/* Reset de estilos */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    user-select: none;
}

body {
    background-color: #0a051b;
    background-image: radial-gradient(circle at center, #1b0c36 0%, #050110 100%);
    color: #ffffff;
    font-family: 'Orbitron', 'Press Start 2P', sans-serif;
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: hidden;
}

/* Contenedor del Juego (Proporción 4:3 adaptada) */
#game-container {
    position: relative;
    width: 800px;
    height: 600px;
    border: 3px solid #ff007f;
    border-radius: 12px;
    box-shadow: 
        0 0 20px rgba(255, 0, 127, 0.4),
        0 0 50px rgba(0, 240, 255, 0.2),
        inset 0 0 20px rgba(255, 0, 127, 0.3);
    background-color: #05010d;
    overflow: hidden;
}

canvas {
    display: block;
    width: 100%;
    height: 100%;
}

/* Efectos retro CRT y Scanlines */
.crt-overlay {
    position: absolute;
    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: 15;
    pointer-events: none;
}

.crt-overlay::after {
    content: " ";
    display: block;
    position: absolute;
    top: 0; left: 0; bottom: 0; right: 0;
    background: radial-gradient(circle, rgba(18, 16, 16, 0) 50%, rgba(0, 0, 0, 0.4) 100%);
    pointer-events: none;
}

@keyframes crt-flicker-anim {
    0% { opacity: 0.985; }
    50% { opacity: 1; }
    100% { opacity: 0.99; }
}

.crt-flicker {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(18, 16, 16, 0.015);
    opacity: 0.95;
    z-index: 16;
    pointer-events: none;
    animation: crt-flicker-anim 0.15s infinite;
}

/* HUD general y pantallas */
.hud-screen {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 10;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    background: rgba(5, 1, 13, 0.85);
    backdrop-filter: blur(4px);
    transition: opacity 0.3s ease;
}

.hud-screen.hidden, .hud-layer.hidden {
    opacity: 0;
    pointer-events: none;
    display: none !important;
}

/* Capa HUD en juego */
.hud-layer {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 5;
    pointer-events: none;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: 20px;
}

.hud-top, .hud-bottom {
    display: flex;
    justify-content: space-between;
    width: 100%;
}

.hud-item {
    font-size: 1.1rem;
    font-weight: 700;
    letter-spacing: 2px;
    text-shadow: 0 0 10px rgba(255, 255, 255, 0.5);
    background: rgba(5, 1, 13, 0.5);
    padding: 8px 16px;
    border-radius: 4px;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.hud-audio-btn {
    position: absolute;
    right: 20px;
    top: 70px;
    z-index: 20;
    pointer-events: auto;
    background: rgba(5, 1, 13, 0.6);
    border: 1px solid #00f0ff;
    border-radius: 50%;
    color: #00f0ff;
    width: 40px;
    height: 40px;
    font-size: 1.2rem;
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
    box-shadow: 0 0 10px rgba(0, 240, 255, 0.3);
    transition: all 0.2s ease;
}

.hud-audio-btn:hover {
    background: #00f0ff;
    color: #05010d;
    box-shadow: 0 0 20px rgba(0, 240, 255, 0.6);
}

/* Estilo del texto retro y neón */
.neon-title {
    font-size: 3rem;
    font-weight: 900;
    letter-spacing: 4px;
    color: #fff;
    text-align: center;
    margin-bottom: 5px;
    position: relative;
    text-shadow: 
        0 0 5px #fff,
        0 0 10px #ff007f,
        0 0 20px #ff007f,
        0 0 40px #ff007f;
}

.neon-title-red {
    font-size: 3rem;
    font-weight: 900;
    letter-spacing: 4px;
    color: #fff;
    text-align: center;
    margin-bottom: 15px;
    position: relative;
    text-shadow: 
        0 0 5px #fff,
        0 0 10px #ff3b30,
        0 0 20px #ff3b30,
        0 0 40px #ff3b30;
}

.subtitle {
    font-size: 1rem;
    letter-spacing: 8px;
    color: #00f0ff;
    margin-bottom: 40px;
    text-shadow: 0 0 8px rgba(0, 240, 255, 0.6);
    text-transform: uppercase;
}

/* Colores de texto neón */
.neon-text-blue {
    color: #00f0ff;
    text-shadow: 0 0 8px rgba(0, 240, 255, 0.8);
}

.neon-text-pink {
    color: #ff007f;
    text-shadow: 0 0 8px rgba(255, 0, 127, 0.8);
}

.neon-text-cyan {
    color: #00f0ff;
    text-shadow: 0 0 8px rgba(0, 240, 255, 0.8);
}

/* Botones neón */
.neon-button {
    font-family: 'Orbitron', sans-serif;
    font-size: 1.2rem;
    font-weight: 700;
    letter-spacing: 3px;
    color: #05010d;
    background-color: #00f0ff;
    border: none;
    border-radius: 6px;
    padding: 15px 35px;
    cursor: pointer;
    box-shadow: 
        0 0 10px rgba(0, 240, 255, 0.5),
        0 0 25px rgba(0, 240, 255, 0.3);
    transition: all 0.2s ease;
    outline: none;
}

.neon-button:hover {
    background-color: #ff007f;
    color: #fff;
    box-shadow: 
        0 0 15px rgba(255, 0, 127, 0.8),
        0 0 30px rgba(255, 0, 127, 0.5);
    transform: scale(1.05);
}

.neon-button:active {
    transform: scale(0.98);
}

/* Guía de controles y Stats */
.controls-guide {
    margin-top: 40px;
    font-size: 0.85rem;
    color: rgba(255, 255, 255, 0.6);
    text-align: center;
    line-height: 1.8;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    padding-top: 20px;
    width: 80%;
    max-width: 400px;
}

.key {
    background: rgba(255, 255, 255, 0.15);
    border: 1px solid rgba(255, 255, 255, 0.3);
    padding: 2px 8px;
    border-radius: 4px;
    color: #00f0ff;
    font-size: 0.75rem;
}

.high-score-display {
    margin-top: 25px;
    font-size: 1.1rem;
    font-weight: 700;
    color: #ff007f;
    letter-spacing: 2px;
    text-shadow: 0 0 8px rgba(255, 0, 127, 0.5);
}

.gameover-stats {
    font-size: 1.3rem;
    margin-bottom: 15px;
    letter-spacing: 2px;
}

/* Responsive adjustment */
@media (max-width: 820px) {
    #game-container {
        width: 95vw;
        height: 71.25vw; /* mantiene relación 4:3 */
    }
    
    .neon-title, .neon-title-red {
        font-size: 2.2rem;
    }
    
    .subtitle {
        font-size: 0.8rem;
        margin-bottom: 25px;
    }
    
    .hud-item {
        font-size: 0.85rem;
        padding: 5px 10px;
    }
}
