:root {
    --bg-primary: #0a0a0f;
    --bg-secondary: #12121a;
    --bg-tertiary: #1a1a25;
    --text-primary: #f0f0f5;
    --text-secondary: #8888aa;
    --accent: #00ffaa;
    --accent-glow: rgba(0, 255, 170, 0.3);
    --border: #2a2a3a;
    --shadow: rgba(0, 0, 0, 0.5);
}

[data-theme="light"] {
    --bg-primary: #fafafa;
    --bg-secondary: #ffffff;
    --bg-tertiary: #f0f0f4;
    --text-primary: #1a1a2e;
    --text-secondary: #6666880;
    --accent: #00cc88;
    --accent-glow: rgba(0, 204, 136, 0.2);
    --border: #d0d0e0;
    --shadow: rgba(0, 0, 0, 0.1);
}

[data-theme="light"] .bg-pattern {
    opacity: 0.22;
}

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

body {
    font-family: 'Space Grotesk', sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
    overflow-x: hidden;
    transition: background 0.4s ease, color 0.4s ease;
}

/* Background Pattern */
.bg-pattern {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 0;
    opacity: 0.4;
    background-image: 
        radial-gradient(circle at 20% 80%, var(--accent-glow) 0%, transparent 50%),
        radial-gradient(circle at 80% 20%, rgba(100, 100, 255, 0.1) 0%, transparent 50%);
}

.game-container {
    position: relative;
    z-index: 1;
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
}

/* Header */
.header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    max-width: 800px;
    padding: 15px 25px;
    background: var(--bg-secondary);
    border-radius: 16px;
    border: 1px solid var(--border);
    box-shadow: 0 4px 20px var(--shadow);
}

.logo {
    font-family: 'Orbitron', sans-serif;
    font-size: 1.8rem;
    font-weight: 900;
    background: linear-gradient(135deg, var(--accent), #00aaff);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    letter-spacing: 2px;
}

.controls-header {
    display: flex;
    gap: 10px;
    align-items: center;
}

.btn {
    padding: 10px 18px;
    border: none;
    border-radius: 10px;
    font-family: 'Space Grotesk', sans-serif;
    font-weight: 500;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 8px;
}

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

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px var(--accent-glow);
}

.btn-secondary {
    background: var(--bg-tertiary);
    color: var(--text-primary);
    border: 1px solid var(--border);
}

.btn-secondary:hover {
    background: var(--border);
}

.btn-icon {
    width: 40px;
    height: 40px;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 10px;
}

/* Main Game Area */
.main-area {
    display: flex;
    gap: 25px;
    align-items: flex-start;
    flex-wrap: wrap;
    justify-content: center;
}

/* Game Board */
.game-board-wrapper {
    background: var(--bg-secondary);
    border-radius: 20px;
    padding: 15px;
    border: 1px solid var(--border);
    box-shadow: 0 8px 40px var(--shadow);
}

.game-board {
    display: grid;
    grid-template-columns: repeat(10, 1fr);
    gap: 1px;
    background: var(--bg-tertiary);
    padding: 4px;
    border-radius: 12px;
}

.cell {
    width: 28px;
    height: 28px;
    background: var(--bg-primary);
    border-radius: 4px;
    transition: all 0.1s ease;
}

.cell.filled {
    transform: translateZ(0);
    position: relative;
}

[data-block-style="crystal"] .game-board .cell.filled {
    overflow: hidden;
}

/* Side Panel */
.side-panel {
    display: flex;
    flex-direction: column;
    gap: 15px;
    min-width: 200px;
}

.panel-card {
    background: var(--bg-secondary);
    border-radius: 16px;
    padding: 20px;
    border: 1px solid var(--border);
    box-shadow: 0 4px 20px var(--shadow);
}

.panel-title {
    font-family: 'Orbitron', sans-serif;
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 2px;
    margin-bottom: 12px;
}

/* Stats */
.stat-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 0;
    border-bottom: 1px solid var(--border);
}

.stat-item:last-child {
    border-bottom: none;
}

.stat-label {
    color: var(--text-secondary);
    font-size: 0.85rem;
}

.stat-value {
    font-family: 'Orbitron', sans-serif;
    font-weight: 700;
    font-size: 1.2rem;
    color: var(--accent);
}

/* Next Piece Preview */
.next-piece-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 2px;
    width: fit-content;
    margin: 0 auto;
}

.preview-cell {
    width: 24px;
    height: 24px;
    background: var(--bg-primary);
    border-radius: 4px;
    position: relative;
    overflow: hidden;
}

/* Block Style Selector */
.style-selector {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
}

.style-btn {
    padding: 12px;
    border: 2px solid var(--border);
    border-radius: 10px;
    background: var(--bg-tertiary);
    color: var(--text-primary);
    cursor: pointer;
    font-size: 0.8rem;
    font-weight: 500;
    transition: all 0.2s ease;
    text-align: center;
}

.style-btn:hover {
    border-color: var(--accent);
}

.style-btn.active {
    border-color: var(--accent);
    background: var(--accent-glow);
}

/* Controls Info */
.controls-info {
    display: grid;
    gap: 8px;
}

.control-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.85rem;
}

.key {
    background: var(--bg-tertiary);
    padding: 4px 10px;
    border-radius: 6px;
    font-family: 'Orbitron', sans-serif;
    font-size: 0.7rem;
    border: 1px solid var(--border);
}

/* Block Styles - Wooden (grain + rings; board + preview) */
[data-block-style="wooden"] .cell.filled.I,
[data-block-style="wooden"] .preview-cell.filled.I {
    background:
        radial-gradient(ellipse 120% 80% at 30% 40%, rgba(255,255,255,0.12) 0%, transparent 45%),
        repeating-linear-gradient(88deg, rgba(0,0,0,0.07) 0 1px, transparent 1px 3px),
        repeating-linear-gradient(2deg, rgba(139,90,20,0.15) 0 5px, transparent 5px 11px),
        linear-gradient(145deg, #dcc07a 0%, #a67c1a 38%, #c9a85c 58%, #6e4a0f 100%);
    box-shadow: inset 2px 2px 5px rgba(255,255,255,0.35), inset -2px -3px 6px rgba(0,0,0,0.45), 0 2px 5px rgba(0,0,0,0.45);
}
[data-block-style="wooden"] .cell.filled.O,
[data-block-style="wooden"] .preview-cell.filled.O {
    background:
        radial-gradient(ellipse 100% 90% at 60% 35%, rgba(255,240,200,0.2) 0%, transparent 50%),
        repeating-linear-gradient(92deg, rgba(60,30,10,0.08) 0 1px, transparent 1px 4px),
        linear-gradient(160deg, #ecd4a8 0%, #a0522d 42%, #deb887 100%);
    box-shadow: inset 2px 2px 5px rgba(255,255,255,0.35), inset -2px -3px 6px rgba(0,0,0,0.45), 0 2px 5px rgba(0,0,0,0.45);
}
[data-block-style="wooden"] .cell.filled.T,
[data-block-style="wooden"] .preview-cell.filled.T {
    background:
        radial-gradient(circle at 70% 30%, rgba(255,255,255,0.1) 0%, transparent 40%),
        repeating-linear-gradient(0deg, rgba(0,0,0,0.06) 0 2px, transparent 2px 7px),
        linear-gradient(135deg, #7a4a28 0%, #4a2a14 45%, #6b3e22 100%);
    box-shadow: inset 2px 2px 5px rgba(255,255,255,0.25), inset -2px -3px 6px rgba(0,0,0,0.5), 0 2px 5px rgba(0,0,0,0.45);
}
[data-block-style="wooden"] .cell.filled.S,
[data-block-style="wooden"] .preview-cell.filled.S {
    background:
        repeating-linear-gradient(90deg, rgba(90,50,20,0.1) 0 2px, transparent 2px 5px),
        linear-gradient(150deg, #d9a066 0%, #8b5a2b 50%, #b87333 100%);
    box-shadow: inset 2px 2px 5px rgba(255,255,255,0.35), inset -2px -3px 6px rgba(0,0,0,0.45), 0 2px 5px rgba(0,0,0,0.45);
}
[data-block-style="wooden"] .cell.filled.Z,
[data-block-style="wooden"] .preview-cell.filled.Z {
    background:
        radial-gradient(ellipse at 40% 60%, rgba(255,200,160,0.15) 0%, transparent 55%),
        repeating-linear-gradient(85deg, rgba(0,0,0,0.06) 0 1px, transparent 1px 3px),
        linear-gradient(140deg, #a86840 0%, #5c2e18 48%, #8b4a2a 100%);
    box-shadow: inset 2px 2px 5px rgba(255,255,255,0.3), inset -2px -3px 6px rgba(0,0,0,0.5), 0 2px 5px rgba(0,0,0,0.45);
}
[data-block-style="wooden"] .cell.filled.J,
[data-block-style="wooden"] .preview-cell.filled.J {
    background:
        repeating-linear-gradient(3deg, rgba(0,0,0,0.05) 0 3px, transparent 3px 8px),
        linear-gradient(155deg, #e88a3c 0%, #9a4a18 40%, #c4621e 100%);
    box-shadow: inset 2px 2px 5px rgba(255,255,255,0.35), inset -2px -3px 6px rgba(0,0,0,0.45), 0 2px 5px rgba(0,0,0,0.45);
}
[data-block-style="wooden"] .cell.filled.L,
[data-block-style="wooden"] .preview-cell.filled.L {
    background:
        radial-gradient(circle at 25% 75%, rgba(255,220,120,0.18) 0%, transparent 45%),
        repeating-linear-gradient(90deg, rgba(100,70,10,0.08) 0 1px, transparent 1px 4px),
        linear-gradient(130deg, #e8c04a 0%, #9a7208 42%, #c9a020 100%);
    box-shadow: inset 2px 2px 5px rgba(255,255,255,0.4), inset -2px -3px 6px rgba(0,0,0,0.45), 0 2px 5px rgba(0,0,0,0.45);
}

@keyframes crystalShimmer {
    0%, 100% { opacity: 0.35; transform: translateX(-100%) skewX(-12deg); }
    50% { opacity: 0.85; transform: translateX(100%) skewX(-12deg); }
}

/* Block Styles - Crystal (facets + shimmer; board + preview) */
[data-block-style="crystal"] .cell.filled,
[data-block-style="crystal"] .preview-cell.filled {
    border: 1px solid rgba(255,255,255,0.45);
    backdrop-filter: saturate(1.2) brightness(1.05);
}
[data-block-style="crystal"] .cell.filled.I,
[data-block-style="crystal"] .preview-cell.filled.I {
    background:
        conic-gradient(from 210deg at 65% 35%, rgba(180,255,255,0.5), rgba(0,180,220,0.75), rgba(100,255,255,0.55), rgba(0,120,180,0.8), rgba(180,255,255,0.5)),
        linear-gradient(155deg, rgba(200,255,255,0.95) 0%, rgba(0,160,200,0.55) 45%, rgba(0,100,140,0.85) 100%);
    box-shadow: 0 0 12px rgba(0,255,255,0.45), inset 1px 1px 0 rgba(255,255,255,0.65), inset -2px -3px 8px rgba(0,60,80,0.35);
    filter: drop-shadow(0 1px 2px rgba(0,200,255,0.4));
}
[data-block-style="crystal"] .cell.filled.O,
[data-block-style="crystal"] .preview-cell.filled.O {
    background:
        conic-gradient(from 90deg at 50% 50%, rgba(255,240,150,0.9), rgba(255,200,50,0.7), rgba(255,255,200,0.85), rgba(220,160,0,0.75), rgba(255,240,150,0.9)),
        linear-gradient(135deg, rgba(255,255,180,0.9) 0%, rgba(255,180,0,0.5) 100%);
    box-shadow: 0 0 12px rgba(255,220,80,0.5), inset 1px 1px 0 rgba(255,255,255,0.7), inset -2px -3px 8px rgba(120,80,0,0.3);
    filter: drop-shadow(0 1px 2px rgba(255,200,50,0.45));
}
[data-block-style="crystal"] .cell.filled.T,
[data-block-style="crystal"] .preview-cell.filled.T {
    background:
        conic-gradient(from 0deg at 40% 60%, rgba(240,200,255,0.85), rgba(180,80,255,0.75), rgba(220,150,255,0.9), rgba(120,0,200,0.8), rgba(240,200,255,0.85)),
        linear-gradient(145deg, rgba(230,180,255,0.95) 0%, rgba(140,40,200,0.6) 100%);
    box-shadow: 0 0 12px rgba(200,100,255,0.5), inset 1px 1px 0 rgba(255,255,255,0.65), inset -2px -3px 8px rgba(60,0,100,0.35);
    filter: drop-shadow(0 1px 2px rgba(200,100,255,0.4));
}
[data-block-style="crystal"] .cell.filled.S,
[data-block-style="crystal"] .preview-cell.filled.S {
    background:
        conic-gradient(from 180deg at 55% 45%, rgba(200,255,220,0.9), rgba(80,220,120,0.75), rgba(160,255,200,0.85), rgba(0,140,80,0.8), rgba(200,255,220,0.9)),
        linear-gradient(160deg, rgba(180,255,200,0.95) 0%, rgba(40,180,100,0.55) 100%);
    box-shadow: 0 0 12px rgba(100,255,150,0.45), inset 1px 1px 0 rgba(255,255,255,0.65), inset -2px -3px 8px rgba(0,80,40,0.35);
    filter: drop-shadow(0 1px 2px rgba(80,220,120,0.4));
}
[data-block-style="crystal"] .cell.filled.Z,
[data-block-style="crystal"] .preview-cell.filled.Z {
    background:
        conic-gradient(from 270deg at 50% 50%, rgba(255,200,220,0.9), rgba(255,100,140,0.75), rgba(255,180,200,0.9), rgba(200,40,80,0.8), rgba(255,200,220,0.9)),
        linear-gradient(140deg, rgba(255,200,220,0.95) 0%, rgba(220,60,100,0.6) 100%);
    box-shadow: 0 0 12px rgba(255,120,160,0.5), inset 1px 1px 0 rgba(255,255,255,0.65), inset -2px -3px 8px rgba(100,20,40,0.35);
    filter: drop-shadow(0 1px 2px rgba(255,100,140,0.4));
}
[data-block-style="crystal"] .cell.filled.J,
[data-block-style="crystal"] .preview-cell.filled.J {
    background:
        conic-gradient(from 330deg at 45% 40%, rgba(200,220,255,0.9), rgba(100,150,255,0.8), rgba(180,200,255,0.9), rgba(40,80,220,0.85), rgba(200,220,255,0.9)),
        linear-gradient(150deg, rgba(200,220,255,0.95) 0%, rgba(60,100,220,0.65) 100%);
    box-shadow: 0 0 12px rgba(120,160,255,0.5), inset 1px 1px 0 rgba(255,255,255,0.7), inset -2px -3px 8px rgba(20,40,120,0.35);
    filter: drop-shadow(0 1px 2px rgba(100,150,255,0.45));
}
[data-block-style="crystal"] .cell.filled.L,
[data-block-style="crystal"] .preview-cell.filled.L {
    background:
        conic-gradient(from 45deg at 50% 55%, rgba(255,230,200,0.95), rgba(255,180,100,0.8), rgba(255,220,180,0.9), rgba(200,100,30,0.85), rgba(255,230,200,0.95)),
        linear-gradient(135deg, rgba(255,220,180,0.95) 0%, rgba(230,140,50,0.65) 100%);
    box-shadow: 0 0 12px rgba(255,180,100,0.5), inset 1px 1px 0 rgba(255,255,255,0.65), inset -2px -3px 8px rgba(120,60,20,0.35);
    filter: drop-shadow(0 1px 2px rgba(255,160,80,0.45));
}
[data-block-style="crystal"] .cell.filled::before,
[data-block-style="crystal"] .preview-cell.filled::before {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: inherit;
    background: linear-gradient(105deg, transparent 35%, rgba(255,255,255,0.55) 50%, transparent 65%);
    animation: crystalShimmer 3.2s ease-in-out infinite;
    pointer-events: none;
    mix-blend-mode: overlay;
}
@media (prefers-reduced-motion: reduce) {
    [data-block-style="crystal"] .cell.filled::before,
    [data-block-style="crystal"] .preview-cell.filled::before {
        animation: none;
        opacity: 0.4;
        transform: none;
    }
}

/* Block Styles - Bricks */
[data-block-style="bricks"] .cell.filled,
[data-block-style="bricks"] .preview-cell.filled {
    background-image: repeating-linear-gradient(
        90deg,
        transparent 0px,
        transparent 3px,
        rgba(0,0,0,0.15) 3px,
        rgba(0,0,0,0.15) 4px
    ), repeating-linear-gradient(
        0deg,
        transparent 0px,
        transparent 6px,
        rgba(0,0,0,0.15) 6px,
        rgba(0,0,0,0.15) 7px
    );
    box-shadow: inset 1px 1px 2px rgba(255,255,255,0.2), inset -1px -1px 2px rgba(0,0,0,0.3), 0 2px 4px rgba(0,0,0,0.4);
}
[data-block-style="bricks"] .cell.filled.I,
[data-block-style="bricks"] .preview-cell.filled.I { background-color: #b22222; }
[data-block-style="bricks"] .cell.filled.O,
[data-block-style="bricks"] .preview-cell.filled.O { background-color: #cd853f; }
[data-block-style="bricks"] .cell.filled.T,
[data-block-style="bricks"] .preview-cell.filled.T { background-color: #8b4513; }
[data-block-style="bricks"] .cell.filled.S,
[data-block-style="bricks"] .preview-cell.filled.S { background-color: #2e8b57; }
[data-block-style="bricks"] .cell.filled.Z,
[data-block-style="bricks"] .preview-cell.filled.Z { background-color: #a52a2a; }
[data-block-style="bricks"] .cell.filled.J,
[data-block-style="bricks"] .preview-cell.filled.J { background-color: #4169e1; }
[data-block-style="bricks"] .cell.filled.L,
[data-block-style="bricks"] .preview-cell.filled.L { background-color: #d2691e; }

/* Block Styles - Lego */
[data-block-style="lego"] .cell.filled,
[data-block-style="lego"] .preview-cell.filled {
    border-radius: 6px;
    position: relative;
    box-shadow: inset 2px 2px 4px rgba(255,255,255,0.4), inset -2px -2px 4px rgba(0,0,0,0.3), 0 3px 6px rgba(0,0,0,0.4);
}
[data-block-style="lego"] .cell.filled::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: inherit;
    box-shadow: inset 1px 1px 2px rgba(255,255,255,0.6), inset -1px -1px 2px rgba(0,0,0,0.2), 0 2px 3px rgba(0,0,0,0.3);
}
[data-block-style="lego"] .preview-cell.filled::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 9px;
    height: 9px;
    border-radius: 50%;
    background: inherit;
    box-shadow: inset 1px 1px 2px rgba(255,255,255,0.6), inset -1px -1px 2px rgba(0,0,0,0.2), 0 2px 3px rgba(0,0,0,0.3);
}
[data-block-style="lego"] .cell.filled.I,
[data-block-style="lego"] .preview-cell.filled.I { background: #00bfff; }
[data-block-style="lego"] .cell.filled.O,
[data-block-style="lego"] .preview-cell.filled.O { background: #ffd700; }
[data-block-style="lego"] .cell.filled.T,
[data-block-style="lego"] .preview-cell.filled.T { background: #9932cc; }
[data-block-style="lego"] .cell.filled.S,
[data-block-style="lego"] .preview-cell.filled.S { background: #32cd32; }
[data-block-style="lego"] .cell.filled.Z,
[data-block-style="lego"] .preview-cell.filled.Z { background: #ff4444; }
[data-block-style="lego"] .cell.filled.J,
[data-block-style="lego"] .preview-cell.filled.J { background: #1e90ff; }
[data-block-style="lego"] .cell.filled.L,
[data-block-style="lego"] .preview-cell.filled.L { background: #ff8c00; }

/* Block Styles - Glass */
[data-block-style="glass"] .game-board .cell.filled {
    overflow: hidden;
}
[data-block-style="glass"] .cell.filled,
[data-block-style="glass"] .preview-cell.filled {
    border: 1px solid rgba(255, 255, 255, 0.45);
    backdrop-filter: blur(8px) saturate(1.35);
    -webkit-backdrop-filter: blur(8px) saturate(1.35);
    box-shadow:
        inset 0 1px 1px rgba(255, 255, 255, 0.55),
        inset 0 -2px 6px rgba(0, 0, 0, 0.12),
        0 2px 8px rgba(0, 0, 0, 0.18);
}
[data-block-style="glass"] .cell.filled.I,
[data-block-style="glass"] .preview-cell.filled.I {
    background: linear-gradient(160deg, rgba(120, 240, 255, 0.42) 0%, rgba(0, 140, 200, 0.38) 100%);
}
[data-block-style="glass"] .cell.filled.O,
[data-block-style="glass"] .preview-cell.filled.O {
    background: linear-gradient(145deg, rgba(255, 240, 140, 0.5) 0%, rgba(220, 160, 0, 0.4) 100%);
}
[data-block-style="glass"] .cell.filled.T,
[data-block-style="glass"] .preview-cell.filled.T {
    background: linear-gradient(155deg, rgba(220, 160, 255, 0.45) 0%, rgba(120, 40, 180, 0.4) 100%);
}
[data-block-style="glass"] .cell.filled.S,
[data-block-style="glass"] .preview-cell.filled.S {
    background: linear-gradient(150deg, rgba(160, 255, 190, 0.42) 0%, rgba(40, 160, 90, 0.38) 100%);
}
[data-block-style="glass"] .cell.filled.Z,
[data-block-style="glass"] .preview-cell.filled.Z {
    background: linear-gradient(150deg, rgba(255, 180, 200, 0.45) 0%, rgba(200, 50, 90, 0.4) 100%);
}
[data-block-style="glass"] .cell.filled.J,
[data-block-style="glass"] .preview-cell.filled.J {
    background: linear-gradient(155deg, rgba(170, 200, 255, 0.45) 0%, rgba(40, 100, 210, 0.4) 100%);
}
[data-block-style="glass"] .cell.filled.L,
[data-block-style="glass"] .preview-cell.filled.L {
    background: linear-gradient(145deg, rgba(255, 210, 160, 0.48) 0%, rgba(220, 110, 30, 0.4) 100%);
}

/* Block Styles - Neon */
[data-block-style="neon"] .cell.filled,
[data-block-style="neon"] .preview-cell.filled {
    background: rgba(12, 14, 28, 0.92);
    border-radius: 3px;
    box-shadow:
        inset 0 0 12px rgba(255, 255, 255, 0.06),
        inset 0 1px 0 rgba(255, 255, 255, 0.12);
}
[data-block-style="neon"] .cell.filled.I,
[data-block-style="neon"] .preview-cell.filled.I {
    border: 2px solid #00f5ff;
    box-shadow:
        0 0 8px #00e5ff,
        0 0 16px rgba(0, 245, 255, 0.45),
        inset 0 0 14px rgba(0, 245, 255, 0.25);
}
[data-block-style="neon"] .cell.filled.O,
[data-block-style="neon"] .preview-cell.filled.O {
    border: 2px solid #fff44f;
    box-shadow:
        0 0 8px #ffe600,
        0 0 18px rgba(255, 238, 0, 0.5),
        inset 0 0 14px rgba(255, 230, 80, 0.2);
}
[data-block-style="neon"] .cell.filled.T,
[data-block-style="neon"] .preview-cell.filled.T {
    border: 2px solid #e056fd;
    box-shadow:
        0 0 8px #da5af0,
        0 0 16px rgba(224, 86, 253, 0.45),
        inset 0 0 14px rgba(224, 86, 253, 0.22);
}
[data-block-style="neon"] .cell.filled.S,
[data-block-style="neon"] .preview-cell.filled.S {
    border: 2px solid #39ff14;
    box-shadow:
        0 0 8px #32e612,
        0 0 16px rgba(57, 255, 20, 0.4),
        inset 0 0 14px rgba(57, 255, 20, 0.2);
}
[data-block-style="neon"] .cell.filled.Z,
[data-block-style="neon"] .preview-cell.filled.Z {
    border: 2px solid #ff2d6a;
    box-shadow:
        0 0 8px #ff1a5c,
        0 0 16px rgba(255, 45, 106, 0.45),
        inset 0 0 14px rgba(255, 45, 106, 0.22);
}
[data-block-style="neon"] .cell.filled.J,
[data-block-style="neon"] .preview-cell.filled.J {
    border: 2px solid #4d9fff;
    box-shadow:
        0 0 8px #3d8fef,
        0 0 16px rgba(77, 159, 255, 0.45),
        inset 0 0 14px rgba(77, 159, 255, 0.22);
}
[data-block-style="neon"] .cell.filled.L,
[data-block-style="neon"] .preview-cell.filled.L {
    border: 2px solid #ff9f1c;
    box-shadow:
        0 0 8px #ff9000,
        0 0 16px rgba(255, 159, 28, 0.45),
        inset 0 0 14px rgba(255, 159, 28, 0.2);
}

/* Block Styles - Metal */
[data-block-style="metal"] .cell.filled,
[data-block-style="metal"] .preview-cell.filled {
    border: 1px solid rgba(255, 255, 255, 0.35);
    box-shadow:
        inset 1px 1px 0 rgba(255, 255, 255, 0.65),
        inset -2px -3px 5px rgba(0, 0, 0, 0.45),
        0 2px 5px rgba(0, 0, 0, 0.35);
}
[data-block-style="metal"] .cell.filled.I,
[data-block-style="metal"] .preview-cell.filled.I {
    background: linear-gradient(168deg, #9eefff 0%, #3aa8c4 28%, #1a6a82 52%, #4cb8d4 78%, #7dd4e8 100%);
}
[data-block-style="metal"] .cell.filled.O,
[data-block-style="metal"] .preview-cell.filled.O {
    background: linear-gradient(168deg, #fff6a8 0%, #d4b020 28%, #8a6a08 52%, #c9a428 78%, #ede090 100%);
}
[data-block-style="metal"] .cell.filled.T,
[data-block-style="metal"] .preview-cell.filled.T {
    background: linear-gradient(168deg, #e8c4ff 0%, #9a4ec8 28%, #5a2088 52%, #8840b0 78%, #c090e0 100%);
}
[data-block-style="metal"] .cell.filled.S,
[data-block-style="metal"] .preview-cell.filled.S {
    background: linear-gradient(168deg, #c8ffc8 0%, #4cb85a 28%, #206830 52%, #50a860 78%, #90d898 100%);
}
[data-block-style="metal"] .cell.filled.Z,
[data-block-style="metal"] .preview-cell.filled.Z {
    background: linear-gradient(168deg, #ffc8d0 0%, #d05068 28%, #882038 52%, #b04058 78%, #e898a8 100%);
}
[data-block-style="metal"] .cell.filled.J,
[data-block-style="metal"] .preview-cell.filled.J {
    background: linear-gradient(168deg, #c8dcff 0%, #5080d8 28%, #2848a0 52%, #4068c0 78%, #90b0f0 100%);
}
[data-block-style="metal"] .cell.filled.L,
[data-block-style="metal"] .preview-cell.filled.L {
    background: linear-gradient(168deg, #ffe0b0 0%, #e09030 28%, #985010 52%, #c87828 78%, #f0c070 100%);
}

/* Block Styles - Carbon fiber */
[data-block-style="carbon"] .cell.filled,
[data-block-style="carbon"] .preview-cell.filled {
    border: 1px solid rgba(255, 255, 255, 0.12);
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.15),
        inset 0 -2px 6px rgba(0, 0, 0, 0.5),
        0 2px 4px rgba(0, 0, 0, 0.4);
}
[data-block-style="carbon"] .cell.filled.I,
[data-block-style="carbon"] .preview-cell.filled.I {
    background-image:
        repeating-linear-gradient(45deg, rgba(255, 255, 255, 0.04) 0 1px, transparent 1px 5px),
        repeating-linear-gradient(-45deg, rgba(0, 0, 0, 0.35) 0 1px, transparent 1px 5px),
        linear-gradient(145deg, #1a4a58 0%, #0a2830 45%, #143842 100%);
}
[data-block-style="carbon"] .cell.filled.O,
[data-block-style="carbon"] .preview-cell.filled.O {
    background-image:
        repeating-linear-gradient(45deg, rgba(255, 255, 255, 0.04) 0 1px, transparent 1px 5px),
        repeating-linear-gradient(-45deg, rgba(0, 0, 0, 0.35) 0 1px, transparent 1px 5px),
        linear-gradient(145deg, #6a5818 0%, #3a3010 45%, #504018 100%);
}
[data-block-style="carbon"] .cell.filled.T,
[data-block-style="carbon"] .preview-cell.filled.T {
    background-image:
        repeating-linear-gradient(45deg, rgba(255, 255, 255, 0.04) 0 1px, transparent 1px 5px),
        repeating-linear-gradient(-45deg, rgba(0, 0, 0, 0.35) 0 1px, transparent 1px 5px),
        linear-gradient(145deg, #4a2860 0%, #281438 45%, #382050 100%);
}
[data-block-style="carbon"] .cell.filled.S,
[data-block-style="carbon"] .preview-cell.filled.S {
    background-image:
        repeating-linear-gradient(45deg, rgba(255, 255, 255, 0.04) 0 1px, transparent 1px 5px),
        repeating-linear-gradient(-45deg, rgba(0, 0, 0, 0.35) 0 1px, transparent 1px 5px),
        linear-gradient(145deg, #285830 0%, #143820 45%, #1e4828 100%);
}
[data-block-style="carbon"] .cell.filled.Z,
[data-block-style="carbon"] .preview-cell.filled.Z {
    background-image:
        repeating-linear-gradient(45deg, rgba(255, 255, 255, 0.04) 0 1px, transparent 1px 5px),
        repeating-linear-gradient(-45deg, rgba(0, 0, 0, 0.35) 0 1px, transparent 1px 5px),
        linear-gradient(145deg, #582028 0%, #381018 45%, #481820 100%);
}
[data-block-style="carbon"] .cell.filled.J,
[data-block-style="carbon"] .preview-cell.filled.J {
    background-image:
        repeating-linear-gradient(45deg, rgba(255, 255, 255, 0.04) 0 1px, transparent 1px 5px),
        repeating-linear-gradient(-45deg, rgba(0, 0, 0, 0.35) 0 1px, transparent 1px 5px),
        linear-gradient(145deg, #283868 0%, #142048 45%, #1c2858 100%);
}
[data-block-style="carbon"] .cell.filled.L,
[data-block-style="carbon"] .preview-cell.filled.L {
    background-image:
        repeating-linear-gradient(45deg, rgba(255, 255, 255, 0.04) 0 1px, transparent 1px 5px),
        repeating-linear-gradient(-45deg, rgba(0, 0, 0, 0.35) 0 1px, transparent 1px 5px),
        linear-gradient(145deg, #684018 0%, #402810 45%, #503818 100%);
}

/* Row clear — explosion */
@keyframes rowClearExplode {
    0% {
        transform: scale(1) rotate(0deg);
        opacity: 1;
        filter: brightness(1);
        box-shadow: 0 0 0 0 rgba(255, 255, 255, 0.6);
    }
    15% {
        transform: scale(1.12) rotate(-3deg);
        filter: brightness(1.8) saturate(1.3);
        box-shadow: 0 0 14px 4px var(--accent-glow), 0 0 0 2px rgba(255, 255, 255, 0.5);
    }
    35% {
        transform: scale(1.2) rotate(4deg);
        filter: brightness(2) saturate(1.5);
        box-shadow: 0 0 28px 12px rgba(255, 255, 255, 0.35);
    }
    70% {
        transform: scale(0.65) rotate(12deg);
        opacity: 0.75;
        filter: blur(1px) brightness(1.4);
        box-shadow: 0 0 40px 16px rgba(255, 255, 255, 0.2);
    }
    100% {
        transform: scale(0) rotate(22deg);
        opacity: 0;
        filter: blur(4px) brightness(0.8);
        box-shadow: 0 0 0 0 transparent;
    }
}

.cell.clearing {
    animation: rowClearExplode 0.58s cubic-bezier(0.4, 0, 0.2, 1) forwards;
    z-index: 2;
}

/* Ghost Piece */
.cell.ghost {
    background: var(--bg-tertiary);
    border: 2px dashed var(--text-secondary);
    opacity: 0.4;
}

/* Game Over Overlay */
.game-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.85);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 100;
    backdrop-filter: blur(8px);
}

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

.overlay-content {
    background: var(--bg-secondary);
    padding: 40px 50px;
    border-radius: 20px;
    text-align: center;
    border: 1px solid var(--border);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
    animation: overlayIn 0.4s ease-out;
}

@keyframes overlayIn {
    from { transform: scale(0.8); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}

.overlay-title {
    font-family: 'Orbitron', sans-serif;
    font-size: 2rem;
    font-weight: 900;
    margin-bottom: 15px;
    background: linear-gradient(135deg, var(--accent), #ff6644);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.overlay-score {
    font-size: 1.2rem;
    color: var(--text-secondary);
    margin-bottom: 25px;
}

.overlay-score span {
    color: var(--accent);
    font-family: 'Orbitron', sans-serif;
    font-weight: 700;
}

/* Pause indicator */
.pause-indicator {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-family: 'Orbitron', sans-serif;
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--accent);
    text-shadow: 0 0 20px var(--accent-glow);
    display: none;
}

.game-board-wrapper.paused .pause-indicator {
    display: block;
}

/* Mobile Controls */
.mobile-controls {
    display: none;
    gap: 10px;
    margin-top: 15px;
}

.mobile-btn {
    width: 60px;
    height: 60px;
    border-radius: 12px;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    color: var(--text-primary);
    font-size: 1.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.15s ease;
    -webkit-tap-highlight-color: transparent;
}

.mobile-btn:active {
    background: var(--accent);
    color: #000;
    transform: scale(0.95);
}

.mobile-row {
    display: flex;
    gap: 10px;
    justify-content: center;
}

/* Responsive */
@media (max-width: 768px) {
    .main-area {
        flex-direction: column;
        align-items: center;
    }

    .side-panel {
        flex-direction: row;
        flex-wrap: wrap;
        justify-content: center;
        min-width: auto;
    }

    .panel-card {
        padding: 15px;
    }

    .cell {
        width: 24px;
        height: 24px;
    }

    .mobile-controls {
        display: flex;
        flex-direction: column;
        align-items: center;
    }

    .header {
        flex-direction: column;
        gap: 15px;
    }

    .controls-header {
        flex-wrap: wrap;
        justify-content: center;
    }
}

@media (max-width: 400px) {
    .cell {
        width: 20px;
        height: 20px;
    }

    .logo {
        font-size: 1.4rem;
    }
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}
