@import url('https://googleapis.com');
:root { 
    --neon: #00f2ff; 
    --bg: #020508; 
}

body { 
    background: var(--bg); 
    background-image: radial-gradient(circle at center, #0a1a20 0%, var(--bg) 70%);
    color: var(--neon); 
    font-family: 'JetBrains Mono', monospace; 
    margin: 0; 
    overflow: hidden; 
    height: 100vh; 
    display: flex; 
    justify-content: center; 
    align-items: center; 
}

/* 1. ГЛАВНЫЙ КОНТЕЙНЕР */
.glyph-row { 
    display: flex; 
    flex-direction: row;
    gap: 30px; 
    transition: opacity 0.8s ease;
}

.glyph-unit { 
    width: 140px; 
    height: 140px; 
    position: relative; 
    background: rgba(0, 242, 255, 0.03);
    border: 1px solid rgba(0, 242, 255, 0.1);
    border-radius: 12px;
    backdrop-filter: blur(4px);
    display: flex;
    justify-content: center;
    align-items: center;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.glyph-unit:hover {
    background: rgba(0, 242, 255, 0.08);
    border-color: var(--neon);
    transform: translateY(-5px) scale(1.02);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5), 0 0 20px rgba(0, 242, 255, 0.2);
}

path { 
    fill: none; 
    stroke: var(--neon); 
    stroke-width: 1.5; 
    stroke-linecap: round; 
    stroke-linejoin: round;
    filter: drop-shadow(0 0 5px var(--neon)) drop-shadow(0 0 2px #fff);
    transition: stroke 0.3s, stroke-width 0.3s; 
}

/* 2. ТЕКСТ ПОД ГЛИФАМИ */
.glyph-label {
    position: absolute;
    bottom: -40px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 10px;
    letter-spacing: 4px;
    text-transform: uppercase;
    white-space: nowrap;
    min-width: 160px;
    text-align: center;
	font-family: 'Michroma', sans-serif;
    font-size: 10px !important;
}

.char-fixed { color: #fff; text-shadow: 0 0 10px var(--neon); opacity: 1; }
.char-noise { opacity: 0.25; color: var(--neon); }

/* 3. НИЖНИЙ СТАТУС-БАР */
#connection-status {
    position: absolute;
    bottom: 40px;
    left: 50%;
    transform: translateX(-50%);
    text-align: center;
    font-family: 'Courier New', monospace;
    color: var(--neon);
    opacity: 0.6;
    pointer-events: none;
    text-transform: uppercase;
}

.status-meta { 
    font-size: 8px; 
    letter-spacing: 2px; 
    opacity: 0.5; 
    line-height: 1;
}

.status-main { 
    font-size: 14px; 
    letter-spacing: 4px; 
    margin: 10px 0; 
    font-weight: bold; 
    line-height: 1;
    transition: opacity 0.25s ease-in-out;
}

.status-progress-container {
    width: 200px; 
    height: 2px; 
    background: rgba(0, 242, 255, 0.1); 
    margin: 0 auto; 
    margin-bottom: 10px;
}

.status-footer {
    font-size: 8px;
    letter-spacing: 2px;
    opacity: 0.5;
    line-height: 1;
    margin-top: 0; 
}

#status-text {
    white-space: pre;
    display: inline-flex;
    text-shadow: 0 0 10px var(--neon);
}

#status-progress-bar { 
    width: 0%; 
    height: 100%; 
    background: var(--neon); 
    transition: width 0.3s linear; 
}

/* 4. ЭФФЕКТЫ СМЕНЫ */
.fade-out { opacity: 0; filter: blur(10px); }

@keyframes wave-effect {
    0% { transform: scale(1); filter: brightness(1) blur(0); }
    50% { transform: scale(1.05); filter: brightness(2) blur(4px); }
    100% { transform: scale(1); filter: brightness(1) blur(0); }
}

.wave-transition {
    animation: wave-effect 1s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes glitch-subtle {
    0% { transform: translate(0); }
    20% { transform: translate(-2px, 1px); }
    40% { transform: translate(2px, -1px); }
    100% { transform: translate(0); }
}

.signal-glitch {
    animation: glitch-subtle 0.1s infinite;
}

/* 5. СКАНЕР И ДОПЫ */
#timer, #const-timer { font-family: monospace; opacity: 0.4;}

#scanner-line {
    position: fixed; top: 0; left: 0; width: 100%; height: 1px;
    background: linear-gradient(90deg, transparent, var(--neon), transparent);
    opacity: 0.15;
    animation: scanMove 8s linear infinite;
}
@keyframes scanMove { 0% { top: 0; } 100% { top: 100%; } }

.pulse-trigger { animation: singlePulse 0.6s ease-out; }
@keyframes singlePulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.1); filter: brightness(1.5); }
    100% { transform: scale(1); }
}
.status-char {
    transition: opacity 0.1s ease, filter 0.2s ease;
    display: inline-block;
}

/* Состояние ERROR */
.mode-error {
    --neon: #ff3333 !important;
}

.mode-error .glyph-unit {
    border-color: rgba(255, 51, 51, 0.4) !important;
    box-shadow: inset 0 0 15px rgba(255, 51, 51, 0.1);
}

.error-text {
    font-size: 24px;
    font-weight: bold;
    color: #ff3333;
    text-shadow: 0 0 10px #ff3333;
    animation: blinker 0.2s infinite alternate;
}

@keyframes blinker {
    from { opacity: 1; }
    to { opacity: 0.3; }
}

.status-warning {
    color: #ff3333;
    font-weight: bold;
    text-shadow: 0 0 5px #ff3333;
}

#test-error-btn {
    position: fixed;
    top: 20px;
    left: 20px;
    padding: 10px;
    background: #333;
    color: #fff;
    border: 1px solid #555;
    cursor: pointer;
    z-index: 100000;
}

#starfield {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -10 !important; /* Уходим глубоко в фон */
    background: radial-gradient(circle at center, #050b10 0%, #000 100%);
}

.audio-control-fixed {
    position: fixed;
    bottom: 25px;
    left: 25px;
    z-index: 1000;
    font-family: monospace;
    font-size: 10px;
    color: var(--neon);
    text-transform: uppercase;
    letter-spacing: 1px;
    cursor: pointer;
    border: 1px solid rgba(0, 242, 255, 0.2);
    padding: 8px 12px;
    background: rgba(0, 20, 30, 0.5);
    transition: all 0.3s ease;
    user-select: none;
}

.audio-control-fixed:hover {
    background: rgba(0, 242, 255, 0.1);
    border-color: rgba(0, 242, 255, 0.5);
    box-shadow: 0 0 10px rgba(0, 242, 255, 0.2);
}

.audio-control-fixed.active {
    color: #fff;
    border-color: var(--neon);
    text-shadow: 0 0 5px var(--neon);
}

#audio-status-icon {
    margin-right: 8px;
}

/* --- ПАНЕЛЬ ТЕЛЕМЕТРИИ СТАНЦИИ --- */
.telemetry-panel {
    position: fixed !important; /* Вырываем из flex-потока body */
    top: 25px !important;       /* Отступ от верха */
    left: 25px !important;      /* Отступ от левого края */
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
    z-index: 15000;            /* Выше всех элементов станции */
    pointer-events: none;      /* Пропускает клики сквоิзь себя */
    margin: 0 !important;
    padding: 10px;
    background: rgba(0, 0, 0, 0.2); /* Легкая подложка для читаемости */
    border-left: 1px solid rgba(0, 242, 255, 0.3);
}

.telemetry-row {
    display: flex;
    align-items: center;
    font-family: 'JetBrains Mono', monospace;
    font-size: 11px;
    color: var(--neon);
    text-transform: uppercase;
    letter-spacing: 2px;
    white-space: nowrap;
}

/* Иконка-прицел */
.telemetry-svg {
    stroke: var(--neon);
    margin-right: 12px;
    filter: drop-shadow(0 0 5px var(--neon));
    opacity: 0.7;
}

/* Динамические координаты */
#station-coords {
    font-weight: bold;
    color: var(--neon);
    margin-left: 8px;
    min-width: 130px; /* Чтобы текст не "прыгал" */
    transition: all 0.3s ease;
}

/* Статус орбиты */
#orbit-status {
    display: block !important;    /* Переключаем с flex на блочный режим */
    white-space: normal !important; /* Разрешаем перенос строк */
    line-height: 1.4;             /* Добавляем межстрочный интервал */
    margin-top: 4px;              /* Небольшой отступ сверху */
}


/* --- СОСТОЯНИЕ "БЕЗОПАСНАЯ ОРБИТА" (Зеленый код) --- */
.telemetry-panel.safe-orbit-active #station-coords {
    color: #00ff44 !important;
    text-shadow: 0 0 10px #00ff44, 0 0 20px rgba(0, 255, 70, 0.5) !important;
}

.telemetry-panel.safe-orbit-active #orbit-status {
    color: #00ff44 !important;
    opacity: 1;
}

/* Смещение кнопки теста под телеметрию */
#test-error-btn {
    position: fixed !important;
    top: 130px !important; /* Ставим ниже панели телеметрии */
    left: 35px !important;
    z-index: 15001;
}
/* 1. АВАРИЙНЫЙ РЕЖИМ: Меняем значение переменной */
body.emergency-mode {
    --neon: #ff3300 !important;
}

/* 2. ПРИНУДИТЕЛЬНАЯ ПЕРЕКРАСКА ТЕКСТА ТЕЛЕМЕТРИИ */
body.emergency-mode .telemetry-row,
body.emergency-mode #station-coords {
    color: var(--neon) !important;
    text-shadow: 0 0 10px var(--neon) !important;
}

/* 3. ЗЕЛЕНЫЙ ПРИОРИТЕТ (Побеждает даже красный режим) */
/* Пишем максимально длинный путь, чтобы браузер не сомневался */
body.emergency-mode .telemetry-panel.safe-orbit-active #station-coords,
.telemetry-panel.safe-orbit-active #station-coords {
    color: #00ff44 !important;
    text-shadow: 0 0 15px #00ff44 !important;
}

body.emergency-mode .telemetry-panel.safe-orbit-active #orbit-status,
.telemetry-panel.safe-orbit-active #orbit-status {
    color: #00ff44 !important;
}

/* --- ГЛОБАЛЬНЫЙ РЕЖИМ ЧС --- */

/* 1. Вспышка (белый экран) */
#flare-overlay {
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background: #ffffff;
    opacity: 0;
    pointer-events: none;
    z-index: 99999;
    transition: opacity 0.1s ease;
}

/* 2. Смена цветов станции на красный */
body.emergency-mode {
    --neon: #ff2200 !important; /* Перехватываем основной цвет */
    background-color: #1a0500 !important; /* Багровый оттенок фона */
}

/* 3. Покраснение звезд и усиление помех */
body.emergency-mode #starfield {
    filter: sepia(1) saturate(10) hue-rotate(-50deg);
}

body.emergency-mode #overlay-noise {
    opacity: 0.4 !important;
    background: rgba(255, 0, 0, 0.15);
}

/* 4. Тревожное мигание для статуса */
.emergency-blink {
    animation: alert-blink 1s infinite ease-in-out;
}

@keyframes alert-blink {
    0%, 100% { opacity: 1; filter: brightness(1.2); }
    50% { opacity: 0.5; filter: brightness(0.8); }
}

/* Дополнительный эффект: багровый туман по краям экрана */
body.emergency-mode::after {
    content: '';
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    box-shadow: inset 0 0 150px rgba(255, 0, 0, 0.3);
    z-index: 10000;
    pointer-events: none;
    animation: alert-vignette 4s infinite alternate;
}

@keyframes alert-vignette {
    from { opacity: 0.2; }
    to { opacity: 0.6; }
}
#solar-flare-bg {
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background: radial-gradient(circle at 100% 50%, rgba(255, 30, 0, 0.6) 0%, transparent 70%);
    z-index: -1; /* Выше фона, но ниже всего остального */
    pointer-events: none;
    opacity: 0;
    transition: opacity 1s ease;
}

/* Когда активен режим ЧС — показываем этот слой */
body.emergency-mode #solar-flare-bg {
    opacity: 1;
    animation: plasma-pulse 10s infinite alternate ease-in-out;
}

/* НОВЫЙ СЛОЙ ПРОТУБЕРАНЦА */
#solar-flare-bg {
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    /* Красное марево справа */
    background: radial-gradient(circle at 100% 50%, rgba(255, 30, 0, 0.5) 0%, transparent 70%);
    z-index: -1; 
    pointer-events: none;
    opacity: 0;
    transition: opacity 1s ease;
}

/* Красная рамка по краям экрана при аварии */
#emergency-vignette {
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    box-shadow: inset 0 0 150px rgba(255, 0, 0, 0.5);
    z-index: 9999;
    pointer-events: none;
    opacity: 0;
    transition: opacity 1s ease;
}

/* АКТИВАЦИЯ ЭФФЕКТОВ */
body.emergency-mode #solar-flare-bg,
body.emergency-mode #emergency-vignette {
    opacity: 1;
}


/* КОНСАЛЬ */
/* --- СИСТЕМНАЯ КОНСОЛЬ НАВИГАЦИИ (ФИНАЛ) --- */
#nav-console-fixed {
    display: none; /* Скрыто по умолчанию */
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    width: 100vw !important;
    height: 100vh !important;
    background: rgba(0, 5, 10, 0.98) !important;
    z-index: 9999999 !important;
    backdrop-filter: blur(15px) !important;
    align-items: center !important;
    justify-content: center !important;
    flex-direction: column !important;
}

/* Эта надстройка заставит JS-команду 'flex' работать правильно */
#nav-console-fixed[style*="display: flex"] {
    display: flex !important;
}

.nav-internal-box {
    width: 600px;
    padding: 50px;
    border: 1px solid rgba(0, 242, 255, 0.3);
    background: #020508;
    text-align: center;
    box-shadow: 0 0 50px #000;
}