:root {
  --black: #090909;
  --ink: #111111;
  --paper: #f3f0e7;
  --paper-2: #ded9cc;
  --acid: #dcff16;
  --acid-dim: #a8be1c;
  --danger: #ff5d4d;
  --muted: #aaa69c;
  --line: rgba(243, 240, 231, 0.22);
  --line-dark: rgba(17, 17, 17, 0.22);
  --radius: 2px;
  --shell: 1180px;
  --shell-wide: 1420px;
}

* { box-sizing: border-box; }
html { color-scheme: dark; scroll-behavior: smooth; }
body {
  margin: 0;
  min-width: 320px;
  background: var(--black);
  color: var(--paper);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  line-height: 1.5;
}
body.modal-open { overflow: hidden; }
button, input { font: inherit; }
button { color: inherit; }
a { color: inherit; }
.hidden { display: none !important; }
.noise {
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: .035;
  z-index: 20;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 180 180' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.8' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='.7'/%3E%3C/svg%3E");
}
.shell { width: min(calc(100% - 40px), var(--shell)); margin-inline: auto; }
.shell-wide { width: min(calc(100% - 40px), var(--shell-wide)); margin-inline: auto; }
.site-header {
  min-height: 92px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--line);
}
.brand {
  display: inline-flex;
  text-decoration: none;
  font-family: "Arial Black", Impact, sans-serif;
  font-size: clamp(1.2rem, 3vw, 1.8rem);
  letter-spacing: -.08em;
  line-height: 1;
}
.brand span:last-child { color: var(--acid); }
.header-actions { display: flex; gap: 24px; }
.text-button {
  appearance: none;
  border: 0;
  border-bottom: 1px solid currentColor;
  padding: 2px 0;
  background: transparent;
  cursor: pointer;
  font-size: .76rem;
  font-weight: 800;
  letter-spacing: .08em;
  text-transform: uppercase;
}
.text-button:hover { color: var(--acid); }
.screen { display: none; }
.screen.active { display: block; }
.hero { padding: clamp(72px, 10vw, 138px) 0 72px; }
.eyebrow {
  margin: 0 0 14px;
  color: var(--acid);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: .74rem;
  font-weight: 800;
  letter-spacing: .16em;
  text-transform: uppercase;
}
.hero h1, .result-wrap > h1 {
  margin: 0;
  max-width: 940px;
  font-family: "Arial Black", Impact, sans-serif;
  font-size: clamp(3.4rem, 9.5vw, 8.4rem);
  letter-spacing: -.075em;
  line-height: .84;
  text-transform: uppercase;
}
.hero h1 span { color: var(--acid); }
.hero-copy {
  max-width: 670px;
  margin: 36px 0 0;
  color: var(--paper-2);
  font-size: clamp(1rem, 2vw, 1.24rem);
}
.setup-grid { border-top: 1px solid var(--line); }
.setup-section {
  display: grid;
  grid-template-columns: 90px 1fr;
  gap: 22px;
  padding: 42px 0;
  border-bottom: 1px solid var(--line);
}
.step-number {
  color: var(--muted);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: .82rem;
}
.setup-section h2 {
  margin: -7px 0 28px;
  font-size: clamp(1.5rem, 3vw, 2.25rem);
  letter-spacing: -.04em;
  text-transform: uppercase;
}
.mode-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.mode-card {
  position: relative;
  min-height: 112px;
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 18px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 22px;
  background: transparent;
  text-align: left;
  cursor: pointer;
  transition: background .15s ease, color .15s ease, border-color .15s ease;
}
.mode-card:hover { border-color: var(--paper); }
.mode-card.selected { background: var(--paper); color: var(--ink); border-color: var(--paper); }
.mode-symbol { font-size: 1.8rem; font-weight: 900; }
.mode-copy { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.mode-copy strong { font-size: 1.04rem; text-transform: uppercase; }
.mode-copy small { color: var(--muted); }
.mode-card.selected .mode-copy small { color: #56534d; }
.badge {
  align-self: start;
  padding: 5px 7px;
  background: var(--acid);
  color: var(--ink);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: .64rem;
  font-weight: 900;
}
.badge.ghost { background: transparent; color: inherit; border: 1px solid currentColor; }
.handle-label { display: block; margin-bottom: 8px; color: var(--muted); font-size: .78rem; text-transform: uppercase; letter-spacing: .08em; }
.handle-row { display: flex; align-items: stretch; max-width: 560px; }
.handle-input {
  min-width: 0;
  flex: 1;
  border: 1px solid var(--paper);
  border-right: 0;
  border-radius: 0;
  padding: 18px;
  background: transparent;
  color: var(--paper);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 1.12rem;
  font-weight: 800;
  outline-offset: 4px;
  text-transform: uppercase;
}
.handle-tag {
  display: grid;
  place-items: center;
  border: 1px solid var(--paper);
  padding: 0 18px;
  background: var(--paper);
  color: var(--ink);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-weight: 900;
}
.microcopy { max-width: 740px; margin: 12px 0 0; color: var(--muted); font-size: .84rem; }
.rules-strip { display: flex; flex-wrap: wrap; gap: 8px; }
.rules-strip span { border: 1px solid var(--line); padding: 7px 10px; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .7rem; font-weight: 800; }
.start-area { padding: 34px 0 4px 112px; }
.primary-button, .secondary-button, .danger-button, .mini-button {
  appearance: none;
  border-radius: var(--radius);
  cursor: pointer;
  font-weight: 900;
  letter-spacing: .04em;
  text-transform: uppercase;
}
.primary-button {
  width: min(100%, 560px);
  min-height: 76px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border: 1px solid var(--acid);
  padding: 0 24px;
  background: var(--acid);
  color: var(--ink);
  font-size: 1rem;
}
.primary-button:hover { background: var(--paper); border-color: var(--paper); }
.primary-button:disabled { opacity: .5; cursor: wait; }
.primary-button.compact { width: auto; min-width: 250px; min-height: 60px; }
.secondary-button { min-height: 60px; border: 1px solid var(--paper); padding: 0 22px; background: transparent; color: var(--paper); }
.secondary-button:hover { background: var(--paper); color: var(--ink); }
.status-line { min-height: 1.5em; margin: 12px 0 0; color: var(--danger); font-size: .82rem; }
.stat-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  margin-top: 78px;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}
.stat-row > div { display: flex; flex-direction: column; padding: 28px 20px; border-right: 1px solid var(--line); }
.stat-row > div:last-child { border-right: 0; }
.stat-row strong { color: var(--acid); font-family: "Arial Black", Impact, sans-serif; font-size: 2rem; }
.stat-row span { color: var(--muted); font-size: .74rem; text-transform: uppercase; }
.site-footer { display: flex; justify-content: space-between; gap: 24px; padding: 60px 0 32px; color: var(--muted); font-size: .72rem; }
.site-footer a:hover { color: var(--acid); }

/* Game */
.game-topbar {
  min-height: 78px;
  display: grid;
  grid-template-columns: 1fr auto auto auto;
  gap: 30px;
  align-items: center;
  border-bottom: 1px solid var(--line);
}
.game-mode { color: var(--acid); font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .75rem; font-weight: 900; letter-spacing: .12em; }
.game-metric { display: flex; align-items: baseline; gap: 8px; }
.game-metric span { color: var(--muted); font-size: .65rem; font-weight: 800; }
.game-metric strong { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 1rem; }
.danger-button { border: 1px solid rgba(255,93,77,.55); padding: 10px 14px; background: transparent; color: var(--danger); font-size: .7rem; }
.danger-button:hover { background: var(--danger); color: var(--ink); }
.target-banner {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 18px;
  align-items: center;
  padding: 22px 0;
  border-bottom: 1px solid var(--line);
}
.target-label, .route-label, .article-kicker { color: var(--muted); font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .65rem; font-weight: 800; letter-spacing: .12em; }
.target-banner strong { font-size: clamp(1.15rem, 2.7vw, 2rem); text-transform: uppercase; }
.mini-button { border: 1px solid var(--line); padding: 9px 12px; background: transparent; font-size: .65rem; }
.mini-button:hover { border-color: var(--acid); color: var(--acid); }
.route-wrap { display: grid; grid-template-columns: 110px 1fr; gap: 18px; align-items: start; padding: 16px 0; border-bottom: 1px solid var(--line); }
.route { display: flex; flex-wrap: wrap; gap: 7px; min-width: 0; }
.route-step { display: inline-flex; gap: 7px; align-items: center; color: var(--paper-2); font-size: .76rem; }
.route-step:not(:last-child)::after { content: '→'; color: var(--acid); }
.game-layout { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 22px; padding-top: 22px; }
.article-panel { min-width: 0; background: var(--paper); color: var(--ink); padding: clamp(24px, 5vw, 64px); }
.article-kicker { color: #6e695f; }
.article-panel > h1 {
  margin: 10px 0 24px;
  font-family: Georgia, 'Times New Roman', serif;
  font-size: clamp(2.4rem, 6vw, 5.5rem);
  line-height: .98;
  letter-spacing: -.055em;
}
.article-status { min-height: 0; margin-bottom: 10px; color: #615d55; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .74rem; }
.article-panel[aria-busy="true"] .article-content { opacity: .35; pointer-events: none; }
.article-content {
  max-width: 920px;
  font-family: Georgia, 'Times New Roman', serif;
  font-size: 1.06rem;
  line-height: 1.72;
  overflow-wrap: anywhere;
}
.article-content h2, .article-content h3, .article-content h4 { font-family: Inter, ui-sans-serif, system-ui, sans-serif; line-height: 1.12; letter-spacing: -.035em; }
.article-content h2 { margin: 48px 0 12px; padding-bottom: 8px; border-bottom: 1px solid var(--line-dark); font-size: 1.7rem; }
.article-content h3 { margin-top: 34px; font-size: 1.25rem; }
.article-content a.wiki-link {
  color: var(--ink);
  text-decoration-color: #7d9100;
  text-decoration-thickness: 2px;
  text-underline-offset: 3px;
  font-weight: 700;
  cursor: pointer;
}
.article-content a.wiki-link:hover, .article-content a.wiki-link:focus { background: var(--acid); outline: 3px solid var(--acid); text-decoration: none; }
.article-content table { display: block; max-width: 100%; overflow-x: auto; border-collapse: collapse; margin: 28px 0; font-family: Inter, ui-sans-serif, system-ui, sans-serif; font-size: .86rem; }
.article-content th, .article-content td { border: 1px solid var(--line-dark); padding: 8px 10px; vertical-align: top; }
.article-content .wiki-infobox { float: right; width: min(340px, 44%); margin: 0 0 24px 28px; background: #e7e2d7; }
.article-content .wiki-hatnote { margin: 10px 0 24px; color: #5c5850; font-style: italic; }
.article-content blockquote { margin: 22px 0; border-left: 4px solid #8ba000; padding-left: 18px; }
.article-content pre, .article-content code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }
.article-source { clear: both; margin-top: 60px; padding-top: 18px; border-top: 1px solid var(--line-dark); color: #68635a; font-size: .72rem; }
.article-source a { font-weight: 800; }
.mission-panel { align-self: start; position: sticky; top: 20px; border: 1px solid var(--line); padding: 24px; }
.mission-node { border: 1px solid var(--line); padding: 18px; }
.mission-node span { display: block; margin-bottom: 6px; color: var(--muted); font-size: .62rem; letter-spacing: .1em; }
.mission-node strong { display: block; font-size: 1rem; text-transform: uppercase; }
.target-node { border-color: var(--acid); }
.target-node strong { color: var(--acid); }
.mission-arrow { padding: 10px 0; color: var(--acid); text-align: center; }
.mission-tip { margin-top: 28px; padding-top: 20px; border-top: 1px solid var(--line); }
.mission-tip strong { color: var(--acid); text-transform: uppercase; font-size: .78rem; }
.mission-tip p { margin: 7px 0 0; color: var(--muted); font-size: .8rem; }

/* Results */
.result-wrap { padding: clamp(74px, 10vw, 130px) 0 70px; }
.result-wrap > h1 { max-width: 1050px; font-size: clamp(3rem, 8vw, 7.2rem); }
.result-score { display: flex; align-items: baseline; gap: 8px; margin-top: 42px; }
.result-score strong { color: var(--acid); font-family: "Arial Black", Impact, sans-serif; font-size: clamp(4rem, 13vw, 10rem); letter-spacing: -.07em; line-height: .85; }
.result-score span { color: var(--muted); font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }
.result-rank { margin: 12px 0 0; font-weight: 900; letter-spacing: .12em; }
.result-metrics { display: grid; grid-template-columns: repeat(4, 1fr); margin-top: 48px; border-block: 1px solid var(--line); }
.result-metrics > div { display: flex; flex-direction: column; gap: 6px; padding: 22px; border-right: 1px solid var(--line); }
.result-metrics > div:last-child { border-right: 0; }
.result-metrics span { color: var(--muted); font-size: .66rem; letter-spacing: .1em; }
.result-metrics strong { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 1.1rem; }
.result-route-block { margin-top: 42px; }
.result-route-block > span { color: var(--muted); font-size: .67rem; letter-spacing: .12em; }
.result-route { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 12px; }
.result-route .route-chip { border: 1px solid var(--line); padding: 10px 12px; font-size: .8rem; }
.result-route .route-chip:not(:last-child)::after { content: '→'; margin-left: 12px; color: var(--acid); }
.result-actions { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; margin-top: 34px; }
.result-change { margin-left: 8px; }
.result-status { color: var(--muted); }

/* Modals */
.modal {
  width: min(calc(100% - 28px), 880px);
  max-height: min(86vh, 850px);
  border: 1px solid var(--paper);
  border-radius: 0;
  padding: 0;
  background: var(--black);
  color: var(--paper);
  overflow: auto;
}
.modal::backdrop { background: rgba(0,0,0,.78); backdrop-filter: blur(4px); }
.modal-head { display: flex; justify-content: space-between; gap: 20px; align-items: flex-start; padding: 28px; border-bottom: 1px solid var(--line); }
.modal-head h2 { margin: 0; font-size: clamp(1.7rem, 4vw, 3rem); text-transform: uppercase; }
.modal-close { appearance: none; border: 1px solid var(--line); background: transparent; color: var(--paper); width: 42px; height: 42px; cursor: pointer; font-size: 1.6rem; }
.modal-close:hover { background: var(--paper); color: var(--ink); }
.board-pair { padding: 24px 28px 8px; color: var(--acid); font-weight: 900; text-transform: uppercase; }
.leaderboard-note { padding: 0 28px 22px; color: var(--muted); font-size: .78rem; }
.leaderboard-table-wrap { overflow-x: auto; }
.leaderboard-table { width: 100%; border-collapse: collapse; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .78rem; }
.leaderboard-table th, .leaderboard-table td { padding: 14px 18px; border-top: 1px solid var(--line); text-align: left; white-space: nowrap; }
.leaderboard-table th { color: var(--muted); font-size: .65rem; }
.leaderboard-table tr.current-player { background: rgba(220,255,22,.08); }
.player-cell strong { display: block; }
.player-cell small { color: var(--muted); }
.board-route td { padding-top: 0; white-space: normal; color: var(--muted); font-size: .68rem; }
.scoring-modal > p { margin: 0; padding: 28px; color: var(--paper-2); }
.formula-block { display: grid; grid-template-columns: 160px 1fr; margin: 0 28px; border: 1px solid var(--line); }
.formula-block code, .formula-block span { padding: 15px; border-bottom: 1px solid var(--line); }
.formula-block code { color: var(--acid); font-weight: 900; }
.formula-block > :nth-last-child(-n+2) { border-bottom: 0; }
.rank-list { margin-top: 26px; }
.rank-list > div { display: grid; grid-template-columns: 160px 1fr; padding: 14px 28px; border-top: 1px solid var(--line); }
.rank-list strong { color: var(--acid); font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }

@media (max-width: 900px) {
  .game-layout { grid-template-columns: 1fr; }
  .mission-panel { position: static; display: grid; grid-template-columns: 1fr auto 1fr; gap: 10px; align-items: center; }
  .mission-panel .eyebrow, .mission-tip { grid-column: 1 / -1; }
  .mission-arrow { transform: rotate(-90deg); }
  .article-content .wiki-infobox { float: none; width: 100%; margin: 22px 0; }
}

@media (max-width: 720px) {
  .shell, .shell-wide { width: min(calc(100% - 24px), var(--shell)); }
  .site-header { min-height: 72px; }
  .header-actions { gap: 14px; }
  .text-button { font-size: .65rem; }
  .hero { padding-top: 72px; }
  .hero h1, .result-wrap > h1 { font-size: clamp(3.1rem, 17vw, 5.4rem); }
  .setup-section { grid-template-columns: 42px 1fr; gap: 10px; padding: 34px 0; }
  .mode-grid { grid-template-columns: 1fr; }
  .mode-card { min-height: 96px; padding: 18px; }
  .start-area { padding-left: 52px; }
  .stat-row { grid-template-columns: repeat(2, 1fr); }
  .stat-row > div:nth-child(2) { border-right: 0; }
  .stat-row > div:nth-child(-n+2) { border-bottom: 1px solid var(--line); }
  .site-footer { flex-direction: column; }
  .game-topbar { grid-template-columns: 1fr auto auto; gap: 12px; padding: 12px 0; }
  .danger-button { grid-column: 1 / -1; }
  .target-banner { grid-template-columns: 1fr auto; }
  .target-label { grid-column: 1 / -1; }
  .route-wrap { grid-template-columns: 1fr; gap: 7px; }
  .game-layout { padding-top: 12px; }
  .article-panel { padding: 24px 18px; }
  .article-panel > h1 { font-size: clamp(2.5rem, 13vw, 4.2rem); }
  .article-content { font-size: 1rem; }
  .mission-panel { grid-template-columns: 1fr; }
  .mission-arrow { transform: none; }
  .result-metrics { grid-template-columns: repeat(2, 1fr); }
  .result-metrics > div:nth-child(2) { border-right: 0; }
  .result-metrics > div:nth-child(-n+2) { border-bottom: 1px solid var(--line); }
  .primary-button.compact, .secondary-button { width: 100%; }
  .result-change { width: auto; margin: 10px auto 0; }
  .formula-block, .rank-list > div { grid-template-columns: 1fr; }
  .formula-block code { padding-bottom: 4px; }
  .formula-block span { padding-top: 4px; }
}

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

#consent-banner { position:fixed; bottom:0; left:0; right:0; z-index:1000; background:var(--ink); border-top:2px solid var(--acid); padding:14px 20px; display:flex; align-items:center; gap:16px; font-size:.78rem; color:var(--muted); line-height:1.5; flex-wrap:wrap; }
#consent-banner strong { color:var(--paper); }
#consent-ok { flex-shrink:0; padding:8px 18px; border:1px solid var(--acid); background:rgba(220,255,22,.08); color:var(--acid); font-weight:850; font-size:.76rem; cursor:pointer; border-radius:var(--radius); }
