*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--background);
  color: var(--text);
  font-family: var(--font-text);
  min-width: 280px;
}
a { color: inherit; }
button { font: inherit; cursor: pointer; }
button:disabled { cursor: default; }
button, a { touch-action: manipulation; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 4px; }
section[id] { scroll-margin-top: var(--scroll-offset); }
.svg-library { position: absolute; width: 0; height: 0; overflow: hidden; }
.skip-link {
  position: absolute;
  inset: 12px auto auto 12px;
  z-index: 3;
  transform: translateY(-160%);
  padding: 10px 14px;
  background: var(--paper);
  color: var(--ink);
}
.skip-link:focus { transform: none; }
.label, .eyebrow, .round-badge, .bot-id, .humanity-ref {
  font: 700 0.72rem/1.4 var(--font-label);
  letter-spacing: 0.12em;
  text-transform: uppercase;
}
.label { color: var(--muted); }
.label span, .eyebrow i { color: var(--team-human); font-style: normal; }

.masthead {
  position: relative;
  z-index: 1;
  background: var(--background);
  border-bottom: 1px solid var(--line);
}
.masthead-inner {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 18px;
  align-items: center;
  min-height: 64px;
  max-width: 1440px;
  margin: auto;
  padding-inline: var(--page-gutter);
}
.wordmark {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  justify-self: start;
  text-decoration: none;
  white-space: nowrap;
  font: 900 1.25rem/1 var(--font-label);
  letter-spacing: -0.055em;
}
.wordmark svg { width: 34px; height: 34px; }
.wordmark-accent { color: var(--team-human); }
nav { display: flex; gap: 6px; }
nav a {
  display: grid;
  place-items: center;
  min-height: 42px;
  padding: 0 13px;
  color: var(--muted);
  font: 700 0.75rem/1 var(--font-label);
  white-space: nowrap;
  text-transform: uppercase;
  text-decoration: none;
  border-bottom: 1px solid transparent;
}
nav a:hover, nav a[aria-current="location"] { color: var(--team-ai); border-color: var(--team-ai); }
.round-badge { justify-self: end; color: var(--muted); white-space: nowrap; }
.round-badge span, .eyebrow span {
  display: inline-block;
  width: 7px;
  height: 7px;
  margin-right: 5px;
  background: var(--team-ai);
  box-shadow: 0 0 12px var(--ai-glow);
}

.hero {
  --hero-artwork: url("/assets/humanity-hero.jpg");
  --cast-width: min(100%, 1660px);
  position: relative;
  isolation: isolate;
  overflow: hidden;
  min-height: min(50vw, 680px);
  padding: 41px var(--page-gutter) 31px;
}
.hero-art, .hero-cast {
  position: absolute;
  top: 0;
  left: 50%;
  width: var(--cast-width);
  aspect-ratio: 3;
  transform: translateX(-50%);
  pointer-events: none;
}
.hero-art { z-index: -1; }
.hero-art::after {
  content: "";
  position: absolute;
  inset-block: 0;
  left: 50%;
  width: 63%;
  transform: translateX(-75%);
  background: var(--hero-artwork) right top / 220% auto no-repeat;
  mask-image: linear-gradient(to right, transparent 27%, var(--ink) 55%, var(--ink) 88%, transparent),
    linear-gradient(to bottom, var(--ink) 40%, transparent 85%);
  mask-composite: intersect;
  opacity: 0.5;
}
.hero-cast figure { margin: 0; }
.humanity {
  position: absolute;
  inset: 0 0 0 auto;
  width: 38%;
}
.humanity-picture { position: relative; height: 100%; }
.humanity-picture::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(to bottom, transparent 54%, var(--background)), var(--hero-artwork) left top / auto 100% no-repeat;
  mask-image: linear-gradient(to right, var(--ink) 76%, transparent);
  transform: scaleX(-1);
}
.hero-portrait {
  position: absolute;
  top: 5px;
  left: -1%;
  width: 32%;
}
.bot-picture { position: relative; }
.bot-picture a { display: block; pointer-events: auto; }
.bot-picture img {
  display: block;
  width: 100%;
  height: auto;
  mask-image: linear-gradient(to bottom, var(--ink) 80%, transparent);
}
.bot-broadcast {
  position: absolute;
  top: 54%;
  left: 56%;
  margin: 0;
  padding: 6px 8px;
  transform: rotate(-4deg);
  border-left: 2px solid var(--team-ai);
  background: var(--panel-glass);
  box-shadow: 0 0 16px var(--ai-glow);
  color: var(--team-ai);
  font: 0.67rem/1.2 var(--font-label);
  text-transform: uppercase;
  white-space: nowrap;
}
.bot-broadcast::after {
  position: absolute;
  left: 11px;
  bottom: 100%;
  width: 26px;
  height: 13px;
  content: "";
  border-top: 1px solid var(--team-ai);
  border-right: 1px solid var(--team-ai);
  transform: skewX(42deg);
  opacity: 0.7;
}
.bot-broadcast span { display: block; margin-bottom: 4px; color: var(--muted); font-size: 0.55rem; }
.hero-layout {
  position: relative;
  z-index: 1;
  max-width: 620px;
  margin: 0 auto;
}
.humanity-label {
  position: absolute;
  z-index: 1;
  top: 31.8%;
  right: 36%;
  transform: translate(50%, -50%) rotate(4deg);
  color: var(--text);
  font: 800 clamp(0.54rem, 1.06vw, 1.05rem)/1 var(--font-label);
  letter-spacing: 0.035em;
}
.humanity-ref {
  position: absolute;
  top: calc(93% + 5px);
  right: 23%;
  color: var(--text);
  text-shadow: 1px 1px 2px var(--ink), 0 0 9px var(--ink);
}
.hero-core { min-width: 0; text-align: center; }
.eyebrow { margin: 3px 0 11px; color: var(--muted); }
.hero h1 {
  margin: 0;
  color: var(--text);
  font: 900 clamp(4rem, 7.8vw, 7.65rem)/0.88 var(--font-display);
  text-transform: uppercase;
  letter-spacing: -0.035em;
  text-shadow: 4px 4px 0 var(--human-deep);
}
.hero h1 em { display: block; color: var(--team-ai); font-style: normal; white-space: nowrap; }
.tagline { margin: 13px 0 25px; color: var(--muted); font: 600 clamp(0.94rem, 2vw, 1.12rem)/1.4 var(--font-label); }
.score {
  --split: 50%;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px 16px;
  padding: 13px 16px 10px;
  background: var(--panel-glass);
  border: 1px solid var(--line);
  box-shadow: 0 0 24px var(--human-glow);
}
.score-side { display: grid; gap: 4px; }
.score-ai { color: var(--team-ai); text-align: left; }
.score-human { color: var(--team-human); text-align: right; }
.score-side span, .score-caption { font: 750 0.72rem/1.3 var(--font-label); letter-spacing: 0.07em; }
.score-side i { font-style: normal; color: var(--muted); }
.score-side strong { font: 850 clamp(1.35rem, 4vw, 2.45rem)/1 var(--font-label); font-variant-numeric: tabular-nums; }
.score-track { grid-column: 1 / -1; height: 10px; margin-top: 3px; background: var(--map-blank); }
.score-track span { display: block; height: 100%; width: var(--split); background: var(--team-ai); transition: width 360ms ease; }
.score-track span { margin-left: auto; visibility: hidden; }
.score.has-votes .score-track { background: var(--team-human); }
.score.has-votes .score-track span { visibility: visible; }
.score-caption {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  grid-column: 1 / -1;
  color: var(--muted);
  margin: 0;
  text-align: left;
}
.ballot { display: grid; grid-template-columns: 1fr 1fr; gap: 11px; margin-top: 13px; }
.vote-button {
  position: relative;
  display: grid;
  align-content: center;
  justify-items: start;
  gap: 5px;
  min-height: 76px;
  padding: 10px 13px;
  color: var(--ink);
  border: 0;
  text-align: left;
  font: 700 0.8rem/1.1 var(--font-label);
}
.vote-ai { background: var(--team-ai); box-shadow: 0 4px 0 var(--ai-deep); }
.vote-human { background: var(--team-human); box-shadow: 0 4px 0 var(--human-deep); }
.vote-button b { font: 900 clamp(1.65rem, 3.3vw, 2.35rem)/0.9 var(--font-display); }
.vote-button:hover:not(:disabled) { filter: brightness(1.12); }
.vote-button:active:not(:disabled) { transform: translateY(2px); }
.vote-button:disabled:not(.selected) { opacity: 0.68; }
.vote-button.selected { outline: 2px solid var(--text); outline-offset: -5px; }
.vote-code { position: absolute; right: 10px; top: 10px; font-size: 0.69rem; }
.vote-status { min-height: 17px; margin: 10px 0 13px; color: var(--muted); font: 0.73rem/1.45 var(--font-label); }
.vote-status a { color: var(--team-ai); }
.retry-button { margin: -3px 0 12px; }
.chaos-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  min-height: 49px;
  padding: 6px 12px;
  border: 1px solid var(--team-human);
  background: var(--panel-raised);
  box-shadow: 0 0 17px var(--human-glow), inset 0 0 14px var(--human-glow);
  color: var(--team-ai);
  font: 800 0.9rem/1 var(--font-label);
  text-transform: uppercase;
}
.chaos-button:hover { background: var(--human-deep); }
.chaos-button:active { transform: translateY(2px); }
.chaos-icon { color: var(--team-human); font-size: 1.5rem; }
.chaos-free { background: var(--team-ai); color: var(--ink); padding: 4px 5px; font-size: 0.63rem; }
.chaos-scene {
  display: grid;
  grid-template-columns: 62px 1fr;
  align-items: center;
  gap: 12px;
  margin-top: 14px;
  padding: 6px 12px;
  min-height: 76px;
  background: var(--panel-glass);
  border: 1px dashed var(--team-human);
  text-align: left;
}
.chaos-scene p { margin: 3px 0 0; line-height: 1.35; font-size: 0.9rem; }
.scene-art { width: 62px; height: 57px; }
.scene-light { fill: var(--paper); }
.scene-shell { fill: var(--team-human); }
.scene-dark { fill: var(--ink); }
.scene-beam { fill: var(--team-ai); opacity: 0.31; }
[data-effect="dance"] .scene-art { animation: dance 420ms ease-in-out 4 alternate; }
[data-effect="ufo"] .scene-art { animation: abduct 580ms ease-in-out 2 alternate; }
[data-effect="recount"] .scene-art { animation: stamp 270ms ease-out; }
@keyframes dance { from { transform: rotate(-15deg); } to { transform: rotate(15deg); } }
@keyframes abduct { from { transform: translateY(3px); } to { transform: translateY(-9px); } }
@keyframes stamp { from { transform: scale(1.2); } to { transform: none; } }

.bot-shadow { fill: var(--ink); }
.bot-shell { fill: var(--team-human); }
.bot-lit { fill: var(--paper); }
.bot-pixel { fill: var(--team-ai); }
.bot-detail { fill: var(--accent-cool); }
.bot-id { text-align: center; color: var(--text); text-shadow: 1px 1px 2px var(--ink); }
.bot-id span { color: var(--team-ai); }
.after-ballot {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: start;
  gap: 8px;
  margin-top: 9px;
}
.goals {
  position: relative;
  width: max-content;
  max-width: 100%;
  margin: 0 8px 5px 0;
  padding: 11px 18px 13px;
  transform: rotate(4deg);
  background: color-mix(in srgb, var(--team-human) 77%, var(--paper));
  color: var(--ink);
  box-shadow: 4px 5px 0 var(--human-deep);
  font-family: var(--font-label);
  text-align: left;
}
.goals::before {
  content: "";
  position: absolute;
  top: -8px;
  right: 22%;
  width: 42px;
  height: 13px;
  background: color-mix(in srgb, var(--paper) 74%, transparent);
  transform: rotate(-10deg);
}
.goals h2 { margin: 0 0 4px; font-size: clamp(0.77rem, 1.3vw, 1.08rem); }
.goals ul { margin: 0; padding: 0; list-style: none; font-size: clamp(0.68rem, 1vw, 0.89rem); line-height: 1.4; }
.goals li:last-child { font-weight: 900; }

.content { max-width: calc(var(--content-width) + 2 * var(--page-gutter)); margin-inline: auto; padding: 0 var(--page-gutter) 50px; }
.receipt-panel {
  display: grid;
  grid-template-columns: minmax(0, 330px) 1fr;
  gap: clamp(14px, 4vw, 42px);
  align-items: center;
  margin-bottom: 38px;
  padding: clamp(13px, 3vw, 29px);
  background: var(--panel);
  border: 1px solid var(--line);
}
.poster-preview { display: block; width: 100%; max-width: 330px; height: auto; margin: 0 auto; }
.receipt-actions { min-width: 0; }
.receipt-actions h2 { margin: 0 0 10px; font: 900 clamp(1.6rem, 3.1vw, 3rem)/1 var(--font-display); text-transform: uppercase; }
.receipt-actions > p:first-child { margin: 0 0 8px; }
.incoming-challenge {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
  padding: 10px 12px;
  background: var(--panel);
  border: 1px solid var(--line);
  text-align: left;
}
.incoming-challenge img { width: 58px; height: auto; flex: none; }
.incoming-challenge p { margin: 0; }
.incoming-challenge h2 { margin: 1px 0 4px; font: 900 1.45rem/1.15 var(--font-display); text-transform: uppercase; }
.action-group { display: flex; flex-wrap: wrap; gap: 6px; }
.action-button, .subtle-button {
  min-height: 44px;
  padding: 7px 11px;
  background: var(--team-ai);
  border: 1px solid var(--team-ai);
  color: var(--ink);
  font: 800 0.72rem/1.2 var(--font-label);
}
.subtle-button { background: var(--panel-raised); border-color: var(--line); color: var(--text); }
.subtle-button:hover { border-color: var(--team-human); }
.action-button:hover { filter: brightness(1.12); }
.action-button:disabled, .subtle-button:disabled { opacity: 0.63; }
.share-status { min-height: 16px; margin: 8px 0 0; color: var(--muted); font: 0.75rem/1.35 var(--font-label); }
#receipt-link { width: 100%; margin-top: 6px; padding: 7px; background: var(--background); color: var(--text); border: 1px solid var(--line); }

.chapter { margin-top: 27px; }
.chapter + .chapter { margin-top: 46px; }
.chapter-header {
  display: flex;
  justify-content: space-between;
  align-items: end;
  flex-wrap: wrap;
  gap: 8px 20px;
  margin-bottom: 13px;
}
.chapter-header .label { margin: 0 0 4px; }
.chapter-header h2 { margin: 0; font: 900 clamp(2.2rem, 5.4vw, 3.9rem)/0.95 var(--font-display); text-transform: uppercase; }
.chapter-header > p { max-width: 39ch; margin: 0; color: var(--muted); font: 0.8rem/1.4 var(--font-label); }
.world-map { margin: 0; background: var(--panel); border: 1px solid var(--line); }
.world-map svg { display: block; width: 100%; height: auto; }
.map-water { fill: var(--panel); }
.map-grid-line, .map-scan-lines { fill: none; stroke: var(--line); opacity: 0.52; }
.map-land-outline { fill: none; stroke: var(--background); stroke-width: 6px; }
.map-land { fill: var(--map-blank); }
.map-mask-fill { fill: var(--white); }
.has-votes .map-land-human { fill: var(--team-human); }
.has-votes .map-land-ai { fill: var(--team-ai); }
.land-dot { fill: var(--ink); opacity: 0.39; }
.map-contours { fill: none; stroke: var(--ink); stroke-width: 1.5px; opacity: 0.48; }
.map-labels { fill: var(--text); stroke: var(--ink); stroke-width: 3px; paint-order: stroke; font: 800 13px var(--font-label); letter-spacing: 1px; }
.map-marks { fill: none; stroke: var(--accent-cool); stroke-width: 1.5px; opacity: 0.8; }
.world-map figcaption {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 15px;
  border-top: 1px solid var(--line);
  padding: 10px 12px;
  color: var(--muted);
  font: 0.77rem/1.35 var(--font-label);
}
.legend-ai { --key-color: var(--team-ai); }
.legend-human { --key-color: var(--team-human); }
.world-map figcaption :is(.legend-ai, .legend-human)::before { display: inline-block; content: ""; width: 9px; height: 9px; margin-right: 6px; background: var(--key-color); }
#map-score { margin-left: auto; }
.event-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.event-card { min-width: 0; padding: 13px; background: var(--panel); border: 1px solid var(--line); }
.event-card svg { display: block; width: 68px; height: 62px; margin-block: 7px; }
.event-card h3 { margin: 0 0 4px; font: 850 1.05rem/1.15 var(--font-text); }
.event-card p { margin: 0; color: var(--muted); font: 0.77rem/1.4 var(--font-label); }
.footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 9px 18px;
  border-top: 1px solid var(--line);
  padding: 17px var(--page-gutter);
  color: var(--muted);
  font: 0.74rem/1.4 var(--font-label);
}
.footer strong { color: var(--team-human); }
.footer p { margin: 0; }
.footer a { color: var(--team-ai); }

@media (max-width: 1050px) {
  .hero-layout { max-width: 565px; }
  .hero h1 { font-size: clamp(3.6rem, 8.4vw, 6.1rem); }
  .bot-broadcast { left: 32%; }
}
@media (max-width: 1024px) {
  .masthead-inner { gap: 6px; grid-template-columns: auto 1fr; }
  .masthead nav { justify-self: end; }
  .round-badge { display: none; }
  .hero { padding-top: 28px; min-height: 0; }
  .hero-art { width: max(100%, 700px); }
  .hero-art::after { opacity: 0.38; }
  .hero-layout { max-width: 550px; }
  .hero h1 { font-size: clamp(3.1rem, 11.4vw, 5.25rem); }
  .tagline { margin-bottom: 18px; }
  .hero-cast {
    position: relative;
    inset: auto;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px 16px;
    align-items: start;
    width: 100%;
    max-width: 550px;
    margin: 24px auto 0;
    aspect-ratio: auto;
    transform: none;
  }
  .humanity, .hero-portrait { position: relative; inset: auto; width: auto; }
  .humanity-picture { height: auto; aspect-ratio: 1000 / 967; }
  .humanity-picture::before { mask-image: none; }
  .humanity-label { right: 39.7%; font-size: clamp(0.42rem, 1.23vw, 0.75rem); }
  .humanity-ref, .bot-id { position: static; margin-top: 4px; text-align: center; font-size: clamp(0.55rem, 1.4vw, 0.72rem); }
  .bot-picture img { mask-image: linear-gradient(to bottom, var(--ink) 88%, transparent); }
  .bot-broadcast { left: 3%; font-size: clamp(0.48rem, 1.25vw, 0.64rem); }
  .chapter { margin-top: 14px; }
}
@media (max-width: 480px) {
  .masthead-inner { min-height: 58px; }
  .wordmark { font-size: 0.99rem; gap: 3px; }
  .wordmark svg { width: 27px; height: 27px; }
  nav { gap: 1px; }
  nav a { padding-inline: 5px; font-size: 0.62rem; min-height: 43px; }
  .hero { padding-top: 24px; padding-bottom: 17px; }
  .hero-art { width: 100%; min-height: 220px; }
  .hero-art::after { width: 93%; opacity: 0.32; }
  .bot-broadcast { padding: 4px; }
  .bot-broadcast span { margin-bottom: 2px; font-size: 0.46rem; }
  .bot-broadcast::after { height: 7px; width: 13px; left: 8px; }
  .goals { padding: 8px 10px; margin-right: 5px; }
  .hero-chaos .chaos-button { flex-wrap: wrap; gap: 5px; padding-inline: 6px; font-size: 0.73rem; }
  .score { padding-inline: 11px; }
  .vote-button { min-height: 68px; padding-inline: 10px; font-size: 0.72rem; }
  .receipt-panel { grid-template-columns: 1fr; gap: 11px; }
  .event-grid { grid-template-columns: 1fr; }
  .event-card { display: grid; grid-template-columns: 55px 1fr; gap: 1px 9px; align-items: center; }
  .event-card svg { grid-column: 1; grid-row: 1 / 4; width: 48px; height: 44px; margin: 0; }
  .event-card h3, .event-card p, .event-card .label { grid-column: 2; }
  .event-card h3 { margin: 0; }
  .map-labels { font-size: 21px; stroke-width: 4px; }
  #map-score { margin-left: 0; }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
