/* ---------- Шрифты (локальные, с кириллицей) ---------- */
@font-face { font-family: "Plex"; src: url(/static/fonts/ibm-plex-sans-cyrillic-400-normal.woff2) format("woff2"); font-weight: 400; font-display: swap; unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116; }
@font-face { font-family: "Plex"; src: url(/static/fonts/ibm-plex-sans-latin-400-normal.woff2) format("woff2"); font-weight: 400; font-display: swap; unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2122, U+2190-2199, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "Plex"; src: url(/static/fonts/ibm-plex-sans-cyrillic-500-normal.woff2) format("woff2"); font-weight: 500; font-display: swap; unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116; }
@font-face { font-family: "Plex"; src: url(/static/fonts/ibm-plex-sans-latin-500-normal.woff2) format("woff2"); font-weight: 500; font-display: swap; unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2122, U+2190-2199, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "Plex"; src: url(/static/fonts/ibm-plex-sans-cyrillic-600-normal.woff2) format("woff2"); font-weight: 600; font-display: swap; unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116; }
@font-face { font-family: "Plex"; src: url(/static/fonts/ibm-plex-sans-latin-600-normal.woff2) format("woff2"); font-weight: 600; font-display: swap; unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2122, U+2190-2199, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "PlexCond"; src: url(/static/fonts/ibm-plex-sans-condensed-latin-600-normal.woff2) format("woff2"); font-weight: 600; font-display: swap; }
@font-face { font-family: "PlexCond"; src: url(/static/fonts/ibm-plex-sans-condensed-latin-500-normal.woff2) format("woff2"); font-weight: 500; font-display: swap; }
@font-face { font-family: "JBMono"; src: url(/static/fonts/jetbrains-mono-latin-400-normal.woff2) format("woff2"); font-weight: 400; font-display: swap; unicode-range: U+0000-00FF, U+2000-206F, U+2190-2199, U+2212; }
@font-face { font-family: "JBMono"; src: url(/static/fonts/jetbrains-mono-cyrillic-400-normal.woff2) format("woff2"); font-weight: 400; font-display: swap; unicode-range: U+0400-045F, U+0490-0491, U+2116; }

/* ---------- Токены ---------- */
:root {
  --bg: #EDF0F4;
  --surface: #FFFFFF;
  --surface-2: #F4F6F9;
  --ink: #18202B;
  --muted: #5B6676;
  --faint: #8A94A3;
  --line: #D6DCE4;
  --line-strong: #B9C2CE;
  --accent: #2643C9;
  --accent-soft: #E3E8FB;
  --accent-ink: #FFFFFF;
  --good: #17785F;
  --good-soft: #DCF1EA;
  --mid: #9A6410;
  --mid-soft: #F8ECD5;
  --bad: #B83A26;
  --bad-soft: #F8E1DC;
  --focus: #2643C9;
  --shadow: 0 1px 2px rgba(24, 32, 43, .06), 0 4px 16px rgba(24, 32, 43, .05);
  --font: "Plex", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-num: "PlexCond", "Plex", system-ui, sans-serif;
  --font-code: "JBMono", ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
  --r-sm: 6px;
  --r-md: 10px;
  --sidebar: 228px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #10141B; --surface: #171C25; --surface-2: #1D2330; --ink: #E4E9F1; --muted: #9AA5B6; --faint: #6E7888;
    --line: #2A3240; --line-strong: #3A4456; --accent: #8197FF; --accent-soft: #232C4D; --accent-ink: #0E1220;
    --good: #4CC59C; --good-soft: #15342B; --mid: #E2AE4D; --mid-soft: #3A2E15; --bad: #F07C66; --bad-soft: #3D1F1A;
    --focus: #8197FF; --shadow: 0 1px 2px rgba(0,0,0,.4); color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #10141B; --surface: #171C25; --surface-2: #1D2330; --ink: #E4E9F1; --muted: #9AA5B6; --faint: #6E7888;
  --line: #2A3240; --line-strong: #3A4456; --accent: #8197FF; --accent-soft: #232C4D; --accent-ink: #0E1220;
  --good: #4CC59C; --good-soft: #15342B; --mid: #E2AE4D; --mid-soft: #3A2E15; --bad: #F07C66; --bad-soft: #3D1F1A;
  --focus: #8197FF; --shadow: 0 1px 2px rgba(0,0,0,.4); color-scheme: dark;
}

/* ---------- База ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 400 15px/1.55 var(--font); }
a { color: var(--accent); text-decoration-thickness: 1px; text-underline-offset: 2px; }
h1, h2, h3 { line-height: 1.25; margin: 0 0 .5em; font-weight: 600; }
h1 { font-size: 1.6rem; letter-spacing: -.01em; }
h2 { font-size: 1.15rem; margin-top: 1.8rem; }
h3 { font-size: 1rem; }
p { margin: 0 0 .8em; }
code, pre, kbd { font-family: var(--font-code); font-size: .88em; }
pre { background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--r-sm); padding: .75rem .9rem; overflow-x: auto; line-height: 1.45; }
:not(pre) > code { background: var(--surface-2); border: 1px solid var(--line); border-radius: 4px; padding: .05em .3em; overflow-wrap: anywhere; }
table { border-collapse: collapse; width: 100%; }
img, svg, canvas { max-width: 100%; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; border-radius: 3px; }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }
[hidden] { display: none !important; }

/* ---------- Каркас ---------- */
.shell { min-height: 100vh; }
.topbar { display: none; }
.sidebar {
  position: fixed; inset: 0 auto 0 0; width: var(--sidebar); padding: 22px 14px 18px;
  background: var(--surface); border-right: 1px solid var(--line); display: flex; flex-direction: column;
  gap: 18px; overflow-y: auto; z-index: 30;
}
.brand { font: 600 1.05rem/1 var(--font); color: var(--ink); text-decoration: none; letter-spacing: -.01em; }
.brand-side { padding: 0 10px; display: block; }
.brand-side span { display: block; font-weight: 400; font-size: .82rem; color: var(--muted); margin-top: 4px; }
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav a, .nav .linklike {
  display: block; padding: 7px 10px; border-radius: var(--r-sm); color: var(--ink); text-decoration: none;
  font-size: .94rem; text-align: left;
}
.nav a:hover, .nav .linklike:hover { background: var(--surface-2); }
.nav a.on { background: var(--accent-soft); color: var(--accent); font-weight: 500; box-shadow: inset 3px 0 0 var(--accent); }
.nav-secondary { margin-top: auto; border-top: 1px solid var(--line); padding-top: 12px; }
.nav-secondary a, .nav-secondary .linklike { color: var(--muted); font-size: .88rem; }
.main { margin-left: var(--sidebar); padding: 28px 36px 64px; max-width: calc(1180px + var(--sidebar)); }
.backdrop { display: none; }

@media (max-width: 900px) {
  .topbar {
    display: flex; align-items: center; gap: 8px; position: sticky; top: 0; z-index: 20; height: 52px;
    padding: 0 8px; background: var(--surface); border-bottom: 1px solid var(--line);
  }
  .sidebar { transform: translateX(-100%); transition: transform .2s ease; box-shadow: none; width: min(280px, 82vw); }
  .sidebar.open { transform: none; box-shadow: 8px 0 24px rgba(0,0,0,.18); }
  .backdrop { display: block; position: fixed; inset: 0; background: rgba(10, 14, 20, .35); z-index: 25; }
  .main { margin-left: 0; padding: 18px 16px 56px; }
  .brand-side { display: none; }
  h1 { font-size: 1.35rem; }
}

/* ---------- Элементы ---------- */
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px 20px; flex-wrap: wrap; margin-bottom: 18px; }
.page-head h1 { margin: 0; }
.page-head p { margin: 4px 0 0; color: var(--muted); max-width: 70ch; }
.muted { color: var(--muted); }
.faint { color: var(--faint); }
.small { font-size: .86rem; }
.nowrap { white-space: nowrap; }
.right { text-align: right; }
.stack > * + * { margin-top: 12px; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.row-between { display: flex; gap: 10px; align-items: center; justify-content: space-between; flex-wrap: wrap; }
.grow { flex: 1 1 auto; min-width: 0; }
.prose { max-width: 75ch; }
.prose ul, .prose ol { padding-left: 1.3em; }
.prose table td, .prose table th { border: 1px solid var(--line); padding: 4px 8px; }

.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-md); padding: 18px 20px; }
.panel + .panel { margin-top: 16px; }
.grid > .panel + .panel, .grid > * + .panel { margin-top: 0; }
.panel-head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; margin-bottom: 12px; flex-wrap: wrap; }
.panel-head h2, .panel-head h3 { margin: 0; }
@media (max-width: 600px) { .panel { padding: 14px 14px; } }

.grid { display: grid; gap: 16px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
@media (max-width: 1000px) { .grid-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 700px) { .grid-2, .grid-3 { grid-template-columns: minmax(0, 1fr); } }

/* Кнопки */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 38px; padding: 0 14px;
  border-radius: var(--r-sm); border: 1px solid var(--line-strong); background: var(--surface); color: var(--ink);
  font: 500 .93rem/1.2 var(--font); text-decoration: none; cursor: pointer; white-space: nowrap;
}
.btn:hover { border-color: var(--ink); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn-primary:hover { filter: brightness(1.08); border-color: var(--accent); }
.btn-danger { color: var(--bad); border-color: color-mix(in srgb, var(--bad) 45%, var(--line)); }
.btn-danger:hover { border-color: var(--bad); }
.btn-ghost { border-color: transparent; background: transparent; }
.btn-ghost:hover { background: var(--surface-2); border-color: transparent; }
.btn-sm { min-height: 30px; padding: 0 10px; font-size: .86rem; }
.btn-lg { min-height: 46px; padding: 0 22px; font-size: 1rem; }
.btn-block { width: 100%; }
.linklike { background: none; border: 0; padding: 0; font: inherit; color: var(--accent); cursor: pointer; }
.icon-btn { background: none; border: 0; color: var(--ink); width: 40px; height: 40px; display: grid; place-items: center; border-radius: var(--r-sm); cursor: pointer; }
.icon-btn:hover { background: var(--surface-2); }
form.inline { display: inline; }

/* Формы */
label { display: block; font-weight: 500; font-size: .9rem; margin-bottom: 4px; }
.hint { font-weight: 400; color: var(--muted); font-size: .84rem; margin-top: 3px; display: block; }
input[type=text], input[type=password], input[type=number], input[type=date], input:not([type]), select, textarea {
  width: 100%; padding: 8px 10px; border: 1px solid var(--line-strong); border-radius: var(--r-sm);
  background: var(--surface); color: var(--ink); font: inherit; min-height: 38px;
}
textarea { min-height: 84px; resize: vertical; line-height: 1.45; }
textarea.code { font-family: var(--font-code); font-size: .86rem; min-height: 220px; tab-size: 4; white-space: pre; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--focus); outline-offset: -1px; border-color: transparent; }
input[type=checkbox], input[type=radio] { accent-color: var(--accent); width: 17px; height: 17px; margin: 0; flex: none; }
.field { margin-bottom: 14px; }
.fields-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 16px; }
.fields-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0 16px; }
@media (max-width: 700px) { .fields-2, .fields-3 { grid-template-columns: minmax(0, 1fr); } }
.check { display: flex; align-items: flex-start; gap: 9px; font-weight: 400; cursor: pointer; padding: 3px 0; }
.check input { margin-top: 3px; }
.form-actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 6px; }

/* Флеш и подсказки */
.flash { padding: 10px 14px; border-radius: var(--r-sm); margin-bottom: 18px; border: 1px solid; overflow-wrap: anywhere; white-space: pre-line; }
.flash-ok { background: var(--good-soft); border-color: color-mix(in srgb, var(--good) 35%, transparent); color: var(--ink); }
.flash-error { background: var(--bad-soft); border-color: color-mix(in srgb, var(--bad) 40%, transparent); color: var(--ink); }
.note { border-left: 3px solid var(--accent); background: var(--accent-soft); padding: 10px 14px; border-radius: 0 var(--r-sm) var(--r-sm) 0; }
.note-warn { border-left-color: var(--mid); background: var(--mid-soft); }
.note-bad { border-left-color: var(--bad); background: var(--bad-soft); }
.empty { color: var(--muted); padding: 18px 0; }

/* Метки */
.tag { display: inline-block; padding: 1px 8px; border-radius: 999px; font-size: .78rem; font-weight: 500; background: var(--surface-2); color: var(--muted); border: 1px solid var(--line); white-space: nowrap; }
.tag-accent { background: var(--accent-soft); color: var(--accent); border-color: transparent; }
.tag-good { background: var(--good-soft); color: var(--good); border-color: transparent; }
.tag-mid { background: var(--mid-soft); color: var(--mid); border-color: transparent; }
.tag-bad { background: var(--bad-soft); color: var(--bad); border-color: transparent; }

/* Числа: главный акцент интерфейса */
.metrics { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 0; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-md); overflow: hidden; }
.metric { padding: 16px 18px 14px; border-right: 1px solid var(--line); min-width: 0; }
.metric:last-child { border-right: 0; }
.metric .label { color: var(--muted); font-size: .86rem; }
.metric .value { font: 600 2.6rem/1.05 var(--font-num); letter-spacing: -.02em; margin: 6px 0 2px; font-variant-numeric: tabular-nums; }
.metric .value small { font-size: .45em; font-weight: 500; color: var(--muted); margin-left: 2px; letter-spacing: 0; }
.metric .sub { color: var(--muted); font-size: .82rem; }
.metric canvas.spark { display: block; width: 100%; height: 34px; margin-top: 8px; }
@media (max-width: 900px) {
  .metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .metric:nth-child(2n) { border-right: 0; }
  .metric:nth-child(-n+2) { border-bottom: 1px solid var(--line); }
  .metric .value { font-size: 2.1rem; }
}
.big-num { font: 600 3.4rem/1 var(--font-num); letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.num { font-family: var(--font-num); font-variant-numeric: tabular-nums; }
.delta-up { color: var(--good); }
.delta-down { color: var(--bad); }

/* Таблицы */
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--r-md); background: var(--surface); }
.table th, .table td { padding: 9px 12px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: middle; }
.table th { font-weight: 500; color: var(--muted); font-size: .84rem; background: var(--surface-2); white-space: nowrap; }
.table tr:last-child td { border-bottom: 0; }
.table td.num, .table th.num { text-align: right; white-space: nowrap; }
.table .clip { max-width: 420px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
@media (max-width: 700px) { .table .clip { max-width: 180px; } .table th, .table td { padding: 8px 9px; } }

/* Владение (цвет) */
.m-high { --m: var(--good); --m-soft: var(--good-soft); }
.m-mid { --m: var(--mid); --m-soft: var(--mid-soft); }
.m-low { --m: var(--bad); --m-soft: var(--bad-soft); }
.m-none { --m: var(--line-strong); --m-soft: var(--surface-2); }
.mbar { display: inline-block; width: 64px; height: 6px; border-radius: 3px; background: var(--surface-2); border: 1px solid var(--line); vertical-align: middle; overflow: hidden; }
.mbar > i { display: block; height: 100%; background: var(--m); }
.mdot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; background: var(--m); flex: none; }

/* Дерево */
.tree, .tree ul { list-style: none; margin: 0; padding: 0; }
.tree ul { padding-left: 18px; border-left: 1px solid var(--line); margin-left: 6px; }
.tree-node > details > summary { list-style: none; cursor: pointer; display: flex; align-items: center; gap: 10px; padding: 7px 8px; border-radius: var(--r-sm); flex-wrap: wrap; }
.tree-node > details > summary::-webkit-details-marker { display: none; }
.tree-node > details > summary::before { content: ""; width: 0; height: 0; border-left: 5px solid var(--muted); border-top: 4px solid transparent; border-bottom: 4px solid transparent; transition: transform .15s; flex: none; }
.tree-node > details[open] > summary::before { transform: rotate(90deg); }
.tree-node > details > summary:hover { background: var(--surface-2); }
.tree-name { font-weight: 500; }
.idea-row { display: flex; align-items: center; gap: 10px; padding: 6px 8px; border-radius: var(--r-sm); flex-wrap: wrap; }
.idea-row:hover { background: var(--surface-2); }
.idea-row a { color: var(--ink); text-decoration: none; }
.idea-row a:hover { text-decoration: underline; }
.idea-row .counts { margin-left: auto; display: flex; gap: 6px; flex-wrap: wrap; }

/* Тренировка: карточка */
.trainer { max-width: 760px; margin: 0 auto; }
.progress { height: 4px; background: var(--line); border-radius: 2px; overflow: hidden; margin: 6px 0 18px; }
.progress > i { display: block; height: 100%; width: 0; background: var(--accent); transition: width .25s ease; }
.qcard { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-md); box-shadow: var(--shadow); overflow: hidden; }
.qcard-head { display: flex; gap: 8px; align-items: center; padding: 12px 20px; border-bottom: 1px solid var(--line); flex-wrap: wrap; background: var(--surface-2); }
.qcard-body { padding: 20px; }
.qcard-body .prompt { font-size: 1.04rem; overflow-wrap: anywhere; }
.qcard-body .prompt pre { font-size: .84rem; }
.qcard-foot { padding: 14px 20px; border-top: 1px solid var(--line); display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
@media (max-width: 600px) { .qcard-head, .qcard-body, .qcard-foot { padding-left: 14px; padding-right: 14px; } }
.options { display: flex; flex-direction: column; gap: 8px; margin-top: 14px; }
.option { display: flex; gap: 12px; align-items: flex-start; padding: 11px 14px; border: 1px solid var(--line-strong); border-radius: var(--r-sm); cursor: pointer; background: var(--surface); font-weight: 400; overflow-wrap: anywhere; }
.option:hover { border-color: var(--ink); }
.option input { margin-top: 3px; }
.option.picked { border-color: var(--accent); background: var(--accent-soft); }
.option.is-correct { border-color: var(--good); background: var(--good-soft); }
.option.is-wrong { border-color: var(--bad); background: var(--bad-soft); }
.option.locked { cursor: default; }
.option .key { font: 500 .8rem/1.6 var(--font-code); color: var(--muted); flex: none; min-width: 1.2em; }
.conf { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.conf-label { color: var(--muted); font-size: .88rem; margin-right: 4px; }
.seg { display: inline-flex; border: 1px solid var(--line-strong); border-radius: var(--r-sm); overflow: hidden; }
.seg button { background: var(--surface); border: 0; border-right: 1px solid var(--line-strong); padding: 0 14px; min-height: 36px; font: 500 .9rem var(--font); color: var(--ink); cursor: pointer; }
.seg button:last-child { border-right: 0; }
.seg button.on { background: var(--accent); color: var(--accent-ink); }
.timer { font: 500 .95rem var(--font-num); font-variant-numeric: tabular-nums; color: var(--muted); }
.timer.done { color: var(--good); }
.reveal { margin-top: 18px; padding-top: 16px; border-top: 1px dashed var(--line-strong); }
.verdict { font-weight: 600; font-size: 1.05rem; margin-bottom: 8px; }
.verdict.good { color: var(--good); }
.verdict.mid { color: var(--mid); }
.verdict.bad { color: var(--bad); }
.kbd-hint { color: var(--faint); font-size: .8rem; }
.kbd-hint kbd { border: 1px solid var(--line-strong); border-bottom-width: 2px; border-radius: 4px; padding: 0 4px; font-size: .75rem; }

/* Код */
.code-wrap { border: 1px solid var(--line-strong); border-radius: var(--r-sm); overflow: hidden; }
.code-wrap .CodeMirror { height: auto; min-height: 260px; font-family: var(--font-code); font-size: 13.5px; line-height: 1.5; background: var(--surface); color: var(--ink); }
.code-wrap .CodeMirror-scroll { min-height: 260px; max-height: 70vh; }
.code-wrap .CodeMirror-gutters { background: var(--surface-2); border-right: 1px solid var(--line); }
.code-wrap .CodeMirror-linenumber { color: var(--faint); }
.code-wrap .CodeMirror-cursor { border-left-color: var(--ink); }
.code-wrap .CodeMirror-selected { background: var(--accent-soft) !important; }
.code-wrap .cm-keyword { color: #7A3EB5; } .code-wrap .cm-def { color: #1F5FBF; } .code-wrap .cm-string { color: #2E7D32; }
.code-wrap .cm-comment { color: var(--faint); font-style: italic; } .code-wrap .cm-number { color: #B5520B; }
.code-wrap .cm-builtin { color: #0B7A86; } .code-wrap .cm-variable-2 { color: #1F5FBF; } .code-wrap .cm-operator { color: var(--muted); }
:root[data-theme="dark"] .code-wrap .cm-keyword { color: #C49BFF; } :root[data-theme="dark"] .code-wrap .cm-def { color: #7FB2FF; }
:root[data-theme="dark"] .code-wrap .cm-string { color: #8FD694; } :root[data-theme="dark"] .code-wrap .cm-number { color: #FFB074; }
:root[data-theme="dark"] .code-wrap .cm-builtin { color: #6FD3DF; } :root[data-theme="dark"] .code-wrap .cm-variable-2 { color: #7FB2FF; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .code-wrap .cm-keyword { color: #C49BFF; } :root:not([data-theme="light"]) .code-wrap .cm-def { color: #7FB2FF; }
  :root:not([data-theme="light"]) .code-wrap .cm-string { color: #8FD694; } :root:not([data-theme="light"]) .code-wrap .cm-number { color: #FFB074; }
  :root:not([data-theme="light"]) .code-wrap .cm-builtin { color: #6FD3DF; } :root:not([data-theme="light"]) .code-wrap .cm-variable-2 { color: #7FB2FF; }
}
.code-wrap .cm-gapline { background: var(--mid-soft); }
.output { margin-top: 12px; }
.output pre { max-height: 320px; overflow: auto; white-space: pre-wrap; overflow-wrap: anywhere; margin: 0; }
.output .fail pre { border-color: color-mix(in srgb, var(--bad) 45%, var(--line)); }
.output .ok pre { border-color: color-mix(in srgb, var(--good) 45%, var(--line)); }
.levels { display: flex; gap: 4px; align-items: center; }
.levels i { width: 22px; height: 6px; border-radius: 3px; background: var(--line); display: block; }
.levels i.on { background: var(--accent); }

/* Тест */
.steps { display: flex; flex-direction: column; gap: 0; border: 1px solid var(--line); border-radius: var(--r-md); background: var(--surface); }
.step { display: flex; gap: 16px; align-items: center; padding: 16px 18px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.step:last-child { border-bottom: 0; }
.step .n { font: 600 1.4rem/1 var(--font-num); color: var(--faint); width: 26px; flex: none; }
.step .body { flex: 1 1 260px; min-width: 0; }
.step .body h3 { margin: 0 0 2px; }
.step.done .n { color: var(--good); }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip { width: 28px; height: 28px; border-radius: 6px; display: grid; place-items: center; font: 500 .8rem var(--font-num); border: 1px solid var(--line-strong); color: var(--muted); background: var(--surface); text-decoration: none; }
.chip.ok { background: var(--good-soft); color: var(--good); border-color: transparent; }
.chip.part { background: var(--mid-soft); color: var(--mid); border-color: transparent; }
.chip.no { background: var(--bad-soft); color: var(--bad); border-color: transparent; }
.chip.pending { border-style: dashed; }

/* Прохождение задачи */
.run-timer { font: 600 2.2rem/1 var(--font-num); font-variant-numeric: tabular-nums; }
.run-timer.over { color: var(--bad); }
.files { display: flex; gap: 8px; flex-wrap: wrap; }

/* Графики */
.chart-box { position: relative; height: 260px; }
.chart-box.tall { height: 320px; }
.chart-box.short { height: 200px; }
.legend-note { font-size: .82rem; color: var(--muted); margin-top: 6px; }

/* Отчёт для канала */
.report { white-space: pre-wrap; font: .9rem/1.5 var(--font); background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--r-sm); padding: 12px 14px; overflow-wrap: anywhere; margin: 0 0 10px; }

/* Вход */
.login { min-height: 100vh; display: grid; place-items: center; padding: 20px; }
.login .panel { width: 100%; max-width: 360px; }
.login h1 { font-size: 1.3rem; }

/* Топики в дневнике */
.topic-row { display: grid; grid-template-columns: minmax(0, 1fr) 150px 36px; gap: 8px; margin-bottom: 8px; align-items: center; }
@media (max-width: 500px) {
  .topic-row { grid-template-columns: minmax(0, 1fr) 36px; padding-bottom: 8px; border-bottom: 1px dashed var(--line); }
  .topic-row input { grid-column: 1 / -1; }
}

details.more > summary { cursor: pointer; color: var(--accent); }
details.more[open] > summary { margin-bottom: 10px; }
.hr { border: 0; border-top: 1px solid var(--line); margin: 20px 0; }

/* Выпадающий фильтр */
.dropdown { position: relative; }
.dropdown-body { position: absolute; right: 0; top: calc(100% + 6px); z-index: 10; width: min(320px, calc(100vw - 32px));
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-md); padding: 14px; box-shadow: var(--shadow); }
details.more.dropdown[open] > summary { margin-bottom: 0; }

@media (max-width: 560px) { .hide-sm { display: none; } }
.show-sm { display: none !important; }
@media (max-width: 560px) { .show-sm { display: inline-block !important; } }
.quiet-link { color: var(--faint); text-decoration: none; }
.quiet-link:hover, .quiet-link:focus-visible { color: var(--accent); text-decoration: underline; }
@media (max-width: 900px) { .dropdown-body { left: 0; right: auto; } }
code, pre, .CodeMirror, textarea.code { font-variant-ligatures: none; font-feature-settings: "liga" 0, "calt" 0; }
.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; }
.seg label + label .pool-btn { border-left: 1px solid var(--line-strong); }
.seg .pool-btn { border: 0; border-radius: 0; min-height: 34px; }
.seg input:focus-visible + .pool-btn { outline: 2px solid var(--focus); outline-offset: -2px; }
.wrap-any { overflow-wrap: anywhere; min-width: 140px; }
input[type=file] { font: inherit; font-size: .9rem; color: var(--muted); max-width: 100%; }
input[type=file]::file-selector-button { font: 500 .88rem var(--font); margin-right: 10px; padding: 7px 12px; border-radius: var(--r-sm);
  border: 1px solid var(--line-strong); background: var(--surface); color: var(--ink); cursor: pointer; }
input[type=file]::file-selector-button:hover { border-color: var(--ink); }
@media (max-width: 600px) { .step > .btn, .step > form { margin-left: 42px; } }

/* ---------- Спринт ---------- */
.sp-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px 24px; flex-wrap: wrap; margin-bottom: 14px; }
.sp-title { min-width: 0; flex: 1 1 320px; }
.sp-title h2 { margin: 8px 0 0; font-size: 1.3rem; }
.sp-clock { text-align: right; min-width: 150px; }
.sp-time { font: 600 2.6rem/1 var(--font-num); font-variant-numeric: tabular-nums; letter-spacing: -.02em; }
.sp-time.over { color: var(--bad); }
.sp-goal { color: var(--muted); font-size: .84rem; margin-top: 4px; }
.sp-bar { height: 4px; background: var(--line); border-radius: 2px; overflow: hidden; margin-top: 8px; }
.sp-bar > i { display: block; height: 100%; width: 0; background: var(--accent); }
.sp-bar > i.over { background: var(--bad); }
.sp-grid { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 8fr); gap: 18px; align-items: start; }
.sp-spec { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-md); padding: 16px 18px; position: sticky; top: 16px; max-height: calc(100vh - 32px); overflow: auto; }
.sp-spec .prose { overflow-wrap: anywhere; }
.sp-work { min-width: 0; }
.sp-work .code-wrap .CodeMirror, .sp-work .code-wrap .CodeMirror-scroll { min-height: 340px; }
.sp-tools { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-top: 10px; }
.sp-out { margin-top: 12px; }
.sp-out pre { white-space: pre-wrap; overflow-wrap: anywhere; max-height: 260px; overflow: auto; margin: 6px 0 0; }
.sp-msg { border-color: color-mix(in srgb, var(--bad) 45%, var(--line)) !important; font-family: var(--font); font-size: .95rem; }
.sp-busy .code-wrap { opacity: .7; }
.sp-hints:empty { display: none; }
.sp-hints { margin-top: 14px; display: flex; flex-direction: column; gap: 8px; }
.sp-hint-card { border-left: 3px solid var(--mid); background: var(--mid-soft); border-radius: 0 var(--r-sm) var(--r-sm) 0; padding: 8px 12px; }
.sp-hint-card pre { margin: 6px 0 0; white-space: pre-wrap; overflow-wrap: anywhere; background: var(--surface); }
#sp-hint.sp-hint-on { background: var(--mid-soft); color: var(--ink); border-color: var(--mid); box-shadow: 0 0 0 3px color-mix(in srgb, var(--mid) 25%, transparent); }
.sp-mobile-note { display: none; margin-bottom: 12px; }
.sp-sessionbar { margin-bottom: 12px; }
.sp-result .verdict { font-size: 1.25rem; }
.sp-facts { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px 18px; margin: 12px 0; }
.sp-facts dt { color: var(--muted); font-size: .82rem; }
.sp-facts dd { margin: 2px 0 0; font: 600 1.15rem var(--font-num); font-variant-numeric: tabular-nums; }
.sp-heat { border: 1px solid var(--line); border-radius: var(--r-sm); overflow: hidden; background: var(--surface); }
.sp-hl { display: grid; grid-template-columns: 38px minmax(0, 1fr) 54px 104px; align-items: center; gap: 8px; padding: 1px 8px; min-height: 28px; border-bottom: 1px solid var(--line); }
.sp-hl:last-child { border-bottom: 0; }
.sp-ln { color: var(--muted); font: .8rem var(--font-code); text-align: right; }
.sp-lc { font: .85rem/1.5 var(--font-code); white-space: pre; overflow-x: auto; background: none !important; border: 0 !important; padding: 0 !important; }
.sp-ls { text-align: right; font: 600 .85rem var(--font-num); }
.sp-pick { margin-top: 12px; }
.sp-pick-list { max-height: 280px; overflow: auto; border: 1px solid var(--line); border-radius: var(--r-sm); padding: 6px 10px; }
.sp-pick-list code { white-space: pre; background: none; border: 0; padding: 0; }
.sp-pick-list .check { align-items: center; }
@media (max-width: 1000px) {
  .sp-grid { grid-template-columns: minmax(0, 1fr); }
  .sp-spec { position: static; max-height: none; }
}
@media (max-width: 760px) {
  .sp-mobile-note { display: block; }
  .sp-clock { text-align: left; }
  .sp-time { font-size: 2rem; }
  .sp-hl { grid-template-columns: 28px minmax(0, 1fr) 44px; }
  .sp-hl > :last-child { grid-column: 2 / -1; justify-self: start; margin-bottom: 4px; }
  .sp-hl > span:last-child:empty { display: none; }
}
.CodeMirror-hints { font-family: var(--font-code); font-size: 13px; z-index: 40; }
@media (max-width: 760px) { .sp-result pre { white-space: pre-wrap; overflow-wrap: anywhere; } }
