/* Future Forge — styles.css
 * One responsive layout: phone at 360px, laptop, and a 43-inch display read from eight feet.
 * Type and the big meter scale with the viewport; controls never shrink below touch size.
 * v1.1: the instrument — local fonts, a machined substrate, the map, choreographed moments.
 */


:root {
  --green-900: #062b21;
  --green-800: #0b3d2e;
  --green-700: #135240;
  --green-600: #1c6a52;
  --green-500: #2a8a6b;
  --gold: #f5b400;
  --gold-dark: #b98700;
  --ink: #f4f7f5;
  --muted: #c3d6cd;
  --dim: #8fb0a3;
  --class-a: #7cc4ff;      /* Pile A: sky blue, marker ● */
  --class-b: #f5b400;      /* Pile B: gold, marker ■ */
  --unsure: #e9e4ff;
  --alert: #ff9e80;
  --focus: #ffd866;
  --radius: 18px;
  --radius-sm: 10px;
  --fs-base: clamp(16px, 0.55vw + 12px, 24px);
  --fs-small: clamp(14px, 0.4vw + 11px, 19px);
  --fs-h1: clamp(28px, 3.6vw + 8px, 78px);
  --fs-h2: clamp(22px, 2vw + 8px, 44px);
  --fs-hero: clamp(34px, 5.2vw + 6px, 112px);
  --fs-meter: clamp(40px, 4.5vw, 88px);
  --fs-card-number: clamp(72px, 14vw, 260px);
  --gutter: clamp(16px, 2.5vw, 48px);
  --control-h: clamp(52px, 4vw + 20px, 84px);
  --font-body: "Inter", -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-display: "Space Grotesk", "Inter", -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  --ease: cubic-bezier(0.2, 0.7, 0.2, 1);
}

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

:root { color-scheme: dark; }
html { background: var(--green-900); color: var(--ink); font-size: var(--fs-base); -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font-body);
  line-height: 1.35;
  background:
    radial-gradient(120vw 80vh at 50% -20vh, rgba(16,73,58,0.9) 0%, rgba(6,43,33,0) 60%),
    linear-gradient(rgba(255,255,255,0.028) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,0.028) 1px, transparent 1px),
    var(--green-900);
  background-size: auto, 44px 44px, 44px 44px, auto;
  background-attachment: fixed;
  display: flex;
  flex-direction: column;
}

[hidden] { display: none !important; }

.sr-only {
  position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}

a { color: var(--gold); }
p { margin: 0 0 0.75em; }
h1, h2, h3 { margin: 0 0 0.4em; line-height: 1.08; letter-spacing: -0.015em; font-family: var(--font-display); }
h1 { font-size: var(--fs-h1); font-weight: 700; }
h2 { font-size: var(--fs-h2); font-weight: 700; }
h3 { font-size: 1.1em; font-weight: 700; }
h1.medium { font-size: clamp(24px, 2.6vw + 6px, 58px); }
h1:focus, h2:focus { outline: none; }
/* Lab screens keep the heading modest so the camera, chart and controls stay above the fold on a 1080p display. */
.screen:has(.lab) h1, .screen:has(.datalab) h1 { font-size: clamp(24px, 2.2vw + 6px, 52px); margin-bottom: 0.25em; }
.screen:has(.lab) .lead, .screen:has(.datalab) .lead { font-size: 1.05em; max-width: 60ch; margin-bottom: 0.5em; }
.screen:has(.lab), .screen:has(.datalab) { padding-top: clamp(12px, 2vh, 24px); padding-bottom: clamp(12px, 2vh, 24px); }
.screen:has(.lab) .actions, .screen:has(.datalab) .actions { margin-top: 8px; }
.class-panel .btn { min-height: clamp(52px, 3.2vw + 16px, 68px); }
.datalab .small, .lab .small { margin-bottom: 0; }
.lead { font-size: 1.15em; color: var(--muted); max-width: 40ch; }
.small { font-size: var(--fs-small); color: var(--muted); }
.gold { color: var(--gold); }
.kbd { display: inline-block; font: inherit; font-size: 0.8em; padding: 0 0.45em; border: 1px solid var(--dim); border-radius: 6px; color: var(--muted); margin-left: 0.4em; vertical-align: middle; }
.btn .kbd { color: inherit; border-color: currentColor; opacity: 0.85; }
.no-hints .kbd { display: none; }
@media (max-width: 700px), (hover: none) { .kbd { display: none; } }

/* ---------- Header ---------- */
.topbar {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 10px var(--gutter);
  border-bottom: 1px solid rgba(255,255,255,0.08);
}
.brand { display: flex; align-items: baseline; gap: 10px; min-width: 0; }
.brand-mark {
  font-weight: 900; letter-spacing: 0.06em; font-size: 0.95em; color: var(--gold);
  border: 2px dashed var(--gold-dark); border-radius: 6px; padding: 2px 8px; white-space: nowrap;
}
.brand-name { font-family: var(--font-display); font-weight: 700; letter-spacing: 0.04em; white-space: nowrap; }
.brand-sub { color: var(--muted); font-size: var(--fs-small); white-space: nowrap; }
@media (max-width: 640px) {
  .brand { flex-wrap: wrap; gap: 2px 8px; }
  .brand-sub { display: none; }
  .brand-mark { font-size: 0.72em; padding: 1px 6px; }
  .brand-name { font-size: 0.9em; }
  .topbar { padding: 8px 12px; }
}

.steps { display: flex; gap: 6px; list-style: none; margin: 0; padding: 0; flex-wrap: wrap; justify-content: center; }
.steps li {
  font-family: var(--font-display); font-size: var(--fs-small); font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--dim); padding: 4px 10px; border-radius: 999px; border: 1px solid transparent;
}
.steps li[aria-current="step"] { color: var(--green-900); background: var(--gold); border-color: var(--gold); }
.steps li.done { color: var(--muted); border-color: var(--green-600); }
@media (max-width: 900px) { .steps { display: none; } }

/* ---------- Layout ---------- */
main { flex: 1; display: flex; flex-direction: column; }
.screen {
  flex: 1; display: flex; flex-direction: column;
  padding: clamp(14px, 3vh, 40px) var(--gutter) clamp(20px, 4vh, 60px);
  max-width: 1720px; width: 100%; margin: 0 auto;
}
.screen.center { align-items: center; text-align: center; justify-content: center; }
.screen.center .lead { margin-left: auto; margin-right: auto; }
.stack { display: flex; flex-direction: column; gap: clamp(10px, 1.6vh, 22px); }
.row { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; }
.row.end { justify-content: flex-end; }
.row.between { justify-content: space-between; }
.grow { flex: 1; }
.actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: clamp(12px, 2vh, 28px); align-items: center; }
.actions.center { justify-content: center; }
.spacer { flex: 1; }

/* ---------- Buttons ---------- */
.btn {
  appearance: none; font: inherit; font-family: var(--font-display); font-weight: 700; cursor: pointer;
  min-height: var(--control-h); padding: 0 clamp(18px, 2vw, 34px);
  border-radius: var(--radius); border: 2px solid transparent;
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  text-decoration: none; line-height: 1.15; text-align: center;
  transition: transform 120ms ease, background-color 120ms ease, border-color 120ms ease;
  touch-action: manipulation; user-select: none;
}
.btn:active { transform: translateY(1px) scale(0.99); }
.btn:disabled { opacity: 0.45; cursor: not-allowed; transform: none; }
.btn-primary { background: var(--gold); color: var(--green-900); }
.btn-primary:hover:not(:disabled) { background: #ffc633; }
.btn-secondary { background: transparent; color: var(--ink); border-color: rgba(255,255,255,0.45); }
.btn-secondary:hover:not(:disabled) { border-color: var(--ink); background: rgba(255,255,255,0.06); }
.btn-quiet { background: transparent; color: var(--muted); border-color: transparent; min-height: 44px; padding: 0 14px; }
.btn-quiet:hover:not(:disabled) { color: var(--ink); background: rgba(255,255,255,0.06); }
.btn-big { font-size: 1.35em; min-height: calc(var(--control-h) * 1.25); padding: 0 clamp(26px, 3vw, 56px); border-radius: 999px; }
.btn-huge { font-size: clamp(22px, 2.4vw + 6px, 54px); min-height: calc(var(--control-h) * 1.5); padding: 0 clamp(30px, 4vw, 80px); border-radius: 999px; }
.btn-a { background: var(--class-a); color: var(--green-900); }
.btn-a:hover:not(:disabled) { background: #a3d6ff; }
.btn-b { background: var(--class-b); color: var(--green-900); }
.btn-b:hover:not(:disabled) { background: #ffc633; }
.btn-danger { background: var(--alert); color: var(--green-900); }
.btn-block { width: 100%; }

:focus-visible { outline: 3px solid var(--focus); outline-offset: 3px; border-radius: 6px; }
.btn:focus-visible { outline-offset: 4px; }

/* ---------- Choice grids ---------- */
.choice-grid {
  display: grid; gap: clamp(10px, 1.4vw, 22px); width: 100%;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 280px), 1fr));
}
.choice {
  appearance: none; font: inherit; color: var(--ink); text-align: left; cursor: pointer;
  background: var(--green-700); border: 2px solid var(--green-600); border-radius: var(--radius);
  padding: clamp(16px, 1.8vw, 30px); min-height: calc(var(--control-h) * 1.4);
  display: flex; flex-direction: column; gap: 6px; justify-content: center;
  transition: border-color 120ms ease, background-color 120ms ease, transform 120ms ease;
}
.choice:hover { border-color: var(--gold); background: #17604b; }
.choice:active { transform: scale(0.99); }
.choice[aria-pressed="true"] { border-color: var(--gold); box-shadow: inset 0 0 0 2px var(--gold); }
.choice .choice-title { font-weight: 800; font-size: 1.25em; }
.choice .choice-sub { color: var(--muted); font-size: var(--fs-small); }
.choice.two { min-height: calc(var(--control-h) * 2.2); }
.choice .choice-title .icon { margin-right: 8px; }

/* ---------- Cards / panels ---------- */
.panel {
  background: var(--green-700); border: 1px solid var(--green-600); border-radius: var(--radius);
  padding: clamp(14px, 1.6vw, 26px);
}
.panel.quiet { background: rgba(255,255,255,0.04); }
.callout { border-left: 6px solid var(--gold); padding-left: 14px; }
.privacy { display: flex; gap: 10px; align-items: flex-start; font-size: var(--fs-small); color: var(--muted); }
.privacy .icon { flex: none; }

/* ---------- Vision lab ---------- */
.lab { display: grid; gap: clamp(12px, 1.5vw, 28px); grid-template-columns: 1fr; align-items: start; }
@media (min-width: 900px) { .lab { grid-template-columns: minmax(280px, 42%) 1fr; } }
.cam-wrap {
  position: relative; width: 100%; aspect-ratio: 1 / 1; max-height: 58vh; margin: 0 auto;
  background: #000; border-radius: var(--radius); overflow: hidden; border: 2px solid var(--green-600);
}
.cam-wrap video { width: 100%; height: 100%; object-fit: cover; display: block; background: #000; }
.cam-wrap .cam-off {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; text-align: center;
  padding: 20px; color: var(--muted); background: var(--green-800);
}
.cam-wrap .cam-frame { position: absolute; inset: 10%; border: 3px dashed rgba(255,255,255,0.35); border-radius: 12px; pointer-events: none; }
.cam-wrap .cam-tag { position: absolute; left: 10px; bottom: 10px; background: rgba(0,0,0,0.6); color: #fff; padding: 4px 10px; border-radius: 8px; font-size: var(--fs-small); }
.cam-wrap.flash::after { content: ""; position: absolute; inset: 0; background: #fff; opacity: 0.6; animation: flash 220ms ease-out forwards; }
@keyframes flash { to { opacity: 0; } }
.cam-small { max-width: 320px; max-height: 320px; }

.class-panels { display: grid; gap: 12px; grid-template-columns: 1fr; }
@media (min-width: 560px) { .class-panels { grid-template-columns: 1fr 1fr; } }
.class-panel { border-radius: var(--radius); padding: 12px 14px; background: var(--green-700); border: 2px solid var(--green-600); display: flex; flex-direction: column; gap: 10px; }
.class-panel.a { border-color: var(--class-a); }
.class-panel.b { border-color: var(--class-b); }
.class-head { display: flex; align-items: center; gap: 10px; }
.class-badge {
  flex: none; width: 44px; height: 44px; border-radius: 12px; display: inline-flex; align-items: center; justify-content: center;
  font-weight: 900; font-size: 1.3em; color: var(--green-900);
}
.class-badge.a { background: var(--class-a); }
.class-badge.b { background: var(--class-b); }
.class-name {
  font: inherit; font-weight: 800; font-size: 1.1em; color: var(--ink); background: transparent; border: 0; border-bottom: 2px dashed var(--green-600);
  padding: 4px 2px; min-width: 0; width: 100%;
}
.class-name:focus { border-bottom-color: var(--gold); outline: none; }
.class-count { color: var(--muted); font-size: var(--fs-small); }
.thumbs { display: flex; gap: 6px; flex-wrap: wrap; min-height: 52px; --thumb: clamp(48px, 3.2vw, 64px); }
.thumbs canvas, .thumbs img { width: var(--thumb); height: var(--thumb); border-radius: 8px; object-fit: cover; background: #000; border: 1px solid rgba(255,255,255,0.2); }
.thumbs .more { width: var(--thumb); height: var(--thumb); border-radius: 8px; display: inline-flex; align-items: center; justify-content: center; color: var(--muted); font-size: var(--fs-small); border: 1px dashed var(--dim); }

/* ---------- Meter ---------- */
.meter { width: 100%; }
.meter-top { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.meter-say {
  font-family: var(--font-display); font-size: var(--fs-meter); font-weight: 700; line-height: 1; letter-spacing: -0.02em;
  display: flex; align-items: baseline; gap: 0.25em; flex-wrap: wrap;
}
.meter-say .meter-lab { display: inline-flex; align-items: baseline; gap: 0.18em; }
.meter-say .meter-mark { font-size: 0.5em; }
.meter-say .meter-pct { font-variant-numeric: tabular-nums; }
.meter-say.unsure { color: var(--unsure); }
.meter-say.a { color: var(--class-a); }
.meter-say.b { color: var(--class-b); }
.meter-note { font-size: 1.05em; color: var(--muted); min-height: 1.3em; margin: 0; }
.meter-bar {
  position: relative; height: clamp(20px, 2.2vw, 40px); border-radius: 999px; overflow: hidden;
  background: linear-gradient(90deg, var(--class-a) 0 50%, var(--class-b) 50% 100%);
  margin: 10px 0 6px;
}
.meter-bar .meter-mask { position: absolute; top: 0; bottom: 0; background: rgba(6,43,33,0.82); transition: left 160ms ease, right 160ms ease; }
.meter-bar .meter-mid { position: absolute; top: 0; bottom: 0; left: 50%; width: 3px; background: rgba(255,255,255,0.8); transform: translateX(-50%); }
.meter-bar .meter-needle { position: absolute; top: 0; bottom: 0; width: 6px; background: #fff; transform: translateX(-50%); transition: left 160ms ease; box-shadow: 0 0 0 2px rgba(0,0,0,0.5); }
.meter-ends { display: flex; justify-content: space-between; font-weight: 800; font-size: 1.1em; }
.meter-ends .a { color: var(--class-a); }
.meter-ends .b { color: var(--class-b); }
.meter.idle .meter-say { color: var(--dim); }
.meter.no-bar .meter-bar, .meter.no-bar .meter-ends { display: none; }

/* ---------- Training overlay ---------- */
.overlay {
  position: fixed; inset: 0; display: flex; align-items: center; justify-content: center; z-index: 50;
  background: rgba(6,43,33,0.92); padding: 24px; text-align: center;
}
.overlay .overlay-box { max-width: 720px; width: 100%; }
.overlay h2 { font-size: var(--fs-h1); }
.progress { height: 14px; border-radius: 999px; background: rgba(255,255,255,0.15); overflow: hidden; margin: 18px auto; max-width: 520px; }
.progress > div { height: 100%; width: 0; background: var(--gold); transition: width 600ms ease; }
.progress.done > div { width: 100%; }

/* ---------- Chips (What changed?) ---------- */
.chips { display: flex; flex-wrap: wrap; gap: 10px; }
.chip {
  appearance: none; font: inherit; font-family: var(--font-display); font-weight: 700; cursor: pointer; color: var(--ink);
  background: var(--green-700); border: 2px solid var(--green-600); border-radius: 999px;
  min-height: 52px; padding: 8px 20px;
}
.chip:hover { border-color: var(--gold); }
.chip[aria-pressed="true"] { background: var(--gold); color: var(--green-900); border-color: var(--gold); }

.snapshot { display: flex; gap: 16px; align-items: center; flex-wrap: wrap; }
.snapshot canvas { width: clamp(120px, 18vw, 260px); height: auto; border-radius: 12px; border: 2px solid var(--green-600); background: #000; }
.snapshot .said { font-size: 1.3em; font-weight: 800; }

/* ---------- Lesson & closing ---------- */
.concepts { display: grid; gap: 12px; grid-template-columns: 1fr; width: 100%; max-width: 1100px; }
@media (min-width: 760px) { .concepts { grid-template-columns: 1fr 1fr; } }
.concept { background: var(--green-700); border-radius: var(--radius); padding: 18px 20px; border-left: 8px solid var(--gold); text-align: left; }
.concept .key { font-weight: 900; letter-spacing: 0.12em; color: var(--gold); font-size: var(--fs-small); }
.concept .text { font-size: 1.15em; font-weight: 600; }
.closing-lines { font-family: var(--font-display); font-size: clamp(20px, 2.2vw + 4px, 46px); font-weight: 700; line-height: 1.3; position: relative; }
.closing-lines div { opacity: 0; transform: translateY(8px); animation: rise 500ms ease forwards; }
.closing-lines div:nth-child(1) { animation-delay: 100ms; }
.closing-lines div:nth-child(2) { animation-delay: 500ms; }
.closing-lines div:nth-child(3) { animation-delay: 900ms; }
.closing-lines div:nth-child(4) { animation-delay: 1300ms; }
.closing-lines div:nth-child(5) { animation-delay: 1700ms; }
@keyframes rise { to { opacity: 1; transform: none; } }
.belong { font-size: var(--fs-hero); font-weight: 700; color: var(--gold); letter-spacing: -0.01em; line-height: 1; margin: 0.3em 0; text-shadow: 0 0 40px rgba(245,180,0,0.35); position: relative; }
.hero-title { font-size: var(--fs-hero); font-weight: 700; line-height: 0.98; letter-spacing: -0.02em; max-width: 14ch; position: relative; }
.hero-title .accent { color: var(--gold); }

.card {
  background: var(--ink); color: var(--green-900); border-radius: var(--radius); padding: clamp(18px, 2.2vw, 36px);
  max-width: 900px; width: 100%; text-align: left; box-shadow: 0 20px 60px rgba(0,0,0,0.35);
}
.card .card-title { font-weight: 900; letter-spacing: 0.14em; color: var(--green-600); font-size: var(--fs-small); margin-bottom: 8px; }
.card .card-q { font-size: clamp(20px, 1.6vw + 6px, 38px); font-weight: 800; line-height: 1.2; margin-bottom: 14px; }
.card .card-line { margin: 6px 0; }
.card .card-line b { color: var(--green-700); }
.card .card-close { margin-top: 14px; font-weight: 800; color: var(--green-700); }

.tally { width: 100%; max-width: 900px; }
.tally-total { font-size: clamp(20px, 2vw + 4px, 40px); font-weight: 800; }
.tally-total .n { color: var(--gold); font-size: 1.4em; font-variant-numeric: tabular-nums; }
.tally-bars { display: grid; grid-template-columns: max-content 1fr max-content; gap: 6px 12px; align-items: center; margin-top: 10px; text-align: left; }
.tally-bars .bar { height: 14px; background: rgba(255,255,255,0.12); border-radius: 999px; overflow: hidden; }
.tally-bars .bar > div { height: 100%; background: var(--gold); border-radius: 999px; }
.tally-bars .n { font-variant-numeric: tabular-nums; color: var(--muted); }

/* ---------- Data lab ---------- */
.datalab { display: grid; gap: clamp(12px, 1.5vw, 28px); grid-template-columns: 1fr; align-items: start; }
@media (min-width: 900px) { .datalab { grid-template-columns: minmax(300px, 52%) 1fr; } }
.chart { width: 100%; height: auto; max-height: 52vh; display: block; margin: 0 auto; background: var(--green-800); border-radius: var(--radius); border: 1px solid var(--green-600); }
.chart text { fill: var(--ink); font-family: inherit; }
.chart .axis line, .chart .axis path { stroke: rgba(255,255,255,0.35); }
.chart .grid line { stroke: rgba(255,255,255,0.08); }
.chart .pt-a { fill: var(--class-a); }
.chart .pt-b { fill: var(--class-b); }
.chart .region-a { fill: var(--class-a); opacity: 0.13; }
.chart .region-b { fill: var(--class-b); opacity: 0.13; }
.chart .test { fill: #fff; stroke: var(--green-900); stroke-width: 2; }
.chart .test-ring { fill: none; stroke: #fff; stroke-width: 3; }
.chart .label { font-size: 18px; fill: var(--muted); }
.chart .label.big { font-size: 21px; fill: var(--ink); font-weight: 700; }

.field { display: flex; flex-direction: column; gap: 6px; }
.field label, .field .lbl { font-weight: 700; }
.field .field-row { display: grid; grid-template-columns: 1fr auto; gap: 8px; align-items: center; }
.field input[type="range"] { width: 100%; height: 44px; accent-color: var(--gold); margin: 0; cursor: pointer; }
.field input[type="number"] {
  font: inherit; font-weight: 700; width: 7.5ch; min-height: 48px; border-radius: var(--radius-sm); border: 2px solid var(--green-600);
  background: var(--green-800); color: var(--ink); padding: 0 8px; text-align: right;
}
.field input[type="number"]:focus { border-color: var(--gold); outline: none; }
.field .unit { color: var(--muted); }
.steppers { display: flex; gap: 6px; }
.stepper { min-height: 48px; min-width: 48px; border-radius: var(--radius-sm); border: 2px solid var(--green-600); background: var(--green-700); color: var(--ink); font: inherit; font-weight: 800; cursor: pointer; }
.stepper:hover { border-color: var(--gold); }

.seg { display: inline-flex; border: 2px solid var(--green-600); border-radius: var(--radius); overflow: hidden; }
.seg button { appearance: none; font: inherit; font-weight: 800; cursor: pointer; min-height: 52px; padding: 0 18px; border: 0; background: var(--green-700); color: var(--ink); }
.seg button + button { border-left: 2px solid var(--green-600); }
.seg button[aria-pressed="true"].a { background: var(--class-a); color: var(--green-900); }
.seg button[aria-pressed="true"].b { background: var(--class-b); color: var(--green-900); }

.readings-table { width: 100%; border-collapse: collapse; font-size: var(--fs-small); }
.readings-table th, .readings-table td { text-align: left; padding: 6px 8px; border-bottom: 1px solid var(--green-600); }
.readings-table caption { text-align: left; font-weight: 700; padding: 6px 0; }
.evidence { font-weight: 700; }
.evidence.weak { color: var(--alert); }
.evidence.strong { color: var(--class-a); }

/* ---------- Series mode ---------- */
.card-number { font-family: var(--font-display); font-size: var(--fs-card-number); font-weight: 700; line-height: 0.95; letter-spacing: -0.04em; color: var(--gold); }
.card-number small { font-size: 0.32em; color: var(--muted); font-weight: 700; letter-spacing: 0.06em; display: block; }
.series-buttons { display: grid; gap: 12px; grid-template-columns: 1fr; }
@media (min-width: 560px) { .series-buttons { grid-template-columns: 1fr 1fr; } }
.progress-dots { display: flex; gap: 6px; flex-wrap: wrap; }
.progress-dots span { width: 18px; height: 18px; border-radius: 50%; background: rgba(255,255,255,0.15); border: 2px solid rgba(255,255,255,0.25); }
.progress-dots span.done { background: var(--gold); border-color: var(--gold); }
.progress-dots span.now { border-color: #fff; }
.series-chart { max-height: 58vh; }
.series-chart .conf-line { fill: none; stroke: #fff; stroke-width: 4; stroke-linejoin: round; stroke-linecap: round; }
.series-chart .conf-dot { stroke: var(--green-900); stroke-width: 2; }
.series-chart .band { fill: var(--alert); opacity: 0.22; }
.series-chart .band-label { fill: var(--alert); font-weight: 800; font-size: 20px; }
.series-chart .unsure-zone { fill: #fff; opacity: 0.07; }
.series-chart .miss { fill: none; stroke: var(--alert); stroke-width: 4; }
.series-chart .row-label { fill: var(--muted); font-size: 19px; font-weight: 700; }
.reveal-bottom { display: grid; gap: 16px; grid-template-columns: 1fr; align-items: center; }
@media (min-width: 1100px) { .reveal-bottom { grid-template-columns: 1fr auto; } }
.legend { display: flex; flex-wrap: wrap; gap: 14px; font-size: var(--fs-small); color: var(--muted); }
.legend .sw { display: inline-block; width: 14px; height: 14px; border-radius: 3px; margin-right: 6px; vertical-align: -2px; }

/* ---------- Footer / staff ---------- */
.footer { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 2px var(--gutter); color: var(--dim); font-size: var(--fs-small); border-top: 1px solid rgba(255,255,255,0.06); }
.footer .btn-quiet { min-height: 44px; }
.footer button { color: var(--dim); }
.footer-right { display: inline-flex; align-items: center; gap: 10px; }
.footer-version { font-variant-numeric: tabular-nums; opacity: 0.8; white-space: nowrap; }
dialog.staff { background: var(--green-700); color: var(--ink); border: 2px solid var(--green-600); border-radius: var(--radius); padding: 22px; max-width: 560px; width: calc(100% - 32px); }
dialog.staff::backdrop { background: rgba(0,0,0,0.6); }
dialog.staff select { font: inherit; min-height: 48px; border-radius: var(--radius-sm); background: var(--green-800); color: var(--ink); border: 2px solid var(--green-600); padding: 0 10px; max-width: 100%; }
.confirm { display: inline-flex; gap: 8px; align-items: center; flex-wrap: wrap; }

.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); background: var(--ink); color: var(--green-900); font-weight: 700; padding: 12px 20px; border-radius: 999px; z-index: 60; box-shadow: 0 10px 30px rgba(0,0,0,0.4); max-width: calc(100% - 32px); }

.attract { font-size: clamp(18px, 1.5vw + 6px, 34px); font-weight: 800; letter-spacing: 0.18em; color: var(--muted); }
.attract span { display: inline-block; margin: 0 0.35em; }
.attract span.on { color: var(--gold); }

.hook-facts { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px 22px; color: var(--muted); font-size: var(--fs-small); }

.notice { background: rgba(255,158,128,0.12); border: 1px solid var(--alert); color: var(--ink); border-radius: var(--radius-sm); padding: 12px 14px; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.001ms !important; animation-iteration-count: 1 !important; transition-duration: 0.001ms !important; scroll-behavior: auto !important; }
  .closing-lines div { opacity: 1; transform: none; }
  .cam-wrap.flash::after { display: none; }
}


/* ==================== v1.1 — the instrument ==================== */

/* Screens arrive, they don't flip. */
.screen.entering { animation: screen-in 320ms var(--ease) both; }
@keyframes screen-in { from { opacity: 0; transform: translateY(8px); } }

/* While the model is learning, the controls step back. */
.training .class-panels, .training #screen-vision-teach .actions, .training #improve-step-add { opacity: 0.45; pointer-events: none; transition: opacity 300ms; }

/* ---------- The map ---------- */
.map-wrap {
  position: relative; width: 100%; height: clamp(200px, 27vh, 400px);
  display: flex; flex-direction: column;
  border-radius: var(--radius); border: 1px solid var(--green-600);
  background:
    radial-gradient(60% 70% at 50% 50%, rgba(255,255,255,0.03), transparent 70%),
    var(--green-800);
  overflow: hidden;
}
.map-wrap canvas { display: block; flex: 1; width: 100%; }
.map-end { position: absolute; top: 10px; font-family: var(--font-display); font-weight: 700; font-size: 1.05em; pointer-events: none; text-shadow: 0 1px 8px rgba(0,0,0,0.6); }
.map-end-a { left: 14px; color: var(--class-a); }
.map-end-b { right: 14px; color: var(--class-b); }
.map-line-label { position: absolute; top: 10px; left: 50%; transform: translateX(-50%); font-size: var(--fs-small); color: var(--gold); pointer-events: none; white-space: nowrap; background: rgba(6,43,33,0.7); padding: 2px 8px; border-radius: 6px; }
.map-caption { margin: 0; padding: 8px 14px 10px; font-size: var(--fs-small); color: var(--muted); min-height: 2.2em; border-top: 1px solid rgba(255,255,255,0.06); background: rgba(6,43,33,0.55); }
@media (max-width: 899px) { .map-wrap { height: clamp(200px, 30vh, 320px); } }
/* Deck mode: the card number shares the column with the map, so both shrink a little. */
#screen-series-label .map-wrap, #screen-series-test .map-wrap { height: clamp(190px, 25vh, 320px); }
#screen-series-label .map-caption, #screen-series-test .map-caption { font-size: calc(var(--fs-small) * 0.92); }
#screen-series-label .card-number, #screen-series-test .card-number { font-size: clamp(56px, 8vw, 150px); }
#screen-series-label .lead, #screen-series-test .lead { margin-bottom: 0.3em; }

/* Understand: the moment, and where it sits on the map */
.understand-grid { display: grid; gap: 16px; grid-template-columns: 1fr; width: 100%; align-items: start; margin-bottom: 8px; }
@media (min-width: 900px) { .understand-grid { grid-template-columns: minmax(200px, 30%) 1fr; } }
#screen-understand .map-wrap { height: clamp(220px, 32vh, 400px); }
#screen-understand { padding-top: clamp(12px, 2vh, 24px); }
#screen-understand h1 { margin-bottom: 0.2em; }

/* ---------- Data Lab: the model's reach grows out of the evidence ---------- */
.chart .regions.grow rect { animation: region-in 520ms ease-out both; animation-delay: var(--d, 0ms); }
@keyframes region-in { from { opacity: 0; } }

/* ---------- Series reveal: the line draws itself, then the band surfaces ---------- */
.series-chart.reveal .conf-line { stroke-dasharray: 4000; stroke-dashoffset: 4000; animation: draw-line 1700ms ease-out 200ms both; }
@keyframes draw-line { to { stroke-dashoffset: 0; } }
.series-chart.reveal .conf-dot { animation: pop-in 420ms var(--ease) both; animation-delay: var(--d, 0ms); transform-box: fill-box; transform-origin: center; }
@keyframes pop-in { from { opacity: 0; transform: scale(0.2); } }
.series-chart.reveal .band, .series-chart.reveal .band-label, .series-chart.reveal .miss { animation: fade-in 700ms ease-out 2000ms both; }
@keyframes fade-in { from { opacity: 0; } }
.reveal-text { animation: fade-in 700ms ease-out 2300ms both; }

/* ---------- Hook: composition ----------
   One vertical rhythm that scales with the viewport's HEIGHT, so a short laptop
   window breathes as well as a 43-inch display: gap instead of per-element margins,
   and the two tallest pieces (title, Start) capped in vh as well as vw. */
#screen-hook { gap: clamp(10px, 2.2vh, 30px); }
#screen-hook > * { margin: 0; }
#screen-hook .hero-title { line-height: 1.04; font-size: min(var(--fs-hero), 10.5vh); }
#screen-hook .actions { margin-top: clamp(6px, 1.4vh, 18px); margin-bottom: clamp(4px, 1vh, 14px); }
#screen-hook .btn-huge { min-height: min(calc(var(--control-h) * 1.5), 11vh); font-size: min(clamp(22px, 2.4vw + 6px, 54px), 4.8vh); }

/* ---------- Hook: the attract field ---------- */
#screen-hook { position: relative; overflow: hidden; }
.attract-canvas { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 0; opacity: 0.9; }
#screen-hook > :not(.attract-canvas) { position: relative; z-index: 1; }
#screen-hook .lead, #screen-hook .hook-facts, #screen-hook .small { text-shadow: 0 2px 14px rgba(6,43,33,0.9); }

/* ---------- Connect: the lab record and the visitor's own picture ---------- */
#screen-connect { position: relative; overflow: hidden; }
.backdrop { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); width: min(120vw, 1500px); max-width: none; opacity: 0.22; filter: blur(1px) saturate(1.2); pointer-events: none; z-index: 0; }
#screen-connect > :not(.backdrop) { position: relative; z-index: 1; }
.recap { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 8px 10px; margin-bottom: 14px; max-width: 1100px; }
.recap-lead { font-family: var(--font-display); font-weight: 700; letter-spacing: 0.12em; text-transform: uppercase; font-size: var(--fs-small); color: var(--gold); margin-right: 6px; }
.recap ul { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; }
.recap li { font-size: var(--fs-small); color: var(--ink); border: 1px solid rgba(255,255,255,0.25); border-radius: 999px; padding: 6px 14px; background: rgba(6,43,33,0.6); }

/* ---------- Finish: today's futures as a field ---------- */
.futures-field { display: block; margin: 0 auto 10px; max-width: 100%; }
.tally-legend { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px 18px; font-size: var(--fs-small); color: var(--muted); }
.tally-legend .sw { display: inline-block; width: 12px; height: 12px; border-radius: 50%; margin-right: 6px; vertical-align: -1px; }

@media (prefers-reduced-motion: reduce) {
  .screen.entering { animation: none; }
  .chart .regions.grow rect, .series-chart.reveal .conf-line, .series-chart.reveal .conf-dot, .series-chart.reveal .band, .series-chart.reveal .band-label, .series-chart.reveal .miss, .reveal-text { animation: none; stroke-dashoffset: 0; }
  .backdrop { filter: none; }
}
