:root {
            --bg: #0d0d0d;
            --fg: #f5f5f5;
            --muted: #666;
            --accent: #ff6b35;
            --card: #1a1a1a;
            --border: #2a2a2a;
            --grid-bg: #161616;
            --cell-bg: #222;
        }

        * {
            margin: 0;
            padding: 0;
            box-sizing: border-box;
        }

        body {
            font-family: 'Space Grotesk', sans-serif;
            background: var(--bg);
            color: var(--fg);
            min-height: 100vh;
            display: flex;
            flex-direction: column;
            align-items: center;
            justify-content: center;
            overflow: hidden;
            position: relative;
        }

        /* Animated background */
        .bg-grid {
            position: fixed;
            inset: 0;
            background-image: 
                linear-gradient(rgba(255,107,53,0.03) 1px, transparent 1px),
                linear-gradient(90deg, rgba(255,107,53,0.03) 1px, transparent 1px);
            background-size: 50px 50px;
            pointer-events: none;
        }

        .bg-glow {
            position: fixed;
            width: 600px;
            height: 600px;
            border-radius: 50%;
            background: radial-gradient(circle, rgba(255,107,53,0.08) 0%, transparent 70%);
            top: 50%;
            left: 50%;
            transform: translate(-50%, -50%);
            pointer-events: none;
            animation: pulse 8s ease-in-out infinite;
        }

        @keyframes pulse {
            0%, 100% { opacity: 0.5; transform: translate(-50%, -50%) scale(1); }
            50% { opacity: 1; transform: translate(-50%, -50%) scale(1.1); }
        }

        .container {
            position: relative;
            z-index: 1;
            padding: 20px;
            width: 100%;
            max-width: 500px;
        }

        /* Header */
        .header {
            display: flex;
            justify-content: space-between;
            align-items: center;
            margin-bottom: 24px;
            gap: 16px;
        }

        .title {
            font-size: 48px;
            font-weight: 700;
            letter-spacing: -2px;
            background: linear-gradient(135deg, var(--fg) 0%, var(--accent) 100%);
            -webkit-background-clip: text;
            -webkit-text-fill-color: transparent;
            background-clip: text;
        }

        .scores {
            display: flex;
            gap: 12px;
        }

        .score-box {
            background: var(--card);
            border: 1px solid var(--border);
            border-radius: 12px;
            padding: 12px 20px;
            text-align: center;
            min-width: 90px;
        }

        .score-label {
            font-size: 11px;
            text-transform: uppercase;
            letter-spacing: 1px;
            color: var(--muted);
            margin-bottom: 4px;
        }

        .score-value {
            font-size: 24px;
            font-weight: 700;
            color: var(--fg);
        }

        /* Game board */
        .game-container {
            background: var(--grid-bg);
            border-radius: 16px;
            padding: 12px;
            border: 1px solid var(--border);
            box-shadow: 
                0 4px 24px rgba(0,0,0,0.4),
                inset 0 1px 0 rgba(255,255,255,0.05);
        }

        .grid {
            display: grid;
            grid-template-columns: repeat(4, 1fr);
            gap: 10px;
            aspect-ratio: 1;
        }

        .cell {
            background: var(--cell-bg);
            border-radius: 8px;
            aspect-ratio: 1;
        }

        .tiles-container {
            position: absolute;
            top: 12px;
            left: 12px;
            right: 12px;
            bottom: 12px;
            pointer-events: none;
        }

        .game-wrapper {
            position: relative;
        }

        .tile {
            position: absolute;
            display: flex;
            align-items: center;
            justify-content: center;
            font-weight: 700;
            border-radius: 8px;
            transition: top 0.12s ease-out, left 0.12s ease-out;
            will-change: top, left;
        }

        .tile-new {
            animation: appear 0.2s ease-out;
        }

        .tile-merged {
            animation: pop 0.2s ease-out;
        }

        @keyframes appear {
            0% { transform: scale(0); opacity: 0; }
            100% { transform: scale(1); opacity: 1; }
        }

        @keyframes pop {
            0% { transform: scale(1); }
            50% { transform: scale(1.15); }
            100% { transform: scale(1); }
        }

        /* Tile colors */
        .tile-2 { background: #2d3436; color: var(--fg); }
        .tile-4 { background: #3d4446; color: var(--fg); }
        .tile-8 { background: #e17055; color: #fff; }
        .tile-16 { background: #d63031; color: #fff; }
        .tile-32 { background: #ff7675; color: #fff; }
        .tile-64 { background: #ff4757; color: #fff; }
        .tile-128 { background: #fdcb6e; color: #1a1a1a; }
        .tile-256 { background: #f9ca24; color: #1a1a1a; }
        .tile-512 { background: #f39c12; color: #fff; }
        .tile-1024 { background: #e67e22; color: #fff; }
        .tile-2048 { background: linear-gradient(135deg, #ff6b35, #f9ca24); color: #fff; box-shadow: 0 0 30px rgba(255,107,53,0.5); }
        .tile-super { background: linear-gradient(135deg, #ff6b35, #e17055); color: #fff; }

        /* Controls */
        .controls {
            margin-top: 24px;
            display: flex;
            gap: 12px;
            justify-content: center;
        }

        .btn {
            background: var(--card);
            border: 1px solid var(--border);
            color: var(--fg);
            padding: 14px 28px;
            border-radius: 10px;
            font-family: inherit;
            font-size: 14px;
            font-weight: 600;
            cursor: pointer;
            transition: all 0.2s ease;
            text-transform: uppercase;
            letter-spacing: 1px;
        }

        .btn:hover {
            background: var(--border);
            transform: translateY(-2px);
        }

        .btn:active {
            transform: translateY(0);
        }

        .btn-primary {
            background: var(--accent);
            border-color: var(--accent);
            color: #fff;
        }

        .btn-primary:hover {
            background: #ff8555;
            border-color: #ff8555;
        }

        /* Instructions */
        .instructions {
            margin-top: 24px;
            text-align: center;
            color: var(--muted);
            font-size: 13px;
        }

        .instructions kbd {
            background: var(--card);
            border: 1px solid var(--border);
            border-radius: 4px;
            padding: 2px 8px;
            font-family: inherit;
            font-size: 12px;
        }

        /* Game over overlay */
        .game-over {
            position: absolute;
            inset: 0;
            background: rgba(13,13,13,0.9);
            border-radius: 16px;
            display: flex;
            flex-direction: column;
            align-items: center;
            justify-content: center;
            opacity: 0;
            pointer-events: none;
            transition: opacity 0.3s ease;
        }

        .game-over.active {
            opacity: 1;
            pointer-events: auto;
        }

        .game-over h2 {
            font-size: 36px;
            font-weight: 700;
            margin-bottom: 8px;
        }

        .game-over.win h2 {
            color: var(--accent);
        }

        .game-over p {
            color: var(--muted);
            margin-bottom: 24px;
        }

        /* Responsive */
        @media (max-width: 480px) {
            .container {
                padding: 16px;
            }
            
            .title {
                font-size: 36px;
            }
            
            .score-box {
                padding: 8px 14px;
                min-width: 70px;
            }
            
            .score-value {
                font-size: 20px;
            }
            
            .grid {
                gap: 8px;
            }
            
            .instructions {
                display: none;
            }
        }

        /* Reduced motion */
        @media (prefers-reduced-motion: reduce) {
            .tile, .bg-glow {
                animation: none;
                transition: none;
            }
        }