:root {
  /* the dark look: a card room, felt green; the accent is the house amber (game-ui-colour §2) */
  --bg: #0f1a14;
  --bg2: #1b2a22;
  --ink: #e6efe9;
  --accent: #ffb338;
  --accentLine: #ffd27a;
  --accentInk: #3a2204;
  --kInk1: #9fb4a8;
  --kInk2: #f4f8f5;
  --kLine1: #33473c;
  --kLine2: #ffb338;
  --kBg2: #2a3a22;
  --kBg3: #14281d;
  --kBg6: rgba(8, 16, 12, 0.88);
  --kBg9: #f4f8f5;
  --kInkG2: #0f1a14;
  --ringL: #ffb020;
  --ringR: #38c6f4;
  --good: #4ade80;
}

/* R-C40: the light look */
:root[data-theme="light"] {
  --bg: #e8f1ea;
  --bg2: #cbdccf;
  --ink: #18221c;
  --accent: #b26f00;
  --accentLine: #8a5600;
  --accentInk: #111111;
  --kInk1: #3a4d42;
  --kInk2: #0b120e;
  --kLine1: #93ab9b;
  --kLine2: #b26f00;
  --kBg2: #e9dcc0;
  --kBg3: #2c6a45;
  --kBg6: rgba(232, 241, 234, 0.92);
  --kBg9: #18221c;
  --kInkG2: #ffffff;
  --ringL: #b26f00;
  --ringR: #0b6e96;
  --good: #15803d;
}

* { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { height: 100%; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: linear-gradient(180deg, var(--bg) 0%, var(--bg2) 100%);
  color: var(--ink); user-select: none; -webkit-user-select: none;
  touch-action: manipulation; overflow: hidden;
}
#app { height: 100%; display: flex; flex-direction: column; max-width: min(100%, 820px); 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(--kLine1); 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; }
#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(--kInk1); }

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

#scr-menu { align-items: center; text-align: center; gap: 12px; justify-content: center; }
#scr-menu h1 { font-size: clamp(32px, 9vw, 44px); color: var(--kInk2); display: flex; align-items: center; gap: 10px; }
#scr-menu h1 .logo { width: 1.1em; height: 1.1em; }
#scr-menu .sub { color: var(--kInk1); font-weight: 600; margin-bottom: 4px; }
.pick { width: 100%; display: flex; flex-direction: column; gap: 5px; text-align: left; font-size: 14px; color: var(--kInk1); }
button.big { width: 100%; border-radius: 16px; min-height: 56px; font-size: 19px; font-weight: 800; background: var(--bg2); color: var(--ink); border: 3px solid var(--kLine1); cursor: pointer; font-family: inherit; }
button.big:active { transform: translateY(2px); }
button.big.primary { background: var(--accent); border-color: var(--accentLine); color: var(--accentInk); }
button.big:disabled { opacity: 0.5; }
/* the armed 🧹 Start over (start-over.js adds .danger): outlined in the accent, the fill unchanged */
button.big.danger { border-color: var(--accent); }
#statsLine { color: var(--kInk1); font-weight: 700; font-size: 14px; }
#needs { color: var(--kInk2); font-weight: 700; font-size: 14px; line-height: 1.4; }
#needs[hidden] { display: none; }
.menuRow { display: flex; gap: 8px; width: 100%; }

.seg { display: flex; flex-wrap: wrap; gap: 6px; }
.seg button { flex: 1; min-height: 44px; min-width: 64px; border-radius: 12px; border: 3px solid var(--kLine1); background: var(--bg); color: var(--ink); font: 800 15px inherit; font-family: inherit; cursor: pointer; padding: 0 6px; }
.seg button.sel { border-color: var(--kLine2); background: var(--kBg2); }

/* play: one canvas the size of its box, drawn by three.js; the other players'
   names, the bar and the cards are laid over it, placed from the plan (§4.2) */
#scr-play { padding: 0 6px 6px; }
#stageWrap { flex: 1; position: relative; min-height: 0; border-radius: 12px; overflow: hidden; background: var(--kBg3); }
canvas#stage { position: absolute; inset: 0; width: 100%; height: 100%; display: block; touch-action: manipulation; }
#seats { position: absolute; left: 0; right: 0; top: 0; height: 40px; pointer-events: none; }
#seats .seat { position: absolute; top: 3px; transform: translateX(-50%); font-size: 11.5px; line-height: 1.2; text-align: center; font-weight: 800; white-space: pre; color: var(--kInk2);
  background: var(--kBg6); padding: 1px 8px; border-radius: 10px; border: 2px solid transparent; overflow: hidden; }
#seats .seat.turn { border-color: var(--kLine2); }
#bar { position: absolute; left: 6px; right: 6px; height: 50px; display: flex; align-items: center; gap: 6px; }
#say { flex: 1; min-width: 0; font-weight: 800; font-size: 14px; line-height: 1.25; color: var(--kInk2); background: var(--kBg6); border-radius: 12px; padding: 4px 10px; min-height: 44px; display: flex; align-items: center; }
#say .you { color: var(--kLine2); }
#choose { display: flex; gap: 6px; }
#choose[hidden] { display: none; }
.endBtn, .drawBtn { min-width: 64px; min-height: 44px; border-radius: 12px; font: 800 15px inherit; font-family: inherit; cursor: pointer; background: var(--bg2); color: var(--ink); border: 3px solid var(--kLine1); padding: 0 8px; white-space: nowrap; }
#endL { border-color: var(--ringL); }
#endR { border-color: var(--ringR); }
.drawBtn:disabled { opacity: 0.45; }
.drawBtn.must { background: var(--accent); border-color: var(--accentLine); color: var(--accentInk); }
#glFail { position: absolute; inset: 16px; display: flex; align-items: center; justify-content: center; text-align: center; font-weight: 800; font-size: 16px; line-height: 1.5; color: var(--kInk2); background: var(--kBg6); border-radius: 12px; padding: 12px; }
#glFail[hidden] { display: none; }
#fpsNow { position: absolute; left: 6px; bottom: 6px; font: 11px/1.3 ui-monospace, monospace; color: var(--kInk1); background: var(--kBg6); padding: 2px 6px; border-radius: 6px; pointer-events: none; }
#fpsNow[hidden] { display: none; }

.ovl { position: absolute; inset: 0; display: none; align-items: flex-start; justify-content: center; background: var(--kBg6); border-radius: 12px; 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; color: var(--kInk2); }
#ovlSub { color: var(--kInk1); font-weight: 700; min-height: 22px; line-height: 1.4; }
#ovlRows .row { display: flex; justify-content: space-between; gap: 10px; font-weight: 700; padding: 6px 10px; border-bottom: 1px solid var(--kLine1); }
#ovlRows .row b { color: var(--kInk2); }
#ovlRows .row.win b { color: var(--good); }

#scr-how .card, #scr-set .card { background: var(--bg2); border: 3px solid var(--kLine1); border-radius: 16px; padding: 14px; margin-bottom: 10px; font-size: 15px; line-height: 1.55; font-weight: 600; }
#scr-how h2, #scr-set h2 { margin-bottom: 8px; color: var(--kInk2); }
#scr-how p { margin-bottom: 6px; }
#scr-set .card { display: flex; flex-direction: column; gap: 12px; }
.setRow { display: flex; flex-direction: column; gap: 6px; font-size: 15px; }
.setNote { font: 12px/1.4 ui-monospace, monospace; color: var(--kInk1); }
.setNote2 { font-size: 14px; color: var(--kInk1); line-height: 1.4; }
.startRow { display: flex; gap: 8px; }
.goal { display: grid; grid-template-columns: 1fr 1fr; gap: 2px 10px; font-size: 13.5px; padding: 6px 0; border-top: 1px solid var(--kLine1); }
.goal small { grid-column: 1 / span 2; color: var(--kInk1); }
.lgSub { font-weight: 800; font-size: 13.5px; color: var(--kInk1); margin: 10px 0 5px; }
.legend { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.lgPip { display: flex; align-items: center; gap: 8px; font-weight: 800; }
.lgPip i { width: 18px; height: 18px; border-radius: 50%; display: inline-block; border: 2px solid var(--kLine1); }

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

/* docs/offline-pwa.md R-C15 — the page never scrolls */
html, body { overflow: hidden; overscroll-behavior: none; }
.scr { overscroll-behavior: contain; }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
