/* Digital twins — booth exhibit
   Engine and visual language reused from the money exhibit: paper, ink and one
   orange accent; Archivo for display, Inter for reading, JetBrains Mono for labels. */

:root {
  --paper: #E8DFD3;
  --paper-2: #DFD4C4;
  --ink: #2A2827;
  --ink-soft: #4A4643;
  --orange: #F16B24;
  --display: 'Archivo', 'Arial Narrow', sans-serif;
  --sans: 'Inter', system-ui, sans-serif;
  --mono: 'JetBrains Mono', ui-monospace, monospace;
  --gutter: clamp(22px, 4.6vw, 64px);
  --head: 64px;
  --foot: 88px;
  --t-title: clamp(30px, min(8vw, 6.2vh), 66px);
  --t-body: clamp(15px, min(4.1vw, 2.2vh), 19px);
  --sp: clamp(12px, 2.4vh, 26px);
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; overscroll-behavior: none; }
body {
  font-family: var(--sans);
  background: var(--paper);
  color: var(--ink);
  /* Pinned to the window rather than sized with 100dvh: Chrome on iOS can
     measure dvh a few pixels taller than the visible area. */
  position: fixed;
  inset: 0;
  height: auto;
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
}
body[data-tone=orange] { background: var(--orange); }
body[data-tone=dark] { background: var(--ink); }
::selection { background: var(--ink); color: var(--paper); }
h1, h2, h3, p { margin: 0; }
button, a { -webkit-tap-highlight-color: transparent; color: inherit; }
button { font: inherit; cursor: pointer; border: 0; background: none; padding: 0; touch-action: manipulation; }
button:focus-visible, a:focus-visible, [tabindex]:focus-visible { outline: 2px solid currentColor; outline-offset: 4px; }
button:disabled { cursor: default; }

.eyebrow, .tag {
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: .12em;
  text-transform: uppercase;
  line-height: 1.4;
}

/* ---------- track & card tones ---------- */

#track {
  height: 100%;
  display: flex;
  overflow-x: auto;
  overflow-y: hidden;
  scroll-snap-type: x mandatory;
  scrollbar-width: none;
  overscroll-behavior-x: contain;
  outline: none;
}
#track::-webkit-scrollbar { display: none; }

.card {
  --bg: var(--paper);
  --fg: var(--ink);
  --soft: var(--ink-soft);
  --mute: rgba(42, 40, 39, .72);
  --rule: rgba(42, 40, 39, .18);
  --rule-strong: rgba(42, 40, 39, .45);
  --accent: var(--orange);
  --hl: var(--orange);
  --grid: rgba(42, 40, 39, .07);
  --logo-letters: var(--ink);
  --logo-bar: var(--orange);
  flex: 0 0 100%;
  height: 100%;
  scroll-snap-align: start;
  scroll-snap-stop: always;
  display: flex;
  flex-direction: column;
  padding: calc(var(--head) + env(safe-area-inset-top)) 0 calc(var(--foot) + env(safe-area-inset-bottom));
  background: var(--bg);
  color: var(--fg);
  /* Each card clips its own fixed header and footer. */
  position: relative;
  clip-path: inset(0);
}
.card.far { content-visibility: hidden; }
.card.orange {
  --bg: var(--orange);
  --soft: var(--ink);
  --mute: var(--ink);
  --rule: rgba(42, 40, 39, .28);
  --rule-strong: rgba(42, 40, 39, .6);
  --accent: var(--paper);
  --hl: var(--ink);
  --grid: rgba(42, 40, 39, .1);
  /* On orange the bar would vanish, so the mark goes single-colour ink. */
  --logo-bar: var(--ink);
}
.card.dark {
  --bg: var(--ink);
  --fg: var(--paper);
  --soft: rgba(232, 223, 211, .82);
  --mute: rgba(232, 223, 211, .66);
  --rule: rgba(232, 223, 211, .16);
  --rule-strong: rgba(232, 223, 211, .42);
  --grid: rgba(232, 223, 211, .06);
  --logo-letters: var(--paper);
}

/* ---------- header ---------- */

.topbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 2;
  height: calc(var(--head) + env(safe-area-inset-top));
  display: flex;
  align-items: center;
  gap: 14px;
  padding: env(safe-area-inset-top) var(--gutter) 0;
  background: var(--bg);
  border-bottom: 1px solid var(--rule);
}
.brand { display: block; line-height: 0; flex-shrink: 0; padding: 11px 0; }
.logo { height: 26px; width: auto; display: block; }
.logo .letters { fill: var(--logo-letters); }
.logo .bar { fill: var(--logo-bar); }
.brand-sep { width: 1px; height: 20px; background: var(--rule-strong); flex-shrink: 0; }
.brand-label { font-family: var(--mono); font-size: 10.5px; letter-spacing: .14em; text-transform: uppercase; color: var(--mute); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bar-actions { margin-left: auto; display: flex; gap: 6px; }
.bar-actions button {
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .08em;
  text-transform: uppercase;
  padding: 8px 14px;
  min-height: 44px;
  border: 1px solid var(--rule-strong);
  color: var(--fg);
  transition: background .12s, color .12s, border-color .12s;
}
.restart-btn span { font-size: 14px; margin-right: 4px; }

/* ---------- faces ---------- */

.inner {
  flex: 1;
  min-height: 0;
  position: relative;
  transform-style: preserve-3d;
  transform: perspective(2400px) rotateY(0deg);
  transition: transform .65s cubic-bezier(.2, .7, .15, 1);
}
.card.flipped .inner { transform: perspective(2400px) rotateY(180deg); }
.inner > .face {
  position: absolute;
  inset: 0;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  background: var(--bg);
  padding: clamp(14px, 2.6vh, 28px) var(--gutter) clamp(14px, 2.4vh, 26px);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.card:has(.back) .inner > .face { cursor: pointer; }
.front { transform: rotateY(0deg); }
.back { transform: rotateY(180deg); overflow-y: auto; overscroll-behavior: contain; }
/* iOS Safari can ignore backface-visibility, so the hidden face is also switched
   off once the turn passes edge-on. */
.front, .card.flipped .back { visibility: visible; transition: visibility 0s .15s; }
.back, .card.flipped .front { visibility: hidden; transition: visibility 0s .15s; }

.scene-meta {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 18px;
  color: var(--mute);
  flex-shrink: 0;
}
.scene-meta .eyebrow { color: var(--fg); }
.scene-meta .tag { white-space: nowrap; }

h2, h3 {
  font-family: var(--display);
  font-weight: 800;
  letter-spacing: -.03em;
  line-height: .95;
}
h2 em, h3 em { font-style: normal; color: var(--accent); }
.front h2, .back h2 { font-size: var(--t-title); max-width: 13em; text-wrap: balance; }
.sub, .back .detail {
  font-size: var(--t-body);
  line-height: 1.5;
  max-width: 34em;
  color: var(--soft);
  text-wrap: pretty;
}
.sub { margin-top: var(--sp); }

/* ---------- front layout: headline + controls, then the figure ---------- */

.layout { flex: 1; min-height: 0; display: flex; flex-direction: column; gap: var(--sp); margin-top: var(--sp); }
.copy { flex-shrink: 0; max-width: 760px; position: relative; z-index: 1; }
.controls { margin-top: var(--sp); }
.figure { flex: 1; min-height: 0; display: flex; align-items: center; justify-content: center; position: relative; }
.figure > svg { width: 100%; height: 100%; max-width: 620px; overflow: visible; }
/* A faint drafting grid behind the drawings, as on the money exhibit's stack cards. */
.figure.grid {
  background-image: linear-gradient(var(--grid) 1px, transparent 1px), linear-gradient(90deg, var(--grid) 1px, transparent 1px);
  background-size: 22px 22px;
  background-position: center;
  margin: 0 calc(-1 * var(--gutter)) calc(-1 * clamp(14px, 2.4vh, 26px));
  padding: clamp(8px, 2vh, 20px) var(--gutter);
  border-top: 1px solid var(--rule);
}
.art-figure > svg { max-width: 460px; }

@media (min-width: 900px) and (min-aspect-ratio: 5/4) {
  .layout { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 6fr); gap: 5vw; align-items: stretch; }
  .copy { align-self: center; }
  .figure.grid { margin: calc(-1 * var(--sp)) calc(-1 * var(--gutter)) calc(-1 * clamp(14px, 2.4vh, 26px)) 0; border-top: 0; border-left: 1px solid var(--rule); }
  .front.cover .layout { grid-template-columns: minmax(0, 7fr) minmax(0, 4fr); }
}

/* ---------- cover & model ---------- */

.front.cover h2 { font-weight: 900; font-size: clamp(44px, min(12vw, 9vh), 112px); line-height: .9; letter-spacing: -.04em; max-width: 11em; }
.front.cover .sub { color: var(--fg); max-width: 26em; }
.cover-strip {
  flex-shrink: 0;
  white-space: nowrap;
  margin-top: var(--sp);
  padding-top: 14px;
  border-top: 1px solid var(--rule-strong);
  display: flex;
  align-items: center;
  gap: 14px;
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: .12em;
  text-transform: uppercase;
}
.hazard { flex: 1; height: 10px; background: repeating-linear-gradient(-45deg, currentColor 0 3px, transparent 3px 8px); opacity: .7; }
.stamp {
  position: absolute;
  top: 8%;
  right: 4%;
  padding: 6px 10px;
  border: 1px solid var(--fg);
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: .12em;
  text-transform: uppercase;
  transform: rotate(-4deg);
  background: var(--bg);
}

/* ---------- axes: caption under the headline ---------- */

.stack-caption { display: flex; align-items: flex-end; gap: 16px; min-height: calc(var(--t-body) * 5); border-top: 1px solid var(--rule-strong); padding-top: 12px; max-width: 520px; }
.caption-text { flex: 1; min-width: 0; }
.caption-text .eyebrow { display: block; color: var(--mute); margin-bottom: 6px; }
.caption-text b { display: block; font-family: var(--display); font-weight: 800; font-size: calc(var(--t-body) * 1.3); letter-spacing: -.02em; line-height: 1.1; }
.caption-text p { font-size: var(--t-body); line-height: 1.45; color: var(--soft); margin-top: 4px; }
.caption-steps { display: flex; gap: 6px; }
.caption-steps button { width: 44px; height: 44px; border: 1px solid var(--rule-strong); font-family: var(--mono); font-size: 15px; background: var(--bg); }
.caption-steps button:disabled { opacity: .3; }

/* Plates lift when a lower plate is selected (driven by .on / .lifted from app.js). */
.twin-stack .plate { transition: transform .45s cubic-bezier(.2, .7, .15, 1); }
.twin-stack .plate.lifted { transform: translateY(var(--lift, -48px)); }
.card[data-id=axes] .twin-stack .plate { cursor: pointer; }
.twin-stack .plate:focus { outline: none; }
.twin-stack .plate:focus-visible .face, .twin-stack .plate:focus-visible .top { stroke: var(--accent); stroke-width: 3; }

/* ---------- spectrum: picker, object line, meters ---------- */

.picker { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; max-width: 560px; }
.pick > span:last-child { min-width: 0; overflow-wrap: anywhere; line-height: 1.2; }
.pick {
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .08em;
  text-transform: uppercase;
  min-height: 44px;
  padding: 0 14px;
  border: 1px solid var(--rule-strong);
  transition: background .15s, color .15s, border-color .15s;
}
.pick[aria-pressed=true] { background: var(--fg); color: var(--bg); border-color: var(--fg); }
.pick { display: flex; align-items: center; gap: 10px; padding: 4px 14px 4px 6px; text-align: left; }
.pick-art { width: 40px; height: 40px; flex: none; display: block; }
.pick-art .object-art { width: 100%; height: 100%; }
/* Selected tile inverts, so the drawing re-themes with it. */
.pick[aria-pressed=true] .object-art { --tw-line: var(--bg); --tw-face: var(--fg); --tw-shade-1: color-mix(in srgb, var(--bg) 20%, var(--fg)); --tw-shade-2: color-mix(in srgb, var(--bg) 35%, var(--fg)); }
.obj-line { display: flex; align-items: center; gap: 12px; min-height: 52px; margin-top: 12px; }
.obj-art { width: 48px; height: 48px; flex-shrink: 0; }
.obj-art:empty { display: none; }
.obj-art svg { width: 100%; height: 100%; display: block; }
.obj-line p { font-size: var(--t-body); line-height: 1.3; color: var(--soft); }
.obj-line b { color: var(--fg); font-family: var(--display); font-weight: 800; letter-spacing: -.01em; }

.gauges, .steppers { list-style: none; margin: 10px 0 0; padding: 0; max-width: 520px; border-top: 1px solid var(--rule-strong); }
.gauge, .stepper {
  display: grid;
  align-items: center;
  gap: 10px;
  padding: 6px 0;
  border-bottom: 1px solid var(--rule);
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: .06em;
  text-transform: uppercase;
}
.gauge { grid-template-columns: 18px minmax(0, 1fr) minmax(80px, 140px) 108px; }
.m-icon { display: block; width: 16px; height: 16px; color: var(--fg); }
.m-icon svg { width: 100%; height: 100%; display: block; fill: none; stroke: currentColor; stroke-width: 1.4; stroke-linecap: round; stroke-linejoin: round; }
.m-label { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.m-bar { display: grid; grid-template-columns: repeat(4, 1fr); gap: 3px; height: 10px; }
.m-bar i { background: var(--rule); transition: background-color .3s calc(var(--i, 0) * 70ms); }
.m-bar i:nth-child(2) { transition-delay: calc(var(--i, 0) * 70ms + 50ms); }
.m-bar i:nth-child(3) { transition-delay: calc(var(--i, 0) * 70ms + 100ms); }
.m-bar i:nth-child(4) { transition-delay: calc(var(--i, 0) * 70ms + 150ms); }
.m-bar i.f { background-color: var(--hl); }
[data-inferred="1"] .m-bar i.f { background-color: transparent; background-image: repeating-linear-gradient(-45deg, var(--hl) 0 2px, transparent 2px 5px); box-shadow: inset 0 0 0 1px var(--hl); }
.m-level { text-align: right; color: var(--fg); white-space: nowrap; }

/* ---------- photogenic: two stacks side by side ---------- */

.duo { display: grid; grid-template-columns: 1fr 1fr; gap: 4vw; width: 100%; height: 100%; }
.duo-item { margin: 0; display: flex; flex-direction: column; min-height: 0; align-items: center; }
.duo-item svg { flex: 1; min-height: 0; width: 100%; max-width: 300px; overflow: visible; }
.duo-item figcaption { text-align: center; margin-top: 10px; display: grid; gap: 4px; }
.duo-item b { font-family: var(--display); font-weight: 800; font-size: calc(var(--t-body) * 1.2); letter-spacing: -.02em; }
.duo-item span { font-family: var(--mono); font-size: 10.5px; letter-spacing: .08em; text-transform: uppercase; color: var(--mute); }
.legend { font-family: var(--mono); font-size: 10.5px; letter-spacing: .08em; text-transform: uppercase; color: var(--mute); line-height: 1.6; }

/* ---------- yours: steppers ---------- */

.stepper { grid-template-columns: 18px minmax(0, 1fr) 44px minmax(64px, 110px) 44px 92px; padding: 4px 0; }
.step-btn { width: 44px; height: 44px; border: 1px solid var(--rule-strong); font-family: var(--mono); font-size: 17px; background: var(--bg); }
.step-btn:disabled { opacity: .3; }
.score-foot { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin-top: 14px; max-width: 520px; }
.total { font-family: var(--mono); font-size: 11px; letter-spacing: .08em; text-transform: uppercase; }
.total b { font-family: var(--display); font-weight: 900; font-size: clamp(34px, 5.4vh, 56px); line-height: .9; letter-spacing: -.035em; margin: 0 4px 0 10px; vertical-align: -.18em; }
.score-foot { border-top: 6px solid transparent; border-image: repeating-linear-gradient(-45deg, currentColor 0 3px, transparent 3px 8px) 6; padding-top: 12px; }
.again-btn {
  font-family: var(--mono);
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: .08em;
  text-transform: uppercase;
  min-height: 44px;
  padding: 0 16px;
  background: var(--fg);
  color: var(--bg);
  border: 1px solid var(--fg);
}

/* ---------- back ---------- */

.back-copy { max-width: 920px; margin-top: var(--sp); }
.back h2 { margin-bottom: var(--sp); }
.takeaway {
  margin-top: clamp(18px, 3.4vh, 34px);
  padding: 4px 0 4px 18px;
  border-left: 4px solid var(--accent);
  max-width: 600px;
  font-family: var(--display);
  font-weight: 700;
  font-size: clamp(18px, min(5vw, 3vh), 26px);
  line-height: 1.2;
  letter-spacing: -.015em;
}
.card.orange .takeaway { border-left-color: var(--ink); }
.recap { list-style: none; margin: var(--sp) 0 0; padding: 0; max-width: 34em; border-top: 1px solid var(--rule-strong); }
.recap li { display: grid; grid-template-columns: 30px 1fr; gap: 10px; padding: 7px 0; border-bottom: 1px solid var(--rule); font-size: calc(var(--t-body) * .88); line-height: 1.4; color: var(--soft); }
.recap b { font-family: var(--mono); font-size: 10.5px; font-weight: 500; color: var(--mute); padding-top: .2em; }
.recap strong { color: var(--fg); font-weight: 600; }
@media (max-width: 799px) { .recap-text { display: none; } }
.notes .eyebrow { margin-top: var(--sp); color: var(--mute); }
.notes .recap { margin-top: 8px; }
.notes .recap li { grid-template-columns: 76px 1fr; }
.refs { margin-top: clamp(18px, 3.4vh, 34px); max-width: 600px; }
.refs .eyebrow { color: var(--mute); }
.refs ul { list-style: none; margin: 8px 0 0; padding: 0; border-top: 1px solid var(--rule-strong); }
.refs a {
  display: block;
  padding: 10px 0;
  border-bottom: 1px solid var(--rule);
  font-family: var(--mono);
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: .04em;
  line-height: 1.5;
  text-transform: uppercase;
  text-decoration: underline;
  text-decoration-color: var(--hl);
  text-decoration-thickness: 2px;
  text-underline-offset: 5px;
}
@media (min-width: 900px) {
  .recap { column-count: 2; column-gap: 40px; max-width: 920px; }
  .recap li { break-inside: avoid; }
  .notes .recap { column-count: 1; max-width: 600px; }
}

/* ---------- footer (one per card) ---------- */

.foot {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 2;
  height: calc(var(--foot) + env(safe-area-inset-bottom));
  padding: 0 var(--gutter) env(safe-area-inset-bottom);
  background: var(--bg);
  border-top: 1px solid var(--rule);
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 10px;
}
.navigation { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.navigation button {
  font-family: var(--mono);
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: .08em;
  text-transform: uppercase;
  min-height: 44px;
  min-width: 44px;
}
.navigation button:disabled { opacity: .25; }
.navigation .flip-btn { font-weight: 400; color: var(--mute); border: 1px solid var(--rule-strong); padding: 0 14px; }
span.flip-btn { visibility: hidden; }
.navigation .flip-btn[aria-pressed=true] { background: var(--fg); color: var(--bg); border-color: var(--fg); }
.navigation .next span, .navigation .prev span { color: var(--accent); }
.card.orange .navigation .next span, .card.orange .navigation .prev span { color: inherit; }
.timeline { display: flex; align-items: center; gap: 14px; font-family: var(--mono); font-size: 9.5px; letter-spacing: .1em; text-transform: uppercase; color: var(--mute); }
.timeline > span { white-space: nowrap; }
.rail { height: 6px; flex: 1; background: var(--rule); position: relative; overflow: hidden; }
.rail span { position: absolute; inset: 0 auto 0 0; background: var(--fg); }
.card:not(.orange) .rail span { background: var(--accent); }
.rail i { position: absolute; top: 0; bottom: 0; width: 2px; margin-left: -1px; background: var(--bg); }

/* ---------- people: the sub is the consent line ---------- */

.card[data-id=people] .sub { color: var(--fg); border-left: 4px solid var(--accent); padding: 2px 0 2px 12px; }

/* ---------- system: zoom levels (a telescope, not the axis stack) ---------- */

.card[data-id=system] .twin-stack .plate { cursor: pointer; }
.twin-stack.drill .face { fill-opacity: 1; stroke-opacity: 1; }
.twin-stack.drill .plate.on .face { fill: var(--tw-f2); }
.twin-stack.drill .motif .hl { fill: var(--tw-hl); }
.twin-stack.drill .dm { fill: var(--tw-rule); stroke: none; opacity: .55; }
.twin-stack.drill .dm.f { fill: var(--tw-sel); opacity: 1; }
.twin-stack.drill.narrow text { font-size: 12px; }
.gep { display: grid; grid-template-columns: auto 1fr; gap: 3px 12px; margin-top: 8px; font-size: calc(var(--t-body) * .92); line-height: 1.35; }
.gep:empty { display: none; }
.gep dt, .place dt { font-family: var(--mono); font-size: 10px; letter-spacing: .08em; text-transform: uppercase; color: var(--mute); padding-top: .25em; }
.gep dd, .place dd { margin: 0; color: var(--fg); }

/* ---------- people: archetype + two places ---------- */

.archetype { font-family: var(--display); font-weight: 800; font-size: calc(var(--t-body) * 1.15); letter-spacing: -.01em; margin-bottom: 10px; }
.places { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; max-width: 620px; }
.place { border-top: 1px solid var(--rule-strong); padding-top: 8px; min-width: 0; }
.place h3 { font-family: var(--mono); font-size: 11px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--accent); margin: 0 0 6px; }
.place dl { margin: 0; display: grid; gap: 2px; font-size: calc(var(--t-body) * .92); line-height: 1.35; }
.place dd + dt { margin-top: 6px; }


/* ---------- phones & narrow screens ---------- */

@media (max-width: 899px), (max-aspect-ratio: 5/4) {
  .card[data-id=spectrum] .sub, .card[data-id=axes] .sub { display: none; }
  .card[data-id=yours] .sub { margin-top: 8px; }
  .pick { min-height: 48px; padding: 2px 8px 2px 4px; gap: 6px; font-size: 10px; letter-spacing: .04em; }
  .pick-art { width: 34px; height: 34px; }
  .obj-art { display: none; }
  .cover-strip span:first-child { display: none; }
  .obj-line { min-height: 40px; margin-top: 8px; }
  .obj-art { width: 36px; height: 36px; }
  .gauge { padding: 4px 0; grid-template-columns: 16px minmax(0, 1fr) 90px 92px; gap: 8px; }
  .stepper { grid-template-columns: 16px minmax(0, 1fr) 44px 70px 44px; gap: 8px; padding: 3px 0; }
  .stepper .m-level { display: none; }
  .step-btn { width: 44px; height: 44px; }
  .stack-caption { min-height: 0; }
  .stack-caption:has(.gep:not(:empty)) { padding-top: 8px; }
  .stack-caption:has(.gep:not(:empty)) p { font-size: calc(var(--t-body) * .88); line-height: 1.3; margin-top: 2px; }
  .stack-caption:has(.gep:not(:empty)) .caption-text b { font-size: var(--t-body); }
  .gep { gap: 1px 10px; margin-top: 4px; font-size: calc(var(--t-body) * .85); line-height: 1.25; }
}
@media (max-width: 799px) {
  :root { --head: 56px; --foot: 84px; }
  .places { grid-template-columns: 1fr; gap: 10px; }
  .card[data-id=people] .figure { display: none; }
  .picker { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .brand-label, .brand-sep { display: none; }
  .logo { height: 22px; }
  .bar-actions button { padding: 6px 10px; font-size: 10.5px; min-height: 44px; }
  .navigation button { font-size: 10.5px; letter-spacing: .06em; }
  .navigation .flip-btn { padding: 0 10px; }
  .timeline { font-size: 9px; gap: 10px; }
  .gauge, .stepper { font-size: 10px; letter-spacing: .04em; }
}

/* Short screens: drop decoration before the story. */
@media (max-height: 640px) {
  :root { --head: 52px; --foot: 70px; }
  .foot { gap: 6px; }
  .navigation button { min-height: 44px; }
  .sub { display: none; }
}
@media (max-height: 480px) {
  :root { --head: 46px; --foot: 50px; }
  .scene-meta, .timeline, .cover-strip { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; scroll-behavior: auto !important; }
}

/* Hover only where a real pointer hovers, so taps don't leave buttons stuck dark. */
@media (hover: hover) {
  .bar-actions button:hover { background: var(--fg); color: var(--bg); border-color: var(--fg); }
  .caption-steps button:hover:not(:disabled) { background: var(--fg); color: var(--bg); }
  .pick:hover { border-color: var(--fg); }
  .step-btn:hover:not(:disabled) { background: var(--fg); color: var(--bg); }
  .again-btn:hover { background: transparent; color: var(--fg); }
}

/* ART CSS — from docs/DESIGN.md (## CSS for art). Re-paste if the design agent updates it. */
/* ---------- twin art (generated for art.js; paste into style.css) ---------- */

:root { --mint: #A6DDC4; }

.twin-stack, .object-art {
  --tw-line: var(--fg, #2A2827);
  --tw-face: var(--bg, #E8DFD3);
  --tw-mute: var(--mute, rgba(42, 40, 39, .72));
  --tw-rule: var(--rule-strong, rgba(42, 40, 39, .45));
  --tw-shade-1: color-mix(in srgb, var(--tw-line) 9%, var(--tw-face));
  --tw-shade-2: color-mix(in srgb, var(--tw-line) 20%, var(--tw-face));
  /* level ramp: face colour per level (1 = plain face) */
  --tw-f2: color-mix(in srgb, var(--orange, #F16B24) 28%, var(--tw-face));
  --tw-f3: color-mix(in srgb, var(--orange, #F16B24) 56%, var(--tw-face));
  --tw-lit: var(--orange, #F16B24);          /* level-4 face */
  --tw-lit-ink: var(--ink, #2A2827);         /* lines drawn on a level-4 face */
  --tw-hl: color-mix(in srgb, var(--orange, #F16B24) 30%, transparent);
  --tw-sel: var(--orange, #F16B24);          /* selection leader + focus */
  --tw-live: var(--mint, #A6DDC4);
  --tw-gloss: var(--paper, #E8DFD3);
  --tw-stroke: 1.5;
  --tw-ease: cubic-bezier(.2, .7, .15, 1);
  --tw-dur: .55s;
  --tw-stagger: 70ms;
}
.card.orange .twin-stack, .card.orange .object-art {
  --tw-f2: color-mix(in srgb, var(--paper, #E8DFD3) 45%, var(--tw-face));
  --tw-f3: color-mix(in srgb, var(--paper, #E8DFD3) 80%, var(--tw-face));
  --tw-lit: var(--ink, #2A2827);
  --tw-lit-ink: var(--orange, #F16B24);
  --tw-hl: color-mix(in srgb, var(--paper, #E8DFD3) 55%, transparent);
  --tw-sel: var(--ink, #2A2827);
}
.card.dark .twin-stack, .card.dark .object-art {
  --tw-shade-1: #34312F;
  --tw-shade-2: #403B38;
  --tw-f2: color-mix(in srgb, var(--orange, #F16B24) 28%, var(--tw-face));
  --tw-f3: color-mix(in srgb, var(--orange, #F16B24) 58%, var(--tw-face));
  --tw-gloss: rgba(232, 223, 211, .5);
}
/* Big booth screens: heavier lines so plates read from 2 m. */
@media (min-width: 1400px) and (min-height: 820px) {
  .twin-stack, .object-art { --tw-stroke: 2; }
}

/* ---------- stack ---------- */

.twin-stack { display: block; width: 100%; height: 100%; overflow: visible; }
.twin-stack * { vector-effect: non-scaling-stroke; }
.twin-stack .tw-hatch line { vector-effect: none; stroke: var(--tw-line); stroke-width: 1.3; }
.twin-stack .guide { stroke: var(--tw-rule); stroke-width: 1; stroke-dasharray: 4 4; }

.twin-stack .plate { --inf: 0; outline: none; cursor: pointer; transition: transform .45s var(--tw-ease); }
.twin-stack .plate[data-inferred="1"] { --inf: 1; }
.twin-stack.compact .plate { cursor: default; }
.twin-stack .plate.lifted { transform: translateY(var(--lift)); }

.twin-stack .plate :is(.face, .face-h, .ghost, .side, .motif *, .leader, .pip, .pip-h, .name, .lvl) {
  transition-property: fill, fill-opacity, stroke, stroke-opacity, stroke-width, opacity;
  transition-duration: var(--tw-dur);
  transition-timing-function: var(--tw-ease);
  transition-delay: calc(var(--i, 0) * var(--tw-stagger));
}

/* face: level 0 = dashed ghost, 1 = plain, 2-3 = tinted, 4 = lit */
.twin-stack .face { fill: var(--tw-face); fill-opacity: 0; stroke: var(--tw-line); stroke-opacity: 0; stroke-width: calc(var(--tw-stroke) * 1.2); stroke-linejoin: round; }
.twin-stack .plate:not([data-level="0"]) .face { fill-opacity: 1; stroke-opacity: 1; }
.twin-stack .plate[data-level="2"] .face { fill: var(--tw-f2); }
.twin-stack .plate[data-level="3"] .face { fill: var(--tw-f3); }
.twin-stack .plate[data-level="4"] .face { fill: var(--tw-lit); }
.twin-stack .ghost { fill: none; stroke: var(--tw-rule); stroke-width: var(--tw-stroke); stroke-dasharray: 5 4; opacity: 0; }
.twin-stack .plate[data-level="0"] .ghost { opacity: 1; }
.twin-stack .side { fill: var(--tw-shade-1); stroke: var(--tw-line); stroke-width: calc(var(--tw-stroke) * 1.2); stroke-linejoin: round; }
.twin-stack .side-r { fill: var(--tw-shade-2); }
.twin-stack .plate[data-level="0"] .side { opacity: 0; }
.twin-stack .plate[data-level="4"] .side-l { fill: color-mix(in srgb, var(--tw-lit) 78%, var(--ink, #2A2827)); }
.twin-stack .plate[data-level="4"] .side-r { fill: color-mix(in srgb, var(--tw-lit) 58%, var(--ink, #2A2827)); }
.card.orange .twin-stack .plate[data-level="4"] .side { fill: #4A4643; }
/* inferred = hatched face */
.twin-stack .face-h { stroke: none; opacity: calc(var(--inf) * .45); }
.twin-stack .plate[data-level="0"] .face-h { opacity: calc(var(--inf) * .25); }

/* motif */
.twin-stack .motif * { fill: none; stroke: var(--tw-line); stroke-width: var(--tw-stroke); stroke-linecap: round; stroke-linejoin: round; }
.twin-stack .motif .dash { stroke-dasharray: 3 3; }
.twin-stack .motif .hl { fill: var(--tw-hl); }
.twin-stack .motif .dot { fill: var(--tw-line); }
.twin-stack .motif .pulse { stroke-width: calc(var(--tw-stroke) * 1.5); }
.twin-stack .plate[data-level="0"] .motif > :not(.seg, .seg-h) { opacity: .22; }
.twin-stack .plate[data-level="4"] .motif > :not(.seg, .seg-h) { stroke: var(--tw-lit-ink); stroke-width: calc(var(--tw-stroke) * 1.4); }
.twin-stack .plate[data-level="4"] .motif .hl { fill: var(--tw-face); }
.twin-stack .plate[data-level="4"] .motif .dot { fill: var(--tw-lit-ink); }

/* meters (four segments on the plate face, four beside the label) */
.twin-stack .s1 { --s: 0; } .twin-stack .s2 { --s: 1; } .twin-stack .s3 { --s: 2; } .twin-stack .s4 { --s: 3; }
.twin-stack .plate:is([data-level="1"], [data-level="2"], [data-level="3"], [data-level="4"]) .s1,
.twin-stack .plate:is([data-level="2"], [data-level="3"], [data-level="4"]) .s2,
.twin-stack .plate:is([data-level="3"], [data-level="4"]) .s3,
.twin-stack .plate[data-level="4"] .s4 { --on: 1; }
.twin-stack .plate .motif .seg, .twin-stack .plate .meter .seg {
  fill: var(--tw-line); fill-opacity: calc(var(--on, 0) * (1 - var(--inf)));
  stroke: var(--tw-line); stroke-width: 1; stroke-opacity: .6;
  transition: fill-opacity var(--tw-dur) var(--tw-ease), stroke-opacity var(--tw-dur) var(--tw-ease), fill var(--tw-dur) var(--tw-ease);
  transition-delay: calc(var(--i, 0) * var(--tw-stagger) + var(--s, 0) * 60ms);
}
.twin-stack .plate .motif .seg-h, .twin-stack .plate .meter .seg-h {
  stroke: none; opacity: calc(var(--on, 0) * var(--inf));
  transition: opacity var(--tw-dur) var(--tw-ease);
  transition-delay: calc(var(--i, 0) * var(--tw-stagger) + var(--s, 0) * 60ms);
}
.twin-stack .plate[data-level="0"] .seg { stroke-opacity: .3; }
.twin-stack .plate[data-level="4"] .motif .seg { fill: var(--tw-lit-ink); stroke: var(--tw-lit-ink); }
.twin-stack .plate[data-level="4"] .meter .seg { fill: var(--tw-lit); stroke: var(--tw-line); stroke-opacity: 1; }

/* labels */
.twin-stack text { font-family: var(--mono); font-size: 11px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; fill: var(--tw-line); }
.twin-stack .num { fill: var(--tw-mute); font-weight: 500; }
.twin-stack .plate[data-level="0"] .name { fill: var(--tw-mute); }
.twin-stack .leader { fill: none; stroke: var(--tw-line); stroke-width: 1; }
.twin-stack .plate[data-level="0"] .leader { stroke: var(--tw-rule); stroke-dasharray: 3 3; }
.twin-stack .lvl { font-size: 9.5px; font-weight: 500; opacity: 0; }
.twin-stack .plate[data-level="0"][data-inferred="0"] .lvl[data-l="0"][data-inf="0"],
.twin-stack .plate[data-level="1"][data-inferred="0"] .lvl[data-l="1"][data-inf="0"],
.twin-stack .plate[data-level="2"][data-inferred="0"] .lvl[data-l="2"][data-inf="0"],
.twin-stack .plate[data-level="3"][data-inferred="0"] .lvl[data-l="3"][data-inf="0"],
.twin-stack .plate[data-level="4"][data-inferred="0"] .lvl[data-l="4"][data-inf="0"],
.twin-stack .plate[data-level="0"][data-inferred="1"] .lvl[data-l="0"][data-inf="1"],
.twin-stack .plate[data-level="1"][data-inferred="1"] .lvl[data-l="1"][data-inf="1"],
.twin-stack .plate[data-level="2"][data-inferred="1"] .lvl[data-l="2"][data-inf="1"],
.twin-stack .plate[data-level="3"][data-inferred="1"] .lvl[data-l="3"][data-inf="1"],
.twin-stack .plate[data-level="4"][data-inferred="1"] .lvl[data-l="4"][data-inf="1"] { opacity: 1; }
.twin-stack .plate[data-level="0"] .lvl { fill: var(--tw-mute); }
/* signal pip: mint = live, hatched = inferred, dashed ring = nothing */
.twin-stack .pip { fill: var(--tw-face); stroke: var(--tw-line); stroke-width: 1.2; }
.twin-stack .plate:not([data-level="0"])[data-inferred="0"] .pip { fill: var(--tw-live); }
.twin-stack .plate[data-level="0"] .pip { stroke: var(--tw-rule); stroke-dasharray: 2 2; }
.twin-stack .pip-h { stroke: none; opacity: var(--inf); }
.twin-stack .plate[data-level="0"] .pip-h { opacity: 0; }

/* selection + focus */
.twin-stack .plate.on .face { stroke-width: calc(var(--tw-stroke) * 2); }
.twin-stack .plate.on .leader { stroke: var(--tw-sel); stroke-width: 3; stroke-dasharray: none; }
.twin-stack .plate.on .name { font-weight: 800; }
.twin-stack .plate:focus-visible .face, .twin-stack .plate:focus-visible .ghost { stroke: var(--tw-sel); stroke-opacity: 1; stroke-width: 3; }

/* object riding on top of a (compact) stack */
.twin-stack .stack-object { overflow: visible; }

/* ---------- objects ---------- */

.object-art { display: block; width: 100%; height: 100%; overflow: visible; }
:is(.object-art, .stack-object) :is(path, rect) { fill: none; stroke: var(--tw-line); stroke-width: var(--tw-stroke); stroke-linejoin: round; stroke-linecap: round; vector-effect: non-scaling-stroke; }
:is(.object-art, .stack-object) .ft { fill: var(--tw-face); }
:is(.object-art, .stack-object) .fl { fill: var(--tw-shade-1); }
:is(.object-art, .stack-object) .fr { fill: var(--tw-shade-2); }
:is(.object-art, .stack-object) .detail { stroke-width: calc(var(--tw-stroke) * .65); }
:is(.object-art, .stack-object) .dash { stroke-dasharray: 3 3; }
:is(.object-art, .stack-object) .glass { fill: color-mix(in srgb, var(--tw-line) 12%, var(--tw-face)); }
:is(.object-art, .stack-object) .item { fill: var(--tw-face); stroke-width: calc(var(--tw-stroke) * .55); }
:is(.object-art, .stack-object) .item.hl { fill: var(--tw-lit); }
:is(.object-art, .stack-object) .screen, :is(.object-art, .stack-object) .door { fill: var(--tw-line); }
:is(.object-art, .stack-object) .win { fill: color-mix(in srgb, var(--tw-line) 16%, var(--tw-face)); stroke-width: calc(var(--tw-stroke) * .55); }
:is(.object-art, .stack-object) .roof.ft { fill: var(--tw-lit); }
:is(.object-art, .stack-object) .body { fill: var(--tw-face); stroke: none; }
:is(.object-art, .stack-object) .core.body { fill: var(--tw-shade-2); }
:is(.object-art, .stack-object) :is(.sil, .lip) { stroke-width: calc(var(--tw-stroke) * 1.25); }
:is(.object-art, .stack-object) .lip { fill: var(--tw-shade-1); }
:is(.object-art, .stack-object) .fan { fill: var(--tw-line); }
:is(.object-art, .stack-object) .blade { stroke: var(--tw-face); stroke-width: calc(var(--tw-stroke) * .7); }
:is(.object-art, .stack-object) .spinner { fill: var(--tw-lit); }
/* cover wireframe: the glossy render people picture */
:is(.object-art, .stack-object) .w { stroke-width: calc(var(--tw-stroke) * .7); }
:is(.object-art, .stack-object) .wb { stroke-width: .8; stroke-opacity: .3; stroke-dasharray: 2 3; }
:is(.object-art, .stack-object) .w.sil { stroke-width: calc(var(--tw-stroke) * 1.3); }
:is(.object-art, .stack-object) .w.thin { stroke-width: .7; stroke-opacity: .7; }
:is(.object-art, .stack-object) .w.hub { fill: var(--tw-line); }
:is(.object-art, .stack-object) .hi { stroke: var(--tw-gloss); stroke-width: calc(var(--tw-stroke) * 2.2); stroke-opacity: .85; }
:is(.object-art, .stack-object) .gloss { stroke: none; }
:is(.object-art, .stack-object) .tw-gloss .g0 { stop-color: var(--tw-gloss); stop-opacity: .75; }
:is(.object-art, .stack-object) .tw-gloss .g1 { stop-color: var(--tw-gloss); stop-opacity: .08; }
:is(.object-art, .stack-object) .tw-gloss .g2 { stop-color: var(--tw-line); stop-opacity: .22; }
:is(.object-art, .stack-object) .node { fill: var(--tw-face); stroke: var(--tw-line); stroke-width: 1.2; }
:is(.object-art, .stack-object) .dim { stroke-width: .8; stroke-opacity: .6; }
.card.orange :is(.object-art, .stack-object) .node { fill: var(--paper, #E8DFD3); }

/* ---------- axis icons ---------- */

.axis-icon { width: 1.4em; height: 1.4em; flex: none; vertical-align: -.3em; }

@media (prefers-reduced-motion: reduce) {
  .twin-stack *, .twin-stack .plate { transition: none !important; animation: none !important; }
}

/* Only the axes card's stack is tappable. */
.card:not([data-id=axes]) .twin-stack .plate { cursor: inherit; }

/* ---------- narration ---------- */

.bar-actions .listen-btn { display: flex; align-items: center; gap: 8px; min-width: 44px; justify-content: center; }
.listen-btn .i-play, .listen-btn .i-pause { font-size: 10px; letter-spacing: -.1em; color: var(--accent); }
.card.orange .listen-btn .i-play, .card.orange .listen-btn .i-pause { color: inherit; }
.listen-btn .i-pause, body.narrating .listen-btn .i-play { display: none; }
body.narrating .listen-btn .i-pause { display: inline; }
body.narrating .listen-btn { background: var(--fg); color: var(--bg); border-color: var(--fg); }
body.narrating .listen-btn .i-pause { color: var(--bg); animation: speaking 1.2s ease-in-out infinite; }
@keyframes speaking { 50% { opacity: .35; } }
.card.speaking-persona .places { outline: 2px solid var(--accent); outline-offset: 6px; }
@media (max-width: 799px) {
  .listen-btn .listen-label { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  body.narrating .listen-btn .i-pause { animation: none; }
}
