:root {
  /* War: a paper page and a green felt table (R5.2); the dark look is a night table */
  --bg: #f3efe4;
  --bg2: #e6dfcd;
  --ink: #26241e;
  --inkDim: #5b564a;
  --line: #c7bea8;
  /* the house amber (game-ui-colour §2): filled on Play, Continue and Flip only */
  --accent: #a26a00;
  --accentBorder: #a26a00;
  --accentInk: #ffffff;
  --sel: #d9d0b8;
  --shade: rgba(243, 239, 228, 0.94);
  --toastBg: #26241e;
  --toastInk: #ffffff;
  --bad: #b91c1c;
  /* the table, as app.js draws it: the felt, the words on it, and the cards' faces */
  --felt: #2f7a52;
  --feltInk: #f4f1e6;
  --face: #fffdf7;
  --faceInk: #1c1b18;
  --faceRed: #c0262d;
  --win: #ffd166;
}
:root[data-theme="dark"] {
  --bg: #10241c;
  --bg2: #1a3329;
  --ink: #e6e2d4;
  --inkDim: #a7b5ad;
  --line: #355446;
  --accent: #ffb338;
  --accentBorder: #ffd27a;
  --accentInk: #3a2204;
  --sel: #2a4a3d;
  --shade: rgba(12, 28, 22, 0.92);
  --toastBg: #f3efe4;
  --toastInk: #10241c;
  --bad: #ff6b5b;
  --felt: #173f2d;
  --feltInk: #e6e2d4;
  --face: #f6f2e6;
  --faceInk: #1c1b18;
  --faceRed: #c0262d;
  --win: #ffd166;
}

* { 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; }
#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: 64px; line-height: 1; }
.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); }
/* Start over, armed (start-over.js): an outline in the bad colour, never a fill */
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 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); }
.setNote { font-size: 13.5px; color: var(--inkDim); }

/* play */
#tableWrap { flex: 1; min-height: 180px; position: relative; border-radius: 16px; overflow: hidden; background: var(--felt); }
#table { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
#sayLine { text-align: center; font-weight: 800; font-size: 16px; min-height: 44px; line-height: 1.35; display: flex; align-items: center; justify-content: center; }
#flipRow { display: flex; gap: 8px; padding-bottom: max(0px, env(safe-area-inset-bottom)); }
#flipRow button.big { min-height: 60px; font-size: 20px; }
#btnAuto { flex: 0 0 38%; }
@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; }
.recLine { font-weight: 700; font-variant-numeric: tabular-nums; }
.cardLink { display: inline-flex; align-items: center; min-height: 44px; color: var(--ink); font-weight: 800; }

.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: 96px; 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; }
