/* VHDL Practice: calm, editor-centric, light/dark from the system. */

:root {
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, Roboto, "Helvetica Neue",
    Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas, "DejaVu Sans Mono",
    "Liberation Mono", monospace;

  --bg: #f6f5f1;
  --surface: #ffffff;
  --ink: #1c1f23;
  --muted: #5e646b;
  --line: #dedcd5;
  --accent: #0d6b63;
  --accent-ink: #ffffff;
  --accent-soft: #e2f0ee;
  --pass: #1d7a3e;
  --pass-soft: #e5f3e9;
  --fail: #b3261e;
  --fail-soft: #fbeceb;
  --warn: #8a5a00;
  --warn-soft: #fbf1dc;

  --editor-bg: #fdfcfa;
  --editor-gutter: #f3f1ec;
  --editor-active: #f0eee7;
  --editor-sel: #cfe6e2;
  --tok-keyword: #7a2f9e;
  --tok-type: #0d6b63;
  --tok-string: #9a4a00;
  --tok-number: #1757a8;
  --tok-comment: #7b8087;
  --tok-operator: #5e646b;

  --radius: 8px;
  --header-h: 52px;
  --tabs-h: 48px;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #16181b;
    --surface: #1e2124;
    --ink: #e3e5e8;
    --muted: #9aa1a9;
    --line: #2f3338;
    --accent: #5cc2b6;
    --accent-ink: #0d1716;
    --accent-soft: #1b3330;
    --pass: #6bcf8b;
    --pass-soft: #1a2e21;
    --fail: #ff8a80;
    --fail-soft: #3a1f1d;
    --warn: #f0c060;
    --warn-soft: #33291a;

    --editor-bg: #1a1c1f;
    --editor-gutter: #1e2124;
    --editor-active: #23272b;
    --editor-sel: #2c4a46;
    --tok-keyword: #d39cf0;
    --tok-type: #6fcfc3;
    --tok-string: #f0b37a;
    --tok-number: #8ab8f5;
    --tok-comment: #7d858e;
    --tok-operator: #a5acb4;
    color-scheme: dark;
  }
}

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 16px/1.55 var(--sans);
  min-height: 100dvh;
}

a { color: var(--accent); text-underline-offset: 2px; }
code, pre, .mono { font-family: var(--mono); }
code { font-size: 0.92em; }
h1, h2 { line-height: 1.25; letter-spacing: -0.01em; }
h1 { font-size: 1.5rem; margin: 0 0 0.25rem; }
h2 { font-size: 1.1rem; }
.muted { color: var(--muted); }
.small { font-size: 0.875rem; }
.visually-hidden {
  position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap;
}
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
main:focus { outline: none; }

/* ---------- header */
.top {
  position: sticky; top: 0; z-index: 20;
  height: var(--header-h);
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding: 0 max(12px, env(safe-area-inset-right)) 0 max(16px, env(safe-area-inset-left));
  background: var(--bg);
  border-bottom: 1px solid var(--line);
}
.brand {
  white-space: nowrap; flex-shrink: 0;
  font-family: var(--mono); font-weight: 600; font-size: 1rem;
  color: var(--ink); text-decoration: none;
  min-height: 44px; display: inline-flex; align-items: center;
}
.brand-mark { color: var(--accent); }
.brand-slash { color: var(--muted); margin: 0 1px; }
.top-nav { display: flex; gap: 2px; }
.top-nav a {
  min-height: 44px; display: inline-flex; align-items: center;
  padding: 0 8px; border-radius: var(--radius); white-space: nowrap;
  color: var(--muted); text-decoration: none; font-size: 0.95rem;
}
.top-nav a[aria-current] { color: var(--ink); background: var(--surface); }
.top-nav a:hover { color: var(--ink); }

/* VHDL 93 | 08 switch */
.std-switch { display: flex; align-items: center; gap: 2px; margin-left: auto; }
.std-switch-label { color: var(--muted); font-size: 0.8rem; margin-right: 4px; }
.std-opt {
  -webkit-appearance: none; appearance: none;
  min-height: 44px; min-width: 44px; padding: 0 6px;
  border: 0; border-radius: var(--radius); background: none; cursor: pointer;
  font-size: 0.95rem; font-weight: 600; color: var(--muted);
  touch-action: manipulation;
}
.std-opt:hover { color: var(--ink); }
.std-opt[aria-checked="true"] {
  color: var(--accent); background: var(--accent-soft);
  box-shadow: inset 0 0 0 1px var(--accent);
}
@media (max-width: 479px) {
  /* Phone header: brand, switch and one nav link. The brand already links to the list. */
  .std-switch-label, .nav-long, .top-nav a[data-nav="list"] { display: none; }
}

/* ---------- shared bits */
.page {
  max-width: 720px; margin: 0 auto;
  padding: 20px 16px calc(40px + env(safe-area-inset-bottom));
}
.loading { padding-top: 24px; }

.btn {
  -webkit-appearance: none; appearance: none;
  min-height: 44px; min-width: 44px;
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 0 16px;
  font: 500 0.95rem/1 var(--sans);
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: var(--surface); color: var(--ink);
  text-decoration: none; cursor: pointer;
  touch-action: manipulation;
}
.btn:hover { border-color: var(--muted); }
.btn:disabled { opacity: 0.6; cursor: progress; }
.btn-primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.btn-primary:hover { filter: brightness(1.06); border-color: var(--accent); }
.btn-quiet { background: transparent; }
.btn.armed { color: var(--fail); border-color: var(--fail); background: var(--fail-soft); }

.notice { padding: 12px 14px; border-radius: var(--radius); margin: 0 0 12px; }
.notice-error { color: var(--fail); background: var(--fail-soft); }
.notice[data-kind="busy"], .notice[data-kind="rate"] { color: var(--warn); background: var(--warn-soft); }
.form-status.notice-error { padding: 10px 12px; border-radius: var(--radius); }

.badge {
  display: inline-block; font-size: 0.75rem; font-weight: 600;
  padding: 3px 8px; border-radius: 999px;
  color: var(--warn); background: var(--warn-soft); border: 1px solid currentColor;
  white-space: nowrap;
}
.badge-sm { font-size: 0.68rem; padding: 1px 6px; margin-left: 8px; vertical-align: 1px; }

/* ---------- list */
.list-head { margin-bottom: 8px; }
.list-head p { margin: 0.25rem 0; }
.tally { color: var(--muted); }
.tally .mono { color: var(--ink); font-weight: 600; }
.section { margin-top: 24px; }
.section-title {
  display: flex; justify-content: space-between; align-items: baseline;
  margin: 0 0 6px; padding: 0 4px;
  font-size: 0.8rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.06em;
  color: var(--muted);
}
.section-count { font-weight: 500; letter-spacing: 0; display: inline-flex; gap: 10px; white-space: nowrap; }
.std-count-tag {
  font-size: 0.85em; padding: 0 4px; border-radius: 4px; border: 1px solid var(--line);
}
.list-page[data-std="93"] .std-count[data-std="93"],
.list-page[data-std="08"] .std-count[data-std="08"] { color: var(--ink); }
.list-page[data-std="93"] .std-count[data-std="93"] .std-count-tag,
.list-page[data-std="08"] .std-count[data-std="08"] .std-count-tag { border-color: var(--accent); color: var(--accent); }
.problem-list {
  list-style: none; margin: 0; padding: 0;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  overflow: hidden;
}
.problem-list li + li { border-top: 1px solid var(--line); }
.problem-row {
  display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 10px;
  min-height: 52px; padding: 8px 14px 8px 10px;
  color: var(--ink); text-decoration: none;
}
.problem-row:hover { background: var(--editor-active); }
.problem-id { color: var(--muted); font-size: 0.78rem; overflow-wrap: anywhere; text-align: right; }
.problem-title { min-width: 0; overflow-wrap: break-word; }

/* per-version marks: empty outline, attempted amber, solved green */
.vmarks { display: inline-flex; gap: 4px; }
.vmark {
  display: inline-grid; place-items: center; width: 26px; height: 20px;
  font-size: 0.7rem; font-weight: 600; border-radius: 4px;
  color: var(--muted); border: 1px dashed var(--line);
}
.vmark-gap { border-color: transparent; }
.vmark[data-state="attempted"] { color: var(--warn); background: var(--warn-soft); border: 1px solid var(--warn); }
.vmark[data-state="solved"] { color: var(--pass-soft); background: var(--pass); border: 1px solid var(--pass); }
.list-page[data-std="93"] .vmark[data-std="08"],
.list-page[data-std="08"] .vmark[data-std="93"] { opacity: 0.5; }

/* ---------- settings */
.warning {
  padding: 12px 14px; border-radius: var(--radius);
  background: var(--warn-soft); color: var(--ink); border-left: 3px solid var(--warn);
}
.code-card {
  margin: 16px 0 28px; padding: 20px 16px;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  display: flex; flex-direction: column; align-items: center; text-align: center; gap: 10px;
}
.code-big {
  margin: 0; font-size: clamp(1.5rem, 7.4vw, 2.2rem); font-weight: 600;
  letter-spacing: 0.06em; user-select: all; -webkit-user-select: all;
  overflow-wrap: anywhere;
}
.qr {
  width: 180px; height: 180px; border-radius: 6px;
  background: #fff; padding: 4px; image-rendering: pixelated;
}
.code-card p { margin: 0; }
.link-form label { display: block; font-weight: 600; margin-bottom: 6px; }
.link-row { display: flex; gap: 8px; }
.confirm-row { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; }
.code-input {
  flex: 1; min-width: 0; min-height: 44px; padding: 0 12px;
  font-size: 16px; letter-spacing: 0.04em; text-transform: uppercase;
  color: var(--ink); background: var(--surface);
  border: 1px solid var(--line); border-radius: var(--radius);
}
.code-input::placeholder { color: var(--muted); opacity: 0.6; }
.form-status { min-height: 1.5em; margin: 10px 0 0; }

/* ---------- problem page: narrow (tabs) */
.problem-layout { display: block; }
.tabs {
  position: sticky; top: var(--header-h); z-index: 10;
  display: grid; grid-template-columns: repeat(3, 1fr);
  height: var(--tabs-h);
  background: var(--bg); border-bottom: 1px solid var(--line);
}
.tab {
  -webkit-appearance: none; appearance: none;
  min-height: 44px; border: 0; background: none; cursor: pointer;
  font: 500 0.95rem var(--sans); color: var(--muted);
  border-bottom: 2px solid transparent; margin-bottom: -1px;
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  touch-action: manipulation;
}
.tab[aria-selected="true"] { color: var(--ink); border-bottom-color: var(--accent); }
.tab-mark { font-size: 0.85em; }
.tab[data-status="pass"] .tab-mark { color: var(--pass); }
.tab[data-status="fail"] .tab-mark,
.tab[data-status="compile_error"] .tab-mark,
.tab[data-status="error"] .tab-mark { color: var(--fail); }

.panel { display: none; }
.problem-layout[data-tab="problem"] .panel-problem,
.problem-layout[data-tab="code"] .panel-code,
.problem-layout[data-tab="result"] .panel-result { display: block; }

.panel-problem, .panel-result { padding: 16px 16px calc(40px + env(safe-area-inset-bottom)); }
.problem-head { display: flex; align-items: center; flex-wrap: wrap; gap: 8px 12px; margin-bottom: 4px; }
.problem-head h1 { margin: 0; }

.prose { overflow-wrap: break-word; }
.prose h1 { display: none; } /* the page shows the title already */
.prose pre {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 10px 12px; overflow-x: auto; font-size: 0.9rem; line-height: 1.5;
}
.prose :not(pre) > code {
  background: var(--editor-active); padding: 1px 5px; border-radius: 4px;
}
.prose table { border-collapse: collapse; display: block; overflow-x: auto; }
.prose th, .prose td { border: 1px solid var(--line); padding: 4px 8px; }
.prose img { max-width: 100%; height: auto; }

.hints {
  margin: 20px 0; background: var(--surface);
  border: 1px solid var(--line); border-radius: var(--radius);
}
.hints summary {
  min-height: 44px; display: flex; align-items: center; padding: 0 14px;
  cursor: pointer; font-weight: 500; color: var(--accent);
}
.hints ol { margin: 0; padding: 0 16px 12px 36px; }
.hints li + li { margin-top: 6px; }
.hints code { background: var(--editor-active); padding: 1px 4px; border-radius: 4px; }

.pager { display: flex; justify-content: space-between; gap: 8px; margin-top: 24px; }

.toolbar {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 12px; background: var(--bg);
  border-bottom: 1px solid var(--line);
}
.draft-note { flex: 1; text-align: right; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.submit-btn { min-width: 104px; }
.grading-as { color: var(--muted); white-space: nowrap; }

.editor-host {
  height: calc(100dvh - var(--header-h) - var(--tabs-h) - 61px);
  min-height: 280px;
  background: var(--editor-bg);
}
.editor-host .cm-editor { height: 100%; font-size: 16px; }
@media (max-width: 599px) {
  /* Too tight for one row: the label drops under the buttons, right-aligned below Submit. */
  .toolbar { flex-wrap: wrap; row-gap: 0; padding-bottom: 4px; }
  .grading-as { order: 1; flex-basis: 100%; text-align: right; line-height: 1.4; }
  .editor-host { height: calc(100dvh - var(--header-h) - var(--tabs-h) - 61px - 20px); }
}

/* ---------- result */
/* Text keeps a reading width; the waveform spans the whole panel. */
.result-body > :not(.wave-slot) { max-width: 760px; }
.result-idle { margin: 8px 0; }
.result-grading { display: flex; align-items: center; gap: 10px; padding: 8px 0; color: var(--muted); }
.spinner {
  width: 18px; height: 18px; border-radius: 50%;
  border: 2px solid var(--line); border-top-color: var(--accent);
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .spinner { animation-duration: 3s; } }

.headline {
  display: flex; align-items: center; gap: 10px;
  font-size: 1.25rem; margin: 4px 0 10px;
}
.headline-mark {
  display: inline-grid; place-items: center; width: 1.6em; height: 1.6em;
  border-radius: 50%; font-size: 0.85em;
  color: var(--fail); background: var(--fail-soft);
}
.headline[data-status="pass"] .headline-mark { color: var(--pass); background: var(--pass-soft); }
.headline[data-status="pass"] { color: var(--pass); }
.solved-note { color: var(--pass); }
.next { margin-top: 16px; }

.error-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.error-item {
  -webkit-appearance: none; appearance: none;
  width: 100%; min-height: 44px; text-align: left; cursor: pointer;
  display: grid; grid-template-columns: auto 1fr; gap: 10px; align-items: baseline;
  padding: 10px 12px; font: inherit; color: var(--ink);
  background: var(--fail-soft); border: 1px solid transparent; border-radius: var(--radius);
}
button.error-item:hover { border-color: var(--fail); }
.error-item .loc { color: var(--fail); font-weight: 600; font-size: 0.9rem; white-space: nowrap; }
.error-item .msg { overflow-wrap: anywhere; }
.error-item.harness { cursor: default; background: var(--surface); border-color: var(--line); }
.error-item.harness .loc { color: var(--muted); }

.mm-summary { font-size: 1.05rem; }
.mm-summary strong { color: var(--fail); }
.table-wrap {
  overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius);
  background: var(--surface);
}
.mm-table { border-collapse: collapse; width: 100%; font-size: 0.9rem; }
.mm-table th, .mm-table td { padding: 8px 12px; text-align: left; white-space: nowrap; }
.mm-table th { font-weight: 600; color: var(--muted); font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.05em; }
.mm-table tbody tr { border-top: 1px solid var(--line); }
.mm-table .got { color: var(--fail); font-weight: 600; }

.wave-slot:empty { display: none; }
.wave-slot { margin: 12px 0 16px; min-width: 0; }

/* ---------- waveform */
.wave {
  margin: 0; min-width: 0;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  overflow: hidden;
}
.wave-head {
  display: flex; flex-wrap: wrap; align-items: center;
  gap: 4px 12px; padding: 4px 4px 4px 12px;
}
.wave-title { font-weight: 600; }
.wave-legend { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); }
.wave-full-btn { margin-left: auto; font-size: 1.25rem; padding: 0; }
.wave-swatch {
  width: 14px; height: 10px; border-radius: 2px;
  background: color-mix(in srgb, var(--fail) 22%, transparent); border: 1px solid var(--fail);
}
.wave-body { display: flex; min-width: 0; border-top: 1px solid var(--line); }
.wave-labels {
  flex: 0 0 auto; max-width: 40%; min-width: 64px;
  border-right: 1px solid var(--line); background: var(--bg);
  font: 15px/1 var(--mono);
}
/* Heights match AXIS_H and ROW_H in wave.js. */
.wave-label-axis {
  height: 26px; padding: 0 8px; display: flex; align-items: center; justify-content: flex-end;
  color: var(--muted); font-size: 13px;
}
.wave-label {
  height: 40px; padding: 0 8px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  line-height: 40px; color: var(--ink);
}
.wave-label .wl-short { display: none; }
@media (max-width: 599px) {
  .wave-label .wl-long { display: none; }
  .wave-label .wl-short { display: inline; }
}
.wave-label[data-role="in"] { color: var(--muted); }
.wave-label[data-role="ref"] { color: var(--accent); }
.wave-plot {
  flex: 1 1 auto; min-width: 0; position: relative; overflow: hidden;
  /* pan-y: vertical drags scroll the page; horizontal pan and pinch go to wave.js. */
  touch-action: pan-y; cursor: grab;
  -webkit-user-select: none; user-select: none;
}
.wave-plot.dragging { cursor: grabbing; }
.wave-svg { display: block; }
.wave-controls {
  display: flex; align-items: center; gap: 6px; flex-wrap: wrap;
  padding: 6px 8px; border-top: 1px solid var(--line);
}
.wave-zoombar { display: flex; align-items: center; gap: 6px; margin-left: auto; }
.wave-zoom { width: 44px; padding: 0; font-size: 1.25rem; }
.wave-navbar { display: flex; align-items: center; gap: 6px; }
.wave-nav { padding: 0 12px; white-space: nowrap; }
.wave-nav:disabled { cursor: default; opacity: 0.45; }
.wave-stop { white-space: nowrap; min-width: 3.5em; text-align: center; }
.wave-range { white-space: nowrap; }
@media (max-width: 479px) {
  /* Prev, count and Next share the first line; zoom wraps to the second. */
  .wave-navbar { flex: 1 1 100%; justify-content: space-between; }
}
.wave-hint { margin: 0; padding: 0 12px 10px; }

.wv-grid { stroke: var(--line); stroke-width: 1; fill: none; }
.wv-tick { fill: var(--muted); font: 13px var(--mono); }
.wv-mark { stroke: var(--fail); stroke-width: 1; stroke-dasharray: 2 3; fill: none; opacity: 0.7; }
.wv-mark-cur { stroke-width: 2; stroke-dasharray: none; opacity: 0.9; }
.wv-tint { fill: var(--fail); fill-opacity: 0.18; }
.wv-busy { fill: var(--muted); fill-opacity: 0.35; }
.wv-line { stroke: var(--ink); stroke-width: 1.5; fill: none; stroke-linejoin: miter; }
.wv-ref .wv-line, .wv-ref .wv-bus { stroke: var(--accent); }
.wv-in .wv-line, .wv-in .wv-bus { stroke: var(--muted); }
.wv-unknown { stroke: var(--warn); stroke-width: 2; fill: none; }
.wv-bus { stroke: var(--ink); stroke-width: 1.25; fill: none; }
.wv-bus-unknown { fill: var(--warn-soft); stroke: none; }
.wv-bad, .wv-yours .wv-bad, .wv-bus.wv-bad { stroke: var(--fail); stroke-width: 2; fill: none; }
/* The halo in the box's own colour keeps values readable where a grid or mismatch line crosses. */
.wv-text {
  --wv-under: var(--surface);
  fill: var(--ink); font: 15px var(--mono); text-anchor: middle;
  paint-order: stroke; stroke: var(--wv-under); stroke-width: 4px; stroke-linejoin: round;
}
.wv-text-bad { fill: var(--fail); font-weight: 700; }
.wv-text-bad { stroke: color-mix(in srgb, var(--fail) 18%, var(--wv-under)); }
.wave-overlay .wv-text { --wv-under: var(--bg); }

/* Full screen: the same figure, moved into a fixed overlay (wave.js openFull). */
.wave-overlay {
  position: fixed; inset: 0; z-index: 100;
  background: var(--bg); overflow: hidden;
  padding: env(safe-area-inset-top) env(safe-area-inset-right)
    env(safe-area-inset-bottom) env(safe-area-inset-left);
}
.wave-overlay .wave {
  height: 100%; display: flex; flex-direction: column;
  border: 0; border-radius: 0; background: var(--bg);
}
.wave-overlay .wave-body { flex: 1 1 auto; overflow-y: auto; align-items: flex-start; }
.wave-overlay .wave-labels { background: var(--surface); }
html.wave-full-open, html.wave-full-open body { overflow: hidden; }
.wave-rotate-hint { display: none; }
@media (orientation: portrait) and (max-width: 599px) {
  .wave-overlay .wave-rotate-hint { display: block; margin: 0; padding: 8px 12px 0; }
}

.log { margin-top: 18px; }
.log summary, .hints summary { list-style: none; }
.log summary::-webkit-details-marker, .hints summary::-webkit-details-marker { display: none; }
.log summary::before, .hints summary::before {
  content: "▸"; display: inline-block; width: 1.1em; transition: transform 0.15s;
}
.log[open] summary::before, .hints[open] summary::before { transform: rotate(90deg); }
.log summary {
  min-height: 44px; display: flex; align-items: center; cursor: pointer; color: var(--muted);
}
.log pre {
  margin: 0; padding: 10px 12px; max-height: 40vh; overflow: auto;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  font-size: 0.8rem; line-height: 1.5; white-space: pre-wrap; overflow-wrap: anywhere;
}

/* ---------- problem page: wide (side by side) */
@media (min-width: 900px) {
  .page { padding-top: 32px; }
  .tabs { display: none; }
  .problem-layout {
    display: grid; grid-template-columns: minmax(320px, 5fr) 7fr;
    height: calc(100dvh - var(--header-h));
  }
  .panel { display: block; }
  .panel-problem {
    overflow-y: auto; padding: 24px 28px 40px;
    border-right: 1px solid var(--line);
  }
  .work { display: flex; flex-direction: column; min-height: 0; min-width: 0; }
  .panel-code { display: flex; flex-direction: column; flex: 1 1 58%; min-height: 0; }
  .editor-host { flex: 1; height: auto; min-height: 0; }
  .editor-host .cm-editor { font-size: 15px; }
  .panel-result {
    flex: 1 1 42%; min-height: 0; overflow-y: auto;
    border-top: 1px solid var(--line); padding: 14px 20px 24px;
  }
  /* A result with a waveform gets ~60% of the column; the editor keeps ~10 lines. */
  .work.has-wave .panel-code { flex: 1 1 40%; min-height: 272px; }
  .work.has-wave .panel-result { flex: 1 1 60%; }
  body[data-view="problem"] { overflow: hidden; }
}
