:root {
    --neon-red: #ff003c;
    --neon-cyan: #00f3ff;
    --neon-yellow: #fff200;
    --dark-bg: #050002;
    --text-main: #e0e0e0;
}

* { box-sizing: border-box; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; }

body {
    margin: 0; padding: 0; background-color: var(--dark-bg); color: var(--text-main);
    font-family: 'Courier New', Courier, monospace; display: flex; justify-content: center; align-items: center;
    height: 100vh; overflow: hidden; transition: background-color 0.15s ease-out;
}

body::after {
    content: " "; display: block; position: absolute; top: 0; left: 0; bottom: 0; right: 0;
    background: linear-gradient(rgba(18, 16, 16, 0) 50%, rgba(0, 0, 0, 0.25) 50%), linear-gradient(90deg, rgba(255, 0, 0, 0.06), rgba(0, 255, 0, 0.02), rgba(0, 0, 255, 0.06));
    z-index: 9000; background-size: 100% 2px, 3px 100%; pointer-events: none;
}

#subliminal-bg { position: absolute; top: 0; left: 0; width: 100%; height: 100%; background-size: cover; background-position: center; opacity: 0; z-index: 1; pointer-events: none; transition: opacity 0.05s ease-out; }
#subliminal-bg.flash { opacity: 0.5; }

#init-overlay { position: fixed; top: 0; left: 0; width: 100vw; height: 100vh; background-color: rgba(0, 0, 0, 0.98); z-index: 9999; display: flex; justify-content: center; align-items: center; cursor: pointer; transition: opacity 0.4s ease; }
#init-overlay.hidden { opacity: 0; pointer-events: none; }

#game-container { position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; width: 100%; height: 100%; z-index: 10; }

.title { color: var(--neon-red); letter-spacing: 5px; text-shadow: 0 0 15px var(--neon-red); font-size: 2.2rem; margin-bottom: 20px; text-align: center;}
#status-text { font-size: 1.2rem; font-weight: bold; color: #fff; margin-bottom: 15px; height: 30px; text-shadow: 0 0 10px #fff; text-align: center; padding: 0 10px; transition: color 0.3s;}

/* --- СЧЕТЧИК ВОЗБУЖДЕНИЯ --- */
@keyframes edgePulse { 0% { filter: brightness(1); } 50% { filter: brightness(1.3); } 100% { filter: brightness(1); } }
#edge-meter-container {
    width: 80%; max-width: 350px; height: 25px; background: rgba(0,0,0,0.8); border: 2px solid var(--neon-red);
    border-radius: 12px; margin-bottom: 20px; position: relative; overflow: hidden;
    box-shadow: inset 0 0 10px #000, 0 0 15px rgba(255, 0, 60, 0.3);
}
#edge-meter-container.hidden { display: none; }
#edge-meter-fill { height: 100%; width: 0%; background: linear-gradient(90deg, var(--neon-cyan), var(--neon-red)); transition: width 0.3s cubic-bezier(0.25, 0.8, 0.25, 1), background 0.5s; animation: edgePulse 2s infinite; }
#edge-text { position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); font-size: 0.9rem; font-weight: bold; color: #fff; text-shadow: 1px 1px 3px #000; width: 100%; text-align: center; letter-spacing: 2px; }

/* --- HUD РИТМА --- */
#rhythm-hud { display: flex; flex-direction: column; align-items: center; margin-bottom: 25px; width: 100%; max-width: 450px; justify-content: center;}
#rhythm-hud.hidden { display: none; }
#hud-timer { font-size: 1.2rem; color: #666; font-family: 'Courier New', monospace; margin-bottom: 10px; }

/* --- RHYTHM TIMELINE UI (НОВОЕ!) --- */
#rhythm-tracker-ui { width: 95%; margin-bottom: 20px; }
.tracker-header { 
    display: flex; justify-content: space-between; font-family: 'Courier New', monospace; 
    color: #fff; font-size: 0.9rem; font-weight: bold; background: rgba(0,0,0,0.7); 
    padding: 8px 15px; border: 2px solid var(--neon-cyan); border-bottom: none; 
    border-radius: 8px 8px 0 0; letter-spacing: 1px;
}
#timeline-wrapper { 
    position: relative; width: 100%; height: 50px; background: rgba(10, 0, 5, 0.9); 
    border: 2px solid var(--neon-cyan); border-radius: 0 0 8px 8px; overflow: hidden; 
    box-shadow: inset 0 0 20px #000, 0 0 15px rgba(0, 243, 255, 0.2); 
}
#timeline-center-line { position: absolute; top: 50%; left: 0; right: 0; height: 2px; background: rgba(255,255,255,0.2); transform: translateY(-50%); z-index: 1; }
#hit-zone { 
    position: absolute; left: 20%; top: 0; bottom: 0; width: 4px; background: #fff; 
    box-shadow: 0 0 15px #fff; z-index: 5; transition: transform 0.1s, box-shadow 0.1s, background 0.1s;
}
#hit-zone.flash { transform: scaleX(2.5); background: var(--neon-cyan); box-shadow: 0 0 30px var(--neon-cyan); }
#timeline-scroll { position: absolute; top: 0; left: 20%; height: 100%; width: 200%; display: flex; z-index: 2; }
.timeline-bar { width: 50%; height: 100%; position: relative; } 
.rhythm-note { 
    position: absolute; top: 50%; width: 22px; height: 22px; 
    border: 2px solid #fff; z-index: 3;
    /* Якорь по центру */
    transform: translate(-50%, -50%) rotate(45deg); 
}
.note-star { transform: translate(-50%, -50%) rotate(0deg); border-radius: 50%; width: 18px; height: 18px; }

#hud-command { font-size: 3.5rem; font-weight: bold; font-family: 'Arial Black', Impact, sans-serif; color: var(--neon-red); text-transform: uppercase; text-shadow: 0 0 30px var(--neon-red); margin-bottom: 5px; line-height: 1; transition: color 0.3s, text-shadow 0.3s; text-align: center;}
#hud-sub { font-size: 1.1rem; color: var(--neon-cyan); letter-spacing: 3px; font-weight: bold; text-shadow: 0 0 10px var(--neon-cyan); text-align: center; transition: color 0.3s;}

/* ВЫПРЫГИВАНИЕ КОМАНДЫ */
@keyframes popIn { 0% { transform: scale(0.8); opacity: 0.5; } 50% { transform: scale(1.1); } 100% { transform: scale(1); opacity: 1; } }
.pop-anim { animation: popIn 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards !important; }
.pulse-text { animation: pulseTextAnim 0.483s infinite alternate; }
@keyframes pulseTextAnim { 0% { transform: scale(0.95); opacity: 0.8; } 100% { transform: scale(1.02); opacity: 1; text-shadow: 0 0 40px currentColor; } }

/* ФИЗИЧЕСКАЯ ЖИДКАЯ КНОПКА */
#touch-zone {
    width: 220px; height: 220px; border: 3px dashed var(--neon-red); border-radius: 50%;
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    cursor: pointer; background: rgba(255, 0, 60, 0.05); margin-top: 10px;
    transition: transform 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275), box-shadow 0.4s ease, background 0.4s ease;
}
#touch-zone.pulse { animation: heartbeat 1.5s infinite; }
#touch-zone.locked { border-style: solid; background: rgba(255, 0, 60, 0.15); transform: scale(0.92) translateY(5px); box-shadow: 0 10px 40px var(--neon-red), inset 0 0 30px rgba(255, 0, 60, 0.6); }
.fingerprint-icon { font-size: 3.5rem; margin-bottom: 10px; opacity: 0.7; transition: opacity 0.3s;}
#touch-zone.locked .fingerprint-icon { opacity: 1; text-shadow: 0 0 20px #fff; }
#touch-zone span { font-weight: bold; color: var(--neon-red); text-align: center; padding: 0 20px; transition: color 0.3s;}
@keyframes heartbeat { 0% { transform: scale(1); box-shadow: 0 0 10px var(--neon-red); } 50% { transform: scale(1.05); box-shadow: 0 0 30px var(--neon-red); } 100% { transform: scale(1); box-shadow: 0 0 10px var(--neon-red); } }

/* РЕАКЦИЯ НА ФРИКЦИЮ (УДАР) */
.friction-hit { transform: scale(0.85) translateY(15px) !important; box-shadow: 0 10px 50px var(--neon-cyan), inset 0 0 40px var(--neon-cyan) !important; border-color: #fff !important; }
.friction-hit span { color: #fff !important; text-shadow: 0 0 20px #fff !important; }

#mic-screen { position: absolute; top: 0; left: 0; width: 100%; height: 100%; background-color: rgba(5, 0, 2, 0.98); display: flex; flex-direction: column; align-items: center; justify-content: center; z-index: 50; text-align: center; padding: 20px; }
#mic-screen.hidden { display: none; }
.mic-icon { font-size: 5rem; margin-bottom: 20px; }
#fail-btn { background: transparent; border: 2px solid #555; color: #555; padding: 10px 20px; font-family: 'Courier New', monospace; font-size: 0.9rem; cursor: pointer; transition: 0.3s; margin-top: 20px;}
#fail-btn:hover { background: #555; color: #000; }

#penalty-screen { position: absolute; top: 0; left: 0; width: 100%; height: 100%; background-color: #2a0000; display: flex; flex-direction: column; align-items: center; justify-content: center; z-index: 100; text-align: center; padding: 20px; }
#penalty-screen.hidden { display: none; }
#penalty-screen p { color: #ffcccc; font-size: 1.2rem; }
.glitch-text { font-size: 3rem; color: #fff; text-shadow: 5px 0 var(--neon-red), -5px 0 var(--neon-cyan); animation: glitch 0.1s infinite; margin-bottom: 20px;}
@keyframes glitch { 0% { transform: translate(0) } 20% { transform: translate(-5px, 5px) } 40% { transform: translate(-5px, -5px) } 60% { transform: translate(5px, 5px) } 80% { transform: translate(5px, -5px) } 100% { transform: translate(0) } }

/* ЭФФЕКТЫ БАСА */
body.bass-pulse { background-color: #2a0010; }
.bass-text { text-shadow: 0 0 50px var(--neon-red), 0 0 80px var(--neon-red) !important; transform: scale(1.15) !important; color: #fff !important; }
.bass-border { border-color: #fff !important; }

@media (max-width: 600px) {
    #hud-command { font-size: 2.5rem; }
    .tracker-header { font-size: 0.8rem; }
}