:root {
  /* the night look (this product's own); the light look is chosen with the switch beside Home */
  --bg: #1b1726;
  --bg2: #2a2438;
  --ink: #f1eef7;
  --inkDim: #b3aac6;
  --line: #483f5e;
  --accent: #ffb338;
  --accentInk: #3a2204;
  --sel: #3a3150;
  --shade: rgba(14, 16, 28, 0.88);
  --toastBg: #f8fafc;
  --toastInk: #161a2b;
  --danger: #f87171;
  --lkUnmet: #4a4f5a; --lkGetting: #e9973f; --lkRelaxed: #2f7d8c; --lkSteady: #2fae7e; --lkQuick: #7fd36a; --lkSnap: #f6e27a; --lkInk: #0b1226; --lkInkUnmet: #e6ecf7;
  --slow: #e9973f; --wrong: #c62828; --slowInk: #9a5a00; --wrongKey: #f4a3a3;
  --paper: #fbf8f0; --paperInk: #1c1628;
}
:root[data-theme="light"] {
  --bg: #f6f3fa;
  --bg2: #e6e0ef;
  --ink: #1c1628;
  --inkDim: #4d4560;
  --line: #b2a7c6;
  --accent: #8a5200;
  --accentInk: #ffffff;
  --sel: #d8cfe6;
  --shade: rgba(241, 242, 248, 0.94);
  --toastBg: #141833;
  --toastInk: #ffffff;
  --danger: #b91c1c;
  --lkUnmet: #a2adb7; --lkGetting: #cb7b19; --lkRelaxed: #158076; --lkSteady: #15ac6f; --lkQuick: #88c060; --lkSnap: #f7bf12; --lkInk: #0e1730; --lkInkUnmet: #0e1730;
  --slow: #9a5a00; --wrong: #b91c1c; --slowInk: #9a5a00; --wrongKey: #f4a3a3;
  --paper: #fffdf8; --paperInk: #1c1628;
}

* { 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; 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: 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: 800 15px inherit; cursor: pointer; }
.seg button.sel { border-color: var(--accent); background: var(--sel); }

/* play: the table takes the width; the piano needs 7 x 44 px */
#scr-play { padding-left: 6px; padding-right: 6px; }
.menuGrid { grid-template-columns: 1fr 1fr 1fr; }
.menuGrid button.big { font-size: 15px; }
#stageRow button { min-width: 44%; }
#playTop { display: flex; justify-content: space-between; font-weight: 800; color: var(--inkDim); padding: 0 8px; }
#card { flex: 1; min-height: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; background: var(--paper); color: var(--paperInk); border-radius: 16px; padding: 8px; }
#staff svg { width: 100%; max-width: 420px; height: auto; display: block; }
#verdict { font-weight: 900; font-size: 20px; min-height: 26px; text-align: center; color: var(--paperInk); }
#verdict.slow { color: var(--slowInk); } #verdict.wrong { color: var(--wrong); }
#verdict.look-relaxed, #verdict.look-steady, #verdict.look-quick, #verdict.look-snap { color: var(--paperInk); background: none; }
#piano { position: relative; display: flex; height: 150px; min-width: 308px; user-select: none; }
#piano .white { flex: 1 1 0; min-width: 44px; height: 100%; background: #fbfaf7; border: 2px solid #3b344a; border-radius: 0 0 8px 8px; display: flex; align-items: flex-end; justify-content: center; padding-bottom: 8px; cursor: pointer; font: 900 20px inherit; color: #1c1628; }
#piano .white + .white { border-left: 0; }
#piano .white.right { background: var(--lkSteady); }
#piano .white.wrong { background: var(--wrongKey); }
#piano .black { position: absolute; top: 0; width: 8.6%; height: 58%; background: #1c1628; border-radius: 0 0 5px 5px; cursor: default; }
#btnNext[hidden] { display: none; }
#piano .white .name { pointer-events: none; }
#staff .line, #staff .ledger { shape-rendering: crispEdges; }
#staff .note { vector-effect: non-scaling-stroke; }

/* done */
#scr-done { align-items: center; justify-content: center; text-align: center; }
#doneSub, #doneUp { color: var(--inkDim); font-weight: 700; }

/* the chart */
#chart { display: grid; grid-template-columns: repeat(auto-fill, minmax(56px, 1fr)); gap: 4px; }
.cell { min-height: 44px; display: flex; align-items: center; justify-content: center; border-radius: 8px; font: 800 15px ui-monospace, Menlo, monospace; }
#chartCount { font-weight: 700; color: var(--inkDim); }
.look-unmet { background: var(--lkUnmet); color: var(--lkInkUnmet); } .look-getting { background: var(--lkGetting); color: var(--lkInk); }
.look-relaxed { background: var(--lkRelaxed); color: #ffffff; } .look-steady { background: var(--lkSteady); color: var(--lkInk); }
.look-quick { background: var(--lkQuick); color: var(--lkInk); } .look-snap { background: var(--lkSnap); color: var(--lkInk); }
.lgRow .sw { width: 22px; height: 22px; border-radius: 6px; flex: none; }
.clefRow { display: flex; flex-direction: column; gap: 4px; background: var(--paper); color: var(--paperInk); border-radius: 12px; padding: 6px 10px; margin-top: 6px; }
.clefRow svg { width: 100%; height: auto; max-width: 300px; }

/* 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; }

#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; }
/* R7.3 a lasting note while a write has not gone in (the toast says it once; this stays until a save goes in) */
#saveNote { position: fixed; left: 50%; top: 8px; transform: translateX(-50%); background: var(--toastBg); color: var(--toastInk); font-weight: 800; font-size: 14px; padding: 8px 14px; border-radius: 12px; pointer-events: none; z-index: 41; max-width: 90vw; text-align: center; box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3); }
#saveNote[hidden] { display: none; }

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