/* ========== Логика — тренажёр по Челпанову ========== */
:root {
  --bg: #f5f1e8;
  --surface: #fffdf8;
  --surface-2: #faf6ec;
  --ink: #20232a;
  --muted: #666b75;
  --line: #e3dccd;
  --accent: #7a1f2b;
  --accent-ink: #ffffff;
  --accent-soft: #f4e4e4;
  --gold: #b88a2a;
  --gold-soft: #f6ecd2;
  --good: #25704a;
  --good-soft: #e0f0e6;
  --bad: #b0342c;
  --bad-soft: #f8e1de;
  --warn: #9a6410;
  --warn-soft: #f7ebd2;
  --info: #25588f;
  --info-soft: #e2ecf7;
  --shadow: 0 1px 2px rgba(40, 30, 10, .06), 0 6px 20px rgba(40, 30, 10, .05);
  --serif: Cambria, "Times New Roman", Georgia, serif;
  --sans: "Segoe UI", system-ui, -apple-system, Roboto, Arial, sans-serif;
  --radius: 14px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #14161b;
    --surface: #1c1f26;
    --surface-2: #22262e;
    --ink: #e9e6df;
    --muted: #9ea2ac;
    --line: #2d313b;
    --accent: #e48a90;
    --accent-ink: #1a1013;
    --accent-soft: #3a2326;
    --gold: #d9ad4a;
    --gold-soft: #3a3120;
    --good: #6fcf97;
    --good-soft: #1d3327;
    --bad: #f08a80;
    --bad-soft: #3b2220;
    --warn: #e5b765;
    --warn-soft: #3a3020;
    --info: #85b6ee;
    --info-soft: #1f2e42;
    --shadow: 0 1px 2px rgba(0,0,0,.4), 0 6px 20px rgba(0,0,0,.25);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #14161b;
  --surface: #1c1f26;
  --surface-2: #22262e;
  --ink: #e9e6df;
  --muted: #9ea2ac;
  --line: #2d313b;
  --accent: #e48a90;
  --accent-ink: #1a1013;
  --accent-soft: #3a2326;
  --gold: #d9ad4a;
  --gold-soft: #3a3120;
  --good: #6fcf97;
  --good-soft: #1d3327;
  --bad: #f08a80;
  --bad-soft: #3b2220;
  --warn: #e5b765;
  --warn-soft: #3a3020;
  --info: #85b6ee;
  --info-soft: #1f2e42;
  --shadow: 0 1px 2px rgba(0,0,0,.4), 0 6px 20px rgba(0,0,0,.25);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 17px/1.65 var(--sans);
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3, h4 { font-family: var(--serif); line-height: 1.22; margin: 0 0 .5em; letter-spacing: -.005em; }
h1 { font-size: clamp(1.9rem, 4.2vw, 2.6rem); font-weight: 700; }
h2 { font-size: 1.55rem; font-weight: 700; margin-top: 1.6em; }
h3 { font-size: 1.2rem; font-weight: 700; margin-top: 1.3em; }
p { margin: 0 0 1em; }
a { color: var(--accent); text-underline-offset: 3px; }
a:hover { text-decoration-thickness: 2px; }
button { font: inherit; color: inherit; cursor: pointer; }
:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; border-radius: 6px; }
.skip { position: absolute; left: -999px; top: 0; background: var(--accent); color: var(--accent-ink); padding: 8px 14px; z-index: 100; }
.skip:focus { left: 8px; top: 8px; }
.muted { color: var(--muted); }
.small { font-size: .88rem; }
.center { text-align: center; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
em.lat, i.lat { font-family: var(--serif); }
code, .mono { font-family: Consolas, "Courier New", monospace; font-size: .92em; }
mark { background: var(--gold-soft); color: inherit; padding: 0 .2em; border-radius: 4px; }

/* ----- шапка ----- */
.topbar {
  position: sticky; top: env(safe-area-inset-top, 0px); z-index: 30;
  background: color-mix(in srgb, var(--surface) 92%, transparent);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.topbar-in {
  max-width: 1120px; margin: 0 auto; padding: 10px 20px;
  display: flex; align-items: center; gap: 18px;
}
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--ink); font-family: var(--serif); font-weight: 700; font-size: 1.25rem; white-space: nowrap; }
.brand small { display: block; font: 500 .7rem/1 var(--sans); color: var(--muted); letter-spacing: .08em; text-transform: uppercase; margin-top: 3px; }
.brand svg { flex: none; }
.nav { display: flex; gap: 2px; margin-left: auto; overflow-x: auto; scrollbar-width: none; }
.nav::-webkit-scrollbar { display: none; }
.nav a {
  padding: 8px 13px; border-radius: 999px; text-decoration: none; color: var(--muted);
  font-weight: 600; font-size: .95rem; white-space: nowrap;
}
.nav a:hover { color: var(--ink); background: var(--surface-2); }
.nav a[aria-current="page"] { background: var(--accent-soft); color: var(--accent); }
.top-tools { display: flex; align-items: center; gap: 6px; }
.pill {
  display: inline-flex; align-items: center; gap: 6px; padding: 5px 11px; border-radius: 999px;
  background: var(--surface-2); border: 1px solid var(--line); font-weight: 700; font-size: .88rem; text-decoration: none; color: var(--ink); white-space: nowrap;
}
.pill svg { width: 16px; height: 16px; }
.icon-btn { background: none; border: 1px solid transparent; border-radius: 10px; padding: 6px; display: inline-grid; place-items: center; color: var(--muted); }
.icon-btn:hover { background: var(--surface-2); color: var(--ink); }
@media (max-width: 1040px) {
  .topbar-in { flex-wrap: wrap; row-gap: 6px; padding: 8px 14px; }
  .nav { order: 3; width: 100%; margin-left: 0; }
  .top-tools { margin-left: auto; }
}

/* ----- каркас ----- */
main { max-width: 1120px; margin: 0 auto; padding: 28px 20px 70px; outline: none; }
.foot { max-width: 1120px; margin: 0 auto; padding: 0 20px 40px; color: var(--muted); font-size: .85rem; }
.foot a { color: inherit; }
.grid { display: grid; gap: 18px; }
.g2 { grid-template-columns: repeat(2, 1fr); }
.g3 { grid-template-columns: repeat(3, 1fr); }
.g-auto { grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); }
@media (max-width: 860px) { .g2, .g3 { grid-template-columns: 1fr; } main { padding: 20px 16px 60px; } }
.card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 22px 24px; box-shadow: var(--shadow);
}
.card > :last-child { margin-bottom: 0; }
.card h2:first-child, .card h3:first-child { margin-top: 0; }
.card.flat { box-shadow: none; }
.card.soft { background: var(--surface-2); box-shadow: none; }
a.card { display: block; text-decoration: none; color: inherit; transition: transform .12s, border-color .12s; }
a.card:hover { transform: translateY(-2px); border-color: var(--accent); }
.eyebrow { font: 700 .74rem/1 var(--sans); letter-spacing: .12em; text-transform: uppercase; color: var(--accent); margin: 0 0 10px; }
.page-head { margin-bottom: 26px; }
.page-head p { color: var(--muted); max-width: 70ch; font-size: 1.05rem; }
.crumbs { font-size: .88rem; color: var(--muted); margin-bottom: 10px; }
.crumbs a { color: inherit; }
.row { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.stack > * + * { margin-top: 14px; }
.grid > *, .lesson-layout > *, .row > * { min-width: 0; }
.prose, .callout, .card, .ex, .arg-text { overflow-wrap: break-word; }
.scroll-x { max-width: 100%; }

/* ----- кнопки и бейджи ----- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 11px 20px; border-radius: 12px; border: 1px solid var(--line);
  background: var(--surface); font-weight: 700; text-decoration: none; color: var(--ink);
  transition: background .12s, transform .06s, border-color .12s;
}
.btn:hover { border-color: var(--accent); }
.btn:active { transform: translateY(1px); }
.btn.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.btn.primary:hover { filter: brightness(1.08); }
.btn.ghost { background: transparent; }
.btn.sm { padding: 6px 12px; font-size: .9rem; border-radius: 10px; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }
.chip {
  display: inline-block; padding: 3px 10px; border-radius: 999px; font-size: .8rem; font-weight: 700;
  background: var(--surface-2); border: 1px solid var(--line); color: var(--muted);
}
.chip.good { background: var(--good-soft); color: var(--good); border-color: transparent; }
.chip.bad { background: var(--bad-soft); color: var(--bad); border-color: transparent; }
.chip.warn { background: var(--warn-soft); color: var(--warn); border-color: transparent; }
.chip.info { background: var(--info-soft); color: var(--info); border-color: transparent; }
.chip.accent { background: var(--accent-soft); color: var(--accent); border-color: transparent; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }

/* ----- прогресс ----- */
.bar { height: 8px; background: var(--surface-2); border: 1px solid var(--line); border-radius: 99px; overflow: hidden; }
.bar > i { display: block; height: 100%; background: var(--accent); border-radius: 99px; transition: width .4s; }
.bar.good > i { background: var(--good); }
.stat { text-align: left; }
.stat b { display: block; font: 700 1.9rem/1.1 var(--serif); }
.stat span { color: var(--muted); font-size: .85rem; }
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; }
.stats > * { min-width: 0; }
.stat b { overflow-wrap: anywhere; }
@media (max-width: 700px) { .stats { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 420px) { .stat b { font-size: 1.35rem; } .sq { grid-template-columns: 1fr; } .card { padding: 18px 16px; } .hero { padding: 22px 16px; } }

/* ----- hero ----- */
.hero {
  position: relative; overflow: hidden;
  background: linear-gradient(135deg, var(--accent) 0%, #4a1119 100%);
  color: #fff; border-radius: 20px; padding: 36px 36px 34px; margin-bottom: 22px;
}
:root[data-theme="dark"] .hero { background: linear-gradient(135deg, #5b1c25, #2a0d12); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .hero { background: linear-gradient(135deg, #5b1c25, #2a0d12); } }
.hero h1 { color: #fff; margin-bottom: .3em; max-width: 18ch; }
.hero p { max-width: 56ch; opacity: .92; margin-bottom: 1.2em; }
.hero .eyebrow { color: #f0cf8a; }
.hero .venn { position: absolute; right: -30px; top: -20px; opacity: .22; pointer-events: none; }
.hero .btn { background: #fff; color: #5a1620; border-color: #fff; }
.hero .btn.ghost { background: transparent; color: #fff; border-color: rgba(255,255,255,.5); }
@media (max-width: 700px) { .hero { padding: 26px 22px; } .hero .venn { display: none; } }

/* ----- тексты уроков ----- */
.prose { max-width: 70ch; }
.prose p, .prose li { font-size: 1.04rem; }
.prose ul, .prose ol { padding-left: 1.3em; margin: 0 0 1em; }
.prose li { margin-bottom: .35em; }
.prose h3 { margin-top: 1.6em; }
.ex {
  border-left: 4px solid var(--gold); background: var(--gold-soft); padding: 12px 18px; border-radius: 0 12px 12px 0;
  margin: 1em 0; font-size: .98rem;
}
.ex > :last-child { margin-bottom: 0; }
.ex .t { font: 700 .74rem/1 var(--sans); letter-spacing: .1em; text-transform: uppercase; color: var(--warn); display: block; margin-bottom: 6px; }
.syl { font-family: var(--serif); font-size: 1.05rem; background: var(--surface-2); border: 1px solid var(--line); border-radius: 12px; padding: 12px 18px; margin: 1em 0; line-height: 1.55; }
.syl .l { display: block; }
.syl .l.c { border-top: 1px solid var(--line); margin-top: 6px; padding-top: 6px; font-weight: 700; }
.syl .tag { float: right; font: 700 .72rem/1 var(--sans); color: var(--muted); letter-spacing: .06em; }
.callout { border-radius: 14px; padding: 16px 20px; margin: 1.4em 0; border: 1px solid transparent; }
.callout > :last-child { margin-bottom: 0; }
.callout h4 { font-family: var(--sans); font-size: .78rem; letter-spacing: .1em; text-transform: uppercase; margin: 0 0 8px; }
.callout.key { background: var(--info-soft); border-color: color-mix(in srgb, var(--info) 25%, transparent); }
.callout.key h4 { color: var(--info); }
.callout.sophist { background: var(--accent-soft); border-color: color-mix(in srgb, var(--accent) 25%, transparent); }
.callout.sophist h4 { color: var(--accent); }
.callout.note { background: var(--warn-soft); }
.callout.note h4 { color: var(--warn); }
.callout.good { background: var(--good-soft); }
.callout.good h4 { color: var(--good); }
.callout.bad { background: var(--bad-soft); }
.callout.bad h4 { color: var(--bad); }
.callout ul { padding-left: 1.2em; margin: 0 0 .6em; }
.terms { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 10px; margin-top: 8px; }
.term { background: var(--surface-2); border: 1px solid var(--line); border-radius: 12px; padding: 10px 14px; font-size: .94rem; }
.term b { display: block; font-family: var(--serif); font-size: 1.05rem; }
table.t { width: 100%; border-collapse: collapse; font-size: .95rem; margin: 1em 0; }
table.t th, table.t td { border: 1px solid var(--line); padding: 8px 10px; text-align: left; vertical-align: top; }
table.t th { background: var(--surface-2); font-size: .82rem; letter-spacing: .04em; text-transform: uppercase; color: var(--muted); }
.scroll-x { overflow-x: auto; }

/* ----- урок: боковая панель ----- */
.lesson-layout { display: grid; grid-template-columns: 250px minmax(0, 1fr); gap: 34px; align-items: start; }
.side { position: sticky; top: 84px; max-height: calc(100vh - 100px); overflow: auto; font-size: .9rem; padding-right: 6px; }
.side h4 { font: 700 .72rem/1 var(--sans); letter-spacing: .1em; text-transform: uppercase; color: var(--muted); margin: 16px 0 6px; }
.side a { display: flex; gap: 8px; padding: 5px 8px; border-radius: 8px; color: var(--ink); text-decoration: none; line-height: 1.3; }
.side a:hover { background: var(--surface-2); }
.side a[aria-current="page"] { background: var(--accent-soft); color: var(--accent); font-weight: 700; }
.side a .n { flex: none; width: 1.7em; color: var(--muted); font-variant-numeric: tabular-nums; }
.side a.done .n::after { content: "✓"; color: var(--good); margin-left: 2px; }
@media (max-width: 960px) { .lesson-layout { grid-template-columns: 1fr; } .side { display: none; } }

/* ----- список курса ----- */
.module { margin-bottom: 26px; }
.module-h { display: flex; align-items: baseline; gap: 12px; margin-bottom: 10px; }
.module-h h2 { margin: 0; font-size: 1.3rem; }
.lrow {
  display: grid; grid-template-columns: 44px 1fr auto; gap: 14px; align-items: center;
  padding: 14px 18px; background: var(--surface); border: 1px solid var(--line); border-radius: 12px;
  text-decoration: none; color: inherit; margin-bottom: 8px; transition: border-color .12s, transform .12s;
}
.lrow:hover { border-color: var(--accent); transform: translateX(2px); }
.lrow .num { width: 38px; height: 38px; border-radius: 50%; display: grid; place-items: center; background: var(--surface-2); border: 1px solid var(--line); font: 700 .88rem var(--serif); }
.lrow.done .num { background: var(--good-soft); color: var(--good); border-color: transparent; }
.lrow b { font-family: var(--serif); font-size: 1.08rem; display: block; }
.lrow .meta { color: var(--muted); font-size: .85rem; }
@media (max-width: 600px) { .lrow { grid-template-columns: 38px 1fr; } .lrow .chips { grid-column: 2; } }

/* ----- вопросы и ответы ----- */
.q-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 14px; }
.q-prompt { font-size: 1.12rem; line-height: 1.5; margin-bottom: 16px; }
.q-prompt .syl { font-size: 1.02rem; }
.opts { display: grid; gap: 10px; }
.opt {
  text-align: left; width: 100%; padding: 13px 16px; border-radius: 12px; background: var(--surface);
  border: 2px solid var(--line); display: flex; gap: 12px; align-items: flex-start; line-height: 1.4;
  transition: border-color .1s, background .1s;
}
.opt:hover:not([disabled]) { border-color: var(--accent); background: var(--surface-2); }
.opt .k { flex: none; width: 1.7em; height: 1.7em; border-radius: 50%; background: var(--surface-2); border: 1px solid var(--line); display: grid; place-items: center; font: 700 .8rem var(--sans); color: var(--muted); }
.opt small { display: block; color: var(--muted); font-size: .85rem; margin-top: 2px; }
.opt.right { border-color: var(--good); background: var(--good-soft); }
.opt.wrong { border-color: var(--bad); background: var(--bad-soft); }
.opt.missed { border-color: var(--good); border-style: dashed; }
.opt[disabled] { cursor: default; }
.feedback { margin-top: 16px; padding: 14px 18px; border-radius: 12px; }
.feedback.ok { background: var(--good-soft); }
.feedback.no { background: var(--bad-soft); }
.feedback b.v { display: block; margin-bottom: 4px; font-family: var(--serif); font-size: 1.08rem; }
.feedback > :last-child { margin-bottom: 0; }
.result-big { font: 700 3.2rem/1 var(--serif); }
.two-btns { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
@media (max-width: 600px) { .two-btns { grid-template-columns: 1fr; } }
.verdict-btn { padding: 18px; border-radius: 14px; border: 2px solid var(--line); background: var(--surface); font-weight: 700; font-size: 1.05rem; text-align: center; transition: .1s; }
.verdict-btn:hover:not([disabled]) { border-color: var(--accent); background: var(--surface-2); }
.verdict-btn small { display: block; font-weight: 500; color: var(--muted); font-size: .85rem; margin-top: 3px; }

/* ----- карточка аргумента (софизм) ----- */
.arg-text { font-family: var(--serif); font-size: 1.18rem; line-height: 1.6; background: var(--surface-2); border: 1px solid var(--line); border-left: 5px solid var(--accent); border-radius: 12px; padding: 16px 22px; margin: 4px 0 20px; }
.arg-text .step { display: flex; gap: 12px; padding: 3px 0; }
.arg-text .step .n { flex: none; width: 1.6em; color: var(--muted); font: 700 .86rem var(--sans); padding-top: .3em; }
.arg-text .step.flaw { background: var(--bad-soft); margin: 0 -12px; padding: 3px 12px; border-radius: 8px; }
.arg-text .step.concl { border-top: 1px dashed var(--line); margin-top: 6px; padding-top: 8px; font-weight: 700; }
.arg-text p { margin: 0 0 .5em; }
.arg-text p:last-child { margin-bottom: 0; }
.dialog p { margin: 0 0 .35em; }
.demolish { counter-reset: s; list-style: none; padding: 0; margin: 0; }
.demolish li { counter-increment: s; position: relative; padding: 0 0 12px 46px; }
.demolish li::before { content: counter(s); position: absolute; left: 0; top: 0; width: 32px; height: 32px; border-radius: 50%; background: var(--accent); color: var(--accent-ink); display: grid; place-items: center; font: 700 .9rem var(--sans); }
.demolish li > b { display: block; font-family: var(--serif); }
.reply { border-left: 4px solid var(--good); background: var(--good-soft); padding: 12px 18px; border-radius: 0 12px 12px 0; font-style: italic; }
.parallel { border-left: 4px solid var(--info); background: var(--info-soft); padding: 12px 18px; border-radius: 0 12px 12px 0; }
textarea.note { width: 100%; min-height: 84px; resize: vertical; border: 2px solid var(--line); border-radius: 12px; padding: 12px 14px; background: var(--surface); color: var(--ink); font: inherit; }
textarea.note:focus { border-color: var(--accent); outline: none; }
input[type="search"], input[type="text"], select {
  width: 100%; padding: 10px 14px; border-radius: 12px; border: 2px solid var(--line); background: var(--surface); color: var(--ink); font: inherit;
}
input[type="search"]:focus, select:focus { border-color: var(--accent); outline: none; }
select { width: auto; }

/* ----- каталог ----- */
.fam-h { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 12px; margin: 30px 0 12px; }
.fam-h h2 { margin: 0; font-size: 1.25rem; }
.fcard { padding: 16px 20px; }
.fcard b { font-family: var(--serif); font-size: 1.1rem; display: block; }
.fcard .lat { color: var(--muted); font-size: .88rem; font-style: italic; }
.flag-list { list-style: none; padding: 0; margin: 0; }
.flag-list li { padding: 7px 0 7px 28px; position: relative; border-bottom: 1px dashed var(--line); }
.flag-list li:last-child { border-bottom: 0; }
.flag-list li::before { content: "⚑"; position: absolute; left: 0; color: var(--bad); }
.flag-list.green li::before { content: "✓"; color: var(--good); }

/* ----- тепловая карта ----- */
.heat { display: grid; grid-auto-flow: column; grid-template-rows: repeat(7, 14px); gap: 4px; overflow-x: auto; padding-bottom: 6px; }
.heat i { width: 14px; height: 14px; border-radius: 3px; background: var(--surface-2); border: 1px solid var(--line); }
.heat i.l1 { background: color-mix(in srgb, var(--accent) 25%, var(--surface-2)); border-color: transparent; }
.heat i.l2 { background: color-mix(in srgb, var(--accent) 50%, var(--surface-2)); border-color: transparent; }
.heat i.l3 { background: color-mix(in srgb, var(--accent) 78%, var(--surface-2)); border-color: transparent; }
.heat i.l4 { background: var(--accent); border-color: transparent; }
.heat i.today { outline: 2px solid var(--gold); }

/* ----- чек-лист «на сегодня» ----- */
.todo { list-style: none; margin: 0; padding: 0; }
.todo li { display: flex; align-items: center; gap: 12px; padding: 11px 0; border-bottom: 1px solid var(--line); }
.todo li:last-child { border-bottom: 0; }
.todo .ck { flex: none; width: 24px; height: 24px; border-radius: 50%; border: 2px solid var(--line); display: grid; place-items: center; font-size: .8rem; }
.todo li.done .ck { background: var(--good); border-color: var(--good); color: #fff; }
.todo li.done a { color: var(--muted); text-decoration: line-through; }
.todo a { color: var(--ink); font-weight: 600; text-decoration: none; flex: 1; }
.todo a:hover { color: var(--accent); }

/* ----- карточки мыслителей ----- */
.th summary { cursor: pointer; list-style: none; }
.th summary::-webkit-details-marker { display: none; }
.th summary::after { content: "▾ подробнее"; display: block; margin-top: 8px; font-size: .82rem; font-weight: 700; color: var(--accent); }
.th[open] summary::after { content: "▴ свернуть"; }
.th[open] > summary { margin-bottom: 14px; }

/* ----- вкладки ----- */
.tabs { display: flex; gap: 4px; border-bottom: 2px solid var(--line); margin-bottom: 20px; overflow-x: auto; scrollbar-width: thin; }
.tabs button { background: none; border: none; padding: 10px 16px; font-weight: 700; color: var(--muted); border-bottom: 3px solid transparent; margin-bottom: -2px; white-space: nowrap; }
.tabs button[aria-selected="true"] { color: var(--accent); border-bottom-color: var(--accent); }

/* ----- виджеты ----- */
.widget { background: var(--surface-2); border: 1px solid var(--line); border-radius: 14px; padding: 18px 20px; margin: 1.3em 0; overflow-x: auto; max-width: 100%; }
.widget select { max-width: 100%; }
.widget h4 { margin: 0 0 10px; font-family: var(--sans); font-size: .78rem; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); }
.euler { display: block; max-width: 220px; height: auto; }
.eul-row { display: flex; gap: 16px; flex-wrap: wrap; }
.eul-cell { text-align: center; font-size: .86rem; flex: 1 1 150px; max-width: 220px; }
.eul-cell figcaption { margin-top: 4px; }
.eul-cell { margin: 0; }
.sq { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; position: relative; }
.sq .corner { border: 2px solid var(--line); background: var(--surface); border-radius: 12px; padding: 10px 12px; text-align: left; display: block; width: 100%; }
.sq .corner b { font: 700 1.3rem var(--serif); margin-right: 6px; }
.sq .corner.sel { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.sq .corner.t { background: var(--good-soft); border-color: var(--good); }
.sq .corner.f { background: var(--bad-soft); border-color: var(--bad); }
.sq .corner.u { background: var(--warn-soft); border-color: var(--warn); }
.sq .corner .st { display: block; font-size: .82rem; font-weight: 700; margin-top: 4px; }
.seg { display: inline-flex; border: 2px solid var(--line); border-radius: 12px; overflow: hidden; }
.seg button { background: var(--surface); border: none; padding: 7px 14px; font-weight: 700; }
.seg button[aria-pressed="true"] { background: var(--accent); color: var(--accent-ink); }
.lab-sel { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin-bottom: 14px; }
.lab-sel label { font-size: .82rem; font-weight: 700; color: var(--muted); display: block; margin-bottom: 4px; }
.lab-sel select { width: 100%; }

/* ----- toasts ----- */
.toasts { position: fixed; right: 16px; bottom: 16px; display: grid; gap: 8px; z-index: 60; max-width: min(360px, calc(100vw - 32px)); }
.toast { background: var(--ink); color: var(--bg); padding: 11px 16px; border-radius: 12px; box-shadow: var(--shadow); font-weight: 600; font-size: .94rem; animation: tin .25s ease; }
@keyframes tin { from { opacity: 0; transform: translateY(8px); } }
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; scroll-behavior: auto !important; } }

@media print {
  .topbar, .foot, .side, .btn, .toasts { display: none !important; }
  body { background: #fff; color: #000; }
  .card { box-shadow: none; }
}
