:root {
  /* Chinese Checkers: a paper page (R5.3); the dark look is a slate, chosen with the switch beside Home */
  --bg: #f4f1e8;
  --bg2: #e8e2d2;
  --ink: #2b2a33;
  --inkDim: #5e5a52;
  --line: #c9c2b0;
  /* the house amber (game-ui-colour §2): filled on Play and Continue only */
  --accent: #a26a00;
  --accentBorder: #a26a00;
  --accentInk: #ffffff;
  --sel: #ddd5bf;
  --shade: rgba(244, 241, 232, 0.94);
  --toastBg: #2b2a33;
  --toastInk: #ffffff;
  --bad: #b91c1c;
  /* the seats' colours, as the board draws them (app.js SEAT) */
  --s0: #2563c9;
  --s1: #d2620f;
  --s2: #1e8a4c;
  --s3: #8146c2;
  --s4: #c0263a;
  --s5: #0f8a8a;
}
:root[data-theme="dark"] {
  --bg: #1b2433;
  --bg2: #253045;
  --ink: #e7e3d6;
  --inkDim: #a9b2c2;
  --line: #3a4458;
  --accent: #ffb338;
  --accentBorder: #ffd27a;
  --accentInk: #3a2204;
  --sel: #33415c;
  --shade: rgba(20, 27, 39, 0.92);
  --toastBg: #f4f1e8;
  --toastInk: #1b2433;
  --bad: #ff6b5b;
  --s0: #6ea6ff;
  --s1: #ffa057;
  --s2: #4fd08a;
  --s3: #c49bff;
  --s4: #ff6b7f;
  --s5: #3fd6d0;
}

* { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
button { touch-action: manipulation; }
html, body { height: 100%; }
body { font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif; background: var(--bg); color: var(--ink); user-select: none; -webkit-user-select: none; overflow: hidden; }
#app { height: 100%; display: flex; flex-direction: column; max-width: min(100%, 900px); margin: 0 auto; }

#hdr { display: flex; align-items: center; gap: 8px; padding: 8px 12px; padding-top: max(8px, env(safe-area-inset-top)); }
#hdr .pill { background: var(--bg2); border: 2px solid var(--line); border-radius: 999px; padding: 6px 11px; font-weight: 800; font-size: 15px; min-width: 44px; min-height: 44px; display: flex; align-items: center; cursor: pointer; justify-content: center; color: inherit; font-family: inherit; }
#saveNote { margin: 0 12px 6px; padding: 8px 12px; border-radius: 12px; background: var(--bg2); border: 2px solid var(--line); color: var(--ink); font-weight: 800; font-size: 14px; line-height: 1.4; text-align: center; }
#saveNote[hidden] { display: none; }
#hdrHome { font-size: 18px; }
#hdrStatus { flex: 1; min-width: 0; text-align: center; font-weight: 800; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--inkDim); }

.scr { flex: 1; display: none; flex-direction: column; overflow-y: auto; padding: 6px 14px 14px; gap: 10px; position: relative; }
.scr.on { display: flex; }

/* the menu */
#scr-menu { align-items: center; text-align: center; justify-content: safe center; }
/* (a menu taller than the screen scrolls; nothing in it is squashed: the picture drew over the title at 320 × 640) */
#scr-menu > * { flex-shrink: 0; }
#scr-menu h1 { font-size: clamp(30px, 8.5vw, 44px); color: var(--ink); }
#scr-menu .sub { color: var(--inkDim); font-weight: 600; max-width: 36ch; }
#menuArt { font-size: 40px; line-height: 1; letter-spacing: -6px; }
.menuGrid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; width: 100%; }
button.big { width: 100%; border-radius: 16px; min-height: 52px; font-size: 18px; font-weight: 800; background: var(--bg2); color: var(--ink); border: 3px solid var(--line); cursor: pointer; font-family: inherit; padding: 6px 10px; }
button.big:active { transform: translateY(2px); }
button.big.primary { background: var(--accent); border-color: var(--accentBorder); color: var(--accentInk); }
button.big.danger { border-color: var(--bad); color: var(--bad); }
button.big[hidden] { display: none; }
button.big:disabled { opacity: 0.45; cursor: default; }
#statsLine { color: var(--inkDim); font-weight: 700; }
.seg { display: flex; flex-wrap: wrap; gap: 6px; width: 100%; }
.seg[hidden] { display: none; }
.seg button { flex: 1; min-height: 44px; min-width: 64px; border-radius: 12px; border: 3px solid var(--line); background: var(--bg); color: var(--ink); font-family: inherit; font-weight: 800; font-size: 15px; cursor: pointer; }
.seg button.sel { border-color: var(--ink); background: var(--sel); }
/* the counts: two by two, so "6 players" fits its button at 320 px */
#countRow button { flex: 1 1 calc(50% - 3px); }
/* R5.1 a chip for each seat, in its colour; tapping one opens the emojis and 🤖 */
#players { width: 100%; display: flex; flex-direction: column; gap: 8px; }
#playersRow { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; }
.seat { min-height: 44px; padding: 6px 12px; border-radius: 999px; border: 3px solid var(--line); background: var(--bg); color: var(--ink); font-family: inherit; font-weight: 800; font-size: 15px; display: inline-flex; align-items: center; }
button.seat { cursor: pointer; }
button.seat.sel { background: var(--sel); }
.seat.s0 { border-color: var(--s0); } .seat.s1 { border-color: var(--s1); } .seat.s2 { border-color: var(--s2); } .seat.s3 { border-color: var(--s3); } .seat.s4 { border-color: var(--s4); } .seat.s5 { border-color: var(--s5); }
.cpuSeat { opacity: 0.85; }
#emojiGrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(44px, 1fr)); gap: 6px; }
#emojiGrid[hidden] { display: none; }
.emo { min-height: 44px; min-width: 44px; font-size: 24px; border-radius: 12px; border: 3px solid var(--line); background: var(--bg); cursor: pointer; font-family: inherit; }
.emo.sel { border-color: var(--ink); background: var(--sel); }
.emo.taken, .emo:disabled { opacity: 0.3; cursor: default; }

/* play */
#scoreRow { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; }
.chip { min-width: 72px; padding: 4px 12px; border-radius: 999px; border: 3px solid var(--line); background: var(--bg2); font-weight: 900; font-size: 20px; text-align: center; font-variant-numeric: tabular-nums; white-space: nowrap; }
.chip.s0 { border-color: var(--s0); } .chip.s1 { border-color: var(--s1); } .chip.s2 { border-color: var(--s2); } .chip.s3 { border-color: var(--s3); } .chip.s4 { border-color: var(--s4); } .chip.s5 { border-color: var(--s5); }
/* whose turn: the chip is lifted and its border doubled, never filled */
.chip.turn { box-shadow: 0 0 0 3px var(--ink); }
.chip.turn.s0 { box-shadow: 0 0 0 3px var(--s0); } .chip.turn.s1 { box-shadow: 0 0 0 3px var(--s1); } .chip.turn.s2 { box-shadow: 0 0 0 3px var(--s2); } .chip.turn.s3 { box-shadow: 0 0 0 3px var(--s3); } .chip.turn.s4 { box-shadow: 0 0 0 3px var(--s4); } .chip.turn.s5 { box-shadow: 0 0 0 3px var(--s5); }
#boardWrap { flex: 1; min-height: 260px; overflow: auto; display: flex; align-items: safe center; justify-content: safe center; }
.goalLine { font-weight: 700; margin: 4px 0; }
#board { flex: none; border-radius: 10px; touch-action: manipulation; }
#moveRow { display: flex; gap: 10px; padding-bottom: max(0px, env(safe-area-inset-bottom)); }
#moveRow button { flex: 1; }
/* (Done and Back keep their space while hidden, so the board does not move between hops) */
#moveRow button[hidden] { display: block; visibility: hidden; }
#sayLine { text-align: center; font-weight: 800; font-size: 16px; min-height: 44px; line-height: 1.35; font-variant-numeric: tabular-nums; }
@media (max-height: 700px) {
  #hdr { padding-top: max(4px, env(safe-area-inset-top)); padding-bottom: 4px; }
  #scr-play { gap: 6px; padding-bottom: 8px; }
}

/* settings, help */
#scr-set .card, #scr-how .card { background: var(--bg2); border: 3px solid var(--line); border-radius: 16px; padding: 14px; display: flex; flex-direction: column; gap: 10px; font-size: 15px; line-height: 1.55; font-weight: 600; }
.setNote { font-size: 13.5px; color: var(--inkDim); }
.recLine { font-weight: 700; font-variant-numeric: tabular-nums; }

.ovl { position: absolute; inset: 0; display: none; align-items: flex-start; justify-content: center; background: var(--shade); padding: 16px; overflow-y: auto; overscroll-behavior: contain; }
.ovl.on { display: flex; }
.ovlCard { text-align: center; width: 100%; max-width: 320px; display: flex; flex-direction: column; gap: 10px; margin: auto; }
#ovlTitle { font-size: 26px; font-weight: 800; }
#ovlSub { color: var(--inkDim); font-weight: 700; font-size: 18px; }

#toast { position: fixed; left: 50%; bottom: 78px; transform: translateX(-50%); background: var(--toastBg); color: var(--toastInk); font-weight: 800; padding: 9px 16px; border-radius: 999px; opacity: 0; transition: opacity 0.25s; pointer-events: none; z-index: 40; max-width: 90vw; text-align: center; }
#toast.on { opacity: 1; }

/* docs/offline-pwa.md R-C15 — the page never scrolls; each screen does */
html, body { overflow: hidden; overscroll-behavior: none; }
.scr { overscroll-behavior: contain; }
