/* Cosmic Gravity: Neon Runner Styling */

/* Imports */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;600;800&family=Orbitron:wght@400;700;900&display=swap');

:root {
    --bg-dark: #070714;
    --neon-blue: #00f0ff;
    --neon-pink: #ff007f;
    --neon-purple: #9d00ff;
    --neon-yellow: #ffea00;
    --neon-green: #39ff14;
    --glass-bg: rgba(13, 13, 33, 0.7);
    --glass-border: rgba(0, 240, 255, 0.2);
    --text-main: #e2e2ec;
    --text-muted: #8a8a9e;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    user-select: none;
    -webkit-user-select: none;
}

body {
    background-color: var(--bg-dark);
    background-image: 
        radial-gradient(circle at 20% 30%, rgba(157, 0, 255, 0.15) 0%, transparent 40%),
        radial-gradient(circle at 80% 70%, rgba(0, 240, 255, 0.15) 0%, transparent 40%);
    font-family: 'Inter', sans-serif;
    color: var(--text-main);
    min-height: 100vh;
    overflow: hidden;
    display: flex;
    justify-content: center;
    align-items: center;
}

/* Background Scanline & CRT FX */
.scanlines {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(
        rgba(18, 16, 16, 0) 50%, 
        rgba(0, 0, 0, 0.25) 50%
    );
    background-size: 100% 4px;
    z-index: 100;
    pointer-events: none;
}

.crt-vignette {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    box-shadow: inset 0 0 80px rgba(0, 0, 0, 0.8);
    z-index: 101;
    pointer-events: none;
}

/* Main Container */
.game-wrapper {
    position: relative;
    width: 960px;
    height: 540px;
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 
        0 20px 50px rgba(0, 0, 0, 0.6),
        0 0 30px rgba(157, 0, 255, 0.2),
        inset 0 0 15px rgba(0, 240, 255, 0.1);
    border: 2px solid rgba(0, 240, 255, 0.3);
    background-color: #05050d;
}

/* Game Canvas */
#gameCanvas {
    display: block;
    width: 100%;
    height: 100%;
}

/* UI Screens Container */
.ui-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 10;
    pointer-events: none;
}

/* Generic Screen Layer */
.screen {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.4s ease, visibility 0.4s ease;
    pointer-events: auto;
    background: radial-gradient(circle, rgba(10, 10, 25, 0.8) 0%, rgba(5, 5, 15, 0.95) 100%);
    padding: 40px;
    text-align: center;
}

.screen.active {
    opacity: 1;
    visibility: visible;
}

/* HUD Overlay - transparent, clicks pass through */
.hud {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    display: flex;
    justify-content: space-between;
    padding: 20px 30px;
    font-family: 'Orbitron', sans-serif;
    opacity: 0;
    transition: opacity 0.3s ease;
    z-index: 5;
}

.hud.active {
    opacity: 1;
}

.hud-panel {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.hud-label {
    font-size: 11px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 2px;
}

.hud-value {
    font-size: 24px;
    font-weight: 700;
    color: var(--neon-blue);
    text-shadow: 0 0 10px rgba(0, 240, 255, 0.6);
}

.hud-value.pink {
    color: var(--neon-pink);
    text-shadow: 0 0 10px rgba(255, 0, 127, 0.6);
}

.hud-multiplier {
    font-size: 14px;
    color: var(--neon-yellow);
    text-shadow: 0 0 5px rgba(255, 234, 0, 0.5);
    margin-left: 5px;
}

/* Glassmorphism Menus */
.menu-panel {
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: 16px;
    padding: 30px 50px;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    box-shadow: 
        0 15px 35px rgba(0, 0, 0, 0.5),
        0 0 20px rgba(0, 240, 255, 0.1);
    max-width: 500px;
    width: 100%;
    animation: panel-glow 4s infinite alternate;
}

@keyframes panel-glow {
    0% {
        border-color: rgba(0, 240, 255, 0.2);
        box-shadow: 0 15px 35px rgba(0, 0, 0, 0.5), 0 0 15px rgba(0, 240, 255, 0.1);
    }
    100% {
        border-color: rgba(157, 0, 255, 0.4);
        box-shadow: 0 15px 35px rgba(0, 0, 0, 0.5), 0 0 25px rgba(157, 0, 255, 0.2);
    }
}

/* Typography */
h1.game-title {
    font-family: 'Orbitron', sans-serif;
    font-size: 42px;
    font-weight: 900;
    text-transform: uppercase;
    letter-spacing: 4px;
    margin-bottom: 5px;
    background: linear-gradient(to right, var(--neon-blue), var(--neon-pink), var(--neon-purple));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    filter: drop-shadow(0 0 15px rgba(0, 240, 255, 0.5));
    animation: glitch 1.5s infinite linear alternate-reverse;
}

h2.screen-title {
    font-family: 'Orbitron', sans-serif;
    font-size: 32px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 2px;
    color: var(--neon-pink);
    text-shadow: 0 0 15px rgba(255, 0, 127, 0.5);
    margin-bottom: 25px;
}

.subtitle {
    font-size: 13px;
    color: var(--text-muted);
    letter-spacing: 5px;
    text-transform: uppercase;
    margin-bottom: 30px;
}

/* Custom Interactive Controls */
.button-group {
    display: flex;
    flex-direction: column;
    gap: 15px;
    width: 100%;
    margin-top: 15px;
}

.btn {
    font-family: 'Orbitron', sans-serif;
    font-weight: 700;
    font-size: 16px;
    text-transform: uppercase;
    letter-spacing: 2px;
    color: #fff;
    background: linear-gradient(135deg, rgba(0, 240, 255, 0.3) 0%, rgba(157, 0, 255, 0.3) 100%);
    border: 1px solid var(--neon-blue);
    border-radius: 8px;
    padding: 14px 28px;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    box-shadow: 0 0 10px rgba(0, 240, 255, 0.2);
    outline: none;
    position: relative;
    overflow: hidden;
}

.btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(
        90deg,
        transparent,
        rgba(255, 255, 255, 0.2),
        transparent
    );
    transition: 0.5s;
}

.btn:hover::before {
    left: 100%;
}

.btn:hover {
    transform: translateY(-2px);
    background: linear-gradient(135deg, rgba(0, 240, 255, 0.5) 0%, rgba(157, 0, 255, 0.5) 100%);
    border-color: #fff;
    box-shadow: 
        0 5px 15px rgba(0, 240, 255, 0.4),
        0 0 15px rgba(157, 0, 255, 0.3);
}

.btn:active {
    transform: translateY(1px);
    box-shadow: 0 2px 5px rgba(0, 240, 255, 0.2);
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.05);
    border-color: rgba(255, 255, 255, 0.15);
    color: var(--text-main);
    box-shadow: none;
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.15);
    border-color: var(--text-main);
    box-shadow: 0 0 10px rgba(255, 255, 255, 0.1);
}

/* Audio Controls */
.audio-bar {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 15px;
    margin-top: 25px;
    padding-top: 20px;
    border-top: 1px solid rgba(255, 255, 255, 0.06);
    pointer-events: auto;
}

.audio-btn {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text-muted);
    transition: color 0.2s, transform 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.audio-btn:hover {
    color: var(--neon-blue);
    border-color: var(--neon-blue);
    transform: scale(1.08);
}

.audio-btn svg {
    width: 18px;
    height: 18px;
    fill: currentColor;
}

/* High Score display in main menu */
.scores-container {
    display: flex;
    justify-content: space-around;
    margin: 20px 0;
    padding: 15px;
    background: rgba(0, 0, 0, 0.25);
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.03);
}

.score-item {
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.score-val {
    font-family: 'Orbitron', sans-serif;
    font-weight: 700;
    font-size: 18px;
    color: var(--neon-yellow);
}

/* Instructions */
.instructions {
    text-align: left;
    margin: 20px 0;
    font-size: 13px;
    line-height: 1.6;
    color: var(--text-muted);
    background: rgba(0, 0, 0, 0.3);
    padding: 15px;
    border-radius: 8px;
    border-left: 3px solid var(--neon-blue);
}

.instructions strong {
    color: var(--text-main);
}

.key-cap {
    display: inline-block;
    padding: 2px 6px;
    background: #1a1a2e;
    border: 1px solid #3f3f5a;
    border-radius: 4px;
    font-family: 'Orbitron', sans-serif;
    font-size: 10px;
    color: #fff;
    box-shadow: 0 2px 0 #0f0f1d;
    vertical-align: middle;
}

/* Stats on Game Over Screen */
.stats-summary {
    display: flex;
    flex-direction: column;
    gap: 12px;
    width: 100%;
    margin-bottom: 25px;
}

.stat-row {
    display: flex;
    justify-content: space-between;
    font-size: 15px;
    padding: 6px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.stat-label {
    color: var(--text-muted);
}

.stat-value {
    font-weight: 600;
    color: #fff;
}

.stat-value.highlight {
    color: var(--neon-blue);
    text-shadow: 0 0 5px rgba(0, 240, 255, 0.3);
}

/* Pause screen styles */
.pause-indicator {
    font-family: 'Orbitron', sans-serif;
    font-size: 20px;
    color: var(--neon-yellow);
    text-shadow: 0 0 10px rgba(255, 234, 0, 0.5);
    margin-bottom: 20px;
    animation: flash 1s infinite alternate;
}

@keyframes flash {
    0% { opacity: 0.3; }
    100% { opacity: 1; }
}

/* Glitch Title Animation */
@keyframes glitch {
    0% {
        text-shadow: 0.05em 0 0 rgba(255, 0, 0, 0.75),
                    -0.05em -0.025em 0 rgba(0, 255, 0, 0.75),
                    -0.025em 0.05em 0 rgba(0, 0, 255, 0.75);
    }
    14% {
        text-shadow: 0.05em 0 0 rgba(255, 0, 0, 0.75),
                    -0.05em -0.025em 0 rgba(0, 255, 0, 0.75),
                    -0.025em 0.05em 0 rgba(0, 0, 255, 0.75);
    }
    15% {
        text-shadow: -0.05em -0.025em 0 rgba(255, 0, 0, 0.75),
                    0.025em 0.025em 0 rgba(0, 255, 0, 0.75),
                    -0.05em -0.05em 0 rgba(0, 0, 255, 0.75);
    }
    49% {
        text-shadow: -0.05em -0.025em 0 rgba(255, 0, 0, 0.75),
                    0.025em 0.025em 0 rgba(0, 255, 0, 0.75),
                    -0.05em -0.05em 0 rgba(0, 0, 255, 0.75);
    }
    50% {
        text-shadow: 0.025em 0.05em 0 rgba(255, 0, 0, 0.75),
                    0.05em 0 0 rgba(0, 255, 0, 0.75),
                    0 -0.05em 0 rgba(0, 0, 255, 0.75);
    }
    99% {
        text-shadow: 0.025em 0.05em 0 rgba(255, 0, 0, 0.75),
                    0.05em 0 0 rgba(0, 255, 0, 0.75),
                    0 -0.05em 0 rgba(0, 0, 255, 0.75);
    }
    100% {
        text-shadow: -0.025em 0 0 rgba(255, 0, 0, 0.75),
                    -0.025em -0.025em 0 rgba(0, 255, 0, 0.75),
                    -0.025em -0.05em 0 rgba(0, 0, 255, 0.75);
    }
}
