/* nodes.dashhq.org. Navy "night network" palette around Dash blue; light and dark are both chosen.
   Series and status colors are roles (see the dataviz reference palette), never raw hex in the JS. */
@font-face {
  font-family: "Archivo"; font-style: normal; font-weight: 100 900; font-stretch: 62% 125%; font-display: swap;
  src: url("/assets/fonts/archivo-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Archivo"; font-style: normal; font-weight: 100 900; font-stretch: 62% 125%; font-display: swap;
  src: url("/assets/fonts/archivo-latin-ext.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
:root {
  color-scheme: light;
  --page: #eef2f7;
  --surface: #ffffff;
  --surface-2: #e4eaf2;
  --ink: #0e1a2b;
  --ink-2: #43536a;
  --muted: #687990;
  --grid: #dae2ec;
  --axis: #b9c6d5;
  --ring: rgba(14, 26, 43, 0.11);
  --brand: #0070c4;
  --brand-ink: #ffffff;
  --s1: #2a78d6; --s2: #eb6834; --s3: #1baf7a; --s4: #eda100; --s5: #e87ba4; --s6: #008300;
  --other: #aab5c3;
  --good: #0ca30c; --warning: #fab219; --serious: #ec835a; --critical: #d03b3b;
  --none: #e2e8f0;
  /* map */
  --ocean: #d5e1ee; --land: #f8fafc; --border-line: #b3c2d3; --state-line: #d3dde8; --label: #6b7c92;
  --shadow: 0 1px 2px rgba(14, 26, 43, .06), 0 8px 28px rgba(14, 26, 43, .10);
  --mono: ui-monospace, "SF Mono", "Cascadia Mono", Menlo, Consolas, monospace;
  --sans: "Archivo", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root:where(:not([data-theme="light"])) {
    color-scheme: dark;
    --page: #0a1321; --surface: #101c2e; --surface-2: #172740;
    --ink: #e8eef6; --ink-2: #a8b7ca; --muted: #7488a2; --grid: #1d2e46; --axis: #2d4262;
    --ring: rgba(170, 200, 235, 0.13); --brand: #3ba3f2; --brand-ink: #06111f;
    --s1: #3987e5; --s2: #d95926; --s3: #199e70; --s4: #c98500; --s5: #d55181; --s6: #008300;
    --other: #4d607a; --good: #22b04b; --none: #1d2e46;
    --ocean: #0a1321; --land: #15243a; --border-line: #2c4060; --state-line: #1d2f48; --label: #6b819e;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 10px 32px rgba(0, 0, 0, .38);
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --page: #0a1321; --surface: #101c2e; --surface-2: #172740;
  --ink: #e8eef6; --ink-2: #a8b7ca; --muted: #7488a2; --grid: #1d2e46; --axis: #2d4262;
  --ring: rgba(170, 200, 235, 0.13); --brand: #3ba3f2; --brand-ink: #06111f;
  --s1: #3987e5; --s2: #d95926; --s3: #199e70; --s4: #c98500; --s5: #d55181; --s6: #008300;
  --other: #4d607a; --good: #22b04b; --none: #1d2e46;
  --ocean: #0a1321; --land: #15243a; --border-line: #2c4060; --state-line: #1d2f48; --label: #6b819e;
  --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 10px 32px rgba(0, 0, 0, .38);
}

* { box-sizing: border-box; }
html { background: var(--page); color: var(--ink); font: 15px/1.5 var(--sans); font-stretch: 100%; -webkit-font-smoothing: antialiased; }
body { margin: 0; min-height: 100vh; display: flex; flex-direction: column; }
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }
code, .mono { font-family: var(--mono); font-size: 0.88em; }
h1 { font-size: 30px; line-height: 1.15; font-weight: 650; font-stretch: 112%; margin: 0; letter-spacing: -0.015em; }
h2 { font-size: 19px; line-height: 1.25; font-weight: 640; font-stretch: 108%; margin: 0; letter-spacing: -0.005em; }
h3 { font-size: 14px; font-weight: 600; margin: 0 0 8px; color: var(--ink-2); }
.sub { color: var(--ink-2); }
.muted { color: var(--muted); }
.num { font-variant-numeric: tabular-nums; }

/* ---- header ---- */
header.top {
  position: sticky; top: 0; z-index: 10;
  background: color-mix(in srgb, var(--page) 88%, transparent);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--ring);
}
.top-inner { max-width: 1280px; margin: 0 auto; padding: 10px 20px; display: flex; align-items: center; gap: 22px; flex-wrap: wrap; }
.brand { display: flex; align-items: center; gap: 9px; color: var(--ink); font-weight: 650; font-size: 15px; }
.brand:hover { text-decoration: none; }
.brand svg { width: 22px; height: 22px; }
.brand small { font-weight: 450; color: var(--muted); font-size: 13px; }
nav.main { display: flex; gap: 2px; }
nav.main a { color: var(--ink-2); padding: 6px 10px; border-radius: 6px; font-weight: 500; }
nav.main a:hover { background: var(--surface-2); text-decoration: none; color: var(--ink); }
nav.main a[aria-current="page"] { color: var(--ink); background: var(--surface-2); }
.top-right { margin-left: auto; display: flex; align-items: center; gap: 12px; }
.net-badge { font-size: 11.5px; font-weight: 650; padding: 2px 7px; border-radius: 999px; background: color-mix(in srgb, var(--warning) 25%, transparent); color: var(--ink); }
.more-toggle { display: none; font: inherit; background: none; border: 0; color: var(--ink-2); padding: 6px; border-radius: 8px; cursor: pointer; margin-left: auto; }
.more-toggle svg { width: 20px; height: 20px; display: block; }
/* Phones and small tablets: one header row (logo, nav, menu button); the rest drops down from the
   button. Same breakpoint as the map's bottom sheet, so the map never gets a two-row header. */
@media (max-width: 900px) {
  /* 16px keeps iOS from zooming the page when a field gets focus. */
  input[type="search"], select { font-size: 16px; }
  .top-inner { flex-wrap: nowrap; gap: 6px; padding: 6px 10px; position: relative; }
  .brand span, .brand small { display: none; }
  .brand svg { width: 26px; height: 26px; }
  nav.main { overflow-x: auto; scrollbar-width: none; flex: 1; min-width: 0; }
  nav.main::-webkit-scrollbar { display: none; }
  nav.main a { padding: 7px 8px; white-space: nowrap; font-size: 14px; }
  .more-toggle { display: block; flex: none; }
  .top-right {
    display: none; position: absolute; right: 8px; top: calc(100% + 6px); z-index: 20; margin: 0;
    flex-direction: column; align-items: stretch; gap: 12px; padding: 12px; min-width: 230px;
    background: var(--surface); border-radius: 12px; box-shadow: 0 0 0 1px var(--ring), var(--shadow);
  }
  header.menu-open .top-right { display: flex; }
  .top-right .chain-status { white-space: normal; font-size: 13px; }
  .top-right .seg.net { justify-content: stretch; }
  .top-right .seg.net button { flex: 1; }
  .top-right .theme-toggle { align-self: flex-start; }
}
.chain-status { color: var(--muted); font-size: 12.5px; white-space: nowrap; }
.chain-status .dot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; margin-right: 6px; vertical-align: 1px; background: var(--muted); }
.chain-status .dot.ok { background: var(--good); }
.chain-status .dot.warn { background: var(--warning); }
.stale-bar { background: color-mix(in srgb, var(--warning) 18%, var(--surface)); color: var(--ink); font-size: 13.5px; text-align: center; padding: 7px 16px; border-bottom: 1px solid var(--ring); }
body.app .stale-bar { position: absolute; z-index: 3; top: 12px; left: 50%; transform: translateX(-50%); border-radius: 999px; border: 0; box-shadow: 0 0 0 1px var(--ring), var(--shadow); width: max-content; max-width: calc(100% - 32px); }
/* Clear of the floating panel (16 + 360 + 16 px) on wide screens; centred over the map on phones. */
@media (min-width: 901px) { body.app .stale-bar { left: 392px; transform: none; max-width: calc(100% - 408px); } }

/* segmented control */
.seg { display: inline-flex; background: var(--surface-2); border-radius: 8px; padding: 2px; gap: 2px; }
.seg button {
  font: inherit; font-size: 13px; border: 0; background: transparent; color: var(--ink-2);
  padding: 4px 11px; border-radius: 6px; cursor: pointer;
}
.seg button:hover { color: var(--ink); }
.seg button[aria-pressed="true"] { background: var(--surface); color: var(--ink); box-shadow: 0 0 0 1px var(--ring), 0 1px 2px rgba(0,0,0,.06); font-weight: 550; }
.seg.net button[aria-pressed="true"][data-net="testnet"] { box-shadow: 0 0 0 1px var(--warning); }

main { max-width: 1280px; width: 100%; margin: 0 auto; padding: 22px 20px 48px; flex: 1; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 18px; }
.page-head p { margin: 4px 0 0; }

.banner { border-radius: 8px; padding: 10px 14px; margin-bottom: 16px; background: var(--surface); box-shadow: 0 0 0 1px var(--ring); color: var(--ink-2); }
.banner strong { color: var(--ink); }

/* ---- cards & tiles ---- */
.card { background: var(--surface); border-radius: 10px; box-shadow: 0 0 0 1px var(--ring); padding: 16px 18px; }
.card-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.card-head .sub { font-size: 12.5px; }
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px; margin-bottom: 18px; }
.tile { background: var(--surface); border-radius: 10px; box-shadow: 0 0 0 1px var(--ring); padding: 14px 16px; }
.tile .label { color: var(--ink-2); font-size: 12.5px; }
.tile .value { font-size: 26px; font-weight: 650; font-stretch: 108%; letter-spacing: -0.015em; margin-top: 2px; }
.tile .foot { color: var(--muted); font-size: 12.5px; margin-top: 2px; }

.filters { display: flex; flex-wrap: wrap; gap: 10px 18px; align-items: center; margin: 4px 0 14px; }
.filters label { color: var(--ink-2); font-size: 12.5px; display: flex; align-items: center; gap: 8px; }

/* ---- charts ---- */
.chart { position: relative; }
.chart svg { display: block; width: 100%; overflow: visible; }
.chart svg rect[tabindex] { touch-action: pan-y; } /* sideways drags scrub the chart, vertical ones scroll */
.chart .gridline { stroke: var(--grid); stroke-width: 1; shape-rendering: crispEdges; }
.chart .baseline { stroke: var(--axis); stroke-width: 1; shape-rendering: crispEdges; }
.chart .tick { fill: var(--muted); font-size: 11px; font-variant-numeric: tabular-nums; }
.chart .xhair { stroke: var(--axis); stroke-width: 1; }
.chart.loading { opacity: 0.45; transition: opacity .15s; }
.legend { display: flex; flex-wrap: wrap; gap: 4px 14px; margin-top: 10px; font-size: 12.5px; color: var(--ink-2); }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend i { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }
.legend i.line { height: 2px; width: 14px; border-radius: 1px; }
.tooltip {
  position: absolute; pointer-events: none; z-index: 5; min-width: 150px;
  background: var(--surface); color: var(--ink); border-radius: 8px; padding: 8px 10px;
  box-shadow: 0 0 0 1px var(--ring), 0 6px 20px rgba(0,0,0,.14); font-size: 12.5px;
}
.tooltip .tt-head { color: var(--muted); margin-bottom: 4px; }
.tooltip .tt-row { display: flex; align-items: center; gap: 8px; white-space: nowrap; }
.tooltip .tt-row i { width: 12px; height: 2px; border-radius: 1px; flex: none; }
.tooltip .tt-row b { font-weight: 650; min-width: 44px; text-align: right; font-variant-numeric: tabular-nums; }
.tooltip .tt-row span { color: var(--ink-2); }

/* ---- tables ---- */
.table-wrap { overflow-x: auto; background: var(--surface); border-radius: 10px; box-shadow: 0 0 0 1px var(--ring); }
table.data { border-collapse: collapse; width: 100%; font-size: 13px; }
table.data th, table.data td { padding: 7px 10px; text-align: left; white-space: nowrap; border-bottom: 1px solid var(--grid); }
table.data th { font-weight: 550; color: var(--ink-2); font-size: 12px; position: sticky; top: 0; background: var(--surface); user-select: none; }
table.data th.sortable { cursor: pointer; }
table.data th.sortable:hover { color: var(--ink); }
table.data th[aria-sort="ascending"]::after { content: " ▲"; font-size: 9px; }
table.data th[aria-sort="descending"]::after { content: " ▼"; font-size: 9px; }
table.data td.r, table.data th.r { text-align: right; }
table.data td { font-variant-numeric: tabular-nums; }
table.data tbody tr:hover { background: var(--surface-2); }
table.data tbody tr:last-child td { border-bottom: 0; }
table.kv td:first-child { color: var(--ink-2); width: 210px; }
table.kv td { white-space: normal; word-break: break-all; }

.badge { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; font-weight: 500; color: var(--ink-2); }
.badge i { width: 8px; height: 8px; border-radius: 50%; display: inline-block; flex: none; }
.badge.good i { background: var(--good); }
.badge.warning i { background: var(--warning); }
.badge.serious i { background: var(--serious); }
.badge.critical i { background: var(--critical); }
.badge.none i { background: var(--axis); }
.pill { font-size: 11px; font-weight: 600; padding: 1px 6px; border-radius: 4px; background: var(--surface-2); color: var(--ink-2); }
.pill.evo { box-shadow: inset 0 0 0 1px var(--s1); color: var(--ink); }

input[type="search"], select {
  font: inherit; font-size: 13px; color: var(--ink); background: var(--surface);
  border: 0; box-shadow: 0 0 0 1px var(--ring); border-radius: 7px; padding: 6px 9px;
}
input[type="search"] { min-width: 280px; }
input[type="search"]:focus, select:focus, button:focus-visible { outline: 2px solid var(--brand); outline-offset: 1px; }
.btn { font: inherit; font-size: 13px; border: 0; border-radius: 7px; padding: 6px 12px; cursor: pointer; background: var(--surface); color: var(--ink); box-shadow: 0 0 0 1px var(--ring); }
.btn:hover { background: var(--surface-2); }
.btn:disabled { opacity: .5; cursor: default; }
.pager { display: flex; align-items: center; gap: 10px; justify-content: flex-end; margin-top: 10px; color: var(--ink-2); font-size: 12.5px; }

/* uptime strip */
.strip { display: grid; grid-template-columns: repeat(90, 1fr); gap: 2px; height: 30px; }
.strip div { border-radius: 2px; background: var(--none); }
.strip div.good { background: var(--good); }
.strip div.warning { background: var(--warning); }
.strip div.critical { background: var(--critical); }
.strip-axis { display: flex; justify-content: space-between; color: var(--muted); font-size: 11px; margin-top: 4px; }

.section { margin-top: 22px; }
.section > h2 { margin-bottom: 10px; }
.cols-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(460px, 1fr)); gap: 14px; }

footer.bottom { border-top: 1px solid var(--ring); color: var(--muted); font-size: 12px; }
footer.bottom .inner { max-width: 1280px; margin: 0 auto; padding: 14px 20px; display: flex; gap: 18px; flex-wrap: wrap; justify-content: space-between; }
footer.bottom a { color: var(--ink-2); }

.empty { padding: 28px; text-align: center; color: var(--muted); }
.theme-toggle { font: inherit; background: none; border: 0; color: var(--muted); cursor: pointer; padding: 4px; border-radius: 6px; display: inline-flex; }
.theme-toggle:hover { color: var(--ink); background: var(--surface-2); }
.theme-toggle svg { width: 16px; height: 16px; }

pre.code { background: var(--surface-2); padding: 10px 12px; border-radius: 8px; overflow-x: auto; font-size: 12.5px; margin: 6px 0 0; }
.api-ep { margin-bottom: 18px; }
.api-ep h3 { color: var(--ink); font-family: var(--mono); font-size: 13px; font-weight: 600; }

/* ---- touch: comfortable targets and readable small text ---- */
@media (pointer: coarse), (max-width: 900px) {
  .seg button { min-height: 40px; padding: 6px 12px; }
  .btn { min-height: 42px; }
  .chip { min-height: 40px; }
  nav.main a { display: inline-flex; align-items: center; min-height: 40px; }
  .more-toggle { width: 42px; height: 42px; display: grid; place-items: center; }
  .theme-toggle { width: 40px; height: 40px; justify-content: center; align-items: center; }
  .brand { min-height: 40px; }
  .pager .btn { min-width: 88px; }
  .maplibregl-ctrl-group button { width: 40px !important; height: 40px !important; }
  table.kv a, .mn-list a, footer.bottom a, .ov-lede a, .mp-foot a { display: inline-block; padding: 8px 0; margin: -8px 0; }
  body button.link, .ov-details summary { padding: 10px 0; margin: -10px 0; }
  .ov-details summary { display: block; margin: 0; }
  table.data td a { display: inline-block; padding: 8px 0; margin: -8px 0; }
  .mp-handle { height: 32px; }
  .brand { min-width: 40px; justify-content: center; }
  table.data { font-size: 14px; }
  code, .mono { font-size: 13px; }
}
/* Overview scope tabs: all four visible on phones, two by two. */
@media (max-width: 560px) {
  .scope-bar { flex-direction: column; align-items: stretch; gap: 6px; }
  .scope-bar .seg { display: grid; grid-template-columns: 1fr 1fr; overflow: visible; }
  .scope-bar .seg button { white-space: normal; }
  .chart-head { flex-wrap: wrap; gap: 8px; }
}

/* ---- masternode list on phones: cards instead of the table ---- */
.filters-toggle, .mn-cards, .filters .sort-select { display: none; }
@media (max-width: 760px) {
  .page-head .actions .btn { padding: 8px 12px; }
  .filters-toggle { display: block; width: 100%; margin: 0 0 10px; padding: 10px 12px; text-align: left; }
  .filters { display: none; flex-direction: column; align-items: stretch; gap: 10px; margin: 0 0 14px; }
  .filters.open { display: flex; }
  .filters label { justify-content: space-between; }
  .filters select { flex: 1; max-width: 65%; }
  .filters .sort-select { display: flex; }
  .table-wrap:has(#table) { display: none; }
  .mn-cards { display: grid; grid-template-columns: minmax(0, 1fr); gap: 8px; list-style: none; margin: 0; padding: 0; }
  .mn-card { display: block; padding: 11px 14px; border-radius: 12px; background: var(--surface); box-shadow: 0 0 0 1px var(--ring); color: var(--ink); }
  .mn-card:hover, .mn-card:active { text-decoration: none; background: var(--surface-2); }
  .mn-card-top { display: flex; align-items: center; gap: 8px; }
  .mn-card-version { margin-left: auto; font-weight: 600; font-variant-numeric: tabular-nums; }
  .mn-card-addr { margin-top: 4px; font-size: 14px; }
  .mn-card-sub { margin-top: 3px; color: var(--muted); font-size: 12.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .pager { justify-content: space-between; flex-wrap: wrap; }
  .pager > span:first-child { width: 100%; }
}

/* ---- masternode page on phones ---- */
#lede, .kv .mono, .kv code { overflow-wrap: anywhere; }
.kv td { overflow-wrap: break-word; }
@media (max-width: 760px) {
  main { padding: 16px 14px 40px; }
  h1 { font-size: 26px; }
  .tiles { grid-template-columns: 1fr 1fr; gap: 8px; }
  .tile { padding: 10px 12px; }
  .tile .value { font-size: 20px; }
  .tile .foot { font-size: 12px; }
  .card { padding: 14px; }
  .card-head { flex-wrap: wrap; row-gap: 2px; }
  .cols-2 { grid-template-columns: minmax(0, 1fr); }
  .cols-2 > * { min-width: 0; }
  table.kv, table.kv tbody, table.kv tr, table.kv td { display: block; }
  table.kv tr { padding: 8px 0; border-bottom: 1px solid var(--grid); }
  table.kv tr:last-child { border-bottom: 0; }
  table.kv td { padding: 0 2px; border: 0; }
  table.kv td:first-child { width: auto; font-size: 12.5px; color: var(--muted); margin-bottom: 2px; }
  table.stack thead { display: none; }
  table.stack, table.stack tbody, table.stack tr { display: block; }
  table.stack tr { padding: 8px 12px; border-bottom: 1px solid var(--grid); }
  table.stack td { display: flex; justify-content: space-between; gap: 12px; padding: 3px 0; border: 0; text-align: right; white-space: normal; }
  table.stack td::before { content: attr(data-label); color: var(--muted); text-align: left; }
  .strip { gap: 1px; height: 24px; }
}

/* ---- speed test (masternode page) ---- */
.card.speed { margin-bottom: 14px; }
.speed-grid { display: grid; grid-template-columns: minmax(240px, 1fr) minmax(0, 2.2fr); gap: 24px; align-items: start; }
.speed-summary { display: flex; gap: 16px; align-items: center; }
.grade { width: 64px; height: 64px; border-radius: 14px; display: grid; place-items: center; flex: none;
  font-size: 34px; font-weight: 700; font-stretch: 112%; color: #fff; background: var(--axis); }
.grade-A, .grade-B { background: var(--good); }
.grade-C { background: var(--warning); color: #1d1300; }
.grade-D { background: var(--serious); }
.grade-F { background: var(--critical); }
.speed-score { margin: 0; color: var(--ink-2); }
.speed-score b { font-size: 24px; color: var(--ink); font-weight: 650; }
.speed-summary .sub { margin: 4px 0 0; font-size: 13px; }
.speed-dims { display: grid; grid-template-columns: auto minmax(60px, 1fr) 28px; gap: 6px 10px; align-items: center; margin-top: 18px; font-size: 13px; color: var(--ink-2); }
.speed-dims > div { display: contents; }
.speed-dims .track { height: 6px; background: var(--surface-2); border-radius: 3px; overflow: hidden; }
.speed-dims .track span { display: block; height: 100%; background: var(--brand); border-radius: 3px; }
.speed-dims .num { text-align: right; color: var(--ink); }
@media (max-width: 900px) { .speed-grid { grid-template-columns: 1fr; } }

/* ---- overview ---- */
.small { font-size: 13px; }
.btn.primary { background: var(--brand); color: var(--brand-ink); box-shadow: none; font-weight: 600; }
.btn.primary:hover { background: color-mix(in srgb, var(--brand) 88%, var(--ink)); }
.hero { position: relative; overflow: hidden; border-bottom: 1px solid var(--ring); }
.hero-inner { position: relative; max-width: 1280px; margin: 0 auto; padding: 56px 20px 48px; }
.hero-inner > * { max-width: 520px; }
.hero h1 { font-size: clamp(30px, 4.2vw, 48px); line-height: 1.06; font-weight: 680; font-stretch: 118%; letter-spacing: -0.02em; text-wrap: balance; }
.hero-sub { margin: 16px 0 0; font-size: 17px; color: var(--ink-2); text-wrap: pretty; }
.hero-inner > .hero-stats { max-width: 700px; display: grid; grid-template-columns: repeat(auto-fill, minmax(122px, 1fr)); gap: 18px 24px; margin: 30px 0 0; }
.hero-stats div { border-left: 2px solid var(--grid); padding-left: 12px; }
.hero-stats dt { color: var(--muted); font-size: 13px; }
.hero-stats dd { margin: 2px 0 0; font-size: 24px; font-weight: 650; font-stretch: 110%; line-height: 1.2; }
.hero-stats small { display: block; font-size: 12.5px; font-weight: 450; font-stretch: 100%; color: var(--muted); margin-top: 2px; }
.hero-links { display: flex; gap: 10px; flex-wrap: wrap; margin: 30px 0 0; }
.hero-links .btn { padding: 9px 16px; font-size: 14px; }
.hero-map { position: absolute; top: 4%; right: 1%; width: 60%; height: 92%; pointer-events: none; }
.wm-land { fill: var(--land); stroke: var(--border-line); stroke-width: 0.4; }
.wm-dots circle { fill: var(--brand); fill-opacity: 0.55; stroke: var(--brand); stroke-width: 0.8; animation: dot-in 600ms cubic-bezier(.2, .7, .3, 1) both; animation-delay: var(--d, 0ms); transform-box: fill-box; transform-origin: center; }
@keyframes dot-in { from { opacity: 0; transform: scale(0.2); } }
@media (prefers-reduced-motion: reduce) { .wm-dots circle { animation: none; } }

main.overview { padding-top: 26px; }
.scope-bar { display: flex; align-items: center; gap: 12px; margin-bottom: 8px; }
.scope-bar .seg { overflow-x: auto; max-width: 100%; }
.scope-bar .seg button { white-space: nowrap; }
.ov-section { padding: 34px 0 38px; border-bottom: 1px solid var(--grid); }
.ov-section:last-child { border-bottom: 0; }
.ov-head { max-width: 760px; margin-bottom: 22px; }
.ov-lede { margin: 8px 0 0; font-size: 16px; color: var(--ink-2); text-wrap: pretty; }
.ov-grid { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 6fr); gap: 36px; align-items: start; }
.ov-grid.even { grid-template-columns: 1fr 1fr; }
.ov-grid > *, .speed-grid > * { min-width: 0; }
.ov-grid h3, .speed-vantage h3 { color: var(--ink); font-size: 15px; margin-bottom: 10px; }
.chart-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 8px; }
.chart-head h3 { margin: 0; }
.ov-chart { background: var(--surface); border-radius: 12px; box-shadow: 0 0 0 1px var(--ring); padding: 14px 16px 12px; }

.sharebar { display: flex; gap: 2px; height: 30px; border-radius: 7px; overflow: hidden; }
.sharebar.thin { height: 12px; border-radius: 4px; margin-bottom: 14px; }
.sharebar div { min-width: 3px; }
.share-legend { display: flex; flex-wrap: wrap; gap: 6px 16px; margin: 12px 0 0; font-size: 13.5px; color: var(--ink-2); }
.share-legend > span { display: inline-flex; align-items: center; gap: 7px; }
.share-legend i { width: 10px; height: 10px; border-radius: 3px; }
.share-legend b { color: var(--ink); font-weight: 600; }
#sw-proto { margin: 14px 0 0; }
.ov-details { margin-top: 18px; }
.ov-details summary { cursor: pointer; color: var(--brand); font-size: 14px; }
.ov-details .table-wrap { margin-top: 10px; max-height: 360px; overflow-y: auto; }

.ranked { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: 10px minmax(0, 1.6fr) minmax(40px, 1fr) auto 52px; gap: 7px 10px; align-items: center; font-size: 14px; }
.ranked li { display: contents; }
.ranked i { width: 10px; height: 10px; border-radius: 3px; }
.ranked .k { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ranked .track { height: 8px; background: var(--surface-2); border-radius: 4px; overflow: hidden; }
.ranked .track span { display: block; height: 100%; background: var(--ink-2); opacity: .55; border-radius: 4px; }
.ranked .v { text-align: right; color: var(--ink); }
.ranked .p { text-align: right; color: var(--muted); font-size: 13px; }
#networks { margin-top: 26px; }

@media (max-width: 900px) {
  .hero-map { position: relative; right: auto; width: 100%; height: auto; display: block; margin-top: 8px; }
  .hero-inner { padding-top: 8px; }
  .hero-inner > * { max-width: none; }
  .ov-grid, .ov-grid.even { grid-template-columns: 1fr; gap: 26px; }
}

.speed-vantages { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 28px; }

/* ---- map (full screen under the header) ---- */
.actions { display: flex; gap: 8px; flex-wrap: wrap; }
a.btn { display: inline-block; }
a.btn:hover { text-decoration: none; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
body.app { height: 100vh; height: 100dvh; min-height: 0; overflow: hidden; }
main.map-app { position: relative; flex: 1; max-width: none; padding: 0; min-height: 0; }
.map { position: absolute; inset: 0; background: var(--ocean); }

/* Floating control panel; a bottom sheet on phones. */
.mp {
  position: absolute; z-index: 2; top: 16px; left: 16px; width: 360px; max-height: calc(100% - 32px);
  display: flex; flex-direction: column; background: color-mix(in srgb, var(--surface) 94%, transparent);
  backdrop-filter: blur(10px); border-radius: 14px; box-shadow: 0 0 0 1px var(--ring), var(--shadow);
}
.mp-handle, .mp-node, .mp-filters-button { display: none; } /* phones only; see the sheet rules below */
.mp-head { padding: 14px 16px 10px; }
.mp-head input[type="search"] { width: 100%; min-width: 0; font-size: 14px; padding: 9px 12px; border-radius: 9px; background: var(--page); }
.mp-headline { margin: 12px 0 0; color: var(--ink-2); font-size: 14px; }
.mp-headline b { color: var(--ink); font-weight: 650; font-stretch: 110%; font-size: 16px; }
.mp-body { padding: 4px 16px 14px; overflow-y: auto; }
.mp-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 10px; }
.mp-row h2 { font-size: 16px; }
.mp-label { color: var(--muted); font-size: 13px; }
.mp[data-layer="nodes"] .mn-only { display: none; }
.mp-filters { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 12px; }
.mp-filters select:last-child { grid-column: 1 / -1; }
.mp-filters select { width: 100%; min-width: 0; }
.mp-foot { margin: 14px 0 0; color: var(--muted); font-size: 12.5px; }
.mp-group { margin-top: 14px; padding: 10px 12px; border-radius: 10px; background: var(--surface-2); }
.mp-group .mp-row { margin-top: 0; }
.mp-group .sub { margin: 4px 0 0; font-size: 13px; }
button.link { font: inherit; font-size: 13px; background: none; border: 0; padding: 0; color: var(--brand); cursor: pointer; }
.mn-list { list-style: none; margin: 8px -6px 0; padding: 0; max-height: 300px; overflow-y: auto; font-size: 13px; }
.mn-row { display: flex; align-items: center; gap: 8px; width: 100%; font: inherit; text-align: left; color: var(--ink); background: none; border: 0; padding: 4px 6px; border-radius: 6px; cursor: pointer; }
.mn-row:hover { background: var(--surface); }
.mn-row .muted { margin-left: auto; white-space: nowrap; }

/* Legend chips double as filters. */
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px; }
.chip {
  display: inline-flex; align-items: center; gap: 7px; font: inherit; font-size: 13px; padding: 4px 10px 4px 8px;
  border-radius: 999px; border: 0; background: var(--surface-2); color: var(--ink); cursor: pointer;
}
.chip i { width: 10px; height: 10px; border-radius: 50%; background: var(--tone); flex: none; }
.chip b { font-weight: 600; color: var(--ink-2); }
.chip[aria-pressed="false"] { color: var(--muted); background: transparent; box-shadow: inset 0 0 0 1px var(--ring); }
.chip[aria-pressed="false"] i { background: transparent; box-shadow: inset 0 0 0 1.5px var(--tone); }
.chip.static { cursor: default; }
.t-good { --tone: var(--good); }
.t-critical { --tone: var(--critical); }
.t-serious { --tone: var(--serious); }
.t-axis { --tone: var(--axis); }
.t-other { --tone: var(--other); }
.t-s1 { --tone: var(--s1); } .t-s2 { --tone: var(--s2); } .t-s3 { --tone: var(--s3); }
.t-s4 { --tone: var(--s4); } .t-s5 { --tone: var(--s5); }

/* Cluster donuts: tone shares around the count. */
.donut {
  display: grid; place-items: center; padding: 0; border: 0; border-radius: 50%; cursor: pointer;
  box-shadow: 0 0 0 1.5px var(--land), 0 2px 8px rgba(0, 0, 0, .25);
}
.donut span {
  width: calc(100% - 8px); height: calc(100% - 8px); border-radius: 50%; display: grid; place-items: center;
  background: var(--surface); color: var(--ink); font: 650 12px/1 var(--sans); font-stretch: 105%; font-variant-numeric: tabular-nums;
}
.donut:hover span, .donut:focus-visible span { background: var(--surface-2); }

/* MapLibre, restyled to the page. */
.maplibregl-map { font: inherit; }
.maplibregl-ctrl-group { background: var(--surface) !important; box-shadow: 0 0 0 1px var(--ring), var(--shadow) !important; border-radius: 10px !important; }
.maplibregl-ctrl-group button + button { border-top-color: var(--grid) !important; }
.maplibregl-ctrl-group button:hover { background: var(--surface-2) !important; }
:root[data-theme="dark"] .maplibregl-ctrl-icon { filter: invert(1) brightness(1.4); }
@media (prefers-color-scheme: dark) { :root:where(:not([data-theme="light"])) .maplibregl-ctrl-icon { filter: invert(1) brightness(1.4); } }
.maplibregl-ctrl-attrib { background: color-mix(in srgb, var(--surface) 85%, transparent) !important; color: var(--muted); font-size: 11px; }
.maplibregl-ctrl-attrib a { color: var(--ink-2); }
.maplibregl-ctrl-attrib-button { background-color: var(--surface) !important; }
.mp-popup .maplibregl-popup-content { background: var(--surface); color: var(--ink); border-radius: 12px; padding: 14px 16px 16px; box-shadow: 0 0 0 1px var(--ring), var(--shadow); }
.mp-popup .maplibregl-popup-close-button { color: var(--muted); font-size: 18px; padding: 2px 8px; border-radius: 0 12px 0 8px; }
.mp-popup.maplibregl-popup-anchor-bottom .maplibregl-popup-tip, .mp-popup.maplibregl-popup-anchor-bottom-left .maplibregl-popup-tip, .mp-popup.maplibregl-popup-anchor-bottom-right .maplibregl-popup-tip { border-top-color: var(--surface); }
.mp-popup.maplibregl-popup-anchor-top .maplibregl-popup-tip, .mp-popup.maplibregl-popup-anchor-top-left .maplibregl-popup-tip, .mp-popup.maplibregl-popup-anchor-top-right .maplibregl-popup-tip { border-bottom-color: var(--surface); }
.mp-popup.maplibregl-popup-anchor-left .maplibregl-popup-tip { border-right-color: var(--surface); }
.mp-popup.maplibregl-popup-anchor-right .maplibregl-popup-tip { border-left-color: var(--surface); }
.pop { font-size: 13px; min-width: 250px; }
.pop-head { display: flex; gap: 8px; align-items: center; }
.pop-id { display: block; margin: 6px 0 10px; font-size: 12px; }
.pop dl { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 4px 14px; margin: 0 0 12px; }
.pop dt { color: var(--muted); }
.pop dd { margin: 0; overflow-wrap: anywhere; }
.pop .btn { width: 100%; text-align: center; }

@media (max-width: 900px) {
  .mp {
    top: auto; left: 0; right: 0; bottom: 0; width: auto; max-height: 75%;
    border-radius: 18px 18px 0 0; padding-bottom: env(safe-area-inset-bottom);
    transition: transform .18s ease-out;
  }
  .mp[data-mode="detail"] { max-height: 62%; }
  /* A tall touch target: the whole top strip grabs the sheet. */
  .mp-handle { display: grid; place-items: center; height: 32px; border: 0; background: none; cursor: grab; padding: 0; touch-action: none; }
  .mp-grip { width: 44px; height: 5px; border-radius: 3px; background: var(--axis); }
  .mp-head { padding: 0 14px 10px; }
  .mp-search-row { display: flex; gap: 8px; }
  .mp-search-row input[type="search"] { flex: 1; font-size: 16px; } /* 16px: iOS doesn't zoom the page on focus */
  .mp-search-row .mp-filters-button { display: block; flex: none; }
  .mp-headline { margin-top: 8px; font-size: 13.5px; }
  .mp-headline b { font-size: 15px; }
  .mp-body { padding: 0 14px 14px; }
  .mp[data-mode="peek"] .mp-body { display: none; }
  .mp[data-mode="open"] .mp-filters-button { display: none; }
  .mp[data-mode="detail"] .mp-head { display: none; }
  .mp[data-mode="detail"] .mp-body > :not(.mp-group):not(.mp-node) { display: none; }
  .mp[data-mode="detail"] .mp-group { background: none; padding: 0; margin-top: 0; }
  .mp[data-mode="detail"] .mn-list { max-height: none; }
  .mp-node:not([hidden]) { display: block; }
  .mp-node .pop { min-width: 0; }
  .mn-row { padding: 9px 6px; }
  .chip { padding: 6px 12px 6px 10px; }
  .mp-filters select, .mp .seg button { min-height: 36px; }
  .maplibregl-ctrl-bottom-right { bottom: calc(var(--sheet-h, 120px) + 4px); }
}

@media (max-width: 640px) { input[type="search"] { min-width: 0; width: 100%; } }
@media (forced-colors: active) {
  .sharebar div, .ranked i, .share-legend i, .chip i, .donut, .wm-dots circle { forced-color-adjust: none; }
  .strip div, .legend i { forced-color-adjust: none; }
}
.ov-section:has(+ .ov-section[hidden]) { border-bottom: 0; }
