:root {
  --paper: #b7c9d8;
  --bg: #ffffff;
  --ink: #161616;
  --red: #b70e16;
  --card: #ffffff;
  --muted: #243848;
  --line: #161616;
  --stage: #e7eef3;
  color-scheme: light;
}

* { box-sizing: border-box; }

html { scrollbar-color: var(--ink) var(--paper); }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: Archivo, system-ui, sans-serif;
  font-weight: 500;
  line-height: 1.45;
  min-height: 100vh;
}

::selection { background: var(--red); color: #fff; }

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

button, input, select { font: inherit; color: inherit; }

h1, h2, h3 {
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1.05;
}

p { margin: 0; }

a { text-underline-offset: 0.18em; }

.wrap {
  width: min(1120px, calc(100% - 32px));
  margin-inline: auto;
}

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

.icon { width: 18px; height: 18px; display: block; }

.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  background: #fff;
  border-bottom: 1px solid var(--ink);
  min-height: 58px;
}

.bar {
  display: flex;
  align-items: center;
  gap: 18px 28px;
  min-height: 58px;
  padding: 8px 0;
}

.logo {
  display: flex;
  align-items: center;
  gap: 10px;
  color: inherit;
  text-decoration: none;
  font-weight: 800;
  letter-spacing: -0.03em;
  font-size: 1.15rem;
}

.nav-links {
  display: flex;
  flex: 1;
  flex-wrap: wrap;
  gap: 4px 18px;
}

.nav-links a {
  color: inherit;
  text-decoration: none;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  padding: 6px 0 8px;
  border-bottom: 2px solid transparent;
}

.nav-links a[aria-current="page"] { border-bottom-color: var(--red); }

.play-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 18px;
  padding: 28px 0 16px;
}

.play-head h1 {
  margin: 0;
  font-size: clamp(2rem, 4vw, 3.15rem);
  text-transform: uppercase;
}

.cadence {
  margin-top: 8px;
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.controls {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 12px;
  margin-bottom: 14px;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 0.7rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.field select, .pick select {
  text-transform: none;
  letter-spacing: 0;
  font-size: 1rem;
  font-weight: 700;
  background: #fff;
  border: 1px solid var(--ink);
  min-height: 42px;
  padding: 0 10px;
}

.seg { display: flex; }

.seg a {
  display: grid;
  place-items: center;
  min-height: 42px;
  padding: 0 14px;
  background: #fff;
  color: var(--ink);
  text-decoration: none;
  border: 1px solid var(--ink);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.seg a + a { margin-left: -1px; }
.seg a.on { background: var(--ink); color: #fff; }

.board {
  background: var(--card);
  border: 1px solid var(--ink);
}

.board-top, .board-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
}

.board-top { border-bottom: 1px solid var(--ink); }

.round-label {
  margin: 0;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  font-size: 0.92rem;
}

.weight-note {
  margin: 2px 0 0;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 700;
}

.pips {
  display: flex;
  gap: 4px;
  list-style: none;
  padding: 0;
  margin: 8px 0 0;
}

.pips li {
  width: 14px;
  height: 14px;
  border: 1px solid var(--ink);
}

.pips li[data-state="done"] { background: var(--ink); }
.pips li[data-state="now"] { background: var(--red); border-color: var(--red); }

.tools { display: flex; align-items: center; gap: 8px; }

.tools button, .tools .icon-link, .zoom button, .nudge button {
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  background: #fff;
  border: 1px solid var(--ink);
  cursor: pointer;
  color: inherit;
  text-decoration: none;
}

.tools button[aria-pressed="true"] { background: var(--ink); color: #fff; }
.tools button:disabled, .nudge button:disabled, .ruler input:disabled { opacity: 0.45; cursor: default; }

.tally {
  margin: 0 0 0 6px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.03em;
}

.prompt {
  margin: 0;
  padding: 16px 16px 4px;
  font-size: clamp(1.45rem, 3vw, 2.15rem);
  text-transform: uppercase;
}

.prompt em { font-style: normal; color: var(--red); }

.stage {
  position: relative;
  height: 460px;
  margin-top: 8px;
  background-color: var(--stage);
  background-image:
    linear-gradient(to right, rgba(22, 22, 22, 0.07) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(22, 22, 22, 0.07) 1px, transparent 1px);
  background-size: 32px 32px;
  border-top: 1px solid var(--ink);
  border-bottom: 1px solid var(--ink);
  overflow: hidden;
  touch-action: none;
  cursor: ew-resize;
  user-select: none;
}

.stage.is-locked { cursor: default; }

.stage::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 36px;
  height: 1px;
  background: var(--ink);
  pointer-events: none;
}

.zoom {
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 3;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.piece {
  position: absolute;
  bottom: 37px;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  max-width: none;
}

.tag {
  margin-bottom: 6px;
  background: #fff;
  border: 1px solid var(--ink);
  padding: 4px 6px;
  font-size: 0.72rem;
  line-height: 1.25;
  max-width: 230px;
}

.tag strong {
  display: block;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.tag .true { color: var(--red); font-weight: 800; display: block; }

.stack { position: relative; }

.mark { display: block; }
.mark path { fill: currentColor; }
.mark.ref { color: var(--ink); }
.mark.guess path {
  fill: #fff;
  stroke: var(--ink);
  stroke-width: 1.75px;
  vector-effect: non-scaling-stroke;
}
.mark.truth {
  position: absolute;
  left: 0;
  bottom: 0;
  color: transparent;
  animation: pen 0.65s cubic-bezier(0.16, 1, 0.3, 1) both;
}
.mark.truth path {
  fill: rgba(183, 14, 22, 0.16);
  stroke: var(--red);
  stroke-width: 2.5px;
  vector-effect: non-scaling-stroke;
}

@keyframes pen {
  from { clip-path: inset(0 100% 0 0); }
  to { clip-path: inset(0 0 0 0); }
}

.grip {
  position: absolute;
  width: 12px;
  height: 12px;
  background: #fff;
  border: 2px solid var(--ink);
  z-index: 2;
}
.grip-x { right: -7px; top: 50%; margin-top: -7px; }
.grip-y { top: -7px; left: 50%; margin-left: -7px; }

.board-bar {
  display: grid;
  grid-template-columns: auto minmax(120px, 1fr) minmax(0, 1.3fr) auto;
  gap: 10px 14px;
  align-items: center;
}

.nudge { display: flex; gap: 6px; }

.ruler { min-width: 0; }

.scale {
  position: relative;
  height: 22px;
  margin: 0 8px 5px;
  pointer-events: none;
}

.tick {
  position: absolute;
  bottom: 0;
  width: 1px;
  height: 5px;
  background: var(--ink);
}

.tick.major { height: 9px; }

.tick > span {
  position: absolute;
  bottom: 12px;
  left: 0;
  transform: translateX(-50%);
  font-size: 0.68rem;
  font-weight: 700;
  line-height: 1;
  letter-spacing: 0;
  font-variant-numeric: tabular-nums;
  color: var(--ink);
  white-space: nowrap;
}

.ruler input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 2px;
  background: var(--ink);
  border-radius: 0;
  cursor: pointer;
}

.ruler input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 16px;
  height: 22px;
  background: var(--red);
  border: 0;
  border-radius: 1px;
}

.ruler input[type="range"]::-moz-range-thumb {
  width: 16px;
  height: 22px;
  background: var(--red);
  border: 0;
  border-radius: 1px;
}

.hint { margin: 0; color: var(--muted); font-size: 0.92rem; }

.lock, .text-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 48px;
  padding: 0 16px;
  background: var(--ink);
  color: #fff;
  border: 1px solid var(--ink);
  text-decoration: none;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  cursor: pointer;
}

.lock:hover, .text-btn:hover { background: var(--red); border-color: var(--red); }

.fact {
  margin: 0;
  padding: 0 16px 14px;
  color: var(--muted);
  max-width: 70ch;
}

.total {
  margin: 8px 0;
  font-size: clamp(2.6rem, 6vw, 4rem);
  font-weight: 800;
  letter-spacing: -0.04em;
  font-variant-numeric: tabular-nums;
}

.recap { list-style: none; padding: 0; margin: 8px 0 18px; }

.recap li, .answer-row {
  display: grid;
  grid-template-columns: 1.3fr 1fr 1fr auto;
  gap: 8px 12px;
  align-items: baseline;
  padding: 10px 0;
  border-top: 1px solid var(--ink);
}

.actions { display: flex; flex-wrap: wrap; gap: 10px; }

.preparing { padding: 48px 0; font-weight: 800; letter-spacing: 0.04em; text-transform: uppercase; }

.story { padding-bottom: 12px; }
.story section { margin-top: 64px; }
.story h2 { margin: 0 0 16px; font-size: clamp(1.7rem, 3vw, 2.35rem); }
.story p, .sheet p, .faq p { max-width: 68ch; }
.story p + p { margin-top: 12px; }

.steps-3, .mode-grid, .surprise {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 22px 28px;
}

.steps-3 article, .mode-grid article, .surprise article {
  border-top: 1px solid var(--ink);
  padding-top: 12px;
}

.steps-3 h3, .mode-grid h3, .surprise h3 { margin: 0 0 8px; font-size: 1.2rem; }
.kicker-num { font-variant-numeric: tabular-nums; color: var(--red); }

.mode-grid a, .cat-list a, .site-footer a { color: inherit; }

.faq details { border-top: 1px solid var(--ink); }
.faq details:last-child { border-bottom: 1px solid var(--ink); }
.faq summary { cursor: pointer; font-weight: 800; padding: 14px 0; }
.faq details p { padding-bottom: 14px; }

.sheet { padding: 36px 0 8px; }
.sheet h1 {
  margin: 0 0 12px;
  font-size: clamp(2rem, 4vw, 3rem);
  text-transform: uppercase;
}
.kicker { margin: 0 0 10px; font-weight: 800; letter-spacing: 0.02em; }
.note-more { margin: 0; padding-left: 1.15rem; }
.note-more li { margin: 8px 0; }
.lead { font-size: 1.05rem; margin-bottom: 18px; }

.cat-list, .day-list { list-style: none; padding: 0; margin: 20px 0 0; }
.cat-list li {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  border-top: 1px solid var(--ink);
  padding: 14px 0;
}
.cat-list h2 { margin: 0 0 4px; font-size: 1.35rem; }
.cat-list a, .text-link {
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  text-decoration: none;
  border-bottom: 2px solid var(--red);
}

.pick { display: flex; flex-wrap: wrap; gap: 12px; margin: 8px 0 14px; align-items: flex-end; }
.pick label { display: flex; flex-direction: column; gap: 4px; font-weight: 800; font-size: 0.75rem; letter-spacing: 0.06em; text-transform: uppercase; }

.ratio-line { font-size: clamp(1.4rem, 3vw, 2rem); font-weight: 800; letter-spacing: -0.03em; margin: 8px 0 14px; }

.day { border-top: 1px solid var(--ink); }
.day summary { cursor: pointer; font-weight: 800; padding: 12px 0; }
.day .answer-row { font-size: 0.95rem; }
.ghost {
  background: #fff;
  border: 1px solid var(--ink);
  min-height: 42px;
  padding: 0 12px;
  font-weight: 800;
  cursor: pointer;
}

.site-footer { border-top: 1px solid var(--ink); margin-top: 72px; }
.foot-grid {
  display: grid;
  grid-template-columns: 1.4fr 0.8fr 0.8fr 0.9fr;
  gap: 28px;
  padding: 28px 0 40px;
}
.site-footer h2 { margin: 0 0 10px; font-size: 0.78rem; letter-spacing: 0.08em; text-transform: uppercase; }
.site-footer ul { list-style: none; padding: 0; margin: 0; }
.site-footer li + li { margin-top: 6px; }
.note { color: var(--muted); max-width: 42ch; }
.rights { margin-top: 16px; font-weight: 700; }

@media (max-width: 860px) {
  .bar { flex-wrap: wrap; gap: 8px 12px; }
  .nav-links {
    order: 3;
    width: 100%;
    flex-wrap: nowrap;
    overflow-x: auto;
    gap: 16px;
    padding-bottom: 4px;
  }
  .nav-links a { white-space: nowrap; }
  .play-head { align-items: flex-start; padding: 16px 0 10px; }
  .play-head h1 { font-size: 1.7rem; }
  .controls { flex-direction: column; align-items: stretch; }
  .seg { width: 100%; }
  .seg a { flex: 1; }
  .board-top { flex-wrap: wrap; align-items: flex-start; }
  .tools { width: 100%; justify-content: flex-start; }
  .tally { margin-left: auto; }
  .steps-3, .mode-grid, .surprise, .foot-grid { grid-template-columns: 1fr; }
  .stage { height: 280px; }
  .board-bar { grid-template-columns: auto 1fr; }
  .hint, .lock { grid-column: 1 / -1; }
  .recap li, .answer-row { grid-template-columns: 1fr 1fr; }
}

@media (prefers-reduced-motion: reduce) {
  .mark.truth { animation: none; }
}

/* Credits and data links */
.data-link {
  color: inherit;
  text-decoration: underline;
  text-decoration-thickness: 1.5px;
  text-underline-offset: 0.18em;
  font-weight: 600;
}
.data-link:hover {
  color: var(--red);
}
.credits-jump {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 20px 0 32px;
}
.credits-jump a {
  display: inline-block;
  padding: 6px 12px;
  border: 1px solid var(--ink);
  font-size: 0.82rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  background: var(--bg);
  color: var(--ink);
  text-decoration: none;
}
.credits-jump a:hover {
  background: var(--ink);
  color: var(--bg);
}
.credits-group {
  margin-top: 48px;
}
.credits-group h2 {
  font-size: clamp(1.4rem, 2.5vw, 1.8rem);
  border-bottom: 2px solid var(--ink);
  padding-bottom: 8px;
  margin-bottom: 16px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.credits-list {
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.credit-card {
  border: 1px solid var(--ink);
  padding: 16px 20px;
  background: var(--bg);
  scroll-margin-top: 80px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px 24px;
}
.credit-card:target {
  outline: 3px solid var(--red);
  background: #fff8f8;
}
.credit-card-head {
  grid-column: 1 / -1;
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  border-bottom: 1px dashed var(--muted);
  padding-bottom: 8px;
  flex-wrap: wrap;
  gap: 8px;
}
.credit-card-title {
  margin: 0;
  font-size: 1.15rem;
  font-weight: 700;
}
.credit-anchor-id {
  font-family: monospace;
  font-size: 0.78rem;
  color: var(--muted);
}
.credit-measure-val {
  font-size: 1.25rem;
  font-weight: 800;
  color: var(--red);
}
.credit-axis-badge {
  display: inline-block;
  margin-left: 8px;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 700;
  padding: 2px 6px;
  border: 1px solid var(--ink);
  vertical-align: middle;
}
.credit-note {
  font-size: 0.92rem;
  color: var(--ink);
  margin: 4px 0 0;
  grid-column: 1 / -1;
}
.credit-source {
  grid-column: 1 / -1;
  font-size: 0.88rem;
  margin-top: 4px;
}
.credit-source a {
  font-weight: 700;
  text-decoration: underline;
  color: var(--ink);
}
.credit-source a:hover {
  color: var(--red);
}
@media (max-width: 640px) {
  .credit-card { grid-template-columns: 1fr; }
}
