:root {
  color-scheme: light;
  --page: #f9f9f7;
  --surface: #fcfcfb;
  --surface-2: #f3f2ee;
  --ink: #0b0b0b;
  --ink-2: #52514e;
  --muted: #898781;
  --grid: #e1e0d9;
  --axis: #c3c2b7;
  --border: rgba(11, 11, 11, 0.10);
  --series-1: #2a78d6;
  --series-1-soft: #b7d3f6;
  --series-2: #eb6834;
  --neutral: #a9a79f;
  --good: #006300;
  --good-bg: rgba(12, 163, 12, 0.10);
  --warn: #8a5a00;
  --warn-bg: rgba(250, 178, 25, 0.16);
  --bad: #b02c2c;
  --bad-bg: rgba(208, 59, 59, 0.10);
  --accent: #2a78d6;
  --radius: 10px;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --page: #0d0d0d;
    --surface: #1a1a19;
    --surface-2: #232321;
    --ink: #ffffff;
    --ink-2: #c3c2b7;
    --muted: #898781;
    --grid: #2c2c2a;
    --axis: #383835;
    --border: rgba(255, 255, 255, 0.10);
    --series-1: #3987e5;
    --series-1-soft: #184f95;
    --series-2: #d95926;
    --neutral: #6b6a64;
    --good: #0ca30c;
    --good-bg: rgba(12, 163, 12, 0.16);
    --warn: #fab219;
    --warn-bg: rgba(250, 178, 25, 0.14);
    --bad: #e66767;
    --bad-bg: rgba(208, 59, 59, 0.18);
    --accent: #6da7ec;
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --page: #0d0d0d; --surface: #1a1a19; --surface-2: #232321; --ink: #ffffff; --ink-2: #c3c2b7; --muted: #898781;
  --grid: #2c2c2a; --axis: #383835; --border: rgba(255, 255, 255, 0.10); --series-1: #3987e5; --series-1-soft: #184f95;
  --series-2: #d95926; --neutral: #6b6a64; --good: #0ca30c; --good-bg: rgba(12, 163, 12, 0.16); --warn: #fab219;
  --warn-bg: rgba(250, 178, 25, 0.14); --bad: #e66767; --bad-bg: rgba(208, 59, 59, 0.18); --accent: #6da7ec;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--page);
  color: var(--ink);
  font: 14px/1.5 system-ui, -apple-system, "Segoe UI", sans-serif;
}
a { color: inherit; text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; }
.wrap { max-width: 1180px; margin: 0 auto; padding: 0 16px; }

/* header */
header.top { border-bottom: 1px solid var(--border); background: var(--surface); position: sticky; top: 0; z-index: 10; }
header.top .wrap { display: flex; align-items: center; gap: 24px; height: 56px; }
.brand { font-weight: 700; letter-spacing: -0.01em; display: flex; align-items: center; gap: 8px; white-space: nowrap; }
.brand svg { color: var(--series-1); }
nav.main { display: flex; gap: 4px; overflow-x: auto; scrollbar-width: none; }
nav.main a { padding: 6px 10px; border-radius: 8px; color: var(--ink-2); white-space: nowrap; }
nav.main a:hover { background: var(--surface-2); text-decoration: none; }
nav.main a.on { color: var(--ink); background: var(--surface-2); font-weight: 600; }
.asof { margin-left: auto; color: var(--muted); font-size: 12px; white-space: nowrap; }
.demo-banner { background: var(--warn-bg); color: var(--ink); font-size: 13px; border-bottom: 1px solid var(--border); }
.demo-banner .wrap { padding: 8px 16px; }
.demo-banner b { color: var(--warn); }

main { padding: 24px 0 64px; }
h1 { font-size: 26px; line-height: 1.2; margin: 0 0 4px; letter-spacing: -0.02em; }
h2 { font-size: 15px; margin: 0 0 12px; letter-spacing: -0.005em; }
.sub { color: var(--ink-2); margin: 0 0 20px; }
.muted { color: var(--muted); }
.small { font-size: 12px; }

/* filters */
.filters { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; margin: 0 0 16px; }
.seg { display: inline-flex; background: var(--surface-2); border-radius: 9px; padding: 3px; }
.seg a { padding: 4px 12px; border-radius: 7px; color: var(--ink-2); font-size: 13px; }
.seg a:hover { text-decoration: none; color: var(--ink); }
.seg a.on { background: var(--surface); color: var(--ink); font-weight: 600; box-shadow: 0 0 0 1px var(--border); }
select {
  font: inherit; font-size: 13px; color: var(--ink); background: var(--surface); border: 1px solid var(--border);
  border-radius: 8px; padding: 5px 8px;
}
.filters label { display: inline-flex; gap: 6px; align-items: center; color: var(--muted); font-size: 12px; }

/* cards & tables */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; }
.card + .card { margin-top: 16px; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th { text-align: left; font-weight: 600; font-size: 12px; color: var(--muted); padding: 8px 10px; border-bottom: 1px solid var(--grid); white-space: nowrap; }
td { padding: 10px; border-bottom: 1px solid var(--grid); vertical-align: middle; }
tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: var(--surface-2); }
th .sort-link { color: inherit; display: inline-flex; align-items: center; gap: 4px; white-space: nowrap; }
th .sort-link:hover { color: var(--ink); text-decoration: none; }
th .sort-link .arrow { font-size: 10px; opacity: 0.45; }
th.sorted .sort-link { color: var(--ink); }
th.sorted .sort-link .arrow { opacity: 1; color: var(--accent); }
th.num .sort-link { justify-content: flex-end; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
td.rank { color: var(--muted); width: 32px; font-variant-numeric: tabular-nums; }
.niche { font-weight: 600; }
.kw { color: var(--muted); font-size: 12px; margin-top: 2px; }
.score { display: inline-flex; align-items: center; gap: 8px; }
.score .bar { width: 56px; height: 6px; border-radius: 3px; background: var(--surface-2); overflow: hidden; }
.score .bar i { display: block; height: 100%; background: var(--series-1); border-radius: 3px; }
.score b { font-variant-numeric: tabular-nums; min-width: 24px; text-align: right; }
.up { color: var(--good); }
.down { color: var(--bad); }
.pill { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; padding: 2px 8px; border-radius: 999px; white-space: nowrap; }
.pill::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.pill.Low { color: var(--good); background: var(--good-bg); }
.pill.Medium { color: var(--warn); background: var(--warn-bg); }
.pill.High { color: var(--bad); background: var(--bad-bg); }
.tag { display: inline-block; font-size: 11px; padding: 1px 6px; border-radius: 5px; background: var(--surface-2); color: var(--ink-2); }
.spark { display: block; }
.spark path.l { fill: none; stroke: var(--series-1); stroke-width: 1.5; }
.spark path.a { fill: var(--series-1); opacity: 0.12; }
.empty { padding: 48px 16px; text-align: center; color: var(--ink-2); }
.empty code { background: var(--surface-2); padding: 2px 6px; border-radius: 5px; }

/* topic page */
.crumbs { font-size: 13px; color: var(--muted); margin-bottom: 8px; }
.topic-head { display: flex; flex-wrap: wrap; gap: 16px; justify-content: space-between; align-items: flex-end; margin-bottom: 16px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.chip { font-size: 12px; padding: 2px 8px; border-radius: 999px; border: 1px solid var(--border); color: var(--ink-2); }
.chip.rawtag { font-size: 13px; padding: 4px 10px; color: var(--ink); background: var(--surface-2); }
.copy-btn {
  font: inherit; font-size: 12px; color: var(--ink); background: var(--surface); border: 1px solid var(--border);
  border-radius: 8px; padding: 4px 10px; cursor: pointer;
}
.copy-btn:hover { background: var(--surface-2); }
.tiles { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 16px; }
.tile { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 16px; }
.tile .k { color: var(--ink-2); font-size: 12px; }
.tile .v { font-size: 30px; font-weight: 700; letter-spacing: -0.02em; line-height: 1.2; }
.tile .v small { font-size: 14px; color: var(--muted); font-weight: 500; }
.tile .d { color: var(--muted); font-size: 12px; }
.grid2 { display: grid; grid-template-columns: 1.4fr 1fr; gap: 16px; }
.grid2 > * { min-width: 0; }
.why ul { margin: 0; padding-left: 18px; }
.why li { margin: 6px 0; }
.why .summary { background: var(--surface-2); border-radius: 8px; padding: 10px 12px; margin-bottom: 12px; }
.comp { display: grid; grid-template-columns: 120px 1fr 34px; gap: 10px; align-items: center; margin: 8px 0; font-size: 13px; }
.comp .track { height: 8px; background: var(--surface-2); border-radius: 4px; overflow: hidden; }
.comp .track i { display: block; height: 100%; background: var(--series-1); border-radius: 0 4px 4px 0; }
.comp .w { color: var(--muted); font-size: 11px; }
.comp b { text-align: right; font-variant-numeric: tabular-nums; }
.chart { position: relative; width: 100%; }
.chart svg { display: block; width: 100%; overflow: visible; }
.chart .grid line { stroke: var(--grid); }
.chart .axis text { fill: var(--muted); font-size: 11px; font-variant-numeric: tabular-nums; }
.chart .baseline { stroke: var(--axis); }
.chart rect.bar { fill: var(--series-1); }
.chart rect.bar.est { fill: var(--series-1-soft); }
.chart rect.bar.hover { opacity: 0.75; }
.chart path.line { fill: none; stroke-width: 2; }
.chart .xhair { stroke: var(--axis); }
.tip {
  position: absolute; pointer-events: none; background: var(--surface); border: 1px solid var(--border);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12); border-radius: 8px; padding: 6px 10px; font-size: 12px; white-space: nowrap;
  transform: translate(-50%, -100%); margin-top: -8px; display: none; z-index: 5;
}
.tip .tv { font-weight: 700; font-size: 13px; color: var(--ink); }
.tip .tl { color: var(--ink-2); }
.tip .key { display: inline-block; width: 10px; height: 2px; vertical-align: middle; margin-right: 6px; }
.legend { display: flex; gap: 14px; font-size: 12px; color: var(--ink-2); margin-top: 6px; flex-wrap: wrap; }
.legend span::before { content: ""; display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 6px; vertical-align: -1px; background: var(--c); }
.legend span.line::before { height: 2px; vertical-align: 3px; }
.multiples { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-top: 12px; }
.vids { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 12px; }
.vid { display: flex; flex-direction: column; gap: 6px; }
.thumb { aspect-ratio: 16/9; border-radius: 8px; background: var(--surface-2); overflow: hidden; display: flex; align-items: center; justify-content: center; color: var(--muted); font-size: 12px; }
.thumb img { width: 100%; height: 100%; object-fit: cover; }
.vid .t { font-weight: 600; font-size: 13px; line-height: 1.35; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.vid .m { color: var(--muted); font-size: 12px; }
.related a { display: flex; justify-content: space-between; gap: 12px; padding: 8px 0; border-bottom: 1px solid var(--grid); }
.related a:last-child { border-bottom: 0; }

.site-foot { border-top: 1px solid var(--border); color: var(--muted); font-size: 12px; line-height: 1.6; }
.site-foot .wrap { padding: 16px; max-width: 1180px; }
.estimate-note { color: var(--muted); font-size: 11px; }
.site-foot a { color: inherit; text-decoration: underline; }

/* public pages: about, privacy, terms */
.prose { max-width: 720px; margin: 32px auto 56px; font-size: 15px; line-height: 1.65; }
.prose h1 { font-size: 30px; line-height: 1.2; letter-spacing: -0.02em; margin: 0 0 14px; }
.prose h2 { font-size: 18px; margin: 30px 0 8px; }
.prose p, .prose ul, .prose ol { margin: 0 0 12px; }
.prose ul, .prose ol { padding-left: 22px; }
.prose li { margin-bottom: 6px; }
.prose a { color: var(--accent); text-decoration: underline; }
.prose .lead { font-size: 18px; color: var(--ink-2); }
.prose .updated { color: var(--muted); font-size: 13px; }
.prose .notice { background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius); padding: 12px 14px; }

/* reports */
.report h1 { font-size: 20px; margin: 0 0 8px; }
.report h2, .report h3 { font-size: 15px; margin: 18px 0 8px; }
.report p, .report li { color: var(--ink-2); max-width: 820px; }
.report table { margin: 8px 0 4px; }

/* validation */
.stat-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px; margin-bottom: 16px; }
.hit { font-weight: 600; }
.hit.yes { color: var(--good); }
.hit.no { color: var(--muted); }
.method p, .method li { color: var(--ink-2); max-width: 760px; }
.method code, .mono { font-family: ui-monospace, "Cascadia Mono", Consolas, monospace; font-size: 12.5px; }
.method pre { background: var(--surface-2); padding: 12px 14px; border-radius: 8px; overflow-x: auto; font-size: 12.5px; }

@media (max-width: 900px) {
  .tiles { grid-template-columns: repeat(2, 1fr); }
  .grid2, .multiples { grid-template-columns: 1fr; }
  .hide-m { display: none; }
  .asof { display: none; }
}
@media (max-width: 520px) {
  h1 { font-size: 22px; }
  .tile .v { font-size: 24px; }
  td, th { padding: 8px 6px; }
}
