        :root {
            --bg-dark: #0a0a0f;
            --bg-gradient-start: #1a1a2e;
            --bg-gradient-end: #0f0f1e;
            --panel-bg: #1e1e2e;
            --accent: #00e5ff;
            --accent-glow: rgba(0, 229, 255, 0.3);
            --text: #ffffff;
            --button-hover: #2a2a3e;
            --success: #4CAF50;
            --warning: #ff9800;
        }

        * {
            box-sizing: border-box;
        }

        body {
            margin: 0;
            padding: 0;
            background: linear-gradient(135deg, var(--bg-gradient-start) 0%, var(--bg-gradient-end) 100%);
            color: var(--text);
            font-family: 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
            display: flex;
            flex-direction: column;
            align-items: center;
            justify-content: center;
            min-height: 100vh;
            overflow: hidden;
            touch-action: none;
        }

        /* Animated background particles */
        .bg-particles {
            position: fixed;
            inset: 0;
            overflow: hidden;
            pointer-events: none;
            z-index: 0;
        }

        .particle {
            position: absolute;
            width: 4px;
            height: 4px;
            background: var(--accent);
            border-radius: 50%;
            opacity: 0.3;
            animation: float 20s infinite linear;
        }

        @keyframes float {
            0% { transform: translateY(100vh) translateX(0); }
            100% { transform: translateY(-100vh) translateX(100px); }
        }

        /* Preloader */
        #preloader {
            position: fixed;
            inset: 0;
            background: var(--bg-dark);
            display: flex;
            flex-direction: column;
            justify-content: center;
            align-items: center;
            z-index: 1000;
            transition: opacity 0.5s ease;
        }

        .spinner {
            width: 60px;
            height: 60px;
            border: 6px solid rgba(255,255,255,0.1);
            border-top: 6px solid var(--accent);
            border-radius: 50%;
            animation: spin 1s cubic-bezier(0.68, -0.55, 0.265, 1.55) infinite;
            box-shadow: 0 0 20px var(--accent-glow);
        }

        @keyframes spin { 
            0% { transform: rotate(0deg); } 
            100% { transform: rotate(360deg); } 
        }

        /* UI Elements */
        #game-container {
            position: relative;
            display: flex;
            flex-direction: column;
            align-items: center;
            width: 95vw;
            max-width: 520px;
            z-index: 1;
            padding: 20px;
        }

        header {
            text-align: center;
            margin-bottom: 20px;
            width: 100%;
        }

        h1 { 
            margin: 0 0 10px 0; 
            font-size: 2.2rem; 
            letter-spacing: 4px; 
            color: var(--accent);
            text-shadow: 0 0 20px var(--accent-glow), 0 0 40px var(--accent-glow);
            font-weight: 700;
        }

        .stats {
            display: flex;
            justify-content: space-between;
            align-items: center;
            width: 100%;
            margin: 15px 0;
            padding: 15px 20px;
            background: rgba(30, 30, 46, 0.8);
            border-radius: 12px;
            font-weight: 600;
            backdrop-filter: blur(10px);
            border: 1px solid rgba(255,255,255,0.1);
            box-shadow: 0 4px 15px rgba(0,0,0,0.3);
        }

        .stat-item {
            display: flex;
            flex-direction: column;
            align-items: center;
            gap: 5px;
        }

        .stat-label {
            font-size: 0.75rem;
            opacity: 0.7;
            text-transform: uppercase;
            letter-spacing: 1px;
        }

        .stat-value {
            font-size: 1.2rem;
            color: var(--accent);
        }

        #canvas-wrapper {
            position: relative;
            background: var(--panel-bg);
            border-radius: 16px;
            box-shadow: 0 15px 50px rgba(0,0,0,0.6), 
                        0 0 30px var(--accent-glow);
            padding: 15px;
            border: 2px solid rgba(0, 229, 255, 0.2);
            transition: transform 0.2s ease;
        }

        #canvas-wrapper:hover {
            transform: translateY(-2px);
        }

        canvas {
            display: block;
            border-radius: 12px;
            touch-action: none;
            background: rgba(0,0,0,0.3);
        }

        .controls {
            margin-top: 25px;
            display: flex;
            gap: 15px;
            width: 100%;
            justify-content: center;
        }

        button {
            padding: 12px 28px;
            border: none;
            border-radius: 8px;
            background: var(--panel-bg);
            color: white;
            cursor: pointer;
            font-weight: 600;
            font-size: 0.95rem;
            transition: all 0.3s ease;
            border: 2px solid rgba(255,255,255,0.1);
            box-shadow: 0 4px 15px rgba(0,0,0,0.3);
            position: relative;
            overflow: hidden;
        }

        button::before {
            content: '';
            position: absolute;
            top: 50%;
            left: 50%;
            width: 0;
            height: 0;
            border-radius: 50%;
            background: rgba(255,255,255,0.1);
            transform: translate(-50%, -50%);
            transition: width 0.6s, height 0.6s;
        }

        button:hover::before {
            width: 300px;
            height: 300px;
        }

        button:hover { 
            background: var(--button-hover);
            transform: translateY(-2px);
            box-shadow: 0 6px 20px rgba(0,0,0,0.4);
        }

        button:active {
            transform: translateY(0);
        }

        #sound-toggle {
            position: fixed;
            top: 20px;
            right: 20px;
            width: 50px;
            height: 50px;
            border-radius: 50%;
            display: flex;
            align-items: center;
            justify-content: center;
            font-size: 1.5rem;
            z-index: 100;
            padding: 0;
        }

        #sound-toggle.muted {
            opacity: 0.5;
        }

        /* Modals */
        .overlay {
            position: fixed;
            inset: 0;
            background: rgba(0,0,0,0.9);
            display: none;
            flex-direction: column;
            justify-content: center;
            align-items: center;
            z-index: 500;
            backdrop-filter: blur(10px);
            animation: fadeIn 0.3s ease;
        }

        @keyframes fadeIn {
            from { opacity: 0; }
            to { opacity: 1; }
        }

        .modal-content {
            background: var(--panel-bg);
            padding: 40px;
            border-radius: 20px;
            text-align: center;
            max-width: 85%;
            border: 2px solid rgba(0, 229, 255, 0.3);
            box-shadow: 0 20px 60px rgba(0,0,0,0.5),
                        0 0 40px var(--accent-glow);
            animation: slideUp 0.3s ease;
        }

        @keyframes slideUp {
            from { transform: translateY(50px); opacity: 0; }
            to { transform: translateY(0); opacity: 1; }
        }

        .modal-content h2 {
            margin-top: 0;
            font-size: 2rem;
            margin-bottom: 15px;
        }

        #level-grid {
            display: grid;
            grid-template-columns: repeat(4, 1fr);
            gap: 12px;
            margin: 25px 0;
            max-height: 60vh;
            overflow-y: auto;
            padding: 10px;
        }

        #level-grid::-webkit-scrollbar {
            width: 8px;
        }

        #level-grid::-webkit-scrollbar-track {
            background: rgba(255,255,255,0.1);
            border-radius: 4px;
        }

        #level-grid::-webkit-scrollbar-thumb {
            background: var(--accent);
            border-radius: 4px;
        }

        .lvl-btn {
            width: 55px;
            height: 55px;
            display: flex;
            align-items: center;
            justify-content: center;
            background: rgba(42, 42, 53, 0.8);
            border-radius: 10px;
            cursor: pointer;
            font-weight: 600;
            font-size: 1.1rem;
            transition: all 0.3s ease;
            border: 2px solid transparent;
        }

        .lvl-btn:hover {
            background: var(--button-hover);
            transform: scale(1.1);
            border-color: var(--accent);
        }

        .lvl-btn.active { 
            border: 2px solid var(--accent);
            background: rgba(0, 229, 255, 0.2);
            box-shadow: 0 0 20px var(--accent-glow);
        }

        .bounce { 
            animation: bounce 0.6s ease-in-out infinite alternate; 
        }

        @keyframes bounce { 
            from { transform: translateY(0); } 
            to { transform: translateY(-15px); } 
        }

        .pulse {
            animation: pulse 2s ease-in-out infinite;
        }

        @keyframes pulse {
            0%, 100% { opacity: 1; }
            50% { opacity: 0.6; }
        }

        /* Progress indicator */
        .progress-bar {
            width: 100%;
            height: 6px;
            background: rgba(255,255,255,0.1);
            border-radius: 3px;
            overflow: hidden;
            margin-top: 10px;
        }

        .progress-fill {
            height: 100%;
            background: linear-gradient(90deg, var(--accent), var(--success));
            border-radius: 3px;
            transition: width 0.3s ease;
            box-shadow: 0 0 10px var(--accent-glow);
        }

        /* Responsive */
        @media (max-width: 600px) {
            h1 { font-size: 1.6rem; }
            .stats { padding: 12px 15px; }
            .stat-value { font-size: 1rem; }
            button { padding: 10px 20px; font-size: 0.9rem; }
        }