:root {
  /* Nim: a paper page with pebbles (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;
}
: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;
}

* { 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; }
/* a little of the heaps: three rows of pebbles, drawn in CSS */
#menuArt { width: 84px; height: 60px; position: relative; background:
  radial-gradient(circle, var(--inkDim) 7px, transparent 8px) 0 0 / 21px 20px; }
#menuArt::after { content: ''; position: absolute; right: 0; bottom: 0; width: 21px; height: 20px; background: radial-gradient(circle, var(--s0) 7px, transparent 8px); }
.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); }
/* R5.1 a chip for each player, in the seat's colour; tapping a person's opens the emojis */
#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); }
.cpuSeat { opacity: 0.85; }
/* the shared emoji picker's look (emoji-picker.js paints it): six to a row, six buttons of 44 px
   and five gaps of 5 px are 289 px, inside the 292 px a 320 px screen leaves within .scr's 14 px
   sides; the sum takes border-box sizing and no padding (tests/shared/emoji-picker-fit.js) */
#emojiGrid { display: grid; grid-template-columns: repeat(6, 1fr); gap: 5px; }
#emojiGrid[hidden] { display: none; }
.emo { min-height: 44px; min-width: 44px; padding: 0; 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); }
/* 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); }
#scr-play { padding-left: 4px; padding-right: 4px; }
#boardWrap { flex: 1; min-height: 200px; overflow: auto; display: flex; align-items: safe center; justify-content: safe center; }
#board { flex: none; touch-action: none; border-radius: 10px; }
#board:focus-visible { outline: 3px solid var(--ink); outline-offset: 2px; }
#sayLine { text-align: center; font-weight: 800; font-size: 15px; min-height: 40px; line-height: 1.35; padding-bottom: max(0px, env(safe-area-inset-bottom)); }
@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; }
