:root {
  --bg: #fbfaf7;
  --panel: #ffffff;
  --ink: #1d232b;
  --muted: #5c6672;
  --line: #e3e0d8;
  --accent: #c25e10;
  --accent-soft: #fbe9d9;
  --blue: #1f5fa8;
  --blue-soft: #e4eefa;
  --good: #2e7d4f;
  --warn: #b3261e;
  --code: #f3f1ec;
  --shadow: 0 1px 2px rgba(0,0,0,.05), 0 4px 14px rgba(0,0,0,.04);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #14171b; --panel: #1c2026; --ink: #e8e6e1; --muted: #a2abb5;
    --line: #2d333b; --accent: #f08a3c; --accent-soft: #3a2616;
    --blue: #7fb0ec; --blue-soft: #1b2a3d; --good: #6fcf97; --warn: #ff8a80;
    --code: #232830; --shadow: none;
  }
}
:root[data-theme="dark"] {
  --bg: #14171b; --panel: #1c2026; --ink: #e8e6e1; --muted: #a2abb5;
  --line: #2d333b; --accent: #f08a3c; --accent-soft: #3a2616;
  --blue: #7fb0ec; --blue-soft: #1b2a3d; --good: #6fcf97; --warn: #ff8a80;
  --code: #232830; --shadow: none;
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font-family: "Rubik", "Assistant", "Segoe UI", Arial, sans-serif;
  font-size: 17px; line-height: 1.7;
}
.katex { direction: ltr; unicode-bidi: isolate; font-size: 1.05em; }
.katex-display { direction: ltr; overflow-x: auto; overflow-y: hidden; padding: 4px 0; }
.ltr { direction: ltr; unicode-bidi: isolate; display: inline-block; }
a { color: var(--blue); }
header.site {
  position: sticky; top: 0; z-index: 10; background: var(--panel);
  border-bottom: 1px solid var(--line); box-shadow: var(--shadow);
}
header.site .bar {
  max-width: 1100px; margin: 0 auto; padding: 10px 16px;
  display: flex; flex-wrap: wrap; align-items: center; gap: 6px 14px;
}
header.site .brand { font-weight: 700; color: var(--ink); text-decoration: none; margin-inline-end: 8px; }
header.site nav { display: flex; flex-wrap: wrap; gap: 4px; }
header.site nav a {
  text-decoration: none; color: var(--muted); padding: 3px 10px; border-radius: 999px; font-size: 15px;
}
header.site nav a:hover { background: var(--code); color: var(--ink); }
header.site nav a.active { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
main { max-width: 1100px; margin: 0 auto; padding: 18px 16px 60px; }
h1 { font-size: 2rem; line-height: 1.25; margin: 18px 0 8px; }
h2 { font-size: 1.45rem; margin: 34px 0 10px; padding-top: 6px; border-top: 1px solid var(--line); }
h3 { font-size: 1.15rem; margin: 22px 0 6px; }
.lead { color: var(--muted); font-size: 1.08rem; margin-top: 0; }
.card {
  background: var(--panel); border: 1px solid var(--line); border-radius: 12px;
  padding: 16px 18px; margin: 14px 0; box-shadow: var(--shadow);
}
.grid { display: grid; gap: 14px; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); }
.grid .card { margin: 0; }
.card h3 { margin-top: 0; }
.level { font-size: 13px; color: var(--accent); font-weight: 700; letter-spacing: .02em; }
.note { border-inline-start: 4px solid var(--blue); background: var(--blue-soft); padding: 10px 14px; border-radius: 8px; margin: 12px 0; }
.warn { border-inline-start: 4px solid var(--accent); background: var(--accent-soft); padding: 10px 14px; border-radius: 8px; margin: 12px 0; }
.src { font-size: 14px; color: var(--muted); }
.tool { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 16px; margin: 16px 0; box-shadow: var(--shadow); }
.tool h3 { margin-top: 0; }
.controls { display: grid; gap: 10px 18px; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); margin: 10px 0; }
.ctl label { display: flex; justify-content: space-between; gap: 8px; font-size: 15px; }
.ctl .val { font-variant-numeric: tabular-nums; direction: ltr; color: var(--accent); font-weight: 600; }
input[type=range] { width: 100%; accent-color: var(--accent); }
select, input[type=number], input[type=text], button {
  font: inherit; font-size: 15px; padding: 5px 9px; border-radius: 8px;
  border: 1px solid var(--line); background: var(--bg); color: var(--ink);
}
button { cursor: pointer; background: var(--accent); color: #fff; border: none; }
button.secondary { background: var(--code); color: var(--ink); border: 1px solid var(--line); }
button:disabled { opacity: .5; cursor: default; }
table { border-collapse: collapse; width: 100%; font-size: 15px; }
th, td { border-bottom: 1px solid var(--line); padding: 6px 8px; text-align: start; vertical-align: top; }
th { color: var(--muted); font-weight: 600; }
td.num, th.num { direction: ltr; text-align: end; font-variant-numeric: tabular-nums; }
.scroll { overflow-x: auto; }
.bars .row { display: grid; grid-template-columns: minmax(150px, 230px) 1fr 82px; gap: 10px; align-items: center; margin: 6px 0; }
.bars .track { background: var(--code); border-radius: 6px; height: 18px; position: relative; overflow: hidden; direction: ltr; }
.bars .fill { position: absolute; inset-inline-start: 0; top: 0; bottom: 0; background: var(--accent); border-radius: 6px; }
.bars .fill.small { background: var(--muted); opacity: .55; }
.bars .mag { direction: ltr; text-align: end; font-variant-numeric: tabular-nums; font-size: 14px; }
.pill { display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: 14px; background: var(--code); margin: 2px; direction: ltr; }
.pill.on { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.verdict { margin-top: 8px; font-weight: 600; }
.ok { color: var(--good); } .bad { color: var(--warn); }
svg.plot { width: 100%; height: auto; display: block; direction: ltr; }
svg.plot text { font-family: inherit; font-size: 12px; fill: var(--muted); }
svg.plot .axis { stroke: var(--muted); stroke-width: 1; }
svg.plot .gridl { stroke: var(--line); stroke-width: 1; }
canvas.field { width: 100%; height: auto; border-radius: 8px; border: 1px solid var(--line); direction: ltr; display: block; }
.legend { display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: 14px; color: var(--muted); }
.legend > span::before { content: ""; display: inline-block; width: 14px; height: 3px; margin-inline-end: 6px; vertical-align: middle; background: var(--c, var(--accent)); }
.two { display: grid; gap: 16px; grid-template-columns: 1fr; }
@media (min-width: 860px) { .two { grid-template-columns: 1fr 1fr; } }
.toc { columns: 2 220px; font-size: 15px; }
.video { width: 100%; border-radius: 10px; background: #000; }
footer { max-width: 1100px; margin: 0 auto; padding: 20px 16px 40px; color: var(--muted); font-size: 14px; border-top: 1px solid var(--line); }
details { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 8px 14px; margin: 10px 0; }
details summary { cursor: pointer; font-weight: 600; }
.status { font-size: 14px; color: var(--muted); min-height: 1.4em; }
code { background: var(--code); padding: 1px 6px; border-radius: 5px; direction: ltr; unicode-bidi: isolate; }
@media (max-width: 600px) {
  body { font-size: 16px; }
  h1 { font-size: 1.6rem; }
  .bars .row { grid-template-columns: 1fr 70px; }
  .bars .row .track { grid-column: 1 / -1; grid-row: 2; }
}
