 * {
            margin: 0;
            padding: 0;
            box-sizing: border-box;
            user-select: none;
            -webkit-tap-highlight-color: transparent;
        }

        :root {
            --bg-primary: #63264a;
            --bg-secondary: blue;
            --text-primary: white;
            --text-secondary: black;
            --card-bg: #edede9;
            --border-color: red;
            --grid-bg: #166088;
            --grid-line: red;
            --block-1: linear-gradient(135deg, #ff6b6b, #ee5a24);
            --block-2: linear-gradient(135deg, #4ecdc4, #44bd32);
            --block-3: linear-gradient(135deg, #feca57, #ff9f43);
            --block-4: linear-gradient(135deg, #a29bfe, #6c5ce7);
            --block-5: linear-gradient(135deg, #fd79a8, #e84393);
            --block-6: linear-gradient(135deg, #00cec9, #00b894);
            --block-7: linear-gradient(135deg, #e17055, #d63031);
            --shadow: 0 5px 15px rgba(0,0,0,0.1);
            --drag-over: rgba(102, 126, 234, 0.3);
            --success: #28a745;
            --warning: #ffc107;
            --info: #17a2b8;
        }

        body.dark {
            --bg-primary: #edede9;
            --bg-secondary: #1a1a1a;
            --text-primary: #ffffff;
            --text-secondary: #cccccc;
            --card-bg: #2d2d2d;
            --border-color: #404040;
            --grid-bg: #252525;
            --grid-line: #3a3a3a;
            --drag-over: rgba(102, 126, 234, 0.5);
        }

        body {
            font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
            background: var(--bg-primary);
            min-height: 120vh;
            display: flex;
            justify-content: center;
            align-items: center;
            padding: 10px;
            color: var(--text-primary);
        }

        .game-wrapper {
            max-width: 1300px;
            width: 100%;
            background: var(--card-bg);
            border-radius: 30px;
            padding: 20px;
            box-shadow: 0 20px 60px rgba(0,0,0,0.3);
            animation: slideIn 0.5s ease-out;
        }

        @keyframes slideIn {
            from {
                opacity: 0;
                transform: translateY(-30px);
            }
            to {
                opacity: 1;
                transform: translateY(0);
            }
        }

        /* Header */
        .game-header {
            display: flex;
            justify-content: space-between;
            align-items: center;
            margin-bottom: 20px;
            flex-wrap: wrap;
            gap: 15px;
        }

        .logo {
            display: flex;
            align-items: center;
            gap: 10px;
            font-size: 1.5rem;
            font-weight: bold;
            background: black;
            -webkit-background-clip: text;
            background-clip: text;
            color: black;
        }

        .controls {
            display: flex;
            gap: 10px;
            flex-wrap: wrap;
        }

        .icon-btn, .sound-toggle {
            background: #5c16f3;
            border: none;
            font-size: 1.3rem;
            cursor: pointer;
            padding: 10px;
            border-radius: 12px;
            transition: all 0.3s;
            color: red;
            min-width: 44px;
            min-height: 44px;
        }

        .icon-btn:hover, .sound-toggle:hover {
            transform: translateY(-2px);
            background: var(--border-color);
        }

        .sound-toggle.muted {
            opacity: 0.5;
        }

        /* Stats Panel */
        .stats-panel {
            display: grid;
            grid-template-columns: repeat(5, 1fr);
            gap: 15px;
            margin-bottom: 20px;
        }

        .stat-card {
            background: #83c5be;
            padding: 15px;
            border-radius: 15px;
            text-align: center;
            transition: all 0.3s;
        }

        .stat-card:hover {
            transform: translateY(-2px);
            box-shadow: var(--shadow);
        }

        .stat-label {
            font-size: 0.75rem;
            color: black;
            text-transform: uppercase;
            font-weight: 600;
        }

        .stat-value {
            font-size: 1.6rem;
            font-weight: bold;
            color: blue;
            margin-top: 5px;
        }

        /* Game Area */
        .game-area {
            display: grid;
            grid-template-columns: 1fr auto;
            gap: 20px;
            margin-bottom: 20px;
        }

        /* Main Grid */
        .grid-container {
            background: var(--grid-bg);
            border-radius: 20px;
            padding: 15px;
            box-shadow: var(--shadow);
            overflow-x: auto;
            -webkit-overflow-scrolling: touch;
        }

        .grid {
            display: grid;
            grid-template-columns: repeat(8, 1fr);
            gap: 4px;
            background: var(--grid-bg);
            min-width: 80px;
        }

        .cell {
            aspect-ratio: 1;
            background: var(--card-bg);
            border-radius: 8px;
            transition: all 0.2s;
            box-shadow: inset 0 0 0 1px var(--grid-line);
            position: relative;
            touch-action: none;
        }

        .cell.drag-over {
            background: var(--drag-over);
            transform: scale(0.95);
            box-shadow: 0 0 0 2px #667eea;
        }

        .cell.filled {
            animation: pop 0.2s ease-out;
        }

        @keyframes pop {
            0% { transform: scale(0.8); opacity: 0; }
            100% { transform: scale(1); opacity: 1; }
        }

        .cell.filled[data-color="0"] { background: var(--block-1); box-shadow: 0 2px 5px rgba(0,0,0,0.2); }
        .cell.filled[data-color="1"] { background: var(--block-2); box-shadow: 0 2px 5px rgba(0,0,0,0.2); }
        .cell.filled[data-color="2"] { background: var(--block-3); box-shadow: 0 2px 5px rgba(0,0,0,0.2); }
        .cell.filled[data-color="3"] { background: var(--block-4); box-shadow: 0 2px 5px rgba(0,0,0,0.2); }
        .cell.filled[data-color="4"] { background: var(--block-5); box-shadow: 0 2px 5px rgba(0,0,0,0.2); }
        .cell.filled[data-color="5"] { background: var(--block-6); box-shadow: 0 2px 5px rgba(0,0,0,0.2); }
        .cell.filled[data-color="6"] { background: var(--block-7); box-shadow: 0 2px 5px rgba(0,0,0,0.2); }

        /* Block Palette */
        .palette {
            background:var(--grid-bg);
            border-radius: 20px;
            padding: 15px;
            min-width: 250px;
        }

        .palette h3 {
            text-align: center;
            margin-bottom: 15px;
            font-size: 1rem;
        }

        .block-list {
            display: flex;
            flex-direction: column;
            gap: 15px;
        }

        .block-option {
            background: var(--card-bg);
            border-radius: 12px;
            padding: 10px;
            cursor: pointer;
            transition: all 0.3s;
            border: 2px solid transparent;
            user-select: none;
            position: relative;
            touch-action: none;
        }

        .block-option:active {
            transform: scale(0.98);
        }

        .block-option:hover {
            transform: translateY(-5px) scale(1.02);
            box-shadow: var(--shadow);
        }

        .block-preview {
            display: grid;
            gap: 3px;
            justify-content: center;
            margin-bottom: 5px;
            pointer-events: none;
        }

        .block-row {
            display: flex;
            gap: 3px;
            justify-content: center;
        }

        .block-cell {
            width: 40px;
            height: 40px;
            background: #667eea;
            border-radius: 8px;
            transition: all 0.2s;
        }

        @media (max-width: 768px) {
            .block-cell {
                width: 35px;
                height: 35px;
            }
        }

        @media (max-width: 480px) {
            .block-cell {
                width: 30px;
                height: 30px;
            }
        }

        .block-cell[data-color="0"] { background: var(--block-1); }
        .block-cell[data-color="1"] { background: var(--block-2); }
        .block-cell[data-color="2"] { background: var(--block-3); }
        .block-cell[data-color="3"] { background: var(--block-4); }
        .block-cell[data-color="4"] { background: var(--block-5); }
        .block-cell[data-color="5"] { background: var(--block-6); }
        .block-cell[data-color="6"] { background: var(--block-7); }

        .block-name {
            text-align: center;
            font-size: 0.75rem;
            color: var(--text-secondary);
            margin-top: 5px;
        }

        /* Floating Block for Mobile */
        .floating-block {
            position: fixed;
            opacity: 0.8;
            pointer-events: none;
            z-index: 10000;
            transform: translate(-50%, -50%) scale(1.1);
            transition: transform 0.05s ease;
            filter: drop-shadow(0 5px 15px rgba(0,0,0,0.3));
        }

        /* Message */
        .message {
            position: fixed;
            top: 50%;
            left: 50%;
            transform: translate(-50%, -50%);
            background: rgba(0,0,0,0.9);
            color: white;
            padding: 20px 40px;
            border-radius: 20px;
            font-size: 1.5rem;
            font-weight: bold;
            z-index: 1000;
            display: none;
            animation: fadeInOut 2s ease-out;
            text-align: center;
            white-space: nowrap;
        }

        @keyframes fadeInOut {
            0% { opacity: 0; transform: translate(-50%, -50%) scale(0.8); }
            20% { opacity: 1; transform: translate(-50%, -50%) scale(1); }
            80% { opacity: 1; transform: translate(-50%, -50%) scale(1); }
            100% { opacity: 0; transform: translate(-50%, -50%) scale(0.8); }
        }

        /* How to Play Section */
        .how-to-play {
            background: #62b6cb;
            border-radius: 20px;
            padding: 20px;
            margin-bottom: 20px;
            border: 1px solid rgba(102, 126, 234, 0.3);
        }

        .how-to-play h3 {
            text-align: center;
            margin-bottom: 15px;
            font-size: 1.2rem;
            display: flex;
            align-items: center;
            justify-content: center;
            gap: 10px;
        }

        .steps-container {
            display: grid;
            grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
            gap: 15px;
        }

        .step {
            text-align: center;
            padding: 10px;
        }

        .step-icon {
            font-size: 2rem;
            margin-bottom: 8px;
            display: inline-block;
            animation: float 3s ease-in-out infinite;
        }

        @keyframes float {
            0%, 100% { transform: translateY(0); }
            50% { transform: translateY(-5px); }
        }

        .step h4 {
            font-size: 1rem;
            margin-bottom: 5px;
            color:black;
        }

        .step p {
            font-size: 0.8rem;
            color: var(--text-secondary);
        }

        .tips {
            margin-top: 15px;
            padding-top: 15px;
            border-top: 1px dashed rgba(102, 126, 234, 0.3);
            display: flex;
            justify-content: center;
            gap: 20px;
            flex-wrap: wrap;
        }

        .tip {
            display: flex;
            align-items: center;
            gap: 5px;
            font-size: 0.8rem;
        }

        /* Stylish Footer - Ultra Edition */
        .ultra-footer {
            background: #1b4965;
            border-radius: 20px;
            overflow: hidden;
            position: relative;
            animation: glowPulse 2s ease-in-out infinite;
        }

        @keyframes glowPulse {
            0%, 100% { box-shadow: 0 5px 20px rgba(102, 126, 234, 0.3); }
            50% { box-shadow: 0 5px 30px rgba(102, 126, 234, 0.6); }
        }

       

        @keyframes waveMove {
            from { background-position: 0 0; }
            to { background-position: 200px 0; }
        }

        .footer-content {
            position: relative;
            z-index: 1;
            padding: 20px;
        }

        .footer-row {
            display: flex;
            justify-content: space-between;
            align-items: center;
            flex-wrap: wrap;
            gap: 20px;
            margin-bottom: 15px;
        }

        .footer-row:last-child {
            margin-bottom: 0;
            padding-top: 15px;
            border-top: 1px solid rgba(255,255,255,0.2);
        }

        .footer-brand {
            display: flex;
            align-items: center;
            gap: 12px;
        }

        .footer-brand .brand-icon {
            font-size: 2rem;
            animation: bounce 2s ease-in-out infinite;
        }

        @keyframes bounce {
            0%, 100% { transform: translateY(0); }
            50% { transform: translateY(-5px); }
        }

        .footer-brand h4 {
            color: white;
            font-size: 1.2rem;
            font-weight: bold;
        }

        .footer-brand p {
            color: rgba(255,255,255,0.8);
            font-size: 0.7rem;
        }

        .footer-stats-grid {
            display: flex;
            gap: 25px;
        }

        .footer-stat-item {
            text-align: center;
        }

        .footer-stat-number {
            color: white;
            font-size: 1.4rem;
            font-weight: bold;
            display: block;
        }

        .footer-stat-label {
            color: rgba(255,255,255,0.8);
            font-size: 0.7rem;
            text-transform: uppercase;
        }

        .footer-buttons {
            display: flex;
            gap: 12px;
            flex-wrap: wrap;
        }

        .footer-btn {
            background: rgba(255,255,255,0.2);
            border: none;
            padding: 8px 16px;
            border-radius: 25px;
            color: white;
            cursor: pointer;
            transition: all 0.3s;
            font-size: 0.85rem;
            display: flex;
            align-items: center;
            gap: 5px;
        }

        .footer-btn:hover {
            background: rgba(255,255,255,0.3);
            transform: translateY(-2px);
        }

        .footer-social-links {
            display: flex;
            gap: 12px;
        }

        .social-circle {
            width: 36px;
            height: 36px;
            background: rgba(255,255,255,0.2);
            border-radius: 50%;
            display: flex;
            align-items: center;
            justify-content: center;
            color: white;
            text-decoration: none;
            transition: all 0.3s;
            font-size: 1.1rem;
        }

        .social-circle:hover {
            background: rgba(255,255,255,0.4);
            transform: translateY(-3px) rotate(360deg);
        }

        .footer-copyright {
            text-align: center;
            font-size: 0.7rem;
            color: rgba(255,255,255,0.7);
        }

        @media (max-width: 768px) {
            .game-area {
                grid-template-columns: 1fr;
            }
            
            .grid {
                gap: 3px;
            }
            
            .stats-panel {
                grid-template-columns: repeat(3, 1fr);
                gap: 10px;
            }
            
            .stats-panel .stat-card:last-child,
            .stats-panel .stat-card:nth-last-child(2) {
                display: none;
            }
            
            .message {
                font-size: 1rem;
                white-space: normal;
                padding: 15px 30px;
                max-width: 90%;
            }

            .steps-container {
                grid-template-columns: 1fr;
            }

            .footer-row {
                flex-direction: column;
                text-align: center;
            }

            .footer-stats-grid {
                justify-content: center;
            }

            .footer-buttons {
                justify-content: center;
            }

            .footer-social-links {
                justify-content: center;
            }
        }

        @media (max-width: 480px) {
            .game-header {
                flex-direction: column;
            }

            .controls {
                justify-content: center;
            }

            .stat-card {
                padding: 10px;
            }

            .stat-value {
                font-size: 1.2rem;
            }
        }