/* ============================================================
   Space Invaders – Kula-Szpiegula Arcade
   Neon cyberpunk theme matching the dashboard aesthetics
   ============================================================ */

:root {
    --bg-primary: #0a0e17;
    --bg-secondary: #111827;
    --bg-card: rgba(17, 24, 39, 0.85);
    --border-color: rgba(55, 65, 81, 0.5);
    --border-glow: rgba(59, 130, 246, 0.3);
    --text-primary: #f1f5f9;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;
    --accent-blue: #3b82f6;
    --accent-cyan: #06b6d4;
    --accent-green: #10b981;
    --accent-yellow: #f59e0b;
    --accent-orange: #f97316;
    --accent-red: #ef4444;
    --accent-purple: #8b5cf6;
    --accent-pink: #ec4899;
    --shadow-lg: 0 10px 30px rgba(0, 0, 0, 0.4);
    --shadow-glow: 0 0 20px rgba(59, 130, 246, 0.1);
    --radius: 12px;
    --radius-sm: 8px;
    --font-pixel: 'Press Start 2P', monospace;
    --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    --font-mono: 'JetBrains Mono', 'Fira Code', monospace;
}

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

html,
body {
    width: 100%;
    height: 100%;
    overflow: hidden;
}

body {
    font-family: var(--font-sans);
    background: var(--bg-primary);
    color: var(--text-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    background-image:
        radial-gradient(ellipse at 20% 50%, rgba(59, 130, 246, 0.06) 0%, transparent 50%),
        radial-gradient(ellipse at 80% 20%, rgba(139, 92, 246, 0.06) 0%, transparent 50%),
        radial-gradient(ellipse at 50% 80%, rgba(6, 182, 212, 0.05) 0%, transparent 50%);
}

/* ---- CRT Scanlines ---- */
.scanlines {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 1000;
    background: repeating-linear-gradient(0deg,
            rgba(0, 0, 0, 0.03) 0px,
            rgba(0, 0, 0, 0.03) 1px,
            transparent 1px,
            transparent 3px);
    animation: scanlineFlicker 0.1s infinite;
}

@keyframes scanlineFlicker {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.97;
    }
}

/* ---- Canvas ---- */
#game-canvas {
    display: block;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    box-shadow:
        0 0 40px rgba(59, 130, 246, 0.08),
        0 0 80px rgba(139, 92, 246, 0.05),
        inset 0 0 60px rgba(0, 0, 0, 0.3);
    image-rendering: pixelated;
}

/* ---- Back Link ---- */
.back-link {
    position: fixed;
    top: 16px;
    left: 20px;
    z-index: 1500;
    color: var(--text-muted);
    text-decoration: none;
    font-family: var(--font-mono);
    font-size: 0.8rem;
    padding: 0.35rem 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    background: var(--bg-card);
    backdrop-filter: blur(8px);
    transition: all 0.2s;
}

.back-link:hover {
    color: var(--accent-cyan);
    border-color: var(--accent-cyan);
    box-shadow: 0 0 12px rgba(6, 182, 212, 0.2);
}

/* ---- HUD ---- */
.hud {
    position: fixed;
    top: 16px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 500;
    display: flex;
    gap: 2rem;
    padding: 0.5rem 1.5rem;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 100px;
    backdrop-filter: blur(10px);
    box-shadow: var(--shadow-lg), 0 0 20px rgba(59, 130, 246, 0.08);
}

.hud-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.15rem;
}

.hud-label {
    font-family: var(--font-pixel);
    font-size: 0.5rem;
    color: var(--text-muted);
    letter-spacing: 0.1em;
}

.hud-value {
    font-family: var(--font-pixel);
    font-size: 0.85rem;
    color: var(--accent-cyan);
    text-shadow: 0 0 8px rgba(6, 182, 212, 0.5);
}

.hud-lives .hud-value {
    color: var(--accent-red);
    text-shadow: 0 0 8px rgba(239, 68, 68, 0.5);
    letter-spacing: 0.2em;
}

/* ---- Overlays ---- */
.overlay {
    position: fixed;
    inset: 0;
    z-index: 800;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(10, 14, 23, 0.88);
    backdrop-filter: blur(8px);
    animation: overlayIn 0.3s ease;
}

@keyframes overlayIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

.overlay-content {
    text-align: center;
    animation: contentSlideIn 0.5s ease;
}

@keyframes contentSlideIn {
    from {
        opacity: 0;
        transform: translateY(30px) scale(0.95);
    }

    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* ---- Title Screen ---- */
.game-title {
    font-family: var(--font-pixel);
    font-size: 3rem;
    line-height: 1.3;
    color: var(--accent-cyan);
    text-shadow:
        0 0 20px rgba(6, 182, 212, 0.6),
        0 0 40px rgba(6, 182, 212, 0.3),
        0 0 80px rgba(6, 182, 212, 0.15);
    animation: titleGlow 3s ease-in-out infinite;
}

@keyframes titleGlow {

    0%,
    100% {
        text-shadow: 0 0 20px rgba(6, 182, 212, 0.6), 0 0 40px rgba(6, 182, 212, 0.3);
    }

    50% {
        text-shadow: 0 0 30px rgba(6, 182, 212, 0.8), 0 0 60px rgba(6, 182, 212, 0.5), 0 0 100px rgba(6, 182, 212, 0.2);
    }
}

.title-accent {
    color: var(--accent-purple);
    text-shadow:
        0 0 20px rgba(139, 92, 246, 0.6),
        0 0 40px rgba(139, 92, 246, 0.3);
}

.title-subtitle {
    font-family: var(--font-pixel);
    font-size: 0.6rem;
    color: var(--text-muted);
    letter-spacing: 0.3em;
    margin-top: 1rem;
    margin-bottom: 3rem;
}

/* ---- Controls Info ---- */
.controls-info {
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
    margin-bottom: 3rem;
}

.control-row {
    font-family: var(--font-mono);
    font-size: 0.8rem;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

kbd {
    display: inline-block;
    padding: 0.2rem 0.5rem;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    font-family: var(--font-mono);
    font-size: 0.75rem;
    color: var(--accent-cyan);
    box-shadow: 0 2px 0 rgba(0, 0, 0, 0.3);
    min-width: 2rem;
    text-align: center;
}

/* ---- Prompts ---- */
.start-prompt {
    font-family: var(--font-pixel);
    font-size: 0.7rem;
    color: var(--accent-green);
    text-shadow: 0 0 10px rgba(16, 185, 129, 0.5);
    letter-spacing: 0.1em;
}

.blink {
    animation: blink 1.2s step-end infinite;
}

@keyframes blink {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0;
    }
}

/* ---- Pause Screen ---- */
.pause-title {
    font-family: var(--font-pixel);
    font-size: 2rem;
    color: var(--accent-yellow);
    text-shadow:
        0 0 20px rgba(245, 158, 11, 0.6),
        0 0 40px rgba(245, 158, 11, 0.3);
    margin-bottom: 2rem;
}

/* ---- Game Over Screen ---- */
.gameover-title {
    font-family: var(--font-pixel);
    font-size: 2.5rem;
    color: var(--accent-red);
    text-shadow:
        0 0 20px rgba(239, 68, 68, 0.6),
        0 0 40px rgba(239, 68, 68, 0.3);
    margin-bottom: 2rem;
    animation: gameoverShake 0.5s ease;
}

.highscore-alert {
    font-family: var(--font-pixel);
    font-size: 1.2rem;
    color: var(--accent-yellow);
    text-shadow: 0 0 15px rgba(245, 158, 11, 0.8), 0 0 30px rgba(245, 158, 11, 0.4);
    margin-bottom: 1.5rem;
}

@keyframes gameoverShake {

    0%,
    100% {
        transform: translateX(0);
    }

    20% {
        transform: translateX(-10px);
    }

    40% {
        transform: translateX(10px);
    }

    60% {
        transform: translateX(-5px);
    }

    80% {
        transform: translateX(5px);
    }
}

.final-score {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-bottom: 1.5rem;
}

.final-label {
    font-family: var(--font-pixel);
    font-size: 0.5rem;
    color: var(--text-muted);
    letter-spacing: 0.15em;
    margin-bottom: 0.3rem;
}

.final-value {
    font-family: var(--font-pixel);
    font-size: 1.6rem;
    color: var(--accent-cyan);
    text-shadow: 0 0 12px rgba(6, 182, 212, 0.6);
}

/* ---- Level Up Screen ---- */
.levelup-title {
    font-family: var(--font-pixel);
    font-size: 2.5rem;
    color: var(--accent-green);
    text-shadow:
        0 0 20px rgba(16, 185, 129, 0.6),
        0 0 40px rgba(16, 185, 129, 0.3);
    animation: levelPulse 0.6s ease-in-out 3;
}

@keyframes levelPulse {

    0%,
    100% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.1);
    }
}

.levelup-text {
    font-family: var(--font-pixel);
    font-size: 0.7rem;
    color: var(--text-secondary);
    margin-top: 1rem;
    letter-spacing: 0.2em;
}

.hidden {
    display: none !important;
}

/* ---- Responsive ---- */
@media (max-width: 600px) {
    .game-title {
        font-size: 2rem;
    }

    .hud {
        gap: 1rem;
        padding: 0.4rem 1rem;
    }

    .hud-value {
        font-size: 0.7rem;
    }

    .hud-label {
        font-size: 0.4rem;
    }

    .controls-info {
        font-size: 0.7rem;
    }
}