:root {
    --neon-pink: #ff00ff;
    --neon-blue: #00ffff;
    --neon-green: #39ff14;
    --neon-yellow: #ffff00;
    --bg-dark: #0a0a0c;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    /* Pour s'assurer qu'aucun clic ne sélectionne le texte */
    user-select: none;
}

body {
    background-color: #0b0213;
    background-image: 
        linear-gradient(rgba(255, 0, 255, 0.15) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255, 0, 255, 0.15) 1px, transparent 1px);
    background-size: 40px 40px;
    background-position: center bottom;
    color: white;
    font-family: 'Press Start 2P', monospace;
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100vh;
    overflow: hidden;
}

#game-container {
    position: relative;
    width: 800px;
    height: 600px;
    background-color: var(--bg-dark);
    box-shadow: 0 0 50px rgba(0, 255, 255, 0.4), 
                0 0 100px rgba(255, 0, 255, 0.3),
                inset 0 0 60px rgba(0,0,0,1);
    border: 15px solid #111;
    border-radius: 40px; /* Big CRT TV rounded edges */
    overflow: hidden;
}

canvas {
    display: block;
    width: 100%;
    height: 100%;
    image-rendering: pixelated;
    position: absolute;
    top:0; left:0;
    z-index: 1;
}

/* ---------------- CRT EFFECTS ---------------- */

#crt-overlay {
    position: absolute;
    top: 0; left: 0; width: 100%; height: 100%;
    pointer-events: none;
    z-index: 20;
    /* Eclairci ! Facile à voir */
    background: radial-gradient(circle at center, transparent 70%, rgba(0,0,0,0.3) 100%);
    box-shadow: inset 0 0 40px rgba(0,0,0,0.5);
}

#scanlines {
    position: absolute;
    top: 0; left: 0; width: 100%; height: 100%;
    pointer-events: none;
    z-index: 21;
    background: linear-gradient(
        to bottom,
        rgba(255,255,255,0),
        rgba(255,255,255,0) 50%,
        rgba(0,0,0,0.2) 50%,
        rgba(0,0,0,0.2)
    );
    background-size: 100% 4px;
    animation: scroll 10s linear infinite;
}

body::after {
    content: " ";
    display: block;
    position: absolute;
    top: 0; left: 0; bottom: 0; right: 0;
    background: rgba(18, 16, 16, 0.1);
    opacity: 0;
    z-index: 100;
    pointer-events: none;
    animation: flicker 0.15s infinite;
}

@keyframes scroll {
    0% { background-position: 0 0; }
    100% { background-position: 0 400px; }
}

@keyframes flicker {
    0% { opacity: 0.02; }
    50% { opacity: 0.05; }
    100% { opacity: 0.02; }
}

/* ---------------- LAYERS & SCREENS ---------------- */

.overlay-screen {
    position: absolute;
    top:0; left:0; right:0; bottom:0;
    z-index: 10;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    background: rgba(10, 10, 20, 0.85);
    backdrop-filter: blur(10px); /* Glassmorphism glow */
    padding: 40px;
}

.hidden {
    display: none !important;
}

/* Menu Principal */

.game-title {
    font-size: 56px;
    background: linear-gradient(to bottom, #00ffff 0%, #ff00ff 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    text-shadow: 0px 0px 30px rgba(255, 0, 255, 0.6);
    margin-bottom: 60px;
    text-align: center;
    line-height: 1.4;
    font-style: italic;
    transform: skewX(-5deg);
}

.menu-options {
    display: flex;
    flex-direction: column;
    gap: 30px;
    width: 300px;
}

.menu-btn {
    background: linear-gradient(45deg, #ff00ff, #00ffff);
    border: none;
    border-radius: 8px;
    color: #fff;
    font-family: 'Press Start 2P', monospace;
    font-size: 22px;
    padding: 20px 40px;
    cursor: pointer;
    text-shadow: 2px 2px 0px rgba(0,0,0,0.5);
    box-shadow: 0 0 15px rgba(255,0,255,0.5);
    transition: transform 0.15s ease, box-shadow 0.15s ease;
    position: relative;
    z-index: 25; 
    text-transform: uppercase;
}

.menu-btn:hover {
    transform: scale(1.08); /* Effet de zoom fluide et moderne */
    box-shadow: 0 0 30px #00ffff, 0 0 60px #ff00ff;
}

/* Story Screen */

#story-text {
    font-size: 16px;
    color: var(--neon-green);
    text-shadow: 2px 2px 0 #000, 0 0 5px var(--neon-green);
    line-height: 2.2;
    text-align: left;
    width: 100%;
    /* Typewriter spacing */
    min-height: 300px;
}

.typewriter-cursor {
    display: inline-block;
    width: 10px;
    height: 16px;
    background-color: var(--neon-green);
    animation: blinkType 1s linear infinite;
    margin-left: 5px;
}

@keyframes blinkType {
    0%, 49% { opacity: 1; }
    50%, 100% { opacity: 0; }
}

/* In-Game UI */

#ui-layer {
    position: absolute;
    top: 0; left: 0; width: 100%; height: 100%;
    pointer-events: none;
    z-index: 5;
    padding: 20px;
    display: flex;
    flex-direction: column;
}

.top-bar {
    display: flex;
    justify-content: space-between;
    text-shadow: 2px 2px 0 #000, 0 0 10px var(--neon-blue);
    font-size: 16px;
    line-height: 1.5;
}

.score-box { color: var(--neon-blue); }
.level-box { color: var(--neon-green); text-shadow: 2px 2px 0 #000, 0 0 10px var(--neon-green); }
.lives-box { color: var(--neon-pink); text-align: right; text-shadow: 2px 2px 0 #000, 0 0 10px var(--neon-pink); }

#center-message {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
}

#center-message h1 {
    font-size: 40px;
    color: var(--neon-yellow);
    text-shadow: 4px 4px 0 #000, 0 0 20px var(--neon-pink);
    margin-bottom: 20px;
}

#center-message p {
    font-size: 18px;
    color: #fff;
}

.blink {
    animation: blinker 1s linear infinite;
}
@keyframes blinker {
    50% { opacity: 0; }
}
