:root {
    --primary-color: #d4af37; /* Metallic Gold */
    --accent-color: #00ff66; /* Vibrant Green */
    --neon-blue: #00e5ff;
    --neon-purple: #bd00ff;
    --bg-dark: #071e12; /* Rich casino green base */
    --bg-felt: radial-gradient(circle, #0e3d23 0%, #06190e 100%);
    --card-shadow: 0 4px 10px rgba(0, 0, 0, 0.4);
    --panel-glow: 0 0 15px rgba(212, 175, 55, 0.15);
    --text-light: #f2f5f3;
}

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

body {
    background: var(--bg-dark);
    color: var(--text-light);
    font-family: 'Outfit', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
    overflow: hidden;
    user-select: none;
    height: 100vh;
    width: 100vw;
}

#app {
    position: relative;
    width: 100%;
    height: 100%;
}

/* SCREEN STATES */
.screen {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: none;
    opacity: 0;
    transition: opacity 0.4s ease;
}

.screen.active {
    display: flex;
    flex-direction: column;
    opacity: 1;
}

/* LOADER SCREEN */
#loader {
    background: #06140d;
    align-items: center;
    justify-content: center;
    text-align: center;
}

.spinner {
    width: 50px;
    height: 50px;
    border: 3px solid rgba(212, 175, 55, 0.2);
    border-radius: 50%;
    border-top-color: var(--primary-color);
    animation: spin 1s ease-in-out infinite;
    margin-bottom: 20px;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

#loader h2 {
    color: var(--primary-color);
    font-size: 24px;
    margin-bottom: 8px;
    letter-spacing: 1px;
}

#loader p {
    color: #8c9c93;
    font-size: 14px;
}

/* SERVER EXCLUSIVE LOCK SCREEN */
#lock-screen {
    background: radial-gradient(circle, #1a0f2e 0%, #0c0517 100%);
    align-items: center;
    justify-content: center;
    z-index: 999;
}

.lock-card {
    background: rgba(18, 9, 36, 0.75);
    border: 2px solid var(--primary-color);
    border-radius: 24px;
    padding: 40px;
    text-align: center;
    width: 90%;
    max-width: 420px;
    box-shadow: 0 15px 45px rgba(0,0,0,0.7), 0 0 30px rgba(189, 0, 255, 0.2);
    backdrop-filter: blur(15px);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
}

.lock-logo {
    width: 80px;
    height: auto;
    filter: drop-shadow(0 0 10px var(--primary-color));
}

.lock-card h1 {
    font-size: 28px;
    font-weight: 800;
    color: var(--primary-color);
    letter-spacing: 2px;
    text-shadow: 0 0 15px rgba(212, 175, 55, 0.4);
}

.lock-card p {
    color: #bfaecf;
    font-size: 15px;
    line-height: 1.6;
}

.lock-badge {
    background: rgba(212, 175, 55, 0.15);
    border: 1px solid var(--primary-color);
    border-radius: 30px;
    color: var(--primary-color);
    font-size: 12px;
    font-weight: 800;
    padding: 6px 18px;
    letter-spacing: 1px;
}

/* CASINO FELT TABLE */
#table {
    background: var(--bg-felt);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: 12px;
    border: 5px solid #142a1d;
    outline: 2px solid var(--primary-color);
    outline-offset: -5px;
}

/* HEADER STYLE */
header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(0, 0, 0, 0.45);
    padding: 8px 16px;
    border-radius: 12px;
    border: 1px solid rgba(212, 175, 55, 0.25);
    backdrop-filter: blur(10px);
    margin-bottom: 8px;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 12px;
}

.back-btn {
    text-decoration: none;
    color: var(--primary-color);
    font-weight: 800;
    font-size: 13px;
    background: rgba(212, 175, 55, 0.15);
    border: 1px solid var(--primary-color);
    padding: 5px 12px;
    border-radius: 8px;
    transition: background 0.2s, transform 0.2s;
    cursor: pointer;
}

.back-btn:hover {
    background: rgba(212, 175, 55, 0.3);
    transform: scale(1.03);
}

.user-profile {
    display: flex;
    align-items: center;
    gap: 8px;
}

.user-profile img {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: 2px solid var(--primary-color);
}

.user-profile span {
    font-weight: 600;
    font-size: 13px;
}

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

.brand-suit {
    font-size: 22px;
    line-height: 1;
    color: var(--primary-color);
    text-shadow: 0 0 8px rgba(212, 175, 55, 0.5);
    opacity: 0.85;
}
.brand-suit:nth-of-type(1) { color: #c9b073; }
.brand-suit:nth-of-type(2) { color: #d35b5b; }

.brand-text {
    font-weight: 800;
    font-size: 16px;
    letter-spacing: 2px;
    color: var(--primary-color);
    text-shadow: 0 0 8px rgba(212, 175, 55, 0.3);
}

.balance-container {
    text-align: right;
}

.balance-container .label {
    display: block;
    font-size: 9px;
    color: #8c9c93;
    letter-spacing: 1px;
}

#balance-amount {
    font-size: 16px;
    font-weight: 800;
    color: var(--accent-color);
    text-shadow: 0 0 6px rgba(0, 255, 102, 0.2);
}

/* Sound toggle (matches Big Bass styling family) */
.sound-toggle-wrap {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 3px;
    margin-left: 14px;
    user-select: none;
}
.bj-switch {
    position: relative;
    display: inline-block;
    width: 38px;
    height: 20px;
    cursor: pointer;
}
.bj-switch input { opacity: 0; width: 0; height: 0; }
.bj-slider {
    position: absolute;
    inset: 0;
    background-color: #122030;
    border-radius: 20px;
    border: 1px solid rgba(255,255,255,0.1);
    transition: .25s ease-in-out;
}
.bj-slider::before {
    position: absolute;
    content: '';
    height: 12px;
    width: 12px;
    left: 3px;
    bottom: 3px;
    background-color: #8fa0b5;
    border-radius: 50%;
    transition: .25s cubic-bezier(0.25, 1, 0.5, 1.1);
    box-shadow: 0 2px 4px rgba(0,0,0,0.4);
}
.bj-switch input:checked + .bj-slider {
    background-color: #1a6e3e;
    border-color: var(--accent-color, #00ff66);
}
.bj-switch input:checked + .bj-slider::before {
    transform: translateX(18px);
    background-color: var(--accent-color, #00ff66);
    box-shadow: 0 0 6px rgba(0, 255, 102, 0.6);
}
.sound-label {
    font-size: 8px;
    font-weight: 800;
    color: #a0c0e0;
    letter-spacing: 0.5px;
}

/* DEALER SECTION */
.dealer-section {
    display: flex;
    flex-direction: column;
    align-items: center;
    min-height: 120px;
    justify-content: center;
    margin-bottom: 4px;
}

.hand-score {
    background: rgba(0, 0, 0, 0.6);
    border: 1px solid var(--primary-color);
    border-radius: 20px;
    padding: 3px 12px;
    font-size: 10px;
    font-weight: 800;
    color: var(--primary-color);
    margin-bottom: 6px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.cards-container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 80px;
}

/* Generic hidden utility — was missing; without it `.player-info.hidden` still rendered the
   empty-seat avatar img which then 404'd into the Discord default and showed up at low opacity. */
.hidden { display: none !important; }

/* STANDARD CARD STYLES — sized up from 55x80 / 40x58 to be more readable on the felt. */
.card-item {
    position: relative;
    width: 72px;
    height: 102px;
    border-radius: 8px;
    background: #fff;
    color: #000;
    box-shadow: var(--card-shadow);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: 5px;
    margin: 0 -10px;
    transition: transform 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    animation: dealCard 0.35s ease-out forwards;
}

@keyframes dealCard {
    from {
        transform: translateY(-100px) rotate(45deg) scale(0.6);
        opacity: 0;
    }
    to {
        transform: translateY(0) rotate(0) scale(1);
        opacity: 1;
    }
}

.card-item.red {
    color: #e50914;
}

.card-item .card-top {
    font-size: 11px;
    font-weight: 800;
    line-height: 1;
}

.card-item .card-suit {
    font-size: 18px;
    align-self: center;
}

.card-item .card-bottom {
    font-size: 11px;
    font-weight: 800;
    line-height: 1;
    transform: rotate(180deg);
    align-self: flex-end;
}

.card-item.back {
    background: linear-gradient(135deg, #a31d1d 0%, #4d0000 100%);
    border: 2px solid #fff;
    outline: 1.5px solid var(--primary-color);
}

.card-item.back * {
    display: none;
}

/* GAME MESSAGES & TIMERS */
.notification-area {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    min-height: 48px;
}

.timer-badge {
    background: rgba(255, 0, 102, 0.15);
    border: 1px solid #ff0066;
    border-radius: 20px;
    padding: 2px 12px;
    font-size: 10px;
    font-weight: 800;
    display: flex;
    gap: 8px;
    letter-spacing: 1px;
    animation: pulseTimer 1s infinite alternate;
}

@keyframes pulseTimer {
    from { box-shadow: 0 0 4px rgba(255,0,102,0.3); }
    to { box-shadow: 0 0 10px rgba(255,0,102,0.6); }
}

#timer-seconds {
    color: #ff0066;
}

#game-message {
    font-size: 13px;
    font-weight: 600;
    color: var(--primary-color);
    letter-spacing: 1px;
    text-transform: uppercase;
    text-shadow: 0 0 8px rgba(212, 175, 55, 0.2);
}

/* 5-SEATS ARC LAYOUT */
.seats-arc {
    position: relative;
    display: flex;
    justify-content: space-around;
    align-items: flex-start;
    width: 100%;
    margin: 12px auto;
    padding: 30px 10px;
    min-height: 240px;
}

.seats-arc::before {
    content: '';
    position: absolute;
    top: 10px;
    left: 5%;
    width: 90%;
    height: 120px;
    border-bottom: 2px dashed rgba(212, 175, 55, 0.35); /* Elegant gold dashed line betting curve */
    border-radius: 50%;
    pointer-events: none;
    z-index: 1;
}

/* Seats sit ON the dashed felt curve, not above its inverse. Players gather AROUND the table:
   edge seats (1 and 5) are nearest the dealer at the top, the center seat (3) sits deepest in
   the curve away from the dealer. This matches the felt's ∪ shape drawn by .seats-arc::before. */
#seat-0 { transform: translateY(0px); }
#seat-1 { transform: translateY(28px); }
#seat-2 { transform: translateY(48px); }
#seat-3 { transform: translateY(28px); }
#seat-4 { transform: translateY(0px); }

.seat-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    position: relative;
}

/* Highlight Active Turn Seat */
.seat-container.active-turn .seat-felt {
    border-color: var(--neon-blue);
    box-shadow: inset 0 4px 10px rgba(0,0,0,0.8),
                0 0 20px var(--neon-blue),
                0 0 0 2px var(--neon-blue);
    animation: pulseActiveTurn 1.5s infinite ease-in-out;
}

@keyframes pulseActiveTurn {
    0%, 100% { box-shadow: inset 0 4px 10px rgba(0,0,0,0.8), 0 0 8px var(--neon-blue), 0 0 0 2px var(--neon-blue); }
    50% { box-shadow: inset 0 4px 10px rgba(0,0,0,0.8), 0 0 20px var(--neon-blue), 0 0 0 2px var(--neon-blue); }
}

.seat-felt {
    width: 105px;
    height: 105px;
    border-radius: 50%;
    border: 4px solid #3d1f05; /* Mahogany solid outer rim */
    background: radial-gradient(circle, #0e3d23 45%, #051d10 70%, #201004 95%);
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
    box-shadow: inset 0 4px 10px rgba(0,0,0,0.8), 
                0 6px 12px rgba(0,0,0,0.6), 
                0 0 0 2px var(--primary-color); /* Elegant gold outer ring */
    z-index: 2;
}

.seat-felt:hover {
    transform: scale(1.04);
    box-shadow: inset 0 4px 10px rgba(0,0,0,0.8), 
                0 10px 20px rgba(0,0,0,0.7), 
                0 0 0 3px var(--primary-color);
}

.sit-here-btn {
    background: rgba(212, 175, 55, 0.15);
    border: 1px solid var(--primary-color);
    border-radius: 30px;
    color: var(--primary-color);
    font-size: 9px;
    font-weight: 800;
    padding: 6px 10px;
    cursor: pointer;
    transition: all 0.2s;
}

.sit-here-btn:hover {
    background: var(--primary-color);
    color: #000;
    transform: scale(1.05);
}

.player-info {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
}

.player-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: 1.5px solid var(--primary-color);
}

.player-username {
    font-size: 10px;
    font-weight: 600;
    max-width: 70px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.player-status-badge {
    font-size: 8px;
    font-weight: 800;
    color: #8c9c93;
    letter-spacing: 0.5px;
    padding: 1px 6px;
    border-radius: 6px;
    background: rgba(0,0,0,0.3);
}

/* Status variants */
.player-status-badge.playing { color: var(--neon-blue); }
.player-status-badge.stood { color: #8c9c93; }
.player-status-badge.busted { color: #ef4444; }
.player-status-badge.won { color: var(--accent-color); }
.player-status-badge.lost { color: #ef4444; }
.player-status-badge.push { color: #e6b800; }
.player-status-badge.blackjack { color: #d4af37; animation: bounce 0.5s infinite alternate; }

@keyframes bounce {
    to { transform: translateY(-3px); }
}

.seat-bet {
    margin-top: -15px;
    z-index: 10;
}

.bet-chip {
    background: #009933;
    border: 1.5px dashed #fff;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 8px;
    font-weight: 800;
    color: #fff;
    box-shadow: 0 2px 5px rgba(0,0,0,0.4);
}

.seat-hand {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
    margin-top: 4px;
}

.seat-cards {
    display: flex;
    justify-content: center;
    width: 100%;
    min-height: 60px;
    perspective: 500px;
    margin-bottom: 2px;
}

/* Mini cards for seatarc */
.seat-cards .card-item {
    width: 40px;
    height: 58px;
    font-size: 8px;
    padding: 2px;
    border-radius: 4px;
    margin: 0 -6px;
    transition: transform 0.25s cubic-bezier(0.25, 0.8, 0.25, 1), box-shadow 0.25s ease;
    z-index: 3;
}

.seat-cards .card-item:hover {
    transform: translateY(-12px) scale(1.2) rotate(-2deg);
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.8);
    z-index: 100;
}

.seat-cards .card-item .card-top {
    font-size: 8px;
}

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

.seat-cards .card-item .card-bottom {
    font-size: 8px;
}

.seat-score-badge {
    background: rgba(0, 0, 0, 0.7);
    border: 1px solid var(--primary-color);
    border-radius: 12px;
    padding: 1px 8px;
    font-size: 9px;
    font-weight: 800;
    color: var(--primary-color);
}

/* HIGH-END TABLE FELT INSCRIPTIONS STYLE */
.felt-inscriptions {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    margin: 10px auto;
    pointer-events: none;
    user-select: none;
    opacity: 0.25;
    z-index: 1;
}

.felt-line {
    color: var(--primary-color);
    font-weight: 800;
    font-size: 16px;
    letter-spacing: 2px;
    margin-bottom: 2px;
    text-transform: uppercase;
}

.felt-line.font-rowdies {
    font-family: 'Rowdies', Impact, sans-serif;
    font-size: 18px;
    border-bottom: 1.5px solid rgba(212, 175, 55, 0.4);
    padding-bottom: 4px;
    margin-bottom: 6px;
}

.felt-line.sub {
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 1px;
    color: #f2f5f3;
}

/* HUD PANELS */
.hud-panel {
    background: rgba(0, 0, 0, 0.6);
    border: 1px solid rgba(212, 175, 55, 0.3);
    backdrop-filter: blur(10px);
    border-radius: 16px;
    padding: 12px 16px;
    width: 100%;
    max-width: 460px;
    margin: 0 auto;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.5);
    text-align: center;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.hud-panel.hidden {
    display: none !important;
}

.hud-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.stand-up-btn {
    background: rgba(239, 68, 68, 0.15);
    border: 1px solid #ef4444;
    border-radius: 6px;
    color: #ef4444;
    font-size: 10px;
    font-weight: 800;
    padding: 3px 8px;
    cursor: pointer;
    transition: all 0.2s;
}

.stand-up-btn:hover {
    background: #ef4444;
    color: #fff;
}

.bet-label {
    font-size: 10px;
    font-weight: 800;
    color: #8c9c93;
    letter-spacing: 1px;
}

.chips-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 6px;
}

.chip {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: 2px dashed #fff;
    cursor: pointer;
    font-weight: 800;
    font-size: 9px;
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s, box-shadow 0.2s;
}

.chip:hover {
    transform: translateY(-3px) scale(1.05);
}

.chip-10 { background: #0066cc; }
.chip-50 { background: #cc3300; }
.chip-100 { background: #009933; }
.chip-500 { background: #e6b800; color: #000; }
.chip-1000 { background: #9900cc; }
.chip-5000 { background: #1a1a1a; border-color: var(--primary-color); }

.custom-bet-row {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

#custom-bet-input {
    background: rgba(0, 0, 0, 0.4);
    border: 1px solid var(--primary-color);
    border-radius: 6px;
    color: #fff;
    font-size: 13px;
    font-weight: 750;
    padding: 5px;
    width: 80px;
    text-align: center;
}

#deal-btn {
    background: linear-gradient(135deg, #d4af37 0%, #b38f19 100%);
    border: none;
    border-radius: 6px;
    color: #000;
    font-weight: 800;
    font-size: 12px;
    padding: 6px 16px;
    cursor: pointer;
    letter-spacing: 0.5px;
    transition: filter 0.2s, transform 0.2s;
}

#deal-btn:hover {
    filter: brightness(1.15);
    transform: scale(1.02);
}

/* SPECTATOR HUD */
.spectator-hud {
    font-size: 12px;
    color: #8c9c93;
    font-weight: 600;
    letter-spacing: 0.5px;
    display: flex;
    flex-direction: row;
    justify-content: space-between;
    align-items: center;
}

/* ACTIVE GAME HUD */
.current-bet-display {
    font-size: 11px;
    color: #8c9c93;
    letter-spacing: 0.5px;
}

.current-bet-display strong {
    color: var(--primary-color);
    font-size: 13px;
}

.buttons-row {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
}

.action-btn {
    border: none;
    border-radius: 8px;
    color: #fff;
    font-weight: 800;
    font-size: 11px;
    padding: 10px 4px;
    cursor: pointer;
    letter-spacing: 0.5px;
    transition: all 0.2s;
}

.action-btn:hover {
    filter: brightness(1.15);
    transform: translateY(-1.5px);
}

.action-btn.double { background: #3b82f6; }
.action-btn.hit { background: #10b981; }
.action-btn.stand { background: #ef4444; }

.action-btn:disabled {
    opacity: 0.3;
    cursor: not-allowed;
    transform: none !important;
    filter: none !important;
}

/* RESPONSIVENESS AND SMALL SCREEN ADAPTATION */
@media (max-width: 600px) {
    .seats-arc {
        gap: 4px;
        min-height: 180px;
        padding: 20px 5px;
    }
    #seat-0 { transform: translateY(0px); }
    #seat-1 { transform: translateY(16px); }
    #seat-2 { transform: translateY(28px); }
    #seat-3 { transform: translateY(16px); }
    #seat-4 { transform: translateY(0px); }
    
    .seat-felt {
        width: 75px;
        height: 75px;
        border-width: 2.5px;
    }
    .player-avatar {
        width: 22px;
        height: 22px;
    }
    .player-username {
        max-width: 50px;
        font-size: 8px;
    }
    .sit-here-btn {
        font-size: 8px;
        padding: 4px 6px;
    }
    .seat-cards .card-item {
        width: 28px;
        height: 42px;
        margin: 0 -4px;
    }
    .seat-cards .card-item .card-top {
        font-size: 6px;
    }
    .seat-cards .card-item .card-suit {
        font-size: 10px;
    }
    .seat-cards .card-item .card-bottom {
        font-size: 6px;
    }
}
