:root {
  color-scheme: light;
  --forest: #183b2c;
  --ink: #203c2b;
  --cream: #f7f5ec;
  --paper: #fffef8;
  --sage: #a6b89a;
  --gold: #e5b95c;
  --line: #d4dccf;
  --light: #ede9d4;
  --soft: #e5ebde;
  --muted: #536652;
  --focus: #945e0f;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--ink);
  background: #e5e9e0;
}

*, *::before, *::after { box-sizing: border-box; }
body { margin: 0; font-size: 1rem; line-height: 1.4; }
button, input, select, textarea { font: inherit; }
button, .button {
  min-height: 44px;
  padding: 8px 13px;
  border: 1px solid #becaba;
  border-radius: 9px;
  background: var(--paper);
  color: var(--forest);
  font-size: .9375rem;
  font-weight: 720;
  line-height: 1.25;
  cursor: pointer;
}
.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  text-decoration: none;
}
button:disabled, [aria-disabled="true"] { opacity: .54; cursor: default; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
a { color: var(--forest); text-underline-offset: .15em; }
a:hover { text-decoration-thickness: .13em; }
.primary, .diff .active { color: var(--cream); background: var(--forest); border-color: var(--forest); }
.gold { background: var(--gold); border-color: var(--gold); color: var(--forest); }
.danger { color: #87392d; }
[hidden], .hidden { display: none !important; }
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}
h1, h2, h3, p, figure, ul, ol { margin: 0; }
h1, h2, h3 { color: inherit; line-height: 1.16; }
h1 { font-size: 1.75rem; letter-spacing: -.045em; }
h2 { font-size: 1.26rem; letter-spacing: -.025em; }
h3 { font-size: 1rem; }
.small, small { color: var(--muted); font-size: .8125rem; }
.kicker {
  color: var(--muted);
  font-size: .68rem;
  font-weight: 800;
  letter-spacing: .13em;
  text-transform: uppercase;
}
.wrap {
  width: min(100%, 480px);
  min-height: 100vh;
  min-height: 100dvh;
  margin-inline: auto;
  display: flex;
  flex-direction: column;
  background: var(--cream);
  box-shadow: 0 0 36px rgb(24 59 44 / 8%);
}
.head {
  flex: none;
  min-height: calc(48px + env(safe-area-inset-top, 0px));
  padding: env(safe-area-inset-top, 0px) max(13px, env(safe-area-inset-right, 0px)) 0 max(13px, env(safe-area-inset-left, 0px));
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  color: var(--cream);
  background: var(--forest);
}
.brand, a.brand { color: inherit; font-size: 1.625rem; font-weight: 900; letter-spacing: -.055em; text-decoration: none; }
.brand em { color: var(--gold); font-style: normal; }
.brand:has(img) { display: inline-flex; align-items: center; min-height: 44px; }
.brand img { display: block; width: 122px; height: auto; }
.race .brand:has(img) { min-height: 40px; }
.head small { color: var(--gold); font-size: .7rem; font-weight: 800; }
.main {
  flex: 1;
  min-width: 0;
  padding: 14px max(12px, env(safe-area-inset-right, 0px)) 14px max(12px, env(safe-area-inset-left, 0px));
}
.hero { padding: 3px 0 13px; }
.hero p { margin-top: 5px; }
.stack { display: grid; align-content: start; gap: 10px; min-width: 0; }
.row { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.grow { flex: 1; min-width: 0; }
.wide { width: 100%; }
.card, .panel {
  min-width: 0;
  padding: 12px;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 12px;
}
.play-together { background: var(--soft); }
.play-together p { margin: 5px 0 10px; }
.play-together .button + .button { margin-top: 6px; }
.tag {
  display: inline-block;
  padding: 4px 8px;
  border-radius: 100px;
  color: #38573a;
  background: var(--soft);
  font-size: .75rem;
  font-weight: 750;
  white-space: nowrap;
}
.bar { margin-block: 8px; height: 5px; overflow: hidden; border-radius: 5px; background: #dae2d4; }
.bar i { display: block; height: 100%; background: #668b5e; }
progress.bar { display: block; width: 100%; appearance: none; border: 0; }
progress.bar::-webkit-progress-bar { background: #dae2d4; }
progress.bar::-webkit-progress-value { background: #668b5e; }
progress.bar::-moz-progress-bar { background: #668b5e; }
.daily-row, .person {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  border-bottom: 1px solid var(--line);
  padding-block: 7px;
}
.daily-row .icon { color: var(--forest); font: 1.65rem/1 "DejaVu Sans", "Segoe UI Symbol", serif; }
#share-day {
  margin-top: 8px;
  background: #ffbf80;
  border-color: var(--gold);
  color: var(--forest);
}
#share-day:hover, #share-day:active { background: #ffaf66; }
.daily-row:last-child, .person:last-child { border-bottom: 0; }
.diff { display: flex; gap: 6px; }
.diff > :is(button, a, label) { flex: 1; min-width: 0; text-align: center; }
.diff button, .diff a { padding-inline: 3px; }
.avatar { display: grid; place-items: center; flex: 0 0 30px; height: 30px; border-radius: 50%; background: var(--soft); font-weight: 800; }
.person b, .row b { overflow-wrap: anywhere; }
.person button { font-size: .82rem; padding-inline: 8px; }
label { font-size: .875rem; font-weight: 650; }
input:not([type="checkbox"], [type="radio"], [type="hidden"]), select, textarea, .input {
  width: 100%;
  min-width: 0;
  min-height: 44px;
  border: 1px solid #b6c3b2;
  border-radius: 8px;
  padding: 9px 11px;
  color: var(--ink);
  background: white;
}
input:is([type="checkbox"], [type="radio"]) { accent-color: var(--forest); width: 1.1rem; height: 1.1rem; vertical-align: -.16em; }
.code { font-size: 1.5rem; font-weight: 800; letter-spacing: .15em; }
.qr { display: block; width: min(100%, 132px); height: auto; aspect-ratio: 1; image-rendering: pixelated; }
.toast, .status { color: var(--muted); font-size: .8125rem; }
.toast:not(:empty) { margin-block: 5px; }
.nav {
  position: sticky;
  bottom: 0;
  z-index: 2;
  display: flex;
  gap: 2px;
  padding: 4px 2px max(4px, env(safe-area-inset-bottom, 0px));
  border-top: 1px solid var(--line);
  background: var(--paper);
}
.nav > :is(a, button) {
  flex: 1;
  min-width: 0;
  min-height: 48px;
  padding: 4px 1px;
  display: grid;
  align-content: center;
  justify-items: center;
  border: 0;
  border-radius: 8px;
  color: var(--forest);
  background: transparent;
  text-align: center;
  text-decoration: none;
  font-size: .75rem;
  font-weight: 700;
}
.nav span { font-size: 1.2rem; line-height: 1.1; }
.nav :is(.active, [aria-current="page"]) { background: var(--soft); }
.board-meta {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  align-items: center;
  margin-inline: auto;
  gap: 4px;
  min-height: 24px;
  color: var(--muted);
  font-size: .8125rem;
  font-weight: 750;
  font-variant-numeric: tabular-nums;
}
.board-meta > :last-child { text-align: end; }
.board-clock {
  color: var(--forest);
  font-size: .975rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  line-height: 1.2;
}
.board {
  display: grid;
  grid-template: repeat(8, minmax(0, 1fr)) / repeat(8, minmax(0, 1fr));
  width: min(100%, 440px);
  margin: 4px auto 0;
  container-type: inline-size;
  aspect-ratio: 1;
  border: 2px solid #395740;
  border-radius: 5px;
  overflow: hidden;
  user-select: none;
}
#game {
  --solo-chrome: 242px;
  --solo-height: calc(100dvh - var(--solo-chrome) - env(safe-area-inset-top, 0px) - env(safe-area-inset-bottom, 0px));
}
.diff + #game { --solo-chrome: 306px; }
#practice-label { min-height: 1.4em; }
#game :is(.board-meta, .board, .game-placeholder) {
  width: min(100%, 440px, max(260px, var(--solo-height)));
}
.game-placeholder {
  aspect-ratio: 1;
  margin: 4px auto 0;
  border: 2px solid #395740;
  border-radius: 5px;
  background: repeating-conic-gradient(var(--light) 0 25%, var(--sage) 0 50%) 0 0 / 25% 25%;
}
.solo-placeholder .controls { min-height: 44px; }
.solo-placeholder::after { content: ""; display: block; min-height: 44px; }
#game .controls { margin-bottom: 3px; }
.movement-guides, #game .row:has(#guides) a {
  display: inline-flex;
  min-height: 44px;
  align-items: center;
  gap: 4px;
}
.board .sq {
  position: relative;
  display: grid;
  place-items: center;
  min-width: 0;
  min-height: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  touch-action: manipulation;
}
.sq.light { --square: var(--light); background: var(--square); }
.sq.dark { --square: var(--sage); background: var(--square); }
.sq.reach { background: color-mix(in srgb, var(--square), var(--forest) 4%); }
.sq.reach::after {
  content: "";
  width: clamp(4px, 12%, 6px);
  aspect-ratio: 1;
  border-radius: 50%;
  background: var(--forest);
  opacity: .60;
}
.sq.cap { background: color-mix(in srgb, var(--square), var(--gold) 23%); }
.sq.cap::before {
  content: "";
  position: absolute;
  inset: 1px;
  border: 2px solid #895b13;
  border-radius: 5px;
  box-shadow: inset 0 0 0 1px var(--gold);
  pointer-events: none;
}
.sq.sel { box-shadow: inset 0 0 0 3px var(--forest); }
.sq.hint::before { border-width: 3px; }
.board .sq:focus-visible { z-index: 1; outline: 3px dashed var(--forest); outline-offset: -4px; }
.piece {
  position: absolute;
  top: 5%;
  color: var(--ink);
  font: 32px/1 "DejaVu Sans", "Segoe UI Symbol", "Apple Symbols", serif;
  font-size: clamp(19px, 9cqw, 40px);
  pointer-events: none;
}
.piece.king { color: #785321; }
.dots { position: absolute; inset-block-end: 6%; display: flex; gap: 4px; pointer-events: none; }
.dots i { width: 6px; height: 6px; border: 1px solid var(--forest); border-radius: 50%; background: var(--forest); }
.dots i.used { background: var(--cream); }
.coord { position: absolute; inset: 1px auto auto 2px; color: #3e503c; font: 9px/1.1 system-ui, sans-serif; pointer-events: none; }
.file { inset: auto 2px 1px auto; }
.status { min-height: 26px; padding-block: 4px; text-align: center; }
.controls { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); gap: 5px; }
.controls button, .controls .button { padding-inline: 3px; }
.race .head, .race > .head { min-height: calc(43px + env(safe-area-inset-top, 0px)); }
.race .nav { display: none; }
.race .main {
  padding: 4px max(8px, env(safe-area-inset-right, 0px)) max(8px, env(safe-area-inset-bottom, 0px)) max(8px, env(safe-area-inset-left, 0px));
}
.race :is(.board-meta, .board) {
  width: min(100%, 440px, max(260px, calc(100dvh - 235px - env(safe-area-inset-top, 0px) - env(safe-area-inset-bottom, 0px))));
}
.tiles {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(0, 1fr);
  gap: 4px;
  margin: 4px 0;
}
.tile {
  min-width: 0;
  height: 66px;
  display: grid;
  align-content: center;
  justify-items: center;
  padding: 3px 1px;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 7px;
  text-align: center;
  line-height: 1.08;
  font-variant-numeric: tabular-nums;
}
.tile.me { border: 2px solid var(--forest); }
.tile.near { border-color: #a97b26; background: #f7ebc8; }
.tile.me.near { box-shadow: inset 0 0 0 1px #8c6620; }
.tile.done { background: #e1ecd8; }
.tile b { display: block; width: 100%; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; font-size: .75rem; }
.tile strong { font-size: 1.2rem; line-height: 1; }
.tile small { font-size: .6rem; color: var(--ink); }
.tile .time { font-size: .7rem; font-weight: 750; }
.tumblers { display: flex; justify-content: center; align-items: start; gap: 2px; margin-block: 2px; height: 8px; max-width: 100%; overflow: hidden; }
.tumblers i { width: 4px; height: 7px; border-radius: 1px; background: #68895f; transition: transform .17s ease, opacity .17s ease; }
.tumblers .drop { transform: translateY(9px); opacity: 0; }
.result { padding: 16px; border: 1px solid #dfce98; border-radius: 12px; background: #f6efd7; text-align: center; }
.result .crown { color: #876124; font-size: 2.25rem; }
.rules-examples {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 9rem), 1fr));
  align-items: start;
  gap: 12px;
  margin-block: 10px;
}
.rules-examples figure { min-width: 0; }
.rules-examples figcaption { margin-top: 6px; font-size: .875rem; }
.example-board {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  width: min(100%, 96px);
  border: 2px solid #395740;
  border-radius: 5px;
  overflow: hidden;
}
.example-square {
  position: relative;
  display: grid;
  place-items: center;
  aspect-ratio: 1;
  background: var(--light);
  font: 1.8rem/1 "DejaVu Sans", "Segoe UI Symbol", serif;
}
.example-square:is(:nth-child(4n + 2), :nth-child(4n + 3)) { background: var(--sage); }
.example-square.cap { background: var(--gold); box-shadow: inset 0 0 0 2px #8a6121; }
.example-square.sel { background: #97be8f; box-shadow: inset 0 0 0 2px #466b48; }
.example-square.reach::after { content: ""; width: 24%; aspect-ratio: 1; border-radius: 50%; background: #558159; }
.example-square.king { color: #785321; }
.example-square small { position: absolute; top: 2px; left: 2px; color: var(--ink); font: .62rem/1 system-ui, sans-serif; }
.share-dialog {
  width: min(440px, calc(100% - 24px - env(safe-area-inset-left, 0px) - env(safe-area-inset-right, 0px)));
  max-width: none;
  max-height: calc(100dvh - 24px - env(safe-area-inset-top, 0px) - env(safe-area-inset-bottom, 0px));
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 12px;
  color: var(--ink);
  background: var(--paper);
  overscroll-behavior: contain;
  overflow-y: auto;
}
.share-dialog::backdrop { background: rgb(21 43 33 / 62%); }
.share-dialog[open] { display: grid; align-content: start; gap: 12px; }
.share-dialog summary { min-height: 44px; padding-block: 10px; cursor: pointer; }
.share-image { display: block; width: 100%; height: auto; border-radius: 6px; }
.poster-link { text-align: center; overflow-wrap: anywhere; font-size: .875rem; }
.share-dialog details .share-text { margin-bottom: 6px; }
.share-actions { display: flex; flex-wrap: wrap; gap: 6px; }
.share-actions > :is(button, a) { flex: 1 1 8rem; }
.desktop-share { display: none; }
@media (min-width: 700px) {
  .desktop-share { display: flex; flex: 1 0 100%; flex-wrap: wrap; gap: 6px; }
  .desktop-share .button { flex: 1 1 auto; }
}
.share-preview, pre {
  margin: 0;
  padding: 10px;
  border-radius: 6px;
  background: #f2f1e6;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  font: .875rem/1.5 system-ui, sans-serif;
}
.ops, .opshead { --forest: #26394b; }
.opshead, .ops .head { background: #26394b; }
.spacer { height: 8px; }
.rule, .note { font-size: .8125rem; color: var(--muted); text-align: center; }
@media (min-width: 650px) {
  body { padding-block: 16px; }
  .wrap { min-height: min(800px, calc(100dvh - 32px)); border-radius: 17px; }
  .head { border-radius: 17px 17px 0 0; }
  .nav { border-radius: 0 0 17px 17px; }
  .wrap.race, body.race .wrap { min-height: auto; }
}
@media (max-height: 650px) {
  .race .main { padding-top: 2px; }
  .race .head { min-height: calc(40px + env(safe-area-inset-top, 0px)); }
  .tile { height: 60px; }
  .race .status { min-height: 22px; padding-block: 2px; }
  .wrap:has(#game) .nav { position: static; }
  section:has(> #game) h1 { font-size: 1.35rem; }
}
@media (max-width: 649px) {
  .main:has(#game) {
    padding: 8px max(8px, env(safe-area-inset-right, 0px)) max(8px, env(safe-area-inset-bottom, 0px)) max(8px, env(safe-area-inset-left, 0px));
  }
}
/* On a sideways phone the board and controls share the available height. */
@media (orientation: landscape) and (min-width: 560px) and (max-height: 540px) {
  body:has(#game) { padding-block: 0; }
  .wrap:has(#game) { width: min(100%, 780px); min-height: 100dvh; }
  .wrap:has(#game) .nav { position: static; }
  .main:has(#game) { padding-block: 6px; }
  section:has(> #game) {
    display: grid;
    grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr);
    grid-template-areas:
      "meta heading"
      "board heading"
      "board label"
      "board difficulty"
      "board status"
      "board controls"
      "board guides"
      "board ."
      "win win";
    grid-template-rows: repeat(7, auto) 1fr auto;
    column-gap: 12px;
    align-items: start;
  }
  section:has(> #game) > .row { grid-area: heading; }
  section:has(> #game) > .diff { grid-area: difficulty; margin-block: 4px; }
  section:has(> #game) > #practice-label { grid-area: label; }
  section:has(> #game) > :not(.row, .diff, #game, #practice-label) { grid-column: 1 / -1; }
  #game, .diff + #game { --solo-chrome: 96px; display: contents; }
  #game .solo-placeholder { display: contents; }
  #game .solo-placeholder::after { grid-area: guides; }
  #game :is(.board, .game-placeholder) { grid-area: board; margin-block: 4px; }
  #game .board-meta { grid-area: meta; }
  #game .status { grid-area: status; text-align: start; }
  #game .controls { grid-area: controls; }
  #game .row:has(#guides) { grid-area: guides; }
  #game #win { grid-area: win; }
  #game #win:empty { display: none; }
  .share-dialog[open] {
    width: min(720px, calc(100% - 24px - env(safe-area-inset-left, 0px) - env(safe-area-inset-right, 0px)));
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    grid-template-areas: "image title" "image text" "image actions" "image message";
    grid-template-rows: auto auto auto 1fr;
    gap: 6px 12px;
  }
  .share-dialog h2 { grid-area: title; }
  .share-dialog details { grid-area: text; }
  .share-dialog .share-image { grid-area: image; max-height: calc(100dvh - 64px); object-fit: contain; object-position: top; }
  .share-dialog:has(.poster-link) { grid-template-areas: "image title" "image text" "image actions" "link message"; }
  .share-dialog .poster-link { grid-area: link; }
  .share-dialog .share-actions { grid-area: actions; align-content: start; }
  .share-dialog [role="status"] { grid-area: message; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; animation: none !important; }
}

.hero .hero-title { margin: 0; font-size: 1.75rem; font-weight: 700; line-height: 1.16; letter-spacing: -.045em; }
.seo-heading { font-size: 1.26rem; letter-spacing: -.025em; }
