:root {
    --felt-green: #0b4a22;
    --felt-dark: #052a12;
    --gold: #d4af37;
    --gold-glow: rgba(212, 175, 55, 0.5);
    --danger: #e74c3c;
    --player-blue: #2980b9;
    --banker-red: #c0392b;
    --tie-green: #27ae60;
    --text-light: #f5f6fa;
    /* Responsive card variables */
    --card-width: 80px;
    --card-height: 112px;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    user-select: none;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

body {
    background: radial-gradient(circle at center, var(--felt-green) 0%, var(--felt-dark) 100%);
    color: var(--text-light);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    overflow-x: hidden; /* Allow vertical scroll if content is tall on mobile */
    touch-action: manipulation;
}

/* --- Responsive Header --- */
header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 20px;
    background: rgba(0, 0, 0, 0.6);
    border-bottom: 2px solid var(--gold);
    box-shadow: 0 4px 15px rgba(0,0,0,0.5);
    z-index: 10;
}

.balance-container h2 {
    font-size: clamp(1rem, 4vw, 1.5rem); /* Scales between 1rem and 1.5rem */
    color: var(--gold);
    text-shadow: 0 0 10px var(--gold-glow);
}

.controls {
    display: flex;
    gap: 5px;
}

.controls button {
    background: linear-gradient(135deg, #444, #222);
    color: white;
    border: 1px solid var(--gold);
    padding: 8px 12px;
    border-radius: 5px;
    cursor: pointer;
    font-weight: bold;
    font-size: 0.8rem;
    transition: all 0.2s;
}

/* --- Game Table Layout --- */
.table {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 20px;
    width: 100%;
}

.hands-container {
    display: flex;
    flex-wrap: wrap; /* Wraps on small screens */
    justify-content: center;
    gap: 20px;
    width: 100%;
    margin-bottom: 20px;
}

.hand-area {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
    max-width: 320px; /* Limits size on desktop */
    min-height: 180px;
    border: 2px dashed rgba(255,255,255,0.2);
    border-radius: 15px;
    padding: 15px;
    position: relative;
    background: rgba(0,0,0,0.1);
}

.hand-title {
    font-size: 1rem;
    text-transform: uppercase;
    letter-spacing: 2px;
    margin-bottom: 5px;
    color: rgba(255,255,255,0.7);
}

.score {
    font-size: 2.5rem;
    font-weight: bold;
    margin-top: 5px;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.5);
    opacity: 0;
    transition: opacity 0.5s ease;
}

.cards {
    display: flex;
    justify-content: center;
    height: var(--card-height);
    width: 100%;
    position: relative;
}

/* --- Responsive Cards --- */
.card {
    width: var(--card-width);
    height: var(--card-height);
    background: white;
    border-radius: 6px;
    position: absolute;
    box-shadow: 2px 2px 10px rgba(0,0,0,0.5);
    transition: all 0.6s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    transform-style: preserve-3d;
}

.card.dealt {
    position: relative;
    margin-left: -35px; /* Overlap effect */
}
.card.dealt:first-child { margin-left: 0; }

.card-inner {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    width: 100%;
    height: 100%;
    padding: 4px;
    background: white;
    border-radius: 6px;
    color: #333;
}

.card-top { align-self: flex-start; font-size: 0.9rem; line-height: 1; }
.card-center { font-size: 2rem; align-self: center; }
.card-bottom { align-self: flex-end; transform: rotate(180deg); font-size: 0.9rem; line-height: 1; }

/* --- Betting Areas (Board) --- */
.betting-board {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    width: 100%;
    max-width: 600px;
    margin: 10px 0;
}

.bet-zone {
    aspect-ratio: 1 / 1; /* Keeps them circular */
    border: 3px solid rgba(255,255,255,0.3);
    border-radius: 50%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    transition: all 0.3s;
    position: relative;
    background: rgba(255,255,255,0.05);
}

.bet-title { font-weight: bold; font-size: clamp(0.7rem, 3vw, 1rem); }
.bet-amount {
    position: absolute;
    bottom: -20px;
    color: var(--gold);
    font-weight: bold;
}

/* --- Chip Rack --- */
.chip-rack {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    padding: 15px;
    background: rgba(0,0,0,0.8);
    border-top: 2px solid #444;
    justify-content: center;
    width: 100%;
}

.chip {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    font-weight: bold;
    font-size: 0.8rem;
    cursor: pointer;
    border: 4px dashed rgba(255,255,255,0.6);
    box-shadow: 0 4px 6px rgba(0,0,0,0.5);
    transition: transform 0.2s;
}

/* --- MOBILE RESPONSIVENESS (Media Queries) --- */
@media (max-width: 600px) {
    :root {
        --card-width: 60px;
        --card-height: 84px;
    }
    
    .hands-container {
        gap: 10px;
    }

    .hand-area {
        max-width: 45%; /* Side by side on small mobile */
        min-height: 140px;
        padding: 10px;
    }

    .score { font-size: 1.8rem; }

    .chip {
        width: 40px;
        height: 40px;
        font-size: 0.7rem;
    }

    .notification {
        width: 90%;
        padding: 20px;
    }
}

/* --- Result Modal & Utilities --- */
.notification {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(0,0,0,0.95);
    border: 2px solid var(--gold);
    padding: 30px;
    border-radius: 10px;
    text-align: center;
    z-index: 1000;
    display: none;
    box-shadow: 0 0 50px black;
}
.notification.active { display: block; }

#shoe-status { 
    text-align: center; 
    font-size: 0.8rem; 
    padding: 5px; 
    color: #888; 
}
/* --- Restored Bet Zone Colors --- */
.bet-zone.player { 
    border-color: var(--player-blue); 
}
.bet-zone.player:hover { 
    box-shadow: 0 0 20px rgba(41, 128, 185, 0.4) inset; 
}

.bet-zone.banker { 
    border-color: var(--banker-red); 
}
.bet-zone.banker:hover { 
    box-shadow: 0 0 20px rgba(192, 57, 43, 0.4) inset; 
}

.bet-zone.tie { 
    border-color: var(--tie-green); 
}
.bet-zone.tie:hover { 
    box-shadow: 0 0 20px rgba(39, 174, 96, 0.4) inset; 
}

/* --- Restored Chip Colors --- */
.chip[data-value="10"] { background-color: #3498db; }
.chip[data-value="25"] { background-color: #2ecc71; }
.chip[data-value="50"] { background-color: #e67e22; }
.chip[data-value="100"] { background-color: #34495e; }
.chip[data-value="500"] { background-color: #9b59b6; }
.chip[data-value="1000"] { background-color: #f1c40f; color: #333; border-color: #333; }
.chip[data-value="ALL"] { background-color: #e74c3c; font-size: 0.7rem; }

/* Highlight the currently selected chip */
.chip.selected {
    transform: scale(1.15) translateY(-5px);
    border-color: var(--gold);
    box-shadow: 0 0 15px var(--gold-glow);
}

/* Specific Suit Colors for Cards */
.card.red { color: var(--danger); }
.card.black { color: #2c3e50; }



/* --- New Action Bar & Main Deal Button --- */
.action-bar {
    width: 100%;
    display: flex;
    justify-content: center;
    padding: 15px 0;
    z-index: 5;
}

.main-deal-btn {
    background: linear-gradient(180deg, var(--gold), #b8860b);
    color: #000;
    border: 2px solid #fff;
    padding: 15px 60px;
    font-size: 1.4rem;
    font-weight: 900;
    border-radius: 50px;
    cursor: pointer;
    letter-spacing: 2px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.4), 0 0 20px var(--gold-glow);
    transition: all 0.2s ease;
    text-transform: uppercase;
}

.main-deal-btn:hover:not(:disabled) {
    transform: scale(1.05);
    box-shadow: 0 6px 20px rgba(0,0,0,0.6), 0 0 30px var(--gold);
}

.main-deal-btn:active:not(:disabled) {
    transform: scale(0.95);
}

.main-deal-btn:disabled {
    background: linear-gradient(180deg, #555, #333);
    color: #777;
    border-color: #444;
    cursor: not-allowed;
    box-shadow: none;
    opacity: 0.6;
}

/* --- Mobile Adjustment for Button --- */
@media (max-width: 600px) {
    .main-deal-btn {
        padding: 12px 40px;
        font-size: 1.1rem;
    }
    .action-bar {
        padding: 10px 0;
    }
}