@font-face {
  font-family: Barlow;
  src: url('/fonts/barlow-400.woff2') format('woff2');
  font-weight: 400;
  font-display: swap;
}
@font-face {
  font-family: Barlow;
  src: url('/fonts/barlow-600.woff2') format('woff2');
  font-weight: 600;
  font-display: swap;
}
@font-face {
  font-family: Barlow;
  src: url('/fonts/barlow-700.woff2') format('woff2');
  font-weight: 700;
  font-display: swap;
}
@font-face {
  font-family: Barlow;
  src: url('/fonts/barlow-800.woff2') format('woff2');
  font-weight: 800;
  font-display: swap;
}
@font-face {
  font-family: 'Barlow Semi Condensed';
  src: url('/fonts/barlow-semi-condensed-600.woff2') format('woff2');
  font-weight: 600;
  font-display: swap;
}

/* Scorecard shell shared with Patches and Better Tango: two inks and hairline rules.
   Colour belongs to the board. Type is set in rem so it follows the reader's text size. */
:root {
  font-family: var(--font-ui);
  font-feature-settings: 'tnum' 1;
  color-scheme: light;
  -webkit-font-smoothing: antialiased;
  --font-ui: Barlow, ui-sans-serif, system-ui, sans-serif;
  --font-label: 'Barlow Semi Condensed', Barlow, ui-sans-serif, system-ui, sans-serif;
  --bg: #f4f5f6;
  --surface: #fff;
  --panel: #eaecee;
  --ink: #16191f;
  --ink-hover: #2b2f37;
  --muted: #5d626b;
  --line: #d7dade;
  --line-strong: #8e939b;
  --primary: #16191f;
  --on-primary: #fff;
  --board: #f7f6f2;
  --dot: #e2ddd3;
  --dock: #86622f;
  --token-ink: #1c2321;
  --backdrop: rgb(22 25 31 / 0.45);
  --lift: rgb(20 24 30 / 0.16);
  --width: 480px;
  --gutter: 20px;
  --page-left: max(var(--gutter), env(safe-area-inset-left, 0px));
  --page-right: max(var(--gutter), env(safe-area-inset-right, 0px));
  color: var(--ink);
  background: var(--bg);
}
:root[data-theme='dark'] {
  color-scheme: dark;
  --bg: #121418;
  --surface: #1b1e24;
  --panel: #23262d;
  --ink: #eceef1;
  --ink-hover: #d4d7dc;
  --muted: #9aa0a9;
  --line: #2e323a;
  --line-strong: #5a5f68;
  --primary: #eceef1;
  --on-primary: #121418;
  --board: #191c21;
  --dot: #343840;
  --dock: #d6b77f;
  --backdrop: rgb(0 0 0 / 0.6);
  --lift: rgb(0 0 0 / 0.4);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme='light']) {
    color-scheme: dark;
    --bg: #121418;
    --surface: #1b1e24;
    --panel: #23262d;
    --ink: #eceef1;
    --ink-hover: #d4d7dc;
    --muted: #9aa0a9;
    --line: #2e323a;
    --line-strong: #5a5f68;
    --primary: #eceef1;
    --on-primary: #121418;
    --board: #191c21;
    --dot: #343840;
    --dock: #d6b77f;
    --backdrop: rgb(0 0 0 / 0.6);
    --lift: rgb(0 0 0 / 0.4);
  }
}

/* Token colours rise with the value; the same hues in both themes. */
[data-rank='0'] {
  --c: #e8d9b5;
}
[data-rank='1'] {
  --c: #b9d98a;
}
[data-rank='2'] {
  --c: #82d3b2;
}
[data-rank='3'] {
  --c: #6cc3dd;
}
[data-rank='4'] {
  --c: #8ea9ef;
}
[data-rank='5'] {
  --c: #b496ec;
}
[data-rank='6'] {
  --c: #eb98c4;
}
[data-rank='7'] {
  --c: #f3a47a;
}
[data-rank='8'],
[data-rank='9'] {
  --c: #f0c44c;
}

* {
  box-sizing: border-box;
}
html {
  -webkit-tap-highlight-color: transparent;
  -webkit-text-size-adjust: 100%;
}
body {
  margin: 0;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  color: var(--ink);
}
main {
  flex: 1 0 auto;
}
button,
input,
select,
textarea {
  font: inherit;
  color: inherit;
}
button {
  cursor: pointer;
}
button:disabled {
  cursor: default;
}
:is(button, a, input, select, textarea, summary):focus-visible {
  outline: 2px solid var(--ink);
  outline-offset: 3px;
}
::selection {
  background: var(--ink);
  color: var(--surface);
}
a {
  color: inherit;
  text-underline-offset: 3px;
  text-decoration-color: var(--line-strong);
}
.shell {
  width: min(calc(100% - var(--page-left) - var(--page-right)), var(--width));
  margin-inline: auto;
}
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}
.tabular {
  font-variant-numeric: tabular-nums;
}
.field-label,
.score dt,
.dialog-section-title {
  font-family: var(--font-label);
  font-size: 0.6875rem;
  font-weight: 600;
  line-height: 1;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--muted);
}

/* ---- Header and footer ---- */
.site-header {
  background: var(--bg);
  border-bottom: 1px solid var(--line);
  padding: env(safe-area-inset-top, 0px) var(--page-right) 0 var(--page-left);
}
.header-inner {
  width: min(100%, var(--width));
  height: 56px;
  margin: auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.site-header nav {
  display: flex;
  align-items: center;
  gap: 4px;
}
.wordmark {
  display: flex;
  align-items: center;
  gap: 9px;
  font-size: 1.3125rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  text-decoration: none;
}
.wordmark img {
  display: block;
  flex: none;
}
.icon-button {
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  padding: 0;
  border: 0;
  border-radius: 4px;
  background: transparent;
}
:is(.icon-button, .text-button, .close, .secondary, .score, .keys summary) svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.text-button {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 44px;
  padding: 0 8px;
  border: 0;
  border-radius: 4px;
  background: none;
  color: var(--muted);
  font-size: 0.8125rem;
  font-weight: 600;
  text-decoration: none;
}
.text-button svg {
  width: 16px;
  height: 16px;
}
.site-footer {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0 18px;
  width: min(calc(100% - var(--page-left) - var(--page-right)), var(--width));
  margin: 0 auto;
  padding: 6px 0 max(12px, env(safe-area-inset-bottom));
  border-top: 1px solid var(--line);
  font-size: 0.8125rem;
  color: var(--muted);
}
.site-footer a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  min-width: 44px;
  text-decoration: none;
}
.site-footer .domain {
  margin-left: auto;
}

/* ---- Game layout ---- */
.game {
  padding-block: 16px 24px;
}
.game-heading {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
}
.modes,
.sizes {
  display: inline-flex;
  gap: 2px;
  padding: 2px;
  border: 1px solid var(--line);
  border-radius: 5px;
}
.modes a,
.sizes button {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding-inline: 12px;
  border: 1px solid transparent;
  border-radius: 3px;
  background: none;
  font-size: 0.9375rem;
  font-weight: 600;
  text-decoration: none;
  color: var(--muted);
}
.modes a[aria-current='page'],
.sizes button[aria-pressed='true'] {
  background: var(--surface);
  border-color: var(--ink);
  color: var(--ink);
}
.daily-date,
.challenge-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 32px;
  margin: -4px 0 6px;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--muted);
}
.challenge-banner[hidden] {
  display: none;
}
.play-area {
  position: relative;
}
/* Score strip: an ink rule above, a hairline below, labels over values. */
.score {
  display: flex;
  justify-content: space-between;
  align-items: stretch;
  gap: 12px;
  min-height: 58px;
  margin: 0 0 12px;
  padding: 6px 0;
  border-top: 1px solid var(--ink);
  border-bottom: 1px solid var(--line);
}
.score > div {
  display: grid;
  align-content: center;
  gap: 6px;
}
.score dd {
  display: flex;
  align-items: center;
  min-height: 26px;
  margin: 0;
  font-size: 1.25rem;
  line-height: 1;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}
.score .score-time {
  justify-items: end;
  min-width: 78px;
  padding-left: 14px;
  border-left: 1px solid var(--line);
}
.score .score-time dt {
  display: flex;
  align-items: center;
  gap: 5px;
}
.score .score-time svg {
  width: 11px;
  height: 11px;
  stroke-width: 2.4;
}
/* The target drawn as the token it will become. */
.target-token {
  display: inline-grid;
  place-items: center;
  min-width: 34px;
  height: 26px;
  padding: 0 8px;
  border-radius: 999px;
  background: var(--c, var(--panel));
  color: var(--token-ink);
  font-size: 0.875rem;
  font-weight: 700;
}

/* ---- Board ---- */
.board {
  --gap: 6px;
  position: relative;
  isolation: isolate;
  display: grid;
  grid-template-rows: repeat(var(--size), minmax(0, 1fr));
  gap: var(--gap);
  width: 100%;
  aspect-ratio: 1;
  padding: 0;
  border-radius: 6px;
  background: var(--board);
  container-type: inline-size;
  touch-action: pinch-zoom;
  user-select: none;
  -webkit-user-select: none;
}
.board-row {
  display: grid;
  grid-template-columns: repeat(var(--size), minmax(0, 1fr));
  gap: var(--gap);
}
.cell {
  position: relative;
  min-width: 0;
  min-height: 0;
}
.token {
  display: grid;
  place-items: center;
  width: 100%;
  height: 100%;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: none;
  color: var(--token-ink);
  touch-action: pinch-zoom;
  cursor: grab;
}
.token:focus-visible {
  outline-offset: -2px;
}
.disc,
.number {
  grid-area: 1 / 1;
}
.disc {
  position: relative;
  z-index: 1;
  width: calc(var(--d) * 100%);
  aspect-ratio: 1;
  border-radius: 50%;
  background: var(--c, var(--dot));
  box-shadow: inset 0 -2px 0 rgb(0 0 0 / 0.07);
}
.number {
  position: relative;
  z-index: 3;
  /* Sized from the board width: per-token containers would trap numbers below the merge layer. */
  font-size: calc(var(--d) * 34cqw / var(--size));
  font-weight: 700;
  line-height: 1;
  letter-spacing: -0.02em;
  pointer-events: none;
}
.is-empty .token,
.is-dock .token {
  cursor: default;
}
.is-empty .disc {
  box-shadow: none;
}
/* The dock: a solid bronze ring that receives merges but never moves. Dashed rings mean
   "you can merge here", so the dock never uses one. */
.cell.is-dock::before {
  content: '';
  position: absolute;
  inset: 1%;
  border: 2px solid var(--dock);
  border-radius: 50%;
  pointer-events: none;
}
.cell.is-dock::after {
  content: 'Dock';
  content: 'Dock' / '';
  position: absolute;
  bottom: -4px;
  left: 50%;
  z-index: 5;
  transform: translateX(-50%);
  padding: 0 5px;
  border-radius: 2px;
  background: var(--board);
  color: var(--dock);
  font-family: var(--font-label);
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  line-height: 1.4;
  text-transform: uppercase;
  pointer-events: none;
}
.is-solved .cell.is-dock::before {
  border-width: 3px;
}
.is-selected .disc {
  outline: 3px solid var(--ink);
  outline-offset: 3px;
}
.is-available .disc {
  outline: 2px dashed var(--ink);
  outline-offset: 3px;
}
/* No merges left: the board steps back so the recovery (Undo) leads. */
.board.is-stuck .disc,
.board.is-stuck .number {
  opacity: 0.45;
}
.hint-pill {
  position: absolute;
  z-index: 4;
  left: calc(var(--col) * (100% + var(--gap)) / var(--size) + 2px);
  top: calc(var(--row) * (100% + var(--gap)) / var(--size) + 2px);
  width: calc(var(--w) * (100% + var(--gap)) / var(--size) - var(--gap) - 4px);
  height: calc(var(--h) * (100% + var(--gap)) / var(--size) - var(--gap) - 4px);
  border: 3px solid var(--ink);
  border-radius: 999px;
  pointer-events: none;
}
/* A chevron between the two tokens points from the tile that moves to its destination. */
.hint-pill::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 9px;
  height: 14px;
  background: var(--ink);
  clip-path: polygon(0 0, 42% 0, 100% 50%, 42% 100%, 0 100%, 58% 50%);
  transform: translate(-50%, -50%) rotate(var(--angle, 0deg));
}
.hint-pill[hidden] {
  display: none;
}
/* Merge motion: equal tokens melt together through an SVG goo filter. */
.goo-defs {
  position: absolute;
  width: 0;
  height: 0;
}
.board-fx,
.board-burst {
  position: absolute;
  inset: 0;
  pointer-events: none;
}
.board-fx {
  z-index: 2;
  filter: url('#goo');
}
.board-burst {
  z-index: 6;
}
.fx-disc {
  position: absolute;
  top: 0;
  left: 0;
  border-radius: 50%;
  background: var(--c);
}
.burst-disc {
  display: grid;
  place-items: center;
  color: var(--token-ink);
  font-weight: 700;
  box-shadow: 0 6px 16px var(--lift);
}
.burst-caption {
  position: absolute;
  left: 50%;
  bottom: 10px;
  transform: translateX(-50%);
  padding: 6px 12px;
  border: 1px solid var(--ink);
  border-radius: 4px;
  background: var(--surface);
  font-size: 0.875rem;
  font-weight: 600;
  white-space: nowrap;
}
.is-bursting .cell:not(.is-dock) .disc {
  opacity: 0.35;
}
.status {
  min-height: 3em;
  display: flex;
  align-items: center;
  margin: 4px 0;
  color: var(--muted);
  font-size: 0.9375rem;
  font-weight: 600;
  line-height: 1.3;
}
.status.is-alert {
  color: var(--ink);
  font-weight: 700;
}

/* ---- Controls: transparent with an ink border, as in the sister games ---- */
.actions {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr)) minmax(0, 1.6fr);
  gap: 8px;
}
.practice-actions {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}
.button {
  min-height: 46px;
  padding: 0 6px;
  border: 1px solid var(--ink);
  border-radius: 4px;
  background: transparent;
  font-size: 1rem;
  font-weight: 600;
  white-space: nowrap;
}
.wide {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  min-height: 44px;
  margin-top: 10px;
  padding: 0 12px;
  border-radius: 4px;
  font-size: 0.9375rem;
  font-weight: 600;
  text-decoration: none;
}
.wide[hidden] {
  display: none;
}
.button.primary,
.primary {
  border: 1px solid var(--primary);
  background: var(--primary);
  color: var(--on-primary);
}
.secondary {
  border: 1px solid var(--ink);
  background: transparent;
  color: var(--ink);
}
.button:disabled,
.wide:disabled {
  border-color: var(--line);
  background: transparent;
  color: var(--muted);
}
.secondary-controls {
  display: flex;
  justify-content: flex-end;
  gap: 4px;
  min-height: 44px;
  margin-top: 6px;
}
.secondary-controls [hidden] {
  display: none;
}

/* Leaving the page pauses unranked boards and hides them until the player returns. */
.paused-note {
  display: none;
}
.game-paused .play-area > :not(.paused-note),
.challenge-pending .play-area > * {
  visibility: hidden;
}
.game-paused .paused-note {
  position: absolute;
  inset: 0;
  display: grid;
  place-content: center;
  gap: 4px;
  margin: 0;
  text-align: center;
  color: var(--muted);
  font-size: 1.125rem;
  font-weight: 600;
}
.paused-note:focus {
  outline: none;
}
.paused-note small {
  font-size: 0.875rem;
  font-weight: 400;
}

/* ---- Dialogs ---- */
dialog {
  width: min(440px, calc(100% - 32px));
  max-height: calc(100dvh - 32px);
  overflow: auto;
  overscroll-behavior: contain;
  padding: 24px;
  border: 1px solid var(--ink);
  border-radius: 4px;
  background: var(--surface);
  color: var(--ink);
}
dialog::backdrop {
  background: var(--backdrop);
}
dialog[open][data-animate-open] {
  transition:
    opacity 200ms cubic-bezier(0.23, 1, 0.32, 1),
    transform 200ms cubic-bezier(0.23, 1, 0.32, 1);
}
@starting-style {
  dialog[open][data-animate-open] {
    opacity: 0;
    transform: scale(0.97);
  }
}
.dialog-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--ink);
}
.dialog-title h2 {
  margin: 0;
  font-size: 1.375rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}
.dialog-title h2:focus {
  outline: none;
}
.close {
  display: grid;
  place-items: center;
  flex: none;
  width: 44px;
  height: 44px;
  margin: -8px -10px -8px 0;
  padding: 0;
  border: 0;
  border-radius: 4px;
  background: transparent;
}
.close svg {
  width: 18px;
  height: 18px;
}
dialog p,
dialog li {
  font-size: 0.875rem;
  line-height: 1.6;
}
.dialog-status:empty {
  display: none;
}
.dialog-status,
.dialog-note {
  color: var(--muted);
}
.dialog-section-title {
  margin: 20px 0 10px;
}
.dialog-links {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 4px 12px;
  margin-top: 8px;
}
.help-rules {
  margin: 0;
  padding-left: 20px;
}
.help-rules li {
  margin: 8px 0;
}
.keys summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 44px;
  font-size: 0.8125rem;
  font-weight: 600;
  list-style: none;
  cursor: pointer;
}
.keys summary::-webkit-details-marker {
  display: none;
}
.keys summary svg {
  width: 16px;
  height: 16px;
  color: var(--muted);
}
.keys[open] summary svg {
  transform: rotate(180deg);
}
.keys dl {
  margin: 0;
  font-size: 0.875rem;
}
.keys dl div {
  display: flex;
  justify-content: space-between;
  padding: 6px 0;
  border-top: 1px solid var(--line);
}
.keys dd {
  margin: 0;
}
kbd {
  padding: 1px 4px;
  border: 1px solid var(--line-strong);
  border-radius: 2px;
  font-family: inherit;
  font-size: 0.75rem;
}
#share-value {
  display: block;
  width: 100%;
  padding: 10px;
  border: 1px solid var(--line-strong);
  border-radius: 4px;
  background: var(--bg);
  resize: none;
  scrollbar-width: none;
  font-size: 0.875rem;
  line-height: 1.5;
}
#share-value[wrap='off'] {
  overflow-x: auto;
  white-space: pre;
}
.result-time {
  margin: 4px 0 0;
  font-size: 3.25rem !important;
  font-weight: 700;
  line-height: 1 !important;
  letter-spacing: -0.03em;
}
.result-stats {
  margin: 6px 0 0;
  color: var(--muted);
}
.result-stats:empty,
.streak:empty {
  display: none;
}
.streak {
  margin: 4px 0 0;
  font-weight: 700;
}
.histogram {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: 1fr;
  align-items: end;
  gap: 4px;
  height: 112px;
  margin: 0;
  padding: 0 0 18px;
  list-style: none;
}
.histogram li {
  position: relative;
  display: flex;
  align-items: flex-end;
  height: 100%;
  margin: 0;
}
.histogram .bar {
  width: 100%;
  border-radius: 2px 2px 0 0;
  background: var(--muted);
}
.histogram .is-mine .bar {
  background: var(--ink);
}
.histogram .bar-label {
  position: absolute;
  left: 50%;
  bottom: -18px;
  transform: translateX(-50%);
  font-size: 0.625rem;
  color: var(--muted);
  white-space: nowrap;
}
.top-times {
  margin: 0;
  padding: 0;
  list-style: none;
  border-top: 1px solid var(--line);
}
.top-times li {
  display: grid;
  grid-template-columns: 3em 1fr auto;
  margin: 0;
  padding: 6px 4px;
  border-bottom: 1px solid var(--line);
  font-variant-numeric: tabular-nums;
}
.top-times .place {
  color: var(--muted);
}
.top-times .is-mine {
  font-weight: 700;
  background: var(--panel);
}
.distribution[hidden],
.leaders[hidden] {
  display: none;
}

/* Thumbnails: replays and races. */
.mini-board {
  display: grid;
  grid-template-columns: repeat(var(--size, 4), 1fr);
  gap: 4px;
  padding: 6px;
  border-radius: 4px;
  background: var(--board);
}
.mini-cell {
  display: grid;
  place-items: center;
  aspect-ratio: 1;
  container-type: size;
  border-radius: 50%;
  color: var(--token-ink);
}
.mini-cell::before,
.mini-cell span {
  grid-area: 1 / 1;
}
.mini-cell::before {
  content: '';
  width: calc(var(--d) * 100%);
  aspect-ratio: 1;
  border-radius: 50%;
  background: var(--c, var(--dot));
}
.mini-cell span {
  position: relative;
  font-size: calc(var(--d) * 38cqmin);
  font-weight: 700;
}
.mini-cell.is-dock {
  box-shadow: inset 0 0 0 1.5px var(--dock);
}
.mini-cell.is-hint::before {
  outline: 2px solid var(--ink);
  outline-offset: 2px;
}
.replay-board {
  width: min(100%, 300px);
  margin: 0 auto;
}
.replay-readout,
.race-meta {
  display: flex;
  justify-content: space-between;
  margin: 10px 0 4px;
  font-size: 0.875rem;
  color: var(--muted);
}
#replay-scrub {
  width: 100%;
  height: 44px;
  margin: 0;
  accent-color: var(--ink);
}
.replay-controls {
  display: flex;
  align-items: center;
  gap: 10px;
}
.replay-controls .secondary {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 44px;
  padding: 0 14px;
  border-radius: 4px;
  font-weight: 600;
}
.replay-controls .text-button {
  margin-left: auto;
}
.speed {
  font-size: 0.875rem;
  color: var(--muted);
}
.speed select {
  min-height: 44px;
  border: 1px solid var(--line-strong);
  border-radius: 4px;
  background: var(--surface);
}
.replay-entries {
  margin: 0;
  padding: 0;
  list-style: none;
  border-top: 1px solid var(--line);
}
.replay-entries li {
  display: flex;
  align-items: center;
  margin: 0;
  border-bottom: 1px solid var(--line);
}
.replay-entry {
  flex: 1;
  display: flex;
  justify-content: space-between;
  min-height: 48px;
  padding: 0 6px 0 0;
  border: 0;
  background: none;
  text-align: left;
}
.replay-entry .replay-name {
  font-weight: 700;
}
.replay-entry .replay-meta {
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}
.replay-entries:empty {
  display: none;
}
.race-dialog {
  width: min(560px, calc(100% - 24px));
}
.race-boards {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}
.race-boards figure {
  margin: 0;
}
.race-boards figcaption {
  display: flex;
  justify-content: space-between;
  margin-bottom: 6px;
  font-size: 0.875rem;
  font-weight: 700;
}
.race-boards .mini-board.is-finished {
  box-shadow: 0 0 0 2px var(--ink);
}
.race-boards progress {
  width: 100%;
  height: 6px;
  margin-top: 6px;
  accent-color: var(--ink);
}
.race-outcome {
  min-height: 1.6em;
  margin: 10px 0 0;
  font-size: 1.125rem !important;
  font-weight: 700;
}

/* ---- Guide pages ---- */
.guide-page {
  --width: 720px;
}
.guide {
  padding-block: 28px 44px;
  font-size: 1rem;
  line-height: 1.6;
}
.guide h1 {
  margin: 0;
  font-size: clamp(1.8125rem, 5vw, 2.375rem);
  line-height: 1.12;
  letter-spacing: -0.02em;
}
.guide .guide-lede {
  margin: 8px 0 0;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--ink);
  color: var(--muted);
}
.guide h2 {
  margin: 32px 0 8px;
  font-size: 1.375rem;
  line-height: 1.25;
  letter-spacing: -0.01em;
}
.guide p {
  max-width: 62ch;
  margin: 8px 0 0;
}
.guide-rules {
  margin: 12px 0 0;
  padding: 0;
  list-style: none;
  border-top: 1px solid var(--line);
}
.guide-rules li {
  display: grid;
  grid-template-columns: minmax(140px, 1fr) 2fr;
  gap: 4px 16px;
  padding: 11px 0;
  border-bottom: 1px solid var(--line);
}
.practice-game {
  max-width: 380px;
  margin-top: 16px;
}
.guide-play {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin: 18px 8px 0 0;
  padding-inline: 16px;
  text-decoration: none;
}

/* ---- Hover (fine pointers only: taps must not leave hover behind), narrow screens,
   motion and contrast ---- */
@media (hover: hover) and (pointer: fine) {
  .icon-button:hover,
  .text-button:hover,
  .close:hover {
    background: var(--panel);
    color: var(--ink);
  }
  .modes a:not([aria-current='page']):hover,
  .sizes button:not([aria-pressed='true']):hover,
  .button:not(.primary):not(:disabled):hover,
  .secondary:not(:disabled):hover {
    background: var(--panel);
  }
  .button.primary:not(:disabled):hover,
  .primary:not(:disabled):hover {
    background: var(--ink-hover);
  }
  .cell:not(.is-empty):not(.is-dock) .token:hover .disc {
    transform: scale(1.04);
  }
  .disc {
    transition: transform 120ms ease-out;
  }
}
@media (max-width: 420px) {
  :root {
    --gutter: 14px;
  }
  .site-header nav {
    gap: 0;
  }
  .wordmark {
    font-size: 1.1875rem;
  }
  .modes a,
  .sizes button {
    padding-inline: 9px;
  }
  .board {
    --gap: 3px;
  }
  .actions {
    gap: 5px;
  }
}
@media (max-width: 340px) {
  .modes a,
  .sizes button {
    padding-inline: 6px;
    font-size: 0.875rem;
  }
  .button {
    font-size: 0.9375rem;
  }
}
@media (max-height: 740px) and (min-width: 501px) {
  :root {
    --width: 420px;
  }
  .game {
    padding-block: 12px 16px;
  }
}
@media (prefers-reduced-motion: reduce) {
  .disc {
    transition: none !important;
  }
  dialog[open][data-animate-open] {
    transition: none;
  }
}
@media (forced-colors: active) {
  .disc {
    border: 2px solid CanvasText;
  }
  .is-empty .disc {
    border-color: GrayText;
  }
  .cell.is-dock::before {
    border-color: CanvasText;
  }
  .is-selected .disc,
  .is-available .disc,
  .hint-pill {
    outline-color: Highlight;
    border-color: Highlight;
  }
  .hint-pill::after {
    forced-color-adjust: none;
    background: Highlight;
  }
}
