/* Textcade — the site's half of the design system.
   Every value here is lifted from Textcade/Console/TextcadeTheme.swift so the
   page and the app cannot drift: one hex, one radius, one depth. */

:root {
  --ink: #0D0F15;
  --ink-soft: #181B20;
  --paper: #F3F2EE;
  --paper-card: #FBF8F2;
  --edge: #DEDAD3;
  --mono-label: #4A4E55;
  --dim-on-ink: #9AA0A8;
  --pip-on-ink: #2A2E36;

  --coral: #EA6A64;
  --coral-dark: #BD413F;
  --coral-text: #FEFBFA;
  --blue: #3A93E6;
  --blue-dark: #036BB9;
  --green: #4CB86A;
  --green-dark: #158F44;
  --teal: #2AA8A0;
  --teal-dark: #0F7E78;

  --card-radius: 22px;
  --tile-radius: 16px;
  --chip-radius: 13px;
  --button-depth: 5px;
  --card-depth: 4px;
  --chip-depth: 3px;

  --display: "Bricolage Grotesque", ui-sans-serif, system-ui, sans-serif;
  --ui: "Figtree", ui-sans-serif, system-ui, -apple-system, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, Menlo, monospace;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--ui);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

.display {
  font-family: var(--display);
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 0.98;
}

.caps {
  font-family: var(--mono);
  font-weight: 500;
  font-size: 11px;
  letter-spacing: 1.3px;
  text-transform: uppercase;
  color: var(--mono-label);
}

.wrap { max-width: 1180px; margin: 0 auto; padding: 0 24px; }

/* ---------- the press: every tappable thing sits on its own shadow ---------- */

.press {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  border: 0;
  cursor: pointer;
  font-family: var(--ui);
  transform: translateY(calc(-1 * var(--depth, 5px)));
  transition: transform 0.08s ease;
}
.press-base { display: inline-block; border-radius: inherit; }
.press:active, .press.is-down { transform: translateY(0); }

.btn-shell { display: inline-block; border-radius: 16px; }
/* A shell in a flex row must not stretch: the depth colour is painted by
   the shell, so any millimetre of it taller than the button reads as a
   coloured band rather than an edge. */
.btn-row { display: flex; gap: 14px; flex-wrap: wrap; justify-content: center; align-items: center; }
.btn {
  border-radius: 16px;
  font-size: 17px;
  font-weight: 700;
  padding: 17px 30px;
  --depth: var(--button-depth);
}
.btn-ink { background: var(--ink); color: var(--paper); }
.btn-ink-shell { background: #000; }
.btn-coral { background: var(--coral); color: var(--coral-text); }
.btn-coral-shell { background: var(--coral-dark); }
.btn-paper { background: var(--coral-text); color: var(--coral-dark); }
.btn-paper-shell { background: rgba(0,0,0,0.22); }

/* ---------- nav ---------- */

.nav {
  position: sticky;
  top: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 0;
  background: rgba(243,242,238,0.86);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid transparent;
  transition: border-color 0.2s ease;
}
.nav.is-stuck { border-bottom-color: var(--edge); }
.nav-mark { display: flex; align-items: baseline; gap: 10px; }
.nav-mark .display { font-size: 20px; }
.nav-links { display: flex; align-items: center; gap: 26px; }
.nav-links a { text-decoration: none; }
.nav-links .caps:hover { color: var(--ink); }
.nav .btn { font-size: 14px; padding: 12px 20px; border-radius: 13px; --depth: var(--chip-depth); }
.nav .btn-shell { border-radius: 13px; }

/* ---------- hero ---------- */

.hero { padding: 74px 0 0; display: flex; flex-direction: column; align-items: center; gap: 18px; }
.hero h1 { font-size: clamp(40px, 7.4vw, 82px); margin: 0; text-align: center; text-wrap: balance; }
.hero-sub {
  max-width: 540px; margin: 0; text-align: center;
  font-size: 18px; line-height: 1.5; color: var(--mono-label); text-wrap: pretty;
}

/* ---------- the stage ---------- */

#stage {
  position: relative;
  width: 100%;
  height: min(62vh, 540px);
  min-height: 380px;
  margin-top: 26px;
  border-radius: var(--card-radius);
  overflow: hidden;
  background: var(--paper);
  transition: background 0.45s ease;
  touch-action: pan-y;
  cursor: grab;
}
#stage.is-ink { background: var(--ink); }
#stage.is-dragging { cursor: grabbing; }
#stage canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }

.layer { position: absolute; inset: 0; pointer-events: none; }
.layer > * { pointer-events: auto; }

/* Pieces ride the stage as DOM sprites: crisper than a texture, and they can
   carry a CSS reaction the shader would have to fake. */
.sprite {
  position: absolute;
  bottom: 8%;
  width: clamp(74px, 11vw, 128px);
  pointer-events: none;
  filter: drop-shadow(0 12px 18px rgba(13,15,21,0.22));
  transition: transform 0.24s cubic-bezier(0.2,0.9,0.3,1.3), opacity 0.35s ease;
}
.sprite img { width: 100%; display: block; }
.sprite-you { left: 4%; }
.sprite-foe { right: 4%; transform: scaleX(-1); }
.sprite-foe.react-win, .sprite-foe.react-lose { }
.sprite.react-win { transform: translateY(-14px) scale(1.05); }
.sprite-foe.react-win { transform: scaleX(-1) translateY(-14px) scale(1.05); }
.sprite.react-lose { transform: translateY(3px) rotate(-4deg); }
.sprite-foe.react-lose { transform: scaleX(-1) translateY(3px) rotate(-4deg); }

.stage-hint {
  position: absolute; left: 0; right: 0; bottom: 16px;
  text-align: center; font-size: 10.5px; opacity: 0.85;
}

.overlay {
  position: absolute; inset: 0;
  display: flex; flex-direction: column;
  opacity: 0; visibility: hidden;
  transition: opacity 0.3s ease, visibility 0.3s ease;
}
.overlay.is-on { opacity: 1; visibility: visible; }

/* boot */
.boot { align-items: center; justify-content: center; gap: 9px; }
.boot-line { font-family: var(--mono); font-size: 12px; color: var(--dim-on-ink); opacity: 0; }
.boot-line.is-on { opacity: 1; }

/* the round */
.play { padding: 22px clamp(16px, 4vw, 40px); gap: 14px; }
.scoreline { display: flex; align-items: center; justify-content: space-between; }
.who { display: flex; flex-direction: column; align-items: center; gap: 7px; }
.pips { display: flex; gap: 5px; }
.pip { width: 9px; height: 9px; border-radius: 50%; background: var(--pip-on-ink); transition: background 0.2s ease, transform 0.2s ease; }
.pip.is-on { background: var(--coral); transform: scale(1.15); }
.pips-foe .pip.is-on { background: var(--blue); }
.qcount { font-family: var(--mono); font-size: 11px; letter-spacing: 1.3px; color: var(--dim-on-ink); }

.flagcard {
  align-self: center;
  width: clamp(150px, 26vw, 214px);
  border-radius: var(--tile-radius);
  overflow: hidden;
  background: var(--paper-card);
  box-shadow: 0 10px 26px rgba(0,0,0,0.35);
}
.flagcard img { width: 100%; display: block; }

.answers {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 9px;
  width: min(100%, 470px);
  align-self: center;
}
.answer {
  --depth: var(--chip-depth);
  border-radius: var(--chip-radius);
  background: var(--ink-soft);
  color: var(--paper);
  font-size: 15px;
  font-weight: 600;
  padding: 13px 10px;
  width: 100%;
}
.answer-shell { border-radius: var(--chip-radius); background: #000; }
.answer.is-right { background: var(--green); color: #F6FFF7; }
.answer.is-wrong { background: var(--coral-dark); color: var(--coral-text); }
.answer:disabled { cursor: default; }

/* game over */
.over { align-items: center; justify-content: center; gap: 14px; }
.over h3 { font-family: var(--display); font-weight: 800; letter-spacing: -0.03em; font-size: clamp(34px, 6vw, 54px); margin: 0; color: var(--paper); }

/* ---------- sections ---------- */

section { padding-top: 108px; }
.head { display: flex; flex-direction: column; gap: 10px; margin-bottom: 34px; }
.head h2 { font-size: clamp(34px, 5vw, 52px); margin: 0; }

/* the shelf */
.shelf { display: grid; grid-template-columns: repeat(2, 1fr); gap: 18px; }
.cart-shell { border-radius: var(--card-radius); }
.cart {
  display: flex;
  border-radius: var(--card-radius);
  transform: translateY(calc(-1 * var(--card-depth)));
  transition: transform 0.16s ease;
}
.cart-shell:hover .cart { transform: translateY(calc(-1 * var(--card-depth) - 3px)); }
.cart-rail { display: flex; flex-direction: column; justify-content: center; align-items: center; gap: 7px; width: 26px; }
.cart-rail span { width: 4px; height: 12px; border-radius: 2px; background: rgba(255,255,255,0.5); }
.cart-face {
  flex-grow: 1;
  margin: 8px 8px 8px 0;
  padding: 22px 24px;
  border-radius: var(--tile-radius);
  background: var(--paper-card);
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.cart-face h3 { font-family: var(--display); font-weight: 800; letter-spacing: -0.03em; font-size: 30px; margin: 0; }
.cart-face p { margin: 0; font-size: 15px; color: var(--mono-label); }
.cart-foot { display: flex; align-items: center; justify-content: space-between; margin-top: 10px; }

/* versus */
.versus {
  border-radius: var(--card-radius);
  background: var(--ink);
  padding: clamp(34px, 5vw, 68px);
  display: grid;
  grid-template-columns: 1fr auto;
  gap: clamp(28px, 5vw, 64px);
  align-items: center;
}
.versus h2 { font-size: clamp(32px, 4.6vw, 56px); margin: 0; color: var(--paper); }
.versus p { margin: 0; font-size: 17px; line-height: 1.55; color: var(--dim-on-ink); max-width: 420px; text-wrap: pretty; }
.versus-copy {
  display: flex; flex-direction: column; gap: 16px;
  /* Not the default stretch. The button is a shell span wrapping an inline
     anchor, so a stretched shell paints its coral depth across the whole
     column while the anchor stays at its own width. */
  align-items: flex-start;
}
.phone {
  width: min(300px, 74vw);
  border-radius: 30px;
  overflow: hidden;
  background: #000;
  padding: 7px;
  box-shadow: 0 26px 60px rgba(0,0,0,0.5);
}
.phone img { width: 100%; display: block; border-radius: 24px; }

/* pieces */
.pieces { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; }
.piece {
  border-radius: var(--tile-radius);
  background: var(--paper-card);
  border: 1px solid var(--edge);
  padding: 18px 10px 14px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  transition: transform 0.18s ease;
}
.piece:hover { transform: translateY(-4px); }
.piece img { height: 118px; width: auto; display: block; }
.piece .caps { font-size: 10px; }
.piece-note { font-family: var(--mono); font-size: 9px; letter-spacing: 1.1px; text-transform: uppercase; color: var(--coral-dark); }

/* ---------- notify ---------- */

.notify {
  border-radius: var(--card-radius);
  background: var(--coral);
  padding: clamp(44px, 6vw, 72px) clamp(24px, 5vw, 56px);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
}
.notify .caps { color: var(--coral-text); opacity: 0.78; }
.notify h2 { font-size: clamp(38px, 6.4vw, 68px); margin: 0; text-align: center; color: var(--coral-text); }
.notify p { max-width: 480px; margin: 0; text-align: center; font-size: 18px; line-height: 1.5; color: var(--coral-text); opacity: 0.92; text-wrap: pretty; }

.notify-form { display: flex; gap: 10px; width: min(100%, 470px); margin-top: 4px; }
.field-shell { flex-grow: 1; border-radius: 16px; background: rgba(0,0,0,0.22); }
.field {
  width: 100%;
  border: 0;
  border-radius: 16px;
  background: var(--coral-text);
  color: var(--ink);
  font-family: var(--ui);
  font-size: 16px;
  padding: 18px 20px;
  transform: translateY(calc(-1 * var(--button-depth)));
}
.field::placeholder { color: #9AA0A8; }
.field:focus { outline: 2px solid var(--ink); outline-offset: -2px; }
/* The honeypot: a real person never sees it, so a filled one is a bot. */
.trap { position: absolute; left: -9999px; width: 1px; height: 1px; opacity: 0; }

.notify-note { font-family: var(--mono); font-size: 11px; letter-spacing: 1.1px; text-transform: uppercase; color: var(--coral-text); opacity: 0.75; text-align: center; min-height: 16px; }
.notify-note.is-bad { color: #4A0F0E; opacity: 1; }

/* ---------- footer ---------- */

footer { display: flex; align-items: center; justify-content: space-between; gap: 20px; flex-wrap: wrap; padding: 44px 0 52px; margin-top: 108px; }
footer a { text-decoration: none; }
footer a:hover { color: var(--ink); }
.foot-links { display: flex; gap: 24px; flex-wrap: wrap; }

/* ---------- narrow ---------- */

@media (max-width: 900px) {
  .nav-links { gap: 16px; }
  .nav-links .caps { display: none; }
  .shelf { grid-template-columns: 1fr; }
  .versus { grid-template-columns: 1fr; justify-items: center; text-align: center; }
  .versus p { max-width: none; }
  .versus-copy { align-items: center; }
  .pieces { grid-template-columns: repeat(2, 1fr); }
  /* Stacked, the shell would stretch to the form width while the button
     kept its own — so the button takes the width instead. */
  .notify-form { flex-direction: column; }
  .notify-form .btn { width: 100%; }
  section { padding-top: 78px; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  * { transition-duration: 0.01ms !important; }
}
