/* ============================================================================
   tool-shell.css v3 — self-contained dark chrome for ProduceHits free browser
   tools. No dependency on main.css. Mobile-first, token-locked: every color,
   duration, and easing in this file references the tokens block below — raw
   literals outside it fail lint (_cursor_brain/scripts/lint_tools.py).
   Type: Bricolage Grotesque (display) · Geist (body) · Geist Mono (data),
   self-hosted from /vendor/tools/fonts/. Accent is themed per domain by an
   inline token override in each page's head.
   Selector compatibility contract: every class used by hand-authored
   TOOL:BODY regions and tool.js files (v2 era) keeps its name and state
   classes. Restyle freely; rename never.
   ========================================================================== */

@font-face {
  font-family: "Bricolage Grotesque";
  src: url("/vendor/tools/fonts/bricolage-grotesque-v9-latin-600.woff2") format("woff2");
  font-weight: 600;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Bricolage Grotesque";
  src: url("/vendor/tools/fonts/bricolage-grotesque-v9-latin-700.woff2") format("woff2");
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Geist";
  src: url("/vendor/tools/fonts/geist-v5-latin-400.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Geist";
  src: url("/vendor/tools/fonts/geist-v5-latin-500.woff2") format("woff2");
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Geist";
  src: url("/vendor/tools/fonts/geist-v5-latin-600.woff2") format("woff2");
  font-weight: 600;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Geist Mono";
  src: url("/vendor/tools/fonts/geist-mono-v6-latin-400.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

/* @tokens ------------------------------------------------------------------
   The only place raw color literals may appear. Neutrals are blue-tinted
   (never pure grey, never pure black); the accent arrives per domain. */
:root {
  /* paper + surfaces (cool-tinted neutral ramp) */
  --bg: #070b12;
  --bg-2: #0b111b;
  --surface: #0f1622;
  --surface-2: #141d2c;
  --surface-3: #1b2637;

  /* ink */
  --text: #e9eff8;
  --text-muted: rgba(233, 239, 248, 0.64);
  --text-faint: rgba(233, 239, 248, 0.42);

  /* lines — hairlines are the border language of this shell */
  --line: rgba(233, 239, 248, 0.09);
  --line-strong: rgba(233, 239, 248, 0.17);

  /* accent (overridden per domain by the page head) */
  --accent: #5b9cff;
  --accent-dim: #3f7ae0;
  --accent-glow: rgba(91, 156, 255, 0.30);
  --accent-contrast: #04101f;

  /* semantic */
  --green: #34d97c;
  --green-wash: rgba(52, 217, 124, 0.13);
  --amber: #f0b13e;
  --amber-wash: rgba(240, 177, 62, 0.14);
  --danger: #ff6b6b;
  --danger-wash: rgba(255, 107, 107, 0.13);
  --shadow: rgba(2, 5, 10, 0.5);
  --scrim: rgba(7, 11, 18, 0.86);

  /* type */
  --font-display: "Bricolage Grotesque", "Geist", "Avenir Next", "Segoe UI", sans-serif;
  --font: "Geist", -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
  --font-mono: "Geist Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;

  /* 1.25 scale, five sizes on a page */
  --fs-sm: 0.85rem;
  --fs-base: 1rem;
  --fs-md: 1.25rem;
  --fs-lg: 1.5625rem;
  --fs-display: clamp(1.95rem, 4.6vw, 2.85rem);

  /* spacing (4pt) */
  --s1: 4px;  --s2: 8px;  --s3: 12px; --s4: 16px; --s5: 20px;
  --s6: 24px; --s7: 32px; --s8: 40px; --s9: 48px; --s10: 64px;

  /* motion */
  --t-fast: 120ms;
  --t-med: 220ms;
  --t-slow: 420ms;
  --t-spin: 800ms;
  --ease: cubic-bezier(0.16, 1, 0.3, 1);

  /* shape */
  --radius: 12px;
  --radius-sm: 8px;
  --radius-lg: 18px;
  --maxw: 1200px;
}
@supports (color: oklch(0% 0 0)) {
  :root {
    --bg: oklch(14.5% 0.021 258);
    --bg-2: oklch(17.5% 0.022 256);
    --surface: oklch(20.5% 0.024 255);
    --surface-2: oklch(23.5% 0.025 254);
    --surface-3: oklch(28% 0.027 253);
    --text: oklch(94.5% 0.008 250);
  }
}
/* legacy aliases — FROZEN NAMES: read from JS (tool.js slider gradients,
   wave.accentColor) and from v2-era BODY markup. Map, never delete. */
:root {
  --border: var(--line);
  --border-strong: var(--line-strong);
}
/* @end-tokens */

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }
html, body { overflow-x: clip; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: var(--fs-base);
  font-weight: 400;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  border-top: 3px solid var(--accent);
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; text-decoration-thickness: 1px; }

h1, h2, h3 {
  font-family: var(--font-display);
  line-height: 1.12;
  letter-spacing: -0.015em;
  margin: 0 0 0.5em;
  overflow-wrap: anywhere;
  min-width: 0;
}
h1 { font-size: var(--fs-display); font-weight: 700; }
h2 { font-size: var(--fs-lg); font-weight: 600; }
h3 { font-size: var(--fs-md); font-weight: 600; }
p { margin: 0 0 1em; color: var(--text-muted); }
strong, b { color: var(--text); font-weight: 600; }

.tnum { font-variant-numeric: tabular-nums; }

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 6px;
  transition: none;
}

::selection { background: var(--accent); color: var(--accent-contrast); }

/* ---- header ----------------------------------------------------------------
   Not the sticky glass AI bar: a quiet masthead that scrolls away. The 3px
   accent strip on <body> carries the domain identity. */
.tool-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s3);
  padding: var(--s4) clamp(14px, 4vw, 32px);
  border-bottom: 1px solid var(--line);
}
.tool-brand {
  display: inline-flex;
  align-items: baseline;
  gap: 10px;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.05rem;
  color: var(--text);
  letter-spacing: -0.01em;
}
.tool-brand:hover { color: var(--text); text-decoration: none; }
.tool-brand .dot {
  width: 11px;
  height: 11px;
  border-radius: 2px;
  background: var(--accent);
  flex: none;
  align-self: center;
}
.tool-brand small {
  color: var(--text-faint);
  font-family: var(--font-mono);
  font-weight: 400;
  font-size: 0.68rem;
  letter-spacing: 0.06em;
}

.tool-nav { display: flex; align-items: center; gap: 2px clamp(4px, 1.6vw, 12px); }
.tool-nav a {
  color: var(--text-muted);
  font-size: var(--fs-sm);
  font-weight: 500;
  padding: 10px 10px;
  border-radius: var(--radius-sm);
}
.tool-nav a:hover { color: var(--text); text-decoration: none; }
.tool-nav a[aria-current="page"] { color: var(--text); }
@media (max-width: 560px) {
  .tool-nav a.nav-optional { display: none; }
}

/* "All tools" disclosure — pure CSS, keyboard-native <details> */
.nav-pop { position: relative; }
.nav-pop > summary {
  list-style: none;
  cursor: pointer;
  color: var(--text-muted);
  font-size: var(--fs-sm);
  font-weight: 500;
  padding: 10px 10px;
  border-radius: var(--radius-sm);
  white-space: nowrap;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
}
.nav-pop > summary::-webkit-details-marker { display: none; }
.nav-pop > summary::after { content: " ▾"; color: var(--text-faint); font-size: 0.72em; margin-left: 4px; }
.nav-pop > summary:hover { color: var(--text); }
.nav-pop[open] > summary { color: var(--text); }
.nav-pop-panel {
  position: absolute;
  right: 0;
  top: calc(100% + 6px);
  z-index: 60;
  min-width: 260px;
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  box-shadow: 0 18px 40px -18px var(--shadow);
  padding: var(--s2);
}
.nav-pop-panel a {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--s3);
  color: var(--text-muted);
  font-size: var(--fs-sm);
  padding: 9px 10px;
  border-radius: var(--radius-sm);
  min-height: 40px;
}
.nav-pop-panel a:hover { color: var(--text); background: var(--surface-2); text-decoration: none; }
.nav-pop-panel a[aria-current="page"] { color: var(--text); }
.nav-pop-panel a .np-tag {
  font-family: var(--font-mono);
  font-size: 0.66rem;
  color: var(--text-faint);
  letter-spacing: 0.04em;
}
.nav-pop-panel .np-all {
  border-top: 1px solid var(--line);
  margin-top: var(--s1);
  padding-top: var(--s2);
  color: var(--accent);
}
@media (max-width: 700px) {
  .nav-pop-panel { position: fixed; left: 12px; right: 12px; min-width: 0; }
}

/* ---- buttons ---------------------------------------------------------------
   Solid, flat, instrument-grade. No gradient pills. */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--s2);
  font-family: inherit;
  font-size: 0.94rem;
  font-weight: 600;
  line-height: 1;
  padding: 12px 18px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line-strong);
  background: var(--surface-2);
  color: var(--text);
  cursor: pointer;
  transition: background var(--t-fast) var(--ease), border-color var(--t-fast) var(--ease),
    color var(--t-fast) var(--ease), transform var(--t-fast) var(--ease), opacity var(--t-fast) var(--ease);
  white-space: nowrap;
  min-height: 44px;
}
.btn:active { transform: translateY(1px); }
.btn[disabled] { opacity: 0.45; cursor: not-allowed; }
.btn-primary {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-contrast);
}
.btn-primary:hover { background: var(--accent-dim); border-color: var(--accent-dim); color: var(--accent-contrast); }
.btn-ghost { background: transparent; }
.btn-quiet { background: transparent; border-color: transparent; color: var(--text-muted); }
.btn-quiet:hover { color: var(--text); }
.btn-sm { padding: 9px 13px; font-size: var(--fs-sm); min-height: 38px; }
.btn-icon { padding: 0; width: 42px; height: 42px; min-height: 42px; }
@media (hover: hover) and (pointer: fine) {
  .btn-ghost:hover { border-color: var(--line-strong); background: var(--surface-2); }
}

/* ---- layout ---- */
.tool-main {
  flex: 1 0 auto;
  width: 100%;
  max-width: var(--maxw);
  margin: 0 auto;
  padding: clamp(22px, 5vw, 52px) clamp(14px, 4vw, 32px) var(--s10);
}
.tool-eyebrow {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 400;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: var(--s3);
}
.tool-hero { max-width: 74ch; }
.lede { font-size: 1.08rem; max-width: 62ch; }

/* ---- panel ---- */
.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: clamp(16px, 4vw, 28px);
}
.panel + .panel { margin-top: var(--s5); }

/* ---- dropzone ---- */
.dropzone {
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius);
  background: var(--bg-2);
  padding: clamp(28px, 8vw, 56px) var(--s5);
  text-align: center;
  cursor: pointer;
  transition: border-color var(--t-med) var(--ease), background var(--t-med) var(--ease);
}
.dropzone:hover { border-color: var(--accent); }
.dropzone.is-drag {
  border-color: var(--accent);
  border-style: solid;
  background: var(--surface-2);
}
.dropzone .dz-icon { width: 42px; height: 42px; margin: 0 auto var(--s3); color: var(--accent); }
.dropzone .dz-title { font-family: var(--font-display); font-weight: 600; font-size: 1.08rem; color: var(--text); }
.dropzone .dz-sub { color: var(--text-faint); font-family: var(--font-mono); font-size: 0.76rem; letter-spacing: 0.02em; margin-top: 6px; }
.dropzone-sm { padding: var(--s4) var(--s5); display: flex; flex-wrap: wrap; align-items: baseline; justify-content: center; gap: var(--s2) var(--s3); text-align: left; }
.dropzone-sm strong { font-family: var(--font-display); font-weight: 600; }
.dropzone-sm span { color: var(--text-faint); font-size: var(--fs-sm); }

/* ---- workspace ---- */
.stage { margin-top: var(--s6); }
.stage[hidden] { display: none; }
.stage-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--s2) var(--s4);
  margin-bottom: var(--s4);
}
.file-name {
  font-weight: 600;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 100%;
}
.file-meta { color: var(--text-faint); font-family: var(--font-mono); font-size: 0.76rem; font-variant-numeric: tabular-nums; }

.wave-wrap {
  position: relative;
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
}
canvas.wave { display: block; width: 100%; height: 148px; }
.wave-host { position: relative; }
.wave-overlay {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  pointer-events: none;
}

/* ---- time ruler ---- */
.time-ruler {
  position: relative;
  height: 22px;
  margin-top: 2px;
  cursor: pointer;
  font-family: var(--font-mono);
  font-size: 0.66rem;
  font-variant-numeric: tabular-nums;
  color: var(--text-faint);
  user-select: none;
  -webkit-user-select: none;
}
.time-ruler .tick {
  position: absolute;
  top: 0;
  height: 100%;
  border-left: 1px solid var(--line);
  padding-left: 5px;
  line-height: 22px;
  white-space: nowrap;
}

/* ---- transport ---- */
.transport {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--s2) var(--s4);
  margin-top: var(--s3);
  padding: var(--s2) var(--s3);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}
.transport:empty { display: none; }
.transport button {
  font: inherit;
  cursor: pointer;
}
.transport svg { width: 16px; height: 16px; fill: currentColor; display: block; }
.t-play {
  width: 44px;
  height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  border: 1px solid var(--accent);
  background: var(--accent);
  color: var(--accent-contrast);
  transition: background var(--t-fast) var(--ease), transform var(--t-fast) var(--ease);
}
.t-play:active { transform: scale(0.96); }
.t-play[disabled] { opacity: 0.4; cursor: not-allowed; }
.t-time {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  font-variant-numeric: tabular-nums;
  color: var(--text-muted);
  white-space: nowrap;
}
.t-time .t-cur { color: var(--text); }
.t-loop, .t-mute {
  width: 40px;
  height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  background: transparent;
  color: var(--text-muted);
  transition: color var(--t-fast) var(--ease), border-color var(--t-fast) var(--ease), background var(--t-fast) var(--ease);
}
.t-loop:hover, .t-mute:hover { color: var(--text); }
.t-loop[aria-pressed="true"], .t-mute[aria-pressed="true"] {
  color: var(--accent);
  border-color: var(--line-strong);
  background: var(--bg-2);
}
.t-speed {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--text);
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 9px 8px;
  min-height: 40px;
  appearance: none;
  -webkit-appearance: none;
  cursor: pointer;
}
.t-volwrap { display: inline-flex; align-items: center; gap: var(--s1); }
input[type="range"].t-vol { width: 88px; flex: none; }
.t-meter {
  position: relative;
  width: 64px;
  height: 6px;
  border-radius: 999px;
  background: var(--surface-3);
  overflow: hidden;
  margin-left: auto;
}
.t-meter i {
  position: absolute;
  inset: 0;
  display: block;
  background: var(--accent);
  transform: scaleX(0);
  transform-origin: left center;
}
.t-meter.hot i { background: var(--danger); }
@media (max-width: 560px) {
  .t-meter { display: none; }
}

/* ---- subtool tabs (mode switch) ---- */
.subtool-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 2px;
  margin: 0 0 var(--s5);
  border-bottom: 1px solid var(--line);
}
.subtool-tabs button {
  font-family: var(--font-mono);
  font-size: 0.74rem;
  font-weight: 400;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-muted);
  background: transparent;
  border: 0;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  padding: 12px 14px;
  min-height: 44px;
  cursor: pointer;
  transition: color var(--t-fast) var(--ease), border-color var(--t-fast) var(--ease);
}
.subtool-tabs button:hover { color: var(--text); }
.subtool-tabs button[aria-selected="true"] {
  color: var(--text);
  border-bottom-color: var(--accent);
}
[data-mode][hidden] { display: none; }
[data-mode]:focus { outline: none; }

/* ---- controls / fields ---- */
.controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--s4) var(--s5);
  margin-top: var(--s5);
}
.slice-control { display: flex; align-items: center; gap: var(--s3); flex: 1 1 260px; }
.slice-control label { font-weight: 500; font-size: var(--fs-sm); color: var(--text); white-space: nowrap; }
.slice-control output {
  min-width: 2.6em;
  text-align: center;
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  font-size: var(--fs-sm);
  color: var(--accent);
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 5px 8px;
}
input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  flex: 1;
  height: 4px;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--accent) 0%, var(--surface-3) 0%);
  outline-offset: 6px;
  cursor: pointer;
}
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--text);
  border: 2px solid var(--accent);
}
input[type="range"]::-moz-range-thumb {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--text);
  border: 2px solid var(--accent);
}

.status {
  margin-top: var(--s3);
  font-size: var(--fs-sm);
  color: var(--text-muted);
  min-height: 1.2em;
}
.status.err { color: var(--danger); }
.status.ok { color: var(--green); }

.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field > label { font-weight: 500; font-size: var(--fs-sm); color: var(--text); }
.field .sub { font-size: 0.78rem; color: var(--text-faint); min-height: 1lh; }
.tool-input,
.field input[type="text"], .field input[type="number"], .field input[type="date"],
.field input[type="email"], .field select, .field textarea {
  font: inherit;
  color: var(--text);
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  min-height: 44px;
  width: 100%;
}
.field select { appearance: none; -webkit-appearance: none; background-image: linear-gradient(45deg, transparent 50%, var(--text-muted) 50%), linear-gradient(135deg, var(--text-muted) 50%, transparent 50%); background-position: calc(100% - 18px) 50%, calc(100% - 13px) 50%; background-size: 5px 5px; background-repeat: no-repeat; padding-right: 34px; }
.field input:focus-visible, .field select:focus-visible, .field textarea:focus-visible, .tool-input:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}
.field-row { display: flex; flex-wrap: wrap; gap: var(--s4) var(--s5); }
.field-row > .field { flex: 1 1 180px; }

/* ---- big numeral readout ---- */
.big-num {
  font-family: var(--font-mono);
  font-size: clamp(3.2rem, 15vw, 6.4rem);
  font-weight: 400;
  letter-spacing: -0.03em;
  line-height: 1;
  color: var(--text);
  font-variant-numeric: tabular-nums;
  text-align: center;
}
.big-num small { font-size: 0.2em; font-weight: 400; color: var(--text-muted); letter-spacing: 0.14em; }
.big-num.accent { color: var(--accent); }
.sub-readouts { display: flex; flex-wrap: wrap; justify-content: center; gap: var(--s2) var(--s6); margin-top: var(--s4); color: var(--text-muted); font-family: var(--font-mono); font-size: var(--fs-sm); font-variant-numeric: tabular-nums; }
.sub-readouts b { color: var(--text); font-weight: 400; }

/* ---- meters ---- */
.meter {
  position: relative;
  height: 12px;
  border-radius: 999px;
  background: var(--surface-3);
  border: 1px solid var(--line);
  overflow: hidden;
}
.meter-fill {
  position: absolute; inset: 0 auto 0 0;
  width: 0%;
  border-radius: 999px;
  background: var(--accent);
  transition: width var(--t-fast) linear;
}
.meter-fill.warn { background: var(--amber); }
.meter-fill.hot { background: var(--danger); }
.meter-scale { display: flex; justify-content: space-between; font-family: var(--font-mono); font-size: 0.7rem; color: var(--text-faint); margin-top: 4px; font-variant-numeric: tabular-nums; }

/* ---- verdict card ---- */
.verdict {
  display: flex; align-items: flex-start; gap: var(--s4);
  border: 1px solid var(--line-strong);
  border-left-width: 3px;
  border-radius: var(--radius);
  padding: var(--s4) var(--s5);
  background: var(--surface-2);
  margin-top: var(--s5);
}
.verdict .v-icon { flex: none; width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; font-weight: 700; font-size: 1.05rem; }
.verdict.ok { border-left-color: var(--green); }
.verdict.warn { border-left-color: var(--amber); }
.verdict.err { border-left-color: var(--danger); }
.verdict.ok .v-icon { background: var(--green-wash); color: var(--green); }
.verdict.warn .v-icon { background: var(--amber-wash); color: var(--amber); }
.verdict.err .v-icon { background: var(--danger-wash); color: var(--danger); }
.verdict h3 { margin: 0 0 2px; }
.verdict p { margin: 0; font-size: 0.92rem; }

/* ---- chips ---- */
.chip-row { display: flex; flex-wrap: wrap; gap: var(--s2); }
.chip {
  font: inherit; font-size: var(--fs-sm); font-weight: 500;
  color: var(--text-muted);
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 8px 14px;
  min-height: 38px;
  cursor: pointer;
  transition: border-color var(--t-fast) var(--ease), color var(--t-fast) var(--ease), background var(--t-fast) var(--ease);
}
.chip:hover { border-color: var(--line-strong); color: var(--text); }
.chip[aria-pressed="true"], .chip.on {
  color: var(--accent-contrast);
  background: var(--accent);
  border-color: var(--accent);
}
.chip-note {
  display: inline-flex; align-items: center; gap: 6px;
  font-family: var(--font-mono);
  font-size: 0.74rem;
  color: var(--text-muted);
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 4px 10px;
}
.chip-note .conf { width: 8px; height: 8px; border-radius: 50%; background: var(--green); }
.chip-note .conf.mid { background: var(--amber); }
.chip-note .conf.low { background: var(--danger); }

/* ---- data table ---- */
.data-table-wrap, .table-wrap { overflow-x: auto; margin-top: var(--s4); border: 1px solid var(--line); border-radius: var(--radius-sm); }
table.data-table { width: 100%; border-collapse: collapse; font-size: var(--fs-sm); font-variant-numeric: tabular-nums; }
.data-table th {
  text-align: left;
  font-family: var(--font-mono);
  font-size: 0.68rem; text-transform: uppercase; letter-spacing: 0.1em;
  color: var(--text-faint); font-weight: 400;
  padding: 10px 14px; border-bottom: 1px solid var(--line-strong);
  background: var(--surface);
  white-space: nowrap;
}
.data-table td { padding: 10px 14px; border-bottom: 1px solid var(--line); color: var(--text-muted); white-space: nowrap; }
.data-table tr:last-child td { border-bottom: 0; }
.data-table td b, .data-table td strong { color: var(--text); }
.data-table .cell-copy { cursor: pointer; }
.data-table .cell-copy:hover { color: var(--accent); }
.data-table .is-pending { color: var(--text-faint); font-style: normal; }
.data-table .is-error { color: var(--danger); }
.batch-bar { display: flex; flex-wrap: wrap; gap: var(--s3); margin-top: var(--s4); }

/* ---- index rows (v3 catalogue style) ---- */
.tool-rows { margin-top: var(--s6); border-top: 1px solid var(--line); }
.tool-row {
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr) auto;
  align-items: baseline;
  gap: var(--s2) var(--s4);
  padding: var(--s4) var(--s1);
  border-bottom: 1px solid var(--line);
  color: var(--text);
  transition: background var(--t-fast) var(--ease);
}
.tool-row:hover { text-decoration: none; background: var(--bg-2); }
.tool-row .tr-idx {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--text-faint);
  font-variant-numeric: tabular-nums;
}
.tool-row .tr-name { font-family: var(--font-display); font-weight: 600; font-size: 1.05rem; }
.tool-row .tr-desc { grid-column: 2; color: var(--text-muted); font-size: var(--fs-sm); margin: 0; }
.tool-row .tr-tag {
  font-family: var(--font-mono);
  font-size: 0.66rem;
  letter-spacing: 0.06em;
  color: var(--text-faint);
  white-space: nowrap;
}
.tool-row:hover .tr-name { color: var(--accent); }
.index-section { margin-top: var(--s8); }
.index-section > h2 { display: flex; align-items: baseline; gap: var(--s3); }
.index-section > h2 .is-domain {
  font-family: var(--font-mono);
  font-weight: 400;
  font-size: 0.7rem;
  letter-spacing: 0.08em;
  color: var(--text-faint);
}

/* legacy card grid — still used inside some BODY regions */
.tools-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: var(--s4); margin-top: var(--s6); }
.tool-card {
  display: flex; flex-direction: column; gap: var(--s2);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: var(--s5);
  color: var(--text);
  transition: border-color var(--t-med) var(--ease);
}
.tool-card:hover { border-color: var(--accent); color: var(--text); text-decoration: none; }
.tool-card h3 { margin: 0; font-size: 1.02rem; }
.tool-card p { margin: 0; font-size: var(--fs-sm); color: var(--text-muted); }
.tool-card .tc-go { margin-top: auto; font-family: var(--font-mono); font-size: 0.74rem; letter-spacing: 0.06em; color: var(--accent); }
.tool-card .tc-badge { align-self: flex-start; font-family: var(--font-mono); font-size: 0.64rem; letter-spacing: 0.09em; text-transform: uppercase; color: var(--accent); border: 1px solid var(--line); padding: 3px 9px; border-radius: 999px; }

/* ---- pads ---- */
.pads-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; margin-top: var(--s5); }
@media (max-width: 560px) { .pads-grid { gap: 8px; } }
.pad {
  position: relative;
  aspect-ratio: 1 / 1;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  background: var(--surface-2);
  color: var(--text);
  font: inherit; font-weight: 600;
  cursor: pointer;
  display: flex; flex-direction: column; align-items: flex-start; justify-content: space-between;
  padding: 10px;
  transition: transform var(--t-fast) var(--ease), border-color var(--t-fast) var(--ease);
  touch-action: manipulation;
  -webkit-user-select: none; user-select: none;
}
.pad:hover { border-color: var(--line-strong); }
.pad.hit, .pad:active { transform: scale(0.97); border-color: var(--accent); }
.pad.empty { opacity: 0.35; cursor: default; }
.pad .pad-key {
  font-family: var(--font-mono);
  font-size: 0.66rem; color: var(--text-faint);
  border: 1px solid var(--line); border-radius: 5px; padding: 1px 6px;
}
.pad .pad-label { font-size: 0.78rem; color: var(--text-muted); font-weight: 500; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---- segmented control (tool-internal toggles; NOT the mode tabs) ---- */
.seg { display: inline-flex; background: var(--bg-2); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 3px; gap: 2px; }
.seg button {
  font: inherit; font-size: var(--fs-sm); font-weight: 500;
  color: var(--text-muted); background: transparent; border: 0; border-radius: 6px;
  padding: 8px 14px; min-height: 36px; cursor: pointer;
}
.seg button[aria-pressed="true"] { background: var(--surface-3); color: var(--text); }

/* ---- slices ---- */
.slice-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: var(--s3);
  margin-top: var(--s6);
}
.slice-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: var(--s3);
  display: flex;
  flex-direction: column;
  gap: 10px;
  transition: border-color var(--t-fast) var(--ease);
}
.slice-card:hover { border-color: var(--line-strong); }
.slice-card.playing { border-color: var(--accent); }
.slice-card .sc-top { display: flex; align-items: baseline; justify-content: space-between; gap: 6px; }
.slice-card .sc-idx { font-weight: 600; font-size: 0.9rem; color: var(--text); }
.slice-card .sc-dur { font-family: var(--font-mono); font-size: 0.72rem; color: var(--text-faint); font-variant-numeric: tabular-nums; }
.slice-card .sc-mini { height: 34px; width: 100%; display: block; opacity: 0.85; }
.slice-card .sc-actions { display: flex; gap: var(--s2); }
.slice-card .sc-actions .btn { flex: 1; }

.actions-row { display: flex; flex-wrap: wrap; gap: var(--s3); margin-top: var(--s6); }

/* ---- pillar article ---- */
.article {
  margin-top: var(--s10);
  padding-top: var(--s7);
  border-top: 1px solid var(--line);
}
.article-cols { display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--s7); }
@media (min-width: 1020px) {
  .article-cols { grid-template-columns: minmax(0, 1fr) 240px; }
}
.article-body { max-width: 68ch; }
.article-body h2 {
  margin-top: var(--s8);
  display: flex;
  align-items: baseline;
  gap: var(--s3);
}
.article-body h2:first-child { margin-top: 0; }
.article-body h2 .a-idx {
  font-family: var(--font-mono);
  font-weight: 400;
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  color: var(--accent);
  font-variant-numeric: tabular-nums;
  flex: none;
}
.article-body p, .article-body li { color: var(--text-muted); }
.article-body a { text-decoration: underline; text-underline-offset: 3px; text-decoration-thickness: 1px; }
.article-body ul, .article-body ol { padding-left: 1.2em; margin: 0 0 1em; }
.article-body table { width: 100%; border-collapse: collapse; font-size: var(--fs-sm); font-variant-numeric: tabular-nums; margin: 0 0 1.2em; }
.article-body th { text-align: left; font-family: var(--font-mono); font-size: 0.68rem; text-transform: uppercase; letter-spacing: 0.1em; color: var(--text-faint); font-weight: 400; padding: 8px 10px; border-bottom: 1px solid var(--line-strong); }
.article-body td { padding: 8px 10px; border-bottom: 1px solid var(--line); color: var(--text-muted); }
.article-aside { order: -1; }
@media (min-width: 1020px) { .article-aside { order: 0; } }
.article-toc {
  position: sticky;
  top: var(--s5);
  border-left: 1px solid var(--line);
  padding-left: var(--s4);
}
.article-toc .at-label {
  font-family: var(--font-mono);
  font-size: 0.66rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-faint);
  margin-bottom: var(--s2);
}
.article-toc a {
  display: block;
  color: var(--text-muted);
  font-size: var(--fs-sm);
  padding: 5px 0;
}
.article-toc a:hover { color: var(--text); text-decoration: none; }
.article-steps { counter-reset: step; margin: var(--s4) 0; padding: 0; list-style: none; }
.article-steps li { counter-increment: step; position: relative; padding: 0 0 var(--s4) var(--s8); }
.article-steps li::before {
  content: counter(step, decimal-leading-zero);
  position: absolute;
  left: 0;
  top: 2px;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--accent);
}
.article-steps li::after {
  content: "";
  position: absolute;
  left: 10px;
  top: 24px;
  bottom: 4px;
  border-left: 1px solid var(--line);
}
.article-steps li:last-child::after { display: none; }
.article-steps b { display: block; color: var(--text); font-weight: 600; }
.article-cta {
  margin: var(--s6) 0;
  padding: var(--s4) var(--s5);
  border-left: 3px solid var(--accent);
  background: var(--bg-2);
  border-radius: 0 var(--radius) var(--radius) 0;
}
.article-cta p { margin: 0; color: var(--text); }

/* ---- SEO prose / FAQ ---- */
.prose { max-width: 68ch; }
.prose h2 { margin-top: 2.2rem; }
.prose p { color: var(--text-muted); }
.faq-item { border-top: 1px solid var(--line); padding: var(--s4) 0; }
.faq-item h3 { margin-bottom: 6px; color: var(--text); font-family: var(--font); font-weight: 600; font-size: var(--fs-base); }
.faq-item p { margin: 0; }

/* ---- related tools ---- */
.related { margin-top: var(--s9); padding-top: var(--s6); border-top: 1px solid var(--line); }
.related > h2 { font-size: var(--fs-md); }
.related-rows { display: grid; grid-template-columns: minmax(0, 1fr); border-top: 1px solid var(--line); margin-top: var(--s4); }
@media (min-width: 760px) { .related-rows { grid-template-columns: repeat(2, minmax(0, 1fr)); column-gap: var(--s7); } }
.related-rows a {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: baseline;
  gap: 2px var(--s3);
  padding: var(--s3) var(--s1);
  border-bottom: 1px solid var(--line);
  color: var(--text);
}
.related-rows a:hover { text-decoration: none; background: var(--bg-2); }
.related-rows a:hover .rr-name { color: var(--accent); }
.related-rows .rr-name { font-weight: 600; font-size: var(--fs-base); }
.related-rows .rr-job { grid-column: 1; color: var(--text-muted); font-size: var(--fs-sm); }
.related-rows .rr-tag { font-family: var(--font-mono); font-size: 0.66rem; letter-spacing: 0.06em; color: var(--text-faint); white-space: nowrap; }

/* ---- upsell (honesty wedge) ---- */
.upsell {
  margin-top: var(--s8);
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-left: 3px solid var(--accent);
  border-radius: var(--radius-lg);
  padding: clamp(20px, 5vw, 34px);
}
.upsell h2 { font-size: var(--fs-lg); }
.upsell p { color: var(--text); opacity: 0.88; max-width: 60ch; }
.upsell .free-badge {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 0.68rem;
  font-weight: 400;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--green);
  background: var(--green-wash);
  border: 1px solid var(--line);
  padding: 5px 10px;
  border-radius: 999px;
  margin-bottom: var(--s3);
}

/* ---- footer / colophon ---- */
.tool-footer {
  flex: none;
  border-top: 1px solid var(--line);
  padding: var(--s6) clamp(14px, 4vw, 32px) var(--s7);
  color: var(--text-faint);
  font-size: var(--fs-sm);
}
.tool-footer a { color: var(--text-muted); }
.colophon {
  max-width: var(--maxw);
  margin: 0 auto;
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--s2) var(--s6);
}
.colophon .co-brand { font-family: var(--font-mono); font-size: 0.74rem; letter-spacing: 0.03em; }
.footer-links { display: flex; flex-wrap: wrap; gap: 6px var(--s5); margin: 0; }
.footer-links a { min-height: 44px; display: inline-flex; align-items: center; }

/* ---- utilities ---- */
.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;
}
.spin { animation: ct-spin var(--t-spin) linear infinite; }
@keyframes ct-spin { to { transform: rotate(360deg); } }
.kbd {
  font-family: var(--font-mono);
  font-size: 0.74rem; color: var(--text-muted);
  background: var(--surface-2); border: 1px solid var(--line-strong);
  border-bottom-width: 2px; border-radius: 5px; padding: 2px 7px;
}
.hint { font-size: var(--fs-sm); color: var(--text-faint); margin-top: 10px; }
.row { display: flex; flex-wrap: wrap; align-items: center; gap: 10px var(--s4); }
.grow { flex: 1 1 auto; }
.privacy-line { display: inline-flex; align-items: center; gap: 7px; font-size: 0.8rem; color: var(--text-faint); margin-top: var(--s4); }
.privacy-line .lock { color: var(--green); display: inline-flex; }
.privacy-line .lock svg { width: 13px; height: 13px; fill: currentColor; display: block; }

/* ---- engine loading ---- */
.engine-note { font-size: 0.8rem; color: var(--text-faint); }
.progress-slim { height: 5px; border-radius: 999px; background: var(--surface-3); overflow: hidden; margin-top: 10px; }
.progress-slim > div { height: 100%; width: 0%; background: var(--accent); transition: width var(--t-med) var(--ease); }

/* ---- full-screen count display ---- */
.count-stage {
  display: grid;
  place-items: center;
  min-height: min(52vh, 420px);
  border-radius: var(--radius-lg);
  background: var(--bg-2);
  border: 1px solid var(--line);
  user-select: none;
}
.count-num {
  font-family: var(--font-mono);
  font-size: clamp(6rem, 34vh, 17rem);
  font-weight: 400;
  line-height: 1;
  letter-spacing: -0.05em;
  color: var(--text);
  font-variant-numeric: tabular-nums;
}
.count-num.accent-1 { color: var(--accent); }
.count-num.accent-5 { color: var(--green); }
.count-stage.mirrored .count-num { transform: scaleX(-1); }
.count-dots { display: flex; gap: 10px; margin-top: var(--s2); }
.count-dots span { width: 10px; height: 10px; border-radius: 50%; background: var(--surface-3); }
.count-dots span.on { background: var(--accent); }
.count-stage.mirrored .count-dots { flex-direction: row-reverse; }

@media (max-width: 460px) {
  .stage-head { gap: 6px var(--s3); }
  .slice-grid { grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); }
  .actions-row .btn { flex: 1 1 100%; }
}

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

/* ---- print sheets ---- */
@media print {
  body { background: #fff !important; color: #000 !important; display: block; border-top: 0; }
  .tool-header, .tool-footer, .upsell, .prose, .dropzone, .controls, .actions-row,
  .hint, .privacy-line, .tool-eyebrow, .lede, .status, .wave-wrap, .transport,
  .time-ruler, .subtool-tabs, .article, .related, .no-print { display: none !important; }
  .tool-main { max-width: none; padding: 0; }
  .panel { border: 0; background: none; padding: 0; }
  .print-sheet { display: block !important; color: #000; }
  .print-sheet h2, .print-sheet h3, .print-sheet p, .print-sheet td, .print-sheet th { color: #000 !important; }
  .print-sheet table { width: 100%; border-collapse: collapse; }
  .print-sheet th, .print-sheet td { border-bottom: 1px solid #999; padding: 8px 10px; text-align: left; }
  .print-sheet tr { page-break-inside: avoid; }
}
