:root {
  color-scheme: light;
  --page: #f9f9f7;
  --surface: #fcfcfb;
  --ink: #0b0b0b;
  --ink-2: #52514e;
  --muted: #898781;
  --grid: #e1e0d9;
  --axis: #c3c2b7;
  --border: rgba(11, 11, 11, 0.10);
  --s1: #2a78d6;   /* London */
  --s2: #eb6834;   /* comparison place */
  --s3: #1baf7a;
  --s4: #eda100;
  --neg: #e34948;
  --gray-1: #b9b8b0;
  --gray-2: #dcdbd4;
  --accent-wash: rgba(42, 120, 214, 0.08);
  --seq-0: #cde2fb; --seq-1: #9ec5f4; --seq-2: #6da7ec; --seq-3: #3987e5; --seq-4: #256abf; --seq-5: #184f95; --seq-6: #0d366b;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --page: #0d0d0d; --surface: #1a1a19; --ink: #f0efec; --ink-2: #c3c2b7; --muted: #898781;
    --grid: #2c2c2a; --axis: #383835; --border: rgba(255, 255, 255, 0.10);
    --s1: #3987e5; --s2: #d95926; --s3: #199e70; --s4: #c98500; --neg: #e66767;
    --gray-1: #6b6a64; --gray-2: #3d3d3a; --accent-wash: rgba(57, 135, 229, 0.12);
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --page: #0d0d0d; --surface: #1a1a19; --ink: #f0efec; --ink-2: #c3c2b7; --muted: #898781;
  --grid: #2c2c2a; --axis: #383835; --border: rgba(255, 255, 255, 0.10);
  --s1: #3987e5; --s2: #d95926; --s3: #199e70; --s4: #c98500; --neg: #e66767;
  --gray-1: #6b6a64; --gray-2: #3d3d3a; --accent-wash: rgba(57, 135, 229, 0.12);
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--page); color: var(--ink);
  font: 16px/1.5 system-ui, -apple-system, "Segoe UI", sans-serif;
}
.page { max-width: 1120px; margin: 0 auto; padding: 32px 16px 64px; }
a { color: var(--s1); }
.nowrap { white-space: nowrap; }

.hero { padding: 24px 0 8px; }
.kicker { color: var(--muted); font-size: 13px; letter-spacing: .04em; text-transform: uppercase; margin: 0 0 8px; }
.hero h1 { font-size: clamp(28px, 4.4vw, 46px); line-height: 1.12; margin: 0 0 16px; font-weight: 700; letter-spacing: -0.01em; max-width: 920px; }
.lede { font-size: 18px; color: var(--ink-2); max-width: 760px; margin: 0 0 12px; }
.byline { color: var(--muted); font-size: 13px; margin: 0; }

.controls {
  position: sticky; top: 0; z-index: 5;
  display: flex; flex-wrap: wrap; gap: 12px 20px; align-items: end;
  background: color-mix(in srgb, var(--page) 92%, transparent); backdrop-filter: blur(6px);
  padding: 14px 0; margin: 16px 0 8px; border-bottom: 1px solid var(--grid);
}
.controls label, .seg legend { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--muted); }
.seg { border: 0; padding: 0; margin: 0; display: flex; gap: 0; flex-wrap: wrap; }
.seg legend { padding: 0; margin-bottom: 4px; float: left; width: 100%; }
select, .seg button, .chips button {
  font: inherit; font-size: 14px; color: var(--ink); background: var(--surface);
  border: 1px solid var(--border); border-radius: 8px; padding: 7px 10px; cursor: pointer;
}
select { max-width: 260px; }
.seg button { border-radius: 0; }
.seg button:first-of-type { border-radius: 8px 0 0 8px; }
.seg button:last-of-type { border-radius: 0 8px 8px 0; border-left: 0; }
.seg button.on, .chips button.on { background: var(--ink); color: var(--surface); border-color: var(--ink); }
.chips { display: flex; gap: 6px; flex-wrap: wrap; margin: 0 0 12px; }
.chips button { border-radius: 999px; padding: 4px 12px; font-size: 13px; }

.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px; margin: 16px 0; }
.tile { background: var(--surface); border: 1px solid var(--border); border-radius: 14px; padding: 16px 18px; }
.tile .label { font-size: 13px; color: var(--ink-2); margin: 0 0 6px; }
.tile .value { font-size: 30px; font-weight: 650; line-height: 1.1; margin: 0; }
.tile.hero-tile .value { font-size: 52px; }
.tile .foot { font-size: 13px; color: var(--muted); margin: 8px 0 0; }
.tiles.inner { margin: 8px 0 0; }

.card { background: var(--surface); border: 1px solid var(--border); border-radius: 16px; padding: 22px 22px 18px; margin: 16px 0; }
.card h2 { font-size: 22px; line-height: 1.25; margin: 0 0 6px; font-weight: 650; }
.card h3 { font-size: 15px; margin: 16px 0 6px; }
.card-head { margin-bottom: 12px; }
.sub { color: var(--ink-2); margin: 0; font-size: 15px; max-width: 820px; }
.note { color: var(--muted); font-size: 13px; margin: 10px 0 0; max-width: 860px; }
figure { margin: 0; min-width: 0; }
figcaption { font-size: 13px; color: var(--ink-2); margin-bottom: 6px; font-weight: 600; }
.duo { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
@media (max-width: 760px) { .duo { grid-template-columns: 1fr; } }
.chart { position: relative; width: 100%; }
.h200 { height: 200px; } .h260 { height: 260px; } .h300 { height: 300px; } .h360 { height: 360px; } .h420 { height: 420px; }

.legend { display: flex; flex-wrap: wrap; gap: 6px 16px; font-size: 13px; color: var(--ink-2); margin: 4px 0 10px; }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend i { display: inline-block; width: 12px; height: 12px; border-radius: 3px; }
.legend i.line { height: 2px; width: 16px; border-radius: 1px; }

.findings { margin: 8px 0 0; padding-left: 0; list-style: none; counter-reset: f; display: grid; gap: 14px; }
.findings li { counter-increment: f; position: relative; padding-left: 44px; color: var(--ink-2); }
.findings li::before {
  content: counter(f); position: absolute; left: 0; top: 0; width: 30px; height: 30px; border-radius: 50%;
  background: var(--accent-wash); color: var(--s1); font-weight: 700; display: grid; place-items: center; font-size: 14px;
}
.findings b { color: var(--ink); }

.stats { display: flex; flex-wrap: wrap; gap: 10px; margin: 0 0 12px; }
.stat { border: 1px solid var(--border); border-radius: 10px; padding: 8px 12px; font-size: 13px; color: var(--ink-2); }
.stat b { display: block; font-size: 20px; color: var(--ink); font-weight: 650; }

.mapwrap { display: grid; grid-template-columns: minmax(0, 440px) 1fr; gap: 20px; align-items: start; }
@media (max-width: 760px) { .mapwrap { grid-template-columns: 1fr; } }
#tilemap { width: 100%; height: auto; }
#tilemap text { font-family: system-ui, -apple-system, "Segoe UI", sans-serif; pointer-events: none; }
.mapkey { font-size: 13px; color: var(--ink-2); }
.ramp { display: flex; height: 10px; border-radius: 5px; overflow: hidden; margin: 6px 0 4px; max-width: 280px; }
.ramp span { flex: 1; }
.ramp-l { display: flex; justify-content: space-between; max-width: 280px; color: var(--muted); font-size: 12px; }

.sliders { display: flex; flex-wrap: wrap; gap: 12px 28px; margin: 4px 0 8px; font-size: 14px; color: var(--ink-2); }
.sliders label { display: flex; align-items: center; gap: 10px; }
input[type=range] { accent-color: var(--s1); width: 180px; }

details { margin-top: 12px; font-size: 14px; }
summary { cursor: pointer; color: var(--ink-2); }
.tablewrap { overflow-x: auto; }
table { border-collapse: collapse; font-size: 13px; margin-top: 8px; min-width: 520px; }
th, td { padding: 6px 10px; border-bottom: 1px solid var(--grid); text-align: right; font-variant-numeric: tabular-nums; }
th:first-child, td:first-child { text-align: left; }
th { color: var(--muted); font-weight: 600; }

.method .cols { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; }
@media (max-width: 760px) { .method .cols { grid-template-columns: 1fr; } }
.method ul { padding-left: 18px; color: var(--ink-2); font-size: 14px; margin: 0; }
.method li { margin-bottom: 6px; }
.sources { font-size: 13px; }
footer { color: var(--muted); font-size: 13px; text-align: center; margin-top: 24px; }
code { font-size: 12px; }

.tip {
  position: fixed; pointer-events: none; z-index: 20; display: none;
  background: var(--surface); color: var(--ink); border: 1px solid var(--border); border-radius: 10px;
  padding: 8px 10px; font-size: 13px; box-shadow: 0 6px 20px rgba(0,0,0,.12); max-width: 280px;
}
.tip b { display: block; margin-bottom: 2px; }
.tip .muted { color: var(--muted); }
