/* Hindsight design tokens. Generated from tokens.json; edit that file, not this one. */
:root {
  --table: #22382f;
  --table-deep: #16241e;
  --table-raised: #2c4a3d;
  --table-line: #3d5f50;
  --tile: #f7f3e8;
  --tile-sunk: #ede6d3;
  --tile-line: #d8d0bc;
  --ink: #1d2b24;
  --ink-muted: #4d5a53;
  --chalk: #f7f3e8;
  --chalk-muted: #cfd8d0;
  --you: #ee6a3f;
  --on-you: #1d2b24;
  --you-ink: #b63a17;
  --you-chalk: #f28a62;
  --crowd: #3a6ea5;
  --on-crowd: #f7f3e8;
  --crowd-ink: #2f5e8f;
  --crowd-chalk: #8db6e3;
  --history: #e0a526;
  --on-history: #1d2b24;
  --history-ink: #7a5400;
  --focus: #58c4dd;
  --font-display: "Lilita One", "Arial Rounded MT Bold", sans-serif;
  --font-sans: "Figtree", system-ui, sans-serif;
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-6: 24px;
  --space-8: 32px;
  --space-12: 48px;
  --hex-point-sm: 8px;
  --hex-point-md: 14px;
  --hex-point-lg: 22px;
  --shadow-piece: 0 4px 0 #16241e;
  --shadow-card: 0 6px 0 #16241e;
  color-scheme: dark;
}

/* Hindsight board-game components. Needs tokens.css and fonts/fonts.css loaded first.
   Every shape is a hexagon, drawn with clip-path. clip-path cuts off borders, outlines and box-shadows,
   so a hex with a rim is two layers: the outer element paints the rim, the inner <span> paints the fill.
   Shadows use filter: drop-shadow() on a wrapper, never box-shadow. */

:root {
  /* Three hexagon shapes, used everywhere. --hp is how far the points reach in. */
  --hex-h: polygon(var(--hp, 14px) 0, calc(100% - var(--hp, 14px)) 0, 100% 50%, calc(100% - var(--hp, 14px)) 100%, var(--hp, 14px) 100%, 0 50%);
  --hex-v: polygon(50% 0, 100% var(--hp, 22px), 100% calc(100% - var(--hp, 22px)), 50% 100%, 0 calc(100% - var(--hp, 22px)), 0 var(--hp, 22px));
  --hex: polygon(50% 0, 100% 25%, 100% 75%, 50% 100%, 0 75%, 0 25%);
}

.hs-table {
  background-color: var(--table);
  background-image: radial-gradient(rgba(255, 255, 255, 0.035) 1px, transparent 1px);
  background-size: 6px 6px;
  color: var(--chalk);
  font-family: var(--font-sans);
}

/* ---------- Button: an elongated hexagon ---------- */
.hs-btn {
  --hp: var(--hex-point-md);
  --rim: var(--ink);
  --fill: var(--tile);
  --fg: var(--ink);
  display: inline-flex;
  min-height: 52px;
  padding: 2px;
  border: 0;
  background: var(--rim);
  clip-path: var(--hex-h);
  cursor: pointer;
  filter: drop-shadow(0 4px 0 var(--table-deep));
  font: inherit;
}
.hs-btn > span {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: 0 calc(var(--hex-point-md) + var(--space-4));
  background: var(--fill);
  color: var(--fg);
  clip-path: var(--hex-h);
  font-family: var(--font-display);
  font-size: 18px;
  line-height: 20px;
  letter-spacing: 0.01em;
}
.hs-btn-you { --fill: var(--you); --fg: var(--on-you); }
.hs-btn-quiet { --rim: var(--chalk-muted); --fill: var(--table); --fg: var(--chalk); }
.hs-btn-block { display: flex; width: 100%; }
.hs-btn:focus-visible { outline: none; --rim: var(--focus); padding: 3px; }
.hs-btn:active { transform: translateY(2px); filter: drop-shadow(0 2px 0 var(--table-deep)); }
.hs-btn[disabled] { opacity: 0.45; cursor: not-allowed; }

/* ---------- Chip: a small elongated hexagon label ---------- */
.hs-chip {
  --hp: var(--hex-point-sm);
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  padding: 5px calc(var(--hex-point-sm) + 6px) 4px;
  clip-path: var(--hex-h);
  font: 800 12px/14px var(--font-sans);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  background: var(--table-raised);
  color: var(--chalk);
}
.hs-chip-history { background: var(--history); color: var(--on-history); }
.hs-chip-you { background: var(--you); color: var(--on-you); }
.hs-chip-crowd { background: var(--crowd); color: var(--on-crowd); }
.hs-chip-tile { background: var(--tile-sunk); color: var(--ink); }

/* ---------- Tile: a regular hexagon, one per quarter ---------- */
.hs-tile {
  --rim: var(--ink);
  --fill: var(--tile);
  --fg: var(--ink);
  position: relative;
  width: var(--tile-w, 96px);
  aspect-ratio: 0.866;
  padding: 3px;
  background: var(--rim);
  clip-path: var(--hex);
}
.hs-tile > span {
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  text-align: center;
  background: var(--fill);
  color: var(--fg);
  clip-path: var(--hex);
  font: 800 13px/15px var(--font-sans);
}
.hs-tile .hs-tile-when { font-family: var(--font-display); font-weight: 400; font-size: 18px; line-height: 20px; }
.hs-tile-real { --rim: var(--history); padding: 6px; }
.hs-tile-current { --rim: var(--you); padding: 6px; }
.hs-tile-history { --fill: var(--history); --fg: var(--on-history); }
.hs-tile-you { --fill: var(--you); --fg: var(--on-you); }
.hs-tile-ahead { --rim: var(--table-line); --fill: var(--table-raised); --fg: var(--chalk-muted); }

/* ---------- Choice: the two hex buttons you move your piece to ---------- */
.hs-choices { display: flex; justify-content: center; gap: var(--space-3); }
.hs-choice {
  --rim: var(--ink);
  --fill: var(--tile);
  --fg: var(--ink);
  width: 168px;
  aspect-ratio: 0.866;
  padding: 3px;
  border: 0;
  background: var(--rim);
  clip-path: var(--hex);
  cursor: pointer;
  font: inherit;
  filter: drop-shadow(0 5px 0 var(--table-deep));
}
.hs-choice > span {
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--space-1);
  padding: 0 var(--space-6);
  box-sizing: border-box;
  text-align: center;
  background: var(--fill);
  color: var(--fg);
  clip-path: var(--hex);
  font-family: var(--font-display);
  font-size: 20px;
  line-height: 22px;
}
.hs-choice small { font: 800 11px/14px var(--font-sans); letter-spacing: 0.12em; text-transform: uppercase; opacity: 0.8; }
.hs-choice[aria-pressed="true"] { --fill: var(--you); --fg: var(--on-you); }
.hs-choice:focus-visible { outline: none; --rim: var(--focus); padding: 5px; }

/* ---------- Resource tokens: the four meters ---------- */
.hs-tokens { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: var(--space-2); }
.hs-token { display: flex; flex-direction: column; align-items: center; gap: var(--space-1); min-width: 0; }
.hs-token-hex {
  flex: none;
  width: 34px;
  aspect-ratio: 0.866;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--tile);
  color: var(--ink);
  clip-path: var(--hex);
  font: 900 13px/1 var(--font-sans);
  font-variant-numeric: tabular-nums;
}
.hs-token-label { max-width: 100%; font: 800 11px/14px var(--font-sans); letter-spacing: 0.08em; text-transform: uppercase; color: var(--chalk-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hs-token-low .hs-token-hex { background: repeating-linear-gradient(135deg, var(--tile) 0 4px, var(--chalk-muted) 4px 8px); }
.hs-token-low .hs-token-label::after { content: " · Low"; color: var(--chalk); }

/* ---------- Card: a tall hexagon panel on the table ---------- */
.hs-card {
  --hp: var(--hex-point-lg);
  background: var(--tile);
  color: var(--ink);
  clip-path: var(--hex-v);
  padding: calc(var(--hex-point-lg) + var(--space-2)) var(--space-6);
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}
.hs-card-wrap { filter: drop-shadow(0 6px 0 var(--table-deep)); }
.hs-card h2 { margin: 0; font: 400 28px/31px var(--font-display); text-wrap: balance; }
.hs-card p { margin: 0; font: 400 16px/24px var(--font-sans); }
.hs-card .hs-note { font-size: 14px; line-height: 20px; color: var(--ink-muted); border-top: 2px dashed var(--tile-line); padding-top: var(--space-3); }
.hs-dateline { font: 800 12px/14px var(--font-sans); letter-spacing: 0.14em; text-transform: uppercase; color: var(--ink-muted); }

/* ---------- Crowd: ten hex chips, one per tenth of players ---------- */
.hs-crowd { display: flex; flex-direction: column; gap: var(--space-2); }
.hs-crowd-chips { display: flex; gap: 3px; }
.hs-crowd-chips i { width: 18px; aspect-ratio: 0.866; clip-path: var(--hex); background: var(--table-line); }
.hs-crowd-chips i.on { background: var(--crowd-chalk); }
.hs-crowd-text { font: 400 14px/20px var(--font-sans); color: var(--chalk-muted); }
.hs-crowd-text b { font: 900 20px/24px var(--font-sans); color: var(--crowd-chalk); font-variant-numeric: tabular-nums; margin-right: var(--space-1); }
.hs-on-tile .hs-crowd-chips i { background: var(--tile-line); }
.hs-on-tile .hs-crowd-chips i.on { background: var(--crowd); }
.hs-on-tile .hs-crowd-text { color: var(--ink-muted); }
.hs-on-tile .hs-crowd-text b { color: var(--crowd-ink); }

/* ---------- Progress: a row of small hexes, one per turn ---------- */
.hs-progress { display: flex; gap: 2px; flex-wrap: wrap; align-items: center; }
.hs-progress i { width: 9px; aspect-ratio: 0.866; clip-path: var(--hex); background: var(--table-line); }
.hs-progress i.done { background: var(--chalk-muted); }
.hs-progress i.real { background: var(--history); }
.hs-progress i.now { background: var(--you); width: 13px; }

/* ---------- Compare: you, players and history side by side in the debrief ---------- */
.hs-compare { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--space-3); }
.hs-compare > div { display: flex; flex-direction: column; gap: var(--space-2); }
.hs-compare .hs-mark { width: 28px; aspect-ratio: 0.866; clip-path: var(--hex); }
.hs-compare .hs-c-you .hs-mark { background: var(--you); }
.hs-compare .hs-c-crowd .hs-mark { background: var(--crowd-chalk); }
.hs-compare .hs-c-history .hs-mark { background: var(--history); }
.hs-compare h4 { margin: 0; font: 800 12px/14px var(--font-sans); letter-spacing: 0.14em; text-transform: uppercase; }
.hs-compare .hs-c-you h4 { color: var(--you-chalk); }
.hs-compare .hs-c-crowd h4 { color: var(--crowd-chalk); }
.hs-compare .hs-c-history h4 { color: var(--history); }
.hs-compare p { margin: 0; font: 800 16px/22px var(--font-sans); color: var(--chalk); }
@media (max-width: 480px) { .hs-compare { grid-template-columns: 1fr; } }

/* ---------- Fields: hex text input and the 6-hex code entry ---------- */
.hs-field { display: flex; flex-direction: column; gap: var(--space-2); }
.hs-field label { font: 800 12px/14px var(--font-sans); letter-spacing: 0.14em; text-transform: uppercase; color: var(--chalk-muted); }
.hs-input { --hp: var(--hex-point-md); --rim: var(--chalk-muted); display: flex; padding: 2px; background: var(--rim); clip-path: var(--hex-h); }
.hs-input input { flex: 1; min-height: 48px; border: 0; padding: 0 calc(var(--hex-point-md) + var(--space-3)); background: var(--tile); color: var(--ink); clip-path: var(--hex-h); font: 400 16px/24px var(--font-sans); }
.hs-input input:focus { outline: none; }
.hs-input:focus-within { --rim: var(--focus); padding: 3px; }
.hs-code { display: flex; gap: var(--space-2); }
.hs-code input { width: 44px; aspect-ratio: 0.866; border: 0; padding: 0; text-align: center; background: var(--tile); color: var(--ink); clip-path: var(--hex); font: 900 22px/1 var(--font-sans); }
.hs-code input:focus { outline: none; background: var(--you); }

/* ---------- Checkbox: a hex that fills ---------- */
.hs-check { display: flex; align-items: center; gap: var(--space-3); font: 400 14px/20px var(--font-sans); color: var(--chalk); cursor: pointer; }
.hs-check input { appearance: none; margin: 0; flex: none; width: 24px; aspect-ratio: 0.866; background: var(--chalk-muted); clip-path: var(--hex); cursor: pointer; }
.hs-check input:checked { background: var(--you); }
.hs-check input:focus-visible { background: var(--focus); }

@media (prefers-reduced-motion: reduce) {
  .hs-btn:active { transform: none; }
}

/* biome-ignore-all lint/style/noDescendingSpecificity: rules follow hindsight.css's order, by component */
/*
 * Pressable pieces (D-93), shared by the player app (app.css) and the Worker's history pages
 * (/history.css, E19-4) so a button looks the same everywhere: loaded after hindsight.css.
 */

/* ---------- Pieces you press stand on the table (D-93) ----------
   Buttons, icon hexes, options and the choice hexes show a solid side under them, a darker shade of
   their own face: shaded cardboard under cream, deep vermilion under vermilion, the table's deep green
   under dark pieces. A drop-shadow on a clipped element is clipped away with it, so the piece itself is
   left unclipped and its rim moves to a clipped ::before; the face (> span) keeps its own clip-path.
   Pressing sinks the piece into its side. */
:is(.hs-btn, .hs-icon, .hs-option, .hs-choice) {
  --edge: color-mix(in srgb, var(--tile-line) 55%, var(--ink));
  --lift: 5px;
  position: relative;
  isolation: isolate;
  background: none;
  clip-path: none;
  filter: drop-shadow(0 var(--lift) 0 var(--edge)) drop-shadow(0 2px 0 var(--table-deep));
}
:is(.hs-btn, .hs-icon, .hs-option, .hs-choice)::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background: var(--rim);
  clip-path: var(--hex-h);
}
:is(.hs-icon, .hs-choice)::before {
  clip-path: var(--hex);
}
.hs-option.hs-option-block::before {
  clip-path: none;
}
.hs-choice {
  --lift: 6px;
}
:is(.hs-btn-you, .hs-choice[aria-pressed="true"]) {
  --edge: var(--you-ink);
}
:is(.hs-btn-quiet, .hs-icon, .hs-option:not(:has(input:checked))) {
  --edge: var(--table-deep);
}
:is(.hs-btn, .hs-icon, .hs-choice):active:not([disabled]),
.hs-option:active {
  --lift: 2px;
  transform: translateY(3px);
  /* Set again: hindsight.css's own .hs-btn:active filter would otherwise win. */
  filter: drop-shadow(0 var(--lift) 0 var(--edge)) drop-shadow(0 2px 0 var(--table-deep));
}
.hs-choice:active:not([disabled]) {
  transform: translateY(4px);
}

/* Focus changes the rim's colour only; hindsight.css also thickens it, which makes the label jump. */
.hs-btn:focus-visible {
  padding: 2px;
}

/* Nothing presses with reduced motion. */
@media (prefers-reduced-motion: reduce) {
  :is(.hs-btn, .hs-icon, .hs-option, .hs-choice):active {
    transform: none;
  }
}

/* biome-ignore-all lint/style/noDescendingSpecificity: link colors follow the surface they sit on, set after the base link rule */
/* History pages (E19-4): served by the Worker with no JavaScript, styled from the design tokens and the
   board-game components (design/DESIGN.md). The web build emits this after tokens.css and hindsight.css
   as /history.css. Chalk text on the table like the legal pages; the parts read closely sit on square
   tiles (D-70); the call to play is a hexagon button. */

html {
  -webkit-text-size-adjust: 100%;
  background: var(--table);
}
body {
  margin: 0;
  min-height: 100vh;
  font: 400 17px / 1.6 var(--font-sans);
}
a {
  color: var(--chalk);
  text-decoration: underline;
  text-underline-offset: 2px;
}
a:hover {
  text-decoration: none;
}
a:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
}

.hp-top,
.hp-main,
.hp-foot {
  max-width: 44rem;
  margin: 0 auto;
  padding: 0 var(--space-4);
  box-sizing: border-box;
}
.hp-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
  padding-top: var(--space-4);
  padding-bottom: var(--space-4);
  font-size: 14px;
  font-weight: 800;
}
.hp-top a {
  text-decoration: none;
}
.hp-logo img {
  display: block;
}
.hp-main {
  padding-bottom: var(--space-8);
}

.hp-crumbs {
  font-size: 13px;
  color: var(--chalk-muted);
  margin: var(--space-2) 0;
}
.hp-crumbs a {
  color: var(--chalk-muted);
}
h1 {
  margin: var(--space-2) 0 var(--space-2);
  font: 400 36px / 1.1 var(--font-display);
  text-wrap: balance;
}
h2 {
  margin: var(--space-8) 0 var(--space-3);
  font: 400 26px / 1.2 var(--font-display);
  text-wrap: balance;
}
h3 {
  margin: var(--space-4) 0 var(--space-2);
  font: 800 18px / 1.35 var(--font-sans);
}
p {
  margin: 0 0 var(--space-3);
}
sup {
  font-size: 0.7em;
  line-height: 0;
  margin-left: 1px;
}
sup a {
  text-decoration: none;
  color: var(--history);
  font-weight: 800;
}
.hp-dateline,
.hp-when {
  font: 800 12px / 14px var(--font-sans);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--chalk-muted);
  margin-bottom: var(--space-4);
}

/* Square tiles (D-70): tile fill, ink text, no radius, the hard piece shadow. */
.hp-tile {
  background: var(--tile);
  color: var(--ink);
  padding: var(--space-4) var(--space-4) var(--space-2);
  box-shadow: var(--shadow-card);
  margin: var(--space-4) 0;
}
.hp-tile a {
  color: var(--ink);
}
.hp-tile sup a {
  color: var(--history-ink);
}
.hp-tile .hp-when {
  color: var(--ink-muted);
  margin-bottom: var(--space-1);
}
.hp-tile h2,
.hp-tile h3 {
  margin-top: 0;
}
.hp-answer p {
  font-size: 19px;
  line-height: 1.55;
}
.hp-game {
  background: var(--tile-sunk);
}

.hp-play {
  margin: var(--space-6) 0;
}
.hp-play .hs-btn {
  text-decoration: none;
}

.hp-figures {
  width: 100%;
  border-collapse: collapse;
  font-size: 15px;
}
.hp-figures th,
.hp-figures td {
  text-align: left;
  vertical-align: top;
  padding: var(--space-2) var(--space-2) var(--space-2) 0;
  border-bottom: 1px solid var(--table-line);
}
.hp-figures thead th {
  font: 800 12px / 14px var(--font-sans);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--chalk-muted);
}
.hp-figures tbody th {
  font-weight: 600;
}

.hp-decisions,
.hp-index {
  list-style: none;
  margin: 0;
  padding: 0;
}
.hp-decisions .hs-crowd {
  margin: var(--space-2) 0 var(--space-3);
}
.hp-decisions .hs-crowd-text {
  margin: 0;
}
.hp-index h2 {
  margin: 0 0 var(--space-2);
  font-size: 22px;
}
.hp-index a {
  text-decoration: none;
}

.hp-timeline {
  margin: 0;
  padding-left: var(--space-6);
}
.hp-timeline li {
  margin-bottom: var(--space-2);
}
.hp-sources {
  margin: 0;
  padding-left: var(--space-6);
  font-size: 14px;
  color: var(--chalk-muted);
}
.hp-sources li {
  margin-bottom: var(--space-2);
}
.hp-sources li:target {
  color: var(--chalk);
}
.hp-sources a {
  color: var(--chalk-muted);
  overflow-wrap: anywhere;
}
.hp-primary {
  font-weight: 800;
  color: var(--history);
}

.hp-foot {
  padding-top: var(--space-6);
  padding-bottom: var(--space-12);
  border-top: 1px solid var(--table-line);
  font-size: 13px;
  color: var(--chalk-muted);
}
.hp-foot a {
  color: var(--chalk-muted);
}

@media (min-width: 640px) {
  h1 {
    font-size: 46px;
  }
  .hp-tile {
    padding: var(--space-6) var(--space-6) var(--space-4);
  }
}
