/* rowergt — one stylesheet. Plain, readable, no framework.
   Chart series take the validated categorical slots 1–3 (blue, orange, aqua),
   with their own dark-mode steps, never a CSS invert. */
:root {
  color-scheme: light dark;
  --bg: #fcfcfb;
  --panel: #ffffff;
  --ink: #0b0b0b;
  --ink-2: #52514e;
  --muted: #6b6a66;
  --line: #e4e3df;
  --grid: #ecebe7;
  --accent: #1c5cab;
  --accent-ink: #ffffff;
  --s1: #2a78d6;
  --s2: #eb6834;
  --s3: #1baf7a;
  --good: #0a7d0a;
  --bad: #c22f2f;
  --warn-bg: #fff4dc;
  --radius: 12px;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #1a1a19;
    --panel: #232322;
    --ink: #f0efec;
    --ink-2: #c3c2b7;
    --muted: #a3a29a;
    --line: #383835;
    --grid: #2e2e2c;
    --accent: #6da7ec;
    --accent-ink: #0b1a2c;
    --s1: #3987e5;
    --s2: #d95926;
    --s3: #199e70;
    --good: #3fbf3f;
    --bad: #e66767;
    --warn-bg: #3a3020;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 16px/1.6 ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
a { color: var(--accent); }
h1 { font-size: clamp(28px, 5vw, 44px); line-height: 1.15; letter-spacing: -0.02em; margin: 0 0 14px; }
h2 { font-size: 24px; letter-spacing: -0.01em; margin: 40px 0 10px; }
h3 { font-size: 18px; margin: 32px 0 8px; }
h4 { margin: 0 0 10px; font-size: 16px; }
p { margin: 0 0 14px; }
.muted { color: var(--muted); }
.small { font-size: 14px; }
.lead { font-size: 19px; color: var(--ink-2); max-width: 60ch; }
.ok { color: var(--good); }
.err { color: var(--bad); }
.warn { background: var(--warn-bg); border-radius: 8px; padding: 10px 14px; }

/* ── frame ── */
.masthead { display: flex; align-items: center; gap: 22px; flex-wrap: wrap; padding: 14px 22px; border-bottom: 1px solid var(--line); }
.wordmark { font-weight: 800; font-size: 20px; letter-spacing: -0.03em; color: var(--ink); text-decoration: none; }
.wordmark span { color: var(--s2); }
.tabs, .more { display: flex; gap: 18px; align-items: center; flex-wrap: wrap; }
.more { margin-left: auto; }
.tabs a, .more a:not(.button) { color: var(--ink-2); text-decoration: none; font-weight: 600; font-size: 15px; }
.tabs a[aria-current="page"], .more a[aria-current="page"] { color: var(--ink); text-decoration: underline; text-underline-offset: 6px; }
main { max-width: 760px; margin: 0 auto; padding: 40px 22px 64px; }
main.wide { max-width: 1040px; }
.siteftr { border-top: 1px solid var(--line); padding: 26px 22px 40px; color: var(--muted); font-size: 14px; text-align: center; }
.siteftr p { margin: 0 0 6px; }

/* ── controls ── */
.button, button.primary {
  display: inline-block; background: var(--accent); color: var(--accent-ink); border: 0; border-radius: 10px;
  padding: 12px 20px; font: inherit; font-weight: 700; text-decoration: none; cursor: pointer;
}
.button.small { padding: 7px 14px; font-size: 14px; }
.button.ghost, button.ghost { background: transparent; color: var(--ink); border: 1px solid var(--line); border-radius: 10px; padding: 11px 18px; font: inherit; font-weight: 600; cursor: pointer; text-decoration: none; }
button:disabled { opacity: .5; cursor: not-allowed; }
.actions { display: flex; gap: 12px; flex-wrap: wrap; margin: 20px 0; align-items: center; }
form.stack { display: grid; gap: 14px; max-width: 520px; }
label { display: grid; gap: 4px; font-weight: 600; font-size: 15px; }
label .hint { font-weight: 400; color: var(--muted); font-size: 13px; }
input, textarea, select {
  font: inherit; color: var(--ink); background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; width: 100%;
}
textarea { min-height: 120px; resize: vertical; }
.hp { position: absolute; left: -10000px; width: 1px; height: 1px; overflow: hidden; }

/* ── home ── */
.hero { padding: 24px 0 8px; }
.points { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 16px; margin: 28px 0; }
.point { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; }
.point h3 { margin: 0 0 6px; font-size: 16px; }
.point p { margin: 0; color: var(--ink-2); font-size: 15px; }
ol.steps { padding-left: 22px; }
ol.steps li { margin-bottom: 10px; }

/* ── analysis ── */
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; margin: 18px 0; }
.tile { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; }
.tile .k { font-size: 13px; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; }
.tile .v { font-size: 30px; font-weight: 800; letter-spacing: -0.02em; }
.tile .v small { font-size: 15px; font-weight: 600; color: var(--muted); }
.tile .n { font-size: 13px; color: var(--muted); }
.stage { position: relative; background: #000; border-radius: var(--radius); overflow: hidden; aspect-ratio: 16 / 9; max-height: 60vh; }
.stage video, .stage canvas { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; }
.progress { height: 6px; background: var(--line); border-radius: 99px; overflow: hidden; margin: 10px 0; }
.progress > span { display: block; height: 100%; width: 0; background: var(--accent); transition: width .2s; }

.chart { margin: 26px 0; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; }
.chart figcaption { display: flex; flex-wrap: wrap; gap: 8px 18px; align-items: baseline; margin-bottom: 8px; }
.legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 14px; color: var(--ink-2); }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.sw { display: inline-block; width: 12px; height: 4px; border-radius: 2px; vertical-align: middle; margin-right: 4px; }
.sw.s1, .seq-bar.s1 { background: var(--s1); }
.sw.s2, .seq-bar.s2 { background: var(--s2); }
.sw.s3, .seq-bar.s3 { background: var(--s3); }
.chart-box { position: relative; }
.chart svg { width: 100%; height: auto; display: block; overflow: visible; touch-action: pan-y; }
.chart .grid { stroke: var(--grid); stroke-width: 1; }
.chart .tick { fill: var(--muted); font-size: 12px; }
.chart .label { fill: var(--ink); font-size: 13px; font-weight: 600; }
.chart .line { fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.chart .line.s1, .chart .dot.s1 { stroke: var(--s1); fill: var(--s1); }
.chart .line.s2, .chart .dot.s2 { stroke: var(--s2); fill: var(--s2); }
.chart .line.s3, .chart .dot.s3 { stroke: var(--s3); fill: var(--s3); }
.chart .line { fill: none !important; }
.chart .dot { stroke: var(--panel); stroke-width: 2; }
.chart .crosshair { stroke: var(--muted); stroke-width: 1; stroke-dasharray: 3 3; }
.tooltip { position: absolute; top: 8px; min-width: 140px; background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; font-size: 13px; box-shadow: 0 4px 16px rgba(0,0,0,.12); pointer-events: none; }
.tooltip div { display: flex; align-items: center; gap: 4px; }
.tooltip b { margin-left: auto; padding-left: 10px; }

.strip { display: flex; flex-wrap: wrap; gap: 6px; margin: 10px 0 16px; }
.chip { min-width: 40px; min-height: 40px; border-radius: 8px; border: 1px solid var(--line); background: var(--panel); color: var(--ink); font: inherit; font-weight: 700; cursor: pointer; position: relative; }
.chip.bad { border: 2px solid var(--bad); }
.chip sup { color: var(--bad); font-size: 11px; margin-left: 2px; }
.chip[aria-pressed="true"] { background: var(--ink); color: var(--bg); }
.stroke-detail { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; }
.seq { display: grid; gap: 8px; margin: 6px 0 14px; }
.seq-row { display: grid; grid-template-columns: 56px 1fr; align-items: center; gap: 10px; font-size: 14px; }
.seq-track { position: relative; height: 12px; background: var(--grid); border-radius: 4px; }
.seq-bar { position: absolute; top: 0; height: 12px; border-radius: 4px; }
.seq-axis .seq-track { background: none; display: flex; justify-content: space-between; font-size: 12px; color: var(--muted); height: auto; }
ul.faults { margin: 0; padding-left: 20px; }

table.data { width: 100%; border-collapse: collapse; font-size: 15px; }
table.data th, table.data td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
table.data th { font-size: 12px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
table.data caption { text-align: left; font-weight: 700; padding: 0 0 6px; }
table.data .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
table.data tr.zero td { color: var(--muted); }
table.data .delta-good { color: var(--good); font-weight: 700; }
table.data .delta-bad { color: var(--bad); font-weight: 700; }
.two { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 20px; }
.table-view { margin: 26px 0; }
.table-view summary { cursor: pointer; font-weight: 600; }
.scroll { overflow-x: auto; }

/* ── sessions ── */
.piece-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 10px; }
.piece-list li { display: grid; grid-template-columns: auto 1fr auto; gap: 12px; align-items: center; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; }
.piece-list .meta { font-size: 14px; color: var(--muted); }
.piece-list input[type="checkbox"] { width: 20px; height: 20px; }
.notes { list-style: none; padding: 0; }
.notes li { border-left: 3px solid var(--line); padding: 4px 12px; margin-bottom: 10px; white-space: pre-wrap; }
.notice { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; margin: 16px 0; }
