/* ============================================
   LaJoc.ro - Platform Design System (Optimized)
   ============================================ */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* PRO User Styling */
.user-pro {
    font-size: 1.1em;
    font-weight: 800;
    color: #fbbf24; /* Amber 400 - Goldish */
    text-shadow: 0 0 8px rgba(251, 191, 36, 0.4);
    background: linear-gradient(135deg, #fbbf24 0%, #f59e0b 50%, #fbbf24 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    display: inline-block;
    position: relative;
    letter-spacing: 0.02em;
}

.user-pro::after {
    content: " ★";
    font-size: 0.8em;
    vertical-align: middle;
    margin-left: 2px;
    background: linear-gradient(135deg, #fbbf24 0%, #f59e0b 50%, #fbbf24 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}


:root {
    --primary: #6366f1;
    --primary-glow: rgba(99, 102, 241, 0.4);
    --primary-light: #818cf8;
    --accent: #a855f7;
    --accent-glow: rgba(168, 85, 247, 0.4);
    --secondary: #06b6d4;
    --bg-deep: #06080f;
    --bg-surface: #0d1117;
    --card-bg: rgba(17, 24, 39, 0.75);
    --card-bg-hover: rgba(25, 33, 52, 0.9);
    --text-main: #f0f2f5;
    --text-muted: #94a3b8;
    --logo-color: #ffffff;
    --text-dim: #94a3b8;
    --success: #22c55e;
    --danger: #ef4444;
    --warning: #f59e0b;
    --border: rgba(255, 255, 255, 0.06);
    --border-hover: rgba(255, 255, 255, 0.12);
    --glass: rgba(255, 255, 255, 0.03);
    --glass-hover: rgba(255, 255, 255, 0.07);
    --radius: 1.25rem;
    --radius-lg: 2rem;
    --shadow-card: 0 8px 32px rgba(0,0,0,0.4);
    --shadow-glow: 0 0 60px rgba(99, 102, 241, 0.15);
    --transition: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    --font: 'Outfit', -apple-system, BlinkMacSystemFont, sans-serif;
    --max-width: 1200px;

    /* Dynamic Game Spacing */
    --game-padding: 1.5rem;
    --game-gap: 1.5rem;
    --card-padding: 1.25rem;
    --header-status-height: 120px;
}

/* Height-based compression for small/medium mobile screens */
@media (max-height: 750px) {
    :root {
        --game-padding: 1rem;
        --game-gap: 1rem;
        --card-padding: 1rem;
    }
}

@media (max-height: 600px) {
    :root {
        --game-padding: 0.6rem;
        --game-gap: 0.5rem;
        --card-padding: 0.75rem;
    }
}

.desktop-only {
    display: block !important;
}

@media (max-width: 1023px) {
    .desktop-only {
        display: none !important;
    }
}

/* Mobile Optimizations for Create/Settings Modal */
@media (max-width: 768px) {
    .form-group {
        margin-bottom: 0.85rem !important;
    }
    .modal-section-settings {
        padding: 0 0.5rem !important;
    }
    .modal-section-settings .form-group label {
        margin-bottom: 0.35rem !important;
        font-size: 0.8rem !important;
    }
    .selection-glass-card {
        padding: 1rem !important;
    }
    .scrollable-selection-grid {
        padding: 0.5rem 0 !important;
    }
    .mode-selector.grid-3 {
        gap: 0.5rem !important;
    }
    .mode-card {
        padding: 0.75rem 0.5rem !important;
    }
    .mode-card h4 {
        font-size: 0.8rem !important;
    }
    .mode-card i {
        font-size: 1.1rem !important;
        margin-bottom: 0.25rem !important;
    }
}

/* ---- Theme: Neon Party ---- */
body.theme-neon {
    --primary: #39ff14;
    --primary-glow: rgba(57, 255, 20, 0.3);
    --primary-light: #6fff4a;
    --accent: #ff00ff;
    --accent-glow: rgba(255, 0, 255, 0.3);
    --secondary: #00d4ff;
    --bg-deep: #050505;
    --bg-surface: #0a0a0a;
    --card-bg: rgba(10, 10, 10, 0.85);
    --text-main: #e0ffe0;
    --border: rgba(57, 255, 20, 0.1);
    --border-hover: rgba(57, 255, 20, 0.25);
}
body.theme-neon .blob-1 { background: radial-gradient(circle, #ff00ff 0%, transparent 70%) !important; }
body.theme-neon .blob-2 { background: radial-gradient(circle, #39ff14 0%, transparent 70%) !important; }
body.theme-neon .game-card { border: 1px dashed rgba(57,255,20,0.2); }
body.theme-neon .game-card:hover { border-color: #39ff14; box-shadow: 0 0 40px rgba(57,255,20,0.2); }

/* ---- Theme: Sunset (Warm) ---- */
body.theme-sunset {
    --primary: #f97316;
    --primary-glow: rgba(249, 115, 22, 0.3);
    --primary-light: #fb923c;
    --accent: #ec4899;
    --accent-glow: rgba(236, 72, 153, 0.3);
    --secondary: #fbbf24;
    --bg-deep: #1a0a00;
    --bg-surface: #1f0d02;
    --card-bg: rgba(31, 13, 2, 0.8);
    --text-main: #fef3c7;
    --text-muted: #f59e0b;
    --border: rgba(249, 115, 22, 0.1);
}
body.theme-sunset .blob-1 { background: radial-gradient(circle, #ec4899 0%, transparent 70%) !important; }
body.theme-sunset .blob-2 { background: radial-gradient(circle, #f97316 0%, transparent 70%) !important; }

/* ---- Theme: Ocean ---- */
body.theme-ocean {
    --primary: #06b6d4;
    --primary-glow: rgba(6, 182, 212, 0.3);
    --primary-light: #22d3ee;
    --accent: #3b82f6;
    --accent-glow: rgba(59, 130, 246, 0.3);
    --secondary: #10b981;
    --bg-deep: #020617;
    --bg-surface: #0c1524;
    --card-bg: rgba(12, 21, 36, 0.8);
    --text-main: #e0f2fe;
    --text-muted: #93c5fd;
    --border: rgba(6, 182, 212, 0.1);
    --text-on-primary: #ffffff;
    --text-on-success: #ffffff;
    --text-on-danger: #ffffff;
}
body.theme-ocean .blob-1 { background: radial-gradient(circle, #3b82f6 0%, transparent 70%) !important; }
body.theme-ocean .blob-2 { background: radial-gradient(circle, #06b6d4 0%, transparent 70%) !important; }

/* ---- Theme: Light Mode ---- */
body.theme-light {
    --primary: #6366f1;
    --primary-glow: rgba(99, 102, 241, 0.2);
    --primary-light: #818cf8;
    --accent: #a855f7;
    --accent-glow: rgba(168, 85, 247, 0.2);
    --bg-deep: #f8fafc;
    --bg-surface: #ffffff;
    --card-bg: rgba(255, 255, 255, 0.9);
    --card-bg-hover: rgba(255, 255, 255, 1);
    --text-main: #0f172a;
    --text-muted: #475569;
    --logo-color: #0f172a;
    --text-dim: #94a3b8;
    --success: #16a34a;
    --danger: #dc2626;
    --warning: #d97706;
    --border: rgba(0, 0, 0, 0.06);
    --border-hover: rgba(0, 0, 0, 0.12);
    --glass: rgba(0, 0, 0, 0.02);
    --glass-hover: rgba(0, 0, 0, 0.04);
    --shadow-card: 0 8px 32px rgba(0,0,0,0.08);
    --shadow-glow: 0 0 60px rgba(99, 102, 241, 0.08);
    --text-on-primary: #ffffff;
    --text-on-success: #ffffff;
    --text-on-danger: #ffffff;
}
body.theme-light .blob-1 { opacity: 0.08 !important; }
body.theme-light .blob-2 { opacity: 0.08 !important; }
body.theme-light .blob-3 { opacity: 0.06 !important; }
body.theme-light header { background: rgba(255,255,255,0.85); border-color: rgba(0,0,0,0.06); }
body.theme-light .form-input { background: rgba(0,0,0,0.03); color: #0f172a; border-color: rgba(0,0,0,0.1); }
body.theme-light .form-input:focus { border-color: var(--primary); }
body.theme-light .glass-card { 
    background: rgba(255,255,255,0.9); 
    border-color: rgba(0,0,0,0.08); 
    box-shadow: 0 20px 40px rgba(0,0,0,0.06); 
}
body.theme-light .modal-close { color: #64748b; }
body.theme-light .modal-close:hover { color: #dc2626; background: rgba(220,38,38,0.08); }
body.theme-light .game-card { background: rgba(255,255,255,0.95); border-color: rgba(0,0,0,0.06); }
body.theme-light footer { border-color: rgba(0,0,0,0.06); }
body.theme-light .hero-badge { background: rgba(99,102,241,0.08); color: var(--primary); border-color: rgba(99,102,241,0.15); }
body.theme-light .btn-ghost { color: var(--primary); }
body.theme-light .tag { background: rgba(99,102,241,0.08); color: var(--primary); }
body.theme-light .game-stat { color: #64748b; }
body.theme-light .nav-btn { color: #64748b; }
body.theme-light .nav-btn:hover { color: var(--primary); background: rgba(99,102,241,0.08); }
body.theme-light .grid-overlay { display: none; }
body.theme-light #main-header { background: rgba(255,255,255,0.98) !important; box-shadow: 0 4px 20px rgba(0,0,0,0.05) !important; }
body.theme-light .nav-btn, body.theme-light .hamburger-btn { color: #0f172a !important; }
body.theme-light .logo-text { color: #0f172a !important; }
body.theme-light .logo-accent { color: var(--primary) !important; }
body.theme-light .game-title-header { color: #0f172a !important; }
body.theme-light .menu-item-text span { color: #475569 !important; }
body.theme-light .header-logo-img { border-color: rgba(0,0,0,0.1); }
body.theme-light .form-input { 
    background: rgba(0,0,0,0.04) !important; 
    color: #0f172a !important; 
    border-color: rgba(0,0,0,0.12) !important; 
}
body.theme-light .menu-divider {
    background: linear-gradient(90deg, transparent, rgba(0,0,0,0.1), transparent) !important;
}

/* ---- Theme: Black & White (High Contrast) ---- */
body.theme-bw {
    --primary: #ffffff;
    --primary-glow: rgba(255, 255, 255, 0.3);
    --primary-light: #ffffff;
    --accent: #888888;
    --accent-glow: rgba(255, 255, 255, 0.1);
    --secondary: #ffffff;
    --bg-deep: #000000;
    --bg-surface: #0a0a0a;
    --card-bg: #111111;
    --text-main: #ffffff;
    --text-muted: #999999;
    --logo-color: #ffffff;
    --border: #ffffff;
    --glass: rgba(255,255,255,0.05);
    --text-on-primary: #000000;
    --text-on-success: #000000;
    --text-on-danger: #000000;
}
body.theme-bw .bg-effects, body.theme-bw .background-blobs, body.theme-bw .blob, body.theme-bw .grid-overlay { display: none !important; }
body.theme-bw .glass-card { border: 2px solid #fff; border-radius: 0; backdrop-filter: none; box-shadow: 10px 10px 0px rgba(255,255,255,0.2); }
body.theme-bw .game-card { border-radius: 0; border: 1px solid #333; }
body.theme-bw .game-card:hover { border-color: #fff; transform: translate(-4px, -4px); box-shadow: 8px 8px 0px #fff; }
body.theme-bw .btn-primary { color: #000 !important; font-weight: 900; }
body.theme-bw .btn-secondary { border-color: #fff; color: #fff; background: transparent; }
body.theme-bw .btn-secondary:hover { background: #fff; color: #000; }
body.theme-bw #main-header { border-bottom: 2px solid #fff; }
body.theme-bw .nav-btn, body.theme-bw .hamburger-btn { color: #fff !important; }
body.theme-bw .logo-text { color: #fff !important; }
body.theme-bw .game-title-header { color: #fff !important; }

/* ---- Theme: White & Black (Inverted) ---- */
body.theme-wb {
    --primary: #000000;
    --primary-glow: rgba(0, 0, 0, 0.2);
    --primary-light: #000000;
    --accent: #555555;
    --accent-glow: rgba(0, 0, 0, 0.1);
    --secondary: #000000;
    --bg-deep: #ffffff;
    --bg-surface: #f0f0f0;
    --card-bg: #ffffff;
    --text-main: #000000;
    --text-muted: #666666;
    --logo-color: #000000;
    --border: #000000;
    --glass: rgba(0,0,0,0.05);
    --text-on-primary: #ffffff;
    --text-on-success: #ffffff;
    --text-on-danger: #ffffff;
}
body.theme-wb .bg-effects, body.theme-wb .background-blobs, body.theme-wb .blob, body.theme-wb .grid-overlay { display: none !important; }
body.theme-wb .glass-card { border: 2px solid #000; border-radius: 0; backdrop-filter: none; background: #fff; box-shadow: 10px 10px 0px #000; }
body.theme-wb .game-card { border-radius: 0; border: 1px solid #ddd; background: #fff; }
body.theme-wb .game-card:hover { border-color: #000; transform: translate(-4px, -4px); box-shadow: 8px 8px 0px #000; }
body.theme-wb header { background: #fff; border-bottom: 3px solid #000; }
body.theme-wb .btn-primary { color: #fff !important; }
body.theme-wb .btn-secondary { border-color: #000; color: #000; background: transparent; }
body.theme-wb .btn-secondary:hover { background: #000; color: #fff; }
body.theme-wb .game-title-header { color: #000 !important; }
body.theme-wb .logo-text { color: #000 !important; }
body.theme-wb .logo-accent { color: #555 !important; }
body.theme-wb .nav-btn, body.theme-wb .hamburger-btn { color: #000 !important; }
body.theme-wb .menu-item-text span { color: #444 !important; }
body.theme-wb .header-logo-img { border: 2px solid #000 !important; }
body.theme-wb .form-input { 
    background: #ffffff !important; 
    color: #000000 !important; 
    border: 2px solid #000000 !important; 
}
body.theme-wb .menu-item-btn {
    background: rgba(0,0,0,0.05) !important;
    border-color: #000 !important;
}
body.theme-wb .menu-divider {
    background: linear-gradient(90deg, transparent, #000, transparent) !important;
}

/* ---- Theme: Crazy (Alien Neon) ---- */
body.theme-crazy {
    --primary: #39ff14;
    --primary-glow: rgba(57, 255, 20, 0.4);
    --accent: #ff00ff;
    --accent-glow: rgba(255, 0, 255, 0.4);
    --bg-deep: #000;
    --bg-surface: #050505;
    --card-bg: rgba(10, 10, 10, 0.9);
    --text-main: #39ff14;
    --text-muted: #ff00ff;
    --border: #39ff14;
    --text-on-primary: #000000;
    --text-on-success: #ffffff;
    --text-on-danger: #ffffff;
}
body.theme-crazy .blob-1 { background: radial-gradient(circle, #ff00ff 0%, transparent 70%) !important; animation: blobMove1 5s infinite alternate; }
body.theme-crazy .blob-2 { background: radial-gradient(circle, #39ff14 0%, transparent 70%) !important; animation: blobMove2 4s infinite alternate-reverse; }
body.theme-crazy .glass-card { border: 2px dashed #39ff14; }
body.theme-crazy .game-card { border: 1px dashed #ff00ff; }
body.theme-crazy .game-card:hover { border-style: solid; border-color: #39ff14; box-shadow: 0 0 30px #39ff14; }
body.theme-crazy .btn-primary { color: #000 !important; font-weight: 900; }
body.theme-crazy .btn-secondary { border-color: #ff00ff; color: #ff00ff; background: rgba(255,0,255,0.1); }
body.theme-crazy .btn-secondary:hover { background: #ff00ff; color: #000; }

/* ---- Theme: Retro (Terminal) ---- */
body.theme-retro {
    --primary: #00ff41;
    --primary-glow: rgba(0, 255, 65, 0.3);
    --accent: #ffb000;
    --accent-glow: rgba(255, 176, 0, 0.3);
    --bg-deep: #0a0a0a;
    --bg-surface: #111111;
    --card-bg: #050505;
    --text-main: #00ff41;
    --text-muted: #00ce2a;
    --border: #00ff41;
    --text-on-primary: #000000;
    --text-on-success: #ffffff;
    --text-on-danger: #ffffff;
}
body.theme-retro .background-blobs { display: none; }
body.theme-retro .glass-card { border: 1px solid #00ff41; border-radius: 0; }
body.theme-retro .game-card { border-radius: 0; border: 1px solid #008f11; }
body.theme-retro .game-card:hover { border-color: #00ff41; background: rgba(0,255,65,0.05); }
body.theme-retro .btn-primary { color: #000 !important; font-weight: 900; }
body.theme-retro .btn-secondary { border-color: #008f11; color: #00ff41; background: transparent; }
body.theme-retro .btn-secondary:hover { background: #00ff41; color: #000; }

/* ============================================
   Base Styles
   ============================================ */
*, *::before, *::after {
    margin: 0; padding: 0; box-sizing: border-box;
}

/* Global overflow prevention for critical layout elements */
header, .status-bar, .game-tabs-header, .game-container {
    max-width: 100% !important;
    box-sizing: border-box !important;
}

html { 
    scroll-behavior: smooth; 
    overflow-x: hidden;
}
html, body {
    
}

body {
    font-family: var(--font);
    background: var(--bg-deep);
    color: var(--text-main);
    min-height: 100vh;
    overflow-x: hidden;
    line-height: 1.6;
}


html.modal-open {
    overflow: hidden;
}

body.modal-open {
    overflow: hidden !important;
    /* On mobile, overflow: hidden on body doesn't always work, but this helps */
    height: 100%;
}

#app-wrapper {
    position: relative;
    width: 100%;
    max-width: var(--max-width);
    margin: 0 auto;
}

/* Vertical Centering & Compression System */
#view-container {
    display: flex;
    flex-direction: column;
    min-height: calc(100vh - var(--header-status-height));
    transition: all 0.3s ease;
}

/* Common container classes that should center vertically if space allows */
.game-container, 
.lobby-container, 
.room-container, 
.results-container,
.lobby-content-wrapper,
.lobby-view-wrapper,
.results-screen,
.static-content-container {
    margin: auto 0; /* THE KEY: centers vertically if content < container height */
    padding: var(--game-padding);
    display: flex;
    flex-direction: column;
    gap: var(--game-gap);
    width: 100%;
    max-width: 960px;
    margin-left: auto;
    margin-right: auto;
}

.hidden { display: none !important; }

/* ============================================
   Utility Classes
   ============================================ */
.flex-between { display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }
.flex-center { display: flex; align-items: center; justify-content: center; gap: 1rem; }
.flex-column { display: flex; flex-direction: column; }
.text-center { text-align: center; }
.text-muted { color: var(--text-muted); }
.m-0 { margin: 0 !important; }
.mt-1 { margin-top: 0.25rem !important; }
.mt-2 { margin-top: 0.5rem !important; }
.mt-3 { margin-top: 1rem !important; }
.mt-4 { margin-top: 1.5rem !important; }
.mb-1 { margin-bottom: 0.25rem !important; }
.mb-2 { margin-bottom: 0.5rem !important; }
.mb-3 { margin-bottom: 1rem !important; }
.mb-4 { margin-bottom: 1.5rem !important; }
.w-100 { width: 100% !important; }

/* Lobby Header Responsive Fix */
.lobby-header {
    width: 100%;
    margin-bottom: var(--game-gap);
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 1.5rem;
}

.lobby-header > div {
    display: flex;
    gap: 1rem;
    width: 100%;
    justify-content: center;
}

@media (max-width: 500px) {
    .lobby-header {
        gap: 1rem !important;
    }
    
    .lobby-header .hero-title {
        font-size: 2rem !important;
    }

    .lobby-header > div {
        flex-direction: column-reverse; /* Put 'Creează Cameră' (last btn) on top */
        gap: 0.75rem;
    }

    .lobby-header .btn {
        width: 100%;
        flex: none;
        font-size: 1.25rem !important; /* Increased by ~40% (from ~0.9rem) */
        padding: 1rem 0.5rem !important;
        white-space: normal;
        line-height: 1.2;
        min-height: 56px;
    }
}

/* ============================================
   Background Effects
   ============================================ */
.bg-effects, .background-blobs {
    position: fixed;
    inset: 0;
    z-index: 0;
    overflow: hidden;
    pointer-events: none;
}

.blob {
    position: absolute;
    border-radius: 50%;
    filter: blur(60px);
    opacity: 0.15;
    transform: translateZ(0);
    backface-visibility: hidden;
}

.blob-1 {
    width: 800px; height: 800px;
    background: radial-gradient(circle, var(--primary) 0%, transparent 70%);
    top: -200px; right: -250px;
}

.blob-2 {
    width: 600px; height: 600px;
    background: radial-gradient(circle, var(--accent) 0%, transparent 70%);
    bottom: -150px; left: -150px;
}

.blob-3 {
    width: 500px; height: 500px;
    background: radial-gradient(circle, var(--secondary) 0%, transparent 70%);
    top: 50%; left: 50%;
    transform: translate(-50%, -50%);
    opacity: 0.08;
}

.grid-overlay {
    position: absolute;
    inset: 0;
    background-image: 
        linear-gradient(rgba(255,255,255,0.012) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255,255,255,0.012) 1px, transparent 1px);
    background-size: 60px 60px;
    pointer-events: none;
    z-index: -1;
}

body.no-effects .grid-overlay {
    background-image: 
        linear-gradient(rgba(255,255,255,0.008) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255,255,255,0.008) 1px, transparent 1px);
}

@keyframes blobMove1 {
    0% { transform: translate(0, 0) scale(1); }
    50% { transform: translate(-150px, 150px) scale(1.1); }
    100% { transform: translate(-250px, 100px) scale(0.9); }
}

@keyframes blobMove2 {
    0% { transform: translate(0, 0) scale(1); }
    50% { transform: translate(200px, -100px) scale(1.15); }
    100% { transform: translate(100px, -200px) scale(0.95); }
}

@keyframes blobMove3 {
    0% { transform: translate(-50%, -50%) scale(1); }
    100% { transform: translate(-30%, -60%) scale(1.3); }
}

/* ============================================
   Header
   ============================================ */
/* Header styles moved to the end of file for better management */

/* ============================================
   Buttons & Inputs
   ============================================ */
.btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    padding: 0.8rem 1.6rem;
    border-radius: 1rem;
    font-family: var(--font);
    font-weight: 700;
    font-size: 0.95rem;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    border: 1px solid transparent;
    width: 100%;
    white-space: nowrap;
    position: relative;
    overflow: hidden;
}

.btn:disabled, .btn.is-disabled {
    opacity: 0.4;
    cursor: not-allowed;
    pointer-events: none;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary), var(--accent));
    color: white;
    box-shadow: 0 4px 15px var(--primary-glow);
    border-color: rgba(255,255,255,0.1);
    font-size: 1.2rem !important;
}

.btn-primary:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 25px var(--primary-glow);
    filter: brightness(1.1);
}

.btn-secondary {
    background: rgba(255,255,255,0.05);
    color: var(--text-main);
    border-color: var(--border);
}

/* Standardized 90vh Modals */
.modal-overlay.modal-90vh {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    padding: 1vh 0; /* Reduced from 2vh */
}

.modal-overlay.modal-90vh > .modal-content {
    height: 90vh;
    max-height: 90vh;
    width: 95%;
    max-width: 700px;
    margin: auto; /* Ensure centering within flex container */
}

/* Laptop/Desktop sizing: 1/3 width, 80% height, perfectly centered */
@media (min-width: 1024px) {
    .modal-overlay.modal-90vh {
        align-items: center !important;
        justify-content: center !important;
    }
    .modal-overlay.modal-90vh > .modal-content {
        width: 33.33vw !important;
        max-width: none !important;
        height: 90vh !important;
        max-height: 90vh !important;
    }
}

.modal-overlay.modal-90vh > .modal-content > .glass-card {
    height: 100%;
    display: flex;
    flex-direction: column;
    padding: 0.75rem !important;
    padding-top: 0.5rem !important;
    overflow: hidden;
}

.modal-section-settings {
    margin: auto 0 !important; /* THE KEY: centers settings vertically if space allows */
}

.modal-overlay.modal-90vh .modal-inner {
    flex: 1;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
}

.modal-overlay.modal-90vh #modal-title {
    font-size: 1.5rem !important;
    margin: 0 !important; /* Force no margins at all */
    padding: 0 !important;
}

.modal-overlay.modal-90vh .modal-header {
    padding-bottom: 0 !important;
}

.modal-overlay.modal-90vh #modal-body {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    padding-top: 0 !important;
    padding-bottom: 1.5rem !important; /* Spațiu pentru ultimul buton */
}

.modal-flex-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    height: 100%;
}

.modal-section-header, .modal-section-footer {
    flex-shrink: 0;
}

.modal-section-footer {
    position: sticky;
    bottom: -1.5rem;
    margin-top: auto;
    padding: 1.5rem 0 1rem 0;
    border-top: 1px solid rgba(255,255,255,0.05);
    background: linear-gradient(to top, var(--bg-card) 85%, transparent);
    z-index: 20;
}

/* Floating Launch Button Support for Mobile Keyboard */
@media (max-width: 768px) {
    .modal-section-footer.keyboard-fixed {
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        z-index: 2000;
        background: var(--bg-card);
        padding: 0.75rem 1rem;
        box-shadow: 0 -10px 25px rgba(0,0,0,0.5);
        backdrop-filter: blur(15px);
        -webkit-backdrop-filter: blur(15px);
        border-top: 1px solid rgba(255,255,255,0.1);
        animation: slideUp 0.3s ease-out;
    }
}

@keyframes slideUp {
    from { transform: translateY(100%); }
    to { transform: translateY(0); }
}

.modal-section-settings {
    flex: 1;
    overflow-y: auto;
    padding-right: 0.5rem;
    margin-bottom: 0.5rem;
    scrollbar-width: none;
}

.modal-section-settings::-webkit-scrollbar {
    display: none;
}

/* Compact Mode Cards in Modals */
.modal-flex-container .mode-card {
    padding: 0.35rem !important;
    min-height: 60px !important; /* Specific min-height to keep it small */
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
}

.modal-flex-container .mode-card[id^="qcount-"] {
    height: 45px !important;
    min-height: 45px !important;
}

.modal-flex-container .mode-card i {
    font-size: 1.1rem !important; /* Reduced from 1.2rem */
    margin-bottom: 0.1rem !important; /* Reduced from 0.25rem */
}

.modal-flex-container .mode-card h4 {
    font-size: 1rem !important; /* Increased from 0.8rem */
    margin-bottom: 0 !important;
    line-height: 1 !important;
}

.modal-flex-container .mode-card small {
    font-size: 0.8rem !important; /* Increased from 0.65rem */
    margin-top: 0 !important;
    opacity: 0.7;
}

.modal-flex-container label {
    margin-bottom: 0.25rem !important;
    margin-top: 0.25rem !important;
    font-size: 1.3rem !important; /* +50% from ~0.85rem */
    font-weight: 800;
    opacity: 0.9;
}

.modal-flex-container .form-group {
    margin-bottom: 0 !important; /* Remove the 1.25rem default */
}

/* Compact Grid & Scrollable Selectors */
.modal-flex-container .mode-selector {
    display: grid;
    grid-template-columns: repeat(3, 1fr) !important; /* Force 3 columns */
    gap: 0.25rem !important;
    max-height: 20vh; /* Reduced to leave space for categories and button */
    min-height: 80px;
    overflow-y: auto;
    padding-right: 4px;
}

@media (max-width: 300px) {
    .modal-flex-container .mode-selector {
        grid-template-columns: repeat(2, 1fr) !important; /* Fallback for extremely narrow screens */
    }
}

/* For moderate to tall screens, show all mode cards and increase spacing */
@media (min-height: 630px) {
    .modal-flex-container {
        gap: 0.75rem; /* Slightly more space on taller screens */
    }
    .modal-flex-container .mode-selector {
        max-height: none !important; /* Show all cards */
        overflow-y: visible !important;
    }
    .modal-overlay.modal-90vh > .modal-content > .glass-card {
        padding: 1rem !important; /* Reduced from 1.5rem */
    }
    .modal-flex-container label {
        margin-bottom: 0.4rem !important;
        font-size: 1.2rem !important; /* +50% from 0.8rem */
    }
}

.modal-flex-container .grid-3 {
    grid-template-columns: repeat(3, 1fr);
}

.modal-flex-container .flex-nowrap-selector {
    display: flex !important;
    flex-wrap: nowrap !important;
    max-height: none; /* Rounds shouldn't scroll */
    overflow: visible;
}

.modal-flex-container .input-wrapper {
    padding: 0.5rem 1rem !important;
}

.modal-flex-container .form-input {
    padding: 0.35rem 0.75rem !important;
    font-size: 1.05rem !important; /* Increased from 0.85rem */
}

/* Optimized scroll area for sets */
.modal-flex-container #set-selector-group {
    overflow: hidden;
    min-height: 10vh; /* Reduced */
}

@media (min-height: 630px) {
    .modal-flex-container #set-selector-group {
        min-height: auto;
    }
    .modal-flex-container #set-selector-placeholder {
        max-height: none !important;
        overflow-y: visible !important;
    }
}

.modal-flex-container #set-selector-placeholder {
    flex: 1;
    overflow-y: auto;
    padding-bottom: 60px; /* Space for the floating-like button at bottom if it gets pushed up */
}

.modal-flex-container .flex-nowrap-selector {
    display: flex !important;
    flex-wrap: nowrap !important;
    gap: 0.25rem !important; /* Reduced from 0.5rem */
    width: 100%;
    min-height: auto !important; /* Remove the 80px default */
}

.modal-flex-container .flex-nowrap-selector .mode-card {
    flex: 1;
    min-width: 0; /* Allow shrinking below content width */
    white-space: nowrap;
}

.btn-danger:hover {
    box-shadow: 0 8px 25px rgba(239, 68, 68, 0.4);
    transform: translateY(-3px);
}

.btn-google {
    background: white;
    color: #444;
    border: 1px solid #ddd;
    margin-bottom: 1rem;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
}

.btn-google:hover {
    background: #f8f9fa;
    border-color: #ccc;
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0,0,0,0.1);
}

.btn-google img {
    width: 18px;
    height: 18px;
}

.auth-divider {
    display: flex;
    align-items: center;
    text-align: center;
    margin: 1.5rem 0;
    color: var(--text-dim);
    font-size: 0.85rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.auth-divider::before,
.auth-divider::after {
    content: '';
    flex: 1;
    border-bottom: 1px solid var(--border);
}

.auth-divider:not(:empty)::before {
    margin-right: .75em;
}

.auth-divider:not(:empty)::after {
    margin-left: .75em;
}

.form-input {
    width: 100%;
    background: rgba(0,0,0,0.2);
    border: 1px solid var(--border);
    padding: 0.8rem 1.25rem;
    border-radius: 0.75rem;
    color: var(--text-main);
    font-family: var(--font);
    transition: var(--transition);
}

.form-input:focus {
    outline: none;
    border-color: var(--primary);
    background: rgba(0,0,0,0.3);
    box-shadow: 0 0 0 4px var(--primary-glow);
}

.logo {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    text-decoration: none;
    color: var(--text-main);
    transition: var(--transition);
}

/* Logo styles moved to end of file */

.logo:hover .header-logo-img {
    transform: scale(1.05);
    box-shadow: 0 0 25px var(--primary-glow);
}

.logo:hover { transform: scale(1.02); }

.logo-icon {
    width: 44px; height: 44px;
    display: flex; align-items: center; justify-content: center;
    background: linear-gradient(135deg, var(--primary), var(--accent));
    border-radius: 12px;
    font-size: 1.3rem;
    color: white;
    box-shadow: 0 4px 15px var(--primary-glow);
}

.game-detail-modal .modal-inner {
    padding: 0 !important;
    height: 100%;
}

.game-detail-title {
    font-size: 1.5rem;
    font-weight: 800;
    margin-bottom: 0.25rem;
    line-height: 1.2;
}

.game-detail-short {
    font-size: 1rem;
    opacity: 0.7;
    line-height: 1.4;
}

.game-detail-desc {
    font-size: 1.05rem;
    line-height: 1.6;
    margin: 1.25rem 0;
    color: var(--text-muted);
}

.detail-stat {
    font-size: 1rem;
    font-weight: 600;
}

/* Mobile Compression & Tag Hiding */
@media (max-width: 600px) {
    
    .game-detail-desc {
        display: -webkit-box;
        -webkit-line-clamp: 6;
        -webkit-box-orient: vertical;
        overflow: hidden;
        font-size: 0.95rem !important;
        margin: 0.75rem 0 !important;
    }
    
    .game-detail-title {
        font-size: 1.3rem;
    }
    
    .game-detail-short {
        font-size: 0.9rem;
    }
}

.logo-text {
    font-size: 2.2rem;
    font-weight: 800;
    letter-spacing: -0.5px;
    color: var(--logo-color);
}

.logo-accent {
    background: linear-gradient(135deg, var(--primary), var(--accent));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.logo-text small {
    font-weight: 400;
    font-size: 0.9rem;
    opacity: 0.6;
    -webkit-text-fill-color: var(--text-muted);
}

/* Nav styles moved to end of file */

#user-area {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: nowrap;
}

.nav-btn {
    width: 42px; height: 42px;
    display: flex; align-items: center; justify-content: center;
    background: none;
    border: 1px solid var(--border);
    border-radius: 12px;
    color: var(--text-muted);
    font-size: 1.1rem;
    cursor: pointer;
    transition: var(--transition);
    flex-shrink: 0;
}

.nav-btn:hover {
    color: var(--primary);
    border-color: var(--primary);
    background: rgba(99, 102, 241, 0.1);
    transform: translateY(-1px);
}

.user-badge {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.35rem 1rem 0.35rem 0.45rem;
    background: var(--glass);
    border: 1px solid var(--border);
    border-radius: 50px;
    cursor: default;
    font-weight: 600;
    font-size: 0.95rem;
    white-space: nowrap;
    height: 42px;
    flex-shrink: 0;
}

.user-avatar {
    width: 32px; height: 32px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary), var(--accent));
    display: flex; align-items: center; justify-content: center;
    font-size: 0.85rem;
    color: white;
    font-weight: 700;
}

/* Auth button (logged out) */
.btn-auth-header {
    padding: 0.55rem 1.25rem;
    background: linear-gradient(135deg, var(--primary), var(--accent));
    border: none;
    border-radius: 50px;
    color: white;
    font-weight: 700;
    font-size: 0.9rem;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    gap: 0.4rem;
    font-family: var(--font);
    flex-shrink: 0;
}

.btn-auth-header:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px var(--primary-glow);
}

.btn-logout-header {
    background: none;
    border: 1px solid rgba(239, 68, 68, 0.3);
    color: var(--danger);
    padding: 0.5rem;
    width: 42px; height: 42px;
    display: flex; align-items: center; justify-content: center;
    border-radius: 12px;
    cursor: pointer;
    font-size: 1rem;
    transition: var(--transition);
    flex-shrink: 0;
}

.btn-logout-header:hover {
    background: rgba(239, 68, 68, 0.1);
    border-color: var(--danger);
    transform: translateY(-1px);
}

/* ============================================
   Hero Section
   ============================================ */
main {
    position: relative;
    z-index: 1;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1.5rem;
    min-height: auto;
}

/* ============================================
  Forms & Modals (Premium Design)
   ============================================ */
.room-create-form {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 1px;
}

.input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.input-wrapper i {
    position: absolute;
    left: 1.25rem;
    color: var(--primary);
    opacity: 0.6;
    pointer-events: none;
}

.input-wrapper .form-input {
    padding-left: 3rem;
}

.mode-selector {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

.mode-card {
    background: rgba(255,255,255,0.03);
    border: 1px solid var(--border);
    border-radius: 1.25rem;
    padding: 1.25rem;
    text-align: center;
    cursor: pointer;
    transition: var(--transition);
    position: relative; /* For pro-tag positioning */
}

.mode-card.is-locked {
    opacity: 0.5;
    filter: grayscale(1);
    cursor: not-allowed;
    border: 1px dashed var(--text-dim);
}

body.theme-light .mode-card.is-locked {
    background: rgba(0, 0, 0, 0.03);
}

.mode-card i {
    font-size: 1.5rem;
    margin-bottom: 0.75rem;
    color: var(--text-dim);
}

.mode-card h4 {
    margin: 0;
    font-size: 1rem;
    font-weight: 800;
}

.mode-card p {
    margin: 0.25rem 0 0;
    font-size: 0.75rem;
    opacity: 0.5;
}

.mode-card:hover {
    background: rgba(255,255,255,0.06);
    border-color: var(--text-muted);
}

.mode-card.selected {
    background: var(--primary-glow);
    border-color: var(--primary);
    box-shadow: 0 0 20px var(--primary-glow);
}

.mode-card.selected i {
    color: var(--primary);
}

.checkbox-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
}

.checkbox-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.6rem 1rem;
    background: rgba(255,255,255,0.05);
    border: 1px solid var(--border);
    border-radius: 50px;
    cursor: pointer;
    font-size: 0.85rem;
    font-weight: 600;
    transition: var(--transition);
}

.checkbox-item input {
    display: none;
}

.checkbox-item.checked {
    background: var(--primary-glow);
    border-color: var(--primary);
    color: var(--primary);
}

.checkbox-item.checked i {
    color: var(--primary);
}

.checkbox-item i {
    margin-right: 2px;
}

.checkbox-item:hover:not(.disabled) {
    background: var(--glass-hover);
}

.hero {
    text-align: center;
    padding: 0.5rem 0 1rem;
    max-width: 700px;
    margin: 0 auto;
}

.hero-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.4rem 1.2rem;
    background: rgba(99, 102, 241, 0.1);
    border: 1px solid rgba(99, 102, 241, 0.2);
    border-radius: 50px;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--primary-light);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 1.5rem;
    animation: fadeInDown 0.6s ease-out;
}

.hero-title {
    font-size: 1.9rem;
    font-weight: 900;
    line-height: 1.1;
    margin-bottom: 1.25rem;
    letter-spacing: -1px;
    animation: fadeInUp 0.6s ease-out 0.1s backwards;
}

.gradient-text {
    background: linear-gradient(135deg, var(--primary), var(--accent), var(--secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    background-size: 200% 200%;
    animation: gradientShift 4s ease-in-out infinite;
}

@keyframes gradientShift {
    0%, 100% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
}

.hero-subtitle {
    font-size: 1.15rem;
    color: var(--text-muted);
    max-width: 800px;
    margin: 0 auto;
    text-align: center;
    animation: fadeInUp 0.6s ease-out 0.2s backwards;
}

@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes fadeInDown {
    from { opacity: 0; transform: translateY(-15px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ============================================
   Games Section
   ============================================ */
.games-section {
    padding-bottom: 4rem;
}

.section-header {
    margin-bottom: 2rem;
}

.section-header h2 {
    font-size: 2.1rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.section-header h2 i {
    color: var(--warning);
    font-size: 1.2rem;
}

.games-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 1.5rem;
}

/* ---- Game Card ---- */
.game-card {
    position: relative;
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 2rem;
    cursor: pointer;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.game-card::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 4px;
    background: var(--game-gradient);
    opacity: 0.6;
    transition: opacity var(--transition);
}

.game-card:hover {
    transform: translateY(-8px);
    border-color: var(--border-hover);
    background: var(--card-bg-hover);
    box-shadow: var(--shadow-card), var(--shadow-glow);
}

.game-card:hover::before { opacity: 1; }

.game-card-header {
    display: flex;
    align-items: flex-start;
    gap: 1rem;
}

.game-icon {
    width: 60px; height: 60px;
    border-radius: 16px;
    display: flex; align-items: center; justify-content: center;
    font-size: 2.0rem;
    color: white;
    background: var(--game-gradient);
    flex-shrink: 0;
    box-shadow: 0 4px 15px var(--game-glow);
    transition: transform var(--transition);
}

.game-card:hover .game-icon { transform: scale(1.1) rotate(-3deg); }

.game-info { flex: 1; min-width: 0; }

.game-name {
    font-size: 1.5rem;
    font-weight: 800;
    margin-bottom: 0.25rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.badge-18, .badge-pro {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.15rem 0.5rem;
    border-radius: 6px;
    font-size: 0.65rem;
    font-weight: 800;
    letter-spacing: 0.5px;
    white-space: nowrap;
}

.badge-18 {
    background: rgba(239, 68, 68, 0.15);
    border: 1px solid rgba(239, 68, 68, 0.3);
    color: var(--danger);
}

.badge-pro {
    background: rgba(168, 85, 247, 0.15);
    border: 1px solid rgba(168, 85, 247, 0.3);
    color: var(--accent);
}

.game-desc {
    color: var(--text-muted);
    font-size: 0.9rem;
    line-height: 1.5;
}

.game-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 0.75rem;
    margin-top: auto;
}

.game-tags {
    display: flex;
    gap: 0.4rem;
    flex-wrap: wrap;
}

.tag {
    padding: 0.2rem 0.65rem;
    background: rgba(99, 102, 241, 0.1);
    border-radius: 50px;
    font-size: 0.72rem;
    font-weight: 600;
    color: var(--primary-light);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.game-stat {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    font-size: 0.85rem;
    color: var(--text-dim);
}

.game-stat i { font-size: 0.8rem; }

/* Mobile Game Card Layout */
@media (max-width: 768px) {
    .game-card-header {
        display: grid !important;
        grid-template-columns: 60px 1fr;
        grid-template-areas: 
            "name name"
            "icon desc";
        gap: 0.2rem 1rem;
        align-items: center;
    }

    .game-info {
        display: contents; /* Permite numelui și descrierii să fie parte din grila header-ului */
    }

    .game-name {
        grid-area: name;
        justify-content: center;
        text-align: center;
        margin-bottom: 0.05rem;
        width: 100%;
        font-size: 1.5rem; /* Sincronizat cu varianta desktop cerută */
    }

    .game-icon {
        grid-area: icon;
        width: 50px; height: 50px; /* Puțin mai mic pe mobil pentru a lăsa loc descrierii */
    }

    .game-desc {
        grid-area: desc;
        text-align: left;
        font-size: 0.85rem;
        line-height: 1.3;
    }
    
    .game-card {
        padding: 1.5rem; /* Padding redus pe mobil */
    }
}
.role-reveal-container {
    perspective: 1000px;
    margin: 1.5rem auto;
    width: 100%;
    max-width: 280px;
    height: 380px;
}

.role-card-flip {
    width: 100%;
    height: 100%;
    position: relative;
    transform-style: preserve-3d;
    transition: transform 0.6s cubic-bezier(0.4, 0, 0.2, 1);
    cursor: pointer;
}

.role-card-flip.flipped {
    transform: rotateY(180deg);
}

.card-front, .card-back {
    position: absolute;
    width: 100%;
    height: 100%;
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    border-radius: 24px;
    padding: 2rem;
    text-align: center;
    box-shadow: 0 10px 30px rgba(0,0,0,0.3);
    border: 1px solid rgba(255,255,255,0.1);
}

.card-front {
    background: linear-gradient(135deg, var(--primary), #818cf8);
    z-index: 2;
}

.card-back {
    background: rgba(15, 23, 42, 0.95);
    transform: rotateY(180deg);
    border: 2px solid var(--primary);
    z-index: 1;
}

.role-card-flip .role-name {
    font-size: 2rem;
    font-weight: 900;
    margin: 0.5rem 0;
    background: linear-gradient(to bottom, #fff, #cbd5e1);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.role-card-flip .location-name {
    font-size: 1.6rem;
    font-weight: 800;
    color: #f59e0b;
    margin-top: 0.5rem;
}

.spionul-instructions {
    background: rgba(255,255,255,0.03);
    border-radius: 16px;
    padding: 1.25rem;
    font-size: 0.9rem;
    margin-top: 1rem;
    border: 1px solid rgba(255,255,255,0.05);
}

.spionul-instructions p {
    margin-bottom: 0.5rem;
    line-height: 1.4;
}

.spionul-instructions strong {
    color: var(--primary);
}

/* ---- Coming Soon Card ---- */
.game-card.coming-soon {
    opacity: 0.5;
    cursor: default;
    border-style: dashed;
}

.game-card.coming-soon:hover {
    transform: none;
    box-shadow: none;
    background: var(--card-bg);
}

.game-card.coming-soon .game-icon {
    background: var(--glass);
    color: var(--text-muted);
    box-shadow: none;
}

/* ============================================
   Buttons
   ============================================ */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.85rem 1.75rem;
    border-radius: var(--radius);
    border: none;
    font-family: var(--font);
    font-weight: 700;
    font-size: 1rem;
    cursor: pointer;
    transition: all var(--transition);
    text-decoration: none;
    line-height: 1;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary), var(--accent));
    color: white;
    box-shadow: 0 8px 25px var(--primary-glow);
}

.btn-primary:hover {
    transform: translateY(-3px);
    box-shadow: 0 12px 35px var(--primary-glow);
}

.btn-primary:active { transform: translateY(-1px); }

.btn-lg {
    width: 100%;
    padding: 1rem;
    font-size: 1.05rem;
    border-radius: var(--radius);
}

.btn-secondary {
    background: var(--glass);
    color: var(--text-main);
    border: 1px solid var(--border);
}

.btn-secondary:hover {
    background: var(--glass-hover);
    border-color: var(--border-hover);
}

.btn-ghost {
    background: none;
    border: none;
    color: var(--text-muted);
    padding: 0.6rem;
    font-family: var(--font);
    cursor: pointer;
    transition: var(--transition);
    width: 100%;
    text-align: center;
    font-size: 0.9rem;
}

.btn-ghost:hover { color: var(--primary-light); }

.btn-link-sm {
    background: none;
    border: none;
    color: var(--primary-light);
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    padding: 0.25rem 0;
    transition: all 0.2s ease;
    opacity: 0.75;
    text-decoration: none;
    display: inline-block;
}

.btn-link-sm:hover {
    opacity: 1;
    color: #fff;
    transform: translateX(-2px);
}

.text-right { text-align: right; }
.mt-1 { margin-top: 0.25rem; }

.btn-play {
    background: var(--game-gradient);
    color: white;
    font-size: 1.1rem;
    padding: 1rem 2rem;
    border-radius: var(--radius);
    width: 100%;
    box-shadow: 0 8px 25px var(--game-glow);
}

.btn-play:hover {
    transform: translateY(-3px);
    box-shadow: 0 12px 35px var(--game-glow);
}

.btn-play:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

/* ============================================
   Modal
   ============================================ */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.75);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 25000;
    padding: 15px; /* Margine fixă de 15px față de ecran */
    overflow: hidden; /* Overlay-ul nu mai face scroll, modal-ul face */
}

.modal-content {
    width: 100%;
    height: 100%;
    max-width: 1200px;
    max-height: 900px;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    animation: modalShake 0.25s cubic-bezier(.36,.07,.19,.97) both;
    overflow: hidden; /* Prevent horizontal overflow from content */
}

/* Stil premium pentru cardurile din interiorul modalelor */
.modal-content .glass-card {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    padding: 2.5rem 2rem 1.5rem 2rem;
    overflow-y: hidden; /* Changed to hidden to let modal-section-settings handle scroll */
    border-radius: 24px;
    border: 1px solid rgba(255, 255, 255, 0.15);
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.1), rgba(255, 255, 255, 0.04));
    box-shadow: 
        0 25px 50px -12px rgba(0, 0, 0, 0.6),
        inset 0 0 20px rgba(255, 255, 255, 0.05);
    
    /* Hide Scrollbar */
    scrollbar-width: none !important; /* Firefox */
    -ms-overflow-style: none !important; /* IE/Edge */
    overflow-x: hidden;
}
.modal-content .glass-card::-webkit-scrollbar,
.modal-content::-webkit-scrollbar,
.modal-inner::-webkit-scrollbar,
.modal-body::-webkit-scrollbar {
    display: none !important; /* Chrome/Safari */
}

/* Centrare verticală pentru conținutul intern */
.modal-inner, .modal-body {
    width: 100%;
    max-width: 800px;
    display: flex;
    flex-direction: column;
    flex: 1;
}

.modal-inner {
    height: 100%;
}

.modal-body.modal-centered-content {
    display: flex !important;
    flex-direction: column !important;
    justify-content: center !important;
}

.modal-body.modal-centered-content > .lobby-view-wrapper,
.modal-body.modal-centered-content > .lobby-action-section,
.modal-body.modal-centered-content > .rules-modal-content {
    margin-top: auto !important;
    margin-bottom: auto !important;
}

body.modal-open {
    overflow: hidden !important;
}

.modal-overlay.hidden {
    opacity: 0;
    pointer-events: none;
}

/* Force visibility during critical phases like Replay */
body.replay-active-modal #premium-modal,
body.replay-active-modal #game-modal,
body.replay-active-modal #action-modal,
body.replay-active-modal #nickname-modal {
    display: flex !important;
    opacity: 1 !important;
    pointer-events: all !important;
    z-index: 30000 !important;
    visibility: visible !important;
}

.modal-90vh {
    /* Acum modalele sunt mari implicit, modal-90vh devine redundant */
    align-items: center !important;
}

.modal-90vh .modal-content {
    height: 100%;
}

.modal-90vh .glass-card {
    height: 100%;
    overflow-y: auto !important;
}

/* Custom Scrollbar for Categorii */
/* --- Professional Category Selector (Premium UI) --- */
/* --- Professional Lobby UI --- */
.lobby-view-wrapper {
    width: 100%;
    max-width: 1000px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    padding: 0.5rem 0;
    animation: fadeIn 0.4s ease-out;
    box-sizing: border-box;
}

.lobby-top-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 1.25rem;
    background: rgba(255, 255, 255, 0.03);
    backdrop-filter: blur(10px);
    border-radius: 16px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    width: 100%;
    box-sizing: border-box;
}

.lobby-room-name {
    font-size: 1.8rem;
    font-weight: 900;
    margin: 0;
    background: linear-gradient(135deg, #fff 0%, rgba(255,255,255,0.7) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    letter-spacing: -0.02em;
    word-break: break-all;
}

.lobby-status-badges {
    display: flex;
    gap: 0.75rem;
    margin-top: 0.5rem;
}

.lobby-badge {
    padding: 0.35rem 0.85rem;
    border-radius: 50px;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.lobby-badge.primary { background: rgba(99, 102, 241, 0.15); color: #818cf8; border: 1px solid rgba(99, 102, 241, 0.2); }
.lobby-badge.secondary { background: rgba(255, 255, 255, 0.05); color: rgba(255,255,255,0.6); border: 1px solid rgba(255, 255, 255, 0.1); }

.lobby-actions {
    display: flex;
    gap: 0.75rem;
}

.btn-icon-lobby {
    width: 48px;
    height: 48px;
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.btn-icon-lobby:hover {
    background: rgba(255, 255, 255, 0.1);
    transform: translateY(-2px);
    border-color: rgba(255, 255, 255, 0.2);
}

.btn-icon-lobby.exit:hover {
    background: rgba(239, 68, 68, 0.15);
    color: #ef4444;
    border-color: rgba(239, 68, 68, 0.3);
}

.lobby-main-content {
    display: grid;
    grid-template-columns: 1fr;
    gap: 0.75rem;
    width: 100%;
}

.lobby-players-section {
    background: rgba(255, 255, 255, 0.02);
    border-radius: 20px;
    padding: 1.25rem;
    border: 1px solid rgba(255, 255, 255, 0.05);
    width: 100%;
    box-sizing: border-box;
}

.lobby-section-title {
    font-size: 0.8rem;
    font-weight: 800;
    text-transform: uppercase;
    color: rgba(255, 255, 255, 0.25);
    letter-spacing: 0.05em;
    margin-bottom: 0.75rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.lobby-section-title::after {
    content: '';
    flex: 1;
    height: 1px;
    background: linear-gradient(90deg, rgba(255,255,255,0.1), transparent);
}

.lobby-players-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 0.75rem;
}

.player-pill {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 12px;
    padding: 0.65rem 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 600;
    transition: all 0.2s ease;
    font-size: 0.9rem;
    min-width: 0;
    overflow: hidden;
    word-break: break-word;
}

.player-pill.host {
    background: rgba(245, 158, 11, 0.08);
    border-color: rgba(245, 158, 11, 0.3);
    box-shadow: 0 0 20px rgba(245, 158, 11, 0.05);
}

.player-pill i {
    font-size: 1rem;
    opacity: 0.7;
}

.player-pill.host i {
    color: #f59e0b;
    opacity: 1;
}

.lobby-action-section {
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.75rem;
    width: 100%;
}

.start-btn-premium {
    padding: 1rem 3rem;
    font-size: 1.25rem;
    font-weight: 900;
    border-radius: 16px;
    background: linear-gradient(135deg, var(--primary) 0%, #4338ca 100%);
    color: white;
    border: none;
    cursor: pointer;
    box-shadow: 0 10px 40px rgba(99, 102, 241, 0.3);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    letter-spacing: 0.05em;
    width: 100%;
    max-width: 500px;
}

.start-btn-premium:hover:not(:disabled) {
    transform: translateY(-4px) scale(1.02);
    box-shadow: 0 15px 50px rgba(99, 102, 241, 0.4);
}

.start-btn-premium:disabled {
    opacity: 0.4;
    filter: grayscale(0.5);
    cursor: not-allowed;
}

.lobby-share-box {
    margin-top: 1rem;
    padding: 1.5rem;
    border-radius: 24px;
    background: rgba(255, 255, 255, 0.02);
    border: 1px dashed rgba(255, 255, 255, 0.1);
    width: 100%;
    max-width: 500px;
    box-sizing: border-box;
}

/* Fix for Lobby in Modal */
.modal-lobby-adjust {
    width: 100% !important;
    max-width: 100% !important;
    padding: 0 !important;
}
.modal-lobby-adjust .lobby-top-bar {
    margin-bottom: 0.75rem;
    padding: 0.75rem 1rem;
}
.lobby-modal-active .modal-inner {
    padding: 0 !important;
    max-width: 100%;
}
.lobby-modal-active .modal-body {
    max-width: 100%;
    padding: 0.5rem;
    box-sizing: border-box;
}

/* Mobile Responsiveness for Lobby */
@media (max-width: 600px) {
    .lobby-room-name {
        font-size: 1.6rem;
    }
    .lobby-top-bar {
        padding: 0.75rem 1rem;
        flex-direction: row;
        flex-wrap: wrap;
        gap: 0.75rem;
        width: 100%;
        box-sizing: border-box;
    }
    .lobby-info {
        width: 100%;
        text-align: center;
    }
    .lobby-status-badges {
        justify-content: center;
    }
    .lobby-actions {
        position: absolute;
        top: 1rem;
        right: 1rem;
    }
    .lobby-players-grid {
        grid-template-columns: 1fr !important;
    }
    .start-btn-premium {
        font-size: 1.1rem;
        padding: 0.85rem 1.5rem;
    }
    .lobby-share-box div {
        flex-direction: column !important;
        width: 100%;
        gap: 0.5rem !important;
    }
    .lobby-share-box button, .lobby-share-box a {
        max-width: 100% !important;
        width: 100% !important;
        margin: 0 !important;
    }
    .modal-content .glass-card {
        padding: 1rem 0.75rem !important;
    }
    .lobby-section-title {
        font-size: 0.75rem;
        margin-bottom: 0.5rem;
    }
    .lobby-players-section {
        padding: 1rem !important;
    }
}


.category-summary-box {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 16px;
    padding: 0.85rem 1.25rem;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    margin-top: 0.5rem;
    box-shadow: inset 0 2px 4px rgba(0,0,0,0.1);
}

.category-summary-box:hover {
    background: rgba(255, 255, 255, 0.07);
    border-color: var(--primary);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(var(--primary-rgb), 0.15);
}

.summary-text {
    font-size: 0.85rem;
    color: var(--text-dim);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    padding-right: 1rem;
}

.summary-action {
    color: var(--primary);
    font-size: 1.1rem;
    flex-shrink: 0;
}

.badge-count {
    display: none; /* Removed as per user request (moved to footer) */
}

.summary-count-footer {
    display: flex;
    justify-content: flex-end;
    margin-top: 0.5rem;
    padding-right: 0.25rem;
}

.count-text-large {
    font-size: 1.35rem; /* +50% larger than previous summary text */
    font-weight: 900;
    color: var(--primary);
    text-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

/* Modal Selection Overlays */
.selection-modal-content {
    max-width: 650px !important;
    width: 95% !important;
    margin: 2rem auto !important; /* Fixed: use margin top/bottom instead of center auto to allow scrolling to top */
}

.selection-glass-card {
    padding: 1.25rem !important;
    border-radius: 24px !important;
    overflow: visible !important;
    max-height: none !important;
    display: flex;
    flex-direction: column;
    padding-bottom: 5rem !important; /* Space for sticky footer */
}

.selection-footer-sticky {
    position: sticky;
    bottom: -1.25rem; /* Match card padding */
    left: -1.25rem;
    right: -1.25rem;
    background: linear-gradient(to top, var(--bg-card) 85%, transparent);
    padding: 1.5rem 1.25rem 1.25rem;
    margin: auto -1.25rem -1.25rem;
    z-index: 20;
    border-top: 1px solid rgba(255,255,255,0.05);
}

.selection-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    gap: 1rem;
}

.selection-title {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.selection-title > i {
    font-size: 1.5rem;
    color: var(--primary);
    background: rgba(var(--primary-rgb), 0.1);
    width: 45px;
    height: 45px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 12px;
}

.selection-header-container {
    margin-bottom: 1.25rem;
    padding: 2.5rem 0.75rem 0;
    text-align: center;
    position: relative;
}

.btn-close-selector {
    position: absolute;
    top: 0.5rem;
    right: 1rem;
    background: rgba(255, 255, 255, 0.1);
    color: white;
    border: none;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-close-selector:hover {
    background: var(--primary, #ef4444);
    transform: scale(1.1);
}

.selection-main-title {
    width: 100%;
    margin: 0;
    font-size: 1.5rem;
    font-weight: 800;
    text-align: center;
}

.selection-sub-title {
    width: 100%;
    margin: 0.5rem 0 0;
    font-size: 0.9rem;
    color: var(--text-dim);
    text-align: center;
}

.btn-done {
    background: var(--primary);
    color: var(--text-on-primary);
    border: none;
    padding: 1rem 3rem; /* +60% */
    border-radius: 14px;
    font-weight: 800;
    font-size: 1.6rem; /* +60% from 1rem */
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 4px 15px rgba(var(--primary-rgb), 0.4);
}

.btn-done:hover {
    transform: scale(1.05);
    filter: brightness(1.1);
}

.selection-actions-area {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 1.5rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid rgba(255,255,255,0.05);
}

.bulk-actions-row {
    display: flex;
    gap: 0.75rem;
    width: 100%;
    justify-content: center;
}

.bulk-actions-row .btn {
    flex: 1;
    max-width: 180px;
    padding: 0.6rem;
    font-size: 0.85rem;
}

.selection-instruction-text {
    font-size: 0.75rem;
    color: var(--text-dim);
    font-weight: 600;
    margin: 0;
    text-align: center;
    width: 100%;
}



/* Grid & Cards */
.scrollable-selection-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 0.75rem;
    overflow-y: auto;
    padding: 0.5rem;
    margin-right: -0.5rem;
    padding-right: 0.5rem;
}

.scrollable-selection-grid::-webkit-scrollbar {
    width: 5px;
}
.scrollable-selection-grid::-webkit-scrollbar-track {
    background: transparent;
}
.scrollable-selection-grid::-webkit-scrollbar-thumb {
    background: rgba(255,255,255,0.1);
    border-radius: 10px;
}

.category-card {
    background: var(--glass);
    border: 1.5px solid var(--border-hover);
    border-radius: 16px;
    padding: 0.75rem 1rem;
    min-height: 75px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    position: relative;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    user-select: none;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}

.category-card:hover {
    background: var(--glass-hover);
    border-color: var(--primary);
    transform: translateY(-2px);
}

.category-card.is-selected {
    background: rgba(var(--primary-rgb), 0.2) !important;
    border-color: var(--primary) !important;
    border-width: 2.5px;
    box-shadow: 0 8px 25px rgba(var(--primary-rgb), 0.3);
    transform: translateY(-3px);
    z-index: 5;
}

.category-card.is-locked {
    background: rgba(0, 0, 0, 0.05);
    border: 1px dashed var(--text-dim);
    opacity: 0.9;
}

body.theme-light .category-card.is-locked {
    background: rgba(0, 0, 0, 0.03);
}

.category-card.is-locked .card-name {
    color: var(--text-dim);
    opacity: 0.7;
}

.category-card.is-selected .card-name {
    color: var(--text-main);
    font-weight: 900;
}

body.theme-light .category-card.is-selected .card-name {
    color: var(--primary);
}

.card-check {
    position: absolute;
    top: -6px;
    right: -6px;
    width: 26px;
    height: 26px;
    background: var(--primary);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    color: white;
    opacity: 0;
    transform: scale(0.5);
    transition: all 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    box-shadow: 0 3px 8px rgba(0,0,0,0.4);
    z-index: 2;
}

.category-card.is-selected .card-check {
    opacity: 1;
    transform: scale(1);
}

.card-content {
    width: 100%;
}

.card-name {
    font-size: 1.15rem; /* Increased by 10% from 1.05rem */
    color: var(--text-main);
    line-height: 1.2;
    display: block;
    word-break: break-word;
    font-weight: 800;
}

.pro-tag {
    position: absolute;
    top: 6px;
    right: 6px;
    font-size: 0.75rem; /* Creascut cu ~35% de la 0.55rem */
    font-weight: 900;
    background: linear-gradient(135deg, #ffd700, #ff8c00);
    color: #000;
    padding: 2px 7px; /* Ajustat pentru vizibilitate */
    border-radius: 4px;
    text-transform: uppercase;
    box-shadow: 0 2px 5px rgba(0,0,0,0.2);
    border: 1px solid rgba(0,0,0,0.1);
    z-index: 10;
    line-height: 1;
}

@media (max-width: 600px) {
    .pro-tag {
        font-size: 0.55rem; /* Crescut cu 10% de la 0.5rem */
        padding: 1px 5px;
        top: 4px;
        right: 4px;
    }
}

.category-card.is-locked {
    opacity: 0.4;
    filter: grayscale(1);
    cursor: not-allowed;
}

@media (max-width: 600px) {
    .selection-header {
        flex-direction: row;
        align-items: center;
        margin-bottom: 1rem;
    }
    .selection-title h3 {
        font-size: 1.1rem;
    }
    .selection-title p {
        font-size: 0.75rem;
    }
    .btn-done {
        padding: 0.8rem 2rem;
        font-size: 1.4rem;
    }
    .scrollable-selection-grid {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 0.75rem;
    }
    .category-card {
        padding: 0.75rem;
        min-height: 70px;
        text-align: center;
    }
    .card-name {
        font-size: 1rem; /* +10% from 0.9rem */
    }
}

.game-detail-modal { max-width: 520px; }

@keyframes modalShake {
    0% { transform: translateX(0); }
    20% { transform: translateX(-8px); }
    40% { transform: translateX(8px); }
    60% { transform: translateX(-4px); }
    80% { transform: translateX(4px); }
    100% { transform: translateX(0); }
}

.modal-close {
    position: absolute;
    top: 1.25rem; right: 1.25rem;
    width: 40px; height: 40px;
    display: flex; align-items: center; justify-content: center;
    background: var(--glass);
    border: 1px solid var(--border);
    border-radius: 12px;
    color: var(--text-muted);
    font-size: 1.2rem;
    cursor: pointer;
    transition: var(--transition);
    z-index: 2;
}

.modal-close:hover {
    color: var(--danger);
    background: rgba(239, 68, 68, 0.1);
    border-color: rgba(239, 68, 68, 0.3);
}

.modal-inner { padding: 0.5rem; }

.glass-card {
    background: var(--card-bg);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    box-shadow: var(--shadow-card);
}

/* ============================================
   Auth Modal  
   ============================================ */
.auth-header {
    text-align: center;
    margin-bottom: 2rem;
}

.auth-logo-img {
    width: 80px;
    height: auto;
    border-radius: 12px;
    margin: 0 auto 1rem;
    display: block;
    box-shadow: 0 8px 25px var(--primary-glow);
}

.auth-header h2 {
    font-size: 1.6rem;
    font-weight: 800;
    margin-bottom: 0.3rem;
}

.text-muted { color: var(--text-muted); }

/* Form Styles */
.form-group {
    margin-bottom: 1.25rem;
}

.form-group label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
    font-weight: 600;
    font-size: 0.85rem;
    color: var(--text-muted);
}

.modal-section-header .form-group label {
    margin-bottom: 0.25rem;
}

.form-group label i {
    font-size: 0.85rem;
    color: var(--primary);
}

.form-input {
    width: 100%;
    padding: 0.9rem 1rem;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--border);
    border-radius: 12px;
    color: var(--text-main);
    font-size: 1rem;
    font-family: var(--font);
    transition: var(--transition);
}

.form-input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-glow);
    background: rgba(255, 255, 255, 0.06);
}

.form-input::placeholder { color: var(--text-dim); }

.input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.input-wrapper i {
    position: absolute;
    left: 1.1rem;
    color: var(--primary);
    opacity: 0.6;
    pointer-events: none;
    font-size: 0.9rem;
}

.input-wrapper .form-input {
    padding-left: 2.8rem;
}

.form-group small {
    display: block;
    margin-top: 0.4rem;
    font-size: 0.78rem;
}

.error-msg {
    padding: 0.75rem 1rem;
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.2);
    border-radius: 10px;
    color: var(--danger);
    font-size: 0.88rem;
    font-weight: 600;
    text-align: center;
    margin-bottom: 1rem;
    animation: shake 0.4s ease-in-out;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-6px); }
    50% { transform: translateX(6px); }
    75% { transform: translateX(-4px); }
}

/* ============================================
   Game Detail Modal
   ============================================ */
.game-detail-header {
    display: flex;
    align-items: center;
    gap: 1.25rem;
    margin-bottom: 1.5rem;
}

.game-detail-icon {
    width: 72px; height: 72px;
    border-radius: 20px;
    display: flex; align-items: center; justify-content: center;
    font-size: 2rem;
    color: white;
    flex-shrink: 0;
    box-shadow: 0 8px 25px var(--game-glow);
}

.game-detail-title {
    font-size: 1.6rem;
    font-weight: 800;
    margin-bottom: 0.2rem;
}

.game-detail-short {
    color: var(--text-muted);
    font-size: 0.9rem;
}

.game-detail-desc {
    color: var(--text-muted);
    font-size: 0.95rem;
    line-height: 1.7;
    margin-bottom: 1.5rem;
    padding: 1.25rem;
    background: var(--glass);
    border-radius: var(--radius);
    border: 1px solid var(--border);
}

.game-detail-stats {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.75rem;
    margin-bottom: 1.5rem;
}

.detail-stat {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.75rem 1rem;
    background: var(--glass);
    border-radius: 12px;
    border: 1px solid var(--border);
    font-size: 0.88rem;
}

.detail-stat i {
    color: var(--primary);
    font-size: 1rem;
    width: 20px;
    text-align: center;
}

.game-detail-tags {
    display: flex;
    flex-wrap: nowrap; /* Force one row */
    gap: 0.4rem;
    margin-bottom: 1rem;
    overflow: hidden;
    width: 100%;
}

.game-detail-tags .tag {
    font-size: 0.7rem !important; /* Smaller to fit more */
    padding: 0.2rem 0.6rem !important;
    white-space: nowrap;
    flex-shrink: 1; /* Allow shrinking if needed */
}

.login-hint {
    text-align: center;
    color: var(--text-muted);
    font-size: 0.85rem;
    margin-top: 0.75rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
}

.login-hint a {
    color: var(--primary-light);
    text-decoration: none;
    font-weight: 600;
    cursor: pointer;
}

.login-hint a:hover { text-decoration: underline; }

.adult-warning {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.75rem 1rem;
    background: rgba(239, 68, 68, 0.08);
    border: 1px solid rgba(239, 68, 68, 0.15);
    border-radius: 12px;
    font-size: 0.85rem;
    color: var(--danger);
    font-weight: 600;
    margin-bottom: 1rem;
}

/* ============================================
   Loading & Spinners
   ============================================ */
.loading-spinner {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 4rem;
    grid-column: 1 / -1;
    color: var(--text-muted);
}

.spinner {
    width: 48px; height: 48px;
    border: 4px solid var(--border);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin-bottom: 1rem;
}

@keyframes spin { to { transform: rotate(360deg); } }
/* ---- Animations for Crazy & Retro Themes ---- */
@keyframes morph {
    0% { border-radius: 30% 70% 70% 30% / 30% 30% 70% 70%; }
    100% { border-radius: 70% 30% 30% 70% / 70% 70% 30% 30%; }
}

@keyframes scanline {
    0% { transform: translateY(-100%); }
    100% { transform: translateY(100%); }
}

body.theme-crazy .blob {
    animation: morph 8s linear infinite alternate !important;
}

body.theme-retro .grid-overlay::after {
    content: "";
    position: absolute;
    top: 0; left: 0; right: 0; height: 100px;
    background: linear-gradient(to bottom, transparent, rgba(0, 255, 65, 0.05), transparent);
    animation: scanline 10s linear infinite;
}

/* ============================================
   Footer
   ============================================ */
footer {
    position: relative;
    z-index: 1;
    text-align: center;
    padding: 3rem 1.5rem;
    color: var(--text-muted);
    font-size: 0.85rem;
    border-top: 1px solid var(--border);
    margin-top: 5rem;
}

.footer-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.75rem;
}

.footer-links {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    flex-wrap: wrap;
}

.footer-links a {
    color: var(--text-muted);
    text-decoration: none;
    transition: var(--transition);
}

.footer-links a:hover {
    color: var(--primary-light);
}

.footer-links .sep {
    opacity: 0.3;
}

footer.is-hidden {
    display: none !important;
}

/* ============================================
   Toast Notifications
   ============================================ */
.toast-container {
    position: fixed;
    top: 1rem;
    right: 1rem;
    z-index: 30000;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.toast {
    padding: 0.85rem 1.25rem;
    background: var(--card-bg);
    backdrop-filter: blur(20px);
    border: 1px solid var(--border);
    border-radius: 12px;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-main);
    box-shadow: var(--shadow-card);
    animation: toastIn 0.3s ease-out;
    min-width: 250px;
    max-width: 400px;
}

.toast.error { border-color: rgba(239,68,68,0.3); color: var(--danger); }
.toast.success { border-color: rgba(34,197,94,0.3); color: var(--success); }

@keyframes toastIn {
    from { opacity: 0; transform: translateX(30px); }
    to { opacity: 1; transform: translateX(0); }
}

/* ============================================
   Responsive
   ============================================ */
@media (max-width: 768px) {
    header { padding: 0.5rem 1rem; }
    .logo-text { font-size: 1.8rem; }
    .hero { padding: 1rem 0 0.5rem; }
    .hero-title { font-size: 1.8rem; }
    .hero-subtitle { font-size: 0.95rem; }
    .flex-between { flex-wrap: wrap; justify-content: center; text-align: center; }
    .games-grid { grid-template-columns: 1fr; gap: 0.75rem; }
    .game-detail-stats { grid-template-columns: 1fr; gap: 0.5rem; }
    main { padding: 0 0.75rem; }
    .modal-content { max-width: 100%; margin: 1rem auto; }
    .glass-card { padding: 1rem; }
}

@media (max-width: 480px) {
    header { padding: 0.5rem 1rem; }
    .logo-text { font-size: 1.8rem; }
    .hero { padding: 1rem 0 0.5rem; }
    .hero-title { font-size: 1.8rem; }
    .hero-subtitle { font-size: 0.95rem; }
    .flex-between { flex-wrap: wrap; justify-content: center; text-align: center; }
    .games-grid { grid-template-columns: 1fr; gap: 0.75rem; }
    .game-detail-stats { grid-template-columns: 1fr; gap: 0.5rem; }
    main { padding: 0 0.75rem; }
    .modal-content { max-width: 100%; margin: 1rem auto; }
    .glass-card { padding: 1rem; }
}

/* ---- Unified Header Elements ---- */
.game-separator {
    margin: 0 1rem;
    color: var(--border);
    opacity: 0.5;
    font-weight: 300;
}
.game-title-header {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text-main);
    letter-spacing: -0.5px;
    white-space: nowrap;
}

@media (max-width: 380px) {
    .game-title-header { 
        font-size: 0.85rem; 
        max-width: 100px;
        overflow: hidden;
        text-overflow: ellipsis;
    }
    .logo-icon { width: 32px; height: 32px; font-size: 0.9rem; }
    .nav-btn { width: 32px; height: 32px; font-size: 0.85rem; }
}

/* Lobby Tabs Bar */
.lobby-tabs-bar {
    display: flex;
    justify-content: center;
    gap: 0.5rem;
    margin: 1rem auto 2rem auto;
    padding: 0.35rem;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 100px;
    width: fit-content;
    backdrop-filter: blur(10px);
    box-shadow: 0 8px 32px rgba(0,0,0,0.2);
}

.lobby-tab-btn {
    background: transparent;
    border: none;
    color: var(--text-muted);
    padding: 0.6rem 1.25rem;
    border-radius: 100px;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    gap: 0.6rem;
}

.lobby-tab-btn i {
    font-size: 1.1rem;
    opacity: 0.8;
}

.lobby-tab-btn:hover {
    color: var(--text-main);
    background: rgba(255, 255, 255, 0.05);
}

.lobby-tab-btn.active {
    background: var(--primary);
    color: white;
    box-shadow: 0 4px 15px var(--primary-glow);
}

.lobby-tab-btn.exit {
    width: 44px;
    height: 44px;
    padding: 0;
    justify-content: center;
    color: var(--danger);
    background: rgba(239, 68, 68, 0.05);
    margin-left: 0.5rem;
}

.lobby-tab-btn.exit:hover {
    background: var(--danger);
    color: white;
    box-shadow: 0 4px 15px rgba(239, 68, 68, 0.3);
}

.lobby-content-wrapper {
    animation: lobbyContentSlideUp 0.4s ease-out;
}

@keyframes lobbyContentSlideUp {
    from { opacity: 0; transform: translateY(15px); }
    to { opacity: 1; transform: translateY(0); }
}

@media (max-width: 600px) {
    .lobby-tabs-bar {
        width: 100%;
        border-radius: 1.25rem;
        gap: 0.25rem;
        margin-top: 0.5rem;
        margin-bottom: 1rem;
    }
    .lobby-tab-btn {
        padding: 0.6rem 0.5rem;
        font-size: 0.8rem;
        flex: 1;
        justify-content: center;
        gap: 0.4rem;
    }
    .lobby-tab-btn span {
        display: none;
    }
    .lobby-tab-btn i {
        font-size: 1.2rem;
    }
    .lobby-tab-btn.exit {
        margin-left: 0;
        flex: 0 0 40px;
    }
}

/* Rules Content Styling (matching reguli.html) */
.rules-modal-content .section-title { font-size: 1.4rem; font-weight: 800; color: var(--primary); margin: 1.5rem 0 1rem; display: flex; align-items: center; gap: 0.5rem; border-bottom: 1px solid rgba(255,255,255,0.05); padding-bottom: 0.5rem; }
.rules-modal-content .point-box { background: rgba(255,255,255,0.05); border-left: 4px solid var(--primary); padding: 1rem 1.5rem; border-radius: 0 12px 12px 0; margin: 1.5rem 0; }
.rules-modal-content .rules-header { text-align: center; margin-bottom: 2rem; }
.rules-modal-content .rules-icon { font-size: 3rem; margin-bottom: 0.5rem; background: linear-gradient(135deg, var(--primary), var(--accent)); -webkit-background-clip: text; -webkit-text-fill-color: transparent; }
.rules-modal-content .rules-title { font-size: 1.8rem; font-weight: 900; margin: 0; color: #fff; }
.rules-modal-content .rules-subtitle { font-size: 1rem; color: var(--text-muted); margin-top: 0.5rem; }
.rules-modal-content p { line-height: 1.7; margin-bottom: 1rem; }
.rules-modal-content ul { padding-left: 1.2rem; margin-bottom: 1rem; }
.rules-modal-content li { margin-bottom: 0.5rem; }

.lobby-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: var(--game-gap);
    margin-top: var(--game-gap);
}

.room-card {
    background: var(--glass);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: var(--card-padding);
    transition: all 0.3s;
    cursor: pointer;
}

.room-card:hover {
    border-color: var(--primary);
    background: rgba(99, 102, 241, 0.1);
    transform: translateY(-5px);
}

.room-card h3 { margin-bottom: 0.5rem; font-size: 1.25rem; }

.room-badge {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    border-radius: 99px;
    font-size: 0.75rem;
    text-transform: uppercase;
    font-weight: 700;
}

.badge-waiting { background: var(--success); color: white; }
.badge-playing { background: var(--warning); color: white; }

.lobby-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    flex-wrap: wrap;
    gap: 1rem;
}

.lobby-title {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex: 1;
    min-width: 0;
}

.lobby-title h2 {
    font-size: 2rem;
    margin-bottom: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Game View */
.game-container {
    display: grid;
    grid-template-columns: 1fr 300px;
    gap: 2rem;
}

.game-main {
    display: flex; flex-direction: column; gap: 1.5rem;
}

.question-card {
    min-height: 400px;
    display: flex; flex-direction: column;
    justify-content: center;
    position: relative;
    overflow: hidden;
}

@media (max-width: 600px) {
    .question-card {
        min-height: 280px !important;
        padding: 1.25rem 1rem !important;
    }
}

.timer-ring {
    position: absolute; top: 0.75rem; right: 0.75rem;
    width: 60px; height: 60px;
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-weight: 800; font-size: 1.2rem;
    background: rgba(0,0,0,0.3);
    border: 4px solid var(--primary);
}

.question-text {
    font-size: 1.1rem; /* Increased by 10% from 1rem */
    font-weight: 600;
    text-align: center;
    margin-bottom: 2rem;
    line-height: 1.4;
}

/* Buzzer */
.buzzer-container {
    display: flex; justify-content: center; align-items: center;
    padding: 2rem;
}

.btn-buzz {
    width: 250px; height: 250px;
    border-radius: 50%;
    border: 12px solid rgba(255,255,255,0.1);
    background: radial-gradient(circle, #ff4757 0%, #b33939 100%);
    color: white;
    font-size: 2.5rem; font-weight: 900;
    cursor: pointer;
    box-shadow: 0 0 50px rgba(239, 68, 68, 0.4), inset 0 0 30px rgba(0,0,0,0.3);
    transition: all 0.1s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 0.5rem;
}

.btn-buzz:not(:disabled):hover {
    transform: scale(1.05);
    filter: brightness(1.1);
}

.btn-buzz:not(:disabled):active {
    transform: scale(0.9);
    box-shadow: 0 0 10px rgba(239, 68, 68, 0.2);
}

.btn-buzz:disabled { opacity: 0.5; filter: grayscale(0.5); cursor: not-allowed; }
.btn-buzz small { font-size: 0.8rem; font-weight: 400; opacity: 0.8; }

/* Variants */
.variants-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    width: 100%;
}

.btn-variant {
    background: var(--glass);
    border: 1px solid var(--border);
    padding: 1.5rem;
    border-radius: 1.25rem;
    color: var(--text-main);
    font-size: 0.91rem; /* Increased by 10% from 0.825rem */
    text-align: left;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-variant:hover:not(:disabled) {
    background: var(--primary);
    border-color: var(--primary);
    color: var(--text-on-primary) !important;
    transform: translateX(10px);
}

.btn-variant.correct { background: var(--success); border-color: var(--success); color: var(--text-on-success) !important; }
.btn-variant.wrong { background: var(--danger); border-color: var(--danger); color: var(--text-on-danger) !important; }

/* Scoreboard */
.scoreboard {
    display: flex; flex-direction: column; gap: 1rem;
}

.score-entry {
    display: flex; justify-content: space-between; align-items: center;
    padding: 1rem; background: var(--glass);
    border-radius: 1rem; border-left: 4px solid var(--primary);
}

.score-name { font-weight: 600; }
.score-value { font-weight: 800; color: var(--primary); font-size: 1.2rem; }

/* Loading States */
.premium-loader {
    width: 60px; height: 60px;
    border: 4px solid rgba(255, 255, 255, 0.1);
    border-top: 4px solid var(--primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin: 2rem auto;
    /* Eliminat will-change și box-shadow pentru economisire resurse */
}

.loading-screen {
    height: 60vh;
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    text-align: center;
}

/* Mode Selector */
.mode-selector {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
    gap: 0.75rem;
}

.mode-selector.grid-2 { 
    grid-template-columns: 1fr 1fr !important; 
}

@media (min-width: 769px) {
    .mode-selector.grid-2 {
        grid-template-columns: repeat(2, minmax(150px, 200px)) !important;
        justify-content: center;
    }
}
.mode-selector.grid-3 { grid-template-columns: repeat(3, 1fr); }

.mode-card {
    padding: 1.25rem 0.75rem;
    background: rgba(255,255,255,0.03);
    border: 1px solid var(--border);
    border-radius: 1.25rem;
    text-align: center; cursor: pointer;
    transition: all 0.2s;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 120px;
}

.mode-card i { font-size: 2rem; margin-bottom: 0.5rem; color: var(--primary); }
.mode-card h4 { margin-top: 0.5rem; font-weight: 700; line-height: 1.2; }
.mode-card small { font-size: 0.75rem; }

.mode-card.selected {
    border-color: var(--primary);
    background: rgba(99, 102, 241, 0.2);
    box-shadow: 0 0 15px rgba(99, 102, 241, 0.4);
}

@media (max-width: 480px) {
    .mode-selector {
        grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
        gap: 0.5rem;
    }
    .mode-selector.grid-3 {
        grid-template-columns: repeat(auto-fill, minmax(90px, 1fr));
    }
    .mode-card {
        padding: 0.8rem 0.4rem;
        min-height: 90px;
        border-radius: 1rem;
    }
    .mode-card i { font-size: 1.4rem; }
    .mode-card h4 { font-size: 0.85rem; }
    .mode-card small { font-size: 0.7rem; }
}

/* Hero Countdown Overlay (Standardized Premium) */
.hero-countdown {
    position: fixed;
    inset: 0; /* Acoperă tot ecranul indiferent de părinte */
    width: 100vw;
    height: 100vh;
    display: flex; 
    flex-direction: column;
    align-items: center; 
    justify-content: center; /* Centrat perfect */
    padding: 2rem;
    background: rgba(15, 23, 42, 0.85);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    z-index: 9999; 
    pointer-events: none;
    transition: opacity 0.3s ease, visibility 0.3s;
    overflow: hidden;
}

#hero-number {
    font-size: min(14rem, 35vh); /* Ușor redus pentru siguranță */
    font-weight: 900;
    color: white;
    text-shadow: 0 0 100px var(--primary-glow), 0 0 200px rgba(99, 102, 241, 0.3);
    line-height: 0.8;
    margin-bottom: 2rem;
    animation: countdownNumberIn 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.countdown-card-wrapper {
    max-width: 500px;
    width: 90%;
}

.countdown-card {
    padding: 2.5rem;
    text-align: center;
    font-size: 1.15rem; /* Reduced by 50% from 2.25rem */
    line-height: 1.3;
    font-weight: 800;
    color: white;
    border: 3px solid var(--primary) !important;
    background: rgba(15, 23, 42, 0.9) !important;
    box-shadow: 0 30px 60px rgba(0,0,0,0.8), 0 0 50px var(--primary-glow);
    border-radius: 2rem !important;
    transform: translateY(0);
    animation: slideUp 0.6s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes countdownNumberIn {
    0% { transform: scale(0.5); opacity: 0; filter: blur(10px); }
    100% { transform: scale(1); opacity: 1; filter: blur(0); }
}

@keyframes countdownPulse {
    0% { transform: scale(0.9); opacity: 0.8; }
    50% { transform: scale(1.05); opacity: 1; }
    100% { transform: scale(1); opacity: 1; }
}

#hero-countdown.pulse {
    animation: countdownPulse 0.4s ease-out;
}

@keyframes timerPulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.2); color: var(--danger); box-shadow: 0 0 20px var(--danger); }
    100% { transform: scale(1); }
}

#game-timer.pulse {
    animation: timerPulse 0.5s ease-in-out;
}

/* Emoji Reactions Area */
.emoji-picker {
    display: flex;
    justify-content: space-around;
    flex-wrap: nowrap; /* Forced single row */
    gap: 0.5rem;
    margin-top: 1.5rem;
    padding: 0.75rem 0.5rem !important;
    border-radius: 1.5rem !important;
    background: rgba(15, 23, 42, 0.9) !important;
    border: 2px solid var(--primary) !important;
    max-width: 100%;
    overflow: hidden;
}

.emoji-picker span {
    font-size: 2rem;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    user-select: none;
    flex: 1;
    display: flex;
    justify-content: center;
    min-width: 0;
}

@media (max-width: 500px) {
    .emoji-picker span { font-size: 1.4rem; }
    .emoji-picker { gap: 0.2rem; padding: 0.5rem !important; }
}

@media (max-width: 380px) {
    .emoji-picker span { font-size: 1.2rem; }
}

.emoji-picker span:hover { transform: scale(1.4) translateY(-5px); }

.emoji-flash {
    position: fixed;
    pointer-events: none;
    z-index: 3000;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    animation: emojiPopIn 1.5s ease-out forwards;
}

.emoji-flash span {
    font-size: 5rem;
    filter: drop-shadow(0 0 20px rgba(0,0,0,0.5));
}

.emoji-flash .user-label, .user-count-badge {
    font-size: 1rem;
    font-weight: 700;
    background: var(--primary);
    color: var(--text-on-primary);
    padding: 0.3rem 1rem;
    border-radius: 99px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.3);
}

@keyframes emojiPopIn {
    0% { transform: scale(0.3) rotate(-20deg); opacity: 0; }
    20% { transform: scale(1.2) rotate(10deg); opacity: 1; }
    30% { transform: scale(1) rotate(0deg); opacity: 1; }
    80% { transform: translateY(-80px); opacity: 1; }
    100% { transform: translateY(-120px) scale(0.8); opacity: 0; }
}

/* Theme Specific Overrides for Games */
body.theme-neon .btn-buzz,
body.theme-crazy .btn-buzz {
    border: 5px solid #39ff14;
    animation: wobble 1s infinite;
}

body.theme-sunset .btn-buzz {
    background: radial-gradient(circle, #f97316 0%, #ea580c 100%);
    box-shadow: 0 0 40px rgba(249, 115, 22, 0.4);
}

body.theme-bw .timer-ring { border-radius: 0; border-color: #fff; }
body.theme-bw .btn-buzz { border-radius: 0; background: #fff; color: #000; }

@keyframes wobble {
    0%, 100% { transform: rotate(-5deg) scale(1); }
    50% { transform: rotate(5deg) scale(1.05); }
}

@media (max-width: 900px) {
    .game-container { grid-template-columns: 1fr; }
    .btn-buzz { width: 220px; height: 220px; font-size: 2rem; }
}

/* Quizz Arena: Extra UI Classes */
.auth-instructions {
    margin-top: 1.5rem;
    border-color: var(--primary-glow);
    background: rgba(99, 102, 241, 0.05);
}

.auth-instructions h3 {
    margin-bottom: 1rem;
    color: var(--primary);
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 1.1rem;
}

.instructions-list {
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
    font-size: 0.9rem;
}

.instruction-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.instruction-item span {
    font-size: 1.2rem;
}

.leaderboard-section {
    margin-top: 1rem;
    padding: 0.5rem;
}

.leaderboard-section h3 {
    margin-bottom: 0.75rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.lobby-players-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 180px));
    justify-content: center;
    gap: 1.25rem;
    max-width: 960px;
    margin: 0 auto;
}

.game-exit-card {
    padding: 1.25rem !important;
    margin-bottom: 1.5rem !important;
    border-color: rgba(239, 68, 68, 0.2) !important;
    background: rgba(239, 68, 68, 0.02) !important;
}

.btn-game-exit {
    margin: 0 !important;
    color: var(--danger) !important;
    border-color: rgba(239, 68, 68, 0.4) !important;
    font-weight: 700 !important;
}

.results-card {
    max-width: 600px;
    text-align: center;
}


.flex-between {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.text-center { text-align: center; }

.q-meta {
    color: var(--text-muted);
    margin-bottom: 1rem;
    font-weight: 600;
}

.game-feedback-card {
    padding: 1rem 2rem;
    display: none;
}

/* Platform Back Button (Premium) */
.platform-back-btn {
    position: fixed;
    bottom: 2rem;
    left: 2rem;
    z-index: 1000;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.6rem 1rem;
    background: var(--card-bg);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--border);
    border-radius: 1rem;
    color: var(--text-main);
    text-decoration: none;
    font-weight: 700;
    font-size: 0.9rem;
    box-shadow: var(--shadow-card);
    transition: var(--transition);
}

.platform-back-btn .btn-text {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.platform-back-btn .close-trigger {
    margin-left: 0.5rem;
    padding: 0.25rem;
    opacity: 0.5;
    transition: var(--transition);
    border-radius: 4px;
}

.platform-back-btn .close-trigger:hover {
    opacity: 1;
    background: rgba(239, 68, 68, 0.2);
    color: var(--danger);
}

.platform-back-btn:hover {
    transform: translateY(-3px);
    border-color: var(--primary);
}

.platform-back-btn.is-hidden {
    display: none !important;
}

@media (max-width: 768px) {
    .platform-back-btn {
        bottom: 1.5rem;
        left: 1.5rem;
        padding: 0.6rem 1rem;
        font-size: 0.85rem;
    }
}

/* ============================================
   Game Specific: MAFIA
   ============================================ */
.status-bar {
    background: rgba(15, 23, 42, 0.6);
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    border-bottom: 1px solid var(--border);
    padding: 0.5rem 1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 70px; /* Aligned with header height */
    left: 0;
    z-index: 99;
    max-width: var(--max-width);
    margin: 0 auto;
    width: 100%;
}

@media (max-width: 600px) {
    .status-bar {
        top: 60px !important; /* Adjusted for smaller mobile header */
        padding: 0.25rem 0.75rem !important;
        margin-bottom: 0 !important;
    }
    .status-center {
        display: none !important; /* Hide round info on very small screens if it overlaps */
    }
}

.status-left, .status-right {
    display: flex;
    align-items: center;
}

#room-name-display {
    text-shadow: 0 2px 4px rgba(0,0,0,0.3);
}

#round-display {
    background: rgba(255,255,255,0.05);
    padding: 0.2rem 1rem;
    border-radius: 1rem;
    border: 1px solid rgba(255,255,255,0.1);
    box-shadow: inset 0 0 10px rgba(255,255,255,0.02);
}

.player-badge {
    background: var(--primary);
    color: var(--text-on-primary);
    padding: 0.35rem 1.5rem;
    border-radius: 2rem;
    font-size: 0.85rem;
    font-weight: 800;
}

.phase-badge {
    background: var(--primary);
    color: var(--text-on-primary);
    padding: 0.35rem 1.5rem;
    border-radius: 2rem;
    font-size: 0.85rem;
    font-weight: 800;
    letter-spacing: 1px;
    box-shadow: 0 0 15px var(--primary-glow);
}

.game-layout {
    display: grid;
    grid-template-columns: 320px 1fr 320px;
    gap: 1.5rem;
    margin-top: 1.5rem;
}

.log-container {
    height: 650px;
    display: flex;
    flex-direction: column;
}

.log-messages {
    flex: 1;
    overflow-y: auto;
    padding: 1.25rem;
    background: rgba(0,0,0,0.2);
    border: 1px solid var(--border);
    border-radius: 1.5rem;
    font-size: 0.9rem;
    line-height: 1.5;
    display: flex;
    flex-direction: column-reverse;
}

.log-msg {
    margin-bottom: 0.85rem;
    padding: 0.75rem 1rem;
    border-radius: 0.75rem;
    background: rgba(255,255,255,0.03);
    animation: slideInLeft 0.3s ease-out;
}

.log-msg.death { border-left: 4px solid #ef4444; background: rgba(239, 68, 68, 0.1); color: #fca5a5; }
.log-msg.save { border-left: 4px solid #10b981; background: rgba(16, 185, 129, 0.1); color: #6ee7b7; }
.log-msg.victory { border-left: 4px solid #f59e0b; background: rgba(245, 158, 11, 0.1); color: #fcd34d; font-weight: bold; }
.log-msg.suspicion { border-left: 4px solid #6366f1; background: rgba(99, 102, 241, 0.1); font-style: italic; }

.status-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.player-status-item {
    background: var(--glass);
    padding: 1rem 1.25rem;
    border-radius: 1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border: 1px solid transparent;
    transition: var(--transition);
}

.player-status-item.status-dead {
    opacity: 0.5;
    background: rgba(0,0,0,0.1);
    border-color: rgba(255,255,255,0.05);
}

.player-status-item.status-dead span:first-child {
    text-decoration: line-through;
}

/* Actions Grid */
.action-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
    gap: 1.25rem;
    margin-top: 1.5rem;
}

/* New: Center box for phases with single action (like Ready button) */
.action-center-box {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 3rem 1rem;
    text-align: center;
    min-height: 300px;
    width: 100%;
}

.action-center-box i {
    filter: drop-shadow(0 0 20px var(--primary-glow));
}

.target-card {
    padding: 1.5rem 1rem;
    background: var(--glass);
    border: 2px solid var(--border);
    border-radius: 1.5rem;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.target-card:hover:not(.disabled) {
    border-color: var(--primary);
    transform: translateY(-8px);
    background: var(--primary-glow);
    box-shadow: 0 10px 30px rgba(0,0,0,0.3);
}

.target-card.selected {
    border-color: var(--primary);
    background: rgba(99, 102, 241, 0.15);
    box-shadow: 0 0 25px var(--primary-glow);
}

.target-card.dead {
    opacity: 0.3;
    pointer-events: none;
    filter: grayscale(1);
    border-style: dashed;
}

.target-avatar {
    width: 65px; height: 65px;
    margin: 0 auto 1rem;
    background: rgba(255,255,255,0.05);
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-size: 1.8rem;
    border: 2px solid var(--border);
}

.target-name { font-weight: 700; font-size: 1rem; }

.ready-badge {
    background: var(--primary);
    color: var(--text-on-primary);
    font-size: 0.7rem;
    padding: 0.25rem 0.75rem;
    border-radius: 1rem;
    font-weight: 800;
}

.vote-badge {
    margin-top: 0.75rem;
    background: var(--primary);
    color: var(--text-on-primary);
    font-size: 0.7rem;
    padding: 0.25rem 0.75rem;
    border-radius: 1rem;
    font-weight: 800;
    text-transform: uppercase;
}

/* Role Card (Premium) */
.role-card {
    margin-top: 2rem;
    padding: 1.75rem;
    border-radius: 1.5rem;
    display: flex;
    align-items: center;
    gap: 1.25rem;
    background: var(--glass);
    border: 2px solid var(--border);
    position: relative;
    overflow: hidden;
}

.role-card::after {
    content: '';
    position: absolute;
    top: 0; right: 0; width: 40%; height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.05));
    pointer-events: none;
}

.role-card i { font-size: 3rem; text-shadow: 0 0 20px rgba(255,255,255,0.2); }
.role-info { display: flex; flex-direction: column; }
.role-label { font-size: 0.8rem; font-weight: 600; text-transform: uppercase; letter-spacing: 1px; color: var(--text-muted); }
.role-name { font-size: 1.8rem; font-weight: 900; letter-spacing: -0.5px; }

.role-card.mafia { border-color: #ef4444; color: #fecaca; background: linear-gradient(135deg, rgba(239, 68, 68, 0.2), transparent); }
.role-card.doctor { border-color: #10b981; color: #d1fae5; background: linear-gradient(135deg, rgba(16, 185, 129, 0.2), transparent); }
.role-card.cop { border-color: #3b82f6; color: #dbeafe; background: linear-gradient(135deg, rgba(59, 130, 246, 0.2), transparent); }
.role-card.civilian { border-color: #94a3b8; color: #f1f5f9; background: linear-gradient(135deg, rgba(148, 163, 184, 0.2), transparent); }

@media (max-width: 1100px) {
    .game-layout { grid-template-columns: 1fr; gap: 2rem; }
    .log-container { height: 350px; order: 3; }
    .action-area { order: 1; }
    .players-sidebar { order: 2; }
}

/* ============================================
   Common Premium Utilities & Animations
   ============================================ */

.fade-in {
    animation: fadeIn 0.4s ease-out forwards;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes slideInLeft {
    from { opacity: 0; transform: translateX(-20px); }
    to { opacity: 1; transform: translateX(0); }
}

.loading-screen {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 4rem 1rem;
    text-align: center;
    gap: 1.5rem;
    color: var(--text-muted);
}

.premium-loader {
    /* Folosește definiția de mai sus */
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

#view-container {
    transition: opacity 0.3s ease-out;
    padding-top: 0.75rem !important;
}

/* Quizz Arena Gameplay Tabs */
#game-tabs-header {
    width: 100%;
    position: sticky;
    top: 0; /* Default for mobile/no header */
    z-index: 98;
    background: var(--bg-surface);
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: center;
    transition: all 0.3s ease;
}

/* Adjust sticky position based on what's visible above it */
#main-header:not(.hidden) ~ #game-tabs-header {
    top: 80px; /* Under main header (80px) */
}

#main-header:not(.hidden) ~ #game-status-bar:not(.hidden) ~ #game-tabs-header {
    top: 118px; /* Under both header and status bar */
}

#game-status-bar:not(.hidden) ~ #game-tabs-header {
    top: 38px; /* Under status bar only (if header hidden) */
}

@media (min-width: 768px) {
    #game-tabs-header {
        top: 0; 
    }
    #main-header:not(.hidden) ~ #game-tabs-header {
        top: 80px;
    }
}

/* Mobile sticky adjustments */
@media (max-width: 768px) {
    #main-header:not(.hidden) ~ #game-tabs-header {
        top: 60px !important;
    }
    #main-header:not(.hidden) ~ #game-status-bar:not(.hidden) ~ #game-tabs-header {
        top: 98px !important; /* 60px header + ~38px status bar */
    }
}

.game-tabs-header {
    display: flex;
    justify-content: center;
    width: 100%;
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 0 0.25rem 0.25rem 0.25rem;
    gap: 0.5rem;
}

.game-container {
    width: 100%;
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 0 1rem 1rem 1rem !important;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    margin-top: 0 !important;
}

@media (max-width: 600px) {
    .game-container {
        padding: 0 0.5rem 0.5rem 0.5rem !important;
        gap: 1rem;
    }
    #view-container {
        padding-left: 0 !important;
        padding-right: 0 !important;
    }
}

.game-tab-btn {
    flex: 1;
    max-width: 200px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.25rem;
    padding: 0.6rem 1rem;
    background: transparent;
    border: none;
    border-radius: 0.5rem;
    color: var(--text-muted);
    font-size: 0.85rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.25s ease;
}

@media (max-width: 600px) {
    .game-tabs-header {
        width: 100% !important;
        max-width: none !important;
        margin: 0 !important;
        gap: 0px;
        padding: 0;
        border-radius: 0;
        border-left: none;
        border-right: none;
    }
    .game-tab-btn {
        padding: 0.5rem 0.25rem !important;
        font-size: 0.7rem !important;
        flex: 1;
        min-width: 0 !important;
        text-align: center;
        border-radius: 0 !important;
    }
    .game-tab-btn i {
        font-size: 1rem !important;
    }
}

.game-tabs-header::-webkit-scrollbar {
    display: none; /* Hide scrollbar Chrome/Safari */
}

.game-tab-btn i {
    font-size: 1.1rem;
}

.game-tab-btn.active {
    color: var(--primary);
    background: rgba(var(--primary-rgb, 99, 102, 241), 0.1);
    position: relative;
}

.game-tab-btn.active::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 20%;
    right: 20%;
    height: 3px;
    background: var(--primary);
    border-radius: 3px 3px 0 0;
    box-shadow: 0 -2px 10px var(--primary-glow);
}

.game-tab-content.hidden {
    display: none !important;
}

.rules-content {
    text-align: left;
    line-height: 1.6;
}

.rules-content p { margin-bottom: 1rem; }
.rules-content ul { padding-left: 1.5rem; margin-bottom: 1rem; }
.rules-content li { margin-bottom: 0.5rem; }

.game-feedback-inline {
    margin-top: 1.5rem;
    text-align: center;
    min-height: 2rem;
    display: none;
}

/* Global Emoji Bar Container */
#game-emoji-bar {
    position: fixed;
    bottom: 1.5rem;
    left: 1.5rem; /* Positioned on the left as requested */
    z-index: 2000;
    pointer-events: none;
}

@media (max-width: 600px) {
    #game-emoji-bar {
        bottom: 1rem;
        left: 1rem;
    }
}

.emoji-reactions-bar {
    pointer-events: auto;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background: rgba(15, 23, 42, 0.85);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 3rem;
    padding: 0.4rem;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    width: 54px; /* Circle size */
    height: 54px;
    overflow: hidden;
}

.emoji-reactions-bar.expanded {
    width: auto;
    max-width: 90vw;
    padding: 0.4rem 1rem 0.4rem 0.4rem;
}

.emoji-trigger {
    width: 44px;
    height: 44px;
    min-width: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.6rem;
    cursor: pointer;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 50%;
    transition: transform 0.3s ease;
}

.emoji-reactions-bar.expanded .emoji-trigger {
    transform: rotate(15deg) scale(0.9);
    background: transparent;
}

.emoji-list {
    display: flex;
    gap: 0.75rem;
    opacity: 0;
    transform: translateX(-10px);
    pointer-events: none;
    transition: all 0.3s ease;
}

.emoji-reactions-bar.expanded .emoji-list {
    opacity: 1;
    transform: translateX(0);
    pointer-events: auto;
}

.emoji-btn {
    font-size: 1.6rem;
    cursor: pointer;
    transition: transform 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    user-select: none;
    filter: drop-shadow(0 2px 4px rgba(0,0,0,0.2));
}

.emoji-btn:hover {
    transform: scale(1.3) translateY(-4px);
}

.emoji-flash {
    position: fixed;
    pointer-events: none;
    z-index: 10000;
    animation: emoji-float-up 3s forwards cubic-bezier(0.165, 0.84, 0.44, 1);
    display: flex;
    flex-direction: column;
    align-items: center;
}

.emoji-flash span {
    font-size: 3rem;
}

.emoji-flash .user-label {
    background: rgba(0,0,0,0.6);
    color: white;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 0.7rem;
    white-space: nowrap;
    margin-top: -5px;
}

@keyframes emoji-float-up {
    0% { transform: translateY(0) scale(0.5); opacity: 0; }
    20% { transform: translateY(-20px) scale(1.2); opacity: 1; }
    100% { transform: translateY(-150px) scale(1); opacity: 0; }
}

.action-flash {
    position: fixed;
    pointer-events: none;
    z-index: 10001;
    animation: action-float-up 3s forwards cubic-bezier(0.165, 0.84, 0.44, 1);
    display: flex;
    justify-content: center;
    align-items: center;
    background: #ffc107;
    color: #1a1a1a;
    padding: 1rem 2rem;
    border-radius: 50px;
    font-weight: 900;
    font-size: 1.5rem;
    box-shadow: 0 10px 30px rgba(255, 193, 7, 0.5);
    border: 4px solid white;
    white-space: nowrap;
}

@keyframes action-float-up {
    0% { transform: translateY(50px) scale(0.5); opacity: 0; }
    15% { transform: translateY(0) scale(1.1); opacity: 1; }
    85% { transform: translateY(-30px) scale(1); opacity: 1; }
    100% { transform: translateY(-80px) scale(0.8); opacity: 0; }
}

/* ============================================
   Common Game Layout & Components
   ============================================ */

.role-reveal-container {
    width: 200px;
    height: 280px;
    perspective: 1000px;
    margin: 0 auto;
    cursor: pointer;
}

.role-card-flip {
    position: relative;
    width: 100%;
    height: 100%;
    text-align: center;
    transition: transform 0.6s cubic-bezier(0.4, 0, 0.2, 1);
    transform-style: preserve-3d;
}

.role-card-flip.flipped {
    transform: rotateY(180deg);
}

.card-front, .card-back {
    position: absolute;
    width: 100%;
    height: 100%;
    backface-visibility: hidden !important;
    -webkit-backface-visibility: hidden !important;
    border-radius: 1.5rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
    border: 2px solid rgba(255,255,255,0.1);
    box-shadow: 0 10px 30px rgba(0,0,0,0.3);
}

.card-front {
    background: var(--bg-card);
    backdrop-filter: blur(10px);
    color: var(--text-muted);
}

.card-back {
    background: rgba(255,255,255,0.05);
    transform: rotateY(180deg);
}

.role-badge {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 2px;
    opacity: 0.6;
    margin-bottom: 1rem;
}

.role-name {
    font-size: 1.5rem;
    font-weight: 900;
    margin: 0;
}

/* Mafia Specific Layout on Desktop */
.game-layout-mafia {
    display: flex;
    flex-direction: column;
    gap: 2rem;
    width: 100%;
}

@media (min-width: 900px) {
    .game-layout-mafia {
        display: grid;
        grid-template-columns: 250px 1fr;
        align-items: start;
        gap: 3rem;
    }
}

.activity-layout {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1.5rem;
}

@media (min-width: 900px) {
    .activity-layout {
        grid-template-columns: 1.5fr 1fr;
    }
}

/* Mafia Action Area */
.action-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 1rem;
    width: 100%;
}

.target-card {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 1rem;
    padding: 1rem;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
}

.target-card:hover {
    background: rgba(255, 255, 255, 0.1);
    transform: translateY(-3px);
    border-color: rgba(255, 255, 255, 0.2);
}

.target-card.selected {
    background: rgba(16, 185, 129, 0.1);
    border-color: #10b981;
    box-shadow: 0 0 15px rgba(16, 185, 129, 0.2);
}

.target-card.dead {
    opacity: 0.4;
    cursor: not-allowed;
    filter: grayscale(1);
}

.target-avatar {
    width: 50px;
    height: 50px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
}

.target-name {
    font-size: 0.9rem;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    width: 100%;
}

.vote-badge {
    position: absolute;
    top: -8px;
    right: -8px;
    background: #ef4444;
    color: white;
    font-size: 0.7rem;
    padding: 2px 8px;
    border-radius: 10px;
    font-weight: 800;
    box-shadow: 0 4px 10px rgba(239, 68, 68, 0.3);
}

.action-center-box {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 2rem;
    min-height: 300px;
}

.flex-column {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    width: 100%;
}
/* ============================================
   Premium Lobby & Leaderboard System
   ============================================ */

.lobby-view-container {
    padding: 1rem;
    max-width: 1200px;
    margin: 0 auto;
}

.lobby-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2.5rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid rgba(255,255,255,0.05);
    gap: 1.5rem;
}

.lobby-header h2 {
    font-size: 2rem;
    font-weight: 900;
    margin: 0;
    background: linear-gradient(135deg, #fff 0%, #94a3b8 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.lobby-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: var(--game-gap);
    margin-bottom: 2rem;
}

.room-card {
    background: rgba(17, 24, 39, 0.4);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255,255,255,0.06);
    border-radius: var(--radius);
    padding: var(--card-padding);
    cursor: pointer;
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    position: relative;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

.room-card::before {
    content: '';
    position: absolute;
    inset: 0;
    background: radial-gradient(circle at top right, rgba(var(--primary-rgb), 0.1), transparent 70%);
    pointer-events: none;
}

.room-card:hover {
    transform: translateY(-8px) scale(1.02);
    border-color: var(--primary);
    background: rgba(17, 24, 39, 0.6);
    box-shadow: 
        0 20px 40px rgba(0,0,0,0.4),
        0 0 20px rgba(var(--primary-rgb), 0.2);
}

.room-card h3 {
    font-size: 1.4rem;
    font-weight: 800;
    margin: 0;
    color: var(--text-main);
}

.room-card-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.room-badge {
    padding: 0.4rem 1rem;
    border-radius: 100px;
    font-size: 0.75rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    background: rgba(255,255,255,0.05);
    border: 1px solid rgba(255,255,255,0.1);
}

.badge-waiting {
    color: #38bdf8;
    background: rgba(56, 189, 248, 0.1);
    border-color: rgba(56, 189, 248, 0.2);
}

.badge-playing {
    color: #10b981;
    background: rgba(16, 185, 129, 0.1);
    border-color: rgba(16, 185, 129, 0.2);
}

.room-players {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 700;
    color: var(--text-muted);
}

.room-players i {
    color: var(--primary-light);
}

/* --- Premium Leaderboard --- */
.leaderboard-section {
    margin-top: 1rem;
}

.leaderboard-section h3 {
    font-size: 1.5rem;
    font-weight: 900;
    margin-bottom: 0.75rem;
    display: flex;
    align-items: center;
    gap: 1rem;
}

.scoreboard {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.score-entry {
    background: rgba(255, 255, 255, 0.02);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 20px;
    padding: 1.25rem 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.score-entry::before {
    content: '';
    position: absolute;
    left: 0;
    top: 15%;
    height: 70%;
    width: 4px;
    border-radius: 0 4px 4px 0;
    background: var(--primary);
    box-shadow: 0 0 10px var(--primary-glow);
}

.score-entry:hover {
    background: rgba(255, 255, 255, 0.05);
    transform: translateX(8px);
    border-color: rgba(255, 255, 255, 0.1);
}

.score-entry.top-1::before { background: #fbbf24; box-shadow: 0 0 15px rgba(251, 191, 36, 0.5); }
.score-entry.top-2::before { background: #94a3b8; box-shadow: 0 0 15px rgba(148, 163, 184, 0.5); }
.score-entry.top-3::before { background: #b45309; box-shadow: 0 0 15px rgba(180, 83, 9, 0.5); }

.score-name {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text-main);
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.rank-number {
    font-size: 0.9rem;
    opacity: 0.6;
    font-weight: 900;
    width: 25px;
}

.score-value {
    font-size: 1.2rem;
    font-weight: 900;
    color: var(--primary-light);
}

.score-value small {
    font-size: 0.75rem;
    opacity: 0.5;
    margin-left: 4px;
    text-transform: uppercase;
}

/* Empty State */
.lobby-empty-state {
    grid-column: 1 / -1;
    text-align: center;
    padding: var(--game-padding) 1.5rem;
    background: rgba(255,255,255,0.02);
    border: 2px dashed rgba(255,255,255,0.05);
    border-radius: 32px;
    color: var(--text-muted);
}

.lobby-empty-state i {
    font-size: 4rem;
    margin-bottom: 1.5rem;
    opacity: 0.3;
    display: block;
}

/* --- Mobile Fixes --- */
@media (max-width: 768px) {
    main {
        padding: 0 1rem;
    }

    .hero {
        padding: 2.5rem 0 1.5rem;
    }

    .games-section {
        padding-bottom: 2.5rem;
    }

    .lobby-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
        margin-bottom: 1.5rem;
    }
    
    .lobby-header h2 {
        font-size: 1.5rem;
    }
    
    .lobby-header .btn {
        width: 100%;
        padding: 0.85rem;
        font-size: 1rem;
    }
    
    .lobby-grid {
        grid-template-columns: 1fr;
        gap: var(--game-gap);
    }
    
    .room-card {
        padding: var(--card-padding);
    }
    
    .game-card {
        padding: var(--card-padding);
        gap: var(--game-gap);
    }

    .game-icon {
        width: 50px;
        height: 50px;
        font-size: 1.3rem;
    }

    .section-header {
        margin-bottom: 1rem;
    }

    .score-entry {
        padding: 0.75rem;
        gap: 0.5rem;
    }
    
    .score-value {
        font-size: 1rem;
    }

    .leaderboard-section {
        margin-top: 1rem;
        padding: 0.25rem;
    }

    .leaderboard-section h3 {
        font-size: 1.1rem;
        gap: 0.5rem;
        margin-bottom: 0.5rem;
        flex-wrap: nowrap;
    }

    .section-header h2 {
        justify-content: center;
    }

    .game-card-header {
        flex-direction: column;
        align-items: center;
        text-align: center;
    }

    .game-name {
        justify-content: center;
    }

    .game-meta {
        justify-content: center;
    }

    .game-detail-header {
        flex-direction: column;
        text-align: center;
    }

    .game-detail-icon {
        margin: 0 auto 1rem;
    }

    .modal-section-header, .modal-section-footer {
        text-align: center;
    }

    .glass-card {
        padding: 1rem;
        text-align: center;
    }

    .modal-content {
        margin: 1rem auto !important;
        width: 95% !important;
        text-align: center;
        padding: 0 !important; /* Reset, subclasses handle it */
    }

    .modal-content.p-5 {
        padding: 1.25rem !important; /* Minimizat la cerere */
    }

    .modal-content.p-4 {
        padding: 1rem !important;
    }

    .p-5 { padding: 1.25rem !important; }
    .p-4 { padding: 1rem !important; }

    .selection-header-container {
        padding: 1.5rem 0.5rem 0;
        margin-bottom: 1rem;
        text-align: center;
    }

    .btn-close-selector {
        top: 0.25rem;
        right: 0.5rem;
        width: 32px;
        height: 32px;
    }
}

@media (max-width: 480px) {
    .game-name {
        font-size: 1.15rem;
    }
    .game-desc {
        font-size: 0.85rem;
    }
    .tag {
        font-size: 0.65rem;
        padding: 0.15rem 0.5rem;
    }
}

/* ---- Static Legal Pages ---- */
.static-page {
    overflow-x: hidden;
}

.static-content-container {
    max-width: 900px;
    margin: 4rem auto;
    padding: 0 1.5rem;
}

.legal-section {
    margin-bottom: 2.5rem;
}

.legal-section h3 {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 1.3rem;
    color: var(--primary-light);
    margin-bottom: 1rem;
    font-weight: 800;
}

.legal-section p {
    line-height: 1.7;
    color: var(--text-main);
    opacity: 0.9;
}

.legal-section ul {
    list-style: none;
    padding: 0;
    margin: 1rem 0;
}

.legal-section ul li {
    position: relative;
    padding-left: 1.5rem;
    margin-bottom: 0.75rem;
    line-height: 1.6;
}

.legal-section ul li::before {
    content: "•";
    position: absolute;
    left: 0;
    color: var(--primary);
    font-weight: bold;
}

.legal-section strong {
    color: var(--accent-light);
}

.border-top { border-top: 1px solid var(--border); }
.p-5 { padding: 3rem !important; }

/* ============================================
   Cookie Consent Banner
   ============================================ */
.cookie-consent {
    position: fixed;
    bottom: 20px;
    left: 20px;
    right: 20px;
    max-width: 500px;
    background: rgba(17, 24, 39, 0.95);
    backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 1.5rem;
    padding: 1.5rem;
    z-index: 10000;
    display: none;
    flex-direction: column;
    gap: 1rem;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
    animation: slideUp 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes slideUp {
    from { transform: translateY(100%) translateY(30px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

.cookie-consent.show {
    display: flex;
}

.cookie-text {
    font-size: 0.9rem;
    line-height: 1.5;
    color: var(--text-main);
}

.cookie-text a {
    color: var(--primary-light);
    text-decoration: underline;
}

.cookie-actions {
    display: flex;
    gap: 0.75rem;
    width: 100%;
}

.cookie-actions .btn {
    flex: 1;
    padding: 0.6rem 1rem;
    font-size: 0.85rem;
}

/* Button Sizes */
.btn-sm {
    padding: 0.5rem 1rem !important;
    font-size: 0.85rem !important;
    border-radius: 0.75rem !important;
    width: auto !important;
    min-width: 0 !important;
    gap: 0.4rem !important;
}

@media (min-width: 768px) {
    .cookie-consent {
        left: auto;
        right: 30px;
        bottom: 30px;
        width: 420px;
    }
}

/* Mobile Auth Keyboard Fixes */
@media (max-height: 600px) {
    .modal-overlay {
        padding: 0.5rem 0.5rem;
    }
    .modal-content {
        margin: 0.5rem auto !important;
    }
    .auth-header {
        margin-bottom: 0.5rem;
    }
    .auth-logo-img {
        height: 30px;
        margin-bottom: 0.25rem;
    }
    .form-group {
        margin-bottom: 0.5rem;
    }
}

.auth-divider {
    display: flex;
    align-items: center;
    text-align: center;
    margin: 1rem 0;
    color: var(--text-dim);
}

.auth-divider::before,
.auth-divider::after {
    content: '';
    flex: 1;
    border-bottom: 1px solid var(--border-color);
}

.auth-divider span {
    padding: 0 0.75rem;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    opacity: 0.6;
}

/* Mobile Menu Overlay */
.mobile-menu-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    z-index: 2000;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
    display: flex;
    justify-content: flex-end;
}

.mobile-menu-overlay.active {
    opacity: 1;
    pointer-events: auto;
}

.mobile-menu-content {
    width: 85%;
    max-width: 320px;
    height: 100%;
    background: var(--card-bg);
    border-left: 1px solid var(--border-color);
    transform: translateX(100%);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    flex-direction: column;
    padding: 1.5rem;
    box-shadow: -10px 0 30px rgba(0,0,0,0.5);
    position: relative;
}

.mobile-menu-overlay.active .mobile-menu-content {
    transform: translateX(0);
}

.menu-close {
    position: absolute;
    top: 1rem;
    right: 1rem;
    background: rgba(255,255,255,0.05);
    border: 1px solid var(--border-color);
    color: var(--text-bright);
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 10;
}

/* ============================================
   Navigation & Mobile Menu Fixes
   ============================================ */
#main-header {
    height: 70px !important;
    padding: 0 2rem !important;
    background: rgba(13, 17, 23, 0.95) !important;
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    display: flex !important;
    align-items: center;
    justify-content: space-between;
    z-index: 1000;
    width: 100%;
    max-width: var(--max-width);
    margin: 0 auto;
}

.header-logo-img {
    height: 64px !important;
    width: 64px !important;
    border-radius: 14px;
    object-fit: contain;
    display: block;
    /* Am eliminat border-ul pentru a evita efectul de 'dublu pătrat' */
}

.desktop-nav {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.header-nav {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.menu-toggle {
    display: none;
    background: rgba(255,255,255,0.05);
    border: 1px solid var(--border-color);
    color: var(--text-bright);
    font-size: 1.2rem;
    cursor: pointer;
    width: 40px;
    height: 40px;
    border-radius: 10px;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

/* Mobile Menu Overlay */
.mobile-menu-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    z-index: 2000;
    opacity: 0;
    display: none; /* Critical: Hide completely when not active */
    pointer-events: none;
    transition: opacity 0.3s ease;
    justify-content: flex-end;
}

.mobile-menu-overlay.active {
    opacity: 1;
    display: flex;
    pointer-events: auto;
}

.mobile-menu-content {
    width: 85%;
    max-width: 320px;
    height: 100%;
    background: var(--card-bg);
    border-left: 1px solid var(--border-color);
    transform: translateX(100%);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    flex-direction: column;
    padding: 1.5rem;
    box-shadow: -10px 0 30px rgba(0,0,0,0.5);
    position: relative;
}

.mobile-menu-overlay.active .mobile-menu-content {
    transform: translateX(0);
}

@media (max-width: 768px) {
    #main-header {
        height: 60px !important;
        padding: 0 1rem !important;
    }
    .header-logo-img {
        height: 48px !important;
        width: 48px !important;
    }
    .desktop-nav {
        display: none;
    }
    .menu-toggle {
        display: flex;
    }
}

.mobile-menu-inner {
    margin-top: 2rem;
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
    height: 100%;
    overflow-y: auto;
    padding-right: 5px;
}

.menu-header {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 0.5rem;
}

.menu-logo-img {
    height: 40px;
    border-radius: 8px;
}

.menu-header h3 {
    font-weight: 800;
    font-size: 1.25rem;
    margin: 0;
    background: var(--primary-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.menu-section {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.menu-item-btn, .menu-link {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.85rem 1rem;
    background: rgba(255,255,255,0.03);
    border: 1px solid transparent;
    border-radius: 12px;
    color: var(--text-bright);
    text-decoration: none;
    font-weight: 600;
    transition: all 0.2s ease;
    cursor: pointer;
    width: 100%;
    text-align: left;
}

.menu-item-btn:active, .menu-link:active {
    background: rgba(255,255,255,0.08);
    border-color: var(--border-color);
}

.menu-item-icon {
    width: 32px;
    height: 32px;
    background: rgba(99, 102, 241, 0.1);
    color: var(--primary);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
}

.menu-divider {
    height: 1px;
    background: linear-gradient(90deg, transparent, var(--border-color), transparent);
    margin: 0.5rem 0;
}

/* User Badge Enhancements */
.user-badge {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    background: rgba(255,255,255,0.05);
    padding: 0.5rem 0.75rem;
    border-radius: 50px;
    border: 1px solid var(--border-color);
    transition: all 0.2s ease;
}

.user-avatar {
    width: 32px;
    height: 32px;
    background: var(--primary-gradient);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    font-size: 0.9rem;
    box-shadow: 0 4px 10px rgba(99, 102, 241, 0.3);
    flex-shrink: 0;
}

.user-info-text {
    display: flex;
    flex-direction: column;
    line-height: 1.1;
    overflow: hidden;
}

.user-name-text {
    font-weight: 700;
    font-size: 0.9rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.pro-tag-sm {
    font-size: 0.6rem;
    font-weight: 900;
    color: var(--accent);
    background: rgba(168, 85, 247, 0.1);
    padding: 1px 4px;
    border-radius: 4px;
    border: 1px solid rgba(168, 85, 247, 0.2);
    width: fit-content;
    margin-top: 2px;
}

.pen-icon {
    font-size: 0.75rem;
    opacity: 0.5;
}

/* Fix pentru a preveni suprapunerea barei de emoji peste butoanele de final joc și asigurare scroll */
.results-container, .results-view, .results-screen {
    padding-bottom: 4rem !important;
    overflow-y: auto !important;
    height: auto !important;
    min-height: auto; 
    -webkit-overflow-scrolling: touch;
    width: 100% !important;
    max-width: 1200px !important;
    margin: 0 auto !important;
    padding: 0 1rem;
}

/* Global scroll force when results are active */
body.results-view-active, html.results-view-active {
    overflow-y: auto !important;
    height: auto !important;
    overflow-x: hidden !important;
}

/* Ensure results content is wide on desktop */
.results-screen #results-header, 
.results-screen #results-scoreboard-area, 
.results-screen #results-custom-content,
.results-screen .replay-container {
    width: 100% !important;
    max-width: 1200px !important;
    margin-left: auto !important;
    margin-right: auto !important;
}

.results-history-scroll {
    max-height: 55vh;
    overflow-y: auto;
    padding-right: 0.5rem;
    margin-bottom: 1rem;
    scrollbar-width: thin;
    scrollbar-color: var(--primary) transparent;
}
.results-history-scroll::-webkit-scrollbar { width: 6px; }
.results-history-scroll::-webkit-scrollbar-thumb { background: var(--primary); border-radius: 10px; }

.results-screen .hero-title {
    font-size: 2.5rem;
    margin: 1rem 0;
}

@media (max-width: 600px) {
    .results-screen {
        padding: 0 0.5rem !important;
        margin: 0 auto !important; /* Eliminate top margin */
    }
    .hero-title {
        font-size: 1.5rem !important; /* Smaller title */
        margin: 0.5rem 0 !important;
    }
    .results-container, .results-view {
        padding-bottom: 2rem !important;
    }
    .results-footer {
        margin-top: 2rem !important;
        flex-direction: column; /* Stack buttons on mobile to save horizontal space and fit better */
        gap: 0.75rem !important;
    }
    .results-footer button {
        width: 100% !important;
        padding: 0.75rem 1rem !important;
    }
    .results-screen {
        padding-bottom: 5rem !important; /* Extra space to ensure scroll works and nothing is cut */
    }
}
/* Performance Optimization - Global "No Effects" Mode */
body.no-effects .bg-effects, 
body.no-effects .background-blobs,
body.no-effects .blob,
body.no-effects .gradient-text,
body.no-effects .pro-promo-card::before,
body.no-effects .phase-area *,
body.no-effects .game-container-inner *,
body.no-effects .tap-button,
body.no-effects .rhythm-visualizer .bar { 
    animation: none !important;
    transition: none !important; /* Disable transitions to save CPU on layout changes */
}

/* Disable expensive filters and shadow animations */
body.no-effects .glass-card,
body.no-effects .modal-content,
body.no-effects .blob,
body.no-effects .companion-popover,
body.no-effects .companion-banner,
body.no-effects .tap-button,
body.no-effects .btn,
body.no-effects .game-card {
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
    filter: none !important;
    box-shadow: 0 4px 12px rgba(0,0,0,0.5) !important;
    animation: none !important;
}



/* ============================================
   Global Game UI (Header & Menu)
   ============================================ */
#main-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 1rem;
    height: 80px;
}

.header-left, .header-right {
    flex: 1;
    display: flex;
    align-items: center;
}

.header-right {
    justify-content: flex-end;
}

.header-center {
    flex: 2;
    display: flex;
    justify-content: center;
    align-items: center;
    text-align: center;
}

.game-title-header {
    font-size: 1.25rem;
    font-weight: 800;
    color: var(--text-main);
    background: var(--primary-gradient, linear-gradient(135deg, var(--primary), var(--accent)));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
}

.hamburger-btn {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    background: var(--glass);
    border: 1px solid var(--border);
    color: var(--text-main);
    font-size: 1.25rem;
    transition: var(--transition);
}

.hamburger-btn:hover {
    background: var(--primary-glow);
    border-color: var(--primary);
    transform: scale(1.05);
}

/* Game Menu Modal Styles */
.game-menu-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1rem;
    padding: 0.5rem 0.5rem 2.5rem 0.5rem; /* Padding generos la bază pentru scroll mobil */
}

@media (min-width: 768px) {
    .game-menu-grid {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 1.5rem !important;
        padding: 1.25rem !important;
        align-items: stretch;
    }
    /* Lărgim modalul special pentru gridul de meniu pe desktop */
    .modal-overlay.modal-wide .modal-content {
        max-width: 950px !important;
        width: 90% !important; 
    }
}

.menu-item-btn {
    display: flex !important;
    flex-direction: row !important;
    align-items: center !important;
    justify-content: flex-start !important;
    gap: 1.25rem !important;
    padding: 1rem 1.5rem !important;
    background: rgba(255, 255, 255, 0.05) !important;
    border: 1px solid var(--border, rgba(255,255,255,0.1)) !important;
    border-radius: 16px !important;
    color: var(--text-main, #fff) !important;
    font-family: inherit !important;
    cursor: pointer !important;
    transition: all 0.2s ease !important;
    text-align: left !important;
    width: 100% !important;
    height: 100% !important;
    box-sizing: border-box !important;
    text-decoration: none !important;
    outline: none !important;
}

.menu-item-btn:hover {
    background: rgba(255, 255, 255, 0.1) !important;
    border-color: var(--primary) !important;
    transform: translateY(-2px) !important;
}

.menu-item-btn.danger:hover {
    border-color: var(--danger) !important;
    background: rgba(239, 68, 68, 0.1) !important;
}

.menu-item-btn.secondary:hover {
    border-color: var(--secondary) !important;
    background: rgba(6, 182, 212, 0.1) !important;
}

.menu-item-icon {
    width: 44px !important;
    height: 44px !important;
    background: var(--primary-glow, rgba(99, 102, 241, 0.2)) !important;
    border-radius: 12px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    font-size: 1.25rem !important;
    color: var(--primary-light, #818cf8) !important;
    flex-shrink: 0 !important;
}

.menu-item-btn.danger .menu-item-icon {
    background: rgba(239, 68, 68, 0.2) !important;
    color: var(--danger) !important;
}

.menu-item-btn.secondary .menu-item-icon {
    background: rgba(6, 182, 212, 0.2) !important;
    color: var(--secondary) !important;
}

.menu-item-text {
    display: flex !important;
    flex-direction: column !important;
    align-items: flex-start !important;
    gap: 2px !important;
    flex: 1 !important;
    min-width: 0 !important; /* Prevents overflow */
}

.menu-item-text strong {
    display: block !important;
    font-size: 1rem !important;
    font-weight: 800 !important;
    color: inherit !important;
    line-height: 1.2 !important;
}

.menu-item-text span {
    display: block !important;
    font-size: 0.8rem !important;
    opacity: 0.7 !important;
    color: var(--text-muted, #94a3b8) !important;
    line-height: 1.2 !important;
}

.menu-divider {
    grid-column: 1 / -1; /* Ocupă tot rândul pe desktop */
    height: 1px;
    background: linear-gradient(90deg, transparent, var(--border), transparent);
    margin: 1rem 0;
}

/* User Profile Form */
#modal-title {
    padding-right: 3.5rem;
    word-break: break-word;
}

.user-profile-form {
    padding: 0.5rem;
}

.user-profile-form .form-group {
    margin-bottom: 1.25rem;
}

.user-profile-form label {
    display: block;
    margin-bottom: 0.5rem;
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
}

@media (max-width: 768px) {
    .game-title-header {
        font-size: 1.1rem;
    }
}

/* --- MOBILE REFINEMENTS (v17.5) --- */
@media (max-width: 768px) {
    .hero {
        padding-top: 0.5rem !important;
    }

    .hero-title {
        font-size: 1.9rem !important;
    }

    .hero-badge {
        font-size: 0.8rem !important;
    }

    .section-header h2 {
        font-size: 2.1rem !important;
    }

    .game-card-header {
        display: grid !important;
        grid-template-columns: 60px 1fr !important;
        grid-template-areas: 
            "name name"
            "icon desc" !important;
        gap: 0.15rem 1rem !important;
        align-items: center !important;
    }

    .game-info {
        display: contents !important;
    }

    .game-name {
        grid-area: name !important;
        justify-content: center !important;
        text-align: center !important;
        margin-bottom: 0 !important;
        width: 100% !important;
        font-size: 1.5rem !important;
    }

    .game-icon {
        grid-area: icon !important;
        width: 50px !important;
        height: 50px !important;
        font-size: 2.0rem !important;
        margin: 0 !important;
    }

    .game-desc {
        grid-area: desc !important;
        text-align: left !important;
        font-size: 0.85rem !important;
        line-height: 1.2 !important;
    }
    
    .game-card {
        padding: 1.25rem !important;
    }

    /* --- GAME DETAIL MODAL REFINEMENTS --- */
    .game-detail-modal {
        padding: 1.25rem !important;
    }

    .game-detail-header {
        flex-direction: column !important;
        text-align: center !important;
        gap: 0.75rem !important;
        margin-bottom: 1rem !important;
    }

    .game-detail-icon {
        width: 64px !important;
        height: 64px !important;
        font-size: 1.8rem !important;
        margin: 0 auto !important;
    }

    .game-detail-title {
        font-size: 1.4rem !important;
        justify-content: center !important;
    }

    .game-detail-short {
        font-size: 0.85rem !important;
    }

    .game-detail-desc {
        display: block !important; /* Remove webkit-box/clamp */
        -webkit-line-clamp: unset !important;
        max-height: 200px !important; /* Limit height and allow scroll */
        overflow-y: auto !important;
        padding: 1rem !important;
        font-size: 0.9rem !important;
        line-height: 1.5 !important;
        margin-bottom: 1rem !important;
        text-align: center !important;
    }

    .game-detail-stats {
        gap: 0.5rem !important;
        margin-bottom: 1rem !important;
    }

    .detail-stat {
        padding: 0.5rem 0.75rem !important;
        font-size: 0.8rem !important;
    }

    .game-detail-tags {
        justify-content: center !important;
        flex-wrap: wrap !important;
    }
}

/* Replay & Exit Action Box (Top of Results) */
.replay-container {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 24px;
    padding: 1.5rem;
    box-shadow: 0 10px 30px rgba(0,0,0,0.2);
    backdrop-filter: blur(10px);
    margin-bottom: 2rem;
}

.replay-action-box .btn-primary {
    background: linear-gradient(135deg, #a855f7 0%, #7c3aed 100%);
    border: none;
    box-shadow: 0 4px 15px rgba(168, 85, 247, 0.4);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.replay-action-box .btn-primary:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(168, 85, 247, 0.5);
    filter: brightness(1.1);
}

@media (max-width: 600px) {
    .replay-container {
        padding: 1rem;
        border-radius: 18px;
        margin-bottom: 1.5rem !important;
    }
    .replay-action-box button {
        height: 55px !important;
        font-size: 1.1rem !important;
    }
}

/* ============================================
   Premium Language Switcher (Globe Dropdown)
   ============================================ */
.lang-selector-header {
    position: relative;
    margin-right: 0.75rem;
    z-index: 100;
}

.lang-globe-btn {
    width: 42px;
    height: 42px;
.lang-selector-header {
    position: relative;
    display: flex;
    align-items: center;
}

.lang-globe-btn {
    width: 38px;
    height: 38px;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border);
    color: var(--secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: var(--transition);
    font-size: 1.1rem;
    position: relative;
    z-index: 10;
}

.lang-globe-btn:hover, .lang-selector-header.open .lang-globe-btn {
    background: rgba(255, 255, 255, 0.1);
    border-color: var(--secondary);
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(6, 182, 212, 0.2);
}

.lang-dropdown {
    position: absolute;
    top: calc(100% + 12px);
    right: 0;
    background: rgba(13, 17, 23, 0.95);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 8px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px) scale(0.95);
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    box-shadow: 0 15px 40px rgba(0,0,0,0.6);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    z-index: 1000;
}

.lang-selector-header.open .lang-dropdown {
    opacity: 1;
    visibility: visible;
    transform: translateY(0) scale(1);
}

.lang-flag-btn {
    width: 42px;
    height: 32px;
    border-radius: 8px;
    border: 2px solid transparent;
    cursor: pointer;
    transition: var(--transition);
    padding: 0;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.05);
    box-shadow: 0 4px 10px rgba(0,0,0,0.2);
}

.lang-flag-btn:hover {
    transform: translateX(-4px);
    background: rgba(255, 255, 255, 0.15);
}

.lang-flag-btn.active {
    border-color: var(--primary);
    box-shadow: 0 0 15px var(--primary-glow);
}

.lang-flag-btn img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    filter: saturate(1.2);
}

@media (max-width: 768px) {
    .lang-globe-btn {
        width: 42px;
        height: 42px;
        font-size: 1.25rem;
    }
    
    .lang-dropdown {
        padding: 10px;
        gap: 12px;
        top: calc(100% + 15px);
    }
    
    .lang-flag-btn {
        width: 50px;
        height: 38px;
    }
}



/* PRO Promo Card in Profile */
.pro-promo-card {
    background: linear-gradient(135deg, rgba(13, 17, 23, 0.9) 0%, rgba(20, 26, 35, 0.95) 100%);
    border: 1px solid rgba(251, 191, 36, 0.4);
    border-radius: 1.5rem;
    padding: 1.5rem;
    text-align: center;
    position: relative;
    overflow: hidden;
    box-shadow: 0 10px 30px rgba(0,0,0,0.5), inset 0 0 20px rgba(251, 191, 36, 0.05);
    margin: 1.5rem 0;
}

.pro-promo-card::before {
    content: "";
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(251, 191, 36, 0.08) 0%, transparent 60%);
    pointer-events: none;
    animation: pulseGlow 4s infinite alternate;
}

@keyframes pulseGlow {
    0% { opacity: 0.5; transform: scale(1); }
    100% { opacity: 1; transform: scale(1.1); }
}

.pro-promo-small {
    font-size: 0.75rem; /* Even smaller as requested */
    color: var(--text-dim);
    line-height: 1.5;
    margin-bottom: 1.25rem;
    text-align: center;
    opacity: 0.8;
}

.pro-promo-large {
    font-size: 1.2rem;
    font-weight: 800;
    color: var(--text-main);
    margin-bottom: 1.25rem;
    text-shadow: 0 2px 4px rgba(0,0,0,0.3);
}

.btn-pro-action {
    background: linear-gradient(135deg, #fbbf24, #f59e0b) !important;
    color: #000 !important;
    border: none !important;
    font-weight: 900 !important;
    font-size: 1.25rem !important; /* Larger button */
    padding: 1rem 1.5rem !important; /* Larger padding */
    text-transform: uppercase;
    letter-spacing: 1px;
    box-shadow: 0 4px 20px rgba(245, 158, 11, 0.4);
    text-decoration: none;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    border-radius: 1rem;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275) !important;
}

.btn-pro-action:hover {
    transform: translateY(-4px) scale(1.02);
    box-shadow: 0 10px 30px rgba(245, 158, 11, 0.5);
    filter: brightness(1.1);
}

.btn-pro-action i {
    font-size: 1.4rem;
    filter: drop-shadow(0 2px 2px rgba(0,0,0,0.2));
}

.pro-active-badge {
    background: rgba(34, 197, 94, 0.1);
    border: 1px solid rgba(34, 197, 94, 0.2);
    color: var(--success);
    padding: 0.75rem;
    border-radius: 1rem;
    text-align: center;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}



/* Categories */
.category-card {
    background: var(--card-bg, rgba(255, 255, 255, 0.05));
    border: 1px solid var(--card-border, rgba(255, 255, 255, 0.1));
    border-radius: 1.5rem;
    padding: 2rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1.5rem;
    cursor: pointer;
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    position: relative;
    overflow: hidden;
    text-align: center;
}

.category-card:hover {
    transform: translateY(-8px) scale(1.02);
    border-color: var(--cat-color);
    box-shadow: 0 20px 40px rgba(0,0,0,0.3), 0 0 20px var(--cat-color);
}

.category-card::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: var(--cat-color);
    opacity: 0.7;
}

.category-icon {
    width: 70px;
    height: 70px;
    background: var(--cat-color);
    border-radius: 1.25rem;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    color: white;
    box-shadow: 0 10px 20px rgba(0,0,0,0.2);
}

.category-name {
    font-size: 1.25rem;
    font-weight: 800;
    color: var(--text-main, #fff);
}

.category-count {
    font-size: 0.85rem;
    color: var(--text-muted, #94a3b8);
    font-weight: 500;
    margin-top: 0.25rem;
}


.empty-category {
    grid-column: 1 / -1;
    padding: 4rem 2rem;
    text-align: center;
    color: var(--text-muted, #94a3b8);
    background: rgba(255,255,255,0.03);
    border-radius: 2rem;
    border: 2px dashed var(--card-border, rgba(255, 255, 255, 0.1));
}

.empty-category i {
    font-size: 3rem;
    margin-bottom: 1rem;
    opacity: 0.3;
}

@media (max-width: 768px) {
    .category-card {
        padding: 1.5rem;
        flex-direction: row;
        text-align: left;
        gap: 1.25rem;
    }
    .category-icon {
        width: 50px;
        height: 50px;
        font-size: 1.5rem;
        border-radius: 1rem;
    }
    .category-name {
        font-size: 1.1rem;
    }
}


/* Premium Categories */
.category-premium-card {
    cursor: pointer;
}

.category-previews {
    display: flex !important;
    gap: 0.5rem !important;
    align-items: center !important;
    font-size: 0.9rem !important;
}

.category-previews i {
    transition: transform 0.3s ease;
}

.category-premium-card:hover .category-previews i {
    transform: scale(1.3);
    filter: brightness(1.2) drop-shadow(0 0 8px rgba(255,255,255,0.2));
}

.category-premium-card .game-icon {
    transition: all 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.category-premium-card:hover .game-icon {
    transform: rotate(10deg) scale(1.1);
}


/* Locked Categories */
.category-premium-card.locked {
    filter: grayscale(0.5) contrast(0.8);
    opacity: 0.9;
}

.category-premium-card.locked:hover {
    transform: translateY(0) scale(1);
    box-shadow: none;
    border-color: var(--card-border);
}

.category-premium-card.locked .game-icon {
    filter: grayscale(1);
    opacity: 0.6;
}


/* Elegant Navigation Styles */
.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    flex-wrap: wrap;
    gap: 1rem;
}

/* SINGLE ULTRA PREMIUM BACK BUTTON - Master Definition */
.ultra-premium-back-btn {
    display: inline-flex !important;
    flex-direction: row !important;
    align-items: center !important;
    justify-content: flex-start !important;
    gap: 0.75rem !important;
    background: rgba(255, 255, 255, 0.05) !important;
    border: 1px solid rgba(255, 255, 255, 0.15) !important;
    padding: 6px 16px 6px 6px !important;
    border-radius: 100px !important;
    color: #ffffff !important;
    font-size: 0.85rem !important;
    font-weight: 800 !important;
    text-transform: uppercase !important;
    letter-spacing: 1px !important;
    cursor: pointer !important;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1) !important;
    backdrop-filter: blur(20px) !important;
    -webkit-backdrop-filter: blur(20px) !important;
    box-shadow: 0 8px 32px rgba(0,0,0,0.3) !important;
    margin: 1.5rem 0 !important;
    position: relative !important;
    overflow: hidden !important;
    white-space: nowrap !important;
}

.ultra-premium-back-btn:hover {
    background: rgba(255, 255, 255, 0.1) !important;
    border-color: #818cf8 !important;
    transform: translateX(-5px) scale(1.02) !important;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.4), 0 0 20px rgba(99, 102, 241, 0.2) !important;
}

.ultra-premium-back-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.15), transparent);
    transition: 0.6s;
}

.ultra-premium-back-btn:hover::before {
    left: 100%;
}

.elegant-back-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.1), transparent);
    transition: 0.6s;
}

.elegant-back-btn:hover::before {
    left: 100%;
}

.back-btn-icon {
    width: 38px !important;
    height: 38px !important;
    background: linear-gradient(135deg, var(--primary, #6366f1), var(--secondary, #a855f7)) !important;
    border-radius: 50% !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    color: white !important;
    font-size: 1rem !important;
    box-shadow: 0 4px 15px rgba(99, 102, 241, 0.4) !important;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1) !important;
}

.ultra-premium-back-btn:hover .back-btn-icon {
    transform: rotate(-15deg) scale(1.1) !important;
    box-shadow: 0 0 25px rgba(99, 102, 241, 0.6) !important;
}

@media (max-width: 768px) {
    .ultra-premium-back-btn {
        width: auto !important;
        max-width: fit-content !important;
        justify-content: flex-start !important;
        margin: 1rem 0 2rem 0 !important;
    }
}

/* Responsive Emoji Bar with Horizontal Scroll */
@media (max-width: 450px) {
    .emoji-reactions-bar.expanded {
        width: auto;
        max-width: 92vw;
        padding: 0.4rem 0.8rem 0.4rem 0.4rem;
    }
    .emoji-list {
        gap: 0.8rem;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
        padding-right: 1rem;
    }
    .emoji-list::-webkit-scrollbar {
        display: none;
    }
    .emoji-btn {
        flex-shrink: 0;
    }
}

@keyframes pulseGlowPrimary {
    from { opacity: 0.8; }
    to { opacity: 1; }
}



/* ========================================
   GAME COMPANION / HELPER WIDGET
   ======================================== */

/* Banner that slides in at the bottom */
.companion-banner {
    position: fixed;
    bottom: 1.5rem;
    left: 1rem;
    right: 1rem;
    z-index: 1000;
    display: flex;
    justify-content: center;
    pointer-events: none;
    transform: translateY(150%);
    transition: transform 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}
.companion-banner.visible {
    transform: translateY(0);
}
.companion-banner-inner {
    display: flex;
    align-items: center;
    gap: 1rem;
    background: linear-gradient(135deg, rgba(30, 27, 75, 0.95), rgba(17, 24, 39, 0.98));
    border: 1px solid rgba(129, 140, 248, 0.3);
    border-radius: 1.25rem;
    padding: 0.8rem 1.2rem;
    max-width: 500px;
    width: 100%;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(10px); /* Redus de la 16px */
    pointer-events: auto;
}
.companion-avatar {
    font-size: 2rem;
    flex-shrink: 0;
    filter: drop-shadow(0 0 10px rgba(129, 140, 248, 0.5));
    animation: companionFloat 3s ease-in-out infinite;
}
@keyframes companionFloat {
    0%, 100% { transform: translateY(0) rotate(0); }
    50% { transform: translateY(-5px) rotate(5deg); }
}
.companion-banner-text {
    font-size: 0.95rem;
    font-weight: 500;
    line-height: 1.4;
    color: #fff;
}
.companion-banner-text b {
    color: #818cf8;
    font-weight: 700;
}

/* The collapsed bubble */
.companion-bubble {
    position: fixed;
    bottom: 85px;
    right: 1.2rem;
    z-index: 999;
    width: 52px;
    height: 52px;
    background: linear-gradient(135deg, #6366f1, #4338ca);
    border: 2px solid rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 8px 24px rgba(67, 56, 202, 0.4);
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    opacity: 0;
    pointer-events: none;
    transform: scale(0.5) rotate(-45deg);
}
.companion-bubble.visible {
    opacity: 1;
    pointer-events: auto;
    transform: scale(1) rotate(0);
}
.companion-bubble:hover {
    transform: scale(1.1) translateY(-3px);
    box-shadow: 0 12px 32px rgba(67, 56, 202, 0.6);
}
.companion-bubble i {
    font-size: 1.4rem;
    color: white;
}
.companion-bubble .companion-ping {
    position: absolute;
    top: -2px;
    right: -2px;
    width: 14px;
    height: 14px;
    background: #f43f5e;
    border: 2px solid #111827;
    border-radius: 50%;
    animation: companionPulse 2s infinite;
}
@keyframes companionPulse {
    0% { transform: scale(1); box-shadow: 0 0 0 0 rgba(244, 63, 94, 0.7); }
    70% { transform: scale(1.2); box-shadow: 0 0 0 10px rgba(244, 63, 94, 0); }
    100% { transform: scale(1); box-shadow: 0 0 0 0 rgba(244, 63, 94, 0); }
}

/* Expanded popover */
.companion-popover {
    position: fixed;
    bottom: 145px;
    right: 1.2rem;
    z-index: 1001;
    width: 280px;
    background: rgba(17, 24, 39, 0.95);
    border: 1px solid rgba(99, 102, 241, 0.4);
    border-radius: 1.25rem;
    padding: 1.2rem;
    box-shadow: 0 20px 50px rgba(0,0,0,0.6);
    backdrop-filter: blur(10px); /* Redus de la 20px */
    transform-origin: bottom right;
    transform: scale(0.8) translateY(20px);
    opacity: 0;
    pointer-events: none;
    transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}
.companion-popover::after {
    content: '';
    position: absolute;
    bottom: -10px;
    right: 20px;
    border-left: 10px solid transparent;
    border-right: 10px solid transparent;
    border-top: 10px solid rgba(17, 24, 39, 0.95);
}

.companion-popover.visible {
    transform: scale(1) translateY(0);
    opacity: 1;
    pointer-events: auto;
}
.companion-popover-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0.8rem;
    padding-bottom: 0.6rem;
    border-bottom: 1px solid rgba(255,255,255,0.1);
}
.companion-popover-title {
    font-size: 0.8rem;
    font-weight: 800;
    color: #818cf8;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}
.companion-popover-title span { font-size: 1.2rem; }
.companion-popover-close {
    background: rgba(255,255,255,0.05);
    border: none;
    color: #9ca3af;
    cursor: pointer;
    width: 24px;
    height: 24px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}
.companion-popover-close:hover {
    background: rgba(239, 68, 68, 0.2);
    color: #f87171;
}
.companion-popover-body {
    font-size: 0.92rem;
    line-height: 1.6;
    color: #e5e7eb;
}
.companion-popover-body b {
    color: #818cf8;
    font-weight: 700;
}
