/* Full-screen overlay for game over + CRT shutdown */
.gameover-overlay {
    position: fixed;
    inset: 0;
    z-index: 30;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: auto;
    background: #000;
    overflow: hidden;
}

/* CRT "turning off" animation: vertical line collapses to center, then fades */
.gameover-overlay.crt-off::before {
    content: '';
    position: absolute;
    inset: 0;
    background: radial-gradient(circle at center, #ffffff, #88ccff 40%, #000 70%);
    opacity: 0;
    animation: crtShutdown 0.9s ease-out forwards;
}

@keyframes crtShutdown {
    0% {
        opacity: 0;
        transform: scaleY(1);
        box-shadow: 0 0 40px rgba(255, 255, 255, 0.8);
    }
    20% {
        opacity: 1;
        transform: scaleY(1);
    }
    60% {
        opacity: 1;
        transform: scaleY(0.06);
        box-shadow: 0 0 60px rgba(255, 255, 255, 0.9);
    }
    100% {
        opacity: 0;
        transform: scaleY(0.0);
        box-shadow: 0 0 0 rgba(0, 0, 0, 0);
    }
}

/* Centered game over card (appears over the now-dark screen) */
.gameover-inner {
    position: relative;
    padding: 20px 18px 18px;
    max-width: min(420px, 90vw);
    text-align: center;
    background: radial-gradient(circle at top, rgba(0, 0, 0, 0.92), rgba(0, 0, 0, 0.98));
    border-radius: 14px;
    border: 1px solid rgba(136, 204, 255, 0.6);
    box-shadow:
        0 0 28px rgba(0, 0, 0, 0.9),
        0 0 36px rgba(0, 255, 204, 0.28);
    animation: gameoverFadeIn 0.8s ease-out 0.5s forwards;
    opacity: 0;
}

/* Title text */
.gameover-title {
    font-size: clamp(22px, 5vw, 30px);
    letter-spacing: 0.3em;
    text-indent: 0.3em;
    text-transform: uppercase;
    font-weight: 700;
    color: #e6f7ff;
    text-shadow:
        0 0 10px rgba(136, 204, 255, 0.9),
        0 0 24px rgba(0, 255, 204, 0.7);
    margin-bottom: 8px;
}

/* Subtitle text */
.gameover-subtitle {
    font-size: 12px;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: #9fb3c7;
    margin-bottom: 18px;
}

/* Button row */
.gameover-buttons {
    display: flex;
    justify-content: center;
}

/* Return button */
.gameover-btn {
    min-width: 160px;
    min-height: 40px;
    padding: 9px 20px;
    border-radius: 999px;
    border: 1px solid rgba(0, 255, 204, 0.9);
    background: radial-gradient(circle at top, rgba(10, 18, 24, 0.95), rgba(3, 6, 10, 0.98));
    color: #e6f7ff;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    cursor: pointer;
    box-shadow:
        0 0 18px rgba(0, 255, 204, 0.7),
        0 0 30px rgba(136, 204, 255, 0.4);
    transition: background 0.18s ease, transform 0.12s ease, box-shadow 0.18s ease, border-color 0.18s ease;
}

.gameover-btn:hover {
    background: radial-gradient(circle at top, rgba(0, 30, 40, 0.98), rgba(0, 10, 16, 0.99));
    transform: translateY(-1px);
    border-color: rgba(136, 204, 255, 1);
    box-shadow:
        0 0 22px rgba(0, 255, 204, 0.85),
        0 0 40px rgba(136, 204, 255, 0.5);
}

.gameover-btn:active {
    transform: translateY(0);
    box-shadow: 0 0 12px rgba(0, 255, 204, 0.6);
}

@keyframes gameoverFadeIn {
    from {
        opacity: 0;
        transform: translateY(12px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}