/* Подготовка тимлида: общий стиль модулей и индекса.
   Layout: липкая верхняя панель; модуль = рейка оглавления (широкие экраны) + колонка чтения;
   карточками оформлены только интерактивные объекты (вопросы, задачи, карточки, STAR). */
@import url('https://fonts.googleapis.com/css2?family=Golos+Text:wght@400..700&family=JetBrains+Mono:wght@400;600&family=Unbounded:wght@500;650&display=swap');

:root {
  --bg: #f3f5f8;
  --surface: #ffffff;
  --surface-2: #e9edf2;
  --fg: #151b23;
  --muted: #586373;
  --line: #d6dce4;
  --accent: #1c58d2;
  --accent-fg: #ffffff;
  --accent-soft: #e2eafb;
  --ok: #17794a;
  --ok-soft: #e0f2e7;
  --bad: #bb3527;
  --bad-soft: #fae4e0;
  --warn: #9a6200;
  --warn-soft: #faefd6;
  --lvl-senior: #0d7a69;
  --lvl-senior-plus: #5643cc;
  --lvl-lead: #ad600b;
  --code-bg: #eef2f6;
  --code-fg: #1b232e;
  --tok-kw: #9c2273;
  --tok-type: #0a6884;
  --tok-str: #2c7420;
  --tok-com: #737e8d;
  --tok-num: #ab5000;
  --tok-fn: #264cbd;
  --hl-line: #fff1bd;
  --bug-line: #fbdcd7;
  --shadow: 0 1px 2px rgb(20 30 45 / .06), 0 6px 18px rgb(20 30 45 / .07);
  --font-display: 'Unbounded', 'Golos Text', system-ui, sans-serif;
  --font-body: 'Golos Text', system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, 'SF Mono', Menlo, Consolas, monospace;
  --radius: 10px;
  --topbar-h: 54px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0d1218; --surface: #141b24; --surface-2: #1b2430; --fg: #e4e9ef; --muted: #97a2b2; --line: #283342;
    --accent: #7ba3ff; --accent-fg: #0a1220; --accent-soft: #1a2947;
    --ok: #4cc38a; --ok-soft: #11301f; --bad: #ff7f6e; --bad-soft: #3b1713; --warn: #f0b64a; --warn-soft: #33270c;
    --lvl-senior: #43c7b1; --lvl-senior-plus: #a598ff; --lvl-lead: #f1a54d;
    --code-bg: #10171f; --code-fg: #d8e0e9; --tok-kw: #ee8dd0; --tok-type: #62d0e6; --tok-str: #9fdb7d; --tok-com: #6d7a8b;
    --tok-num: #ffb276; --tok-fn: #91b1ff; --hl-line: #38321a; --bug-line: #46201a;
    --shadow: 0 1px 2px rgb(0 0 0 / .35), 0 6px 20px rgb(0 0 0 / .28);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0d1218; --surface: #141b24; --surface-2: #1b2430; --fg: #e4e9ef; --muted: #97a2b2; --line: #283342;
  --accent: #7ba3ff; --accent-fg: #0a1220; --accent-soft: #1a2947;
  --ok: #4cc38a; --ok-soft: #11301f; --bad: #ff7f6e; --bad-soft: #3b1713; --warn: #f0b64a; --warn-soft: #33270c;
  --lvl-senior: #43c7b1; --lvl-senior-plus: #a598ff; --lvl-lead: #f1a54d;
  --code-bg: #10171f; --code-fg: #d8e0e9; --tok-kw: #ee8dd0; --tok-type: #62d0e6; --tok-str: #9fdb7d; --tok-com: #6d7a8b;
  --tok-num: #ffb276; --tok-fn: #91b1ff; --hl-line: #38321a; --bug-line: #46201a;
  --shadow: 0 1px 2px rgb(0 0 0 / .35), 0 6px 20px rgb(0 0 0 / .28);
  color-scheme: dark;
}

/* ---------- База ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-padding-top: calc(var(--topbar-h) + 72px); -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font: 400 17px/1.65 var(--font-body);
  font-feature-settings: 'kern';
}
img, svg { max-width: 100%; }
a { color: var(--accent); text-underline-offset: 2px; }
a:hover { text-decoration-thickness: 2px; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }
[hidden] { display: none !important; }
.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; }
hr { border: 0; border-top: 1px solid var(--line); margin: 32px 0; }
::selection { background: var(--accent-soft); }

h1, h2, h3, h4 { text-wrap: balance; line-height: 1.2; margin: 0; }
h1 { font: 650 clamp(28px, 4.2vw, 42px)/1.12 var(--font-display); letter-spacing: -0.01em; }
h2 { font: 650 clamp(22px, 2.8vw, 28px)/1.2 var(--font-display); letter-spacing: -0.005em; }
h3 { font-size: 21px; font-weight: 650; }
h4 { font-size: 18px; font-weight: 650; }
p, ul, ol, dl, blockquote, pre, table, figure { margin: 0; }
.prose > * + *, .module-flow > * + * { margin-top: 14px; }
ul, ol { padding-left: 1.4em; }
li + li { margin-top: 4px; }
li > ul, li > ol { margin-top: 4px; }
strong, b { font-weight: 650; }
small, .muted { color: var(--muted); }
kbd, .kbd {
  font: 600 13px var(--font-mono); padding: 1px 6px; border: 1px solid var(--line);
  border-bottom-width: 2px; border-radius: 5px; background: var(--surface);
}
mark { background: var(--hl-line); color: inherit; padding: 0 2px; border-radius: 3px; }

/* ---------- Верхняя панель ---------- */
.topbar {
  position: sticky; top: env(safe-area-inset-top, 0px); z-index: 30;
  display: flex; align-items: center; gap: 10px 16px; flex-wrap: wrap;
  min-height: var(--topbar-h); padding-block: 8px; padding-inline: 16px;
  background: color-mix(in srgb, var(--bg) 90%, transparent);
  backdrop-filter: saturate(1.4) blur(10px); -webkit-backdrop-filter: saturate(1.4) blur(10px);
  border-bottom: 1px solid var(--line);
}
.topbar-home { font-weight: 600; text-decoration: none; white-space: nowrap; font-size: 15px; }
.topbar-title { display: flex; gap: 8px; align-items: baseline; min-width: 0; flex: 1 1 200px; font-size: 15px; }
.topbar-title b { font: 650 13px var(--font-display); color: var(--accent); letter-spacing: .02em; }
.topbar-title span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.topbar-parts { display: flex; gap: 4px; flex-wrap: wrap; }
.topbar-parts a {
  font-size: 14px; text-decoration: none; color: var(--muted); padding: 4px 10px; border-radius: 999px;
}
.topbar-parts a:hover, .topbar-parts a.is-active { color: var(--fg); background: var(--surface-2); }
.theme-btn {
  font: 600 13px var(--font-body); color: var(--fg); background: var(--surface);
  border: 1px solid var(--line); border-radius: 999px; padding: 6px 12px; cursor: pointer;
}
@media (max-width: 720px) {
  .topbar { gap: 6px 10px; padding-block: 6px; }
  .topbar-title { flex: 1 1 0; }
  .theme-btn { padding: 5px 10px; font-size: 12px; }
  .topbar-parts { order: 3; width: 100%; flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; margin-inline: -4px; }
  .topbar-parts::-webkit-scrollbar { display: none; }
  .topbar-parts a { white-space: nowrap; padding: 3px 9px; }
  .quiz > .quiz-bar { position: static; box-shadow: none; }
}

/* ---------- Раскладка модуля ---------- */
.page {
  display: grid; grid-template-columns: minmax(0, 1fr); gap: 32px;
  max-width: 1260px; margin: 0 auto; padding-inline: 16px; padding-block: 28px 80px;
}
@media (min-width: 1120px) {
  .page { grid-template-columns: 260px minmax(0, 1fr); gap: 48px; padding-inline: 24px; }
  .toc { position: sticky; top: calc(env(safe-area-inset-top, 0px) + var(--topbar-h) + 20px);
         max-height: calc(100vh - var(--topbar-h) - 40px); overflow: auto; align-self: start; }
  .toc > summary { display: none; }
}
.module { min-width: 0; max-width: 880px; display: flex; flex-direction: column; gap: 18px; }
.module p, .module li, .module dd { max-width: 74ch; }
.module > header, .mod-hero { display: flex; flex-direction: column; gap: 12px; padding-bottom: 8px; }
.eyebrow {
  font: 600 12px/1.3 var(--font-body); letter-spacing: .09em; text-transform: uppercase; color: var(--muted);
}
.lead { font-size: 19px; color: var(--muted); }

.part { display: flex; flex-direction: column; gap: 16px; padding-top: 28px; border-top: 2px solid var(--fg); margin-top: 36px; }
.part > h2 { margin-bottom: 4px; }
.part h3 { margin-top: 22px; }
.part h4 { margin-top: 12px; }
.topic { display: flex; flex-direction: column; gap: 14px; }
.topic + .topic { padding-top: 14px; }

/* Оглавление */
.toc { font-size: 14px; line-height: 1.4; min-width: 0; }
.toc > summary {
  cursor: pointer; font-weight: 600; padding: 10px 14px; border: 1px solid var(--line);
  border-radius: var(--radius); background: var(--surface); list-style: none;
}
.toc > summary::-webkit-details-marker { display: none; }
.toc > summary::after { content: ' ▾'; color: var(--muted); }
.toc[open] > summary { margin-bottom: 10px; }
.toc ol { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 2px; }
.toc ol ol { padding-left: 12px; margin: 2px 0 6px; border-left: 1px solid var(--line); }
.toc li + li { margin-top: 0; }
.toc a { display: block; padding: 4px 8px; color: var(--muted); text-decoration: none; border-radius: 6px; }
.toc a:hover { color: var(--fg); background: var(--surface-2); }
.toc a.is-active { color: var(--accent); background: var(--accent-soft); font-weight: 600; }
.toc .toc-part > a { color: var(--fg); font-weight: 650; margin-top: 8px; }
.toc-progress { margin-top: 16px; padding-top: 12px; border-top: 1px solid var(--line); color: var(--muted); font-size: 13px; }

/* ---------- Код ---------- */
.code-wrap { position: relative; min-width: 0; }
pre {
  background: var(--code-bg); color: var(--code-fg); border: 1px solid var(--line); border-radius: 8px;
  padding-block: 12px; padding-inline: 0; overflow-x: auto; font: 14px/1.6 var(--font-mono); tab-size: 4;
  font-variant-ligatures: none; font-feature-settings: 'liga' 0, 'calt' 0;
}
pre > code { display: block; min-width: max-content; font: inherit; background: none; padding: 0; }
pre > code:not(.is-lined) { padding-inline: 16px; }
pre .ln { display: block; padding-inline: 16px; min-height: 1.6em; }
pre.numbered > code { counter-reset: ln; }
pre.numbered .ln::before {
  counter-increment: ln; content: counter(ln); display: inline-block; width: 2em; margin-right: 14px;
  text-align: right; color: var(--tok-com); user-select: none; -webkit-user-select: none;
}
pre .ln.hl { background: var(--hl-line); }
pre .ln.hl-bug { background: var(--bug-line); box-shadow: inset 3px 0 0 var(--bad); }
:not(pre) > code {
  font: 0.86em var(--font-mono); font-variant-ligatures: none; font-feature-settings: 'liga' 0, 'calt' 0; background: var(--surface-2); padding: .12em .38em; border-radius: 4px;
  overflow-wrap: anywhere;
}
.code-copy {
  position: absolute; top: 6px; right: 6px; font: 600 12px var(--font-body); padding: 4px 8px;
  border: 1px solid var(--line); border-radius: 6px; background: var(--surface); color: var(--muted);
  cursor: pointer; opacity: 0; transition: opacity .15s;
}
.code-wrap:hover .code-copy, .code-copy:focus-visible { opacity: 1; }
@media (hover: none) { .code-copy { opacity: .75; } }
.tok-kw { color: var(--tok-kw); }
.tok-type { color: var(--tok-type); }
.tok-str { color: var(--tok-str); }
.tok-com { color: var(--tok-com); font-style: italic; }
.tok-num, .tok-lit { color: var(--tok-num); }
.tok-fn { color: var(--tok-fn); }
pre.diagram { padding-inline: 16px; line-height: 1.35; }
pre.mermaid { padding-inline: 16px; text-align: center; }
pre.mermaid[data-processed], pre.mermaid.is-rendered { background: var(--surface); }

/* ---------- Таблицы и сетки ---------- */
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); }
table { border-collapse: collapse; width: 100%; font-size: 15px; line-height: 1.5; font-variant-numeric: tabular-nums; }
th, td { padding: 9px 12px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
tr:last-child > td { border-bottom: 0; }
th { background: var(--surface-2); font-weight: 650; white-space: nowrap; }
td code { white-space: nowrap; }
.cols { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(min(280px, 100%), 1fr)); }
.cols > * { min-width: 0; display: flex; flex-direction: column; gap: 10px; }
dl.defs { display: grid; grid-template-columns: minmax(0, max-content) minmax(0, 1fr); gap: 8px 18px; }
dl.defs dt { font-weight: 650; }
dl.defs dd { margin: 0; }
@media (max-width: 560px) { dl.defs { grid-template-columns: minmax(0, 1fr); } dl.defs dd { margin-bottom: 8px; } }

/* ---------- Врезки ---------- */
.callout { padding: 12px 16px; border-radius: 8px; background: var(--surface-2); display: flex; flex-direction: column; gap: 8px; }
.callout::before {
  content: 'Справка'; font: 650 12px/1.2 var(--font-body); letter-spacing: .08em; text-transform: uppercase; color: var(--muted);
}
.callout.tip { background: var(--ok-soft); }
.callout.tip::before { content: 'Как отвечать'; color: var(--ok); }
.callout.warn { background: var(--warn-soft); }
.callout.warn::before { content: 'Ловушка'; color: var(--warn); }
.callout.danger { background: var(--bad-soft); }
.callout.danger::before { content: 'Причина отказа'; color: var(--bad); }
.callout[data-label]::before { content: attr(data-label); }
.interviewer, .candidate { padding: 12px 16px; border-radius: 8px; display: flex; flex-direction: column; gap: 6px; }
.interviewer { background: var(--accent-soft); }
.candidate { background: var(--surface); border: 1px solid var(--line); }
.interviewer::before, .candidate::before {
  font: 650 12px/1.2 var(--font-body); letter-spacing: .08em; text-transform: uppercase;
}
.interviewer::before { content: 'Интервьюер'; color: var(--accent); }
.candidate::before { content: 'Кандидат'; color: var(--muted); }
.interviewer[data-label]::before, .candidate[data-label]::before { content: attr(data-label); }

ol.timeline { list-style: none; padding: 0; border-top: 1px solid var(--line); }
ol.timeline > li { position: relative; padding: 9px 0 9px 8.2em; border-bottom: 1px solid var(--line); margin: 0; max-width: none; }
ol.timeline .t {
  position: absolute; left: 0; top: 10px; font: 600 14px/1.5 var(--font-mono); color: var(--accent); white-space: nowrap;
}
@media (max-width: 560px) { ol.timeline > li { padding-left: 0; } ol.timeline .t { position: static; display: block; } }
ul.checklist, ul.redflags { list-style: none; padding-left: 0; }
ul.checklist > li, ul.redflags > li { position: relative; padding-left: 1.6em; }
ul.checklist > li::before { content: '✓'; position: absolute; left: 0; color: var(--ok); font-weight: 700; }
ul.redflags > li::before { content: '✕'; position: absolute; left: 0; color: var(--bad); font-weight: 700; }

/* Бейджи и чипы */
.chip {
  display: inline-flex; align-items: center; gap: 4px; padding: 2px 9px; border: 1px solid var(--line);
  border-radius: 999px; font-size: 13px; line-height: 1.6; color: var(--muted); background: var(--surface); white-space: nowrap;
}
.lvl {
  --c: var(--muted);
  display: inline-flex; align-items: center; padding: 3px 9px; border-radius: 999px; white-space: nowrap;
  font: 650 11.5px/1.3 var(--font-body); letter-spacing: .06em; text-transform: uppercase;
  color: var(--c); background: color-mix(in srgb, var(--c) 13%, transparent);
}
.lvl-senior { --c: var(--lvl-senior); }
.lvl-senior-plus { --c: var(--lvl-senior-plus); }
.lvl-lead { --c: var(--lvl-lead); }
.lvl-none { --c: var(--bad); }

/* Кнопки */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  font: 600 14px/1.2 var(--font-body); padding: 9px 14px; border-radius: 8px; cursor: pointer;
  border: 1px solid var(--line); background: var(--surface); color: var(--fg); text-decoration: none;
}
.btn:hover { border-color: var(--muted); }
.btn-primary { background: var(--accent); color: var(--accent-fg); border-color: transparent; }
.btn-primary:hover { border-color: transparent; filter: brightness(1.06); }
.btn-ghost { background: transparent; }
.btn-danger { color: var(--bad); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn-row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.timer { font-variant-numeric: tabular-nums; }
.timer.is-running { color: var(--accent); border-color: var(--accent); }
.timer.is-over { color: var(--bad); border-color: var(--bad); }
textarea, input[type="text"] {
  width: 100%; font: 15px/1.55 var(--font-body); color: var(--fg); background: var(--bg);
  border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; resize: vertical;
}
textarea.mono { font-family: var(--font-mono); font-size: 14px; }
textarea:focus, input:focus, select:focus { outline: 2px solid var(--accent); outline-offset: 0; border-color: transparent; }
.save-note { font-size: 12px; color: var(--muted); }

/* ---------- Спойлеры ---------- */
details.spoiler, details.hint { border-radius: 8px; border: 1px dashed var(--line); background: var(--surface-2); }
details.hint { background: var(--warn-soft); border-color: transparent; }
details.spoiler > summary, details.hint > summary {
  cursor: pointer; padding: 10px 14px; font-weight: 650; list-style: none; display: flex; gap: 8px; align-items: center;
}
details.spoiler > summary::-webkit-details-marker, details.hint > summary::-webkit-details-marker { display: none; }
details.spoiler > summary::before { content: '▸'; color: var(--accent); transition: transform .15s; }
details.hint > summary::before { content: '?'; color: var(--warn); font-weight: 800; }
details.spoiler[open] > summary::before { transform: rotate(90deg); }
details.spoiler > summary::after { content: 'спойлер'; margin-left: auto; font-size: 12px; font-weight: 500; color: var(--muted); }
details.spoiler[open] > summary::after { content: 'скрыть'; }
details.spoiler[open], details.hint[open] { padding-bottom: 14px; }
details.spoiler > :not(summary), details.hint > :not(summary) { margin: 10px 14px 0; }
details.spoiler[open] { background: var(--surface); border-style: solid; }

/* ---------- Практика ---------- */
.task {
  display: flex; flex-direction: column; gap: 14px; padding: 20px; background: var(--surface);
  border: 1px solid var(--line); border-radius: var(--radius);
}
.task > h3 { margin-top: 0; }
.task-meta { display: flex; flex-wrap: wrap; gap: 6px; }
.task-tools { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; padding-top: 4px; border-top: 1px solid var(--line); padding-top: 12px; }
.task.is-solved { border-color: var(--ok); }
.task .solved-toggle[aria-pressed="true"] { color: var(--ok); border-color: var(--ok); background: var(--ok-soft); }
details.draft > summary { cursor: pointer; color: var(--muted); font-size: 14px; font-weight: 600; }
details.draft[open] > summary { margin-bottom: 8px; }
.practice-list { display: flex; flex-direction: column; gap: 20px; }

/* ---------- Тест ---------- */
html.js .q-options, html.js .q-explain, html.js .q-model, html.js .q-checklist { display: none; }
.quiz { display: flex; flex-direction: column; gap: 16px; }
.quiz-bar {
  position: sticky; top: calc(env(safe-area-inset-top, 0px) + var(--topbar-h) + 8px); z-index: 10;
  display: flex; flex-wrap: wrap; gap: 10px 18px; align-items: center; padding: 10px 14px;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow);
}
.quiz-stat { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.quiz-stat b { font: 650 18px/1.1 var(--font-display); font-variant-numeric: tabular-nums; }
.quiz-stat small { font-size: 12px; }
.quiz-levels { display: flex; flex-wrap: wrap; gap: 6px; }
.quiz-bar .btn-row { margin-left: auto; }
.quiz.only-wrong .q:not(.is-miss) { display: none; }
.q {
  display: flex; flex-direction: column; gap: 12px; padding: 18px 20px; background: var(--surface);
  border: 1px solid var(--line); border-radius: var(--radius); scroll-margin-top: 140px;
}
.q-head { display: flex; flex-wrap: wrap; gap: 6px 8px; align-items: center; font-size: 13px; color: var(--muted); }
.q-num { font: 650 13px var(--font-display); color: var(--fg); margin-right: 4px; font-variant-numeric: tabular-nums; }
.q-text { display: flex; flex-direction: column; gap: 10px; font-size: 17px; }
.q-ui { display: flex; flex-direction: column; gap: 10px; }
.q-opts { display: flex; flex-direction: column; gap: 8px; }
.q-opt {
  display: flex; gap: 10px; align-items: flex-start; width: 100%; text-align: left; padding: 10px 12px;
  border: 1px solid var(--line); border-radius: 8px; background: var(--bg); color: var(--fg); font: inherit; font-size: 16px; cursor: pointer;
}
.q-opt:hover:not(:disabled) { border-color: var(--muted); }
.q-opt .q-mark {
  flex: none; width: 1.7em; height: 1.7em; display: inline-grid; place-items: center; border-radius: 6px;
  font: 650 13px var(--font-mono); background: var(--surface-2); color: var(--muted);
}
.q-opt .q-otext { min-width: 0; flex: 1; }
.q-opt.mono .q-otext { font-family: var(--font-mono); font-size: 14px; white-space: pre-wrap; font-variant-ligatures: none; font-feature-settings: 'liga' 0, 'calt' 0; }
.q-opt[aria-pressed="true"] { border-color: var(--accent); background: var(--accent-soft); }
.q-opt[aria-pressed="true"] .q-mark { background: var(--accent); color: var(--accent-fg); }
.q-opt:disabled { cursor: default; }
.q-opt.is-correct { border-color: var(--ok); background: var(--ok-soft); }
.q-opt.is-correct .q-mark { background: var(--ok); color: var(--surface); }
.q-opt.is-wrong { border-color: var(--bad); background: var(--bad-soft); }
.q-opt.is-wrong .q-mark { background: var(--bad); color: var(--surface); }
.q-opt.is-missed { border-style: dashed; border-color: var(--ok); }
.q-verdict { font-weight: 650; }
.q.is-hit .q-verdict { color: var(--ok); }
.q.is-miss .q-verdict { color: var(--bad); }
.q.is-partial .q-verdict { color: var(--warn); }
html.js .q.is-answered .q-explain, html.js .q.is-revealed .q-model { display: flex; }
.q-explain, .q-model {
  flex-direction: column; gap: 10px; padding: 12px 14px; border-radius: 8px; background: var(--surface-2);
}
.q-model::before, .q-explain::before {
  font: 650 12px/1.2 var(--font-body); letter-spacing: .08em; text-transform: uppercase; color: var(--muted);
}
.q-explain::before { content: 'Разбор'; }
.q-model::before { content: 'Эталон'; }
.q-checks { display: flex; flex-direction: column; gap: 6px; padding: 12px 14px; border: 1px solid var(--line); border-radius: 8px; }
.q-checks > b { font-size: 14px; }
.check-row { display: flex; gap: 10px; align-items: flex-start; font-size: 15px; cursor: pointer; }
.check-row input { margin-top: .3em; width: 17px; height: 17px; accent-color: var(--accent); flex: none; }
.quiz-result {
  display: flex; flex-direction: column; gap: 14px; padding: 22px; border-radius: var(--radius);
  border: 2px solid var(--fg); background: var(--surface);
}
.quiz-result .big { font: 650 clamp(30px, 6vw, 48px)/1 var(--font-display); font-variant-numeric: tabular-nums; }
.quiz-result.is-pass .big { color: var(--ok); }
.quiz-result.is-fail .big { color: var(--bad); }
.level-ladder { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(150px, 100%), 1fr)); gap: 10px; }
.level-step { padding: 10px 12px; border-radius: 8px; border: 1px solid var(--line); display: flex; flex-direction: column; gap: 6px; }
.level-step.is-ok { border-color: var(--ok); }
.level-step b { font: 650 20px var(--font-display); font-variant-numeric: tabular-nums; }

/* ---------- Карточки ---------- */
html.js .flashcards > .fc { display: none; }
html.js .flashcards.as-list > .fc { display: grid; }
.flashcards { display: flex; flex-direction: column; gap: 12px; }
.flashcards > .fc { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 16px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.flashcards > .fc .fc-front { font-weight: 650; }
@media (max-width: 640px) { .flashcards > .fc { grid-template-columns: minmax(0, 1fr); gap: 4px; } }
.deck { display: flex; flex-direction: column; gap: 12px; }
.deck-head { display: flex; flex-wrap: wrap; gap: 8px 16px; align-items: baseline; justify-content: space-between; }
.deck-head h3 { margin: 0; }
.fc-card {
  position: relative; display: flex; flex-direction: column; justify-content: center; align-items: center; gap: 12px;
  width: 100%; min-height: 220px; padding: 34px 24px 26px; text-align: center; font: inherit; font-size: 19px; color: var(--fg);
  border: 1px solid var(--line); border-radius: 14px; background: var(--surface); box-shadow: var(--shadow); cursor: pointer;
}
.fc-card .fc-side { position: absolute; top: 10px; left: 14px; font-size: 12px; color: var(--muted); letter-spacing: .08em; text-transform: uppercase; }
.fc-card.is-back { background: var(--surface-2); font-size: 17px; text-align: left; align-items: stretch; }
.fc-card.is-known::after { content: 'знаю'; position: absolute; top: 10px; right: 14px; font-size: 12px; color: var(--ok); font-weight: 650; }
.fc-card pre { text-align: left; }

/* ---------- STAR ---------- */
.star-ui { display: flex; flex-direction: column; gap: 14px; }
.star-bar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.star-summary { color: var(--muted); font-size: 14px; margin-left: auto; }
.filter-chip { cursor: pointer; font: inherit; font-size: 13px; }
.filter-chip[aria-pressed="true"] { color: var(--accent-fg); background: var(--accent); border-color: transparent; }
html.js .star-trainer > .star { display: none; }
.star-list { display: flex; flex-direction: column; gap: 10px; }
.star-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.star-card > button.star-head {
  display: flex; gap: 12px; align-items: flex-start; width: 100%; padding: 14px 16px; text-align: left;
  font: inherit; color: var(--fg); background: none; border: 0; cursor: pointer; border-radius: var(--radius);
}
.star-head .star-n { font: 650 13px/1.7 var(--font-display); color: var(--muted); flex: none; min-width: 2.2em; }
.star-head .star-title { flex: 1; min-width: 0; font-weight: 600; }
.star-head .star-status { flex: none; }
.star-body { display: flex; flex-direction: column; gap: 14px; padding: 4px 16px 18px; }
.star-card.is-open { border-color: var(--accent); }
.star-card.is-rated .star-status { color: var(--ok); border-color: var(--ok); }
.star-why, .star-model, .star-followups, .star-redflags { display: flex; flex-direction: column; gap: 8px; }
.star-section-title { font: 650 12px/1.2 var(--font-body); letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.star-model .star-step { display: grid; grid-template-columns: 2.4em minmax(0, 1fr); gap: 8px; }
.star-model .star-step > b { font: 650 15px var(--font-display); color: var(--accent); }

/* ---------- Индекс ---------- */
.index-page { max-width: 1180px; margin: 0 auto; padding-inline: 16px; padding-block: 32px 80px; display: flex; flex-direction: column; gap: 40px; }
.index-hero { display: grid; gap: 24px; grid-template-columns: minmax(0, 1fr); }
@media (min-width: 900px) { .index-hero { grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr); align-items: end; } }
.index-hero h1 { font-size: clamp(30px, 5vw, 52px); }
.overall { padding: 18px; border: 2px solid var(--fg); border-radius: var(--radius); background: var(--surface); display: flex; flex-direction: column; gap: 12px; }
.overall .big { font: 650 40px/1 var(--font-display); font-variant-numeric: tabular-nums; }
.stages { list-style: none; padding: 0; margin: 0; display: grid; gap: 10px; grid-template-columns: repeat(auto-fit, minmax(min(190px, 100%), 1fr)); counter-reset: st; }
.stages > li { margin: 0; padding: 12px 14px; border-top: 2px solid var(--fg); display: flex; flex-direction: column; gap: 4px; font-size: 15px; }
.stages > li::before { counter-increment: st; content: 'Этап ' counter(st); font: 650 12px var(--font-display); color: var(--muted); letter-spacing: .04em; }
.stages b { font-size: 16px; }
.group { display: flex; flex-direction: column; gap: 16px; }
.group-head { display: flex; flex-wrap: wrap; gap: 8px 16px; align-items: baseline; }
.mod-grid { display: grid; gap: 14px; grid-template-columns: repeat(auto-fill, minmax(min(320px, 100%), 1fr)); }
.mod-card {
  display: flex; flex-direction: column; gap: 10px; padding: 18px; background: var(--surface);
  border: 1px solid var(--line); border-radius: var(--radius); color: var(--fg); text-decoration: none; min-width: 0;
}
a.mod-card:hover { border-color: var(--accent); box-shadow: var(--shadow); }
.mod-card.is-soon { background: transparent; border-style: dashed; }
.mod-card .mod-code { font: 650 14px var(--font-display); color: var(--accent); letter-spacing: .02em; }
.mod-card.is-soon .mod-code { color: var(--muted); }
.mod-card h3 { font-size: 19px; }
.mod-card p { font-size: 15px; color: var(--muted); }
.mod-stats { display: flex; flex-wrap: wrap; gap: 6px; margin-top: auto; }
.meter { height: 6px; border-radius: 99px; background: var(--surface-2); overflow: hidden; }
.meter > span { display: block; height: 100%; width: var(--v, 0%); background: var(--accent); border-radius: 99px; }
.data-tools { display: flex; flex-direction: column; gap: 10px; }

/* ---------- Источники и навигация ---------- */
ol.sources { display: flex; flex-direction: column; gap: 6px; font-size: 15px; }
ol.sources a { overflow-wrap: anywhere; }
.mod-nav { display: flex; flex-wrap: wrap; gap: 12px; justify-content: space-between; padding-top: 24px; border-top: 1px solid var(--line); }

/* ---------- Аккаунт ---------- */
.acct { position: relative; display: flex; align-items: center; }
.acct-login, .acct-btn {
  display: inline-flex; align-items: center; gap: 8px; min-height: 36px; max-width: 280px;
  font: 600 13px var(--font-body); color: var(--fg); background: var(--surface); text-decoration: none;
  border: 1px solid var(--line); border-radius: 999px; padding: 6px 12px; cursor: pointer;
}
.acct-login { color: var(--accent-fg); background: var(--accent); border-color: transparent; }
.acct-btn:hover, .acct-login:hover { border-color: var(--muted); }
.acct-dot { flex: none; width: 8px; height: 8px; border-radius: 50%; background: var(--muted); }
.acct-btn[data-status="ok"] .acct-dot { background: var(--ok); }
.acct-btn[data-status="error"] .acct-dot { background: var(--bad); }
.acct-btn[data-status="stale"] .acct-dot, .acct-btn[data-status="syncing"] .acct-dot { background: var(--warn); }
.acct-label { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.acct-state { color: var(--muted); font-weight: 500; white-space: nowrap; }
.acct-menu {
  position: absolute; top: calc(100% + 8px); right: 0; z-index: 40; width: min(300px, calc(100vw - 32px));
  display: flex; flex-direction: column; gap: 8px; padding: 14px; background: var(--surface);
  border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow);
}
.acct-menu .btn { width: 100%; }
.acct-login { font-weight: 650; overflow-wrap: anywhere; }
.acct-status { font-size: 13px; }
.acct-home { display: flex; flex-direction: column; gap: 10px; margin-top: 8px; padding-top: 14px; border-top: 1px solid var(--line); }
@media (max-width: 720px) {
  .acct-state { display: none; }
  .acct-label { max-width: 110px; }
  .acct-login, .acct-btn { min-height: 32px; padding: 5px 10px; font-size: 12px; }
}

/* ---------- Закладки на странице модуля ---------- */
.bm-btn {
  float: right; display: inline-grid; place-items: center; width: 44px; height: 44px; margin: -8px -10px 0 8px;
  padding: 0; border: 0; border-radius: 50%; background: none; color: var(--muted); cursor: pointer;
}
.bm-btn svg { fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linejoin: round; }
.bm-btn:hover { color: var(--accent); background: var(--surface-2); }
.bm-btn.is-on { color: var(--warn); }
.bm-btn.is-on svg { fill: currentColor; }
.bm-btn:disabled { opacity: .5; cursor: progress; }
.task > h3:has(> .bm-btn), .topic > h3:has(> .bm-btn) { display: flow-root; }
.bm-panel {
  display: flex; flex-direction: column; gap: 8px; padding: 12px 14px; border-radius: 8px;
  background: var(--warn-soft); border: 1px solid var(--line);
}
.bm-panel[hidden] { display: none; }
.bm-panel label { font-size: 14px; font-weight: 600; }
.topic > .bm-panel { margin-top: -4px; }

/* ---------- Вход и «Мои закладки» ---------- */
.auth-page, .bookmarks-page {
  display: flex; flex-direction: column; gap: 18px; max-width: 880px; margin: 0 auto; padding-inline: 16px; padding-block: 32px 80px;
}
.auth-page { max-width: 460px; }
.auth-card {
  display: flex; flex-direction: column; gap: 14px; padding: 22px; background: var(--surface);
  border: 1px solid var(--line); border-radius: var(--radius);
}
.auth-form { display: flex; flex-direction: column; gap: 14px; }
.auth-form .btn { min-height: 44px; }
.field { display: flex; flex-direction: column; gap: 6px; font-size: 14px; font-weight: 600; }
input[type="text"], input[type="email"], input[type="password"], select {
  width: 100%; min-height: 44px; font: 16px/1.4 var(--font-body); color: var(--fg); background: var(--bg);
  border: 1px solid var(--line); border-radius: 8px; padding: 9px 12px;
}
select { width: auto; max-width: 100%; cursor: pointer; }
.form-error { color: var(--bad); font-size: 14px; min-height: 1em; }
.form-error:empty { display: none; }
.bm-tools { display: flex; flex-wrap: wrap; gap: 8px 12px; align-items: center; }
.bm-tools[hidden] { display: none; }
.bm-tools label { font-weight: 600; font-size: 14px; }
.bm-list { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 12px; }
.bm-item {
  margin: 0; display: flex; flex-direction: column; gap: 10px; padding: 16px 18px; background: var(--surface);
  border: 1px solid var(--line); border-radius: var(--radius); min-width: 0;
}
.bm-item h3 { font-size: 18px; overflow-wrap: anywhere; }
.bm-meta { display: flex; flex-wrap: wrap; gap: 6px 8px; align-items: center; font-size: 13px; }
.bm-note { white-space: pre-wrap; overflow-wrap: anywhere; }
.bm-edit { display: flex; flex-direction: column; gap: 8px; }
.bm-edit[hidden] { display: none; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; scroll-behavior: auto !important; }
}
@media print {
  .topbar, .toc, .quiz-bar, .task-tools, .code-copy, .bm-btn, .bm-panel { display: none !important; }
  html.js .q-options, html.js .q-explain { display: block !important; }
}
