/* Лист на столе: подложка — стол, рабочая область — белый лист, маркер — на найденном и на цифре-ответе.
   Цвет оболочки — только чернила. Значения — prototype/DESIGN.md. */
:root {
  --desk: #e9ebee; --sheet: #ffffff; --raised: #f3f4f6; --active: #dcdfe4;
  --border: #dcdfe3; --rule: #e9ebee; --control: #bfc3c9;
  --ink: #121417; --muted: #545962; --faint: #636872;
  --marker: #a9e4c4; --on-marker: #0f2a1f; --frame-edge: #121417;
  --primary: #121417; --on-primary: #ffffff;
  --shadow: 0 14px 32px rgba(18, 20, 23, .16);
  --font: "Onest", "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
  --fig: "JetBrains Mono", ui-monospace, "SF Mono", Consolas, "Liberation Mono", monospace;
  --ease-out: cubic-bezier(0.23, 1, 0.32, 1);
  --gut: 40px;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --desk: #0f1012; --sheet: #17191c; --raised: #212328; --active: #272a2f;
    --border: #2c2f34; --rule: #24262b; --control: #4a4e55;
    --ink: #eef0f2; --muted: #aeb3ba; --faint: #9aa0a8;
    --marker: #8fd3b0; --on-marker: #0c2118; --frame-edge: #8fd3b0;
    --primary: #eef0f2; --on-primary: #121417;
    --shadow: 0 14px 32px rgba(0, 0, 0, .5);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --desk: #0f1012; --sheet: #17191c; --raised: #212328; --active: #272a2f;
  --border: #2c2f34; --rule: #24262b; --control: #4a4e55;
  --ink: #eef0f2; --muted: #aeb3ba; --faint: #9aa0a8;
  --marker: #8fd3b0; --on-marker: #0c2118; --frame-edge: #8fd3b0;
  --primary: #eef0f2; --on-primary: #121417;
  --shadow: 0 14px 32px rgba(0, 0, 0, .5);
  color-scheme: dark;
}

html { -webkit-tap-highlight-color: transparent; -webkit-text-size-adjust: 100%; scroll-padding-top: 76px; }
body {
  margin: 0; background: var(--desk); color: var(--ink);
  font: 400 16px/1.55 var(--font); font-synthesis: none;
  -webkit-font-smoothing: antialiased; overflow-wrap: break-word;
}
html.locked, html.locked body { overflow: hidden; }
* { box-sizing: border-box; }
::selection { background: var(--marker); color: var(--on-marker); }
a { color: inherit; text-decoration-color: var(--control); text-underline-offset: 3px; text-decoration-thickness: 1px; }
button, a, [role="option"] { touch-action: manipulation; }
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
button, .chip, .nav a { user-select: none; -webkit-user-select: none; }
:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; border-radius: 3px; }
h1, h2, h3, p, ul, ol, dl, dd, figure { margin: 0; padding: 0; }
ul, ol { list-style: none; }
h1 { font-size: 30px; line-height: 1.2; font-weight: 600; letter-spacing: -.012em; text-wrap: balance; overflow-wrap: anywhere; }
h1:focus { outline: none; }
h2 { font-size: 20px; line-height: 1.3; font-weight: 600; text-wrap: balance; }
h3 { font-size: 16px; line-height: 1.35; font-weight: 600; }
mark { background: var(--marker); color: var(--on-marker); border-radius: 2px; padding: 0 1px; }
svg.i { width: 18px; height: 18px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.num, .fig { font-family: var(--fig); font-variant-numeric: tabular-nums; font-feature-settings: "zero" 0; }
.muted { color: var(--muted); }
.small { font-size: 13px; line-height: 1.45; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.skip { position: absolute; left: 12px; top: -60px; z-index: 90; background: var(--primary); color: var(--on-primary); padding: 8px 12px; border-radius: 6px; }
.skip:focus { top: 12px; }
.ext { display: inline-block; width: 12px; height: 12px; margin-left: 3px; vertical-align: -1px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }

.tag {
  display: inline-block; flex: none; background: var(--raised); color: var(--muted);
  font: 500 12px/20px var(--font); padding: 0 6px; border-radius: 3px; white-space: nowrap;
}
.tag-later { background: none; border: 1px solid var(--control); line-height: 18px; color: var(--muted); }

/* Оболочка */
.app { display: grid; grid-template-columns: 248px minmax(0, 1fr); min-height: 100dvh; }
.side {
  position: sticky; top: env(safe-area-inset-top, 0px); height: 100dvh; overflow-y: auto; overscroll-behavior: contain;
  padding: 20px 12px 16px; display: flex; flex-direction: column; gap: 22px; scrollbar-width: thin; scrollbar-color: var(--control) transparent;
}
.wm { display: inline-flex; align-items: center; min-height: 24px; font-size: 17px; line-height: 24px; font-weight: 600; letter-spacing: -.01em; text-decoration: none; white-space: nowrap; }
.wm b { font-weight: 600; background: var(--marker); color: var(--on-marker); padding: 0 3px 1px; border-radius: 2px; }
.side .wm { padding: 0 10px; }
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav-h { font-size: 13px; line-height: 18px; color: var(--muted); padding: 0 10px 6px; }
.nav a {
  display: flex; align-items: center; justify-content: space-between; gap: 8px; min-height: 34px; padding: 5px 10px;
  border-radius: 6px; font-size: 14px; line-height: 20px; text-decoration: none; color: var(--ink);
}
.nav a[aria-current="page"] { background: var(--active); font-weight: 500; }
.side-foot { margin-top: auto; }
.theme { display: inline-flex; align-items: center; gap: 8px; min-height: 36px; padding: 6px 10px; border-radius: 6px; font-size: 14px; color: var(--muted); }
.main { padding: 12px 12px 12px 0; min-width: 0; }
.sheet {
  background: var(--sheet); border: 1px solid var(--border); border-radius: 10px;
  min-height: calc(100dvh - 24px); display: flex; flex-direction: column; min-width: 0;
}
.bar {
  position: sticky; top: env(safe-area-inset-top, 0px); z-index: 30; background: var(--sheet); border-bottom: 1px solid var(--rule);
  border-radius: 10px 10px 0 0; padding: 10px var(--gut);
}
.phonebar { display: none; }
.content { flex: 1; padding: 32px var(--gut) 48px; min-width: 0; }
.wrap { max-width: 1120px; margin: 0 auto; }
.foot {
  border-top: 1px solid var(--rule); padding: 8px var(--gut); display: flex; flex-wrap: wrap; align-items: center;
  justify-content: space-between; gap: 4px 24px; color: var(--muted); font-size: 13px; line-height: 1.45;
}
.foot p { max-width: 66ch; padding: 6px 0; }

/* Подпись Юры: разметка и стиль — из shared/подпись, не менять */
.yr-sign{display:inline-flex;align-items:center;gap:8px;min-height:44px;color:inherit;font:inherit;text-decoration:none}
.yr-sign:hover .yr-sign__t{text-decoration:underline;text-underline-offset:3px}
.yr-sign__seal{--yr-red:#C1121F;display:inline-flex;align-items:center;justify-content:center;width:24px;height:24px;
  box-sizing:border-box;border:1.5px solid var(--yr-red);border-radius:5px;color:var(--yr-red);transform:rotate(-6deg);
  font-family:"Oswald","Arial Narrow",sans-serif;font-weight:700;font-size:11px;line-height:1;letter-spacing:.02em;
  text-transform:none}
@media (prefers-color-scheme:dark){:root:not([data-theme="light"]) .yr-sign__seal{--yr-red:#EE3A2F}}
:root[data-theme="dark"] .yr-sign__seal{--yr-red:#EE3A2F}

/* Поиск */
.search { position: relative; }
.search-row {
  display: flex; align-items: center; gap: 10px; height: 44px; padding: 0 6px 0 12px;
  background: var(--sheet); border: 1px solid var(--control); border-radius: 8px;
}
.search-row:focus-within { border-color: var(--ink); box-shadow: 0 0 0 1px var(--ink); }
.search-row > svg.i { color: var(--muted); }
.search input {
  flex: 1; min-width: 0; height: 100%; border: 0; outline: 0; background: none; color: var(--ink);
  font: 400 16px/1.2 var(--font); padding: 0; caret-color: var(--ink); -webkit-appearance: none; appearance: none;
}
.search input::placeholder { color: var(--faint); opacity: 1; }
.search-go {
  flex: none; height: 32px; padding: 0 12px; border-radius: 6px; background: var(--primary); color: var(--on-primary);
  font-weight: 500; font-size: 14px; transition: transform 100ms var(--ease-out);
}
.search-go:active { transform: scale(.97); }
.search-x { display: none; flex: none; width: 44px; height: 44px; align-items: center; justify-content: center; color: var(--muted); }
.key { font: 500 12px/20px var(--fig); color: var(--muted); border: 1px solid var(--border); border-radius: 4px; padding: 0 6px; flex: none; }
.search-big .search-row { height: 72px; padding: 0 10px 0 20px; border-width: 1.5px; border-color: var(--ink); border-radius: 10px; gap: 14px; }
.search-big .search-row:focus-within { box-shadow: 0 0 0 1.5px var(--ink); }
.search-big .search-row > svg.i { width: 22px; height: 22px; }
.search-big input { font-size: 22px; letter-spacing: -.005em; }
.search-big .search-go { height: 52px; padding: 0 24px; font-size: 16px; border-radius: 7px; }

.panel {
  position: absolute; top: calc(100% + 6px); left: 0; right: 0; z-index: 40; background: var(--sheet); border: 1px solid var(--control);
  border-radius: 10px; box-shadow: var(--shadow); max-height: min(72vh, 640px); overflow-y: auto; overscroll-behavior: contain;
  scrollbar-width: thin; scrollbar-color: var(--control) transparent;
}
.panel-note { padding: 10px 16px 0; font-size: 13px; color: var(--muted); }
.panel-h { padding: 12px 16px 4px; font-size: 13px; color: var(--muted); }
.opt {
  display: flex; align-items: center; gap: 16px; padding: 10px 16px; min-height: 56px; cursor: pointer; text-decoration: none; color: inherit;
}
.opt.is-active { background: var(--raised); }
.opt-main { flex: 1; min-width: 0; }
.opt-title { font-size: 15px; line-height: 1.35; font-weight: 500; overflow-wrap: anywhere; }
.opt-meta { font-size: 13px; line-height: 1.4; color: var(--muted); margin-top: 2px; }
.opt-fig { flex: none; display: flex; align-items: center; gap: 10px; max-width: 46%; text-align: right; }
.opt-fig .fig { font-size: 15px; font-weight: 500; }
.opt-fig > span:last-child { min-width: 0; overflow-wrap: anywhere; }
.opt-fig .unit { font-size: 13px; color: var(--muted); }
.opt-answer { padding: 14px 16px; align-items: center; border-bottom: 1px solid var(--rule); }
.opt-answer .opt-title { font-size: 15px; font-weight: 400; color: var(--muted); }
.opt-answer .ans-fig { font: 500 26px/1.25 var(--fig); margin-top: 2px; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.opt-answer .ans-fig .unit { font: 400 15px/1 var(--font); color: var(--muted); }
.ans-mark { background: var(--marker); color: var(--on-marker); padding: 0 6px; border-radius: 2px; box-decoration-break: clone; -webkit-box-decoration-break: clone; }
.panel-foot {
  position: sticky; bottom: 0; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 16px;
  background: var(--sheet); border-top: 1px solid var(--rule); font-size: 14px; font-weight: 500; cursor: pointer; min-height: 44px;
}
.panel-empty { padding: 16px; }
.panel-empty p { margin-bottom: 10px; }
.try { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  display: inline-flex; align-items: center; gap: 6px; min-height: 32px; padding: 4px 10px; border: 1px solid var(--control); border-radius: 6px;
  font-size: 14px; line-height: 20px; text-decoration: none; color: var(--ink); background: var(--sheet); cursor: pointer;
  transition: transform 100ms var(--ease-out);
}
.chip:active { transform: scale(.97); }
.chip[aria-pressed="true"], .chip[aria-current="true"] { background: var(--primary); color: var(--on-primary); border-color: var(--primary); }
.chip[disabled] { color: var(--faint); border-color: var(--rule); cursor: default; }
.chip .num { font-size: 12px; opacity: .8; }

/* Размерная рамка: прямоугольник в настоящих пропорциях формата */
.fr { display: inline-block; flex: none; background: var(--marker); border: 1.25px solid var(--frame-edge); border-radius: 1px; vertical-align: middle; }

.frs { display: inline-flex; align-items: flex-end; gap: 3px; flex: none; }

/* Главная */
.home-head { display: flex; flex-direction: column; gap: 6px; margin-bottom: 20px; }
.home-head p { color: var(--muted); max-width: 68ch; }
.home-grid { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 56px; margin-top: 36px; align-items: start; }
.block-h { display: flex; align-items: baseline; flex-wrap: wrap; gap: 4px 10px; margin-bottom: 10px; }
.block-h a { font-size: 14px; color: var(--muted); }
.block-h .sp { flex: 1; }
.ledger li + li { border-top: 1px solid var(--rule); }
.led {
  display: grid; grid-template-columns: minmax(0, max-content) minmax(16px, 1fr) minmax(0, max-content); align-items: baseline; gap: 8px;
  padding: 11px 0; text-decoration: none; color: inherit; min-height: 44px;
}
.led-q { font-size: 15px; line-height: 1.4; overflow-wrap: anywhere; }
.led-q .tag { margin-left: 6px; vertical-align: 1px; }
.led-dots { border-bottom: 1.5px dotted var(--control); transform: translateY(-4px); }
.led-a { display: inline-flex; align-items: center; gap: 8px; justify-content: flex-end; text-align: right; }
.led-a > span:last-child { min-width: 0; overflow-wrap: anywhere; }
.led-a .fig { font-size: 14.5px; font-weight: 500; }
.led-a .unit { font-size: 13px; color: var(--muted); }
.pl li + li { border-top: 1px solid var(--rule); }
.pl a { display: flex; align-items: baseline; gap: 12px; padding: 10px 0; text-decoration: none; min-height: 44px; }
.pl-name { font-size: 16px; font-weight: 500; }
.pl-src { display: block; font-size: 13px; color: var(--muted); }
.pl-main { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.pl .num { font-size: 14px; color: var(--muted); white-space: nowrap; }
.later { margin-top: 12px; display: flex; flex-wrap: wrap; align-items: center; gap: 6px 8px; font-size: 14px; color: var(--muted); }
.parts { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 0 32px; margin-top: 44px; padding-top: 28px; border-top: 1px solid var(--border); }
.part { min-width: 0; }
.part h2 { font-size: 16px; margin-bottom: 8px; }
.part h2 a { text-decoration: none; }
.part li { font-size: 14px; line-height: 1.4; padding: 5px 0; }
.part li a { text-decoration: none; }
.part .more { color: var(--muted); }
.changes { margin-top: 44px; padding-top: 28px; border-top: 1px solid var(--border); }
.ch-list { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px 32px; margin-top: 10px; }
.ch-list li { font-size: 14.5px; line-height: 1.45; }
.ch-date { display: block; font: 500 12.5px/1.5 var(--fig); color: var(--muted); }

/* Хлебные крошки */
.crumbs { display: flex; flex-wrap: wrap; gap: 2px 6px; font-size: 13px; color: var(--muted); margin-bottom: 10px; }
.crumbs a { text-decoration: none; }
.crumbs span[aria-hidden] { color: var(--control); }

/* Площадка */
.pg-head { margin-bottom: 20px; }
.pg-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 14px; margin-top: 6px; color: var(--muted); font-size: 14px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 16px 0 8px; }
.warn { border: 1px solid var(--border); border-left: 4px solid var(--ink); background: var(--raised); color: var(--ink); padding: 12px 16px; margin: 0 0 20px; font-size: 14px; line-height: 1.5; border-radius: 4px; max-width: 80ch; }
.warn b { font-weight: 600; }
.pl-group { padding: 14px 0 4px; font-size: 13px; color: var(--ink); font-weight: 500; }
.pl li.pl-group + li { border-top: 0; }
.legend { display: flex; flex-wrap: wrap; gap: 4px 16px; font-size: 13px; color: var(--muted); margin-bottom: 8px; }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.sq { display: inline-block; width: 9px; height: 9px; flex: none; border: 1.25px solid var(--muted); border-radius: 1px; }
.sq.on { background: var(--marker); border-color: var(--frame-edge); }
.sec { padding-top: 28px; }
.sec-h { display: flex; align-items: baseline; gap: 10px; margin-bottom: 8px; }
.sec-h .num { font-size: 13px; color: var(--muted); }
.topics { columns: 2; column-gap: 40px; }
.topics li { break-inside: avoid; }
.topics a { display: flex; align-items: baseline; gap: 8px; padding: 5px 0; font-size: 14.5px; line-height: 1.4; text-decoration: none; overflow-wrap: anywhere; }
.topics a .sq { transform: translateY(1px); }
.topics a.ready { font-weight: 500; }

/* Статья */
.art { display: grid; grid-template-columns: minmax(0, 700px) 240px; gap: 48px; justify-content: space-between; align-items: start; }
.art-col { min-width: 0; }
.art h1 { margin-bottom: 18px; }
.art h2 { margin: 32px 0 10px; }
.answer { font-size: 21px; line-height: 1.5; font-weight: 400; letter-spacing: -.005em; }
.answer b { font: 500 .94em/1 var(--fig); white-space: nowrap; }
.ans-text { border-radius: 2px; transition: background-color 200ms ease, color 200ms ease; box-decoration-break: clone; -webkit-box-decoration-break: clone; }
.ans-text.is-copied { background: var(--marker); color: var(--on-marker); }
.answer b.sweep-long { white-space: normal; overflow-wrap: anywhere; background: var(--marker); color: var(--on-marker); padding: 0 .22em; border-radius: 2px; box-decoration-break: clone; -webkit-box-decoration-break: clone; }
.sweep { position: relative; isolation: isolate; color: var(--on-marker); padding: 0 .22em; margin: 0 .04em; }
.sweep::before {
  content: ""; position: absolute; inset: .02em 0 .02em 0; background: var(--marker); border-radius: 2px; z-index: -1; transform-origin: left center;
}
.sweep.play::before { animation: sweep 420ms var(--ease-out) both; }
@keyframes sweep { from { transform: scaleX(0); } to { transform: scaleX(1); } }
.prose { font-size: 16px; line-height: 1.6; max-width: 68ch; }
.prose p + p, .prose p + ul, .prose ul + p { margin-top: 10px; }
.prose ul { display: flex; flex-direction: column; gap: 6px; }
.prose li { position: relative; padding-left: 16px; }
.prose li::before { content: ""; position: absolute; left: 2px; top: .68em; width: 5px; height: 5px; background: var(--muted); border-radius: 1px; }
.note { background: var(--raised); border-radius: 8px; padding: 14px 18px; }
.sizes { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 16px 28px; margin: 4px 0 16px; }
.size { display: flex; flex-direction: column; gap: 6px; font-size: 13px; line-height: 1.35; min-width: 0; max-width: 100%; }
.size small { overflow-wrap: anywhere; }
.size .num { font-weight: 500; }
.size small { font-size: 13px; color: var(--muted); }
.tbl { overflow-x: auto; margin: 0; }
.tbl-h { margin: 18px 0 6px; }
.prose h3 { margin: 18px 0 6px !important; }
.prose h3:first-child { margin-top: 0 !important; }
.stub-pages { display: flex; flex-direction: column; gap: 4px; margin-top: 6px; font-size: 14.5px; }
.cmp-block { padding-top: 26px; scroll-margin-top: 56px; }
.cmp-block h2 a, .sec-h h2 a, .term dt a { text-decoration: none; }
.res-more { margin-top: 14px; }
.cmp-intro { margin: 2px 0 10px; max-width: 80ch; }
.cmp-foot { margin-top: 10px; max-width: 80ch; }
table { border-collapse: collapse; width: 100%; font-size: 15px; line-height: 1.4; }
caption { text-align: left; color: var(--muted); font-size: 13px; padding-bottom: 6px; }
th, td { padding: 9px 16px 9px 0; text-align: left; vertical-align: top; }
thead th { font-size: 13px; font-weight: 400; color: var(--muted); border-bottom: 1px solid var(--control); white-space: nowrap; }
tbody th { font-weight: 500; }
tbody tr + tr th, tbody tr + tr td { border-top: 1px solid var(--rule); }
td .num, td.num { font-family: var(--fig); font-size: 14px; }
.src-box { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 16px; margin-top: 32px; padding-top: 16px; border-top: 1px solid var(--border); font-size: 15px; }
.src-box .checked { color: var(--muted); }
.src-more { flex-basis: 100%; font-size: 13px; line-height: 1.5; color: var(--muted); }
.src-box a { overflow-wrap: anywhere; }
.copy-row { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 12px; margin-top: 16px; }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 8px 16px; border-radius: 7px;
  background: var(--primary); color: var(--on-primary); font-weight: 500; font-size: 15px; transition: transform 100ms var(--ease-out);
}
.btn:active { transform: scale(.97); }
.copy-state { font-size: 13px; color: var(--muted); }
.related { margin-top: 32px; }
.related li + li { border-top: 1px solid var(--rule); }
.related a { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; padding: 9px 0; min-height: 44px; font-size: 15px; text-decoration: none; overflow-wrap: anywhere; }
.rail { position: sticky; top: 84px; font-size: 14px; line-height: 1.4; display: flex; flex-direction: column; gap: 18px; }
.rail-h { font-size: 13px; color: var(--muted); margin-bottom: 4px; }
.rail a { text-decoration: none; }
.rail li { padding: 3px 0; }
.rail-src a { overflow-wrap: anywhere; text-decoration: underline; text-decoration-color: var(--control); }
.stub { max-width: 68ch; margin-top: 8px; }
.stub p + p { margin-top: 10px; }
.stub .note { margin: 14px 0 0; }

/* Сравнение */
.cmp table { table-layout: fixed; }
.cmp thead th { position: sticky; top: 65px; background: var(--sheet); z-index: 2; font-size: 14px; font-weight: 500; color: var(--ink); white-space: normal; }
.cmp thead th:first-child { width: 22%; font-weight: 400; color: var(--muted); }
.cmp tbody th { font-size: 15px; }
.cmp td { font-size: 14.5px; overflow-wrap: anywhere; }
.cell { display: flex; flex-direction: column; align-items: flex-start; gap: 6px; }
.cell-v { min-width: 0; }
.cell-v .num { font-size: 14px; font-weight: 500; }
.cell-sub { display: block; font-size: 13px; line-height: 1.35; color: var(--muted); margin-top: 2px; }
.none { color: var(--faint); font-size: 13.5px; }
.cmp-src td { font-size: 13px; color: var(--muted); }

/* Термины */
.abc { display: flex; flex-wrap: wrap; gap: 4px; margin: 14px 0 10px; }
.abc a { display: inline-flex; align-items: center; justify-content: center; min-width: 32px; min-height: 32px; border-radius: 6px; font-weight: 500; font-size: 14px; text-decoration: none; background: var(--raised); }
.term-group { padding-top: 22px; }
.term-letter { font: 500 13px/1 var(--fig); color: var(--muted); padding-bottom: 6px; border-bottom: 1px solid var(--control); }
.term { display: grid; grid-template-columns: 240px minmax(0, 1fr); gap: 4px 28px; padding: 14px 0; border-bottom: 1px solid var(--rule); scroll-margin-top: 84px; }
.term dt { font-weight: 600; overflow-wrap: anywhere; }
.term dt .tag { margin-left: 6px; font-weight: 500; }
.term dd { max-width: 68ch; }
.term-src { display: block; margin-top: 4px; font-size: 13px; color: var(--muted); overflow-wrap: anywhere; }
.term.flash dt span:first-child { background: var(--marker); color: var(--on-marker); border-radius: 2px; }

/* Результаты */
.res-head { margin-bottom: 14px; }
.res-count { color: var(--muted); font-size: 14px; margin-top: 2px; }
.res-note { font-size: 14px; color: var(--muted); margin-top: 6px; }
.res-note button { text-decoration: underline; text-underline-offset: 3px; text-decoration-color: var(--control); color: var(--ink); min-height: 32px; }
.res-list { margin-top: 10px; border-top: 1px solid var(--rule); }
.res-list .opt { padding-left: 0; padding-right: 0; border-bottom: 1px solid var(--rule); }
.res-list .opt-answer { padding-left: 0; padding-right: 0; }
.empty { max-width: 68ch; }
.empty h2 { margin: 26px 0 8px; font-size: 16px; }
.empty ul.tips { display: flex; flex-direction: column; gap: 4px; }

/* Меню на телефоне */
.phone-menu { position: fixed; inset: 0; height: 100dvh; z-index: 70; background: var(--sheet); overflow-y: auto; overscroll-behavior: contain; display: flex; flex-direction: column; padding: env(safe-area-inset-top, 0px) max(8px, env(safe-area-inset-right, 0px)) calc(16px + env(safe-area-inset-bottom, 0px)) max(8px, env(safe-area-inset-left, 0px)); }
.phone-menu-top { display: flex; align-items: center; justify-content: space-between; min-height: 52px; padding-left: 8px; }
.phone-menu .nav { margin-top: 14px; }
.phone-menu .nav a { min-height: 44px; font-size: 16px; }
.icon-btn { display: inline-flex; align-items: center; justify-content: center; width: 44px; height: 44px; border-radius: 8px; color: var(--ink); flex: none; transition: transform 100ms var(--ease-out); }
.icon-btn:active { transform: scale(.94); }

@media (hover: hover) and (pointer: fine) {
  a:hover { text-decoration-color: currentColor; }
  .nav a:hover { background: var(--active); }
  .theme:hover { color: var(--ink); background: var(--active); }
  .led:hover .led-q, .pl a:hover .pl-name, .topics a:hover, .part li a:hover, .part h2 a:hover, .related a:hover, .rail li a:hover, .crumbs a:hover, .opt:hover .opt-title { text-decoration: underline; text-underline-offset: 3px; text-decoration-color: var(--control); }
  .opt:hover { background: var(--raised); }
  .chip:hover:not([disabled]):not([aria-pressed="true"]) { border-color: var(--ink); }
  .panel-foot:hover { background: var(--raised); }
  .icon-btn:hover { background: var(--raised); }
  .abc a:hover { background: var(--active); }
  .cmp-block h2 a:hover, .sec-h h2 a:hover, .term dt a:hover { text-decoration: underline; text-underline-offset: 3px; text-decoration-color: var(--control); }
}

@media (max-width: 1180px) {
  .home-grid { grid-template-columns: minmax(0, 1fr) 300px; gap: 40px; }
  .art { grid-template-columns: minmax(0, 1fr) 200px; gap: 32px; }
}
@media (max-width: 1020px) {
  :root { --gut: 24px; }
  .app { display: block; }
  .side { display: none; }
  .main { padding: 0; }
  .sheet { border: 0; border-radius: 0; min-height: 100dvh; }
  .phonebar {
    display: flex; align-items: center; justify-content: space-between; gap: 4px; position: sticky; top: env(safe-area-inset-top, 0px); z-index: 32;
    background: var(--sheet); border-bottom: 1px solid var(--rule); min-height: 52px;
    padding: 0 max(8px, env(safe-area-inset-right, 0px)) 0 max(16px, env(safe-area-inset-left, 0px));
  }
  .phonebar .btns { display: flex; align-items: center; }
  .phonebar .wm, .phone-menu-top .wm { min-height: 44px; }
  .bar { position: static; display: none; z-index: auto; } /* у элемента флекса z-index работает и без position: иначе поиск уходит под верхнюю полосу */
  .bar.is-open { display: block; }
  .cmp thead th { top: 52px; }
  .rail { position: static; }
  .parts { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 28px 32px; }
  .ch-list { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .home-grid { grid-template-columns: minmax(0, 1fr); gap: 32px; }
  .art { display: block; }
  .rail { margin-top: 28px; }
  .rail-toc { display: none; }
}
@media (max-width: 720px) {
  :root { --gut: max(16px, env(safe-area-inset-left, 0px)); }
  html { scroll-padding-top: 60px; }
  .content { padding-top: 22px; padding-right: max(16px, env(safe-area-inset-right, 0px)); padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-bottom: 32px; }
  .foot { padding-right: max(16px, env(safe-area-inset-right, 0px)); padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-bottom: calc(8px + env(safe-area-inset-bottom, 0px)); }
  h1 { font-size: 25px; }
  .answer { font-size: 19px; }
  .topics { columns: 1; }
  .parts { grid-template-columns: minmax(0, 1fr); gap: 24px; }
  .ch-list { grid-template-columns: minmax(0, 1fr); }

  .search-big .search-row { height: 56px; padding: 0 6px 0 14px; gap: 10px; border-radius: 9px; }
  .search-big input { font-size: 17px; }
  .search-big .search-go { display: none; }
  .search-row .key { display: none; }

  /* Поиск на телефоне — весь экран, как у приложения */
  .search.open { position: fixed; inset: 0; height: 100dvh; z-index: 60; background: var(--sheet); display: flex; flex-direction: column; padding-top: env(safe-area-inset-top, 0px); }
  .search.open .search-row { flex: none; height: 56px; border: 0; box-shadow: none; border-radius: 0; border-bottom: 1px solid var(--control); padding: 0 0 0 max(14px, env(safe-area-inset-left, 0px)); }
  .search.open .search-row .search-go { display: none; }
  .search.open input { font-size: 17px; }
  .search.open .search-x { display: inline-flex; }
  .search.open .panel { position: static; flex: 1; min-height: 0; max-height: none; border: 0; border-radius: 0; box-shadow: none; padding-bottom: env(safe-area-inset-bottom, 0px); }

  .opt { gap: 10px; padding: 10px 16px; }
  .opt-fig { max-width: 44%; }
  .opt-fig .frs { display: none; }
  .opt-answer .ans-fig { font-size: 22px; }
  .res-list .opt-fig { max-width: 42%; }

  /* Частые запросы — две строки, отточие не нужно */
  .led { grid-template-columns: minmax(0, 1fr) auto; row-gap: 2px; align-items: center; }
  .led-dots { display: none; }
  .led-a { max-width: 46vw; }

  /* Таблицы становятся списками: страница вбок не едет */
  .stack table, .stack tbody, .stack tr, .stack th, .stack td { display: block; width: auto; }
  .stack thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
  .stack tr { padding: 12px 0; border-top: 1px solid var(--rule); }
  .stack tbody tr:first-child { border-top: 1px solid var(--control); }
  .stack tbody th { padding: 0 0 6px; border: 0 !important; font-size: 15px; }
  .stack tbody td { display: grid; grid-template-columns: minmax(0, 118px) minmax(0, 1fr); gap: 12px; padding: 5px 0; border: 0 !important; align-items: start; }
  .stack tbody td::before { content: attr(data-label); color: var(--muted); font-size: 13px; line-height: 1.5; font-family: var(--font); font-weight: 400; }
  .stack tbody td.solo { display: block; padding: 0; }
  .stack tbody td.solo::before { content: none; }
  .stack tbody th:has(+ td.solo) { padding-bottom: 2px; }
  .topics a { padding: 9px 0; }
  .part h2 a, .part li a, .term dt a, .src-box a { display: inline-block; padding: 6px 0; }
  .part li { padding: 0; }
  .block-h a { display: inline-block; padding: 8px 0; }
  .cmp-src td a { display: inline-block; padding: 6px 0; }
  .cmp table { table-layout: auto; }
  .cmp-src td { font-size: 13px; }

  .term { grid-template-columns: minmax(0, 1fr); }
  .term dt .tag { margin-left: 6px; }
  .sizes { gap: 14px 20px; }
}
@media (prefers-reduced-motion: reduce) {
  .sweep.play::before { animation: fade 160ms ease both; }
  @keyframes fade { from { opacity: 0; } to { opacity: 1; } }
  .btn, .chip, .search-go, .icon-btn { transition: none; }
  .btn:active, .chip:active, .search-go:active, .icon-btn:active { transform: none; }
}
