@font-face { font-family: "Cabin"; src: url("../fonts/cabin-latin-wdth-normal.woff2") format("woff2"); font-weight: 400 700; font-stretch: 75% 100%; font-display: swap; }
@font-face { font-family: "Hammersmith One"; src: url("../fonts/hammersmith-one-latin-400-normal.woff2") format("woff2"); font-weight: 400; font-display: swap; }

:root {
  --mist: #e3e9e1;      /* page */
  --paper: #f3f6f0;     /* raised surfaces */
  --ink: #1d282d;       /* text */
  --ink-soft: #4d5b58;
  --moor: #2f4a3a;      /* the hill, primary actions */
  --moor-deep: #223529;
  --sedge: #93a97f;     /* board spaces */
  --lichen: #d6e04b;    /* things you can do */
  --heather: #a2569c;   /* things that can be done to you */
  --chalk: #f4f2e8;
  --chalk-side: #c6c1ab;
  --slate: #2c3742;
  --slate-side: #131a21;
  --line: #c3cdc2;
  --display: "Hammersmith One", "Cabin", "Gill Sans", "Trebuchet MS", sans-serif;
  --body: "Cabin", "Gill Sans", "Trebuchet MS", system-ui, sans-serif;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--mist); color: var(--ink); font: 400 17px/1.5 var(--body); padding-bottom: calc(64px + env(safe-area-inset-bottom)); }
h1, h2 { font-family: var(--display); font-weight: 400; line-height: 1.15; margin: 0; }
h1 { font-size: 1.9rem; letter-spacing: -0.01em; }
h2 { font-size: 1.2rem; }
a { color: var(--moor); }
[hidden] { display: none !important; }
:focus-visible { outline: 3px solid var(--heather); outline-offset: 2px; border-radius: 4px; }

/* ── header and tabs ── */
.top { display: flex; align-items: center; justify-content: space-between; padding: 10px 16px 6px; max-width: 1080px; margin: 0 auto; }
.mark { display: flex; align-items: center; gap: 8px; text-decoration: none; color: var(--ink); font: 400 1.45rem/1 var(--display); }
.mark svg { width: 34px; height: 34px; background: var(--moor); border-radius: 50%; padding: 3px; }
.tabs { position: fixed; z-index: 5; left: 0; right: 0; bottom: 0; display: grid; grid-template-columns: repeat(4, 1fr); background: var(--moor-deep); padding-bottom: env(safe-area-inset-bottom); }
.tabs a { color: #cfdccf; text-decoration: none; text-align: center; padding: 14px 4px 13px; font-weight: 600; font-size: 0.95rem; font-stretch: 88%; border-top: 3px solid transparent; }
.tabs a[aria-current="page"] { color: #fff; border-top-color: var(--lichen); background: var(--moor); }
@media (min-width: 860px) {
  body { padding-bottom: 24px; }
  .tabs { position: static; display: flex; gap: 4px; background: none; padding: 0; }
  .tabs a { color: var(--ink-soft); padding: 8px 14px; border-top: 0; border-bottom: 3px solid transparent; }
  .tabs a[aria-current="page"] { color: var(--ink); background: none; border-bottom-color: var(--moor); }
}

/* ── play ── */
.view { max-width: 1080px; margin: 0 auto; padding: 4px 12px 24px; }
.play { display: grid; gap: 10px; }
.table { max-width: 620px; width: 100%; margin: 0 auto; }
.score { display: grid; grid-template-columns: 1fr 1fr; align-items: center; gap: 4px 10px; padding: 2px 6px 6px; }
.score .s2 { justify-content: flex-end; }
.score .meter { grid-column: 1 / -1; }
.side { display: flex; align-items: baseline; gap: 6px; font-weight: 600; }
.side b { font: 400 1.7rem/1 var(--display); min-width: 1.2em; text-align: center; }
.side.turn span { box-shadow: 0 2px 0 var(--ink); }
.pip { display: inline-block; width: 15px; height: 11px; border-radius: 50%; align-self: center; border: 1.5px solid var(--slate); flex: none; }
.pip.c1 { background: var(--chalk); } .pip.c2 { background: var(--slate); }
.meter { display: flex; height: 9px; border-radius: 5px; overflow: hidden; background: var(--line); border: 1.5px solid var(--slate); }
.meter span { transition: flex-basis .35s ease; flex: 0 0 0; }
#m1 { background: var(--chalk); } #m0 { background: var(--sedge); flex-grow: 1; } #m2 { background: var(--slate); }
.board { display: block; width: 100%; height: auto; touch-action: manipulation; user-select: none; -webkit-user-select: none; }
.panel { max-width: 620px; width: 100%; margin: 0 auto; padding: 0 6px; }
.status { font: 400 1.25rem/1.25 var(--display); margin: 0; min-height: 1.6em; }
.sub { margin: 2px 0 10px; color: var(--ink-soft); min-height: 1.5em; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; }
.btn { font: 600 1rem/1 var(--body); padding: 13px 18px; border-radius: 999px; border: 2px solid var(--moor); background: transparent; color: var(--moor); cursor: pointer; text-decoration: none; display: inline-block; }
.btn.primary { background: var(--moor); color: #fff; }
.btn.accent { background: var(--lichen); border-color: var(--ink); color: var(--ink); }
.btn:disabled { opacity: .4; cursor: default; }
.btn:active:not(:disabled) { transform: translateY(1px); }
.read { margin-top: 14px; }
.read-bar { height: 9px; border-radius: 5px; background: var(--slate); border: 1.5px solid var(--slate); overflow: hidden; }
.read-bar span { display: block; height: 100%; width: 50%; background: var(--chalk); transition: width .4s ease; }
.read p { margin: 4px 0 0; font-size: .92rem; color: var(--ink-soft); }
.check { display: flex; gap: 8px; align-items: center; margin-top: 14px; font-size: .95rem; }
.check.second { margin-top: 8px; }
.check input { width: 20px; height: 20px; accent-color: var(--moor); }
.tally { color: var(--ink-soft); font-size: .92rem; margin: 10px 0 0; }
@media (min-width: 860px) {
  .play { grid-template-columns: minmax(0, 620px) minmax(260px, 1fr); gap: 28px; align-items: start; }
  .panel { padding-top: 56px; }
}

/* ── board pieces ── */
.bd-hill { fill: var(--moor); stroke: var(--moor); stroke-width: 26; stroke-linejoin: round; }
.bd-cell { stroke: var(--moor-deep); stroke-width: 1; }
.bd-ring0 { fill: #a9bc92; } .bd-ring1 { fill: #9eb388; } .bd-ring2 { fill: #93a97f; } .bd-ring3 { fill: #889f76; }
.bd-cell.bd-last { stroke: var(--lichen); stroke-width: 3; }
.bd-hit { fill: transparent; cursor: pointer; outline: none; }
.bd-hit:focus-visible { stroke: var(--heather); stroke-width: 3; }
@media (hover: hover) { .bd-hit:hover { fill: rgba(255, 255, 255, .13); } }
.bd-shadow { fill: rgba(20, 33, 26, .32); }
.bd-stone .top { stroke-width: 1; }
.bd-stone.c1 .top { fill: var(--chalk); stroke: #8f8b78; } .bd-stone.c1 .side { fill: var(--chalk-side); stroke: #8f8b78; stroke-width: 1; }
.bd-stone.c2 .top { fill: var(--slate); stroke: #0c1116; } .bd-stone.c2 .side { fill: var(--slate-side); stroke: #0c1116; stroke-width: 1; }
.bd-stone .glint { fill: none; stroke-width: 1.6; stroke-linecap: round; }
.bd-stone.c1 .glint { stroke: #fff; } .bd-stone.c2 .glint { stroke: #6e7f8f; }
.bd-stone .crown { fill: none; stroke-width: 1.6; }
.bd-stone.c1 .crown { stroke: #8f8b78; } .bd-stone.c2 .crown { stroke: #8fa0b0; }
.bd-cairn-ring { fill: none; stroke-width: 2.2; }
.bd-cairn-ring.c1 { stroke: var(--chalk); } .bd-cairn-ring.c2 { stroke: var(--slate); }
.bd-ring-cap { fill: none; stroke: var(--lichen); stroke-width: 2.6; stroke-dasharray: 5 4; }
.bd-ring-threat { fill: none; stroke: var(--heather); stroke-width: 2.6; }
.bd-hint { fill: var(--lichen); stroke: var(--ink); stroke-width: 1.5; opacity: .8; pointer-events: none; }
.bd-hint.best { opacity: 1; }
.bd-dim { opacity: .45; }
.bd-drop { animation: drop .22s cubic-bezier(.3, 1.3, .6, 1); }
@keyframes drop { from { transform: translateY(-16px); opacity: 0; } to { transform: none; opacity: 1; } }
.bd-no { animation: no .28s; }
@keyframes no { 30% { fill: var(--heather); } }
@media (prefers-reduced-motion: reduce) { .bd-drop, .bd-no { animation: none; } .meter span, .read-bar span { transition: none; } }

/* ── prose pages ── */
.prose { max-width: 760px; }
.prose h1 { margin-top: 10px; }
.prose h1.gap { margin-top: 44px; }
.prose .lead { font-size: 1.12rem; margin: 8px 0 22px; max-width: 34em; }
.prose p, .prose li { max-width: 36em; }
.quiet { color: var(--ink-soft); font-size: .95rem; }
.rule { display: grid; grid-template-columns: 132px 1fr; gap: 14px; align-items: center; padding: 14px 0; border-top: 1.5px solid var(--line); }
.rule h2 { margin-bottom: 4px; }
.rule p, .rule ul { margin: 4px 0; }
.rule ul { padding-left: 1.1em; }
.fig { width: 132px; height: auto; background: var(--moor); border-radius: 14px; }
@media (min-width: 620px) { .rule { grid-template-columns: 190px 1fr; gap: 22px; } .fig { width: 190px; } }
.tips { padding-left: 1.1em; } .tips li { margin: 10px 0; }
.puzzles { display: grid; gap: 14px; }
@media (min-width: 720px) { .puzzles { grid-template-columns: repeat(3, 1fr); } }
.puzzle { background: var(--paper); border: 1.5px solid var(--line); border-radius: 16px; padding: 12px; }
.puzzle h2 { font-size: 1.05rem; } .puzzle p { margin: 4px 0 8px; font-size: .97rem; min-height: 3em; }
.puzzle svg { width: 100%; height: auto; background: var(--moor); border-radius: 12px; }
.puzzle .verdict { font-weight: 600; min-height: 4.2em; margin: 8px 0 0; }
.puzzle.solved { border-color: var(--moor); }

/* ── lab ── */
.lab-block { border-top: 1.5px solid var(--line); padding: 18px 0 6px; }
.lab-block h2 { font-size: 1.35rem; margin-bottom: 6px; }
.chart { margin: 14px 0 6px; }
.chart h3 { font: 600 1rem/1.3 var(--body); margin: 0 0 2px; }
.chart .note { font-size: .9rem; color: var(--ink-soft); margin: 0 0 8px; }
.chart svg { max-width: 100%; height: auto; display: block; overflow: visible; }
.chart details { margin-top: 4px; } .chart summary { cursor: pointer; font-size: .9rem; }
.chart text { font-family: var(--body); fill: var(--ink); }
.chart .ax { fill: var(--ink-soft); font-size: 12px; }
.chart .val { font-size: 12.5px; font-weight: 600; }
.chart .lab { font-size: 13px; }
.chart .grid { stroke: var(--line); stroke-width: 1; }
.chart .picked { font-weight: 700; }
.facts { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; margin: 14px 0; padding: 0; list-style: none; }
@media (min-width: 620px) { .facts { grid-template-columns: repeat(4, 1fr); } }
.facts li { background: var(--paper); border: 1.5px solid var(--line); border-radius: 14px; padding: 10px 12px; max-width: none; }
.facts b { display: block; font: 400 1.5rem/1.1 var(--display); }
.facts span { font-size: .9rem; color: var(--ink-soft); }
table.plain { border-collapse: collapse; width: 100%; font-size: .95rem; margin: 8px 0; }
table.plain th, table.plain td { text-align: left; padding: 6px 8px 6px 0; border-bottom: 1px solid var(--line); vertical-align: top; }
table.plain th { font-weight: 600; }
table.plain td.num, table.plain th.num { text-align: right; font-variant-numeric: tabular-nums; }

/* ── print ── */
.files { display: grid; gap: 12px; padding: 0; list-style: none; }
@media (min-width: 620px) { .files { grid-template-columns: repeat(2, 1fr); } }
.files li { background: var(--paper); border: 1.5px solid var(--line); border-radius: 16px; padding: 14px; max-width: none; }
.files h2 { font-size: 1.1rem; margin-bottom: 2px; } .files p { margin: 2px 0 10px; font-size: .96rem; }
.files img { width: 100%; border-radius: 10px; background: var(--moor); display: block; margin-bottom: 10px; }

/* ── dialog ── */
dialog { border: 0; border-radius: 20px; padding: 0; width: min(520px, calc(100vw - 20px)); background: var(--paper); color: var(--ink); max-height: calc(100dvh - 20px); }
dialog::backdrop { background: rgba(20, 30, 25, .55); }
dialog form { padding: 18px 16px 14px; }
dialog h2 { font-size: 1.5rem; margin-bottom: 8px; }
fieldset { border: 0; padding: 0; margin: 10px 0 0; }
legend { font-weight: 600; padding: 0; margin-bottom: 6px; }
.opts { display: grid; gap: 6px; } .opts.two { grid-template-columns: 1fr 1fr; }
.opt { display: block; cursor: pointer; }
.opt input { position: absolute; opacity: 0; }
.opt span { display: block; border: 2px solid var(--line); border-radius: 12px; padding: 8px 12px; }
.opt b { display: flex; gap: 6px; align-items: center; font-weight: 600; }
.opt small { display: block; color: var(--ink-soft); font-size: .88rem; line-height: 1.3; }
.opt em { font-style: normal; float: right; color: var(--ink-soft); font-size: .88rem; font-variant-numeric: tabular-nums; }
.opt input:checked + span { border-color: var(--moor); background: #dfe8d9; }
.opt input:focus-visible + span { outline: 3px solid var(--heather); outline-offset: 2px; }
.dlg-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 16px; }

/* ── watch two nets ── */
.watch { max-width: 520px; }
.watch-pick { display: flex; flex-wrap: wrap; gap: 10px 14px; align-items: end; margin: 6px 0 10px; }
.watch-pick label { display: grid; gap: 2px; font-weight: 600; font-size: .95rem; }
.watch-pick select { font: inherit; padding: 9px 10px; border-radius: 10px; border: 2px solid var(--line); background: var(--paper); color: var(--ink); max-width: 44vw; }
.watch .status { font-size: 1.05rem; margin-top: 6px; }

/* ── game review ── */
.review { margin-top: 16px; padding-top: 12px; border-top: 1.5px solid var(--line); }
.review h2 { font-size: 1.1rem; }
.review p { margin: 2px 0 6px; min-height: 1.4em; }
#rev-chart { display: block; width: 100%; height: 96px; overflow: visible; }
#rev-slider { width: 100%; margin: 6px 0 0; accent-color: var(--moor); height: 32px; }

/* ── first visit ── */
.welcome { background: var(--paper); border: 1.5px solid var(--line); border-radius: 16px; padding: 12px 14px; margin-bottom: 12px; }
.welcome p { margin: 0 0 10px; }
.welcome div { display: flex; flex-wrap: wrap; gap: 8px; }
