:root {
  --bg: #edf5ef;
  --surface: #fbfefc;
  --surface-2: #e3efe7;
  --sidebar: #f3f9f5;
  --text: #14281c;
  --muted: #52695b;
  --border: #cde0d3;
  --accent: #217346;
  --accent-strong: #185c37;
  --accent-soft: #d5ebdc;
  --on-accent: #fff;
  --ok: #1e7d43;
  --ok-soft: #dcf0e2;
  --bad: #b3261e;
  --bad-soft: #fbe9e7;
  --warn: #8a5a00;
  --grid-line: #d9e7dd;
  --grid-head: #e8f2eb;
  --grid-head-hl: #c3e1cd;
  --sel-fill: rgba(33, 115, 70, 0.12);
  --cf-hit: #ffe2a8;
  --target: #eef6ff;
  --unlocked: #fff7cc;
  --code-bg: #e2efe6;
  --shadow: 0 1px 2px rgba(20, 60, 35, 0.06), 0 4px 16px rgba(20, 60, 35, 0.05);
  /* Шапка: в светлой теме — сплошной зелёный, как заголовок окна Excel */
  --tb-bg: #1b6b40;
  --tb-surface: transparent;
  --tb-text: #fff;
  --tb-muted: rgba(255, 255, 255, 0.82);
  --tb-border: rgba(255, 255, 255, 0.28);
  --tb-track: rgba(255, 255, 255, 0.22);
  --tb-accent: #fff;
  --tb-on-accent: #1b6b40;
  --radius: 12px;
  --mono: ui-monospace, 'SF Mono', Menlo, Consolas, monospace;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #131714;
    --surface: #1b201c;
    --surface-2: #232923;
    --text: #e6ebe7;
    --muted: #9aa69e;
    --border: #2f3731;
    --accent: #3fae6e;
    --accent-strong: #5cc488;
    --accent-soft: #1f3a2a;
    --ok: #5cc488;
    --ok-soft: #1c3526;
    --bad: #f28b82;
    --bad-soft: #3b2120;
    --warn: #f0c060;
    --grid-line: #2c332d;
    --grid-head: #222823;
    --grid-head-hl: #2b4a37;
    --sel-fill: rgba(63, 174, 110, 0.16);
    --cf-hit: #5a4416;
    --target: #1d2a3a;
    --unlocked: #3b3613;
    --code-bg: #262d27;
    --sidebar: #1b201c;
    --tb-bg: #1b201c;
    --tb-surface: #1b201c;
    --tb-text: #e6ebe7;
    --tb-muted: #9aa69e;
    --tb-border: #2f3731;
    --tb-track: #232923;
    --tb-accent: #3fae6e;
    --tb-on-accent: #fff;
    --shadow: none;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #131714;
  --surface: #1b201c;
  --surface-2: #232923;
  --text: #e6ebe7;
  --muted: #9aa69e;
  --border: #2f3731;
  --accent: #3fae6e;
  --accent-strong: #5cc488;
  --accent-soft: #1f3a2a;
  --ok: #5cc488;
  --ok-soft: #1c3526;
  --bad: #f28b82;
  --bad-soft: #3b2120;
  --warn: #f0c060;
  --grid-line: #2c332d;
  --grid-head: #222823;
  --grid-head-hl: #2b4a37;
  --sel-fill: rgba(63, 174, 110, 0.16);
  --cf-hit: #5a4416;
  --target: #1d2a3a;
  --unlocked: #3b3613;
  --code-bg: #262d27;
  --sidebar: #1b201c;
  --tb-bg: #1b201c;
  --tb-surface: #1b201c;
  --tb-text: #e6ebe7;
  --tb-muted: #9aa69e;
  --tb-border: #2f3731;
  --tb-track: #232923;
  --tb-accent: #3fae6e;
  --tb-on-accent: #fff;
  --shadow: none;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font: 15px/1.6 system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--accent); }
body::before { content: ""; position: fixed; inset: 0 0 auto; height: env(safe-area-inset-top, 0px); z-index: 31; background: var(--tb-bg); }
code, pre, .mono { font-family: var(--mono); font-size: 0.92em; }
code { background: var(--code-bg); padding: 1px 5px; border-radius: 4px; }
pre { background: var(--code-bg); padding: 12px 14px; border-radius: 8px; overflow-x: auto; margin: 10px 0; }
kbd {
  font-family: var(--mono); font-size: 0.85em;
  border: 1px solid var(--border); border-bottom-width: 2px; border-radius: 4px;
  padding: 0 5px; background: var(--surface);
}

/* ---------- Каркас ---------- */
.topbar {
  position: sticky; top: env(safe-area-inset-top, 0px); z-index: 30;
  display: flex; align-items: center; gap: 16px;
  height: 56px; padding-block: 0;
  padding-left: max(20px, env(safe-area-inset-left, 0px)); padding-right: max(20px, env(safe-area-inset-right, 0px));
  background: var(--tb-bg); border-bottom: 1px solid var(--tb-border);
  --surface: var(--tb-surface); --surface-2: var(--tb-track); --text: var(--tb-text); --muted: var(--tb-muted);
  --border: var(--tb-border); --accent: var(--tb-accent); --on-accent: var(--tb-on-accent);
}
.logo { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 17px; color: var(--text); text-decoration: none; }
.logo-mark {
  display: grid; place-items: center; width: 30px; height: 30px; border-radius: 7px;
  background: var(--accent); color: var(--on-accent); font-weight: 800;
}
.progress { margin-left: auto; display: flex; align-items: center; gap: 10px; font-size: 13px; color: var(--muted); }
.visits { display: flex; align-items: center; gap: 5px; font-size: 13px; color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; }
.visits[hidden] { display: none; }
.visits svg { opacity: 0.8; }
.progress-bar { width: 160px; height: 6px; border-radius: 3px; background: var(--surface-2); overflow: hidden; }
#progress-fill { height: 100%; width: 0; background: var(--accent); transition: width 0.4s; }
.lang-switch { display: flex; border: 1px solid var(--border); border-radius: 8px; overflow: hidden; flex: none; }
.lang-switch button {
  border: 0; background: var(--surface); color: var(--muted); font: inherit; font-size: 12px; font-weight: 700;
  padding: 5px 9px; cursor: pointer; letter-spacing: 0.03em;
}
.lang-switch button + button { border-left: 1px solid var(--border); }
.lang-switch button:hover { color: var(--text); }
.lang-switch button[aria-pressed="true"] { background: var(--accent); color: var(--on-accent); }
.theme-btn {
  display: grid; place-items: center; width: 32px; height: 30px; flex: none; padding: 0; cursor: pointer;
  background: var(--surface); color: var(--muted); border: 1px solid var(--border); border-radius: 8px;
}
.theme-btn:hover { color: var(--text); }
.theme-btn svg { width: 16px; height: 16px; }
.ref-scroll { overflow-x: auto; }
.menu-btn { display: none; background: none; border: 0; font-size: 22px; color: var(--text); cursor: pointer; padding: 4px 8px; }

.layout { display: grid; grid-template-columns: 290px minmax(0, 1fr); min-height: calc(100vh - 56px); }
.sidebar {
  position: sticky; top: 56px; height: calc(100vh - 56px); overflow-y: auto;
  border-right: 1px solid var(--border); background: var(--sidebar); padding: 16px 10px 40px;
}
#main {
  padding-block: 32px 80px; max-width: 1080px; width: 100%; min-width: 0;
  padding-left: max(clamp(16px, 4vw, 48px), env(safe-area-inset-left, 0px)); padding-right: max(clamp(16px, 4vw, 48px), env(safe-area-inset-right, 0px));
}

/* ---------- Навигация ---------- */
#nav a { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--text); border-radius: 8px; padding: 6px 10px; font-size: 14px; }
#nav a:hover { background: var(--surface-2); }
#nav a.active { background: var(--accent-soft); color: var(--accent-strong); font-weight: 600; }
.nav-home { font-weight: 600; margin-bottom: 6px; }
.nav-module { margin: 10px 0 4px; }
.nav-mtitle { display: flex; align-items: center; gap: 8px; font-size: 12px; text-transform: uppercase; letter-spacing: 0.04em; color: var(--muted); padding: 6px 10px; font-weight: 600; }
.mnum {
  display: inline-grid; place-items: center; min-width: 20px; height: 20px; border-radius: 6px;
  background: var(--surface-2); color: var(--muted); font-size: 11px; font-weight: 700;
}
.nav-lesson { line-height: 1.35; }
.nav-extra { border-top: 1px solid var(--border); margin-top: 14px; padding-top: 10px; }
.dot {
  flex: none; display: inline-grid; place-items: center; width: 18px; height: 18px; border-radius: 50%;
  border: 1.5px solid var(--border); font-size: 11px; color: #fff; font-weight: 700;
}
.dot.part { border-color: var(--accent); background: linear-gradient(90deg, var(--accent) 50%, transparent 50%); }
.dot.done { border-color: var(--ok); background: var(--ok); }

/* ---------- Главная ---------- */
.hero {
  display: grid; grid-template-columns: 1fr auto; gap: 32px; align-items: center;
  background: var(--surface); border: 1px solid var(--border); border-radius: 16px; padding: 32px; box-shadow: var(--shadow);
}
.eyebrow { margin: 0 0 6px; color: var(--accent); font-weight: 600; font-size: 13px; }
.hero h1 { margin: 0 0 10px; font-size: 38px; line-height: 1.1; }
.lead { color: var(--muted); max-width: 640px; margin: 0 0 20px; }
.hero-stat { text-align: center; color: var(--muted); font-size: 13px; }
.hero-stat .big { font-size: 46px; font-weight: 800; color: var(--accent); line-height: 1; margin-bottom: 4px; font-variant-numeric: tabular-nums; }
.modules { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 16px; margin-top: 24px; }
.mcard { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px 18px 10px; box-shadow: var(--shadow); }
.mcard-head { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.mcard-head h2 { font-size: 16px; margin: 0; flex: 1; }
.mcount { font-size: 13px; color: var(--muted); font-variant-numeric: tabular-nums; }
.mcard ul { list-style: none; margin: 0; padding: 0; }
.mcard li { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 6px 0; border-top: 1px solid var(--border); font-size: 14px; }
.mcard li a { display: flex; align-items: center; gap: 10px; color: var(--text); text-decoration: none; }
.mcard li a:hover { color: var(--accent); }
.pages { color: var(--muted); font-size: 12px; white-space: nowrap; }

/* ---------- Кнопки ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--border); background: var(--surface);
  color: var(--text); border-radius: 8px; padding: 9px 16px; font: inherit; font-weight: 600; font-size: 14px;
  text-decoration: none; cursor: pointer;
}
.btn:hover { border-color: var(--accent); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover { background: var(--accent-strong); }
.btn.small { padding: 5px 12px; font-size: 13px; }
.btn.danger { border-color: var(--bad); color: var(--bad); }
.link { background: none; border: 0; color: var(--accent); cursor: pointer; padding: 0; font: inherit; font-size: 13px; }
.link:hover { text-decoration: underline; }
button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ---------- Урок ---------- */
.crumbs { color: var(--muted); font-size: 13px; }
.ltitle { margin: 4px 0 10px; font-size: 30px; line-height: 1.2; }
.lmeta { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 20px; }
.badge { display: inline-block; font-size: 12px; font-weight: 600; padding: 3px 10px; border-radius: 999px; background: var(--surface-2); color: var(--muted); }
.badge.ok { background: var(--ok-soft); color: var(--ok); }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 22px 26px; margin-bottom: 20px; box-shadow: var(--shadow); }
.card h2 { font-size: 19px; margin: 0 0 12px; }
.theory h3 { font-size: 16px; margin: 20px 0 6px; }
.theory p, .theory ul, .theory ol { margin: 8px 0; }
.theory li { margin: 3px 0; }
.note { background: var(--accent-soft); border-left: 3px solid var(--accent); padding: 10px 14px; border-radius: 0 8px 8px 0; }
.kbd-table { border-collapse: collapse; margin: 8px 0; }
.kbd-table td { padding: 5px 16px 5px 0; vertical-align: top; border-bottom: 1px solid var(--border); }
.kbd-table td:first-child { white-space: nowrap; }
.muted { color: var(--muted); font-size: 13px; }

.phead { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 8px; }
.phead h2 { margin: 0; }
.tasks { list-style: none; padding: 0; margin: 0 0 16px; counter-reset: t; }
.task { display: flex; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--border); counter-increment: t; }
.task:last-child { border-bottom: 0; }
.tmark {
  flex: none; width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center;
  border: 1.5px solid var(--border); font-size: 12px; font-weight: 700; color: var(--muted); margin-top: 1px;
}
.tmark::before { content: counter(t); }
.task.done .tmark { background: var(--ok); border-color: var(--ok); color: #fff; }
.task.done .tmark::before { content: '✓'; }
.task.was .tmark { border-color: var(--ok); color: var(--ok); }
.tbody { flex: 1; min-width: 0; }
.ttext { line-height: 1.5; }
.tmsg { color: var(--bad); font-size: 13px; }
.tmsg:empty { display: none; }
.tbtns { margin-top: 2px; }
.thint { font-family: var(--mono); font-size: 13px; background: var(--code-bg); padding: 6px 10px; border-radius: 6px; margin-top: 6px; }
.hint-keys { color: var(--muted); font-size: 12.5px; margin: 10px 0 0; line-height: 1.9; }

/* Инструменты: условное форматирование, подбор параметра */
.tool { border: 1px solid var(--border); border-radius: 10px; padding: 14px 16px; margin-bottom: 16px; background: var(--surface-2); }
.tool-title { font-weight: 600; font-size: 14px; margin-bottom: 10px; }
.tool-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 8px; }
.tool-row label, .tool-grid label { font-size: 13px; color: var(--muted); min-width: 110px; }
.tool input, .answer input {
  font: inherit; font-family: var(--mono); font-size: 14px; padding: 6px 10px; border: 1px solid var(--border);
  border-radius: 6px; background: var(--surface); color: var(--text); min-width: 0;
}
#cf-f { flex: 1; min-width: 200px; }
.tool-grid { display: grid; grid-template-columns: auto minmax(0, 200px); gap: 8px 12px; align-items: center; margin-bottom: 10px; }
.tool .tasks { margin: 8px 0 0; }
.answer { display: flex; align-items: center; gap: 8px; margin-top: 8px; flex-wrap: wrap; }
.answer input { width: 140px; }

/* ---------- Сетка ячеек ---------- */
.sheet { border: 1px solid var(--border); border-radius: 8px; overflow: hidden; background: var(--surface); }
.fbar { display: flex; align-items: stretch; border-bottom: 1px solid var(--border); background: var(--surface); }
.namebox {
  width: 84px; border: 0; border-right: 1px solid var(--border); padding: 6px 8px; font: 13px var(--mono);
  background: var(--surface); color: var(--text); text-align: center;
}
.fx { padding: 6px 10px; color: var(--muted); font-style: italic; font-family: Georgia, serif; border-right: 1px solid var(--border); }
.formula { flex: 1; border: 0; padding: 6px 10px; font: 13.5px var(--mono); background: var(--surface); color: var(--text); min-width: 0; }
.namebox:focus, .formula:focus { outline: none; box-shadow: inset 0 0 0 2px var(--accent); }
.grid-scroll { position: relative; overflow: auto; max-height: 460px; outline: none; }
.grid { border-collapse: separate; border-spacing: 0; font-size: 13.5px; user-select: none; }
.grid th, .grid td { border-right: 1px solid var(--grid-line); border-bottom: 1px solid var(--grid-line); height: 26px; padding: 0 6px; }
.grid th { background: var(--grid-head); color: var(--muted); font-weight: 500; font-size: 12px; position: sticky; z-index: 2; }
.grid th.colh { top: 0; min-width: 96px; }
.grid th.rowh { left: 0; width: 40px; min-width: 40px; text-align: center; }
.grid th.corner { top: 0; left: 0; z-index: 3; }
.grid th.hl { background: var(--grid-head-hl); color: var(--accent-strong); font-weight: 700; }
.grid td { white-space: nowrap; max-width: 220px; overflow: hidden; text-overflow: ellipsis; cursor: cell; background: var(--surface); }
.grid td.num { text-align: right; font-variant-numeric: tabular-nums; }
.grid td.bool { text-align: center; }
.grid td.err { color: var(--bad); text-align: center; }
.grid td.hdr { font-weight: 600; }
.grid td.target { background: var(--target); }
.grid td.unlocked { background: var(--unlocked); }
.grid td.cf-hit { background: var(--cf-hit); }
.grid td.insel { background-image: linear-gradient(var(--sel-fill), var(--sel-fill)); }
.selbox { position: absolute; border: 2px solid var(--accent); pointer-events: none; z-index: 4; margin: -1px 0 0 -1px; }
.fill-handle {
  position: absolute; right: -5px; bottom: -5px; width: 8px; height: 8px; background: var(--accent);
  border: 1px solid var(--surface); pointer-events: auto; cursor: crosshair;
}
.antbox { position: absolute; border: 2px dashed var(--accent); pointer-events: none; z-index: 4; margin: -1px 0 0 -1px; }
.fillbox { position: absolute; border: 1px dashed var(--muted); pointer-events: none; z-index: 4; }
.cell-editor {
  position: absolute; z-index: 6; border: 2px solid var(--accent); padding: 0 5px; margin: -1px 0 0 -1px;
  font: 13.5px var(--mono); background: var(--surface); color: var(--text); outline: none; box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}
.drop-btn {
  position: absolute; z-index: 5; width: 20px; border: 1px solid var(--border); background: var(--surface);
  color: var(--text); cursor: pointer; font-size: 11px; padding: 0;
}
.drop-list {
  position: absolute; z-index: 7; background: var(--surface); border: 1px solid var(--border); border-radius: 4px;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.15); font-size: 13.5px; padding: 2px 0;
}
.drop-list div { padding: 4px 12px; cursor: pointer; }
.drop-list div:hover { background: var(--accent-soft); }

/* ---------- Сводная таблица ---------- */
.pivot-wrap { display: grid; grid-template-columns: 260px minmax(0, 1fr); gap: 20px; align-items: start; }
.pivot-fields { display: flex; flex-direction: column; gap: 12px; background: var(--surface-2); border: 1px solid var(--border); border-radius: 10px; padding: 14px; }
.pf { display: flex; flex-direction: column; gap: 4px; }
.pf label { font-size: 12px; text-transform: uppercase; letter-spacing: 0.04em; color: var(--muted); font-weight: 600; }
.pf select { font: inherit; font-size: 14px; padding: 5px 8px; border: 1px solid var(--border); border-radius: 6px; background: var(--surface); color: var(--text); }
.pf-check { display: flex; align-items: center; gap: 8px; font-size: 14px; }
.pivot-out { overflow-x: auto; }
.empty { color: var(--muted); padding: 30px; border: 1px dashed var(--border); border-radius: 10px; text-align: center; }
.ptable { border-collapse: collapse; font-size: 13.5px; width: 100%; }
.ptable th, .ptable td { padding: 6px 10px; border-bottom: 1px solid var(--border); text-align: left; }
.ptable th { background: var(--accent-soft); color: var(--accent-strong); font-weight: 600; }
.ptable .num { text-align: right; font-variant-numeric: tabular-nums; }
.ptable .strong, .ptable tr.total td { font-weight: 700; }
.ptable tr.total td { border-top: 2px solid var(--accent); }
.ptable caption { text-align: left; padding-bottom: 8px; font-size: 13px; color: var(--muted); }
.source summary { cursor: pointer; font-size: 13px; color: var(--accent); }
.source-table { max-height: 260px; overflow: auto; margin-top: 8px; font-size: 12px; }
.source-table .ptable { font-size: 12px; }
.source-table .ptable th, .source-table .ptable td { padding: 3px 6px; }

/* ---------- Тест ---------- */
.q { border: 0; padding: 0; margin: 0 0 20px; }
.q legend { font-weight: 600; margin-bottom: 8px; padding: 0; }
.opts { display: flex; flex-direction: column; gap: 6px; }
.opt {
  text-align: left; font: inherit; font-size: 14px; padding: 9px 14px; border: 1px solid var(--border);
  border-radius: 8px; background: var(--surface); color: var(--text); cursor: pointer;
}
.opt:hover { border-color: var(--accent); }
.opt.right { border-color: var(--ok); background: var(--ok-soft); }
.opt.wrong { border-color: var(--bad); background: var(--bad-soft); }
.explain { margin-top: 8px; font-size: 14px; padding: 8px 12px; border-radius: 8px; }
.explain.ok { background: var(--ok-soft); }
.explain.bad { background: var(--bad-soft); }

.pager { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-top: 28px; }
.reftable td:first-child, .reftable td:nth-child(2) { white-space: nowrap; }
.reftable td { vertical-align: top; }
.reftable td:last-child { min-width: 340px; line-height: 1.5; }
.ref-syn { margin-top: 6px; font-size: 13px; }
.ref-syn span { color: var(--muted); }
.ref-syn code { white-space: normal; }

/* ---------- Уведомления ---------- */
.toast {
  position: fixed; left: 50%; bottom: calc(24px + env(safe-area-inset-bottom, 0px)); transform: translate(-50%, 20px); opacity: 0; pointer-events: none;
  background: var(--text); color: var(--bg); padding: 10px 18px; border-radius: 10px; font-size: 14px; font-weight: 500;
  transition: opacity 0.2s, transform 0.2s; z-index: 50; max-width: calc(100vw - 32px);
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.ok { background: var(--ok); color: #fff; }
.toast.warn { background: var(--bad); color: #fff; }

/* ---------- Адаптивность ---------- */
@media (max-width: 900px) {
  .layout { grid-template-columns: minmax(0, 1fr); }
  .menu-btn { display: block; }
  .sidebar {
    position: fixed; top: calc(56px + env(safe-area-inset-top, 0px)); left: 0; padding-left: max(10px, env(safe-area-inset-left, 0px)); width: 300px; max-width: 85vw; z-index: 25;
    transform: translateX(-100%); transition: transform 0.2s; box-shadow: 4px 0 20px rgba(0, 0, 0, 0.15);
  }
  body.nav-open .sidebar { transform: none; }
  .hero { grid-template-columns: 1fr; padding: 22px; }
  .hero h1 { font-size: 30px; }
  .pivot-wrap { grid-template-columns: 1fr; }
  .progress-bar { width: 80px; }
  #main { padding-block: 20px 60px; }
  .card { padding: 18px 16px; }
}
@media (max-width: 520px) {
  #progress-text { display: none; }
  .progress-bar { width: 56px; }
  .topbar { gap: 10px; padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); }
  .logo { font-size: 15px; }
  .tool-grid { grid-template-columns: 1fr; }
}
/* Справочник на узком экране: строка таблицы — карточка (названия сверху, описание ниже) */
@media (max-width: 700px) {
  .reftable, .reftable tbody, .reftable tr { display: block; }
  .reftable tr:first-child { display: none; }
  .reftable tr { padding: 12px 0; border-bottom: 1px solid var(--border); }
  .reftable td { display: inline; border: 0; padding: 0 6px 0 0; }
  .reftable td:last-child { display: block; min-width: 0; padding: 8px 0 0; }
  .reftable td:first-child, .reftable td:nth-child(2) { white-space: normal; }
}
/* Кнопка темы: в светлой теме — луна (перейти в тёмную), в тёмной — солнце */
.theme-btn .i-sun { display: none; }
:root[data-theme="dark"] .theme-btn .i-sun { display: block; }
:root[data-theme="dark"] .theme-btn .i-moon { display: none; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .theme-btn .i-sun { display: block; }
  :root:not([data-theme="light"]) .theme-btn .i-moon { display: none; }
}
