: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;
  --violet: #7a5cc2;
  --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; --violet: #a58be6;
    --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; --violet: #a58be6;
  --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; margin-bottom: .55em; }
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 { display: inline-flex; align-items: center; gap: 9px; font-weight: 700; text-decoration: none; color: var(--text); white-space: nowrap; flex: none; }
.brand-mark { width: 26px; height: 26px; border-radius: 7px; display: block; }
.brand-txt 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 9px; 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, .install-btn { border: 1px solid var(--line); background: var(--surface); color: var(--text); border-radius: 8px; padding: 5px 9px; cursor: pointer; font-size: .85rem; flex: none; }
.theme-btn, .install-btn { height: 32px; min-width: 34px; }
.install-btn { display: inline-flex; align-items: center; justify-content: center; padding: 0 8px; }
.install-btn[hidden] { display: none; }
.install-btn svg { width: 16px; height: 16px; }
html { scroll-padding-top: 76px; }

/* phone menu: custom dropdown */
.mnav-btn { display: none; flex: 1 1 auto; min-width: 0; max-width: 360px; align-items: center; gap: 10px; height: 40px; padding: 0 8px 0 6px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); color: var(--text); font: inherit; font-weight: 650; text-align: left; cursor: pointer; }
.mnav-btn:hover { border-color: color-mix(in srgb, var(--accent) 45%, var(--line)); }
.mnav-btn[aria-expanded="true"] { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.mnav-cur { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mnav-chev { flex: none; display: grid; place-items: center; width: 26px; height: 26px; border-radius: 8px; color: var(--muted); transition: transform .18s ease; }
.mnav-chev svg { width: 18px; height: 18px; }
.mnav-btn[aria-expanded="true"] .mnav-chev { transform: rotate(180deg); color: var(--accent); }
.mnav-badge { flex: none; width: 28px; height: 28px; border-radius: 8px; display: grid; place-items: center; background: var(--c, var(--accent)); color: #fff; font-size: .8rem; font-weight: 800; line-height: 1; }
.mnav-badge.ico { background: var(--surface-2); color: var(--muted); }
/* dark theme colours are light, so numbers on them get dark text */
:root[data-theme="dark"] .mnav-badge:not(.ico), :root[data-theme="dark"] .chapters .n { color: #15171a; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .mnav-badge:not(.ico), :root:not([data-theme="light"]) .chapters .n { color: #15171a; } }
.mnav-badge svg { width: 16px; height: 16px; }
.mnav-btn .mnav-badge { width: 26px; height: 26px; }
.mnav-panel { position: absolute; top: calc(100% + 6px); left: 10px; width: min(440px, calc(100% - 20px)); max-height: calc(100vh - 76px); max-height: calc(100dvh - 76px); overflow-y: auto; overscroll-behavior: contain; padding: 8px; background: var(--surface); border: 1px solid var(--line); border-radius: 16px; box-shadow: 0 18px 50px rgba(0,0,0,.2), 0 2px 6px rgba(0,0,0,.06); opacity: 0; visibility: hidden; transform: translateY(-6px) scale(.985); transform-origin: 30% top; transition: opacity .16s ease, transform .16s ease, visibility 0s linear .16s; }
.mnav-panel.open { opacity: 1; visibility: visible; transform: none; transition-delay: 0s; }
.mnav-item { display: flex; align-items: center; gap: 12px; width: 100%; padding: 8px 10px; border: 0; border-radius: 11px; background: none; color: var(--text); font: inherit; text-align: left; text-decoration: none; cursor: pointer; }
.mnav-item[hidden] { display: none; }
.mnav-item:hover { background: var(--surface-2); }
.mnav-item:focus-visible, .mnav-sub button:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.mnav-item.active { background: var(--accent-soft); }
.mnav-item.active b { color: var(--accent); }
.mnav-txt { flex: 1; min-width: 0; }
.mnav-txt b { display: block; font-weight: 650; line-height: 1.3; }
.mnav-txt small { display: block; color: var(--muted); font-size: .8rem; line-height: 1.35; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mnav-sub { display: grid; gap: 1px; margin: 4px 0 8px 23px; padding-left: 14px; border-left: 2px solid var(--line); }
.mnav-sub button { display: flex; align-items: baseline; gap: 10px; width: 100%; padding: 7px 10px; border: 0; border-radius: 8px; background: none; color: var(--muted); font: inherit; font-size: .9rem; line-height: 1.35; text-align: left; cursor: pointer; }
.mnav-sub button:hover { background: var(--surface-2); color: var(--text); }
.mnav-sub .n { flex: none; min-width: 14px; font-size: .74rem; font-weight: 800; }
.mnav-sub button.on { color: var(--accent); font-weight: 650; background: color-mix(in srgb, var(--accent-soft) 55%, transparent); }
.mnav-sep { margin: 8px 0 2px; padding: 12px 10px 4px; border-top: 1px solid var(--line); font-size: .7rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.mnav-foot:has(> :not([hidden])) { margin-top: 8px; padding-top: 8px; border-top: 1px solid var(--line); }
.mnav-shade { position: fixed; inset: 0; z-index: 9; background: rgba(12,14,17,.34); opacity: 0; visibility: hidden; transition: opacity .16s ease, visibility 0s linear .16s; }
.mnav-shade.open { opacity: 1; visibility: visible; transition-delay: 0s; }
html.mnav-open { overflow: hidden; }
@media (max-width: 1180px) {
  .nav { display: none; }
  .mnav-btn { display: flex; }
  .install-btn { padding: 0; width: 40px; height: 40px; border-radius: 12px; }
  .theme-btn { width: 40px; height: 40px; padding: 0; border-radius: 12px; font-size: .95rem; }
  .topbar .wrap { gap: 10px; min-height: 60px; }
}
@media (max-width: 560px) { .brand-txt { display: none; } }
@media (prefers-reduced-motion: reduce) { .mnav-panel, .mnav-shade, .mnav-chev { transition: none; } }

.install-help { width: min(420px, calc(100vw - 32px)); padding: 22px; border: 1px solid var(--line); border-radius: 16px; background: var(--surface); color: var(--text); box-shadow: 0 20px 60px rgba(0,0,0,.25); }
.install-help::backdrop { background: rgba(12,14,17,.45); }
.install-help h2 { margin: 0 0 12px; font-size: 1.15rem; padding: 0; }
.install-help ol { margin: 0 0 12px; padding-left: 20px; }
.install-help li { margin-bottom: 6px; }
.install-help p { font-size: .88rem; }
.install-help form { display: flex; justify-content: flex-end; }
.install-help button { font: inherit; font-weight: 650; color: #fff; background: var(--accent); border: 0; border-radius: 9px; padding: 9px 18px; cursor: pointer; }

main { padding: 28px 0 64px; }
main.wrap { padding-top: 40px; 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: 16px; }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
@media (max-width: 680px) { .g2 { grid-template-columns: 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: 20px; 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: 14px 18px; border-radius: 0 10px 10px 0; margin: 18px 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: 24px 0 48px; 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: 12px 16px; margin: 10px 0; }
details summary { cursor: pointer; font-weight: 600; }
.src a { word-break: break-all; }

/* ---- shared page components (v2) ---- */
.page-head { margin-bottom: 30px; }
.page-head .eyebrow { margin-bottom: 6px; }
.page-head h1 { margin-bottom: 14px; }
.oneliner { font-size: clamp(1.08rem, 2.2vw, 1.3rem); line-height: 1.55; color: var(--text); max-width: 860px; border-left: 4px solid var(--accent); padding: 4px 0 4px 18px; margin: 0; }
.facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 12px; margin: 0 0 8px; }
.fact { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px; }
.fact .k { font-size: .74rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 700; }
.fact .v { font-size: 1.15rem; font-weight: 750; margin: 2px 0; line-height: 1.25; }
.fact .d { font-size: .85rem; color: var(--muted); }
.fact.alert { border-color: var(--bad); background: var(--bad-soft); }
.fact.alert .v { color: var(--bad); }
.tldr { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px 22px; margin: 28px 0; }
.tldr h2 { margin: 0 0 10px; font-size: 1.1rem; }
.tldr ol { margin: 0; padding-left: 20px; }
.tldr li { margin-bottom: 8px; }
.tldr li:last-child { margin-bottom: 0; }
section.block { margin-top: 56px; }
section.block > h2 { margin-top: 0; margin-bottom: 16px; display: flex; align-items: baseline; gap: 10px; }
section.block > h2 .num { font-size: .8rem; font-weight: 800; color: #fff; background: var(--accent); border-radius: 6px; padding: 2px 8px; }
.section-lead { color: var(--muted); margin: -6px 0 18px; max-width: 820px; }
.pagenav { display: flex; justify-content: space-between; gap: 12px; margin-top: 56px; padding-top: 20px; border-top: 1px solid var(--line); flex-wrap: wrap; }
.pagenav a { text-decoration: none; color: var(--accent); font-weight: 650; }
.mini-bars { display: grid; gap: 8px; }
.mini-bars .r { display: grid; grid-template-columns: minmax(150px, 230px) 1fr 52px; gap: 10px; align-items: center; font-size: .9rem; }
.mini-bars .r .bar { margin: 0; height: 10px; }
.mini-bars .r .p { text-align: right; font-weight: 700; white-space: nowrap; }
@media (max-width: 680px) { main.wrap { padding-top: 28px; } section.block { margin-top: 44px; } .card { padding: 16px; } }
@media (max-width: 560px) { .mini-bars .r { grid-template-columns: 1fr auto; } .mini-bars .r .bar { grid-column: 1 / -1; grid-row: 2; } }

/* tables that become stacked rows on phones */
@media (max-width: 600px) {
  table.stack thead { display: none; }
  table.stack, table.stack tbody, table.stack tr, table.stack td { display: block; width: 100%; }
  table.stack tr { padding: 10px 0; border-bottom: 1px solid var(--line); }
  table.stack tr:last-child { border-bottom: 0; }
  table.stack td { border: 0 !important; padding: 3px 14px; white-space: normal !important; background: none !important; }
  table.stack td[data-label]::before { content: attr(data-label); display: block; font-size: .72rem; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); margin-top: 4px; }
  table.stack td:first-child { font-size: 1rem; }
  table.stack td:first-child::before { display: none; }
}

@media (max-width: 560px) { .facts { grid-template-columns: 1fr 1fr; gap: 10px; } .fact { padding: 12px; } .fact .v { font-size: 1.02rem; } }
