:root {
  color-scheme: light;
  --page: #e9e7e1;
  --surface: #f4f2ed;
  --surface-2: #e6e4dd;
  --ink: #1d1d1b;
  --ink-2: #4d4c49;
  --muted: #7d7b75;
  --grid: #dcd9d1;
  --axis: #bdbab0;
  --border: rgba(11, 11, 11, 0.10);
  --open: #2a78d6;
  --api: #eb6834;
  --open-soft: rgba(42, 120, 214, 0.10);
  --api-soft: rgba(235, 104, 52, 0.12);
  --frontier: #1d1d1b;
  --band: rgba(98, 80, 214, 0.07);
  --band-ink: #6250d6;
  --jev: #b8401a;
  --accent: #2a78d6;
  --hero-1: #0f1b2d;
  --hero-2: #17325a;
  --hero-ink: #f3f6fb;
  --hero-ink-2: #b7c6dc;
  --row-hover: rgba(42, 120, 214, 0.06);
  --row-sel: rgba(42, 120, 214, 0.13);
  --shadow: 0 1px 2px rgba(11, 11, 11, 0.04), 0 4px 16px rgba(11, 11, 11, 0.04);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --page: #1d1e21;
    --surface: #26272b;
    --surface-2: #313237;
    --ink: #dcdad3;
    --ink-2: #b3b1a9;
    --muted: #8e8c86;
    --grid: #36373c;
    --axis: #4a4b51;
    --border: rgba(255, 255, 255, 0.10);
    --open: #3987e5;
    --api: #d95926;
    --open-soft: rgba(57, 135, 229, 0.16);
    --api-soft: rgba(217, 89, 38, 0.18);
    --frontier: #dcdad3;
    --band: rgba(144, 133, 233, 0.10);
    --band-ink: #9085e9;
  --jev: #e8835a;
    --jev: #e8835a;
    --accent: #3987e5;
    --hero-1: #16202f;
    --hero-2: #1d3150;
    --row-hover: rgba(57, 135, 229, 0.08);
    --row-sel: rgba(57, 135, 229, 0.18);
    --shadow: none;
  }
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --page: #1d1e21;
  --surface: #26272b;
  --surface-2: #313237;
  --ink: #dcdad3;
  --ink-2: #b3b1a9;
  --muted: #8e8c86;
  --grid: #36373c;
  --axis: #4a4b51;
  --border: rgba(255, 255, 255, 0.10);
  --open: #3987e5;
  --api: #d95926;
  --open-soft: rgba(57, 135, 229, 0.16);
  --api-soft: rgba(217, 89, 38, 0.18);
  --frontier: #dcdad3;
  --band: rgba(144, 133, 233, 0.10);
  --band-ink: #9085e9;
  --accent: #3987e5;
  --hero-1: #16202f;
  --hero-2: #1d3150;
  --row-hover: rgba(57, 135, 229, 0.08);
  --row-sel: rgba(57, 135, 229, 0.18);
  --shadow: none;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--page);
  color: var(--ink);
  font: 15px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
code { font: 0.92em ui-monospace, SFMono-Regular, Menlo, monospace; }

.wrap { max-width: 1200px; margin: 0 auto; padding: 0 16px; }

/* Hero */
.hero {
  background: linear-gradient(135deg, var(--hero-1), var(--hero-2));
  color: var(--hero-ink);
  padding: 14px 0 16px;
}
.hero-inner { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.hero h1 { font-size: clamp(20px, 2.6vw, 26px); line-height: 1.15; margin: 0 0 2px; letter-spacing: -0.02em; }
.lead { color: var(--hero-ink-2); margin: 0 0 6px; font-size: 14px; }
.lead a { color: var(--hero-ink); }
.meta { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 12px; color: var(--hero-ink-2); font-size: 12.5px; }
.meta a { color: var(--hero-ink); }
.meta .dot {
  width: 8px; height: 8px; border-radius: 50%; background: #2fbf4a; position: relative; flex: none;
  animation: live-pulse 2s ease-in-out infinite;
}
.meta .dot::after {
  content: ""; position: absolute; inset: -4px; border-radius: 50%; border: 2px solid #2fbf4a;
  animation: live-ring 2s ease-out infinite;
}
.meta .dot.warn { background: #fab219; animation: none; }
.meta .dot.warn::after { display: none; }
@keyframes live-pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.45; } }
@keyframes live-ring { 0% { transform: scale(0.6); opacity: 0.8; } 100% { transform: scale(1.6); opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .meta .dot, .meta .dot::after { animation: none; } }
.meta .sep { opacity: 0.4; }
.icon-btn {
  display: inline-grid; place-items: center; flex: none;
  width: 32px; height: 32px; border-radius: 9px;
  border: 1px solid rgba(255, 255, 255, 0.18); background: transparent; color: var(--hero-ink); cursor: pointer;
}
.icon-btn:hover { background: rgba(255, 255, 255, 0.08); }

main { margin-top: 14px; display: grid; gap: 16px; }

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: var(--shadow);
  padding: 16px;
  min-width: 0;
}
h2 { font-size: 17px; margin: 0; letter-spacing: -0.01em; }
h3 { font-size: 14px; margin: 0 0 4px; }

/* Toolbar */
.toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 16px; position: relative; }
.seg { display: inline-flex; background: var(--surface-2); border-radius: 10px; padding: 3px; gap: 2px; flex-wrap: wrap; }
.seg button {
  border: 0; background: transparent; color: var(--ink-2); font: inherit; font-size: 14px;
  padding: 6px 12px; border-radius: 8px; cursor: pointer; white-space: nowrap;
}
.seg button[aria-selected="true"] { background: var(--surface); color: var(--ink); font-weight: 600; box-shadow: 0 1px 2px rgba(0, 0, 0, 0.12); }
.filters { display: flex; flex-wrap: wrap; gap: 8px; margin-left: auto; }
.search {
  display: inline-flex; align-items: center; gap: 6px; color: var(--muted);
  border: 1px solid var(--border); border-radius: 9px; padding: 0 10px; background: var(--surface);
}
.search input { border: 0; outline: 0; background: transparent; color: var(--ink); font: inherit; font-size: 14px; padding: 7px 0; width: 170px; }
select {
  font: inherit; font-size: 14px; color: var(--ink); background: var(--surface);
  border: 1px solid var(--border); border-radius: 9px; padding: 6px 8px; max-width: 100%;
}
.view-note { flex-basis: 100%; margin: 0; font-size: 13px; color: var(--ink-2); }
.view-note:empty { display: none; }

/* Chart */
.chart-head { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 10px 16px; align-items: flex-start; }
.sub { margin: 2px 0 0; color: var(--ink-2); font-size: 13px; }
.presets { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  font: inherit; font-size: 13px; color: var(--ink-2); background: var(--surface);
  border: 1px solid var(--border); border-radius: 999px; padding: 4px 11px; cursor: pointer;
}
.chip:hover { border-color: var(--accent); color: var(--ink); }
.chip[aria-pressed="true"] { background: var(--ink); color: var(--surface); border-color: var(--ink); }
.axis-pick { display: flex; flex-wrap: wrap; gap: 8px 16px; align-items: center; font-size: 13px; color: var(--ink-2); }
.chart-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px 28px; margin-top: 14px; }
.panel { min-width: 0; }
.panel-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 6px 10px; }
.panel-title { font-size: 15px; margin: 0; }
.panel-axes { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.panel-axes select { font-size: 13px; padding: 4px 6px; }
.panel-axes .times { color: var(--muted); }
.panel-sub { margin: 4px 0 6px; color: var(--muted); font-size: 12.5px; }
.vh { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
@media (max-width: 900px) { .chart-grid { grid-template-columns: minmax(0, 1fr); } .panel-sub { min-height: 0; } }
.axis-pick label { display: inline-flex; align-items: center; gap: 6px; }
.check input { accent-color: var(--accent); }
.chart { width: 100%; position: relative; }
.chart svg { display: block; width: 100%; overflow: visible; }
.chart .grid line { stroke: var(--grid); }
.chart .grid .domain { display: none; }
.chart .axis .domain, .chart .axis line { stroke: var(--axis); }
.chart .axis text { fill: var(--muted); font-size: 12px; font-variant-numeric: tabular-nums; }
.chart .axis-title { fill: var(--ink-2); font-size: 12px; }
.chart .ref line { stroke: var(--muted); stroke-dasharray: 3 4; stroke-width: 1; }
.chart .ref text { fill: var(--muted); font-size: 11px; }
.chart .band-label { fill: var(--band-ink); font-size: 11px; font-weight: 600; }
.chart .frontier-path { fill: none; stroke: var(--frontier); stroke-width: 2; stroke-linejoin: round; opacity: 0.85; }
.chart .frontier-path.dashed { stroke-dasharray: 5 4; opacity: 0.7; }
.chart .frontier-path.dotted { stroke-dasharray: 1.5 4; stroke-linecap: round; opacity: 0.75; }
.chart .jev-line line { stroke: var(--jev); stroke-width: 1.5; stroke-dasharray: 6 3; }
.chart .jev-line text { fill: var(--jev); font-size: 11px; font-weight: 600; paint-order: stroke; stroke: var(--surface); stroke-width: 3px; }
.chart .whisker { fill: none; stroke: var(--ink); stroke-width: 1.5; pointer-events: none; }
.tie { color: var(--muted); margin-right: 3px; cursor: help; }
.chart .frontier-fill { fill: var(--frontier); opacity: 0.035; }
.chart .pt { cursor: pointer; transition: opacity 120ms; }
.chart .pt.dim { opacity: 0.16; }
.chart .lbl { font-size: 11.5px; fill: var(--ink); paint-order: stroke; stroke: var(--surface); stroke-width: 3.5px; stroke-linejoin: round; pointer-events: none; }
.chart .lbl.front { font-weight: 600; }
.chart .hover-ring { fill: none; stroke: var(--ink); stroke-width: 2; pointer-events: none; }
.chart .empty { fill: var(--muted); font-size: 14px; }
.legend { display: flex; flex-wrap: wrap; gap: 6px 18px; font-size: 13px; color: var(--ink-2); margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--grid); align-items: center; }
.legend .sw { display: inline-block; vertical-align: -2px; margin-right: 6px; }
.frontier { margin-top: 8px; font-size: 12.5px; color: var(--ink-2); line-height: 1.7; }
.frontier b { color: var(--ink); }
.frontier .f-item { white-space: nowrap; }
.frontier .f-arrow { color: var(--muted); margin: 0 4px; }

/* Table */
.table-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 10px; }
.count { color: var(--muted); font-weight: 400; font-size: 14px; margin-left: 4px; }
.ghost-btn {
  font: inherit; font-size: 13px; color: var(--ink-2); background: transparent;
  border: 1px solid var(--border); border-radius: 9px; padding: 5px 10px; cursor: pointer;
}
.ghost-btn:hover { color: var(--ink); border-color: var(--accent); }
.table-scroll { overflow-x: auto; margin: 0 -16px; padding: 0 16px; }
table { border-collapse: collapse; width: 100%; font-size: 14px; min-width: 860px; }
thead th {
  position: sticky; top: 0; background: var(--surface); z-index: 1;
  text-align: left; font-weight: 600; font-size: 12px; color: var(--muted);
  text-transform: uppercase; letter-spacing: 0.04em;
  border-bottom: 1px solid var(--axis); padding: 8px 10px; white-space: nowrap; cursor: pointer; user-select: none;
}
thead th.num { text-align: right; }
thead th:hover { color: var(--ink); }
thead th .arr { display: inline-block; width: 10px; margin-left: 3px; color: var(--accent); }
tbody td { border-bottom: 1px solid var(--grid); padding: 9px 10px; vertical-align: middle; }
tbody td.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
tbody td.rk { color: var(--muted); font-variant-numeric: tabular-nums; width: 36px; }
tbody tr { cursor: pointer; }
tbody tr:hover { background: var(--row-hover); }
tbody tr.sel { background: var(--row-sel); }
td.best { font-weight: 700; }
.m-name { display: flex; align-items: center; gap: 8px; min-width: 230px; }
.m-name .sw { flex: none; }
.m-name a, .m-name span.nm { color: var(--ink); font-weight: 600; }
.m-name a:hover { color: var(--accent); }
.m-sub { font-size: 12px; color: var(--muted); margin-top: 1px; display: flex; flex-wrap: wrap; gap: 4px 6px; align-items: center; }
.m-sub a { color: var(--muted); }
.m-meta { display: none; font-size: 12px; color: var(--ink-2); margin-top: 2px; font-variant-numeric: tabular-nums; }
.coarse-only { display: none; }
@media (pointer: coarse) { .coarse-only { display: block; } .fine-only { display: none; } }
.m-sub a:hover { color: var(--accent); }
.badge {
  display: inline-block; font-size: 11px; line-height: 16px; padding: 0 6px; border-radius: 999px;
  border: 1px solid var(--border); color: var(--ink-2); white-space: nowrap;
}
.badge.open { background: var(--open-soft); border-color: transparent; color: var(--ink); }
.badge.api { background: var(--api-soft); border-color: transparent; color: var(--ink); }
.badge.pareto { border-color: var(--ink); color: var(--ink); font-weight: 600; }
.badge.fit { border-style: dashed; }
.badge.moved { border-color: var(--band-ink); color: var(--band-ink); }
.badge.moved:hover { text-decoration: none; background: var(--band); }
.moved-note { color: var(--muted); }
.acc-cell { display: flex; align-items: center; justify-content: flex-end; gap: 8px; }
.acc-bar { width: 64px; height: 6px; border-radius: 3px; background: var(--surface-2); position: relative; overflow: hidden; flex: none; }
.acc-bar i { position: absolute; left: 0; top: 0; bottom: 0; border-radius: 3px; background: var(--accent); }
.acc-bar i.over { background: var(--band-ink); }
.note { color: var(--muted); font-size: 12px; }
.nil { color: var(--muted); }

/* Notes */
.notes-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 16px 24px; margin-top: 12px; }
.notes p { margin: 0; color: var(--ink-2); font-size: 14px; }

.foot { color: var(--muted); font-size: 13px; padding-top: 18px; padding-bottom: 32px; }

/* Tooltip */
.tip {
  position: fixed; z-index: 10; pointer-events: none;
  background: var(--surface); color: var(--ink); border: 1px solid var(--border);
  border-radius: 10px; box-shadow: 0 8px 28px rgba(0, 0, 0, 0.18);
  padding: 10px 12px; font-size: 13px; max-width: 320px;
}
.tip .t-name { font-weight: 650; font-size: 14px; margin-bottom: 2px; }
.tip .t-sub { color: var(--muted); font-size: 12px; margin-bottom: 8px; }
.tip dl { display: grid; grid-template-columns: auto 1fr; gap: 2px 12px; margin: 0; }
.tip dt { color: var(--muted); }
.tip dd { margin: 0; text-align: right; font-variant-numeric: tabular-nums; }
.tip .t-kind { margin-top: 8px; color: var(--ink-2); font-size: 12px; }

@media (max-width: 640px) {
  .hero { padding: 12px 0 14px; }
  .lead { font-size: 13px; }
  .meta #commit { display: none; }
  main { gap: 12px; margin-top: 12px; }
  .toolbar { gap: 10px; }
  .seg { width: 100%; }
  .seg button { flex: 1 1 auto; padding: 6px 8px; font-size: 13px; }
  .filters { margin-left: 0; width: 100%; }
  .search { flex: 1 1 100%; }
  .search input { width: 100%; }
  .filters select { flex: 1 1 0; min-width: 0; }
  .card { padding: 12px; border-radius: 12px; }
  .chart-grid { gap: 22px; margin-top: 8px; }
  .panel-head { gap: 6px; }
  .panel-axes { width: 100%; }
  .panel-axes label { flex: 1 1 0; min-width: 0; }
  .panel-axes select { width: 100%; }
  .legend { gap: 4px 12px; font-size: 12px; }
  .table-scroll { margin: 0 -12px; padding: 0 12px; }
  table { min-width: 0; font-size: 13.5px; }
  .c-params, .c-kl, .c-brier, .c-ece, .c-lat, .c-price { display: none; }
  .m-meta { display: block; }
  .m-sub .badge.pareto, .m-sub .via, .m-sub > a { display: none; }
  .meta .sep { display: none; }
  .meta { gap: 4px 10px; }
  .m-name { min-width: 0; }
  thead th, tbody td { padding: 8px 6px; }
  .acc-bar { width: 40px; }
  .notes-grid { gap: 12px; }
}

/* Link-preview card (?og), captured at 1200x630 */
.og .toolbar, .og .table-card, .og .notes, .og .foot, .og .chart-head, .og .panel-axes, .og .panel-sub,
.og .icon-btn, .og .meta #commit { display: none !important; }
.og .hero { padding: 18px 0 16px; }
.og .hero h1 { font-size: 30px; }
.og .lead { font-size: 16px; }
.og main { margin-top: 12px; }
.og .chart-grid { margin-top: 0; }
.og .legend { margin-top: 6px; padding-top: 8px; }
