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

body {
    background: #1a1a2e;
    color: #eee;
    font-family: 'Segoe UI', system-ui, sans-serif;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
}

h1 {
    margin: 16px 0 8px;
    font-size: 1.5rem;
    color: #e0c068;
}

#lobby {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    margin-top: 40px;
}

#lobby select, #lobby input {
    padding: 8px 12px;
    border-radius: 6px;
    border: 1px solid #444;
    background: #2a2a4a;
    color: #eee;
    font-size: 1rem;
}

#lobby button {
    padding: 12px 32px;
    font-size: 1.1rem;
    border: none;
    border-radius: 8px;
    background: #e0c068;
    color: #1a1a2e;
    font-weight: bold;
    cursor: pointer;
    transition: background 0.2s;
}

#lobby button:hover {
    background: #f0d080;
}

#game-area {
    display: none;
    flex-direction: column;
    align-items: center;
    width: 100%;
    max-width: 900px;
    padding: 10px;
}

/* Table */
#table {
    position: relative;
    width: 100%;
    max-width: 800px;
    height: 480px;
    background: radial-gradient(ellipse at center, #2d6a2d 0%, #1a4a1a 70%, #0f2f0f 100%);
    border-radius: 200px;
    border: 12px solid #6b6b6b;
    box-shadow: 0 0 40px rgba(0,0,0,0.5), inset 0 0 60px rgba(0,0,0,0.3);
    margin: 10px 0;
}

#table-text {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 4rem;
    font-weight: bold;
    letter-spacing: 0.5em;
    color: rgba(255, 255, 255, 0.07);
    pointer-events: none;
    user-select: none;
    z-index: 0;
}

/* Card styling */
.card {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 52px;
    height: 74px;
    border-radius: 6px;
    font-size: 1.1rem;
    font-weight: bold;
    margin: 2px;
    box-shadow: 1px 2px 4px rgba(0,0,0,0.4);
    transition: transform 0.3s;
}

.card-front {
    background: #fff;
    color: #333;
}

.card-red {
    color: #d32f2f;
}

.card-black {
    color: #222;
}

.card-back {
    background: linear-gradient(135deg, #3a3a3a 0%, #2a2a2a 50%, #3a3a3a 100%);
    color: transparent;
    border: 2px solid #505050;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.card-back::after {
    content: '';
    display: block;
    width: 36px;
    height: 52px;
    border: 2px solid rgba(255,255,255,0.15);
    border-radius: 4px;
}

/* Player areas */
.player-area {
    position: absolute;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
}

#opponent-area {
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
}

#player-area {
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
}

.player-info {
    display: flex;
    align-items: center;
    gap: 8px;
    background: rgba(0,0,0,0.5);
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 0.9rem;
}

.player-name {
    font-weight: bold;
    color: #e0c068;
}

.player-stack {
    color: #8f8;
}

.player-profit {
    font-size: 0.85rem;
    font-weight: bold;
}

.player-profit.positive {
    color: #4caf50;
}

.player-profit.negative {
    color: #f44336;
}

.player-profit.zero {
    color: #999;
}

.dealer-chip {
    background: #e0c068;
    color: #1a1a2e;
    font-weight: bold;
    font-size: 0.7rem;
    padding: 2px 6px;
    border-radius: 10px;
}

.cards-row {
    display: flex;
    gap: 4px;
}

/* Community cards */
#community-area {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

#community-cards {
    display: flex;
    gap: 6px;
}

#pot-display {
    background: rgba(0,0,0,0.6);
    padding: 4px 16px;
    border-radius: 12px;
    font-size: 1rem;
    color: #e0c068;
    font-weight: bold;
}

/* Bet displays */
.bet-display {
    position: absolute;
    background: rgba(0,0,0,0.5);
    padding: 3px 10px;
    border-radius: 10px;
    font-size: 0.85rem;
    color: #ff9;
}

#opponent-bet {
    top: 140px;
    left: 50%;
    transform: translateX(-50%);
}

#player-bet {
    bottom: 140px;
    left: 50%;
    transform: translateX(-50%);
}

/* Toggle options */
#toggle-options {
    display: flex;
    gap: 16px;
    margin-top: 6px;
}

#toggle-options label {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.85rem;
    color: #aaa;
    cursor: pointer;
    user-select: none;
}

#toggle-options input {
    accent-color: #e0c068;
}

/* Controls */
#controls {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 10px;
    flex-wrap: wrap;
    justify-content: center;
}

.btn {
    padding: 10px 20px;
    font-size: 1rem;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-weight: bold;
    transition: all 0.15s;
    min-width: 80px;
}

.btn:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

.btn:hover:not(:disabled) {
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(0,0,0,0.3);
}

#btn-fold {
    background: #c0392b;
    color: white;
}

#btn-check {
    background: #27ae60;
    color: white;
}

#btn-call {
    background: #2980b9;
    color: white;
}

#btn-raise {
    background: #e67e22;
    color: white;
}

#btn-allin {
    background: #8e44ad;
    color: white;
}

#btn-new-hand {
    background: #e0c068;
    color: #1a1a2e;
    display: none;
}

/* Raise slider */
#raise-controls {
    display: flex;
    align-items: center;
    gap: 8px;
}

#raise-slider {
    width: 120px;
    accent-color: #e67e22;
}


/* Status bar */
#status {
    margin-top: 8px;
    padding: 8px 20px;
    background: rgba(0,0,0,0.4);
    border-radius: 8px;
    font-size: 0.95rem;
    min-height: 36px;
    text-align: center;
}

/* Action log */
#action-log {
    margin-top: 10px;
    width: 100%;
    max-width: 800px;
    max-height: 120px;
    overflow-y: auto;
    background: rgba(0,0,0,0.3);
    border-radius: 8px;
    padding: 8px 12px;
    font-size: 0.85rem;
    color: #aaa;
}

#action-log .log-entry {
    padding: 2px 0;
    border-bottom: 1px solid rgba(255,255,255,0.05);
}

/* Win bubble */
.win-bubble {
    display: none;
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    padding: 5px 14px;
    border-radius: 16px;
    font-size: 0.95rem;
    font-weight: bold;
    z-index: 10;
    white-space: nowrap;
    animation: bubble-pop 0.35s ease-out;
}

#player-win-bubble {
    bottom: 120px;
}

#opponent-win-bubble {
    top: 120px;
}

.win-bubble.won {
    background: rgba(76, 175, 80, 0.9);
    color: #fff;
    box-shadow: 0 2px 12px rgba(76, 175, 80, 0.4);
}

.win-bubble.lost {
    background: rgba(244, 67, 54, 0.9);
    color: #fff;
    box-shadow: 0 2px 12px rgba(244, 67, 54, 0.4);
}

.win-bubble.split {
    background: rgba(255, 152, 0, 0.9);
    color: #fff;
    box-shadow: 0 2px 12px rgba(255, 152, 0, 0.4);
}

@keyframes bubble-pop {
    0% { transform: translateX(-50%) scale(0.5); opacity: 0; }
    70% { transform: translateX(-50%) scale(1.1); }
    100% { transform: translateX(-50%) scale(1); opacity: 1; }
}

/* Pot size presets */
#pot-presets {
    display: flex;
    gap: 4px;
}

#pot-presets button:not(#btn-allin) {
    background: #e67e22;
    color: white;
}

#pot-presets button:not(#btn-allin):hover {
    background: #f39c12;
}

/* Mode selector */
#mode-selector {
    display: flex;
    gap: 20px;
    margin-bottom: 4px;
}

#mode-selector label {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 1rem;
    cursor: pointer;
    user-select: none;
}

#mode-selector input {
    accent-color: #e0c068;
}

/* AvA lobby options */
#ava-options {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
}

#ava-options label {
    display: flex;
    align-items: center;
    gap: 8px;
}

#ava-options input[type="range"] {
    width: 120px;
    accent-color: #e0c068;
}

/* AvA in-game controls */
#ava-controls {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-top: 10px;
}

#ava-controls label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.9rem;
    color: #ccc;
}

#ava-controls input[type="range"] {
    width: 120px;
    accent-color: #e0c068;
}

#btn-pause {
    background: #e0c068;
    color: #1a1a2e;
    min-width: 90px;
}

/* ===== Mobile responsiveness ===== */
@media (max-width: 600px) {
    body {
        padding: 0 4px;
    }

    h1 {
        font-size: 1.1rem;
        margin: 10px 0 4px;
    }

    /* Lobby */
    #lobby {
        margin-top: 20px;
        width: 100%;
        padding: 0 12px;
    }

    #lobby select, #lobby input {
        width: 100%;
    }

    #lobby label {
        display: flex;
        flex-direction: column;
        width: 100%;
        gap: 4px;
    }

    #lobby button {
        width: 100%;
    }

    .stack-info {
        display: block;
        font-size: 0.8rem;
        color: #aaa;
        margin-top: 2px;
    }

    #mode-selector {
        gap: 12px;
    }

    #ava-options label {
        flex-direction: column;
        width: 100%;
    }

    #ava-options select,
    #ava-options input[type="range"] {
        width: 100%;
    }

    /* Table */
    #table {
        height: 300px;
        border-width: 6px;
        border-radius: 100px;
        margin: 6px 0;
    }

    #table-text {
        font-size: 2.5rem;
    }

    /* Cards */
    .card {
        width: 40px;
        height: 58px;
        font-size: 0.9rem;
        border-radius: 5px;
        margin: 1px;
    }

    .card-back::after {
        width: 28px;
        height: 40px;
    }

    .cards-row {
        gap: 2px;
    }

    /* Player areas */
    #opponent-area {
        top: 12px;
    }

    #player-area {
        bottom: 12px;
    }

    .player-info {
        padding: 4px 10px;
        font-size: 0.8rem;
        gap: 6px;
    }

    /* Bet displays */
    #opponent-bet {
        top: 100px;
    }

    #player-bet {
        bottom: 100px;
    }

    .bet-display {
        font-size: 0.8rem;
        padding: 2px 8px;
    }

    /* Win bubbles */
    #player-win-bubble {
        bottom: 90px;
    }

    #opponent-win-bubble {
        top: 90px;
    }

    .win-bubble {
        font-size: 0.85rem;
        padding: 4px 10px;
    }

    /* Community area */
    #community-area {
        gap: 4px;
    }

    #community-cards {
        gap: 3px;
    }

    #pot-display {
        font-size: 0.85rem;
        padding: 3px 10px;
    }

    /* Toggle options */
    #toggle-options {
        gap: 10px;
    }

    #toggle-options label {
        font-size: 0.78rem;
    }

    /* Controls */
    #controls {
        display: grid;
        grid-template-columns: 1fr 1fr 1fr;
        gap: 6px;
        width: 100%;
        padding: 0 4px;
    }

    .btn {
        min-height: 44px;
        min-width: unset;
        width: 100%;
        padding: 8px 4px;
        font-size: 0.9rem;
    }

    #btn-new-hand {
        grid-column: 1 / -1;
    }

    #raise-controls {
        grid-column: 1 / -1;
        display: flex;
        flex-wrap: wrap;
        gap: 6px;
        width: 100%;
    }

    #raise-slider {
        flex: 1;
        min-width: 0;
        width: auto;
    }

    #raise-controls .btn {
        width: auto;
        min-width: 60px;
    }

    #pot-presets {
        width: 100%;
        display: flex;
    }

    #pot-presets button {
        flex: 1;
        padding: 6px 4px;
        font-size: 0.8rem;
        min-width: 0;
    }

    /* AvA controls */
    #ava-controls {
        flex-wrap: wrap;
        justify-content: center;
        gap: 8px;
    }

    #ava-controls input[type="range"] {
        width: 100px;
    }

    /* Status & log */
    #status {
        font-size: 0.85rem;
        padding: 6px 12px;
    }

    #action-log {
        max-height: 80px;
        font-size: 0.78rem;
        padding: 6px 8px;
    }

    /* Game area */
    #game-area {
        padding: 4px;
    }
}
