:root {
  --green: #00d16a;
  --green-deep: #00b85c;
  --bg: #001222;
  --surface: #0a1d2e;
  --surface-2: #12273a;
  --line: rgba(255, 255, 255, 0.09);
  --text: #ffffff;
  --muted: rgba(255, 255, 255, 0.6);
  --faint: rgba(255, 255, 255, 0.12);
  --ink: #001222;

  --pad-x: 96px;
  --pad-y: 112px;
  --radius: 5px;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --ease-in: cubic-bezier(0.55, 0, 0.75, 0);

  --s: 1;
}

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

html,
body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  background: #000;
}

body {
  font-family: "Adyen", system-ui, sans-serif;
  font-optical-sizing: auto;
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  -webkit-user-select: none;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

button {
  font: inherit;
  color: inherit;
  background: none;
  border: 0;
  padding: 0;
  cursor: pointer;
}

svg {
  display: block;
}

/* ---------- Frame: fixed 9:16 canvas, uniformly scaled ---------- */

.stage {
  position: fixed;
  inset: 0;
  overflow: hidden;
}

.frame {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 1080px;
  height: 1920px;
  overflow: hidden;
  background: var(--bg);
  transform: translate(-50%, -50%) scale(var(--s));
  transform-origin: center center;
}

/* ---------- Screens ---------- */

.screen {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  padding: var(--pad-y) var(--pad-x);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.45s var(--ease), visibility 0s linear 0.45s;
}

.screen.is-active {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transition: opacity 0.6s var(--ease);
}

.screen.is-active .rise {
  animation: rise 0.9s var(--ease) both;
  animation-delay: calc(var(--d, 0) * 90ms + 120ms);
}

@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(48px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

/* ---------- Type ---------- */

.logo {
  width: 204px;
  height: 66px;
  color: var(--green);
  flex: none;
}

.display {
  margin: 0;
  font-size: 132px;
  line-height: 0.96;
  font-weight: 500;
  letter-spacing: -0.045em;
  text-wrap: balance;
}

.display--md {
  font-size: 104px;
  line-height: 1;
}

.lede {
  margin: 0;
  font-size: 44px;
  line-height: 1.3;
  font-weight: 400;
  letter-spacing: -0.01em;
  color: var(--muted);
  text-wrap: pretty;
}

/* ---------- Buttons ---------- */

.btn {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 168px;
  flex: none;
  border-radius: var(--radius);
  font-size: 48px;
  font-weight: 500;
  letter-spacing: -0.01em;
  overflow: hidden;
  isolation: isolate;
  transition: transform 0.2s var(--ease), background-color 0.2s var(--ease);
}

.btn:active {
  transform: scale(0.985);
}

.btn-primary {
  background: var(--green);
  color: var(--ink);
}

.btn-primary:active {
  background: var(--green-deep);
}

.btn-secondary {
  background: var(--surface-2);
  color: var(--text);
}

.btn-fill {
  position: absolute;
  inset: 0;
  z-index: -1;
  transform: scaleX(0);
  transform-origin: left center;
}

.btn-primary .btn-fill {
  background: rgba(0, 0, 0, 0.12);
}

.btn-secondary .btn-fill {
  background: rgba(255, 255, 255, 0.07);
}

.btn-timed.is-running .btn-fill {
  animation: fill var(--dur, 6000ms) linear forwards;
}

@keyframes fill {
  to {
    transform: scaleX(1);
  }
}

.link {
  font-size: 40px;
  color: var(--muted);
  padding: 20px 0 20px 40px;
  margin: -20px 0;
  transition: color 0.2s;
}

.link:active {
  color: var(--text);
}

.debug {
  display: flex;
  justify-content: center;
  gap: 56px;
}

.debug-btn {
  font-size: 28px;
  color: rgba(255, 255, 255, 0.4);
  padding: 12px 8px;
}

/* ---------- Attract ---------- */

.drift {
  flex: 1;
  display: flex;
  flex-direction: column;
  animation: drift 64s ease-in-out infinite;
}

@keyframes drift {
  0%, 100% { transform: translate(0, 0); }
  25% { transform: translate(14px, -10px); }
  50% { transform: translate(-6px, 16px); }
  75% { transform: translate(-14px, -6px); }
}

.attract-copy {
  margin-top: 152px;
  display: flex;
  flex-direction: column;
  gap: 48px;
}

#s-attract .logo {
  align-self: center;
}

.attract-copy {
  align-items: center;
  text-align: center;
}

.cycle {
  min-height: 1.92em;
}

.cycle .w {
  display: inline-block;
}

.cycle .w.is-enter {
  animation: word-in 1s var(--ease) both;
  animation-delay: calc(var(--i) * 55ms);
}

.cycle .w.is-leave {
  animation: word-out 0.5s var(--ease-in) both;
  animation-delay: calc(var(--i) * 35ms);
}

@keyframes word-in {
  from {
    opacity: 0;
    transform: translateY(0.35em);
  }
}

@keyframes word-out {
  to {
    opacity: 0;
    transform: translateY(-0.25em);
  }
}

.badge-wrap {
  position: relative;
  flex: 1;
  margin-top: 64px;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
}

.ill {
  display: block;
  width: 888px;
  height: 800px;
  overflow: visible;
  cursor: pointer;
}

.ln {
  fill: none;
  stroke-width: 2;
  vector-effect: non-scaling-stroke;
  transition: stroke 0.6s var(--ease), opacity 0.6s var(--ease);
}

.ln-grey {
  stroke: rgba(255, 255, 255, 0.32);
}

.ln-white {
  stroke: #ffffff;
}

.ln-face {
  fill: var(--bg);
  stroke: rgba(255, 255, 255, 0.92);
}

.ln-echo {
  fill: var(--bg);
  stroke: rgba(255, 255, 255, var(--o));
}

.ln-green {
  stroke: var(--green);
}

.ln-green-dim {
  stroke: rgba(0, 209, 106, 0.3);
}

.ln-axis {
  stroke: rgba(0, 209, 106, 0.45);
  stroke-dasharray: 4 10;
}

.node {
  fill: var(--green);
}

.scanner-fill {
  fill: var(--green);
  opacity: 0;
  transition: opacity 0.8s var(--ease);
}

.dot {
  fill: #ffffff;
  transition: opacity 1.2s var(--ease);
}

.dot.off {
  opacity: 0;
}

.qr {
  transition: opacity 0.5s var(--ease);
}

.mover {
  animation: approach 16s ease-in-out infinite;
}

@keyframes approach {
  0%, 100% { transform: translate(0, 0); }
  50% { transform: translate(120px, -120px); }
}

.pulse {
  fill: var(--green);
  animation: pulse-travel 3.6s cubic-bezier(0.45, 0, 0.55, 1) infinite;
}

@keyframes pulse-travel {
  0% { transform: translate(140px, 200px); opacity: 0; }
  15% { opacity: 1; }
  85% { opacity: 1; }
  100% { transform: translate(520px, -180px); opacity: 0; }
}

.scanline {
  stroke: var(--green);
  stroke-width: 2;
  vector-effect: non-scaling-stroke;
  animation: scan 3.4s var(--ease) infinite alternate;
}

@keyframes scan {
  from { transform: translateY(58px); }
  to { transform: translateY(254px); }
}

.check {
  fill: none;
  stroke: var(--green);
  stroke-width: 3;
  stroke-linecap: round;
  stroke-linejoin: round;
  vector-effect: non-scaling-stroke;
  stroke-dasharray: 200;
  stroke-dashoffset: 200;
  transition: stroke-dashoffset 0.7s var(--ease) 0.15s;
}

.ill.is-scanned .ln-face {
  stroke: var(--green);
}

.ill.is-scanned .scanner-fill {
  opacity: 0.1;
}

.ill.is-scanned .qr {
  opacity: 0.12;
}

.ill.is-scanned .scanline,
.ill.is-scanned .pulse {
  opacity: 0;
  transition: opacity 0.2s;
}

.ill.is-scanned .check {
  stroke-dashoffset: 0;
}

.ill.is-scanned .mover,
.ill.is-scanned .pulse {
  animation-play-state: paused;
}

.hint {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 28px;
  font-size: 40px;
  color: var(--muted);
}

.hint-arrow {
  width: 72px;
  height: 72px;
  color: var(--green);
  animation: nudge-x 2.4s var(--ease) infinite;
}

@keyframes nudge {
  0%, 100% { transform: translateY(0); }
  45% { transform: translateY(18px); }
}

@keyframes nudge-x {
  0%, 100% { transform: translateX(0); }
  45% { transform: translateX(20px); }
}

/* ---------- Countdown ---------- */

.count {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 24px;
}

.count-num {
  font-size: 640px;
  line-height: 0.8;
  font-weight: 500;
  letter-spacing: -0.06em;
  color: var(--green);
}

.count-num.tick {
  animation: tick 0.9s var(--ease) both;
}

@keyframes tick {
  from {
    opacity: 0;
    transform: scale(1.18);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

/* ---------- HUD ---------- */

.hud {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 128px;
  flex: none;
}

.hud-count {
  font-family: "Adyen Mono", ui-monospace, monospace;
  font-size: 40px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.hud-count b {
  font-weight: 400;
  color: var(--text);
}

.timer {
  position: relative;
  width: 128px;
  height: 128px;
}

.timer svg {
  width: 100%;
  height: 100%;
  transform: rotate(-90deg);
}

.timer circle {
  fill: none;
  stroke-width: 6;
}

.timer-track {
  stroke: var(--faint);
}

.timer-bar {
  stroke: var(--green);
  stroke-linecap: round;
  stroke-dasharray: 339.292;
  stroke-dashoffset: 0;
  transition: stroke 0.3s;
}

.timer-num {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  font-family: "Adyen Mono", ui-monospace, monospace;
  font-size: 42px;
  font-variant-numeric: tabular-nums;
  transition: opacity 0.3s;
}

.timer.is-paused .timer-bar {
  stroke: rgba(255, 255, 255, 0.4);
}

.timer.is-paused .timer-num {
  opacity: 0.5;
}

.timer.is-low .timer-num {
  animation: pulse 1s ease-in-out infinite;
}

@keyframes pulse {
  50% { opacity: 0.4; }
}

.foot {
  margin-top: auto;
  display: flex;
  flex-direction: column;
  gap: 40px;
  flex: none;
}

.segments {
  display: flex;
  gap: 10px;
  flex: none;
}

.segments i {
  flex: 1;
  height: 8px;
  border-radius: 4px;
  background: var(--faint);
  transition: background-color 0.4s var(--ease);
}

.segments i.is-current {
  background: var(--text);
}

.segments i.is-correct {
  background: var(--green);
}

.segments i.is-wrong {
  background: rgba(255, 255, 255, 0.36);
}

/* ---------- Question ---------- */

.q-wrap {
  margin-top: 16px;
}

.q-text {
  margin: 0;
  font-size: 88px;
  line-height: 1.06;
  font-weight: 500;
  letter-spacing: -0.035em;
  text-wrap: balance;
}

.q-text.is-long {
  font-size: 76px;
}

.q-wrap,
.answers {
  transition: opacity 0.4s var(--ease), transform 0.5s var(--ease);
}

.is-out {
  opacity: 0 !important;
  transform: translateY(-32px) !important;
  transition-duration: 0.3s !important;
  transition-timing-function: var(--ease-in) !important;
}

.q-wrap.is-in {
  animation: rise 0.8s var(--ease) both;
}

.answer-area {
  position: relative;
  margin-top: 88px;
}

.answers {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.answers.is-tf {
  flex-direction: row;
  gap: 24px;
}

.answers.is-hidden {
  opacity: 0;
  transform: translateY(40px);
  pointer-events: none;
}

.opt {
  position: relative;
  display: flex;
  align-items: center;
  gap: 40px;
  min-height: 168px;
  padding: 36px 48px 36px 40px;
  border-radius: var(--radius);
  background: var(--surface);
  text-align: left;
  font-size: 42px;
  line-height: 1.2;
  letter-spacing: -0.01em;
  transition: background-color 0.25s var(--ease), color 0.25s var(--ease),
    opacity 0.35s var(--ease), transform 0.2s var(--ease);
}

.answers.is-in .opt {
  animation: rise 0.8s var(--ease) both;
  animation-delay: calc(var(--i) * 60ms + 120ms);
}

.opt:active {
  transform: scale(0.985);
}

.opt-key {
  flex: none;
  width: 80px;
  height: 80px;
  border-radius: 20px;
  display: grid;
  place-items: center;
  background: var(--faint);
  font-family: "Adyen Mono", ui-monospace, monospace;
  font-size: 36px;
  transition: background-color 0.25s var(--ease), color 0.25s var(--ease);
}

.opt-key svg {
  width: 48px;
  height: 48px;
}

.opt-label {
  flex: 1;
}

.is-tf .opt {
  flex: 1;
  flex-direction: column;
  align-items: flex-start;
  justify-content: space-between;
  height: 480px;
  padding: 48px;
}

.is-tf .opt-key {
  background: none;
}

.is-tf .opt.is-correct .opt-key {
  background: rgba(0, 0, 0, 0.12);
}

.is-tf .opt.is-picked-wrong .opt-key {
  background: var(--faint);
}

.is-tf .opt-label {
  flex: none;
  font-size: 96px;
  line-height: 1;
  font-weight: 500;
  letter-spacing: -0.04em;
}

.answers.is-locked .opt {
  pointer-events: none;
}

.opt.is-dim {
  opacity: 0.32;
}

.opt.is-correct {
  background: var(--green);
  color: var(--ink);
}

.opt.is-correct .opt-key {
  background: rgba(0, 0, 0, 0.12);
}

.opt.is-picked-wrong {
  background: var(--surface-2);
  box-shadow: inset 0 0 0 3px rgba(255, 255, 255, 0.5);
}

/* ---------- Reveal ---------- */

.reveal {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  display: flex;
  flex-direction: column;
  padding: 64px 64px 64px;
  border-radius: 48px;
  background: var(--surface);
  opacity: 0;
  transform: translateY(48px);
  pointer-events: none;
  transition: opacity 0.35s var(--ease), transform 0.35s var(--ease-in);
}

.reveal.is-open {
  opacity: 1;
  transform: none;
  pointer-events: auto;
  transition: opacity 0.5s var(--ease), transform 0.8s var(--ease);
}

.reveal-head {
  display: flex;
  align-items: center;
  gap: 32px;
}

.reveal-mark {
  width: 96px;
  height: 96px;
  flex: none;
  border-radius: 24px;
  display: grid;
  place-items: center;
  background: var(--green);
  color: var(--ink);
}

.reveal-mark svg {
  width: 56px;
  height: 56px;
}

.reveal.is-wrong .reveal-mark {
  background: var(--faint);
  color: var(--text);
}

.reveal-title {
  margin: 0;
  font-size: 80px;
  line-height: 1;
  font-weight: 500;
  letter-spacing: -0.04em;
}

.reveal-answer {
  margin: 48px 0 0;
  font-size: 44px;
  line-height: 1.25;
  color: var(--text);
}

.reveal-answer span {
  color: var(--muted);
}

.reveal-answer:empty {
  display: none;
}

.reveal-fact {
  margin: 40px 0 0;
  padding-top: 40px;
  border-top: 2px solid var(--line);
  font-size: 42px;
  line-height: 1.35;
  color: var(--muted);
  text-wrap: pretty;
}

.reveal .btn {
  margin-top: 64px;
}

/* ---------- Time's up ---------- */

.timeup {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  background: var(--bg);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.5s var(--ease);
}

.timeup .display {
  font-size: 180px;
  transform: translateY(40px);
  transition: transform 0.9s var(--ease);
}

.timeup.is-open {
  opacity: 1;
  pointer-events: auto;
}

.timeup.is-open .display {
  transform: none;
}

/* ---------- Results ---------- */

.results {
  display: flex;
  flex-direction: column;
  margin-top: 168px;
}

.results + .btn {
  margin-top: 112px;
}

.score {
  display: flex;
  align-items: baseline;
  font-size: 400px;
  line-height: 0.82;
  font-weight: 500;
  letter-spacing: -0.06em;
}

.score-num {
  color: var(--green);
}

.score-of {
  color: rgba(255, 255, 255, 0.24);
}

.score-blocks {
  display: flex;
  gap: 10px;
  margin: 88px 0 96px;
}

.score-blocks i {
  flex: 1;
  height: 16px;
  border-radius: 8px;
  background: var(--faint);
}

.score-blocks i.is-correct {
  background: var(--green);
}

.results .lede {
  margin-top: 40px;
  max-width: 840px;
}

/* ---------- Qualifying ---------- */

.answers--qual .opt {
  min-height: 152px;
  padding: 32px 40px 32px 48px;
}

.opt-radio {
  flex: none;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  box-shadow: inset 0 0 0 3px rgba(255, 255, 255, 0.3);
  display: grid;
  place-items: center;
  transition: box-shadow 0.25s var(--ease);
}

.opt-radio::after {
  content: "";
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--ink);
  transform: scale(0);
  transition: transform 0.3s var(--ease);
}

.opt.is-selected {
  background: var(--green);
  color: var(--ink);
}

.opt.is-selected .opt-radio {
  box-shadow: inset 0 0 0 3px var(--ink);
}

.opt.is-selected .opt-radio::after {
  transform: scale(1);
}

/* ---------- End ---------- */

.end-copy {
  margin-top: 152px;
  display: flex;
  flex-direction: column;
  gap: 48px;
}

.end-copy .lede {
  max-width: 840px;
}

.end-drop {
  display: grid;
  place-items: center;
  margin: 120px 0;
}

.drop-mark {
  width: 320px;
  height: 320px;
  border-radius: 80px;
  display: grid;
  place-items: center;
  background: var(--green);
  color: var(--ink);
}

.drop-mark svg {
  width: 160px;
  height: 160px;
  animation: nudge 1.8s var(--ease) infinite;
}

.is-lose .end-drop {
  display: none;
}

.is-lose .end-copy {
  margin-bottom: 112px;
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
  }
}
