/* theme.css: Traceback Highlighter. "Triage desk under a reading lamp": warm paper, ink-black
   monospace, one deep teal accent, and a marker-amber highlighter stroke for the blocks you pick.
   Signature: the highlighter stroke, a marker wash with a solid amber left bar and a numbered
   flag (1/2, 2/2) on each selected block. Nothing else on the page uses amber.
   Contrast ratios (WCAG 2.x) are noted beside each text colour. Builder: layout only, no literals. */

:root {
  color-scheme: light dark;

  /* Palette, light */
  --bg: #f7f5ef;             /* page paper */
  --surface: #ffffff;        /* panels, log pane */
  --raised: #efece4;         /* gutters, chips, ad slot */
  --text: #1c1b18;           /* 16.9:1 on --surface, 15.6:1 on --bg */
  --muted: #5f5b52;          /* 7.0:1 on --surface, 6.4:1 on --bg, 6.0:1 on --mark */
  --border: #dcd7cb;         /* edges only, never text */
  --border-strong: #8f897c;  /* input edges: 3.5:1 on --surface (UI component) */
  --accent: #0f5e5a;         /* 7.6:1 with --on-accent */
  --accent-hover: #0b4b48;
  --accent-active: #083a38;
  --accent-text: #0d5753;    /* links and quiet buttons: 8.3:1 on --surface */
  --accent-tint: #e2efed;
  --on-accent: #ffffff;
  --mark: #fff1b8;           /* highlighter wash: --text 15.2:1 on it */
  --mark-current: #ffe48a;   /* the focused block: --text 13.9:1 */
  --mark-bar: #9a5b00;       /* the stroke: 5.1:1 on --bg, 4.5:1 on --mark (non-text min 3:1) */
  --on-mark-bar: #ffffff;    /* flag text: 5.7:1 on --mark-bar */
  --success: #1e6b3a;        /* 6.6:1 on --surface, 6.0:1 on --success-tint */
  --success-tint: #e6f3ea;
  --warning: #8a5300;        /* 6.4:1 on --surface, 5.6:1 on --warning-tint */
  --warning-tint: #fbf0dc;
  --danger: #b42318;         /* 6.6:1 on --surface, 5.7:1 on --danger-tint */
  --danger-tint: #fdecea;

  /* Type */
  --font-ui: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-mono: ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
  --fs-label: 0.8125rem;     /* 13px caps labels */
  --fs-small: 0.9375rem;     /* 15px hints, log text, counts */
  --fs-body: 1.0625rem;      /* 17px */
  --fs-lede: 1.25rem;        /* 20px */
  --fs-h2: 1.5rem;           /* 24px */
  --fs-h1: clamp(1.75rem, 4.5vw, 2.5rem);

  /* Space */
  --s1: 4px; --s2: 8px; --s3: 12px; --s4: 16px; --s5: 24px; --s6: 32px; --s7: 48px; --s8: 64px;

  /* Shape */
  --r-sm: 6px;
  --r-md: 10px;
  --r-lg: 14px;
  --shadow-1: 0 1px 2px rgb(28 27 24 / 0.06), 0 2px 8px rgb(28 27 24 / 0.05);
  --shadow-2: 0 4px 12px rgb(28 27 24 / 0.08), 0 12px 32px rgb(28 27 24 / 0.10);
  --ring: 0 0 0 3px var(--accent-tint);

  --t-fast: 160ms;
  --line-h: 1.6em;           /* one log row */
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #15171a;
    --surface: #1d2024;
    --raised: #262a2f;
    --text: #e8e6e1;          /* 13.9:1 on --surface */
    --muted: #a9a59c;         /* 6.6:1 on --surface, 7.3:1 on --bg */
    --border: #33383e;
    --border-strong: #6b7178; /* 3.2:1 on --surface */
    --accent: #5fc4b8;        /* 8.1:1 with --on-accent */
    --accent-hover: #7ad3c8;
    --accent-active: #4bb0a4;
    --accent-text: #6fcdc1;   /* 8.6:1 on --surface */
    --accent-tint: #183533;
    --on-accent: #08201e;
    --mark: #3a3214;          /* --text 10.6:1 on it */
    --mark-current: #4d4217;  /* --text 8.4:1 */
    --mark-bar: #f2b84b;      /* 9.4:1 on --bg */
    --on-mark-bar: #1c1b18;   /* 9.8:1 on --mark-bar */
    --success: #6fd394;       /* 8.6:1 on --surface */
    --success-tint: #17301f;
    --warning: #f2b84b;       /* 8.9:1 on --surface */
    --warning-tint: #33280f;
    --danger: #ff8f85;        /* 7.1:1 on --surface, 7.2:1 on --danger-tint */
    --danger-tint: #3a1a18;
    --shadow-1: 0 1px 2px rgb(0 0 0 / 0.4), 0 2px 8px rgb(0 0 0 / 0.3);
    --shadow-2: 0 4px 12px rgb(0 0 0 / 0.45), 0 12px 32px rgb(0 0 0 / 0.4);
  }
}

/* ---------- Base ---------- */
html { background: var(--bg); }
body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-ui);
  font-size: var(--fs-body);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}
header, main, footer { max-width: 76rem; padding-left: var(--s5); padding-right: var(--s5); }
header { border-bottom: 1px solid var(--border); padding-top: var(--s2); padding-bottom: var(--s2); }
.brand {
  display: inline-flex; align-items: center; gap: var(--s2);
  font-weight: 700; letter-spacing: -0.01em; color: var(--text);
}
.brand::before {
  content: ""; width: 28px; height: 28px; flex: none;
  background: url("icons/favicon.svg") center / contain no-repeat;
}
header nav a { color: var(--muted); text-decoration: none; padding: 0 var(--s2); border-radius: var(--r-sm); }
header nav a:hover { color: var(--text); background: var(--raised); }

a { color: var(--accent-text); text-underline-offset: 0.18em; text-decoration-thickness: 1px; }
a:hover { text-decoration-thickness: 2px; }

h1 { font-size: var(--fs-h1); letter-spacing: -0.02em; margin: var(--s6) 0 var(--s3); }
h2 { font-size: var(--fs-h2); line-height: 1.25; letter-spacing: -0.01em; margin: var(--s7) 0 var(--s3); }
h3 { font-size: var(--fs-body); margin: var(--s5) 0 var(--s1); }
.lede { font-size: var(--fs-lede); color: var(--muted); max-width: 60ch; margin: 0 0 var(--s6); line-height: 1.45; }
main > p, main > ol, main > ul, main > h3, .example-note { max-width: 68ch; }
main li + li { margin-top: var(--s2); }
code, kbd, samp { font-family: var(--font-mono); font-size: 0.9em; }
:not(pre) > code { background: var(--raised); padding: 0.1em 0.35em; border-radius: var(--r-sm); }
kbd { border: 1px solid var(--border); border-bottom-width: 2px; border-radius: var(--r-sm); padding: 0 0.35em; background: var(--surface); }

:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; box-shadow: var(--ring); }

.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;
}

/* ---------- Buttons ---------- */
button, .btn, .file-pick {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--s2);
  min-height: 44px; padding: 0 var(--s4);
  border-radius: var(--r-md); border: 1px solid transparent;
  font: inherit; font-size: var(--fs-small); font-weight: 600; line-height: 1.2;
  cursor: pointer; text-decoration: none; white-space: nowrap;
  transition: background-color var(--t-fast) ease, border-color var(--t-fast) ease, color var(--t-fast) ease, transform var(--t-fast) ease;
}
button svg, .file-pick svg { width: 18px; height: 18px; flex: none; }
button:active:not(:disabled), .file-pick:active { transform: translateY(1px); }
button:disabled { cursor: not-allowed; opacity: 0.5; }

/* The one filled button: "Choose log file" before a log is loaded, "Copy N blocks" after. */
.primary, .actions button.primary, .file-pick {
  background: var(--accent); color: var(--on-accent); border-color: var(--accent);
  min-height: 48px; padding: 0 var(--s5); font-size: var(--fs-body);
}
.primary:hover:not(:disabled), .file-pick:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.primary:active:not(:disabled), .file-pick:active { background: var(--accent-active); }

.secondary, .actions button.secondary {
  background: var(--surface); color: var(--text); border-color: var(--border-strong);
}
.secondary:hover:not(:disabled) { background: var(--raised); }
.secondary:active:not(:disabled) { background: var(--border); }

.quiet, .actions button.quiet {
  background: transparent; color: var(--accent-text); border-color: transparent;
}
.quiet:hover:not(:disabled) { background: var(--accent-tint); }
.quiet:active:not(:disabled) { background: var(--border); }

/* Template default for any bare .actions button (Clear) is the quiet look. */
.actions button:not(.primary):not(.secondary) { background: transparent; color: var(--accent-text); }
.actions button:not(.primary):not(.secondary):hover { background: var(--accent-tint); }

/* ---------- Intake (file, drop, paste) ---------- */
.tool { margin: 0 0 var(--s7); }
.intake {
  background: var(--surface);
  border: 2px dashed var(--border-strong);
  border-radius: var(--r-lg);
  padding: var(--s5);
  box-shadow: var(--shadow-1);
  transition: border-color var(--t-fast) ease, background-color var(--t-fast) ease;
}
.intake.over, .drop.over { border-color: var(--accent); background: var(--accent-tint); }
.intake-pick { display: flex; align-items: center; gap: var(--s4); flex-wrap: wrap; }
.intake-icon { width: 40px; height: 40px; color: var(--accent-text); flex: none; }
.intake-copy { flex: 1 1 18rem; min-width: 0; }
.intake-title { margin: 0; font-size: var(--fs-lede); font-weight: 700; letter-spacing: -0.01em; }
.hint { margin: var(--s1) 0 0; color: var(--muted); font-size: var(--fs-small); }

.file-pick { position: relative; overflow: hidden; }
.file-pick input[type="file"] {
  position: absolute; inset: 0; width: 100%; height: 100%;
  opacity: 0; cursor: pointer; font-size: 0;
}
.file-pick:focus-within { outline: 2px solid var(--accent); outline-offset: 2px; box-shadow: var(--ring); }

.paste { margin-top: var(--s5); padding-top: var(--s4); border-top: 1px solid var(--border); }
.field-label, .label {
  display: block; margin: 0 0 var(--s2);
  font-size: var(--fs-label); font-weight: 700; letter-spacing: 0.07em; text-transform: uppercase;
  color: var(--text);
}
textarea, input[type="text"], select {
  width: 100%; font: inherit; color: var(--text); background: var(--bg);
  border: 1px solid var(--border-strong); border-radius: var(--r-md);
  transition: border-color var(--t-fast) ease;
}
textarea {
  display: block; min-height: 9rem; padding: var(--s3);
  font-family: var(--font-mono); font-size: var(--fs-small); line-height: 1.5;
  white-space: pre; overflow: auto; resize: vertical; tab-size: 4;
}
textarea::placeholder { color: var(--muted); opacity: 1; }
textarea:hover { border-color: var(--text); }
textarea:focus-visible { border-color: var(--accent); }
.drop textarea { border: 1px solid var(--border-strong); background: var(--bg); }

.actions { display: flex; align-items: center; flex-wrap: wrap; gap: var(--s2); margin: var(--s4) 0 0; }
.actions .push { margin-left: auto; }
.kbd-hint { color: var(--muted); font-size: var(--fs-label); }

/* Ready: the intake shrinks to one row naming the loaded log. */
.tool[data-state="ready"] .intake { border-style: solid; border-color: var(--border); padding: var(--s3) var(--s4); box-shadow: none; }
.tool[data-state="ready"] .intake-icon,
.tool[data-state="ready"] .hint,
.tool[data-state="ready"] .paste { display: none; }
.tool[data-state="ready"] .intake-title { font-size: var(--fs-small); font-weight: 600; }
.tool[data-state="ready"] .file-pick {
  background: var(--surface); color: var(--text); border-color: var(--border-strong);
  min-height: 44px; font-size: var(--fs-small); padding: 0 var(--s4);
}
.tool[data-state="ready"] .file-pick:hover { background: var(--raised); }
.tool[data-state="ready"] .actions { margin-top: 0; }
.source { font-family: var(--font-mono); font-size: var(--fs-small); color: var(--muted); font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.source strong { color: var(--text); font-weight: 600; }

/* ---------- Status ---------- */
#status {
  min-height: 1.6em; margin: var(--s4) 0 var(--s3);
  font-size: var(--fs-small); font-weight: 600; color: var(--muted);
  font-variant-numeric: tabular-nums;
}
#status.ok { color: var(--success); }
#status.error { color: var(--danger); }
#status.busy::before {
  content: ""; display: inline-block; width: 0.8em; height: 0.8em; margin-right: var(--s2); vertical-align: -0.05em;
  border: 2px solid var(--border-strong); border-top-color: var(--accent); border-radius: 50%;
  animation: tbh-spin 0.8s linear infinite;
}
@keyframes tbh-spin { to { transform: rotate(360deg); } }

/* ---------- Output: empty, loading, error ---------- */
#output { min-height: 10rem; }
.empty-state {
  display: flex; gap: var(--s4); align-items: flex-start;
  padding: var(--s5); border-radius: var(--r-lg);
  background: var(--raised); color: var(--muted);
}
.empty-state svg { width: 48px; height: 48px; flex: none; color: var(--border-strong); }
.empty-state strong { display: block; color: var(--text); font-size: var(--fs-body); margin-bottom: var(--s1); }
.empty-state p { margin: 0; font-size: var(--fs-small); max-width: 62ch; }

.loading {
  padding: var(--s5); border-radius: var(--r-lg); background: var(--surface);
  border: 1px solid var(--border); min-height: 10rem;
}
.loading .bar { height: 4px; border-radius: 2px; background: var(--raised); overflow: hidden; margin-bottom: var(--s5); }
.loading .bar::after {
  content: ""; display: block; width: 30%; height: 100%; background: var(--accent); border-radius: 2px;
  animation: tbh-slide 1.1s ease-in-out infinite;
}
@keyframes tbh-slide { from { transform: translateX(-100%); } to { transform: translateX(340%); } }
.loading .ghost { height: 0.8em; margin: var(--s3) 0; border-radius: var(--r-sm); background: var(--raised); }
.loading .ghost:nth-child(3) { width: 72%; } .loading .ghost:nth-child(4) { width: 54%; } .loading .ghost:nth-child(5) { width: 64%; }

.error-panel, .notice {
  display: flex; gap: var(--s3); align-items: flex-start;
  padding: var(--s4) var(--s5); border-radius: var(--r-lg);
  background: var(--danger-tint); color: var(--text);
  border-left: 4px solid var(--danger);
}
.error-panel svg, .notice svg { width: 22px; height: 22px; flex: none; color: var(--danger); margin-top: 2px; }
.error-panel strong { display: block; color: var(--danger); font-size: var(--fs-body); }
.error-panel p { margin: var(--s1) 0 0; font-size: var(--fs-small); max-width: 64ch; }
.notice { background: var(--warning-tint); border-left-color: var(--warning); }
.notice svg { color: var(--warning); }
.notice p { margin: 0; font-size: var(--fs-small); }

/* ---------- Workbench: class list + log ---------- */
.workbench {
  display: grid; grid-template-columns: minmax(15rem, 19rem) minmax(0, 1fr); gap: var(--s5);
  align-items: start;
  animation: tbh-rise 180ms ease-out both;
}
@keyframes tbh-rise { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }

.classes {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg);
  padding: var(--s4); box-shadow: var(--shadow-1);
  position: sticky; top: var(--s4);
}
.classes h2 {
  margin: 0 0 var(--s1);
  font-size: var(--fs-label); font-weight: 700; letter-spacing: 0.07em; text-transform: uppercase;
}
.classes-meta { margin: 0 0 var(--s3); font-size: var(--fs-small); color: var(--muted); font-variant-numeric: tabular-nums; }
.class-list { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--s1); }
.class-list li + li { margin-top: 0; }
.class-btn {
  width: 100%; justify-content: space-between; gap: var(--s3);
  min-height: 44px; padding: var(--s2) var(--s3);
  background: transparent; color: var(--text); border: 1px solid transparent; border-radius: var(--r-md);
  font-weight: 500; text-align: left; white-space: normal;
}
.class-btn:hover { background: var(--raised); }
.class-btn[aria-pressed="true"] {
  background: var(--mark); border-color: var(--mark-bar);
  box-shadow: inset 4px 0 0 var(--mark-bar);
  font-weight: 700;
}
.class-name { font-family: var(--font-mono); font-size: var(--fs-small); overflow-wrap: anywhere; min-width: 0; }
.class-name .pkg { color: var(--muted); }
.count {
  flex: none; min-width: 2.25em; padding: 0 var(--s2); border-radius: 999px;
  background: var(--raised); color: var(--text);
  font-size: var(--fs-label); font-weight: 700; line-height: 1.75; text-align: center;
  font-variant-numeric: tabular-nums;
}
.class-btn[aria-pressed="true"] .count { background: var(--mark-bar); color: var(--on-mark-bar); }
.incomplete-note {
  margin: var(--s3) 0 0; padding-top: var(--s3); border-top: 1px solid var(--border);
  font-size: var(--fs-small); color: var(--warning);
  display: flex; gap: var(--s2); align-items: flex-start;
}
.incomplete-note svg { width: 18px; height: 18px; flex: none; margin-top: 2px; }

.viewer { min-width: 0; }
.selection-bar {
  display: flex; align-items: center; flex-wrap: wrap; gap: var(--s2) var(--s3);
  min-height: 64px; padding: var(--s2) var(--s2) var(--s2) var(--s4);
  background: var(--surface); border: 1px solid var(--border); border-bottom: 0;
  border-radius: var(--r-lg) var(--r-lg) 0 0;
}
.summary { margin: 0; flex: 1 1 14rem; min-width: 0; font-size: var(--fs-body); font-weight: 700; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.summary code { background: none; padding: 0; font-weight: 700; }
.summary.idle { font-weight: 500; color: var(--muted); }
.position { font-size: var(--fs-small); color: var(--muted); font-variant-numeric: tabular-nums; min-width: 6.5em; text-align: right; }
.nav { display: flex; gap: var(--s2); }
#copy { min-width: 11.5rem; }
#copy .done { display: none; }
#copy.copied .done { display: inline; }
#copy.copied .idle-icon { display: none; }

.copy-fallback { padding: var(--s4); background: var(--warning-tint); border: 1px solid var(--border); border-bottom: 0; }
.copy-fallback label { display: block; font-weight: 700; color: var(--text); margin-bottom: var(--s2); font-size: var(--fs-small); }
.copy-fallback textarea { min-height: 12rem; background: var(--surface); }

/* The log pane */
.log {
  max-height: min(72vh, 46rem); overflow: auto;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 0 0 var(--r-lg) var(--r-lg);
  font-family: var(--font-mono); font-size: var(--fs-small); line-height: var(--line-h);
  tab-size: 4; scroll-padding-top: var(--s6);
  box-shadow: var(--shadow-1);
}
.log-lines { margin: 0; padding: var(--s2) 0; min-width: max-content; }
.line { display: flex; white-space: pre; }
.line .n {
  position: sticky; left: 0; flex: none;
  width: 4.5rem; padding: 0 var(--s3) 0 0; margin-right: var(--s4);
  text-align: right; color: var(--muted); background: var(--raised);
  font-variant-numeric: tabular-nums; user-select: none;
  border-right: 1px solid var(--border);
}
.line .t { padding-right: var(--s5); }
.line.header .t { font-weight: 700; }
.line.final .t { font-weight: 700; }

/* Every complete block is wrapped; only selected ones are marked. */
.block { position: relative; outline-offset: -2px; border-radius: 0; }
.block.hit { background: var(--mark); box-shadow: inset 4px 0 0 var(--mark-bar); }
.block.hit .line .n { background: var(--mark); color: var(--text); border-right-color: var(--mark-bar); box-shadow: inset 4px 0 0 var(--mark-bar); }
.block.hit + .block.hit { border-top: 2px solid var(--surface); }
.block.current { background: var(--mark-current); }
.block.current .line .n { background: var(--mark-current); }
.block:focus-visible { outline: 2px solid var(--accent); box-shadow: inset 4px 0 0 var(--mark-bar); }
/* The signature flag: a numbered amber tab pinned to the top-right of each marked block. It is a
   zero-height sticky element, so it never moves a line and stays in view when the pane scrolls
   sideways. Markup: <span class="flag" data-flag="1/2" aria-hidden="true"></span> as the block's first child. */
.flag { display: none; }
.block.hit > .flag {
  display: block; position: sticky; right: var(--s2); z-index: 2;
  width: max-content; height: 0; margin-left: auto; overflow: visible;
}
.block.hit > .flag::before {
  content: attr(data-flag);
  display: block; transform: translateY(3px);
  padding: 0 var(--s2); border-radius: var(--r-sm);
  background: var(--mark-bar); color: var(--on-mark-bar);
  font-family: var(--font-ui); font-size: 0.75rem; font-weight: 700; line-height: 1.5;
  font-variant-numeric: tabular-nums; letter-spacing: 0.02em;
}
.block.hit { animation: tbh-mark 180ms ease-out both; }
@keyframes tbh-mark { from { opacity: 0.6; } to { opacity: 1; } }

/* ---------- Worked example (reading section) ---------- */
.example {
  max-width: 68rem; margin: var(--s4) 0 var(--s5);
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg);
  overflow: hidden; box-shadow: var(--shadow-1);
}
.example figcaption {
  padding: var(--s3) var(--s4); border-bottom: 1px solid var(--border); background: var(--raised);
  font-size: var(--fs-label); font-weight: 700; letter-spacing: 0.07em; text-transform: uppercase;
}
.example pre {
  margin: 0; padding: var(--s3) var(--s4); overflow-x: auto;
  font-family: var(--font-mono); font-size: var(--fs-small); line-height: var(--line-h);
}
.example mark { display: block; margin: 0 calc(-1 * var(--s4)); padding: 0 var(--s4); background: var(--mark); color: var(--text); box-shadow: inset 4px 0 0 var(--mark-bar); }
.example-note { color: var(--muted); font-size: var(--fs-small); }

/* ---------- Template furniture: styled, never resized ---------- */
.ad-slot { background: var(--raised); border: 1px solid var(--border); }
.ad-label { color: var(--muted); opacity: 1; font-size: var(--fs-label); letter-spacing: 0.07em; text-transform: uppercase; font-weight: 700; }
.house-card { background: var(--surface); border: 1px solid var(--border); transition: border-color var(--t-fast) ease; }
.house-card:hover { border-color: var(--accent); }
.house-card strong { color: var(--accent-text); }
.house-card span { color: var(--muted); }
.consent { background: var(--surface); color: var(--text); border-color: var(--border); border-radius: var(--r-lg); box-shadow: var(--shadow-2); }
.consent button { border-color: var(--border-strong); color: var(--text); background: var(--surface); }
.consent button:hover { background: var(--raised); }
.consent button:first-of-type { background: var(--accent); color: var(--on-accent); border-color: var(--accent); }
footer { opacity: 1; color: var(--muted); border-top: 1px solid var(--border); padding-top: var(--s5); padding-bottom: var(--s6); }
footer a { color: var(--accent-text); }

/* ---------- Phone ---------- */
@media (max-width: 52rem) {
  header, main, footer { padding-left: var(--s4); padding-right: var(--s4); }
  h1 { margin-top: var(--s5); }
  .intake { padding: var(--s4); }
  .intake-pick .file-pick { width: 100%; }
  .tool[data-state="ready"] .intake-pick .file-pick { width: auto; }
  .actions button { flex: 1 1 auto; }
  .actions .push { margin-left: 0; }
  .kbd-hint { display: none; }
  .workbench { grid-template-columns: minmax(0, 1fr); gap: var(--s4); }
  .classes { position: static; }
  .class-list { grid-template-columns: repeat(auto-fill, minmax(min(100%, 14rem), 1fr)); }
  .selection-bar { padding: var(--s3); }
  .summary { flex-basis: 100%; }
  .position { text-align: left; min-width: 0; margin-right: auto; }
  #copy { flex: 1 1 100%; min-width: 0; }
  .log { max-height: 60vh; }
  .line .n { width: 3.25rem; margin-right: var(--s3); padding-right: var(--s2); }
}

@media (max-width: 600px) {
  .log {
    -webkit-mask-image: linear-gradient(to right, #000 calc(100% - 24px), transparent);
    mask-image: linear-gradient(to right, #000 calc(100% - 24px), transparent);
  }
  /* The flag becomes a small amber dot in the line-number gutter: it never covers log text. */
  .block.hit > .flag { position: sticky; left: 0; right: auto; margin-left: 0; height: 0; width: 0; }
  .block.hit > .flag::before {
    content: ""; width: 8px; height: 8px; padding: 0; border-radius: 50%;
    transform: translate(8px, 0.55rem); background: var(--mark-bar);
  }
}

/* ---------- Reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; scroll-behavior: auto !important; }
  .loading .bar::after { width: 100%; }
}
