/* ==========================================================
   НИИ «СФЕРА»
   v5 · компактная вёрстка
   ========================================================== */

:root {
    --bg:      #000000;
    --ink:     #d4ccbd;
    --ink-dim: #706860;
    --ink-mid: #a09684;
    --red:     #a01818;
    --red-hi:  #e02020;
    --amber:   #c89a4a;
    --green:   #3a9a5c;
    --paper:   #0a0a0a;
    --font-px: 'Handjet', 'VT323', monospace;
    --font-tx: 'VT323', monospace;
    --font-mn: 'JetBrains Mono', monospace;

    --pad:     clamp(10px, 2vw, 16px);
    --gap:     clamp(12px, 1.8vw, 20px);
    --safe-top:    env(safe-area-inset-top, 0px);
    --safe-bottom: env(safe-area-inset-bottom, 0px);
    --safe-left:   env(safe-area-inset-left, 0px);
    --safe-right:  env(safe-area-inset-right, 0px);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html {
    background: #000;
    overflow-x: clip;
    overflow-y: auto;
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
    overscroll-behavior-y: none;
}

body {
    background: var(--bg);
    color: var(--ink);
    font-family: var(--font-tx);
    font-size: clamp(14px, 1.2vw + 10px, 17px);
    line-height: 1.4;
    min-height: 100vh;
    min-height: 100dvh;
    overflow-x: clip;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    cursor: crosshair;
    animation: breathe 12s ease-in-out infinite;
    padding-left: var(--safe-left);
    padding-right: var(--safe-right);
}

html.is-locked, body.is-locked {
    overflow: hidden !important;
    height: 100vh;
    height: 100dvh;
    position: fixed;
    inset: 0;
    width: 100%;
}

@keyframes breathe {
    0%, 100% { filter: brightness(1.04) contrast(1.02); }
    50%      { filter: brightness(0.98) contrast(1.06); }
}

::selection { background: var(--red); color: #fff; }

a { color: inherit; text-decoration: none; -webkit-tap-highlight-color: transparent; }
button, input, textarea, select {
    font: inherit;
    color: inherit;
    background: none;
    border: none;
    -webkit-appearance: none;
    appearance: none;
    border-radius: 0;
    font-family: inherit;
}
button { cursor: pointer; touch-action: manipulation; }
input[type="checkbox"] { -webkit-appearance: none; appearance: none; }
input[type="range"] { -webkit-appearance: none; appearance: none; }

img, svg, canvas, video {
    max-width: 100%;
    height: auto;
    display: block;
}

/* ==========================================================
   ЭФФЕКТЫ
   ========================================================== */
.fx {
    position: fixed;
    inset: 0;
    pointer-events: none;
    contain: strict;
}

.fx--scanlines {
    z-index: 990;
    background: repeating-linear-gradient(
        to bottom,
        transparent 0,
        transparent 2px,
        rgba(0,0,0,0.42) 3px,
        rgba(0,0,0,0.42) 4px
    );
    mix-blend-mode: multiply;
}

.fx--noise {
    z-index: 991;
    background-image:
        radial-gradient(circle at 20% 30%, rgba(255,255,255,0.035) 1px, transparent 1.5px),
        radial-gradient(circle at 70% 60%, rgba(255,255,255,0.03) 1px, transparent 1.5px),
        radial-gradient(circle at 40% 80%, rgba(255,255,255,0.025) 1px, transparent 1.5px);
    background-size: 3px 3px, 4px 4px, 5px 5px;
    opacity: 0.55;
    animation: noiseMove 0.24s steps(3) infinite;
}
@keyframes noiseMove {
    0%   { background-position: 0 0, 0 0, 0 0; }
    33%  { background-position: -4px 2px, 3px -3px, -2px 4px; }
    66%  { background-position: 3px -3px, -2px 4px, 4px -1px; }
    100% { background-position: 0 0, 0 0, 0 0; }
}

.fx--vignette {
    z-index: 993;
    background:
        radial-gradient(ellipse 80% 70% at center,
            transparent 0%,
            transparent 22%,
            rgba(0,0,0,0.20) 42%,
            rgba(0,0,0,0.62) 65%,
            rgba(0,0,0,0.92) 88%,
            rgba(0,0,0,1) 100%),
        radial-gradient(ellipse 100% 100% at center,
            transparent 30%,
            rgba(40,0,0,0.35) 78%,
            rgba(70,0,0,0.6) 100%);
}

.fx--grain {
    z-index: 992;
    background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='120' height='120'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.35 0'/></filter><rect width='100%25' height='100%25' filter='url(%23n)'/></svg>");
    background-size: 240px 240px;
    opacity: 0.6;
    animation: grain 0.5s steps(4) infinite;
    mix-blend-mode: overlay;
}
@keyframes grain {
    0%   { background-position: 0 0; }
    25%  { background-position: -20px 15px; }
    50%  { background-position: 15px -20px; }
    75%  { background-position: -15px -15px; }
    100% { background-position: 20px 10px; }
}

.fx--edge {
    z-index: 994;
    box-shadow:
        inset 0 0 120px 20px rgba(0,0,0,0.9),
        inset 0 0 300px 60px rgba(0,0,0,0.65);
}

.fx--glitch {
    z-index: 996;
    opacity: 0;
    mix-blend-mode: screen;
    transition: opacity 0.06s;
    background:
        repeating-linear-gradient(
            to bottom,
            transparent 0px,
            transparent 32px,
            rgba(120,10,10,0.55) 32px,
            rgba(120,10,10,0.55) 34px,
            transparent 34px,
            transparent 80px
        ),
        repeating-linear-gradient(
            to bottom,
            transparent 0px,
            transparent 48px,
            rgba(160,20,20,0.4) 48px,
            rgba(160,20,20,0.4) 50px,
            transparent 50px,
            transparent 120px
        );
}
.fx--glitch.on { opacity: 1; animation: glitchSlice 0.18s steps(2) infinite; }
@keyframes glitchSlice {
    0%   { transform: translateY(0); }
    50%  { transform: translateY(-4px); }
    100% { transform: translateY(3px); }
}

/* ==========================================================
   Пиксельный переход
   ========================================================== */
.pixel-canvas {
    position: fixed;
    inset: 0;
    z-index: 9990;
    pointer-events: none;
    image-rendering: pixelated;
    image-rendering: -moz-crisp-edges;
    image-rendering: crisp-edges;
    opacity: 0;
    transition: opacity 0.08s linear;
    width: 100%;
    height: 100%;
}
.pixel-canvas.active { opacity: 1; }

/* ==========================================================
   Кровь
   ========================================================== */
.blood {
    position: fixed;
    inset: 0;
    z-index: 9988;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.4s;
}
.blood.on { opacity: 1; }
.blood::before, .blood::after {
    content: '';
    position: absolute;
    left: 0; right: 0; top: 0;
    height: 0;
    background: linear-gradient(to bottom, #3a0505, #1a0000 60%, transparent);
    filter: blur(0.5px);
}
.blood::after { left: auto; right: 15%; width: 8%; }
.blood.on::before { animation: bleed 5s ease-out forwards; }
.blood.on::after  { animation: bleed 6s ease-out forwards; animation-delay: 0.4s; }
@keyframes bleed {
    0%   { height: 0; }
    35%  { height: 60%; }
    60%  { height: 65%; }
    100% { height: 85%; }
}

/* ==========================================================
   Скримеры
   ========================================================== */
.scream {
    position: fixed;
    inset: 0;
    z-index: 99999;
    display: none;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    background: #000;
    padding: 20px;
}
.scream.on { display: flex; }

.scream__inner {
    max-width: 100%;
    text-align: center;
    word-break: break-word;
}

.scream--face .scream__inner {
    font-family: var(--font-px);
    font-weight: 800;
    font-size: clamp(36px, 16vw, 260px);
    color: #fff;
    text-shadow:
        3px 0 #d81a1a, -3px 0 #00d0d0,
        0 0 40px #d81a1a, 0 0 100px #d81a1a;
    letter-spacing: clamp(2px, 1vw, 6px);
    animation: shake 0.05s infinite;
    transform: scaleY(1.35);
}
@keyframes shake {
    0%   { transform: translate(0,0) scaleY(1.35); }
    25%  { transform: translate(-6px,3px) scaleY(1.35); }
    50%  { transform: translate(5px,-5px) scaleY(1.35); }
    75%  { transform: translate(-3px,-2px) scaleY(1.35); }
    100% { transform: translate(3px,5px) scaleY(1.35); }
}

.scream--blade { background: #6b0000; }
.scream--blade .scream__inner {
    font-family: var(--font-px);
    font-weight: 800;
    font-size: clamp(24px, 10vw, 160px);
    color: #000;
    letter-spacing: clamp(2px, 0.8vw, 6px);
    line-height: 1.05;
    animation: shake 0.04s infinite;
}

.scream--static { background: #000; }
.scream--static .scream__inner {
    position: absolute; inset: 0;
    background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='200' height='200'><filter id='s'><feTurbulence type='fractalNoise' baseFrequency='1.6' numOctaves='1'/></filter><rect width='100%25' height='100%25' filter='url(%23s)'/></svg>");
    animation: staticMove 0.08s steps(2) infinite;
    max-width: none;
    text-align: inherit;
}
@keyframes staticMove {
    0%   { background-position: 0 0; }
    25%  { background-position: -20px 10px; }
    50%  { background-position: 10px -16px; }
    75%  { background-position: -10px -10px; }
    100% { background-position: 16px 12px; }
}
.scream--static::after {
    content: 'СТОЙ';
    position: absolute; inset: 0;
    display: flex; align-items: center; justify-content: center;
    font-family: var(--font-px);
    font-weight: 800;
    font-size: clamp(36px, 14vw, 220px);
    color: #fff;
    text-shadow: 4px 0 #d81a1a;
    mix-blend-mode: difference;
    z-index: 1;
    padding: 20px;
    text-align: center;
}

.scream--blood { background: #000; }
.scream--blood::before {
    content: '';
    position: absolute; inset: 0;
    background:
        radial-gradient(circle at 30% 30%, #7a0000 0%, transparent 40%),
        radial-gradient(circle at 70% 60%, #5a0000 0%, transparent 45%),
        radial-gradient(circle at 50% 90%, #8a0000 0%, transparent 50%);
    animation: bloodPulse 0.35s ease-out infinite alternate;
}
@keyframes bloodPulse {
    0%   { transform: scale(1); filter: brightness(0.7); }
    100% { transform: scale(1.08); filter: brightness(1.3); }
}
.scream--blood .scream__inner {
    position: relative; z-index: 1;
    font-family: var(--font-px);
    font-weight: 800;
    font-size: clamp(30px, 12vw, 200px);
    color: #000;
    text-shadow: 0 0 30px #d81a1a;
    letter-spacing: clamp(2px, 1vw, 4px);
    animation: shake 0.03s infinite;
}

.scream--glitch { background: #000; }
.scream--glitch .scream__inner {
    font-family: var(--font-px);
    font-weight: 800;
    font-size: clamp(22px, 8vw, 140px);
    color: #fff;
    letter-spacing: clamp(2px, 0.8vw, 4px);
    line-height: 1.05;
    animation: glitchText 0.08s steps(2) infinite;
}
@keyframes glitchText {
    0%   { text-shadow: 3px 0 #d81a1a, -3px 0 #00d0d0; transform: translate(0); }
    50%  { text-shadow: -4px 0 #d81a1a, 4px 0 #00d0d0; transform: translate(-3px, 2px); }
    100% { text-shadow: 2px 0 #d81a1a, -2px 0 #00d0d0; transform: translate(2px, -1px); }
}

.scream--void { background: #000; }
.scream--void .scream__inner {
    font-family: var(--font-px);
    font-weight: 400;
    font-size: clamp(18px, 4vw, 48px);
    color: #666;
    letter-spacing: clamp(4px, 2vw, 10px);
    animation: fadeIn 0.8s ease-in;
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

/* ==========================================================
   Boot
   ========================================================== */
.boot {
    position: fixed;
    inset: 0;
    z-index: 10001;
    background: #000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: clamp(16px, 4vw, 30px);
}
.boot.done { display: none; }
.boot__scan {
    position: absolute;
    left: 0; right: 0;
    height: 2px;
    background: linear-gradient(to right, transparent, rgba(180,180,180,0.55), transparent);
    animation: scanLine 2.2s ease-in-out;
}
@keyframes scanLine {
    0%   { top: 0; opacity: 0; }
    10%  { opacity: 1; }
    90%  { opacity: 1; }
    100% { top: 100%; opacity: 0; }
}
.boot__log {
    font-family: var(--font-mn);
    font-size: clamp(10px, 1.1vw + 6px, 12px);
    color: #5aa85a;
    letter-spacing: 1px;
    white-space: pre-wrap;
    max-width: 100%;
    line-height: 1.6;
    text-shadow: 0 0 8px rgba(90,168,90,0.4);
    overflow-wrap: anywhere;
}

/* ==========================================================
   Согласие
   ========================================================== */
.oath {
    position: fixed;
    inset: 0;
    z-index: 9950;
    background: #000;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding: calc(22px + var(--safe-top)) clamp(12px, 3vw, 18px) calc(40px + var(--safe-bottom));
    transition: opacity 0.9s, filter 0.9s;
}
.oath.gone { opacity: 0; filter: blur(20px); pointer-events: none; }

.oath__wrap {
    max-width: 520px;
    margin: 0 auto;
    padding: clamp(16px, 3vw, 24px) clamp(14px, 3vw, 24px) clamp(18px, 3vw, 26px);
    background: var(--paper);
    border: 1px solid #161616;
    position: relative;
    box-shadow:
        inset 0 0 60px rgba(0,0,0,0.7),
        0 0 0 1px rgba(255,255,255,0.015);
    animation: oathIn 0.9s ease-out;
}
.oath__wrap::before {
    content: '';
    position: absolute; top: 0; left: 0; right: 0;
    height: 1px;
    background: linear-gradient(to right, transparent, rgba(160,24,24,0.6), transparent);
}
@keyframes oathIn {
    from { opacity: 0; transform: translateY(10px); filter: blur(3px); }
    to   { opacity: 1; transform: none; filter: none; }
}

.oath__stamp {
    font-family: var(--font-mn);
    font-size: clamp(9px, 0.8vw + 6px, 10px);
    letter-spacing: clamp(2px, 0.5vw, 3px);
    color: var(--red-hi);
    text-align: center;
    margin-bottom: 14px;
    padding-bottom: 10px;
    border-bottom: 1px dashed #1a1a1a;
}

.oath__title {
    font-family: var(--font-px);
    font-weight: 800;
    font-size: clamp(22px, 6vw, 40px);
    line-height: 1.05;
    letter-spacing: clamp(2px, 0.6vw, 3px);
    color: #f0e8d8;
    text-align: center;
    margin-bottom: 12px;
    text-shadow: 2px 2px 0 rgba(160,24,24,0.7), 0 0 30px rgba(160,24,24,0.25);
    animation: oathGlitch 6s infinite;
}
@keyframes oathGlitch {
    0%, 93%, 100% { transform: none; }
    94%           { transform: translate(-2px, 1px) skewX(2deg); }
    96%           { transform: translate(2px, -1px) skewX(-2deg); }
}

.oath__lead {
    font-size: clamp(13px, 1.2vw + 9px, 15px);
    color: var(--ink-mid);
    text-align: center;
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px dashed #1a1a1a;
    line-height: 1.45;
}

.oath__list { list-style: none; }
.oath__item { margin-bottom: 2px; }

.oath__item label {
    display: flex;
    gap: clamp(10px, 1.6vw, 13px);
    align-items: flex-start;
    cursor: pointer;
    padding: clamp(6px, 1.2vw, 8px) clamp(4px, 1.2vw, 6px);
    transition: background 0.2s;
    border-left: 2px solid transparent;
    -webkit-tap-highlight-color: transparent;
    min-height: 40px;
}
.oath__item label:hover,
.oath__item label:active {
    background: rgba(160,24,24,0.05);
    border-left-color: rgba(160,24,24,0.5);
}

.oath__chk {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.oath__box {
    flex-shrink: 0;
    width: clamp(18px, 2vw, 22px);
    height: clamp(18px, 2vw, 22px);
    border: 2px solid #3a3a3a;
    background: #060606;
    position: relative;
    margin-top: 2px;
    transition: all 0.22s;
}
.oath__chk:checked + .oath__box {
    border-color: var(--red-hi);
    background: #1a0505;
    box-shadow: 0 0 16px rgba(224,32,32,0.55), inset 0 0 10px rgba(224,32,32,0.35);
}
.oath__chk:checked + .oath__box::after {
    content: '';
    position: absolute;
    inset: 4px;
    background: var(--red-hi);
}

.oath__text {
    font-size: clamp(13px, 1.2vw + 9px, 15px);
    line-height: 1.35;
    color: var(--ink);
    transition: color 0.2s;
}
.oath__chk:checked ~ .oath__text { color: #eadfc8; }
.oath__item--last .oath__text { color: var(--amber); font-style: italic; }

.oath__toggle {
    margin-top: 14px;
    padding-top: 12px;
    border-top: 1px dashed #1c1c1c;
}
.oath__toggle label {
    display: inline-flex;
    gap: 10px;
    align-items: center;
    cursor: pointer;
    padding: 6px 4px;
    min-height: 40px;
    -webkit-tap-highlight-color: transparent;
}
.oath__toggle input { position: absolute; opacity: 0; pointer-events: none; }
.oath__switch {
    width: 38px;
    height: 20px;
    background: #141414;
    border: 1px solid #2e2e2e;
    border-radius: 10px;
    position: relative;
    transition: all 0.25s;
    flex-shrink: 0;
}
.oath__switch i {
    position: absolute;
    top: 2px; left: 2px;
    width: 14px; height: 14px;
    background: #4a4a4a;
    border-radius: 50%;
    transition: all 0.25s;
}
.oath__toggle input:checked + .oath__switch {
    background: #2a0000;
    border-color: var(--red-hi);
    box-shadow: 0 0 14px rgba(224,32,32,0.4);
}
.oath__toggle input:checked + .oath__switch i {
    left: 20px;
    background: var(--red-hi);
    box-shadow: 0 0 8px var(--red-hi);
}
.oath__switch-txt {
    font-family: var(--font-mn);
    font-size: clamp(10px, 0.9vw + 6px, 11px);
    letter-spacing: 2px;
    color: #8a8070;
}
.oath__toggle input:checked ~ .oath__switch-txt { color: var(--amber); }

.oath__btn {
    display: block;
    width: 100%;
    margin-top: 18px;
    padding: clamp(11px, 2vw, 15px) clamp(10px, 1.6vw, 14px);
    font-family: var(--font-px);
    font-weight: 800;
    font-size: clamp(16px, 2.4vw, 24px);
    letter-spacing: clamp(4px, 1vw, 6px);
    color: var(--red-hi);
    background: linear-gradient(180deg, #1a0000, #080000);
    border: 2px solid var(--red-hi);
    box-shadow:
        0 0 24px rgba(224,32,32,0.3),
        inset 0 0 24px rgba(224,32,32,0.18);
    transition: all 0.25s;
    min-height: 44px;
    touch-action: manipulation;
}
.oath__btn:disabled {
    color: #3a3a3a;
    background: #0a0a0a;
    border-color: #222;
    box-shadow: none;
    cursor: not-allowed;
}
.oath__btn:not(:disabled):active { transform: scale(0.98); }
@media (hover: hover) {
    .oath__btn:not(:disabled):hover {
        background: linear-gradient(180deg, #3a0000, #1c0000);
        color: #fff;
        letter-spacing: clamp(5px, 1.2vw, 8px);
        box-shadow:
            0 0 50px rgba(224,32,32,0.65),
            inset 0 0 32px rgba(224,32,32,0.45);
        text-shadow: 0 0 20px var(--red-hi);
    }
}

.oath__hint {
    margin-top: 14px;
    text-align: center;
    font-size: clamp(10px, 0.9vw + 6px, 11px);
    color: #4a4a4a;
    letter-spacing: 2px;
    font-style: italic;
}

/* ==========================================================
   Основной каркас
   ========================================================== */
.shell {
    position: relative;
    z-index: 10;
    max-width: 840px;
    margin: 0 auto;
    padding: 0 var(--pad) calc(36px + var(--safe-bottom));
    animation: shellIn 1s ease-out;
}
@keyframes shellIn {
    from { opacity: 0; filter: blur(6px); }
    to   { opacity: 1; filter: none; }
}

.head {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    gap: var(--gap);
    padding: 20px 0 12px;
    margin-bottom: 14px;
    border-bottom: 1px solid #1a1a1a;
    flex-wrap: wrap;
}
.head__left { flex: 1 1 200px; min-width: 0; }
.head__mark {
    display: block;
    font-family: var(--font-px);
    font-weight: 800;
    font-size: clamp(17px, 2.4vw, 22px);
    letter-spacing: clamp(2px, 0.4vw, 3px);
    color: #f4ecdc;
    text-shadow: 2px 2px 0 rgba(160,24,24,0.75), 0 0 24px rgba(160,24,24,0.15);
    transition: text-shadow 0.3s, color 0.3s;
    word-break: break-word;
}
.head__sub {
    display: block;
    font-family: var(--font-mn);
    font-size: clamp(9px, 0.8vw + 6px, 11px);
    color: #a89c88;
    letter-spacing: clamp(1px, 0.3vw, 2px);
    margin-top: 5px;
    line-height: 1.35;
}
.head__right { display: flex; align-items: center; }

.vol { display: flex; align-items: center; gap: clamp(6px, 1.2vw, 10px); }
.vol__label {
    font-family: var(--font-mn);
    font-size: clamp(9px, 0.8vw + 6px, 10px);
    letter-spacing: 2px;
    color: #8a8070;
}
.vol__slider {
    -webkit-appearance: none;
    appearance: none;
    width: clamp(60px, 10vw, 100px);
    height: 4px;
    background: #2a2a2a;
    cursor: pointer;
    outline: none;
    touch-action: manipulation;
}
.vol__slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 12px;
    height: 18px;
    background: var(--red-hi);
    cursor: pointer;
    box-shadow: 0 0 10px var(--red-hi);
    border-radius: 0;
}
.vol__slider::-moz-range-thumb {
    width: 12px;
    height: 18px;
    background: var(--red-hi);
    border: none;
    cursor: pointer;
    box-shadow: 0 0 10px var(--red-hi);
    border-radius: 0;
}
.vol__mute {
    font-family: var(--font-mn);
    font-size: clamp(9px, 0.8vw + 6px, 10px);
    letter-spacing: 2px;
    color: #8a8070;
    padding: 5px 8px;
    border: 1px solid #2a2a2a;
    transition: all 0.2s;
    min-height: 30px;
    min-width: 42px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}
.vol__mute:hover,
.vol__mute:active { color: var(--red-hi); border-color: var(--red-hi); }

/* Табы */
.tabs {
    display: flex;
    gap: 0;
    margin-bottom: var(--gap);
    border-bottom: 1px solid #1a1a1a;
    padding-left: 3px;
    overflow-x: auto;
    overflow-y: hidden;
    scrollbar-width: thin;
    -webkit-overflow-scrolling: touch;
    scroll-snap-type: x proximity;
}
.tabs::-webkit-scrollbar { height: 3px; }
.tabs::-webkit-scrollbar-track { background: #0a0a0a; }
.tabs::-webkit-scrollbar-thumb { background: #2a0000; }

.tab {
    position: relative;
    flex-shrink: 0;
    padding: clamp(9px, 1.1vw, 11px) clamp(11px, 1.4vw, 15px) clamp(8px, 1vw, 10px);
    font-family: var(--font-mn);
    font-size: clamp(9px, 0.85vw + 6px, 11px);
    letter-spacing: clamp(1px, 0.3vw, 2px);
    text-transform: uppercase;
    color: #7d7466;
    border-top: 1px solid #1a1a1a;
    border-left: 1px solid #1a1a1a;
    border-right: 1px solid #1a1a1a;
    margin-right: -1px;
    margin-bottom: -1px;
    background: #050505;
    transition: all 0.22s;
    cursor: pointer;
    white-space: nowrap;
    scroll-snap-align: start;
    min-height: 40px;
    display: inline-flex;
    align-items: center;
}
.tab:hover,
.tab:active {
    color: var(--ink);
    background: #0d0a08;
    border-color: #2e2018;
}
.tab.is-on {
    color: #f0e8d8;
    background: var(--paper);
    border-bottom-color: var(--paper);
}
.tab.is-on::after {
    content: '';
    position: absolute;
    left: 0; right: 0; bottom: -1px;
    height: 2px;
    background: var(--red-hi);
    box-shadow: 0 0 14px rgba(224,32,32,0.8);
}

.content { min-height: 40vh; }

.doc {
    animation: docIn 0.5s ease-out;
    padding: clamp(14px, 2.2vw, 22px) clamp(14px, 2.4vw, 26px) clamp(20px, 2.6vw, 30px);
    background: var(--paper);
    border: 1px solid #141414;
    position: relative;
    box-shadow:
        inset 0 0 60px rgba(0,0,0,0.7),
        0 0 0 1px rgba(255,255,255,0.015);
}
.doc::before {
    content: '';
    position: absolute; top: 0; left: 0; right: 0;
    height: 1px;
    background: linear-gradient(to right, transparent, rgba(160,24,24,0.6), transparent);
}
@keyframes docIn {
    from { opacity: 0; transform: translateY(6px); }
    to   { opacity: 1; transform: none; }
}
.doc--danger { border-color: rgba(160,24,24,0.4); }

.doc__title {
    font-family: var(--font-px);
    font-weight: 800;
    font-size: clamp(17px, 2.8vw, 30px);
    letter-spacing: clamp(2px, 0.5vw, 4px);
    color: #efe6d4;
    margin-bottom: clamp(14px, 2vw, 20px);
    padding-bottom: clamp(10px, 1.4vw, 14px);
    border-bottom: 1px dashed #1e1e1e;
    position: relative;
    word-break: break-word;
    line-height: 1.1;
}
.doc__title::before {
    content: '§';
    color: var(--red-hi);
    margin-right: clamp(8px, 1.2vw, 14px);
    font-size: 0.7em;
    opacity: 0.9;
}

.doc__sub {
    font-family: var(--font-px);
    font-weight: 600;
    font-size: clamp(13px, 1.5vw, 16px);
    letter-spacing: clamp(2px, 0.4vw, 3px);
    color: var(--amber);
    margin: clamp(16px, 2.4vw, 24px) 0 10px;
    padding-left: clamp(8px, 1.2vw, 10px);
    border-left: 3px solid var(--amber);
    line-height: 1.2;
}

.doc p {
    margin-bottom: 10px;
    color: #b8b0a0;
    font-size: clamp(14px, 1.2vw + 10px, 17px);
    line-height: 1.45;
    overflow-wrap: anywhere;
}

.dl {
    display: grid;
    grid-template-columns: minmax(130px, 190px) 1fr;
    gap: 8px 18px;
    margin-top: 8px;
}
.dl dt {
    font-family: var(--font-mn);
    font-size: clamp(9px, 0.85vw + 6px, 11px);
    letter-spacing: 2px;
    color: var(--ink-dim);
    text-transform: uppercase;
    padding-top: 3px;
}
.dl dd {
    color: #d0c8b8;
    font-size: clamp(14px, 1.2vw + 10px, 17px);
    padding-bottom: 9px;
    border-bottom: 1px dashed #141414;
    overflow-wrap: anywhere;
}

.project-lead {
    display: grid;
    gap: 6px;
    padding: clamp(11px, 1.5vw, 15px) clamp(13px, 1.9vw, 18px);
    margin-bottom: 18px;
    border-left: 3px solid var(--red-hi);
    background: rgba(160,24,24,0.05);
    font-size: clamp(13px, 1.1vw + 9px, 16px);
    color: #c8c0b0;
    line-height: 1.45;
}
.project-lead b { color: var(--amber); }

.run {
    padding: clamp(11px, 1.5vw, 15px) clamp(13px, 1.9vw, 18px);
    margin-bottom: clamp(14px, 2.2vw, 22px);
    border: 1px solid #1c1c1c;
    background: rgba(255,255,255,0.014);
    display: grid;
    gap: 7px;
    font-size: clamp(14px, 1.2vw + 10px, 17px);
}
.run__row {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 4px;
}
.run__row span {
    color: var(--ink-dim);
    font-family: var(--font-mn);
    font-size: clamp(9px, 0.85vw + 6px, 11px);
    letter-spacing: 2px;
    text-transform: uppercase;
    flex: 0 0 auto;
    min-width: 0;
}
.run__footer {
    margin-top: 16px;
    padding: clamp(9px, 1.3vw, 11px) clamp(11px, 1.5vw, 15px);
    border-left: 2px solid var(--amber);
    color: var(--amber);
    font-size: clamp(13px, 1.1vw + 9px, 16px);
    letter-spacing: 1px;
    background: rgba(200,154,74,0.06);
    line-height: 1.45;
}

.roles {
    width: 100%;
    border-collapse: collapse;
    font-size: clamp(13px, 1.2vw + 9px, 17px);
}
.roles th {
    text-align: left;
    padding: clamp(8px, 1.1vw, 10px) clamp(10px, 1.4vw, 14px);
    font-family: var(--font-mn);
    font-size: clamp(9px, 0.8vw + 6px, 10px);
    letter-spacing: 2px;
    text-transform: uppercase;
    color: var(--ink-dim);
    border-bottom: 2px solid #1c1c1c;
    background: #030303;
}
.roles td {
    padding: clamp(8px, 1.2vw, 11px) clamp(10px, 1.4vw, 14px);
    border-bottom: 1px dashed #141414;
    transition: all 0.25s;
}
.roles__row:hover,
.roles__row:active { background: rgba(160,24,24,0.08); }
.roles__role {
    font-family: var(--font-px);
    font-weight: 600;
    font-size: clamp(13px, 1.3vw + 9px, 16px);
    letter-spacing: clamp(2px, 0.4vw, 3px);
    color: #5c554c;
    transition: all 0.25s;
    word-break: break-word;
}
.roles__row:hover .roles__role,
.roles__row:active .roles__role {
    color: var(--red-hi);
    letter-spacing: clamp(2px, 0.6vw, 5px);
    text-shadow: 0 0 14px rgba(224,32,32,0.7);
}
.roles__free {
    font-family: var(--font-mn);
    font-size: clamp(11px, 0.95vw + 7px, 13px);
    letter-spacing: 2px;
    color: var(--green);
    transition: all 0.25s;
}
.roles__row:hover .roles__free,
.roles__row:active .roles__free {
    color: var(--red-hi);
    text-shadow: 0 0 10px rgba(224,32,32,0.8);
}
.roles__row.haunt .roles__role {
    color: var(--red-hi);
    animation: hauntJolt 0.4s;
}
@keyframes hauntJolt {
    0%   { transform: translateX(0); }
    25%  { transform: translateX(-5px); }
    75%  { transform: translateX(5px); }
    100% { transform: translateX(0); }
}

/* ==========================================================
   ВЕРТИКАЛЬНЫЙ ТАЙМЛАЙН
   ========================================================== */
.tl {
    position: relative;
    padding: 14px 0;
    display: flex;
    flex-direction: column;
    gap: clamp(14px, 2.2vw, 20px);
}
.tl::before {
    content: '';
    position: absolute;
    top: 6px;
    bottom: 6px;
    left: var(--tl-line, 130px);
    width: 1px;
    background: linear-gradient(to bottom,
        transparent,
        rgba(160,24,24,0.5) 8%,
        rgba(160,24,24,0.65) 50%,
        rgba(160,24,24,0.5) 92%,
        transparent);
}
.tl__row {
    display: grid;
    grid-template-columns: var(--tl-year, 115px) var(--tl-mark, 32px) 1fr;
    gap: 0;
    align-items: flex-start;
    position: relative;
}
.tl__year {
    font-family: var(--font-px);
    font-weight: 800;
    font-size: clamp(12px, 1.2vw + 9px, 15px);
    letter-spacing: 1px;
    color: var(--amber);
    text-align: right;
    padding-top: 4px;
    padding-right: 8px;
    transition: all 0.3s;
    line-height: 1.15;
    word-break: break-word;
}
.tl__row:hover .tl__year,
.tl__row:active .tl__year {
    color: #fff;
    text-shadow: 0 0 16px var(--amber);
}
.tl__mark {
    display: flex;
    justify-content: center;
    padding-top: 8px;
    position: relative;
}
.tl__mark span {
    display: block;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: #000;
    border: 2px solid var(--red-hi);
    box-shadow: 0 0 10px rgba(160,24,24,0.7);
    transition: all 0.3s;
    position: relative;
    z-index: 2;
}
.tl__row:hover .tl__mark span,
.tl__row:active .tl__mark span {
    background: var(--red-hi);
    box-shadow: 0 0 20px var(--red-hi);
    transform: scale(1.25);
}
.tl__row--key .tl__mark span {
    background: var(--red-hi);
    animation: tlPulse 1.8s infinite;
}
@keyframes tlPulse {
    0%, 100% { box-shadow: 0 0 10px rgba(224,32,32,0.6); }
    50%      { box-shadow: 0 0 26px rgba(224,32,32,1); }
}
.tl__card {
    padding: clamp(11px, 1.4vw, 14px) clamp(13px, 1.6vw, 17px) clamp(12px, 1.5vw, 15px);
    background: #050505;
    border: 1px solid #161616;
    border-left: 2px solid #262626;
    margin-left: 8px;
    transition: all 0.3s;
}
.tl__row:hover .tl__card,
.tl__row:active .tl__card {
    border-color: #2a1a1a;
    border-left-color: var(--red-hi);
    background: #0a0505;
    transform: translateX(3px);
    box-shadow: -6px 0 24px -8px rgba(160,24,24,0.4);
}
.tl__row--key .tl__card {
    border-left-color: var(--red-hi);
    background: #0a0303;
}
.tl__h {
    font-family: var(--font-px);
    font-weight: 600;
    font-size: clamp(12px, 1.3vw + 9px, 15px);
    letter-spacing: 1px;
    color: var(--amber);
    margin-bottom: 8px;
    padding-bottom: 8px;
    border-bottom: 1px dashed #1a1a1a;
    line-height: 1.2;
}
.tl__row--key .tl__h { color: var(--red-hi); }
.tl__card p {
    font-size: clamp(13px, 1.2vw + 9px, 15px);
    line-height: 1.45;
    color: #b8b0a0;
    margin-bottom: 8px;
    overflow-wrap: anywhere;
}
.tl__card p:last-child { margin-bottom: 0; }

/* Люди */
.people {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: clamp(10px, 1.5vw, 14px);
}
.person {
    padding: clamp(13px, 1.6vw, 18px) clamp(14px, 1.8vw, 20px);
    background: #050505;
    border: 1px solid #161616;
    border-left: 3px solid #2e2e2e;
    transition: all 0.3s;
}
.person:hover,
.person:active {
    border-left-color: var(--red-hi);
    background: #080303;
    transform: translateX(3px);
    box-shadow: -8px 0 20px -8px rgba(160,24,24,0.5);
}
.person__name {
    font-family: var(--font-px);
    font-weight: 600;
    font-size: clamp(13px, 1.3vw + 9px, 15px);
    letter-spacing: 1px;
    color: #e0d8c6;
    margin-bottom: 10px;
    padding-bottom: 9px;
    border-bottom: 1px dashed #1a1a1a;
    line-height: 1.3;
    word-break: break-word;
}
.person p {
    font-size: clamp(13px, 1.2vw + 9px, 15px);
    color: #b0a898;
    line-height: 1.45;
    overflow-wrap: anywhere;
}
.person--alive { border-left-color: var(--red-hi); }
.person--alive .person__name {
    color: var(--red-hi);
    animation: alivePulse 3s infinite;
}
@keyframes alivePulse {
    0%, 100% { text-shadow: 0 0 0 transparent; }
    50%      { text-shadow: 0 0 20px rgba(224,32,32,0.7); }
}
.person--lost { opacity: 0.8; }
.person--lost .person__name {
    text-decoration: line-through;
    text-decoration-color: var(--red-hi);
    text-decoration-thickness: 2px;
}

.patient__card { padding: 14px 0; }
.patient__name {
    font-family: var(--font-px);
    font-weight: 800;
    font-size: clamp(16px, 2.8vw, 30px);
    letter-spacing: clamp(2px, 0.5vw, 3px);
    color: #efe6d4;
    text-align: center;
    margin-bottom: clamp(18px, 2.8vw, 24px);
    text-shadow:
        3px 3px 0 rgba(160,24,24,0.85),
        0 0 40px rgba(160,24,24,0.35);
    animation: patientDrift 7s infinite;
    line-height: 1.1;
    word-break: break-word;
}
@keyframes patientDrift {
    0%, 88%, 100% { transform: translate(0); }
    90%           { transform: translate(-3px, 2px); }
    92%           { transform: translate(3px, -2px); }
    94%           { transform: translate(-2px, 1px); }
}

.foot {
    margin-top: clamp(28px, 4vw, 40px);
    padding-top: 16px;
    border-top: 1px solid #141414;
    text-align: center;
    font-family: var(--font-mn);
    font-size: clamp(9px, 0.8vw + 6px, 10px);
    letter-spacing: clamp(2px, 0.5vw, 3px);
    color: #3c3831;
    line-height: 1.5;
}

/* ==========================================================
   АДАПТИВ
   ========================================================== */
@media (max-width: 900px) {
    :root {
        --tl-line: 92px;
        --tl-year: 80px;
    }
}

@media (max-width: 720px) {
    .dl {
        grid-template-columns: 1fr;
        gap: 3px 0;
    }
    .dl dt { padding-top: 2px; }
    .dl dd { padding-bottom: 10px; }

    .people { grid-template-columns: 1fr; }

    :root {
        --tl-line: 58px;
        --tl-year: 50px;
        --tl-mark: 20px;
    }
    .tl__year {
        font-size: 11px;
        letter-spacing: 0px;
        padding-right: 4px;
        padding-top: 7px;
    }
    .tl__mark span { width: 8px; height: 8px; }
    .tl__card { margin-left: 4px; padding: 10px 12px; }

    .head { padding: 14px 0 10px; }
    .head__right { width: 100%; }
    .vol { width: 100%; justify-content: space-between; }
    .vol__slider { flex: 1; }

    .oath__wrap { padding: 16px 14px 20px; }

    .run__row span { display: block; flex: 1 1 100%; padding-right: 0; }
}

@media (max-width: 480px) {
    :root {
        --tl-line: 52px;
        --tl-year: 44px;
        --tl-mark: 16px;
        --pad: 10px;
        --gap: 12px;
    }
    body { font-size: 14px; }
    .tabs { margin-left: -10px; margin-right: -10px; padding-left: 10px; padding-right: 10px; }
    .tab { padding: 8px 10px; font-size: 9px; letter-spacing: 1px; }
    .oath__wrap { padding: 14px 12px 18px; }
    .oath__title { font-size: clamp(20px, 7vw, 28px); }
    .oath__text { font-size: 13px; }
    .oath__btn { font-size: 15px; letter-spacing: 3px; padding: 11px 8px; }
    .roles td, .roles th { padding: 7px 9px; }
    .roles__role { letter-spacing: 2px; }
    .doc__title { letter-spacing: 3px; }
    .patient__name { font-size: clamp(15px, 4.5vw, 22px); }
}

@media (max-width: 400px) {
    .roles thead { display: none; }
    .roles, .roles tbody, .roles tr, .roles td { display: block; width: 100%; }
    .roles tr {
        margin-bottom: 7px;
        border: 1px solid #161616;
        background: #060606;
        padding: 3px 0;
    }
    .roles td { border-bottom: none; padding: 5px 11px; }
    .roles__role { display: block; font-size: 14px; }
    .roles__free {
        display: block;
        font-size: 11px;
        color: var(--green);
        margin-top: -2px;
    }
    .roles__free::before { content: 'статус: '; color: var(--ink-dim); }
}

@media (min-width: 1800px) {
    :root { --pad: 24px; }
    .shell { max-width: 940px; }
}

@media (min-width: 2400px) {
    body { font-size: 19px; }
    .shell { max-width: 1080px; }
    .head__mark { font-size: 26px; }
    .doc__title { font-size: 36px; }
}

@media (hover: none) {
    .roles__row:hover .roles__role { letter-spacing: inherit; color: #5c554c; text-shadow: none; }
    .roles__row:hover .roles__free { color: var(--green); text-shadow: none; }
    .tl__row:hover .tl__year { color: var(--amber); text-shadow: none; }
    .tl__row:hover .tl__mark span { background: #000; box-shadow: 0 0 10px rgba(160,24,24,0.7); transform: none; }
    .tl__row:hover .tl__card { transform: none; }
    .person:hover { transform: none; }
    .head__mark:hover { text-shadow: 2px 2px 0 rgba(160,24,24,0.75), 0 0 24px rgba(160,24,24,0.15); color: #f4ecdc; }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.001s !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.05s !important;
        scroll-behavior: auto !important;
    }
    .fx--noise, .fx--grain, .fx--scanlines { animation: none !important; opacity: 0.2 !important; }
    .fx--glitch { display: none; }
    body { animation: none; }
}

@media (max-width: 720px), (pointer: coarse) {
    .fx--grain { opacity: 0.35; animation-duration: 0.8s; }
    .fx--noise { opacity: 0.35; animation-duration: 0.4s; }
    .fx--edge {
        box-shadow:
            inset 0 0 60px 10px rgba(0,0,0,0.85),
            inset 0 0 160px 30px rgba(0,0,0,0.55);
    }
}

@media (max-height: 500px) and (orientation: landscape) {
    .oath { padding-top: 14px; padding-bottom: 14px; }
    .oath__wrap { max-width: 100%; }
    .oath__title { font-size: 20px; margin-bottom: 8px; }
    .oath__lead { margin-bottom: 10px; padding-bottom: 8px; font-size: 12px; }
    .oath__item label { padding: 3px; min-height: auto; }
    .oath__text { font-size: 12px; }
    .oath__btn { padding: 8px; font-size: 15px; margin-top: 10px; }
}

@media print {
    .fx, .boot, .oath, .pixel-canvas, .blood, .scream, .tabs, .head__right, .vol { display: none !important; }
    body { background: #fff; color: #000; }
}