:root {
  /* Layout: one phone-width column of sealed slips on a town notice board; two columns from 880px. */
  --paper: #E4EAE6;
  --card: #F5F8F5;
  --ink: #14232A;
  --muted: #52646A;
  --line: #C3CEC9;
  --you: #8A5200;
  --you-fill: #EDB640;
  --you-on: #2A1B00;
  --them: #7B2D5E;
  --them-fill: #7B2D5E;
  --them-on: #FFF4FA;
  --display: "Bricolage Grotesque", "Arial Narrow", system-ui, sans-serif;
  --accent-font: "Science Gothic", "Bricolage Grotesque", "Arial Narrow", system-ui, sans-serif;
  --body: "Atkinson Hyperlegible", Verdana, system-ui, sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --paper: #0E1719; --card: #162226; --ink: #E4EDE9; --muted: #93A5A7; --line: #2B3B40;
    --you: #F2BE55; --you-fill: #E0A62E; --you-on: #201400;
    --them: #E09AC4; --them-fill: #8E3A70; --them-on: #FFF4FA;
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --paper: #0E1719; --card: #162226; --ink: #E4EDE9; --muted: #93A5A7; --line: #2B3B40;
  --you: #F2BE55; --you-fill: #E0A62E; --you-on: #201400;
  --them: #E09AC4; --them-fill: #8E3A70; --them-on: #FFF4FA;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--paper); color: var(--ink); font-family: var(--body); font-size: 16px; line-height: 1.45; }
h1, h2, h3, p { margin: 0; }
button { font: inherit; color: inherit; }
.wrap { max-width: 1040px; margin: 0 auto; padding: 20px 16px 32px; display: grid; gap: 16px; }
.mast { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 8px 16px; }
.mast h1 { font-family: var(--accent-font); font-weight: 800; font-size: 44px; line-height: 0.9; letter-spacing: 0.04em; }
.mast .sub { color: var(--muted); font-size: 14px; }
.pips { display: flex; gap: 6px; align-items: center; }
.pip { width: 14px; height: 14px; border-radius: 50%; border: 2px solid var(--ink); }
.pip.done { background: var(--ink); }
.pip.now { box-shadow: 0 0 0 3px var(--paper), 0 0 0 5px var(--you-fill); }
.turnlabel { font-family: var(--accent-font); font-weight: 600; font-size: 14px; letter-spacing: 0.03em; margin-right: 6px; }
.cols { display: grid; gap: 16px; }
.stack { display: grid; gap: 16px; align-content: start; min-width: 0; }
@media (min-width: 880px) { .cols { grid-template-columns: minmax(0, 1.1fr) minmax(0, 0.9fr); } }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 6px; padding: 14px; display: grid; gap: 10px; }
.eyebrow { font-size: 12px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); font-weight: 700; }
.card h2 { font-family: var(--display); font-weight: 800; font-size: 24px; line-height: 1.05; text-wrap: balance; }
.them-card { border-left: 6px solid var(--them-fill); }
.you-card { border-left: 6px solid var(--you-fill); }
.small { font-size: 14px; color: var(--muted); }
.rules { font-size: 14px; display: grid; gap: 4px; padding-left: 18px; margin: 0; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { font-size: 13px; padding: 3px 9px; border-radius: 999px; border: 1px solid var(--line); background: var(--paper); white-space: nowrap; }
.chip.you { background: var(--you-fill); color: var(--you-on); border-color: transparent; font-weight: 700; }
.chip.them { background: var(--them-fill); color: var(--them-on); border-color: transparent; font-weight: 700; }
.bars { display: grid; gap: 6px; }
.bar { display: grid; grid-template-columns: minmax(0, 9.5em) 1fr 3.2em; gap: 8px; align-items: center; font-size: 14px; }
.bar .track { height: 12px; background: var(--paper); border: 1px solid var(--line); border-radius: 2px; overflow: hidden; }
.bar .fill { height: 100%; background: var(--them-fill); transition: width 0.4s ease; }
.bar .pct { text-align: right; font-variant-numeric: tabular-nums; color: var(--muted); }
.bar.mine .lbl { font-weight: 700; color: var(--you); }
.person { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px 10px; align-items: center; padding: 10px 0; border-top: 1px solid var(--line); }
.person:first-of-type { border-top: 0; }
.person .who { min-width: 0; }
.person .role { font-family: var(--display); font-weight: 800; font-size: 19px; line-height: 1.1; }
.person .meta { font-size: 13px; color: var(--muted); display: flex; flex-wrap: wrap; gap: 4px 8px; align-items: center; }
.own { font-size: 12px; font-weight: 700; padding: 1px 7px; border-radius: 3px; border: 1px solid var(--line); }
.own.you { background: var(--you-fill); color: var(--you-on); border-color: transparent; }
.own.them { background: var(--them-fill); color: var(--them-on); border-color: transparent; }
.acts { display: flex; gap: 6px; }
.act { min-height: 44px; min-width: 60px; padding: 6px 8px; border-radius: 4px; border: 2px solid var(--ink); background: transparent; cursor: pointer; font-weight: 700; font-size: 14px; }
.act:disabled { border-color: var(--line); color: var(--muted); cursor: not-allowed; }
.act.visit[aria-pressed="true"] { background: var(--you-fill); color: var(--you-on); border-color: var(--you-fill); }
.act.expect[aria-pressed="true"] { background: var(--them-fill); color: var(--them-on); border-color: var(--them-fill); }
.act.dodge[aria-pressed="true"] { background: var(--ink); color: var(--card); border-color: var(--ink); }
.check { display: flex; gap: 8px; align-items: center; min-height: 44px; }
.check input { width: 20px; height: 20px; accent-color: var(--ink); }
button:focus-visible, summary:focus-visible, select:focus-visible { outline: 3px solid var(--you-fill); outline-offset: 2px; }
.callrow { display: flex; flex-wrap: wrap; gap: 6px; }
.callopt { min-height: 40px; padding: 6px 12px; border-radius: 999px; border: 1.5px solid var(--ink); background: transparent; cursor: pointer; font-size: 14px; }
.callopt[aria-pressed="true"] { background: var(--ink); color: var(--card); font-weight: 700; }
.dock { position: sticky; bottom: 0; background: var(--paper); padding: 10px 0 12px; border-top: 2px solid var(--ink); display: grid; gap: 8px; z-index: 2; }
.dock .picks { font-size: 14px; display: flex; flex-wrap: wrap; gap: 4px 14px; }
.primary { min-height: 52px; width: 100%; border: 0; border-radius: 4px; background: var(--ink); color: var(--paper); font-family: var(--display); font-weight: 800; font-size: 20px; cursor: pointer; }
.primary:disabled { background: var(--line); color: var(--muted); cursor: not-allowed; }
.ghost { min-height: 44px; padding: 8px 14px; border-radius: 4px; border: 2px solid var(--ink); background: transparent; cursor: pointer; font-weight: 700; }
.slips { display: grid; gap: 8px; }
.slip { border: 1px dashed var(--ink); border-radius: 4px; padding: 10px 12px; background: var(--card); display: grid; gap: 2px; }
.slip.you { border-left: 6px solid var(--you-fill); }
.slip.them { border-left: 6px solid var(--them-fill); }
.slip b.tag { font-family: var(--display); font-size: 13px; letter-spacing: 0.06em; text-transform: uppercase; }
.slip .award { font-weight: 700; }
.slip.you .award { color: var(--you); }
.slip.them .award { color: var(--them); }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { text-align: left; padding: 5px 6px; border-top: 1px solid var(--line); vertical-align: top; }
thead th { border-top: 0; font-size: 12px; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
.scroll { overflow-x: auto; }
.verdict { font-family: var(--accent-font); font-weight: 800; font-size: 32px; line-height: 1.05; letter-spacing: 0.01em; text-wrap: balance; }
.agenda { display: grid; gap: 4px; padding: 8px 0; border-top: 1px solid var(--line); }
.agenda:first-of-type { border-top: 0; }
.agenda .nm { font-weight: 700; }
.row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
select { font: inherit; min-height: 44px; padding: 6px 8px; border-radius: 4px; border: 2px solid var(--ink); background: var(--card); color: var(--ink); }
.share { font-size: 14px; background: var(--paper); border: 1px solid var(--line); border-radius: 4px; padding: 8px 10px; white-space: pre-wrap; }

.board { width: 100%; max-width: 470px; margin: 0 auto; display: block; touch-action: manipulation; }
.board .edge { stroke: var(--muted); stroke-width: 2.5; stroke-linecap: round; opacity: 0.55; }
.board .v { fill: var(--card); stroke: var(--ink); stroke-width: 1.5; }
.board .v.mission { stroke-width: 3.5; }
.board .v.you { fill: var(--you-fill); }
.board .v.them { fill: var(--them-fill); }
.board .lbl { font-family: var(--display); font-weight: 800; font-size: 13px; fill: var(--ink); text-anchor: middle; dominant-baseline: central; pointer-events: none; }
.board .lbl.big { font-size: 16px; }
.board .lbl.you { fill: var(--you-on); }
.board .lbl.them { fill: var(--them-on); }
.board .goal { fill: none; stroke: var(--you); stroke-width: 2.5; }
.board .pickmove { fill: none; stroke: var(--you); stroke-width: 5; }
.board .pickexpect { fill: none; stroke: var(--them); stroke-width: 4; stroke-dasharray: 6 4; }
.board .dim { opacity: 0.4; }
.board .can { fill: none; stroke: var(--ink); stroke-width: 1.5; stroke-dasharray: 2 3; }
.sw.can { border: 1.5px dotted var(--ink); }
.board .hit { fill: transparent; cursor: pointer; }
.board .hit.off { cursor: default; }
.board .hit:focus-visible { outline: none; stroke: var(--you-fill); stroke-width: 3; }
.modes { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.mode { min-height: 44px; border-radius: 4px; border: 2px solid var(--ink); background: transparent; cursor: pointer; font-weight: 700; }
.mode:disabled { border-style: dashed; border-color: var(--muted); color: var(--muted); cursor: not-allowed; font-weight: 400; }
.mode.m[aria-pressed="true"] { background: var(--you-fill); color: var(--you-on); border-color: var(--you-fill); }
.mode.e[aria-pressed="true"] { background: var(--them-fill); color: var(--them-on); border-color: var(--them-fill); }
.steps { display: grid; grid-template-columns: 1fr 1fr; gap: 8px 14px; }
.step { display: grid; gap: 4px; font-size: 14px; }
.step .ctl { display: flex; align-items: center; gap: 8px; }
.step button { min-width: 44px; min-height: 44px; border-radius: 4px; border: 2px solid var(--ink); background: transparent; cursor: pointer; font-weight: 700; font-size: 18px; }
.step button:disabled { border-color: var(--line); color: var(--muted); cursor: not-allowed; }
.step .val { font-family: var(--display); font-weight: 800; font-size: 22px; min-width: 1.2em; text-align: center; font-variant-numeric: tabular-nums; }
.meter { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.meter .cap { font-size: 12px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); font-weight: 700; }
.meter .pts { display: flex; gap: 6px; }
.meter .pt { width: 26px; height: 26px; border-radius: 50%; border: 2.5px solid var(--ink); background: transparent; display: inline-block; position: relative; }
.meter .pt.on { background: var(--you-fill); }
.meter .pt.spend { background: transparent; border-style: dashed; border-color: var(--you); }
.meter .pt.spend::after { content: ""; position: absolute; inset: 6px; border-radius: 50%; background: var(--you-fill); }
.meter .count { font-family: var(--display); font-weight: 800; font-size: 22px; font-variant-numeric: tabular-nums; }
.meter .note { font-size: 13px; color: var(--muted); }
.legend { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: 13px; color: var(--muted); }
.legend span { display: inline-flex; align-items: center; gap: 5px; }
.sw { width: 14px; height: 14px; border-radius: 50%; border: 1.5px solid var(--ink); display: inline-block; background: var(--card); }
.sw.you { background: var(--you-fill); } .sw.them { background: var(--them-fill); } .sw.goal { border: 2.5px solid var(--you); } .sw.mis { border-width: 3.5px; }

/* ---- play screen: board first, everything a turn needs on one phone screen ---- */
.wrap { padding-top: 6px; gap: 6px; }
.stack { gap: 6px; }
.mast { align-items: baseline; }
.mast h1 { font-size: 24px; line-height: 1; }
.mast h1 .sub { font-family: var(--body); font-weight: 400; font-size: 13px; letter-spacing: 0; color: var(--muted); margin-left: 6px; }
.strip { display: grid; gap: 4px; background: var(--card); border: 1px solid var(--line); border-left: 6px solid var(--you-fill); border-radius: 6px; padding: 6px 8px; }
.strip .obj { display: flex; align-items: center; gap: 8px; }
.strip .obj { justify-content: space-between; }
.strip .obj > span:first-child { display: inline-flex; align-items: center; gap: 8px; }
.strip .cap, .meter .cap { font-size: 11.5px; letter-spacing: 0.07em; text-transform: uppercase; color: var(--muted); font-weight: 700; }
.trios { display: flex; flex-wrap: wrap; gap: 6px; }
.trio { display: inline-flex; gap: 2px; padding: 2px; border: 1px solid var(--line); border-radius: 5px; background: var(--paper); }
.trio.mine { border-color: var(--you); border-width: 2px; }
.trio.truth { border-color: var(--them); border-width: 2px; }
.cell { width: 22px; height: 22px; display: inline-flex; align-items: center; justify-content: center; border-radius: 3px; font-family: var(--display); font-weight: 800; font-size: 13.5px; background: var(--card); color: var(--ink); }
.cell.you { background: var(--you-fill); color: var(--you-on); }
.cell.them { background: var(--them-fill); color: var(--them-on); }
.boardwrap { margin: 0 -16px; }
/* Full width, but on a short screen give up a little height so the turn's buttons stay in view. */
.board { max-width: none; max-height: max(290px, calc(100dvh - 326px)); }
@media (max-width: 380px) { .cell { width: 19px; height: 21px; font-size: 12.5px; } .trios { gap: 5px; } }
.board .lbl { font-size: 14px; }
.board .lbl.big { font-size: 18px; }
.controls { display: grid; gap: 6px; grid-template-columns: minmax(0, 1fr); }
.stack { grid-template-columns: minmax(0, 1fr); }
.controls .hint { margin: 0; }
.steps { grid-template-columns: 1fr 1fr; gap: 8px; }
.step { display: flex; align-items: center; justify-content: space-between; gap: 6px; }
.step button { min-width: 40px; min-height: 40px; }
.dock { display: flex; align-items: center; gap: 10px; padding: 8px 0 10px; border-top: 0; background: var(--paper); }
/* iOS Safari: when its toolbar is tucked away, a tap in the bottom strip of the screen brings the toolbar
   back instead of reaching the page. 100dvh - 100svh is zero while the toolbar shows and grows when it
   hides, so the bar lifts its button clear of that strip only when it has to. */
@supports (height: 100dvh) { .dock { padding-bottom: calc(10px + min(56px, 100dvh - 100svh)); } }
button, .hit, summary, label.ghost { touch-action: manipulation; }
.dock .meter { display: grid; gap: 3px; flex: none; }
.dock .meter .pt { width: 22px; height: 22px; }
.dock .meter .pt.spend::after { inset: 5px; }
.dock .primary { flex: 1; min-width: 0; font-size: 18px; }
.rulesbox summary { cursor: pointer; font-weight: 700; min-height: 32px; display: flex; align-items: center; }
.rulesbox[open] summary { margin-bottom: 4px; }
@media (min-width: 880px) {
  .wrap { padding-top: 20px; gap: 16px; } .stack { gap: 16px; }
  .mast h1 { font-size: 44px; }
  .boardwrap { margin: 0; } .board { max-width: 560px; max-height: none; }
}

/* ---- names beside the plain pieces ---- */
.board .cap { font-family: var(--body); font-size: 12px; fill: var(--muted); text-anchor: middle; dominant-baseline: central; pointer-events: none; paint-order: stroke; stroke: var(--paper); stroke-width: 3px; stroke-linejoin: round; }
/* ---- last turn on the board: arrows for moves, dashed rings for waiting, dots for points ---- */
.fx { pointer-events: none; }
.fx .arrow { fill: none; stroke-width: 5.5; stroke-linecap: round; stroke-dasharray: 1; stroke-dashoffset: 0; }
.fx .bar { fill: none; stroke-width: 4.5; stroke-linecap: round; }
.fx .watch { fill: none; stroke-width: 3; stroke-dasharray: 5 4; }
.fx .cutring { fill: none; stroke: var(--ink); stroke-width: 2; stroke-dasharray: 2 4; }
.fx .you.arrow, .fx .you.bar, .fx .you.watch { stroke: var(--you); } .fx .you.head, .fx .you.pip, .fx .you.plus { fill: var(--you); }
.fx .them.arrow, .fx .them.bar, .fx .them.watch { stroke: var(--them); } .fx .them.head, .fx .them.pip, .fx .them.plus { fill: var(--them); }
.fx .pip { stroke: var(--paper); stroke-width: 1.2; }
.fx .plus { font-family: var(--display); font-weight: 800; font-size: 15px; text-anchor: middle; dominant-baseline: central; paint-order: stroke; stroke: var(--paper); stroke-width: 3.5px; stroke-linejoin: round; }
.fx .arrow.fail { stroke-dasharray: 0.16 0.2; }
.fx .head.fail { opacity: 0; }
.fx .watch.caught { stroke-width: 5; stroke-dasharray: none; }
/* While you choose, last turn stays as a faint trace. */
.board.trace .fx { opacity: 0.4; }
.board.trace .fx .cutring { opacity: 0; }
/* Playback: each stage is a class added to the board in turn. */
.board .v { transition: fill 0.35s ease; }
.board.playing .fx .arrow { stroke-dasharray: 1; stroke-dashoffset: 1; transition: stroke-dashoffset 0.5s ease, opacity 0.3s ease; }
.board.playing .fx .head, .board.playing .fx .pip, .board.playing .fx .watch, .board.playing .fx .bar, .board.playing .fx .plus, .board.playing .fx .cutring { opacity: 0; transition: opacity 0.3s ease, transform 0.45s ease, stroke-width 0.25s ease; }
.board.playing .fx .watch { stroke-width: 3; stroke-dasharray: 5 4; }
.board.playing.go .fx .arrow { stroke-dashoffset: 0; }
.board.playing.go .fx .head { opacity: 1; transition-delay: 0.35s; }
.board.playing.go .fx .pip, .board.playing.go .fx .watch { opacity: 1; }
.board.playing .fx .plus { transform: translateY(10px); }
.board.playing.r .fx .plus { opacity: 1; transform: none; }
.board.playing.r .fx .watch.caught { stroke-width: 6; stroke-dasharray: none; }
.board.playing.r .fx .watch.broken { opacity: 0.35; }
.board.playing.r .fx .arrow.blocked, .board.playing.c .fx .arrow.lost { stroke-dasharray: 0.16 0.2; opacity: 0.6; transition: opacity 0.3s ease; }
.board.playing.r .fx .head.blocked, .board.playing.c .fx .head.lost { opacity: 0; transition-delay: 0s; }
.board.playing.r .fx .bar.blocked, .board.playing.c .fx .bar.lost { opacity: 1; }
.board.playing.k .fx .cutring { opacity: 1; }
.board.playing.k .fx .arrow, .board.playing.k .fx .head, .board.playing.k .fx .pip { opacity: 0.45; }
.board.playing .hit { cursor: pointer; }
.playcap { min-height: 5.2em; font-size: 15px; margin: 0; }
.lastline { margin: 0; min-width: 0; max-width: 100%; overflow: hidden; display: flex; align-items: center; gap: 8px; font-size: 13px; }
.lastline span { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lastline span.wrapok { white-space: normal; }
button.link { flex: none; background: none; border: 0; padding: 0 2px; color: var(--ink); text-decoration: underline; cursor: pointer; font-size: 14px; min-height: 28px; }
@media (prefers-reduced-motion: no-preference) {
  .meter .pt.new { animation: pop 0.6s ease; }
  @keyframes pop { 0% { transform: scale(0.3); } 60% { transform: scale(1.35); } 100% { transform: scale(1); } }
}
.pair { display: inline-flex; align-items: center; gap: 8px; white-space: nowrap; }
input[type="text"] { font: inherit; min-height: 44px; padding: 6px 8px; border-radius: 4px; border: 2px solid var(--ink); background: var(--card); color: var(--ink); width: 9.5em; max-width: 100%; }

/* ---- front page ---- */
.front { display: grid; gap: 14px; max-width: 760px; margin: 0 auto; grid-template-columns: minmax(0, 1fr); }
.mast.front { width: 100%; max-width: 760px; justify-self: center; }
.intro .tagline { font-family: var(--display); font-weight: 800; font-size: clamp(20px, 5vw, 28px); line-height: 1.2; margin: 0 0 10px; }
.intro p { margin: 0; }
.homelink { color: inherit; text-decoration: none; }
.homelink:hover, .homelink:focus-visible { text-decoration: underline; }
.card a { color: var(--ink); }
button.primary.inline, .front button.primary { min-height: 48px; padding: 10px 18px; }
