@import url('https://fonts.googleapis.com/css2?family=JetBrains+Mono:wght@500;800&display=swap');

:root {
    /* Updated by main.js in real-time */
    --current-hue: hsl(180, 100%, 50%);
    --neon-red: #ff003c;
    --bg-black: #050505;
}

* { 
    margin: 0; 
    padding: 0; 
    box-sizing: border-box; 
    -webkit-tap-highlight-color: transparent; 
}

body {
    background-color: var(--bg-black);
    color: white;
    font-family: 'JetBrains Mono', monospace;
    overflow: hidden;
    height: 100vh;
    user-select: none;
    touch-action: none; /* Prevents accidental scrolling/zooming on mobile */
}

/* --- CRT SCANLINE EFFECT --- */
.vfx-layer {
    position: fixed;
    inset: 0;
    z-index: 5;
    pointer-events: none;
    background: linear-gradient(rgba(18, 16, 16, 0) 50%, rgba(0, 0, 0, 0.1) 50%), 
                linear-gradient(90deg, rgba(255, 0, 0, 0.03), rgba(0, 255, 0, 0.01), rgba(0, 0, 255, 0.03));
    background-size: 100% 3px, 3px 100%;
    opacity: 0.6;
}

#game-canvas {
    position: fixed;
    inset: 0;
    z-index: 1;
}

/* --- INTERFACE SCREENS --- */
#start-screen, #death-screen {
    position: fixed;
    inset: 0;
    z-index: 100;
    background: var(--bg-black);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 20px;
    text-align: center;
}

.glitch {
    font-size: clamp(2.5rem, 10vw, 5rem);
    font-weight: 800;
    color: var(--current-hue);
    text-shadow: 3px 0px var(--neon-red), -3px 0px #00ff41;
    letter-spacing: 5px;
    animation: flicker 0.2s infinite alternate;
}

@keyframes flicker {
    0% { opacity: 0.8; transform: skew(0.5deg); }
    100% { opacity: 1; transform: skew(-0.5deg); }
}

/* --- HUD OVERLAY --- */
#ui-overlay {
    position: fixed;
    inset: 0;
    z-index: 10;
    pointer-events: none;
    padding: 20px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

#connection-status {
    width: 100%;
    max-width: 350px;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(10px);
    padding: 20px;
    border: 1px solid var(--current-hue);
    box-shadow: 0 0 20px rgba(0, 0, 0, 1);
}

.status-label { font-size: 0.6rem; letter-spacing: 3px; margin-bottom: 10px; opacity: 0.7; }

#sync-bar-container {
    width: 100%;
    height: 12px;
    background: #111;
    margin-bottom: 5px;
}

#sync-level {
    width: 100%;
    height: 100%;
    background: var(--current-hue);
    box-shadow: 0 0 15px var(--current-hue);
    transition: width 0.3s ease-out;
}

.status-percent { font-size: 1.5rem; font-weight: 800; color: var(--current-hue); }

#game-stats {
    align-self: flex-end;
    text-align: right;
    font-weight: 800;
    text-shadow: 0 0 10px black;
}

/* --- UNIVERSAL INPUT: MOBILE SPACE BAR --- */
#mobile-controls {
    pointer-events: auto;
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    padding-bottom: 30px;
}

#touch-pulse {
    width: 90%;
    max-width: 400px;
    height: 70px;
    background: transparent;
    border: 3px solid var(--current-hue);
    color: var(--current-hue);
    font-family: 'JetBrains Mono', monospace;
    font-weight: 800;
    font-size: 1.2rem;
    box-shadow: 0 0 20px rgba(0, 0, 0, 0.5);
    cursor: pointer;
    transition: 0.1s;
}

#touch-pulse:active {
    background: var(--current-hue);
    color: black;
    transform: scale(0.96);
}

/* --- DANGER MODE --- */
.danger #connection-status {
    border-color: var(--neon-red);
    animation: alarm-shake 0.1s infinite;
}

@keyframes alarm-shake {
    0% { transform: translateX(0); }
    50% { transform: translateX(2px); }
    100% { transform: translateX(-2px); }
}

.hidden { display: none !important; }
