/* scrubai styles: a forensic instrument, dark by default.
   The subject is codepoint notation, so monospace is the data face and a clean
   sans carries the shell. Colour is a taxonomy: each finding kind owns one hue,
   and those hues light up against a quiet indigo-charcoal ground.
   The base below is shared with the local UI (ui/style.css); the web-only
   additions follow after the divider. */

:root {
  color-scheme: dark;

  /* Neutral shell: indigo-tinted, never pure black. */
  --paper:      #0B0A12;
  --surface:    #17141F;
  --surface-2:  #1E1A29;
  --sunk:       #0E0C16;
  --ink:        #ECEAF5;
  --muted:      #A49CB8;
  --faint:      #6F6785;
  --rule:       #272235;
  --rule-hard:  #392F4E;

  /* Accent through-line (violet, from the U+ brand mark) and a teal signal. */
  --accent:     #8B5CF6;
  --accent-lo:  #7C3AED;
  --accent-2:   #22D3B7;
  --accent-ink: #FFFFFF;
  --glow:       color-mix(in srgb, var(--accent) 55%, transparent);

  /* Finding taxonomy, tuned for a dark ground. */
  --k-zwj:      #B092FF;
  --k-bidi:     #FF79B0;
  --k-tag:      #6FB0FF;
  --k-vs:       #34D6C6;
  --k-pua:      #FF9E63;
  --k-space:    #F0C25A;
  --k-conf:     #9AA4B4;
  --k-strip:    #B092FF;
  --k-other:    #C3B2E6;

  --ok:         #34D399;
  --off:        #4A4360;
  --warn:       #F0B24A;
  --danger:     #FF6B87;

  --mono: ui-monospace, "Cascadia Mono", "SF Mono", "JetBrains Mono", Menlo,
          Consolas, "Liberation Mono", monospace;
  --sans: ui-sans-serif, -apple-system, "Segoe UI Variable Text", "Segoe UI",
          Roboto, "Helvetica Neue", Arial, sans-serif;

  --r-sm: 7px;
  --r:    11px;
  --r-lg: 16px;

  --shadow-sm: 0 1px 2px rgba(0,0,0,.5);
  --shadow:    0 2px 6px rgba(0,0,0,.34), 0 20px 44px -22px rgba(0,0,0,.72);
  --shadow-lg: 0 12px 54px -14px rgba(0,0,0,.8);
}

/* Light stays close to the original forensic palette. */
@media (prefers-color-scheme: light) {
  :root {
    color-scheme: light;

    --paper:      #F6F5FB;
    --surface:    #FFFFFF;
    --surface-2:  #FBFAFF;
    --sunk:       #F1EFF8;
    --ink:        #1A1726;
    --muted:      #5E576E;
    --faint:      #8B839D;
    --rule:       #E7E3F1;
    --rule-hard:  #D3CCE4;

    --accent:     #7C3AED;
    --accent-lo:  #6D28D9;
    --accent-2:   #0D9488;
    --accent-ink: #FFFFFF;
    --glow:       color-mix(in srgb, var(--accent) 26%, transparent);

    --k-zwj:      #7B2FF7;
    --k-bidi:     #D6006E;
    --k-tag:      #0057D9;
    --k-vs:       #00807A;
    --k-pua:      #C2410C;
    --k-space:    #A16207;
    --k-conf:     #5B6472;
    --k-strip:    #7B2FF7;
    --k-other:    #4B3F63;

    --ok:         #067A4E;
    --off:        #B3AABF;
    --warn:       #B45309;
    --danger:     #C81E4A;

    --shadow-sm: 0 1px 2px rgba(22,20,28,.06);
    --shadow:    0 2px 8px rgba(22,20,28,.06), 0 20px 44px -26px rgba(22,20,28,.22);
    --shadow-lg: 0 22px 62px -20px rgba(22,20,28,.26);
  }

  /* Saturated taxonomy hues in light mode read better with white text. */
  .chip:not(.is-kept), .kindtag, .verb { color: #fff; }
}

* { box-sizing: border-box; }

/* The `hidden` attribute is only display:none in the UA stylesheet, so any
   author rule that sets display (a .split grid, a .controls flex) beats it and
   the element stays on screen. This makes hidden take effect. */
[hidden] { display: none !important; }

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

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 15px/1.55 var(--sans);
  font-variant-numeric: tabular-nums;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

/* A soft ambient wash so the dark ground has depth rather than reading flat. */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background:
    radial-gradient(60% 42% at 78% -8%, color-mix(in srgb, var(--accent) 16%, transparent), transparent 70%),
    radial-gradient(50% 38% at 8% 2%, color-mix(in srgb, var(--accent-2) 12%, transparent), transparent 68%);
}

h1, h2, h3 { margin: 0; font-weight: 600; }

a { color: var(--accent); text-underline-offset: 2px; }
a:hover { color: var(--accent-lo); }

/* ─────────────────────────────────────────────────────── top bar */

.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  background: color-mix(in srgb, var(--paper) 80%, transparent);
  backdrop-filter: saturate(1.5) blur(14px);
  -webkit-backdrop-filter: saturate(1.5) blur(14px);
  border-bottom: 1px solid var(--rule);
}

.masthead {
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px; flex-wrap: wrap;
  padding: 13px clamp(16px, 4vw, 40px) 11px;
}

.brand { display: flex; align-items: center; gap: 11px; }

.brand-mark {
  display: inline-grid; place-items: center;
  min-width: 26px; height: 26px; padding: 0 6px;
  font: 700 12px/1 var(--mono);
  letter-spacing: .02em;
  color: #fff;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  border-radius: 8px;
  box-shadow: 0 4px 14px -4px var(--glow);
}

.brand h1 {
  font: 700 20px/1 var(--sans);
  letter-spacing: -.02em;
}

.version {
  font: 600 10.5px/1 var(--mono);
  letter-spacing: .04em;
  color: var(--muted);
  padding: 4px 8px;
  border: 1px solid var(--rule);
  border-radius: 999px;
  background: var(--surface);
}

.lamps { display: flex; gap: 6px; flex-wrap: wrap; }

.lamp {
  display: inline-flex; align-items: center; gap: 7px;
  font: 600 11.5px/1 var(--sans);
  letter-spacing: .01em;
  padding: 6px 11px;
  border: 1px solid var(--rule);
  border-radius: 999px;
  color: var(--muted);
  background: var(--surface);
}
.lamp::before {
  content: ""; width: 6px; height: 6px; border-radius: 50%;
  background: var(--off);
}
.lamp.on { color: var(--ink); border-color: var(--rule-hard); }
.lamp.on::before {
  background: var(--ok);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--ok) 22%, transparent);
}

/* ──────────────────────────────────────────────────────── tabs */

.tabs {
  display: flex; gap: 4px;
  padding: 0 clamp(16px, 4vw, 40px) 10px;
  overflow-x: auto;
  scrollbar-width: none;
}
.tabs::-webkit-scrollbar { display: none; }

.tab {
  appearance: none;
  border: 1px solid transparent;
  background: none;
  padding: 8px 15px;
  border-radius: 999px;
  font: 600 13px/1 var(--sans);
  color: var(--muted);
  cursor: pointer;
  white-space: nowrap;
  transition: color .14s, background .14s, border-color .14s;
}
.tab:hover { color: var(--ink); background: color-mix(in srgb, var(--ink) 7%, transparent); }
.tab.is-active {
  color: var(--ink);
  background: var(--surface-2);
  border-color: var(--rule-hard);
  box-shadow: 0 1px 0 color-mix(in srgb, var(--accent) 55%, transparent) inset,
              0 6px 16px -10px var(--glow);
}
.tab:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

main {
  padding: clamp(22px, 3.4vw, 40px) clamp(16px, 4vw, 40px) 96px;
  max-width: 1500px;
  margin: 0 auto;
}

/* ─────────────────────────────────────────────────── split panes */

.split {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}
@media (max-width: 860px) { .split { grid-template-columns: 1fr; } }

.pane {
  display: flex; flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--rule);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.pane-head {
  display: flex; align-items: center; gap: 10px;
  padding: 11px 14px;
  border-bottom: 1px solid var(--rule);
  background: var(--surface-2);
}

.pane-head h2 {
  font: 700 10.5px/1 var(--mono);
  letter-spacing: .11em;
  text-transform: uppercase;
  color: var(--muted);
}

.pane-meta {
  font: 500 11.5px/1 var(--mono);
  color: var(--faint);
  margin-left: auto;
}

.pane-head .mini { margin-left: 0; }

textarea {
  width: 100%;
  min-height: 230px;
  resize: vertical;
  border: 0;
  padding: 15px;
  background: var(--surface);
  color: var(--ink);
  font: 13.5px/1.65 var(--mono);
  tab-size: 2;
}
textarea:focus { outline: 2px solid var(--accent); outline-offset: -2px; }
textarea[readonly] { background: var(--sunk); }
textarea::placeholder { color: var(--faint); }

/* ───────────────────────────────────────────────────── controls */

.controls {
  display: flex; align-items: center; gap: 11px; flex-wrap: wrap;
  margin: 16px 0 0;
}

.btn {
  appearance: none;
  border: 1px solid var(--rule-hard);
  background: var(--surface-2);
  color: var(--ink);
  font: 600 13px/1 var(--sans);
  padding: 10px 16px;
  border-radius: var(--r);
  cursor: pointer;
  box-shadow: var(--shadow-sm);
  transition: border-color .14s, background .14s, transform .06s, box-shadow .14s;
}
.btn:hover:not(:disabled) {
  border-color: color-mix(in srgb, var(--accent) 60%, var(--rule-hard));
  background: color-mix(in srgb, var(--accent) 9%, var(--surface-2));
}
.btn:active:not(:disabled) { transform: translateY(1px); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.btn-primary {
  background: var(--accent);
  border-color: transparent;
  color: var(--accent-ink);
  box-shadow: 0 1px 0 rgba(255,255,255,.18) inset,
              0 10px 22px -10px var(--glow);
}
.btn-primary:hover:not(:disabled) {
  background: var(--accent-lo);
  border-color: transparent;
}

.chev { margin-left: 7px; opacity: .7; }

.mini {
  appearance: none; border: 1px solid var(--rule);
  background: var(--surface); color: var(--muted);
  font: 600 11px/1 var(--sans);
  padding: 6px 10px; border-radius: 999px; cursor: pointer;
  transition: color .14s, border-color .14s, background .14s;
}
.mini:hover { color: var(--ink); border-color: var(--rule-hard); background: var(--surface-2); }

.check {
  display: inline-flex; align-items: center; gap: 7px;
  font-size: 13px; color: var(--muted); cursor: pointer;
}
.check input { accent-color: var(--accent); }

.hint {
  display: inline-grid; place-items: center;
  width: 16px; height: 16px; border-radius: 50%;
  border: 1px solid var(--rule-hard);
  font: 700 9px/1 var(--mono); color: var(--faint);
  cursor: help;
}
.hint:hover { color: var(--ink); border-color: var(--accent); }

/* ──────────────────────────────────────────── section headers */

.section-head { margin: 34px 0 14px; }
.section-head h3 {
  font: 700 10.5px/1 var(--mono);
  letter-spacing: .11em; text-transform: uppercase;
  color: var(--muted);
}
.section-head p {
  margin: 6px 0 0; font-size: 13px; color: var(--faint); max-width: 68ch;
}

/* ══════════════════════════ SIGNATURE: the reveal ══════════ */

.reveal-block { margin-top: 14px; }

.ruler {
  position: relative;
  height: 22px;
  margin-bottom: 10px;
  border-bottom: 1px solid var(--rule-hard);
  background:
    repeating-linear-gradient(90deg,
      var(--rule) 0 1px, transparent 1px 10%);
  border-radius: 2px 2px 0 0;
}

.tick {
  position: absolute; bottom: 0;
  width: 2px; height: 14px;
  border-radius: 1px;
  transform: translateX(-1px);
}
.tick::after {
  content: ""; position: absolute; inset: auto 0 0;
  height: 22px; width: 2px;
  background: inherit; opacity: .18;
}

.reveal {
  background: var(--sunk);
  border: 1px solid var(--rule);
  border-radius: var(--r-lg);
  padding: 16px 17px;
  font: 13.5px/2.15 var(--mono);
  white-space: pre-wrap;
  word-break: break-word;
  max-height: 340px;
  overflow: auto;
  box-shadow: inset 0 1px 3px rgba(0,0,0,.35);
}

.chip {
  display: inline-block;
  font: 700 9.5px/1 var(--mono);
  letter-spacing: .04em;
  padding: 3px 4px 2px;
  border-radius: 4px;
  vertical-align: 2px;
  margin: 0 1px;
  color: #10101a;
  cursor: help;
  box-shadow: 0 2px 12px -3px color-mix(in srgb, var(--chip-c, var(--accent)) 70%, transparent);
  animation: bloom .32s cubic-bezier(.2,.9,.3,1.2) both;
  animation-delay: var(--d, 0ms);
}

@keyframes bloom {
  from { opacity: 0; transform: scale(.55); }
  to   { opacity: 1; transform: scale(1); }
}

@media (prefers-reduced-motion: reduce) {
  .chip { animation: none; }
}

.chip[data-kind="zwj_family"]        { background: var(--k-zwj);   --chip-c: var(--k-zwj); }
.chip[data-kind="bidi"]              { background: var(--k-bidi);  --chip-c: var(--k-bidi); }
.chip[data-kind="tag_chars"]         { background: var(--k-tag);   --chip-c: var(--k-tag); }
.chip[data-kind="variation_selector"]{ background: var(--k-vs);    --chip-c: var(--k-vs); }
.chip[data-kind="private_use"]       { background: var(--k-pua);   --chip-c: var(--k-pua); }
.chip[data-kind="space"]             { background: var(--k-space); --chip-c: var(--k-space); }
.chip[data-kind="confusable"]        { background: var(--k-conf);  --chip-c: var(--k-conf); }
.chip[data-kind="strip"]             { background: var(--k-strip); --chip-c: var(--k-strip); }
.chip[data-kind="other_cf"]          { background: var(--k-other); --chip-c: var(--k-other); }

.chip.is-kept {
  background: var(--surface);
  color: var(--muted);
  border: 1px dashed var(--rule-hard);
  box-shadow: none;
  padding: 2px 3px 1px;
}

/* ──────────────────────────────────────────────────── tables */

.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--rule);
  border-radius: var(--r-lg);
  background: var(--surface);
  box-shadow: var(--shadow);
}

table.data { width: 100%; border-collapse: collapse; font-size: 13px; }

table.data th {
  text-align: left;
  font: 700 10.5px/1 var(--mono);
  letter-spacing: .08em; text-transform: uppercase;
  color: var(--faint);
  padding: 12px 13px;
  border-bottom: 1px solid var(--rule);
  background: var(--surface-2);
  white-space: nowrap;
}

table.data td {
  padding: 10px 13px;
  border-bottom: 1px solid var(--rule);
  vertical-align: top;
}
table.data tbody tr { transition: background .12s; }
table.data tbody tr:hover { background: color-mix(in srgb, var(--accent) 5%, transparent); }
table.data tr:last-child td { border-bottom: 0; }
table.data .num { text-align: right; }

.cp { font: 700 12.5px/1 var(--mono); }
.uname { font-size: 12.5px; color: var(--muted); }
.offsets { font: 11.5px/1.5 var(--mono); color: var(--faint); }

.kindtag {
  display: inline-block;
  font: 700 10px/1 var(--mono);
  letter-spacing: .04em;
  padding: 4px 7px 3px;
  border-radius: 999px;
  color: #10101a;
}
.kindtag[data-kind="zwj_family"]        { background: var(--k-zwj); }
.kindtag[data-kind="bidi"]              { background: var(--k-bidi); }
.kindtag[data-kind="tag_chars"]         { background: var(--k-tag); }
.kindtag[data-kind="variation_selector"]{ background: var(--k-vs); }
.kindtag[data-kind="private_use"]       { background: var(--k-pua); }
.kindtag[data-kind="space"]             { background: var(--k-space); }
.kindtag[data-kind="confusable"]        { background: var(--k-conf); }
.kindtag[data-kind="strip"]             { background: var(--k-strip); }
.kindtag[data-kind="other_cf"]          { background: var(--k-other); }

.kept-note { font-size: 11.5px; color: var(--ok); }

/* ────────────────────────────────────────────────────── diff */

.diff {
  background: var(--sunk);
  border: 1px solid var(--rule);
  border-radius: var(--r-lg);
  padding: 16px 17px;
  font: 13.5px/1.95 var(--mono);
  white-space: pre-wrap; word-break: break-word;
  max-height: 300px; overflow: auto;
  box-shadow: inset 0 1px 3px rgba(0,0,0,.35);
}
.d-del {
  background: color-mix(in srgb, var(--danger) 20%, transparent);
  color: var(--danger);
  text-decoration: line-through;
  border-radius: 3px; padding: 0 2px;
}
.d-rep {
  background: color-mix(in srgb, var(--k-space) 22%, transparent);
  border: 1px solid var(--k-space);
  border-radius: 3px; padding: 0 2px;
}
.d-ins {
  background: color-mix(in srgb, var(--ok) 20%, transparent);
  color: var(--ok); border-radius: 3px;
}

/* ───────────────────────────────────────────────── drop zone */

.drop {
  border: 1.5px dashed var(--rule-hard);
  border-radius: var(--r-lg);
  background: var(--surface);
  padding: 52px 24px;
  text-align: center;
  cursor: pointer;
  transition: border-color .14s, background .14s, box-shadow .14s;
}
.drop:hover, .drop:focus-visible {
  border-color: var(--accent);
  outline: none;
  box-shadow: 0 14px 40px -22px var(--glow);
}
.drop.is-over {
  border-color: var(--accent);
  background: color-mix(in srgb, var(--accent) 9%, var(--surface));
}
.drop-slim { padding: 30px 20px; }

.drop-mark {
  display: block; font-size: 34px;
  margin-bottom: 10px; line-height: 1;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent;
}
.drop-title { margin: 0 0 6px; font-weight: 600; font-size: 15.5px; }
.drop-sub {
  margin: 0 0 18px;
  font: 11.5px/1.7 var(--mono);
  color: var(--faint);
}

/* ──────────────────────────────────────────────── file cards */

.filecard {
  margin-top: 22px;
  background: var(--surface);
  border: 1px solid var(--rule);
  border-radius: var(--r-lg);
  padding: 18px;
  box-shadow: var(--shadow);
}
.filecard-head {
  display: flex; gap: 14px; align-items: flex-start;
  justify-content: space-between; flex-wrap: wrap;
}
.filecard-head h3 { font: 700 15px/1.35 var(--mono); word-break: break-all; }

.verdict {
  margin-top: 15px; padding: 12px 14px;
  border-radius: var(--r);
  font-size: 13.5px;
  border: 1px solid var(--rule);
  background: var(--sunk);
}
.verdict.hit {
  border-color: color-mix(in srgb, var(--danger) 45%, transparent);
  background: color-mix(in srgb, var(--danger) 12%, var(--surface));
}
.verdict.clear {
  border-color: color-mix(in srgb, var(--ok) 45%, transparent);
  background: color-mix(in srgb, var(--ok) 12%, var(--surface));
}
.verdict strong { font-weight: 600; }

.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 22px; }
@media (max-width: 860px) { .two-col { grid-template-columns: 1fr; } }

.findlist { list-style: none; margin: 0; padding: 0; }
.findlist li {
  display: flex; gap: 10px; align-items: flex-start;
  padding: 9px 12px;
  border: 1px solid var(--rule);
  border-radius: var(--r-sm);
  background: var(--surface);
  margin-bottom: 6px;
  font-size: 13px;
}
.findlist .detail { word-break: break-word; min-width: 0; }
.findlist .empty {
  color: var(--faint); border-style: dashed; justify-content: center;
}

/* ────────────────────────────────────────────────────── batch */

.batch-bar {
  display: flex; align-items: center; gap: 13px; flex-wrap: wrap;
  margin: 18px 0 14px;
}
.progress {
  flex: 1 1 160px; min-width: 120px; height: 6px;
  background: var(--rule); border-radius: 999px; overflow: hidden;
}
.progress-fill {
  height: 100%; width: 0%;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  transition: width .25s ease;
}

.status { font: 700 11px/1 var(--mono); letter-spacing: .04em; }
.status[data-s="pending"]    { color: var(--faint); }
.status[data-s="inspecting"] { color: var(--k-tag); }
.status[data-s="cleaning"]   { color: var(--k-tag); }
.status[data-s="done"]       { color: var(--ok); }
.status[data-s="error"]      { color: var(--danger); }

/* ──────────────────────────────────────────── capability cards */

.cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(268px, 1fr));
  gap: 14px;
}

.card {
  background: var(--surface);
  border: 1px solid var(--rule);
  border-radius: var(--r-lg);
  padding: 16px;
  box-shadow: var(--shadow);
  transition: border-color .14s, transform .14s;
}
.card:hover { border-color: var(--rule-hard); transform: translateY(-2px); }
.card.on { border-left: 3px solid var(--ok); }
.card.off { border-left: 3px solid var(--off); }

.card h4 {
  margin: 0 0 3px;
  font: 700 13.5px/1 var(--mono);
  display: flex; align-items: center; gap: 8px;
}
.card .state {
  font: 700 10px/1 var(--mono); letter-spacing: .06em;
  text-transform: uppercase; margin-left: auto;
}
.card.on .state { color: var(--ok); }
.card.off .state { color: var(--faint); }
.card p { margin: 9px 0 0; font-size: 12.5px; color: var(--muted); }
.card code {
  display: block; margin-top: 10px;
  font: 11.5px/1.6 var(--mono);
  background: var(--sunk);
  border: 1px solid var(--rule);
  border-radius: var(--r-sm);
  padding: 8px 10px;
  color: var(--ink);
  overflow-x: auto; white-space: pre;
}
.card .ver { font: 500 11px/1 var(--mono); color: var(--faint); }

.spec {
  background: var(--surface);
  border: 1px solid var(--rule);
  border-radius: var(--r-lg);
  overflow: hidden;
  box-shadow: var(--shadow);
}
.route {
  display: flex; gap: 12px; align-items: baseline;
  padding: 11px 14px;
  border-bottom: 1px solid var(--rule);
  font-size: 13px;
}
.route:last-child { border-bottom: 0; }
.verb {
  font: 700 10.5px/1 var(--mono); letter-spacing: .06em;
  padding: 5px 7px 4px; border-radius: 999px;
  color: #10101a; min-width: 46px; text-align: center;
}
.verb[data-v="get"]  { background: var(--k-vs); }
.verb[data-v="post"] { background: var(--k-tag); }
.route .path { font: 700 12.5px/1 var(--mono); }
.route .sum { color: var(--muted); font-size: 12.5px; }

/* ─────────────────────────────────────────────────── drawer */

.scrim {
  position: fixed; inset: 0;
  background: rgba(6,5,12,.6);
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
  z-index: 40;
}

.drawer {
  position: fixed; top: 0; right: 0; bottom: 0;
  width: min(460px, 100vw);
  background: var(--surface);
  border-left: 1px solid var(--rule);
  box-shadow: var(--shadow-lg);
  z-index: 41;
  overflow-y: auto;
  padding: 20px 22px 44px;
  animation: slide .22s cubic-bezier(.2,.8,.3,1) both;
}
@keyframes slide { from { transform: translateX(28px); opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .drawer { animation: none; } }

.drawer-head {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 14px;
}
.drawer-head h2 {
  font: 700 18px/1 var(--sans); letter-spacing: -.01em;
}

.drawer-note {
  margin: 0 0 20px;
  font-size: 12.5px; line-height: 1.65;
  color: var(--muted);
  border-left: 2px solid var(--accent);
  padding-left: 12px;
}

.field { display: block; margin-bottom: 14px; }
.field > span {
  display: flex; justify-content: space-between; align-items: baseline;
  font: 700 10.5px/1 var(--mono);
  letter-spacing: .08em; text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 6px;
}
.field > span em {
  font: 500 10px/1 var(--mono); text-transform: none;
  letter-spacing: 0; color: var(--faint);
}
.field input[type=text], .field input[type=password], .field select {
  width: 100%;
  padding: 9px 11px;
  border: 1px solid var(--rule-hard);
  border-radius: var(--r-sm);
  background: var(--sunk);
  color: var(--ink);
  font: 13px/1.3 var(--mono);
}
.field select { font-family: var(--sans); }
.field input:focus, .field select:focus {
  outline: 2px solid var(--accent); outline-offset: -1px;
}
.field input[type=range] { width: 100%; accent-color: var(--accent); }
.field-note {
  display: block; margin-top: 5px;
  font-size: 11.5px; font-style: normal; color: var(--faint);
}
.drawer-check { display: flex; flex-wrap: wrap; margin-bottom: 13px; }
.drawer-check .field-note { flex-basis: 100%; margin-left: 22px; }

.drawer-actions { display: flex; gap: 9px; margin-top: 18px; flex-wrap: wrap; }

.preview {
  margin: 0;
  background: var(--sunk);
  border: 1px solid var(--rule);
  border-radius: var(--r-sm);
  padding: 13px;
  font: 12.5px/1.7 var(--mono);
  white-space: pre-wrap; word-break: break-word;
  max-height: 300px; overflow: auto;
}

.notes { list-style: none; margin: 16px 0 0; padding: 0; }
.notes li {
  font-size: 12px; line-height: 1.6; color: var(--muted);
  padding-left: 16px; position: relative; margin-bottom: 8px;
}
.notes li::before {
  content: "\203A"; position: absolute; left: 2px; color: var(--accent);
  font-weight: 700;
}

/* ──────────────────────────────────────────────────────── toast */

.toast {
  position: fixed; left: 50%; bottom: 28px;
  transform: translateX(-50%);
  background: var(--surface-2);
  color: var(--ink);
  border: 1px solid var(--rule-hard);
  padding: 12px 18px;
  border-radius: 999px;
  font-size: 13px;
  box-shadow: var(--shadow-lg);
  z-index: 50;
  max-width: min(560px, 92vw);
}
.toast.err {
  background: color-mix(in srgb, var(--danger) 22%, var(--surface-2));
  border-color: var(--danger);
  color: var(--ink);
}

.spin {
  display: inline-block; width: 11px; height: 11px;
  border: 2px solid currentColor; border-right-color: transparent;
  border-radius: 50%;
  animation: spin .6s linear infinite;
  vertical-align: -1px; margin-right: 7px;
}
@keyframes spin { to { transform: rotate(360deg); } }


/* ══════════════════════════════════════════════════════════════════════════
   Web build additions.
   Base above is shared with the local UI (ui/style.css).
   ══════════════════════════════════════════════════════════════════════════ */

.masthead-right { display: flex; align-items: center; gap: 10px; }

/* hero: the Strip view opens on a thesis, then the live workbench sits under it */
.hero { margin: 4px 0 30px; }

.eyebrow {
  display: inline-flex; align-items: center; gap: 8px;
  font: 700 10.5px/1 var(--mono);
  letter-spacing: .12em; text-transform: uppercase;
  color: var(--muted);
  padding: 6px 12px;
  border: 1px solid var(--rule);
  border-radius: 999px;
  background: var(--surface);
  margin-bottom: 18px;
}
.eyebrow::before {
  content: ""; width: 6px; height: 6px; border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
}

.hero-title {
  font: 700 clamp(2rem, 4.8vw, 3.1rem)/1.05 var(--sans);
  letter-spacing: -.03em;
  max-width: 18ch;
  margin: 0 0 16px;
}
.hero-title .grad {
  background: linear-gradient(115deg, var(--accent), var(--accent-2));
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent;
}
.hero .lede { margin: 0; }

.lede {
  max-width: 68ch;
  margin: 0 0 22px;
  font-size: 15.5px;
  line-height: 1.7;
  color: var(--muted);
}
.lede em { color: var(--ink); font-style: italic; }

.footnote { font-size: 12.5px; color: var(--faint); margin: 10px 0 0; }

.callout {
  border: 1px solid var(--rule);
  border-left: 3px solid var(--accent);
  background: var(--surface);
  border-radius: var(--r);
  padding: 13px 15px;
  font-size: 13px;
  line-height: 1.65;
  color: var(--muted);
  margin: 18px 0;
  box-shadow: var(--shadow-sm);
}
.callout strong { color: var(--ink); font-weight: 600; }
.callout.warn { border-left-color: var(--warn); }

.privacy {
  border: 1px solid color-mix(in srgb, var(--ok) 45%, transparent);
  background: color-mix(in srgb, var(--ok) 10%, var(--surface));
  border-radius: var(--r);
  padding: 13px 15px;
  font-size: 13px;
  line-height: 1.65;
  color: var(--muted);
  margin: 0 0 20px;
}
.privacy strong { color: var(--ink); }

/* mode picker */
.mode-picker {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 12px;
  margin-bottom: 22px;
}
.mode {
  display: grid;
  grid-template-columns: auto 1fr;
  grid-template-areas: "radio title" "radio sub";
  gap: 3px 11px;
  align-items: start;
  padding: 15px 16px;
  border: 1px solid var(--rule-hard);
  border-radius: var(--r);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
  cursor: pointer;
  transition: border-color .14s, background .14s, box-shadow .14s;
}
.mode:hover { border-color: color-mix(in srgb, var(--accent) 50%, var(--rule-hard)); }
.mode input { grid-area: radio; margin-top: 3px; accent-color: var(--accent); }
.mode-title { grid-area: title; font-weight: 600; font-size: 13.5px; }
.mode-sub { grid-area: sub; font-size: 12px; color: var(--faint); line-height: 1.5; }
.mode:has(input:checked) {
  border-color: var(--accent);
  background: color-mix(in srgb, var(--accent) 10%, var(--surface));
  box-shadow: 0 12px 28px -18px var(--glow);
}
.mode:has(input:focus-visible) { outline: 2px solid var(--accent); outline-offset: 2px; }

.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width: 720px) { .grid2 { grid-template-columns: 1fr; } }

.key-row { display: flex; gap: 7px; align-items: center; }
.key-row input { flex: 1; min-width: 0; }

/* divergence meter */
.meter { display: flex; align-items: center; gap: 13px; margin: 16px 0; }
.meter-bar {
  flex: 1; height: 8px; border-radius: 999px;
  background: var(--rule); overflow: hidden;
}
.meter-fill {
  height: 100%; width: 0%;
  border-radius: 999px;
  background: var(--danger);
  transition: width .4s ease, background .4s ease;
}
.meter-fill.mid  { background: var(--k-space); }
.meter-fill.good { background: var(--ok); }
.meter-label { font: 700 12px/1 var(--mono); color: var(--muted); white-space: nowrap; }

/* worked examples */
.example {
  border: 1px solid var(--rule);
  border-radius: var(--r-lg);
  background: var(--surface);
  margin-bottom: 14px;
  overflow: hidden;
  box-shadow: var(--shadow);
}
.example-head {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  padding: 11px 14px;
  border-bottom: 1px solid var(--rule);
  background: var(--surface-2);
}
.example-head h4 { margin: 0; font: 600 13px/1.3 var(--sans); }
.example-body { display: grid; grid-template-columns: 1fr 1fr; }
@media (max-width: 780px) { .example-body { grid-template-columns: 1fr; } }
.example-side { padding: 13px 15px; font: 12.5px/1.7 var(--mono); white-space: pre-wrap; word-break: break-word; }
.example-side + .example-side { border-left: 1px solid var(--rule); }
@media (max-width: 780px) {
  .example-side + .example-side { border-left: 0; border-top: 1px solid var(--rule); }
}
.example-label {
  display: block;
  font: 700 10px/1 var(--mono);
  letter-spacing: .08em; text-transform: uppercase;
  color: var(--faint);
  margin-bottom: 8px;
}
.example-note {
  padding: 11px 15px;
  border-top: 1px solid var(--rule);
  font-size: 12.5px; color: var(--muted);
  background: var(--surface-2);
}

.prose { max-width: 76ch; }
.prose h3 {
  font: 700 10.5px/1 var(--mono);
  letter-spacing: .11em; text-transform: uppercase;
  color: var(--muted);
  margin: 32px 0 12px;
}
.prose h3:first-child { margin-top: 0; }
.prose p { margin: 0 0 15px; font-size: 14.5px; line-height: 1.75; color: color-mix(in srgb, var(--ink) 84%, var(--muted)); }
.prose ul { margin: 0 0 15px; padding-left: 20px; }
.prose li { font-size: 14.5px; line-height: 1.75; margin-bottom: 11px; color: color-mix(in srgb, var(--ink) 84%, var(--muted)); }
.prose strong { font-weight: 600; color: var(--ink); }

.yes { color: var(--ok); font-weight: 600; }
.no  { color: var(--faint); }

.good-text { color: var(--ok); }
.warn-text { color: var(--warn); }
