:root {
  /* Deepwing's night look (static/games/deepwing/style.css); the light look is chosen with the switch beside Home */
  --bg: #0b1422;
  --bg2: #13233a;
  --ink: #eef4fb;
  --inkDim: #9fb3c8;
  --line: #2a4466;
  --accent: #ffb338;
  --accentInk: #3a2204;
  --sel: #1e3858;
  --shade: rgba(8, 16, 30, 0.88);
  --toastBg: #f8fafc;
  --toastInk: #0b1422;
  --danger: #ff6b5b;
  /* a carved stone: dark slate in both looks, so each sign's colour reads the same */
  --stone: #1a2b42;
  --stoneRim: #3b5a80;
  --slotBg: #08101c;
  --markIn: #ffd04a;
  --markRing: #ffd04a;
  /* LEDGER's plate: the Company's blocky orange on black, in both looks */
  --xtm: #ff8a1f;
  --xtmBg: #120d08;
}
:root[data-theme="light"] {
  --bg: #eef3f9;
  --bg2: #dbe5f1;
  --ink: #0b1422;
  --inkDim: #3c516a;
  --line: #9fb3c8;
  --accent: #8a5200;
  --accentInk: #ffffff;
  --sel: #c7d6e9;
  --shade: rgba(238, 243, 249, 0.94);
  --toastBg: #0b1422;
  --toastInk: #ffffff;
  --danger: #b91c1c;
  --stone: #1a2b42;
  --stoneRim: #3b5a80;
  --slotBg: #ffffff;
  --markIn: #8a5200;
  --markRing: #8a5200;
  --xtm: #ff8a1f;
  --xtmBg: #120d08;
}

* { 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: linear-gradient(180deg, var(--bg) 0%, var(--bg2) 100%); color: var(--ink); user-select: none; -webkit-user-select: none; overflow: hidden; }
#app { height: 100%; display: flex; flex-direction: column; max-width: min(100%, 720px); 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; }
#hdrHome { border: none; background: var(--accent); color: var(--accentInk); 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; }

#scr-menu { align-items: center; text-align: center; justify-content: safe center; }
#scr-menu h1 { font-size: clamp(32px, 9vw, 46px); color: var(--ink); }
#scr-menu .sub { color: var(--inkDim); font-weight: 600; }
#sizeNote { color: var(--inkDim); font-weight: 700; font-size: 14px; }
.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(--accent); color: var(--accentInk); }
button.big.danger { border-color: var(--danger); color: var(--danger); }
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(--accent); background: var(--sel); }

/* play */
#sayRow { display: flex; align-items: center; gap: 8px; }
#sayLine { flex: 1; min-width: 0; text-align: left; font-weight: 800; font-size: 16px; min-height: 22px; }
.art { display: block; flex: none; }
.art[hidden] { display: none; }
.tag { flex: none; font-weight: 900; font-size: 13px; letter-spacing: 0.14em; color: var(--xtm); background: var(--xtmBg); border: 2px solid var(--xtm); border-radius: 3px; padding: 4px 7px; }
.tag[hidden] { display: none; }
#menuArt { width: 160px; height: 96px; }
#art { width: 72px; height: 48px; }
#mineLine { display: flex; align-items: center; justify-content: center; gap: 6px; font-weight: 800; color: var(--inkDim); }
#mineLine[hidden] { display: none; }
#board { flex: 1; min-height: 60px; overflow-y: auto; display: flex; flex-direction: column; gap: 6px; }
.row { display: flex; align-items: center; gap: 6px; background: var(--bg2); border-radius: 12px; padding: 5px 8px; min-width: 0; }
.row .n { width: 20px; flex: none; text-align: right; font-weight: 800; color: var(--inkDim); font-variant-numeric: tabular-nums; }
.row .pegs { display: flex; gap: 3px; flex: none; }
.row .fit { margin-left: auto; font-size: 13px; font-weight: 700; color: var(--inkDim); white-space: nowrap; }
.peg { display: inline-flex; width: 34px; height: 34px; }
.peg svg { width: 100%; height: 100%; }
.peg.small { width: 24px; height: 24px; }
.peg.empty { border: 2px dashed var(--line); border-radius: 50%; }
/* R2.1 the clue: a filled dot in place, a ring elsewhere, an empty socket for none */
.marks { display: inline-grid; grid-template-columns: repeat(3, 10px); gap: 3px; margin-left: 2px; flex: none; }
.marks i { width: 10px; height: 10px; border-radius: 50%; display: block; }
.marks i.in { background: var(--markIn); box-shadow: 0 0 5px var(--markIn); }
.marks i.near { border: 2px dashed var(--markRing); }
.marks i.none { border: 1px dotted var(--line); }
#entry { display: flex; flex-direction: column; gap: 8px; }
#entry[hidden] { display: none; }
#slots { display: flex; justify-content: center; gap: 6px; }
.slot { width: 52px; height: 52px; border-radius: 12px; border: 3px solid var(--line); background: var(--slotBg); display: flex; align-items: center; justify-content: center; cursor: pointer; }
#palette { display: grid; grid-template-columns: repeat(var(--cols, 4), 1fr); gap: 6px; }
.pick { min-height: 52px; border-radius: 12px; border: 3px solid var(--line); background: var(--bg2); display: flex; align-items: center; justify-content: center; gap: 4px; cursor: pointer; color: var(--inkDim); font-family: inherit; font-weight: 800; font-size: 12px; }
.pick:disabled { opacity: 0.3; cursor: default; }
.row2 { display: grid; grid-template-columns: 1fr 2fr; gap: 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); }
.legend { display: flex; flex-direction: column; gap: 6px; }
.lgRow { display: flex; align-items: center; gap: 10px; font-size: 14px; font-weight: 700; }
.goals { display: flex; flex-direction: column; gap: 8px; }
.goal { display: flex; flex-direction: column; gap: 1px; }
.goal b { font-size: 14.5px; } .goal span { font-weight: 800; } .goal i { color: var(--inkDim); font-size: 13.5px; }

.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; }
#ovlStars { font-size: 28px; min-height: 8px; }
#ovlSub { color: var(--inkDim); font-weight: 700; }
#ovlCode { display: flex; justify-content: center; gap: 6px; }

#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; }

/* the game is not being saved (a write the storage did not take): shown until a write goes in */
#saveNote { padding: 6px 12px; font-size: 14px; font-weight: 700; line-height: 1.4; text-align: center; color: var(--ink); background: var(--bg2); border-bottom: 2px solid var(--danger); }
#saveNote[hidden] { display: none; }
