        @import url('https://fonts.googleapis.com/css2?family=Nunito:wght@400;600;700;800&display=swap');
        
        * {
            box-sizing: border-box;
        }
        
        body {
            font-family: 'Nunito', sans-serif;
            margin: 0;
            padding: 20px;
            background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
            min-height: 100vh;
            position: relative;
            overflow-x: auto;
        }
        
        /* 添加装饰性背景元素 */
        body::before {
            content: '';
            position: absolute;
            top: 0;
            left: 0;
            width: 100%;
            height: 100%;
            background-image: 
                radial-gradient(circle at 20% 80%, rgba(255,255,255,0.1) 0%, transparent 50%),
                radial-gradient(circle at 80% 20%, rgba(255,255,255,0.1) 0%, transparent 50%);
            pointer-events: none;
            z-index: 0;
        }
        
        .game-layout {
            max-width: 1400px;
            width: 100%;
            margin: 0 auto;
            background: rgba(255, 255, 255, 0.95);
            backdrop-filter: blur(10px);
            border-radius: 20px;
            padding: 0;
            box-shadow: 
                0 20px 40px rgba(0,0,0,0.1),
                0 0 0 1px rgba(255,255,255,0.2);
            position: relative;
            z-index: 1;
            min-height: 90vh;
            display: flex;
            flex-direction: column;
        }
        
        /* Top Header */
        .top-header {
            display: flex;
            justify-content: space-between;
            align-items: center;
            padding: 20px 30px;
            background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
            color: white;
            border-radius: 20px 20px 0 0;
        }
        
        .game-title h1 {
            font-size: 2.5rem;
            font-weight: 800;
            margin: 0;
            text-shadow: 0 2px 4px rgba(0,0,0,0.2);
        }
        
        .game-subtitle {
            font-size: 1rem;
            opacity: 0.9;
            font-weight: 500;
        }
        
        .back-link a {
            color: rgba(255, 255, 255, 0.9);
            text-decoration: none;
            font-weight: 600;
            transition: opacity 0.3s ease;
        }
        
        .back-link a:hover {
            opacity: 1;
        }
        
        /* Controls Bar */
        .controls-bar {
            display: flex;
            justify-content: space-between;
            align-items: center;
            padding: 15px 30px;
            background: rgba(255, 255, 255, 0.8);
            border-bottom: 1px solid rgba(0, 0, 0, 0.1);
        }
        
        .mode-controls {
            display: flex;
            gap: 10px;
        }
        
        .game-actions {
            display: flex;
            gap: 10px;
        }
        
        /* Main Game Area */
        .main-game-area {
            display: flex;
            flex: 1;
            min-height: 0;
        }
        
        /* Left Sidebar */
        .left-sidebar {
            width: 320px;
            background: rgba(248, 249, 250, 0.95);
            padding: 20px;
            border-right: 1px solid rgba(0, 0, 0, 0.1);
            display: flex;
            flex-direction: column;
            gap: 15px;
            box-shadow: 2px 0 10px rgba(0, 0, 0, 0.05);
        }
        
        /* Game Stats */
        .game-stats {
            background: linear-gradient(135deg, #ffffff 0%, #f8f9ff 50%, #fff5f5 100%);
            border-radius: 15px;
            padding: 20px;
            box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
            border: 1px solid rgba(255, 255, 255, 0.8);
            position: relative;
            overflow: hidden;
        }
        
        .game-stats::before {
            content: '';
            position: absolute;
            top: 0;
            left: -100%;
            width: 100%;
            height: 100%;
            background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.4), transparent);
            animation: shimmer 3s infinite;
            pointer-events: none;
        }
        
        @keyframes shimmer {
            0% { left: -100%; }
            100% { left: 100%; }
        }
        
        .stat-item {
            display: flex;
            justify-content: space-between;
            align-items: center;
            padding: 12px 0;
            border-bottom: 1px solid rgba(240, 240, 240, 0.6);
            transition: all 0.3s ease;
        }
        
        .stat-item:last-child {
            border-bottom: none;
        }
        
        .stat-item:hover {
            background: rgba(102, 126, 234, 0.05);
            border-radius: 8px;
            margin: 0 -8px;
            padding: 12px 8px;
        }
        
        .stat-label {
            font-weight: 600;
            color: #555;
            font-size: 0.95rem;
            display: flex;
            align-items: center;
            gap: 8px;
        }
        
        .stat-label::before {
            content: '●';
            color: #667eea;
            font-size: 0.8rem;
        }
        
        .stat-value {
            font-weight: 700;
            font-size: 1.3rem;
            color: #333;
            text-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
            transition: all 0.3s ease;
            position: relative;
            z-index: 1;
        }
        
        .stat-value.pulse {
            animation: scorePulse 0.6s ease-out;
        }
        
        @keyframes scorePulse {
            0% { transform: scale(1); }
            50% { transform: scale(1.2); color: #ffd700; }
            100% { transform: scale(1); }
        }
        
        .stat-value[id="score"] {
            color: #28a745;
            background: linear-gradient(135deg, #28a745, #20c997);
            background-clip: text;
            -webkit-background-clip: text;
            -webkit-text-fill-color: transparent;
        }
        
        .stat-value[id="timer"] {
            color: #dc3545;
            background: linear-gradient(135deg, #dc3545, #fd7e14);
            background-clip: text;
            -webkit-background-clip: text;
            -webkit-text-fill-color: transparent;
        }
        
        .stat-value[id="timer"].warning {
            animation: timerWarning 1s infinite;
        }
        
        @keyframes timerWarning {
            0%, 100% { opacity: 1; }
            50% { opacity: 0.6; }
        }
        
        .stat-value[id="pairs"] {
            color: #667eea;
            background: linear-gradient(135deg, #667eea, #764ba2);
            background-clip: text;
            -webkit-background-clip: text;
            -webkit-text-fill-color: transparent;
        }
        
        /* Combo Display */
        .combo-stat {
            margin-top: 10px;
            padding: 12px;
            background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
            border-radius: 10px;
            text-align: center;
            border: 2px solid rgba(255, 255, 255, 0.3);
            box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
        }
        
        .combo-value {
            font-size: 1.4rem;
            font-weight: bold;
            color: white;
            text-shadow: 0 2px 4px rgba(0,0,0,0.3);
            animation: comboPulse 0.5s ease-in-out infinite alternate;
            display: block;
        }
        
        @keyframes comboPulse {
            from {
                transform: scale(1);
            }
            to {
                transform: scale(1.1);
            }
        }
        
        /* Level Selection Panel */
        .level-selection-panel {
            background: white;
            border-radius: 12px;
            padding: 15px;
            box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
            flex: 1;
            display: flex;
            flex-direction: column;
        }
        
        .panel-header h3 {
            margin: 0 0 5px 0;
            font-size: 1.1rem;
            color: #333;
        }
        
        .panel-header p {
            margin: 0;
            font-size: 0.9rem;
            color: #666;
        }
        
        .level-grid-container {
            flex: 1;
            margin: 15px 0;
            max-height: 400px;
            overflow-y: auto;
        }
        
        .level-grid {
            display: grid;
            grid-template-columns: repeat(auto-fit, minmax(80px, 1fr));
            gap: 8px;
        }
        
        /* Free Play Panel */
        .freeplay-panel {
            background: white;
            border-radius: 12px;
            padding: 15px;
            box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
        }
        
        .setting-group {
            margin: 15px 0;
        }
        
        .setting-group label {
            display: block;
            margin-bottom: 5px;
            font-weight: 600;
            color: #333;
        }
        
        .select-input {
            width: 100%;
            padding: 8px 12px;
            border: 1px solid #ddd;
            border-radius: 6px;
            font-size: 0.9rem;
        }
        
        /* Game Canvas Area */
        .game-canvas-area {
            flex: 1;
            display: flex;
            justify-content: center;
            align-items: center;
            padding: 20px;
            min-height: 500px;
        }
        
        .game-info {
            display: grid;
            grid-template-columns: repeat(3, 1fr);
            gap: 20px;
            margin-bottom: 25px;
            padding: 20px;
            background: linear-gradient(135deg, #f8f9ff 0%, #e9ecff 100%);
            border-radius: 15px;
            box-shadow: inset 0 2px 4px rgba(0,0,0,0.1);
        }
        
        .info-item {
            text-align: center;
            padding: 15px;
            background: white;
            border-radius: 12px;
            box-shadow: 0 4px 8px rgba(0,0,0,0.1);
            transition: transform 0.2s ease, box-shadow 0.2s ease;
        }
        
        .info-item:hover {
            transform: translateY(-2px);
            box-shadow: 0 6px 12px rgba(0,0,0,0.15);
        }
        
        .info-label {
            font-size: 0.9rem;
            color: #666;
            display: block;
            margin-bottom: 8px;
            font-weight: 600;
            text-transform: uppercase;
            letter-spacing: 0.5px;
        }
        
        .info-value {
            font-size: 2rem;
            font-weight: 800;
            color: #333;
            line-height: 1;
        }
        
        .info-value.score {
            color: #28a745;
        }
        
        .info-value.time {
            color: #fd7e14;
        }
        
        .info-value.pairs {
            color: #6f42c1;
        }
        
        .game-canvas {
            border: 3px solid #e9ecef;
            border-radius: 15px;
            display: block;
            margin: 0 auto;
            background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
            cursor: pointer;
            box-shadow: 
                0 8px 16px rgba(0,0,0,0.1),
                inset 0 1px 0 rgba(255,255,255,0.5);
            transition: transform 0.2s ease, box-shadow 0.2s ease;
            max-width: 100%;
            width: 600px;
            height: 400px;
        }
        
        .game-canvas:hover {
            transform: translateY(-2px);
            box-shadow: 
                0 12px 20px rgba(0,0,0,0.15),
                inset 0 1px 0 rgba(255,255,255,0.5);
        }
        
        .controls {
            display: flex;
            justify-content: center;
            gap: 15px;
            margin-top: 25px;
            flex-wrap: wrap;
        }
        
        .btn {
            background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
            color: white;
            border: none;
            padding: 12px 24px;
            border-radius: 25px;
            cursor: pointer;
            font-size: 16px;
            font-weight: 600;
            font-family: 'Nunito', sans-serif;
            transition: all 0.3s ease;
            box-shadow: 0 4px 8px rgba(102, 126, 234, 0.3);
            position: relative;
            overflow: hidden;
        }
        
        .btn::before {
            content: '';
            position: absolute;
            top: 0;
            left: -100%;
            width: 100%;
            height: 100%;
            background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent);
            transition: left 0.5s;
        }
        
        .btn:hover {
            transform: translateY(-2px);
            box-shadow: 0 6px 12px rgba(102, 126, 234, 0.4);
        }
        
        .btn:hover::before {
            left: 100%;
        }
        
        .btn:active {
            transform: translateY(0);
        }
        
        .btn:disabled {
            background: #ccc;
            cursor: not-allowed;
            transform: none;
            box-shadow: 0 2px 4px rgba(0,0,0,0.1);
        }
        
        .btn.restart {
            background: linear-gradient(135deg, #28a745 0%, #20c997 100%);
            box-shadow: 0 4px 8px rgba(40, 167, 69, 0.3);
        }
        
        .btn.pause {
            background: linear-gradient(135deg, #ffc107 0%, #fd7e14 100%);
            box-shadow: 0 4px 8px rgba(255, 193, 7, 0.3);
        }
        
        .btn.hint {
            background: linear-gradient(135deg, #6f42c1 0%, #e83e8c 100%);
            box-shadow: 0 4px 8px rgba(111, 66, 193, 0.3);
        }
        
        .back-link {
            margin-bottom: 20px;
        }
        
        .back-link a {
            color: #667eea;
            text-decoration: none;
            font-weight: 600;
            padding: 8px 16px;
            border-radius: 20px;
            background: rgba(102, 126, 234, 0.1);
            transition: all 0.3s ease;
            display: inline-flex;
            align-items: center;
            gap: 8px;
        }
        
        .back-link a:hover {
            background: rgba(102, 126, 234, 0.2);
            transform: translateX(-5px);
        }
        
        /* 游戏说明样式 */
        .game-instructions {
            margin-top: 20px;
        }
        
        .instructions-btn {
            background: linear-gradient(135deg, #17a2b8 0%, #138496 100%);
            color: white;
            border: none;
            padding: 12px 24px;
            border-radius: 25px;
            cursor: pointer;
            font-size: 16px;
            font-weight: 600;
            font-family: 'Nunito', sans-serif;
            transition: all 0.3s ease;
            box-shadow: 0 4px 8px rgba(23, 162, 184, 0.3);
            margin-bottom: 15px;
        }
        
        .instructions-btn:hover {
            background: linear-gradient(135deg, #138496 0%, #117a8b 100%);
            transform: translateY(-2px);
            box-shadow: 0 6px 12px rgba(23, 162, 184, 0.4);
        }
        
        .instructions-panel {
            max-height: 0;
            overflow: hidden;
            background: linear-gradient(135deg, #f8f9ff 0%, #e9ecff 100%);
            border-radius: 15px;
            transition: max-height 0.5s ease, padding 0.3s ease;
            box-shadow: inset 0 2px 4px rgba(0,0,0,0.1);
        }
        
        .instructions-panel.active {
            max-height: 600px;
            padding: 25px;
            margin-bottom: 20px;
            border: 2px solid rgba(102, 126, 234, 0.2);
        }
        
        .instructions-content h3 {
            color: #667eea;
            margin: 0 0 15px 0;
            font-size: 1.3rem;
            font-weight: 700;
            display: flex;
            align-items: center;
            gap: 8px;
        }
        
        .instructions-content p {
            color: #555;
            margin-bottom: 20px;
            line-height: 1.6;
            font-size: 1.05rem;
        }
        
        .instructions-content ul {
            list-style: none;
            padding: 0;
            margin: 0 0 25px 0;
        }
        
        .instructions-content li {
            background: rgba(255, 255, 255, 0.7);
            margin: 8px 0;
            padding: 12px 16px;
            border-radius: 10px;
            border-left: 4px solid #667eea;
            box-shadow: 0 2px 4px rgba(0,0,0,0.05);
            transition: transform 0.2s ease;
            line-height: 1.5;
        }
        
        .instructions-content li:hover {
            transform: translateX(5px);
            background: rgba(255, 255, 255, 0.9);
        }
        
        .instructions-content strong {
            color: #667eea;
            font-weight: 700;
        }
        
        /* 游戏控制区域 */
        .game-controls {
            margin-top: 25px;
        }
        
        .difficulty-selection {
            display: flex;
            justify-content: center;
            align-items: center;
            gap: 15px;
            margin-bottom: 20px;
            padding: 15px;
            background: linear-gradient(135deg, #f8f9ff 0%, #e9ecff 100%);
            border-radius: 15px;
            box-shadow: inset 0 2px 4px rgba(0,0,0,0.1);
        }
        
        .difficulty-label {
            font-weight: 700;
            color: #667eea;
            font-size: 1.1rem;
        }
        
        .difficulty-select {
            background: linear-gradient(135deg, #ffffff 0%, #f8f9ff 100%);
            border: 2px solid #667eea;
            border-radius: 12px;
            padding: 10px 16px;
            font-size: 16px;
            font-weight: 600;
            font-family: 'Nunito', sans-serif;
            color: #667eea;
            cursor: pointer;
            transition: all 0.3s ease;
            min-width: 180px;
            box-shadow: 0 2px 4px rgba(102, 126, 234, 0.1);
        }
        
        .difficulty-select:hover {
            background: linear-gradient(135deg, #f8f9ff 0%, #e9ecff 100%);
            transform: translateY(-1px);
            box-shadow: 0 4px 8px rgba(102, 126, 234, 0.2);
        }
        
        .difficulty-select:focus {
            outline: none;
            border-color: #764ba2;
            box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.2);
        }
        
        /* 关卡选择系统 */
        .level-selection {
            background: linear-gradient(135deg, #f8f9ff 0%, #e9ecff 100%);
            border-radius: 20px;
            padding: 30px;
            margin-bottom: 25px;
            box-shadow: 0 8px 16px rgba(0,0,0,0.1);
            border: 2px solid rgba(102, 126, 234, 0.2);
        }
        
        .level-header {
            text-align: center;
            margin-bottom: 30px;
        }
        
        .level-header h2 {
            color: #667eea;
            margin: 0 0 10px 0;
            font-size: 2rem;
            font-weight: 800;
        }
        
        .level-header p {
            color: #666;
            margin: 0;
            font-size: 1.1rem;
        }
        
        .level-grid {
            display: grid;
            grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
            gap: 20px;
            margin-bottom: 30px;
            max-width: 800px;
            margin-left: auto;
            margin-right: auto;
        }
        
        .level-card {
            background: white;
            border: 3px solid #e9ecef;
            border-radius: 15px;
            padding: 20px;
            text-align: center;
            cursor: pointer;
            transition: all 0.3s ease;
            position: relative;
            min-height: 140px;
            display: flex;
            flex-direction: column;
            justify-content: center;
        }
        
        .level-card:hover {
            transform: translateY(-5px);
            border-color: #667eea;
            box-shadow: 0 8px 16px rgba(102, 126, 234, 0.2);
        }
        
        .level-card.completed {
            border-color: #28a745;
            background: linear-gradient(135deg, #f8fff9 0%, #e8f5e8 100%);
        }
        
        .level-card.locked {
            background: #f8f9fa;
            border-color: #dee2e6;
            cursor: not-allowed;
            opacity: 0.6;
        }
        
        .level-card.selected {
            border-color: #667eea;
            background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
            color: white;
            transform: translateY(-3px);
            box-shadow: 0 8px 16px rgba(102, 126, 234, 0.4);
        }
        
        .level-number {
            font-size: 1.8rem;
            font-weight: 800;
            margin-bottom: 8px;
        }
        
        .level-title {
            font-size: 0.9rem;
            font-weight: 600;
            margin-bottom: 8px;
            line-height: 1.2;
        }
        
        .level-stars {
            display: flex;
            justify-content: center;
            gap: 4px;
            margin-bottom: 8px;
        }
        
        .star {
            font-size: 1.2rem;
            color: #ffc107;
        }
        
        .star.empty {
            color: #dee2e6;
        }
        
        .level-difficulty {
            font-size: 0.8rem;
            padding: 4px 8px;
            border-radius: 10px;
            background: rgba(0,0,0,0.1);
            color: #666;
            margin-top: auto;
        }
        
        .level-card.selected .level-difficulty {
            background: rgba(255,255,255,0.2);
            color: white;
        }
        
        .level-controls {
            display: flex;
            justify-content: center;
            gap: 15px;
            flex-wrap: wrap;
        }
        
        .level-start-btn {
            background: linear-gradient(135deg, #28a745 0%, #20c997 100%);
            font-size: 1.1rem;
            padding: 14px 28px;
            min-width: 150px;
        }
        
        .level-start-btn:disabled {
            background: #ccc;
            cursor: not-allowed;
        }
        
        .btn.secondary {
            background: linear-gradient(135deg, #6c757d 0%, #5a6268 100%);
            box-shadow: 0 4px 8px rgba(108, 117, 125, 0.3);
        }
        
        /* 模式选择 */
        .mode-selection {
            display: flex;
            justify-content: center;
            gap: 10px;
            margin-bottom: 20px;
            padding: 15px;
            background: linear-gradient(135deg, #f8f9ff 0%, #e9ecff 100%);
            border-radius: 15px;
            box-shadow: inset 0 2px 4px rgba(0,0,0,0.1);
        }
        
        .mode-btn {
            flex: 1;
            max-width: 200px;
            background: rgba(255, 255, 255, 0.7);
            color: #667eea;
            border: 2px solid transparent;
            transition: all 0.3s ease;
        }
        
        .mode-btn:hover {
            background: rgba(255, 255, 255, 0.9);
            border-color: #667eea;
        }
        
        .mode-btn.active {
            background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
            color: white;
            border-color: #667eea;
            box-shadow: 0 4px 8px rgba(102, 126, 234, 0.3);
        }
        
        /* 响应式设计 */
        @media (max-width: 768px) {
            body {
                padding: 10px;
            }
            
            .container {
                margin: 0;
                padding: 20px;
                border-radius: 15px;
            }
            
            .header h1 {
                font-size: 2.5rem;
            }
            
            .game-info {
                grid-template-columns: 1fr;
                gap: 15px;
                padding: 15px;
            }
            
            .info-item {
                padding: 12px;
            }
            
            .info-value {
                font-size: 1.8rem;
            }
            
            .game-canvas {
                width: 100%;
                height: auto;
                max-width: 90vw;
                max-height: 60vh;
            }
            
            .controls {
                gap: 10px;
                flex-wrap: wrap;
            }
            
            .btn {
                padding: 10px 20px;
                font-size: 14px;
                min-width: 120px;
            }
        }
        
        @media (max-width: 480px) {
            .header h1 {
                font-size: 2rem;
            }
            
            .header p {
                font-size: 1rem;
            }
            
            .game-info {
                grid-template-columns: 1fr;
                gap: 10px;
                padding: 12px;
            }
            
            .info-item {
                padding: 10px;
            }
            
            .info-value {
                font-size: 1.5rem;
            }
            
            .game-canvas {
                max-width: 95vw;
                max-height: 50vh;
            }
            
            .btn {
                padding: 8px 16px;
                font-size: 13px;
                min-width: 100px;
            }
            
            .controls {
                gap: 8px;
            }
            
            /* 关卡系统移动端优化 */
            .level-grid {
                grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
                gap: 15px;
            }
            
            .level-card {
                padding: 15px;
                min-height: 120px;
            }
            
            .level-number {
                font-size: 1.5rem;
            }
            
            .level-title {
                font-size: 0.8rem;
            }
            
            .mode-selection {
                flex-direction: column;
                gap: 8px;
            }
            
            .mode-btn {
                max-width: none;
            }
            
            .level-controls {
                flex-direction: column;
                gap: 10px;
            }
            
            .level-start-btn {
                padding: 12px 24px;
                font-size: 1rem;
                min-width: 120px;
            }
        }
        
        /* 动画效果 */
        @keyframes fadeIn {
            from {
                opacity: 0;
                transform: translateY(20px);
            }
            to {
                opacity: 1;
                transform: translateY(0);
            }
        }
        
        .container {
            animation: fadeIn 0.6s ease-out;
        }
        
        .info-item {
            animation: fadeIn 0.6s ease-out;
            animation-delay: 0.1s;
            animation-fill-mode: both;
        }
        
        .info-item:nth-child(2) {
            animation-delay: 0.2s;
        }
        
        .info-item:nth-child(3) {
            animation-delay: 0.3s;
        }
        
        /* 对话框动画 */
        @keyframes fadeInScale {
            from {
                opacity: 0;
                transform: scale(0.8) translateY(20px);
            }
            to {
                opacity: 1;
                transform: scale(1) translateY(0);
            }
        }
        
        @keyframes fadeOutScale {
            from {
                opacity: 1;
                transform: scale(1) translateY(0);
            }
            to {
                opacity: 0;
                transform: scale(0.8) translateY(-20px);
            }
        }
        
        /* 无解对话框样式 */
        .no-solution-dialog .dialog-content {
            font-family: 'Nunito', sans-serif;
        }
        
        .no-solution-dialog .dialog-header h3 {
            color: #667eea;
            margin: 0 0 20px 0;
            font-size: 1.5rem;
            font-weight: 800;
        }
        
        .no-solution-dialog .dialog-body p {
            color: #666;
            margin: 10px 0;
            line-height: 1.6;
        }
        
        .no-solution-dialog .dialog-actions {
            display: flex;
            flex-direction: column;
            gap: 12px;
            margin-top: 25px;
        }
        
        .no-solution-dialog .dialog-btn {
            padding: 12px 24px;
            border: none;
            border-radius: 12px;
            font-size: 16px;
            font-weight: 600;
            font-family: 'Nunito', sans-serif;
            cursor: pointer;
            transition: all 0.3s ease;
            min-width: 200px;
        }
        
        .no-solution-dialog .dialog-btn.primary {
            background: linear-gradient(135deg, #28a745 0%, #20c997 100%);
            color: white;
            box-shadow: 0 4px 8px rgba(40, 167, 69, 0.3);
        }
        
        .no-solution-dialog .dialog-btn.primary:hover {
            transform: translateY(-2px);
            box-shadow: 0 6px 12px rgba(40, 167, 69, 0.4);
        }
        
        .no-solution-dialog .dialog-btn.secondary {
            background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
            color: white;
            box-shadow: 0 4px 8px rgba(102, 126, 234, 0.3);
        }
        
        .no-solution-dialog .dialog-btn.secondary:hover {
            transform: translateY(-2px);
            box-shadow: 0 6px 12px rgba(102, 126, 234, 0.4);
        }
        
        .no-solution-dialog .dialog-btn.tertiary {
            background: #f8f9fa;
            color: #666;
            border: 2px solid #dee2e6;
        }
        
        .no-solution-dialog .dialog-btn.tertiary:hover {
            background: #e9ecef;
            border-color: #adb5bd;
        }
        
        /* Level Complete Dialog Styles */
        .level-complete-dialog {
            position: fixed;
            top: 0;
            left: 0;
            width: 100%;
            height: 100%;
            background: rgba(0, 0, 0, 0.8);
            display: flex;
            justify-content: center;
            align-items: center;
            z-index: 2000;
            backdrop-filter: blur(5px);
        }
        
        .level-complete-dialog .dialog-content {
            background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
            border-radius: 25px;
            padding: 40px;
            max-width: 450px;
            width: 90%;
            box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
            text-align: center;
            position: relative;
            overflow: hidden;
            font-family: 'Nunito', sans-serif;
        }
        
        .level-complete-dialog .dialog-content::before {
            content: '';
            position: absolute;
            top: 0;
            left: 0;
            right: 0;
            bottom: 0;
            background: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100"><defs><radialGradient id="g" cx="50%" cy="50%" r="50%"><stop offset="0%" stop-color="rgba(255,255,255,0.1)"/><stop offset="100%" stop-color="rgba(255,255,255,0)"/></radialGradient></defs><circle cx="50" cy="50" r="50" fill="url(%23g)"/></svg>');
            pointer-events: none;
        }
        
        .level-complete-dialog .dialog-header h3 {
            color: white;
            font-size: 28px;
            margin: 0 0 20px 0;
            text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
            position: relative;
            z-index: 1;
        }
        
        .level-complete-dialog .level-info {
            background: rgba(255, 255, 255, 0.15);
            border-radius: 15px;
            padding: 20px;
            margin: 20px 0;
            backdrop-filter: blur(10px);
            position: relative;
            z-index: 1;
        }
        
        .level-complete-dialog .stat-row {
            display: flex;
            justify-content: space-between;
            align-items: center;
            margin: 12px 0;
            color: white;
            font-size: 16px;
        }
        
        .level-complete-dialog .stat-label {
            font-weight: 500;
        }
        
        .level-complete-dialog .stat-value {
            font-weight: 700;
            font-size: 18px;
        }
        
        .level-complete-dialog .stars {
            font-size: 24px;
            letter-spacing: 2px;
        }
        
        .level-complete-dialog .dialog-actions {
            display: flex;
            flex-direction: column;
            gap: 15px;
            margin-top: 30px;
            position: relative;
            z-index: 1;
        }
        
        .level-complete-dialog .dialog-btn {
            padding: 15px 30px;
            border: none;
            border-radius: 15px;
            font-size: 16px;
            font-weight: 700;
            font-family: 'Nunito', sans-serif;
            cursor: pointer;
            transition: all 0.3s ease;
            position: relative;
            overflow: hidden;
            text-transform: uppercase;
            letter-spacing: 1px;
        }
        
        .level-complete-dialog .dialog-btn.primary {
            background: linear-gradient(135deg, #ff6b6b 0%, #ffd93d 100%);
            color: #333;
            box-shadow: 0 8px 20px rgba(255, 107, 107, 0.4);
        }
        
        .level-complete-dialog .dialog-btn.primary:hover {
            transform: translateY(-3px);
            box-shadow: 0 12px 25px rgba(255, 107, 107, 0.5);
        }
        
        .level-complete-dialog .dialog-btn.secondary {
            background: rgba(255, 255, 255, 0.2);
            color: white;
            border: 2px solid rgba(255, 255, 255, 0.3);
            backdrop-filter: blur(10px);
        }
        
        .level-complete-dialog .dialog-btn.secondary:hover {
            background: rgba(255, 255, 255, 0.3);
            border-color: rgba(255, 255, 255, 0.5);
            transform: translateY(-2px);
        }
        
        .level-complete-dialog .dialog-btn.tertiary {
            background: rgba(0, 0, 0, 0.2);
            color: rgba(255, 255, 255, 0.8);
            border: 2px solid rgba(255, 255, 255, 0.2);
        }
        
        .level-complete-dialog .dialog-btn.tertiary:hover {
            background: rgba(0, 0, 0, 0.3);
            color: white;
            border-color: rgba(255, 255, 255, 0.3);
        }
        
        .level-complete-dialog .completion-message,
        .level-complete-dialog .unlock-message {
            background: rgba(255, 255, 255, 0.1);
            border-radius: 12px;
            padding: 15px;
            margin: 10px 0;
            color: white;
            font-size: 16px;
            font-weight: 600;
            backdrop-filter: blur(10px);
        }
        
        .level-complete-dialog .completion-message {
            background: linear-gradient(135deg, #28a745 0%, #20c997 100%);
        }
        
        .level-complete-dialog .unlock-message {
            background: linear-gradient(135deg, #ffc107 0%, #fd7e14 100%);
            color: #333;
        }
        
        /* Button Styles */
        .btn {
            padding: 8px 16px;
            border: none;
            border-radius: 6px;
            font-weight: 600;
            font-size: 0.9rem;
            cursor: pointer;
            transition: all 0.3s ease;
            text-decoration: none;
            display: inline-flex;
            align-items: center;
            gap: 5px;
        }
        
        .btn-primary {
            background: #667eea;
            color: white;
        }
        
        .btn-primary:hover {
            background: #5a6fd8;
            transform: translateY(-1px);
        }
        
        .btn-secondary {
            background: #6c757d;
            color: white;
        }
        
        .btn-secondary:hover {
            background: #5a6268;
        }
        
        .btn-success {
            background: #28a745;
            color: white;
        }
        
        .btn-success:hover {
            background: #218838;
        }
        
        .btn-outline {
            background: transparent;
            border: 1px solid currentColor;
        }
        
        .btn-close {
            background: transparent;
            border: none;
            color: white;
            font-size: 1.2rem;
            padding: 5px;
            border-radius: 50%;
            width: 30px;
            height: 30px;
            display: flex;
            align-items: center;
            justify-content: center;
        }
        
        .btn-close:hover {
            background: rgba(255, 255, 255, 0.2);
        }
        
        .mode-btn {
            background: rgba(102, 126, 234, 0.1);
            color: #667eea;
            border: 1px solid rgba(102, 126, 234, 0.3);
        }
        
        .mode-btn.active {
            background: #667eea;
            color: white;
        }
        
        .mode-btn:hover {
            background: rgba(102, 126, 234, 0.2);
        }
        
        .mode-btn.active:hover {
            background: #5a6fd8;
        }
        
        /* Level Cards */
        .level-card {
            background: white;
            border-radius: 8px;
            padding: 10px;
            text-align: center;
            cursor: pointer;
            transition: all 0.3s ease;
            border: 2px solid transparent;
            min-height: 80px;
            display: flex;
            flex-direction: column;
            justify-content: center;
        }
        
        .level-card:hover {
            transform: translateY(-2px);
            box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
        }
        
        .level-card.selected {
            border-color: #667eea;
            background: rgba(102, 126, 234, 0.05);
        }
        
        .level-card.completed {
            background: rgba(40, 167, 69, 0.05);
            border-color: rgba(40, 167, 69, 0.3);
        }
        
        .level-card.locked {
            opacity: 0.5;
            cursor: not-allowed;
        }
        
        .level-number {
            font-weight: 700;
            font-size: 1.1rem;
            color: #333;
        }
        
        .level-title {
            font-size: 0.7rem;
            color: #666;
            margin: 2px 0;
        }
        
        .level-stars {
            font-size: 0.7rem;
            margin: 2px 0;
        }
        
        .level-difficulty {
            font-size: 0.6rem;
            padding: 2px 4px;
            border-radius: 3px;
            color: white;
            margin-top: 2px;
        }
        
        /* Responsive Design */
        @media (max-width: 1024px) {
            .main-game-area {
                flex-direction: column;
            }
            
            .left-sidebar {
                width: 100%;
                order: 2;
            }
            
            .game-canvas-area {
                order: 1;
                min-height: 400px;
            }
            
            .level-grid {
                grid-template-columns: repeat(auto-fit, minmax(60px, 1fr));
            }
        }
        
        @media (max-width: 768px) {
            .top-header {
                flex-direction: column;
                gap: 10px;
                text-align: center;
            }
            
            .controls-bar {
                flex-direction: column;
                gap: 10px;
            }
            
            .left-sidebar {
                padding: 15px;
            }
            
            .game-canvas-area {
                padding: 15px;
            }
        }
        
        /* 动画效果 */
        @keyframes fadeInScale {
            0% {
                opacity: 0;
                transform: scale(0.8) translateY(-20px);
            }
            100% {
                opacity: 1;
                transform: scale(1) translateY(0);
            }
        }
        
        @keyframes fadeOutScale {
            0% {
                opacity: 1;
                transform: scale(1) translateY(0);
            }
            100% {
                opacity: 0;
                transform: scale(0.8) translateY(-20px);
            }
        }
        
        @keyframes hintMessageFade {
            0% {
                opacity: 0;
                transform: translateX(-50%) translateY(-20px);
            }
            10% {
                opacity: 1;
                transform: translateX(-50%) translateY(0);
            }
            90% {
                opacity: 1;
                transform: translateX(-50%) translateY(0);
            }
            100% {
                opacity: 0;
                transform: translateX(-50%) translateY(-20px);
            }
        }
        
        @keyframes goldPulse {
            0%, 100% {
                box-shadow: 0 0 10px rgba(255, 215, 0, 0.5);
            }
            50% {
                box-shadow: 0 0 25px rgba(255, 215, 0, 0.8);
            }
        }
        
        @keyframes fadeInUp {
            0% { opacity: 0; transform: translateY(30px); }
            100% { opacity: 1; transform: translateY(0); }
        }
        
        @keyframes fadeOut {
            0% { opacity: 1; }
            100% { opacity: 0; }
        }

/* Audio Settings Panel */
.audio-settings-panel {
    background: white;
    border-radius: 12px;
    padding: 15px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

/* === Award-winning Layout Refresh === */
:root {
    --gradient-start: #090b1f;
    --gradient-mid: #121735;
    --gradient-end: #1f1b3f;
    --accent-primary: #8f9bff;
    --accent-secondary: #5ec7ff;
    --glass-fill: rgba(15, 18, 40, 0.58);
    --surface: rgba(21, 25, 52, 0.7);
    --surface-strong: rgba(29, 35, 71, 0.88);
    --surface-soft: rgba(30, 36, 68, 0.55);
    --text-primary: rgba(247, 248, 255, 0.95);
    --text-secondary: rgba(196, 205, 234, 0.78);
    --shadow-strong: 0 40px 90px rgba(3, 6, 24, 0.65);
    --shadow-soft: 0 22px 50px rgba(7, 14, 45, 0.45);
    --border-light: rgba(143, 155, 255, 0.22);
    --border-strong: rgba(143, 155, 255, 0.35);
    --pill-bg: rgba(31, 33, 66, 0.6);
    --success: #27d17e;
    --warning: #ffb443;
    --danger: #ff5c8c;
}

body {
    padding: 36px 18px;
    min-height: 100vh;
    background:
        radial-gradient(120% 120% at 15% 10%, rgba(80, 83, 173, 0.22) 0%, transparent 45%),
        radial-gradient(120% 140% at 85% 0%, rgba(96, 102, 182, 0.18) 0%, transparent 36%),
        linear-gradient(145deg, var(--gradient-start), var(--gradient-mid) 45%, var(--gradient-end));
    display: flex;
    justify-content: center;
    align-items: flex-start;
    position: relative;
    overflow-x: hidden;
    color: var(--text-primary);
}

body::before {
    display: none;
}

.game-shell {
    width: min(1380px, 100%);
    backdrop-filter: blur(32px);
    background: rgba(12, 13, 31, 0.6);
    border: 1px solid rgba(143, 155, 255, 0.18);
    border-radius: 34px;
    box-shadow: var(--shadow-strong);
    padding: 28px 36px 40px;
    display: flex;
    flex-direction: column;
    gap: 24px;
    position: relative;
    z-index: 2;
}

.hero {
    display: flex;
    flex-direction: column;
    gap: 18px;
    padding: 22px 26px;
    border-radius: 28px;
    background: linear-gradient(120deg, rgba(28, 32, 66, 0.78), rgba(21, 25, 54, 0.5));
    border: 1px solid rgba(143, 155, 255, 0.22);
    box-shadow: 0 24px 60px rgba(6, 8, 26, 0.52);
}

.hero-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 20px;
    flex-wrap: wrap;
}

.hero-left {
    display: flex;
    gap: 24px;
    align-items: center;
}

.hero-right {
    display: flex;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
}

.hero-back {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    border: 1px solid rgba(143,155,255,0.3);
    background: rgba(37, 42, 83, 0.7);
    color: var(--text-primary);
    text-decoration: none;
    font-weight: 700;
    transition: transform 0.25s ease, box-shadow 0.25s ease, background 0.25s ease;
}

.hero-back:hover {
    transform: translateY(-2px);
    background: rgba(59, 65, 120, 0.9);
    box-shadow: 0 18px 32px rgba(4, 6, 20, 0.55);
}

.hero-brand h1 {
    margin: 0;
    font-size: clamp(2.4rem, 3vw, 3.2rem);
    color: var(--text-primary);
    letter-spacing: -0.03em;
}

.hero-brand p {
    margin: 6px 0 0;
    font-size: 1.05rem;
    color: var(--text-secondary);
}

.mode-switch {
    background: rgba(34, 39, 78, 0.6);
    border-radius: 999px;
    padding: 6px;
    display: inline-flex;
    gap: 6px;
    border: 1px solid rgba(143, 155, 255, 0.16);
}

.mode-chip {
    border: none;
    background: transparent;
    color: rgba(221,224,255,0.75);
    font-weight: 600;
    font-size: 0.95rem;
    padding: 10px 22px;
    border-radius: 999px;
    cursor: pointer;
    transition: background 0.2s ease, color 0.2s ease, transform 0.2s ease;
}

.mode-chip:hover {
    color: var(--text-primary);
    transform: translateY(-1px);
}

.mode-chip.active {
    background: linear-gradient(135deg, rgba(144, 155, 255, 0.95), rgba(127, 234, 255, 0.7));
    color: #14173a;
    box-shadow: 0 14px 24px rgba(7, 12, 38, 0.55);
}

.hero-actions {
    display: flex;
    gap: 14px;
}

.pill-btn,
.ghost-btn {
    border-radius: 999px;
    border: 1px solid rgba(143, 155, 255, 0.18);
    font-weight: 600;
    font-size: 0.95rem;
    padding: 12px 24px;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
    backdrop-filter: blur(6px);
}

.pill-btn {
    background: rgba(43, 49, 90, 0.6);
    color: var(--text-primary);
}

.pill-btn.primary {
    background: linear-gradient(135deg, rgba(143, 155, 255, 0.9), rgba(94, 199, 255, 0.75));
    color: #14173a;
    border-color: rgba(143,155,255,0.4);
}

.pill-btn:hover,
.ghost-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 18px 32px rgba(6, 8, 26, 0.55);
}

.pill-btn:disabled {
    opacity: 0.45;
    cursor: not-allowed;
    box-shadow: none;
    transform: none;
}

.ghost-btn {
    background: transparent;
    color: var(--text-secondary);
}

.hero-metrics {
    width: 100%;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
    gap: 14px;
    padding: 12px 16px;
    border-radius: 20px;
    background: rgba(19, 23, 50, 0.68);
    border: 1px solid rgba(143, 155, 255, 0.18);
}

.metric-card {
    background: rgba(25, 29, 58, 0.78);
    border-radius: 18px;
    padding: 16px 18px;
    border: 1px solid rgba(143, 155, 255, 0.18);
    box-shadow: 0 20px 38px rgba(6, 8, 26, 0.45);
    display: flex;
    flex-direction: column;
    gap: 12px;
    position: relative;
    overflow: hidden;
}

.metric-card::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, rgba(143,155,255,0.18), transparent);
    mix-blend-mode: soft-light;
    pointer-events: none;
}

.metric-label {
    font-size: 0.95rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: rgba(196,205,234,0.68);
    font-weight: 700;
}

.metric-value {
    font-size: clamp(2.2rem, 4vw, 2.9rem);
    font-weight: 800;
    color: var(--text-primary);
    letter-spacing: -0.02em;
}

.metric-score .metric-value {
    background: linear-gradient(135deg, #5ae8b2, #17a960);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.metric-time .metric-value {
    background: linear-gradient(135deg, #ffad5e, #ff5f6d);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    position: relative;
}

#timer.timer-flash {
    animation: timerPulse 0.6s ease;
}

#timer.timer-flash::after {
    content: attr(data-bonus);
    position: absolute;
    top: -18px;
    right: -6px;
    font-size: 0.75rem;
    color: var(--accent-secondary);
    font-weight: 700;
    opacity: 0;
    transform: translateY(-4px);
    animation: timerBonusRise 0.9s ease forwards;
    text-shadow: 0 0 8px rgba(94, 199, 255, 0.6);
}

@keyframes timerPulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.12); }
    100% { transform: scale(1); }
}

@keyframes timerBonusRise {
    0% { opacity: 0; transform: translateY(-4px); }
    20% { opacity: 1; transform: translateY(-8px); }
    100% { opacity: 0; transform: translateY(-18px); }
}

.metric-pairs .metric-value {
    background: linear-gradient(135deg, #8b78ff, #5b4bff);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.metric-combo-value {
    font-size: clamp(1.6rem, 3vw, 2.1rem);
    font-weight: 700;
    color: var(--gradient-end);
}

.metric-level .metric-value {
    background: linear-gradient(135deg, #78d4ff, #5b8bff);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.layout-grid {
    display: grid;
    grid-template-columns: minmax(0, 2.6fr) minmax(0, 0.7fr);
    gap: 22px;
    align-items: start;
}

.board-panel {
    background: linear-gradient(150deg, rgba(33, 39, 82, 0.88), rgba(23, 28, 62, 0.72));
    border-radius: 32px;
    border: none;
    padding: 22px 26px 28px;
    display: flex;
    flex-direction: column;
    gap: 18px;
    position: relative;
    overflow: visible;
    box-shadow: 0 28px 60px rgba(5, 7, 24, 0.55);
    color: var(--text-primary);
}

.board-panel::before {
    content: '';
    position: absolute;
    inset: -30px;
    border-radius: 40px;
    background: radial-gradient(120% 140% at 20% 10%, rgba(114, 128, 255, 0.35), transparent 60%);
    z-index: -1;
    filter: blur(32px);
}

.board-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: relative;
    z-index: 1;
}

.board-status {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.status-title {
    font-weight: 700;
    color: var(--text-primary);
    font-size: 1.1rem;
}

.status-subtitle {
    font-size: 0.95rem;
    color: rgba(196,205,234,0.7);
}

.status-pill {
    padding: 10px 20px;
    border-radius: 999px;
    background: linear-gradient(135deg, rgba(144,155,255,0.95), rgba(94,199,255,0.65));
    color: #14173a;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.canvas-stage {
    position: relative;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 12px;
    border-radius: 32px;
    overflow: visible;
    min-height: clamp(480px, 68vh, 720px);
}

.canvas-stage::before {
    content: '';
    position: absolute;
    inset: -26px;
    background: radial-gradient(80% 80% at 50% 30%, rgba(121, 135, 255, 0.28), transparent 68%);
    filter: blur(20px);
    z-index: -1;
    border-radius: 46px;
}

.canvas-stage::after {
    content: '';
    position: absolute;
    inset: -18px;
    border-radius: 42px;
    background: linear-gradient(135deg, rgba(143,155,255,0.18), rgba(143,155,255,0));
    z-index: -1;
}

.canvas-stage .game-canvas {
    position: relative;
    border-radius: 26px;
    border: none;
    background: rgba(251, 251, 255, 0.92);
    box-shadow: 0 30px 60px rgba(12, 21, 66, 0.34);
}

.canvas-placeholder {
    position: absolute;
    inset: 18px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 16px;
    padding: 32px 40px;
    text-align: center;
    color: rgba(20, 23, 58, 0.94);
    background: radial-gradient(120% 120% at 50% 20%, rgba(156, 171, 255, 0.55), rgba(242, 244, 255, 0.92) 62%, rgba(242, 244, 255, 0.98));
    border-radius: 24px;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.7), 0 24px 48px rgba(20, 23, 58, 0.28);
    overflow: hidden;
    transition: opacity 0.35s ease, transform 0.35s ease;
    z-index: 1;
}

.canvas-placeholder.hidden {
    opacity: 0;
    transform: translateY(12px) scale(0.98);
    pointer-events: none;
    visibility: hidden;
}

.canvas-placeholder::before,
.canvas-placeholder::after {
    content: '';
    position: absolute;
    border-radius: 999px;
    filter: blur(26px);
    opacity: 0.55;
}

.canvas-placeholder::before {
    inset: -60% 40% 50% -50%;
    background: radial-gradient(circle, rgba(255, 255, 255, 0.6), transparent 60%);
}

.canvas-placeholder::after {
    inset: 55% -45% -50% 45%;
    background: radial-gradient(circle, rgba(140, 207, 255, 0.4), transparent 65%);
}

.placeholder-orb {
    position: absolute;
    width: 140px;
    height: 140px;
    border-radius: 50%;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.65), rgba(141, 166, 255, 0.25));
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.85);
    filter: blur(0.2px);
    animation: orbFloat 8s ease-in-out infinite;
    opacity: 0.55;
}

.placeholder-orb.orb-one {
    top: 12%;
    left: 14%;
    animation-delay: -2s;
}

.placeholder-orb.orb-two {
    bottom: 10%;
    right: 12%;
    animation-duration: 9.5s;
}

@keyframes orbFloat {
    0%   { transform: translate3d(-8px, 0, 0) scale(1); }
    50%  { transform: translate3d(6px, -10px, 0) scale(1.05); }
    100% { transform: translate3d(-8px, 0, 0) scale(1); }
}

.placeholder-emblem {
    position: relative;
    font-size: 2.8rem;
    line-height: 1;
    padding: 14px;
    border-radius: 18px;
    background: rgba(255, 255, 255, 0.82);
    box-shadow: 0 12px 28px rgba(91, 102, 192, 0.18);
}

.canvas-placeholder h3 {
    font-size: 1.6rem;
    font-weight: 800;
    letter-spacing: 0.01em;
    margin: 0;
    text-shadow: 0 6px 18px rgba(30, 36, 82, 0.18);
}

.canvas-placeholder p {
    margin: 0;
    max-width: 420px;
    font-size: 1rem;
    line-height: 1.6;
    color: rgba(30, 36, 82, 0.8);
}

.placeholder-hints {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 4px;
    font-size: 0.95rem;
    color: rgba(30, 36, 82, 0.72);
}

.placeholder-hints .hint-row {
    background: rgba(255, 255, 255, 0.58);
    border-radius: 999px;
    padding: 8px 18px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.75);
}

.side-panel {
    display: flex;
    flex-direction: column;
    gap: 20px;
    max-width: 320px;
    width: 100%;
    margin-left: auto;
}

.ui-panel {
    background: rgba(26, 32, 66, 0.72);
    border-radius: 22px;
    border: 1px solid rgba(143, 155, 255, 0.16);
    padding: 22px;
    box-shadow: 0 20px 40px rgba(6, 8, 26, 0.45);
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.panel-heading span:first-child {
    font-weight: 700;
    font-size: 1.05rem;
    color: var(--text-primary);
}

.panel-sub {
    font-size: 0.82rem;
    color: rgba(196,205,234,0.62);
}

.toggle-row,
.slider-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 18px;
}

.toggle-row input[type="checkbox"] {
    width: 20px;
    height: 20px;
    accent-color: var(--gradient-end);
}

.slider-row input[type="range"] {
    flex: 1;
    accent-color: var(--accent-primary);
}

.select-field {
    width: 100%;
    border-radius: 14px;
    border: 1px solid rgba(143, 155, 255, 0.32);
    padding: 10px 14px;
    background: rgba(22, 27, 56, 0.9);
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-primary);
}

.level-grid-container {
    max-height: 360px;
    overflow-y: auto;
    padding-right: 6px;
}

.level-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 14px;
}

.level-card {
    background: rgba(25, 30, 60, 0.85);
    border: 1px solid rgba(143, 155, 255, 0.18);
    border-radius: 18px;
    padding: 16px 14px;
    text-align: center;
    cursor: pointer;
    transition: transform 0.25s ease, box-shadow 0.25s ease, border-color 0.25s ease, background 0.25s ease;
    min-height: 120px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 8px;
    box-shadow: 0 18px 32px rgba(6, 8, 26, 0.45);
}

.level-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 24px 44px rgba(5, 7, 24, 0.6);
    border-color: rgba(143, 155, 255, 0.4);
    background: rgba(29, 35, 68, 0.95);
}

.level-card.selected {
    background: linear-gradient(140deg, rgba(144,155,255,0.9), rgba(127, 234, 255, 0.65));
    color: #15183b;
    border-color: transparent;
    box-shadow: 0 28px 48px rgba(5, 9, 30, 0.65);
}

.level-card.completed {
    background: linear-gradient(135deg, rgba(48, 163, 123, 0.78), rgba(25, 109, 85, 0.78));
    color: rgba(233, 255, 248, 0.95);
    border-color: transparent;
}

.level-card.locked {
    background: rgba(17, 20, 41, 0.6);
    border-color: rgba(70, 74, 112, 0.6);
    opacity: 0.55;
    cursor: not-allowed;
    box-shadow: none;
}

.level-card.selected .level-difficulty {
    background: rgba(17, 22, 48, 0.12);
    color: #15183b;
}

.level-card.completed .level-difficulty {
    background: rgba(12, 18, 31, 0.35);
    color: rgba(233,255,248,0.9);
}

.level-number {
    font-size: 1.5rem;
    font-weight: 800;
    color: inherit;
}

.level-title {
    font-weight: 600;
    font-size: 0.95rem;
    color: inherit;
}

.level-difficulty {
    align-self: center;
    padding: 4px 10px;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 700;
    background: rgba(0,0,0,0.12);
    color: inherit;
}

.knowledge-panel {
    background: rgba(20, 24, 53, 0.72);
    border-radius: 26px;
    border: 1px solid rgba(143, 155, 255, 0.18);
    padding: 32px;
    display: flex;
    flex-direction: column;
    gap: 28px;
    box-shadow: 0 24px 48px rgba(6, 8, 26, 0.45);
}

.guide-intro h2 {
    margin: 0 0 8px;
    font-size: clamp(1.8rem, 3vw, 2.3rem);
    color: var(--text-primary);
}

.guide-intro p {
    margin: 0;
    color: rgba(196,205,234,0.7);
    font-size: 1rem;
}

.guide-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 22px;
}

.guide-card {
    background: rgba(26, 31, 64, 0.82);
    border-radius: 20px;
    border: 1px solid rgba(143, 155, 255, 0.18);
    padding: 22px;
    display: flex;
    flex-direction: column;
    gap: 16px;
    box-shadow: 0 18px 36px rgba(6, 8, 26, 0.45);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.guide-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 26px 46px rgba(5, 6, 20, 0.6);
}

.guide-icon {
    font-size: 1.8rem;
}

.guide-card h3 {
    margin: 0;
    font-size: 1.2rem;
    color: var(--text-primary);
}

.guide-card p {
    margin: 0;
    color: rgba(196,205,234,0.7);
    line-height: 1.5;
}

.instructions-overlay {
    position: fixed;
    inset: 0;
    background: rgba(4, 6, 20, 0.85);
    display: none;
    align-items: center;
    justify-content: center;
    padding: 40px 24px;
    backdrop-filter: blur(22px);
    z-index: 50;
}

.instructions-overlay.active {
    display: flex;
}

.instructions-content {
    background: rgba(26, 31, 64, 0.92);
    border-radius: 26px;
    padding: 32px 38px;
    max-width: 960px;
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 28px;
    box-shadow: 0 32px 72px rgba(5, 7, 24, 0.65);
}

.instructions-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 24px;
}

.instructions-header h2 {
    margin: 0;
    color: var(--text-primary);
    font-size: 1.9rem;
}

.pill-btn.ghost {
    background: transparent;
    color: var(--accent-primary);
    border-color: rgba(143, 155, 255, 0.35);
}

.instructions-columns {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 24px;
}

.instructions-block {
    background: rgba(31, 36, 72, 0.82);
    border-radius: 18px;
    padding: 18px 20px;
    border: 1px solid rgba(143, 155, 255, 0.2);
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.instructions-block h3 {
    margin: 0;
    color: var(--accent-primary);
    font-size: 1.1rem;
}

.instructions-block ul {
    margin: 0;
    padding-left: 18px;
    color: rgba(196,205,234,0.72);
    line-height: 1.55;
}

@media (max-width: 1150px) {
    body {
        padding: 32px 16px;
    }
    .game-shell {
        padding: 32px 28px 48px;
    }
    .layout-grid {
        grid-template-columns: 1fr;
    }
    .hero {
        flex-direction: column;
        align-items: flex-start;
        gap: 22px;
    }
    .hero-right {
        width: 100%;
        justify-content: space-between;
    }
    .hero-actions {
        flex-wrap: wrap;
        justify-content: flex-end;
    }
}

@media (max-width: 768px) {
    .hero-actions {
        justify-content: flex-start;
    }
    .hero-metrics {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
    .instructions-content {
        padding: 32px;
    }
}

@media (max-width: 540px) {
    .hero-metrics {
        grid-template-columns: 1fr;
    }
    .guide-grid {
        grid-template-columns: 1fr;
    }
    .instructions-columns {
        grid-template-columns: 1fr;
    }
    .hero-right {
        flex-direction: column;
        align-items: stretch;
        gap: 18px;
    }
    .mode-switch {
        align-self: flex-start;
    }
    .hero-actions {
        flex-direction: column;
        align-items: stretch;
    }
}

.audio-settings-panel .panel-header h3 {
    margin: 0 0 15px 0;
    font-size: 1rem;
    color: #333;
}

.audio-settings-panel .setting-group {
    margin-bottom: 10px;
}

.audio-settings-panel label {
    display: flex;
    align-items: center;
    font-weight: 600;
    color: #555;
    margin-bottom: 8px;
    cursor: pointer;
    font-size: 0.9rem;
}

.audio-settings-panel input[type="checkbox"] {
    margin-right: 8px;
    cursor: pointer;
    width: 16px;
    height: 16px;
}

.volume-slider {
    width: 100%;
    height: 6px;
    border-radius: 3px;
    background: #ddd;
    outline: none;
    margin-bottom: 5px;
    cursor: pointer;
    -webkit-appearance: none;
}

.volume-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: #667eea;
    cursor: pointer;
    transition: transform 0.2s ease;
}

.volume-slider::-webkit-slider-thumb:hover {
    transform: scale(1.2);
}

.volume-slider::-moz-range-thumb {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: #667eea;
    cursor: pointer;
    border: none;
    transition: transform 0.2s ease;
}

.volume-slider::-moz-range-thumb:hover {
    transform: scale(1.2);
}

.volume-value {
    font-size: 0.85rem;
    color: #667eea;
    font-weight: 600;
    float: right;
}
