[hidden] { display: none !important; } /* the display rules below must not override the hidden attribute */
/* Layout: board as the hero on the left, a narrow control rail on the right; stacks on phones. Palette drawn from Horezu pottery: slip, cobalt, ochre, glaze green. */
:root {
  --bg: #eceef0;
  --surface: #f8f8f6;
  --fg: #1c2230;
  --muted: #5b6373;
  --line: #d3d7de;
  --accent: #2b4f9e;        /* cobalt */
  --ochre: #c18a25;         /* decoration only (band): 2.85:1 on --surface, never text or a focus ring */
  --ochre-text: #8a5f0f;    /* 5.30:1 on --surface (#f8f8f6) */
  --felt: #3c5038;          /* the board's playing surface (glaze green) */
  --bar: #2f3a2c;           /* the bar and the bear-off trays */
  --tri-a: #b5762b;         /* the two point colours: ochre and cobalt */
  --tri-b: #27437f;
  --cream: #f5eddc;         /* White's checkers, the focus ring, labels on dark */
  --ink: #14171d;           /* Black's checkers, and the dark pills that carry text on the board */
  --label: #d9ccab;         /* point numbers on the felt */
  --gold: #e0a940;          /* things you can play, and the coach's suggestion */
  --danger-bg: #7a1f19;     /* the number of shots that hit a lone checker */
  --font-display: "Alegreya SC", "Palatino Linotype", Palatino, Georgia, serif;
  --font-body: "Alegreya Sans", "Gill Sans", "Segoe UI", system-ui, sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #14171d; --surface: #1c2028; --fg: #e6e8ec; --muted: #9aa2b1; --line: #2e3440;
    --accent: #7f9ee6; --ochre: #e0a940; --ochre-text: #e0a940;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #14171d; --surface: #1c2028; --fg: #e6e8ec; --muted: #9aa2b1; --line: #2e3440;
  --accent: #7f9ee6; --ochre: #e0a940; --ochre-text: #e0a940;
  color-scheme: dark;
}
html, body { background: var(--bg); color: var(--fg); }
body {
  font-family: var(--font-body); font-size: 16px; line-height: 1.45;
  padding-left: max(16px, env(safe-area-inset-left, 0px));
  padding-right: max(16px, env(safe-area-inset-right, 0px));
  padding-block: 20px 32px;
}
.wrap { max-width: 1040px; margin: 0 auto; display: grid; gap: 20px; }
header h1 { font-family: var(--font-display); font-weight: 700; font-size: clamp(28px, 5vw, 40px); margin: 0; letter-spacing: 0.02em; line-height: 1.1; text-wrap: balance; }
header p { margin: 4px 0 0; color: var(--muted); }
.band { height: 10px; border-radius: 2px; opacity: .9;
  background:
    repeating-linear-gradient(90deg, var(--accent) 0 6px, transparent 6px 12px) top/100% 5px no-repeat,
    repeating-linear-gradient(90deg, transparent 0 6px, var(--ochre) 6px 12px) bottom/100% 5px no-repeat; }

.layout { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 24px; align-items: start; }
@media (max-width: 820px) { .layout { grid-template-columns: minmax(0, 1fr); } }

/* Board: laid out like a real one, White's home bottom right. --cw is one point's width, so everything scales with the board. */
.table { display: grid; gap: 14px; min-width: 0; }
.board-frame { background: var(--bar); padding: 10px; border-radius: 8px; container-type: inline-size; width: 100%; box-sizing: border-box; }
.board { --cw: calc(100cqw / 13.65); display: grid; grid-template-columns: repeat(6, 1fr) .75fr repeat(6, 1fr) .9fr; grid-template-rows: 20px calc(var(--cw) * 5.4) calc(var(--cw) * 5.4) 20px; background: var(--felt); border-radius: 4px; }
.plabel { font-size: 12px; font-weight: 700; color: var(--label); text-align: center; align-self: center; font-variant-numeric: tabular-nums; }
.pt, .bar, .tray { border: 0; padding: 0; margin: 0; min-width: 0; min-height: 0; position: relative; display: flex; flex-direction: column; align-items: center; cursor: pointer; font: inherit; color: inherit; background: none; }
.pt.bot, .bar.bot, .tray.bot { flex-direction: column-reverse; }
.pt::before { content: ""; position: absolute; inset: 0 5%; clip-path: polygon(0 0, 100% 0, 50% 100%); }
.pt.bot::before { clip-path: polygon(0 100%, 100% 100%, 50% 0); }
.pt.a::before { background: var(--tri-a); }
.pt.b::before { background: var(--tri-b); }
.bar, .tray { background: var(--bar); }
.pt:focus-visible, .bar:focus-visible, .tray:focus-visible { outline: 3px solid var(--cream); outline-offset: -4px; z-index: 3; }
.pt > *, .bar > *, .tray > * { position: relative; z-index: 1; }
.ck { width: 94%; aspect-ratio: 1; border-radius: 50%; box-sizing: border-box; flex: none; display: grid; place-items: center; font-size: calc(var(--cw) * .42); font-weight: 700; margin-block: 1px; }
.ck.w { background: var(--cream); border: 2px solid #8c8167; color: var(--ink); }
.ck.b { background: var(--ink); border: 2px solid var(--cream); color: var(--cream); }
.ck-mini { display: inline-block; width: 18px; height: 18px; border-radius: 50%; box-sizing: border-box; flex: none; }
.ck-mini.w { background: var(--cream); border: 2px solid #8c8167; }
.ck-mini.b { background: var(--ink); border: 2px solid var(--cream); }
.ghost { width: 94%; aspect-ratio: 1; border-radius: 50%; box-sizing: border-box; flex: none; display: grid; place-items: center; background: var(--ink); border: 2px dashed var(--cream); color: var(--cream); font-weight: 700; font-size: calc(var(--cw) * .38); margin-block: 1px; }
.ghost.small { width: 80%; }
.shots { position: absolute !important; z-index: 2; background: var(--danger-bg); color: var(--cream); font-size: 11px; font-weight: 700; padding: 0 4px; border-radius: 8px; line-height: 16px; }
.pt.top .shots { bottom: 2px; }
.pt.bot .shots { top: 2px; }
.pt.can, .bar.can { box-shadow: inset 0 0 0 3px var(--gold); }
.pt.sel, .bar.sel { box-shadow: inset 0 0 0 3px var(--cream); }
.pt.dest, .tray.dest { box-shadow: inset 0 0 0 2px var(--cream); }
.pt.hint-from, .pt.hint-to, .tray.hint-to { box-shadow: inset 0 0 0 4px var(--gold); background: #e0a94033; }
.tray { padding-block: 2px; }
.tray .off { width: 84%; height: calc(var(--cw) * .26); border-radius: 2px; flex: none; margin-block: 1px; }
.tray.bot .off { background: var(--cream); border: 1px solid #8c8167; }
.tray.top .off { background: var(--ink); border: 1px solid var(--cream); }

.controls { display: grid; gap: 10px; }
.dice { display: flex; gap: 10px; min-height: 52px; align-items: center; flex-wrap: wrap; }
.nodice { color: var(--muted); font-size: 14px; }
.die { width: 48px; height: 48px; border-radius: 9px; box-sizing: border-box; padding: 6px; display: grid; grid-template: repeat(3, 1fr) / repeat(3, 1fr); place-items: center; border: 2px solid #8c8167; }
.die.w { background: var(--cream); }
.die.b { background: var(--ink); border-color: var(--cream); }
.die i { width: 8px; height: 8px; border-radius: 50%; }
.die.w i.on { background: var(--ink); }
.die.b i.on { background: var(--cream); }
.die.used { opacity: .4; }
.coach { margin: 0; font-size: 15px; }
.pips { display: grid; gap: 6px; }
.pips div { display: flex; align-items: center; gap: 8px; font-size: 14px; }
.pips b { margin-left: auto; font-variant-numeric: tabular-nums; }
.select { font: inherit; font-size: 14px; padding: 7px 8px; border-radius: 6px; border: 1px solid var(--line); background: var(--surface); color: var(--fg); width: 100%; }
.select:focus-visible, .check input:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.check { display: flex; gap: 8px; align-items: flex-start; font-size: 14px; }
.check input { margin-top: 3px; flex: none; }
@media (max-width: 520px) { .board-frame { padding: 4px; } .die { width: 40px; height: 40px; padding: 5px; } .die i { width: 6px; height: 6px; } .shots { font-size: 10px; padding: 0 3px; } }

/* Rail */
.rail { display: grid; gap: 16px; min-width: 0; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: 14px 16px; display: grid; gap: 10px; }
.label { font-size: 12px; text-transform: uppercase; letter-spacing: .1em; color: var(--muted); font-weight: 700; }
.seg { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; border: 1px solid var(--line); border-radius: 6px; overflow: hidden; }
.seg button { font: inherit; font-size: 14px; border: 0; padding: 7px 6px; background: transparent; color: var(--fg); cursor: pointer; }
.seg button + button { border-left: 1px solid var(--line); }
.seg button[aria-pressed="true"] { background: var(--accent); color: var(--surface); font-weight: 700; }
.seg button:focus-visible, .btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.row { display: flex; gap: 8px; flex-wrap: wrap; }
.btn { font: inherit; font-size: 14px; font-weight: 500; padding: 8px 14px; border-radius: 6px; border: 1px solid var(--line); background: var(--surface); color: var(--fg); cursor: pointer; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--surface); font-weight: 700; }
.btn:disabled { opacity: .45; cursor: default; }

.status { font-family: var(--font-display); font-size: 22px; line-height: 1.2; display: flex; align-items: center; gap: 10px; text-wrap: balance; }
.hint { color: var(--muted); font-size: 14px; margin: 0; }
.status.win { color: var(--ochre-text); }

.tally { display: grid; gap: 6px; }
.tally div { display: flex; align-items: center; gap: 8px; font-size: 14px; }
.tally b { margin-left: auto; font-variant-numeric: tabular-nums; }

.log { max-height: 180px; overflow-y: auto; font-variant-numeric: tabular-nums; font-size: 14px; margin: 0; padding: 0; list-style: none; display: grid; gap: 4px; }
.log li { display: flex; align-items: center; gap: 8px; }
.log .ck-mini { width: 14px; height: 14px; }
.log .n { color: var(--muted); min-width: 2em; }
.empty { color: var(--muted); font-size: 14px; }

details.rules summary { cursor: pointer; font-weight: 700; padding-block: 6px; }
details.rules ul { margin: 8px 0 0; padding-left: 18px; font-size: 14px; display: grid; gap: 4px; }
.legend { display: flex; gap: 12px; flex-wrap: wrap; font-size: 13px; color: var(--muted); }
.legend span { display: inline-flex; align-items: center; gap: 5px; }
.legend i { display: inline-block; width: 12px; height: 12px; border-radius: 50%; }
/* Site chrome shared by every page: skip link, footer, document pages */
.sr-only { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0; }
.skip-link { position: absolute; left: 8px; top: -60px; z-index: 10; background: var(--surface); color: var(--fg); padding: 8px 12px; border-radius: 6px; border: 1px solid var(--line); }
.skip-link:focus { top: 8px; }
a { color: var(--accent); }
header .brand { margin: 0; font-family: var(--font-display); font-weight: 700; font-size: clamp(22px, 4vw, 28px); letter-spacing: 0.02em; color: var(--fg); }
header .brand a { color: inherit; text-decoration: none; }
header .brand a:hover, header .brand a:focus-visible { text-decoration: underline; }
footer.site { border-top: 1px solid var(--line); padding-top: 16px; display: grid; gap: 8px; font-size: 14px; color: var(--muted); }
footer.site nav ul { list-style: none; margin: 0; padding: 0; display: flex; gap: 6px 18px; flex-wrap: wrap; }
footer.site p { margin: 0; }
main.doc { display: grid; gap: 14px; max-width: 720px; }
main.doc h1 { font-family: var(--font-display); font-size: clamp(28px, 5vw, 40px); margin: 0; line-height: 1.1; }
main.doc h2 { font-family: var(--font-display); font-size: 24px; margin: 18px 0 0; }
main.doc h3 { font-size: 18px; margin: 10px 0 0; }
main.doc p, main.doc ul, main.doc ol { margin: 0; }
main.doc ul, main.doc ol { padding-left: 22px; display: grid; gap: 6px; }
main.doc code { font-size: .92em; background: var(--surface); border: 1px solid var(--line); border-radius: 4px; padding: 0 4px; }
.lede { color: var(--muted); font-size: 18px; }
.build-number { font-weight: 700; }
.changelog { list-style: none; padding: 0 !important; display: grid; gap: 16px !important; }
.changelog li { background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: 12px 14px; display: grid; gap: 6px; }
.changelog-meta { display: flex; gap: 6px 14px; flex-wrap: wrap; font-size: 14px; color: var(--muted); }
.changelog-build { font-weight: 700; color: var(--fg); font-variant-numeric: tabular-nums; }
table.book { border-collapse: collapse; width: 100%; font-size: 15px; }
table.book th, table.book td { text-align: left; padding: 6px 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
table.book th { font-size: 12px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); }
