* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    background: linear-gradient(135deg, #0d7a5c 0%, #119f74 50%, #0d7a5c 100%);
    color: #f7fff8;
    font-family: 'Nunito', 'Segoe UI', 'Helvetica Neue', Arial, sans-serif;
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
}

#app {
    width: 100%;
    max-width: 800px;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

#table {
    background: linear-gradient(180deg, #215642 0%, #153b2e 50%, #215642 100%);
    border: 14px solid #303030;
    box-shadow:
        inset 0 0 80px rgba(0, 0, 0, 0.6),
        0 8px 32px rgba(0, 0, 0, 0.5),
        0 0 0 4px #1a1a1a,
        0 0 0 8px #d4af37;
    border-radius: 160px;
    padding: 48px 38px;
    display: flex;
    flex-direction: column;
    gap: 24px;
    min-height: 560px;
    position: relative;
}

#table::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: radial-gradient(ellipse at center, rgba(255, 215, 0, 0.03) 0%, transparent 70%);
    border-radius: 144px;
    pointer-events: none;
}

#opponent-area,
#player-area {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    transition: transform 0.25s ease, filter 0.25s ease;
    position: relative;
    z-index: 1;
}

#opponent-info,
#player-info {
    display: flex;
    align-items: center;
    gap: 14px;
    background: rgba(0, 0, 0, 0.7);
    padding: 10px 20px;
    border-radius: 25px;
    border: 2px solid rgba(212, 175, 55, 0.3);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.player-name {
    font-weight: 700;
    font-size: 16px;
    letter-spacing: 0.3px;
}

.chip-count {
    background: linear-gradient(180deg, #3a3a3a 0%, #1a1a1a 100%);
    padding: 6px 14px;
    border-radius: 14px;
    font-size: 16px;
    font-weight: 700;
    color: #ffd700;
    border: 2px solid #555;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
    min-width: 70px;
    text-align: center;
}

.chip-count::before {
    content: '$';
    margin-right: 2px;
    opacity: 0.7;
}

.dealer-chip {
    background: linear-gradient(180deg, #ffffff 0%, #e0e0e0 100%);
    color: #000;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    font-weight: bold;
    box-shadow:
        0 3px 6px rgba(0, 0, 0, 0.4),
        inset 0 2px 4px rgba(255, 255, 255, 0.8);
    border: 3px solid #333;
    animation: dealerPulse 2s ease-in-out infinite;
}

@keyframes dealerPulse {
    0%, 100% { box-shadow: 0 3px 6px rgba(0, 0, 0, 0.4), inset 0 2px 4px rgba(255, 255, 255, 0.8); }
    50% { box-shadow: 0 3px 12px rgba(212, 175, 55, 0.6), inset 0 2px 4px rgba(255, 255, 255, 0.8); }
}

#dealer-avatar {
    position: absolute;
    top: -40px;
    left: 50%;
    transform: translateX(-50%);
    pointer-events: none;
    z-index: 10;
}

.dealer-avatar-inner {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
}

.dealer-face {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: radial-gradient(circle at 30% 20%, #fff 0%, #ffe9b3 40%, #c27b33 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 36px;
    box-shadow:
        0 6px 16px rgba(0, 0, 0, 0.6),
        0 0 0 4px rgba(212, 175, 55, 0.5);
}

.dealer-text {
    font-size: 11px;
    letter-spacing: 1px;
    color: rgba(255, 255, 255, 0.7);
    font-weight: 600;
}

.hidden {
    display: none !important;
}

.cards {
    display: flex;
    gap: 12px;
    justify-content: center;
    min-height: 120px;
    perspective: 1000px;
}

.card {
    width: 84px;
    height: 118px;
    background: linear-gradient(180deg, #ffffff 0%, #f8f8f8 100%);
    border-radius: 10px;
    position: relative;
    font-family: 'Georgia', serif;
    box-shadow:
        0 8px 16px rgba(0, 0, 0, 0.45),
        inset 0 1px 0 rgba(255, 255, 255, 0.9);
    border: 1px solid #dcdcdc;
    transform-style: preserve-3d;
}

.card.dealing {
    animation: dealCard 0.4s ease-out forwards;
}

@keyframes dealCard {
    0% {
        transform: translateY(-200px) rotateY(180deg) scale(0.5);
        opacity: 0;
    }
    50% {
        opacity: 1;
    }
    100% {
        transform: translateY(0) rotateY(0deg) scale(1);
        opacity: 1;
    }
}

.card.reveal {
    animation: revealCard 0.5s ease-out forwards;
}

@keyframes revealCard {
    0% {
        transform: rotateY(180deg);
    }
    100% {
        transform: rotateY(0deg);
    }
}

.card.red {
    color: #cc0000;
}

.card.black {
    color: #111;
}

.card-tl {
    position: absolute;
    top: 5px;
    left: 6px;
    text-align: center;
    line-height: 1;
}

.card-br {
    position: absolute;
    bottom: 5px;
    right: 6px;
    text-align: center;
    line-height: 1;
    transform: rotate(180deg);
}

.card-rank {
    font-size: 19px;
    font-weight: bold;
}

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

.card-center {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 40px;
}

.card.back {
    background: linear-gradient(135deg, #274f9c 0%, #1b3c7a 100%);
    border: 2px solid #5c8ad0;
}

.card-back-pattern {
    position: absolute;
    top: 6px;
    left: 6px;
    right: 6px;
    bottom: 6px;
    border: 2px solid rgba(255, 255, 255, 0.25);
    border-radius: 4px;
    background:
        repeating-linear-gradient(
            45deg,
            transparent,
            transparent 4px,
            rgba(255, 255, 255, 0.05) 4px,
            rgba(255, 255, 255, 0.05) 8px
        ),
        repeating-linear-gradient(
            -45deg,
            transparent,
            transparent 4px,
            rgba(255, 255, 255, 0.03) 4px,
            rgba(255, 255, 255, 0.03) 8px
        );
}

.card-back-pattern::after {
    content: '♠';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 24px;
    color: rgba(255, 255, 255, 0.15);
}

.card-slot {
    width: 84px;
    height: 118px;
    border: 2px dashed rgba(255, 255, 255, 0.22);
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.03);
}

#board {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
    padding: 16px 0;
    position: relative;
    z-index: 1;
}

#stage-indicator {
    font-size: 15px;
    letter-spacing: 2px;
    color: #ffefaa;
    font-weight: 700;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
}

#pot-area {
    display: flex;
    align-items: center;
    gap: 14px;
    background: rgba(0, 0, 0, 0.6);
    padding: 14px 28px;
    border-radius: 30px;
    border: 2px solid rgba(212, 175, 55, 0.4);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
}

.pot-coin {
    width: 40px;
    height: 40px;
    background: linear-gradient(135deg, #ffd700 0%, #ffaa00 50%, #ffd700 100%);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    font-weight: bold;
    color: #8B6914;
    box-shadow:
        0 4px 8px rgba(0, 0, 0, 0.5),
        inset 0 3px 6px rgba(255, 255, 255, 0.4),
        inset 0 -3px 6px rgba(0, 0, 0, 0.2);
    border: 3px solid #cc9900;
    text-shadow: 0 1px 1px rgba(255, 255, 255, 0.3);
    animation: coinShine 3s ease-in-out infinite;
}

@keyframes coinShine {
    0%, 100% { transform: rotateY(0deg); }
    50% { transform: rotateY(15deg); }
}

.pot-label {
    font-size: 13px;
    letter-spacing: 1.5px;
    color: rgba(255, 255, 255, 0.75);
}

.pot-amount {
    font-size: 32px;
    font-weight: 700;
    color: #ffd700;
    text-shadow: 0 2px 6px rgba(0, 0, 0, 0.6);
    min-width: 60px;
}

.pot-amount::before {
    content: '$';
    font-size: 20px;
    opacity: 0.7;
    margin-right: 2px;
}

.pot-amount.growing {
    animation: potGrow 0.3s ease-out;
}

@keyframes potGrow {
    0% { transform: scale(1); }
    50% { transform: scale(1.15); color: #fff; }
    100% { transform: scale(1); }
}

#opponent-area.active,
#player-area.active {
    filter: drop-shadow(0 0 20px rgba(212, 175, 55, 0.5));
    transform: translateY(-4px);
}

#player-area.active #player-info {
    border-color: rgba(212, 175, 55, 0.7);
}

#opponent-area.active #opponent-info {
    border-color: rgba(212, 175, 55, 0.7);
}

#opponent-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    max-width: 540px;
}

#opponent-action {
    min-height: 36px;
    text-align: right;
}

.bet-display {
    min-height: 32px;
    font-size: 18px;
    color: #ffd700;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.bet-display:not(:empty) {
    background: rgba(0, 0, 0, 0.5);
    padding: 6px 16px;
    border-radius: 16px;
    border: 1px solid rgba(212, 175, 55, 0.3);
}

.bet-display:not(:empty)::before {
    content: 'Bet: $';
    color: rgba(255, 255, 255, 0.6);
    font-weight: 400;
}

.bet-display.betting {
    animation: chipMove 0.4s ease-out;
}

@keyframes chipMove {
    0% { transform: translateY(20px); opacity: 0; }
    100% { transform: translateY(0); opacity: 1; }
}

.hand-rank {
    font-size: 18px;
    font-weight: 600;
    color: #5f5;
    min-height: 28px;
    letter-spacing: 1px;
    text-shadow: 0 0 12px rgba(85, 255, 85, 0.5);
    padding: 8px 20px;
    background: rgba(0, 255, 0, 0.1);
    border-radius: 20px;
    border: 1px solid rgba(85, 255, 85, 0.25);
}

.hand-rank:empty {
    background: none;
    border: none;
}

#player-hand-rank {
    font-size: 20px;
}

#opponent-hand-rank {
    font-size: 16px;
}

#game-message {
    text-align: center;
    font-size: 22px;
    font-weight: 600;
    min-height: 44px;
    padding: 12px 24px;
    background: rgba(0, 0, 0, 0.35);
    border-radius: 14px;
    border: 1px solid rgba(255, 255, 255, 0.12);
    display: flex;
    align-items: center;
    justify-content: center;
}

#game-message.thinking {
    color: #aaa;
    animation: pulse 1.2s ease-in-out infinite;
}

#game-message.win {
    color: #4f4;
    background: rgba(68, 255, 68, 0.15);
    text-shadow: 0 0 12px rgba(68, 255, 68, 0.5);
    border-color: rgba(68, 255, 68, 0.3);
    animation: winCelebrate 0.5s ease-out;
}

@keyframes winCelebrate {
    0% { transform: scale(1); }
    50% { transform: scale(1.05); }
    100% { transform: scale(1); }
}

#game-message.loss {
    color: #f66;
    background: rgba(255, 102, 102, 0.15);
    border-color: rgba(255, 102, 102, 0.3);
}

#game-message.turn {
    color: #fff;
    background: rgba(100, 150, 255, 0.2);
    border-color: rgba(100, 150, 255, 0.3);
}

#game-message.action {
    color: #ffd700;
    font-weight: 600;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

.opponent-action-badge {
    display: inline-block;
    padding: 10px 20px;
    background: rgba(255, 193, 112, 0.18);
    border: 2px solid #ffb347;
    border-radius: 20px;
    color: #ffb347;
    font-size: 14px;
    font-weight: 700;
    letter-spacing: 1px;
    animation: actionPop 0.35s ease-out;
    box-shadow: 0 0 16px rgba(255, 165, 0, 0.35);
}

@keyframes actionPop {
    0% { transform: scale(0.7); opacity: 0; }
    70% { transform: scale(1.1); }
    100% { transform: scale(1); opacity: 1; }
}

#bottom-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
}

#controls {
    display: flex;
    gap: 12px;
    justify-content: center;
    flex: 1;
    flex-wrap: wrap;
}

#controls button,
#bet-options,
#play-again,
#guide-toggle {
    font-family: inherit;
    border-radius: 12px;
    padding: 14px 18px;
    font-size: 16px;
    font-weight: 700;
    border: none;
    cursor: pointer;
    transition: all 0.2s ease;
}

#check-btn {
    background: linear-gradient(180deg, #6ee7b7 0%, #3fcf99 100%);
    color: #0f2d1f;
    box-shadow: 0 6px 14px rgba(63, 207, 153, 0.35);
}

#bet-btn {
    background: linear-gradient(180deg, #ffd166 0%, #f7a81b 100%);
    color: #4a2c00;
    box-shadow: 0 6px 14px rgba(247, 168, 27, 0.35);
}

#fold-btn {
    background: linear-gradient(180deg, #ff9f9f 0%, #ff6b6b 100%);
    color: #3d0a0a;
    box-shadow: 0 6px 14px rgba(255, 107, 107, 0.35);
}

#controls button:disabled {
    opacity: 0.55;
    cursor: not-allowed;
    box-shadow: none;
}

.bet-group {
    display: flex;
    gap: 10px;
    align-items: center;
}

#bet-options {
    min-width: 170px;
    background: linear-gradient(180deg, #1f1f1f 0%, #161616 100%);
    color: #f2f2f2;
    border: 2px solid #3b3b3b;
}

#bet-options:disabled {
    opacity: 0.55;
    cursor: not-allowed;
}

#bet-options:not(:disabled):focus {
    outline: none;
    border-color: #ffd166;
    box-shadow: 0 0 0 3px rgba(255, 209, 102, 0.25);
}

.aux-actions {
    display: flex;
    gap: 12px;
}

#play-again {
    background: linear-gradient(180deg, #7dd3fc 0%, #38bdf8 100%);
    color: #06283b;
    box-shadow: 0 6px 14px rgba(56, 189, 248, 0.35);
}

#guide-toggle {
    background: rgba(0, 0, 0, 0.5);
    border: 1px solid #5e5e5e;
    color: #e6e6e6;
    padding: 12px 20px;
    font-family: inherit;
    font-size: 14px;
    border-radius: 10px;
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.2s ease;
}

#guide-toggle:hover {
    border-color: #8a8a8a;
    color: #fff;
    background: rgba(0, 0, 0, 0.65);
}

#guide-toggle {
    background: rgba(0, 0, 0, 0.5);
    border: 1px solid #555;
    color: #ccc;
    padding: 12px 20px;
    font-family: inherit;
    font-size: 13px;
    border-radius: 8px;
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.2s ease;
}

#guide-toggle:hover {
    border-color: #777;
    color: #fff;
    background: rgba(0, 0, 0, 0.7);
}

#guide {
    background: linear-gradient(180deg, #1a1a1a 0%, #111 100%);
    border: 1px solid #444;
    border-radius: 12px;
    padding: 28px;
    font-size: 14px;
    line-height: 1.7;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
}

#guide h2 {
    font-size: 18px;
    margin-bottom: 24px;
    color: #d4af37;
    font-weight: 600;
    letter-spacing: 1px;
}

#guide h3 {
    font-size: 14px;
    margin: 20px 0 10px 0;
    color: #fff;
    font-weight: 600;
}

#guide p {
    color: #aaa;
    margin-bottom: 10px;
}

#guide ul, #guide ol {
    color: #aaa;
    padding-left: 24px;
    margin-bottom: 10px;
}

#guide li {
    margin-bottom: 6px;
}

#guide b {
    color: #ffd700;
}

@media (max-width: 600px) {
    body {
        padding: 10px;
    }

    #table {
        padding: 30px 20px;
        border-radius: 100px;
        border-width: 10px;
    }

    .card {
        width: 70px;
        height: 98px;
    }

    .card-slot {
        width: 70px;
        height: 98px;
    }

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

    .card-suit {
        font-size: 14px;
    }

    .card-center {
        font-size: 32px;
    }

    #bottom-bar {
        flex-direction: column;
    }

    #controls {
        width: 100%;
    }

    #action-select {
        max-width: none;
    }
}
