        :root {
            --bg: #0b0e1a;
            --bg-dark: #060812;
            --accent: #00ff9d;
            --accent2: #00d4ff;
            --accent3: #7c9eff;
            --text: #e0f0ff;
            --text-dim: #a3bffa;
            --card: rgba(20, 25, 45, 0.65);
            --glow: 0 0 20px;
            --glow-intense: 0 0 40px;
            --safe-bottom: env(safe-area-inset-bottom, 0px);
        }

        * {
            margin: 0;
            padding: 0;
            box-sizing: border-box;
            -webkit-tap-highlight-color: transparent;
        }

        body {
            font-family: 'Inter', sans-serif;
            background: linear-gradient(145deg, var(--bg-dark) 0%, var(--bg) 100%);
            color: var(--text);
            min-height: 100dvh;
            overflow-x: hidden;
            width: 100%;
        }

        /* Navigation */
        .navbar-desktop {
            position: fixed;
            inset: 0 0 auto 0;
            padding: 0.9rem 5vw;
            background: rgba(8, 12, 30, 0.98);
            backdrop-filter: blur(12px);
            border-bottom: 1px solid rgba(0, 255, 157, 0.16);
            z-index: 1000;
            display: flex;
            justify-content: space-between;
            align-items: center;
            width: 100%;
        }

        @media (max-width: 1024px) {
            .navbar-desktop {
                display: none;
            }
        }

        .logo {
            font-family: 'Orbitron', monospace;
            font-size: clamp(1.4rem, 5vw, 1.8rem);
            font-weight: 800;
            background: linear-gradient(90deg, var(--accent), var(--accent2));
            -webkit-background-clip: text;
            background-clip: text;
            color: transparent;
        }

        .nav-links {
            display: flex;
            gap: clamp(1rem, 3vw, 1.8rem);
            align-items: center;
        }

        .nav-links a {
            color: var(--text-dim);
            text-decoration: none;
            font-weight: 500;
            font-size: clamp(0.8rem, 3vw, 0.95rem);
            transition: all 0.22s;
            padding: 0.3rem 0.5rem;
        }

        .nav-links a:hover,
        .nav-links a.active {
            color: var(--accent);
            text-shadow: 0 0 12px var(--accent);
        }

        .btn-small {
            background: linear-gradient(90deg, var(--accent), var(--accent2));
            color: #0b1121 !important;
            padding: 0.4rem 1rem;
            border-radius: 50vmax;
            font-weight: 700;
        }

        /* Sidebar */
        .sidebar-toggle {
            position: fixed;
            top: 1rem;
            left: 1rem;
            z-index: 1100;
            background: var(--card);
            border: 1px solid var(--accent2);
            color: var(--accent2);
            width: 44px;
            height: 44px;
            border-radius: 50%;
            font-size: 1.5rem;
            cursor: pointer;
            display: none;
            align-items: center;
            justify-content: center;
            backdrop-filter: blur(8px);
        }

        @media (max-width: 1024px) {
            .sidebar-toggle {
                display: flex;
            }
        }

        .admin-sidebar {
            display: none;
            position: fixed;
            top: 1rem;
            left: 1rem;
            transform: translateX(-120%);
            opacity: 0;
            width: 260px;
            background: rgba(8, 12, 24, 0.98);
            backdrop-filter: blur(16px);
            border: 1px solid var(--accent2);
            border-radius: 2rem;
            padding: 1.5rem 0.8rem;
            transition: transform 0.3s, opacity 0.2s;
            z-index: 2000;
        }

        @media (max-width: 1024px) {
            .admin-sidebar {
                display: block;
            }
        }

        .admin-sidebar.open {
            transform: translateX(0);
            opacity: 1;
        }

        .sidebar-logo {
            font-family: 'Orbitron', monospace;
            font-size: 1.5rem;
            font-weight: 800;
            background: linear-gradient(90deg, var(--accent2), var(--accent));
            -webkit-background-clip: text;
            background-clip: text;
            color: transparent;
            padding: 0 0.5rem 1.2rem;
            border-bottom: 1px solid var(--accent2);
            margin-bottom: 1.2rem;
        }

        .sidebar-nav a {
            display: flex;
            align-items: center;
            gap: 0.8rem;
            padding: 0.7rem 1rem;
            color: var(--text-dim);
            text-decoration: none;
            border-radius: 2rem;
        }

        .sidebar-nav a i {
            width: 1.5rem;
            color: var(--accent2);
        }

        .sidebar-nav a:hover,
        .sidebar-nav a.active {
            background: rgba(0, 212, 255, 0.15);
            color: var(--accent2);
        }

        .sidebar-footer {
            margin-top: auto;
            padding-top: 1rem;
            border-top: 1px solid rgba(0, 255, 157, 0.1);
            margin-top: 1.5rem;
        }

        .sidebar-footer .signup-link {
            background: linear-gradient(90deg, var(--accent), var(--accent2));
            color: #0b1121;
            padding: 0.7rem 1rem;
            border-radius: 2rem;
            text-align: center;
            display: block;
            font-weight: 700;
            text-decoration: none;
        }

        .sidebar-footer .logout-link {
            background: linear-gradient(90deg, rgba(225, 62, 62, 0.81), red);
            color: white;
            padding: 0.7rem 1rem;
            border-radius: 2rem;
            text-align: center;
            display: flex;
            align-items: center;
            justify-content: center;
            gap: 0.5rem;
            font-weight: 700;
            text-decoration: none;
            margin-top: 0.5rem;
        }

        .main-container {
            max-width: 1200px;
            margin: 0 auto;
            width: 100%;
            padding: 0 1rem;
        }

        @media (min-width: 1025px) {
            .main-container {
                padding-top: 80px;
            }
        }

        @media (max-width: 1024px) {
            .main-container {
                padding-top: 0.5rem;
            }
        }

        .back-home {
            display: inline-flex;
            align-items: center;
            gap: 0.5rem;
            color: var(--text-dim);
            text-decoration: none;
            margin: 1rem 0;
            font-size: 0.9rem;
        }

        @media (max-width: 1024px) {
            .back-home {
                margin-left: 3.5rem;
            }
        }

        @media (min-width: 1025px) {
            .back-home {
                margin-left: 1rem;
            }
        }

        .back-home:hover {
            color: var(--accent);
            transform: translateX(-5px);
        }

        /* Game Header */
        .game-header {
            text-align: center;
            padding: 1rem;
        }

        .game-header h1 {
            font-family: 'Orbitron', monospace;
            font-size: clamp(1.8rem, 8vw, 2.5rem);
            font-weight: 900;
        }

        .gradient-text {
            background: linear-gradient(90deg, var(--accent), var(--accent2), var(--accent3));
            -webkit-background-clip: text;
            background-clip: text;
            color: transparent;
        }

        /* Mode Selector */
        .mode-selector {
            display: flex;
            justify-content: center;
            gap: 1rem;
            margin: 1rem auto;
            flex-wrap: wrap;
        }

        .mode-btn {
            background: rgba(255, 255, 255, 0.05);
            border: 1px solid rgba(0, 255, 157, 0.3);
            border-radius: 50px;
            padding: 0.6rem 1.5rem;
            font-size: 1rem;
            font-weight: 600;
            cursor: pointer;
            transition: all 0.2s;
            color: var(--text-dim);
        }

        .mode-btn:hover {
            border-color: var(--accent);
            color: var(--accent);
            transform: translateY(-2px);
        }

        .mode-btn.active {
            background: linear-gradient(90deg, var(--accent), var(--accent2));
            color: #0b1121;
            border-color: transparent;
        }

        .mode-btn.practice {
            background: rgba(0, 255, 157, 0.2);
            border-color: var(--accent);
        }

        /* Timer Settings */
        .timer-settings {
            background: var(--card);
            border-radius: 1.5rem;
            padding: 1rem;
            margin: 1rem auto;
            max-width: 500px;
            text-align: center;
            border: 1px solid rgba(0, 255, 157, 0.2);
            display: none;
        }

        .timer-settings.show {
            display: block;
        }

        .timer-presets {
            display: flex;
            justify-content: center;
            gap: 0.5rem;
            flex-wrap: wrap;
            margin: 0.5rem 0;
        }

        .preset-btn {
            background: rgba(255, 255, 255, 0.1);
            border: 1px solid rgba(0, 255, 157, 0.3);
            border-radius: 50px;
            padding: 0.3rem 0.8rem;
            font-size: 0.8rem;
            cursor: pointer;
            transition: all 0.2s;
        }

        .preset-btn:hover,
        .preset-btn.active {
            background: var(--accent);
            color: #0b1121;
            border-color: transparent;
        }

        .custom-timer {
            display: flex;
            justify-content: center;
            gap: 0.5rem;
            margin: 0.5rem 0;
        }

        .custom-timer input {
            background: rgba(0, 0, 0, 0.5);
            border: 1px solid rgba(0, 255, 157, 0.3);
            border-radius: 1rem;
            padding: 0.3rem 0.8rem;
            color: var(--text);
            width: 80px;
            text-align: center;
        }

        .custom-timer button {
            background: var(--accent);
            border: none;
            border-radius: 1rem;
            padding: 0.3rem 1rem;
            cursor: pointer;
            font-weight: bold;
        }

        /* Game Stats */
        .game-stats {
            display: flex;
            justify-content: center;
            gap: 2rem;
            flex-wrap: wrap;
            margin: 1rem auto;
            padding: 1rem;
            background: var(--card);
            border-radius: 2rem;
            border: 1px solid rgba(0, 255, 157, 0.2);
            max-width: 800px;
        }

        .stat-box {
            text-align: center;
        }

        .stat-value {
            font-family: 'Orbitron', monospace;
            font-size: 1.8rem;
            font-weight: bold;
            color: var(--accent);
        }

        .stat-label {
            font-size: 0.7rem;
            color: var(--text-dim);
            text-transform: uppercase;
            letter-spacing: 1px;
        }

        .time-bar {
            position: fixed;
            top: 80px;
            left: 50%;
            transform: translateX(-50%);
            width: 300px;
            height: 6px;
            background: rgba(255, 255, 255, 0.2);
            border-radius: 3px;
            overflow: hidden;
            z-index: 100;
        }

        .time-fill {
            height: 100%;
            background: linear-gradient(90deg, var(--accent), var(--accent2));
            width: 100%;
            transition: width 0.1s linear;
        }

        /* Practice Badge */
        .practice-badge {
            position: fixed;
            top: 100px;
            right: 20px;
            background: linear-gradient(135deg, #ffd700, #ffaa00);
            color: #0b1121;
            padding: 0.3rem 1rem;
            border-radius: 50px;
            font-weight: bold;
            font-size: 0.8rem;
            z-index: 100;
            display: none;
        }

        .practice-badge.show {
            display: block;
            animation: fadeIn 0.3s ease;
        }

        /* Difficulty Selector */
        .difficulty-selector {
            display: flex;
            justify-content: center;
            gap: 1rem;
            margin: 1rem auto;
            flex-wrap: wrap;
        }

        .difficulty-btn {
            background: rgba(255, 255, 255, 0.05);
            border: 1px solid rgba(0, 255, 157, 0.3);
            border-radius: 50px;
            padding: 0.5rem 1.2rem;
            font-size: 0.9rem;
            font-weight: 600;
            cursor: pointer;
            transition: all 0.2s;
            color: var(--text-dim);
        }

        .difficulty-btn:hover {
            border-color: var(--accent);
            color: var(--accent);
            transform: translateY(-2px);
        }

        .difficulty-btn.active {
            background: linear-gradient(90deg, var(--accent), var(--accent2));
            color: #0b1121;
            border-color: transparent;
        }

        /* Memory Grid */
        .memory-grid {
            display: grid;
            gap: 0.8rem;
            justify-content: center;
            margin: 2rem auto;
            max-width: 800px;
        }

        .memory-grid.grid-4x4 {
            grid-template-columns: repeat(4, 1fr);
            width: min(500px, 90vw);
        }

        .memory-grid.grid-6x6 {
            grid-template-columns: repeat(6, 1fr);
            width: min(600px, 95vw);
            gap: 0.5rem;
        }

        .memory-grid.grid-8x8 {
            grid-template-columns: repeat(8, 1fr);
            width: min(800px, 98vw);
            gap: 0.4rem;
        }

        .memory-grid.grid-8x8 .memory-card i {
            font-size: 1.2rem;
        }

        .memory-card {
            aspect-ratio: 1 / 1;
            background: linear-gradient(135deg, #1a1f35, #0f1322);
            border-radius: 1rem;
            cursor: pointer;
            display: flex;
            align-items: center;
            justify-content: center;
            font-size: 2.5rem;
            transition: all 0.2s;
            border: 2px solid rgba(0, 255, 157, 0.3);
            box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
            transform: scale(1);
        }

        .memory-card:hover {
            transform: scale(1.02);
            border-color: var(--accent);
            box-shadow: 0 0 20px rgba(0, 255, 157, 0.3);
        }

        .memory-card.flipped,
        .memory-card.matched {
            background: linear-gradient(135deg, var(--accent), var(--accent2));
            transform: scale(0.98);
        }

        .memory-card.matched {
            opacity: 0.6;
            cursor: default;
        }

        .memory-card.matched i {
            color: #0b1121;
        }

        .memory-card i {
            font-size: 2rem;
            color: var(--text);
            transition: all 0.2s;
        }

        .memory-card.flipped i,
        .memory-card.matched i {
            color: #0b1121;
            text-shadow: 0 0 5px rgba(0, 0, 0, 0.3);
        }

        /* Combo Meter */
        .combo-meter {
            position: fixed;
            bottom: 100px;
            left: 50%;
            transform: translateX(-50%);
            background: linear-gradient(135deg, #ffd700, #ffaa00);
            color: #000;
            border-radius: 50px;
            padding: 0.5rem 1.5rem;
            font-weight: bold;
            font-size: 1rem;
            z-index: 100;
            display: none;
            white-space: nowrap;
        }

        .combo-meter.show {
            display: block;
            animation: comboPop 0.3s ease;
        }

        @keyframes comboPop {
            0% {
                transform: translateX(-50%) scale(0.8);
                opacity: 0;
            }

            100% {
                transform: translateX(-50%) scale(1);
                opacity: 1;
            }
        }

        /* Leaderboard */
        .leaderboard-section {
            background: var(--card);
            border-radius: 1.5rem;
            padding: 1.5rem;
            margin: 2rem auto;
            max-width: 800px;
            border: 1px solid rgba(0, 255, 157, 0.2);
        }

        .memory-rank-item {
            display: flex;
            align-items: center;
            gap: 1rem;
            padding: 0.75rem;
            border-bottom: 1px solid rgba(255, 255, 255, 0.05);
        }

        .memory-rank-number {
            font-family: 'Orbitron', monospace;
            width: 40px;
            font-weight: bold;
            color: var(--accent);
        }

        .memory-rank-flag {
            font-size: 1.2rem;
            width: 30px;
        }

        .memory-rank-name {
            flex: 1;
        }

        .memory-rank-score {
            font-family: 'Orbitron', monospace;
            color: var(--accent2);
            font-weight: bold;
        }

        .memory-rank-time {
            font-size: 0.7rem;
            color: var(--text-dim);
            margin-left: 0.5rem;
        }

        /* Modal */
        .game-over-modal {
            display: none;
            position: fixed;
            top: 0;
            left: 0;
            width: 100%;
            height: 100%;
            background: rgba(0, 0, 0, 0.9);
            backdrop-filter: blur(8px);
            z-index: 2000;
            align-items: center;
            justify-content: center;
        }

        .modal-content {
            background: linear-gradient(135deg, #1a1f35, #0b0e1a);
            border-radius: 2rem;
            padding: 2rem;
            max-width: 500px;
            width: 90%;
            text-align: center;
            border: 1px solid var(--accent);
        }

        .modal-buttons {
            display: flex;
            gap: 1rem;
            justify-content: center;
            margin-top: 1.5rem;
        }

        .modal-btn {
            padding: 0.75rem 1.5rem;
            border-radius: 2rem;
            font-weight: bold;
            cursor: pointer;
            border: none;
        }

        .modal-btn-primary {
            background: linear-gradient(90deg, var(--accent), var(--accent2));
            color: #0b1121;
        }

        .modal-btn-secondary {
            background: transparent;
            border: 1px solid var(--accent);
            color: var(--accent);
        }

        .practice-warning {
            background: rgba(255, 193, 7, 0.2);
            border: 1px solid #ffc107;
            border-radius: 1rem;
            padding: 0.5rem;
            margin: 1rem 0;
            display: none;
        }

        /* Footer */
        footer {
            padding: 2rem 5vw 1.5rem;
            display: flex;
            flex-direction: row;
            justify-content: space-around;
            color: var(--text-dim);
            border-top: 1px solid rgba(0, 255, 157, 0.1);
            font-size: 0.8rem;
            margin-top: 2rem;
            width: 100%;
            padding-bottom: calc(1.5rem + var(--safe-bottom));
        }

        .footer-developer {
            font-family: 'Orbitron', monospace;
            font-size: 0.9rem;
            color: #8ab4ff;
        }

        footer a {
            color: var(--text-dim);
            text-decoration: none;
            font-size: 0.8rem;
        }

        footer a:hover {
            color: var(--accent);
        }

        @media (max-width: 930px) {
            footer {
                flex-direction: column;
                justify-content: center;
                align-items: center;
                text-align: center;
                gap: 0.8rem;
            }
        }


        body.sidebar-open {
            overflow: hidden;
        }

        @keyframes fadeIn {
            from {
                opacity: 0;
                transform: translateY(-10px);
            }

            to {
                opacity: 1;
                transform: translateY(0);
            }
        }

        @keyframes fadeOut {
            0% {
                opacity: 1;
                transform: translate(-50%, -50%) scale(1);
            }

            100% {
                opacity: 0;
                transform: translate(-50%, -50%) scale(1.2);
                display: none;
            }
        }

        @keyframes matchFlash {
            0% {
                transform: scale(1);
            }

            50% {
                transform: scale(1.1);
            }

            100% {
                transform: scale(1);
            }
        }

        .match-animation {
            animation: matchFlash 0.2s ease;
        }

        @keyframes mismatchShake {

            0%,
            100% {
                transform: translateX(0);
            }

            25% {
                transform: translateX(-3px);
            }

            75% {
                transform: translateX(3px);
            }
        }

        .mismatch-animation {
            animation: mismatchShake 0.2s ease;
        }