/* theme.css: Template Render, "print proof on the bench". Written by the designer (DESIGN.md); loaded
   after styles.css so these rules win.
   Signature: the prefix meter (.meter), shared prefix in green, the rest cobalt (stable) or red
   hatching (changed), with a tick where Turn N ended. */

/* ------------------------------------------------------------------ tokens */
:root {
  color-scheme: light dark;

  /* Palette, light. Ratios are text-on-background, WCAG 2.x. */
  --bg: #f6f5f1;            /* page, and code fields */
  --surface: #ffffff;       /* cards */
  --raised: #eeece6;        /* wells, chips, meter track */
  --text: #1a1d23;          /* 16.9:1 on surface, 15.4:1 on bg, 14.2:1 on raised */
  --muted: #535862;         /* 7.1:1 on surface, 6.5:1 on bg, 6.0:1 on raised */
  --border: #dedbd2;        /* hairlines only, never text */
  --border-strong: #858a93; /* control edges, 3.47:1 on surface, 3.18:1 on bg */
  --accent: #1f4fbf;        /* white on it 7.2:1 */
  --accent-hover: #1a43a3;
  --accent-active: #153886;
  --accent-text: #1f4fbf;   /* 7.2:1 on surface, 6.1:1 on accent-tint */
  --accent-tint: #e7edfb;
  --on-accent: #ffffff;
  --success: #1f6b3a;       /* 6.5:1 on surface, 5.7:1 on its tint */
  --success-tint: #e3f1e6;  /* the shared-prefix wash; text on it 14.8:1, muted 6.2:1 */
  --warning: #8a4b00;       /* 6.8:1 on surface, 5.9:1 on its tint */
  --warning-tint: #fbf0dc;
  --danger: #a8261d;        /* 7.0:1 on surface, 6.0:1 on its tint */
  --danger-tint: #fbe9e6;
  --on-danger: #ffffff;     /* 7.1:1 on danger: the first-difference mark */
  --focus-halo: #1f4fbf33;

  /* Type */
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
  --fs-label: 13px;
  --fs-small: 15px;
  --fs-body: 17px;
  --fs-lede: 21px;
  --fs-verdict: 26px;
  --fs-title: clamp(30px, 5vw, 42px);

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

  /* Shape */
  --r1: 4px; --r2: 10px; --r3: 16px;
  --shadow-1: 0 1px 2px #1a1d230f, 0 2px 8px #1a1d230a;
  --shadow-2: 0 8px 28px #1a1d231f;

  --t: 160ms cubic-bezier(.2, .7, .3, 1);
  --t-in: 180ms cubic-bezier(.2, .7, .3, 1);
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f1115;
    --surface: #171a20;
    --raised: #20242c;
    --text: #e8e6e1;          /* 13.9:1 on surface, 12.4:1 on raised */
    --muted: #a3a8b2;         /* 7.3:1 on surface, 6.5:1 on raised, 7.9:1 on bg */
    --border: #2b3039;
    --border-strong: #656c79; /* 3.2:1 on surface */
    --accent: #8fb0ff;        /* on-accent on it 8.5:1 */
    --accent-hover: #a6c0ff;
    --accent-active: #bccfff;
    --accent-text: #9dbaff;   /* 9.0:1 on surface, 7.7:1 on accent-tint */
    --accent-tint: #1b2747;
    --on-accent: #0d1530;
    --success: #7fd49a;       /* 9.8:1 on surface, 8.5:1 on its tint */
    --success-tint: #15291c;  /* text on it 12.2:1, muted 6.4:1 */
    --warning: #f0b45a;       /* 9.3:1 on surface, 7.9:1 on its tint */
    --warning-tint: #33270f;
    --danger: #ff9b8f;        /* 8.5:1 on surface, 7.0:1 on its tint */
    --danger-tint: #3a1d1a;
    --on-danger: #2a0c08;     /* 9.2:1 on danger */
    --focus-halo: #8fb0ff40;
    --shadow-1: 0 1px 2px #0006;
    --shadow-2: 0 10px 30px #0009;
  }
}

/* ------------------------------------------------------------------ base */
html { background: var(--bg); }
body {
  background: var(--bg);
  color: var(--text);
  font: 400 var(--fs-body)/1.55 var(--font);
  -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(--s3);
  min-height: 44px; line-height: 1.2; font-weight: 700; font-size: var(--fs-body); 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 {
  display: inline-flex; align-items: center; min-height: 44px; padding: 0 var(--s3);
  border-radius: var(--r1); color: var(--muted); font-weight: 550; text-decoration: none;
  transition: color var(--t), background-color var(--t);
}
header nav a:hover { color: var(--text); background: var(--raised); }

main { padding-top: var(--s6); padding-bottom: var(--s7); }
main > p, main > ul, main > ol, main > h3 { max-width: 68ch; }
h1 {
  font-size: var(--fs-title); line-height: 1.1; letter-spacing: -0.025em; font-weight: 750;
  margin: 0 0 var(--s3); color: var(--text);
}
.lede { font-size: var(--fs-lede); line-height: 1.45; color: var(--muted); max-width: 56ch; margin: 0 0 var(--s6); }
h2 { font-size: var(--fs-lede); line-height: 1.3; letter-spacing: -0.01em; margin: var(--s7) 0 var(--s3); }
h3 { font-size: var(--fs-body); margin: var(--s5) 0 var(--s1); }
main li { margin-bottom: var(--s2); }
a { color: var(--accent-text); text-underline-offset: 3px; text-decoration-thickness: 1px; }
a:hover { text-decoration-thickness: 2px; }
code, pre, kbd { font-family: var(--mono); font-size: 0.9em; }
:not(pre) > code { background: var(--raised); padding: 1px 5px; border-radius: var(--r1); overflow-wrap: anywhere; }

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

.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.caps {
  font-size: var(--fs-label); font-weight: 650; letter-spacing: 0.07em; text-transform: uppercase;
  color: var(--muted);
}
.num { font-variant-numeric: tabular-nums; }
svg { flex: none; }

/* ------------------------------------------------------------------ buttons */
.btn, .chip-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--s2);
  min-height: 44px; padding: 0 var(--s4);
  border-radius: var(--r2); border: 1px solid transparent;
  font: 600 var(--fs-small)/1.2 var(--font); cursor: pointer; text-decoration: none;
  transition: background-color var(--t), border-color var(--t), color var(--t), transform var(--t);
}
.btn svg, .chip-btn svg { width: 16px; height: 16px; }
.btn:active, .chip-btn:active { transform: translateY(1px); }

.btn-primary {
  min-height: 48px; padding: 0 var(--s6);
  background: var(--accent); color: var(--on-accent);
  font-size: var(--fs-body); font-weight: 650; box-shadow: var(--shadow-1);
}
.btn-primary:hover { background: var(--accent-hover); }
.btn-primary:active { background: var(--accent-active); }
.btn-primary[disabled], .btn-primary[aria-busy="true"] { cursor: progress; opacity: .7; transform: none; }

.btn-secondary { background: var(--surface); color: var(--text); border-color: var(--border-strong); }
.btn-secondary:hover { background: var(--raised); }
.btn-secondary:active { background: var(--border); }

.btn-quiet { background: transparent; color: var(--muted); }
.btn-quiet:hover { background: var(--raised); color: var(--text); }
.btn-quiet:active { background: var(--border); }

.btn-small { padding: 0 var(--s3); font-size: var(--fs-label); font-weight: 650; }
.copy { min-width: 11.5rem; } /* "Copy raw prompt" -> "Copied" keeps its width */
.copy[data-done="true"] { color: var(--success); border-color: var(--success); }

.chip-btn {
  min-height: 44px; padding: 0 var(--s3); border-radius: 999px;
  background: var(--raised); color: var(--text); border-color: var(--border);
  font-size: var(--fs-small); font-weight: 550;
}
.chip-btn svg { color: var(--accent-text); }
.chip-btn:hover { background: var(--accent-tint); border-color: var(--accent); }
.chip-btn:active { background: var(--accent-tint); }

/* ------------------------------------------------------------------ input panel */
.panel {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--r3);
  box-shadow: var(--shadow-1); padding: var(--s5);
}
.panel-top { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s2); margin-bottom: var(--s4); }
.panel-top .caps { margin-right: var(--s2); }
.panel-top #clear { margin-left: auto; }

.fields { display: grid; grid-template-columns: 5fr 7fr; gap: var(--s5); }
.field-stack { display: flex; flex-direction: column; gap: var(--s3); min-width: 0; }
.field { display: flex; flex-direction: column; min-width: 0; }
.field-label { font-size: var(--fs-small); font-weight: 700; color: var(--text); }
.vars .field-label { font-family: var(--mono); font-weight: 600; }
.field-hint { margin: 2px 0 var(--s2); font-size: var(--fs-small); line-height: 1.45; color: var(--muted); }
.field-error {
  min-height: 1.45em; margin: var(--s1) 0 0;
  font-size: var(--fs-small); line-height: 1.45; font-weight: 600; color: var(--danger);
  overflow-wrap: anywhere;
}

@media (width > 52rem) {
  .fields {
    grid-template-columns: minmax(0, 5fr) minmax(0, 7fr);
    grid-template-rows: repeat(6, auto);
    row-gap: 0;
  }
  .field-template, .field-stack, .field-stack > .field:first-child {
    display: grid;
    grid-template-rows: subgrid;
    /* Share the label, hint and textarea edges across both columns. */
    row-gap: 0;
  }
  .field-template, .field-stack { grid-row: 1 / -1; }
  .field-template textarea { grid-row: 3 / 6; }
  .field-template .field-error { grid-row: 6; }
  .field-stack > .field:first-child { grid-row: 1 / 5; }
  .field-stack > .field:last-child { grid-row: 5 / 7; margin-top: var(--s3); }
}

textarea.code, input.code {
  width: 100%; margin: 0;
  background: var(--bg); color: var(--text);
  border: 1px solid var(--border-strong); border-radius: var(--r2);
  font: 400 var(--fs-small)/1.55 var(--mono);
  padding: var(--s3);
  transition: border-color var(--t), background-color var(--t);
}
textarea.code { resize: vertical; tab-size: 2; min-height: 13rem; }
.field-template textarea.code { min-height: 26rem; flex: 1; }
textarea.code-short { min-height: 8rem; }
input.code { min-height: 44px; padding: 0 var(--s3); }
textarea.code:hover, input.code:hover { border-color: var(--text); }
textarea.code:focus-visible, input.code:focus-visible { outline-offset: 0; background: var(--surface); }
textarea.code::placeholder, input.code::placeholder { color: var(--muted); opacity: 1; font-style: italic; }
.field.invalid textarea.code, .field.invalid input.code, [aria-invalid="true"] {
  border-color: var(--danger); background: var(--danger-tint);
}

.presets { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s2); margin: 0 0 var(--s2); }
.presets .caps { flex-basis: 100%; }

.vars {
  display: flex; flex-wrap: wrap; align-items: flex-end; gap: var(--s4) var(--s5);
  margin-top: var(--s4); padding-top: var(--s4); border-top: 1px solid var(--border);
}
.field-inline { width: 12rem; gap: var(--s1); }
.check {
  display: inline-flex; align-items: center; gap: var(--s2); min-height: 44px; cursor: pointer;
  font: 600 var(--fs-small)/1.2 var(--mono); color: var(--text);
  padding: 0 var(--s2); border-radius: var(--r2); transition: background-color var(--t);
}
.check:hover { background: var(--raised); }
.check input { width: 20px; height: 20px; margin: 0; accent-color: var(--accent); cursor: pointer; }

.compare-actions {
  display: flex; flex-wrap: wrap; align-items: center; gap: var(--s3) var(--s5);
  margin-top: var(--s5);
}
.local-note {
  display: inline-flex; align-items: center; gap: var(--s2); margin: 0;
  font-size: var(--fs-small); color: var(--muted);
}
.local-note svg { width: 18px; height: 18px; }

/* ------------------------------------------------------------------ verdict banner (#status) */
#status.verdict {
  min-height: 7rem; margin: var(--s5) 0 var(--s4); padding: var(--s5);
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--r3);
  box-shadow: var(--shadow-1); font-weight: 400; color: var(--text);
}
#status.verdict[data-state="empty"] { background: transparent; border-color: transparent; box-shadow: none; }
#status.verdict[data-state="ready"],
#status.verdict[data-state="loading"] {
  display: flex; align-items: center; gap: var(--s3);
  background: transparent; border: 1px dashed var(--border-strong); box-shadow: none; color: var(--muted);
}
#status.verdict[data-state="stable"],
#status.verdict[data-state="changed"],
#status.verdict[data-state="error"] { animation: rise var(--t-in) both; }
#status.verdict[data-state="error"] { background: var(--danger-tint); border-color: var(--danger); }

.example-flag { display: block; margin: 0 0 var(--s2); color: var(--accent-text); }

.verdict-head { display: flex; align-items: center; gap: var(--s3); }
.verdict-head svg { width: 30px; height: 30px; }
[data-state="stable"] .verdict-head svg { color: var(--success); }
[data-state="changed"] .verdict-head svg,
[data-state="error"] .verdict-head svg { color: var(--danger); }
.verdict-title {
  margin: 0; font-size: var(--fs-verdict); line-height: 1.2; font-weight: 750; letter-spacing: -0.015em;
  font-variant-numeric: tabular-nums;
}
.verdict-title .num { font-family: var(--mono); font-weight: 700; letter-spacing: 0; }
[data-state="changed"] .verdict-title .num { color: var(--danger); }
.verdict-body { margin: var(--s2) 0 0; max-width: 72ch; overflow-wrap: anywhere; }
.verdict-body b, .verdict-body .num { font-family: var(--mono); font-weight: 700; font-variant-numeric: tabular-nums; }
.verdict-help { margin: var(--s1) 0 0; font-size: var(--fs-small); color: var(--text); max-width: 72ch; }
.caveat, .first-only { margin: var(--s3) 0 0; font-size: var(--fs-small); color: var(--muted); max-width: 72ch; }
.why {
  display: flex; flex-wrap: wrap; align-items: baseline; gap: var(--s1) var(--s2);
  margin: var(--s4) 0 0; padding: var(--s3) var(--s4);
  background: var(--warning-tint); border-radius: var(--r2); color: var(--text); max-width: 72ch;
}
.why svg { width: 16px; height: 16px; color: var(--warning); align-self: center; }
.why .caps { color: var(--warning); }

.spinner {
  width: 20px; height: 20px; flex: none; border-radius: 50%;
  border: 2.5px solid var(--border); border-top-color: var(--accent);
  animation: spin 800ms linear infinite;
}

/* ---- the prefix meter: the signature ---- */
.meter {
  position: relative; height: 14px; margin: var(--s4) 0 var(--s2);
  background: var(--raised); border-radius: var(--r1); max-width: 56rem;
}
.meter-shared, .meter-rest { position: absolute; top: 0; bottom: 0; transform-origin: left center; }
.meter-shared {
  left: 0; width: calc(var(--shared, 0) * 100%);
  background: var(--success); border-radius: var(--r1) 0 0 var(--r1);
  animation: grow 200ms cubic-bezier(.2, .7, .3, 1) both;
}
.meter-rest {
  left: calc(var(--shared, 0) * 100%); right: 0;
  background: var(--accent-tint); border: 1px solid var(--accent); border-left: 0;
  border-radius: 0 var(--r1) var(--r1) 0;
}
[data-state="changed"] .meter-rest {
  border-color: var(--danger);
  background: repeating-linear-gradient(135deg, var(--danger) 0 3px, var(--danger-tint) 3px 7px);
}
.meter-tick {
  position: absolute; top: -5px; bottom: -5px; width: 2px;
  left: calc(var(--end-a, 0) * 100% - 1px); background: var(--text); border-radius: 1px;
}
[data-state="loading"] .meter { display: none; }
.meter-legend {
  display: flex; flex-wrap: wrap; justify-content: space-between; gap: var(--s1) var(--s4);
  margin: 0; max-width: 56rem;
  font: 600 var(--fs-label)/1.4 var(--mono); font-variant-numeric: tabular-nums; color: var(--muted);
}
.meter-legend span { display: inline-flex; align-items: center; gap: var(--s2); }
.meter-legend span::before { content: ""; width: 10px; height: 10px; border-radius: 2px; flex: none; }
.lg-shared::before { background: var(--success); }
.lg-new::before { background: var(--accent-tint); box-shadow: inset 0 0 0 1px var(--accent); }
.lg-drift::before { background: var(--danger); }

/* ------------------------------------------------------------------ output */
#output { min-height: 12rem; }
.stale-note {
  margin: 0 0 var(--s3); padding: var(--s3) var(--s4);
  background: var(--warning-tint); color: var(--text); border-radius: var(--r2);
  border-left: 3px solid var(--warning); font-size: var(--fs-small); font-weight: 600;
}

.empty-state {
  display: flex; align-items: flex-start; gap: var(--s4);
  padding: var(--s5); border: 1px dashed var(--border-strong); border-radius: var(--r3);
  color: var(--text);
}
.empty-state svg { width: 40px; height: 40px; color: var(--muted); }
.empty-state strong { display: block; font-size: var(--fs-body); }
.empty-state p { margin: var(--s1) 0 0; color: var(--muted); max-width: 64ch; }

.galleys {
  display: grid; grid-template-columns: 1fr 1fr; gap: var(--s4);
  animation: rise var(--t-in) both;
}
.galley {
  margin: 0; min-width: 0; display: flex; flex-direction: column;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--r3);
  box-shadow: var(--shadow-1); overflow: hidden;
}
.galley-head {
  display: flex; flex-wrap: wrap; align-items: center; gap: var(--s1) var(--s3);
  padding: var(--s2) var(--s2) var(--s2) var(--s4);
  background: var(--raised); border-bottom: 1px solid var(--border);
}
.galley-title { font-weight: 750; font-size: var(--fs-body); }
.galley-meta { font: 500 var(--fs-label)/1.3 var(--mono); color: var(--muted); font-variant-numeric: tabular-nums; }
.galley-head .copy { margin-left: auto; }

pre.prompt {
  margin: 0; padding: var(--s4); max-height: 70vh; overflow: auto;
  background: var(--surface); color: var(--text);
  font: 400 var(--fs-small)/1.65 var(--mono);
  white-space: pre-wrap; overflow-wrap: anywhere; tab-size: 4;
  user-select: text;
}
pre.prompt:focus-visible { outline-offset: -2px; box-shadow: inset 0 0 0 4px var(--focus-halo); }

/* markers inside prompts */
.ws { color: var(--muted); }
.ws-tab { display: inline-block; min-width: 2ch; }
/* Keep the visible NBSP joined to its neighbors, including when drawn as an inline box. */
.prompt .ws-nbsp { white-space: nowrap; }
.prompt .ws-nbsp::before, .prompt .ws-nbsp::after { content: "\2060"; }
.cp {
  display: inline-block; padding: 0 3px; margin: 0 1px; border-radius: var(--r1);
  font-size: var(--fs-label); line-height: 1.4; font-weight: 600;
  color: var(--warning); background: var(--warning-tint); border: 1px dashed var(--warning);
}
.trail {
  background: var(--warning-tint);
  text-decoration: underline wavy var(--warning); text-underline-offset: 4px; text-decoration-thickness: 1.5px;
}
.tok {
  padding: 0 3px; border-radius: var(--r1); font-weight: 650;
  color: var(--accent-text); background: var(--accent-tint);
  box-shadow: inset 0 0 0 1px var(--accent);
  -webkit-box-decoration-break: clone; box-decoration-break: clone;
}
.same {
  background: var(--success-tint);
  -webkit-box-decoration-break: clone; box-decoration-break: clone;
}
mark.first-diff {
  background: var(--danger); color: var(--on-danger);
  border-radius: 2px; outline: 2px solid var(--danger); outline-offset: 1px;
  font-weight: 700;
}
mark.first-diff .ws, mark.first-diff .tok, mark.first-diff .cp, mark.first-diff .trail {
  color: inherit; background: transparent; border-color: currentColor; box-shadow: none; text-decoration-color: currentColor;
}
mark.first-diff.end {
  display: inline-block; padding: 0 var(--s1); font: 700 var(--fs-label)/1.4 var(--font);
  letter-spacing: 0.04em; text-transform: uppercase;
}

.legend {
  display: flex; flex-wrap: wrap; gap: var(--s2) var(--s4);
  list-style: none; margin: var(--s3) 0 0; padding: 0;
  font-size: var(--fs-label); color: var(--muted);
}
.legend li { margin: 0; display: inline-flex; align-items: center; gap: var(--s1); }
.legend .first-diff { margin-inline-end: var(--s2); }
.legend .ws, .legend .tok, .legend .trail, .legend mark { font-family: var(--mono); }
@media (min-width: 64rem) {
  .legend { display: grid; grid-template-columns: repeat(5, max-content); }
}
.tool {
  --marker-font: "DejaVu Sans", "Segoe UI Symbol", "Apple Symbols", "Noto Sans Symbols 2", "Cambria Math", system-ui, sans-serif;
}
.ws.ws-cr, .ws.ws-nbsp, .cp {
  font-family: var(--marker-font);
  font-size: var(--fs-small);
  font-weight: 700;
}
.cp { direction: ltr; }
.marker-symbol {
  position: relative;
  display: inline-block;
  inline-size: 1em;
  block-size: 1em;
  vertical-align: -0.16em;
  font-size: var(--fs-body);
  line-height: 1;
  overflow: clip;
  -webkit-text-fill-color: transparent;
}
.cp .marker-symbol { inline-size: 0.5em; }
.marker-symbol::before {
  content: "";
  position: absolute;
  inset: 0;
  background: currentColor;
  mask: var(--glyph) center / 100% 100% no-repeat;
  pointer-events: none;
}
.marker-cr {
  --glyph: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 16 16'%3E%3Cpath fill='none' stroke='black' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round' d='M6 1.5H2.5v9H6m3 0v-9h2.5a2.25 2.25 0 0 1 0 4.5H9m2 0 3 4.5M2.5 14.5H14'/%3E%3C/svg%3E");
}
.marker-nbsp {
  --glyph: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 16 16'%3E%3Cpath fill='none' stroke='black' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round' d='M2 4.5v10h12v-10M4.5 14.5l7-13'/%3E%3C/svg%3E");
}
.marker-open {
  --glyph: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='8' height='16' viewBox='0 0 8 16'%3E%3Cpath fill='none' stroke='black' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round' d='M6.5 1.5 2 8l4.5 6.5'/%3E%3C/svg%3E");
}
.marker-close {
  --glyph: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='8' height='16' viewBox='0 0 8 16'%3E%3Cpath fill='none' stroke='black' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round' d='M1.5 1.5 6 8l-4.5 6.5'/%3E%3C/svg%3E");
}
.same-key {
  display: inline-block; width: 14px; height: 14px; border-radius: 3px;
  background: var(--success-tint); box-shadow: inset 0 0 0 1px var(--success);
}

/* ------------------------------------------------------------------ worked example (reading section) */
.example { margin: var(--s4) 0 var(--s5); }
.example-verdict { font-weight: 650; margin: 0 0 var(--s3); }
.example-verdict .num { font-family: var(--mono); color: var(--danger); }
.example-files { display: grid; grid-template-columns: 1fr 1fr; gap: var(--s4); }
.example-files figure {
  margin: 0; min-width: 0; border: 1px solid var(--border); border-radius: var(--r2); overflow: hidden;
  background: var(--surface);
}
.example-files figcaption {
  padding: var(--s2) var(--s3); background: var(--raised); border-bottom: 1px solid var(--border);
  font-size: var(--fs-label); font-weight: 650; color: var(--text);
}
.example-files pre.prompt { max-height: none; padding: var(--s3); }
.callout {
  margin: var(--s4) 0 0; padding: var(--s4); max-width: 68ch;
  background: var(--accent-tint); color: var(--text); border-radius: var(--r2);
  border-left: 3px solid var(--accent);
}

/* ------------------------------------------------------------------ template pieces: restyled, not 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.05em; }
.house-card {
  background: var(--surface); border: 1px solid var(--border); color: var(--text);
  transition: border-color var(--t);
}
.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(--r3); box-shadow: var(--shadow-2);
}
.consent button { border-color: var(--border-strong); color: var(--text); font-weight: 600; transition: background-color var(--t); }
.consent button:hover { background: var(--raised); }
footer {
  opacity: 1; color: var(--muted); border-top: 1px solid var(--border);
  padding-top: var(--s5); padding-bottom: var(--s6); font-size: var(--fs-small);
}
footer a { color: var(--accent-text); }

/* ------------------------------------------------------------------ motion */
@keyframes rise { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }
@keyframes grow { from { transform: scaleX(0); } to { transform: scaleX(1); } }
@keyframes spin { to { transform: rotate(360deg); } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  .spinner { border-top-color: var(--border-strong); }
}

/* ------------------------------------------------------------------ phone */
@media (max-width: 52rem) {
  header, main, footer { padding-left: var(--s4); padding-right: var(--s4); }
  main { padding-top: var(--s5); }
  main:has(#status[data-example="true"]) { padding-top: var(--s2); }
  .lede { font-size: var(--fs-body); margin-bottom: var(--s2); }
  #status.verdict[data-example="true"] {
    margin-block: var(--s1) var(--s2);
    padding-block: var(--s3);
    font-size: var(--fs-small);
    line-height: 1.45;
  }
  #status[data-example="true"] .example-flag {
    margin-bottom: var(--s1);
    letter-spacing: normal;
    text-wrap: balance;
  }
  #status[data-example="true"] :is(.verdict-body, .first-only) { margin-top: var(--s1); }
  #status[data-example="true"] .meter { margin-top: var(--s2); }
  #status[data-example="true"] .why {
    row-gap: 0;
    margin-top: var(--s2);
    padding-block: var(--s2);
  }
  .panel { padding: var(--s4); border-radius: var(--r2); }
  #status[data-example="true"] + .panel { padding-top: var(--s2); }
  .panel-top { margin-bottom: var(--s3); }
  .panel-top .caps { flex-basis: 100%; }
  .panel-top .btn-secondary { flex: 1 1 100%; }
  .fields { grid-template-columns: 1fr; gap: var(--s3); }
  .field-template textarea.code { min-height: 16rem; }
  textarea.code { min-height: 11rem; }
  .presets .chip-btn { flex: 1 1 calc(50% - var(--s2)); }
  .field-inline { width: 100%; }
  .compare-actions { display: contents; }
  .compare-row {
    position: sticky; bottom: 0; z-index: 1;
    padding-block: var(--s2); margin-top: var(--s2);
    /* The bar reaches the panel edges, with the button aligned to the editor. */
    margin-inline: calc(-1 * var(--s4));
    padding-inline: var(--s4);
    border-top: 1px solid var(--border);
    background: var(--surface);
  }
  .compare-row .btn-primary { width: 100%; }
  .compare-actions .local-note { margin-top: var(--s2); }
  html { scroll-padding-bottom: calc(48px + 1px + var(--s5)); }
  #status.verdict { padding: var(--s4); }
  .verdict-title { font-size: var(--fs-lede); }
  .galleys, .example-files { grid-template-columns: 1fr; }
  pre.prompt { max-height: 60vh; }
}
