:root {
  --bg: #f6f4ef;
  --surface: #ffffff;
  --surface-2: #efece4;
  --text: #1d1f22;
  --muted: #5f646b;
  --line: #dcd7cc;
  --accent: #b23a2e;
  --accent-soft: #f6e3e0;
  --good: #2f7d4f;
  --good-soft: #e1f1e7;
  --warn: #a96a00;
  --warn-soft: #fbefd6;
  --bad: #b3261e;
  --bad-soft: #fbe2df;
  --info: #2b5c9a;
  --info-soft: #e2ebf7;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(0,0,0,.04), 0 6px 20px rgba(0,0,0,.05);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #15171a; --surface: #1d2024; --surface-2: #25292e; --text: #e9e7e2; --muted: #a2a7ae;
    --line: #33383e; --accent: #e0705f; --accent-soft: #3a2420;
    --good: #6cc08f; --good-soft: #1e3327; --warn: #e6b04f; --warn-soft: #3a2f18;
    --bad: #f08a80; --bad-soft: #3d2220; --info: #84aee6; --info-soft: #1e2a3b;
    --shadow: none; color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #15171a; --surface: #1d2024; --surface-2: #25292e; --text: #e9e7e2; --muted: #a2a7ae;
  --line: #33383e; --accent: #e0705f; --accent-soft: #3a2420;
  --good: #6cc08f; --good-soft: #1e3327; --warn: #e6b04f; --warn-soft: #3a2f18;
  --bad: #f08a80; --bad-soft: #3d2220; --info: #84aee6; --info-soft: #1e2a3b;
  --shadow: none; color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 16px/1.6 -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Roboto, sans-serif;
}
a { color: var(--accent); }
h1, h2, h3 { line-height: 1.2; margin: 0 0 .5em; letter-spacing: -.01em; }
h1 { font-size: clamp(1.8rem, 4vw, 2.6rem); }
h2 { font-size: 1.45rem; margin-top: 2.2rem; }
h3 { font-size: 1.08rem; }
p { margin: 0 0 .9em; }
small, .muted { color: var(--muted); }
code { background: var(--surface-2); padding: .1em .35em; border-radius: 5px; font-size: .9em; }

.wrap { max-width: 1120px; margin: 0 auto; padding: 0 16px; }

/* nav */
.topbar { position: sticky; top: 0; z-index: 10; background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: blur(8px); border-bottom: 1px solid var(--line); }
.topbar .wrap { display: flex; align-items: center; gap: 12px; min-height: 56px; }
.brand { font-weight: 700; text-decoration: none; color: var(--text); white-space: nowrap; }
.brand span { color: var(--accent); }
.nav { display: flex; gap: 4px; overflow-x: auto; flex: 1; scrollbar-width: none; }
.nav::-webkit-scrollbar { display: none; }
.nav a { text-decoration: none; color: var(--muted); padding: 6px 10px; border-radius: 8px; white-space: nowrap; font-size: .92rem; }
.nav a:hover { background: var(--surface-2); color: var(--text); }
.nav a.active { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.theme-btn { border: 1px solid var(--line); background: var(--surface); color: var(--text); border-radius: 8px; padding: 5px 9px; cursor: pointer; font-size: .85rem; }

main { padding: 28px 0 64px; }
main.wrap { padding-top: 36px; padding-bottom: 72px; }
.eyebrow { text-transform: uppercase; letter-spacing: .08em; font-size: .75rem; color: var(--accent); font-weight: 700; margin-bottom: .4rem; }
.lead { font-size: 1.12rem; color: var(--muted); max-width: 760px; }

/* cards & grids */
.grid { display: grid; gap: 14px; }
.g2 { grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); }
.g3 { grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
.g4 { grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow); }
.card > :last-child { margin-bottom: 0; }
a.card { text-decoration: none; color: inherit; display: block; transition: transform .12s, border-color .12s; }
a.card:hover { transform: translateY(-2px); border-color: var(--accent); }
.card .num { font-size: 2rem; font-weight: 750; line-height: 1; margin-bottom: 6px; }
.card .lbl { color: var(--muted); font-size: .88rem; }

.verdict { background: var(--text); color: var(--bg); border-radius: var(--radius); padding: 24px; margin: 22px 0; }
.verdict h2 { margin-top: 0; color: inherit; }
.verdict p { opacity: .92; }
.verdict strong { color: inherit; }

.callout { border-left: 4px solid var(--info); background: var(--info-soft); padding: 12px 16px; border-radius: 0 10px 10px 0; margin: 14px 0; }
.callout.good { border-color: var(--good); background: var(--good-soft); }
.callout.warn { border-color: var(--warn); background: var(--warn-soft); }
.callout.bad { border-color: var(--bad); background: var(--bad-soft); }
.callout > :last-child { margin-bottom: 0; }

.pill { display: inline-block; font-size: .75rem; font-weight: 650; padding: 2px 9px; border-radius: 999px; background: var(--surface-2); color: var(--muted); vertical-align: middle; }
.pill.good { background: var(--good-soft); color: var(--good); }
.pill.warn { background: var(--warn-soft); color: var(--warn); }
.pill.bad { background: var(--bad-soft); color: var(--bad); }
.pill.info { background: var(--info-soft); color: var(--info); }

ul.clean { list-style: none; padding: 0; margin: 0; }
ul.clean li { padding: 7px 0; border-bottom: 1px dashed var(--line); }
ul.clean li:last-child { border-bottom: 0; }
ul.plus li::before { content: "+ "; color: var(--good); font-weight: 700; }
ul.minus li::before { content: "– "; color: var(--bad); font-weight: 700; }
ul.arrow li::before { content: "→ "; color: var(--accent); font-weight: 700; }

/* tables */
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
table { border-collapse: collapse; width: 100%; font-size: .93rem; }
th, td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { background: var(--surface-2); font-weight: 650; white-space: nowrap; }
tr:last-child td { border-bottom: 0; }

/* bars */
.bar { height: 8px; border-radius: 99px; background: var(--surface-2); overflow: hidden; margin: 6px 0 2px; }
.bar > i { display: block; height: 100%; border-radius: 99px; background: var(--accent); }
.bar.good > i { background: var(--good); } .bar.warn > i { background: var(--warn); } .bar.bad > i { background: var(--bad); }

.range-chart { display: grid; gap: 12px; }
.range-row { display: grid; grid-template-columns: minmax(120px, 190px) 1fr; gap: 10px; align-items: center; font-size: .9rem; }
.range-track { position: relative; height: 26px; background: var(--surface-2); border-radius: 6px; }
.range-fill { position: absolute; top: 5px; bottom: 5px; background: color-mix(in srgb, var(--accent) 35%, transparent); border-radius: 4px; }
.range-mark { position: absolute; top: 0; bottom: 0; width: 3px; background: var(--accent); border-radius: 2px; }
.range-txt { position: absolute; right: 4px; top: 3px; font-size: .75rem; color: var(--muted); background: var(--surface-2); padding: 0 4px; border-radius: 4px; }
.axis { display: flex; justify-content: space-between; font-size: .75rem; color: var(--muted); margin-left: calc(min(190px, 35%) + 10px); }
@media (max-width: 560px) { .range-row { grid-template-columns: 1fr; gap: 2px; } .axis { margin-left: 0; } }

.score { display: inline-flex; gap: 3px; }
.score i { width: 12px; height: 12px; border-radius: 3px; background: var(--surface-2); display: inline-block; }
.score i.on { background: var(--accent); }

blockquote { margin: 10px 0; padding: 8px 14px; border-left: 3px solid var(--line); color: var(--muted); font-style: italic; }

.timeline { position: relative; padding-left: 22px; }
.timeline::before { content: ""; position: absolute; left: 6px; top: 4px; bottom: 4px; width: 2px; background: var(--line); }
.tl-item { position: relative; margin-bottom: 18px; }
.tl-item::before { content: ""; position: absolute; left: -21px; top: 6px; width: 12px; height: 12px; border-radius: 50%; background: var(--accent); border: 2px solid var(--bg); }

.check { display: flex; gap: 10px; align-items: flex-start; padding: 8px 0; border-bottom: 1px dashed var(--line); cursor: pointer; }
.check:last-child { border-bottom: 0; }
.check input { margin-top: 5px; accent-color: var(--accent); width: 17px; height: 17px; flex: none; }
.check.done span { text-decoration: line-through; color: var(--muted); }

.split { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
@media (max-width: 720px) { .split { grid-template-columns: 1fr; } }

.foot { border-top: 1px solid var(--line); padding: 20px 0 40px; color: var(--muted); font-size: .85rem; }
.next-link { display: inline-block; margin-top: 28px; padding: 10px 16px; background: var(--accent); color: #fff; border-radius: 10px; text-decoration: none; font-weight: 600; }
details { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 10px 14px; margin: 8px 0; }
details summary { cursor: pointer; font-weight: 600; }
.src a { word-break: break-all; }
