/* ============================================
   GAMES LOBBY V2 - Wooden Bookshelf Cabinet
   Mobile-First | Ultra Performance
   ============================================ */

/* ===== CSS VARIABLES ===== */
:root {
    /* Wood colors - Rich mahogany cabinet */
    --cabinet-wood: #4a2511;
    --cabinet-dark: #2d1810;
    --shelf-wood: #6b4423;
    --shelf-edge: #8b5a3c;

    /* Dimensions */
    --shelf-thickness: 16px;
    --shelf-gap: 28px;
    --game-box-height: 90px;

    /* Shadows */
    --deep-shadow: 0 8px 16px rgba(0, 0, 0, 0.6);
    --box-shadow: 2px 4px 10px rgba(0, 0, 0, 0.4);
}

/* ===== MAIN CABINET CONTAINER ===== */
.games-shelf-lobby {
    min-height: 100vh;
    background:
        linear-gradient(135deg, #0d1b0d 0%, #1a0f00 50%, #0a0a0a 100%);
    position: relative;
    padding: 0;
}

/* Ambient lighting */
.games-shelf-lobby::before {
    content: '';
    position: absolute;
    top: -50%;
    left: 50%;
    width: 150%;
    height: 150%;
    background: radial-gradient(
        ellipse at center,
        rgba(255, 200, 100, 0.08) 0%,
        transparent 60%
    );
    transform: translateX(-50%);
    pointer-events: none;
}

/* ===== CABINET FRAME ===== */
.games-shelf-container {
    /* Scrolling */
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior-y: contain;
    scroll-behavior: smooth;

    /* Layout */
    max-height: calc(100vh - 80px);
    padding: 24px 12px 100px 12px;
    position: relative;

    /* Cabinet inner frame */
    background: linear-gradient(
        to right,
        rgba(74, 37, 17, 0.3) 0%,
        transparent 8%,
        transparent 92%,
        rgba(74, 37, 17, 0.3) 100%
    );
}

/* Cabinet side panels (left/right edges) */
.games-shelf-container::before,
.games-shelf-container::after {
    content: '';
    position: fixed;
    top: 0;
    bottom: 80px;
    width: 8px;
    background: linear-gradient(
        180deg,
        var(--cabinet-dark) 0%,
        var(--cabinet-wood) 50%,
        var(--cabinet-dark) 100%
    );
    pointer-events: none;
    z-index: 10;
    box-shadow: inset 2px 0 4px rgba(0,0,0,0.5);
}

.games-shelf-container::before {
    left: 0;
}

.games-shelf-container::after {
    right: 0;
    box-shadow: inset -2px 0 4px rgba(0,0,0,0.5);
}

/* ===== WOODEN HEADER SIGN ===== */
.games-header-sign {
    background:
        linear-gradient(135deg, var(--shelf-wood) 0%, var(--cabinet-wood) 100%);
    border: 4px solid var(--cabinet-dark);
    border-radius: 12px;
    padding: 18px;
    margin: 0 auto 32px;
    max-width: 360px;
    box-shadow:
        var(--deep-shadow),
        inset 0 2px 0 rgba(255, 255, 255, 0.2),
        inset 0 -2px 8px rgba(0, 0, 0, 0.4);
    position: relative;
}

/* Carved wood texture */
.games-header-sign::before {
    content: '';
    position: absolute;
    inset: 4px;
    background: repeating-linear-gradient(
        90deg,
        transparent 0px,
        rgba(0, 0, 0, 0.1) 1px,
        transparent 2px,
        transparent 12px
    );
    border-radius: 8px;
    opacity: 0.6;
    pointer-events: none;
}

.games-header-title {
    font-size: 26px;
    font-weight: bold;
    color: #ffd700;
    text-shadow:
        2px 2px 4px rgba(0, 0, 0, 0.9),
        0 0 20px rgba(255, 215, 0, 0.5);
    margin: 0;
    position: relative;
    z-index: 1;
    letter-spacing: 1.5px;
    text-align: center;
}

.games-header-subtitle {
    color: #ffecb3;
    margin: 8px 0 0 0;
    font-size: 13px;
    position: relative;
    z-index: 1;
    text-align: center;
    opacity: 0.95;
}

/* ===== SHELF UNIT (Each game shelf) ===== */
.game-shelf {
    position: relative;
    margin-bottom: var(--shelf-gap);

    /* Remove problematic animations */
    opacity: 1;
    transform: none;
}

/* ===== WOODEN SHELF BOARD ===== */
.shelf-board {
    height: var(--shelf-thickness);
    background: linear-gradient(
        180deg,
        var(--shelf-edge) 0%,
        var(--shelf-wood) 20%,
        var(--cabinet-wood) 80%,
        var(--cabinet-dark) 100%
    );
    border-radius: 3px;
    margin-top: 8px;
    position: relative;
    box-shadow:
        0 -2px 4px rgba(255, 255, 255, 0.15) inset,
        0 8px 16px rgba(0, 0, 0, 0.5);

    /* Wood grain texture simulation */
    background-image:
        repeating-linear-gradient(
            90deg,
            transparent,
            transparent 8px,
            rgba(0, 0, 0, 0.08) 8px,
            rgba(0, 0, 0, 0.08) 9px
        );
}

/* Top edge highlight */
.shelf-board::before {
    content: '';
    position: absolute;
    top: 0;
    left: 8%;
    right: 8%;
    height: 3px;
    background: linear-gradient(
        90deg,
        transparent 0%,
        rgba(255, 255, 255, 0.4) 50%,
        transparent 100%
    );
    border-radius: 2px;
}

/* Bottom shadow (cast on wall) */
.shelf-board::after {
    content: '';
    position: absolute;
    bottom: -10px;
    left: 10%;
    right: 10%;
    height: 10px;
    background: radial-gradient(
        ellipse at center,
        rgba(0, 0, 0, 0.6) 0%,
        rgba(0, 0, 0, 0.2) 50%,
        transparent 100%
    );
    filter: blur(6px);
}

/* Shelf support brackets */
.shelf-board-bracket {
    position: absolute;
    width: 12px;
    height: 24px;
    background: linear-gradient(135deg, #2a2a2a 0%, #1a1a1a 100%);
    border: 1px solid #000;
    top: -8px;
    box-shadow: inset 0 1px 2px rgba(255,255,255,0.2);
}

.shelf-board-bracket:first-of-type {
    left: 15%;
}

.shelf-board-bracket:last-of-type {
    right: 15%;
}

/* ===== GAME BOX (Board Game on Shelf) ===== */
.game-box {
    /* Layout */
    min-height: var(--game-box-height);
    width: 90%;
    max-width: 340px;
    margin: 0 auto 10px;
    padding: 16px;

    /* Box appearance */
    background:
        linear-gradient(135deg,
            #3d2817 0%,
            #2d1810 40%,
            #1a0f00 60%,
            #2d1810 100%
        );
    border: 3px solid #2a1810;
    border-left-width: 6px;
    border-radius: 8px;
    box-shadow:
        var(--box-shadow),
        inset -2px 0 6px rgba(0, 0, 0, 0.5),
        inset 0 2px 4px rgba(255, 255, 255, 0.05);

    /* Flexbox layout */
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 6px;

    /* Touch */
    touch-action: manipulation;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;

    /* Performance */
    will-change: transform, box-shadow;

    /* Transitions */
    transition:
        transform 0.15s cubic-bezier(0.4, 0, 0.2, 1),
        box-shadow 0.3s ease;

    position: relative;
}

/* Spine texture lines */
.game-box::before {
    content: '';
    position: absolute;
    left: 0;
    top: 8%;
    bottom: 8%;
    width: 6px;
    background:
        repeating-linear-gradient(
            180deg,
            rgba(0, 0, 0, 0.4) 0px,
            transparent 2px,
            transparent 4px
        ),
        linear-gradient(180deg, #1a0f00 0%, #0a0500 100%);
    border-radius: 2px 0 0 2px;
    pointer-events: none;
}

/* Inner highlight */
.game-box::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background:
        linear-gradient(
            135deg,
            rgba(255, 255, 255, 0.08) 0%,
            transparent 50%
        );
    border-radius: 6px;
    pointer-events: none;
}

/* ===== READY STATE ===== */
.game-box--ready {
    border-color: #8b6914;
    background:
        linear-gradient(135deg,
            #4a3520 0%,
            #3d2817 40%,
            #2d1810 60%,
            #3d2817 100%
        );
    box-shadow:
        var(--box-shadow),
        0 0 25px rgba(255, 215, 0, 0.4),
        inset -2px 0 8px rgba(255, 215, 0, 0.1),
        inset 0 2px 6px rgba(255, 255, 255, 0.1);
}

/* Golden spine */
.game-box--ready::before {
    background:
        repeating-linear-gradient(
            180deg,
            rgba(255, 215, 0, 0.3) 0px,
            transparent 2px,
            transparent 4px
        ),
        linear-gradient(180deg, #b8860b 0%, #8b6914 100%);
    box-shadow: 0 0 8px rgba(255, 215, 0, 0.6);
}

/* Pulse glow */
@keyframes readyGlow {
    0%, 100% {
        box-shadow:
            var(--box-shadow),
            0 0 20px rgba(255, 215, 0, 0.3);
    }
    50% {
        box-shadow:
            var(--box-shadow),
            0 0 35px rgba(255, 215, 0, 0.6);
    }
}

.game-box--ready {
    animation: readyGlow 2.5s ease-in-out infinite;
}

/* ===== LOCKED STATE ===== */
.game-box--locked {
    filter: grayscale(80%) brightness(0.5);
    opacity: 0.6;
    cursor: not-allowed;
    border-color: #3a3a3a;
}

/* ===== COMING SOON STATE ===== */
.game-box--coming {
    border-color: #2563eb;
    background:
        linear-gradient(135deg,
            #1e3a5f 0%,
            #1a2844 40%,
            #0f1a2e 60%,
            #1a2844 100%
        );
}

/* ===== TAP FEEDBACK ===== */
.game-box--ready:active,
.game-box--ready.tapped {
    transform: scale(0.97);
    box-shadow:
        0 3px 8px rgba(0, 0, 0, 0.5),
        0 0 20px rgba(255, 215, 0, 0.5);
}

/* ===== GAME BOX CONTENT ===== */
.game-icon {
    font-size: 42px;
    filter: drop-shadow(2px 3px 6px rgba(0, 0, 0, 0.7));
    position: relative;
    z-index: 2;
}

.game-title {
    font-size: 15px;
    font-weight: bold;
    color: #ffd700;
    text-shadow:
        1px 1px 3px rgba(0, 0, 0, 0.9),
        0 0 10px rgba(255, 215, 0, 0.4);
    margin: 0;
    text-align: center;
    position: relative;
    z-index: 2;
    line-height: 1.2;
    letter-spacing: 1px;
    text-transform: uppercase;
}

.game-box--locked .game-title,
.game-box--coming .game-title {
    color: #999;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.8);
}

.game-rating {
    font-size: 13px;
    color: #ffa500;
    letter-spacing: 2px;
    position: relative;
    z-index: 2;
    filter: drop-shadow(0 1px 3px rgba(0, 0, 0, 0.6));
}

.game-box--locked .game-rating {
    color: #666;
}

/* ===== STATUS BADGE ===== */
.game-status {
    position: relative;
    z-index: 2;
    margin-top: 2px;
}

.status-badge {
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 10px;
    font-weight: bold;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    display: inline-block;
    box-shadow: 0 2px 6px rgba(0,0,0,0.3);
}

.status-badge--ready {
    background: linear-gradient(135deg, #ffd700 0%, #ff8c00 100%);
    color: #1a0f00;
}

.status-badge--locked {
    background: linear-gradient(135deg, #555 0%, #333 100%);
    color: #999;
}

.status-badge--coming {
    background: linear-gradient(135deg, #3b82f6 0%, #1e40af 100%);
    color: white;
}

/* ===== DECORATIVE SPINE LINE ===== */
.game-spine-line {
    display: none; /* Removed to simplify */
}

/* ===== MOBILE OPTIMIZATIONS ===== */
@media (max-width: 640px) {
    :root {
        --game-box-height: 85px;
        --shelf-gap: 24px;
    }

    .games-header-sign {
        padding: 16px;
        margin-bottom: 28px;
    }

    .games-header-title {
        font-size: 24px;
    }

    .game-icon {
        font-size: 38px;
    }

    .game-title {
        font-size: 14px;
    }
}

@media (max-width: 380px) {
    :root {
        --game-box-height: 80px;
    }

    .game-box {
        padding: 14px;
    }

    .game-icon {
        font-size: 36px;
    }

    .game-title {
        font-size: 13px;
    }
}

/* ===== ACCESSIBILITY ===== */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        transition-duration: 0.01ms !important;
    }
}

/* ===== LOW BANDWIDTH ===== */
.low-bandwidth .game-box--ready {
    animation: none;
}

.low-bandwidth .games-shelf-lobby::before {
    display: none;
}

/* ============================================
   GAMING BOTTOM NAV - Sunwell Midnight Theme
   ============================================ */

/* Bottom Navigation Container - Sunwell Midnight Theme */
.bottom-nav--gaming {
    /* Theme Variables */
    --sunwell-gold: #FFD700;
    --sunwell-amber: #FFAA00;
    --sunwell-light: #FFF8DC;
    --sunwell-glow: #FFE4B5;
    --silvermoon-gold: #C9A227;
    --void-purple: #4B0082;
    --void-deep: #1A0033;
    --void-cosmic: #0D001A;
    --void-pink: #9932CC;
    --bio-cyan: #00CED1;
    --blood-crimson: #DC143C;

    /* Layout & Position */
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 1000;

    /* Appearance */
    background: linear-gradient(180deg, rgba(26, 0, 51, 0.95), rgba(13, 0, 26, 0.98));
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-top: 2px solid var(--silvermoon-gold);

    /* Spacing */
    padding: 8px 10px 18px;
    display: flex;
    justify-content: space-around;
}

/* Golden glow line at top */
.bottom-nav--gaming::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent, var(--sunwell-gold), transparent);
}

/* Navigation Item */
.gaming-nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    padding: 8px 12px;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    background: transparent;
    border: none;
    flex: 1;
}

/* Active state */
.gaming-nav-item.active {
    background: linear-gradient(180deg, rgba(255, 215, 0, 0.15), transparent);
}

/* Active indicator bar */
.gaming-nav-item.active::before {
    content: '';
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 25px;
    height: 3px;
    background: var(--sunwell-gold);
    border-radius: 2px;
    box-shadow: 0 0 10px var(--sunwell-gold);
}

/* Navigation Icon */
.gaming-nav-icon {
    font-size: 1.3rem;
    transition: all 0.3s ease;
}

.gaming-nav-item.active .gaming-nav-icon {
    filter: drop-shadow(0 0 10px var(--sunwell-gold));
    transform: scale(1.15);
}

/* Navigation Label */
.gaming-nav-label {
    font-family: 'Cinzel', serif;
    font-size: 0.55rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: rgba(255, 255, 255, 0.6);
    transition: color 0.3s ease;
}

.gaming-nav-item.active .gaming-nav-label {
    color: var(--sunwell-gold);
}

/* Notification Badge */
.gaming-nav-badge {
    position: absolute;
    top: 3px;
    right: 8px;
    width: 8px;
    height: 8px;
    background: var(--blood-crimson);
    border-radius: 50%;
    box-shadow: 0 0 8px var(--blood-crimson);
    animation: gamingNavBadgePulse 1.5s ease-in-out infinite;
}

@keyframes gamingNavBadgePulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.3); }
}

/* Safe area padding for iOS */
@supports (padding-bottom: env(safe-area-inset-bottom)) {
    .bottom-nav--gaming {
        padding-bottom: calc(18px + env(safe-area-inset-bottom));
    }
}
