/* ==========================================================================
   3omar.hs Arcade & Boredom Busters - Design System & Retro Theme
   ========================================================================== */

:root {
    --arcade-neon-pink: #ff2a85;
    --arcade-neon-cyan: #00f0ff;
    --arcade-neon-yellow: #ffe600;
    --arcade-neon-green: #05ffa1;
    --arcade-neon-purple: #b026ff;
    --arcade-bg-stage: #050811;
    --arcade-cabinet-border: rgba(255, 255, 255, 0.14);
}

/* Ambient glow accents */
.arcade-hero {
    text-align: center;
    padding: 3rem 1rem 2rem;
    position: relative;
    max-width: 900px;
    margin: 0 auto;
}

.arcade-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.35rem 1rem;
    background: rgba(255, 42, 133, 0.12);
    border: 1px solid rgba(255, 42, 133, 0.35);
    border-radius: 9999px;
    font-size: 0.85rem;
    font-weight: 700;
    color: #ff5e9c;
    margin-bottom: 1rem;
    box-shadow: 0 0 16px rgba(255, 42, 133, 0.2);
    letter-spacing: 0.5px;
}

.arcade-title {
    font-size: clamp(2rem, 5vw, 3.2rem);
    font-weight: 800;
    line-height: 1.2;
    margin-bottom: 0.75rem;
    background: linear-gradient(135deg, #00f0ff 0%, #ff2a85 50%, #ffe600 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    text-shadow: 0 0 30px rgba(0, 240, 255, 0.3);
}

.arcade-subtitle {
    font-size: 1.1rem;
    color: var(--glass-text-muted, #94a3b8);
    max-width: 650px;
    margin: 0 auto 1.5rem;
    line-height: 1.6;
}

/* Controls section: Search and Categories */
.arcade-controls {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1.25rem;
    margin-bottom: 2.5rem;
    padding: 0 1rem;
}

.arcade-search-box {
    position: relative;
    width: 100%;
    max-width: 520px;
}

.arcade-search-box input {
    width: 100%;
    padding: 0.85rem 1.25rem 0.85rem 2.85rem;
    background: var(--control-bg, rgba(15, 23, 42, 0.7));
    border: 1px solid var(--glass-border, rgba(255, 255, 255, 0.12));
    border-radius: 9999px;
    color: var(--glass-text-main, #f8fafc);
    font-size: 0.95rem;
    outline: none;
    transition: all 0.25s ease;
    backdrop-filter: blur(10px);
}

[dir="rtl"] .arcade-search-box input {
    padding: 0.85rem 2.85rem 0.85rem 1.25rem;
}

.arcade-search-box input:focus {
    border-color: var(--arcade-neon-cyan);
    box-shadow: 0 0 16px rgba(0, 240, 255, 0.25);
}

.arcade-search-icon {
    position: absolute;
    top: 50%;
    left: 1.1rem;
    transform: translateY(-50%);
    color: #94a3b8;
    pointer-events: none;
    display: flex;
}

[dir="rtl"] .arcade-search-icon {
    left: auto;
    right: 1.1rem;
}

.arcade-pills {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.5rem;
}

.arcade-pill {
    padding: 0.5rem 1.1rem;
    background: var(--glass-bg-subtle, rgba(255, 255, 255, 0.05));
    border: 1px solid var(--glass-border, rgba(255, 255, 255, 0.1));
    border-radius: 9999px;
    color: var(--glass-text-muted, #94a3b8);
    font-size: 0.88rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.arcade-pill:hover {
    color: #fff;
    border-color: rgba(255, 255, 255, 0.25);
    background: rgba(255, 255, 255, 0.08);
}

.arcade-pill.active {
    background: linear-gradient(135deg, #06b6d4, #3b82f6);
    color: #fff;
    border-color: transparent;
    box-shadow: 0 0 18px rgba(6, 182, 212, 0.35);
}

/* Games Grid */
.arcade-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(290px, 1fr));
    gap: 1.5rem;
    max-width: 1280px;
    margin: 0 auto;
    padding: 0 1.25rem 4rem;
}

.game-card {
    background: var(--glass-bg, rgba(20, 24, 38, 0.75));
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 1.25rem;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    transition: transform 0.35s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.35s ease, border-color 0.35s ease;
    backdrop-filter: var(--glass-blur, blur(20px));
    position: relative;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.45);
}

.game-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.4), transparent);
    z-index: 2;
    pointer-events: none;
}

.game-card:hover {
    transform: translateY(-8px) scale(1.015);
    border-color: rgba(0, 240, 255, 0.6);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.6), 0 0 30px rgba(0, 240, 255, 0.25);
}

.game-thumb-wrap {
    height: 175px;
    position: relative;
    background: radial-gradient(circle at center, #1e293b, #090d16);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.game-thumb-wrap::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg, transparent 60%, rgba(9, 14, 26, 0.85) 100%);
    pointer-events: none;
    z-index: 1;
}

.game-thumb-svg,
.game-thumb-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.5s cubic-bezier(0.16, 1, 0.3, 1);
}

.game-thumb-svg-fallback {
    width: 100%;
    height: 100%;
}

.game-thumb-svg-fallback svg {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.game-card:hover .game-thumb-svg,
.game-card:hover .game-thumb-img,
.game-card:hover .game-thumb-svg-fallback svg {
    transform: scale(1.08);
}

.game-cat-tag {
    position: absolute;
    top: 0.75rem;
    left: 0.75rem;
    padding: 0.25rem 0.65rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    background: rgba(0, 0, 0, 0.65);
    backdrop-filter: blur(8px);
    border: 1px solid rgba(255, 255, 255, 0.15);
    color: #38bdf8;
}

[dir="rtl"] .game-cat-tag {
    left: auto;
    right: 0.75rem;
}

.game-high-score-badge {
    position: absolute;
    bottom: 0.75rem;
    right: 0.75rem;
    padding: 0.2rem 0.6rem;
    border-radius: 6px;
    font-size: 0.75rem;
    font-weight: 700;
    background: rgba(16, 185, 129, 0.2);
    border: 1px solid rgba(16, 185, 129, 0.4);
    color: #34d399;
}

[dir="rtl"] .game-high-score-badge {
    right: auto;
    left: 0.75rem;
}

.game-body {
    padding: 1.25rem;
    display: flex;
    flex-direction: column;
    flex: 1;
}

.game-title {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--glass-text-main, #fff);
    margin-bottom: 0.5rem;
    line-height: 1.3;
}

.game-desc {
    font-size: 0.88rem;
    color: var(--glass-text-muted, #94a3b8);
    line-height: 1.5;
    margin-bottom: 1.25rem;
    flex: 1;
}

.game-card-footer {
    display: flex;
    gap: 0.65rem;
}

.btn-play-now {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.65rem 1rem;
    background: linear-gradient(135deg, #06b6d4, #3b82f6);
    border: none;
    border-radius: 0.75rem;
    color: #fff;
    font-size: 0.92rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 4px 14px rgba(6, 182, 212, 0.35);
}

.btn-play-now:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(6, 182, 212, 0.5);
    filter: brightness(1.1);
}

.btn-instructions-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0.65rem 0.85rem;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid var(--glass-border, rgba(255, 255, 255, 0.12));
    border-radius: 0.75rem;
    color: #cbd5e1;
    font-size: 0.88rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-instructions-toggle:hover {
    background: rgba(255, 255, 255, 0.12);
    color: #fff;
}

/* ==========================================================================
   Game Stage & Player Modal (Arcade Cabinet)
   ========================================================================== */
.game-stage-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(4, 7, 16, 0.94);
    backdrop-filter: blur(20px);
    z-index: 99999;
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 0.75rem;
    box-sizing: border-box;
}

.game-stage-modal.open {
    display: flex;
}

.arcade-cabinet {
    width: 100%;
    max-width: min(98vw, 1420px);
    background: #090e1a;
    border: 1px solid var(--arcade-cabinet-border);
    border-radius: 1.25rem;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.8), 0 0 35px rgba(0, 240, 255, 0.15);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    position: relative;
    max-height: 98vh;
    transition: all 0.3s ease;
}

.arcade-cabinet.is-fullscreen {
    max-width: 100vw;
    max-height: 100vh;
    width: 100vw;
    height: 100vh;
    border-radius: 0;
    border: none;
}

/* Cabinet Header / HUD */
.cabinet-topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem 1.25rem;
    background: rgba(15, 23, 42, 0.9);
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.cabinet-left {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.cabinet-game-title {
    font-size: 1.1rem;
    font-weight: 700;
    color: #fff;
}

.cabinet-hud {
    display: flex;
    align-items: center;
    gap: 1.25rem;
}

.hud-stat {
    display: flex;
    flex-direction: column;
    align-items: center;
    line-height: 1.1;
}

.hud-label {
    font-size: 0.68rem;
    text-transform: uppercase;
    color: #94a3b8;
    font-weight: 700;
    letter-spacing: 0.5px;
}

.hud-value {
    font-size: 1.1rem;
    font-weight: 800;
    color: var(--arcade-neon-yellow);
    font-family: 'Courier New', Courier, monospace;
}

.hud-value.lives {
    color: #ff2a85;
}

.cabinet-actions {
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.cab-btn {
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: #cbd5e1;
    border-radius: 0.5rem;
    padding: 0.45rem 0.65rem;
    cursor: pointer;
    font-size: 0.85rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.cab-btn:hover {
    background: rgba(255, 255, 255, 0.15);
    color: #fff;
}

.cab-btn.cab-control-toggle {
    gap: 0.35rem;
    padding: 0.45rem 0.75rem;
    font-weight: 700;
    font-size: 0.8rem;
    transition: all 0.25s ease;
    border-radius: 9999px;
}

.cab-btn.cab-control-toggle.is-keyboard-mode {
    background: rgba(0, 240, 255, 0.18);
    border-color: rgba(0, 240, 255, 0.5);
    color: #00f0ff;
    box-shadow: 0 0 14px rgba(0, 240, 255, 0.35);
}

.cab-btn.cab-control-toggle:not(.is-keyboard-mode) {
    background: rgba(255, 42, 133, 0.18);
    border-color: rgba(255, 42, 133, 0.5);
    color: #ff5e9c;
    box-shadow: 0 0 14px rgba(255, 42, 133, 0.35);
}

.cab-control-label {
    font-size: 0.75rem;
    letter-spacing: 0.4px;
}

.cab-btn.close-btn {
    background: rgba(239, 68, 68, 0.15);
    border-color: rgba(239, 68, 68, 0.35);
    color: #f87171;
}

.cab-btn.close-btn:hover {
    background: #ef4444;
    color: #fff;
}

/* Canvas Viewport */
.canvas-wrapper {
    position: relative;
    width: 100%;
    height: 74vh;
    min-height: 520px;
    max-height: 84vh;
    background: #020617;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.arcade-cabinet.is-fullscreen .canvas-wrapper {
    flex: 1;
    width: 100vw;
    height: calc(100vh - 65px);
    min-height: calc(100vh - 65px);
    max-height: calc(100vh - 65px);
}

#gameCanvas {
    display: block;
    width: 100%;
    height: 100%;
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    object-position: center center;
    margin: 0 auto;
    image-rendering: -webkit-optimize-contrast;
    image-rendering: crisp-edges;
    image-rendering: pixelated;
    background: #000;
    box-shadow: 0 0 50px rgba(0, 0, 0, 0.95);
}

.arcade-cabinet.is-fullscreen #gameCanvas {
    width: 100%;
    height: 100%;
    max-height: calc(100vh - 75px);
    object-position: center center;
    margin: 0 auto;
}

/* CRT Scanlines Overlay */
.crt-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    background: linear-gradient(rgba(18, 16, 16, 0) 50%, rgba(0, 0, 0, 0.25) 50%), linear-gradient(90deg, rgba(255, 0, 0, 0.03), rgba(0, 255, 0, 0.01), rgba(0, 0, 255, 0.03));
    background-size: 100% 4px, 6px 100%;
    z-index: 10;
    opacity: 0.85;
    display: none;
}

.crt-active .crt-overlay {
    display: block;
}

/* Pause and Game Over Overlays */
.stage-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(5, 8, 17, 0.85);
    backdrop-filter: blur(8px);
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 20;
    padding: 1.5rem;
    text-align: center;
}

.stage-overlay.visible {
    display: flex;
}

.overlay-title {
    font-size: 2.2rem;
    font-weight: 800;
    margin-bottom: 0.5rem;
    color: #fff;
    text-shadow: 0 0 20px rgba(0, 240, 255, 0.4);
}

.overlay-title.gameover {
    color: #ef4444;
    text-shadow: 0 0 25px rgba(239, 68, 68, 0.6);
}

.overlay-title.victory {
    color: #10b981;
    text-shadow: 0 0 25px rgba(16, 185, 129, 0.6);
}

.overlay-subtitle {
    color: #94a3b8;
    font-size: 1.1rem;
    margin-bottom: 1.5rem;
}

.overlay-actions {
    display: flex;
    gap: 1rem;
}

/* ==========================================================================
   On-Screen Transparent Glassmorphism Overlay Controls (Mobile & Touch)
   ========================================================================== */
.glass-controls-overlay {
    position: absolute;
    inset: 0;
    pointer-events: none;
    z-index: 28;
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    padding: max(0.85rem, env(safe-area-inset-bottom, 0.85rem)) max(0.85rem, env(safe-area-inset-right, 0.85rem)) max(0.85rem, env(safe-area-inset-bottom, 0.85rem)) max(0.85rem, env(safe-area-inset-left, 0.85rem));
    box-sizing: border-box;
    transition: opacity 0.25s ease, transform 0.25s ease;
}

.glass-controls-overlay.is-hidden {
    display: none !important;
}

.glass-cluster {
    display: flex;
    align-items: flex-end;
    gap: 0.75rem;
    pointer-events: none;
}

.glass-cluster-left {
    justify-content: flex-start;
}

.glass-cluster-right {
    justify-content: flex-end;
    flex-wrap: wrap-reverse;
    max-width: 58%;
    gap: 0.65rem;
}

/* Transparent Glassmorphism Button Core */
.glass-btn {
    pointer-events: auto;
    position: relative;
    background: rgba(15, 23, 42, 0.42);
    backdrop-filter: blur(14px) saturate(180%);
    -webkit-backdrop-filter: blur(14px) saturate(180%);
    border: 1.5px solid rgba(255, 255, 255, 0.28);
    border-radius: 1.1rem;
    color: #ffffff;
    box-shadow: 0 8px 30px 0 rgba(0, 0, 0, 0.4), inset 0 0 12px rgba(255, 255, 255, 0.08);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    user-select: none;
    -webkit-user-select: none;
    touch-action: none;
    transition: transform 0.08s ease, background 0.12s ease, border-color 0.12s ease, box-shadow 0.12s ease;
    text-shadow: 0 1px 4px rgba(0, 0, 0, 0.8);
    font-weight: 800;
}

/* Glass D-Pad (4-Way Directional Cross) */
.glass-dpad {
    position: relative;
    width: 140px;
    height: 140px;
    pointer-events: none;
}

.glass-dir-btn {
    position: absolute;
    width: 48px;
    height: 48px;
    border-radius: 14px;
    font-size: 1.3rem;
}

.glass-dpad-up    { top: 0; left: 46px; }
.glass-dpad-down  { bottom: 0; left: 46px; }
.glass-dpad-left  { top: 46px; left: 0; }
.glass-dpad-right { top: 46px; right: 0; }
.glass-dpad-center {
    position: absolute;
    top: 48px;
    left: 48px;
    width: 44px;
    height: 44px;
    background: rgba(255, 255, 255, 0.04);
    border-radius: 10px;
    pointer-events: none;
}

/* Glass 2-Way Horizontal Pad */
.glass-hpad {
    display: flex;
    gap: 0.65rem;
    pointer-events: none;
}

.glass-h-btn {
    width: 58px;
    height: 58px;
    border-radius: 16px;
    font-size: 1.4rem;
}

/* Glass Action Buttons */
.glass-act-btn {
    min-width: 62px;
    height: 60px;
    padding: 0 0.85rem;
    border-radius: 18px;
    font-size: 0.82rem;
    gap: 2px;
}

.glass-act-btn .act-icon {
    font-size: 1.25rem;
    line-height: 1;
}

.glass-act-btn .act-label {
    font-size: 0.64rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    color: rgba(255, 255, 255, 0.95);
    white-space: nowrap;
}

/* Action Button Variants */
.glass-act-primary {
    background: rgba(0, 240, 255, 0.22);
    border-color: rgba(0, 240, 255, 0.55);
    box-shadow: 0 0 20px rgba(0, 240, 255, 0.3), inset 0 0 14px rgba(0, 240, 255, 0.2);
}

.glass-act-secondary {
    background: rgba(255, 42, 133, 0.22);
    border-color: rgba(255, 42, 133, 0.55);
    box-shadow: 0 0 20px rgba(255, 42, 133, 0.3), inset 0 0 14px rgba(255, 42, 133, 0.2);
}

.glass-act-special {
    background: rgba(255, 230, 0, 0.22);
    border-color: rgba(255, 230, 0, 0.55);
    box-shadow: 0 0 20px rgba(255, 230, 0, 0.3), inset 0 0 14px rgba(255, 230, 0, 0.2);
}

.glass-act-extra {
    background: rgba(168, 85, 247, 0.22);
    border-color: rgba(168, 85, 247, 0.55);
    box-shadow: 0 0 20px rgba(168, 85, 247, 0.3), inset 0 0 14px rgba(168, 85, 247, 0.2);
}

/* Active / Pressed State */
.glass-btn:active,
.glass-btn.is-active {
    transform: scale(0.9);
    filter: brightness(1.3);
    background: rgba(0, 240, 255, 0.45);
    border-color: #00f0ff;
    box-shadow: 0 0 32px rgba(0, 240, 255, 0.8), inset 0 0 20px rgba(0, 240, 255, 0.5);
}

/* Topbar Glass Toggle Button */
.cab-btn.glass-toggle-btn.active {
    background: rgba(0, 240, 255, 0.22);
    border-color: rgba(0, 240, 255, 0.6);
    color: #00f0ff;
    box-shadow: 0 0 16px rgba(0, 240, 255, 0.4);
}

/* Hide legacy bottom touch controller */
.mobile-touch-controller {
    display: none !important;
}

/* ==========================================================================
   Mobile Phone Responsiveness (Portrait & Landscape)
   ========================================================================== */
@media (max-width: 768px) {
    .game-stage-modal {
        padding: 0;
        width: 100vw;
        height: 100dvh;
        max-height: 100dvh;
    }

    .arcade-cabinet {
        width: 100vw;
        height: 100dvh;
        max-height: 100dvh;
        border-radius: 0;
        border: none;
    }

    .cabinet-topbar {
        padding: 0.35rem 0.65rem;
        height: 44px;
        min-height: 44px;
        box-sizing: border-box;
    }

    .cabinet-game-title {
        font-size: 0.95rem;
        max-width: 110px;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .cabinet-hud {
        gap: 0.5rem;
    }

    .hud-label {
        font-size: 0.58rem;
    }

    .hud-value {
        font-size: 0.92rem;
    }

    .cab-btn {
        padding: 0.25rem 0.45rem;
        font-size: 0.82rem;
        min-width: 30px;
        height: 32px;
        display: inline-flex;
        align-items: center;
        justify-content: center;
    }

    .cab-btn.close-btn {
        background: rgba(239, 68, 68, 0.25);
        color: #ef4444;
        border-color: rgba(239, 68, 68, 0.5);
    }

    .cab-control-toggle,
    #cabCrtBtn,
    #cabFullscreenBtn {
        display: none !important;
    }

    .canvas-wrapper {
        flex: 1;
        width: 100vw;
        height: calc(100dvh - 44px);
        min-height: calc(100dvh - 44px);
        max-height: calc(100dvh - 44px);
        padding: 0;
        box-sizing: border-box;
    }

    .info-drawer {
        display: none !important;
    }

    .glass-controls-overlay {
        padding: 0.5rem;
    }

    .glass-dpad {
        width: 124px;
        height: 124px;
    }

    .glass-dir-btn {
        width: 42px;
        height: 42px;
        font-size: 1.15rem;
    }

    .glass-dpad-up    { top: 0; left: 41px; }
    .glass-dpad-down  { bottom: 0; left: 41px; }
    .glass-dpad-left  { top: 41px; left: 0; }
    .glass-dpad-right { top: 41px; right: 0; }
    .glass-dpad-center { top: 43px; left: 43px; width: 38px; height: 38px; }

    .glass-h-btn {
        width: 52px;
        height: 52px;
        font-size: 1.25rem;
    }

    .glass-act-btn {
        min-width: 52px;
        height: 52px;
        padding: 0 0.55rem;
        border-radius: 15px;
    }

    .glass-act-btn .act-icon {
        font-size: 1.1rem;
    }

    .glass-act-btn .act-label {
        font-size: 0.58rem;
    }

    /* Games grid responsive scaling */
    .arcade-grid {
        grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
        gap: 0.85rem;
        padding: 0 0.75rem 3rem;
    }

    .game-thumb-wrap {
        height: 120px;
    }

    .game-body {
        padding: 0.85rem;
    }

    .game-title {
        font-size: 1rem;
    }

    .game-desc {
        font-size: 0.78rem;
        margin-bottom: 0.85rem;
    }

    .arcade-hero-title {
        font-size: 1.75rem;
    }

    .arcade-badge {
        font-size: 0.78rem;
    }

    .arcade-filter-tabs {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        flex-wrap: nowrap;
        padding-bottom: 0.5rem;
        scrollbar-width: none;
    }

    .arcade-filter-tabs::-webkit-scrollbar {
        display: none;
    }

    .arcade-pill {
        white-space: nowrap;
        font-size: 0.82rem;
        padding: 0.4rem 0.9rem;
    }
}

/* Mobile Landscape optimizations */
@media (max-width: 950px) and (orientation: landscape) {
    .cabinet-topbar {
        height: 38px;
        min-height: 38px;
        padding: 0.2rem 0.6rem;
    }

    .canvas-wrapper {
        height: calc(100dvh - 38px);
        min-height: calc(100dvh - 38px);
        max-height: calc(100dvh - 38px);
    }

    .glass-controls-overlay {
        padding: 0.35rem 0.85rem;
    }

    .glass-dpad {
        width: 110px;
        height: 110px;
    }

    .glass-dir-btn {
        width: 36px;
        height: 36px;
        font-size: 1rem;
    }

    .glass-dpad-up    { top: 0; left: 37px; }
    .glass-dpad-down  { bottom: 0; left: 37px; }
    .glass-dpad-left  { top: 37px; left: 0; }
    .glass-dpad-right { top: 37px; right: 0; }
    .glass-dpad-center { top: 38px; left: 38px; width: 34px; height: 34px; }

    .glass-h-btn {
        width: 46px;
        height: 46px;
        font-size: 1.15rem;
    }

    .glass-act-btn {
        min-width: 46px;
        height: 46px;
        padding: 0 0.45rem;
    }
}

/* Instructions Drawer / Modal */
.info-drawer {
    background: rgba(15, 23, 42, 0.95);
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    padding: 0.75rem 1.25rem;
    font-size: 0.85rem;
    color: #94a3b8;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.info-keys {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.key-tag {
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 4px;
    padding: 0.15rem 0.45rem;
    font-family: monospace;
    font-size: 0.8rem;
    color: #e2e8f0;
}

/* ==========================================================================
   Light Mode Overrides & Adaptations (Matching 3omar.hs Design System)
   ========================================================================== */
html.light-mode,
body.light-mode,
[data-theme="light"],
html[data-theme="light"] body {
    --arcade-cabinet-border: rgba(0, 0, 0, 0.14);
}

html.light-mode .arcade-hero,
[data-theme="light"] .arcade-hero {
    color: #0f172a;
}

html.light-mode .arcade-badge,
[data-theme="light"] .arcade-badge {
    background: rgba(255, 42, 133, 0.08);
    color: #e11d48;
    border-color: rgba(255, 42, 133, 0.28);
    box-shadow: 0 0 14px rgba(255, 42, 133, 0.12);
}

html.light-mode .arcade-subtitle,
[data-theme="light"] .arcade-subtitle {
    color: #475569;
}

html.light-mode .arcade-search-box input,
[data-theme="light"] .arcade-search-box input {
    background: rgba(255, 255, 255, 0.95);
    color: #0f172a;
    border-color: rgba(0, 0, 0, 0.14);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.04);
}

html.light-mode .arcade-search-box input:focus,
[data-theme="light"] .arcade-search-box input:focus {
    border-color: #0284c7;
    box-shadow: 0 0 16px rgba(2, 132, 199, 0.2);
}

html.light-mode .arcade-search-icon,
[data-theme="light"] .arcade-search-icon {
    color: #64748b;
}

html.light-mode .arcade-pill,
[data-theme="light"] .arcade-pill {
    background: rgba(0, 0, 0, 0.04);
    color: #475569;
    border-color: rgba(0, 0, 0, 0.08);
}

html.light-mode .arcade-pill:hover,
[data-theme="light"] .arcade-pill:hover {
    background: rgba(0, 0, 0, 0.08);
    color: #0f172a;
    border-color: rgba(0, 0, 0, 0.16);
}

html.light-mode .arcade-pill.active,
[data-theme="light"] .arcade-pill.active {
    background: linear-gradient(135deg, #0284c7, #2563eb);
    color: #ffffff;
    box-shadow: 0 0 16px rgba(2, 132, 199, 0.28);
}

html.light-mode .game-card,
[data-theme="light"] .game-card {
    background: rgba(255, 255, 255, 0.92);
    border-color: rgba(0, 0, 0, 0.09);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.06);
}

html.light-mode .game-card:hover,
[data-theme="light"] .game-card:hover {
    border-color: #0284c7;
    box-shadow: 0 14px 32px rgba(2, 132, 199, 0.18);
}

html.light-mode .game-title,
[data-theme="light"] .game-title {
    color: #0f172a;
}

html.light-mode .game-desc,
[data-theme="light"] .game-desc {
    color: #475569;
}

html.light-mode .game-cat-tag,
[data-theme="light"] .game-cat-tag {
    background: rgba(255, 255, 255, 0.9);
    color: #0369a1;
    border-color: rgba(2, 132, 199, 0.25);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}

html.light-mode .game-high-score-badge,
[data-theme="light"] .game-high-score-badge {
    background: rgba(16, 185, 129, 0.12);
    color: #059669;
    border-color: rgba(16, 185, 129, 0.3);
}

html.light-mode .btn-instructions-toggle,
[data-theme="light"] .btn-instructions-toggle {
    background: rgba(0, 0, 0, 0.04);
    border-color: rgba(0, 0, 0, 0.1);
    color: #334155;
}

html.light-mode .btn-instructions-toggle:hover,
[data-theme="light"] .btn-instructions-toggle:hover {
    background: rgba(0, 0, 0, 0.08);
    color: #0f172a;
}

/* ==========================================================================
   Agar.io Nickname Input Modal Overlay
   ========================================================================== */
.agar-name-overlay {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 25;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    pointer-events: auto;
}

.agar-name-card {
    background: rgba(15, 23, 42, 0.95);
    border: 2px solid var(--arcade-neon-cyan);
    border-radius: 1.25rem;
    padding: 1.75rem 2rem;
    box-shadow: 0 0 35px rgba(0, 240, 255, 0.45), inset 0 0 20px rgba(0, 240, 255, 0.1);
    backdrop-filter: blur(16px);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.85rem;
    width: min(90vw, 360px);
    animation: agarModalPop 0.25s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes agarModalPop {
    from { opacity: 0; transform: scale(0.9); }
    to { opacity: 1; transform: scale(1); }
}

.agar-name-icon {
    font-size: 2.4rem;
    line-height: 1;
}

.agar-name-title {
    font-size: 1.25rem;
    font-weight: 800;
    color: #fff;
    text-align: center;
    margin: 0;
    letter-spacing: 0.5px;
}

.agar-name-subtitle {
    font-size: 0.85rem;
    color: #94a3b8;
    text-align: center;
    margin: -0.25rem 0 0.5rem;
}

.agar-name-input {
    width: 100%;
    padding: 0.75rem 1.25rem;
    background: rgba(2, 6, 23, 0.85);
    border: 2px solid rgba(0, 240, 255, 0.35);
    border-radius: 9999px;
    color: #00f0ff;
    font-size: 1.05rem;
    font-weight: 700;
    text-align: center;
    outline: none;
    transition: all 0.2s ease;
    box-sizing: border-box;
}

.agar-name-input:focus {
    border-color: #00f0ff;
    box-shadow: 0 0 20px rgba(0, 240, 255, 0.5);
    background: rgba(2, 6, 23, 0.98);
}

.agar-name-btn {
    width: 100%;
    padding: 0.75rem 1.5rem;
    background: linear-gradient(135deg, #00f0ff 0%, #3b82f6 100%);
    border: none;
    border-radius: 9999px;
    color: #050811;
    font-size: 1rem;
    font-weight: 800;
    cursor: pointer;
    box-shadow: 0 4px 20px rgba(0, 240, 255, 0.45);
    transition: all 0.2s ease;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.agar-name-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 25px rgba(0, 240, 255, 0.65);
    filter: brightness(1.1);
}


