:root {
  --bg: #0d1117; --panel: #161b22; --line: #30363d; --text: #e6edf3; --muted: #8b949e;
  --accent: #2f81f7; --green: #2ea043; --yellow: #d29922; --red: #f85149; --gray: #6e7681;
  color-scheme: dark;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; background: var(--bg); color: var(--text); font: 15px/1.45 system-ui, -apple-system, "Segoe UI", sans-serif; }
header { display: flex; justify-content: space-between; align-items: center; gap: 16px; padding: 16px 24px; border-bottom: 1px solid var(--line); }
h1 { font-size: 20px; margin: 0; }
h2 { font-size: 14px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin: 0 0 12px; }
.sub, .hint { color: var(--muted); margin: 4px 0 0; font-size: 13px; }
#baselineInfo { margin: -4px 0 12px; }
.head-right { display: flex; align-items: center; gap: 12px; }
button.link { background: none; border: 0; color: var(--accent); padding: 4px; text-decoration: underline; }
fieldset.seg span small { display: block; font-size: 11px; opacity: .8; }
.placeholder h3 { margin: 0 0 8px; }
.steps { text-align: left; max-width: 560px; margin: 0 auto 12px; padding-left: 22px; line-height: 1.5; }
.steps li { margin-bottom: 6px; }
.steps .pre-note { display: block; margin: 6px 0; padding: 6px 10px; border-left: 3px solid var(--yellow); background: rgba(210, 153, 34, 0.16); border-radius: 4px; color: #f0f6fc; }
.explain dl { display: grid; grid-template-columns: max-content 1fr; gap: 6px 10px; font-size: 13px; margin: 8px 0; }
.explain dt { font-weight: 600; } .explain dd { margin: 0; color: var(--muted); }
dialog { max-width: 620px; background: var(--panel); color: var(--text); border: 1px solid var(--line); border-radius: 10px; padding: 20px 24px; }
.who { font-size: 13px; color: var(--muted); }
dialog.login { width: min(380px, calc(100vw - 32px)); }
dialog.login h2 { color: var(--text); font-size: 18px; text-transform: none; letter-spacing: 0; }
dialog::backdrop { background: rgba(0,0,0,.6); }
dialog h3 { font-size: 15px; margin: 16px 0 6px; }
.pill { padding: 4px 12px; border-radius: 999px; background: var(--panel); border: 1px solid var(--line); font-size: 13px; white-space: nowrap; }
.pill.live { border-color: var(--green); color: var(--green); }
.pill.err { border-color: var(--red); color: var(--red); }

main { display: grid; grid-template-columns: 300px minmax(0, 1fr) 300px; grid-template-areas: "setup stage results" "setup stage log"; gap: 16px; padding: 16px 24px; align-items: start; }
.setup { grid-area: setup; } .stage { grid-area: stage; } .results { grid-area: results; } .log { grid-area: log; }
@media (max-width: 1200px) { main { grid-template-columns: 300px minmax(0, 1fr); grid-template-areas: "setup stage" "results log"; } }
@media (max-width: 760px) { main { grid-template-columns: 1fr; grid-template-areas: "stage" "setup" "results" "log"; padding: 12px 16px; } header { padding: 12px 16px; } }

.panel { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 16px; }
label { display: block; margin-bottom: 12px; font-size: 13px; color: var(--muted); }
input:not([type=radio]):not([type=checkbox]), select { display: block; width: 100%; margin-top: 4px; padding: 8px 10px; background: var(--bg); color: var(--text); border: 1px solid var(--line); border-radius: 6px; font: inherit; }
input:focus, select:focus, button:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
label.check { display: flex; gap: 8px; align-items: center; color: var(--text); }

fieldset.seg { border: 0; padding: 0; margin: 0 0 12px; display: flex; gap: 0; }
fieldset.seg legend { font-size: 13px; color: var(--muted); margin-bottom: 4px; padding: 0; }
fieldset.seg label { flex: 1; margin: 0; }
fieldset.seg input { position: absolute; opacity: 0; }
fieldset.seg span { display: block; text-align: center; padding: 8px; border: 1px solid var(--line); color: var(--text); cursor: pointer; }
fieldset.seg label:first-of-type span { border-radius: 6px 0 0 6px; }
fieldset.seg label:last-of-type span { border-radius: 0 6px 6px 0; border-left: 0; }
fieldset.seg input:checked + span { background: var(--accent); border-color: var(--accent); }
fieldset.seg input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 1px; }
fieldset:disabled span { opacity: .5; cursor: default; }

.actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
button, .button { padding: 8px 14px; border-radius: 6px; border: 1px solid var(--line); background: #21262d; color: var(--text); font: inherit; cursor: pointer; margin: 0; display: inline-block; }
button:disabled { opacity: .45; cursor: default; }
button.locked { opacity: .45; }   /* greyed out PRE-EVA: still pressable, it opens the pop-up */
button.primary { background: var(--green); border-color: var(--green); color: #fff; font-weight: 600; }
button.danger { color: var(--red); }
kbd { font-size: 11px; color: var(--muted); border: 1px solid var(--line); border-radius: 3px; padding: 0 4px; margin-left: 4px; }
.error { color: var(--red); font-size: 13px; }

.stage { position: relative; background: #000; border-radius: 10px; overflow: hidden; border: 1px solid var(--line); }
#canvas { display: block; width: 100%; height: auto; max-height: 80vh; object-fit: contain; }
.placeholder { position: absolute; inset: 0; display: grid; place-content: safe center; text-align: center; padding: 24px; overflow: auto; }
.stage { min-height: 360px; }

.summary { margin-bottom: 12px; }
.summary .plain { margin: 0 0 8px; font-size: 14px; }
.summary .big { font-size: 28px; font-weight: 700; }
table { width: 100%; border-collapse: collapse; font-size: 13px; font-variant-numeric: tabular-nums; }
th, td { text-align: left; padding: 6px 4px; border-bottom: 1px solid var(--line); }
th { color: var(--muted); font-weight: 500; }
.chip { display: inline-block; padding: 1px 8px; border-radius: 999px; font-size: 12px; font-weight: 600; background: var(--gray); color: #fff; }
.chip.TOO_FAST { background: transparent; border: 1px dashed var(--gray); color: var(--muted); }
.chip.GREEN { background: var(--green); } .chip.YELLOW { background: var(--yellow); color: #111; } .chip.RED, .chip.NO_MOVEMENT { background: var(--red); }
.chip.PRE_TRIAL, .chip.PRE_BASELINE { background: var(--accent); }
.chip.OK { background: var(--green); } .chip.WATCH { background: var(--yellow); color: #111; } .chip.ALERT { background: var(--red); }
.chip.CALIBRATING { background: var(--accent); } .chip.UNKNOWN { background: var(--gray); }
.decision-list { font-size: 12px; margin: 6px 0; display: flex; flex-wrap: wrap; gap: 4px; }
.chip.FALSE_START { background: transparent; border: 1px dashed var(--yellow); color: var(--yellow); }
.chip.INSUFFICIENT_DATA, .chip.NO_PRE, .chip.NO_DATA { background: var(--gray); }
tr.practice td { color: var(--muted); font-style: italic; }
.compare { border: 1px solid var(--line); border-radius: 8px; padding: 12px; margin-bottom: 12px; }
.compare h3 { margin: 0 0 8px; font-size: 14px; }
.compare table td, .compare table th { padding: 4px; white-space: nowrap; font-size: 12px; }
.compare { overflow-x: auto; }
#trialTable td, #trialTable th { white-space: nowrap; }
#trialTable th { font-size: 12px; }
.compare svg { width: 100%; height: auto; display: block; margin-top: 8px; }
.compare .legend { font-size: 12px; color: var(--muted); display: flex; gap: 12px; margin-top: 4px; }
.dot-pre { fill: var(--accent); } .dot-post { fill: var(--yellow); } .dot-axis { stroke: var(--line); }
.dot-label { fill: var(--muted); font-size: 11px; }
label .hint { display: block; }
pre { max-height: 320px; overflow: auto; background: var(--bg); padding: 8px; border-radius: 6px; font-size: 11px; }
details summary { cursor: pointer; color: var(--muted); font-size: 13px; margin-top: 12px; }

/* ---- blink test additions ---- */
code { font-size: 12px; background: rgba(127,127,127,.15); padding: 1px 4px; border-radius: 4px; }
#advanced summary { cursor: pointer; color: var(--muted); font-size: 13px; margin: 4px 0 12px; }
.files { list-style: none; padding: 0; margin: 4px 0; font-size: 13px; }
.files li { display: flex; justify-content: space-between; gap: 8px; padding: 4px 0; border-bottom: 1px solid var(--line); }
.files a { color: var(--accent); }
.files-h { font-size: 13px; margin: 12px 0 4px; }
.pill.ok { border-color: var(--green); color: var(--green); }
.pill.warn { border-color: var(--yellow); color: var(--yellow); }
#compare td, #compare th { white-space: nowrap; }
#compare td.up { color: var(--yellow); } #compare td.down { color: var(--accent); }
canvas.chart { width: 100%; height: auto; border-radius: 6px; margin: 8px 0; background: #fff; }
.stage:fullscreen { display: grid; place-items: center; background: #000; }
.stage:fullscreen #canvas { max-height: 100vh; width: auto; max-width: 100vw; }
