/* Cascade: "the bench". One viewport on desktop: notice, top bar, a control
   rail and a tabbed stage. Dark-first night lab; a designed light theme too.
   Data colors are the validated pair (corrected blue, original orange) and
   never double as decoration. Brand accents are crimson and plasma straw. */

:root {
  color-scheme: dark;
  --bg: #0e0c0a;
  --bg-2: #15120f;
  --surface: #1a1714;
  --surface-2: #221e1a;
  --line: #2f2a24;
  --line-2: #3d362e;
  --ink: #f3ede2;
  --ink-2: #cbc2b2;
  --muted: #958b7b;
  --grid: #26221d;
  --axis: #4a433a;
  --brand: #e0564d;            /* crimson, brand only */
  --brand-soft: rgba(224, 86, 77, 0.16);
  --plasma: #f1cf7a;           /* plasma is straw-yellow */
  --plasma-2: #c99a3c;
  --notice-bg: #e0564d;
  --notice-ink: #140d0b;
  --series-corrected: #3987e5;
  --series-original: #d95926;
  --series-lab: #f3ede2;
  --series-ref: #8a8170;
  --focus: #6da7ec;
  --glow: 0 0 0 1px rgba(255, 255, 255, 0.03), 0 20px 60px -30px rgba(0, 0, 0, 0.9);
  --r: 16px;
  --font-body: "Atkinson Hyperlegible", "Segoe UI", system-ui, sans-serif;
  --font-read: "Literata", Georgia, serif;
  --font-display: "Bodoni Moda", "Didot", Georgia, serif;
  --font-mono: "IBM Plex Mono", ui-monospace, monospace;
}

@media (prefers-color-scheme: light) {
  :root:where(:not([data-theme="dark"])) {
    color-scheme: light;
    --bg: #f4efe4; --bg-2: #ece5d6; --surface: #fffcf5; --surface-2: #f7f1e4;
    --line: #e2d9c6; --line-2: #d3c7ae; --ink: #1c1812; --ink-2: #4a4337; --muted: #7b715f;
    --grid: #ece4d3; --axis: #c3b8a1; --brand: #b3322b; --brand-soft: rgba(179, 50, 43, 0.1);
    --plasma: #f0c95e; --plasma-2: #a8771c; --notice-bg: #1c1812; --notice-ink: #fbf3df;
    --series-corrected: #2a78d6; --series-original: #eb6834; --series-lab: #1c1812; --series-ref: #9a9384;
    --focus: #2a78d6; --glow: 0 1px 0 rgba(28, 24, 18, 0.04), 0 18px 40px -28px rgba(28, 24, 18, 0.35);
  }
}
:root[data-theme="light"] {
  color-scheme: light;
  --bg: #f4efe4; --bg-2: #ece5d6; --surface: #fffcf5; --surface-2: #f7f1e4;
  --line: #e2d9c6; --line-2: #d3c7ae; --ink: #1c1812; --ink-2: #4a4337; --muted: #7b715f;
  --grid: #ece4d3; --axis: #c3b8a1; --brand: #b3322b; --brand-soft: rgba(179, 50, 43, 0.1);
  --plasma: #f0c95e; --plasma-2: #a8771c; --notice-bg: #1c1812; --notice-ink: #fbf3df;
  --series-corrected: #2a78d6; --series-original: #eb6834; --series-lab: #1c1812; --series-ref: #9a9384;
  --focus: #2a78d6; --glow: 0 1px 0 rgba(28, 24, 18, 0.04), 0 18px 40px -28px rgba(28, 24, 18, 0.35);
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr);
  height: 100dvh;
  overflow: hidden;
  color: var(--ink);
  font: 16px/1.5 var(--font-body);
  background:
    radial-gradient(900px 600px at 78% -10%, var(--brand-soft), transparent 60%),
    radial-gradient(700px 500px at -10% 110%, color-mix(in oklab, var(--plasma) 10%, transparent), transparent 60%),
    var(--bg);
}
body::before {
  /* fine grain so large dark areas do not band */
  content: ""; position: fixed; inset: 0; pointer-events: none; z-index: 0; opacity: 0.035;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence baseFrequency='.9' numOctaves='2'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

.skip { position: absolute; left: -999px; top: 0; background: var(--surface); color: var(--ink); padding: 8px 12px; z-index: 50; }
.skip:focus { left: 12px; top: 8px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
:focus-visible { outline: 2.5px solid var(--focus); outline-offset: 2px; border-radius: 8px; }
button { font: inherit; color: inherit; }

/* ---------- notice: always visible, never a footer */
.notice {
  position: relative; z-index: 3;
  display: flex; gap: 8px; align-items: center; justify-content: center;
  padding: 7px 16px; background: var(--notice-bg); color: var(--notice-ink);
  font-size: 13.5px; font-weight: 700; letter-spacing: 0.01em; text-align: center;
}
.notice p { margin: 0; }
.notice svg { flex: none; }

/* ---------- top bar */
.topbar {
  position: relative; z-index: 2;
  display: grid; grid-template-columns: 340px 1fr auto; align-items: center; gap: 16px;
  padding: 12px 20px; border-bottom: 1px solid var(--line);
  background: color-mix(in oklab, var(--bg) 80%, transparent);
  backdrop-filter: blur(8px);
}
.brand { display: flex; align-items: center; gap: 12px; }
.brand-mark { width: 34px; height: 34px; fill: var(--brand); stroke: var(--brand); }
.brand-mark circle:nth-child(2) { opacity: 0.75; } .brand-mark circle:nth-child(3) { opacity: 0.85; }
.brand-name { display: block; font: 700 25px/1 var(--font-display); letter-spacing: 0.01em; }
.brand-sub { display: block; color: var(--muted); font-size: 12.5px; margin-top: 3px; }

.tabs { display: flex; gap: 4px; background: var(--surface); border: 1px solid var(--line); border-radius: 999px; padding: 4px; justify-self: start; }
.tabs [role="tab"] {
  border: 0; background: none; cursor: pointer; padding: 8px 16px; border-radius: 999px;
  color: var(--ink-2); font-weight: 700; font-size: 14.5px; white-space: nowrap;
  transition: background 0.2s, color 0.2s;
}
.tabs [role="tab"]:hover { color: var(--ink); }
.tabs [role="tab"][aria-selected="true"] { background: var(--ink); color: var(--bg); }
.tab-badge { font: 500 10.5px var(--font-mono); padding: 1px 5px; border-radius: 5px; margin-left: 4px; background: var(--brand); color: #fff; vertical-align: 1px; }
.theme-toggle { border: 1px solid var(--line); background: var(--surface); width: 38px; height: 38px; border-radius: 50%; cursor: pointer; display: grid; place-items: center; color: var(--ink-2); }

/* ---------- workspace */
.workspace {
  position: relative; z-index: 1;
  display: grid; grid-template-columns: 340px minmax(0, 1fr); gap: 16px;
  padding: 16px 20px 18px; min-height: 0;
}
.rail {
  min-height: 0; overflow-y: auto; scrollbar-width: thin;
  display: flex; flex-direction: column; gap: 10px; padding-right: 4px;
}
.rail-block { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 12px 14px; box-shadow: var(--glow); }
.rail-title { display: block; margin: 0 0 10px; font: 700 12px/1.2 var(--font-body); letter-spacing: 0.12em; text-transform: uppercase; color: var(--muted); }
.hint { color: var(--muted); font-size: 13px; margin: 8px 0 0; line-height: 1.45; }
.eyebrow { color: var(--muted); font-size: 12.5px; }

.presets { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.preset {
  text-align: left; cursor: pointer; padding: 8px 10px; border-radius: 12px;
  border: 1px solid var(--line-2); background: var(--surface-2);
  transition: border-color 0.2s, transform 0.2s, background 0.2s;
}
.preset:hover { transform: translateY(-1px); border-color: var(--ink-2); }
.preset[aria-pressed="true"] { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.preset .p-label { display: block; font-weight: 700; font-size: 14px; line-height: 1.25; }
.preset .p-level { display: block; font: 500 11.5px var(--font-mono); opacity: 0.7; margin-top: 3px; }

.tube-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.tube-head .rail-title { margin: 0; }
select {
  font: 700 14px var(--font-body); padding: 7px 10px; border-radius: 10px; min-width: 0; max-width: 200px;
  border: 1px solid var(--line-2); background: var(--surface-2); color: var(--ink);
}
.tube-row { display: grid; grid-template-columns: 70px 1fr; gap: 16px; align-items: center; margin-top: 8px; }
.tube { width: 70px; cursor: ns-resize; touch-action: none; border-radius: 14px; }
.tube svg { display: block; width: 100%; height: auto; overflow: visible; }
.tube-glass { fill: color-mix(in oklab, var(--ink) 5%, transparent); stroke: color-mix(in oklab, var(--ink) 55%, transparent); stroke-width: 2; }
.tube-rim { stroke: color-mix(in oklab, var(--ink) 70%, transparent); stroke-width: 3; stroke-linecap: round; }
.tube-shine { stroke: rgba(255, 255, 255, 0.22); stroke-width: 3; stroke-linecap: round; }
.liquid, .meniscus { transition: y 0.45s cubic-bezier(.2,.8,.2,1), height 0.45s cubic-bezier(.2,.8,.2,1), cy 0.45s cubic-bezier(.2,.8,.2,1); }
.meniscus { fill: color-mix(in oklab, var(--plasma) 70%, white); opacity: 0.9; }
.bubbles circle { fill: rgba(255, 255, 255, 0.55); animation: rise 3.2s linear infinite; }
@keyframes rise { from { transform: translateY(0); opacity: 0; } 15% { opacity: 0.8; } to { transform: translateY(-160px); opacity: 0; } }
.tube-ticks text { fill: var(--muted); font: 500 9px var(--font-mono); }
.tube-ticks line { stroke: color-mix(in oklab, var(--ink) 35%, transparent); stroke-width: 1; }
.big-level { font: 700 58px/0.95 var(--font-display); letter-spacing: -0.02em; font-variant-numeric: lining-nums tabular-nums; }
.big-level .pct { font-size: 28px; color: var(--muted); margin-left: 2px; }
.steppers { display: flex; gap: 6px; margin-top: 10px; }
.step { width: 40px; height: 34px; border-radius: 10px; border: 1px solid var(--line-2); background: var(--surface-2); cursor: pointer; font-size: 18px; font-weight: 700; }
.step:hover { border-color: var(--ink-2); }

.seg { display: flex; border: 1px solid var(--line-2); border-radius: 12px; padding: 3px; background: var(--surface-2); }
.seg label { position: relative; flex: 1; cursor: pointer; }
.seg input { position: absolute; opacity: 0; inset: 0; cursor: pointer; margin: 0; }
.seg span { display: block; text-align: center; padding: 7px 10px; border-radius: 9px; font-weight: 700; font-size: 14px; color: var(--ink-2); transition: background 0.2s, color 0.2s; }
.seg input:checked + span { background: var(--ink); color: var(--bg); }
.seg input:focus-visible + span { outline: 2.5px solid var(--focus); outline-offset: 1px; }
.seg.small span { padding: 5px 8px; font-size: 13px; }
.switch-note { margin: 10px 0 0; padding: 9px 11px; border-radius: 10px; font-size: 13.5px; background: var(--brand-soft); border-left: 3px solid var(--brand); }

.toggle { display: flex; align-items: center; gap: 10px; margin: 8px 0; cursor: pointer; font-size: 14.5px; }
.toggle input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.toggle .switch { flex: none; width: 36px; height: 21px; border-radius: 999px; background: var(--line-2); position: relative; transition: background 0.2s; }
.toggle .switch::after { content: ""; position: absolute; top: 3px; left: 3px; width: 15px; height: 15px; border-radius: 50%; background: var(--ink); transition: transform 0.2s; }
.toggle input:checked + .switch { background: var(--series-corrected); }
.toggle input:checked + .switch::after { transform: translateX(15px); background: #fff; }
.toggle input:focus-visible + .switch { outline: 2.5px solid var(--focus); outline-offset: 2px; }

/* ---------- glossary terms */
.term {
  background: none; border: 0; padding: 0; cursor: help; color: inherit; font: inherit;
  text-decoration: underline dotted color-mix(in oklab, var(--ink) 55%, transparent);
  text-underline-offset: 3px; text-decoration-thickness: 1.5px;
}
.term:hover { text-decoration-style: solid; }
.term-pop {
  position: absolute; z-index: 60; max-width: 320px;
  background: var(--ink); color: var(--bg); padding: 10px 12px; border-radius: 12px;
  font-size: 14px; line-height: 1.45; box-shadow: 0 16px 40px -12px rgba(0, 0, 0, 0.6);
}
.term-pop strong { display: block; margin-bottom: 2px; }

/* ---------- stage */
.stage { min-height: 0; min-width: 0; position: relative; }
.stage:focus { outline: none; }
.panel {
  height: 100%; min-height: 0; display: flex; flex-direction: column; gap: 12px;
  background: var(--surface); border: 1px solid var(--line); border-radius: calc(var(--r) + 4px);
  padding: 18px 20px; box-shadow: var(--glow);
  animation: enter 0.45s cubic-bezier(.2,.8,.2,1) both;
}
.panel[hidden] { display: none; }
@keyframes enter { from { opacity: 0; transform: translateY(6px) scale(0.995); } to { opacity: 1; transform: none; } }

.panel-head { display: flex; flex-direction: column; gap: 8px; }
.verdict {
  margin: 0; max-width: 64ch; font: 400 clamp(17px, 1.55vw, 21px)/1.4 var(--font-read);
  text-wrap: pretty;
}
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  display: inline-flex; align-items: center; gap: 6px; cursor: pointer;
  border: 1px solid var(--line-2); background: var(--surface-2); border-radius: 999px;
  padding: 4px 11px 4px 8px; font-size: 13px; font-weight: 700; color: var(--ink-2);
}
.chip::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--brand); }
.chip[aria-expanded="true"] { background: var(--ink); color: var(--bg); }
.chip-text { flex-basis: 100%; margin: 2px 0 0; font-size: 13.5px; color: var(--ink-2); padding: 8px 12px; border-radius: 10px; background: var(--surface-2); border-left: 3px solid var(--brand); }

.chart-card { flex: 1; min-height: 0; display: flex; flex-direction: column; border: 1px solid var(--line); border-radius: var(--r); background: var(--bg-2); padding: 10px 12px 8px; }
.chart-toolbar { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.legend { display: flex; flex-wrap: wrap; gap: 4px 16px; font-size: 13px; color: var(--ink-2); }
.legend .key { display: inline-flex; align-items: center; gap: 7px; }
.view-toggle { border: 1px solid var(--line-2); background: var(--surface-2); padding: 4px 12px; border-radius: 999px; cursor: pointer; font-size: 13px; font-weight: 700; color: var(--ink-2); }
.view-toggle[aria-pressed="true"] { background: var(--ink); color: var(--bg); }
.chart { position: relative; margin: 0; flex: 1; min-height: 0; }
.chart[hidden] { display: none; }
.chart-svg { position: absolute; inset: 0; }
.chart-svg svg { display: block; width: 100%; height: 100%; overflow: visible; }
.chart .axis text { fill: var(--muted); font: 500 11px var(--font-mono); }
.chart .axis-title { fill: var(--ink-2); font: 700 12px var(--font-body); }
.chart .grid line { stroke: var(--grid); }
.chart .baseline { stroke: var(--axis); }
.chart .direct { font: 700 12.5px var(--font-body); fill: var(--ink); paint-order: stroke; stroke: var(--bg-2); stroke-width: 5px; }
.chart .crosshair { stroke: var(--ink-2); stroke-dasharray: 2 3; }
.chart .marker { stroke: var(--ink-2); stroke-width: 1.2; stroke-dasharray: 3 4; }
.chart .marker-label { font: 700 11.5px var(--font-body); fill: var(--ink); paint-order: stroke; stroke: var(--bg-2); stroke-width: 4px; }

.tooltip {
  position: absolute; pointer-events: none; z-index: 5; min-width: 170px;
  background: var(--surface); border: 1px solid var(--line-2); border-radius: 12px; padding: 8px 10px;
  font-size: 13px; box-shadow: 0 14px 34px -14px rgba(0, 0, 0, 0.7);
}
.tooltip .t-head { color: var(--muted); font-size: 12px; margin-bottom: 4px; }
.tooltip .t-row { display: grid; grid-template-columns: 16px auto 1fr; gap: 6px; align-items: center; }
.tooltip .t-val { font-weight: 700; font-variant-numeric: tabular-nums; }
.tooltip .t-name { color: var(--ink-2); }

.table-view { flex: 1; min-height: 0; overflow: auto; margin-top: 6px; }
.table-view[hidden] { display: none; }
table { border-collapse: collapse; font-size: 13px; font-variant-numeric: tabular-nums; width: 100%; }
th, td { padding: 5px 10px; text-align: right; border-bottom: 1px solid var(--line); white-space: nowrap; }
th:first-child, td:first-child { text-align: left; }
thead th { position: sticky; top: 0; background: var(--bg-2); color: var(--ink-2); }

.measures { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
.measure { border: 1px solid var(--line); border-radius: 14px; padding: 11px 13px; background: var(--surface-2); position: relative; overflow: hidden; }
.measure::after { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 3px; background: var(--series-corrected); transform-origin: left; transform: scaleX(var(--fill, 0)); transition: transform 0.6s cubic-bezier(.2,.8,.2,1); opacity: 0.8; }
.measure .m-name { font-weight: 700; font-size: 13.5px; }
.measure .m-value { font: 700 30px/1.05 var(--font-display); margin: 4px 0 1px; font-variant-numeric: lining-nums tabular-nums; }
.measure .m-unit { font: 400 13px var(--font-body); color: var(--muted); margin-left: 4px; }
.measure .m-rel { color: var(--ink-2); font-size: 13px; }
.measure .m-lab { color: var(--muted); font-size: 12.5px; margin-top: 3px; }

/* ---------- 3D cascade */
.cascade-wrap {
  flex: 1; min-height: 0; display: grid; gap: 12px;
  grid-template-columns: minmax(0, 1fr) 260px; grid-template-rows: minmax(0, 1fr) auto;
}
.cascade-canvas {
  position: relative; min-height: 0; border-radius: var(--r); overflow: hidden;
  background: radial-gradient(120% 90% at 50% 0%, #1b1712 0%, #0a0907 70%);
  border: 1px solid var(--line);
}
.cascade-canvas canvas { display: block; width: 100%; height: 100%; }
.cascade-canvas .label3d {
  font: 700 12.5px var(--font-body); color: #f3ede2; text-align: center; pointer-events: none;
  text-shadow: 0 1px 8px rgba(0, 0, 0, 0.9); white-space: nowrap;
}
.label3d .l-val { display: block; font: 500 11px var(--font-mono); color: #cbc2b2; }
.label3d.deficient .l-name { color: #f1cf7a; }
.cascade-fallback { position: absolute; inset: 0; display: grid; place-items: center; padding: 20px; color: #cbc2b2; text-align: center; }
.cascade-key { position: absolute; right: 14px; bottom: 12px; display: flex; gap: 14px; font-size: 12px; color: #b3a995; pointer-events: none; }
.cascade-key span { display: inline-flex; align-items: center; gap: 6px; }
.cascade-key i { display: inline-block; width: 18px; height: 0; border-top: 2px solid #6b6152; }
.cascade-key i.k-dash { border-top-style: dashed; }
.cascade-key i.k-ghost { width: 10px; height: 10px; border: 1px dashed #8a7a52; border-radius: 50%; }
.cascade-hint { position: absolute; left: 14px; bottom: 12px; font-size: 12px; color: #958b7b; pointer-events: none; }
.cascade-side { min-height: 0; overflow: auto; border: 1px solid var(--line); border-radius: var(--r); background: var(--bg-2); padding: 12px 14px; grid-row: span 2; }
.side-title { margin: 14px 0 0; font: 700 12px var(--font-body); letter-spacing: 0.12em; text-transform: uppercase; color: var(--muted); }
.node-list { list-style: none; margin: 10px 0 0; padding: 0; display: grid; gap: 7px; }
.node-list li { display: grid; grid-template-columns: 1fr auto; gap: 3px 8px; align-items: baseline; font-size: 13.5px; }
.node-list .n-name { font-weight: 700; }
.node-list .n-val { font: 500 12.5px var(--font-mono); color: var(--ink-2); }
.node-list .n-bar { grid-column: span 2; height: 5px; border-radius: 3px; background: var(--line); overflow: hidden; }
.node-list .n-bar i { display: block; height: 100%; background: var(--n-color, var(--series-corrected)); transform-origin: left; transform: scaleX(var(--v, 0)); transition: transform 0.5s cubic-bezier(.2,.8,.2,1); }
.node-list li.deficient .n-name { color: var(--plasma-2); }

.player { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 12px; align-items: center; }
.play { width: 44px; height: 44px; border-radius: 50%; border: 0; cursor: pointer; background: var(--brand); color: #fff; display: grid; place-items: center; box-shadow: 0 8px 24px -10px var(--brand); }
.play:hover { filter: brightness(1.1); }
.scrub { position: relative; height: 40px; }
.spark { position: absolute; inset: 0; width: 100%; height: 100%; }
.spark path.fill { fill: color-mix(in oklab, var(--series-corrected) 22%, transparent); }
.spark path.line { fill: none; stroke: var(--series-corrected); stroke-width: 1.5; vector-effect: non-scaling-stroke; }
.spark line.head { stroke: var(--ink); stroke-width: 1.5; vector-effect: non-scaling-stroke; }
.scrub input { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; margin: 0; }
.scrub:focus-within { outline: 2.5px solid var(--focus); outline-offset: 3px; border-radius: 6px; }
.clock { font: 500 15px var(--font-mono); color: var(--ink-2); min-width: 64px; text-align: right; }

/* ---------- learn */
.learn { overflow: auto; }
.learn-grid { display: grid; grid-template-columns: 1.1fr 1fr; gap: 32px; }
.learn h2 { font: 700 26px/1.15 var(--font-display); margin: 4px 0 10px; }
.learn .lede, .learn p, .learn li { font-family: var(--font-read); color: var(--ink-2); max-width: 62ch; }
.learn .lede { font-size: 19px; color: var(--ink); }
.limits { padding-left: 18px; }
.limits li { margin-bottom: 6px; }
.glossary { display: grid; grid-template-columns: max-content 1fr; gap: 8px 16px; margin: 0; font-size: 14.5px; }
.glossary dt { font-weight: 700; }
.glossary dd { margin: 0; color: var(--ink-2); }
.source { font-size: 13px; color: var(--muted); }
.noscript { padding: 20px; }

/* ---------- smaller screens: stack and scroll */
@media (max-width: 1100px) {
  .topbar { grid-template-columns: 1fr auto; }
  .tabs { grid-column: 1 / -1; grid-row: 2; overflow-x: auto; max-width: 100%; }
  .workspace { grid-template-columns: 300px minmax(0, 1fr); }
  .cascade-wrap { grid-template-columns: minmax(0, 1fr); grid-template-rows: minmax(0, 1fr) auto auto; }
  .cascade-side { grid-row: auto; max-height: 180px; }
}
@media (max-width: 820px) {
  body { height: auto; overflow: auto; display: block; }
  .notice { position: sticky; top: 0; z-index: 10; font-size: 12.5px; }
  .topbar { position: static; padding: 10px 16px; }
  .stage { scroll-margin-top: 80px; }
  .brand-sub { display: none; }
  .workspace { display: block; padding: 12px 16px 24px; }
  .rail { overflow: visible; margin-bottom: 12px; padding: 0; }
  .panel { height: auto; min-height: 0; padding: 16px; }
  .chart-card { min-height: 300px; }
  .chart { min-height: 260px; }
  .cascade-canvas { height: 380px; }
  .measures { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .learn-grid { grid-template-columns: 1fr; }
  .glossary { grid-template-columns: 1fr; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
@media (forced-colors: active) {
  .notice { border-bottom: 2px solid CanvasText; }
}

.rail-sub { margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--line); }
@media (max-height: 980px) and (min-width: 821px) {
  .rail .hint.long { display: none; }
}

@media (max-height: 780px) and (min-width: 821px) {
  .verdict { font-size: 16.5px; line-height: 1.38; }
  .panel { padding: 14px 16px; gap: 10px; }
  .measure { padding: 9px 11px; }
  .measure .m-value { font-size: 25px; }
  .measure .m-lab { display: none; }
}
