:root {
    --primary: #ffd700;
    /* Gold */
    --secondary: #c90000;
    /* Casino Red */
    --accent: #2e7d32;
    /* Felt Green */
    --bg-dark: #0f0f0f;
    --text: #ffffff;
    --card-bg: #ffffff;
    --chip-shadow: 0 4px 6px rgba(0, 0, 0, 0.4);
    --glass: rgba(20, 20, 20, 0.85);
    --glass-border: rgba(255, 215, 0, 0.3);
}

.hidden {
    display: none !important;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Roboto', sans-serif;
}

body {
    background: radial-gradient(circle at center, #1a1a1a 0%, #000000 100%);
    color: var(--text);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    font-size: 16px;
}

.glass-container {
    background: rgba(10, 10, 10, 0.9);
    border: 1px solid var(--glass-border);
    border-radius: 20px;
    padding: 2rem;
    width: 100%;
    max-width: 1000px;
    box-shadow: 0 0 50px rgba(0, 0, 0, 0.8), inset 0 0 100px rgba(0, 0, 0, 0.5);
    position: relative;
    /* overflow: hidden; Removed to prevent clipping of child elements */
    margin: 10px;
}

/* Header & Nav */
header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    /* Allow wrapping on smaller screens */
    gap: 1rem;
    /* Add gap for better spacing when wrapped */
    margin-bottom: 2rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid rgba(255, 215, 0, 0.2);
}

.glow-text {
    font-family: 'Orbitron', sans-serif;
    font-size: 2rem;
    background: linear-gradient(to bottom, #ffd700, #b8860b);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    text-shadow: 0 0 15px rgba(255, 215, 0, 0.3);
    letter-spacing: 2px;
}

.game-nav {
    display: flex;
    gap: 0.5rem;
    background: rgba(0, 0, 0, 0.3);
    padding: 5px;
    border-radius: 12px;
    overflow-x: auto;
    max-width: 100%;
    scrollbar-width: thin;
    scrollbar-color: var(--primary) transparent;
    -ms-overflow-style: none;
    /* Hide scrollbar for IE/Edge */
}

.game-nav::-webkit-scrollbar {
    height: 4px;
}

.game-nav::-webkit-scrollbar-track {
    background: transparent;
}

.game-nav::-webkit-scrollbar-thumb {
    background: var(--primary);
    border-radius: 10px;
}

.nav-btn {
    background: transparent;
    border: none;
    color: #888;
    padding: 0.6rem 1.2rem;
    border-radius: 8px;
    cursor: pointer;
    font-family: 'Orbitron', sans-serif;
    font-size: 0.85rem;
    transition: all 0.3s ease;
    text-transform: uppercase;
    font-weight: bold;
    white-space: nowrap;
}

.nav-btn:hover {
    color: var(--primary);
}

.nav-btn.active {
    background: linear-gradient(135deg, var(--primary) 0%, #b8860b 100%);
    color: #000;
    box-shadow: 0 0 15px rgba(255, 215, 0, 0.4);
}

.user-stats {
    background: rgba(0, 0, 0, 0.5);
    padding: 0.5rem 1.5rem;
    border-radius: 50px;
    border: 1px solid var(--glass-border);
    min-width: 180px;
}

.user-stats .value {
    font-family: 'Orbitron', sans-serif;
    color: #4caf50;
    font-weight: bold;
    font-size: 1.4rem;
    text-shadow: 0 0 5px rgba(76, 175, 80, 0.5);
}

/* Slot Machine Enhanced */
.slot-machine {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 3rem;
    background: linear-gradient(135deg, #1a1a1a, #0d0d0d);
    padding: 4rem;
    border-radius: 30px;
    border: 1px solid rgba(255, 215, 0, 0.3);
    box-shadow:
        0 0 80px rgba(0, 0, 0, 0.9),
        inset 0 0 50px rgba(0, 0, 0, 0.8),
        0 0 20px rgba(255, 215, 0, 0.1);
    position: relative;
    overflow: hidden;
}

/* Glass Reflection Overlay */
.slot-machine::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: linear-gradient(45deg,
            rgba(255, 255, 255, 0) 0%,
            rgba(255, 255, 255, 0.03) 45%,
            rgba(255, 255, 255, 0.1) 50%,
            rgba(255, 255, 255, 0.03) 55%,
            rgba(255, 255, 255, 0) 100%);
    transform: rotate(30deg);
    pointer-events: none;
}

.reels {
    display: flex;
    gap: 20px;
    padding: 20px;
    background: #000;
    border-radius: 20px;
    border: 4px solid #444;
    box-shadow: inset 0 0 30px #000;
    position: relative;
}

.reels::after {
    /* Shadow overlay on top and bottom of reels for depth */
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(to bottom,
            rgba(0, 0, 0, 0.8) 0%,
            rgba(0, 0, 0, 0) 20%,
            rgba(0, 0, 0, 0) 80%,
            rgba(0, 0, 0, 0.8) 100%);
    pointer-events: none;
    border-radius: 15px;
    z-index: 5;
}

.reel {
    width: 140px;
    height: 180px;
    background: linear-gradient(to bottom, #f5f5f5 0%, #ffffff 50%, #e0e0e0 100%);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 6rem;
    color: #333;
    border: 2px solid #333;
    box-shadow: inset 0 0 15px rgba(0, 0, 0, 0.3);
    overflow: hidden;
    position: relative;
    background-clip: padding-box;
}

/* --- Mobile Responsiveness Overhaul --- */
@media (max-width: 768px) {
    body {
        padding: 0;
        align-items: flex-start;
    }

    .glass-container {
        padding: 1rem;
        margin: 0;
        border-radius: 0;
        min-height: 100vh;
        max-width: 100%;
    }

    header {
        flex-direction: column;
        gap: 1rem;
        text-align: center;
    }

    .glow-text {
        font-size: 1.5rem;
    }

    .game-nav {
        width: 100%;
        overflow-x: auto;
        justify-content: flex-start;
        padding: 5px;
        -webkit-overflow-scrolling: touch;
    }

    .nav-btn {
        padding: 0.6rem 1rem;
        font-size: 0.75rem;
        white-space: nowrap;
    }

    /* Slots scaling */
    .reels {
        gap: 10px;
        padding: 10px;
        border-width: 2px;
    }

    .reel {
        width: 28vw;
        height: 40vw;
        max-width: 100px;
        max-height: 140px;
        font-size: 2.5rem;
    }

    /* Blackjack scaling */
    .bj-table {
        transform: scale(0.9);
        transform-origin: top center;
        margin-bottom: -10%;
        /* Compensate for scale shrinkage */
        padding: 20px 5px;
    }

    .bj-seats {
        flex-wrap: wrap;
        justify-content: center;
    }

    .bj-seat {
        min-width: 80px;
        font-size: 0.8rem;
    }

    /* Roulette scaling */
    .roulette-container {
        padding: 10px;
        border-width: 6px;
        border-radius: 20px;
    }

    .wheel-area {
        width: 80vw;
        height: 80vw;
        max-width: 320px;
        max-height: 320px;
        border-width: 8px;
    }

    .table-area {
        padding: 10px;
        width: 100%;
    }

    .roulette-grid-wrapper {
        width: 100%;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        padding-bottom: 10px;
    }

    .roulette-grid {
        grid-template-columns: 50px repeat(12, 45px);
        grid-template-rows: repeat(3, 45px);
    }

    .grid-cell {
        font-size: 0.9rem;
    }

    .outside-bets {
        display: grid;
        grid-template-columns: repeat(2, 1fr);
        gap: 8px;
    }

    .bet-node {
        padding: 10px;
        font-size: 0.7rem;
    }

    .chip-selection {
        gap: 8px;
        padding: 10px;
        flex-wrap: wrap;
        justify-content: center;
    }

    .chip {
        width: 40px !important;
        height: 40px !important;
        font-size: 0.7rem !important;
    }

    /* Trading refined for mobile */
    .trading-container {
        grid-template-columns: 1fr;
    }

    .stock-item {
        padding: 10px;
    }

    .stock-price {
        font-size: 1rem;
    }

    .stock-info h3 {
        font-size: 0.9rem;
    }
}

@media (max-width: 400px) {
    .bj-table {
        transform: scale(0.75);
    }

    .reel {
        font-size: 2rem;
    }
}

/* --- Stock Details & P/L --- */
.stock-item {
    cursor: pointer;
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
}

.stock-main-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.stock-details {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease-out;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 5px;
    margin-top: 5px;
}

.stock-item.expanded .stock-details {
    max-height: 200px;
    padding: 10px;
}

.detail-chart {
    width: 100%;
    height: 100px;
}

.pl-indicator {
    font-size: 0.9em;
    font-weight: bold;
    margin-left: 10px;
}

.pl-profit {
    color: #00e676;
}

.pl-loss {
    color: #ff5252;
}

.purchase-info {
    font-size: 0.8rem;
    opacity: 0.6;
    margin-top: 5px;
}

/* --- Blackjack Multiplayer UI (Design-Safe) --- */
.bj-mode-selector {
    display: flex;
    justify-content: center;
    gap: 15px;
    margin-bottom: 20px;
}

.bj-seats {
    display: flex;
    justify-content: space-around;
    gap: 15px;
    margin: 10px 0;
    width: 100%;
}

.bj-seat {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 8px;
    padding: 8px;
    min-width: 100px;
    text-align: center;
    border: 2px solid transparent;
    transition: all 0.3s;
}

.bj-seat.active {
    border-color: #ffd700;
    box-shadow: 0 0 10px rgba(255, 215, 0, 0.2);
}

.bj-seat .username {
    font-size: 0.7rem;
    color: #4facfe;
    font-weight: bold;
    margin-bottom: 4px;
}

.multi-info {
    color: #ffd700;
    font-family: 'Orbitron', sans-serif;
    font-size: 0.8rem;
    margin-bottom: 10px;
}

.solo-only.hidden {
    display: none !important;
}

.handSmall {
    display: flex;
    justify-content: center;
    gap: -15px;
    min-height: 50px;
}

.handSmall .card {
    transform: scale(0.5);
    margin-left: -20px;
}

/* --- Trading Styles --- */
.trading-container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 30px;
    height: 100%;
}

.market-view,
.portfolio-view {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 15px;
    padding: 20px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    flex-direction: column;
}

.stock-list,
.portfolio-list {
    flex: 1;
    overflow: visible;
    /* Disable all internal scrolling per user request */
    overflow-x: hidden;
    /* Explicitly prevent horizontal scroll */
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.stock-item,
.portfolio-item {
    background: rgba(0, 0, 0, 0.3);
    border-radius: 10px;
    padding: 15px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: transform 0.2s;
}

.stock-item:hover {
    transform: scale(1.02);
    background: rgba(255, 255, 255, 0.1);
}

.stock-info h3 {
    margin: 0;
    font-size: 1.1em;
    color: #4facfe;
    display: flex;
    align-items: center;
    gap: 8px;
}

.stock-info p {
    margin: 5px 0 0;
    font-size: 0.8em;
    opacity: 0.6;
    font-style: italic;
    color: #ffd700;
}

.stock-price {
    font-family: 'Orbitron', sans-serif;
    font-weight: bold;
    font-size: 1.2em;
    transition: color 0.3s;
}

.stock-sparkline {
    width: 60px;
    height: 30px;
    margin: 0 15px;
}

.sparkline-path {
    fill: none;
    stroke: #4facfe;
    stroke-width: 2;
    stroke-linecap: round;
}

.price-up {
    color: #00e676 !important;
}

.price-down {
    color: #ff5252 !important;
}

.trading-actions {
    display: flex;
    gap: 10px;
}

.trade-btn {
    padding: 8px 15px;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-family: 'Orbitron', sans-serif;
    font-weight: bold;
    transition: all 0.3s;
}

.buy-btn {
    background: linear-gradient(135deg, #00b09b, #96c93d);
    color: white;
}

.sell-btn {
    background: linear-gradient(135deg, #f85032, #e73827);
    color: white;
}

.trade-btn:hover {
    filter: brightness(1.2);
    box-shadow: 0 0 10px rgba(255, 255, 255, 0.2);
}

/* Blackjack Table - Enhanced Felt */
.bj-table {
    background: radial-gradient(circle, #357a38 0%, #1b5e20 100%);
    /* Casino Green Felt */
    border: 15px solid #3e2723;
    /* Dark Wood */
    border-radius: 200px 200px 20px 20px;
    padding: 4rem 3rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2rem;
    min-height: 550px;
    position: relative;
    box-shadow:
        inset 0 0 100px rgba(0, 0, 0, 0.6),
        0 20px 50px rgba(0, 0, 0, 0.5);
}

/* Felt Pattern Overlay */
.bj-table::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-image: url("data:image/svg+xml,%3Csvg width='100' height='100' viewBox='0 0 100 100' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.8' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)' opacity='0.05'/%3E%3C/svg%3E");
    pointer-events: none;
    border-radius: 185px 185px 5px 5px;
}

.center-text {
    position: absolute;
    top: 45%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: rgba(255, 255, 255, 0.15);
    font-family: 'Orbitron', sans-serif;
    font-size: 1.5rem;
    font-weight: 900;
    pointer-events: none;
    text-align: center;
    letter-spacing: 2px;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
    border: 2px solid rgba(255, 255, 255, 0.1);
    padding: 10px 30px;
    border-radius: 50px;
}

/* Areas */
.dealer-area,
.player-area {
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    z-index: 2;
    min-height: 140px;
}

.hand {
    display: flex;
    justify-content: center;
    height: 120px;
    perspective: 1000px;
}

/* Cards - Realistic Style */
.card {
    width: 90px;
    height: 130px;
    background-color: white;
    border-radius: 8px;
    position: relative;
    box-shadow: 2px 2px 8px rgba(0, 0, 0, 0.4);
    margin-left: -40px;
    /* Overlapping */
    transition: transform 0.3s;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: 8px;
    font-family: 'Roboto', sans-serif;
    font-weight: bold;
    font-size: 1.4rem;
    color: #222;
}

.card:first-child {
    margin-left: 0;
}

.card:hover {
    transform: translateY(-20px) rotate(2deg) !important;
    z-index: 10;
}

.card.red {
    color: #d32f2f;
}

.card.back {
    background: repeating-linear-gradient(45deg,
            #1a237e,
            #1a237e 10px,
            #283593 10px,
            #283593 20px);
    border: 4px solid white;
}

.card div:nth-child(2) {
    font-size: 2.5rem;
    align-self: center;
}

/* Score Badges - High Visibility */
.score-badge {
    background: #000;
    color: #fff;
    padding: 5px 15px;
    border-radius: 4px;
    font-family: 'Orbitron', sans-serif;
    font-size: 1.2rem;
    font-weight: bold;
    border: 1px solid #444;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.5);
    min-width: 50px;
    text-align: center;
    margin-bottom: 5px;
}

/* Betting Chips - 3D Style */
.bj-controls {
    margin-top: auto;
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    z-index: 5;
}

.chips-row {
    display: flex;
    gap: 15px;
    margin-bottom: 1.5rem;
    padding: 10px;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 50px;
}

.chip {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 900;
    font-size: 0.9rem;
    cursor: pointer;
    border: 5px dashed white;
    box-shadow:
        0 5px 5px rgba(0, 0, 0, 0.5),
        inset 0 0 10px rgba(0, 0, 0, 0.3);
    transition: transform 0.2s;
    user-select: none;
    position: relative;
    font-family: 'Orbitron', sans-serif;
}

.chip::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 45px;
    height: 45px;
    border-radius: 50%;
    border: 2px solid rgba(255, 255, 255, 0.3);
}

.chip:hover {
    transform: translateY(-8px);
}

/* Chip Colors */
.chip-1 {
    background: linear-gradient(135deg, #e0e0e0, #bdbdbd);
    color: #333;
    border-color: #333;
}

.chip-5 {
    background: linear-gradient(135deg, #ef5350, #c62828);
    color: #fff;
    border-color: #fff;
}

.chip-10 {
    background: linear-gradient(135deg, #42a5f5, #1565c0);
    color: #fff;
    border-color: #fff;
}

.chip-50 {
    background: linear-gradient(135deg, #66bb6a, #2e7d32);
    color: #fff;
    border-color: #fff;
}

.chip-100 {
    background: linear-gradient(135deg, #424242, #212121);
    color: #FFD700;
    border-color: #FFD700;
}

.current-bet-display {
    background: rgba(0, 0, 0, 0.6);
    padding: 8px 20px;
    border-radius: 8px;
    color: #FFD700;
    font-family: 'Orbitron', sans-serif;
    font-size: 1.2rem;
    margin-bottom: 1rem;
    border: 1px solid #FFD700;
}

/* Action Buttons */
.action-btn {
    padding: 1rem 2.5rem;
    border-radius: 50px;
    border: none;
    font-family: 'Orbitron', sans-serif;
    font-weight: 900;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.2s;
    text-transform: uppercase;
    letter-spacing: 1px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
}

.action-btn:active {
    transform: scale(0.95);
}

.action-btn.deal {
    background: linear-gradient(135deg, #FFD700 0%, #FFA000 100%);
    color: #000;
}

.action-btn.hit {
    background: linear-gradient(135deg, #66bb6a 0%, #2e7d32 100%);
    color: white;
}

.action-btn.stand {
    background: linear-gradient(135deg, #ef5350 0%, #c62828 100%);
    color: white;
}

.action-btn.clear {
    background: #444;
    color: #aaa;
}

/* Controls Container */
.controls {
    display: flex;
    align-items: center;
    gap: 2rem;
    background: #000;
    padding: 1.5rem 3rem;
    border-radius: 100px;
    border: 1px solid #333;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
}

#bet-amount {
    background: #111;
    color: #FFD700;
    border: 1px solid #FFD700;
    font-size: 1.2rem;
    padding: 0.8rem;
    width: 120px;
    text-align: center;
    border-radius: 10px;
    box-shadow: inset 0 0 10px rgba(255, 215, 0, 0.2);
}

#bet-amount:focus {
    outline: none;
    box-shadow: 0 0 15px rgba(255, 215, 0, 0.5);
}

.spin-button {
    background: linear-gradient(135deg, #ff4081, #c51162);
    border: none;
    padding: 1rem 3rem;
    border-radius: 50px;
    color: white;
    font-weight: bold;
    font-family: 'Orbitron', sans-serif;
    cursor: pointer;
    box-shadow: 0 0 20px rgba(197, 17, 98, 0.5);
    font-size: 1.2rem;
}

.spin-button:hover {
    transform: scale(1.05);
    box-shadow: 0 0 30px rgba(197, 17, 98, 0.8);
}

.spin-button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.reel {
    width: 140px;
    height: 180px;
    background: linear-gradient(to bottom, #f5f5f5 0%, #ffffff 50%, #e0e0e0 100%);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 6rem;
    color: #333;
    border: 2px solid #333;
    box-shadow: inset 0 0 15px rgba(0, 0, 0, 0.3);
    overflow: hidden;
    position: relative;
    background-clip: padding-box;
}

/* Moving Reel Strip Animation */
.reel-strip {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
    position: absolute;
    top: 0;
    width: 100%;
    animation: none;
}

.spinning-strip {
    animation: scrollStrip 0.2s linear infinite;
    filter: blur(2px);
    /* Slight motion blur */
}

@keyframes scrollStrip {
    0% {
        transform: translateY(0);
    }

    100% {
        transform: translateY(-50%);
    }

    /* Scroll halfway up quickly */
}

/* Realistic Gold Coins */
.gold-coin {
    width: 40px;
    height: 40px;
    background: radial-gradient(ellipse at center, #ffd700 0%, #d4af37 100%);
    border: 3px solid #b8860b;
    border-radius: 50%;
    position: fixed;
    z-index: 9999;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.4), inset 0 0 10px rgba(255, 255, 255, 0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #8b4513;
    font-weight: bold;
    font-family: 'Times New Roman', serif;
    font-size: 1.5rem;
    pointer-events: none;
    will-change: transform;
}

.gold-coin::before {
    content: '$';
    text-shadow: 0 1px 0 rgba(255, 255, 255, 0.5);
}

@keyframes spinCoin {
    0% {
        transform: translateY(0) rotateY(0) rotateX(0);
    }

    100% {
        transform: translateY(110vh) rotateY(1080deg) rotateX(720deg);
    }
}

/* Flying Chip Animation */
.flying-chip {
    position: fixed;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    z-index: 10000;
    pointer-events: none;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.5);
    transition: all 0.5s ease-out;
}

.chip-stack {
    position: fixed;
    width: 50px;
    height: 50px;
    z-index: 10000;
    pointer-events: none;
}

.chip-stack .chip {
    position: absolute;
    top: 0;
    left: 0;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.3);
}

/* Remove old blur-scroll if present (cleaning up) */
.spinning {
    /* Legacy fallback */
    animation: bounce 0.1s infinite alternate;
}

/* Slot Animations */
/* The original .spinning rule and its related keyframes are removed as per instruction */

/* Win Pulse Animation */
.win-pulse {
    animation: pulse-gold 1s infinite alternate;
}

@keyframes pulse-gold {
    0% {
        box-shadow: 0 0 20px rgba(255, 215, 0, 0.5);
    }

    100% {
        box-shadow: 0 0 50px rgba(255, 215, 0, 1), 0 0 100px rgba(255, 215, 0, 0.5);
    }
}

/* Win Overlay Enhanced */
.win-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.85);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.win-content {
    background: radial-gradient(circle, #e6b800, #ff8f00);
    padding: 5rem;
    border-radius: 30px;
    box-shadow:
        0 0 0 20px rgba(255, 215, 0, 0.2),
        0 0 100px rgba(255, 143, 0, 0.8);
    border: 5px solid #fff;
    transform: perspective(500px) rotateX(10deg);
}

.win-content h2 {
    font-family: 'Orbitron', sans-serif;
    font-weight: 900;
    letter-spacing: 5px;
    color: #fff;
    -webkit-text-stroke: 2px #000;
}

#win-amount {
    font-size: 3rem;
    color: #d32f2f;
    font-weight: 900;
}

@keyframes zoomIn {
    from {
        transform: scale(0);
        opacity: 0;
    }

    to {
        transform: scale(1);
        opacity: 1;
    }
}

/* Roulette Styles */
/* Roulette Styles */
.roulette-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2rem;
    padding: 3rem;
    background: url('felt_texture.png');
    background-size: 512px;
    /* Repeat perfectly */
    background-repeat: repeat;
    border-radius: 40px;
    border: 12px solid #3e2723;
    box-shadow: 0 50px 100px rgba(0, 0, 0, 0.5), inset 0 0 100px rgba(0, 0, 0, 0.4);
    position: relative;
    overflow: hidden;
}

.roulette-container::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.1) 0%, transparent 50%);
    pointer-events: none;
}

.wheel-area {
    position: relative;
    width: 430px;
    height: 430px;
    background: #111;
    border-radius: 50%;
    border: 15px solid #5d4037;
    box-shadow:
        0 20px 40px rgba(0, 0, 0, 0.6),
        inset 0 0 60px rgba(0, 0, 0, 0.8),
        0 0 0 5px rgba(255, 215, 0, 0.1);
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: hidden;
}

.wheel-pointer {
    position: absolute;
    top: -25px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 2.5rem;
    color: #ffd700;
    z-index: 10;
    text-shadow: 0 0 15px rgba(255, 215, 0, 0.6);
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.5));
}

.table-area {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    padding: 2rem;
    background: rgba(0, 0, 0, 0.2);
    border: 2px solid rgba(255, 255, 255, 0.1);
    border-radius: 20px;
    box-shadow: inset 0 0 30px rgba(0, 0, 0, 0.3);
}

.roulette-grid {
    display: grid;
    grid-template-columns: 70px repeat(12, 55px);
    grid-template-rows: repeat(3, 55px);
    gap: 2px;
    background: rgba(255, 255, 255, 0.05);
    padding: 2px;
}

.grid-cell {
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    user-select: none;
    position: relative;
    border: 1px solid rgba(255, 255, 255, 0.15);
    font-family: 'Orbitron', sans-serif;
    font-size: 1.1rem;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
    z-index: 5;
    /* Ensure validation: Hoist above background */
}

/* ... existing code ... */

.grid-cell .bet-indicator {
    position: absolute;
    width: 28px;
    height: 28px;
    background: radial-gradient(circle at 30% 30%, #ffd700, #b8860b);
    color: #000;
    border-radius: 50%;
    font-size: 0.75rem;
    font-weight: bold;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid #fff;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.5);
    z-index: 10;
    font-family: sans-serif;
    animation: chipDrop 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    pointer-events: none;
    /* KEY FIX: Let clicks pass through to the cell */
}

.grid-cell:hover {
    filter: brightness(1.4);
    z-index: 5;
    transform: scale(1.05);
    box-shadow: 0 0 20px rgba(255, 255, 255, 0.2);
}

.grid-cell.red {
    background: linear-gradient(135deg, #d32f2f, #b71c1c);
    color: #fff;
}

.grid-cell.black {
    background: linear-gradient(135deg, #333, #000);
    color: #fff;
}

.grid-cell.green {
    background: linear-gradient(135deg, #2e7d32, #1b5e20);
    color: #fff;
    grid-row: 1 / span 3;
}

.outside-bets {
    display: flex;
    justify-content: center;
    gap: 15px;
    margin-top: 10px;
}

.bet-node {
    flex: 1;
    padding: 15px;
    border-radius: 12px;
    font-weight: bold;
    cursor: pointer;
    text-align: center;
    text-transform: uppercase;
    transition: all 0.2s;
    border: 1px solid rgba(255, 255, 255, 0.2);
    font-family: 'Orbitron', sans-serif;
    color: white;
    background: rgba(255, 255, 255, 0.05);
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.2);
}

.bet-node:hover {
    transform: translateY(-5px);
    background: rgba(255, 255, 255, 0.1);
    box-shadow: 0 8px 15px rgba(0, 0, 0, 0.3);
}

.bet-node.red {
    background: linear-gradient(135deg, rgba(211, 47, 47, 0.8), rgba(183, 28, 28, 0.8));
}

.bet-node.black {
    background: linear-gradient(135deg, rgba(51, 51, 51, 0.8), rgba(0, 0, 0, 0.8));
}

.roulette-controls {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2rem;
    width: 100%;
}

.chip-selection {
    display: flex;
    gap: 20px;
    padding: 20px;
    background: rgba(0, 0, 0, 0.6);
    border-radius: 60px;
    border: 2px solid rgba(255, 215, 0, 0.2);
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.4);
}

.active-chip {
    transform: translateY(-15px) scale(1.15) !important;
    box-shadow: 0 15px 30px rgba(255, 215, 0, 0.4) !important;
    border: 4px solid #ffd700 !important;
}

.chip.disabled {
    opacity: 0.3;
    filter: grayscale(100%);
    cursor: not-allowed !important;
    pointer-events: auto !important;
    /* Catch the click so it doesn't fall through */
    transform: none !important;
    box-shadow: none !important;
}

.grid-cell .bet-indicator {
    position: absolute;
    width: 28px;
    height: 28px;
    background: radial-gradient(circle at 30% 30%, #ffd700, #b8860b);
    color: #000;
    border-radius: 50%;
    font-size: 0.75rem;
    font-weight: bold;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid #fff;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.5);
    z-index: 10;
    font-family: sans-serif;
    animation: chipDrop 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes chipDrop {
    from {
        transform: scale(3) rotate(45deg);
        opacity: 0;
    }

    to {
        transform: scale(1) rotate(0);
        opacity: 1;
    }
}

.hidden {
    display: none !important;
}

footer p {
    color: #555;
    font-size: 0.8rem;
    margin-top: 2rem;
    text-align: center;
}

/* --- POKER STYLES --- */
.poker-container {
    display: flex;
    flex-direction: column;
    gap: 20px;
    padding: 20px;
    background: linear-gradient(135deg, #1a1a1a, #0d0d0d);
    border-radius: 30px;
    border: 1px solid rgba(255, 215, 0, 0.3);
    box-shadow: 0 0 80px rgba(0, 0, 0, 0.9), inset 0 0 50px rgba(0, 0, 0, 0.8);
}

.poker-info {
    text-align: center;
    color: #ffd700;
    font-family: 'Orbitron', sans-serif;
    font-size: 1rem;
    padding: 10px;
    background: rgba(255, 215, 0, 0.1);
    border-radius: 10px;
}

.poker-table {
    background: radial-gradient(ellipse at center, #2e7d32 0%, #1b5e20 100%);
    border: 15px solid #3e2723;
    border-radius: 50%;
    padding: 3rem 2rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2rem;
    min-height: 500px;
    position: relative;
    box-shadow: inset 0 0 100px rgba(0, 0, 0, 0.6), 0 20px 50px rgba(0, 0, 0, 0.5);
}

.poker-table::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-image: url("data:image/svg+xml,%3Csvg width='100' height='100' viewBox='0 0 100 100' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.8' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)' opacity='0.05'/%3E%3C/svg%3E");
    pointer-events: none;
    border-radius: 50%;
}

.community-cards {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 15px;
    z-index: 2;
}

.pot-display {
    background: rgba(0, 0, 0, 0.6);
    border: 2px solid #ffd700;
    border-radius: 10px;
    padding: 10px 20px;
    text-align: center;
}

.pot-label {
    font-family: 'Orbitron', sans-serif;
    color: #ffd700;
    font-size: 0.8rem;
    font-weight: bold;
}

.pot-amount {
    font-family: 'Orbitron', sans-serif;
    color: #4caf50;
    font-size: 1.5rem;
    font-weight: bold;
    text-shadow: 0 0 10px rgba(76, 175, 80, 0.5);
}

.community-hand {
    display: flex;
    justify-content: center;
    gap: 10px;
    min-height: 130px;
    align-items: center;
}

.poker-seats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 15px;
    width: 100%;
    z-index: 2;
}

.poker-seat {
    background: rgba(0, 0, 0, 0.4);
    border: 2px solid rgba(255, 255, 255, 0.2);
    border-radius: 12px;
    padding: 15px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    transition: all 0.3s;
}

.poker-seat.active {
    border-color: #ffd700;
    box-shadow: 0 0 20px rgba(255, 215, 0, 0.4);
    background: rgba(255, 215, 0, 0.1);
}

.poker-seat.folded {
    opacity: 0.4;
}

.poker-seat .player-name {
    font-family: 'Orbitron', sans-serif;
    color: #4facfe;
    font-weight: bold;
    font-size: 0.9rem;
}

.poker-seat .player-chips {
    color: #4caf50;
    font-family: 'Orbitron', sans-serif;
    font-size: 0.8rem;
}

.poker-seat .player-hand {
    display: flex;
    gap: 5px;
    min-height: 80px;
}

.poker-seat .player-hand .card {
    transform: scale(0.6);
    margin-left: -25px;
}

.poker-seat .player-hand .card:first-child {
    margin-left: 0;
}

.poker-seat .player-bet {
    background: rgba(255, 215, 0, 0.2);
    padding: 5px 10px;
    border-radius: 5px;
    font-size: 0.8rem;
    color: #ffd700;
}

.poker-seat .player-status {
    font-size: 0.7rem;
    font-weight: bold;
    text-transform: uppercase;
}

.poker-seat .player-status.win {
    color: #00e676;
}

.poker-seat .player-status.lose {
    color: #ff5252;
}

.poker-controls {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 15px;
    width: 100%;
}

.poker-waiting {
    display: flex;
    gap: 15px;
}

.poker-actions {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 15px;
    width: 100%;
}

.raise-controls {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    width: 100%;
    max-width: 400px;
    padding: 15px;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 10px;
}

#poker-raise-slider {
    width: 100%;
    height: 8px;
    border-radius: 5px;
    background: linear-gradient(to right, #2e7d32, #4caf50);
    outline: none;
    -webkit-appearance: none;
}

#poker-raise-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #ffd700;
    cursor: pointer;
    box-shadow: 0 0 10px rgba(255, 215, 0, 0.5);
}

#poker-raise-slider::-moz-range-thumb {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #ffd700;
    cursor: pointer;
    box-shadow: 0 0 10px rgba(255, 215, 0, 0.5);
}

.raise-amount {
    font-family: 'Orbitron', sans-serif;
    color: #ffd700;
    font-size: 1.2rem;
    font-weight: bold;
}

@media (max-width: 768px) {
    .poker-table {
        border-radius: 30px;
        padding: 2rem 1rem;
        min-height: 400px;
    }

    .poker-seats {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
    }

    .poker-seat {
        padding: 10px;
    }

    .poker-seat .player-hand .card {
        transform: scale(0.5);
    }
}

/* Authentication Styles */
.auth-container {
    max-width: 480px;
    padding: 2.5rem;
    text-align: center;
}

.auth-form {
    text-align: left;
}

.auth-form .action-btn {
    padding: 1rem 1.5rem;
    font-size: 0.9rem;
}

.input-group {
    margin-bottom: 1.5rem;
}

.input-group label {
    display: block;
    margin-bottom: 5px;
    color: var(--primary);
    font-size: 0.9rem;
    font-family: 'Orbitron', sans-serif;
}

.input-group input {
    width: 100%;
    padding: 12px;
    background: rgba(0, 0, 0, 0.5);
    border: 1px solid var(--glass-border);
    border-radius: 8px;
    color: white;
    font-size: 1rem;
    transition: border-color 0.3s ease;
}

.input-group input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 10px rgba(255, 215, 0, 0.2);
}

.error-msg {
    color: #ff4444;
    background: rgba(255, 68, 68, 0.1);
    padding: 10px;
    border-radius: 5px;
    margin-top: 15px;
    font-size: 0.85rem;
    border: 1px solid rgba(255, 68, 68, 0.3);
}

.auth-btns {
    margin-top: 25px;
    display: flex;
    gap: 15px;
}

#logout-btn {
    background: rgba(211, 47, 47, 0.2);
    border: 1px solid rgba(211, 47, 47, 0.5);
    color: #ff8a80;
}

#logout-btn:hover {
    background: rgba(211, 47, 47, 0.4);
    color: white;
}

/* --- Leaderboard Styles --- */
.leaderboard-container {
    background: rgba(15, 15, 15, 0.8);
    border-radius: 15px;
    padding: 2rem;
    border: 1px solid var(--glass-border);
    box-shadow: 0 0 30px rgba(0, 0, 0, 0.5);
    max-width: 800px;
    margin: 0 auto;
}

.leaderboard-header {
    display: grid;
    grid-template-columns: 50px 1fr 120px 120px 150px;
    padding: 1rem;
    background: rgba(255, 215, 0, 0.1);
    border-radius: 8px;
    font-weight: bold;
    font-family: 'Orbitron', sans-serif;
    color: var(--primary);
    margin-bottom: 1rem;
}

.leaderboard-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.leaderboard-item {
    display: grid;
    grid-template-columns: 50px 1fr 120px 120px 150px;
    padding: 1rem;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 8px;
    align-items: center;
    transition: all 0.3s ease;
    border: 1px solid transparent;
}

.leaderboard-item:hover {
    background: rgba(255, 255, 255, 0.1);
    transform: scale(1.01);
    border-color: rgba(255, 215, 0, 0.3);
}

.leaderboard-item.top1 {
    background: linear-gradient(90deg, rgba(255, 215, 0, 0.2), rgba(255, 215, 0, 0.05));
    border: 1px solid rgba(255, 215, 0, 0.5);
}

.leaderboard-item .rank {
    font-family: 'Orbitron', sans-serif;
    font-weight: bold;
    font-size: 1.2rem;
}

.leaderboard-item .name {
    font-weight: bold;
    color: #4facfe;
    font-size: 1.1rem;
}

.leaderboard-item .value {
    text-align: right;
    font-family: 'Orbitron', sans-serif;
}

.leaderboard-item .total {
    text-align: right;
    font-family: 'Orbitron', sans-serif;
    color: var(--primary);
    font-weight: bold;
    font-size: 1.1rem;
}

@media (max-width: 768px) {

    .leaderboard-header,
    .leaderboard-item {
        grid-template-columns: 40px 1fr 100px;
    }

    .leaderboard-header span:nth-child(3),
    .leaderboard-header span:nth-child(4),
    .leaderboard-item .value:nth-child(3),
    .leaderboard-item .value:nth-child(4) {
        display: none;
    }
}

/* Trading Controls */
.trade-control {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-right: 10px;
}

.trade-control input[type=range] {
    width: 80px;
    accent-color: var(--gold);
}

.slider-val {
    font-size: 0.8rem;
    color: #ccc;
    margin-top: 2px;
}

.chip-500 {
    background: radial-gradient(circle at 30% 30%, #9c27b0, #4a148c);
    border: 2px dashed #e1bee7;
    color: white;
    text-shadow: 0 0 2px black;
}