/* Razor Formatter: app.css
   One font (Lilex), restrained neutrals + one indigo accent, light/dark via light-dark().
   Hierarchy comes from weight and contrast, never size jumps. Code is the only coloured thing. */

@font-face {
  font-family: "Lilex";
  src: url("fonts/Lilex-VariableFont_wght.woff2") format("woff2");
  font-weight: 100 700;
  font-display: swap;
}

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

  /* neutral grounds: content vs recessed chrome */
  --ground:      light-dark(#fbfbf9, #131315);
  --chrome:      light-dark(#f2f2ef, #1d1e22);
  --sunken:      light-dark(#eeeeea, #0f0f11);
  --raised:      light-dark(#ffffff, #26272c);

  /* hairline seams */
  --line:        light-dark(#e6e6e0, #2a2b30);
  --line-strong: light-dark(#d7d7cf, #37383f);

  /* ink: one meaningful secondary tier (AA), one faint tier for aids */
  --ink:   light-dark(#1b1b19, #ecebe7);
  --ink-2: light-dark(#585853, #a4a39d);
  --ink-3: light-dark(#8a8a83, #797a76);

  /* the single accent, used only for primary action / selection / focus */
  --accent:      light-dark(#4f46e5, #8f88f7);
  --accent-ink:  light-dark(#ffffff, #121218);
  --accent-soft: light-dark(#ecebfb, #24233a);
  --accent-line: light-dark(#c9c6f5, #3a3860);

  /* semantic (kept desaturated) */
  --ok:   light-dark(#2f7d43, #79c088);
  --warn: light-dark(#b25b18, #e0a05a);
  --err:  light-dark(#c0392b, #f0756a);

  /* code palette: calm, low saturation */
  --c-razor: light-dark(#6a44c0, #b0a2f4);
  --c-tag:   light-dark(#1f6b74, #64c4cf);
  --c-attr:  light-dark(#8a6207, #e0b25f);
  --c-str:   light-dark(#3d7a37, #8cc384);
  --c-cmt:   light-dark(#9a9a90, #6a6b67);
  --c-num:   light-dark(#b0501f, #e0a06e);

  /* geometry & motion */
  --r-1: 5px;
  --r-2: 8px;
  --r-3: 11px;
  --tap: 28px;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --dur: 105ms;

  --font: "Lilex", ui-monospace, "SF Mono", "Cascadia Code", Consolas, monospace;
  --code-size: 14px;
}
[data-theme="light"] { color-scheme: light; }
[data-theme="dark"]  { color-scheme: dark; }

/* ---------- reset & base ---------- */
* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font-family: var(--font);
  font-weight: 400;
  font-variant-ligatures: none;
  font-size: 13px;
  line-height: 1.5;
  color: var(--ink);
  background: var(--ground);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
/* one drawn icon system: consistent stroke, no fills, no emoji */
.ic { fill: none; stroke: currentColor; stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; display: block; }
:where(button, [tabindex], input, select, a):focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: var(--r-1);
}

/* browser surfaces carry the design too */
::selection { background: var(--accent-soft); color: var(--ink); }
* { scrollbar-width: thin; scrollbar-color: var(--line-strong) transparent; }
::-webkit-scrollbar { width: 11px; height: 11px; }
::-webkit-scrollbar-thumb {
  background: var(--line-strong); border-radius: 99px;
  border: 3px solid var(--ground); background-clip: padding-box;
}
::-webkit-scrollbar-thumb:hover { background: var(--ink-3); }
::-webkit-scrollbar-corner { background: transparent; }

/* weights are the hierarchy */
.faint { color: var(--ink-3); }

/* ---------- app shell ---------- */
.app {
  height: 100dvh;
  display: grid;
  grid-template-rows: auto 1fr auto;
  container-type: size;
}

/* ---------- toolbar ---------- */
.bar {
  display: flex;
  align-items: center;
  gap: 4px;
  height: 44px;
  padding: 0 10px 0 14px;
  background: var(--chrome);
  border-bottom: 1px solid var(--line);
  user-select: none;
}
.brand {
  display: flex; align-items: center; gap: 9px;
  padding-right: 10px; margin-right: 2px;
}
.brand .logo {
  flex: none; width: 25px; height: 25px; border-radius: 7px;
  display: grid; place-items: center;
  background: var(--accent); color: var(--accent-ink);
  box-shadow: 0 1px 2px light-dark(rgba(79,70,229,.35), rgba(0,0,0,.5)),
              inset 0 1px 0 light-dark(rgba(255,255,255,.22), rgba(255,255,255,.10));
}
.brand .logo svg { width: 15px; height: 15px; stroke-width: 1.9; }
.brand .name { font-weight: 700; letter-spacing: -0.02em; font-size: 13.5px; white-space: nowrap; }
.brand .name b { font-weight: 700; color: var(--ink); }
.brand .name span { color: var(--ink-3); font-weight: 400; margin-left: 6px; }

.bar .spacer { flex: 1; }

.actions { display: flex; align-items: center; gap: 3px; }

/* icon button: the one shape used everywhere */
.ibtn {
  display: inline-grid; place-items: center;
  width: var(--tap); height: var(--tap); border-radius: var(--r-1);
  color: var(--ink-2);
  transition: background var(--dur) var(--ease), color var(--dur) var(--ease);
}
.ibtn svg { width: 17px; height: 17px; }
.ibtn:hover { background: color-mix(in oklab, var(--ink) 7%, transparent); color: var(--ink); }
.ibtn:active { background: color-mix(in oklab, var(--ink) 12%, transparent); }
.ibtn[disabled] { color: var(--ink-3); opacity: 0.5; cursor: default; background: none; }
.ibtn.on { color: var(--accent); background: var(--accent-soft); }
.ibtn[aria-expanded="true"] { color: var(--accent); background: var(--accent-soft); }
/* copy confirmation (icon briefly becomes a tick) */
.ibtn.ok, .ibtn.ok:hover { color: var(--ok); background: none; }
/* clear is destructive and has no undo, so it reads as danger on hover */
.ibtn[data-act="clear"]:hover { color: var(--err); background: color-mix(in oklab, var(--err) 12%, transparent); }

/* text button, and the single accent (primary) button */
.tbtn {
  display: inline-flex; align-items: center; gap: 7px;
  height: var(--tap); padding: 0 12px; border-radius: var(--r-1);
  color: var(--ink); font-weight: 500;
  transition: background var(--dur) var(--ease), color var(--dur) var(--ease), border-color var(--dur) var(--ease);
}
.tbtn svg { width: 16px; height: 16px; }
.tbtn:hover { background: color-mix(in oklab, var(--ink) 7%, transparent); }
.tbtn.primary {
  background: var(--accent); color: var(--accent-ink); font-weight: 600;
  box-shadow: 0 1px 2px light-dark(rgba(79,70,229,.25), rgba(0,0,0,.4));
}
.tbtn.primary:hover { background: color-mix(in oklab, var(--accent) 88%, black); }
.tbtn.primary:active { transform: translateY(0.5px); }

/* ---------- dropdown menus ---------- */
.menu-pop {
  position: fixed; z-index: 60;
  min-width: 244px; padding: 5px;
  background: var(--raised);
  border: 1px solid var(--line-strong);
  border-radius: var(--r-3);
  box-shadow: 0 4px 12px -6px light-dark(rgba(24,24,30,.16), rgba(0,0,0,.55));
  opacity: 0; transform: translateY(-4px) scale(0.99); transform-origin: top left;
  pointer-events: none; visibility: hidden;
  transition: opacity var(--dur) var(--ease), transform var(--dur) var(--ease), visibility var(--dur);
}
.menu-pop.open { opacity: 1; transform: none; pointer-events: auto; visibility: visible; }
.menu-pop .grp { padding: 6px 9px 4px; font-size: 11px; font-weight: 500; letter-spacing: 0.02em; color: var(--ink-3); }
.menu-pop .sep { height: 1px; margin: 5px 8px; background: var(--line); }
.mi {
  display: flex; align-items: center; gap: 10px; width: 100%;
  padding: 7px 9px; border-radius: var(--r-1); text-align: left; color: var(--ink);
  transition: background var(--dur) var(--ease);
}
.mi:hover, .mi:focus-visible { background: var(--accent-soft); outline: none; }
.mi .mi-ic { width: 16px; height: 16px; color: var(--ink-2); flex: none; }
.mi:hover .mi-ic { color: var(--accent); }
.mi .mi-lb { flex: 1; }
.mi .mi-kbd {
  color: var(--ink-3); font-size: 11px; font-variant-numeric: tabular-nums;
  padding: 1px 5px; border: 1px solid var(--line); border-radius: 4px;
}

/* ---------- workspace ---------- */
.work { display: flex; min-height: 0; overflow: hidden; }

.pane {
  flex: 1 1 50%; min-width: 0; min-height: 0;
  display: flex; flex-direction: column;
  background: var(--ground);
}
.pane + .pane { border-left: 1px solid var(--line); }

/* draggable divider between the two panes */
.resizer { flex: none; width: 11px; cursor: col-resize; position: relative; z-index: 3; touch-action: none; }
.resizer::before { content: ""; position: absolute; inset: 0 4px; background: var(--line-strong); transition: background var(--dur) var(--ease); }
.resizer:hover::before, .resizer.drag::before { background: var(--accent); }
.resizer:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }

.pane-head {
  display: flex; align-items: center; gap: 6px;
  height: 34px; padding: 0 6px 0 14px;
  background: color-mix(in oklab, var(--chrome) 50%, var(--ground));
}
.pane-head .lb {
  font-size: 11px; font-weight: 500; letter-spacing: 0.06em; color: var(--ink-2);
  text-transform: uppercase;
}.pane-head .grow { flex: 1; }
.pane-head .ibtn { width: 26px; height: 26px; }
.pane-head .ibtn svg { width: 15px; height: 15px; }
/* editor: gutter + code, scroll together */
.editor { position: relative; flex: 1; min-height: 0; display: flex; overflow: auto; overscroll-behavior: contain; }
.editor.wrap .code { white-space: pre-wrap; word-break: break-word; }
.gutter {
  flex: none; padding: 10px 10px 10px 12px; text-align: right;
  background: var(--ground); font-size: 11px;
  font-variant-numeric: tabular-nums; user-select: none;
  position: sticky; left: 0; z-index: 1;
}
.gutter b { display: block; font-weight: 400; line-height: calc(var(--code-size) * 1.62);
  color: color-mix(in oklab, var(--ink-3) 58%, var(--ground)); }.code {
  flex: 1; min-width: 0; padding: 10px 16px 40px 4px; margin: 0;
  font-family: var(--font); font-size: var(--code-size); line-height: 1.62;
  font-variant-ligatures: contextual; white-space: normal; tab-size: 2;
  caret-color: var(--accent);
}
.code .ln { display: block; white-space: pre; padding-left: 12px; min-height: 1.62em;
  /* skip layout/paint for off-screen lines; each nowrap line is exactly 1.62em,
     so the reserved size is exact and the gutter stays aligned */
  content-visibility: auto; contain-intrinsic-size: auto 1.62em; }
.editor.wrap .code .ln { white-space: pre-wrap; overflow-wrap: anywhere; }
/* indent guides: faint verticals stepped every 2ch */
.code .ln { position: relative; }
/* .il carries the indent width always; the guide line only when guides are on,
   so toggling guides never collapses the indentation. */
.il {
  display: inline-block; width: var(--il-w, 2ch); height: 1.62em; vertical-align: top; position: relative;
}
.editor.guides .il::before {
  content: ""; position: absolute; left: 0; top: 0; bottom: 0;
  border-left: 1px solid var(--line);
}

/* input: an editable textarea with a scroll-synced gutter */
.editor.input { overflow: hidden; }
.editor.input .gutter { overflow: hidden; }
.gutter-in b { display: block; font-weight: 400; text-align: right;
  line-height: calc(var(--code-size) * 1.62);
  color: color-mix(in oklab, var(--ink-3) 58%, var(--ground)); }
.src {
  flex: 1; min-width: 0; margin: 0; border: 0; outline: 0; resize: none;
  background: transparent; color: var(--ink);
  font-family: var(--font); font-size: var(--code-size); line-height: 1.62;
  font-variant-ligatures: contextual; tab-size: 2;
  padding: 10px 16px 40px 4px; white-space: pre; overflow: auto; overscroll-behavior: contain;
  caret-color: var(--accent);
}
.editor.input.wrap .src { white-space: pre-wrap; overflow-wrap: anywhere; }

/* syntax tokens: the only colour on the surface */
.t-razor { color: var(--c-razor); }
.t-tag   { color: var(--c-tag); }
.t-attr  { color: var(--c-attr); }
.t-str   { color: var(--c-str); }
.t-num   { color: var(--c-num); }
.t-cmt   { color: var(--c-cmt); font-style: italic; }
.t-punct { color: color-mix(in oklab, var(--ink) 58%, var(--ground)); }
.t-key   { color: var(--c-razor); }

/* structural issue: red wavy underline on the offending line */
.code .ln.err { text-decoration: underline wavy var(--err); text-decoration-skip-ink: none; text-underline-offset: 3px; background: color-mix(in oklab, var(--err) 9%, transparent); }
.code .ln.err .il { text-decoration: none; }
.gutter b.err { color: var(--err); }

/* the one authored moment: output settles after Format */
@keyframes settle { from { opacity: 0; transform: translateY(2px); } to { opacity: 1; transform: none; } }
.pane.out.settling .ln { animation: settle 0.17s var(--ease) both; }
.pane.out.settling .ln:nth-child(n+2) { animation-delay: calc((var(--i, 0)) * 2.5ms); }

/* ---------- docked settings panel ---------- */
.settings {
  flex: none; width: 300px; min-width: 300px;
  display: flex; flex-direction: column;
  background: var(--chrome);
  overflow: hidden;
}
.settings[hidden] { display: none; }
.app[data-settings="closed"] .settings { width: 0; min-width: 0; }
.settings-head {
  display: flex; align-items: center; height: 34px; padding: 0 6px 0 16px;
}
.settings-head .lb { flex: 1; font-size: 11px; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: var(--ink-2); }
.settings-body { flex: 1; overflow: auto; overscroll-behavior: contain; padding: 2px 0 18px; }
.p-section + .p-section { margin-top: 8px; }
.p-title { margin: 0; padding: 15px 16px 3px; font-size: 11px; font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase; color: var(--ink-2); }.set-row {
  display: flex; align-items: flex-start; gap: 12px;
  padding: 9px 16px;
}
.set-row .set-lb { flex: 1; min-width: 0; }
.set-row .set-lb b { display: block; font-weight: 500; color: var(--ink); line-height: 1.35; }
.set-row .set-lb small { display: block; color: var(--ink-3); font-size: 11px; line-height: 1.45; margin-top: 2px; }
.set-row .switch, .set-row .seg, .set-row .stepper, .set-row .row-btn { margin-top: 1px; }

/* switch: full state set */
.switch {
  flex: none; width: 34px; height: 20px; border-radius: 99px;
  background: var(--line-strong); position: relative;
  transition: background var(--dur) var(--ease);
}
.switch::after {
  content: ""; position: absolute; top: 3px; left: 3px;
  width: 14px; height: 14px; border-radius: 50%;
  background: var(--raised); box-shadow: 0 1px 2px rgba(0,0,0,.25);
  transition: transform var(--dur) var(--ease);
}
.switch[aria-checked="true"] { background: var(--accent); }
.switch[aria-checked="true"]::after { transform: translateX(14px); }
.switch:hover { background: color-mix(in oklab, var(--line-strong) 80%, var(--ink)); }
.switch[aria-checked="true"]:hover { background: color-mix(in oklab, var(--accent) 88%, black); }

/* segmented control (indent style) */
.seg { display: inline-flex; padding: 2px; gap: 2px; background: var(--sunken); border-radius: var(--r-1); }
.seg button {
  min-width: 30px; height: 22px; padding: 0 8px; border-radius: 4px;
  color: var(--ink-2); font-size: 12px; font-weight: 500;
  transition: background var(--dur) var(--ease), color var(--dur) var(--ease);
}
.seg button[aria-pressed="true"] { background: var(--raised); color: var(--ink); box-shadow: 0 1px 2px rgba(0,0,0,.12); }
.seg button:hover:not([aria-pressed="true"]) { color: var(--ink); }

.set-link {
  display: flex; align-items: flex-start; gap: 10px; width: 100%;
  padding: 9px 16px; color: var(--ink); text-align: left;
  transition: background var(--dur) var(--ease);
}
.set-link svg { flex: none; width: 15px; height: 15px; margin-top: 1px; color: var(--ink-2); }
.set-link:hover { background: color-mix(in oklab, var(--ink) 6%, transparent); }
.set-link:hover svg { color: var(--accent); }
.set-link .sl-lb { display: flex; flex-direction: column; min-width: 0; }
.set-link .sl-lb b { font-weight: 500; line-height: 1.35; }
.set-link .sl-lb small { color: var(--ink-3); font-size: 11px; line-height: 1.45; margin-top: 2px; }
.set-link.danger .sl-lb b { color: var(--err); }
.set-link.danger svg, .set-link.danger:hover svg { color: var(--err); }
.set-foot { display: flex; flex-direction: column; margin-top: 14px; padding-top: 6px; }

/* text-size stepper */
.stepper { display: inline-flex; align-items: center; gap: 2px; padding: 2px; background: var(--sunken); border-radius: var(--r-1); }
.stepper .st-btn { width: 24px; height: 22px; display: grid; place-items: center; border-radius: 4px; color: var(--ink-2); transition: background var(--dur) var(--ease), color var(--dur) var(--ease); }
.stepper .st-btn:hover { background: var(--raised); color: var(--ink); }
.stepper .st-btn svg { width: 13px; height: 13px; }
.stepper .st-val { min-width: 30px; text-align: center; font-size: 12px; font-weight: 500; font-variant-numeric: tabular-nums; color: var(--ink); }

/* small inline button that sits at the right of a setting row */
.row-btn { display: inline-flex; align-items: center; gap: 6px; height: 24px; padding: 0 9px; border-radius: var(--r-1); background: var(--sunken); color: var(--ink-2); font-size: 12px; font-weight: 500; white-space: nowrap; transition: background var(--dur) var(--ease), color var(--dur) var(--ease); }
.row-btn svg { flex: none; width: 13px; height: 13px; }
.row-btn:hover { background: color-mix(in oklab, var(--ink) 8%, transparent); color: var(--ink); }

/* ---------- tooltip ---------- */
.tip {
  position: fixed; z-index: 90; max-width: 260px;
  padding: 6px 9px; border-radius: var(--r-1);
  background: light-dark(#1f1f1d, #33343a); color: light-dark(#f6f6f2, #f2f2ef);
  font-size: 12px; line-height: 1.4; font-weight: 400;
  box-shadow: 0 6px 20px -6px rgba(0,0,0,.5);
  opacity: 0; transform: translateY(2px); pointer-events: none;
  transition: opacity 80ms var(--ease), transform 80ms var(--ease);
}
.tip.show { opacity: 1; transform: none; }
.tip b { font-weight: 600; }
.tip .tip-kbd { color: light-dark(#b9b9b3, #b0b1ad); }

/* ---------- toast (brief confirmation after a format) ---------- */
.toast {
  position: fixed; z-index: 120; left: 50%; bottom: 40px;
  display: flex; align-items: center; gap: 8px;
  padding: 8px 15px; border-radius: var(--r-2);
  background: var(--raised); border: 1px solid var(--line-strong);
  color: var(--ink); font-size: 12.5px; font-weight: 500; white-space: nowrap;
  box-shadow: 0 10px 30px -10px light-dark(rgba(24,24,30,.28), rgba(0,0,0,.6));
  opacity: 0; pointer-events: none;
  transform: translateX(-50%) translateY(8px);
  transition: opacity var(--dur) var(--ease), transform var(--dur) var(--ease);
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast .ic { width: 15px; height: 15px; color: var(--ok); }

/* ---------- document report dialog ---------- */
/* dialogs animate in and out with @starting-style + allow-discrete, the modern
   replacement for keyframes-on-[open] and JS-timed display toggling */
.modal {
  width: min(440px, 92vw); padding: 0; border: none; border-radius: var(--r-3);
  background: var(--raised); color: var(--ink);
  box-shadow: 0 24px 64px -24px light-dark(rgba(24,24,30,.4), rgba(0,0,0,.75));
  opacity: 0; transform: translateY(6px) scale(0.99);
  transition: opacity 0.16s var(--ease), transform 0.16s var(--ease),
              display 0.16s allow-discrete, overlay 0.16s allow-discrete;
}
.modal[open] { opacity: 1; transform: none; }
@starting-style { .modal[open] { opacity: 0; transform: translateY(6px) scale(0.99); } }
.modal::backdrop {
  background: light-dark(rgba(20,20,24,.30), rgba(0,0,0,.55));
  opacity: 0;
  transition: opacity 0.16s var(--ease), display 0.16s allow-discrete, overlay 0.16s allow-discrete;
}
.modal[open]::backdrop { opacity: 1; }
@starting-style { .modal[open]::backdrop { opacity: 0; } }
.modal-head { display: flex; align-items: center; gap: 10px; padding: 15px 12px 12px 18px; }
.modal-title { flex: 1; margin: 0; font-size: 14px; font-weight: 600; letter-spacing: -0.01em; }
.modal-body { padding: 2px 18px 20px; }
.rep-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-bottom: 18px; }
.rep-cell { display: flex; flex-direction: column; gap: 3px; padding: 12px; border-radius: var(--r-2); background: var(--sunken); }
.rep-n { font-size: 21px; font-weight: 600; font-variant-numeric: tabular-nums; letter-spacing: -0.02em; }
.rep-l { font-size: 10.5px; color: var(--ink-3); text-transform: uppercase; letter-spacing: 0.06em; }
.rep-h { margin: 0 0 4px; font-size: 11px; font-weight: 600; color: var(--ink-2); text-transform: uppercase; letter-spacing: 0.06em; }
.rep-list { list-style: none; margin: 0; padding: 0; }
.rep-list li { display: flex; align-items: center; gap: 10px; padding: 8px 2px; border-top: 1px solid var(--line); }
.rep-list li:first-child { border-top: none; }
.rep-name { flex: 1; }
.rep-count { color: var(--ink-2); font-variant-numeric: tabular-nums; }
.rep-empty { color: var(--ink-3); padding: 6px 2px; }

/* projects dialog */
.proj-list { display: flex; flex-direction: column; gap: 8px; }
.proj { display: block; padding: 12px 14px; border-radius: var(--r-2); border: 1px solid var(--line); text-decoration: none; transition: background var(--dur) var(--ease), border-color var(--dur) var(--ease); }
.proj:hover { background: var(--sunken); border-color: var(--line-strong); }
.proj-name { display: inline-flex; align-items: center; gap: 6px; font-weight: 600; color: var(--ink); }
.proj:hover .proj-name { color: var(--accent); }
.proj-name svg { width: 13px; height: 13px; color: var(--ink-3); }
.proj:hover .proj-name svg { color: var(--accent); }
.proj-desc { display: block; margin-top: 3px; color: var(--ink-3); font-size: 12px; line-height: 1.5; }

/* dialog forms + prose (custom components, help) */
.modal-note { margin: 0 0 12px; color: var(--ink-2); font-size: 12.5px; line-height: 1.5; }
.comps-ta {
  width: 100%; min-height: 120px; resize: vertical; box-sizing: border-box;
  padding: 10px 12px; border: 1px solid var(--line-strong); border-radius: var(--r-2);
  background: var(--sunken); color: var(--ink);
  font-family: var(--font); font-size: 13px; line-height: 1.6; caret-color: var(--accent);
}
.comps-ta:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; border-color: transparent; }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 14px; }
.btn {
  height: 30px; padding: 0 14px; border-radius: var(--r-1); font-weight: 500;
  color: var(--ink); background: var(--sunken);
  transition: background var(--dur) var(--ease), color var(--dur) var(--ease);
}
.btn:hover { background: color-mix(in oklab, var(--ink) 8%, transparent); }
.btn.primary { background: var(--accent); color: var(--accent-ink); font-weight: 600; }
.btn.primary:hover { background: color-mix(in oklab, var(--accent) 88%, black); }

.prose { font-size: 13px; line-height: 1.6; color: var(--ink-2); max-height: min(64vh, 520px); overflow: auto; }
.prose h3 { margin: 16px 0 6px; font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em; color: var(--ink-3); }
.prose h3:first-child { margin-top: 0; }
.prose p { margin: 0 0 10px; }
.prose ul { margin: 0 0 10px; padding-left: 18px; }
.prose li { margin: 3px 0; }
.prose b, .prose strong { color: var(--ink); font-weight: 600; }
.prose code { font-family: var(--font); font-size: 12px; padding: 1px 5px; border-radius: 4px; background: var(--sunken); color: var(--ink); }
.prose .kb { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; padding: 7px 0; border-top: 1px solid var(--line); }
.prose .kb:first-of-type { border-top: none; }
.prose kbd { font-family: var(--font); font-size: 12px; padding: 1px 6px; border-radius: 4px; background: var(--sunken); border: 1px solid var(--line-strong); color: var(--ink); font-variant-numeric: tabular-nums; white-space: nowrap; }
.prose a { color: var(--accent); text-decoration: none; }
.prose a:hover { text-decoration: underline; }

/* ---------- drag & drop ---------- */
.drop-veil {
  position: fixed; inset: 0; z-index: 100; display: none; place-items: center; padding: 24px;
  background: light-dark(rgba(251,251,249,.70), rgba(12,12,14,.70));
}
.drop-veil.show { display: grid; }
.drop-card {
  display: flex; flex-direction: column; align-items: center; gap: 12px;
  padding: 38px 52px; border-radius: var(--r-3);
  border: 2px dashed var(--accent-line); background: var(--raised);
  color: var(--ink-2); font-weight: 500; text-align: center;
  box-shadow: 0 24px 64px -28px rgba(0,0,0,.45);
}
.drop-card svg { width: 32px; height: 32px; color: var(--accent); }

/* ---------- guided tour (coach marks) ---------- */
.coach { position: fixed; inset: 0; z-index: 200; }
.coach[hidden] { display: none; }
.coach-spot {
  position: absolute; border-radius: var(--r-2); pointer-events: none;
  box-shadow: 0 0 0 9999px light-dark(rgba(18,18,24,.5), rgba(0,0,0,.62)), 0 0 0 2px var(--accent) inset;
  transition: left .24s var(--ease), top .24s var(--ease), width .24s var(--ease), height .24s var(--ease);
}
.coach-card {
  position: absolute; width: 280px; padding: 16px 16px 14px; border-radius: var(--r-3);
  background: var(--raised); border: 1px solid var(--line-strong);
  box-shadow: 0 24px 64px -24px rgba(0,0,0,.55);
  transition: left .24s var(--ease), top .24s var(--ease);
}
.coach-card h4 { margin: 0 0 6px; font-size: 14px; font-weight: 600; letter-spacing: -.01em; }
.coach-card p { margin: 0 0 14px; font-size: 12.5px; line-height: 1.55; color: var(--ink-2); }
.coach-foot { display: flex; align-items: center; gap: 8px; }
.coach-dots { display: flex; gap: 5px; flex: 1; }
.coach-dots i { width: 6px; height: 6px; border-radius: 50%; background: var(--line-strong); }
.coach-dots i.on { background: var(--accent); }
.coach-card .btn { height: 28px; padding: 0 12px; font-size: 12px; }

/* ---------- footer ---------- */
.foot {
  display: flex; align-items: center; gap: 13px;
  height: 26px; padding: 0 14px;
  background: var(--chrome); border-top: 1px solid var(--line);
  color: var(--ink-3); font-size: 11.5px;
  font-variant-numeric: tabular-nums; user-select: none;
}
.foot .stat { display: inline-flex; align-items: center; gap: 5px; color: var(--ink-2); white-space: nowrap; }
.foot .stat b { font-weight: 600; color: var(--ink); }
.foot .stat .dot { width: 6px; height: 6px; border-radius: 50%; background: var(--ok); }
.foot .stat-btn { display: inline-flex; align-items: center; gap: 6px; height: 18px; padding: 0 8px; border-radius: 5px; color: var(--ink-2); white-space: nowrap; transition: background var(--dur) var(--ease), color var(--dur) var(--ease); }
.foot .stat-btn b { font-weight: 600; color: var(--ink); }
.foot .stat-btn .stat-mid { color: var(--ink-3); opacity: .55; }
.foot .stat-btn:hover { background: color-mix(in oklab, var(--ink) 8%, transparent); color: var(--ink); }
.foot #st-status.has-issue { color: var(--err); }
.foot #st-status.has-issue .dot { background: var(--err); }
.foot .st-msg { margin-left: -1px; }
.foot .st-msg:empty { display: none; }
.foot .trust { margin-left: auto; color: var(--ink-3); white-space: nowrap; }
.foot .credit { margin: 0; padding: 0; color: var(--ink-3); text-decoration: none; white-space: nowrap; transition: color var(--dur) var(--ease); }
.foot .credit:hover { color: var(--ink-2); }
/* ---------- minimal mode ---------- */
.app[data-minimal="on"] .bar,
.app[data-minimal="on"] .foot,
.app[data-minimal="on"] .pane-head,
.app[data-minimal="on"] .settings { display: none; }
.app[data-minimal="on"] .pane + .pane { border-left: 1px solid var(--line); }
.minimal-exit {
  position: fixed; z-index: 80; top: 10px; right: 12px;
  display: none; align-items: center; gap: 7px;
  height: var(--tap); padding: 0 11px; border-radius: var(--r-1);
  background: var(--raised); border: 1px solid var(--line-strong);
  color: var(--ink-2); font-size: 12px; opacity: 0.5;
  transition: opacity var(--dur) var(--ease);
}
.app[data-minimal="on"] .minimal-exit { display: inline-flex; }
.minimal-exit:hover { opacity: 1; color: var(--ink); }

/* ---------- on-page content (article below the tool) ---------- */
.page { padding: 72px 24px 96px; border-top: 1px solid var(--line); background: var(--ground); }
.page-in { max-width: 680px; margin: 0 auto; }
.page h1 { margin: 0 0 14px; font-size: clamp(1.55rem, 1rem + 2.2vw, 2.15rem); font-weight: 700; letter-spacing: -0.02em; line-height: 1.15; color: var(--ink); }
.page .lead { margin: 0 0 8px; font-size: 15px; line-height: 1.65; color: var(--ink-2); }
.page h2 { margin: 42px 0 10px; font-size: 1.05rem; font-weight: 600; letter-spacing: -0.01em; color: var(--ink); }
.page p { margin: 0 0 12px; font-size: 14px; line-height: 1.7; color: var(--ink-2); }
.page ul { margin: 0 0 12px; padding-left: 20px; }
.page li { margin: 5px 0; font-size: 14px; line-height: 1.6; color: var(--ink-2); }
.page li::marker { color: var(--accent); }
.page a { color: var(--accent); text-decoration: none; }
.page a:hover { text-decoration: underline; }
.page code { font-family: var(--font); font-size: 12.5px; padding: 1px 5px; border-radius: 4px; background: var(--sunken); color: var(--ink); }
.page .page-foot { margin-top: 42px; padding-top: 16px; border-top: 1px solid var(--line); font-size: 12.5px; color: var(--ink-3); }
.app[data-minimal="on"] ~ .page { display: none; }

/* ---------- reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: 1ms !important; animation-duration: 1ms !important; }
}
