:root {
  --bg: #0b1018; --panel: #121a26; --panel2: #172233; --line: #ffffff14;
  --text: #e8edf4; --muted: #9aa7b8; --gold: #f2b33d; --teal: #38c6c0;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); }
body { font: 16px/1.55 system-ui, -apple-system, "Segoe UI", Roboto, Ubuntu, sans-serif; }
a { color: var(--gold); }
a:hover { color: #ffd27a; }

.hero { position: relative; min-height: 520px; display: flex; align-items: flex-end; overflow: hidden; border-bottom: 1px solid var(--line); }
.hero-img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: 70% 30%; }
.hero::after { content: ""; position: absolute; inset: 0; background: linear-gradient(90deg, #0b1018f2 0%, #0b1018cc 42%, #0b101833 75%, #0b101800 100%), linear-gradient(0deg, #0b1018 0%, #0b101800 35%); }
.hero-text { position: relative; z-index: 1; max-width: 640px; padding: 56px 40px 40px; }
.eyebrow { margin: 0; color: var(--teal); letter-spacing: .14em; text-transform: uppercase; font-size: 13px; font-weight: 600; }
h1 { margin: 6px 0 12px; font-size: clamp(44px, 8vw, 76px); line-height: 1; letter-spacing: -.02em; background: linear-gradient(90deg, #ffe2a3, var(--gold) 45%, var(--teal)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.lede { margin: 0 0 12px; color: #d3dbe6; }
.links { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 18px; }
.btn { display: inline-block; padding: 9px 15px; border-radius: 999px; border: 1px solid #ffffff33; color: var(--text); text-decoration: none; font-size: 14px; background: #ffffff0d; backdrop-filter: blur(4px); }
.btn:hover { border-color: var(--gold); color: var(--text); }
.btn.primary { background: var(--gold); border-color: var(--gold); color: #1a1205; font-weight: 600; }

main { max-width: 1180px; margin: 0 auto; padding: 24px 24px 8px; }
.bar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; margin: 8px 0 18px; }
.asof { margin: 0; color: var(--muted); font-size: 14px; }
.window, .share-toggle { display: inline-flex; background: var(--panel); border: 1px solid var(--line); border-radius: 999px; padding: 4px; }
.window button, .share-toggle button { border: 0; background: none; color: var(--muted); font: inherit; font-size: 14px; padding: 6px 14px; border-radius: 999px; cursor: pointer; }
.window button[aria-pressed="true"], .share-toggle button[aria-pressed="true"] { background: var(--panel2); color: var(--text); box-shadow: inset 0 0 0 1px #f2b33d66; }

.tabs { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 18px; border-bottom: 1px solid var(--line); }
.tabs button { border: 0; border-bottom: 2px solid transparent; background: none; color: var(--muted); font: inherit; font-size: 15px; padding: 8px 12px; cursor: pointer; margin-bottom: -1px; }
.tabs button:hover { color: var(--text); }
.tabs button[aria-selected="true"] { color: var(--text); border-bottom-color: var(--gold); }
.tab-panel[hidden] { display: none; }
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; margin-bottom: 18px; }
.kpi { background: linear-gradient(160deg, var(--panel2), var(--panel)); border: 1px solid var(--line); border-radius: 14px; padding: 14px 16px; display: flex; flex-direction: column; gap: 2px; }
.kpi-label { color: var(--muted); font-size: 13px; }
.kpi-value { font-size: 28px; font-weight: 700; font-variant-numeric: tabular-nums; }
.kpi-note { color: var(--muted); font-size: 12px; }
.kpi:nth-child(1) .kpi-value { color: var(--gold); }
.kpi:nth-child(2) .kpi-value { color: var(--teal); }

.card { background: var(--panel); border: 1px solid var(--line); border-radius: 16px; padding: 18px 18px 14px; margin-bottom: 18px; min-width: 0; }
.card h2 { margin: 0 0 4px; font-size: 18px; }
.sub { margin: 0 0 12px; color: var(--muted); font-size: 14px; }
.chart { width: 100%; min-height: 300px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.grid2 .card { margin-bottom: 18px; }
.empty { color: var(--muted); }

.uplot, .uplot * { font-family: inherit; }
.u-legend { color: var(--text); font-size: 13px; }
.u-legend .u-marker { border-radius: 3px; }
.u-select { background: #f2b33d22; }

.share-toggle { margin: 6px 0 10px; }
.donut-wrap { display: flex; align-items: center; gap: 18px; flex-wrap: wrap; }
#donut { width: 200px; height: 200px; flex: none; }
.donut-legend { flex: 1; min-width: 180px; display: flex; flex-direction: column; gap: 6px; }
.leg-row { display: flex; align-items: center; gap: 8px; font-size: 14px; }
.leg-name { flex: 1; overflow-wrap: anywhere; }
.leg-val { font-variant-numeric: tabular-nums; color: var(--muted); }
.sw { display: inline-block; width: 11px; height: 11px; border-radius: 3px; flex: none; margin-right: 6px; vertical-align: -1px; }

.heat { display: grid; grid-template-columns: 34px repeat(24, 1fr); gap: 2px; font-size: 11px; color: var(--muted); }
.hh { text-align: left; height: 16px; }
.hd { line-height: 18px; }
.hc { height: 18px; border-radius: 3px; background: var(--gold); }

.mcards { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(300px, 100%), 1fr)); gap: 12px; }
.mcard { background: linear-gradient(160deg, var(--panel2), var(--panel)); border: 1px solid var(--line); border-radius: 14px; padding: 14px 16px; display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.mhead { display: flex; flex-direction: column; gap: 2px; }
.mhead h3 { margin: 0; font-size: 17px; color: var(--gold); }
.mid { color: var(--muted); font-size: 12px; overflow-wrap: anywhere; }
.mdesc { margin: 0; font-size: 14px; color: #d3dbe6; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { display: inline-flex; flex-direction: column; align-items: flex-start; gap: 1px; padding: 5px 10px; border-radius: 10px; border: 1px solid #ffffff26; background: #ffffff0a; color: var(--text); font: inherit; font-size: 12px; cursor: pointer; text-align: left; }
.chip:hover, .chip:focus-visible { border-color: var(--teal); }
.chip code, .also code { color: var(--teal); font-size: 13px; }
.chip span { color: var(--muted); }
.also { margin: 0; color: var(--muted); font-size: 12px; overflow-wrap: anywhere; }
.mprice { display: grid; grid-template-columns: auto 1fr; gap: 3px 10px; margin: 0; font-size: 13px; }
.mprice dt { color: var(--muted); }
.mprice dd { margin: 0; text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.mcap, .mmeta, .muse { margin: 0; color: var(--muted); font-size: 12px; }
.mcap { margin-bottom: -4px; text-transform: uppercase; letter-spacing: .04em; font-size: 11px; }
.muse { color: var(--text); }

.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { padding: 8px 7px; border-bottom: 1px solid var(--line); text-align: right; white-space: nowrap; }
#models th { white-space: normal; vertical-align: bottom; }
th { color: var(--muted); font-weight: 500; font-size: 13px; }
th:first-child, td.model { text-align: left; }
td.num { font-variant-numeric: tabular-nums; }
tbody tr:hover { background: #ffffff06; }
.hbar { display: inline-block; height: 8px; border-radius: 4px; background: linear-gradient(90deg, var(--gold), var(--teal)); vertical-align: middle; }
.bar-col { width: 30%; text-align: left; }
#speed .bar-col .hbar { max-width: 100%; }
#top td.share { text-align: left; min-width: 160px; }
#top td.share .hbar { width: 0; max-width: 110px; margin-right: 8px; }
#top td.rank { text-align: center; width: 2.5em; }
#top th:nth-child(2) { text-align: left; }
.tid { color: var(--teal); font-size: 13px; }
.recipe { margin-top: 14px; }
.recipe summary { cursor: pointer; color: var(--gold); }
.recipe pre { margin: 8px 0 10px; padding: 12px 14px; background: var(--bg); border: 1px solid var(--line); border-radius: 12px; overflow-x: auto; }
.recipe pre code { color: var(--text); font-size: 13px; }
.recipe code { color: var(--teal); }

.about { display: grid; grid-template-columns: 300px 1fr; gap: 22px; align-items: start; }
.about img { width: 100%; height: auto; border-radius: 12px; }
.about ul { margin: 8px 0 12px; padding-left: 20px; color: #d3dbe6; }
.about li { margin-bottom: 6px; }
.data-links { color: var(--muted); font-size: 14px; }

footer { max-width: 1180px; margin: 0 auto; padding: 8px 24px 40px; color: var(--muted); font-size: 13px; }

/* API page (api.html, served at /v1) */
.hero-short { min-height: 420px; }
.endpoint { margin: 14px 0 0; }
.endpoint code { display: inline-block; padding: 8px 14px; border-radius: 10px; background: #0b1018cc; border: 1px solid var(--gold); color: var(--gold); font-size: 17px; overflow-wrap: anywhere; }
.doc code { color: var(--teal); font-size: 14px; overflow-wrap: anywhere; }
.doc pre { margin: 0 0 10px; padding: 14px 16px; background: var(--bg); border: 1px solid var(--line); border-radius: 12px; overflow-x: auto; }
.doc pre code { color: var(--text); font-size: 13px; overflow-wrap: normal; }
.doc .card { margin-bottom: 18px; }
.methods th, .methods td { text-align: left; white-space: normal; }
.methods td:first-child { white-space: nowrap; }
.doc-list { margin: 8px 0 0; padding-left: 20px; color: #d3dbe6; }
.doc-list li { margin-bottom: 8px; }

@media (max-width: 820px) {
  .grid2, .about { grid-template-columns: 1fr; }
  .hero { min-height: 0; }
  .hero::after { background: linear-gradient(0deg, #0b1018 25%, #0b1018b3 60%, #0b101866 100%); }
  .hero-text { padding: 160px 16px 24px; }
  main, footer { padding-left: 16px; padding-right: 16px; }
  .heat { grid-template-columns: 30px repeat(24, 1fr); gap: 1px; font-size: 9px; }
  .kpi-value { font-size: 24px; }
  #top td.share { min-width: 0; }
  #top td.share .hbar { display: none; }
  #top th, #top td { padding: 8px 4px; font-size: 13px; }
  #top .tid { font-size: 12px; }
  .methods thead { display: none; }
  .methods tr { display: block; padding: 8px 0; border-bottom: 1px solid var(--line); }
  .methods td { display: block; border: 0; padding: 2px 4px; }
  .methods td:first-child { white-space: normal; }
}
