/* ==========================================
   1. GLOBAL BODY & VIEWPORT SETUP
   ========================================== */
html, body {
    margin: 0 !important;
    padding: 0 !important;
    border: none !important;
    width: 100% !important;
    height: 100% !important;
    overflow: hidden !important;
    background-color: #0d0d0d !important;
}

.game-viewport {
    display: flex !important;
    width: 100vw !important;
    height: 100vh !important;
    margin: 0 !important;
    padding: 0 !important;
    border: none !important;
    overflow: hidden !important;
}

.game-container {
    position: relative !important;
    flex: 1 !important;
    height: 100vh !important;
    margin: 0 !important;
    padding: 0 !important;
    overflow: hidden !important;
}

.blackjack-table {
    position: relative !important;
    width: 100% !important;
    height: 100% !important;
    margin: 0 !important;
    padding: 0 !important;
    overflow: hidden !important;
}

/* ==========================================
   2. MARBLE SIDE COLUMNS (FLUID SCALING)
   ========================================== */
.side-column {
    width: 8% !important;
    min-width: 60px !important;
    height: 100vh !important;
    position: relative !important;
    z-index: 999 !important;
    flex-shrink: 0 !important;
    box-shadow: inset 0 0 25px rgba(0, 0, 0, 0.9);
}

.left-column {
    background: linear-gradient(90deg, #151515 0%, #3a3a3a 50%, #1a1a1a 100%) !important;
    border-right: 3px solid #f1c40f !important;
}

.right-column {
    background: linear-gradient(90deg, #1a1a1a 0%, #3a3a3a 50%, #151515 100%) !important;
    border-left: 3px solid #f1c40f !important;
}

/* ==========================================
   3. VIDEO & MEDIA CROP
   ========================================== */
#eden-video-layer {
    position: absolute !important;
    top: -25px !important;
    left: -25px !important;
    width: calc(100% + 50px) !important;
    height: calc(100% + 50px) !important;
    overflow: hidden !important;
    pointer-events: none !important;
    z-index: 1 !important;
}

#eden-video-layer video {
    width: 100% !important;
    height: 100% !important;
    object-fit: cover !important;
    object-position: center 35% !important;
    transform: scale(1.0) !important;
}

/* ==========================================
   4. SEATS & JOIN BADGES OVERLAY
   ========================================== */
.seats-container {
    position: absolute !important;
    bottom: 12% !important;           /* Shifted down toward outer table rail */
    left: 0 !important;
    width: 100% !important;
    display: flex !important;
    justify-content: space-between !important;
    align-items: center !important;
    padding: 0 16% !important;        /* Wider spread along outer table arc */
    z-index: 5 !important;
    box-sizing: border-box !important;
    pointer-events: none !important;
}

/* Base Seat Container (Clean overlay with no background bounding box) */
.seat, .player-seat {
    position: relative !important;
    width: auto !important;
    height: auto !important;
    display: flex !important;
    flex-direction: column !important;      
    align-items: center !important;    
    justify-content: center !important;
    pointer-events: auto !important;
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
}

/* Arc curve adjustment to sit on outer wooden rail */
.seat:nth-child(1), #seat-0 {
    transform: translate(-10px, -15px) !important;
}

#seat-1 {
    transform: translate(0px, 20px) !important;  /* Center seat rests lower on arc */
}

#seat-2 {
    transform: translate(10px, -15px) !important;
}

/* JOIN Button & Score Badge Styling (Black & Gold) */
.join-btn, .score-badge {
    background-color: rgba(0, 0, 0, 0.85) !important;
    color: #f1c40f !important;
    font-family: 'Arial', sans-serif !important;
    font-size: 14px !important;
    font-weight: bold !important;
    letter-spacing: 1px !important;
    text-align: center !important;
    padding: 6px 14px !important;
    border: 2px solid #f1c40f !important;
    border-radius: 6px !important;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.6) !important;
    display: inline-block !important;
    z-index: 10 !important;
    position: relative !important;
    cursor: pointer !important;
    pointer-events: auto !important;
    white-space: nowrap !important;
    margin-top: 5px !important;
}

.join-btn:hover, .seat:hover .score-badge {
    background-color: #f1c40f !important;
    color: #000 !important;
    transition: all 0.2s ease-in-out !important;
}

/* Player Info Wrapper */
.player-info,
.seat-info,
.player-details,
div[class*="player-info"] {
    display: flex !important;
    flex-direction: column !important;
    align-items: flex-start !important;
    justify-content: flex-end !important;
    margin-right: 6px !important;
    margin-bottom: 2px !important;
    white-space: nowrap !important;
}

/* ==========================================
   5. CARD ANIMATIONS & 3D FLIP SYSTEM
   ========================================== */
.card-flip-container {
    perspective: 1000px !important;
    display: inline-block !important;
    width: 42px !important;
    height: 60px !important;
    margin: 2px !important;
    vertical-align: middle !important;
    transform-style: preserve-3d !important;
}

.card-inner {
    position: relative !important;
    width: 100% !important;
    height: 100% !important;
    transition: transform 0.6s cubic-bezier(0.4, 0.2, 0.2, 1) !important;
    transform-style: preserve-3d !important;
}

.card-face {
    position: absolute !important;
    top: 0 !important;
    left: 0 !important;
    width: 100% !important;
    height: 100% !important;
    backface-visibility: hidden !important;
    -webkit-backface-visibility: hidden !important;
    border-radius: 4px !important;
    box-shadow: 0 2px 6px rgba(0,0,0,0.6) !important;
    overflow: hidden !important;
}

.card-face img {
    width: 100% !important;
    height: 100% !important;
    object-fit: cover !important;
}

.card-back {
    transform: rotateY(0deg) !important;
}

.card-front {
    transform: rotateY(180deg) !important;
}

.card-inner.flipped {
    transform: rotateY(180deg) !important;
}

/* Container for dealt player cards */
.player-cards,
.seat-cards,
.cards-container {
    display: flex !important;
    flex-direction: row !important;
    align-items: flex-end !important;
}

/* ==========================================
   6. DEALER CARDS & TABLE PERSPECTIVE
  ========================================== */
#dealer-cards, 
.dealer-cards-container {
    position: absolute !important;
    top: 67% !important;         /* Moved down from 61% to sit right below the dealer's hands */
    left: 50% !important;
    perspective: 1200px !important;            
    transform-origin: center bottom !important;
    transform: translate(-50%, -50%) rotateX(45deg) scale(0.85) !important; /* Lays cards flat with 3D tilt */
    transform-style: preserve-3d !important;
    display: flex !important;
    justify-content: center !important;
    align-items: center !important;
    z-index: 6 !important;
    pointer-events: auto !important;
}

#dealer-cards .card-flip-container,
.dealer-cards-container .card-flip-container {
    margin: 0 2px !important;
    transform-style: preserve-3d !important;
    filter: drop-shadow(0px 6px 8px rgba(0, 0, 0, 0.7)) !important;
}

/* Action Controls Panel (Black & Gold) */
#controls {
    display: flex !important;
    flex-direction: row !important;
    justify-content: flex-end !important;
    gap: 10px !important;
    position: absolute !important;
    bottom: 12px !important;
    right: 20px !important;
    z-index: 1000 !important;
}

#controls button, .action-btn {
    background: #0d0d0d !important;
    color: #f1c40f !important;
    border: 2px solid #f1c40f !important;
    border-radius: 6px !important;
    padding: 8px 16px !important;
    font-weight: bold !important;
    font-family: 'Arial', sans-serif !important;
    cursor: pointer !important;
    transition: all 0.2s ease-in-out !important;
}

#controls button:hover, .action-btn:hover {
    background: #f1c40f !important;
    color: #000000 !important;
}

#controls button:nth-child(1), .surrender-btn { order: 1; }
#controls button:nth-child(2), .split-btn     { order: 2; }
#controls button:nth-child(3), .double-btn    { order: 3; }
#controls button:nth-child(4), .hit-btn       { order: 4; }
#controls button:nth-child(5), .stand-btn     { order: 5; }

/* ==========================================
   7. USER CASH & BALANCE DISPLAY
   ========================================== */
.player-cash,
.user-balance,
#user-cash-display,
.seat .balance-display {
    font-family: 'Arial', sans-serif !important;
    font-size: 22px !important;
    font-weight: 800 !important;
    color: #ffffff !important;
    text-shadow: 1px 2px 4px rgba(0, 0, 0, 0.9) !important;
    letter-spacing: 0.5px !important;
    margin-top: 2px !important;
}

.player-cash.gold {
    color: #f1c40f !important;
}

#balance-display,
.balance-display,
.cash-badge,
.top-right-balance {
    display: none !important;
}

.score-badge,
.seat-balance,
.seat span,
div[class*="score"] {
    font-size: 20px !important;
    font-weight: 800 !important;
    padding: 8px 16px !important;
    letter-spacing: 0.8px !important;
    white-space: nowrap !important;
}

.seat-balance-text {
    font-size: 22px !important;
    color: #f1c40f !important;
}

.player-balance {
    font-size: 16px !important;
    font-weight: 800 !important;
    color: #28a745 !important;
    text-shadow: 1px 2px 4px rgba(0, 0, 0, 0.9) !important;
    letter-spacing: 0.5px !important;
    margin-top: 2px !important;
}

/* ==========================================
   8. CURVED FELT TIMER OVERLAY
   ========================================== */
#felt-timer-layer {
    position: absolute !important;
    bottom: 12.5% !important;           /* Lowered significantly to clear 'INSURANCE PAYS 2 TO 1' */
    left: 50% !important;
    transform: translateX(-50%) perspective(700px) rotateX(36deg) !important;
    transform-origin: center bottom !important;
    width: 780px !important;
    height: 120px !important;
    z-index: 4 !important;
    pointer-events: none !important;
}

.felt-timer-text {
    fill: #ffd700 !important;
    font-size: 14px !important;
    font-weight: bold !important;
    letter-spacing: 2px !important;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif !important;
    text-shadow: 0 0 8px rgba(255, 215, 0, 0.8) !important;
}

/* ==========================================
   9. FULL-SCREEN GAME RULES VIEW
   ========================================== */
.rules-modal, #rules-modal, .modal-content {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    width: 100vw !important;
    height: 100vh !important;
    max-width: none !important;
    max-height: none !important;
    border-radius: 0 !important;
    border: none !important;
    background-color: #0d0d0d !important;
    z-index: 99999 !important;
    overflow-y: auto !important;
    padding: 40px 10% !important;
    box-sizing: border-box !important;
}

/* ==========================================
   10. BETTING CHIP ALIGNMENT FIX
   ========================================== */
.chip, .bet-chip, div[class*="chip"] {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    box-sizing: border-box !important;
    text-align: center !important;
}

/* ==========================================
   BETTING CHIPS ALIGNMENT FIX
   ========================================== */
.chip-btn {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    box-sizing: border-box !important;
    min-width: 45px !important;
    height: 40px !important;
    padding: 0 8px !important;
    text-align: center !important;
}

@keyframes dealCardSlide {
    0% {
        transform: translate(-250px, -180px) scale(0.4) rotate(-15deg);
        opacity: 0;
    }
    100% {
        transform: translate(0, 0) scale(1) rotate(0deg);
        opacity: 1;
    }
}

/* Only animate cards explicitly marked as new */
.playing-card.new-card, .card-flip-container.new-card {
    animation: dealCardSlide 0.45s cubic-bezier(0.15, 0.85, 0.35, 1) forwards;
    will-change: transform, opacity;
}

/* Update Right Column Layout for Sidebar */
.right-column.league-leaderboard-sidebar {
    width: 260px !important; /* Expands pillar width for player cards */
    background: rgba(12, 14, 22, 0.95) !important;
    border-left: 2px solid rgba(255, 215, 0, 0.3);
    display: flex;
    flex-direction: column;
    padding: 12px 8px;
    z-index: 100;
    overflow-y: auto;
}

.sidebar-header {
    text-align: center;
    padding-bottom: 10px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.15);
    margin-bottom: 10px;
}

.sidebar-header h3 {
    color: #ffd700 !important; /* Gold Header Text */
    font-size: 1rem;
    margin: 0;
    font-family: Arial, sans-serif;
    letter-spacing: 1px;
}

/* Scrollable 40-Player List */
.player-list {
    flex: 1;
    overflow-y: auto;
    max-height: calc(100vh - 80px);
}

/* Custom Gold Scrollbar */
.player-list::-webkit-scrollbar {
    width: 5px;
}
.player-list::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.4);
}
.player-list::-webkit-scrollbar-thumb {
    background: rgba(255, 215, 0, 0.6);
    border-radius: 3px;
}

/* Player "Bubble Box" Cards */
.player-card {
    display: flex;
    align-items: center;
    background: rgba(255, 255, 255, 0.08);
    border-radius: 6px;
    padding: 6px 10px;
    margin-bottom: 6px;
    font-family: Arial, sans-serif;
}

.rank-badge {
    font-weight: bold;
    font-size: 0.85rem;
    min-width: 30px;
    color: #bbb;
}

.player-info {
    display: flex;
    flex-direction: column;
    flex: 1;
}

.player-name {
    font-weight: bold;
    font-size: 0.8rem;
    color: #ffffff;
}

.player-score {
    font-size: 0.75rem;
    color: #00ff66;
}

/* Zone Highlights */
.player-card.promotion { border-left: 4px solid #2ecc71; } /* Green */
.player-card.safe { border-left: 4px solid #3498db; }      /* Blue */
.player-card.demotion { border-left: 4px solid #e74c3c; }  /* Red */

/* Current Player Highlight */
.player-card.current-user {
    background: rgba(241, 196, 15, 0.25);
    border: 1px solid #f1c40f;
}