/* cyber.css — киберпанк-оформление всей игры: палитра, компоненты, вход, загрузка, меню,
   лобби, ангар, задания, лидеры, настройки и HUD. Подключается последним (после theme.css).
   Цвета: маджента — главные действия; циан — интерфейс; кислотно-жёлтый — награды и важное; красный — урон и враги. */

:root {
    --cy-bg: #07060f;
    --cy-mag: #ff2bd6;
    --cy-cyan: #00f0ff;
    --cy-acid: #f5ff3b;
    --cy-red: #ff3b5c;
    --cy-txt: #eaf6ff;
    --cy-dim: rgba(234, 246, 255, 0.55);
    --cy-line: rgba(0, 240, 255, 0.22);
    --cy-panel: linear-gradient(160deg, rgba(22, 8, 34, 0.86), rgba(7, 6, 15, 0.92));
    --cy-mono: 'Share Tech Mono', 'Consolas', monospace;
    --cy-disp: 'Orbitron', sans-serif;
    --cy-body: 'Rajdhani', 'Segoe UI', sans-serif;
    --cy-cut: polygon(0 0, calc(100% - 18px) 0, 100% 18px, 100% 100%, 0 100%);
    --cy-cut2: polygon(0 0, calc(100% - 14px) 0, 100% 14px, 100% 100%, 14px 100%, 0 calc(100% - 14px));

    /* Переопределяем переменные theme.css — HUD и старые экраны сразу берут новую палитру */
    --vb-accent: #00f0ff;
    --vb-accent-soft: rgba(0, 240, 255, 0.35);
    --vb-accent-faint: rgba(0, 240, 255, 0.1);
    --vb-warm: #f5ff3b;
    --vb-danger: #ff3b5c;
    --vb-ok: #3bff9d;
    --vb-text: #eaf6ff;
    --vb-text-dim: rgba(234, 246, 255, 0.58);
    --vb-panel: rgba(12, 6, 22, 0.86);
    --vb-panel-strong: rgba(8, 5, 16, 0.94);
    --vb-border: rgba(255, 43, 214, 0.35);
    --vb-radius: 0px;
}

body {
    background: var(--cy-bg);
}

::selection {
    background: var(--cy-mag);
    color: #0b0010;
}

/* ---------- Анимации ---------- */
@keyframes cyIn {
    from { opacity: 0; transform: translateY(12px); }
    to { opacity: 1; transform: none; }
}

@keyframes cyFlicker {
    0%, 90%, 100% { opacity: 1; }
    91% { opacity: 0.4; }
    92% { opacity: 1; }
    94% { opacity: 0.6; }
}

@keyframes cySweep {
    from { transform: translateX(-130%) skewX(-20deg); }
    to { transform: translateX(380%) skewX(-20deg); }
}

@keyframes cyPulse {
    0%, 100% { box-shadow: 0 0 26px rgba(255, 43, 214, 0.45); }
    50% { box-shadow: 0 0 52px rgba(255, 43, 214, 0.8); }
}

@keyframes cyTicker {
    from { transform: translateX(0); }
    to { transform: translateX(-50%); }
}

@keyframes cyBlink {
    50% { opacity: 0; }
}

/* Глитч: цветные «слои» заголовка сдвигаются рывками (класс ставит cyberui.js) */
@keyframes cyGlitch {
    0% { clip-path: polygon(0 10%, 100% 10%, 100% 28%, 0 28%); transform: translate(-6px, 0); }
    25% { clip-path: polygon(0 55%, 100% 55%, 100% 64%, 0 64%); transform: translate(5px, 0); }
    50% { clip-path: polygon(0 30%, 100% 30%, 100% 42%, 0 42%); transform: translate(-3px, 0); }
    75% { clip-path: polygon(0 72%, 100% 72%, 100% 90%, 0 90%); transform: translate(7px, 0); }
    100% { clip-path: polygon(0 40%, 100% 40%, 100% 48%, 0 48%); transform: translate(0, 0); }
}

/* ---------- Общие кнопки, поля, списки ---------- */
#lobbyOverlay button,
#hangarOverlay button,
#settingsOverlay button,
#seasonOverlay button,
#questsOverlay button,
#loginWindow button,
#menuRoomInfo button,
#match-results button,
#loadingRetry {
    font-family: var(--cy-disp) !important;
    font-size: 12px;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--cy-cyan) !important;
    background: rgba(0, 240, 255, 0.06) !important;
    border: 1px solid rgba(0, 240, 255, 0.4) !important;
    border-radius: 0 !important;
    clip-path: var(--cy-cut2);
    transition: background 0.15s, color 0.15s, box-shadow 0.15s;
}

#lobbyOverlay button:hover:not(:disabled),
#hangarOverlay button:hover:not(:disabled),
#settingsOverlay button:hover:not(:disabled),
#seasonOverlay button:hover:not(:disabled),
#questsOverlay button:hover:not(:disabled),
#loginWindow button:hover:not(:disabled),
#menuRoomInfo button:hover {
    color: #fff !important;
    background: rgba(0, 240, 255, 0.2) !important;
    box-shadow: 0 0 18px rgba(0, 240, 255, 0.35) !important;
}

/* Главные действия — маджента со штриховкой */
#loginWindow #loginButton,
#lobbyOverlay #quickPlayButton,
#lobbyOverlay #createRoomButton,
#hangarOverlay #hangarSelectShip,
#lobbyOverlay button.lobby-primary {
    position: relative;
    overflow: hidden;
    min-height: 48px;
    font-weight: 800 !important;
    font-size: 14px !important;
    letter-spacing: 0.24em !important;
    color: #0b0010 !important;
    background:
        repeating-linear-gradient(-45deg, rgba(0, 0, 0, 0.12) 0 8px, transparent 8px 16px),
        var(--cy-mag) !important;
    border: none !important;
    box-shadow: 0 0 30px rgba(255, 43, 214, 0.45);
}

#loginWindow #loginButton:hover,
#lobbyOverlay #quickPlayButton:hover,
#lobbyOverlay #createRoomButton:hover,
#hangarOverlay #hangarSelectShip:hover:not(:disabled),
#lobbyOverlay button.lobby-primary:hover {
    color: #0b0010 !important;
    background:
        repeating-linear-gradient(-45deg, rgba(0, 0, 0, 0.12) 0 8px, transparent 8px 16px),
        #ff5ce0 !important;
    box-shadow: 0 0 44px rgba(255, 43, 214, 0.75) !important;
}

#loginWindow #loginButton::after,
#lobbyOverlay #quickPlayButton::after,
#mainMenuOverlay > #mission1Button::before {
    content: '';
    position: absolute;
    top: 0;
    bottom: 0;
    left: 0;
    width: 26%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.6), transparent);
    animation: cySweep 3.4s ease-in-out infinite;
    pointer-events: none;
}

#hangarOverlay #hangarSelectShip:disabled {
    background: rgba(255, 43, 214, 0.12) !important;
    color: var(--cy-mag) !important;
    box-shadow: none;
}

#roomNameInput,
#loginWindow input,
#lobbyOverlay select,
#settingsOverlay select {
    font-family: var(--cy-mono) !important;
    font-size: 15px !important;
    color: var(--cy-txt) !important;
    background-color: rgba(4, 3, 12, 0.85) !important;
    border: 1px solid var(--cy-line) !important;
    border-radius: 0 !important;
}

#lobbyOverlay select,
#settingsOverlay select {
    appearance: none;
    -webkit-appearance: none;
    padding: 8px 32px 8px 12px !important;
    background: rgba(4, 3, 12, 0.85) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' fill='none' stroke='%23ff2bd6' stroke-width='1.8'/%3E%3C/svg%3E") right 10px center / 11px no-repeat !important;
    cursor: pointer;
}

#lobbyOverlay select option,
#settingsOverlay select option {
    background: #0c0718;
    color: var(--cy-txt);
}

#roomNameInput:focus,
#loginWindow input:focus,
#lobbyOverlay select:focus,
#settingsOverlay select:focus {
    outline: none;
    border-color: var(--cy-mag) !important;
    box-shadow: 0 0 0 1px var(--cy-mag), 0 0 20px rgba(255, 43, 214, 0.3) !important;
}

/* Ползунки и флажки настроек — неон */
#settingsOverlay input[type="range"] {
    accent-color: var(--cy-mag);
}

#settingsOverlay input[type="checkbox"],
#lobbyOverlay input[type="checkbox"] {
    accent-color: var(--cy-mag);
    width: 16px;
    height: 16px;
}

/* ---------- Вход ---------- */
#loginWindow {
    position: fixed !important;
    top: 50% !important;
    left: clamp(24px, 8vw, 140px) !important;
    transform: translateY(-50%) !important;
    width: min(410px, calc(100vw - 32px)) !important;
    max-height: calc(100vh - 24px);
    overflow-y: auto;
    padding: 30px 30px 22px !important;
    text-align: left;
    background: var(--cy-panel) !important;
    border: 1px solid rgba(255, 43, 214, 0.45) !important;
    border-radius: 0 !important;
    clip-path: var(--cy-cut);
    box-shadow: inset 0 0 50px rgba(255, 43, 214, 0.12) !important;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    animation: cyIn 0.6s ease-out both;
}

#loginWindow::before {
    content: 'SECURE://AUTH  ·  NODE EU' !important;
    display: block;
    margin: -10px 0 16px;
    font-family: var(--cy-mono) !important;
    font-size: 10px !important;
    font-weight: normal !important;
    letter-spacing: 0.25em !important;
    text-align: left !important;
    color: var(--cy-dim) !important;
    background: none !important;
    filter: none !important;
    -webkit-text-fill-color: currentColor;
}

#loginWindow::after {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 3px;
    background: var(--cy-mag);
    box-shadow: 0 0 14px var(--cy-mag);
}

.login-brand {
    margin-bottom: 20px;
}

.login-logo,
.menu-brand .menu-title {
    position: relative;
    font-family: var(--cy-disp);
    font-weight: 900;
    font-style: italic;
    letter-spacing: 0.02em;
    line-height: 0.9;
    color: #fff;
    background: none !important;
    -webkit-background-clip: border-box !important;
    background-clip: border-box !important;
    -webkit-text-fill-color: currentColor;
    filter: none !important;
    animation: none;
    text-shadow: 0 0 2px #fff, 0 0 22px rgba(0, 240, 255, 0.85), 0 0 60px rgba(0, 240, 255, 0.35);
}

.login-logo {
    font-size: 44px;
    color: var(--cy-mag);
    text-shadow: 0 0 2px #fff, 0 0 22px var(--cy-mag), 0 0 60px rgba(255, 43, 214, 0.45);
}

.login-logo span {
    display: block;
    color: #fff;
    font-size: 0.86em;
    text-shadow: 0 0 2px #fff, 0 0 22px rgba(0, 240, 255, 0.85), 0 0 60px rgba(0, 240, 255, 0.35);
}

/* Глитч-вспышка: смещённые копии цвета */
.login-logo.glitching,
.menu-title.glitching {
    animation: cyFlicker 0.3s steps(2) 1;
}

.menu-title .cy-glitch {
    position: relative;
    display: inline-block;
}

.menu-title .cy-glitch::before,
.menu-title .cy-glitch::after {
    content: attr(data-t);
    position: absolute;
    left: 0;
    top: 0;
    width: 100%;
    opacity: 0;
    pointer-events: none;
}

.menu-title .cy-glitch::before {
    color: var(--cy-cyan);
}

.menu-title .cy-glitch::after {
    color: var(--cy-mag);
}

.menu-title.glitching .cy-glitch::before {
    opacity: 0.9;
    animation: cyGlitch 0.3s steps(4) 1;
}

.menu-title.glitching .cy-glitch::after {
    opacity: 0.9;
    animation: cyGlitch 0.3s steps(4) 1 reverse;
}

.login-tag {
    margin-top: 12px;
    font-family: var(--cy-mono);
    font-size: 12px;
    letter-spacing: 0.3em;
    color: var(--cy-mag);
    text-shadow: 0 0 10px var(--cy-mag);
}

.login-tag::before {
    content: '// ';
}

#loginWindow h2 {
    display: block;
    margin: 0 0 14px !important;
    padding: 0 !important;
    border: none !important;
    min-width: 0 !important;
    font-family: var(--cy-mono) !important;
    font-size: 13px !important;
    font-weight: normal !important;
    letter-spacing: 0.2em !important;
    text-align: left !important;
    color: var(--cy-cyan) !important;
    text-shadow: none !important;
}

#loginWindow h2::before {
    content: '> ';
}

#loginWindow h2::after {
    content: '█';
    margin-left: 6px;
    animation: cyBlink 1s steps(1) infinite;
}

.login-field {
    position: relative;
    margin: 0 0 12px;
}

/* Префиксы полей как в терминале */
.login-field::before {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    font-family: var(--cy-mono);
    font-size: 12px;
    color: var(--cy-mag);
    pointer-events: none;
}

.login-field.user::before {
    content: 'ID://';
}

.login-field.pass::before {
    content: 'KEY://';
}

#loginWindow input {
    width: 100%;
    height: 48px;
    margin: 0 !important;
    padding: 0 12px 0 64px !important;
    box-shadow: none !important;
}

#loginWindow input::placeholder {
    color: rgba(234, 246, 255, 0.35);
}

#loginError {
    margin: 0 0 8px;
    font-family: var(--cy-mono);
    font-size: 13px;
    color: var(--cy-red) !important;
}

#loginError:not(:empty)::before {
    content: '[ERROR] ';
}

#loginError:empty {
    display: none;
}

#loginWindow button {
    width: 100%;
    margin: 0 0 10px !important;
}

#loginWindow #loginButton {
    height: 52px;
}

#loginWindow #registerButton {
    height: 44px;
}

.login-or {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 4px 0 10px;
    font-family: var(--cy-mono);
    font-size: 11px;
    letter-spacing: 0.3em;
    text-transform: uppercase;
    color: var(--cy-dim);
}

.login-or::before,
.login-or::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--cy-line);
}

/* Гость — жёлтая «предупреждающая» лента */
#loginWindow #guestButton {
    height: 46px;
    color: #0b0010 !important;
    font-weight: 800 !important;
    background: repeating-linear-gradient(-45deg, var(--cy-acid) 0 14px, #d9e000 14px 28px) !important;
    border: none !important;
}

#loginWindow #guestButton:hover {
    color: #0b0010 !important;
    background: repeating-linear-gradient(-45deg, #fbff7a 0 14px, var(--cy-acid) 14px 28px) !important;
    box-shadow: 0 0 26px rgba(245, 255, 59, 0.45) !important;
}

#guestHint {
    margin: 2px 0 0;
    font-family: var(--cy-mono);
    font-size: 12px;
    line-height: 1.4;
    text-align: center;
    color: var(--cy-dim) !important;
}

/* ---------- Загрузка ---------- */
#loadingOverlay {
    background:
        radial-gradient(ellipse at 70% 30%, rgba(255, 43, 214, 0.22), transparent 55%),
        radial-gradient(ellipse at 20% 90%, rgba(0, 240, 255, 0.14), transparent 55%),
        rgba(7, 6, 15, 0.94) !important;
}

#loadingOverlay::after {
    content: '';
    position: absolute;
    inset: 0;
    background: repeating-linear-gradient(0deg, rgba(0, 0, 0, 0.3) 0 1px, transparent 1px 3px);
    pointer-events: none;
}

#loadingOverlay .loading-brand {
    font-family: var(--cy-disp) !important;
    font-weight: 900 !important;
    font-style: italic;
    color: var(--cy-mag) !important;
    background: none !important;
    -webkit-text-fill-color: currentColor;
    text-shadow: 0 0 2px #fff, 0 0 26px var(--cy-mag), 0 0 70px rgba(255, 43, 214, 0.5) !important;
    filter: none !important;
}

#loadingOverlay .loading-box {
    font-family: var(--cy-mono);
    background: var(--cy-panel) !important;
    border: 1px solid rgba(255, 43, 214, 0.4) !important;
    border-radius: 0 !important;
    clip-path: var(--cy-cut);
}

#cyLog {
    margin-bottom: 12px;
    font-family: var(--cy-mono);
    font-size: 12px;
    line-height: 1.6;
    color: var(--cy-cyan);
    min-height: 58px;
}

#cyLog div:last-child::after {
    content: ' █';
    animation: cyBlink 1s steps(1) infinite;
}

#loadingStatus,
#loadingPercent {
    font-family: var(--cy-mono) !important;
}

#loadingPercent {
    color: var(--cy-acid) !important;
}

/* Сегментная полоса загрузки */
#loadingOverlay .loading-bar {
    height: 12px !important;
    border-radius: 0 !important;
    background: rgba(255, 255, 255, 0.06) !important;
}

#loadingFill {
    border-radius: 0 !important;
    background:
        repeating-linear-gradient(90deg, transparent 0 8px, rgba(7, 6, 15, 0.9) 8px 10px),
        linear-gradient(90deg, var(--cy-mag), var(--cy-cyan)) !important;
    box-shadow: 0 0 14px rgba(255, 43, 214, 0.6) !important;
}

#loadingTip {
    font-family: var(--cy-body);
    color: var(--cy-dim) !important;
}

#loadingTip::before {
    content: '// ';
    color: var(--cy-mag);
}

/* ---------- Главное меню ---------- */
#mainMenuOverlay {
    padding-left: clamp(24px, 6.5vw, 110px) !important;
    padding-top: 30px;
    background:
        linear-gradient(90deg, rgba(7, 6, 15, 0.94) 0%, rgba(7, 6, 15, 0.72) 30%, rgba(7, 6, 15, 0.1) 58%, rgba(7, 6, 15, 0.25) 100%) !important;
}

/* Сканлайны и лёгкий шум поверх меню */
#mainMenuOverlay::after {
    content: '';
    position: absolute;
    inset: 0;
    background: repeating-linear-gradient(0deg, rgba(0, 0, 0, 0.22) 0 1px, transparent 1px 3px);
    pointer-events: none;
    z-index: 0;
}

#mainMenuOverlay > * {
    position: relative;
    z-index: 1;
}

.cy-topbar {
    position: absolute !important;
    top: 0;
    left: 0;
    right: 0;
    height: 34px;
    display: flex;
    align-items: center;
    gap: 26px;
    padding: 0 28px;
    font-family: var(--cy-mono);
    font-size: 12px;
    letter-spacing: 0.12em;
    color: var(--cy-dim);
    border-bottom: 1px solid var(--cy-line);
    background: linear-gradient(90deg, rgba(7, 6, 15, 0.92), rgba(7, 6, 15, 0.45));
    box-sizing: border-box;
}

.cy-topbar b {
    color: var(--cy-cyan);
    font-weight: normal;
}

.cy-topbar .cy-ok {
    color: var(--cy-acid);
}

.cy-topbar .off .cy-ok {
    color: var(--cy-red);
}

.cy-dot {
    display: inline-block;
    width: 7px;
    height: 7px;
    margin-right: 8px;
    background: var(--cy-acid);
    box-shadow: 0 0 8px var(--cy-acid);
    animation: cyFlicker 4s infinite;
}

.cy-topbar .off .cy-dot {
    background: var(--cy-red);
    box-shadow: 0 0 8px var(--cy-red);
}

.cy-sp {
    flex: 1;
}

.menu-brand {
    margin-bottom: 26px !important;
    animation: cyIn 0.5s ease-out both;
    pointer-events: none;
}

.menu-tag {
    font-family: var(--cy-mono);
    font-size: 13px;
    letter-spacing: 0.3em;
    color: var(--cy-mag);
    text-shadow: 0 0 10px var(--cy-mag);
    text-transform: uppercase;
}

.menu-brand .menu-title {
    margin-top: 8px;
    font-size: clamp(42px, 6.2vw, 86px) !important;
}

.menu-title .cy-glitch.v {
    color: var(--cy-mag);
    text-shadow: 0 0 2px #fff, 0 0 22px var(--cy-mag), 0 0 60px rgba(255, 43, 214, 0.5);
}

.menu-brand .menu-subtitle {
    display: none;
}

.menu-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 16px;
    font-family: var(--cy-mono);
    font-size: 12px;
    color: var(--cy-dim);
}

.menu-chips span {
    padding: 2px 8px;
    border: 1px solid rgba(0, 240, 255, 0.3);
}

.menu-chips .hot {
    border-color: var(--cy-acid);
    color: var(--cy-acid);
}

/* Пункты меню */
#mainMenuOverlay > button {
    position: relative;
    display: flex !important;
    align-items: center;
    overflow: hidden;
    width: min(430px, 86vw) !important;
    height: 52px;
    margin: 0 0 8px !important;
    padding: 0 0 0 18px !important;
    font-family: var(--cy-disp) !important;
    font-size: clamp(14px, 1.4vw, 18px) !important;
    font-weight: 600 !important;
    letter-spacing: 0.2em !important;
    text-align: left;
    color: var(--cy-dim) !important;
    background: linear-gradient(90deg, rgba(0, 240, 255, 0.07), transparent 85%) !important;
    border: none !important;
    border-left: 2px solid rgba(0, 240, 255, 0.4) !important;
    border-radius: 0 !important;
    clip-path: var(--cy-cut);
    text-shadow: none !important;
    transform: none;
    transition: transform 0.18s ease-out, background 0.18s, color 0.18s !important;
    animation: cyIn 0.45s ease-out both;
}

#mainMenuOverlay > button:nth-of-type(2) { animation-delay: 0.05s; }
#mainMenuOverlay > button:nth-of-type(3) { animation-delay: 0.1s; }
#mainMenuOverlay > button:nth-of-type(4) { animation-delay: 0.15s; }
#mainMenuOverlay > button:nth-of-type(5) { animation-delay: 0.2s; }
#mainMenuOverlay > button:nth-of-type(6) { animation-delay: 0.25s; }
#mainMenuOverlay > button:nth-of-type(7) { animation-delay: 0.3s; }

#mainMenuOverlay > button::after {
    content: none !important;
}

#mainMenuOverlay > button .mi-n {
    width: 42px;
    font-family: var(--cy-mono);
    font-size: 13px;
    letter-spacing: 0.05em;
    color: var(--cy-cyan);
}

#mainMenuOverlay > button .mi-ico {
    width: 30px;
    font-size: 16px;
    color: var(--cy-cyan);
}

#mainMenuOverlay > button .mi-side {
    margin-left: auto;
    margin-right: 22px;
    font-family: var(--cy-mono);
    font-size: 11px;
    letter-spacing: 0.1em;
    color: rgba(234, 246, 255, 0.35);
    white-space: nowrap;
}

#mainMenuOverlay > button:hover,
#mainMenuOverlay > button:focus,
#mainMenuOverlay > button.active-button {
    outline: none;
    transform: translateX(10px) !important;
    color: #fff !important;
    padding-left: 18px !important;
    background: linear-gradient(90deg, rgba(0, 240, 255, 0.28), rgba(0, 240, 255, 0.04) 85%) !important;
    border-left-color: var(--cy-cyan) !important;
    text-shadow: 0 0 12px var(--cy-cyan) !important;
}

/* Полоски-«эквалайзер» справа у выбранного пункта */
#mainMenuOverlay > button:not(#mission1Button):hover::before,
#mainMenuOverlay > button:not(#mission1Button):focus::before,
#mainMenuOverlay > button:not(#mission1Button).active-button::before {
    content: '';
    position: absolute;
    right: 0;
    top: 0;
    bottom: 0;
    width: 120px;
    background: repeating-linear-gradient(90deg, rgba(0, 240, 255, 0.45) 0 2px, transparent 2px 6px);
    -webkit-mask-image: linear-gradient(90deg, transparent, #000);
    mask-image: linear-gradient(90deg, transparent, #000);
    pointer-events: none;
}

#mainMenuOverlay > button:hover .mi-side,
#mainMenuOverlay > button:focus .mi-side,
#mainMenuOverlay > button.active-button .mi-side {
    color: var(--cy-acid);
}

/* «В БОЙ» — маджентовая полоса со штриховкой */
#mainMenuOverlay > #mission1Button {
    height: 74px;
    margin-bottom: 18px !important;
    padding: 0 26px !important;
    font-size: clamp(20px, 2.1vw, 28px) !important;
    font-weight: 900 !important;
    font-style: italic;
    letter-spacing: 0.22em !important;
    color: #0b0010 !important;
    background:
        repeating-linear-gradient(-45deg, rgba(0, 0, 0, 0.12) 0 8px, transparent 8px 16px),
        var(--cy-mag) !important;
    border-left: none !important;
    clip-path: var(--cy-cut2);
    animation: cyIn 0.45s ease-out both, cyPulse 2.6s ease-in-out 0.5s infinite;
}

#mainMenuOverlay > #mission1Button small {
    margin-left: 14px;
    font-family: var(--cy-mono);
    font-style: normal;
    font-weight: normal;
    font-size: 12px;
    letter-spacing: 0.15em;
    opacity: 0.8;
}

#mainMenuOverlay > #mission1Button .mi-arrow {
    margin-left: auto;
    font-size: 20px;
    font-style: normal;
}

#mainMenuOverlay > #mission1Button:hover,
#mainMenuOverlay > #mission1Button:focus,
#mainMenuOverlay > #mission1Button.active-button {
    color: #0b0010 !important;
    text-shadow: none !important;
    padding-left: 26px !important;
    background:
        repeating-linear-gradient(-45deg, rgba(0, 0, 0, 0.12) 0 8px, transparent 8px 16px),
        #ff5ce0 !important;
}

#exitButton {
    color: rgba(255, 59, 92, 0.75) !important;
}

/* В браузере «Выход» не нужен — app.js прячет его встроенным стилем, а правило пунктов меню выше его перебивало */
#mainMenuOverlay > #exitButton[style*="none"] {
    display: none !important;
}

#exitButton .mi-n,
#exitButton .mi-ico {
    color: var(--cy-red) !important;
}

#menuRoomInfo {
    margin: 8px 0 0 !important;
    font-family: var(--cy-mono) !important;
    color: var(--cy-dim);
}

/* Досье пилота */
.cy-dossier {
    position: absolute !important;
    right: 30px;
    top: 62px;
    width: 330px;
    padding: 18px 20px 16px;
    background: linear-gradient(160deg, rgba(22, 8, 34, 0.96), rgba(7, 6, 15, 0.97));
    border: 1px solid rgba(255, 43, 214, 0.42);
    clip-path: var(--cy-cut);
    box-shadow: inset 0 0 40px rgba(255, 43, 214, 0.12);
    font-family: var(--cy-body);
    animation: cyIn 0.6s ease-out 0.15s both;
    pointer-events: none;
    box-sizing: border-box;
}

.cy-dhead {
    display: flex;
    justify-content: space-between;
    margin-bottom: 12px;
    font-family: var(--cy-mono);
    font-size: 11px;
    letter-spacing: 0.2em;
    color: var(--cy-mag);
    text-transform: uppercase;
}

.cy-dossier .menu-player {
    position: static !important;
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 0 !important;
    background: none !important;
    border: none !important;
    box-shadow: none !important;
    backdrop-filter: none;
    font-family: var(--cy-disp);
    font-size: 17px;
    font-weight: 800;
    letter-spacing: 0.06em;
    animation: none;
}

.cy-dossier .menu-player .avatar {
    width: 56px !important;
    height: 56px !important;
    font-size: 24px !important;
    font-weight: 900;
    color: var(--cy-cyan) !important;
    background: rgba(0, 240, 255, 0.08) !important;
    border: 1px solid var(--cy-cyan);
    border-radius: 0 !important;
    clip-path: polygon(0 0, 100% 0, 100% 75%, 75% 100%, 0 100%);
    box-shadow: inset 0 0 18px rgba(0, 240, 255, 0.3) !important;
}

.cy-dossier .menu-player .badge {
    border-radius: 0 !important;
    border-color: var(--cy-acid) !important;
    color: var(--cy-acid) !important;
    font-family: var(--cy-mono) !important;
}

.cy-rank {
    margin: 8px 0 0 70px;
    margin-top: -18px;
    font-family: var(--cy-mono);
    font-size: 12px;
    color: var(--cy-acid);
}

.cy-xp {
    position: relative;
    height: 8px;
    margin: 18px 0 4px;
    background: rgba(255, 255, 255, 0.08);
}

.cy-xp i {
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    background: linear-gradient(90deg, var(--cy-mag), var(--cy-cyan));
    box-shadow: 0 0 10px var(--cy-mag);
    transition: width 0.4s;
}

.cy-xp-text {
    text-align: right;
    font-family: var(--cy-mono);
    font-size: 10px;
    color: var(--cy-dim);
}

.cy-res {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px 14px;
    margin-top: 12px;
    font-family: var(--cy-mono);
    font-size: 13px;
}

.cy-res div {
    display: flex;
    justify-content: space-between;
    padding-bottom: 3px;
    border-bottom: 1px dashed rgba(0, 240, 255, 0.2);
    color: var(--cy-dim);
}

.cy-res b {
    color: var(--cy-cyan);
    font-weight: normal;
}

.cy-contracts {
    margin-top: 16px;
}

.cy-ctitle {
    margin-bottom: 8px;
    font-family: var(--cy-mono);
    font-size: 11px;
    letter-spacing: 0.2em;
    color: var(--cy-acid);
    text-transform: uppercase;
}

.cy-ct {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 7px;
    font-size: 14px;
    font-weight: 600;
}

.cy-ct .txt {
    flex: 1;
}

.cy-ct .bar {
    position: relative;
    flex: 0 0 64px;
    height: 4px;
    background: rgba(255, 255, 255, 0.1);
}

.cy-ct .bar i {
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    background: var(--cy-acid);
    box-shadow: 0 0 6px var(--cy-acid);
}

.cy-ct .mark {
    flex: 0 0 38px;
    text-align: right;
    font-family: var(--cy-mono);
    font-size: 11px;
    color: var(--cy-dim);
}

.cy-ct.done .mark {
    color: var(--cy-acid);
}

.cy-ct.done .txt {
    color: var(--cy-dim);
    text-decoration: line-through;
}

.menu-hints {
    position: absolute !important;
    left: clamp(24px, 6.5vw, 110px);
    bottom: 52px;
    display: flex;
    align-items: center;
    gap: 8px;
    font-family: var(--cy-mono);
    font-size: 12px;
    color: var(--cy-dim);
    pointer-events: none;
}

.menu-hints span:nth-child(odd) {
    padding: 1px 6px;
    border: 1px solid rgba(0, 240, 255, 0.35);
    color: var(--cy-cyan);
}

.menu-hints span:nth-child(even) {
    margin-right: 10px;
}

body.touch .menu-hints {
    display: none;
}

.menu-version {
    position: absolute !important;
    left: auto !important;
    right: 30px;
    bottom: 48px !important;
    font-family: var(--cy-mono) !important;
    color: var(--cy-dim) !important;
}

/* Бегущая строка «Эфир» */
.cy-ticker {
    position: absolute !important;
    left: 0;
    right: 0;
    bottom: 0;
    height: 34px;
    display: flex;
    align-items: center;
    overflow: hidden;
    font-family: var(--cy-mono);
    font-size: 13px;
    letter-spacing: 0.06em;
    white-space: nowrap;
    background: rgba(7, 6, 15, 0.94);
    border-top: 1px solid rgba(255, 43, 214, 0.45);
    pointer-events: none;
}

.cy-tlabel {
    position: relative;
    z-index: 2;
    display: flex;
    align-items: center;
    height: 100%;
    padding: 0 16px;
    font-weight: bold;
    letter-spacing: 0.2em;
    color: #0b0010;
    background: var(--cy-acid);
}

.cy-trun {
    flex: 1;
    overflow: hidden;
}

.cy-trun span {
    display: inline-block;
    padding-left: 24px;
    color: var(--cy-dim);
    animation: cyTicker 60s linear infinite;
}

.cy-trun b {
    color: var(--cy-red);
    font-weight: normal;
}

.cy-trun i {
    color: var(--cy-cyan);
    font-style: normal;
}

.cy-trun em {
    color: var(--cy-mag);
    font-style: normal;
}

/* ---------- Экраны меню: общий каркас ---------- */
#lobbyOverlay,
#hangarOverlay,
#settingsOverlay,
#seasonOverlay,
#questsOverlay {
    background:
        radial-gradient(ellipse at 80% 0%, rgba(255, 43, 214, 0.18), transparent 55%),
        radial-gradient(ellipse at 10% 100%, rgba(0, 240, 255, 0.1), transparent 55%),
        rgba(7, 6, 15, 0.82) !important;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    font-family: var(--cy-body) !important;
}

#lobbyOverlay::after,
#hangarOverlay::after,
#settingsOverlay::after,
#seasonOverlay::after,
#questsOverlay::after {
    content: '';
    position: fixed;
    inset: 0;
    background: repeating-linear-gradient(0deg, rgba(0, 0, 0, 0.2) 0 1px, transparent 1px 3px);
    pointer-events: none;
}

#lobbyOverlay > *,
#hangarOverlay > *,
#settingsOverlay > *,
#seasonOverlay > *,
#questsOverlay > * {
    position: relative;
    z-index: 1;
    animation: cyIn 0.4s ease-out both;
}

#lobbyOverlay h2,
#hangarOverlay h2,
#settingsOverlay h2,
#seasonOverlay h2,
#questsOverlay h2,
#match-results h2 {
    border: none !important;
    font-family: var(--cy-disp) !important;
    font-size: clamp(22px, 2.6vw, 32px) !important;
    font-weight: 900 !important;
    font-style: italic;
    letter-spacing: 0.18em !important;
    color: #fff !important;
    background: none !important;
    -webkit-text-fill-color: currentColor;
    filter: none !important;
    text-shadow: 0 0 2px #fff, 0 0 20px rgba(255, 43, 214, 0.9), 0 0 50px rgba(255, 43, 214, 0.4) !important;
}

#lobbyOverlay h2::before,
#hangarOverlay h2::before,
#settingsOverlay h2::before,
#seasonOverlay h2::before,
#questsOverlay h2::before {
    content: '// ';
    color: var(--cy-mag);
}

#lobbyOverlay h2::after,
#hangarOverlay h2::after,
#settingsOverlay h2::after,
#seasonOverlay h2::after,
#questsOverlay h2::after {
    content: '';
    display: block;
    width: 160px;
    height: 2px;
    margin: 10px auto 0;
    background: linear-gradient(90deg, transparent, var(--cy-cyan), transparent);
}

/* Панели со срезанным углом */
.lobby-section,
.quests-section,
#settingsForm fieldset,
.hangar-ship,
#seasonTable {
    background: var(--cy-panel) !important;
    border: 1px solid rgba(255, 43, 214, 0.35) !important;
    border-radius: 0 !important;
    clip-path: var(--cy-cut);
    box-shadow: inset 0 0 40px rgba(255, 43, 214, 0.08) !important;
}

.lobby-section h3,
.quests-section h3,
#settingsForm legend,
#hangarOverlay h3,
.hangar-paint-title {
    font-family: var(--cy-mono) !important;
    font-size: 13px !important;
    font-weight: normal !important;
    letter-spacing: 0.22em !important;
    text-transform: uppercase;
    color: var(--cy-acid) !important;
}

.lobby-section h3::before,
.quests-section h3::before,
#settingsForm legend::before,
#hangarOverlay h3::before {
    content: '// ';
    color: var(--cy-mag);
}

.lobby-status,
#lobbyStatus,
#seasonReset,
#seasonMine,
#questReset,
#achievementSummary,
#hangarResources,
.hangar-hint {
    font-family: var(--cy-mono) !important;
    color: var(--cy-dim) !important;
}

#hangarResources {
    color: var(--cy-cyan) !important;
}

/* Кнопки «Назад» */
#lobbyOverlay #lobbyBackButton,
#hangarOverlay #hangarBackButton,
#settingsOverlay #backToMenuButton,
#seasonOverlay #seasonBackButton,
#questsOverlay #questsBackButton {
    color: var(--cy-dim) !important;
    background: transparent !important;
    border-color: var(--cy-line) !important;
    padding: 10px 24px !important;
}

#lobbyOverlay #lobbyBackButton::before,
#hangarOverlay #hangarBackButton::before,
#settingsOverlay #backToMenuButton::before,
#seasonOverlay #seasonBackButton::before,
#questsOverlay #questsBackButton::before {
    content: '‹ ESC  ';
    color: var(--cy-mag);
}

/* ---------- Лобби ---------- */
.room-row {
    font-family: var(--cy-mono) !important;
    background: rgba(0, 240, 255, 0.04) !important;
    border: 1px solid rgba(0, 240, 255, 0.14) !important;
    border-left: 2px solid var(--cy-cyan) !important;
    border-radius: 0 !important;
}

.room-row:hover {
    background: rgba(0, 240, 255, 0.12) !important;
}

.cy-hidden-map {
    display: none !important;
}

/* Карточки карт */
#cyMapCards {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 8px;
    margin: 4px 0 12px;
}

#lobbyOverlay .cy-map {
    display: flex !important;
    flex-direction: column;
    align-items: stretch;
    padding: 0 !important;
    min-height: 0;
    color: var(--cy-dim) !important;
    background: rgba(4, 3, 12, 0.9) !important;
    border: 1px solid var(--cy-line) !important;
    clip-path: polygon(0 0, calc(100% - 10px) 0, 100% 10px, 100% 100%, 0 100%);
    letter-spacing: 0.08em;
}

.cy-map .thumb {
    display: block;
    height: 54px;
    background-size: cover;
}

.cy-map .name {
    padding: 6px 4px 7px;
    font-family: var(--cy-mono);
    font-size: 10px;
    text-align: center;
    line-height: 1.2;
}

.cy-map[data-map="standard"] .thumb {
    background:
        radial-gradient(circle at 70% 40%, rgba(0, 240, 255, 0.5) 0 2px, transparent 3px),
        radial-gradient(circle at 25% 65%, #fff 0 1px, transparent 2px),
        radial-gradient(circle at 50% 20%, #fff 0 1px, transparent 2px),
        radial-gradient(circle at 85% 80%, #fff 0 1px, transparent 2px),
        radial-gradient(ellipse at 60% 50%, rgba(80, 40, 140, 0.6), transparent 70%),
        #05040c;
}

.cy-map[data-map="belt"] .thumb {
    background:
        radial-gradient(circle at 20% 60%, #6b5a4a 0 6px, transparent 7px),
        radial-gradient(circle at 45% 35%, #847262 0 9px, transparent 10px),
        radial-gradient(circle at 70% 65%, #5d4f42 0 5px, transparent 6px),
        radial-gradient(circle at 85% 30%, #77685a 0 4px, transparent 5px),
        linear-gradient(160deg, #1a1420, #07060f);
}

.cy-map[data-map="nebula"] .thumb {
    background:
        radial-gradient(ellipse at 30% 40%, rgba(255, 43, 214, 0.7), transparent 55%),
        radial-gradient(ellipse at 75% 60%, rgba(120, 60, 255, 0.7), transparent 55%),
        #12061e;
}

.cy-map[data-map="station"] .thumb {
    background:
        radial-gradient(circle at 50% 55%, transparent 0 12px, rgba(0, 240, 255, 0.8) 13px 15px, transparent 16px),
        radial-gradient(circle at 50% 55%, rgba(255, 59, 92, 0.9) 0 3px, transparent 4px),
        linear-gradient(160deg, #0b1424, #05040c);
}

.cy-map[data-map="planet"] .thumb {
    background:
        linear-gradient(180deg, transparent 55%, #2e5a2a 56%, #1d3a1c 100%),
        radial-gradient(ellipse at 70% 20%, #ffe9b0 0 4px, transparent 6px),
        linear-gradient(180deg, #6fa0d8, #b9d3ee 55%);
}

#lobbyOverlay .cy-map:hover {
    color: #fff !important;
    border-color: var(--cy-cyan) !important;
}

#lobbyOverlay .cy-map.active {
    color: var(--cy-acid) !important;
    border-color: var(--cy-mag) !important;
    box-shadow: 0 0 18px rgba(255, 43, 214, 0.5) !important;
    background: rgba(255, 43, 214, 0.12) !important;
}

/* ---------- Ангар ---------- */
.hangar-preview-wrap {
    background:
        radial-gradient(ellipse at 50% 80%, rgba(255, 43, 214, 0.35), transparent 60%),
        linear-gradient(180deg, rgba(0, 240, 255, 0.05), transparent) !important;
    border-radius: 0 !important;
}

/* Голографическая платформа под кораблём */
.hangar-preview-wrap::after {
    content: '';
    position: absolute;
    left: 15%;
    right: 15%;
    bottom: 10%;
    height: 22%;
    border: 2px solid rgba(0, 240, 255, 0.6);
    border-radius: 50%;
    box-shadow: 0 0 24px rgba(0, 240, 255, 0.5), inset 0 0 24px rgba(0, 240, 255, 0.3);
    pointer-events: none;
}

#hangarShipName {
    font-family: var(--cy-disp) !important;
    font-weight: 900 !important;
    font-style: italic;
    color: #fff !important;
    text-shadow: 0 0 18px rgba(0, 240, 255, 0.8);
}

#hangarShipStats {
    font-family: var(--cy-mono);
}

/* Шкалы характеристик — сегменты */
#hangarShipStats .stat-bar,
#hangarShipStats [class*="bar"] {
    border-radius: 0 !important;
}

#hangarShipStats [class*="fill"],
#hangarShipStats .stat-bar > div {
    border-radius: 0 !important;
    background:
        repeating-linear-gradient(90deg, transparent 0 6px, rgba(7, 6, 15, 0.9) 6px 8px),
        linear-gradient(90deg, var(--cy-mag), var(--cy-cyan)) !important;
    box-shadow: 0 0 8px rgba(255, 43, 214, 0.5);
}

#hangarOverlay .hangar-arrow {
    color: var(--cy-mag) !important;
    border-color: var(--cy-mag) !important;
    border-radius: 0 !important;
    font-size: 22px !important;
}

#hangarOverlay #hangarPaints button {
    border-radius: 0 !important;
    clip-path: polygon(0 0, 100% 0, 100% 70%, 70% 100%, 0 100%);
}

#hangarOverlay #hangarPaints button.active {
    box-shadow: 0 0 0 2px var(--cy-acid), 0 0 16px var(--cy-acid) !important;
}

/* Улучшения и арсенал — карточки «имплантов» */
#hangarList > div,
#arsenalList > div {
    background: rgba(4, 3, 12, 0.88) !important;
    border: 1px solid var(--cy-line) !important;
    border-left: 2px solid var(--cy-cyan) !important;
    border-radius: 0 !important;
    clip-path: var(--cy-cut);
}

#hangarList [class*="pip"],
#hangarList [class*="dot"],
#hangarList [class*="level"] span {
    border-radius: 0 !important;
}

/* ---------- Задания и достижения ---------- */
.quest-row {
    border-radius: 0 !important;
    border-left: 2px solid var(--cy-acid) !important;
    background: rgba(245, 255, 59, 0.04) !important;
}

.quest-row.done {
    border-left-color: var(--cy-mag) !important;
    opacity: 0.75;
}

.quest-row b {
    font-family: var(--cy-body);
}

.quest-count {
    font-family: var(--cy-mono) !important;
    color: var(--cy-acid) !important;
}

.ach-bar {
    border-radius: 0 !important;
}

.ach-bar div {
    border-radius: 0 !important;
    background: linear-gradient(90deg, var(--cy-mag), var(--cy-cyan)) !important;
}

/* Достижения — «чипы»: закрытые серые с помехами, открытые светятся */
.ach-card {
    border-radius: 0 !important;
    clip-path: polygon(0 0, calc(100% - 12px) 0, 100% 12px, 100% 100%, 0 100%);
    background:
        repeating-linear-gradient(0deg, rgba(255, 255, 255, 0.03) 0 1px, transparent 1px 3px),
        rgba(10, 8, 18, 0.9) !important;
    border: 1px solid rgba(234, 246, 255, 0.1) !important;
    filter: grayscale(0.8);
}

.ach-card.got {
    filter: none;
    border-color: var(--cy-mag) !important;
    background: linear-gradient(160deg, rgba(255, 43, 214, 0.18), rgba(10, 8, 18, 0.9)) !important;
    box-shadow: 0 0 18px rgba(255, 43, 214, 0.3) !important;
}

.ach-card small {
    font-family: var(--cy-mono);
}

.ach-toast {
    border-radius: 0 !important;
    clip-path: var(--cy-cut);
    background: linear-gradient(135deg, rgba(40, 8, 40, 0.94), rgba(7, 6, 15, 0.94)) !important;
    border: 1px solid var(--cy-mag) !important;
    box-shadow: 0 0 24px rgba(255, 43, 214, 0.45) !important;
}

.ach-toast b {
    color: var(--cy-acid) !important;
}

/* ---------- Лидеры: «MOST WANTED» ---------- */
#seasonTable {
    border-collapse: collapse;
}

#seasonTable th {
    font-family: var(--cy-mono) !important;
    color: var(--cy-mag) !important;
}

#seasonTable td {
    font-family: var(--cy-mono) !important;
    border-bottom: 1px dashed rgba(0, 240, 255, 0.15) !important;
}

#seasonTable tbody tr:nth-child(1) td {
    color: var(--cy-acid) !important;
    text-shadow: 0 0 10px rgba(245, 255, 59, 0.6);
}

#seasonTable tbody tr:nth-child(2) td,
#seasonTable tbody tr:nth-child(3) td {
    color: var(--cy-cyan) !important;
}

.season-tab {
    clip-path: var(--cy-cut2);
}

.season-tab.active {
    color: #0b0010 !important;
    background: var(--cy-mag) !important;
}

/* ---------- Телефон ---------- */
@media (max-width: 1100px) {
    .cy-dossier {
        width: 280px;
    }
    #cyMapCards {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (max-width: 900px) {
    .cy-dossier,
    .cy-topbar span:not(:first-child):not(.cy-sp) {
        display: none;
    }
}

@media (max-width: 760px) {
    #loginWindow {
        left: 50% !important;
        transform: translate(-50%, -50%) !important;
        animation: none;
        padding: 24px 20px 16px !important;
    }
    .login-logo {
        font-size: 34px;
    }
    #mainMenuOverlay {
        background: linear-gradient(90deg, rgba(7, 6, 15, 0.9), rgba(7, 6, 15, 0.6)) !important;
    }
    #mainMenuOverlay > button .mi-side {
        display: none;
    }
}

@media (max-height: 520px) {
    #loginWindow {
        padding: 14px 18px 10px !important;
        width: min(560px, calc(100vw - 24px)) !important;
    }
    #loginWindow::before,
    .login-tag,
    #loginWindow h2,
    #guestHint {
        display: none !important;
    }
    .login-brand {
        margin-bottom: 8px;
    }
    .login-logo {
        font-size: 24px;
    }
    .login-logo span {
        display: inline;
        margin-left: 10px;
    }
    #loginWindow input,
    #loginWindow #loginButton,
    #loginWindow #registerButton,
    #loginWindow #guestButton {
        height: 38px !important;
        min-height: 0;
    }
    .menu-brand {
        margin-bottom: 8px !important;
    }
    .menu-tag,
    .menu-chips {
        display: none;
    }
    .menu-brand .menu-title {
        font-size: 30px !important;
    }
    #mainMenuOverlay > button {
        height: 38px;
        margin-bottom: 5px !important;
    }
    #mainMenuOverlay > #mission1Button {
        height: 50px;
        margin-bottom: 8px !important;
    }
    .cy-ticker,
    .menu-hints,
    .menu-version {
        display: none !important;
    }
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation: none !important;
        transition: none !important;
    }
}

/* =====================================================================
   HUD в бою
   ===================================================================== */

/* Цель захвачена — строка терминала */
#cosmic-base-label {
    font-family: var(--cy-mono) !important;
    font-size: 14px !important;
    font-weight: normal !important;
    letter-spacing: 0.06em;
    color: var(--cy-txt) !important;
    background: linear-gradient(90deg, rgba(20, 6, 30, 0.92), rgba(7, 6, 15, 0.7)) !important;
    border: none !important;
    border-left: 3px solid var(--cy-mag) !important;
    border-radius: 0 !important;
    clip-path: var(--cy-cut);
    text-shadow: none !important;
    box-shadow: none !important;
}

#cosmic-base-label::before {
    content: '> ';
    color: var(--cy-mag);
}

/* Корпус — сегментная шкала */
#ship-health-bar {
    height: 12px !important;
    border-radius: 0 !important;
    background: rgba(255, 255, 255, 0.07) !important;
    border: 1px solid rgba(0, 240, 255, 0.25) !important;
}

#ship-health-bar::before {
    font-family: var(--cy-mono) !important;
    letter-spacing: 0.25em !important;
    color: var(--cy-cyan) !important;
}

#ship-health-fill {
    border-radius: 0 !important;
    background:
        repeating-linear-gradient(90deg, transparent 0 9px, rgba(7, 6, 15, 0.9) 9px 11px),
        linear-gradient(90deg, var(--cy-red), var(--cy-mag) 40%, var(--cy-cyan)) !important;
    box-shadow: 0 0 10px rgba(255, 43, 214, 0.5) !important;
}

#target-health-bar {
    border-radius: 0 !important;
    background: rgba(255, 255, 255, 0.08) !important;
    border: 1px solid rgba(255, 59, 92, 0.5) !important;
}

#target-health-fill {
    border-radius: 0 !important;
    background: repeating-linear-gradient(90deg, var(--cy-red) 0 6px, transparent 6px 8px) !important;
    box-shadow: 0 0 8px var(--cy-red) !important;
}

#speed-display,
#cooldown-label,
#fps-counter {
    font-family: var(--cy-mono) !important;
    font-weight: normal !important;
    letter-spacing: 0.06em;
    color: var(--cy-cyan) !important;
    background: rgba(10, 4, 20, 0.82) !important;
    border: 1px solid var(--cy-line) !important;
    border-radius: 0 !important;
    text-shadow: none !important;
}

#cooldown-label {
    font-size: 12px !important;
    color: var(--cy-acid) !important;
    clip-path: polygon(10px 0, 100% 0, 100% 100%, 0 100%, 0 10px);
}

#network-status {
    font-family: var(--cy-mono) !important;
    font-size: 13px !important;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

/* Чат — терминал */
#chat-container {
    background: rgba(10, 4, 20, 0.72) !important;
    border: 1px solid rgba(255, 43, 214, 0.3) !important;
    border-radius: 0 !important;
    clip-path: var(--cy-cut);
    font-family: var(--cy-mono) !important;
}

#chat-log {
    font-family: var(--cy-mono) !important;
    font-size: 13px !important;
}

#chat-input {
    font-family: var(--cy-mono) !important;
    background: rgba(4, 3, 12, 0.9) !important;
    border: 1px solid var(--cy-line) !important;
    border-radius: 0 !important;
    color: var(--cy-txt) !important;
}

#chat-send-button {
    font-family: var(--cy-disp) !important;
    font-size: 11px !important;
    letter-spacing: 0.1em;
    color: #0b0010 !important;
    background: var(--cy-mag) !important;
    border: none !important;
    border-radius: 0 !important;
    clip-path: polygon(8px 0, 100% 0, 100% 100%, 0 100%, 0 8px);
}

/* Лента убийств — строки терминала */
.kill-entry {
    font-family: var(--cy-mono) !important;
    font-size: 13px !important;
    letter-spacing: 0.02em;
    background: rgba(10, 4, 20, 0.85) !important;
    border: none !important;
    border-left: 2px solid var(--cy-cyan) !important;
    border-radius: 0 !important;
}

.kill-entry.mine {
    border-left-color: var(--cy-acid) !important;
    background: rgba(40, 40, 0, 0.6) !important;
}

.kill-entry .tag {
    color: var(--cy-mag);
}

.kill-entry .killer {
    color: var(--cy-cyan) !important;
}

.kill-entry .victim {
    color: var(--cy-red) !important;
}

.kill-entry .icon {
    color: var(--cy-dim) !important;
}

/* Метки над целями */
.combat-label {
    font-family: var(--cy-mono) !important;
    letter-spacing: 0.04em;
}

.lead-marker {
    border-color: var(--cy-acid) !important;
    box-shadow: 0 0 8px var(--cy-acid) !important;
}

.damage-arc {
    filter: hue-rotate(-10deg) saturate(1.4);
}

/* Прицел: циан — свободно, маджента — цель захвачена */
#crosshair::before,
#crosshair::after {
    background: var(--cy-cyan) !important;
    box-shadow: 0 0 6px var(--cy-cyan) !important;
}

#crosshair.active::before,
#crosshair.active::after {
    background: var(--cy-mag) !important;
    box-shadow: 0 0 10px var(--cy-mag) !important;
}

#crosshair.active {
    outline: 1px solid rgba(255, 43, 214, 0.8);
    outline-offset: 6px;
    transform: translate(-50%, -50%) rotate(45deg) scale(1.15) !important;
}

/* Перегрев и форсаж */
#heat-meter {
    border-radius: 0 !important;
}

#boost-meter .boost-label {
    font-family: var(--cy-mono) !important;
}

#boost-meter .boost-bar,
#boost-meter .boost-fill {
    border-radius: 0 !important;
}

#boost-meter .boost-fill {
    background: repeating-linear-gradient(90deg, var(--cy-acid) 0 8px, transparent 8px 10px) !important;
    box-shadow: 0 0 8px rgba(245, 255, 59, 0.6) !important;
}

#boost-meter.active .boost-fill {
    background: repeating-linear-gradient(90deg, var(--cy-mag) 0 8px, transparent 8px 10px) !important;
    box-shadow: 0 0 12px var(--cy-mag) !important;
}

/* Спецоружие внизу */
#special-hud .sp-item {
    font-family: var(--cy-mono) !important;
    background: rgba(10, 4, 20, 0.85) !important;
    border: 1px solid rgba(255, 43, 214, 0.35) !important;
    border-radius: 0 !important;
    clip-path: polygon(8px 0, 100% 0, 100% calc(100% - 8px), calc(100% - 8px) 100%, 0 100%, 0 8px);
}

#special-hud .sp-item b,
#special-hud .sp-item kbd {
    border-radius: 0 !important;
}

/* Компас, счётчик ядер, условие карты */
#compass .compass-info {
    font-family: var(--cy-mono) !important;
}

#core-counter {
    color: var(--cy-acid) !important;
}

#mission-banner {
    font-family: var(--cy-disp) !important;
    font-style: italic;
    font-weight: 900;
    color: var(--cy-cyan) !important;
    text-shadow: 0 0 2px #fff, 0 0 20px var(--cy-cyan) !important;
}

#mission-banner.gold {
    color: var(--cy-acid) !important;
    text-shadow: 0 0 2px #fff, 0 0 24px var(--cy-acid) !important;
}

/* Волны и матч */
#wave-hud,
#match-hud {
    font-family: var(--cy-mono) !important;
    background: rgba(10, 4, 20, 0.85) !important;
    border: 1px solid rgba(255, 43, 214, 0.4) !important;
    border-radius: 0 !important;
}

#wave-banner,
#streak-banner {
    font-family: var(--cy-disp) !important;
    font-style: italic;
    font-weight: 900 !important;
    color: var(--cy-mag) !important;
    text-shadow: 0 0 2px #fff, 0 0 24px var(--cy-mag), 0 0 60px rgba(255, 43, 214, 0.5) !important;
}

/* Таблица фрагов (Tab) */
#fragTable {
    background: var(--cy-panel) !important;
    border: 1px solid rgba(255, 43, 214, 0.45) !important;
    border-radius: 0 !important;
    clip-path: var(--cy-cut);
    font-family: var(--cy-mono) !important;
}

#fragTable h2 {
    font-family: var(--cy-disp) !important;
    font-style: italic;
    color: #fff !important;
    text-shadow: 0 0 18px var(--cy-mag) !important;
}

#fragTable th,
#fragTable td {
    border: none !important;
    border-bottom: 1px dashed rgba(0, 240, 255, 0.2) !important;
}

#fragTable th {
    color: var(--cy-mag) !important;
}

/* Плашка переподключения */
#reconnect-banner {
    border-radius: 0 !important;
    clip-path: var(--cy-cut);
    font-family: var(--cy-mono) !important;
}

/* ---------- Экран гибели: «СИГНАЛ ПОТЕРЯН» ---------- */
#game-over-screen {
    background:
        repeating-linear-gradient(0deg, rgba(0, 0, 0, 0.35) 0 1px, transparent 1px 3px),
        radial-gradient(ellipse at 50% 50%, rgba(80, 0, 30, 0.55), rgba(7, 6, 15, 0.92)) !important;
}

.death-card {
    background: none !important;
    border: none !important;
    box-shadow: none !important;
    font-family: var(--cy-mono) !important;
}

.death-card .game-over-title {
    position: relative;
    font-family: var(--cy-disp) !important;
    font-style: italic;
    font-weight: 900 !important;
    letter-spacing: 0.12em !important;
    color: #fff !important;
    text-shadow: -4px 0 var(--cy-red), 4px 0 var(--cy-cyan), 0 0 40px rgba(255, 59, 92, 0.7) !important;
    animation: cyFlicker 1.6s infinite, cyShake 0.4s steps(2) infinite;
}

@keyframes cyShake {
    0% { transform: translate(0, 0); }
    50% { transform: translate(-2px, 1px); }
    100% { transform: translate(2px, -1px); }
}

#deathBy {
    color: var(--cy-red) !important;
    font-family: var(--cy-mono) !important;
}

#deathBy::before {
    content: '> ';
}

#deathStats {
    color: var(--cy-dim) !important;
}

#deathCountdown {
    color: var(--cy-acid) !important;
    font-family: var(--cy-mono) !important;
    letter-spacing: 0.12em;
}

.death-card .restart-button {
    font-family: var(--cy-disp) !important;
    letter-spacing: 0.2em !important;
    color: #0b0010 !important;
    background: repeating-linear-gradient(-45deg, rgba(0, 0, 0, 0.12) 0 8px, transparent 8px 16px), var(--cy-mag) !important;
    border: none !important;
    border-radius: 0 !important;
    clip-path: var(--cy-cut2);
    box-shadow: 0 0 26px rgba(255, 43, 214, 0.5) !important;
}

/* ---------- Попадание: красный глитч по краям экрана ---------- */
#cy-hit {
    position: fixed;
    inset: 0;
    z-index: 260;
    pointer-events: none;
    opacity: 0;
    background:
        radial-gradient(ellipse at 50% 50%, transparent 55%, rgba(255, 59, 92, 0.55) 100%);
}

#cy-hit i {
    position: absolute;
    left: 0;
    right: 0;
    background: linear-gradient(90deg, rgba(255, 59, 92, 0.7), rgba(0, 240, 255, 0.5) 50%, rgba(255, 43, 214, 0.7));
    mix-blend-mode: screen;
}

#cy-hit.on {
    animation: cyHit 0.32s steps(4) 1;
}

@keyframes cyHit {
    0% { opacity: 1; }
    40% { opacity: 0.8; }
    100% { opacity: 0; }
}

#application-canvas:not([style*="display: block"]) ~ #cy-hit {
    display: none !important;
}

/* =====================================================================
   Свечение мира (neon.js): уменьшенная копия кадра → только яркое → размытие → «экран» поверх игры
   ===================================================================== */
#neon-bloom {
    position: fixed;
    z-index: 0;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: none;
    pointer-events: none;
    image-rendering: auto;
    mix-blend-mode: screen;
    filter: brightness(0.6) contrast(2.6) saturate(1.7) blur(7px);
    opacity: 0.9;
}

/* Корпус ниже 25%: красное мерцание по краям экрана (cyberui.js) */
body.cy-critical #cy-hit:not(.on) {
    opacity: 1;
    background: radial-gradient(ellipse at 50% 50%, transparent 60%, rgba(255, 59, 92, 0.35) 100%);
    animation: cyCritical 1s ease-in-out infinite;
}

@keyframes cyCritical {
    0%, 100% { opacity: 0.35; }
    50% { opacity: 1; }
}

/* Щит в кабине (combat.js): голубое свечение с сотами только по краям экрана, центр свободен */
#shield-edge {
    position: fixed;
    inset: 0;
    z-index: 255;
    pointer-events: none;
    opacity: 0;
    background:
        radial-gradient(ellipse at 50% 50%, transparent 58%, rgba(0, 240, 255, 0.28) 88%, rgba(0, 240, 255, 0.5) 100%),
        url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='28' height='48' viewBox='0 0 28 48'%3E%3Cpath d='M14 0l14 8v16l-14 8L0 24V8z M14 32l14 8v16 M14 32L0 40' fill='none' stroke='%2300f0ff' stroke-opacity='0.35' stroke-width='1'/%3E%3C/svg%3E");
    -webkit-mask-image: radial-gradient(ellipse at 50% 50%, transparent 55%, #000 95%);
    mask-image: radial-gradient(ellipse at 50% 50%, transparent 55%, #000 95%);
    transition: opacity 0.08s linear;
}

#application-canvas:not([style*="display: block"]) ~ #shield-edge {
    display: none !important;
}

/* =====================================================================
   Экран «Управление» (controls.js): 3D-корабль, схемы кнопок, тренировка
   ===================================================================== */
#controlsOverlay {
    position: fixed;
    inset: 0;
    z-index: 100;
    flex-direction: column;
    gap: 12px;
    padding: 46px clamp(12px, 2.2vw, 30px) 22px;
    box-sizing: border-box;
    overflow-y: auto;
    color: var(--cy-txt);
    font-family: var(--cy-body);
    background:
        radial-gradient(ellipse at 80% 0%, rgba(255, 43, 214, 0.16), transparent 55%),
        radial-gradient(ellipse at 10% 100%, rgba(0, 240, 255, 0.1), transparent 55%),
        rgba(7, 6, 15, 0.92);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    user-select: none;
    -webkit-user-select: none;
}

#controlsOverlay::after {
    content: '';
    position: fixed;
    inset: 0;
    background: repeating-linear-gradient(0deg, rgba(0, 0, 0, 0.18) 0 1px, transparent 1px 3px);
    pointer-events: none;
}

#controlsOverlay > * {
    position: relative;
    z-index: 1;
    flex: none;
    animation: cyIn 0.4s ease-out both;
}

/* Цвет группы действий: движение — циан, повороты — маджента, оружие — красный, цели — жёлтый, система — белый */
#controlsOverlay [data-group="move"], #ctl-cheat [data-group="move"] { --g: 0, 240, 255; }
#controlsOverlay [data-group="rotate"], #ctl-cheat [data-group="rotate"] { --g: 255, 43, 214; }
#controlsOverlay [data-group="combat"], #ctl-cheat [data-group="combat"] { --g: 255, 59, 92; }
#controlsOverlay [data-group="target"], #ctl-cheat [data-group="target"] { --g: 245, 255, 59; }
#controlsOverlay [data-group="system"], #ctl-cheat [data-group="system"] { --g: 234, 246, 255; }

/* Кнопки экрана */
#controlsOverlay button {
    font-family: var(--cy-disp);
    font-size: 12px;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--cy-cyan);
    background: rgba(0, 240, 255, 0.06);
    border: 1px solid rgba(0, 240, 255, 0.4);
    border-radius: 0;
    clip-path: var(--cy-cut2);
    padding: 9px 16px;
    cursor: pointer;
    transition: background 0.15s, color 0.15s, box-shadow 0.15s;
}

#controlsOverlay button:hover {
    color: #fff;
    background: rgba(0, 240, 255, 0.2);
    box-shadow: 0 0 18px rgba(0, 240, 255, 0.35);
}

/* Шапка: заголовок, вкладки схем, «Назад» */
.ctl-head {
    display: flex;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
}

.ctl-head h2 {
    margin: 0;
    font-family: var(--cy-disp);
    font-size: clamp(20px, 2.3vw, 30px);
    font-weight: 900;
    font-style: italic;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: #fff;
    text-shadow: 0 0 2px #fff, 0 0 20px rgba(255, 43, 214, 0.9), 0 0 50px rgba(255, 43, 214, 0.4);
}

.ctl-head h2::before {
    content: '// ';
    color: var(--cy-mag);
}

.ctl-tabs {
    display: flex;
    gap: 6px;
    margin-left: auto;
}

.ctl-tabs button b {
    margin-right: 8px;
    font-weight: normal;
}

#controlsOverlay .ctl-tabs button.active {
    color: #0b0010;
    background: var(--cy-cyan);
    box-shadow: 0 0 18px rgba(0, 240, 255, 0.5);
}

#controlsOverlay #controlsBackButton {
    color: var(--cy-dim);
    background: transparent;
    border-color: var(--cy-line);
}

#controlsOverlay #controlsBackButton::before {
    content: '‹ ESC  ';
    color: var(--cy-mag);
}

/* Две колонки: 3D-сцена и схема */
.ctl-main {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1.12fr);
    gap: 14px;
}

.ctl-stage {
    position: relative;
    height: clamp(340px, 56vh, 600px);
    overflow: hidden;
    border: 1px solid rgba(255, 43, 214, 0.45);
    clip-path: var(--cy-cut);
    background: #07050f;
    box-shadow: inset 0 0 60px rgba(255, 43, 214, 0.15);
    cursor: crosshair;
    touch-action: none;
}

#ctlCanvas {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    display: block;
}

#ctlStatus {
    position: absolute;
    left: 50%;
    top: 45%;
    transform: translate(-50%, -50%);
    font-family: var(--cy-mono);
    font-size: 13px;
    letter-spacing: 0.2em;
    text-transform: uppercase;
    color: var(--cy-cyan);
    text-shadow: 0 0 10px var(--cy-cyan);
    pointer-events: none;
    animation: cyFlicker 2s infinite;
}

/* Линии скорости при форсаже (--boost ставит controls.js) */
.ctl-lines {
    position: absolute;
    inset: -20%;
    background: repeating-conic-gradient(from 0deg at 50% 50%, transparent 0deg 4deg, rgba(160, 240, 255, 0.4) 4deg 4.5deg, transparent 4.5deg 9deg);
    -webkit-mask-image: radial-gradient(circle, transparent 26%, #000 72%);
    mask-image: radial-gradient(circle, transparent 26%, #000 72%);
    opacity: calc(var(--boost, 0) * 0.6);
    pointer-events: none;
    animation: ctlLines 0.2s linear infinite;
}

@keyframes ctlLines {
    from { transform: rotate(0deg) scale(1); }
    to { transform: rotate(3deg) scale(1.04); }
}

/* Вид из кабины: стойки фонаря, затемнение по краям и прицел */
.ctl-cockpit {
    display: none;
    position: absolute;
    inset: 0;
    pointer-events: none;
    background:
        radial-gradient(ellipse at 50% 45%, transparent 55%, rgba(0, 0, 0, 0.7) 100%),
        linear-gradient(180deg, transparent 80%, rgba(16, 6, 26, 0.92) 80.4%, rgba(8, 4, 14, 0.96) 100%);
}

.ctl-cockpit::before {
    content: '';
    position: absolute;
    inset: 0;
    background:
        linear-gradient(112deg, rgba(10, 4, 18, 0.95) 0 8%, rgba(255, 43, 214, 0.6) 8.2%, transparent 8.6%),
        linear-gradient(248deg, rgba(10, 4, 18, 0.95) 0 8%, rgba(255, 43, 214, 0.6) 8.2%, transparent 8.6%);
}

.ctl-cockpit i {
    position: absolute;
    left: 50%;
    top: 46%;
    width: 34px;
    height: 34px;
    margin: -17px 0 0 -17px;
    border: 2px solid var(--cy-cyan);
    border-radius: 50%;
    box-shadow: 0 0 12px var(--cy-cyan);
}

.ctl-cockpit i::before,
.ctl-cockpit i::after {
    content: '';
    position: absolute;
    background: var(--cy-cyan);
}

.ctl-cockpit i::before {
    left: -14px;
    right: -14px;
    top: 15px;
    height: 2px;
}

.ctl-cockpit i::after {
    top: -14px;
    bottom: -14px;
    left: 15px;
    width: 2px;
}

.ctl-stage.cabin .ctl-cockpit {
    display: block;
}

.ctl-stage.cabin .ctl-arrows {
    display: none;
}

/* Приборы: скорость и энергия форсажа */
.ctl-hud {
    position: absolute;
    left: 14px;
    top: 12px;
    display: flex;
    flex-direction: column;
    gap: 7px;
    pointer-events: none;
}

.ctl-meter {
    display: grid;
    grid-template-columns: 70px 120px auto;
    align-items: center;
    gap: 8px;
    font-family: var(--cy-mono);
    font-size: 11px;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: var(--cy-dim);
}

.ctl-meter i {
    display: block;
    height: 6px;
    background: rgba(0, 240, 255, 0.12);
    border: 1px solid rgba(0, 240, 255, 0.35);
}

.ctl-meter b {
    display: block;
    height: 100%;
    width: 0;
    background:
        repeating-linear-gradient(90deg, transparent 0 6px, rgba(7, 6, 15, 0.9) 6px 8px),
        linear-gradient(90deg, var(--cy-cyan), #fff);
    box-shadow: 0 0 8px var(--cy-cyan);
}

.ctl-meter em {
    font-style: normal;
    color: var(--cy-cyan);
}

.ctl-meter.boost b {
    background:
        repeating-linear-gradient(90deg, transparent 0 6px, rgba(7, 6, 15, 0.9) 6px 8px),
        linear-gradient(90deg, #ffb020, var(--cy-acid));
    box-shadow: 0 0 8px var(--cy-acid);
}

.ctl-meter.boost.locked b {
    background: var(--cy-red);
    box-shadow: 0 0 8px var(--cy-red);
}

/* Подписи стрелок: нос и курс */
.ctl-arrows {
    display: flex;
    flex-direction: column;
    gap: 3px;
    margin-top: 2px;
    font-family: var(--cy-mono);
    font-size: 11px;
    letter-spacing: 0.08em;
    color: var(--cy-dim);
}

.ctl-arrows span::before {
    content: '━━▶';
    margin-right: 8px;
    letter-spacing: -0.1em;
}

.ctl-arrows .nose::before {
    color: var(--cy-cyan);
    text-shadow: 0 0 6px var(--cy-cyan);
}

.ctl-arrows .vel::before {
    color: var(--cy-acid);
    text-shadow: 0 0 6px var(--cy-acid);
}

/* Значки режимов: вид, ассист, мышь */
.ctl-badges {
    position: absolute;
    right: 14px;
    top: 12px;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 5px;
    pointer-events: none;
}

.ctl-badges span {
    padding: 2px 8px;
    font-family: var(--cy-mono);
    font-size: 11px;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--cy-dim);
    background: rgba(7, 6, 15, 0.65);
    border: 1px solid rgba(234, 246, 255, 0.15);
}

.ctl-badges span:first-child,
.ctl-badges span.on {
    color: var(--cy-acid);
    border-color: rgba(245, 255, 59, 0.45);
}

/* Захват цели */
.ctl-lock {
    position: absolute;
    left: 63%;
    top: 34%;
    width: 64px;
    height: 64px;
    margin: -32px 0 0 -32px;
    pointer-events: none;
    opacity: 0;
    --lc: 255, 59, 92;
}

.ctl-lock.rock { --lc: 245, 255, 59; }
.ctl-lock.auto { --lc: 0, 240, 255; }
.ctl-lock.reset { --lc: 234, 246, 255; }

.ctl-lock i {
    position: absolute;
    inset: 0;
    border: 2px solid rgba(var(--lc), 0.95);
    clip-path: polygon(0 0, 30% 0, 30% 6%, 6% 6%, 6% 30%, 0 30%, 0 70%, 6% 70%, 6% 94%, 30% 94%, 30% 100%, 70% 100%, 70% 94%, 94% 94%, 94% 70%, 100% 70%, 100% 30%, 94% 30%, 94% 6%, 70% 6%, 70% 0, 100% 0, 100% 100%, 0 100%);
    box-shadow: 0 0 14px rgba(var(--lc), 0.8), inset 0 0 14px rgba(var(--lc), 0.5);
}

.ctl-lock span {
    position: absolute;
    left: 50%;
    top: 100%;
    margin-top: 8px;
    transform: translateX(-50%);
    white-space: nowrap;
    font-family: var(--cy-mono);
    font-size: 12px;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: rgb(var(--lc));
    text-shadow: 0 0 8px rgba(var(--lc), 0.9);
}

.ctl-lock.on {
    animation: ctlLock 2.6s ease-out forwards;
}

.ctl-lock.reset.on {
    animation: ctlUnlock 1.2s ease-out forwards;
}

@keyframes ctlLock {
    0% { opacity: 0; transform: scale(2.2) rotate(45deg); }
    18% { opacity: 1; transform: scale(1) rotate(0deg); }
    24% { opacity: 0.4; }
    30%, 85% { opacity: 1; transform: scale(1); }
    100% { opacity: 0; transform: scale(0.9); }
}

@keyframes ctlUnlock {
    0% { opacity: 1; transform: scale(1); }
    100% { opacity: 0; transform: scale(1.8); }
}

/* «Окно игры» по клавишам M, U, 9, Tab, Enter */
.ctl-win {
    position: absolute;
    left: 50%;
    top: 16px;
    transform: translate(-50%, -12px);
    padding: 8px 18px;
    font-family: var(--cy-disp);
    font-size: 13px;
    font-weight: 700;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: #fff;
    background: rgba(12, 6, 22, 0.9);
    border: 1px solid rgba(234, 246, 255, 0.45);
    clip-path: var(--cy-cut2);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.15s, transform 0.15s;
}

.ctl-win.on {
    opacity: 1;
    transform: translate(-50%, 0);
}

/* Подпись внизу сцены: клавиши, название, что делает */
.ctl-caption {
    position: absolute;
    left: 14px;
    right: 14px;
    bottom: 12px;
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 10px 14px;
    background: linear-gradient(90deg, rgba(7, 6, 15, 0.92), rgba(7, 6, 15, 0.72));
    border: 1px solid rgba(var(--g, 0, 240, 255), 0.5);
    border-left: 3px solid rgb(var(--g, 0, 240, 255));
    clip-path: var(--cy-cut2);
    pointer-events: none;
}

.ctl-caption.pop {
    animation: ctlPop 0.25s ease-out;
}

@keyframes ctlPop {
    from { transform: translateY(6px); opacity: 0.4; }
    to { transform: none; opacity: 1; }
}

.ctl-caption.preview {
    border-style: dashed;
    border-left-style: solid;
}

.ctl-cap-keys {
    display: flex;
    gap: 6px;
    flex: none;
}

#controlsOverlay .ctl-cap-keys kbd {
    min-width: 40px;
    padding: 6px 10px;
    font-size: 16px;
}

.ctl-cap-txt {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.ctl-cap-txt b {
    font-family: var(--cy-disp);
    font-size: clamp(14px, 1.3vw, 18px);
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: #fff;
    text-shadow: 0 0 12px rgba(var(--g, 0, 240, 255), 0.8);
}

.ctl-cap-txt small {
    font-size: 15px;
    line-height: 1.25;
    color: var(--cy-dim);
}

.ctl-caption.hint {
    border-color: rgba(0, 240, 255, 0.3);
    border-left-color: var(--cy-cyan);
}

.ctl-caption.hint b {
    font-size: clamp(13px, 1.15vw, 16px);
    color: var(--cy-cyan);
    animation: cyFlicker 4s infinite;
}

/* Вспышки сцены: ЭМИ — глитч, варп — белый всполох */
.ctl-stage.emp::before,
.ctl-stage.warp::before {
    content: '';
    position: absolute;
    inset: 0;
    z-index: 2;
    pointer-events: none;
}

.ctl-stage.emp::before {
    background: repeating-linear-gradient(0deg, rgba(0, 240, 255, 0.25) 0 2px, transparent 2px 7px);
    mix-blend-mode: screen;
    animation: ctlGlitch 0.45s steps(4) forwards;
}

.ctl-stage.warp::before {
    background: radial-gradient(circle at 50% 50%, rgba(255, 255, 255, 0.85), rgba(160, 220, 255, 0.3) 45%, transparent 75%);
    animation: ctlFlash 0.3s ease-out forwards;
}

@keyframes ctlGlitch {
    0% { opacity: 1; transform: translateX(-6px); }
    50% { opacity: 0.7; transform: translateX(5px); }
    100% { opacity: 0; transform: none; }
}

@keyframes ctlFlash {
    from { opacity: 1; }
    to { opacity: 0; }
}

/* Правая колонка: схемы */
.ctl-side {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.ctl-scheme {
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 12px;
    flex: 1;
    padding: 14px 16px;
    box-sizing: border-box;
    background: var(--cy-panel);
    border: 1px solid rgba(255, 43, 214, 0.35);
    clip-path: var(--cy-cut);
    box-shadow: inset 0 0 40px rgba(255, 43, 214, 0.08);
}

.ctl-note {
    margin: 0;
    font-family: var(--cy-mono);
    font-size: 12px;
    letter-spacing: 0.06em;
    color: var(--cy-dim);
    text-align: center;
}

.ctl-note.on {
    color: var(--cy-acid);
}

/* Клавиатура */
.ctl-kbd {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.ctl-row {
    display: flex;
    gap: 5px;
}

.ctl-row.fn {
    margin-bottom: 6px;
}

.ctl-key,
.ctl-gap {
    flex: 1 1 0;
    min-width: 0;
}

.ctl-key {
    position: relative;
    height: clamp(30px, 3.4vw, 44px);
    box-sizing: border-box;
    padding: 3px 5px;
    overflow: hidden;
    border: 1px solid rgba(var(--g, 234, 246, 255), 0.6);
    background: linear-gradient(180deg, rgba(var(--g, 234, 246, 255), 0.18), rgba(var(--g, 234, 246, 255), 0.05));
    box-shadow: inset 0 -3px 0 rgba(var(--g, 234, 246, 255), 0.6);
    clip-path: polygon(0 0, calc(100% - 6px) 0, 100% 6px, 100% 100%, 0 100%);
    font-family: var(--cy-disp);
    font-size: clamp(9px, 0.82vw, 12px);
    color: #fff;
    cursor: pointer;
    transition: transform 0.06s, background 0.1s, box-shadow 0.1s;
}

.ctl-row.fn .ctl-key {
    height: clamp(20px, 2.2vw, 28px);
    font-size: clamp(8px, 0.7vw, 10px);
}

.ctl-key b {
    display: block;
    font-weight: 700;
    line-height: 1.15;
    white-space: nowrap;
}

.ctl-key s {
    position: absolute;
    left: 5px;
    bottom: 3px;
    font-family: var(--cy-mono);
    font-size: 0.85em;
    text-decoration: none;
    color: rgba(234, 246, 255, 0.45);
}

.ctl-key i {
    position: absolute;
    right: 4px;
    bottom: 2px;
    font-style: normal;
    font-size: 1.1em;
    color: rgb(var(--g, 234, 246, 255));
    text-shadow: 0 0 6px rgba(var(--g, 234, 246, 255), 0.8);
}

.ctl-key.off {
    border-color: rgba(234, 246, 255, 0.08);
    background: rgba(255, 255, 255, 0.02);
    box-shadow: none;
    color: rgba(234, 246, 255, 0.22);
    cursor: default;
}

.ctl-key.off s {
    color: rgba(234, 246, 255, 0.12);
}

.ctl-key:not(.off):hover {
    background: rgba(var(--g), 0.3);
}

/* Нажатая клавиша (и кнопка мыши, телефона, строка списка) */
.ctl-key.down,
.ctl-mb.down,
.ctl-mbody.down,
.ctl-tb.down {
    background: rgb(var(--g)) !important;
    color: #07060f;
    box-shadow: 0 0 22px rgba(var(--g), 0.9), inset 0 0 0 1px #fff;
    transform: translateY(2px);
}

.ctl-key.down i,
.ctl-key.down s {
    color: #07060f;
    text-shadow: none;
}

/* Мышь и подписи к ней */
.ctl-kbd-foot {
    display: flex;
    align-items: center;
    gap: 18px;
    flex-wrap: wrap;
}

.ctl-mouse-box {
    display: flex;
    align-items: center;
    gap: 16px;
}

.ctl-mouse {
    position: relative;
    width: 70px;
    height: 104px;
    flex: none;
}

.ctl-mb,
.ctl-mbody {
    position: absolute;
    box-sizing: border-box;
    border: 1px solid rgba(var(--g), 0.65);
    background: rgba(var(--g), 0.1);
    cursor: pointer;
    transition: background 0.1s, box-shadow 0.1s;
}

.ctl-mb {
    top: 0;
    width: 34px;
    height: 44px;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    padding-bottom: 4px;
    font-family: var(--cy-disp);
    font-size: 8px;
    font-weight: 700;
    color: #fff;
}

.ctl-mb.l {
    left: 0;
    border-radius: 34px 0 0 0;
}

.ctl-mb.r {
    right: 0;
    border-radius: 0 34px 0 0;
}

.ctl-mb.m {
    left: 29px;
    top: 9px;
    width: 12px;
    height: 22px;
    padding: 0;
    border-radius: 6px;
    z-index: 1;
    background: rgba(var(--g), 0.35);
}

.ctl-mbody {
    left: 0;
    right: 0;
    top: 46px;
    bottom: 0;
    border-radius: 0 0 35px 35px;
    display: grid;
    place-items: center;
}

.ctl-mbody i {
    font-style: normal;
    font-size: 18px;
    color: rgba(var(--g), 0.7);
}

.ctl-mb:hover,
.ctl-mbody:hover {
    background: rgba(var(--g), 0.3);
}

.ctl-mlist {
    display: grid;
    grid-template-columns: repeat(2, auto);
    gap: 3px 10px;
}

.ctl-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 6px 12px;
    margin-left: auto;
    font-family: var(--cy-mono);
    font-size: 11px;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--cy-dim);
}

.ctl-legend span {
    display: flex;
    align-items: center;
    gap: 6px;
}

.ctl-legend i,
.ctl-lh i {
    width: 8px;
    height: 8px;
    background: rgb(var(--g));
    box-shadow: 0 0 8px rgb(var(--g));
}

/* Клавиши-чипы в подписях и списках */
#controlsOverlay kbd,
#ctl-cheat kbd,
#briefing kbd,
#ctl-f1hint kbd {
    display: inline-block;
    min-width: 1.7em;
    padding: 1px 6px;
    box-sizing: border-box;
    text-align: center;
    font-family: var(--cy-disp);
    font-size: 11px;
    font-weight: 700;
    line-height: 1.5;
    color: #fff;
    white-space: nowrap;
    border: 1px solid rgba(var(--g, 0, 240, 255), 0.75);
    background: rgba(var(--g, 0, 240, 255), 0.14);
    box-shadow: inset 0 -2px 0 rgba(var(--g, 0, 240, 255), 0.6);
}

/* Строка списка: клавиши + действие */
.ctl-li {
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 3px 6px;
    font-size: 14px;
    line-height: 1.2;
    color: var(--cy-txt);
    border-left: 2px solid rgba(var(--g), 0.6);
    background: rgba(var(--g), 0.04);
    cursor: pointer;
    transition: background 0.1s;
}

.ctl-li span {
    margin-left: 3px;
}

.ctl-li:hover {
    background: rgba(var(--g), 0.14);
}

.ctl-li.down {
    background: rgba(var(--g), 0.38);
}

/* Геймпад */
.ctl-pad-svg {
    display: block;
    width: 100%;
    max-height: 290px;
    touch-action: none;
}

.ctl-pad-svg .body {
    fill: rgba(22, 8, 34, 0.92);
    stroke: rgba(255, 43, 214, 0.65);
    stroke-width: 2;
}

.ctl-pad-svg .pb {
    fill: rgba(0, 240, 255, 0.08);
    stroke: rgba(0, 240, 255, 0.75);
    stroke-width: 2;
    cursor: pointer;
    transition: fill 0.08s;
}

.ctl-pad-svg .pb:hover {
    fill: rgba(0, 240, 255, 0.28);
}

.ctl-pad-svg .pb.down {
    fill: var(--cy-cyan);
    filter: drop-shadow(0 0 8px var(--cy-cyan));
}

.ctl-pad-svg .ring {
    fill: rgba(0, 0, 0, 0.4);
    stroke: rgba(234, 246, 255, 0.25);
    stroke-width: 2;
}

.ctl-pad-svg .stick {
    cursor: grab;
}

.ctl-pad-svg .knob {
    fill: rgba(255, 43, 214, 0.14);
    stroke: var(--cy-mag);
}

.ctl-pad-svg .knob.down {
    fill: var(--cy-mag);
    filter: drop-shadow(0 0 8px var(--cy-mag));
}

.ctl-pad-svg .abxy:nth-of-type(odd) {
    stroke: rgba(255, 59, 92, 0.85);
}

.ctl-pad-svg text {
    fill: #fff;
    font-family: var(--cy-disp);
    font-size: 15px;
    font-weight: 700;
    pointer-events: none;
}

/* Буквы на кнопках — по центру; у подписей выравнивание задано в разметке */
.ctl-pad-svg text:not(.lbl) {
    text-anchor: middle;
}

.ctl-pad-svg text.sm {
    font-size: 11px;
}

/* Подписи действий на схеме геймпада */
.ctl-pad-svg text.lbl {
    font-family: var(--cy-body);
    font-size: 15px;
    font-weight: 600;
    fill: rgba(234, 246, 255, 0.75);
}

.ctl-pad-svg text.lbl.rot {
    fill: var(--cy-mag);
}

.ctl-pad-svg text.lbl.sm {
    font-size: 13px;
    fill: rgba(234, 246, 255, 0.6);
}

/* Телефон боком: кнопки как в бою */
.ctl-phone {
    position: relative;
    width: 100%;
    max-width: 640px;
    margin: 0 auto;
    padding: 10px 26px;
    box-sizing: border-box;
    border: 2px solid rgba(234, 246, 255, 0.28);
    border-radius: 26px;
    background: #050409;
    box-shadow: 0 0 30px rgba(0, 240, 255, 0.08);
}

.ctl-screen {
    position: relative;
    aspect-ratio: 800 / 380;
    border-radius: 12px;
    overflow: hidden;
    background:
        radial-gradient(ellipse at 50% 40%, rgba(90, 30, 130, 0.55), transparent 70%),
        linear-gradient(180deg, #0b0718, #05040b);
}

.ctl-joy {
    position: absolute;
    aspect-ratio: 1;
    border-radius: 50%;
    background: rgba(0, 212, 255, 0.08);
    border: 2px solid rgba(0, 212, 255, 0.45);
    box-sizing: border-box;
    cursor: grab;
    touch-action: none;
}

.ctl-joy i {
    position: absolute;
    left: 30%;
    top: 30%;
    width: 40%;
    height: 40%;
    border-radius: 50%;
    box-sizing: border-box;
    background: rgba(0, 212, 255, 0.45);
    border: 2px solid #00d4ff;
    pointer-events: none;
}

.ctl-tb {
    position: absolute;
    aspect-ratio: 1;
    border-radius: 50%;
    display: grid;
    place-items: center;
    box-sizing: border-box;
    border: 2px solid rgba(0, 212, 255, 0.6);
    background: rgba(0, 20, 35, 0.6);
    color: #fff;
    font-family: var(--cy-disp);
    font-size: clamp(7px, 0.75vw, 11px);
    cursor: pointer;
    touch-action: none;
}

.ctl-tb.big {
    border-color: rgba(255, 90, 90, 0.85);
    background: rgba(60, 0, 0, 0.55);
    font-size: clamp(8px, 0.9vw, 13px);
}

.ctl-tb.special {
    border-color: rgba(255, 176, 32, 0.7);
    font-size: clamp(10px, 1.2vw, 16px);
}

.ctl-tb.boost {
    color: #ffd34d;
    border-color: rgba(255, 176, 32, 0.85);
    font-size: clamp(11px, 1.4vw, 18px);
}

/* Тренировка */
.ctl-practice {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-areas: 'title fight' 'tasks fight';
    gap: 8px 16px;
    align-items: center;
    padding: 12px 16px;
    background: var(--cy-panel);
    border: 1px solid rgba(0, 240, 255, 0.3);
    clip-path: var(--cy-cut);
}

.ctl-ptitle {
    grid-area: title;
    display: flex;
    align-items: center;
    gap: 14px;
    font-family: var(--cy-mono);
    font-size: 13px;
    letter-spacing: 0.22em;
    text-transform: uppercase;
    color: var(--cy-acid);
}

.ctl-ptitle > span:first-child {
    color: var(--cy-mag);
}

.ctl-ptitle > span span {
    color: var(--cy-acid);
}

.ctl-ptitle b {
    color: #fff;
    font-weight: normal;
}

.ctl-ptitle em {
    font-style: normal;
    color: var(--cy-mag);
    text-shadow: 0 0 10px var(--cy-mag);
    animation: cyFlicker 3s infinite;
}

#controlsOverlay #ctlResetPractice {
    margin-left: auto;
    padding: 4px 10px;
    font-size: 10px;
    color: var(--cy-dim);
    border-color: var(--cy-line);
    background: transparent;
}

.ctl-tasks {
    grid-area: tasks;
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 6px;
}

.ctl-task {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 9px;
    font-size: 15px;
    line-height: 1.2;
    border: 1px solid rgba(234, 246, 255, 0.1);
    background: rgba(4, 3, 12, 0.7);
    clip-path: polygon(0 0, calc(100% - 8px) 0, 100% 8px, 100% 100%, 0 100%);
}

.ctl-task i {
    width: 20px;
    flex: none;
    font-style: normal;
    font-family: var(--cy-mono);
    color: var(--cy-dim);
}

.ctl-task span {
    flex: 1;
    min-width: 0;
}

.ctl-task em {
    display: flex;
    gap: 3px;
    flex: none;
    font-style: normal;
}

.ctl-task.next {
    border-color: var(--cy-cyan);
    box-shadow: inset 0 0 14px rgba(0, 240, 255, 0.18);
}

.ctl-task.next i {
    color: var(--cy-cyan);
    animation: cyBlink 1s steps(1) infinite;
}

.ctl-task.done {
    border-color: rgba(245, 255, 59, 0.35);
    background: rgba(245, 255, 59, 0.06);
}

.ctl-task.done i {
    color: var(--cy-acid);
    text-shadow: 0 0 8px var(--cy-acid);
}

.ctl-task.done span {
    color: var(--cy-dim);
}

.ctl-task.just {
    animation: ctlJust 0.8s ease-out;
}

@keyframes ctlJust {
    0% { background: rgba(245, 255, 59, 0.55); }
    100% { background: rgba(245, 255, 59, 0.06); }
}

#controlsOverlay #ctlFight {
    grid-area: fight;
    position: relative;
    display: flex;
    align-items: center;
    gap: 14px;
    min-height: 64px;
    padding: 0 26px;
    font-size: 20px;
    font-weight: 900;
    font-style: italic;
    letter-spacing: 0.2em;
    color: #0b0010;
    border: none;
    background:
        repeating-linear-gradient(-45deg, rgba(0, 0, 0, 0.12) 0 8px, transparent 8px 16px),
        var(--cy-mag);
}

#controlsOverlay #ctlFight:hover {
    background:
        repeating-linear-gradient(-45deg, rgba(0, 0, 0, 0.12) 0 8px, transparent 8px 16px),
        #ff5ce0;
}

#ctlFight i {
    font-style: normal;
}

.ctl-practice.complete {
    border-color: rgba(245, 255, 59, 0.5);
}

.ctl-practice.complete #ctlFight {
    animation: cyPulse 1.6s ease-in-out infinite;
}

/* Все клавиши по группам (и шпаргалка F1) */
.ctl-all h3 {
    margin: 4px 0 8px;
    font-family: var(--cy-mono);
    font-size: 13px;
    font-weight: normal;
    letter-spacing: 0.22em;
    text-transform: uppercase;
    color: var(--cy-acid);
}

.ctl-all h3::before {
    content: '// ';
    color: var(--cy-mag);
}

.ctl-list,
.ctl-cheat-list {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 12px;
}

.ctl-lg {
    display: flex;
    flex-direction: column;
    gap: 3px;
    min-width: 0;
}

.ctl-lh {
    display: flex;
    align-items: center;
    gap: 7px;
    margin-bottom: 4px;
    font-family: var(--cy-mono);
    font-size: 12px;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: rgb(var(--g));
}

/* F1 в бою */
#ctl-cheat {
    position: fixed;
    left: 50%;
    top: 50%;
    z-index: 1500;
    width: min(1100px, 94vw);
    max-height: 86vh;
    overflow: hidden;
    padding: 16px 20px 18px;
    box-sizing: border-box;
    color: var(--cy-txt);
    font-family: var(--cy-body);
    background: rgba(7, 6, 15, 0.86);
    border: 1px solid rgba(255, 43, 214, 0.5);
    clip-path: var(--cy-cut);
    box-shadow: inset 0 0 50px rgba(255, 43, 214, 0.15);
    pointer-events: none;
    opacity: 0;
    visibility: hidden;
    transform: translate(-50%, -50%) scale(0.97);
    transition: opacity 0.15s, transform 0.15s, visibility 0.15s;
}

#ctl-cheat.on {
    opacity: 1;
    visibility: visible;
    transform: translate(-50%, -50%);
}

.ctl-cheat-head {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    margin-bottom: 12px;
    font-family: var(--cy-mono);
    letter-spacing: 0.2em;
    text-transform: uppercase;
}

.ctl-cheat-head b {
    font-family: var(--cy-disp);
    font-size: 18px;
    font-style: italic;
    color: #fff;
    text-shadow: 0 0 14px rgba(255, 43, 214, 0.8);
}

.ctl-cheat-head span {
    font-size: 12px;
    color: var(--cy-dim);
}

#ctl-cheat .ctl-cheat-list {
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 10px;
}

#ctl-cheat .ctl-li {
    cursor: default;
    padding: 2px 5px;
    font-size: 13px;
}

#ctl-cheat kbd {
    font-size: 10px;
    padding: 0 5px;
}

/* Подсказка «F1 — управление» в первых боях */
#ctl-f1hint {
    position: fixed;
    left: 50%;
    top: 118px;
    z-index: 1400;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 7px 16px;
    font-family: var(--cy-mono);
    font-size: 13px;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: var(--cy-txt);
    background: rgba(7, 6, 15, 0.82);
    border: 1px solid rgba(0, 240, 255, 0.45);
    clip-path: var(--cy-cut2);
    pointer-events: none;
    opacity: 0;
    transform: translate(-50%, -8px);
    transition: opacity 0.3s, transform 0.3s;
}

#ctl-f1hint.on {
    opacity: 1;
    transform: translate(-50%, 0);
    animation: cyFlicker 3s infinite;
}

@media (max-width: 1100px) {
    .ctl-main {
        grid-template-columns: minmax(0, 1fr);
    }
    .ctl-stage {
        height: clamp(280px, 48vh, 520px);
    }
    .ctl-list {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

@media (max-width: 760px) {
    #controlsOverlay {
        padding-top: 38px;
    }
    .ctl-tabs {
        order: 3;
        width: 100%;
        margin-left: 0;
    }
    .ctl-tabs button {
        flex: 1;
        padding: 8px 4px !important;
        font-size: 10px !important;
    }
    .ctl-practice {
        grid-template-columns: minmax(0, 1fr);
        grid-template-areas: 'title' 'tasks' 'fight';
    }
    .ctl-tasks {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
    #controlsOverlay #ctlFight {
        justify-content: center;
        min-height: 50px;
    }
    .ctl-list {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
    .ctl-meter {
        grid-template-columns: 58px 80px auto;
    }
    .ctl-cap-txt small {
        font-size: 13px;
    }
}

@media (max-width: 480px) {
    .ctl-meter em {
        display: none;
    }
}

/* Телефон боком: сцена и схема рядом, экран прокручивается */
@media (max-height: 520px) and (orientation: landscape) {
    #controlsOverlay {
        padding: 30px 12px 14px;
    }
    .ctl-main {
        grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    }
    .ctl-stage {
        height: calc(100vh - 92px);
        min-height: 230px;
    }
    .ctl-caption {
        padding: 6px 10px;
    }
    .ctl-cap-txt small {
        display: none;
    }
    .ctl-hud .ctl-meter span {
        display: none;
    }
    .ctl-head {
        gap: 10px;
    }
    .ctl-head h2 {
        font-size: 18px;
    }
    #controlsOverlay .ctl-head button {
        padding: 6px 10px;
        font-size: 10px;
    }
    .ctl-tabs {
        gap: 4px;
    }
}

/* Чат — часть боя. В меню (после выхода из боя) он оставался поверх экрана и перекрывал нижние пункты меню */
#application-canvas:not([style*="display: block"]) ~ #chat-container {
    display: none !important;
}

/* =====================================================================
   «Брифинг пилота» (briefing.js): как летает корабль — окно над меню
   ===================================================================== */
#briefing {
    position: fixed;
    inset: 0;
    z-index: 2000;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 16px;
    box-sizing: border-box;
    background: rgba(4, 3, 10, 0.74);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
}

#briefing.on {
    display: flex;
}

#briefing [data-group="move"] { --g: 0, 240, 255; }
#briefing [data-group="rotate"] { --g: 255, 43, 214; }
#briefing [data-group="combat"] { --g: 255, 59, 92; }
#briefing [data-group="target"] { --g: 245, 255, 59; }
#briefing [data-group="system"] { --g: 234, 246, 255; }

.brf-box {
    position: relative;
    display: flex;
    flex-direction: column;
    width: min(980px, 100%);
    max-height: min(92vh, 900px);
    box-sizing: border-box;
    color: var(--cy-txt);
    font-family: var(--cy-body);
    background: linear-gradient(160deg, rgba(22, 8, 34, 0.97), rgba(7, 6, 15, 0.98));
    border: 1px solid rgba(255, 43, 214, 0.55);
    clip-path: var(--cy-cut);
    box-shadow: inset 0 0 60px rgba(255, 43, 214, 0.14);
    animation: cyIn 0.35s ease-out both;
}

.brf-box::after {
    content: '';
    position: absolute;
    inset: 0;
    background: repeating-linear-gradient(0deg, rgba(0, 0, 0, 0.16) 0 1px, transparent 1px 3px);
    pointer-events: none;
}

#briefing .brf-x {
    position: absolute;
    top: 12px;
    right: 18px;
    z-index: 2;
    width: 38px;
    height: 38px;
    padding: 0;
    font-size: 18px;
    line-height: 1;
    color: var(--cy-dim);
    background: rgba(7, 6, 15, 0.6);
    border: 1px solid rgba(234, 246, 255, 0.2);
    border-radius: 0;
    cursor: pointer;
    transition: color 0.15s, border-color 0.15s, box-shadow 0.15s;
}

#briefing .brf-x:hover,
#briefing .brf-x:focus {
    outline: none;
    color: #fff;
    border-color: var(--cy-mag);
    box-shadow: 0 0 14px rgba(255, 43, 214, 0.6);
}

.brf-head {
    padding: 22px 70px 12px 28px;
    border-bottom: 1px solid var(--cy-line);
}

.brf-tag {
    font-family: var(--cy-mono);
    font-size: 12px;
    letter-spacing: 0.3em;
    text-transform: uppercase;
    color: var(--cy-mag);
    text-shadow: 0 0 10px var(--cy-mag);
}

.brf-head h3 {
    margin: 8px 0 6px;
    font-family: var(--cy-disp);
    font-size: clamp(18px, 2.2vw, 26px);
    font-weight: 900;
    font-style: italic;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: #fff;
    text-shadow: 0 0 18px rgba(0, 240, 255, 0.7);
}

.brf-head p {
    margin: 0;
    font-size: 18px;
    line-height: 1.35;
    color: var(--cy-acid);
}

.brf-scroll {
    position: relative;
    z-index: 1;
    overflow-y: auto;
    padding: 16px 28px 6px;
    overscroll-behavior: contain;
}

/* Ниже есть ещё текст — низ прокрутки плавно гаснет (класс end ставит briefing.js) */
.brf-scroll:not(.end) {
    -webkit-mask-image: linear-gradient(180deg, #000 calc(100% - 40px), transparent);
    mask-image: linear-gradient(180deg, #000 calc(100% - 40px), transparent);
}

/* Восемь правил — карточки в две колонки */
.brf-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
}

.brf-pt {
    display: flex;
    gap: 12px;
    padding: 11px 14px 12px;
    background: rgba(4, 3, 12, 0.75);
    border: 1px solid rgba(var(--g), 0.22);
    border-left: 3px solid rgb(var(--g));
    clip-path: polygon(0 0, calc(100% - 10px) 0, 100% 10px, 100% 100%, 0 100%);
}

.brf-pt > i {
    flex: none;
    font-style: normal;
    font-family: var(--cy-mono);
    font-size: 15px;
    color: rgb(var(--g));
    text-shadow: 0 0 8px rgba(var(--g), 0.8);
}

.brf-pt b {
    display: block;
    margin-bottom: 4px;
    font-family: var(--cy-disp);
    font-size: 13px;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: #fff;
}

.brf-pt p,
.brf-ex-text p {
    margin: 0;
    font-size: 16px;
    line-height: 1.42;
    color: rgba(234, 246, 255, 0.82);
}

#briefing kbd {
    padding: 0 5px;
    font-size: 11px;
    vertical-align: 1px;
}

/* Пример со схемой */
.brf-example {
    display: grid;
    grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr);
    gap: 16px;
    align-items: center;
    margin-top: 12px;
    padding: 14px 16px;
    background: rgba(245, 255, 59, 0.05);
    border: 1px solid rgba(245, 255, 59, 0.35);
    clip-path: var(--cy-cut2);
}

.brf-ex-text > b {
    display: block;
    margin-bottom: 6px;
    font-family: var(--cy-mono);
    font-size: 13px;
    font-weight: normal;
    letter-spacing: 0.22em;
    text-transform: uppercase;
    color: var(--cy-acid);
}

.brf-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 4px 16px;
    margin-top: 10px;
    font-family: var(--cy-mono);
    font-size: 12px;
    color: var(--cy-dim);
}

.brf-legend span::before {
    content: '━━▶';
    margin-right: 6px;
    letter-spacing: -0.1em;
}

.brf-legend .nose::before {
    color: var(--cy-cyan);
    text-shadow: 0 0 6px var(--cy-cyan);
}

.brf-legend .vel::before {
    color: var(--cy-acid);
    text-shadow: 0 0 6px var(--cy-acid);
}

.brf-svg {
    display: block;
    width: 100%;
}

.brf-svg .panel rect {
    fill: rgba(7, 6, 15, 0.8);
    stroke: rgba(0, 240, 255, 0.18);
    stroke-width: 1;
}

.brf-svg .ship {
    fill: #eaf6ff;
    stroke: var(--cy-cyan);
    stroke-width: 1.5;
    filter: drop-shadow(0 0 4px rgba(0, 240, 255, 0.8));
}

.brf-svg .nose,
.brf-svg .vel,
.brf-svg .trail {
    fill: none;
    stroke-width: 3;
    stroke-linecap: round;
}

.brf-svg .nose {
    stroke: var(--cy-cyan);
}

.brf-svg .vel {
    stroke: var(--cy-acid);
}

.brf-svg .trail {
    stroke: rgba(245, 255, 59, 0.45);
    stroke-width: 2;
    stroke-dasharray: 3 6;
}

.brf-svg .flame {
    fill: var(--cy-mag);
    filter: drop-shadow(0 0 5px var(--cy-mag));
}

.brf-svg .cap {
    fill: rgba(234, 246, 255, 0.75);
    font-family: var(--cy-body);
    font-size: 12px;
    font-weight: 600;
}

.brf-svg .cap .n {
    fill: var(--cy-acid);
    font-family: var(--cy-mono);
}

/* Совет */
.brf-tip {
    display: flex;
    align-items: baseline;
    gap: 12px;
    margin: 12px 0 10px;
    padding: 11px 16px;
    font-size: 16px;
    line-height: 1.4;
    background: rgba(255, 43, 214, 0.08);
    border-left: 3px solid var(--cy-mag);
}

.brf-tip b {
    flex: none;
    font-family: var(--cy-mono);
    font-weight: normal;
    font-size: 13px;
    letter-spacing: 0.22em;
    text-transform: uppercase;
    color: var(--cy-mag);
}

/* Низ окна: галочка и кнопки */
.brf-foot {
    position: relative;
    z-index: 1;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 28px 18px;
    border-top: 1px solid var(--cy-line);
}

.brf-never {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-right: auto;
    font-family: var(--cy-mono);
    font-size: 12px;
    letter-spacing: 0.08em;
    color: var(--cy-dim);
    cursor: pointer;
}

.brf-never input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.brf-never i {
    position: relative;
    width: 16px;
    height: 16px;
    flex: none;
    border: 1px solid rgba(0, 240, 255, 0.55);
    background: rgba(0, 240, 255, 0.05);
}

.brf-never input:checked + i {
    background: var(--cy-cyan);
    box-shadow: 0 0 10px rgba(0, 240, 255, 0.7);
}

.brf-never input:checked + i::after {
    content: '✓';
    position: absolute;
    inset: 0;
    display: grid;
    place-items: center;
    font-style: normal;
    font-size: 12px;
    color: #07060f;
}

.brf-never input:focus-visible + i {
    outline: 1px solid #fff;
    outline-offset: 2px;
}

#briefing .brf-foot button {
    min-height: 46px;
    padding: 0 20px;
    font-family: var(--cy-disp);
    font-size: 13px;
    font-weight: 800;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--cy-cyan);
    background: rgba(0, 240, 255, 0.08);
    border: 1px solid rgba(0, 240, 255, 0.45);
    border-radius: 0;
    clip-path: var(--cy-cut2);
    cursor: pointer;
    transition: box-shadow 0.15s, background 0.15s;
}

#briefing #brfFight {
    min-width: 170px;
    font-size: 16px;
    font-style: italic;
    font-weight: 900;
    color: #0b0010;
    border: none;
    background:
        repeating-linear-gradient(-45deg, rgba(0, 0, 0, 0.12) 0 8px, transparent 8px 16px),
        var(--cy-mag);
}

#brfFight i {
    font-style: normal;
}

#briefing .brf-foot button:hover,
#briefing .brf-foot button:focus {
    outline: none;
    box-shadow: 0 0 20px rgba(255, 43, 214, 0.55);
}

/* Кнопка «Как летает корабль» под «В бой» */
#mainMenuOverlay > .cy-brief-row {
    margin: -8px 0 14px;
    animation: cyIn 0.45s ease-out 0.03s both;
}

#mainMenuOverlay #briefingLink {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    margin: 0;
    padding: 6px 14px 6px 8px;
    font-family: var(--cy-mono);
    font-size: 13px;
    font-weight: normal;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--cy-acid);
    background: rgba(245, 255, 59, 0.05);
    -webkit-background-clip: border-box;
    background-clip: border-box;
    border: 1px solid rgba(245, 255, 59, 0.3);
    clip-path: var(--cy-cut2);
    text-shadow: none;
    animation: none;
    transform: none;
    transition: background 0.15s, box-shadow 0.15s;
}

#mainMenuOverlay #briefingLink b {
    display: grid;
    place-items: center;
    width: 20px;
    height: 20px;
    font-family: var(--cy-disp);
    font-size: 12px;
    font-style: italic;
    text-transform: none;
    color: #07060f;
    background: var(--cy-acid);
}

#mainMenuOverlay #briefingLink:hover,
#mainMenuOverlay #briefingLink:focus {
    outline: none;
    background: rgba(245, 255, 59, 0.16);
    box-shadow: 0 0 16px rgba(245, 255, 59, 0.35);
}

@media (max-width: 760px) {
    .brf-grid,
    .brf-example {
        grid-template-columns: minmax(0, 1fr);
    }
    .brf-head {
        padding: 16px 60px 10px 16px;
    }
    .brf-scroll {
        padding: 12px 16px 4px;
    }
    .brf-foot {
        flex-wrap: wrap;
        padding: 10px 16px 14px;
    }
    .brf-never {
        width: 100%;
    }
    #briefing .brf-foot button {
        flex: 1;
    }
}

@media (max-height: 520px) {
    #mainMenuOverlay > .cy-brief-row {
        margin: -4px 0 6px;
    }
    #mainMenuOverlay #briefingLink {
        padding: 3px 10px 3px 6px;
        font-size: 11px;
    }
    #briefing {
        padding: 6px;
    }
    .brf-box {
        max-height: calc(100vh - 12px);
    }
    .brf-head {
        padding: 8px 60px 6px 18px;
    }
    .brf-tag {
        font-size: 10px;
    }
    .brf-head h3 {
        margin: 2px 0;
        font-size: 16px;
    }
    .brf-head p {
        font-size: 14px;
    }
    .brf-scroll {
        padding: 10px 18px 4px;
    }
    .brf-foot {
        padding: 6px 18px 8px;
    }
    #briefing .brf-foot button {
        min-height: 36px;
    }
    #briefing .brf-x {
        top: 8px;
        width: 32px;
        height: 32px;
    }
}
