/* Fine-Tuning Lab
 * Layout: one reading column of "lab benches". Each bench is a simulation window beside its
 * instrument panel, with a run chart beneath. One deliberate night-sky look (no light theme). */
:root {
  --ink: #0b0e1c; --panel: #131830; --raise: #1b2142; --line: #2a3159;
  --fg: #e8e5f3; --muted: #9e9cbb; --faint: #6d6b8c;
  --gold: #f1b54d; --teal: #71c9d9; --ember: #e8684f; --slate: #93a6cc; --violet: #b19cff;
  --display: "Bricolage Grotesque", "Avenir Next", system-ui, sans-serif;
  --body: "IBM Plex Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, "SF Mono", Menlo, monospace;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html { background: var(--ink); }
body {
  margin: 0; background: var(--ink); color: var(--fg); font-family: var(--body); font-size: 15px; line-height: 1.55;
  padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px));
  padding-block: 40px 64px;
}
.wrap { max-width: 1080px; margin: 0 auto; display: flex; flex-direction: column; gap: 56px; }
header.top { display: flex; flex-direction: column; gap: 14px; max-width: 68ch; }
.nocase { text-transform: none; letter-spacing: 0; }
.eyebrow { font-family: var(--mono); font-size: 12px; letter-spacing: .12em; text-transform: uppercase; color: var(--gold); }
h1 { font-family: var(--display); font-weight: 700; font-size: clamp(34px, 6vw, 58px); line-height: 1.02; margin: 0; letter-spacing: -.02em; text-wrap: balance; }
h2 { font-family: var(--display); font-weight: 700; font-size: clamp(24px, 3.4vw, 32px); line-height: 1.1; margin: 0; letter-spacing: -.01em; text-wrap: balance; }
p { margin: 0; }
a { color: var(--teal); }
.lede { color: var(--muted); font-size: 17px; }
.lede b { color: var(--fg); font-weight: 500; }

/* Bench index */
.toc { display: flex; flex-wrap: wrap; gap: 8px; margin: 4px 0 0; padding: 0; list-style: none; }
.toc a {
  display: inline-flex; align-items: baseline; gap: 8px; padding: 6px 12px; border: 1px solid var(--line); border-radius: 999px;
  color: var(--fg); text-decoration: none; font-size: 13.5px; background: var(--panel);
}
.toc a span { font-family: var(--mono); font-size: 11px; color: var(--gold); }
.toc a:hover { border-color: var(--muted); }
.toc a:focus-visible { outline: 2px solid var(--teal); outline-offset: 2px; }

section.bench { display: flex; flex-direction: column; gap: 20px; border-top: 1px solid var(--line); padding-top: 28px; scroll-margin-top: 16px; }
.bench-head { display: flex; flex-direction: column; gap: 10px; max-width: 72ch; }
.bench-head p { color: var(--muted); }
.grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 360px); gap: 20px; align-items: start; }
@media (max-width: 820px) { .grid { grid-template-columns: minmax(0, 1fr); } }
.viewport { position: relative; background: #070914; border: 1px solid var(--line); border-radius: 6px; overflow: hidden; aspect-ratio: 1 / 1; max-width: 100%; }
.viewport canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.viewport .tag { position: absolute; left: 10px; top: 8px; font-family: var(--mono); font-size: 11px; color: var(--faint); letter-spacing: .06em; pointer-events: none; }
.viewport .big { position: absolute; inset: auto 0 14px 0; text-align: center; font-family: var(--display); font-weight: 700; font-size: 22px; color: var(--fg); text-shadow: 0 2px 12px #000; pointer-events: none; }
#alpha .viewport .big { inset: 30px 0 auto 0; }
.panel { display: flex; flex-direction: column; gap: 16px; background: var(--panel); border: 1px solid var(--line); border-radius: 6px; padding: 16px; }
.label { font-family: var(--mono); font-size: 11px; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); }
.presets { display: flex; flex-wrap: wrap; gap: 6px; }
.presets input { position: absolute; opacity: 0; pointer-events: none; }
.presets label { font-size: 13px; padding: 6px 10px; border: 1px solid var(--line); border-radius: 4px; cursor: pointer; background: var(--raise); color: var(--fg); user-select: none; transition: border-color .15s, background .15s; }
.presets label:hover { border-color: var(--muted); }
.presets input:checked + label { background: var(--gold); border-color: var(--gold); color: #1a1405; font-weight: 600; }
.presets input:focus-visible + label { outline: 2px solid var(--teal); outline-offset: 2px; }
.slider-row { display: flex; flex-direction: column; gap: 6px; }
.slider-top { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.slider-top output { font-family: var(--mono); font-size: 14px; color: var(--gold); font-variant-numeric: tabular-nums; text-align: right; }
input[type=range] { width: 100%; accent-color: var(--gold); }
input[type=range]:focus-visible { outline: 2px solid var(--teal); outline-offset: 2px; }
.slider-ends { display: flex; justify-content: space-between; font-family: var(--mono); font-size: 11px; color: var(--faint); }
.hint { font-size: 12.5px; color: var(--muted); line-height: 1.45; }
.buttons { display: flex; gap: 8px; }
button { font-family: var(--body); font-size: 14px; font-weight: 500; padding: 8px 14px; border-radius: 4px; border: 1px solid var(--line); background: var(--raise); color: var(--fg); cursor: pointer; }
button:hover { border-color: var(--muted); }
button:focus-visible { outline: 2px solid var(--teal); outline-offset: 2px; }
button.primary { background: var(--teal); border-color: var(--teal); color: #06171b; }
.readouts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px 14px; margin: 0; }
.readouts div { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.readouts dt { font-family: var(--mono); font-size: 10.5px; letter-spacing: .08em; text-transform: uppercase; color: var(--faint); }
.readouts dd { margin: 0; font-family: var(--mono); font-size: 15px; font-variant-numeric: tabular-nums; color: var(--fg); overflow-wrap: anywhere; }
.milestones { display: flex; flex-direction: column; gap: 6px; list-style: none; margin: 0; padding: 0; }
.milestones li { display: flex; align-items: center; gap: 10px; font-size: 13.5px; color: var(--muted); }
.milestones li::before { content: ""; flex: none; width: 10px; height: 10px; border-radius: 50%; border: 1.5px solid var(--faint); }
.milestones li.yes { color: var(--fg); }
.milestones li.yes::before { background: var(--gold); border-color: var(--gold); box-shadow: 0 0 8px var(--gold); }
.milestones li.no { color: var(--faint); text-decoration: line-through; }
.milestones li.no::before { border-color: var(--ember); background: transparent; }
.milestones li.unk { color: var(--slate); }
.milestones li.unk::before { border-color: var(--slate); border-style: dashed; }
.milestones li span.when { margin-left: auto; font-family: var(--mono); font-size: 12px; color: var(--faint); font-variant-numeric: tabular-nums; }
.verdict { font-size: 14.5px; line-height: 1.5; padding: 12px 14px; border-left: 3px solid var(--faint); background: var(--raise); border-radius: 0 4px 4px 0; min-height: 3em; }
.verdict.good { border-left-color: var(--gold); }
.verdict.warn { border-left-color: var(--slate); }
.verdict.bad { border-left-color: var(--ember); }

/* Composition bar (Hoyle bench) */
.compbar { display: flex; height: 12px; border-radius: 3px; overflow: hidden; background: var(--raise); }
.compbar i { display: block; height: 100%; transition: width .2s linear; }

.chartbox { background: var(--panel); border: 1px solid var(--line); border-radius: 6px; padding: 12px 12px 6px; }
.chartbox canvas { width: 100%; height: 220px; display: block; }
.chartbox.split { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); gap: 16px; align-items: start; }
.chartbox.split > div { min-width: 0; }
@media (max-width: 760px) { .chartbox.split { grid-template-columns: minmax(0, 1fr); } }
.chart-title { font-family: var(--mono); font-size: 11px; letter-spacing: .08em; text-transform: uppercase; color: var(--faint); padding: 2px 4px 6px; }
.legend { display: flex; flex-wrap: wrap; gap: 6px 16px; font-size: 12.5px; color: var(--muted); padding: 2px 4px 8px; }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend i { display: inline-block; width: 16px; height: 3px; border-radius: 2px; }
.legend i.dot { width: 9px; height: 9px; border-radius: 50%; }
.legend i.box { width: 10px; height: 10px; border-radius: 2px; background: transparent; border: 1.5px solid; }
.legend i.dash { background: repeating-linear-gradient(90deg, var(--muted) 0 4px, transparent 4px 7px) !important; height: 2px; }

.notes { display: flex; flex-direction: column; gap: 14px; max-width: 72ch; border-top: 1px solid var(--line); padding-top: 28px; }
.notes ul { margin: 0; padding-left: 20px; display: flex; flex-direction: column; gap: 10px; color: var(--muted); }
.notes li b { color: var(--fg); font-weight: 500; }
.foot { font-size: 13px; color: var(--faint); }
@media (max-width: 480px) { body { padding-block: 24px 48px; } .lede { font-size: 16px; } }
@media (prefers-reduced-motion: reduce) { .compbar i { transition: none; } }
