/* World model lab. Chart colours: the dataviz reference palette (validated, light + dark). */
:root {
  color-scheme: light;
  --page: #eef0f3;
  --surface: #fcfcfb;
  --ink: #15171b;
  --ink-2: #4c5058;
  --muted: #898781;
  --grid: #e1e0d9;
  --axis: #c3c2b7;
  --ring: rgba(21, 23, 27, 0.10);
  --s-ft: #2a78d6;        /* fine-tune, 1000 steps */
  --s-base: #eb6834;      /* base model */
  --s-ft250: #1baf7a;     /* fine-tune, 250 steps */
  --yard: #898781;        /* yardsticks */
  --good: #0ca30c; --warn: #fab219; --bad: #d03b3b;
  --good-ink: #006300;
  --monitor: #0f1418;
  --monitor-ink: #d6e2da;
  --radius: 10px;
  font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root {
    color-scheme: dark;
    --page: #111214;
    --surface: #1a1a19;
    --ink: #f0efec;
    --ink-2: #c3c2b7;
    --grid: #2c2c2a;
    --axis: #383835;
    --ring: rgba(255, 255, 255, 0.10);
    --s-ft: #3987e5; --s-base: #d95926; --s-ft250: #199e70;
    --good-ink: #0ca30c;
    --monitor: #060809;
  }
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--page); color: var(--ink); line-height: 1.45; font-size: 15px; }
h1, h2, h3 { line-height: 1.2; margin: 0; }
h1 { font-size: 1.55rem; font-weight: 700; letter-spacing: -0.01em; }
h2 { font-size: 1.2rem; font-weight: 650; margin-bottom: 0.3rem; }
h3 { font-size: 0.98rem; font-weight: 620; }
.muted { color: var(--ink-2); }
.lead { max-width: 72ch; margin: 0 0 1rem; }
a { color: var(--s-ft); }
button:focus-visible, select:focus-visible, input:focus-visible, summary:focus-visible, [tabindex]:focus-visible {
  outline: 2px solid var(--s-ft); outline-offset: 2px;
}
.top { display: flex; justify-content: space-between; align-items: flex-start; gap: 1rem;
  max-width: 1240px; margin: 0 auto; padding: 1.6rem 1.25rem 0.6rem; }
.brand p { margin: 0.35rem 0 0; max-width: 70ch; }
main { max-width: 1240px; margin: 0 auto; padding: 0 1.25rem 4rem; }
.block { padding: 1.6rem 0 0.4rem; border-top: 1px solid var(--grid); margin-top: 1.4rem; }
.btn { font: inherit; border-radius: 8px; padding: 0.45rem 0.9rem; cursor: pointer; border: 1px solid var(--axis);
  background: var(--surface); color: var(--ink); }
.btn.primary { background: var(--s-ft); border-color: var(--s-ft); color: #fff; font-weight: 600; }
.btn.ghost { background: transparent; }
.btn:disabled { opacity: 0.5; cursor: default; }

/* run status */
.status { max-width: 1240px; margin: 0.6rem auto 0; padding: 0.9rem 1.25rem; display: grid;
  grid-template-columns: 1fr auto; gap: 0.4rem 1rem; align-items: center; }
.status .line { font-weight: 600; }
.status .sub { grid-column: 1 / -1; color: var(--ink-2); font-size: 0.92rem; }
.bar { grid-column: 1 / -1; height: 8px; border-radius: 4px; background: var(--grid); overflow: hidden; }
.bar > span { display: block; height: 100%; background: var(--s-ft); border-radius: 4px; }
.note { border-radius: 8px; padding: 0.55rem 0.8rem; margin: 0.4rem 0; grid-column: 1 / -1; font-size: 0.93rem; }
.note.crit { background: color-mix(in srgb, var(--bad) 12%, transparent); border: 1px solid var(--bad); }
.note.info { background: color-mix(in srgb, var(--s-ft) 8%, transparent); border: 1px solid var(--ring); }

/* split tabs */
.tabs { display: flex; gap: 0.3rem; margin-bottom: 0.9rem; flex-wrap: wrap; }
.tabs button { font: inherit; border: 1px solid var(--axis); background: transparent; color: var(--ink-2);
  border-radius: 999px; padding: 0.3rem 0.85rem; cursor: pointer; }
.tabs button[aria-selected="true"] { background: var(--ink); color: var(--page); border-color: var(--ink); }

/* verdict list */
.verdict { width: 100%; border-collapse: collapse; background: var(--surface); border-radius: var(--radius);
  box-shadow: 0 0 0 1px var(--ring); overflow: hidden; }
.verdict th, .verdict td { text-align: left; padding: 0.62rem 0.8rem; border-bottom: 1px solid var(--grid);
  vertical-align: top; }
.verdict thead th { font-size: 0.85rem; color: var(--ink-2); font-weight: 600; background: transparent; }
.verdict tr:last-child td { border-bottom: 0; }
.verdict td.num { font-variant-numeric: tabular-nums; white-space: nowrap; }
.verdict .what { font-weight: 600; }
.verdict .why { display: block; font-size: 0.85rem; color: var(--ink-2); font-weight: 400; }
.mark { display: inline-flex; align-items: center; gap: 0.35rem; font-weight: 600; white-space: nowrap; }
.mark i { width: 0.8rem; height: 0.8rem; border-radius: 50%; display: inline-block; font-style: normal; }
.mark.good i { background: var(--good); } .mark.good { color: var(--good-ink); }
.mark.bad i { background: var(--bad); } .mark.bad { color: var(--bad); }
.mark.mixed i { background: var(--warn); }
.mark.none i { background: var(--axis); } .mark.none { color: var(--ink-2); }
.foot { font-size: 0.86rem; color: var(--ink-2); margin: 0.6rem 0 0; }

/* charts */
.charts { display: grid; grid-template-columns: repeat(auto-fill, minmax(520px, 1fr)); gap: 1rem; }
#curve-chart .card { max-width: 860px; }
.card { background: var(--surface); border-radius: var(--radius); box-shadow: 0 0 0 1px var(--ring); padding: 0.9rem 1rem; }
.card h3 { margin-bottom: 0.15rem; }
.card .hint { font-size: 0.84rem; color: var(--ink-2); margin: 0 0 0.4rem; }
.legend { display: flex; flex-wrap: wrap; gap: 0.25rem 0.9rem; font-size: 0.84rem; color: var(--ink-2); margin: 0 0 0.8rem; }
.legend span { display: inline-flex; align-items: center; gap: 0.35rem; }
.legend i { width: 10px; height: 10px; border-radius: 50%; display: inline-block; }
.legend i.tick { width: 2px; height: 12px; border-radius: 1px; background: var(--yard); }
svg { display: block; width: 100%; height: auto; overflow: visible; }
svg text { fill: var(--ink-2); font-size: 13px; font-family: inherit; }
svg .val { fill: var(--ink); font-weight: 600; }
svg .grid { stroke: var(--grid); stroke-width: 1; }
svg .axis { stroke: var(--axis); stroke-width: 1; }
svg .zero { stroke: var(--muted); stroke-width: 1.5; }
svg .yard { stroke: var(--yard); stroke-width: 2; stroke-linecap: round; }
svg .hit { fill: transparent; cursor: default; }
details.table { margin-top: 0.5rem; font-size: 0.85rem; }
details.table summary { cursor: pointer; color: var(--ink-2); }
details.table table { border-collapse: collapse; margin-top: 0.4rem; width: 100%; }
details.table th, details.table td { text-align: left; padding: 0.25rem 0.5rem; border-bottom: 1px solid var(--grid);
  font-variant-numeric: tabular-nums; }
.empty { color: var(--ink-2); background: var(--surface); border-radius: var(--radius); box-shadow: 0 0 0 1px var(--ring);
  padding: 1rem; }

/* the video wall: the one bold element */
.filters { display: flex; flex-wrap: wrap; gap: 0.6rem 1rem; align-items: center; margin-bottom: 1rem; }
.filters label { display: inline-flex; gap: 0.4rem; align-items: center; font-size: 0.9rem; color: var(--ink-2); }
.filters select { font: inherit; padding: 0.3rem 0.5rem; border-radius: 6px; border: 1px solid var(--axis);
  background: var(--surface); color: var(--ink); }
.wall { background: var(--monitor); border-radius: 14px; padding: 0.9rem; display: grid; gap: 1.1rem; }
.feed { display: grid; gap: 0.55rem; }
.feed .screens { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0.45rem; }
.screen { position: relative; aspect-ratio: 16 / 9; background: #000; border-radius: 6px; overflow: hidden; }
.screen video { width: 100%; height: 100%; object-fit: cover; display: block; }
.screen .osd { position: absolute; left: 0.45rem; top: 0.35rem; right: 0.45rem; display: flex; justify-content: space-between;
  font: 600 0.72rem/1.2 ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace; color: #fff;
  text-shadow: 0 1px 2px #000, 0 0 3px #000; pointer-events: none; }
.screen .osd .who { padding: 0.1rem 0.35rem; border-radius: 3px; background: rgba(0, 0, 0, 0.45); }
.screen .osd .who.real { box-shadow: inset 3px 0 0 #fff; }
.screen .osd .who.base { box-shadow: inset 3px 0 0 var(--s-base); }
.screen .osd .who.ft { box-shadow: inset 3px 0 0 var(--s-ft); }
.screen .novideo { position: absolute; inset: 0; display: grid; place-items: center; color: var(--monitor-ink);
  font-size: 0.85rem; opacity: 0.7; }
.feed .ctrl { display: flex; align-items: center; gap: 0.7rem; color: var(--monitor-ink); font-size: 0.84rem; }
.feed .ctrl button { font: inherit; border: 1px solid #2c3a40; background: #18232a; color: var(--monitor-ink);
  border-radius: 6px; padding: 0.25rem 0.7rem; cursor: pointer; min-width: 4.6rem; }
.feed .ctrl input[type=range] { flex: 1; accent-color: var(--s-ft); }
.feed .ctrl .clock { font-variant-numeric: tabular-nums; min-width: 6.5rem; text-align: right; }
.feed .facts { display: flex; flex-wrap: wrap; gap: 0.2rem 1.1rem; color: #9fb0b6; font-size: 0.82rem; }
.feed .facts b { color: var(--monitor-ink); font-weight: 600; }
.feed .facts .cap { flex-basis: 100%; color: #7f9298; }
.more { margin-top: 0.8rem; }

/* sweep + glossary */
.sweep { width: 100%; border-collapse: collapse; background: var(--surface); border-radius: var(--radius);
  box-shadow: 0 0 0 1px var(--ring); overflow: hidden; font-size: 0.92rem; }
.sweep th, .sweep td { padding: 0.5rem 0.7rem; border-bottom: 1px solid var(--grid); text-align: right;
  font-variant-numeric: tabular-nums; }
.sweep th:first-child, .sweep td:first-child { text-align: left; }
.sweep thead th { color: var(--ink-2); font-weight: 600; font-size: 0.84rem; }
.gloss { display: grid; grid-template-columns: minmax(180px, 260px) 1fr; gap: 0.55rem 1.4rem; max-width: 980px; }
.gloss dt { font-weight: 600; }
.gloss dd { margin: 0; color: var(--ink-2); }
.tip { position: fixed; z-index: 10; pointer-events: none; background: var(--ink); color: var(--page); border-radius: 6px;
  padding: 0.35rem 0.55rem; font-size: 0.82rem; max-width: 280px; box-shadow: 0 2px 8px rgba(0,0,0,0.25); }

/* sign-in page */
body.login { display: grid; place-items: center; min-height: 100vh; }
.login-box { background: var(--surface); padding: 1.6rem; border-radius: 12px; box-shadow: 0 0 0 1px var(--ring);
  width: min(360px, 92vw); display: grid; gap: 0.8rem; }
.login-box .f { display: grid; gap: 0.3rem; font-size: 0.9rem; color: var(--ink-2); }
.login-box input { font: inherit; padding: 0.55rem 0.6rem; border-radius: 8px; border: 1px solid var(--axis);
  background: var(--page); color: var(--ink); }

@media (max-width: 760px) {
  .feed .screens { grid-template-columns: 1fr; }
  .gloss { grid-template-columns: 1fr; }
  .verdict .hide-sm { display: none; }
  .charts { grid-template-columns: 1fr; }
  svg text { font-size: 19px; }
}
@media (prefers-reduced-motion: reduce) { * { scroll-behavior: auto !important; } }
