/* Vend · Stripe-confident on white, CreateOS-dark terminals, Vercel restraint.
 * One focal point per screen: the vending machine on /, the build log on /sell.
 * Figures: hand-inked isometric (own drawing, style after Colorfigures) + hairline line figures.
 */
:root {
  --color-paper: #ffffff;
  --color-paper-2: oklch(97.6% 0.004 270);
  --color-surface: #ffffff;
  --color-rule: oklch(92% 0.006 270);
  --color-rule-2: oklch(86% 0.01 270);
  --color-ink: oklch(19% 0.02 275);
  --color-ink-2: oklch(34% 0.018 272);
  --color-muted: oklch(50% 0.016 270);
  --color-faint: oklch(62% 0.012 270);
  --color-accent: oklch(55% 0.22 278);
  --color-accent-ink: #ffffff;
  --color-accent-soft: oklch(95% 0.03 278);
  --color-focus: oklch(55% 0.22 278);

  /* Money semantics: green = paid to seller, amber = refunded, red = blocked. Same meaning everywhere. */
  --color-paid: oklch(52% 0.13 155);
  --color-paid-soft: oklch(95% 0.04 155);
  --color-refund: oklch(56% 0.13 70);
  --color-refund-soft: oklch(95.5% 0.045 80);
  --color-blocked: oklch(54% 0.2 27);
  --color-blocked-soft: oklch(95% 0.035 25);

  --color-graphite: oklch(17% 0.012 270);
  --color-graphite-2: oklch(21% 0.014 270);
  --color-graphite-rule: oklch(29% 0.016 270);
  --color-graphite-ink: oklch(92% 0.008 270);
  --color-graphite-muted: oklch(64% 0.014 270);
  --color-log-ok: oklch(80% 0.14 155);
  --color-log-fail: oklch(74% 0.14 27);
  --color-log-lock: oklch(84% 0.12 85);
  --color-log-accent: oklch(76% 0.13 278);

  /* Ink figure palette (spot colours, flat fills) */
  --ink-line: oklch(18% 0.02 275);
  --ink-paper: #ffffff;
  --ink-solid: oklch(18% 0.02 275);
  --ink-on-solid: #ffffff;
  --ink-plate: oklch(97% 0.006 270);
  --ink-machine: oklch(60% 0.2 278);
  --ink-machine-side: oklch(46% 0.18 278);
  --ink-machine-top: oklch(74% 0.13 278);
  --ink-glass: oklch(95% 0.025 230);
  --ink-yellow: oklch(87% 0.15 90);
  --ink-coral: oklch(78% 0.11 30);
  --ink-cube: oklch(24% 0.014 270);
  --ink-cube-side: oklch(17% 0.012 270);
  --ink-cube-top: oklch(32% 0.016 270);

  --font-display: 'Geist', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', sans-serif;
  --font-body: 'Geist', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', sans-serif;
  --font-mono: 'Geist Mono', ui-monospace, 'SFMono-Regular', Menlo, monospace;

  --text-2xs: 0.6875rem;
  --text-xs: 0.75rem;
  --text-sm: 0.8125rem;
  --text-base: 0.9375rem;
  --text-md: 1.0625rem;
  --text-lg: 1.25rem;
  --text-xl: 1.75rem;
  --text-2xl: clamp(1.75rem, 1.3rem + 1.6vw, 2.5rem);
  --text-display: clamp(2.6rem, 1.5rem + 4.4vw, 4.6rem);

  --space-3xs: 0.25rem;
  --space-2xs: 0.5rem;
  --space-xs: 0.75rem;
  --space-sm: 1rem;
  --space-md: 1.5rem;
  --space-lg: 2rem;
  --space-xl: 3rem;
  --space-2xl: 4.5rem;
  --space-3xl: 7rem;
  --gutter: clamp(1rem, 0.5rem + 2vw, 2.5rem);

  --radius-sm: 4px;
  --radius: 6px;
  --radius-card: 12px;
  --radius-pill: 999px;
  --header-h: 56px;

  --ease-out: cubic-bezier(0.23, 1, 0.32, 1);
  --ease-in-out: cubic-bezier(0.77, 0, 0.175, 1);
  --dur-fast: 140ms;
  --dur: 220ms;
  --dur-slow: 600ms;
  --ring: 0 0 0 1px var(--color-rule);
  --shadow-card: var(--ring), 0 1px 2px oklch(20% 0.02 275 / 0.04), 0 8px 24px -12px oklch(20% 0.02 275 / 0.12);
  --shadow-float: 0 0 0 1px oklch(20% 0.02 275 / 0.06), 0 2px 4px oklch(20% 0.02 275 / 0.04), 0 24px 48px -16px oklch(30% 0.12 278 / 0.25);
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme='light']) {
    --color-paper: oklch(14% 0.008 270);
    --color-paper-2: oklch(18% 0.01 270);
    --color-surface: oklch(17% 0.01 270);
    --color-rule: oklch(26% 0.012 270);
    --color-rule-2: oklch(34% 0.014 270);
    --color-ink: oklch(96% 0.004 270);
    --color-ink-2: oklch(84% 0.008 270);
    --color-muted: oklch(68% 0.012 270);
    --color-faint: oklch(56% 0.012 270);
    --color-accent: oklch(70% 0.16 278);
    --color-accent-ink: oklch(14% 0.02 278);
    --color-accent-soft: oklch(27% 0.07 278);
    --color-focus: oklch(74% 0.15 278);
    --color-paid: oklch(76% 0.14 155);
    --color-paid-soft: oklch(27% 0.05 155);
    --color-refund: oklch(80% 0.13 78);
    --color-refund-soft: oklch(28% 0.05 75);
    --color-blocked: oklch(72% 0.16 27);
    --color-blocked-soft: oklch(28% 0.07 25);
    --color-graphite: oklch(11% 0.008 270);
    --color-graphite-2: oklch(15% 0.01 270);
    --color-graphite-rule: oklch(24% 0.012 270);
    --ink-line: oklch(92% 0.01 270);
    --ink-paper: oklch(22% 0.012 270);
    --ink-solid: oklch(9% 0.006 270);
    --ink-plate: oklch(17% 0.01 270);
    --ink-machine: oklch(50% 0.17 278);
    --ink-machine-side: oklch(38% 0.14 278);
    --ink-machine-top: oklch(62% 0.13 278);
    --ink-glass: oklch(28% 0.03 240);
    --ink-yellow: oklch(78% 0.14 88);
    --ink-coral: oklch(66% 0.11 30);
    --ink-cube: oklch(12% 0.008 270);
    --ink-cube-side: oklch(9% 0.006 270);
    --ink-cube-top: oklch(19% 0.01 270);
    --shadow-card: var(--ring), 0 8px 24px -12px oklch(0% 0 0 / 0.6);
    --shadow-float: 0 0 0 1px oklch(100% 0 0 / 0.06), 0 24px 48px -16px oklch(0% 0 0 / 0.7);
    color-scheme: dark;
  }
}

*, *::before, *::after { box-sizing: border-box; }
html, body { overflow-x: clip; }
html { -webkit-text-size-adjust: 100%; -webkit-tap-highlight-color: transparent; }
body {
  margin: 0;
  background: var(--color-paper);
  color: var(--color-ink-2);
  font: 400 var(--text-base)/1.6 var(--font-body);
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3 { color: var(--color-ink); font-family: var(--font-display); font-weight: 600; margin: 0; line-height: 1.1; letter-spacing: -0.03em; text-wrap: balance; }
a { color: inherit; }
code, pre, .mono { font-family: var(--font-mono); }
:focus-visible { outline: 2px solid var(--color-focus); outline-offset: 2px; border-radius: var(--radius-sm); }
.wrap { max-width: 1200px; margin-inline: auto; padding-inline: var(--gutter); }
.label { font: 500 var(--text-2xs)/1 var(--font-mono); letter-spacing: 0.06em; text-transform: uppercase; color: var(--color-muted); }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
button, a, [role='button'] { touch-action: manipulation; }
button, .btn { user-select: none; -webkit-user-select: none; }

/* Header */
.site-header { position: sticky; top: 0; z-index: 10; height: var(--header-h); box-shadow: 0 1px 0 var(--color-rule); background: color-mix(in oklch, var(--color-paper) 86%, transparent); backdrop-filter: saturate(1.4) blur(10px); }
.site-header .wrap { height: 100%; display: flex; align-items: center; justify-content: space-between; gap: var(--space-sm); }
.brand { display: inline-flex; align-items: center; gap: var(--space-2xs); font: 600 var(--text-md)/1 var(--font-display); color: var(--color-ink); text-decoration: none; letter-spacing: -0.02em; white-space: nowrap; }
.brand-mark { width: 22px; height: 22px; border-radius: 6px; background: var(--color-ink); color: var(--color-paper); display: grid; place-items: center; font: 700 var(--text-2xs)/1 var(--font-mono); }
.site-nav { display: flex; align-items: center; gap: var(--space-xs); }
.nav-link { position: relative; color: var(--color-muted); text-decoration: none; font-size: var(--text-sm); padding: var(--space-2xs) var(--space-3xs); white-space: nowrap; transition: color var(--dur-fast) ease; }
.nav-link[aria-current='page'] { color: var(--color-ink); }

/* Buttons: one solid primary per view */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: var(--space-2xs); min-height: 40px; padding: 0 var(--space-sm); border-radius: var(--radius); border: 0; box-shadow: 0 0 0 1px var(--color-rule-2), 0 1px 2px oklch(20% 0.02 275 / 0.06); background: var(--color-surface); color: var(--color-ink); font: 500 var(--text-sm)/1 var(--font-body); text-decoration: none; white-space: nowrap; cursor: pointer; transition: background-color var(--dur-fast) ease, box-shadow var(--dur-fast) ease, transform 160ms var(--ease-out); }
.btn:active { transform: scale(0.97); }
.btn[disabled] { opacity: 0.55; cursor: not-allowed; transform: none; }
.btn-primary { background: var(--color-accent); color: var(--color-accent-ink); box-shadow: 0 0 0 1px var(--color-accent), 0 1px 2px oklch(30% 0.15 278 / 0.3), inset 0 1px 0 oklch(100% 0 0 / 0.18); }
.btn-sm { min-height: 32px; padding: 0 var(--space-xs); font-size: var(--text-xs); }
.btn-lg { min-height: 46px; padding: 0 var(--space-md); font-size: var(--text-base); font-weight: 600; }
.btn-ghost { box-shadow: none; background: transparent; color: var(--color-muted); }
.btn-evil { color: var(--color-blocked); }
.text-link { color: var(--color-ink); font-weight: 500; text-decoration: underline; text-decoration-color: var(--color-rule-2); text-underline-offset: 4px; transition: text-decoration-color var(--dur-fast) ease; }

@media (hover: hover) and (pointer: fine) {
  .nav-link:hover { color: var(--color-ink); }
  .btn:hover { box-shadow: 0 0 0 1px var(--color-ink-2), 0 1px 2px oklch(20% 0.02 275 / 0.08); }
  .btn-primary:hover { background: color-mix(in oklch, var(--color-accent) 90%, var(--color-ink)); box-shadow: 0 0 0 1px var(--color-accent), 0 4px 12px -2px oklch(45% 0.2 278 / 0.45); }
  .btn-ghost:hover { color: var(--color-ink); box-shadow: 0 0 0 1px var(--color-rule-2); }
  .text-link:hover { text-decoration-color: var(--color-accent); }
  .snippet:hover { box-shadow: 0 0 0 1px var(--color-rule-2); }
  input:hover, textarea:hover { border-color: var(--color-muted); }
  .vm:hover { cursor: pointer; }
}

/* ───────── Landing · hero: copy left, Fig. 00 machine right ───────── */
.hero { position: relative; isolation: isolate; overflow: hidden; }
/* One restrained Stripe-style wash behind the hero, skewed, never behind text contrast */
.hero::before { content: ''; position: absolute; inset: -40% -10% 30% 35%; z-index: -1; background: radial-gradient(40% 50% at 30% 40%, oklch(80% 0.12 278 / 0.35), transparent 70%), radial-gradient(35% 40% at 70% 30%, oklch(85% 0.1 200 / 0.3), transparent 70%), radial-gradient(30% 35% at 60% 75%, oklch(88% 0.1 60 / 0.3), transparent 70%); transform: skewY(-8deg); }
.hero-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.05fr); gap: var(--space-xl); align-items: start; padding-block: var(--space-2xl) var(--space-xl); }
.eyebrow { display: inline-flex; align-items: center; gap: var(--space-2xs); margin: 0 0 var(--space-md); font: 500 var(--text-xs)/1 var(--font-mono); color: var(--color-muted); padding: 7px 10px; border-radius: var(--radius-pill); background: var(--color-surface); box-shadow: var(--ring); }
.hero h1 { font-size: var(--text-display); line-height: 0.98; letter-spacing: -0.045em; max-width: 12ch; }
.lede { font-size: var(--text-md); color: var(--color-ink-2); max-width: 44ch; margin: var(--space-md) 0 var(--space-lg); }
.lede strong { color: var(--color-ink); font-weight: 600; }
.hero-actions { display: flex; flex-wrap: wrap; gap: var(--space-xs); }
.hero-hint { margin: var(--space-sm) 0 0; font-size: var(--text-sm); color: var(--color-muted); max-width: 46ch; }
.hero-fig { margin: 0; display: grid; gap: var(--space-xs); }
.hero-fig figcaption, .fig-cap { font-size: var(--text-sm); color: var(--color-muted); max-width: 52ch; }
.fig-no { font: 500 var(--text-xs)/1 var(--font-mono); color: var(--color-ink); letter-spacing: 0.02em; margin-right: 0.35em; }
.fig-hint { color: var(--color-accent); }
.live-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--color-paid); box-shadow: 0 0 0 3px var(--color-paid-soft); flex: none; }

/* Fig. 00 · the vending machine (inline SVG; all colours from tokens so dark mode is free) */
.vm { width: 100%; height: auto; display: block; overflow: visible; }
.vm polygon, .vm rect, .vm ellipse, .vm path, .vm circle, .vm line { stroke: var(--ink-line); stroke-width: 1.4; stroke-linejoin: round; stroke-linecap: round; }
.vm text { font-family: var(--font-mono); stroke: none; fill: var(--ink-line); }
.vm .plate { fill: var(--ink-plate); stroke-width: 1; stroke-dasharray: 2 5; }
.vm .shadow { fill: var(--ink-line); opacity: 0.08; stroke: none; }
.vm .m-l { fill: var(--ink-machine); } .vm .m-r { fill: var(--ink-machine-side); } .vm .m-t { fill: var(--ink-machine-top); }
.vm .cap-l, .vm .cap-r, .vm .cap-t { fill: var(--ink-solid); }
.vm .cube-l { fill: var(--ink-cube); } .vm .cube-r { fill: var(--ink-cube-side); } .vm .cube-t { fill: var(--ink-cube-top); }
.vm .bot-l, .vm .bot-t { fill: var(--ink-paper); } .vm .bot-r { fill: var(--ink-plate); }
.vm .band { fill: var(--ink-solid); }
.vm .t-brand { fill: var(--ink-on-solid); font: 700 12px/1 var(--font-display); letter-spacing: 0.12em; }
.vm .t-mini { fill: var(--ink-on-solid); font-size: 5.5px; opacity: 0.8; }
.vm .glass { fill: var(--ink-glass); }
.vm .glare { stroke: var(--ink-paper); stroke-width: 2.5; opacity: 0.7; }
.vm .shelf { stroke-width: 1.6; }
.vm .it-a { fill: var(--ink-yellow); } .vm .it-b { fill: var(--ink-paper); } .vm .it-c { fill: var(--ink-coral); }
.vm .bar { fill: var(--color-paid); stroke-width: 0.8; }
.vm .hair, .vm .hair-ink { stroke-width: 0.8; fill: none; }
.vm .hair { opacity: 0.55; }
.vm .t-tag { font-size: 5.6px; text-anchor: middle; fill: var(--ink-line); }
.vm .t-402 { font: 700 8px/1 var(--font-mono); fill: var(--ink-on-solid); }
.vm .slot-plate { fill: var(--ink-solid); } .vm .slot { stroke: var(--ink-yellow); stroke-width: 2.4; }
.vm .key { fill: var(--ink-paper); stroke-width: 0.8; }
.vm .paper { fill: var(--ink-paper); }
.vm .t-paid { font-size: 5px; fill: var(--color-paid); font-weight: 600; }
.vm .tray { fill: var(--ink-solid); } .vm .flap { stroke: var(--ink-machine-top); }
.vm .sticker { fill: var(--ink-yellow); } .vm .lock { fill: var(--ink-yellow); }
.vm .shackle, .vm .shackle-s { fill: none; stroke-width: 2.6; }
.vm .cube-l + g .shackle, .vm .shackle { stroke: var(--ink-yellow); }
.vm .ink-dot { fill: var(--ink-line); } .vm .t-cube { fill: var(--ink-yellow); font-size: 8px; }
.vm .cable { fill: none; stroke-width: 2; stroke-dasharray: 4 3; }
.vm .eye { fill: var(--ink-machine); } .vm .ink { fill: none; } .vm .arm { stroke-width: 3; fill: none; }
.vm .coin-face { fill: var(--ink-yellow); } .vm .t-coin { font-size: 8px; font-weight: 700; }
.vm .t-earn { font: 600 15px/1 var(--font-mono); fill: var(--color-paid); opacity: 0; }
.vm .note { font-size: 10px; fill: var(--color-muted); }
.vm .note-line { stroke: var(--color-faint); stroke-width: 1; fill: none; }
.vm .coin, .vm .vend-item, .vm .receipt, .vm .t-earn, .vm .t-402 { transform-box: fill-box; }
.vm .receipt { transform-origin: top; transform: scaleY(0); }
.vm.is-vending .coin { animation: coin-in 800ms var(--ease-in-out) both; }
.vm.is-vending .t-402 { animation: flash-paid 1600ms 700ms both; }
.vm.is-vending .vend-item { animation: drop 520ms 1200ms cubic-bezier(0.5, 0, 0.75, 0) both; }
.vm.is-vending .receipt { animation: print 700ms 1700ms var(--ease-out) both; }
.vm.is-vending .t-earn { animation: earn 1400ms 2000ms var(--ease-out) both; }
.vm.is-blocked .coin { animation: coin-in 800ms var(--ease-in-out) both; }
.vm.is-blocked .cube-l, .vm.is-blocked .cube-r { animation: alarm 900ms 800ms 2 both; }
@keyframes coin-in { 0% { transform: none; } 55% { transform: translate(calc(var(--cx) * 0.55), calc(var(--cy) - 46px)); } 90% { transform: translate(var(--cx), var(--cy)) scale(0.9); opacity: 1; } 100% { transform: translate(var(--cx), var(--cy)) scale(0.6); opacity: 0; } }
@keyframes flash-paid { 0%, 100% { fill: var(--ink-on-solid); } 10%, 70% { fill: var(--ink-yellow); } }
@keyframes drop { to { transform: translateY(126px); } }
@keyframes print { to { transform: scaleY(1); } }
@keyframes earn { 0% { opacity: 0; transform: translateY(8px); } 25% { opacity: 1; } 80% { opacity: 1; } 100% { opacity: 0; transform: translateY(-14px); } }
@keyframes alarm { 50% { fill: var(--color-blocked); } }

/* Try-it panel: steps land one by one, never a blank spinner */
.try-panel { margin-top: var(--space-md); padding: var(--space-sm); border-radius: var(--radius-card); background: var(--color-surface); box-shadow: var(--shadow-card); display: grid; gap: var(--space-xs); }
.try-panel[hidden] { display: none; }
.try-steps { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; font: 400 var(--text-xs)/1.4 var(--font-mono); }
.try-step { display: grid; grid-template-columns: 10px minmax(0, 1fr) auto; gap: var(--space-2xs); align-items: center; color: var(--color-ink-2); overflow-wrap: anywhere; animation: line-in var(--dur) var(--ease-out); }
.try-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--color-faint); }
.try-step[data-kind='active'] .try-dot { background: var(--color-accent); animation: pulse 1s var(--ease-in-out) infinite; }
.try-step[data-kind='402'] .try-dot { background: var(--color-refund); }
.try-step[data-kind='paid'] .try-dot, .try-step[data-kind='ok'] .try-dot { background: var(--color-paid); }
.try-step[data-kind='ok'] { color: var(--color-paid); font-weight: 500; }
.try-step[data-kind='blocked'], .try-step[data-kind='failed'] { color: var(--color-blocked); }
.try-step[data-kind='blocked'] .try-dot, .try-step[data-kind='failed'] .try-dot { background: var(--color-blocked); }
.try-clock { color: var(--color-faint); font-variant-numeric: tabular-nums; }
.try-img { width: 100%; max-width: 480px; height: auto; border-radius: var(--radius); background: #fff; box-shadow: var(--ring); animation: line-in var(--dur-slow) var(--ease-out); }
.try-out { margin: 0; font: 400 var(--text-xs)/1.5 var(--font-mono); color: var(--color-ink-2); white-space: pre-wrap; overflow-wrap: anywhere; max-height: 14rem; overflow: auto; }
.try-out.is-blocked { color: var(--color-accent-ink); background: var(--color-blocked); padding: var(--space-2xs) var(--space-xs); border-radius: var(--radius); font-weight: 600; }
.try-out.is-failed { color: var(--color-refund); }

/* Live totals as one ledger line */
.tally { box-shadow: 0 -1px 0 var(--color-rule), 0 1px 0 var(--color-rule); background: var(--color-paper-2); }
.tally .wrap { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--space-xs) var(--space-xl); padding-block: var(--space-sm); }
.tally dl { margin: 0; display: flex; flex-wrap: wrap; gap: var(--space-2xs) var(--space-xl); align-items: baseline; }
.tally div { display: flex; align-items: baseline; gap: var(--space-2xs); }
.tally dt { font-size: var(--text-sm); color: var(--color-muted); order: 2; }
.tally dd { margin: 0; font: 600 var(--text-lg)/1 var(--font-display); color: var(--color-ink); font-variant-numeric: tabular-nums; letter-spacing: -0.02em; }
.tally .is-paid dd { color: var(--color-paid); }
.tally .is-blocked dd:not([data-value='0']) { color: var(--color-blocked); }
.sse-state { font: 500 var(--text-xs)/1 var(--font-mono); color: var(--color-refund); }
.sse-state:empty { display: none; }

/* Figures · Fig. 01–04 */
.figs { padding-block: var(--space-2xl); }
.figs h2 { font-size: var(--text-2xl); max-width: 22ch; margin-bottom: var(--space-xl); }
.fig-list { list-style: none; margin: 0 0 var(--space-xl); padding: 0; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: var(--space-md); }
.fig-card { display: grid; align-content: start; gap: var(--space-sm); }
.hl { aspect-ratio: 5 / 4; border-radius: var(--radius-card); background: var(--color-surface); box-shadow: var(--shadow-card); overflow: hidden; --hairline-plate: var(--color-surface); }
.fig-cap { margin: 0; }
.fig-cap b { color: var(--color-ink); font-weight: 600; }

.agent-view { display: grid; grid-template-columns: minmax(0, 0.8fr) minmax(0, 1.2fr); gap: var(--space-xl); align-items: center; }
.agent-view h3 { font-size: var(--text-xl); margin-bottom: var(--space-xs); }
.agent-view p { margin: 0; color: var(--color-muted); max-width: 40ch; }
.exchange { margin: 0; background: var(--color-graphite); color: var(--color-graphite-ink); border-radius: var(--radius-card); box-shadow: var(--shadow-float); font: 400 var(--text-sm)/1.65 var(--font-mono); overflow: hidden; }
.exchange figcaption { display: flex; justify-content: space-between; gap: var(--space-sm); padding: var(--space-xs) var(--space-sm); box-shadow: 0 1px 0 var(--color-graphite-rule); color: var(--color-graphite-muted); font-size: var(--text-xs); }
.exchange ol { list-style: none; margin: 0; padding: var(--space-sm); display: grid; gap: var(--space-xs); }
.exchange li { display: grid; grid-template-columns: 2.25rem minmax(0, 1fr); gap: var(--space-2xs); overflow-wrap: anywhere; }
.exchange .who, .exchange .dim { color: var(--color-graphite-muted); }
.exchange .k { color: var(--color-log-accent); }
.exchange .ok { color: var(--color-log-ok); }
.exchange .warn { color: var(--color-log-lock); }

/* Live tools · rows with try buttons and copyable buyer snippets */
.tools-section { padding-block: var(--space-xl) 0; }
.section-head { display: grid; gap: var(--space-2xs); margin-bottom: var(--space-md); }
.section-head h2 { font-size: var(--text-xl); }
.section-head p { margin: 0; color: var(--color-muted); font-size: var(--text-sm); }
.tools { display: grid; gap: var(--space-sm); }
.tool { display: grid; grid-template-columns: minmax(0, 16rem) minmax(0, 1fr); gap: var(--space-md); padding: var(--space-md) 0; box-shadow: 0 -1px 0 var(--color-rule); }
.tool-head { display: grid; align-content: start; gap: var(--space-2xs); }
.tool-name { font: 600 var(--text-md)/1.3 var(--font-mono); color: var(--color-ink); overflow-wrap: anywhere; letter-spacing: -0.01em; }
.price { justify-self: start; font: 600 var(--text-xs)/1 var(--font-mono); color: var(--color-accent); background: var(--color-accent-soft); padding: 5px 8px; border-radius: var(--radius-sm); white-space: nowrap; }
.tool-desc { color: var(--color-muted); font-size: var(--text-sm); margin: 0; overflow-wrap: anywhere; }
.tool-try { display: flex; flex-wrap: wrap; gap: var(--space-2xs); margin-top: var(--space-2xs); }
.tool .try-panel { margin-top: 0; }
.snippets { display: grid; gap: var(--space-2xs); min-width: 0; }
.snippet { display: grid; grid-template-columns: 3.5rem minmax(0, 1fr) auto; gap: var(--space-xs); align-items: start; background: var(--color-paper-2); box-shadow: 0 0 0 1px var(--color-rule); border-radius: var(--radius); padding: var(--space-2xs) var(--space-2xs) var(--space-2xs) var(--space-xs); transition: box-shadow var(--dur-fast) ease; }
.snippet-label { font: 500 var(--text-2xs)/32px var(--font-mono); color: var(--color-faint); text-transform: uppercase; letter-spacing: 0.06em; }
.snippet code { display: block; white-space: pre-wrap; overflow-wrap: anywhere; line-height: 1.65; padding-block: 6px; font-size: var(--text-xs); color: var(--color-ink); min-width: 0; }
.btn.is-copied { color: var(--color-paid); }
.show-all { justify-self: start; }
.snippet-box { display: grid; gap: var(--space-2xs); }
.snippet-box > summary { cursor: pointer; font-size: var(--text-sm); color: var(--color-muted); padding-block: var(--space-3xs); width: fit-content; }
.snippet-box[open] > summary { margin-bottom: var(--space-2xs); color: var(--color-ink); }
.empty { box-shadow: inset 0 0 0 1px var(--color-rule-2); border-radius: var(--radius-card); padding: var(--space-lg); color: var(--color-muted); }
.empty a { color: var(--color-accent); }
.skeleton { height: 112px; border-radius: var(--radius-card); background: var(--color-paper-2); animation: breathe 1.6s var(--ease-in-out) infinite alternate; }
@keyframes breathe { from { opacity: 0.55; } to { opacity: 1; } }

.site-footer { margin-top: var(--space-3xl); box-shadow: 0 -1px 0 var(--color-rule); padding-block: var(--space-md) var(--space-xl); color: var(--color-faint); font-size: var(--text-sm); }
.site-footer p { margin: 0; }
.site-footer .credits { margin-top: var(--space-3xs); font-size: var(--text-xs); }

/* ───────── /sell · Workbench: form │ build log │ earnings, one screen at 1440×900 ───────── */
.bench { display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--space-sm); padding-block: var(--space-sm) var(--space-xl); }
.panel { background: var(--color-surface); box-shadow: var(--shadow-card); border-radius: var(--radius-card); display: flex; flex-direction: column; min-width: 0; min-height: 0; }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: var(--space-xs); padding: 0 var(--space-sm); box-shadow: 0 1px 0 var(--color-rule); height: 52px; flex: none; position: relative; z-index: 1; }
.panel-head h2 { font-size: var(--text-md); letter-spacing: -0.015em; }
.panel-body { padding: var(--space-sm); min-height: 0; }

.field { display: grid; align-content: start; gap: var(--space-3xs); margin-bottom: var(--space-sm); }
.field label { font-size: var(--text-sm); font-weight: 500; color: var(--color-ink); }
.field .hint { font-size: var(--text-xs); color: var(--color-faint); }
.row-2 { display: grid; grid-template-columns: minmax(0, 1fr) 7.5rem; gap: var(--space-xs); }
input, textarea { width: 100%; font: 400 var(--text-sm)/1.4 var(--font-body); color: var(--color-ink); background: var(--color-paper); border: 1px solid var(--color-rule-2); border-radius: var(--radius); padding: 9px 11px; transition: border-color var(--dur-fast) var(--ease-out), box-shadow var(--dur-fast) var(--ease-out); }
input::placeholder, textarea::placeholder { color: var(--color-faint); }
input:focus-visible, textarea:focus-visible { outline: none; border-color: var(--color-accent); box-shadow: 0 0 0 3px var(--color-accent-soft); }
input[aria-invalid='true'] { border-color: var(--color-blocked); }
textarea.code { font: 400 var(--text-xs)/1.6 var(--font-mono); min-height: 16rem; resize: vertical; tab-size: 4; }
.form-foot { display: flex; align-items: center; justify-content: space-between; gap: var(--space-xs); flex-wrap: wrap; padding-top: var(--space-2xs); }
.form-msg { flex: 1 1 9rem; min-width: 0; font-size: var(--text-sm); color: var(--color-muted); min-height: 1.4em; }
.form-foot .vend-btn { flex: none; margin-left: auto; }
.form-msg.error { color: var(--color-blocked); }
.form-msg.ok { color: var(--color-paid); }

/* Interaction 1 · "Vend it" press: compress on press, sweep while submitting, settle on success */
.vend-btn { position: relative; overflow: hidden; min-width: 8.5rem; min-height: 44px; font-size: var(--text-base); font-weight: 600; isolation: isolate; }
.vend-btn .vend-label { transition: opacity var(--dur-fast) var(--ease-out); }
.vend-btn::before { content: ''; position: absolute; inset: 0; z-index: -1; background: linear-gradient(90deg, transparent, color-mix(in oklch, var(--color-accent-ink) 26%, transparent), transparent); transform: translateX(-100%); }
.vend-btn[data-state='loading'] { cursor: progress; opacity: 1; }
.vend-btn[data-state='loading']::before { animation: sweep 1.1s var(--ease-in-out) infinite; }
.vend-btn[data-state='building'] { background: var(--color-ink); border-color: var(--color-ink); color: var(--color-paper); opacity: 1; cursor: progress; }
.vend-btn[data-state='success'] { background: var(--color-paid); border-color: var(--color-paid); color: var(--color-accent-ink); }
.vend-btn[data-state='error'] { background: var(--color-blocked); border-color: var(--color-blocked); color: var(--color-accent-ink); }
@keyframes sweep { to { transform: translateX(100%); } }

/* Interaction 2 · step player above the build log */
.steps { list-style: none; margin: 0; padding: var(--space-xs) var(--space-sm); display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: var(--space-3xs); border-bottom: 1px solid var(--color-rule); counter-reset: none; }
.step { display: grid; justify-items: center; gap: 6px; font: 500 var(--text-2xs)/1.2 var(--font-mono); color: var(--color-faint); text-align: center; position: relative; }
.step::before, .step::after { content: ''; position: absolute; top: 11px; left: calc(-50% + 14px); right: calc(50% + 14px); height: 2px; background: var(--color-rule); }
/* The connector fills left→right as a step completes */
.step::after { background: var(--color-paid); transform: scaleX(0); transform-origin: left; transition: transform 300ms var(--ease-out); }
.step:not([data-state='pending']):not([data-state='fail'])::after { transform: scaleX(1); }
.step:first-child::before, .step:first-child::after { display: none; }
.step .pip { width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; border: 1.5px solid var(--color-rule-2); background: var(--color-surface); color: var(--color-faint); font-size: var(--text-2xs); position: relative; z-index: 1; transition: background-color var(--dur) var(--ease-out), border-color var(--dur) var(--ease-out), color var(--dur) var(--ease-out), transform var(--dur) var(--ease-out); }
.step[data-state='active'] { color: var(--color-ink); }
.step[data-state='active'] .pip { border-color: var(--color-accent); color: var(--color-accent); animation: pulse 1.2s var(--ease-in-out) infinite; }
.step[data-state='done'] { color: var(--color-ink-2); }
.step[data-state='done'] .pip { background: var(--color-paid); border-color: var(--color-paid); color: var(--color-accent-ink); }
.step[data-state='fail'] { color: var(--color-blocked); }
.step[data-state='fail'] .pip { background: var(--color-blocked); border-color: var(--color-blocked); color: var(--color-accent-ink); }
.step[data-state='skip'] { color: var(--color-faint); text-decoration: line-through; }
.step[data-state='skip'] .pip { border-style: dashed; }
.step[data-state='live'] { color: var(--color-paid); font-weight: 600; }
.step[data-state='live'] .pip { background: var(--color-paid); border-color: var(--color-paid); color: var(--color-accent-ink); transform: scale(1.15); }
@keyframes pulse { 50% { transform: scale(1.12); } }

.build-now { margin: 0; padding: var(--space-xs) var(--space-sm); font-size: var(--text-sm); color: var(--color-ink); box-shadow: 0 1px 0 var(--color-rule); min-height: 2.9rem; }
.build-now.is-caught { color: var(--color-refund); }
.build-now.is-live { color: var(--color-paid); font-weight: 500; }
.build-now.is-fail { color: var(--color-blocked); }
.log-line.caught { color: var(--color-log-lock); }
.log { flex: 1; margin: 0; background: var(--color-graphite); color: var(--color-graphite-ink); font: 400 var(--text-xs)/1.75 var(--font-mono); padding: var(--space-sm); min-height: 16rem; overflow: auto; overscroll-behavior: contain; border-radius: 0 0 var(--radius-card) var(--radius-card); }
.log-line { display: grid; grid-template-columns: 4.75rem minmax(0, 1fr); white-space: pre-wrap; overflow-wrap: anywhere; animation: line-in var(--dur) var(--ease-out); }
.log-line .t { color: var(--color-graphite-muted); }
.log-line.ok { color: var(--color-log-ok); }
.log-line.fail { color: var(--color-log-fail); }
.log-line.lock { color: var(--color-log-lock); }
.log-line.live { color: var(--color-log-ok); font-weight: 600; }
.log-line.muted { color: var(--color-graphite-muted); }
@keyframes line-in { from { opacity: 0; transform: translateY(3px); } }

.status-pill { font: 500 var(--text-2xs)/1 var(--font-mono); letter-spacing: 0.06em; text-transform: uppercase; padding: 6px 8px; border-radius: var(--radius-sm); background: var(--color-paper-2); color: var(--color-muted); white-space: nowrap; }
.status-pill.running { color: var(--color-accent); background: var(--color-accent-soft); }
.status-pill.ok { color: var(--color-paid); background: var(--color-paid-soft); }
.status-pill.fail { color: var(--color-blocked); background: var(--color-blocked-soft); }

/* Interaction 3 · earnings tick: the seller number rolls up, a +delta floats off it */
.earn-hero { display: grid; gap: var(--space-3xs); padding-bottom: var(--space-sm); box-shadow: 0 1px 0 var(--color-rule); position: relative; container-type: inline-size; }
.earn-hero strong { justify-self: start; font: 600 clamp(2.25rem, 1.6rem + 1.6vw, 3rem)/1 var(--font-display); color: var(--color-ink); letter-spacing: -0.035em; font-variant-numeric: tabular-nums; transition: color var(--dur-slow) var(--ease-out); }
.earn-hero strong[data-long='true'] { font-size: clamp(1.5rem, 11cqi, 2.25rem); }
.earn-hero strong.tick { color: var(--color-paid); transition-duration: 0ms; }
.earn-hero .delta { position: absolute; left: 0; top: 1.25rem; font: 600 var(--text-sm)/1 var(--font-mono); color: var(--color-paid); pointer-events: none; animation: float-off 1.2s var(--ease-out) forwards; }
@keyframes float-off { from { opacity: 0; transform: translate(var(--dx, 7rem), 6px); } 20% { opacity: 1; } to { opacity: 0; transform: translate(var(--dx, 7rem), -22px); } }
.earn-sub { display: flex; flex-wrap: wrap; gap: var(--space-3xs) var(--space-sm); font-size: var(--text-sm); color: var(--color-muted); }
.earn-sub b { color: var(--color-ink); font-weight: 600; font-variant-numeric: tabular-nums; }
.earn-sub .refund b:not([data-value='0']) { color: var(--color-refund); }
.earn-sub .blocked b:not([data-value='0']) { color: var(--color-blocked); }

.ledger-wrap { flex: 1; overflow: auto; overscroll-behavior: contain; min-height: 0; margin-top: var(--space-xs); }
.ledger { width: 100%; border-collapse: collapse; font-size: var(--text-sm); }
.ledger th { position: sticky; top: 0; background: var(--color-surface); text-align: left; font: 500 var(--text-2xs)/1 var(--font-mono); letter-spacing: 0.06em; text-transform: uppercase; color: var(--color-faint); padding: var(--space-2xs) var(--space-2xs) var(--space-2xs) 0; }
.ledger td { padding: var(--space-2xs) var(--space-2xs) var(--space-2xs) 0; border-top: 1px solid var(--color-rule); vertical-align: top; }
.ledger td.num, .ledger th.num { text-align: right; padding-right: 0; font-family: var(--font-mono); font-size: var(--text-xs); font-variant-numeric: tabular-nums; white-space: nowrap; }
.ledger td.num .sub { color: var(--color-faint); }
.ledger tr.row-in { animation: line-in var(--dur) var(--ease-out); }
.ledger tr[data-kind='paid'] td.num { color: var(--color-paid); }
.ledger tr[data-kind='refunded'] td.num { color: var(--color-refund); }
.ledger tr[data-kind='blocked'] td { background: var(--color-blocked-soft); }
.ledger tr[data-kind='blocked'] td:first-child { padding-left: var(--space-2xs); border-radius: var(--radius) 0 0 var(--radius); }
.ledger tr[data-kind='blocked'] td:last-child { padding-right: var(--space-2xs); border-radius: 0 var(--radius) var(--radius) 0; }
.ledger tr[data-kind='blocked'] td.num { color: var(--color-blocked); }
.ledger .tool-id { color: var(--color-ink-2); margin-top: var(--space-3xs); }
.ledger .sub { display: block; color: var(--color-faint); font: 400 var(--text-xs)/1.4 var(--font-mono); margin-top: 2px; overflow-wrap: anywhere; }
.ledger .empty-row td { color: var(--color-faint); border-top: 0; padding-top: var(--space-sm); }
.badge { display: inline-flex; align-items: center; gap: 5px; font: 600 var(--text-2xs)/1 var(--font-mono); letter-spacing: 0.04em; text-transform: uppercase; padding: 5px 7px; border-radius: var(--radius-sm); white-space: nowrap; }
.badge.paid { color: var(--color-paid); background: var(--color-paid-soft); }
.badge.refunded { color: var(--color-refund); background: var(--color-refund-soft); }
.badge.blocked { color: var(--color-accent-ink); background: var(--color-blocked); }
.badge.failed { color: var(--color-muted); background: var(--color-paper-2); }

@media (min-width: 820px) {
  .bench { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .form-panel { grid-column: 1 / -1; }
  .form-panel form { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); gap: 0 var(--space-md); }
  .form-panel .field-code { grid-row: span 4; }
}
/* The demo screen: three columns, fixed to the viewport so log and earnings never scroll off */
@media (min-width: 1180px) and (min-height: 700px) {
  .bench { grid-template-columns: minmax(0, 0.95fr) minmax(0, 1.15fr) minmax(0, 0.9fr); height: calc(100dvh - var(--header-h)); padding-block: var(--space-sm); }
  .form-panel { grid-column: auto; overflow: auto; }
  .form-panel form { display: block; }
  .bench .panel { min-height: 0; }
  textarea.code { min-height: 0; height: clamp(8rem, 100dvh - 37rem, 22rem); }
  .earn-panel .panel-body { display: flex; flex-direction: column; flex: 1; }
  .log { min-height: 0; }
}

@media (max-width: 960px) {
  .hero-grid { grid-template-columns: minmax(0, 1fr); gap: var(--space-lg); padding-block: var(--space-xl) var(--space-lg); }
  .fig-list { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .agent-view { grid-template-columns: minmax(0, 1fr); gap: var(--space-md); }
  .tool { grid-template-columns: minmax(0, 1fr); gap: var(--space-sm); }
}
@media (max-width: 560px) {
  .nav-link.hide-sm { display: none; }
  .row-2 { grid-template-columns: minmax(0, 1fr); }
  .snippet { grid-template-columns: minmax(0, 1fr) auto; }
  .snippet-label { grid-column: 1 / -1; line-height: 1.4; }
  .steps { grid-template-columns: repeat(4, minmax(0, 1fr)); row-gap: var(--space-xs); }
  .step::before, .step::after { display: none; }
  .vm .vm-notes { display: none; }
  .tally dl { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--space-xs) var(--space-md); width: 100%; }
  .fig-list { gap: var(--space-sm); }
  .hero-actions .btn { flex: 1 1 auto; }
  .log-line { grid-template-columns: minmax(0, 1fr); }
  .log-line .t { font-size: var(--text-2xs); }
}

/* iOS zooms into inputs under 16px */
@media (pointer: coarse) {
  input, textarea { font-size: 16px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 1ms !important; animation-delay: 0ms !important; animation-iteration-count: 1 !important; transition-duration: 1ms !important; }
  .vm .coin { opacity: 0; }
  .earn-hero .delta { display: none; }
}
