/* ================================================================
   thock — engineering-publication aesthetic, shared with mwlabs.be.
   Cool paper ground, deep ink, instrument-blue accent. Fraunces for
   display, IBM Plex Sans for body, IBM Plex Mono for technical labels
   and numerics. The dark-mode toggle swaps the palette tokens below;
   the instrument canvases (app.js) read the same tokens and repaint.
   ================================================================ */

:root {
  /* light — engineering paper (the mwlabs.be default) */
  --bg:        #f8fafc;
  --bg-2:      #eef2f8;
  --surface:   #ffffff;
  --surface-2: #f1f4fa;
  --line:      #dbe0ea;
  --line-2:    #c5cdda;
  --ink:       #0b1220;
  --ink-dim:   #475569;
  --ink-mute:  #7e8aa0;
  --accent:    #1849d6;
  --accent-2:  #2f5cf0;
  --accent-soft:  rgba(24, 73, 214, 0.16);
  --accent-faint: rgba(24, 73, 214, 0.07);
  --ok:        #1a8a4a;
  --danger:    #c4302b;
  --grid:      #e9eef5;
  --scrim:     rgba(11, 18, 32, 0.45);
  --shadow:    rgba(11, 18, 32, 0.18);

  --font-display: "Fraunces", Georgia, "Times New Roman", serif;
  --font-body:    "IBM Plex Sans", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --font-mono:    "IBM Plex Mono", ui-monospace, "SF Mono", "Cascadia Mono", monospace;

  --radius: 2px;
  --pane-padding: 18px;
  color-scheme: light;
}

html.dark {
  /* dark — same family: ink ground, brighter instrument-blue */
  --bg:        #0b1220;
  --bg-2:      #0d1526;
  --surface:   #131c30;
  --surface-2: #1a2538;
  --line:      #273349;
  --line-2:    #36445d;
  --ink:       #e8edf5;
  --ink-dim:   #9aa6ba;
  --ink-mute:  #5f6d82;
  --accent:    #6b8dff;
  --accent-2:  #88a4ff;
  --accent-soft:  rgba(107, 141, 255, 0.20);
  --accent-faint: rgba(107, 141, 255, 0.10);
  --ok:        #5bd98a;
  --danger:    #e0726a;
  --grid:      #182640;
  --scrim:     rgba(3, 6, 14, 0.66);
  --shadow:    rgba(0, 0, 0, 0.6);
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }

html, body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 14px;
  line-height: 1.55;
  font-feature-settings: "ss02", "zero", "cv11";
  font-variant-numeric: lining-nums;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  transition: background-color 0.28s ease, color 0.28s ease;
}

/* graph-paper grid — the datasheet / lab-notebook ground from mwlabs,
   fading out toward the edges. */
body::before {
  content: "";
  position: fixed; inset: 0;
  z-index: 0;
  pointer-events: none;
  background-image:
    linear-gradient(to right, var(--grid) 1px, transparent 1px),
    linear-gradient(to bottom, var(--grid) 1px, transparent 1px);
  background-size: 32px 32px;
  background-position: -1px -1px;
  -webkit-mask-image: radial-gradient(ellipse 85% 70% at 50% 25%, #000 0%, rgba(0,0,0,0.45) 55%, transparent 100%);
  mask-image: radial-gradient(ellipse 85% 70% at 50% 25%, #000 0%, rgba(0,0,0,0.45) 55%, transparent 100%);
}

/* technical labels, eyebrows, and numeric readouts use the mono face —
   the mwlabs "eyebrow" convention. */
.pane-head h2, .pane-status, .fp-label, .fp-meta, .block-label,
.capture-meta dt, .capture-meta dd, .samples-head > span, .switch-empty,
.scope-legend, .level-db, .dialog-hint, .guided-phase-num,
.guided-card-status, .guided-card-counter, .preset-count,
.switch-tile .ct, .tile .label, .typist-switches:empty::before,
#status-text, .param {
  font-family: var(--font-mono);
}

/* theme toggle — sun/moon glyph swap */
.theme-toggle { line-height: 1; padding: 5px 9px; font-size: 0.95rem; }
.theme-toggle .theme-icon-sun { display: none; }
html.dark .theme-toggle .theme-icon-sun { display: inline; }
html.dark .theme-toggle .theme-icon-moon { display: none; }

/* ----------------------------- topbar ----------------------------- */

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 22px 28px 18px;
  border-bottom: 1px solid var(--line);
  position: relative;
  z-index: 1;
  background: var(--bg);
}

.topbar h1 {
  margin: 0;
  font-family: var(--font-mono);
  font-weight: 600;
  font-size: 2.1rem;
  letter-spacing: -0.02em;
  font-feature-settings: "zero" on;
  color: var(--ink);
  line-height: 1;
}
.topbar h1 span { color: var(--accent); }

.topbar-status {
  display: flex;
  gap: 22px;
  align-items: center;
}

#status-text {
  color: var(--ink-dim);
  font-size: 0.78rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

.level-meter {
  position: relative;
  width: 240px;
  height: 22px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  overflow: hidden;
}
.level-fill {
  position: absolute;
  inset: 0;
  width: 0%;
  background: linear-gradient(90deg, var(--accent-soft) 0%, var(--accent) 100%);
  transition: width 30ms linear;
}
.level-db {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  padding: 0 8px;
  color: var(--ink);
  font-size: 0.7rem;
  letter-spacing: 0.1em;
  text-shadow: 0 0 4px var(--bg);
}

/* ----------------------------- layout ----------------------------- */

main {
  display: grid;
  grid-template-columns: 320px minmax(0, 1fr) 440px;
  grid-template-areas:
    "capture switches inspect"
    "typist  typist   typist";
  gap: 16px;
  padding: 16px 28px 28px;
  position: relative;
  z-index: 1;
}

.capture-pane { grid-area: capture; }
.switch-pane  { grid-area: switches; }
.inspect-pane { grid-area: inspect; }
.typist-pane  { grid-area: typist; }

.pane {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: var(--pane-padding);
  position: relative;
}

/* tiny corner ticks on every pane — measurement-instrument detail */
.pane::before, .pane::after {
  content: "";
  position: absolute;
  width: 10px; height: 10px;
  border-color: var(--line-2);
  border-style: solid;
  border-width: 0;
}
.pane::before { top: -1px; left: -1px; border-top-width: 1px; border-left-width: 1px; }
.pane::after  { bottom: -1px; right: -1px; border-bottom-width: 1px; border-right-width: 1px; }

.pane-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 14px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--line);
}

.pane-head h2 {
  margin: 0;
  font-size: 0.7rem;
  letter-spacing: 0.32em;
  text-transform: uppercase;
  color: var(--ink-dim);
  font-weight: 500;
}

.pane-status {
  color: var(--ink-mute);
  font-size: 0.7rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
}
.pane-status.armed,
.pane-status.typing,
.pane-status.live { color: var(--accent); }
.pane-status.armed::before {
  content: "● ";
  animation: blink 1s ease-in-out infinite;
}
@keyframes blink {
  0%, 100% { opacity: 1; }
  50%      { opacity: 0.25; }
}

/* ---------------------------- buttons ----------------------------- */

.action {
  background: transparent;
  border: 1px solid var(--line-2);
  color: var(--ink);
  padding: 9px 16px;
  font-family: inherit;
  font-size: 0.85rem;
  letter-spacing: 0.06em;
  cursor: pointer;
  border-radius: var(--radius);
  transition: border-color 120ms, color 120ms, background 120ms;
}
.action:hover:not(:disabled) { border-color: var(--accent); color: var(--accent); }
.action:disabled { opacity: 0.35; cursor: not-allowed; }

.action.primary {
  background: var(--accent);
  color: var(--bg);
  border-color: var(--accent);
  font-weight: 600;
}
.action.primary:hover:not(:disabled) { background: var(--accent-2); }
.action.primary.armed,
.action.primary.busy {
  box-shadow: 0 0 0 0 var(--accent-soft);
  animation: armedpulse 1.3s ease-out infinite;
}
@keyframes armedpulse {
  0%   { box-shadow: 0 0 0 0 var(--accent-soft); }
  100% { box-shadow: 0 0 0 14px transparent; }
}

.action.ghost {
  color: var(--ink-dim);
  border-color: var(--line);
}
.action.ghost:hover:not(:disabled) {
  color: var(--accent);
  border-color: var(--accent);
}

.action.small { padding: 5px 10px; font-size: 0.75rem; }

.action.danger:hover:not(:disabled),
#delete-all-btn:hover:not(:disabled),
#remove-switch-btn:hover:not(:disabled) {
  color: var(--danger);
  border-color: var(--danger);
}

.pane-head-actions {
  display: flex;
  gap: 6px;
}

.presets-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin: 14px 0;
  max-height: 420px;
  overflow-y: auto;
  background: var(--bg-2);
  border: 1px solid var(--line);
  padding: 6px;
  border-radius: var(--radius);
}
.preset-item {
  --c: var(--accent);
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-left: 3px solid var(--c);
  padding: 10px 14px;
  border-radius: var(--radius);
}
.preset-item.importing { opacity: 0.6; }
.preset-dot {
  width: 12px; height: 12px; border-radius: 50%;
  background: var(--c);
  flex-shrink: 0;
}
.preset-info { flex: 1; min-width: 0; }
.preset-name {
  color: var(--ink);
  font-size: 0.95rem;
  font-weight: 500;
}
.preset-desc {
  color: var(--ink-dim);
  font-size: 0.75rem;
  margin-top: 2px;
}
.preset-count {
  color: var(--ink-mute);
  font-variant-numeric: tabular-nums;
  font-size: 0.85rem;
  min-width: 60px;
  text-align: right;
}
.preset-item button { min-width: 84px; }
.presets-list .dim {
  padding: 18px;
  text-align: center;
  color: var(--ink-mute);
  font-size: 0.85rem;
}

/* ------------------------------ capture --------------------------- */

.scope-wrap {
  position: relative;
  margin-bottom: 12px;
}
.scope-legend {
  position: absolute;
  bottom: 4px;
  right: 6px;
  color: var(--ink-mute);
  font-size: 0.65rem;
  letter-spacing: 0.1em;
}

canvas {
  display: block;
  width: 100%;
  height: auto;
  background: var(--bg);
  border: 1px solid var(--line);
}

#scope { height: 160px; }

.capture-actions {
  display: flex;
  gap: 6px;
  margin-bottom: 14px;
}
.capture-actions .action { flex: 1; text-align: center; }

/* guided recording popup — full-screen overlay, centered card. Same
   pattern as the storage-gate so it feels native to the app. Commands
   attention while a session is running; the rest of the UI dims out. */
.guided-modal {
  position: fixed;
  inset: 0;
  background: var(--scrim);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 600;
}
.guided-modal.hidden { display: none; }
.guided-card {
  background: var(--surface);
  border: 1px solid var(--accent);
  padding: 32px 40px 28px;
  max-width: 520px;
  min-width: 380px;
  box-shadow: 0 30px 80px var(--shadow);
  border-radius: var(--radius);
  text-align: center;
}
.guided-card-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 6px;
}
.guided-card h3 {
  margin: 0;
  font-family: var(--font-display);
  font-variation-settings: "SOFT" 100, "opsz" 36;
  font-weight: 400;
  font-size: 1.4rem;
  color: var(--ink);
  letter-spacing: -0.01em;
}
.guided-card h3 #guided-card-switch {
  color: var(--accent);
  font-style: italic;
  letter-spacing: 0;
}
.guided-card .guided-phase-num {
  color: var(--ink-mute);
  font-size: 0.7rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  font-variant-numeric: tabular-nums;
}

/* the big action stage — what to do right now, written huge */
.guided-stage {
  background: var(--surface-2);
  border: 1px solid var(--line-2);
  border-radius: var(--radius);
  padding: 24px 16px 18px;
  margin: 18px 0 14px;
  transition: border-color 0.18s ease, background 0.18s ease;
}
.guided-stage-icon {
  font-size: 4.5rem;
  line-height: 1;
  color: var(--ink-dim);
  margin-bottom: 6px;
  transition: color 0.18s ease, transform 0.18s ease;
}
.guided-stage-label {
  font-size: 1.5rem;
  font-weight: 500;
  letter-spacing: 0.02em;
  color: var(--ink);
  margin-bottom: 2px;
}
.guided-stage-sub {
  font-size: 0.82rem;
  color: var(--ink-dim);
  min-height: 1.1em;
}
.guided-stage[data-step="press"] {
  border-color: var(--accent);
  background: var(--accent-faint);
}
.guided-stage[data-step="press"] .guided-stage-icon,
.guided-stage[data-step="press"] .guided-stage-label {
  color: var(--accent);
}
.guided-stage[data-step="hold"] {
  border-color: var(--line-2);
}
.guided-stage[data-step="hold"] .guided-stage-icon {
  color: var(--ink);
}
.guided-stage[data-step="release"] {
  border-color: var(--ok);
  background: color-mix(in srgb, var(--ok) 8%, transparent);
}
.guided-stage[data-step="release"] .guided-stage-icon,
.guided-stage[data-step="release"] .guided-stage-label {
  color: var(--ok);
}
.guided-stage[data-step="got"] {
  border-color: var(--ok);
}
.guided-stage[data-step="got"] .guided-stage-icon {
  color: var(--ok);
  transform: scale(1.1);
}
.guided-stage[data-step="ready"] .guided-stage-icon {
  color: var(--ink-mute);
}

.guided-card-phase {
  margin-bottom: 12px;
}
.guided-card-label {
  color: var(--ink-dim);
  font-size: 0.95rem;
  letter-spacing: 0.02em;
  margin-bottom: 4px;
}
.guided-card-hint {
  color: var(--ink-mute);
  font-size: 0.8rem;
  line-height: 1.45;
}
.guided-card-counter {
  font-size: 1.6rem;
  color: var(--accent);
  letter-spacing: 0.18em;
  font-variant-numeric: tabular-nums;
  padding: 4px 0 2px;
  min-height: 1.8rem;
}
.guided-card-status {
  color: var(--ink-mute);
  font-size: 0.72rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  margin-bottom: 14px;
  font-variant-numeric: tabular-nums;
}
.guided-card-learned {
  background: var(--surface-2);
  border-left: 2px solid var(--accent);
  padding: 12px 16px;
  margin: 4px 0 18px;
  text-align: left;
  font-size: 0.85rem;
  color: var(--ink);
  line-height: 1.55;
}
.guided-card-learned.hidden { display: none; }
.guided-card-learned strong {
  color: var(--accent);
  font-weight: 500;
}
.guided-card-controls {
  display: flex;
  gap: 8px;
  justify-content: center;
}
.guided-card-controls .action {
  min-width: 110px;
}

.capture-meta {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1px;
  background: var(--line);
  border: 1px solid var(--line);
  margin: 0;
}
.capture-meta > div {
  background: var(--surface-2);
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.capture-meta dt {
  color: var(--ink-mute);
  font-size: 0.65rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}
.capture-meta dd {
  margin: 0;
  font-size: 0.95rem;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}

/* ------------------------------ switches -------------------------- */

.switch-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 18px;
}

.switch-empty {
  color: var(--ink-mute);
  font-size: 0.75rem;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  padding: 8px 0;
}

.switch-tile {
  --c: var(--accent);
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-left: 3px solid var(--c);
  padding: 8px 12px 8px 10px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.9rem;
  color: var(--ink);
  font-family: inherit;
  border-radius: var(--radius);
  transition: border-color 100ms, background 100ms, color 100ms;
  position: relative;
  user-select: none;
}
.switch-tile:hover { border-color: var(--c); border-left-color: var(--c); }
.switch-tile:focus { outline: 1px solid var(--c); outline-offset: 1px; }
.switch-tile .name { font-weight: 500; }
.switch-tile .ct {
  color: var(--ink-mute);
  font-size: 0.75rem;
  font-variant-numeric: tabular-nums;
}
.switch-tile.active {
  background: var(--c);
  color: var(--bg);
  border-color: var(--c);
  border-left-color: var(--c);
}
.switch-tile.active .ct      { color: var(--bg); opacity: 0.65; }
.switch-tile.active .swatch  { border-color: var(--bg); }
.switch-tile.pulse::after {
  content: "";
  position: absolute;
  inset: -1px;
  border: 1px solid var(--c);
  animation: pulseflash 280ms ease-out forwards;
  pointer-events: none;
}
@keyframes pulseflash {
  0%   { opacity: 1; transform: scale(1);    }
  100% { opacity: 0; transform: scale(1.18); }
}

.swatch {
  appearance: none;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  border: 1px solid var(--line-2);
  background: var(--c);
  cursor: pointer;
  padding: 0;
  flex-shrink: 0;
  box-shadow: 0 0 0 1px transparent;
  transition: box-shadow 120ms, transform 120ms;
}
.swatch:hover { box-shadow: 0 0 0 2px var(--c); transform: scale(1.1); }

.color-popover {
  position: absolute;
  background: var(--surface);
  border: 1px solid var(--line-2);
  padding: 8px;
  display: flex;
  gap: 6px;
  z-index: 200;
  border-radius: var(--radius);
  box-shadow: 0 12px 32px var(--shadow);
}
.color-swatch {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 1px solid var(--line);
  cursor: pointer;
  padding: 0;
  transition: transform 100ms, border-color 100ms;
}
.color-swatch:hover { transform: scale(1.18); border-color: var(--ink); }
.color-swatch.active {
  border-color: var(--ink);
  box-shadow: 0 0 0 2px var(--bg), 0 0 0 3px var(--ink);
}

/* -------- fingerprint: the centerpiece — the switch's identity ---- */

.fingerprint {
  position: relative;
  margin-bottom: 18px;
  border: 1px solid var(--line);
  background: var(--bg-2);
  padding: 14px 16px 8px;
}
.fingerprint-head {
  display: flex;
  align-items: baseline;
  gap: 14px;
  margin-bottom: 6px;
}
.fp-label {
  font-size: 0.65rem;
  letter-spacing: 0.32em;
  text-transform: uppercase;
  color: var(--ink-mute);
}
.fp-name {
  font-family: var(--font-display);
  font-variation-settings: "SOFT" 100, "opsz" 144;
  font-weight: 400;
  font-size: 2rem;
  letter-spacing: -0.01em;
  color: var(--accent);
  line-height: 1;
}
.fp-controls {
  display: flex;
  gap: 6px;
  margin-left: 14px;
}
.fp-controls .mini-select { font-size: 0.7rem; padding: 3px 6px; }
.fp-meta {
  margin-left: auto;
  color: var(--ink-mute);
  font-size: 0.7rem;
  letter-spacing: 0.15em;
  text-transform: uppercase;
}
#fingerprint {
  width: 100%;
  height: 220px;
  background: var(--bg-2);
  border: none;
}

.samples-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 6px;
}
.samples-head > span {
  font-size: 0.65rem;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  color: var(--ink-dim);
}
.samples-actions {
  display: flex;
  gap: 6px;
}
.mini-select {
  background: var(--surface-2);
  border: 1px solid var(--line);
  color: var(--ink);
  padding: 4px 8px;
  font-family: inherit;
  font-size: 0.7rem;
  border-radius: var(--radius);
}

.samples {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 4px;
  background: var(--bg-2);
  border: 1px solid var(--line);
  padding: 4px;
  max-height: 360px;
  overflow-y: auto;
}
.samples::-webkit-scrollbar { width: 6px; }
.samples::-webkit-scrollbar-thumb { background: var(--line-2); }

.tile {
  background: var(--surface);
  border: 1px solid transparent;
  padding: 4px;
  cursor: pointer;
  transition: border-color 100ms, background 100ms;
  border-radius: var(--radius);
}
.tile:hover { border-color: var(--accent); }
.tile.active { border-color: var(--accent); background: var(--accent-faint); }
.tile.pending { opacity: 0.45; }
.tile canvas { height: 30px; border: none; background: transparent; }
.tile .label {
  display: flex; justify-content: space-between;
  color: var(--ink-mute); font-size: 0.65rem;
  margin-top: 2px;
  font-variant-numeric: tabular-nums;
}

/* ------------------------------ inspect --------------------------- */

.inspect-info {
  color: var(--ink-dim);
  font-size: 0.75rem;
  margin-bottom: 10px;
  font-variant-numeric: tabular-nums;
}
.inspect-actions { display: flex; gap: 6px; margin-bottom: 10px; }
.inspect-block { margin-top: 12px; }
.block-label {
  display: block;
  font-size: 0.62rem;
  letter-spacing: 0.32em;
  text-transform: uppercase;
  color: var(--ink-mute);
  margin-bottom: 4px;
}
#detail-wave { height: 140px; }
#detail-fft  { height: 180px; }
#detail-spec { height: 180px; }

/* ------------------------------ typist ---------------------------- */

.typist-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
}
.typist-controls .hint {
  margin: 0 0 0 auto;
  color: var(--ink-mute);
  font-size: 0.7rem;
  letter-spacing: 0.05em;
}

.param {
  color: var(--ink-dim);
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.75rem;
  letter-spacing: 0.05em;
}
.param input {
  width: 54px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  color: var(--ink);
  padding: 5px 8px;
  font-family: inherit;
  font-size: 0.85rem;
  border-radius: var(--radius);
}

.typist-switches {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 12px;
  min-height: 36px;
}
.typist-switches:empty::before {
  content: "no switches with samples yet";
  color: var(--ink-mute);
  font-size: 0.7rem;
  letter-spacing: 0.15em;
  text-transform: uppercase;
}

.typist-stack { margin-top: 10px; }
.typist-stack canvas { display: block; width: 100%; background: var(--bg); }
#typist-text {
  height: 56px;
  border: 1px solid var(--line);
  border-bottom: none;
}
#typist-viz {
  height: 120px;
  border: 1px solid var(--line);
}

/* ------------------------------ dialogs --------------------------- */

dialog {
  background: var(--surface);
  color: var(--ink);
  border: 1px solid var(--line-2);
  border-radius: var(--radius);
  padding: 26px 28px;
  min-width: 460px;
  max-width: 720px;
  box-shadow: 0 18px 60px var(--shadow);
}
dialog::backdrop {
  background: var(--scrim);
  backdrop-filter: blur(3px);
}
dialog h3 {
  margin: 0 0 14px;
  font-family: var(--font-display);
  font-variation-settings: "SOFT" 100, "opsz" 36;
  font-weight: 400;
  font-size: 1.5rem;
  letter-spacing: -0.01em;
  text-transform: none;
  color: var(--ink);
}
dialog input {
  background: var(--surface-2);
  border: 1px solid var(--line-2);
  color: var(--ink);
  padding: 10px 12px;
  font-family: inherit;
  font-size: 1.05rem;
  width: 100%;
  margin: 12px 0 4px;
  border-radius: var(--radius);
}
dialog input:focus { outline: none; border-color: var(--accent); }
.dialog-hint { color: var(--ink-mute); font-size: 0.7rem; margin: 0 0 18px; letter-spacing: 0.08em; }
.dialog-actions { gap: 8px; }

.row { display: flex; align-items: center; }

.capture-pane .hint {
  color: var(--ink-dim);
  font-size: 0.74rem;
  letter-spacing: 0.01em;
  line-height: 1.5;
  margin: 0 0 14px;
}
.capture-pane .hint strong { color: var(--accent); font-weight: 500; }

/* ---------- storage gate ---------- */

.storage-gate {
  position: fixed;
  inset: 0;
  background: var(--scrim);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 500;
}
.storage-gate.hidden { display: none; }
.storage-gate-card {
  background: var(--surface);
  border: 1px solid var(--line-2);
  padding: 28px 32px;
  max-width: 460px;
  box-shadow: 0 30px 80px var(--shadow);
  border-radius: var(--radius);
}
.storage-gate-card h3 {
  margin: 0 0 12px;
  font-family: var(--font-display);
  font-variation-settings: "SOFT" 100, "opsz" 36;
  font-weight: 400;
  font-size: 1.7rem;
  color: var(--ink);
  letter-spacing: -0.01em;
}
.storage-gate-card p { margin: 0 0 12px; color: var(--ink); font-size: 0.85rem; line-height: 1.55; }
.storage-gate-card p.dim { color: var(--ink-dim); }
.storage-gate-card p.small { font-size: 0.7rem; color: var(--ink-mute); margin-top: 14px; }
.storage-gate-card code {
  background: var(--surface-2);
  padding: 1px 6px;
  border-radius: 2px;
  color: var(--ink);
  font-family: inherit;
}
.storage-gate-card button { margin-top: 6px; }
.storage-gate-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; }
.storage-gate-card strong { color: var(--accent); font-weight: 500; }
.storage-gate-card #storage-pick.hidden,
.storage-gate-card #storage-opfs.hidden { display: none; }

#storage-btn.needs-folder {
  background: var(--accent);
  color: var(--bg);
  border-color: var(--accent);
}

/* responsive minimal — pile panes if narrow */
@media (max-width: 1100px) {
  main {
    grid-template-columns: 1fr;
    grid-template-areas:
      "capture"
      "switches"
      "inspect"
      "typist";
  }
}
