/* Game Over Screen - Cyberpunk Theme */
#gameover {
    display: none; /* Hidden by default, shown by GameOver.js */
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 70; /* Above game canvas */
}

/* Particles canvas for falling debris */
#gameover-particles {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1; /* Lowest layer - behind everything */
    pointer-events: none;
}

/* Dark overlay with cyberpunk gradient and grid */
.gameover-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 2; /* Above particles */
    background: 
        /* Gradient overlay */
        linear-gradient(135deg, rgba(26, 0, 48, 0.3) 0%, rgba(10, 0, 21, 0.3) 100%),
        /* Dark overlay */
        rgba(0, 0, 0, 0.7);
    pointer-events: none;
}

/* Cyberpunk grid overlay */
.gameover-overlay::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: 
        repeating-linear-gradient(
            0deg,
            transparent,
            transparent 39px,
            rgba(0, 255, 255, 0.1) 39px,
            rgba(0, 255, 255, 0.1) 40px
        ),
        repeating-linear-gradient(
            90deg,
            transparent,
            transparent 39px,
            rgba(0, 255, 255, 0.1) 39px,
            rgba(0, 255, 255, 0.1) 40px
        );
    background-size: 100% 100%;
    pointer-events: none;
    animation: gridScroll 8s linear infinite;
}

@keyframes gridScroll {
    0% { background-position: 0 0; }
    100% { background-position: 40px 40px; }
}

/* Scanlines effect */
.gameover-overlay::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: repeating-linear-gradient(
        0deg,
        rgba(0, 255, 255, 0.02) 0px,
        rgba(0, 255, 255, 0.02) 2px,
        transparent 2px,
        transparent 4px
    );
    pointer-events: none;
}

/* Content container */
.gameover-content {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 10; /* Above overlay and particles */
    display: flex;
    flex-direction: column;
    align-items: center;
}

/* Title with glitch effect */
.gameover-title {
    position: relative;
    margin: 0;
    margin-bottom: calc(20px * var(--ui-scale));
}

.title-main {
    display: block;
    font-family: monospace;
    font-size: calc(64px * var(--ui-scale));
    font-weight: bold;
    color: #ff0000;
    text-shadow: 
        0 0 20px #ff0000,
        0 0 40px #ff0000,
        0 0 50px #ff0000;
    animation: titlePulse 2s ease-in-out infinite;
}

/* Glitch overlay with animation */
.title-glitch {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    font-family: monospace;
    font-size: calc(64px * var(--ui-scale));
    font-weight: bold;
    color: #ff00ff;
    opacity: 0.4;
    pointer-events: none;
    animation: glitchShift 0.3s infinite;
}

@keyframes titlePulse {
    0%, 100% { 
        text-shadow: 
            0 0 20px #ff0000,
            0 0 40px #ff0000,
            0 0 50px #ff0000;
    }
    50% { 
        text-shadow: 
            0 0 30px #ff0000,
            0 0 50px #ff0000,
            0 0 70px #ff0000,
            0 0 90px #ff0000;
    }
}

@keyframes glitchShift {
    0% { transform: translate(0, 0); }
    20% { transform: translate(-3px, 2px); }
    40% { transform: translate(3px, -2px); }
    60% { transform: translate(-2px, -1px); }
    80% { transform: translate(2px, 1px); }
    100% { transform: translate(0, 0); }
}

/* Subtitle */
.gameover-subtitle {
    font-family: monospace;
    font-size: calc(24px * var(--ui-scale));
    color: #00ffff;
    text-shadow: 
        0 0 10px #00ffff,
        0 0 20px #00ffff;
    margin: 0;
    margin-bottom: calc(40px * var(--ui-scale));
}

/* Stats box with reveal animation */
.stats-box {
    width: calc(400px * var(--ui-scale));
    background: rgba(10, 0, 32, 0.8);
    border: calc(3px * var(--ui-scale)) solid #00ffff;
    border-radius: calc(8px * var(--ui-scale));
    padding: calc(20px * var(--ui-scale)) calc(30px * var(--ui-scale));
    box-shadow: 
        0 0 calc(15px * var(--ui-scale)) rgba(0, 255, 255, 0.6);
    animation: statsReveal 0.5s ease-out forwards;
    opacity: 0;
}

@keyframes statsReveal {
    0% { 
        opacity: 0;
        transform: scale(0.8);
    }
    100% { 
        opacity: 1;
        transform: scale(1);
    }
}

/* Stat rows with progressive reveal */
.stat-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: calc(20px * var(--ui-scale));
    opacity: 0;
    animation: statFadeIn 0.3s ease-out forwards;
}

.stat-row:last-child {
    margin-bottom: 0;
}

/* Staggered animation delays */
.stat-time { animation-delay: 0.3s; }
.stat-kills { animation-delay: 0.5s; }
.stat-level { animation-delay: 0.7s; }

@keyframes statFadeIn {
    from { 
        opacity: 0;
        transform: translateX(-20px);
    }
    to { 
        opacity: 1;
        transform: translateX(0);
    }
}

.stat-label {
    font-family: monospace;
    font-size: calc(18px * var(--ui-scale));
    color: #ff00ff;
}

.stat-value {
    font-family: monospace;
    font-size: calc(28px * var(--ui-scale));
    font-weight: bold;
    color: #ffffff;
    text-shadow: 0 0 10px #ffffff;
}

/* Buttons */
.gameover-buttons {
    display: flex;
    flex-direction: column;
    align-items: center; /* Center buttons horizontally */
    gap: calc(20px * var(--ui-scale));
    margin-top: calc(40px * var(--ui-scale));
    opacity: 0;
    animation: buttonsFadeIn 0.3s ease-out 0.9s forwards;
}

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

.gameover-btn {
    font-family: monospace;
    font-weight: bold;
    border: calc(3px * var(--ui-scale)) solid;
    border-radius: calc(8px * var(--ui-scale));
    cursor: pointer;
    transition: all 0.2s ease;
    padding: 0; /* Remove padding, use flexbox instead */
    
    /* Perfect centering with flexbox */
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Primary button (PLAY AGAIN) */
.gameover-btn-primary {
    width: calc(300px * var(--ui-scale));
    height: calc(70px * var(--ui-scale));
    font-size: calc(28px * var(--ui-scale));
    background: rgba(10, 0, 32, 0.6);
    border-color: #00ffff;
    color: #00ffff;
    text-shadow: 0 0 calc(5px * var(--ui-scale)) #00ffff;
    box-shadow: 0 0 calc(10px * var(--ui-scale)) rgba(0, 255, 255, 0.3);
}

.gameover-btn-primary:hover {
    background: rgba(0, 255, 255, 0.2);
    border-color: #00ff00;
    color: #ffffff;
    transform: scale(1.05);
    box-shadow: 0 0 calc(20px * var(--ui-scale)) rgba(0, 255, 255, 0.6);
}

/* Secondary button (MENU) */
.gameover-btn-secondary {
    width: calc(250px * var(--ui-scale));
    height: calc(55px * var(--ui-scale));
    font-size: calc(20px * var(--ui-scale));
    background: rgba(10, 0, 32, 0.6);
    border-color: #ff00ff;
    color: #ff00ff;
    text-shadow: 0 0 calc(5px * var(--ui-scale)) #ff00ff;
    box-shadow: 0 0 calc(10px * var(--ui-scale)) rgba(255, 0, 255, 0.3);
}

.gameover-btn-secondary:hover {
    background: rgba(255, 0, 255, 0.2);
    border-color: #ff0099;
    color: #ffffff;
    transform: scale(1.05);
    box-shadow: 0 0 calc(20px * var(--ui-scale)) rgba(255, 0, 255, 0.6);
}

/* Pulsing hint */
.gameover-hint {
    position: fixed; /* Fixed relative to viewport, not parent */
    bottom: calc(50px * var(--ui-scale));
    left: 50%;
    transform: translateX(-50%);
    font-family: monospace;
    font-size: calc(16px * var(--ui-scale));
    color: #ffff00;
    text-shadow: 0 0 10px #ffff00;
    margin: 0;
    z-index: 100; /* Above everything */
    visibility: hidden; /* Hidden until cooldown ends */
    opacity: 0.3; /* Start with low opacity for pulse animation */
    /* Animation added by JS when visible */
}

@keyframes hintPulse {
    0%, 100% { opacity: 0.3; }
    50% { opacity: 0.9; }
}

/* New Record Notification */
.new-record-notification {
    font-family: monospace;
    font-size: calc(32px * var(--ui-scale));
    font-weight: bold;
    color: #ffff00;
    text-shadow: 
        0 0 20px #ffff00,
        0 0 40px #ffff00,
        0 0 60px #ffff00;
    margin-top: calc(20px * var(--ui-scale));
    margin-bottom: calc(10px * var(--ui-scale));
    display: flex;
    align-items: center;
    gap: calc(15px * var(--ui-scale));
    animation: recordPulse 1s ease-in-out infinite;
}

.record-icon {
    font-size: calc(40px * var(--ui-scale));
    color: #ff00ff;
    text-shadow: 0 0 20px #ff00ff;
}

@keyframes recordPulse {
    0%, 100% { 
        transform: scale(1);
        text-shadow: 
            0 0 20px #ffff00,
            0 0 40px #ffff00,
            0 0 60px #ffff00;
    }
    50% { 
        transform: scale(1.1);
        text-shadow: 
            0 0 30px #ffff00,
            0 0 50px #ffff00,
            0 0 80px #ffff00,
            0 0 100px #ffff00;
    }
}

/* High Score Display */
.highscore-display {
    font-family: monospace;
    font-size: calc(18px * var(--ui-scale));
    color: #00ff00;
    text-shadow: 0 0 10px #00ff00;
    margin-top: calc(15px * var(--ui-scale));
    text-align: center;
}