/* ===== Сайт «КСВ · Антенны · TYT в поле» — тёмная тема (v2) ===== */

:root {
    --bg: #070b14;
    --bg2: #0c1220;
    --card: #121a2c;
    --line: #223052;
    --text: #dbe4f5;
    --muted: #8fa2c4;
    --amber: #ffb020;
    --cyan: #22d3ee;
    --green: #34d399;
    --red: #f87171;
    --orange: #fb923c;
    --violet: #a78bfa;
    --blue: #60a5fa;
    --pink: #f472b6;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; }

body {
    font-family: "Segoe UI", system-ui, -apple-system, Roboto, sans-serif;
    background:
        radial-gradient(900px 500px at 85% -10%, #14304d66, transparent),
        radial-gradient(700px 420px at -10% 8%, #3a2a1055, transparent),
        var(--bg);
    color: var(--text);
    line-height: 1.65;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.wrap { max-width: 1080px; margin: 0 auto; padding: 0 18px; width: 100%; }
main.wrap { flex: 1; padding-top: 26px; padding-bottom: 54px; }

a { color: var(--cyan); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ===== Шапка с вкладками ===== */

.site-header {
    position: sticky; top: 0; z-index: 50;
    background: #0a101dee;
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--line);
}

.header-row {
    display: flex; align-items: center; gap: 22px;
    min-height: 58px; flex-wrap: wrap;
}

.brand {
    font-size: 1.15rem; font-weight: 800;
    background: linear-gradient(90deg, var(--amber), var(--cyan));
    -webkit-background-clip: text; background-clip: text;
    -webkit-text-fill-color: transparent;
    white-space: nowrap;
}
.brand:hover { text-decoration: none; }

.tabs { display: flex; gap: 4px; flex-wrap: wrap; overflow: visible; }

.tab {
    color: var(--muted); font-weight: 600; font-size: 0.95rem;
    padding: 9px 14px; border-radius: 10px;
    white-space: nowrap; position: relative;
    transition: color .15s, background .15s;
}
.tab:hover { color: var(--text); background: #ffffff0d; text-decoration: none; }
.tab.active { color: #fff; background: #ffffff12; }
.tab.active::after {
    content: ""; position: absolute; left: 12px; right: 12px; bottom: 3px; height: 3px;
    border-radius: 3px;
    background: linear-gradient(90deg, var(--amber), var(--cyan));
}

/* ===== Выпадающие группы в шапке ===== */

.nav-group { position: relative; }
.nav-group > summary {
    list-style: none; cursor: pointer; user-select: none;
    display: inline-flex; align-items: center; gap: 6px;
    background: transparent; border: 0; font-family: inherit;
}
.nav-group > summary::-webkit-details-marker { display: none; }
.nav-group > summary::marker { content: ""; }
.nav-group[open] > summary { color: var(--text); background: #ffffff0d; }
.nav-group[open] > summary.active { color: #fff; background: #ffffff12; }

.nav-caret {
    font-size: .7em; line-height: 1; opacity: .8;
    transition: transform .15s;
}
.nav-group[open] .nav-caret { transform: rotate(180deg); }

.nav-menu {
    position: absolute; top: calc(100% + 8px); left: 0; z-index: 70;
    min-width: 270px; padding: 8px;
    background: #0b1322f7; border: 1px solid #2a3b60;
    border-radius: 14px; box-shadow: 0 22px 55px #000c;
    backdrop-filter: blur(12px);
}
.nav-group:last-child .nav-menu { left: auto; right: 0; }

.nav-menu-head {
    padding: 6px 11px 8px; color: var(--muted);
    font-size: .7rem; font-weight: 700; letter-spacing: .1em;
    text-transform: uppercase;
}
.nav-menu a {
    display: flex; align-items: flex-start; gap: 10px;
    padding: 9px 11px; border-radius: 9px;
    color: var(--text); font-size: .92rem; font-weight: 600;
    white-space: normal;
}
.nav-menu a:hover { background: #ffffff0d; text-decoration: none; }
.nav-menu a.active { background: #22d3ee14; color: var(--cyan); }
.nav-menu .nm-ico { width: 22px; flex: 0 0 22px; text-align: center; }
.nav-menu b { display: block; font-size: .92rem; line-height: 1.3; }
.nav-menu .nm-sub {
    display: block; margin-top: 1px;
    color: var(--muted); font-size: .76rem; font-weight: 400; line-height: 1.35;
}

/* ===== Герой и заголовки страниц ===== */

.hero { position: relative; padding: 34px 0 10px; overflow: hidden; }
.hero-glow {
    position: absolute; inset: -40% -20% auto -20%; height: 320px; pointer-events: none;
    background:
        radial-gradient(420px 180px at 20% 50%, #22d3ee22, transparent),
        radial-gradient(420px 180px at 75% 50%, #ffb02022, transparent);
    filter: blur(6px);
}

.eyebrow {
    display: inline-block; font-size: .8rem; font-weight: 700;
    letter-spacing: .13em; text-transform: uppercase;
    color: var(--amber); border: 1px solid #ffb02055;
    background: #ffb02014; border-radius: 999px; padding: 5px 14px;
    margin-bottom: 12px; position: relative;
}

h1 {
    font-size: clamp(1.7rem, 4.5vw, 2.7rem); line-height: 1.18;
    margin: 10px 0 14px; position: relative;
}
.accent {
    background: linear-gradient(90deg, var(--amber), #ff7e33, var(--cyan));
    -webkit-background-clip: text; background-clip: text;
    -webkit-text-fill-color: transparent;
}

.lead { font-size: 1.08rem; color: var(--muted); max-width: 780px; position: relative; }

.page-head { padding: 8px 0 4px; }

.section-title {
    font-size: 1.35rem; margin: 42px 0 6px;
    padding-left: 14px; border-left: 4px solid;
    border-image: linear-gradient(180deg, var(--cyan), var(--violet)) 1;
}

/* ===== Кнопки и статистика ===== */

.hero-actions { display: flex; flex-wrap: wrap; gap: 12px; margin: 22px 0 26px; }

.btn {
    display: inline-block; font-weight: 700; font-size: .97rem;
    padding: 12px 22px; border-radius: 12px; border: 1px solid transparent;
    transition: transform .15s, box-shadow .15s, background .15s;
}
.btn:hover { text-decoration: none; transform: translateY(-2px); }
.btn.primary {
    color: #06121c;
    background: linear-gradient(90deg, var(--amber), var(--cyan));
    box-shadow: 0 10px 26px #22d3ee33;
}
.btn.primary:hover { box-shadow: 0 14px 32px #22d3ee4d; }
.btn.ghost {
    color: var(--cyan); border-color: #22d3ee66; background: #22d3ee14;
}
.btn.ghost:hover { background: #22d3ee22; }

.stat-row {
    display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
    margin-top: 8px;
}
.stat {
    background: var(--card); border: 1px solid var(--line);
    border-radius: 14px; padding: 14px 16px;
    border-top: 3px solid transparent;
    border-image: linear-gradient(90deg, var(--amber), var(--cyan)) 1;
}
.stat b { display: block; font-size: 1.35rem; font-weight: 800; color: #fff; }
.stat span { color: var(--muted); font-size: .87rem; }

/* ===== Шеврон подразделения ===== */

.unit-banner {
    position: relative;
    display: grid;
    grid-template-columns: minmax(0, 270px) minmax(0, 1fr);
    align-items: center;
    gap: clamp(24px, 4vw, 48px);
    margin: 30px 0 8px;
    padding: clamp(22px, 3.6vw, 34px) clamp(20px, 4vw, 42px);
    border: 1px solid #5a1a24;
    border-radius: 24px;
    background:
        radial-gradient(520px 300px at 12% 50%, #b91c2e33, transparent 72%),
        radial-gradient(560px 300px at 100% 0%, #22d3ee12, transparent 70%),
        linear-gradient(118deg, #17090d 0%, #0b0f18 55%, #0b1220 100%);
    box-shadow:
        inset 0 1px 0 #ffffff0d,
        0 24px 60px #00000059;
    overflow: hidden;
    isolation: isolate;
}
.unit-banner::before {
    content: "";
    position: absolute;
    inset: 0;
    background:
        repeating-linear-gradient(118deg, transparent 0 30px, #ffffff05 30px 31px),
        linear-gradient(90deg, #e11d2e 0%, #e11d2e00 34%, #22d3ee00 68%, #22d3ee55 100%);
    opacity: .28;
    pointer-events: none;
}
.unit-banner::after {
    content: "";
    position: absolute;
    left: 0; right: 0; top: 0;
    height: 2px;
    background: linear-gradient(90deg, #ff3b4a, #ff8a8a 32%, #22d3ee 100%);
    opacity: .9;
}

.unit-patch-wrap,
.unit-copy { position: relative; z-index: 1; }

.unit-patch-wrap {
    width: min(100%, 270px);
    aspect-ratio: 1;
    justify-self: center;
    display: grid;
    place-items: center;
}
.unit-patch-halo {
    position: absolute;
    inset: -14%;
    border-radius: 50%;
    background: radial-gradient(circle, #e11d2e55 0%, #e11d2e1a 48%, transparent 70%);
    filter: blur(14px);
    pointer-events: none;
}
.unit-patch-pic { display: block; width: 100%; height: 100%; }
.unit-patch {
    position: relative;
    width: 100%;
    height: 100%;
    display: block;
    object-fit: cover;
    border-radius: 50%;
    border: 1px solid #ff6b7866;
    box-shadow:
        0 0 0 7px #0a0e17,
        0 0 0 8px #ffffff14,
        0 22px 45px #000000b3,
        0 0 46px #e11d2e40;
    transition: transform .4s ease, box-shadow .4s ease;
}
.unit-banner:hover .unit-patch {
    transform: scale(1.018) rotate(-1.2deg);
    box-shadow:
        0 0 0 7px #0a0e17,
        0 0 0 8px #ff6b7844,
        0 24px 50px #000000cc,
        0 0 58px #e11d2e59;
}

.unit-copy { max-width: 590px; }
.unit-kicker {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin: 0 0 10px;
    color: #ff8a94;
    font-size: .77rem;
    font-weight: 800;
    letter-spacing: .16em;
    text-transform: uppercase;
}
.unit-dot {
    width: 6px; height: 6px; flex: 0 0 6px;
    border-radius: 50%;
    background: #ff3b4a;
    box-shadow: 0 0 10px #ff3b4a;
}
.unit-title {
    margin: 0 0 10px;
    font-size: clamp(1.7rem, 3.5vw, 2.5rem);
    line-height: 1.08;
    letter-spacing: -.025em;
    color: #fff;
}
.unit-title span {
    background: linear-gradient(90deg, #ff8a8a, #e11d2e);
    -webkit-background-clip: text; background-clip: text;
    -webkit-text-fill-color: transparent;
}
.unit-motto {
    margin: 0 0 14px;
    padding-left: 13px;
    border-left: 3px solid #e11d2e;
    color: #f6d9dc;
    font-size: clamp(1rem, 1.7vw, 1.14rem);
    font-weight: 700;
    line-height: 1.35;
    letter-spacing: .015em;
}
.unit-desc {
    margin: 0 0 17px;
    max-width: 520px;
    color: var(--muted);
    font-size: .97rem;
}
.unit-tags { display: flex; flex-wrap: wrap; gap: 8px; }
.unit-tags a {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 7px 12px;
    border: 1px solid #6d2631;
    border-radius: 999px;
    background: #e11d2e0d;
    color: #ffd9dd;
    font-size: .8rem;
    font-weight: 700;
    transition: border-color .18s, background .18s, color .18s, transform .18s;
}
.unit-tags a::before {
    content: "";
    width: 5px; height: 5px;
    border-radius: 50%;
    background: #ff5a67;
}
.unit-tags a:hover {
    text-decoration: none;
    border-color: #ff6b78;
    background: #e11d2e1f;
    color: #fff;
    transform: translateY(-1px);
}
.unit-watermark {
    position: absolute;
    right: clamp(14px, 3vw, 30px);
    top: 50%;
    z-index: 0;
    transform: translateY(-50%);
    color: #ffffff06;
    font-size: clamp(6rem, 12vw, 10rem);
    font-weight: 900;
    line-height: .8;
    letter-spacing: -.08em;
    pointer-events: none;
    user-select: none;
}

/* Главная — только блок с шевроном */
body.home-unit main.wrap {
    display: flex;
    align-items: center;
    justify-content: center;
    padding-top: 34px;
    padding-bottom: 54px;
}
body.home-unit .unit-banner {
    width: 100%;
    margin: 0;
}

/* ===== Карточки ===== */

.cards { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(255px, 1fr)); margin-top: 16px; }

.card {
    background: var(--card);
    border: 1px solid var(--line); border-radius: 16px;
    padding: 20px; display: block; color: var(--text);
    position: relative; overflow: hidden;
    transition: transform .18s, border-color .18s, box-shadow .18s;
}
.card::before {
    content: ""; position: absolute; inset: 0 0 auto 0; height: 4px;
    background: var(--card-accent, linear-gradient(90deg, var(--cyan), var(--violet)));
}
.card:hover {
    text-decoration: none; transform: translateY(-4px);
    border-color: #33507e;
    box-shadow: 0 14px 34px #00000066;
}
.card-icon { font-size: 1.9rem; margin-bottom: 4px; }
.card h3 { margin: 8px 0 8px; font-size: 1.12rem; }
.card p { color: var(--muted); font-size: .95rem; }
.card-more { display: inline-block; margin-top: 12px; font-weight: 700; font-size: .9rem; color: var(--cyan); }

.card-grad-cyan   { --card-accent: linear-gradient(90deg, var(--cyan), var(--blue)); }
.card-grad-green  { --card-accent: linear-gradient(90deg, var(--green), var(--cyan)); }
.card-grad-violet { --card-accent: linear-gradient(90deg, var(--violet), var(--pink)); }
.card-grad-orange { --card-accent: linear-gradient(90deg, var(--amber), var(--orange)); }
.card-grad-blue   { --card-accent: linear-gradient(90deg, var(--blue), var(--violet)); }
.card-grad-pink   { --card-accent: linear-gradient(90deg, var(--pink), var(--amber)); }
.card-grad-gold   { --card-accent: linear-gradient(90deg, var(--amber), var(--pink)); }

/* ===== Две колонки и панели ===== */

.two-col { display: grid; gap: 16px; grid-template-columns: 1fr 1fr; margin-top: 16px; }

.panel {
    background: var(--card); border: 1px solid var(--line);
    border-radius: 16px; padding: 22px; margin: 4px 0;
}
.panel h3 { margin-bottom: 10px; font-size: 1.06rem; color: #fff; }
.panel p { margin: 8px 0; color: var(--text); font-size: .96rem; }
.panel ul.list, .panel ol { margin: 8px 0 8px 20px; }
.panel ul.list li, .panel ol li { margin: 7px 0; font-size: .95rem; color: var(--text); }

.formula {
    font-family: Consolas, "Courier New", monospace;
    background: var(--bg2); border: 1px dashed var(--line);
    border-radius: 10px; padding: 10px 14px; margin: 12px 0 !important;
    color: var(--cyan); font-size: .95rem; line-height: 1.9;
}

.hint { color: var(--muted); font-size: .9rem !important; }

.warn-strip {
    background: #fb923c14; border-left: 4px solid var(--orange);
    border-radius: 0 10px 10px 0; padding: 10px 14px; margin-top: 12px;
    font-size: .9rem; color: #ffd9b8;
}

.note {
    border-left: 4px solid var(--cyan); background: #22d3ee10;
    border-radius: 0 12px 12px 0; padding: 14px 18px; margin: 30px 0 6px;
    font-size: .95rem; color: var(--text);
}
.note b { color: var(--cyan); }

/* Ссылки внутри текста должны отличаться не только цветом */
.panel a:not(.btn), .hint a:not(.btn), .note a:not(.btn) {
    text-decoration: underline;
    text-underline-offset: 2px;
    text-decoration-color: #22d3ee88;
}

/* ===== Мини-таблицы и бейджи ===== */

.mini-table { display: grid; gap: 8px; margin: 12px 0 14px; font-size: .93rem; }
.mini-table > div {
    background: var(--bg2); border: 1px solid var(--line);
    border-radius: 10px; padding: 8px 12px;
}

.pill {
    display: inline-block; font-weight: 700; font-size: .8rem;
    padding: 3px 10px; border-radius: 999px; margin-right: 8px;
    border: 1px solid transparent; min-width: 62px; text-align: center;
}
.pill-good { background: #34d39922; color: var(--green); border-color: #34d39955; }
.pill-warn { background: #facc1522; color: #facc15; border-color: #facc1555; }
.pill-bad  { background: #fb923c22; color: var(--orange); border-color: #fb923c55; }
.pill-crit { background: #f8717122; color: var(--red); border-color: #f8717155; }

/* ===== Таблицы ===== */

.tbl {
    width: 100%; border-collapse: collapse; margin: 12px 0;
    font-size: .93rem; display: block; overflow-x: auto;
}
.tbl th, .tbl td {
    border: 1px solid var(--line); padding: 9px 13px; text-align: left;
    vertical-align: top;
}
.tbl th { background: #1a2740; color: var(--cyan); font-weight: 700; white-space: nowrap; }
.tbl tr:nth-child(even) td { background: #ffffff06; }
.tbl tr:hover td { background: #ffffff0a; }
.tbl-wide { font-size: .95rem; }

/* ===== Графики ===== */

.chart-box {
    background: var(--card); border: 1px solid var(--line);
    border-radius: 16px; padding: 16px; margin: 16px 0 8px;
}
.chart { width: 100%; height: 320px; display: block; }
.caption { color: var(--muted); font-size: .87rem; margin-top: 10px; padding: 0 6px; }

/* ===== Калькуляторы ===== */

.calc {
    background: var(--card); border: 1px solid var(--line);
    border-radius: 16px; padding: 20px; margin: 16px 0;
}
.calc > p { font-size: .96rem; margin-bottom: 10px; }

.calc-row { display: flex; flex-direction: column; gap: 6px; max-width: 320px; }
.calc-row label { font-size: .88rem; color: var(--muted); font-weight: 600; }
.calc input[type=number] {
    width: 100%; padding: 11px 13px; font-size: 1.05rem;
    background: var(--bg2); color: var(--text);
    border: 1px solid var(--line); border-radius: 10px;
    font-variant-numeric: tabular-nums;
}
.calc input:focus { outline: none; border-color: var(--cyan); box-shadow: 0 0 0 3px #22d3ee22; }

.presets { display: flex; flex-wrap: wrap; gap: 8px; margin: 14px 0 4px; }
.preset {
    border: 1px solid var(--line); background: #16203450; color: var(--muted);
    border-radius: 999px; padding: 6px 13px; font-size: .85rem; cursor: pointer;
    font-weight: 600; transition: all .15s;
}
.preset:hover { border-color: var(--cyan); color: var(--cyan); background: #22d3ee14; }

.calc-out { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 16px; }
.out-box {
    flex: 1 1 170px;
    background: var(--bg2); border: 1px solid var(--line);
    border-radius: 12px; padding: 12px 16px;
}
.out-box span { display: block; color: var(--muted); font-size: .82rem; margin-bottom: 2px; }
.out-box b {
    font-size: 1.5rem; font-weight: 800; color: var(--cyan);
    font-variant-numeric: tabular-nums;
}

.verdict { margin-top: 12px; font-weight: 700; font-size: .97rem; }
.v-good { color: var(--green); }
.v-ok   { color: #facc15; }
.v-bad  { color: var(--red); }

/* ===== Шаги ===== */

.steps { counter-reset: step; list-style: none; margin: 10px 0; }
.steps li {
    counter-increment: step; position: relative;
    padding: 10px 0 10px 50px; border-bottom: 1px dashed #ffffff10;
    font-size: .95rem;
}
.steps li:last-child { border-bottom: none; }
.steps li::before {
    content: counter(step);
    position: absolute; left: 0; top: 8px;
    width: 34px; height: 34px; border-radius: 50%;
    display: grid; place-items: center; font-weight: 800; color: #071018;
    background: linear-gradient(135deg, var(--amber), var(--cyan));
}

.steps-grid { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); margin-top: 16px; }
.step-card {
    background: var(--card); border: 1px solid var(--line);
    border-radius: 14px; padding: 16px 18px; position: relative;
}
.step-card > b {
    display: inline-grid; place-items: center;
    width: 32px; height: 32px; border-radius: 50%;
    background: linear-gradient(135deg, var(--amber), var(--cyan));
    color: #071018; font-weight: 800; margin-bottom: 8px;
}
.step-card h3, .step-card h4 { font-size: .98rem; margin-bottom: 6px; color: #fff; }
.step-card p { color: var(--muted); font-size: .88rem; }

.check-list { list-style: none; margin: 8px 0; }
.check-list li {
    padding: 7px 0 7px 30px; position: relative;
    border-bottom: 1px dashed #ffffff10; font-size: .94rem;
}
.check-list li:last-child { border-bottom: none; }
.check-list li::before {
    content: "✔"; position: absolute; left: 2px; top: 7px;
    color: var(--green); font-weight: 900;
}

/* ===== Видео ===== */

.video-grid { display: grid; gap: 18px; grid-template-columns: repeat(auto-fit, minmax(310px, 1fr)); margin-top: 16px; }
.video-card {
    background: var(--card); border: 1px solid var(--line);
    border-radius: 14px; overflow: hidden;
    transition: transform .18s, border-color .18s;
}
.video-card:hover { transform: translateY(-3px); border-color: #33507e; }
.ratio { position: relative; padding-top: 56.25%; background: #000; }
.ratio iframe, .ratio video {
    position: absolute; inset: 0; width: 100%; height: 100%;
    border: 0; background: #000;
}
.ratio video { object-fit: contain; }
.video-meta { padding: 12px 15px; }
.video-meta h4 { font-size: .97rem; margin-bottom: 4px; }
.video-meta p { color: var(--muted); font-size: .87rem; }
.video-direct {
    display: flex; flex-wrap: wrap; align-items: center; gap: 7px;
    margin-top: 8px; font-size: .78rem;
}
.video-direct a { color: var(--cyan); font-weight: 600; text-decoration: none; }
.video-direct a:hover { text-decoration: underline; }
.video-direct .sep { color: var(--line); }

/* ===== Тактическая медицина ===== */

.medic-toc { display: flex; flex-wrap: wrap; gap: 8px; margin: 18px 0 6px; }
.medic-toc a {
    display: inline-block; padding: 6px 12px;
    border: 1px solid var(--line); border-radius: 999px;
    background: var(--card); color: var(--muted);
    font-size: .82rem; font-weight: 600;
}
.medic-toc a:hover { color: var(--cyan); border-color: #22d3ee66; text-decoration: none; }

.medic-kpi { display: grid; gap: 10px; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); margin: 14px 0; }
.medic-kpi > div { background: var(--bg2); border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; }
.medic-kpi b { display: block; color: var(--cyan); font-size: 1.02rem; }
.medic-kpi span { color: var(--muted); font-size: .82rem; }

h2[id] { scroll-margin-top: 86px; }

/* ===== Футер ===== */

.site-footer {
    border-top: 1px solid var(--line); background: #0a101d;
    padding: 20px 0; font-size: .88rem; color: var(--muted);
}
.foot-note { margin-bottom: 6px; }
.foot-links a { color: var(--muted); }
.foot-links a:hover { color: var(--cyan); }

/* ===== Адаптив ===== */

@media (max-width: 760px) {
    .two-col { grid-template-columns: 1fr; }
    .header-row { gap: 8px; padding-top: 8px; padding-bottom: 8px; }
    .tabs { width: 100%; gap: 2px; }
    .tab { padding: 8px 10px; font-size: .9rem; }
    .nav-med-long { display: none; }
    .nav-group[open] .nav-menu {
        position: fixed; top: var(--nav-menu-top, 143px);
        left: 12px; right: 12px; width: auto; min-width: 0;
        margin: 0; padding: 6px;
        display: grid; grid-template-columns: 1fr 1fr; gap: 2px;
        max-height: calc(100vh - var(--nav-menu-top, 143px) - 12px);
        overflow-y: auto;
        box-shadow: 0 18px 40px #000b;
    }
    .nav-group[open] .nav-menu-head { grid-column: 1 / -1; }
    .nav-menu a { padding: 8px 9px; }
    .nav-menu b { font-size: .86rem; }
    .nav-menu .nm-sub { display: none; }
    .hero { padding-top: 22px; }
    .unit-banner {
        grid-template-columns: 1fr;
        gap: 16px;
        padding: 22px 18px 24px;
        text-align: center;
    }
    .unit-patch-wrap { width: min(230px, 66vw); }
    .unit-copy { max-width: none; }
    .unit-kicker { justify-content: center; }
    .unit-motto {
        border-left: 0;
        padding-left: 0;
        text-align: center;
    }
    .unit-desc { margin-left: auto; margin-right: auto; }
    .unit-tags { justify-content: center; }
    .unit-title { font-size: clamp(1.6rem, 8vw, 2.1rem); }
    .unit-watermark { display: none; }
    .chart { height: 260px; }
    .stat b { font-size: 1.2rem; }
}

/* ===== Алтай Шатра ===== */
.shatra-layout { display: flex; flex-direction: column; gap: 8px; margin-top: 8px; flex: 1 1 auto; min-height: 0; }
.sh-status { font-weight: 700; padding: 8px 14px; border-radius: 12px; margin-bottom: 0;
    background: #101a30; border: 1px solid var(--line); text-align: center; flex: 0 0 auto; }
.sh-status.sh-warn { background: #3a1620; border-color: var(--red); color: #ffd0d0; animation: shPulse 1s infinite alternate; }
.sh-status.sh-over { background: linear-gradient(90deg,#14304d,#2a1a3a); border-color: var(--cyan); }
@keyframes shPulse { from { opacity: .75; } to { opacity: 1; } }

.shatra-board { display: grid; grid-template-columns: repeat(7, var(--cell, 42px)); grid-auto-rows: var(--cell, 42px); gap: 2px;
    background: #ffffff; padding: 8px; border-radius: 14px; border: 1px solid #e2d8c2;
    box-shadow: 0 18px 44px #000a; user-select: none; flex: 0 0 auto; }
.sh-cell { position: relative; aspect-ratio: 1; display: flex; align-items: center; justify-content: center;
    border-radius: 4px; cursor: default; }
.sh-light { background: #cfc4a6; }
.sh-dark { background: #6f5c3e; }
/* внеигровые клетки — алтайские символы вместо пустых квадратов */
.sh-wall { background-color: #ffffff; border-radius: 4px; background-position: center; background-repeat: no-repeat; background-size: 100% 100%; }
.sh-wall.sh-alt0 { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 36 36'%3E%3Cg fill='none' stroke='%23b99b62' stroke-width='2' stroke-linecap='round'%3E%3Cpath d='M18 18C18 11 24 7 29 10c4 2.5 3 8.5-2 8.5'/%3E%3Cpath d='M18 18c0 7-6 11-11 8-4-2.5-3-8.5 2-8.5'/%3E%3C/g%3E%3Ccircle cx='18' cy='18' r='2' fill='%23b99b62'/%3E%3C/svg%3E"); }
.sh-wall.sh-alt1 { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 36 36'%3E%3Cg fill='none' stroke='%23b99b62' stroke-width='2' stroke-linejoin='round'%3E%3Cpath d='M18 6L30 18L18 30L6 18Z'/%3E%3Cpath d='M18 12L24 18L18 24L12 18Z'/%3E%3C/g%3E%3C/svg%3E"); }
.sh-wall.sh-alt2 { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 36 36'%3E%3Cg fill='none' stroke='%23b99b62' stroke-width='2' stroke-linecap='round'%3E%3Cpath d='M27 18A9 9 0 1 1 18 9'/%3E%3Cpath d='M22 18A4 4 0 1 1 18 14'/%3E%3C/g%3E%3Ccircle cx='18' cy='18' r='1.8' fill='%23b99b62'/%3E%3C/svg%3E"); }
.sh-wall.sh-alt3 { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 36 36'%3E%3Cg fill='none' stroke='%23b99b62' stroke-width='2' stroke-linecap='round'%3E%3Ccircle cx='18' cy='18' r='8'/%3E%3Cpath d='M18 4v4M18 28v4M4 18h4M28 18h4M8 8l3 3M25 25l3 3M28 8l-3 3M11 25l-3 3'/%3E%3C/g%3E%3Ccircle cx='18' cy='18' r='2.4' fill='%23b99b62'/%3E%3C/svg%3E"); }
/* подсветка шага хода ИИ */
.sh-cell.sh-ai-mark { outline: 3px solid var(--amber); outline-offset: -3px; z-index: 3; animation: shPulse .5s infinite alternate; }
.sh-void { background: transparent; }
.sh-fort.sh-light { background: #d8c690; }
.sh-fort.sh-dark { background: #8a6a34; }
.sh-gate { outline: 2px solid var(--amber); outline-offset: -2px; }
.sh-promo { box-shadow: inset 0 0 0 2px var(--violet); }
.sh-num { position: absolute; top: 1px; left: 3px; font-size: .55rem; color: #00000059; font-weight: 700; pointer-events: none; }
.sh-dark .sh-num { color: #ffffff5c; }

.sh-piece { position: absolute; inset: 4%; z-index: 2; transition: transform .12s;
    filter: drop-shadow(0 3px 3px #0009); }
.sh-piece svg { width: 100%; height: 100%; display: block; }
/* белые — кость с тёмной резьбой */
.sh-white .shp-disk { fill: #f3ead2; stroke: #8a6a34; stroke-width: 2; }
.sh-white .shp-rim  { fill: none; stroke: #c9a86a; stroke-width: 1.5; }
.sh-white .shp-o, .sh-white .shp-s { fill: none; stroke: #7a5a2e; stroke-width: 4; stroke-linejoin: round; stroke-linecap: round; }
.sh-white .shp-f    { fill: #7a5a2e; }
/* чёрные — самшит с золотой резьбой */
.sh-black .shp-disk { fill: #1d1712; stroke: #574326; stroke-width: 2; }
.sh-black .shp-rim  { fill: none; stroke: #3d3020; stroke-width: 1.5; }
.sh-black .shp-o, .sh-black .shp-s { fill: none; stroke: #d8a94a; stroke-width: 4; stroke-linejoin: round; stroke-linecap: round; }
.sh-black .shp-f    { fill: #d8a94a; }
/* пунктирный кант-резьба общий */
.shp-rim2 { fill: none; stroke: #00000033; stroke-width: 2; }
.sh-white .shp-rim2 { stroke: #00000022; }
.sh-black .shp-rim2 { stroke: #ffffff22; }
.sh-piece.sh-by { animation: shBy 2.2s infinite alternate; }
@keyframes shBy { from { filter: drop-shadow(0 0 2px #ffb02088); } to { filter: drop-shadow(0 0 9px #ffb020); } }

.sh-cell.sh-sel { outline: 3px solid var(--cyan); outline-offset: -3px; z-index: 3; }
.sh-cell.sh-hl::after { content: ""; position: absolute; width: 34%; height: 34%; border-radius: 50%;
    background: #22d3eebb; box-shadow: 0 0 10px #22d3ee; z-index: 4; animation: shPulse .8s infinite alternate; }
.sh-cell.sh-chain::after { content: ""; position: absolute; inset: 6%; border-radius: 50%;
    border: 3px solid #f87171; box-shadow: 0 0 12px #f87171; z-index: 4; animation: shPulse .5s infinite alternate; }
.sh-cell.sh-hl, .sh-cell.sh-chain { cursor: pointer; }

.sh-toolbar { display: flex; gap: 10px 14px; align-items: center; flex-wrap: wrap; margin-top: 0; flex: 0 0 auto; }
.sh-toolbar .btn { padding: 9px 16px; font-size: .92rem; }
.sh-diff-label { color: var(--muted); font-size: .95rem; display: flex; gap: 8px; align-items: center; }
.sh-select { background: var(--card); color: var(--text); border: 1px solid var(--line);
    border-radius: 10px; padding: 8px 12px; font-size: .95rem; }
.sh-captured-row { margin-top: 10px; color: var(--muted); font-size: .92rem; min-height: 1.4em; }
.sh-toolbar .sh-captured-row { margin-top: 0; margin-left: auto; white-space: nowrap; }
.sh-log { margin: 4px 0 4px 20px; max-height: 240px; overflow-y: auto; font-size: .88rem; color: var(--text); }
.sh-log li { margin: 4px 0; font-family: ui-monospace, monospace; }
.sh-legend li b { color: #fff; }
.sh-cell.sh-moat { border-top: 3px solid #22d3eeaa; box-shadow: inset 0 3px 6px -3px #22d3ee88; }
.sh-cell.sh-road { box-shadow: inset 0 0 0 1px #ffb02055; }

/* — компактная шапка игры: меню «Правила» слева-вверху, вкладка «Запись ходов» справа — */
.sh-hero { padding: 8px 0 2px; overflow: visible; }
.sh-hero .hero-glow { display: none; }
.sh-topbar { display: flex; align-items: center; gap: 12px; position: relative; }
.sh-title { flex: 1 1 auto; min-width: 0; margin: 0; line-height: 1.3;
    font-size: clamp(1.05rem, 2.6vw, 1.4rem); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sh-title small { color: var(--muted); font-weight: 400; font-size: .8rem; }
.sh-dropdown, .sh-log-tab { flex: 0 0 auto; }
.sh-drop-btn { display: inline-flex; align-items: center; gap: 6px; font-weight: 700; font-size: .93rem;
    color: var(--text); background: var(--card); border: 1px solid var(--line); border-radius: 12px;
    padding: 9px 15px; cursor: pointer; transition: border-color .15s, color .15s, background .15s; }
.sh-drop-btn:hover, .sh-drop-btn[aria-expanded="true"] { border-color: var(--cyan); color: var(--cyan); background: #22d3ee14; }
.sh-dropdown { position: relative; }
.sh-drop-panel { position: absolute; top: calc(100% + 8px); left: 0; z-index: 60;
    width: min(440px, calc(100vw - 36px)); max-height: min(72dvh, 620px); overflow-y: auto;
    background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 16px 18px;
    box-shadow: 0 22px 50px #000b; font-size: .93rem; }
.sh-drop-panel h4 { margin: 14px 0 6px; font-size: 1rem; color: #fff; }
.sh-drop-panel h4:first-of-type { margin-top: 6px; }
.sh-drop-panel p { margin: 6px 0; }
.sh-drop-lead { color: var(--text); }
.sh-rules-list { margin: 2px 0 4px 20px; }
.sh-rules-list li { margin: 6px 0; font-size: .92rem; }
.sh-rules-list li b { color: #fff; }

/* — поле доски занимает всё свободное место, доска вписывается точно (размер считает JS) — */
.sh-board-box { position: relative; flex: 1 1 auto; min-height: 0;
    display: flex; align-items: center; justify-content: center; overflow: hidden; }

/* — запись ходов — отдельная вкладка: выдвижная панель поверх доски — */
.sh-log-drawer { position: absolute; top: 0; right: 0; bottom: 0; width: min(320px, 46%);
    background: #0c1220f5; border: 1px solid var(--line); border-radius: 14px;
    padding: 12px 14px; z-index: 10; overflow-y: auto; box-shadow: -14px 0 34px #0009; }
.sh-log-drawer h4 { font-size: .95rem; color: #fff; margin-bottom: 8px; }
.sh-log-drawer .sh-log { max-height: none; margin: 2px 0 2px 18px; }
@media (max-width: 700px) { .sh-log-drawer { width: min(320px, 92%); } }

/* — страница игры: вписываем в экран, скроллинга во время партии нет — */
body.altai-page { height: 100vh; height: 100dvh; overflow-y: auto; }
body.altai-page main.wrap { display: flex; flex-direction: column; min-height: 0;
    padding-top: 8px; padding-bottom: 8px; }
body.altai-page .site-footer { display: none; }

/* — вход по позывному, статистика и рейтинг игроков — */
.sh-login[hidden], .sh-user-row[hidden] { display: none !important; }
.sh-login { position: absolute; inset: 0; z-index: 20;
    display: flex; align-items: center; justify-content: center; }
.sh-login-card { width: min(360px, 94%); background: var(--card); border: 1px solid var(--line);
    border-radius: 16px; padding: 20px 22px; box-shadow: 0 22px 50px #000b; text-align: center; }
.sh-login-card h4 { font-size: 1.1rem; color: #fff; margin-bottom: 6px; }
.sh-login-lead { color: var(--muted); font-size: .9rem; margin-bottom: 12px; }
.sh-input { width: 100%; background: var(--bg2); color: var(--text); border: 1px solid var(--line);
    border-radius: 10px; padding: 11px 12px; font-size: 1rem; text-align: center; margin-bottom: 12px; }
.sh-input:focus { outline: none; border-color: var(--cyan); }
.sh-login-card .btn { width: 100%; }
.sh-login-err { color: var(--red); font-size: .85rem; margin-top: 8px; }
body.sh-no-login .shatra-board { pointer-events: none; opacity: .45; filter: grayscale(.4); }
.sh-user-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
    font-size: .9rem; color: var(--muted); flex: 0 0 auto; }
.sh-user-name b { color: var(--amber); }
.sh-user-stats { margin-left: auto; }
.sh-user-swap { background: none; border: 1px solid var(--line); color: var(--muted);
    border-radius: 8px; padding: 2px 8px; cursor: pointer; font-size: .85rem; }
.sh-user-swap:hover { border-color: var(--cyan); color: var(--cyan); }
.sh-rating { margin: 2px 0 4px 20px; }
.sh-rating li { margin: 5px 0; font-size: .92rem; }
.sh-rating li b { color: #fff; }
.sh-rating-stat { color: var(--muted); font-size: .82rem; }
.sh-rating-note { color: var(--muted); font-size: .8rem; margin-top: 4px; }

/* ===== Home page v2: approved local preview ===== */
/* Local homepage preview for hackq.online.
   Uses the existing site.css tokens/components and adds only the new home blocks. */

body.home-unit main.wrap {
    display: block;
    padding-top: 26px;
    padding-bottom: 54px;
}

/* ===== header brand ===== */
.brand {
    display: inline-flex;
    align-items: center;
    gap: 11px;
    white-space: normal;
    line-height: 1.08;
    color: #fff;
    background: none;
    -webkit-background-clip: border-box;
    background-clip: border-box;
    -webkit-text-fill-color: currentColor;
}
.brand-mark {
    width: 39px;
    height: 39px;
    flex: 0 0 39px;
    display: grid;
    place-items: center;
    border-radius: 12px;
    color: #fff;
    font-size: .95rem;
    font-weight: 900;
    letter-spacing: -.04em;
    background: linear-gradient(135deg, #e11d2e, #7f1021);
    border: 1px solid #ff6b7866;
    box-shadow: 0 0 24px #e11d2e33;
    -webkit-text-fill-color: #fff;
}
.brand-copy { display: flex; flex-direction: column; gap: 2px; }
.brand-copy b {
    color: #fff;
    font-size: 1.02rem;
    font-weight: 800;
    letter-spacing: -.02em;
    white-space: nowrap;
    -webkit-text-fill-color: #fff;
}
.brand-copy small {
    color: var(--muted);
    font-size: .69rem;
    font-weight: 600;
    letter-spacing: .06em;
    text-transform: uppercase;
    white-space: nowrap;
    -webkit-text-fill-color: currentColor;
}
.brand:hover .brand-copy b { color: #fff; }

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* ===== page rhythm ===== */
.home-section { margin-top: 34px; }
.section-head {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 20px;
    margin-bottom: 14px;
}
.section-head .section-title { margin: 0; }
.section-note {
    max-width: 430px;
    color: var(--muted);
    font-size: .9rem;
    text-align: right;
}
.section-kicker {
    display: block;
    margin-bottom: 4px;
    color: var(--amber);
    font-size: .68rem;
    font-weight: 800;
    letter-spacing: .14em;
    text-transform: uppercase;
}

/* ===== hero tweaks ===== */
.home-hero { margin-top: 4px; }
.home-hero .unit-title { font-size: clamp(1.8rem, 3.8vw, 2.65rem); }
.home-hero .unit-desc { max-width: 610px; }
.hero-actions { margin: 18px 0 14px; }
.hero-actions .btn { padding: 11px 18px; }
.hero-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 2px;
}
.hero-meta span {
    padding: 4px 9px;
    border: 1px solid #ffffff18;
    border-radius: 7px;
    color: #c8d4e7;
    background: #ffffff07;
    font-size: .74rem;
    font-weight: 650;
}

/* ===== quick access / search ===== */
.home-tools {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 22px 0 16px;
}
.home-search {
    position: relative;
    flex: 1;
    max-width: 520px;
}
.home-search::before {
    content: "⌕";
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-52%);
    color: var(--cyan);
    font-size: 1.35rem;
    line-height: 1;
    pointer-events: none;
}
.home-search input {
    width: 100%;
    padding: 11px 15px 11px 42px;
    color: var(--text);
    background: #0d1525;
    border: 1px solid #263657;
    border-radius: 11px;
    font: inherit;
    font-size: .93rem;
    outline: none;
}
.home-search input:focus {
    border-color: #22d3ee88;
    box-shadow: 0 0 0 3px #22d3ee17;
}
.home-search input::placeholder { color: #7184a5; }
.search-count {
    color: var(--muted);
    font-size: .82rem;
    white-space: nowrap;
}
.home-cards { margin-top: 0; grid-template-columns: repeat(3, minmax(0, 1fr)); }
.home-card { padding: 18px 19px 17px; }
.home-card .card-icon { margin-bottom: 8px; }
.home-card .card-kicker {
    display: block;
    margin-bottom: 5px;
    color: var(--muted);
    font-size: .67rem;
    font-weight: 800;
    letter-spacing: .11em;
    text-transform: uppercase;
}
.home-card h3 { margin: 0 0 6px; }
.home-card p { min-height: 42px; line-height: 1.45; }
.home-card .card-more { margin-top: 10px; }
.home-card.is-hidden { display: none; }
.no-results {
    display: none;
    padding: 18px 20px;
    border: 1px dashed #31415f;
    border-radius: 14px;
    color: var(--muted);
    background: #0d152522;
    font-size: .93rem;
}
.no-results.is-visible { display: block; }

/* ===== start path ===== */
.start-grid { margin-top: 0; }
.start-card {
    display: block;
    position: relative;
    padding: 19px 18px 17px;
    color: var(--text);
    background: linear-gradient(160deg, #111a2b, #0d1422);
    border: 1px solid var(--line);
    border-radius: 15px;
    transition: transform .18s, border-color .18s, background .18s;
}
.start-card:hover {
    color: var(--text);
    text-decoration: none;
    transform: translateY(-3px);
    border-color: #22d3ee55;
    background: linear-gradient(160deg, #152139, #0e1728);
}
.start-num {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 29px;
    height: 29px;
    margin-bottom: 12px;
    border-radius: 9px;
    color: var(--cyan);
    background: #22d3ee12;
    border: 1px solid #22d3ee44;
    font-size: .78rem;
    font-weight: 800;
}
.start-card h3 { margin: 0 0 5px; font-size: 1rem; color: #fff; }
.start-card p { margin: 0; color: var(--muted); font-size: .87rem; line-height: 1.45; }
.start-card .start-arrow {
    position: absolute;
    right: 15px;
    bottom: 14px;
    color: #7e91b3;
    font-size: 1rem;
}

/* ===== popular / tools ===== */
.home-split {
    display: grid;
    grid-template-columns: minmax(0, 1.45fr) minmax(280px, .8fr);
    gap: 16px;
    align-items: stretch;
}
.home-panel {
    padding: 20px 21px;
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: 17px;
}
.home-panel > h3 { margin: 0 0 13px; color: #fff; font-size: 1.02rem; }
.popular-list { display: grid; gap: 3px; }
.popular-item {
    display: grid;
    grid-template-columns: 42px minmax(0, 1fr) auto;
    align-items: center;
    gap: 12px;
    padding: 10px 9px;
    border-radius: 10px;
    color: var(--text);
}
.popular-item:hover { text-decoration: none; background: #ffffff07; }
.popular-icon {
    width: 42px;
    height: 42px;
    display: grid;
    place-items: center;
    border-radius: 10px;
    background: #ffffff08;
    border: 1px solid #ffffff10;
    font-size: 1.2rem;
}
.popular-item b { display: block; font-size: .92rem; line-height: 1.35; }
.popular-item small { display: block; margin-top: 2px; color: var(--muted); font-size: .77rem; }
.popular-arrow { color: #7085a8; }
.tool-links { display: grid; gap: 8px; }
.tool-link {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 11px 13px;
    border: 1px solid #ffffff12;
    border-radius: 10px;
    color: #dce6f7;
    background: #ffffff05;
    font-size: .88rem;
    font-weight: 650;
}
.tool-link:hover { text-decoration: none; border-color: #22d3ee55; background: #22d3ee0d; }
.tool-link span:last-child { color: var(--cyan); }

/* ===== chat CTA ===== */
.home-cta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
    margin-top: 34px;
    padding: 23px 25px;
    border: 1px solid #1e4a66;
    border-radius: 18px;
    background:
        radial-gradient(520px 200px at 90% 0%, #22d3ee1d, transparent 70%),
        linear-gradient(120deg, #0c1a27, #0d1420);
}
.home-cta h2 { margin: 2px 0 5px; font-size: 1.18rem; color: #fff; }
.home-cta p { margin: 0; color: var(--muted); font-size: .9rem; }
.home-cta .btn { flex: 0 0 auto; }

/* ===== responsive ===== */
@media (max-width: 980px) {
    .home-cards { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .home-split { grid-template-columns: 1fr; }
}
@media (max-width: 760px) {
    .header-row { gap: 10px; }
    .brand-copy small { display: none; }
    .brand-copy b { font-size: .9rem; }
    .home-section { margin-top: 27px; }
    .section-head { display: block; }
    .section-note { margin-top: 5px; text-align: left; }
    .home-tools { align-items: flex-start; flex-direction: column; gap: 7px; }
    .home-search { max-width: none; width: 100%; }
    .home-cards { grid-template-columns: 1fr; }
    .home-hero { padding: 20px 18px; }
    .home-hero .unit-patch-wrap { width: min(210px, 58vw); }
    .home-hero .unit-copy { text-align: center; }
    .home-hero .unit-kicker, .home-hero .unit-meta { justify-content: center; }
    .home-hero .unit-motto { text-align: left; }
    .home-hero .hero-actions { justify-content: center; }
    .home-cta { display: block; }
    .home-cta .btn { margin-top: 15px; }
    .popular-item { grid-template-columns: 38px minmax(0, 1fr) auto; gap: 9px; }
    .popular-icon { width: 38px; height: 38px; }
}
