@font-face {
  font-family: 'Unbounded';
  src: url('/assets/fonts/unbounded-latin.woff2') format('woff2');
  font-weight: 200 900;
  font-display: swap;
}

:root {
  /* The real world: survey paper and ink. */
  --paper: #e8eaef;
  --paper-deep: #dde1e8;
  --ink: #12142b;
  --ink-soft: rgba(18, 20, 43, 0.66);
  --rule: rgba(18, 20, 43, 0.14);
  --scan: #3a2bff;
  /* The simulation: void, ion, amber, hazard. */
  --void: #0a0b1a;
  --ion: #48e5ff;
  --amber: #ffb547;
  --hazard: #ff3f6c;

  --display: 'Unbounded', system-ui, sans-serif;
  --body: system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --mono: ui-monospace, 'Cascadia Mono', 'SF Mono', Menlo, Consolas, monospace;

  --gutter: clamp(16px, 4vw, 40px);
  --max: 1120px;
}

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

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 400 1rem/1.55 var(--body);
}

a { color: var(--scan); text-underline-offset: 0.2em; }

:focus-visible { outline: 3px solid var(--scan); outline-offset: 3px; }

.wrap { max-width: var(--max); margin: 0 auto; padding: 0 var(--gutter); }

/* ---------- header ---------- */
.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding-top: 18px;
  padding-bottom: 18px;
}

.wordmark {
  font: 800 1.05rem/1 var(--display);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--ink);
  text-decoration: none;
}

.site-nav { display: flex; gap: 20px; font-size: 0.95rem; }
.site-nav a { color: var(--ink-soft); text-decoration: none; }
.site-nav a:hover { color: var(--ink); text-decoration: underline; }

/* ---------- buttons ---------- */
.button {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-height: 48px;
  padding: 0 22px;
  border: 0;
  border-radius: 999px;
  background: var(--amber);
  color: var(--void);
  font: 800 0.95rem/1 var(--display);
  letter-spacing: 0.02em;
  text-decoration: none;
  cursor: pointer;
}
.button:hover { background: #ffc66e; }
.button-quiet { background: transparent; color: var(--ink); box-shadow: inset 0 0 0 1.5px var(--rule); }
.button-quiet:hover { background: var(--paper-deep); }

/* ---------- hero viewport: the window into the simulation ---------- */
.viewport {
  position: relative;
  overflow: hidden;
  border-radius: 20px;
  background: var(--void);
  color: var(--paper);
  aspect-ratio: 2 / 3;
  max-height: 78svh;
  isolation: isolate;
}
@media (min-width: 760px) { .viewport { aspect-ratio: 16 / 9; } }

.viewport canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }

.viewport-overlay {
  position: absolute;
  inset: auto 0 0 0;
  padding: clamp(20px, 4vw, 40px);
  background: linear-gradient(to top, rgba(10, 11, 26, 0.92) 30%, rgba(10, 11, 26, 0));
}

.sector-label {
  margin: 0 0 8px;
  font: 500 0.75rem/1 var(--mono);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ion);
}

.game-title {
  margin: 0;
  font: 800 clamp(2.4rem, 9vw, 5.5rem)/0.95 var(--display);
  letter-spacing: -0.02em;
}

.game-pitch {
  max-width: 34ch;
  margin: 14px 0 22px;
  color: rgba(232, 234, 239, 0.78);
  font-size: 1.05rem;
}

/* Live readout of the running simulation, in the frame's corners. */
.telemetry {
  position: absolute;
  top: 14px;
  left: 16px;
  right: 16px;
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin: 0;
  font: 400 0.7rem/1.4 var(--mono);
  letter-spacing: 0.06em;
  color: rgba(72, 229, 255, 0.7);
  pointer-events: none;
}
.telemetry div { display: flex; gap: 6px; }
.telemetry dt { color: rgba(232, 234, 239, 0.4); }
.telemetry dd { margin: 0; font-variant-numeric: tabular-nums; }

/* ---------- home sections ---------- */
.statement {
  max-width: 30ch;
  margin: clamp(48px, 9vw, 96px) 0 clamp(36px, 6vw, 64px);
  font: 500 clamp(1.4rem, 3.6vw, 2.3rem)/1.25 var(--display);
  letter-spacing: -0.01em;
}
.statement em { font-style: normal; color: var(--scan); }

.section-heading {
  margin: 0 0 4px;
  font: 500 0.75rem/1 var(--mono);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-soft);
}

.sectors { list-style: none; margin: 0; padding: 0; border-top: 1.5px solid var(--ink); }
.sector {
  display: grid;
  grid-template-columns: 4.5ch 1fr auto;
  align-items: center;
  gap: 16px;
  padding: 18px 0;
  border-bottom: 1px solid var(--rule);
}
.sector-number { font: 500 0.85rem/1 var(--mono); color: var(--ink-soft); }
.sector-name { margin: 0; font: 800 1.15rem/1.2 var(--display); }
.sector-desc { margin: 4px 0 0; color: var(--ink-soft); font-size: 0.95rem; }
.sector-pending .sector-name { color: var(--ink-soft); font-weight: 500; }

/* ---------- ads: hidden until an ad unit is configured ---------- */
.ad { margin: 48px 0; }
.ad[hidden] { display: none; }
.ad-label {
  display: block;
  margin-bottom: 6px;
  font: 400 0.7rem/1 var(--mono);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-soft);
}

/* ---------- footer ---------- */
.site-footer {
  width: calc(100% - 2 * var(--gutter));
  max-width: calc(var(--max) - 2 * var(--gutter));
  margin-top: 64px;
  padding: 20px 0 40px;
  border-top: 1px solid var(--rule);
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 12px;
  font-size: 0.9rem;
  color: var(--ink-soft);
}
.site-footer a { color: var(--ink-soft); }

/* ---------- game page ---------- */
.play-body { background: var(--void); color: var(--paper); }
.play-body .site-footer, .play-body .section-heading { color: rgba(232, 234, 239, 0.6); border-color: rgba(232, 234, 239, 0.14); }
.play-body .site-footer a { color: rgba(232, 234, 239, 0.75); }
.play-body a { color: var(--ion); }

.stage { position: relative; height: 100svh; }
@media (min-width: 760px) {
  .stage { height: min(86svh, 820px); max-width: 960px; margin: 0 auto; }
}
.stage canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; cursor: pointer; }
.stage canvas:focus-visible { outline: 2px solid rgba(72, 229, 255, 0.35); outline-offset: -2px; }

.stage-bar {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px var(--gutter);
  z-index: 1;
  pointer-events: none;
}
.stage-bar > * { pointer-events: auto; }
.stage-bar .wordmark { color: var(--paper); font-size: 0.85rem; }

.icon-button {
  min-width: 44px;
  min-height: 44px;
  border: 0;
  border-radius: 999px;
  background: rgba(232, 234, 239, 0.08);
  color: var(--paper);
  font: 500 0.8rem/1 var(--mono);
  cursor: pointer;
  padding: 0 14px;
}

.how {
  max-width: 60ch;
  padding-top: 40px;
}
.how h2 { font: 800 1.4rem/1.2 var(--display); margin: 0 0 12px; }
.how ul { padding-left: 1.2em; color: rgba(232, 234, 239, 0.8); }
.how li + li { margin-top: 6px; }
.key { font-family: var(--mono); color: var(--ion); }

.play-body .ad-label { color: rgba(232, 234, 239, 0.5); }

/* ---------- prose pages ---------- */
.prose { max-width: 68ch; padding-top: 24px; }
.prose h1 { font: 800 clamp(1.8rem, 5vw, 2.6rem)/1.1 var(--display); margin: 0 0 8px; }
.prose h2 { font: 800 1.15rem/1.3 var(--display); margin: 36px 0 8px; }
.prose .button { margin: 0 8px 8px 0; }
.prose code { font: 400 0.9em var(--mono); }
.prose .updated { font: 400 0.8rem/1 var(--mono); color: var(--ink-soft); margin-bottom: 32px; }

/* ---------- consent bar ---------- */
.consent {
  position: fixed;
  left: 12px;
  right: 12px;
  bottom: 12px;
  z-index: 10;
  max-width: 560px;
  margin: 0 auto;
  padding: 16px 18px;
  border-radius: 16px;
  background: var(--paper);
  color: var(--ink);
  box-shadow: 0 10px 40px rgba(10, 11, 26, 0.35);
  font-size: 0.92rem;
}
.consent p { margin: 0 0 12px; }
.consent a { color: var(--scan); }
.consent-actions { display: flex; justify-content: flex-end; gap: 10px; flex-wrap: wrap; }
.consent .button { min-height: 42px; padding: 0 16px; font-size: 0.85rem; }

@media (prefers-reduced-motion: reduce) {
  * { scroll-behavior: auto !important; }
}

/* Game pages: the full name collides with centred scores on narrow screens. */
.stage-bar .wm-short { display: none; }
@media (max-width: 520px) {
  .stage-bar .wm-full { display: none; }
  .stage-bar .wm-short { display: inline; }
}

/* ---------- identity chip, supporter link, panels (meta.js) ---------- */
.visually-hidden {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.stage-bar { gap: 8px; }
.stage-bar .identity-chip { margin-left: auto; min-width: 44px; padding: 0; display: inline-grid; place-items: center; }
.identity-dot {
  width: 18px; height: 18px; border-radius: 50%;
  box-shadow: 0 0 0 2px rgba(232, 234, 239, 0.55);
}
.identity-chip.is-unset .identity-dot {
  background: conic-gradient(#FFB547, #5CF2B0, #9FD8FF, #B18CFF, #FF8AD8, #D4FF5C, #FFB547) !important;
}

.supporter-link {
  position: absolute;
  right: var(--gutter);
  bottom: max(16px, env(safe-area-inset-bottom));
  z-index: 1;
  font-size: 0.75rem;
}
.supporter-link[hidden] { display: none; }
/* Floodline's centred "Copy result" bar sits at the bottom too: lift ours above it on phones. */
@media (max-width: 520px) { .supporter-link { bottom: calc(max(16px, env(safe-area-inset-bottom)) + 56px); } }

.panel {
  width: min(460px, calc(100vw - 32px));
  max-height: calc(100dvh - 32px);
  overflow: auto;
  padding: 24px;
  border: 0;
  border-radius: 20px;
  background: var(--paper);
  color: var(--ink);
  font: 400 0.98rem/1.5 var(--body);
  box-shadow: 0 20px 60px rgba(10, 11, 26, 0.5);
}
.panel::backdrop { background: rgba(10, 11, 26, 0.7); }
.panel h2 { margin: 0 0 10px; font: 800 1.25rem/1.25 var(--display); }
.panel p { margin: 0 0 14px; }
.panel a { color: var(--scan); }
.panel-list { margin: 0 0 14px; padding-left: 1.2em; }
.panel-list li + li { margin-top: 4px; }
.panel-note { font-size: 0.82rem; color: var(--ink-soft); }
.panel-thanks { font-weight: 600; }
.panel-actions { display: flex; justify-content: flex-end; gap: 10px; flex-wrap: wrap; margin: 4px 0 14px; }

.swatches { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 0 0 14px; }
.swatch {
  display: flex; align-items: center; gap: 8px;
  min-height: 48px; padding: 0 12px;
  border: 0; border-radius: 12px;
  background: var(--void); color: var(--paper);
  font: 500 0.85rem/1 var(--body);
  cursor: pointer;
  box-shadow: inset 0 0 0 2px transparent;
}
.swatch[aria-checked="true"] { box-shadow: inset 0 0 0 2px var(--swatch); }
.swatch-dot { width: 18px; height: 18px; border-radius: 50%; background: var(--swatch); flex: none; }
