/* ============================================================
   LUMA — A laboratory in your browser.
   Instrument-panel design system. Near-black surfaces, phosphor
   readouts, thin grids, monospace numerals, bezelled panels.
   ============================================================ */

:root {
  --bg: #07090B;
  --bg-2: #0B0E11;
  --panel: #0E1216;
  --panel-2: #12181D;
  --bezel: #1A2229;
  --line: #1F2A32;
  --line-2: #2B3844;
  --text: #D9E2E8;
  --text-2: #9BABB7;
  --text-3: #6E7E8A;
  --phos: #5CFF8A;
  --phos-dim: #2E9E54;
  --amber: #FFB547;
  --cyan: #59D6FF;
  --violet: #C89BFF;
  --red: #FF6B6B;
  --red-2: #C93B3B;
  --ok: #5CFF8A;
  --warn: #FFB547;
  --focus: #FFFFFF;
  --font-mono: 'IBM Plex Mono', ui-monospace, 'SF Mono', Menlo, Consolas, monospace;
  --font-sans: 'IBM Plex Sans', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --radius: 4px;
  --wrap: 1240px;
  --gutter: clamp(16px, 3vw, 40px);
  --dur: .18s;
  --grid: repeating-linear-gradient(0deg, transparent 0 23px, rgba(89,214,255,.045) 23px 24px),
          repeating-linear-gradient(90deg, transparent 0 23px, rgba(89,214,255,.045) 23px 24px);
}

/* High-contrast mode (toggle) */
html.hc {
  --bg: #000000;
  --bg-2: #000000;
  --panel: #000000;
  --panel-2: #050505;
  --bezel: #1E1E1E;
  --line: #5A5A5A;
  --line-2: #8A8A8A;
  --text: #FFFFFF;
  --text-2: #E6E6E6;
  --text-3: #C4C4C4;
  --phos: #7CFFA5;
  --phos-dim: #7CFFA5;
  --amber: #FFD37A;
  --cyan: #8BE4FF;
  --violet: #E0C4FF;
  --red: #FF8A8A;
  --focus: #FFFF00;
  --grid: none;
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; color-scheme: dark; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font-family: var(--font-sans); font-size: 1rem; line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}
img, svg, canvas { max-width: 100%; display: block; }
a { color: var(--cyan); text-underline-offset: .15em; }
a:hover { color: var(--text); }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
button, input, select, textarea { font: inherit; color: inherit; }
h1, h2, h3, h4 { margin: 0 0 .5em; line-height: 1.15; font-weight: 600; letter-spacing: -.01em; }
h1 { font-size: clamp(2rem, 5vw, 3.4rem); }
h2 { font-size: clamp(1.4rem, 2.6vw, 2rem); }
h3 { font-size: 1.1rem; }
p { margin: 0 0 1em; }
code, .mono { font-family: var(--font-mono); }
hr { border: 0; border-top: 1px solid var(--line); margin: 2rem 0; }
::selection { background: var(--phos); color: #000; }

.visually-hidden { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }
.skip-link { position: absolute; left: 12px; top: -80px; z-index: 2000; background: var(--phos); color: #000; padding: .6rem 1rem; font-weight: 600; text-decoration: none; border-radius: var(--radius); font-family: var(--font-mono); }
.skip-link:focus { top: 12px; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; scroll-behavior: auto !important; }
}
html.rm *, html.rm *::before, html.rm *::after { animation-duration: .001ms !important; transition-duration: .001ms !important; }

/* ---------- Labels / eyebrow ---------- */
.eyebrow { font-family: var(--font-mono); font-size: .72rem; letter-spacing: .14em; text-transform: uppercase; color: var(--text-3); margin: 0 0 .6rem; }
.eyebrow--phos { color: var(--phos); }
.led { display: inline-flex; align-items: center; gap: .45rem; font-family: var(--font-mono); font-size: .72rem; letter-spacing: .08em; text-transform: uppercase; color: var(--text-2); }
.led::before { content: ""; width: .55rem; height: .55rem; border-radius: 50%; background: var(--text-3); box-shadow: inset 0 0 0 1px rgba(0,0,0,.6); }
.led--on::before { background: var(--phos); box-shadow: 0 0 6px var(--phos); }
.led--warn::before { background: var(--amber); box-shadow: 0 0 6px var(--amber); }
.led--err::before { background: var(--red); box-shadow: 0 0 6px var(--red); }
.led--busy::before { background: var(--cyan); box-shadow: 0 0 6px var(--cyan); }

/* ---------- Top bar ---------- */
.topbar {
  display: flex; align-items: center; gap: 1rem; flex-wrap: wrap;
  padding: .6rem var(--gutter); border-bottom: 1px solid var(--line);
  background: var(--bg-2); position: sticky; top: 0; z-index: 100;
}
.wordmark { display: inline-flex; align-items: center; gap: .6rem; color: var(--text); text-decoration: none; font-family: var(--font-mono); font-weight: 600; letter-spacing: .18em; font-size: 1.05rem; }
.wordmark svg { width: 30px; height: 30px; }
.wordmark small { font-family: var(--font-sans); font-weight: 400; letter-spacing: 0; font-size: .8rem; color: var(--text-3); margin-left: .35rem; }
.topnav { display: flex; align-items: center; gap: .25rem; margin-left: auto; flex-wrap: wrap; }
.topnav a, .topnav button { color: var(--text-2); text-decoration: none; padding: .45rem .7rem; border-radius: var(--radius); font-family: var(--font-mono); font-size: .8rem; letter-spacing: .04em; background: transparent; border: 1px solid transparent; cursor: pointer; }
.topnav a:hover, .topnav button:hover { color: var(--text); border-color: var(--line-2); }
.topnav a[aria-current="page"] { color: var(--phos); border-color: var(--line-2); }
.topnav .back { color: var(--text-3); }
.pref-toggles { display: flex; gap: .3rem; flex-wrap: wrap; }
.toggle { display: inline-flex; align-items: center; gap: .45rem; border: 1px solid var(--line-2); background: var(--panel); color: var(--text-2); padding: .4rem .65rem; border-radius: var(--radius); font-family: var(--font-mono); font-size: .75rem; letter-spacing: .04em; cursor: pointer; }
.toggle .sw { width: 1.6rem; height: .85rem; border-radius: 1rem; border: 1px solid var(--line-2); position: relative; background: var(--bg); flex: none; }
.toggle .sw::after { content: ""; position: absolute; top: 1px; left: 1px; width: .6rem; height: .6rem; border-radius: 50%; background: var(--text-3); transition: transform var(--dur); }
.toggle[aria-pressed="true"] { color: var(--phos); border-color: var(--phos-dim); }
.toggle[aria-pressed="true"] .sw::after { background: var(--phos); transform: translateX(.72rem); }
.toggle[aria-pressed="true"] .sw { border-color: var(--phos-dim); }

/* ---------- Buttons ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: .5rem; padding: .6rem 1rem; border-radius: var(--radius); border: 1px solid var(--line-2); background: var(--panel-2); color: var(--text); font-family: var(--font-mono); font-size: .85rem; letter-spacing: .04em; text-decoration: none; cursor: pointer; min-height: 2.5rem; }
.btn:hover { border-color: var(--text-3); background: var(--bezel); color: var(--text); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn--primary { background: var(--phos); color: #000; border-color: var(--phos); font-weight: 600; }
.btn--primary:hover { background: #7dffa2; color: #000; border-color: #7dffa2; }
.btn--amber { border-color: var(--amber); color: var(--amber); }
.btn--amber:hover { background: var(--amber); color: #000; }
.btn--danger { border-color: var(--red-2); color: var(--red); }
.btn--danger:hover { background: var(--red-2); color: #fff; }
.btn--sm { padding: .35rem .6rem; font-size: .75rem; min-height: 2rem; }
.btn--lg { padding: .9rem 1.5rem; font-size: 1rem; }
.btn svg { width: 1em; height: 1em; }
.btn[aria-pressed="true"] { background: var(--bezel); border-color: var(--cyan); color: var(--cyan); }

/* ---------- Panels ---------- */
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: inset 0 1px 0 rgba(255,255,255,.03), 0 0 0 1px rgba(0,0,0,.4); }
.panel__head { display: flex; align-items: center; gap: .75rem; padding: .55rem .9rem; border-bottom: 1px solid var(--line); background: var(--panel-2); border-radius: var(--radius) var(--radius) 0 0; }
.panel__head h2, .panel__head h3 { margin: 0; font-family: var(--font-mono); font-size: .8rem; font-weight: 600; letter-spacing: .12em; text-transform: uppercase; color: var(--text-2); }
.panel__head .spacer { margin-left: auto; }
.panel__body { padding: .9rem; }

/* ============================================================
   LANDING
   ============================================================ */
.wrap { max-width: var(--wrap); margin: 0 auto; padding: 0 var(--gutter); }
.hero { position: relative; padding: clamp(3rem, 8vw, 6rem) 0 clamp(2.5rem, 6vw, 4rem); border-bottom: 1px solid var(--line); background-image: var(--grid); }
.hero::after { content: ""; position: absolute; inset: 0; background: linear-gradient(180deg, transparent 40%, var(--bg) 100%); pointer-events: none; }
.hero .wrap { position: relative; z-index: 1; display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, .8fr); gap: 3rem; align-items: center; }
.hero h1 { margin-bottom: 1rem; }
.hero h1 em { font-style: normal; color: var(--phos); }
.hero .lede { font-size: clamp(1.05rem, 1.6vw, 1.25rem); color: var(--text-2); max-width: 36rem; }
.hero .cta-row { display: flex; gap: .75rem; flex-wrap: wrap; margin-top: 1.6rem; }
.scope { position: relative; aspect-ratio: 4/3; border: 1px solid var(--line-2); border-radius: 6px; background: var(--bg-2); padding: 12px; box-shadow: 0 0 0 6px var(--panel), 0 0 0 7px var(--line); }
.scope svg { width: 100%; height: 100%; }
.scope__label { position: absolute; left: 14px; top: 10px; font-family: var(--font-mono); font-size: .65rem; letter-spacing: .12em; color: var(--phos); text-transform: uppercase; }
.scope__label2 { position: absolute; right: 14px; bottom: 10px; font-family: var(--font-mono); font-size: .65rem; letter-spacing: .1em; color: var(--text-3); }

.section { padding: clamp(2.5rem, 6vw, 4.5rem) 0; border-bottom: 1px solid var(--line); }
.section h2 { margin-bottom: 1.2rem; }
.two-col { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 2rem; }
.stat-row { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 1px; background: var(--line); border: 1px solid var(--line); margin-top: 2rem; }
.stat { background: var(--panel); padding: 1rem 1.2rem; }
.stat b { display: block; font-family: var(--font-mono); font-size: 1.8rem; color: var(--phos); font-weight: 500; }
.stat span { color: var(--text-2); font-size: .9rem; }

.exp-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1rem; }
.exp-card { display: flex; flex-direction: column; gap: .5rem; padding: 1rem 1.1rem; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); color: inherit; text-decoration: none; position: relative; }
.exp-card:hover { border-color: var(--phos-dim); color: inherit; }
.exp-card:hover .exp-card__title { color: var(--phos); }
.exp-card__meta { display: flex; justify-content: space-between; gap: .5rem; font-family: var(--font-mono); font-size: .7rem; letter-spacing: .1em; text-transform: uppercase; color: var(--text-3); }
.exp-card__title { font-size: 1.15rem; font-weight: 600; margin: 0; }
.exp-card__desc { color: var(--text-2); font-size: .92rem; margin: 0; flex: 1; }
.exp-card__measure { font-family: var(--font-mono); font-size: .78rem; color: var(--cyan); margin: 0; }
.exp-card__measure::before { content: "MEASURES "; color: var(--text-3); letter-spacing: .1em; }
.diff { display: inline-flex; align-items: center; gap: .25rem; }
.diff i { display: inline-block; width: .45rem; height: .45rem; border-radius: 1px; background: var(--line-2); }
.diff i.on { background: var(--amber); }

.feature-list { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 1rem; }
.feature-list li { padding: 1rem; border: 1px solid var(--line); background: var(--panel); border-radius: var(--radius); }
.feature-list b { display: block; font-family: var(--font-mono); font-size: .85rem; color: var(--phos); margin-bottom: .3rem; }
.feature-list p { margin: 0; color: var(--text-2); font-size: .92rem; }

.footer { padding: 2rem 0 3rem; color: var(--text-3); font-size: .85rem; }
.footer .wrap { display: flex; flex-wrap: wrap; gap: 1rem 2rem; align-items: center; justify-content: space-between; }
.footer a { color: var(--text-2); }
.footer .quiet { margin: 0; }
.footer nav { display: flex; gap: 1rem; flex-wrap: wrap; }

/* ============================================================
   LABORATORY
   ============================================================ */
.lab body, body.lab-body { overflow-x: hidden; }
.workspace { display: grid; grid-template-columns: 236px minmax(0, 1fr) 360px; gap: 10px; padding: 10px; min-height: calc(100vh - 56px); align-items: start; }
.rail { position: sticky; top: 66px; max-height: calc(100vh - 76px); overflow: auto; }
.rail__group { padding: .5rem .5rem .6rem; border-bottom: 1px solid var(--line); }
.rail__group:last-child { border-bottom: 0; }
.rail__group h3 { font-family: var(--font-mono); font-size: .68rem; letter-spacing: .14em; text-transform: uppercase; color: var(--text-3); margin: .3rem .5rem .4rem; }
.rail__group ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
.rail__btn { width: 100%; text-align: left; display: flex; align-items: center; gap: .5rem; background: transparent; border: 1px solid transparent; color: var(--text-2); padding: .5rem .6rem; border-radius: var(--radius); cursor: pointer; font-size: .9rem; }
.rail__btn:hover { background: var(--panel-2); color: var(--text); }
.rail__btn[aria-current="true"] { background: var(--panel-2); border-color: var(--line-2); color: var(--phos); }
.rail__btn .idx { font-family: var(--font-mono); font-size: .7rem; color: var(--text-3); width: 1.4rem; flex: none; }
.rail__btn[aria-current="true"] .idx { color: var(--phos); }
.rail__select { display: none; }

.stage { display: grid; gap: 10px; min-width: 0; }
.apparatus { min-width: 0; }
.apparatus__view { position: relative; background: var(--bg-2); background-image: var(--grid); border-bottom: 1px solid var(--line); aspect-ratio: 16/9; max-height: 440px; min-height: 240px; }
.apparatus__view svg { width: 100%; height: 100%; }
.apparatus__status { display: flex; gap: 1rem; flex-wrap: wrap; align-items: center; }
.apparatus__desc { padding: .7rem .9rem; color: var(--text-2); font-size: .88rem; margin: 0; }
.apparatus__clock { margin-left: auto; font-family: var(--font-mono); font-size: .85rem; color: var(--amber); font-variant-numeric: tabular-nums; }

.controls__grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: .8rem 1.2rem; }
.ctl { display: grid; gap: .3rem; }
.ctl__label { display: flex; justify-content: space-between; align-items: baseline; font-size: .85rem; color: var(--text-2); gap: .5rem; }
.ctl__label .u { font-family: var(--font-mono); font-size: .72rem; color: var(--text-3); }
.ctl__row { display: grid; grid-template-columns: minmax(0,1fr) 5.2rem; gap: .5rem; align-items: center; }
.ctl input[type="number"], .ctl select, .ctl input[type="text"] { background: var(--bg); border: 1px solid var(--line-2); color: var(--phos); font-family: var(--font-mono); padding: .35rem .45rem; border-radius: var(--radius); width: 100%; min-height: 2.2rem; font-variant-numeric: tabular-nums; }
.ctl select { color: var(--text); }
.ctl input[type="range"] { width: 100%; accent-color: var(--phos); height: 1.6rem; margin: 0; background: transparent; }
.ctl input[type="range"]:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
.ctl--check { grid-template-columns: auto 1fr; align-items: center; gap: .6rem; }
.ctl--check input { width: 1.1rem; height: 1.1rem; accent-color: var(--phos); }
.ctl.is-advanced .ctl__label::after { content: "ADV"; font-family: var(--font-mono); font-size: .6rem; color: var(--text-3); letter-spacing: .1em; border: 1px solid var(--line-2); padding: 0 .3rem; border-radius: 2px; }
html.simple .ctl.is-advanced { display: none; }
html.simple .adv-only { display: none !important; }

.components { margin-top: 1rem; border-top: 1px dashed var(--line-2); padding-top: .8rem; }
.components__head { display: flex; align-items: center; gap: .6rem; margin-bottom: .6rem; }
.components__head h3 { margin: 0; font-family: var(--font-mono); font-size: .75rem; letter-spacing: .12em; text-transform: uppercase; color: var(--text-2); }
.components__head .count { font-family: var(--font-mono); font-size: .75rem; color: var(--text-3); }
.components__list { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: .6rem 1.2rem; }
.components__list li { display: grid; gap: .3rem; }
.components__list .ctl__row { grid-template-columns: minmax(0,1fr) 5.2rem auto; }

.toolbar { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; padding: .7rem .9rem; }
.toolbar .sep { width: 1px; height: 1.6rem; background: var(--line-2); margin: 0 .25rem; }
.toolbar .grow { flex: 1; }
.toolbar .msg { font-family: var(--font-mono); font-size: .78rem; color: var(--amber); min-height: 1.2em; }

.task-strip { display: none; padding: .8rem .9rem; border: 1px solid var(--amber); border-radius: var(--radius); background: var(--panel); }
html.simple .task-strip { display: grid; gap: .5rem; }
.task-strip .eyebrow { margin: 0; color: var(--amber); }
.task-strip p { margin: 0; }
.task-strip .row { display: flex; gap: .5rem; align-items: center; flex-wrap: wrap; }

/* right column */
.readouts { display: grid; gap: 10px; min-width: 0; }
.readouts > .panel, .stage > .panel, .stage > .toolbar, .panel__body { min-width: 0; }
.graph__canvas { display: block; width: 100%; max-width: 100%; }
.meter-grid { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: .5rem; }
.meter { background: var(--bg); border: 1px solid var(--line-2); border-radius: var(--radius); padding: .5rem .65rem; min-width: 0; }
.meter__label { font-family: var(--font-mono); font-size: .65rem; letter-spacing: .1em; text-transform: uppercase; color: var(--text-3); line-height: 1.25; min-height: 1.6em; }
.meter__value { font-family: var(--font-mono); font-size: 1.35rem; color: var(--phos); font-variant-numeric: tabular-nums; line-height: 1.2; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.meter__value .u { font-size: .7rem; color: var(--text-3); margin-left: .25rem; }
.meter--theory .meter__value { color: var(--cyan); }
.meter--warn .meter__value { color: var(--amber); }
.meter--err .meter__value { color: var(--red); }
.meter__note { font-size: .72rem; color: var(--text-2); margin-top: .15rem; }
.warn-box { margin-top: .6rem; display: flex; gap: .5rem; align-items: flex-start; padding: .55rem .7rem; border: 1px solid var(--amber); border-radius: var(--radius); color: var(--amber); font-size: .85rem; }
.warn-box--err { border-color: var(--red); color: var(--red); }
.warn-box svg { width: 1.1rem; height: 1.1rem; flex: none; margin-top: .1rem; }
.warn-box:empty { display: none; }

.graph__canvas { width: 100%; height: 260px; background: var(--bg); border-radius: var(--radius); }
.graph__tools { display: flex; gap: .5rem; align-items: center; flex-wrap: wrap; margin-bottom: .6rem; }
.graph__tools select { background: var(--bg); border: 1px solid var(--line-2); color: var(--text); font-family: var(--font-mono); font-size: .8rem; padding: .35rem .45rem; border-radius: var(--radius); flex: 1; min-width: 0; }
.graph__desc { font-size: .82rem; color: var(--text-2); margin: .6rem 0 0; }
.graph__desc:empty { display: none; }

.table-wrap { overflow-x: auto; max-height: 260px; overflow-y: auto; border: 1px solid var(--line); border-radius: var(--radius); }
table.data { border-collapse: collapse; width: 100%; font-family: var(--font-mono); font-size: .75rem; }
table.data th, table.data td { padding: .35rem .5rem; border-bottom: 1px solid var(--line); text-align: right; white-space: nowrap; }
table.data th { position: sticky; top: 0; background: var(--panel-2); color: var(--text-3); font-weight: 500; letter-spacing: .06em; text-transform: uppercase; font-size: .65rem; }
table.data td:first-child, table.data th:first-child { text-align: left; }
table.data td.num-theory { color: var(--cyan); }
table.data td.num-meas { color: var(--phos); }
table.data .rowbtn { background: transparent; border: 1px solid var(--line-2); color: var(--text-2); font-size: .7rem; padding: .1rem .4rem; border-radius: 2px; cursor: pointer; }
table.data .rowbtn:hover { color: var(--red); border-color: var(--red); }
.table-tools { display: flex; gap: .5rem; flex-wrap: wrap; margin-top: .6rem; align-items: center; }
.table-tools .n { font-family: var(--font-mono); font-size: .75rem; color: var(--text-3); margin-left: auto; }
.empty-note { color: var(--text-3); font-size: .82rem; padding: .8rem; text-align: center; }

.notes textarea { width: 100%; min-height: 4.5rem; background: var(--bg); border: 1px solid var(--line-2); color: var(--text); padding: .5rem .6rem; border-radius: var(--radius); resize: vertical; font-family: var(--font-sans); font-size: .9rem; }
.notes__list { list-style: none; padding: 0; margin: .6rem 0 0; display: grid; gap: .4rem; max-height: 200px; overflow: auto; }
.notes__list li { display: grid; grid-template-columns: 1fr auto; gap: .5rem; padding: .45rem .6rem; border: 1px solid var(--line); border-radius: var(--radius); font-size: .85rem; }
.notes__list time { display: block; font-family: var(--font-mono); font-size: .65rem; color: var(--text-3); }

/* ---------- Report dialog ---------- */
dialog.report { width: min(960px, 96vw); max-height: 92vh; background: var(--panel); color: var(--text); border: 1px solid var(--line-2); border-radius: 6px; padding: 0; }
dialog.report::backdrop { background: rgba(0,0,0,.7); }
.report__bar { position: sticky; top: 0; display: flex; gap: .5rem; align-items: center; flex-wrap: wrap; padding: .6rem .9rem; border-bottom: 1px solid var(--line); background: var(--panel-2); z-index: 2; }
.report__bar h2 { margin: 0; font-family: var(--font-mono); font-size: .8rem; letter-spacing: .12em; text-transform: uppercase; }
.report__bar .spacer { margin-left: auto; }
.report__body { padding: 1.2rem 1.4rem 2rem; }
.rep h1 { font-size: 1.6rem; margin-bottom: .2rem; }
.rep h2 { font-size: 1rem; font-family: var(--font-mono); letter-spacing: .1em; text-transform: uppercase; color: var(--phos); margin: 1.6rem 0 .6rem; border-bottom: 1px solid var(--line); padding-bottom: .3rem; }
.rep .meta { color: var(--text-3); font-family: var(--font-mono); font-size: .78rem; }
.rep table { border-collapse: collapse; width: 100%; font-family: var(--font-mono); font-size: .8rem; }
.rep th, .rep td { border: 1px solid var(--line); padding: .35rem .5rem; text-align: right; }
.rep th { text-align: left; color: var(--text-2); font-weight: 500; }
.rep td:first-child { text-align: left; }
.rep .calc { display: grid; grid-template-columns: 1fr; gap: .5rem; }
.rep .calc div { border: 1px solid var(--line); padding: .5rem .7rem; border-radius: var(--radius); font-family: var(--font-mono); font-size: .8rem; }
.rep .calc b { color: var(--text-2); font-weight: 500; display: block; font-family: var(--font-sans); margin-bottom: .2rem; }
.rep .calc .f { color: var(--cyan); }
.rep .calc .s { color: var(--text-2); }
.rep .calc .r { color: var(--phos); }
.rep .result { border: 1px solid var(--phos-dim); padding: .8rem 1rem; border-radius: var(--radius); }
.rep .result p { margin: .2rem 0; }
.rep svg { max-width: 100%; height: auto; }
.rep ul { margin: 0; padding-left: 1.2rem; }

/* ---------- Toast/announcer ---------- */
.toast { position: fixed; left: 50%; bottom: 20px; transform: translateX(-50%); background: var(--panel-2); border: 1px solid var(--line-2); color: var(--text); padding: .6rem 1rem; border-radius: var(--radius); font-family: var(--font-mono); font-size: .8rem; z-index: 500; max-width: 90vw; }
.toast[hidden] { display: none; }

/* ---------- Docs ---------- */
.docs { display: grid; grid-template-columns: 240px minmax(0,1fr); gap: 3rem; padding: 2.5rem 0 4rem; }
.docs__toc { position: sticky; top: 76px; align-self: start; }
.docs__toc ol { list-style: none; padding: 0; margin: 0; display: grid; gap: .2rem; }
.docs__toc a { display: block; padding: .35rem .5rem; color: var(--text-2); text-decoration: none; font-size: .88rem; border-left: 2px solid var(--line); }
.docs__toc a:hover { color: var(--phos); border-left-color: var(--phos); }
.docs__content h2 { margin-top: 2.5rem; padding-top: .5rem; border-top: 1px solid var(--line); font-family: var(--font-mono); font-size: 1.1rem; letter-spacing: .06em; text-transform: uppercase; color: var(--phos); }
.docs__content h2:first-child { margin-top: 0; border-top: 0; }
.docs__content h3 { margin-top: 1.6rem; }
.docs__content p, .docs__content li { color: var(--text-2); max-width: 70ch; }
.docs__content .eq { display: block; font-family: var(--font-mono); background: var(--bg); border: 1px solid var(--line); padding: .6rem .8rem; border-radius: var(--radius); color: var(--cyan); margin: .6rem 0 1rem; overflow-x: auto; white-space: pre; font-size: .85rem; }
.docs__content table { border-collapse: collapse; width: 100%; font-size: .85rem; margin: .8rem 0 1.4rem; }
.docs__content th, .docs__content td { border: 1px solid var(--line); padding: .45rem .6rem; text-align: left; vertical-align: top; }
.docs__content th { background: var(--panel-2); color: var(--text-2); font-family: var(--font-mono); font-size: .72rem; letter-spacing: .08em; text-transform: uppercase; }
.docs__content td { color: var(--text-2); }
.docs__content td code { color: var(--phos); }
.tbl-wrap { overflow-x: auto; }

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 1180px) {
  .workspace { grid-template-columns: minmax(0,1fr) 340px; }
  .rail { position: static; max-height: none; grid-column: 1 / -1; }
  .rail__groups { display: none; }
  .rail__select { display: grid; gap: .4rem; padding: .7rem .9rem; }
  .rail__select select { background: var(--bg); border: 1px solid var(--line-2); color: var(--text); font-family: var(--font-mono); padding: .45rem .5rem; border-radius: var(--radius); min-height: 2.4rem; }
}
@media (max-width: 900px) {
  .hero .wrap { grid-template-columns: 1fr; }
  .exp-grid { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .two-col, .feature-list { grid-template-columns: 1fr; }
  .stat-row { grid-template-columns: 1fr; }
  .docs { grid-template-columns: 1fr; gap: 1.5rem; }
  .docs__toc { position: static; }
  .docs__toc ol { grid-template-columns: repeat(2, minmax(0,1fr)); }
}
@media (max-width: 760px) {
  .workspace { grid-template-columns: minmax(0,1fr); padding: 8px; gap: 8px; }
  .readouts { grid-column: 1; }
  .exp-grid { grid-template-columns: 1fr; }
  .apparatus__view { aspect-ratio: 4/3; min-height: 200px; }
  .meter-grid { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .topbar { gap: .5rem; }
  .topnav { margin-left: 0; width: 100%; }
  .wordmark small { display: none; }
  .docs__toc ol { grid-template-columns: 1fr; }
}

/* ---------- Print (report) ---------- */
@media print {
  body { background: #fff; color: #000; }
  .topbar, .workspace, .footer, .toast, .report__bar { display: none !important; }
  dialog.report { position: static; border: 0; width: auto; max-height: none; color: #000; background: #fff; }
  .rep h2 { color: #000; }
}
