/* Layout: a card table. Three role buttons sit in a row, the drawn card lands
   beneath them, and the rulebook follows. One accent colour (cobalt).
   Yellow and red appear only as the referee's penalty cards. */
:root {
  --bg: #F4F5F9;
  --surface: #FFFFFF;
  --ink: #14161F;
  --muted: #383D50;
  --line: #DADDE6;
  --edge: #6B7185;
  --accent: #2838C8;
  --accent-ink: #FFFFFF;
  --accent-soft: #E6E9FD;
  --shadow: 0 1px 2px rgba(20, 22, 31, 0.06), 0 8px 24px rgba(20, 22, 31, 0.06);

  /* Penalty cards: the same in both themes, like the real thing */
  --yellow: #FFD13B;
  --yellow-ink: #17140A;
  --red: #B01029;
  --red-ink: #FFFFFF;

  --font-display: "Archivo", "Arial Narrow", "Helvetica Neue", Arial, sans-serif;
  --font-body: "Atkinson Hyperlegible", Verdana, "Segoe UI", Arial, sans-serif;

  --step--1: 0.9375rem;
  --step-0: 1.125rem;
  --step-1: 1.3125rem;
  --step-2: clamp(1.5rem, 1.2rem + 1.2vw, 1.875rem);
  --step-3: clamp(1.75rem, 1.3rem + 2vw, 2.5rem);
  --step-4: clamp(2.375rem, 1.5rem + 4.4vw, 4.25rem);

  --radius: 14px;
  --gutter: clamp(16px, 4vw, 40px);
  --measure: 64ch;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0E1016;
    --surface: #171A23;
    --ink: #ECEEF5;
    --muted: #C4C8D8;
    --line: #2A2F3D;
    --edge: #7A819A;
    --accent: #A3AEFF;
    --accent-ink: #0E1016;
    --accent-soft: #1D2244;
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.4), 0 8px 24px rgba(0, 0, 0, 0.3);
    color-scheme: dark;
  }
}

:root[data-theme="dark"] {
  --bg: #0E1016;
  --surface: #171A23;
  --ink: #ECEEF5;
  --muted: #C4C8D8;
  --line: #2A2F3D;
  --edge: #7A819A;
  --accent: #A3AEFF;
  --accent-ink: #0E1016;
  --accent-soft: #1D2244;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.4), 0 8px 24px rgba(0, 0, 0, 0.3);
  color-scheme: dark;
}

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

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: var(--step-0);
  line-height: 1.55;
  overflow-wrap: break-word;
}

[hidden] { display: none !important; }

h1, h2, h3, h4 {
  font-family: var(--font-display);
  line-height: 1.1;
  text-wrap: balance;
  margin: 0;
}

p, ul, ol, dl, blockquote, figure { margin: 0; }

a { color: var(--accent); text-underline-offset: 0.18em; text-decoration-thickness: 0.08em; }
a:hover { text-decoration-thickness: 0.14em; }

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

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

.skip {
  position: absolute;
  left: var(--gutter);
  top: -100px;
  background: var(--accent);
  color: var(--accent-ink);
  padding: 0.6rem 1rem;
  border-radius: 8px;
  font-weight: 700;
  z-index: 10;
}
.skip:focus { top: 12px; }

.wrap {
  width: 100%;
  max-width: 68rem;
  margin-inline: auto;
  padding-inline: var(--gutter);
}

/* ---------- Masthead ---------- */
.masthead {
  padding-block: clamp(28px, 6vw, 64px) 24px;
  display: grid;
  gap: 14px;
}
.masthead > * { min-width: 0; }

.eyebrow {
  font-family: var(--font-display);
  font-variation-settings: "wdth" 112;
  font-weight: 700;
  font-size: var(--step--1);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

.masthead h1 {
  font-size: var(--step-4);
  font-weight: 850;
  font-variation-settings: "wdth" 118;
  letter-spacing: -0.015em;
  line-height: 0.98;
  max-width: 14ch;
  hyphens: auto;
  overflow-wrap: anywhere;
}

.lede {
  font-size: var(--step-1);
  max-width: 46ch;
  color: var(--ink);
}

/* ---------- Role buttons ---------- */
.picker { padding-block: 8px 8px; }

.roles {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 15rem), 1fr));
  gap: 14px;
}

.role {
  appearance: none;
  font: inherit;
  color: var(--ink);
  background: var(--surface);
  border: 2px solid var(--edge);
  border-radius: var(--radius);
  padding: 18px 20px 20px;
  min-height: 9rem;
  text-align: left;
  cursor: pointer;
  display: grid;
  grid-template-rows: auto 1fr auto;
  gap: 10px;
  box-shadow: var(--shadow);
  transition: transform 160ms ease, border-color 160ms ease, background-color 160ms ease;
}

.role:hover { border-color: var(--accent); transform: translateY(-2px); }

.role-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.role svg { width: 36px; height: 36px; flex: none; }

.role-name {
  font-family: var(--font-display);
  font-weight: 800;
  font-variation-settings: "wdth" 102;
  font-size: clamp(1.375rem, 1.1rem + 0.8vw, 1.625rem);
  line-height: 1.05;
  align-self: end;
}

.role-hint { color: var(--muted); font-size: var(--step--1); }

.role-state {
  display: none;
  font-family: var(--font-display);
  font-weight: 700;
  font-variation-settings: "wdth" 110;
  font-size: 0.8125rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  border: 2px solid currentColor;
  border-radius: 999px;
  padding: 2px 10px;
}

.role[aria-pressed="true"] {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-ink);
}
.role[aria-pressed="true"] .role-hint { color: var(--accent-ink); }
.role[aria-pressed="true"] .role-state { display: inline-block; }

.picker-note {
  margin-top: 12px;
  color: var(--muted);
  font-size: var(--step--1);
}

/* ---------- Shared bits ---------- */
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: clamp(20px, 4vw, 36px);
  display: grid;
  align-content: start;
  gap: 18px;
  min-width: 0;
}

.stage { padding-block: 22px 8px; }
.stage .card { animation: rise 260ms ease-out; }

@keyframes rise {
  from { transform: translateY(10px); }
  to { transform: none; }
}

.label {
  font-family: var(--font-display);
  font-weight: 700;
  font-variation-settings: "wdth" 110;
  font-size: 0.8125rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

.chip {
  display: inline-block;
  font-family: var(--font-display);
  font-weight: 700;
  font-variation-settings: "wdth" 110;
  font-size: 0.875rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--accent);
  background: var(--accent-soft);
  border-radius: 999px;
  padding: 4px 12px;
}

.meta { color: var(--muted); font-size: var(--step--1); }

.btn {
  appearance: none;
  font: inherit;
  font-family: var(--font-display);
  font-weight: 700;
  font-variation-settings: "wdth" 105;
  font-size: 1.0625rem;
  line-height: 1.2;
  border-radius: 10px;
  padding: 12px 18px;
  min-height: 48px;
  cursor: pointer;
  border: 2px solid var(--accent);
  background: var(--accent);
  color: var(--accent-ink);
}
.btn:hover { filter: brightness(1.08); }

.btn-quiet {
  background: transparent;
  color: var(--accent);
}
.btn-quiet:hover { background: var(--accent-soft); filter: none; }

.actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px 18px;
}

.count { color: var(--muted); font-size: var(--step--1); font-variant-numeric: tabular-nums; }

/* ---------- News card ---------- */
.news-card { max-width: 48rem; }

.card-top {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 14px;
}

.news-card h2 {
  font-size: var(--step-3);
  font-weight: 800;
  font-variation-settings: "wdth" 100;
  letter-spacing: -0.01em;
}

.news-card h2:focus { outline: none; }
.news-card h2:focus-visible { outline: 3px solid var(--accent); outline-offset: 4px; }

.snapshot {
  font-size: var(--step-1);
  line-height: 1.55;
  max-width: var(--measure);
}

.source { font-size: var(--step--1); color: var(--muted); }
.source a { font-weight: 700; }

.brief {
  border-top: 1px solid var(--line);
  padding-top: 16px;
  display: grid;
  gap: 10px;
}

.flow {
  list-style: none;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  counter-reset: flow;
}

.flow li {
  counter-increment: flow;
  font-family: var(--font-display);
  font-weight: 800;
  font-variation-settings: "wdth" 108;
  font-size: var(--step-1);
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.flow li::before {
  content: counter(flow);
  display: inline-grid;
  place-items: center;
  width: 1.6em; height: 1.6em;
  border-radius: 50%;
  background: var(--accent);
  color: var(--accent-ink);
  font-size: 0.8em;
}


/* ---------- Character card ----------
   Phone first: the public top, the opening line and the hidden side
   (once shown) fit on one phone screen, so the character can see how
   to react without scrolling. */
.char-card { max-width: 48rem; gap: 14px; }

.char-head { display: grid; gap: 6px; }

.char-card h2 {
  font-size: var(--step-3);
  font-weight: 850;
  font-variation-settings: "wdth" 115;
  letter-spacing: -0.015em;
  line-height: 1;
}
.char-card h2:focus { outline: none; }
.char-card h2:focus-visible { outline: 3px solid var(--accent); outline-offset: 4px; }

.char-role {
  font-size: var(--step-0);
  font-weight: 700;
}

.tagline { max-width: var(--measure); color: var(--muted); font-size: var(--step--1); line-height: 1.45; }
.never { color: var(--ink); }

.scene {
  border-left: 4px solid var(--accent);
  padding: 2px 0 2px 12px;
  line-height: 1.4;
}
.scene .label { display: block; }

.opening { margin: 0; display: grid; gap: 6px; }

.quote {
  margin: 0;
  position: relative;
  padding-left: 2rem;
  font-size: clamp(1.25rem, 1.1rem + 0.6vw, 1.625rem);
  font-family: var(--font-display);
  font-weight: 600;
  font-variation-settings: "wdth" 95;
  line-height: 1.2;
}
.quote::before {
  content: "\201C";
  position: absolute;
  left: 0;
  top: -0.14em;
  font-size: 2.75rem;
  line-height: 1;
  font-weight: 900;
  color: var(--accent);
}

.secret {
  border: 2px dashed var(--edge);
  border-radius: var(--radius);
  padding: 12px;
  display: grid;
  gap: 12px;
}

.secret-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 16px;
}

.secret-head .btn { display: inline-flex; align-items: center; gap: 8px; }
.secret-head svg { width: 20px; height: 20px; }

.secret-note { color: var(--muted); font-size: var(--step--1); flex: 1 1 14rem; line-height: 1.4; }

/* The hidden side: climate view, time, wallet, reach, triggers, door openers */
.hidden-side { display: grid; gap: 14px; min-width: 0; }

.view { display: grid; gap: 4px; }
.view-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 10px; }
.view-name {
  font-family: var(--font-display);
  font-weight: 850;
  font-variation-settings: "wdth" 108;
  font-size: var(--step-1);
}
.view-scale { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 4px; }
.view-scale span { height: 10px; border-radius: 3px; border: 2px solid var(--edge); }
.view-scale span.on { background: var(--accent); border-color: var(--accent); height: 10px; }
.view-ends {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  color: var(--muted);
  font-size: 0.8125rem;
}
.view-play { font-size: var(--step--1); line-height: 1.4; }
.view-tip { font-size: var(--step--1); line-height: 1.4; color: var(--muted); }

.stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, max-content));
  gap: 6px 22px;
}
.stat { display: grid; gap: 2px; min-width: 0; }
.stat dt {
  font-family: var(--font-display);
  font-weight: 800;
  font-variation-settings: "wdth" 108;
  font-size: var(--step--1);
  line-height: 1.2;
}
.stat dd { margin: 0; display: flex; align-items: center; }

.pips { display: inline-flex; flex-wrap: wrap; gap: 3px; }
.pip {
  width: 13px; height: 13px;
  border-radius: 3px;
  border: 2px solid var(--edge);
}
.pip.on { background: var(--accent); border-color: var(--accent); }

.secret-cols {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 15rem), 1fr));
  gap: 10px 24px;
}

.col-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 0 10px; margin-bottom: 2px; }
.col-head h3 {
  font-size: var(--step-0);
  font-weight: 800;
  font-variation-settings: "wdth" 108;
}

.secret-cols ul { padding-left: 1.2em; display: grid; gap: 2px; line-height: 1.35; }
.secret-cols .hint { color: var(--muted); font-size: var(--step--1); line-height: 1.4; }

/* ---------- Referee kit ---------- */
.ref-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 16px;
}
@media (min-width: 760px) {
  .ref-grid { grid-template-columns: minmax(0, 1fr) minmax(0, 1.35fr); }
}

.ref-grid h2 {
  font-size: var(--step-2);
  font-weight: 800;
  font-variation-settings: "wdth" 110;
}
.ref-grid h2:focus { outline: none; }
.ref-grid h2:focus-visible { outline: 3px solid var(--accent); outline-offset: 4px; }

.ref-verdict { grid-column: 1 / -1; }

/* ---------- Referee: character lookup ---------- */
.ref-char { grid-column: 1 / -1; gap: 12px; }

.field { display: grid; gap: 6px; max-width: 30rem; }
.field label { font-weight: 700; }
.field input {
  font: inherit;
  font-size: var(--step-0);
  color: var(--ink);
  background: var(--surface);
  border: 2px solid var(--edge);
  border-radius: 10px;
  padding: 10px 14px;
  min-height: 48px;
  width: 100%;
  min-width: 0;
}
.field input:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }

.match-list { list-style: none; padding: 0; display: grid; gap: 8px; max-width: 30rem; }
.match {
  appearance: none;
  font: inherit;
  color: var(--ink);
  background: var(--surface);
  border: 2px solid var(--edge);
  border-radius: 10px;
  width: 100%;
  min-height: 48px;
  padding: 8px 14px;
  text-align: left;
  cursor: pointer;
  display: grid;
  gap: 2px;
}
.match:hover { border-color: var(--accent); }
.match-name { font-family: var(--font-display); font-weight: 800; }
.match-where { color: var(--muted); font-size: var(--step--1); line-height: 1.3; }

.ref-char-body {
  display: grid;
  gap: 12px;
  border-top: 1px solid var(--line);
  padding-top: 14px;
}
.ref-who { display: grid; gap: 2px; }
.ref-who h3 {
  font-size: var(--step-2);
  font-weight: 850;
  font-variation-settings: "wdth" 110;
}
.ref-who h3:focus { outline: none; }
.ref-who h3:focus-visible { outline: 3px solid var(--accent); outline-offset: 4px; }
@media (min-width: 760px) {
  .ref-char-body .hidden-side { grid-template-columns: minmax(0, 1fr) minmax(0, 1.4fr); gap: 16px 32px; align-items: start; }
  .ref-char-body .view, .ref-char-body .stats { grid-column: 1; }
  .ref-char-body .secret-cols { grid-column: 2; grid-row: 1 / span 2; }
}

.clock {
  font-family: var(--font-display);
  font-weight: 800;
  font-variation-settings: "wdth" 125;
  font-variant-numeric: tabular-nums;
  font-size: clamp(4rem, 2.5rem + 8vw, 6.5rem);
  line-height: 1;
  letter-spacing: -0.02em;
}

.clock.done { color: var(--accent); }

.clock-note { color: var(--muted); font-size: var(--step--1); }

.pen-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.pen {
  appearance: none;
  font: inherit;
  font-family: var(--font-display);
  font-weight: 800;
  font-variation-settings: "wdth" 110;
  font-size: var(--step-1);
  min-height: 6.5rem;
  border-radius: 12px;
  border: 0;
  box-shadow: 0 0 0 2px var(--edge);
  cursor: pointer;
  display: grid;
  place-items: center;
  gap: 6px;
  padding: 12px;
}
.pen:hover { filter: brightness(1.05); }
.pen svg { width: 26px; height: 34px; }

.pen-yellow { background: var(--yellow); color: var(--yellow-ink); }
.pen-red { background: var(--red); color: var(--red-ink); }

.tally { font-variant-numeric: tabular-nums; }

.offences {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 12rem), 1fr));
  gap: 12px 20px;
  font-size: var(--step--1);
}
.offences ul { padding-left: 1.1em; display: grid; gap: 2px; }

.verdict-form {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 14rem), 1fr));
  gap: 16px 24px;
}

fieldset {
  border: 0;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 8px;
  min-width: 0;
}

legend {
  font-family: var(--font-display);
  font-weight: 800;
  font-variation-settings: "wdth" 108;
  margin-bottom: 8px;
  padding: 0;
}

.check {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  cursor: pointer;
}

.check input {
  width: 22px; height: 22px;
  margin: 0;
  accent-color: var(--accent);
  flex: none;
}

.verdict-result {
  font-family: var(--font-display);
  font-weight: 800;
  font-variation-settings: "wdth" 105;
  font-size: var(--step-1);
  background: var(--accent-soft);
  color: var(--ink);
  border-radius: 10px;
  padding: 14px 16px;
}

/* ---------- Score ---------- */
.ref-score { grid-column: 1 / -1; }

.score-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }

.score-total {
  font-family: var(--font-display);
  font-weight: 900;
  font-variation-settings: "wdth" 125;
  font-variant-numeric: tabular-nums;
  font-size: clamp(3rem, 2rem + 6vw, 4.5rem);
  line-height: 1;
  color: var(--accent);
}

.score-groups {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 18rem), 1fr));
  gap: 16px 24px;
}
.score-groups > div { display: grid; gap: 8px; align-content: start; }

.tick-list { display: grid; gap: 8px; }

.tick {
  appearance: none;
  font: inherit;
  color: var(--ink);
  background: var(--surface);
  border: 2px solid var(--edge);
  border-radius: 12px;
  min-height: 56px;
  padding: 10px 14px;
  display: grid;
  grid-template-columns: 2.6rem minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  text-align: left;
  cursor: pointer;
  touch-action: manipulation;
}
.tick:active { transform: scale(0.98); }
.tick-sign {
  font-family: var(--font-display);
  font-weight: 900;
  font-size: var(--step-1);
  font-variant-numeric: tabular-nums;
}
.tick-plus .tick-sign { color: var(--accent); }
.tick-minus { border-style: dashed; }
.tick-name { line-height: 1.3; }
.tick-count {
  font-family: var(--font-display);
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  min-width: 2.2rem;
  text-align: center;
  border-radius: 999px;
  padding: 2px 8px;
  background: var(--accent-soft);
  color: var(--ink);
}
.tick.bump { animation: bump 220ms ease-out; }
@keyframes bump { 50% { transform: scale(1.03); } }

.btn:disabled { opacity: 0.55; cursor: not-allowed; }

/* ---------- Worked example and resources ---------- */
.fold {
  border: 2px solid var(--edge);
  border-radius: var(--radius);
  background: var(--surface);
}
.fold > summary {
  cursor: pointer;
  list-style: none;
  padding: 16px 20px;
  min-height: 56px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  font-family: var(--font-display);
  font-weight: 800;
  font-variation-settings: "wdth" 108;
  font-size: var(--step-1);
}
.fold > summary::-webkit-details-marker { display: none; }
.fold > summary::after {
  content: "+";
  font-size: 1.6rem;
  line-height: 1;
  color: var(--accent);
  flex: none;
}
.fold[open] > summary::after { content: "\2212"; }
.fold > summary:focus-visible { outline-offset: -3px; border-radius: var(--radius); }

.fold-body {
  padding: 4px 20px 22px;
  display: grid;
  gap: 14px;
  max-width: 46rem;
}

.setup {
  display: grid;
  grid-template-columns: max-content minmax(0, 1fr);
  gap: 6px 16px;
}
.setup dt { font-family: var(--font-display); font-weight: 800; }
.setup dd { margin: 0; }

.ex-step {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: var(--step-1);
  font-weight: 800;
  margin-top: 8px;
}
.ex-step span {
  display: inline-grid;
  place-items: center;
  width: 1.7em; height: 1.7em;
  border-radius: 50%;
  background: var(--accent);
  color: var(--accent-ink);
  font-size: 0.85em;
}

.line {
  border-radius: 14px;
  padding: 10px 14px;
  max-width: 34rem;
  display: grid;
  gap: 2px;
}
.line .who {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 0.8125rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}
.line-msg { background: var(--accent-soft); justify-self: start; }
.line-char { border: 1px solid var(--line); justify-self: end; }

.why-note { color: var(--muted); font-size: var(--step--1); }
.why-note strong { color: var(--ink); }

.resource-list { list-style: none; padding: 0; display: grid; gap: 16px; }
.resource-list li { display: grid; gap: 2px; }
.resource-list a { font-weight: 700; }
.resource-list span:not(.visually-hidden) { color: var(--muted); font-size: var(--step--1); }

/* ---------- Celebration ---------- */
.celebrate {
  border: 0;
  padding: 0;
  margin: 0;
  width: 100%;
  max-width: 100%;
  height: 100%;
  max-height: 100%;
  background: var(--accent);
  color: var(--accent-ink);
  overflow: hidden auto;
}
.celebrate::backdrop { background: rgba(0, 0, 0, 0.6); }
.confetti { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.celebrate-inner {
  position: relative;
  min-height: 100%;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  align-content: center;
  justify-items: start;
  gap: 18px;
  padding: max(24px, env(safe-area-inset-top, 0px)) var(--gutter) max(24px, env(safe-area-inset-bottom, 0px));
  max-width: 52rem;
  margin-inline: auto;
  container-type: inline-size;
}
.celebrate-inner > * { max-width: 100%; min-width: 0; }

/* End-of-round titles fill the column but never split a word. The longest,
   MESSENGER, is about 6.9em wide, so 13.5cqi leaves room to spare. The first
   font-size is for browsers without container units. The vh cap keeps the
   whole screen in view on a short laptop. */
.celebrate h2, .pewpew h2 {
  font-size: min(4.5rem, 11vw, 12vh);
  font-size: min(7rem, 13.5cqi, 12vh);
  font-weight: 900;
  font-variation-settings: "wdth" 100;
  line-height: 0.9;
  letter-spacing: -0.02em;
  text-transform: uppercase;
}
.celebrate .celebrate-close { background: var(--accent-ink); color: var(--accent); }
.celebrate .celebrate-close:focus-visible { outline: 3px solid var(--accent-ink); outline-offset: 4px; }
.celebrate[open] h2 { animation: pop 500ms cubic-bezier(.2, 1.6, .4, 1); }
@keyframes pop { from { transform: scale(0.6); } to { transform: none; } }

/* ---------- Pew pew (no win) ---------- */
.pewpew {
  border: 0;
  padding: 0;
  margin: 0;
  width: 100%;
  max-width: 100%;
  height: 100%;
  max-height: 100%;
  background: var(--bg);
  color: var(--ink);
}
.pewpew::backdrop { background: rgba(0, 0, 0, 0.6); }
.pewpew .pewpew-close { background: var(--ink); color: var(--bg); }
.pewpew .pewpew-close:focus-visible { outline: 3px solid var(--ink); outline-offset: 4px; }

/* The pigeons. Their animations are SVG <animate> elements, started by app.js. */
.pigeon { --pigeon-line: var(--ink); width: min(100%, 300px, 32vh); height: auto; overflow: visible; }
.pigeon-happy { --pigeon-line: #14161F; }
.pigeon .bird { fill: #A9AEC0; stroke: var(--pigeon-line); stroke-width: 3; }
.pigeon .wing { fill: #8C92A8; stroke: var(--pigeon-line); stroke-width: 3; stroke-linejoin: round; }
.pigeon .beak { fill: #FFD13B; stroke: var(--pigeon-line); stroke-width: 3; stroke-linejoin: round; }
.pigeon .eye, .pigeon .feet, .pigeon .letter-flap, .pigeon .line { fill: none; stroke: var(--pigeon-line); stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; }
.pigeon .pupil { fill: var(--pigeon-line); }
.pigeon .letter { fill: #FFFFFF; stroke: var(--pigeon-line); stroke-width: 3; }
.pigeon .dart rect, .pigeon .dart path { fill: var(--accent); stroke: var(--pigeon-line); stroke-width: 2; }
.pigeon .dart .cup { fill: var(--pigeon-line); }
.pigeon .stars path, .pigeon .sparkles path { fill: #FFD13B; stroke: var(--pigeon-line); stroke-width: 1.5; stroke-linejoin: round; }
.pigeon .burst path { fill: none; stroke: var(--accent); stroke-width: 3; stroke-linecap: round; }
.pigeon .shadow { fill: var(--pigeon-line); opacity: 0.25; }
.pigeon .pew {
  font-family: var(--font-display);
  font-weight: 900;
  font-size: 30px;
  fill: var(--accent);
}
.pigeon .pew-small { font-size: 20px; }

/* ---------- Penalty overlay ---------- */
.penalty {
  border: 0;
  padding: 0;
  margin: 0;
  width: 100%;
  max-width: 100%;
  height: 100%;
  max-height: 100%;
  background: var(--yellow);
  color: var(--yellow-ink);
}
.penalty::backdrop { background: rgba(0, 0, 0, 0.6); }
.penalty.is-red { background: var(--red); color: var(--red-ink); }

.penalty-inner {
  min-height: 100%;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  align-content: center;
  justify-items: start;
  gap: 18px;
  padding: max(24px, env(safe-area-inset-top, 0px)) var(--gutter) max(24px, env(safe-area-inset-bottom, 0px));
  max-width: 52rem;
  margin-inline: auto;
  container-type: inline-size;
}

.penalty-kicker {
  font-family: var(--font-display);
  font-weight: 800;
  font-variation-settings: "wdth" 112;
  font-size: var(--step-1);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.penalty-inner > * { max-width: 100%; min-width: 0; }
/* YELLOW is about 5.4em wide, so 16cqi always fits */
.penalty h2 {
  font-size: min(5.5rem, 13vw, 20vh);
  font-size: min(9rem, 16cqi, 20vh);
  font-weight: 900;
  font-variation-settings: "wdth" 125;
  line-height: 0.9;
  letter-spacing: -0.02em;
  text-transform: uppercase;
}

.penalty-text { font-size: var(--step-2); font-weight: 700; max-width: 30ch; line-height: 1.3; }

.penalty-count {
  font-family: var(--font-display);
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  font-size: var(--step-1);
}

.penalty-script {
  font-size: var(--step-1);
  max-width: 40ch;
  border-top: 2px solid currentColor;
  padding-top: 14px;
}

.penalty-close {
  appearance: none;
  font: inherit;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: var(--step-1);
  border: 0;
  border-radius: 10px;
  padding: 14px 22px;
  min-height: 52px;
  cursor: pointer;
  background: var(--yellow-ink);
  color: var(--yellow);
}
.penalty-close:focus-visible { outline: 3px solid var(--yellow-ink); outline-offset: 4px; }
.penalty.is-red .penalty-close { background: var(--red-ink); color: var(--red); }
.penalty.is-red .penalty-close:focus-visible { outline-color: var(--red-ink); }

/* ---------- Rules ---------- */
.rules {
  padding-block: clamp(40px, 7vw, 80px) 24px;
  display: grid;
  gap: clamp(36px, 5vw, 56px);
}

.rules > header { display: grid; gap: 12px; }

.rules h2 {
  font-size: var(--step-3);
  font-weight: 850;
  font-variation-settings: "wdth" 115;
  letter-spacing: -0.01em;
}

.rules-lede { font-size: var(--step-1); max-width: 52ch; }

.rule-block { display: grid; gap: 16px; }
.rule-block > p { max-width: var(--measure); }
.block-lede { font-size: var(--step-1); }

.rule-block > h4.sub {
  font-size: var(--step-1);
  font-weight: 800;
  font-variation-settings: "wdth" 108;
  margin-top: 4px;
}

.knows { border-collapse: collapse; width: 100%; max-width: 52rem; }
.knows th, .knows td {
  text-align: left;
  vertical-align: top;
  padding: 12px 16px 12px 0;
  border-bottom: 1px solid var(--line);
}
.knows thead th {
  font-family: var(--font-display);
  font-weight: 700;
  font-variation-settings: "wdth" 110;
  font-size: 0.8125rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}
.knows tbody th { font-weight: 400; width: 45%; }
.knows tbody th strong { display: block; }
.knows tbody th span { display: block; color: var(--muted); font-size: var(--step--1); line-height: 1.4; margin-top: 2px; }
.knows td:last-child, .knows th:last-child { padding-right: 0; }

.views-list { padding-left: 1.4em; display: grid; gap: 12px; }
.views-list li > * { display: block; }
.views-list li > * + * { margin-top: 2px; }
.views-list li::marker { font-family: var(--font-display); font-weight: 800; color: var(--accent); }
.views-list strong { font-family: var(--font-display); font-weight: 800; }

.rule-block > h3 {
  font-size: var(--step-2);
  font-weight: 800;
  font-variation-settings: "wdth" 110;
  padding-bottom: 10px;
  border-bottom: 2px solid var(--ink);
}

.role-rules {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 17rem), 1fr));
  gap: 16px 28px;
}

.role-rules section { display: grid; gap: 6px; align-content: start; }

.role-rules h4, .steps h4, .card-rules h4 {
  font-size: var(--step-1);
  font-weight: 800;
  font-variation-settings: "wdth" 108;
}

.steps {
  list-style: none;
  padding: 0;
  display: grid;
  gap: 22px;
  counter-reset: step;
}

.steps > li {
  counter-increment: step;
  display: grid;
  grid-template-columns: 3.25rem minmax(0, 1fr);
  gap: 4px 16px;
}

.steps > li::before {
  content: counter(step);
  grid-row: 1 / span 4;
  font-family: var(--font-display);
  font-weight: 900;
  font-variation-settings: "wdth" 125;
  font-size: 2.75rem;
  line-height: 1;
  color: var(--accent);
}

.steps p { max-width: var(--measure); }

.cite { color: var(--muted); font-size: var(--step--1); }

.mmo {
  display: grid;
  grid-template-columns: max-content minmax(0, 1fr);
  gap: 6px 16px;
  margin-block: 6px;
  padding: 14px 16px;
  border-radius: 10px;
  background: var(--accent-soft);
}
.mmo dt {
  font-family: var(--font-display);
  font-weight: 800;
  font-variation-settings: "wdth" 108;
}
.mmo dd { margin: 0; }

.card-rules {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 18rem), 1fr));
  gap: 20px 28px;
}

.card-rules section { display: grid; gap: 10px; align-content: start; }
.card-rules ul { padding-left: 1.2em; display: grid; gap: 6px; }

.card-title { display: flex; align-items: center; gap: 12px; }

.swatch {
  width: 22px; height: 30px;
  border-radius: 4px;
  box-shadow: 0 0 0 2px var(--edge);
  transform: rotate(-8deg);
  flex: none;
}
.swatch-yellow { background: var(--yellow); }
.swatch-red { background: var(--red); }

.script {
  font-family: var(--font-display);
  font-weight: 700;
  font-variation-settings: "wdth" 100;
  font-size: var(--step-2);
  line-height: 1.25;
  max-width: 36ch;
}

.plain-list { padding-left: 1.2em; display: grid; gap: 8px; max-width: var(--measure); }

.table-wrap { overflow-x: auto; }

.timeline {
  border-collapse: collapse;
  width: 100%;
}
.timeline th, .timeline td {
  text-align: left;
  vertical-align: top;
  padding: 12px 16px 12px 0;
  border-bottom: 1px solid var(--line);
}
.timeline thead th {
  font-family: var(--font-display);
  font-weight: 700;
  font-variation-settings: "wdth" 110;
  font-size: 0.8125rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}
.timeline td:first-child, .timeline tbody th {
  font-family: var(--font-display);
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

/* ---------- Footer ---------- */
.site-foot {
  padding-block: 24px 48px;
  color: var(--muted);
  font-size: var(--step--1);
  display: grid;
  gap: 6px;
}

.site-foot p { max-width: var(--measure); }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation: none !important;
    transition: none !important;
  }
  .role:hover { transform: none; }
}
