/* =========================================
   ПАЛИТРА CYBERPUNK
   ========================================= */
:root {
    --tip: #ff0055;     
    --shaft: #aa00ff;   
    --full: #00e5ff;    
    --denial: #ff2a00;  
    
    --theme: var(--full);
    --bg-color: #050508;
}

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

body {
    background-color: var(--bg-color); color: #fff;
    font-family: 'Montserrat', sans-serif;
    height: 100vh; width: 100vw; overflow: hidden;
    display: flex; flex-direction: column;
}

/* =========================================
   МЕДИА И ЭФФЕКТЫ
   ========================================= */
.media-container { position: absolute; top: 0; left: 0; width: 100%; height: 100%; z-index: 0; background: #000; }
.media-container video, .media-container img { width: 100%; height: 100%; object-fit: cover; opacity: 0.7; transition: filter 1s ease, opacity 1s ease; }

.vignette {
    position: absolute; top: 0; left: 0; width: 100%; height: 100%;
    background: radial-gradient(circle at center, transparent 10%, rgba(5,5,8,0.95) 100%);
    z-index: 1; pointer-events: none; transition: background 0.5s ease;
}

.denial-overlay {
    position: absolute; top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(20, 0, 0, 0); box-shadow: inset 0 0 150px rgba(255,0,0,0);
    z-index: 2; pointer-events: none; transition: all 0.5s ease;
}
.denial-active { background: rgba(20, 0, 0, 0.5); box-shadow: inset 0 0 150px rgba(255,0,0,0.8); }

.whiteout {
    position: absolute; top: 0; left: 0; width: 100%; height: 100%;
    background: #fff; z-index: 9999; opacity: 0; pointer-events: none;
    transition: opacity 2s ease-out;
}
.whiteout.active { opacity: 1; transition: opacity 0.1s ease-in; }

/* Кнопка Fullscreen */
.fullscreen-btn {
    position: absolute; top: 15px; right: 15px; z-index: 50;
    background: rgba(255,255,255,0.05); border: 1px solid rgba(0, 229, 255, 0.3);
    color: var(--theme); width: 40px; height: 40px; border-radius: 8px;
    font-size: 20px; cursor: pointer; display: flex; justify-content: center; align-items: center;
    backdrop-filter: blur(5px); transition: 0.2s; outline: none;
    box-shadow: 0 0 15px rgba(0, 229, 255, 0.1);
}
.fullscreen-btn:active { transform: scale(0.9); background: rgba(255,255,255,0.2); }

/* =========================================
   UI ИГРЫ
   ========================================= */
.ui-layer {
    position: relative; z-index: 10; width: 100%; height: 100%;
    display: flex; flex-direction: column; justify-content: space-between;
}

.top-hud {
    display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px;
    padding: 20px 65px 20px 20px;
    background: linear-gradient(to bottom, rgba(0,0,0,0.9) 0%, transparent 100%);
}
@media (max-width: 600px) { .top-hud { grid-template-columns: repeat(2, 1fr); padding: 15px 65px 15px 15px; gap: 8px; } }

.hud-item { 
    display: flex; flex-direction: column; align-items: center; text-align: center; 
    background: rgba(10, 10, 15, 0.6); border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px; padding: 10px 5px; backdrop-filter: blur(10px);
}
.hud-label { font-family: 'Share Tech Mono', monospace; font-size: 10px; color: #888; letter-spacing: 1px; text-transform: uppercase; margin-bottom: 5px; }
.hud-value { font-family: 'Orbitron', sans-serif; font-size: 20px; font-weight: 700; color: #fff; text-shadow: 0 0 10px rgba(0,229,255,0.4); }

#ui-status { color: var(--theme); text-shadow: 0 0 15px var(--theme); transition: color 0.3s; }
#ui-timer { font-variant-numeric: tabular-nums; }

.center-zone {
    flex-grow: 1; display: flex; flex-direction: column; justify-content: center; align-items: center;
    pointer-events: none; gap: 15px;
}

/* АБСТРАКТНАЯ СХЕМА */
.visual-guide { display: flex; justify-content: center; align-items: center; height: 140px; margin-bottom: 10px; opacity: 0.9; }
.energy-core {
    width: 30px; height: 130px; 
    border: 2px solid var(--theme); border-radius: 15px;
    position: relative;
    box-shadow: 0 0 15px var(--theme), inset 0 0 10px var(--theme);
    transition: border-color 0.3s, box-shadow 0.3s;
    overflow: hidden; background: rgba(255,255,255,0.05);
}
.core-glow {
    position: absolute; left: 0; width: 100%;
    background: var(--theme);
    box-shadow: 0 0 20px var(--theme), inset 0 0 10px #fff;
    border-radius: 10px;
    transition: top 0.3s, height 0.3s, background 0.3s, box-shadow 0.3s;
    opacity: 0; z-index: 1; will-change: opacity, top, height;
}

@keyframes pulse-denial { 0% { opacity: 0.5; box-shadow: 0 0 10px red, inset 0 0 10px red; } 100% { opacity: 1; box-shadow: 0 0 30px red, inset 0 0 20px red; } }
.energy-core.mode-denial { animation: pulse-denial 1s infinite alternate; border-color: red; }

.command-text {
    font-family: 'Oswald', sans-serif; font-size: 11vw; font-weight: 700;
    text-transform: uppercase; letter-spacing: 4px; color: var(--theme);
    text-shadow: 0 0 40px var(--theme), 0 5px 20px rgba(0,0,0,0.9);
    line-height: 1; transition: color 0.3s, text-shadow 0.3s, transform 0.1s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    text-align: center;
}
@media(min-width: 600px) { .command-text { font-size: 70px; } }
.command-sub {
    font-family: 'Share Tech Mono', monospace; font-size: 16px; color: rgba(255,255,255,0.8); letter-spacing: 4px; 
    text-transform: uppercase; margin-top: 10px; text-shadow: 0 2px 10px rgba(0,0,0,0.9); transition: color 0.3s;
}

.bottom-zone {
    padding: 0 15px 30px 15px; display: flex; flex-direction: column; align-items: center; gap: 20px;
    background: linear-gradient(to top, rgba(0,0,0,0.95) 0%, transparent 100%);
}

/* ТАЙМЛАЙН */
.timeline-wrapper {
    position: relative; width: 100%; max-width: 800px; height: 60px;
    background: rgba(10, 10, 20, 0.6); border-radius: 30px;
    box-shadow: inset 0 0 20px rgba(0,0,0,0.8), 0 10px 30px rgba(0,0,0,0.8);
    border: 1px solid rgba(255,255,255,0.05); backdrop-filter: blur(8px); overflow: hidden;
}
.hit-target {
    position: absolute; top: 50%; left: 15%; transform: translate(-50%, -50%);
    width: 44px; height: 44px; border: 2px solid rgba(255,255,255,0.2); border-radius: 50%; z-index: 6;
    transition: border-color 0.3s, transform 0.1s, box-shadow 0.1s;
}
.hit-target::after {
    content: ''; position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%);
    width: 2px; height: 60px; background: rgba(255,255,255,0.2); border-radius: 1px;
}

.notes-layer { position: absolute; top: 0; left: 0; width: 100%; height: 100%; z-index: 4; }
.note-block {
    position: absolute; top: 50%; transform: translateY(-50%);
    width: 12px; height: 34px; border-radius: 6px;
    background: var(--theme); box-shadow: 0 0 15px var(--theme); will-change: transform;
}

/* КНОПКИ УПРАВЛЕНИЯ */
.controls-bar { display: flex; width: 100%; max-width: 600px; gap: 10px; justify-content: center; z-index: 50; }
.ctrl-btn {
    flex: 1; background: rgba(255,255,255,0.05); border: 1px solid rgba(255,255,255,0.1);
    color: #fff; font-family: 'Orbitron', sans-serif; font-size: 13px; font-weight: 700;
    padding: 15px 5px; border-radius: 8px; cursor: pointer;
    backdrop-filter: blur(10px); transition: 0.2s; text-transform: uppercase; letter-spacing: 1px;
}
.ctrl-btn:active { transform: scale(0.95); background: rgba(255,255,255,0.2); }
.pause-active { border-color: var(--theme); color: var(--theme); text-shadow: 0 0 10px var(--theme); }
.climax-btn { border-color: var(--tip); color: var(--tip); text-shadow: 0 0 10px var(--tip); font-weight: 900; background: rgba(255,0,85,0.05); }
.climax-btn:hover { background: var(--tip); color: #fff; text-shadow: none; box-shadow: 0 0 30px var(--tip); }

/* ОВЕРЛЕИ */
#pause-overlay {
    position: absolute; top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0,0,0,0.85); z-index: 1500; display: none; justify-content: center; align-items: center; flex-direction: column;
    backdrop-filter: blur(10px); cursor: pointer;
}
.pause-text { font-family: 'Orbitron', sans-serif; font-size: 50px; color: #fff; letter-spacing: 10px; text-shadow: 0 0 20px var(--theme); }
.pause-subtext { font-family: 'Share Tech Mono', monospace; font-size: 16px; color: #aaa; margin-top: 15px; letter-spacing: 2px; text-transform: uppercase;}

#start-overlay, #end-overlay, #editor-overlay {
    position: absolute; top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(5,5,10,0.98); z-index: 2000; display: flex; justify-content: center; align-items: center; flex-direction: column; gap: 20px;
}
#end-overlay { display: none; z-index: 3000; backdrop-filter: blur(15px); }
#editor-overlay { display: none; z-index: 2500; justify-content: flex-start; padding: 40px 20px; overflow-y: auto; }

.title-text { font-family: 'Orbitron', sans-serif; font-size: 40px; color: var(--full); text-shadow: 0 0 30px var(--full); text-align: center; line-height: 1.2; letter-spacing: 2px;}

/* Кнопки меню */
.upload-btn, .mode-toggle {
    position: relative; overflow: hidden;
    background: rgba(255,255,255,0.05); border: 1px solid rgba(255,255,255,0.2); color: #fff;
    padding: 15px 30px; font-family: 'Orbitron', sans-serif; font-size: 13px; font-weight: 700; cursor: pointer;
    border-radius: 8px; letter-spacing: 1px; transition: 0.3s; width: 280px; text-align: center;
}
.upload-btn input[type="file"] { position: absolute; top: 0; left: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; }
.mode-toggle:active { background: rgba(255,255,255,0.2); }

.start-btn {
    background: var(--full); border: none; color: #000;
    padding: 20px 40px; font-family: 'Orbitron', sans-serif; font-size: 18px; font-weight: 900; cursor: pointer;
    box-shadow: 0 0 40px var(--full); border-radius: 8px; letter-spacing: 2px;
    transition: 0.3s; width: 280px; text-align: center; text-transform: uppercase;
}
.start-btn:active { transform: scale(0.95); }

.helper-text { color: #888; font-family: 'Share Tech Mono', monospace; font-size: 12px; text-align: center; max-width: 300px; line-height: 1.5; margin: 10px 0;}

/* РЕДАКТОР */
.editor-container {
    display: flex; flex-direction: row; gap: 20px; width: 100%; max-width: 800px; flex-grow: 1; margin-bottom: 20px;
}
@media(max-width: 700px) { .editor-container { flex-direction: column; } }

.editor-sidebar {
    flex: 1; background: rgba(0,0,0,0.5); border: 1px solid var(--theme); border-radius: 8px; padding: 15px;
    font-family: 'Share Tech Mono', monospace;
}
.editor-sidebar h3 { color: var(--theme); margin-bottom: 10px; font-size: 16px; }
.syntax-help { list-style: none; font-size: 12px; color: #ccc; margin-bottom: 20px; }
.syntax-help li { margin-bottom: 8px; }
.syntax-help code { color: #fff; background: rgba(255,255,255,0.1); padding: 2px 5px; border-radius: 3px; font-family: monospace; }

.bpm-control label { display: block; font-size: 12px; color: var(--theme); margin-bottom: 5px; }
.bpm-control input { width: 100%; background: #000; border: 1px solid #555; color: #fff; padding: 10px; font-family: 'Orbitron', sans-serif; font-size: 16px; border-radius: 4px; outline: none; }
.bpm-control input:focus { border-color: var(--theme); box-shadow: 0 0 10px var(--theme); }

#editor-textarea {
    flex: 2; background: rgba(0,0,0,0.8); border: 1px solid #555; border-radius: 8px; padding: 15px;
    color: #fff; font-family: monospace; font-size: 16px; line-height: 1.5; outline: none; resize: none;
}
#editor-textarea:focus { border-color: var(--tip); box-shadow: 0 0 15px rgba(255,0,85,0.3); }

.editor-actions { display: flex; gap: 15px; width: 100%; max-width: 800px; flex-wrap: wrap; justify-content: center; }

.end-stats {
    background: rgba(255,255,255,0.05); padding: 20px 40px; border-radius: 12px; border: 1px solid rgba(255,255,255,0.1);
    text-align: center; font-family: 'Share Tech Mono', monospace; font-size: 16px; color: #aaa; line-height: 2;
}
.end-stats span { font-family: 'Orbitron', sans-serif; font-size: 24px; color: #fff; font-weight: 700; margin-left: 10px; }

.shake-active { animation: screenShake 0.4s infinite; }
@keyframes screenShake { 0% { transform: translate(0px, 0px); } 50% { transform: translate(1px, 2px); } 100% { transform: translate(0px, 0px); } }