#tetris-game-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #000000 0%, #0a0a0a 50%, #000000 100%);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    z-index: 10000;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 20px;
    font-family: 'VT323', monospace;
    clip-path: circle(0% at 50% 50%);
    transition: background 1.2s ease, clip-path 0.6s cubic-bezier(0.7, 0, 0.3, 1);
    overflow: hidden;
}

#tetris-game-overlay.visible {
    clip-path: circle(150% at 50% 50%);
}

#tetris-game-overlay.game-active {
    cursor: none;
}

#tetris-canvas {
    --bg-color: rgba(15, 15, 15, 0.6);
    background: linear-gradient(135deg, var(--bg-color), rgba(25, 25, 25, 0.4));
    border: 3px solid #c586ff;
    border-radius: 12px;
    box-shadow:
        0 0 30px rgba(197, 134, 255, 0.6),
        0 0 60px rgba(197, 134, 255, 0.3),
        inset 0 0 20px rgba(255, 255, 255, 0.05);
    transition: border-color 0.5s ease, box-shadow 0.5s ease, background 0.5s ease;
}

#tetris-game-ui {
    color: #c586ff;
    text-shadow: 0 0 12px rgba(197, 134, 255, 0.7), 0 0 25px rgba(197, 134, 255, 0.4);
    text-align: center;
    backdrop-filter: blur(5px);
    background: rgba(197, 134, 255, 0.05);
    padding: 20px;
    border-radius: 15px;
    border: 1px solid rgba(197, 134, 255, 0.2);
    transition: color 0.5s ease, text-shadow 0.5s ease;
    flex-shrink: 0;
}

#tetris-game-container {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 30px;
    flex-shrink: 0;
}

#tetris-title {
    font-size: 2.8rem;
    margin-bottom: 12px;
    font-weight: 600;
    line-height: 1.2;
}

.milestone-title {
    font-size: 2.8rem;
    font-weight: 600;
    margin-bottom: 5px;
    text-shadow: 
        0 0 12px currentColor,
        0 0 25px currentColor,
        0 0 40px currentColor;
}

.milestone-subtitle {
    font-size: 1.2rem;
    font-style: italic;
    opacity: 0.9;
    text-shadow: 
        0 0 8px currentColor,
        0 0 16px currentColor;
    animation: milestone-subtitle-pulse 3s ease-in-out infinite alternate;
}

@keyframes milestone-subtitle-pulse {
    0% { 
        opacity: 0.7;
        transform: scale(0.98);
    }
    100% { 
        opacity: 1;
        transform: scale(1.02);
    }
}

#tetris-score {
    font-size: 1.6rem;
    margin-bottom: 12px;
}

#tetris-instructions {
    font-size: 1.1rem;
    opacity: 0.8;
}

#tetris-next-piece,
#tetris-hold-piece {
    color: #c586ff;
    text-shadow: 0 0 12px rgba(197, 134, 255, 0.7);
    text-align: center;
    background: rgba(197, 134, 255, 0.05);
    padding: 20px;
    border-radius: 15px;
    border: 1px solid rgba(197, 134, 255, 0.2);
    width: 160px;
}

#next-canvas,
#hold-canvas {
    background: rgba(15, 15, 15, 0.4);
    border-radius: 8px;
    border: 2px solid rgba(197, 134, 255, 0.5);
}

/* JoJo Milestone Effects */

/* Stardust Crusaders - Star Platinum effect */
@keyframes star-platinum-effect {
    0% { 
        box-shadow: 0 0 50px #6495ed, 0 0 80px #4169e1, inset 0 0 20px rgba(100, 149, 237, 0.3); 
        border-color: #6495ed;
    }
    50% { 
        box-shadow: 0 0 80px #6495ed, 0 0 120px #4169e1, inset 0 0 30px rgba(100, 149, 237, 0.5); 
        border-color: #4169e1;
    }
    100% { 
        box-shadow: 0 0 50px #6495ed, 0 0 80px #4169e1, inset 0 0 20px rgba(100, 149, 237, 0.3); 
        border-color: #6495ed;
    }
}

#tetris-game-overlay.milestone-stardust-crusaders-bg #tetris-canvas {
    animation: star-platinum-effect 2s infinite;
}

/* The World Over Heaven effect */
@keyframes za-warudo-flash {
    0%, 100% { 
        background: rgba(148, 0, 211, 0.9);
        box-shadow: 0 0 100px rgba(255, 215, 0, 0.8);
    }
    25% { 
        background: rgba(255, 215, 0, 0.95);
        box-shadow: 0 0 150px rgba(148, 0, 211, 0.8);
    }
    50% { 
        background: rgba(255, 255, 255, 0.95);
        box-shadow: 0 0 200px rgba(255, 215, 0, 1);
    }
    75% { 
        background: rgba(255, 215, 0, 0.95);
        box-shadow: 0 0 150px rgba(148, 0, 211, 0.8);
    }
}

#tetris-game-overlay.milestone-the-world-over-heaven-bg {
    animation: za-warudo-flash 2s infinite;
}

#tetris-game-overlay.milestone-the-world-over-heaven-bg #tetris-canvas {
    animation: za-warudo-flash 2s infinite;
}

/* Block Style Enhancements */
.tetris-blocks-phantom { filter: hue-rotate(0deg) saturate(1.2) brightness(1.1); }
.tetris-blocks-battle { filter: hue-rotate(30deg) saturate(1.3) brightness(1.2); }
.tetris-blocks-stardust { filter: hue-rotate(240deg) saturate(1.4) brightness(1.3); }
.tetris-blocks-diamond { filter: hue-rotate(120deg) saturate(1.2) brightness(1.2); }
.tetris-blocks-golden { filter: hue-rotate(60deg) saturate(1.5) brightness(1.4); }
.tetris-blocks-ocean { filter: hue-rotate(270deg) saturate(1.3) brightness(1.1); }
.tetris-blocks-steel { filter: grayscale(0.3) brightness(1.2) contrast(1.3); }
.tetris-blocks-jojolion { filter: hue-rotate(300deg) saturate(1.4) brightness(1.3); }
.tetris-blocks-heaven { filter: brightness(1.6) saturate(1.5) drop-shadow(0 0 10px gold); }
.tetris-blocks-world { 
    filter: brightness(1.8) saturate(2) drop-shadow(0 0 15px purple); 
    animation: world-glow 1s infinite alternate;
}

@keyframes world-glow {
    0% { filter: brightness(1.8) saturate(2) drop-shadow(0 0 15px purple); }
    100% { filter: brightness(2.2) saturate(2.5) drop-shadow(0 0 25px gold); }
}

/* Miami/Hotline Theme */
body.hotline-miami-theme #tetris-game-overlay {
    background: linear-gradient(135deg, #ff1493 0%, #ff00ff 50%, #00ffff 100%);
    background-size: 400% 400%;
    animation: miami-gradient 4s ease infinite;
}

body.hotline-miami-theme #tetris-canvas {
    border: 4px solid #00ffff;
    background: rgba(0, 0, 0, 0.8);
    box-shadow: 
        0 0 40px rgba(0, 255, 255, 0.8),
        0 0 80px rgba(255, 20, 147, 0.6),
        inset 0 0 20px rgba(255, 255, 255, 0.1);
    border-radius: 4px;
}

body.hotline-miami-theme #tetris-game-ui,
body.hotline-miami-theme #tetris-next-piece,
body.hotline-miami-theme #tetris-hold-piece {
    color: #00ffff;
    background: linear-gradient(135deg, rgba(255, 20, 147, 0.9), rgba(0, 0, 0, 0.8));
    border: 3px solid #00ffff;
    box-shadow: 0 0 20px rgba(0, 255, 255, 0.6);
    text-shadow: 0 0 10px rgba(0, 255, 255, 1);
    font-family: 'Courier New', monospace;
}

body.hotline-miami-theme #next-canvas,
body.hotline-miami-theme #hold-canvas {
    background: rgba(0, 0, 0, 0.7);
    border: 2px solid #00ffff;
    box-shadow: 0 0 15px rgba(0, 255, 255, 0.5);
}

/* Akai Theme */
body.akai-theme #tetris-game-overlay {
    background: linear-gradient(135deg, #8b0000 0%, #dc143c 50%, #ff0000 100%);
    background-size: 200% 200%;
    animation: akai-pulse 3s ease infinite;
}

body.akai-theme #tetris-canvas {
    border: 3px solid #ff0000;
    background: rgba(0, 0, 0, 0.9);
    box-shadow: 
        0 0 30px rgba(255, 0, 0, 0.9),
        0 0 60px rgba(220, 20, 60, 0.7),
        inset 0 0 15px rgba(255, 255, 255, 0.05);
    border-radius: 2px;
}

body.akai-theme #tetris-game-ui,
body.akai-theme #tetris-next-piece,
body.akai-theme #tetris-hold-piece {
    color: #ffffff;
    background: linear-gradient(135deg, rgba(139, 0, 0, 0.95), rgba(0, 0, 0, 0.9));
    border: 2px solid #ff0000;
    box-shadow: 0 0 15px rgba(255, 0, 0, 0.8);
    text-shadow: 0 0 8px rgba(255, 0, 0, 1);
    font-family: 'MS Gothic', monospace;
}

body.akai-theme #next-canvas,
body.akai-theme #hold-canvas {
    background: rgba(0, 0, 0, 0.8);
    border: 2px solid #ff0000;
    box-shadow: 0 0 10px rgba(255, 0, 0, 0.6);
}

/* Star Glitcher Theme */
body.star-glitcher-theme #tetris-game-overlay {
    background: linear-gradient(135deg, #8000ff 0%, #00ffff 50%, #ff00ff 100%);
    background-size: 300% 300%;
    animation: star-glitch 2s linear infinite;
}

body.star-glitcher-theme #tetris-canvas {
    border: 4px solid transparent;
    background: rgba(0, 0, 0, 0.8);
    background-clip: padding-box;
    border-image: linear-gradient(45deg, #8000ff, #00ffff) 1;
    box-shadow: 
        0 0 50px rgba(128, 0, 255, 0.8),
        0 0 100px rgba(0, 255, 255, 0.6),
        inset 0 0 25px rgba(255, 255, 255, 0.1);
    border-radius: 16px;
}

body.star-glitcher-theme #tetris-game-ui,
body.star-glitcher-theme #tetris-next-piece,
body.star-glitcher-theme #tetris-hold-piece {
    color: #ffffff;
    background: linear-gradient(135deg, rgba(128, 0, 255, 0.9), rgba(0, 255, 255, 0.8));
    border: 3px solid transparent;
    background-clip: padding-box;
    border-image: linear-gradient(45deg, #8000ff, #00ffff) 1;
    box-shadow: 0 0 25px rgba(128, 0, 255, 0.7);
    text-shadow: 
        0 0 15px rgba(255, 255, 255, 1),
        0 0 30px rgba(128, 0, 255, 0.8);
    font-family: 'Orbitron', 'VT323', monospace;
}

body.star-glitcher-theme #next-canvas,
body.star-glitcher-theme #hold-canvas {
    background: rgba(0, 0, 0, 0.7);
    border: 2px solid #8000ff;
    box-shadow: 0 0 20px rgba(128, 0, 255, 0.6);
}

/* Frutiger Aero Theme */
body.frutiger-aero-theme #tetris-game-overlay {
    background: linear-gradient(to bottom, #4a90e2 0%, #87ceeb 100%);
    backdrop-filter: blur(10px);
}

body.frutiger-aero-theme #tetris-canvas {
    border: 3px solid rgba(255, 255, 255, 0.8);
    background: rgba(255, 255, 255, 0.2);
    box-shadow: 
        0 10px 40px rgba(0, 0, 0, 0.2), 
        inset 0 2px 5px rgba(255, 255, 255, 0.8),
        0 0 20px rgba(135, 206, 235, 0.4);
    border-radius: 20px;
}

body.frutiger-aero-theme #tetris-game-ui,
body.frutiger-aero-theme #tetris-next-piece,
body.frutiger-aero-theme #tetris-hold-piece {
    color: #003d7a;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.9), rgba(200, 220, 240, 0.8));
    border: 2px solid rgba(255, 255, 255, 0.8);
    box-shadow: 
        0 5px 15px rgba(0, 0, 0, 0.1),
        inset 0 1px 0 rgba(255, 255, 255, 0.9);
    text-shadow: 0 1px 1px rgba(255, 255, 255, 0.7);
    font-family: 'Segoe UI', Arial, sans-serif;
    border-radius: 15px;
}

body.frutiger-aero-theme #next-canvas,
body.frutiger-aero-theme #hold-canvas {
    background: rgba(255, 255, 255, 0.3);
    border: 2px solid rgba(255, 255, 255, 0.7);
    border-radius: 10px;
}

/* Theme Animations */
@keyframes miami-gradient {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

@keyframes akai-pulse {
    0%, 100% { filter: brightness(1); }
    50% { filter: brightness(1.2) saturate(1.3); }
}

@keyframes star-glitch {
    0% { 
        background-position: 0% 50%;
        filter: hue-rotate(0deg);
    }
    25% { 
        background-position: 100% 50%;
        filter: hue-rotate(90deg);
    }
    50% { 
        background-position: 0% 100%;
        filter: hue-rotate(180deg);
    }
    75% { 
        background-position: 100% 0%;
        filter: hue-rotate(270deg);
    }
    100% { 
        background-position: 0% 50%;
        filter: hue-rotate(360deg);
    }
}