/* Layout concept: a projector deck. One slide at a time, prose on the left and a live "bench" on the right.
   The QR itself always sits on a sheet of paper, because that is what scanners see. */
:root {
  --bg: #0f141d;
  --surface: #161d2a;
  --surface-2: #1d2636;
  --line: #2a3448;
  --fg: #e8edf6;
  --muted: #95a1b8;
  --accent: #7fb2ff;
  --data: #5b9dff;
  --data-2: #3d7be0;
  --ec: #f2a73b;
  --ec-2: #c9831f;
  --fn: #ab8dff;
  --err: #ff6b6b;
  --ok: #3fcb8c;
  --paper: #f5f7fa;
  --ink: #111620;
  --shadow: 0 1px 0 rgba(255,255,255,.04) inset, 0 18px 40px -20px rgba(0,0,0,.6);

  --f-display: "Bricolage Grotesque", "Avenir Next", "Segoe UI", system-ui, sans-serif;
  --f-body: "IBM Plex Sans", "Segoe UI", system-ui, -apple-system, sans-serif;
  --f-mono: "IBM Plex Mono", ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;

  --step--1: clamp(.78rem, .74rem + .15vw, .86rem);
  --step-0: clamp(.95rem, .9rem + .2vw, 1.05rem);
  --step-1: clamp(1.15rem, 1.05rem + .4vw, 1.35rem);
  --step-2: clamp(1.5rem, 1.25rem + 1vw, 2.1rem);
  --step-3: clamp(2rem, 1.5rem + 2.2vw, 3.4rem);
  --step-4: clamp(2.6rem, 1.8rem + 3.6vw, 5rem);
  --radius: 10px;
  color-scheme: dark;
}
@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) {
    --bg: #eef1f6; --surface: #ffffff; --surface-2: #f4f6fa; --line: #d3dae6; --fg: #131925; --muted: #586379;
    --accent: #2563d6; --data: #2a68d8; --data-2: #1c4fae; --ec: #c07400; --ec-2: #94590a; --fn: #6a4ed6;
    --err: #d23b3b; --ok: #108452; --paper: #ffffff; --ink: #111620;
    --shadow: 0 1px 2px rgba(20,30,50,.06), 0 18px 40px -24px rgba(20,30,50,.35);
    color-scheme: light;
  }
}
:root[data-theme="light"] {
  --bg: #eef1f6; --surface: #ffffff; --surface-2: #f4f6fa; --line: #d3dae6; --fg: #131925; --muted: #586379;
  --accent: #2563d6; --data: #2a68d8; --data-2: #1c4fae; --ec: #c07400; --ec-2: #94590a; --fn: #6a4ed6;
  --err: #d23b3b; --ok: #108452; --paper: #ffffff; --ink: #111620;
  --shadow: 0 1px 2px rgba(20,30,50,.06), 0 18px 40px -24px rgba(20,30,50,.35);
  color-scheme: light;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--fg);
  font: 400 var(--step-0)/1.6 var(--f-body);
  display: grid; grid-template-rows: auto 1fr auto; overflow: hidden;
}
[hidden] { display: none !important; }
button, input, select { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }
code, .mono { font-family: var(--f-mono); font-size: .92em; }
h1, h2, h3 { font-family: var(--f-display); text-wrap: balance; margin: 0; line-height: 1.08; letter-spacing: -.01em; }
p { margin: 0; }
a { color: var(--accent); }

/* ---------- top bar & nav ---------- */
.topbar {
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  padding-block: .7rem; padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px));
  border-bottom: 1px solid var(--line);
}
.wordmark { display: flex; align-items: center; gap: .6rem; font-family: var(--f-display); font-weight: 700; letter-spacing: .01em; }
.wordmark i { width: 18px; height: 18px; display: grid; grid-template-columns: repeat(3, 1fr); gap: 1px; }
.wordmark i b { background: var(--fg); border-radius: 1px; }
.wordmark i b:nth-child(2), .wordmark i b:nth-child(4), .wordmark i b:nth-child(9) { background: transparent; }
.top-actions { display: flex; gap: .5rem; align-items: center; }
.kbd-hint { color: var(--muted); font-size: var(--step--1); }
@media (max-width: 700px) { .kbd-hint { display: none; } }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .45rem;
  border: 1px solid var(--line); background: var(--surface); border-radius: 8px;
  padding: .45rem .8rem; cursor: pointer; font-size: var(--step--1); font-weight: 500; line-height: 1.2;
  transition: background .15s, border-color .15s, transform .1s;
}
.btn:hover { border-color: var(--accent); }
.btn:active { transform: translateY(1px); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--bg); }
.btn.is-on { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 16%, var(--surface)); }
.btn[disabled] { opacity: .45; cursor: default; }
.btn svg { width: 16px; height: 16px; }

.navbar {
  display: flex; align-items: center; gap: 1rem;
  padding-block: .6rem; padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px));
  border-top: 1px solid var(--line); background: var(--bg);
}
.modules { flex: 1; display: flex; gap: 5px; justify-content: center; flex-wrap: wrap; min-width: 0; }
.modules button {
  width: 14px; height: 14px; padding: 0; border: 1.5px solid var(--muted); background: transparent; border-radius: 2px; cursor: pointer;
  transition: background .2s, transform .2s, border-color .2s;
}
.modules button.seen { background: var(--muted); }
.modules button.now { background: var(--accent); border-color: var(--accent); transform: scale(1.25); }
@media (max-width: 560px) {
  .navbar { gap: .5rem; }
  .modules { gap: 3px; }
  .modules button { width: 9px; height: 9px; border-width: 1px; }
  .counter { display: none; }
}
.counter { font-family: var(--f-mono); font-size: var(--step--1); color: var(--muted); min-width: 4.5em; text-align: center; font-variant-numeric: tabular-nums; }

/* ---------- slides ---------- */
.deck { position: relative; overflow: hidden; min-height: 0; }
.slide {
  position: absolute; inset: 0; overflow-y: auto; overflow-x: hidden;
  display: none;
  padding-block: clamp(1rem, 3vh, 2.5rem); padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px));
}
.slide.is-active { display: block; animation: slideIn .45s cubic-bezier(.2,.7,.2,1); }
.slide.is-active.back { animation-name: slideInBack; }
@keyframes slideIn { from { opacity: 0; transform: translateX(24px); } to { opacity: 1; transform: none; } }
@keyframes slideInBack { from { opacity: 0; transform: translateX(-24px); } to { opacity: 1; transform: none; } }
.slide-inner {
  max-width: 1280px; margin: 0 auto; min-height: 100%;
  display: grid; grid-template-columns: minmax(0, .85fr) minmax(0, 1.15fr); gap: clamp(1.5rem, 4vw, 3.5rem); align-items: start; align-content: center;
}
.slide-inner.wide { grid-template-columns: minmax(0, 1fr); align-items: start; }
@media (max-width: 920px) { .slide-inner { grid-template-columns: minmax(0, 1fr); align-items: start; } }

.prose { display: flex; flex-direction: column; gap: 1rem; min-width: 0; }
.prose > p { max-width: 62ch; color: color-mix(in srgb, var(--fg) 88%, var(--muted)); }
.eyebrow { font-family: var(--f-mono); font-size: var(--step--1); letter-spacing: .12em; text-transform: uppercase; color: var(--muted); display: flex; gap: .7rem; align-items: center; }
.eyebrow .dot { width: 8px; height: 8px; background: var(--chap, var(--accent)); border-radius: 1px; }
.prose h2 { font-size: var(--step-3); font-weight: 700; }
.lede { font-size: var(--step-1); line-height: 1.5; }
.k-data { color: var(--data); font-weight: 600; }
.k-ec { color: var(--ec); font-weight: 600; }
.k-fn { color: var(--fn); font-weight: 600; }
.k-err { color: var(--err); font-weight: 600; }
.k-ok { color: var(--ok); font-weight: 600; }

details.deeper { border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); max-width: 62ch; }
details.deeper summary { cursor: pointer; padding: .6rem .9rem; font-weight: 600; font-size: var(--step--1); letter-spacing: .04em; list-style: none; display: flex; gap: .5rem; align-items: center; }
details.deeper summary::-webkit-details-marker { display: none; }
details.deeper summary::before { content: "+"; font-family: var(--f-mono); color: var(--accent); width: 1ch; }
details.deeper[open] summary::before { content: "−"; }
details.deeper .body { padding: 0 .9rem .9rem; display: flex; flex-direction: column; gap: .7rem; font-size: var(--step--1); line-height: 1.65; }
.eq { font-family: var(--f-mono); background: var(--surface-2); border: 1px solid var(--line); border-radius: 6px; padding: .5rem .7rem; overflow-x: auto; white-space: pre; font-size: .85rem; line-height: 1.55; }

/* ---------- the bench (interactive area) ---------- */
.bench { display: flex; flex-direction: column; gap: 1rem; min-width: 0; }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem; box-shadow: var(--shadow); min-width: 0; }
.panel-title .nocase { text-transform: none; letter-spacing: .02em; }
.panel-title { font-family: var(--f-mono); font-size: .72rem; text-transform: uppercase; letter-spacing: .12em; color: var(--muted); margin-bottom: .6rem; display: flex; justify-content: space-between; gap: .5rem; flex-wrap: wrap; }
.row { display: flex; gap: .6rem; align-items: center; flex-wrap: wrap; }
.row.spread { justify-content: space-between; }
.paper { background: var(--paper); border-radius: 6px; box-shadow: 0 10px 30px -14px rgba(0,0,0,.55); }
canvas { display: block; max-width: 100%; touch-action: none; }
.qr-canvas { width: 100%; aspect-ratio: 1; max-width: 100%; }
.stage-sq { width: min(100%, 500px, 64vh); margin-inline: auto; }
@media (max-width: 920px) { .stage-sq { width: min(100%, 500px); } }
.caption { font-size: var(--step--1); color: var(--muted); }
.stat-line { font-family: var(--f-mono); font-size: .8rem; color: var(--muted); display: flex; flex-wrap: wrap; gap: .3rem 1rem; font-variant-numeric: tabular-nums; }
.stat-line b { color: var(--fg); font-weight: 500; }

.field { display: flex; flex-direction: column; gap: .3rem; min-width: 0; flex: 1; }
.field label { font-size: .72rem; font-family: var(--f-mono); letter-spacing: .1em; text-transform: uppercase; color: var(--muted); }
.text-input {
  width: 100%; padding: .6rem .8rem; border-radius: 8px; border: 1px solid var(--line); background: var(--surface-2);
  font-family: var(--f-mono); font-size: .95rem;
}
.text-input:focus { outline: 2px solid var(--accent); outline-offset: 0; border-color: transparent; }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; background: var(--surface-2); }
.seg button { border: 0; background: transparent; padding: .4rem .7rem; cursor: pointer; font-family: var(--f-mono); font-size: .82rem; color: var(--muted); }
.seg button + button { border-left: 1px solid var(--line); }
.seg button.is-on { background: var(--accent); color: var(--bg); }
.err-msg { color: var(--err); font-size: var(--step--1); }
input[type="range"] { accent-color: var(--accent); width: 100%; }
.legend { display: flex; flex-wrap: wrap; gap: .4rem 1rem; font-size: .8rem; color: var(--muted); }
.legend span { display: inline-flex; gap: .4rem; align-items: center; }
.legend i { width: 11px; height: 11px; border-radius: 2px; display: inline-block; }

/* ---------- bits & codewords ---------- */
.bits { font-family: var(--f-mono); display: flex; flex-wrap: wrap; gap: .35rem; align-items: flex-end; }
.bitgrp { display: flex; flex-direction: column; align-items: center; gap: .15rem; animation: pop .35s both; animation-delay: calc(var(--i, 0) * 25ms); }
.bitgrp .lab { font-size: .72rem; color: var(--muted); white-space: pre; max-width: 12ch; overflow: hidden; text-overflow: ellipsis; }
.bitgrp .b { font-size: .82rem; padding: .15rem .35rem; border-radius: 4px; background: color-mix(in srgb, var(--c) 18%, transparent); color: var(--c); border: 1px solid color-mix(in srgb, var(--c) 45%, transparent); letter-spacing: .04em; }
@keyframes pop { from { opacity: 0; transform: translateY(6px) scale(.96); } to { opacity: 1; transform: none; } }
.seg-row { display: grid; grid-template-columns: 9rem minmax(0, 1fr); gap: .8rem; align-items: start; padding-block: .55rem; border-top: 1px dashed var(--line); }
.seg-row:first-child { border-top: 0; }
.seg-row .name { font-size: .82rem; }
.seg-row .name small { display: block; color: var(--muted); font-size: .72rem; font-family: var(--f-mono); }
@media (max-width: 560px) { .seg-row { grid-template-columns: minmax(0, 1fr); gap: .3rem; } }
.ribbon { font-family: var(--f-mono); font-size: .74rem; line-height: 1.8; word-break: break-all; letter-spacing: .03em; }
.ribbon span { transition: opacity .3s; }
.cwgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(3.3rem, 1fr)); gap: .35rem; }
.cw { font-family: var(--f-mono); border-radius: 6px; padding: .3rem .2rem; text-align: center; border: 1px solid color-mix(in srgb, var(--c) 50%, transparent); background: color-mix(in srgb, var(--c) 14%, transparent); animation: pop .4s both; animation-delay: calc(var(--i, 0) * 18ms); }
.cw b { display: block; font-size: .9rem; color: var(--fg); font-weight: 600; }
.cw small { display: block; font-size: .62rem; color: var(--muted); letter-spacing: .02em; }
.bar { height: 14px; border-radius: 4px; background: var(--surface-2); border: 1px solid var(--line); display: flex; overflow: hidden; }
.bar > i { display: block; height: 100%; transition: width .5s cubic-bezier(.2,.7,.2,1); }
.modebars { display: flex; flex-direction: column; gap: .55rem; }
.modebar { display: grid; grid-template-columns: 7.5rem minmax(0, 1fr) minmax(5.5rem, auto); gap: .6rem; align-items: center; font-size: .82rem; }
.modebar .v { font-family: var(--f-mono); text-align: right; white-space: nowrap; color: var(--muted); font-variant-numeric: tabular-nums; }
.modebar.off { opacity: .45; }
.modebar.on .name { color: var(--accent); font-weight: 600; }

/* ---------- error-correction intro ---------- */
.codes { display: flex; flex-direction: column; gap: .8rem; }
.code-row { display: grid; grid-template-columns: 8.5rem minmax(0, 1fr); gap: .8rem; align-items: center; }
@media (max-width: 560px) { .code-row { grid-template-columns: minmax(0, 1fr); gap: .3rem; } }
.cells { display: flex; flex-wrap: wrap; gap: 3px; }
.cell {
  width: 1.75rem; height: 1.75rem; border-radius: 4px; display: grid; place-items: center; font-family: var(--f-mono); font-size: .85rem;
  border: 1px solid var(--line); background: var(--surface-2); cursor: pointer; padding: 0; transition: background .2s, border-color .2s, transform .15s;
}
.cell.gap { margin-left: .5rem; }
.cell.par { border-color: color-mix(in srgb, var(--ec) 60%, transparent); color: var(--ec); }
.cell.flipped { background: color-mix(in srgb, var(--err) 25%, transparent); border-color: var(--err); color: var(--err); }
.cell.fixed { background: color-mix(in srgb, var(--ok) 22%, transparent); border-color: var(--ok); }
.cell.static { cursor: default; }
.cell:not(.static):hover { transform: translateY(-1px); border-color: var(--accent); }
.verdict { font-size: .8rem; font-family: var(--f-mono); }
.tabs { display: flex; gap: .4rem; flex-wrap: wrap; }

/* ---------- GF(256) ---------- */
.calc { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .8rem; }
@media (max-width: 560px) { .calc { grid-template-columns: minmax(0, 1fr); } }
.calc .out { font-family: var(--f-mono); font-size: .8rem; line-height: 1.7; white-space: pre; overflow-x: auto; background: var(--surface-2); border: 1px solid var(--line); border-radius: 6px; padding: .55rem .7rem; }
.num-in { width: 5.5rem; padding: .4rem .5rem; border-radius: 6px; border: 1px solid var(--line); background: var(--surface-2); font-family: var(--f-mono); }

/* ---------- RS division ---------- */
.tape { display: flex; flex-wrap: wrap; gap: 2px; }
.tape span { font-family: var(--f-mono); font-size: .68rem; min-width: 1.9rem; text-align: center; padding: .15rem 0; border-radius: 3px; background: color-mix(in srgb, var(--data) 15%, transparent); color: var(--fg); transition: opacity .25s, background .25s; }
.tape span.used { opacity: .3; }
.tape span.cur { background: var(--data); color: var(--bg); }
.tape span.ecz { background: color-mix(in srgb, var(--ec) 15%, transparent); }
.divgrid { display: grid; gap: 3px; font-family: var(--f-mono); font-size: .7rem; overflow-x: auto; padding-bottom: .2rem; }
.divgrid .r { display: grid; grid-template-columns: 7.2rem repeat(var(--n), minmax(1.75rem, 1fr)); gap: 2px; align-items: center; }
.divgrid .r > span { text-align: center; padding: .25rem 0; border-radius: 3px; background: var(--surface-2); }
.divgrid p { font-family: var(--f-body); }
.divgrid .r > span:first-child { text-align: left; background: transparent; color: var(--muted); font-family: var(--f-body); font-size: .74rem; }
.divgrid .lead { background: color-mix(in srgb, var(--data) 35%, transparent) !important; }
.divgrid .gen > span:not(:first-child) { background: color-mix(in srgb, var(--fn) 20%, transparent); }
.divgrid .res > span:not(:first-child) { background: color-mix(in srgb, var(--ec) 18%, transparent); }
.divgrid .res > span.zero { opacity: .35; }
.flash { animation: flash .5s; }
@keyframes flash { from { filter: brightness(1.8); } to { filter: none; } }

/* ---------- repair ---------- */
.toolbar { display: flex; flex-wrap: wrap; gap: .4rem; }
.blockbars { display: flex; flex-direction: column; gap: .45rem; }
.blockbar { display: grid; grid-template-columns: 4.2rem minmax(0, 1fr) 6.5rem; gap: .6rem; align-items: center; font-size: .78rem; font-family: var(--f-mono); }
.blockbar .meter { position: relative; height: 12px; background: var(--surface-2); border: 1px solid var(--line); border-radius: 3px; overflow: hidden; }
.blockbar .meter i { position: absolute; inset: 0 auto 0 0; background: var(--ok); transition: width .25s, background .25s; }
.blockbar.over .meter i { background: var(--err); }
.result { border-radius: 8px; padding: .7rem .8rem; font-family: var(--f-mono); font-size: .9rem; border: 1px solid var(--line); word-break: break-word; transition: background .25s, border-color .25s; }
.result.good { border-color: var(--ok); background: color-mix(in srgb, var(--ok) 12%, transparent); }
.result.bad { border-color: var(--err); background: color-mix(in srgb, var(--err) 12%, transparent); }
.result small { display: block; font-family: var(--f-body); color: var(--muted); font-size: .75rem; margin-bottom: .2rem; }
.mathlog { font-family: var(--f-mono); font-size: .72rem; line-height: 1.7; display: flex; flex-direction: column; gap: .5rem; }
.mathlog .k { color: var(--muted); }
.mathlog .chips { display: flex; flex-wrap: wrap; gap: 2px; }
.mathlog .chips span { padding: 0 .3rem; border-radius: 3px; background: var(--surface-2); }
.mathlog .chips span.nz { background: color-mix(in srgb, var(--err) 25%, transparent); color: var(--fg); }
.mathlog .chips span.fx { background: color-mix(in srgb, var(--ok) 25%, transparent); }
.mathlog .step { animation: pop .4s both; animation-delay: calc(var(--i, 0) * 140ms); }
.mathlog.still .step { animation: none; }

/* ---------- masks ---------- */
.maskgrid { display: grid; grid-template-columns: repeat(8, minmax(0, 1fr)); gap: .4rem; }
@media (max-width: 1100px) { .maskgrid { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.maskbtn { display: flex; flex-direction: column; gap: .3rem; align-items: stretch; padding: .45rem; border-radius: 8px; border: 1px solid var(--line); background: var(--surface-2); cursor: pointer; text-align: left; }
.maskbtn canvas { width: 100%; aspect-ratio: 1; border-radius: 3px; }
.maskbtn .t { font-family: var(--f-mono); font-size: .68rem; display: flex; flex-direction: column; gap: 0; line-height: 1.35; }
.maskbtn .t em { font-style: normal; color: var(--muted); font-variant-numeric: tabular-nums; }
.maskbtn.is-on { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.maskbtn.best .t b::after { content: " ★"; color: var(--ok); }
.penalty { display: grid; grid-template-columns: 4.5rem minmax(0, 1fr) 3rem; gap: .5rem; align-items: center; font-size: .75rem; font-family: var(--f-mono); }
.penalty .bar { height: 10px; }

/* ---------- format ---------- */
.binlines { font-family: var(--f-mono); font-size: .82rem; line-height: 1.6; white-space: pre; overflow-x: auto; background: var(--surface-2); border: 1px solid var(--line); border-radius: 6px; padding: .6rem .8rem; }
.binlines .ln { animation: pop .3s both; animation-delay: calc(var(--i, 0) * 90ms); }
.binlines .g { color: var(--fn); }
.binlines .x { color: var(--muted); }
.binlines .e { color: var(--ec); }
.binlines .d { color: var(--data); }
.fbits { display: flex; flex-wrap: wrap; gap: 3px; }
.fbits span { width: 1.6rem; text-align: center; font-family: var(--f-mono); font-size: .8rem; padding: .2rem 0; border-radius: 3px; background: var(--surface-2); border: 1px solid var(--line); cursor: default; }
.fbits span.d { border-color: var(--data); color: var(--data); }
.fbits span.e { border-color: var(--ec); color: var(--ec); }
.fbits span.hot { background: var(--accent); color: var(--bg); }

/* ---------- scanning ---------- */
.runs { display: flex; height: 26px; border-radius: 4px; overflow: hidden; border: 1px solid var(--line); }
.runs i { display: block; height: 100%; }
.found { font-family: var(--f-mono); font-size: .8rem; }
.hmat { font-family: var(--f-mono); font-size: .78rem; display: grid; grid-template-columns: repeat(3, auto); gap: .2rem 1rem; justify-content: start; font-variant-numeric: tabular-nums; }
.twocol { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem; }
@media (max-width: 640px) { .twocol { grid-template-columns: minmax(0, 1fr); } }

/* ---------- title & pipeline ---------- */
.title-h { font-size: var(--step-4); font-weight: 800; letter-spacing: -.025em; line-height: .98; }
.title-h em { font-style: normal; color: var(--accent); }
.toc { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .25rem 1.2rem; font-size: var(--step--1); max-width: 62ch; }
.toc a { color: var(--muted); text-decoration: none; display: flex; gap: .6rem; padding: .15rem 0; }
.toc a:hover { color: var(--fg); }
.toc a span { font-family: var(--f-mono); color: var(--accent); }
@media (max-width: 480px) { .toc { grid-template-columns: minmax(0, 1fr); } }

.pipeline { display: flex; flex-direction: column; gap: 1.2rem; }
.pipe { display: flex; flex-wrap: wrap; gap: .45rem; align-items: center; }
.pipe .lane { font-family: var(--f-mono); font-size: .7rem; text-transform: uppercase; letter-spacing: .12em; color: var(--muted); width: 100%; }
.chip {
  border: 1px solid var(--line); background: var(--surface); border-radius: 999px; padding: .35rem .8rem; font-size: .82rem; cursor: pointer;
  text-decoration: none; color: var(--fg); transition: border-color .2s, background .2s, transform .2s; animation: pop .4s both; animation-delay: calc(var(--i, 0) * 60ms);
}
.chip:hover { border-color: var(--accent); transform: translateY(-2px); }
.chip.c-data { border-color: color-mix(in srgb, var(--data) 60%, transparent); }
.chip.c-ec { border-color: color-mix(in srgb, var(--ec) 60%, transparent); }
.chip.c-fn { border-color: color-mix(in srgb, var(--fn) 60%, transparent); }
.chip.c-scan { border-color: color-mix(in srgb, var(--ok) 60%, transparent); }
.arrow { color: var(--muted); font-family: var(--f-mono); font-size: .8rem; }
.ideas { display: grid; grid-template-columns: repeat(auto-fit, minmax(16rem, 1fr)); gap: .8rem; }
.idea { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: .9rem 1rem; display: flex; flex-direction: column; gap: .4rem; }
.idea h3 { font-size: 1.05rem; font-weight: 650; }
.idea .pair { display: flex; gap: .4rem; flex-wrap: wrap; font-family: var(--f-mono); font-size: .68rem; text-transform: uppercase; letter-spacing: .08em; }
.idea .pair span { padding: .1rem .4rem; border-radius: 3px; background: var(--surface-2); color: var(--muted); }
.idea p { font-size: .86rem; color: var(--muted); }

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