:root {
  --bg: #1423b8;
  --ink: #ffffff;
  --accent: #1fc27a;
  --accent-ink: #0a0a0a;
  --field-1: #1423b8; --field-1-ink: #ffffff;
  --field-2: #000000; --field-2-ink: #ffffff;
  --field-3: #f7dd47; --field-3-ink: #000000;
  --field-4: #e9479f; --field-4-ink: #000000;
  --paper: #ffffff;
  --step-small: clamp(0.8125rem, 0.79rem + 0.1vw, 0.875rem);
  --step-body: clamp(1.0625rem, 1rem + 0.25vw, 1.1875rem);
  --step-lead: clamp(1.25rem, 1.1rem + 0.7vw, 1.625rem);
  --step-display: clamp(2.75rem, 5.2vw, 5rem);
  --step-poster: clamp(3rem, 8.6vw, 9rem);
  --margin: clamp(16px, 2.8vw, 40px);
  --ease: cubic-bezier(0.2, 0.7, 0.2, 1);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 400 var(--step-body)/1.45 "Hanken Grotesk", system-ui, sans-serif;
  letter-spacing: -0.005em;
  overflow-x: hidden;
}
h1, h2 { margin: 0; font-weight: 500; letter-spacing: -0.05em; line-height: 0.95; }
p { margin: 0; }
a { color: inherit; }
img { display: block; max-width: 100%; height: auto; }
code, pre { font-family: ui-monospace, Menlo, Consolas, monospace; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 3px; }

.button {
  display: inline-block;
  padding: 14px 22px;
  border: 0;
  background: var(--accent);
  color: var(--accent-ink);
  font: 500 var(--step-body)/1.2 "Hanken Grotesk", system-ui, sans-serif;
  text-decoration: none;
  cursor: pointer;
  transition: transform 160ms var(--ease);
}
.button[hidden] { display: none; }
.button:hover { transform: translateY(-2px); }
.button:active { transform: translateY(1px); }

.bar {
  position: absolute;
  inset: 0 0 auto 0;
  z-index: 2;
  display: flex;
  align-items: center;
  gap: clamp(16px, 3vw, 40px);
  padding: 18px var(--margin);
}
.wordmark { font-weight: 500; text-decoration: none; margin-right: auto; }
.bar nav { display: flex; gap: clamp(16px, 2.4vw, 32px); }
.bar nav a { text-decoration: none; transition: opacity 160ms var(--ease); }
.bar nav a:hover { opacity: 0.7; }
.bar .action { font-weight: 500; text-decoration: underline; text-underline-offset: 4px; }

.hero {
  position: relative;
  min-height: 100svh;
  padding: clamp(120px, 19vh, 190px) var(--margin) 0;
  background: var(--field-1);
  color: var(--field-1-ink);
  overflow: hidden;
}
.hero-words { max-width: 60vw; }
.hero h1 { font-size: var(--step-display); }
.hero-words p { max-width: 40ch; margin: 24px 0 28px; font-size: var(--step-lead); line-height: 1.3; }
.stage {
  position: absolute;
  left: 41.6%;
  right: 0;
  top: 46%;
  bottom: 0;
  padding: 56px 0 0 56px;
  background: var(--field-3);
  clip-path: polygon(0 96px, 96px 0, 100% 0, 100% 100%, 0 100%);
}
.panel {
  width: min(620px, 100%);
  min-height: 100%;
  padding: 28px;
  background: var(--paper);
  color: var(--field-2);
  font-size: 15px;
}
.panel-label { font-size: 14px; }
.balance {
  margin: 2px 0 18px;
  font-size: clamp(2.5rem, 4.6vw, 4rem);
  font-weight: 500;
  letter-spacing: -0.04em;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}
.balance.moved { color: var(--field-1); }
.panel-note { margin-bottom: 14px; font-size: 14px; }
.panel-live { min-height: 112px; }
.tried { font-weight: 500; font-size: 17px; }
.answer { margin-top: 6px; font-size: 16px; }
.panel-button { margin-top: 16px; }
.fallback { margin: 16px 0 0; padding-left: 20px; font-size: 15px; }
.fallback li { margin-bottom: 6px; }
.replay-ready .fallback { display: none; }

.split { display: grid; grid-template-columns: 1fr 1fr; min-height: 96svh; }
.split-in, .split-out {
  position: relative;
  display: flex;
  flex-direction: column;
  padding: clamp(40px, 9vh, 96px) var(--margin) 32px;
}
.split-in { background: var(--field-2); color: var(--field-2-ink); }
.split-out { background: var(--field-3); color: var(--field-3-ink); }
.raw { margin: 0; font-size: clamp(1rem, 2vw, 1.875rem); line-height: 1.4; white-space: pre-wrap; }
.white-on-white { color: var(--field-3); }
.split-note { max-width: 44ch; margin-top: 24px; }
.split-head { margin-top: auto; padding-top: 48px; font-size: var(--step-display); }
.message { width: min(520px, 100%); padding: 22px 24px; background: var(--paper); color: var(--field-2); font-size: 15px; }
.message p + p { margin-top: 8px; }
.message-from { font-size: 14px; }
.message-title { font-size: 22px; font-weight: 500; }
.message pre { margin: 12px 0 0; padding: 12px; background: var(--field-2); color: var(--paper); font-size: 13px; white-space: pre-wrap; }

.tiles { padding: clamp(64px, 12vh, 140px) var(--margin) clamp(64px, 12vh, 140px); background: var(--field-1); position: relative; }
.tiles h2 { position: absolute; top: clamp(64px, 12vh, 140px); left: var(--margin); max-width: 40vw; font-size: var(--step-display); }
@media (min-width: 1100px) { .tiles h2 { max-width: 60vw; } }
.tile-row { display: grid; grid-template-columns: 3fr 4fr 5fr; gap: 10px; align-items: end; }
.tile { margin: 0; }
.tile-field { display: flex; align-items: center; justify-content: center; overflow: hidden; }
.tile-field img { width: 100%; height: 100%; object-fit: cover; }
.tile-outside .tile-field { height: 30vh; background: var(--field-3); }
.tile-door .tile-field { height: 44vh; background: var(--field-2); }
.tile-inside .tile-field { height: 60vh; background: var(--paper); padding: clamp(16px, 3vw, 48px); }
.tile-inside .tile-field img { height: auto; object-fit: contain; }
.tile figcaption { margin-top: 14px; max-width: 46ch; }
.tile figcaption strong { display: block; margin-bottom: 4px; font-size: var(--step-lead); font-weight: 500; }

.band { background: var(--field-4); color: var(--field-4-ink); overflow: hidden; }
.band-track { display: flex; width: max-content; padding: 3vh 0; animation: band 60s linear infinite; }
.band-track p { flex: none; padding-right: 2vw; font-size: var(--step-poster); font-weight: 500; letter-spacing: -0.05em; line-height: 1.1; white-space: nowrap; }
.band-track i { display: inline-block; width: 0.28em; height: 0.28em; margin: 0 0.25em; border-radius: 50%; background: currentColor; vertical-align: 0.2em; }
@keyframes band { to { transform: translateX(-50%); } }
.band-note { padding: 28px var(--margin) clamp(64px, 12vh, 120px); max-width: 66ch; background: var(--field-1); }

.poster { padding: 80px var(--margin); background: var(--field-3); color: var(--field-3-ink); }
.poster ul { margin: 0; padding: 0; list-style: none; }
.poster li { display: flex; justify-content: space-between; align-items: baseline; gap: 32px; }
.poster span { font-size: var(--step-poster); font-weight: 500; letter-spacing: -0.05em; line-height: 0.98; white-space: nowrap; transition: transform 160ms var(--ease); }
.poster small { max-width: 34ch; font-size: var(--step-body); text-align: right; }
.poster li:hover span { transform: translateX(12px); }

.close {
  display: grid;
  grid-template-columns: 5fr 1fr 5fr;
  align-items: end;
  min-height: 92svh;
  padding: clamp(64px, 10vh, 120px) var(--margin);
  background: var(--accent);
  color: var(--accent-ink);
}
.close-words { grid-column: 1; }
.close h2 { font-size: var(--step-display); max-width: 11ch; }
.close-words p { max-width: 40ch; margin-top: 20px; }
.close-words img { width: clamp(96px, 12vw, 180px); margin-top: 28px; }
.dialog { grid-column: 3; align-self: center; width: min(520px, 100%); justify-self: end; padding: 24px; background: var(--paper); color: var(--field-2); }
.dialog-title { font-size: 20px; font-weight: 500; }
.dialog pre { margin: 14px 0; padding: 14px; background: var(--field-2); color: var(--paper); font-size: 14px; white-space: pre-wrap; overflow-wrap: anywhere; }
.dialog-note { font-size: 15px; }
.dialog-button { width: 100%; margin-top: 14px; background: var(--field-2); color: var(--paper); }

.end { display: flex; flex-direction: column; min-height: 72svh; padding: 40px var(--margin) 24px; background: var(--field-2); color: var(--field-2-ink); }
.end-top { display: flex; justify-content: space-between; gap: 32px; }
.end-top p { max-width: 54ch; }
.end-line { margin-top: auto; font-size: var(--step-poster); font-weight: 500; letter-spacing: -0.05em; line-height: 1; text-decoration: none; transition: opacity 160ms var(--ease); }
.end-line:hover { opacity: 0.7; }
.credits { margin-top: 28px; font-size: var(--step-small); }

/* Entrances. The content is visible without script: only motion.js adds .will-enter. */
.will-enter { opacity: 0; transform: translateY(24px); }
.entered { opacity: 1; transform: none; transition: opacity 620ms var(--ease), transform 620ms var(--ease); transition-delay: var(--delay, 0ms); }
.shutter.will-shut { clip-path: inset(0 100% 0 0); transform: scale(1.12); }
.shutter.shut-open { clip-path: inset(0 0 0 0); transform: none; transition: clip-path 1.1s var(--ease), transform 1.1s var(--ease); }
.balance.tick { animation: tick 500ms var(--ease); }
@keyframes tick { 0% { transform: translateY(-8px); opacity: 0.4; } 100% { transform: none; opacity: 1; } }

@media (max-width: 760px) {
  .bar nav { display: none; }
  .hero { display: flex; flex-direction: column; min-height: auto; padding-top: 84px; }
  .hero-words { max-width: none; }
  .hero h1 { font-size: 10vw; }
  .hero-words p { font-size: 17px; }
  .stage { position: static; margin: 36px calc(var(--margin) * -1) 0; padding: 16px; clip-path: polygon(0 72px, 72px 0, 100% 0, 100% 100%, 0 100%); }
  .panel { width: 100%; padding: 72px 18px 22px; }
  .panel-button { width: 100%; }
  .split { grid-template-columns: 1fr; }
  .split-in, .split-out { min-height: 62svh; }
  .split-head { font-size: 10vw; }
  .tiles h2 { position: static; max-width: none; margin-bottom: 28px; font-size: 10vw; }
  .tile-row { grid-template-columns: 1fr; gap: 28px; }
  .tile-outside .tile-field { height: 34vw; }
  .tile-door .tile-field { height: 46vw; }
  .tile-inside .tile-field { height: 62vw; }
  .band-track p { font-size: 13vw; }
  .poster { padding: 56px var(--margin); }
  .poster li { display: block; margin-bottom: 22px; }
  .poster span { font-size: 13vw; }
  .poster small { display: block; margin-top: 6px; text-align: left; font-size: 16px; }
  .close { display: flex; flex-direction: column; align-items: stretch; gap: 32px; min-height: 84svh; }
  .close h2 { font-size: 10vw; }
  .dialog { width: 100%; }
  .dialog-button { min-height: 52px; }
  .end-top { flex-direction: column; }
  .end-line { font-size: 13vw; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .band-track { animation: none; }
  .will-enter, .entered, .shutter.will-shut, .shutter.shut-open { opacity: 1; transform: none; clip-path: none; transition: none; }
  .balance.tick { animation: none; }
}
