/* Base reset */
:root { padding-top: env(safe-area-inset-top, 0px); padding-bottom: env(safe-area-inset-bottom, 0px); }
body { margin: 0; }
img { max-width: 100%; }
[hidden] { display: none !important; }
:root {
  /* Layout: instrument bench. Catalogue rail | live specimen on a lit stage | datasheet. */
  --bg: #E3E6E9;
  --surface: #F1F3F5;
  --raised: #FFFFFF;
  --ink: #12161B;
  --ink-2: #444D58;
  --ink-3: #69727E;
  --line: #C8CED5;
  --line-soft: #DADFE4;
  --accent: #C2410C;
  --accent-soft: rgba(194, 65, 12, 0.10);
  --role-input: #E8590C;
  --role-output: #1F64C8;
  --role-fixed: #8A939D;
  --role-transfer: #B3BAC2;
  --role-elastic: #9C36B5;
  --role-sensor: #2F7A55;
  --role-fluid: #E59A1F;
  --section: #B02A37;
  --stage-hi: #EEF0F2;
  --stage-lo: #CDD2D8;
  --series-a: #2a78d6;
  --series-b: #eda100;
  --series-c: #1baf7a;
  --chart-line: #2a78d6;
  --chart-wash: rgba(42, 120, 214, 0.10);
  --good: #2B8A3E;
  --warn: #B35C00;
  --shadow: 0 1px 2px rgba(18, 22, 27, 0.06), 0 8px 24px rgba(18, 22, 27, 0.08);
  --font-display: "Archivo", "Helvetica Neue", Arial, sans-serif;
  --font-body: "IBM Plex Sans", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-mono: "IBM Plex Mono", ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  --r-sm: 4px;
  --r-md: 8px;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0C1014; --surface: #131820; --raised: #1A2029; --ink: #E7EBEF; --ink-2: #A8B1BB; --ink-3: #7C8692;
    --line: #2B333D; --line-soft: #212831; --accent: #FF8A4C; --accent-soft: rgba(255, 138, 76, 0.12);
    --role-input: #F2702A; --role-output: #4C8DF0; --role-fixed: #8C96A1; --role-transfer: #B8C0C9; --role-elastic: #C065DB;
    --role-sensor: #3FA772; --role-fluid: #F2AE3D; --section: #D2475A;
    --stage-hi: #1D242D; --stage-lo: #0C1014;
    --series-a: #3987e5; --series-b: #c98500; --series-c: #199e70; --chart-line: #3987e5; --chart-wash: rgba(57, 135, 229, 0.12);
    --good: #52B865; --warn: #E0902F;
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 10px 28px rgba(0, 0, 0, 0.35);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0C1014; --surface: #131820; --raised: #1A2029; --ink: #E7EBEF; --ink-2: #A8B1BB; --ink-3: #7C8692;
  --line: #2B333D; --line-soft: #212831; --accent: #FF8A4C; --accent-soft: rgba(255, 138, 76, 0.12);
  --role-input: #F2702A; --role-output: #4C8DF0; --role-fixed: #8C96A1; --role-transfer: #B8C0C9; --role-elastic: #C065DB;
  --role-sensor: #3FA772; --role-fluid: #F2AE3D; --section: #D2475A;
  --stage-hi: #1D242D; --stage-lo: #0C1014;
  --series-a: #3987e5; --series-b: #c98500; --series-c: #199e70; --chart-line: #3987e5; --chart-wash: rgba(57, 135, 229, 0.12);
  --good: #52B865; --warn: #E0902F;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 10px 28px rgba(0, 0, 0, 0.35);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  background: var(--bg); color: var(--ink);
  font-family: var(--font-body); font-size: 14px; line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
button, input, select { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
h1, h2, h3 { text-wrap: balance; margin: 0; }
.mono { font-family: var(--font-mono); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- App frame ---------- */
.app { display: flex; flex-direction: column; height: 100%; }
.topbar {
  display: flex; align-items: center; gap: 24px; flex-wrap: wrap;
  padding-block: 10px; padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px));
  border-bottom: 1px solid var(--line); background: var(--surface);
}
.brand { display: flex; align-items: baseline; gap: 12px; min-width: 0; }
.brand-mark {
  font-family: var(--font-display); font-weight: 800; font-stretch: 125%; font-variation-settings: "wdth" 125;
  font-size: 15px; letter-spacing: 0.14em; text-transform: uppercase; white-space: nowrap;
}
.brand-mark span { color: var(--accent); }
.brand-sub { font-family: var(--font-mono); font-size: 11.5px; color: var(--ink-3); white-space: nowrap; }
.tabs { display: flex; gap: 2px; margin-left: auto; background: var(--bg); border: 1px solid var(--line); border-radius: var(--r-md); padding: 3px; }
.tab {
  border: 0; background: transparent; padding: 5px 14px; border-radius: 5px; cursor: pointer;
  font-weight: 500; font-size: 13px; color: var(--ink-2);
}
.tab[aria-selected="true"] { background: var(--raised); color: var(--ink); box-shadow: 0 1px 2px rgba(0,0,0,0.08); }
.tab:hover { color: var(--ink); }

.view { flex: 1; min-height: 0; }
.view[hidden] { display: none !important; }

/* ---------- Lab layout ---------- */
.lab { display: grid; grid-template-columns: 232px minmax(0, 1fr) 392px; height: 100%; min-height: 0; }
.rail { border-right: 1px solid var(--line); background: var(--surface); overflow-y: auto; padding-block: 14px 24px; }
.rail-group { padding-inline: 14px; }
.rail-group + .rail-group { margin-top: 16px; }
.rail-head {
  font-family: var(--font-mono); font-size: 10.5px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--ink-3);
  padding: 0 8px 6px;
}
.rail-item {
  display: block; width: 100%; text-align: left; border: 0; background: transparent; cursor: pointer;
  padding: 7px 8px 8px; border-radius: 6px; color: var(--ink);
}
.rail-item:hover { background: var(--bg); }
.rail-item[aria-current="true"] { background: var(--raised); box-shadow: inset 0 0 0 1px var(--line); }
.rail-item[aria-current="true"] .rail-name::before { background: var(--accent); }
.rail-name { display: flex; align-items: center; gap: 8px; font-weight: 600; font-size: 13.5px; line-height: 1.3; }
.rail-name::before { content: ""; width: 6px; height: 6px; border-radius: 1px; background: var(--line); flex: none; }
.rail-spec { display: block; font-family: var(--font-mono); font-size: 11px; color: var(--ink-3); padding-left: 14px; margin-top: 2px; }

/* ---------- Stage ---------- */
.stage-wrap { position: relative; display: flex; flex-direction: column; min-width: 0; min-height: 0; }
.stage {
  position: relative; flex: 1; min-width: 0; min-height: 0; overflow: hidden;
  background: radial-gradient(120% 90% at 50% 35%, var(--stage-hi) 0%, var(--stage-lo) 100%);
}
.stage canvas { position: absolute; inset: 0; width: 100% !important; height: 100% !important; display: block; touch-action: none; }
.stage-title { position: absolute; top: 16px; left: 18px; right: 260px; pointer-events: none; }
.stage-kicker { font-family: var(--font-mono); font-size: 11px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--ink-3); }
.stage-name {
  font-family: var(--font-display); font-weight: 750; font-stretch: 112%; font-variation-settings: "wdth" 112;
  font-size: clamp(20px, 2.1vw, 28px); line-height: 1.1; letter-spacing: -0.005em; margin-top: 4px;
}
.stage-tagline { color: var(--ink-2); max-width: 46ch; margin-top: 6px; font-size: 13.5px; }
.legend { display: flex; flex-wrap: wrap; gap: 6px 14px; margin-top: 10px; font-size: 12px; color: var(--ink-2); }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.dot { width: 9px; height: 9px; border-radius: 50%; flex: none; display: inline-block; }
.dot.input { background: var(--role-input); } .dot.output { background: var(--role-output); }
.dot.fixed { background: var(--role-fixed); } .dot.transfer { background: var(--role-transfer); box-shadow: inset 0 0 0 1px var(--line); }
.dot.elastic { background: var(--role-elastic); } .dot.sensor { background: var(--role-sensor); } .dot.fluid { background: var(--role-fluid); }
.dot.section { background: var(--section); border-radius: 1px; }

.hud {
  position: absolute; top: 14px; right: 14px; width: 232px; pointer-events: none;
  background: color-mix(in srgb, var(--raised) 88%, transparent); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
  border: 1px solid var(--line); border-radius: var(--r-md); padding: 10px 12px; box-shadow: var(--shadow);
}
.hud-row { display: flex; justify-content: space-between; gap: 10px; align-items: baseline; padding-block: 3px; }
.hud-row + .hud-row { border-top: 1px solid var(--line-soft); }
.hud-k { font-size: 11.5px; color: var(--ink-3); }
.hud-v { font-family: var(--font-mono); font-size: 12.5px; font-weight: 500; font-variant-numeric: tabular-nums; text-align: right; }
.hud-foot { font-family: var(--font-mono); font-size: 10.5px; color: var(--ink-3); margin-top: 6px; }

.controls {
  position: absolute; left: 50%; bottom: 14px; transform: translateX(-50%);
  display: flex; align-items: center; gap: 4px 14px; flex-wrap: wrap; justify-content: center;
  width: max-content; max-width: calc(100% - 28px);
  background: color-mix(in srgb, var(--raised) 92%, transparent); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
  border: 1px solid var(--line); border-radius: 10px; padding: 7px 10px; box-shadow: var(--shadow);
}
.ctl-group { display: flex; align-items: center; gap: 8px; }
.ctl-label { font-size: 11.5px; color: var(--ink-3); white-space: nowrap; }
.ctl-sep { width: 1px; height: 22px; background: var(--line); }
.icon-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: 30px; min-width: 30px; padding: 0 9px; border-radius: 6px; border: 1px solid transparent; background: transparent; cursor: pointer;
  font-size: 12.5px; font-weight: 500; color: var(--ink-2); white-space: nowrap;
}
.icon-btn:hover { background: var(--bg); color: var(--ink); }
.icon-btn[aria-pressed="true"] { background: var(--accent-soft); color: var(--accent); border-color: color-mix(in srgb, var(--accent) 35%, transparent); }
.icon-btn svg { width: 16px; height: 16px; flex: none; }
.icon-btn.primary { background: var(--ink); color: var(--raised); }
.icon-btn.primary:hover { background: var(--ink-2); color: var(--raised); }
.icon-btn[disabled] { opacity: 0.35; cursor: default; }

input[type="range"] { -webkit-appearance: none; appearance: none; width: 96px; height: 20px; background: transparent; cursor: pointer; }
input[type="range"]::-webkit-slider-runnable-track { height: 3px; border-radius: 2px; background: var(--line); }
input[type="range"]::-moz-range-track { height: 3px; border-radius: 2px; background: var(--line); }
input[type="range"]::-webkit-slider-thumb { -webkit-appearance: none; width: 14px; height: 14px; border-radius: 50%; background: var(--raised); border: 2px solid var(--ink); margin-top: -5.5px; }
input[type="range"]::-moz-range-thumb { width: 12px; height: 12px; border-radius: 50%; background: var(--raised); border: 2px solid var(--ink); }
input[type="range"]:focus-visible { outline: none; }
input[type="range"]:focus-visible::-webkit-slider-thumb { box-shadow: 0 0 0 3px var(--accent-soft), 0 0 0 1px var(--accent); }

.tags { position: absolute; inset: 0; pointer-events: none; overflow: hidden; }
.tags svg { position: absolute; inset: 0; width: 100%; height: 100%; }
.tag {
  position: absolute; left: 0; top: 0; display: inline-flex; align-items: center; gap: 6px; white-space: nowrap;
  font-size: 11.5px; font-weight: 500; color: var(--ink); padding: 3px 8px 3px 7px; border-radius: 5px;
  background: color-mix(in srgb, var(--raised) 90%, transparent); border: 1px solid var(--line); box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}
.tag.is-focus { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-soft); }
.tag-anchor { position: absolute; left: 0; top: 0; width: 7px; height: 7px; margin: -3.5px 0 0 -3.5px; border-radius: 50%; background: var(--ink); box-shadow: 0 0 0 2px var(--raised); }
.tooltip {
  position: absolute; z-index: 5; pointer-events: none; max-width: 270px;
  background: var(--raised); border: 1px solid var(--line); border-radius: var(--r-md); box-shadow: var(--shadow);
  padding: 9px 11px; font-size: 12.5px; line-height: 1.45;
}
.tooltip b { display: block; font-size: 13px; margin-bottom: 2px; }
.tooltip .role { display: inline-flex; align-items: center; gap: 6px; font-family: var(--font-mono); font-size: 10.5px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink-3); margin-bottom: 4px; }
.tooltip p { margin: 0; color: var(--ink-2); }
.hint { position: absolute; left: 18px; bottom: 18px; font-size: 11.5px; color: var(--ink-3); pointer-events: none; }
.webgl-error { position: absolute; inset: 0; display: grid; place-items: center; padding: 24px; text-align: center; color: var(--ink-2); }

/* ---------- Datasheet panel ---------- */
.sheet { border-left: 1px solid var(--line); background: var(--surface); display: flex; flex-direction: column; min-height: 0; min-width: 0; }
.sheet-tabs { display: flex; gap: 0; border-bottom: 1px solid var(--line); padding-inline: 12px; background: var(--surface); flex: none; }
.sheet-tab {
  border: 0; background: transparent; cursor: pointer; padding: 12px 10px 10px; font-size: 13px; font-weight: 500; color: var(--ink-3);
  border-bottom: 2px solid transparent; margin-bottom: -1px;
}
.sheet-tab[aria-selected="true"] { color: var(--ink); border-bottom-color: var(--accent); }
.sheet-tab:hover { color: var(--ink); }
.sheet-body { overflow-y: auto; padding: 18px 18px 40px; flex: 1; min-height: 0; }
.sheet-body > section + section { margin-top: 24px; }
.h-sec {
  font-family: var(--font-mono); font-size: 10.5px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--ink-3);
  margin-bottom: 10px; display: flex; align-items: center; gap: 8px;
}
.h-sec::after { content: ""; flex: 1; height: 1px; background: var(--line-soft); }
.prose p { margin: 0 0 10px; color: var(--ink-2); max-width: 62ch; }

.plate {
  position: relative; border: 1px solid var(--line); border-radius: 6px; background: var(--raised);
  padding: 12px 16px 10px;
  background-image:
    radial-gradient(circle at 7px 7px, var(--line) 2px, transparent 2.5px),
    radial-gradient(circle at calc(100% - 7px) 7px, var(--line) 2px, transparent 2.5px),
    radial-gradient(circle at 7px calc(100% - 7px), var(--line) 2px, transparent 2.5px),
    radial-gradient(circle at calc(100% - 7px) calc(100% - 7px), var(--line) 2px, transparent 2.5px);
}
.plate-head { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; padding: 0 4px 8px; border-bottom: 1px solid var(--line-soft); }
.plate-title { font-family: var(--font-display); font-weight: 700; font-stretch: 125%; font-variation-settings: "wdth" 125; font-size: 11px; letter-spacing: 0.16em; text-transform: uppercase; }
.plate-std { font-family: var(--font-mono); font-size: 10.5px; color: var(--ink-3); }
.plate-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 16px; padding: 4px 4px 0; }
.plate-cell { padding: 7px 0; border-bottom: 1px solid var(--line-soft); min-width: 0; }
.plate-cell:nth-last-child(-n+2) { border-bottom: 0; }
.plate-k { font-size: 11px; color: var(--ink-3); }
.plate-v { font-family: var(--font-mono); font-size: 12.5px; font-weight: 500; overflow-wrap: anywhere; }

.steps { list-style: none; margin: 0; padding: 0; counter-reset: step; display: grid; gap: 10px; }
.steps li { counter-increment: step; display: grid; grid-template-columns: 22px 1fr; gap: 8px; color: var(--ink-2); }
.steps li::before {
  content: counter(step); font-family: var(--font-mono); font-size: 11px; font-weight: 600; color: var(--ink);
  width: 20px; height: 20px; border: 1px solid var(--line); border-radius: 50%; display: grid; place-items: center; margin-top: 1px; background: var(--raised);
}
.steps-note { font-size: 12px; color: var(--ink-3); margin-top: 10px; padding-left: 30px; }

.parts { display: grid; gap: 2px; }
.part-row {
  display: grid; grid-template-columns: 12px 1fr; gap: 10px; align-items: start; text-align: left;
  border: 0; background: transparent; padding: 7px 8px; border-radius: 6px; cursor: pointer; width: 100%;
}
.part-row:hover, .part-row.is-focus { background: var(--raised); box-shadow: inset 0 0 0 1px var(--line); }
.part-row .dot { margin-top: 5px; }
.part-name { font-weight: 600; font-size: 13px; }
.part-role { font-family: var(--font-mono); font-size: 10.5px; color: var(--ink-3); margin-left: 6px; text-transform: uppercase; letter-spacing: 0.06em; }
.part-desc { display: block; color: var(--ink-2); font-size: 12.5px; margin-top: 1px; }

.pc { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.pc h4 { margin: 0 0 6px; font-size: 12px; font-weight: 600; display: flex; align-items: center; gap: 6px; }
.pc ul { margin: 0; padding-left: 16px; color: var(--ink-2); font-size: 12.5px; display: grid; gap: 5px; }
.pc .plus h4::before { content: "+"; font-family: var(--font-mono); color: var(--good); font-weight: 700; }
.pc .minus h4::before { content: "−"; font-family: var(--font-mono); color: var(--warn); font-weight: 700; }

.param { display: grid; gap: 4px; padding-block: 8px; border-bottom: 1px solid var(--line-soft); }
.param-top { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; }
.param label, .param .param-label { font-size: 12.5px; font-weight: 500; }
.param output { font-family: var(--font-mono); font-size: 12.5px; font-variant-numeric: tabular-nums; color: var(--ink); }
.param input[type="range"] { width: 100%; }
.param-help { font-size: 11.5px; color: var(--ink-3); }
.seg { display: flex; flex-wrap: wrap; gap: 4px; }
.seg button {
  border: 1px solid var(--line); background: var(--raised); border-radius: 6px; padding: 4px 9px; font-size: 12px; cursor: pointer; color: var(--ink-2);
  font-family: var(--font-mono);
}
.seg button[aria-pressed="true"] { border-color: var(--ink); color: var(--ink); box-shadow: inset 0 0 0 1px var(--ink); }
.seg button:hover { color: var(--ink); }

.calc { display: grid; gap: 0; }
.calc-row { padding: 8px 0; border-bottom: 1px solid var(--line-soft); display: grid; gap: 2px; }
.calc-k { font-size: 11.5px; color: var(--ink-3); }
.calc-line { display: flex; justify-content: space-between; gap: 12px; align-items: baseline; }
.calc-expr { font-family: var(--font-mono); font-size: 12px; color: var(--ink-2); overflow-wrap: anywhere; min-width: 0; }
.calc-val { font-family: var(--font-mono); font-size: 13px; font-weight: 600; white-space: nowrap; font-variant-numeric: tabular-nums; }
.pill { display: inline-flex; align-items: center; gap: 5px; font-family: var(--font-mono); font-size: 11px; font-weight: 600; padding: 1px 7px; border-radius: 999px; border: 1px solid currentColor; }
.pill.good { color: var(--good); } .pill.warn { color: var(--warn); }

.flow { margin-top: 12px; }
.flow-bar { display: flex; gap: 2px; height: 10px; border-radius: 3px; overflow: hidden; margin-top: 6px; }
.flow-bar .out { background: var(--role-output); }
.flow-bar .loss { background: repeating-linear-gradient(135deg, var(--role-fixed) 0 2px, transparent 2px 5px); box-shadow: inset 0 0 0 1px var(--role-fixed); border-radius: 0 3px 3px 0; }
.flow-legend { display: flex; justify-content: space-between; gap: 8px; font-size: 11.5px; color: var(--ink-3); margin-top: 6px; font-family: var(--font-mono); }
.flow-legend span { display: inline-flex; align-items: center; gap: 6px; }
.sw { width: 10px; height: 10px; border-radius: 2px; display: inline-block; }
.sw.out { background: var(--role-output); } .sw.loss { background: repeating-linear-gradient(135deg, var(--role-fixed) 0 2px, transparent 2px 4px); box-shadow: inset 0 0 0 1px var(--role-fixed); }

.mini-chart { margin-top: 6px; }
.mini-chart svg { display: block; width: 100%; height: auto; overflow: visible; }
.chart-cap { font-size: 11.5px; color: var(--ink-3); margin-top: 6px; }
.live-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.live-cell { background: var(--raised); border: 1px solid var(--line); border-radius: 6px; padding: 8px 10px; }
.live-cell .k { font-size: 11px; color: var(--ink-3); }
.live-cell .v { font-family: var(--font-mono); font-size: 16px; font-weight: 600; }

.uses { display: grid; gap: 10px; }
.use { border: 1px solid var(--line); border-radius: var(--r-md); background: var(--raised); padding: 11px 13px; }
.use-field { font-weight: 600; font-size: 13.5px; }
.use-ex { font-family: var(--font-mono); font-size: 11.5px; color: var(--ink-3); margin-top: 2px; }
.use-why { color: var(--ink-2); font-size: 12.5px; margin-top: 6px; }
.choose { display: grid; gap: 10px; }
.choose div { padding-left: 12px; border-left: 2px solid var(--line); color: var(--ink-2); font-size: 12.5px; }
.choose b { display: block; color: var(--ink); font-size: 12px; margin-bottom: 2px; }
.choose .yes { border-left-color: var(--good); } .choose .no { border-left-color: var(--warn); }

/* ---------- Compare & Concepts ---------- */
.doc { height: 100%; overflow-y: auto; }
.doc-inner { max-width: 1120px; margin: 0 auto; padding-block: 28px 64px; padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); }
.doc-head { max-width: 70ch; }
.doc-kicker { font-family: var(--font-mono); font-size: 11px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--accent); }
.doc-title { font-family: var(--font-display); font-weight: 750; font-stretch: 112%; font-variation-settings: "wdth" 112; font-size: clamp(24px, 3vw, 34px); line-height: 1.1; margin-top: 6px; }
.doc-lede { color: var(--ink-2); font-size: 15px; margin-top: 10px; }
.block { margin-top: 32px; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 20px; }
.block-title { font-weight: 600; font-size: 16px; }
.block-sub { color: var(--ink-3); font-size: 12.5px; margin-top: 2px; max-width: 80ch; }
.ratio-ctl { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 18px; margin-top: 16px; }
.ratio-ctl input[type="range"] { width: min(360px, 100%); }
.ratio-readout { font-family: var(--font-mono); font-size: 13px; font-weight: 600; }
.bands { margin-top: 14px; }
.multiples { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px; margin-top: 12px; }
.multiple { min-width: 0; }
.multiple-title { font-size: 12.5px; font-weight: 600; }
.multiple-val { font-family: var(--font-mono); font-size: 20px; font-weight: 600; margin-top: 2px; }
.multiple svg { display: block; width: 100%; height: auto; overflow: visible; margin-top: 6px; }
.axis-t { font-family: var(--font-mono); font-size: 10px; fill: var(--ink-3); }
.grid-l { stroke: var(--line-soft); stroke-width: 1; }
.axis-l { stroke: var(--line); stroke-width: 1; }
.table-wrap { overflow-x: auto; margin-top: 14px; border: 1px solid var(--line); border-radius: var(--r-md); background: var(--raised); }
table.cmp { border-collapse: collapse; width: 100%; min-width: 980px; font-size: 12.5px; }
table.cmp th, table.cmp td { padding: 9px 12px; text-align: left; border-bottom: 1px solid var(--line-soft); vertical-align: top; }
table.cmp thead th { font-family: var(--font-mono); font-size: 10.5px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink-3); font-weight: 500; background: var(--surface); position: sticky; top: 0; }
table.cmp tbody tr { cursor: pointer; }
table.cmp tbody tr:hover { background: var(--accent-soft); }
table.cmp td.num { font-family: var(--font-mono); font-variant-numeric: tabular-nums; white-space: nowrap; }
table.cmp td.name { font-weight: 600; white-space: nowrap; }
.meter { display: inline-flex; gap: 2px; vertical-align: middle; margin-right: 6px; }
.meter i { width: 9px; height: 9px; border-radius: 2px; background: var(--line-soft); box-shadow: inset 0 0 0 1px var(--line); }
.meter i.on { background: var(--ink-2); box-shadow: none; }
.meter-n { font-family: var(--font-mono); font-size: 11px; color: var(--ink-3); }
.guide { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; margin-top: 14px; }
.guide-item { background: var(--raised); border: 1px solid var(--line); border-radius: var(--r-md); padding: 12px 14px; }
.guide-need { font-size: 12px; color: var(--ink-3); }
.guide-pick { font-weight: 600; margin-top: 2px; }
.guide-why { font-size: 12.5px; color: var(--ink-2); margin-top: 4px; }
.link-btn { border: 0; background: none; padding: 0; color: var(--accent); cursor: pointer; font-weight: 500; font-size: 12.5px; text-decoration: underline; text-underline-offset: 2px; }
.gloss { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 12px; margin-top: 24px; }
.term { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-md); padding: 14px 16px; display: flex; flex-direction: column; gap: 6px; }
.term-name { font-weight: 600; font-size: 14.5px; }
.term-f { font-family: var(--font-mono); font-size: 12.5px; background: var(--raised); border: 1px solid var(--line-soft); border-radius: 5px; padding: 6px 8px; overflow-x: auto; white-space: nowrap; }
.term-d { color: var(--ink-2); font-size: 13px; }
.term-see { margin-top: auto; font-size: 12px; color: var(--ink-3); display: flex; flex-wrap: wrap; gap: 4px 10px; align-items: center; }

/* ---------- Responsive ---------- */
@media (max-width: 1180px) {
  .lab { grid-template-columns: 208px minmax(0, 1fr) 340px; }
  .stage-title { right: 16px; }
  .hud { top: auto; bottom: 70px; }
}
@media (max-width: 880px) {
  html, body { height: auto; }
  .app { height: auto; min-height: 100%; }
  .view { flex: none; }
  .lab { display: flex; flex-direction: column; height: auto; }
  .rail { border-right: 0; border-bottom: 1px solid var(--line); display: flex; gap: 6px; overflow-x: auto; overflow-y: hidden; padding: 10px max(16px, env(safe-area-inset-right, 0px)) 10px max(16px, env(safe-area-inset-left, 0px)); }
  .rail-group { display: contents; }
  .rail-head { display: none; }
  .rail-item { flex: none; width: auto; border: 1px solid var(--line); background: var(--raised); padding: 6px 10px; }
  .rail-spec { display: none; }
  .rail-name::before { display: none; }
  .rail-item[aria-current="true"] { border-color: var(--ink); box-shadow: inset 0 0 0 1px var(--ink); }
  .stage { flex: none; height: 64vh; min-height: 380px; max-height: 640px; }
  .stage-title { top: 12px; left: 14px; right: 14px; }
  .stage-tagline { display: none; }
  .hud { top: auto; bottom: 12px; right: 12px; width: 200px; padding: 8px 10px; }
  .hud-foot { display: none; }
  .controls { position: static; transform: none; width: auto; max-width: none; margin: 0; border-radius: 0; border-left: 0; border-right: 0; box-shadow: none; justify-content: flex-start; padding: 8px max(16px, env(safe-area-inset-left, 0px)); }
  .hint { display: none; }
  .sheet { border-left: 0; border-top: 1px solid var(--line); }
  .sheet-body { overflow: visible; padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); }
  .multiples { grid-template-columns: 1fr; }
  .brand-sub { display: none; }
  .tabs { margin-left: 0; }
}
@media (max-width: 480px) {
  .pc { grid-template-columns: 1fr; }
  .hud { display: none; }
  .controls input[type="range"] { width: 72px; }
  .controls { gap: 4px 10px; }
}
@media (prefers-reduced-motion: reduce) {
  * { scroll-behavior: auto !important; transition: none !important; }
}
