body {
    font-family: 'Arial', sans-serif;
    background-color: #1a1a1a; /* Fallback color */
    color: #fff;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    margin: 0;
    padding: 10px;
    box-sizing: border-box;
    background-image: url('./table_felt.png'); /* Poker room background */
    background-size: cover;
    background-position: center;
    background-attachment: fixed; /* Keeps background stationary on scroll */
}

#game-container {
    display: flex;
    justify-content: center;
    align-items: center;
    width: 100%;
    max-width: 1000px; /* Max width of the game area */
}

#game-table {
    background: radial-gradient(ellipse at center, #007a00 10%, #005200 90%); /* Felt green with subtle lighting */
    border-radius: 150px / 75px; /* Elliptical border for table shape */
    padding: 30px;
    box-shadow: 
        0 20px 50px rgba(0,0,0,0.6), /* Outer shadow for lift and depth */
        inset 0 3px 8px rgba(0,0,0,0.4), /* Inner shadow for felt depression */
        inset 0 -3px 5px rgba(0,0,0,0.2), /* Inner bottom shadow for curvature */
        0 0 0 8px #3a200c; /* Dark wood-like border */
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px; /* Spacing between player areas */
    width: 92%;
    min-height: 600px; /* Minimum height */
    position: absolute; /* For potential absolute positioned elements like animation-overlay & mute button */
    top: 2px;
}

.mute-button {
    position: absolute;
    top: 20px; /* Adjusted for padding and border of game-table */
    right: 30px; /* Adjusted for padding and border of game-table */
    background: rgba(0,0,0,0.5);
    border: 2px solid #ffd700;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    padding: 7px; /* Padding around the icon inside the button */
    cursor: pointer;
    z-index: 150; /* Above most elements but potentially below modals */
    display: flex;
    justify-content: center;
    align-items: center;
    box-sizing: border-box;
}
.mute-button img {
    width: 100%;
    height: 100%;
    display: block;
    object-fit: contain;
}
.mute-button:hover {
    background: rgba(0,0,0,0.7);
    border-color: #fff;
}

#animation-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none; /* Allows clicks to go through to elements behind it */
    overflow: hidden; /* Ensures exploding chips don't make scrollbars if they go outside table bounds visually */
    z-index: 100; /* Above cards, below modals if any */
}

.blackjack-text-animation {
    position: absolute;
    left: 50%;
    top: 40%; /* Start a bit higher than pure center */
    transform: translateX(-50%) translateY(-50%);
    font-size: clamp(3em, 10vw, 6em); /* Responsive font size */
    color: gold;
    text-shadow: 0 0 5px black, 0 0 10px black, 0 0 15px #ff0, 2px 2px 3px rgba(0,0,0,0.7);
    font-weight: bold;
    font-family: 'Impact', Haettenschweiler, 'Arial Narrow Bold', sans-serif;
    opacity: 0;
    animation: floatUpFadeOut 2s ease-out forwards;
    z-index: 101; /* Above other elements in overlay */
}

.win-amount-text {
    position: absolute;
    left: 50%;
    top: 55%; /* Positioned below the "BLACKJACK!" text (which is top: 40%) */
    transform: translateX(-50%) translateY(-50%); /* Initial centering before animation movement */
    font-size: clamp(2.5em, 8vw, 4.5em); /* Large, but potentially a bit smaller than "BLACKJACK!" */
    color: #60FF00; /* Bright green */
    text-shadow: 0 0 4px black, 0 0 8px rgba(0,0,0,0.7), 1px 1px 2px rgba(0,0,0,0.5);
    font-weight: bold;
    font-family: 'Impact', Haettenschweiler, 'Arial Narrow Bold', sans-serif;
    opacity: 0; /* Start invisible */
    animation: floatUpWinAmountAnimation 2s ease-out forwards;
    z-index: 101; /* Same visual layer as Blackjack text, relies on positioning */
}

@keyframes floatUpFadeOut {
    0% {
        opacity: 0;
        transform: translateX(-50%) translateY(0%); /* Start lower */
    }
    20% {
        opacity: 1;
    }
    50% {
        opacity: 1;
        transform: translateX(-50%) translateY(-60%); /* Peak height */
    }
    100% {
        opacity: 0;
        transform: translateX(-50%) translateY(-120%); /* Float further up */
    }
}

@keyframes floatUpWinAmountAnimation {
    0% {
        opacity: 0;
        transform: translateX(-50%) translateY(0%); /* Starts effectively at top:55% (its defined top) */
    }
    20% {
        opacity: 1;
    }
    60% {
        opacity: 1;
        transform: translateX(-50%) translateY(-80%); /* Float up; adjust numbers for desired height */
    }
    100% {
        opacity: 0;
        transform: translateX(-50%) translateY(-150%); /* Float further up and fade */
    }
}

.exploding-chip {
    position: absolute;
    width: 40px; /* Match bet chip size or slightly larger for effect */
    height: 40px;
    background-size: contain;
    background-repeat: no-repeat;
    opacity: 0;
    animation: chipExplode 1.5s cubic-bezier(0.1, 0.8, 0.7, 1) forwards; /* Ease-out like explosion */
    z-index: 100;
}

@keyframes chipExplode {
    0% {
        opacity: 0;
        transform: scale(0.3) translate(0, 0) rotate(0deg);
    }
    20% { /* Initial burst appearance */
        opacity: 1;
        transform: scale(1.1) translate(var(--tx-mid), var(--ty-mid)) rotate(var(--rotate-mid));
    }
    100% { /* Fly out and fade */
        opacity: 0;
        transform: scale(0.5) translate(var(--tx-end), var(--ty-end)) rotate(var(--rotate-end));
    }
}

.player-area {
    background-color: rgba(0, 0, 0, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 10px;
    padding: 10px;
    min-height: 120px; /* Height for cards */
    width: 80%;
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;
}

.area-label {
    font-weight: bold;
    margin-bottom: 8px;
    color: #ffd700; /* Gold color for labels */
}

.score {
    font-weight: normal;
    color: #fff;
}

.cards-area {
    display: flex;
    gap: 5px; /* Spacing between cards */
    justify-content: center;
    align-items: center;
    flex-wrap: wrap; /* Allow cards to wrap if many */
    min-height: 75px; /* Standard card height approx + little margin for animation */
    perspective: 1000px; /* For 3D effects on cards if added later */
}

.card {
    background-color: white;
    border: 1px solid #333;
    border-radius: 5px;
    width: 50px;
    height: 70px;
    display: flex;
    flex-direction: column;
    justify-content: space-between; /* For rank top/bottom */
    align-items: center;
    padding: 3px;
    font-family: 'Georgia', serif;
    font-weight: bold;
    box-shadow: 2px 2px 5px rgba(0,0,0,0.3);
    position: relative; /* For internal positioning */
    opacity: 1;
    transform: translateY(0) scale(1);
    transition: opacity 0.3s ease-out, transform 0.3s ease-out;
}

.card.animate-in-start {
    opacity: 0;
    transform: translateY(15px) scale(0.95);
}

.card.facedown {
    background-image: url('./card_back.png');
    background-size: cover;
    background-position: center;
}

.card .rank {
    font-size: 16px;
}

.card .suit-icon {
    width: 20px; /* Main suit icon in center */
    height: 20px;
}

.card.suit-red .rank { color: #D00000; }
.card.suit-black .rank { color: #000; }

.card-content {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: center; /* Center main suit */
    align-items: center;
    position: relative; /* For corner elements */
}

.card-corner {
    position: absolute;
    font-size: 10px;
    display: flex;
    flex-direction: column;
    align-items: center;
}
.card-corner .rank { font-size: 12px; }
.card-corner .suit-icon-small { width: 8px; height: 8px; }

.top-left { top: 3px; left: 3px; }
.bottom-right { bottom: 3px; right: 3px; transform: rotate(180deg); } /* Rotate for bottom right */

#opponents-row {
    display: flex;
    justify-content: space-around;
    width: 90%;
    gap: 15px;
}

.opponent-area {
    width: 45%; /* Two opponents side-by-side */
    min-height: 100px; /* Slightly smaller than player/dealer */
}

#ui-area {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 15px;
    padding: 10px;
    background-color: rgba(0,0,0,0.3);
    border-radius: 8px;
    width: 80%;
}

#betting-controls, #game-controls {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    align-items: center;
    gap: 10px;
}
#bet-buttons-container {
    display: flex;
    gap: 5px;
    align-items: center;
}

.chip-info {
    font-size: 1em;
    padding: 5px 10px;
    background-color: rgba(255,255,255,0.1);
    border-radius: 5px;
}

.action-button, .bet-button {
    padding: 10px 15px;
    font-size: 1em;
    font-weight: bold;
    border-radius: 5px;
    border: none;
    cursor: pointer;
    transition: background-color 0.2s, transform 0.1s;
    background-color: #ffd700; /* Gold */
    color: #333;
}
.action-button:hover, .bet-button:hover {
    background-color: #ffec80; /* Lighter gold */
}
.action-button:active, .bet-button:active {
    transform: scale(0.95);
}
.action-button:disabled {
    background-color: #555;
    color: #888;
    cursor: not-allowed;
}

.chip-button {
    background-color: transparent;
    border: none;
    padding: 0;
}
.chip-button img {
    width: 40px; /* Adjust size of chip images */
    height: 40px;
    transition: transform 0.1s;
}
.chip-button:hover img {
    transform: scale(1.1);
}
.chip-button:active img {
    transform: scale(0.9);
}

#message-area {
    margin-top: 10px;
    padding: 10px 20px;
    background-color: rgba(0,0,0,0.6);
    border-radius: 5px;
    font-size: 1.1em;
    text-align: center;
    min-height: 2em; /* Ensure space for messages */
    width: 70%;
    color: #fff;
    border: 1px solid #ffd700;
}

.status-badge {
    position: absolute;
    top: 5px;
    right: 5px;
    background-color: #d00000; /* Red for BUST */
    color: white;
    padding: 3px 7px;
    font-size: 0.8em;
    border-radius: 3px;
    font-weight: bold;
}
.status-badge.blackjack { background-color: #008000; /* Green for BLACKJACK */ }
.status-badge.push { background-color: #808080; /* Gray for PUSH */ }
.status-badge.win { background-color: #006400; /* Dark Green for WIN */ }

.card.facedown::before {
    content: ""; /* Placeholder if image fails */
    color: #ccc;
    font-size: 10px;
}