/* Stavalator: deep space, a glowing stave, Alator gold. */
@font-face { font-family: Bravura; src: url(bravura.woff2) format('woff2'); font-display: block; }

:root {
  --gold: #ffc21a;
  --ink: #05060f;
  --glow: #7fe7ff;
  --wrong: #ff4040;
  --right: #22d36e;
  --text: #eef3ff;
  --muted: #9aa6c7;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; }
/* No double-tap zoom on iPads (game.js does the rest), and no copy menu on a long press. */
body { background: var(--ink); color: var(--text); font-family: -apple-system, "Helvetica Neue", Arial, sans-serif;
  display: flex; flex-direction: column; touch-action: manipulation; -webkit-user-select: none; user-select: none;
  -webkit-touch-callout: none; overscroll-behavior: none; }
button { font: inherit; color: inherit; cursor: pointer; touch-action: manipulation; -webkit-tap-highlight-color: transparent; }
.hidden { display: none !important; }

/* ── Top bar ── */
.bar { flex: none; display: flex; align-items: center; gap: 14px; padding: 8px 16px; padding-top: max(8px, env(safe-area-inset-top));
  background: rgba(5, 6, 15, .85); border-bottom: 1px solid rgba(127, 231, 255, .18); z-index: 3; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 900; letter-spacing: 3px; font-size: 18px; }
.logo { width: 30px; height: 30px; background: url(icon.svg) center / contain no-repeat; }
.hud { flex: 1; display: flex; justify-content: center; gap: 26px; font-size: 15px; color: var(--muted); font-weight: 700; }
.hud b { color: var(--text); font-size: 20px; margin-left: 4px; }
.lives { display: flex; gap: 6px; align-items: center; }
.lives i { width: 26px; height: 18px; background: url(icon-ship.svg) center / contain no-repeat; }
.lives i.gone { opacity: .18; }
.bar-right { margin-left: auto; display: flex; gap: 8px; align-items: center; }
.bar-btn { background: rgba(255, 255, 255, .08); border: 1px solid rgba(255, 255, 255, .2); border-radius: 999px; padding: 7px 14px; font-weight: 700; }
.chip { font-size: 13px; color: var(--muted); }

/* ── The game ── */
.stage { position: relative; flex: 1; min-height: 0; overflow: hidden;
  background: radial-gradient(ellipse at 78% 22%, rgba(146, 64, 214, .45), transparent 55%),
              radial-gradient(ellipse at 12% 85%, rgba(0, 150, 199, .35), transparent 50%),
              radial-gradient(ellipse at 50% 120%, rgba(255, 194, 26, .16), transparent 55%),
              linear-gradient(180deg, #070a1f, #0b0626 60%, #05060f); }
#sky { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.heading { position: absolute; left: 0; right: 0; top: 14px; margin: 0; text-align: center; font-size: clamp(18px, 3vw, 28px);
  font-weight: 900; letter-spacing: .5px; text-shadow: 0 0 18px rgba(127, 231, 255, .55); pointer-events: none; }
.banner { position: absolute; left: 50%; top: 42%; transform: translate(-50%, -50%); font-size: clamp(34px, 7vw, 72px); font-weight: 900;
  color: var(--gold); letter-spacing: 4px; text-shadow: 0 0 30px rgba(255, 194, 26, .8); pointer-events: none; animation: banner 1.2s ease-out forwards; }
@keyframes banner { 0% { opacity: 0; transform: translate(-50%, -50%) scale(.6); } 20% { opacity: 1; transform: translate(-50%, -50%) scale(1.08); }
  75% { opacity: 1; } 100% { opacity: 0; transform: translate(-50%, -50%) scale(1); } }

/* ── Start and game-over panels ── */
.panel { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 20px; text-align: center; z-index: 2; overflow: auto; }
.title { margin: 0; font-size: clamp(44px, 9vw, 96px); font-weight: 900; letter-spacing: clamp(4px, 1.2vw, 12px);
  background: linear-gradient(180deg, #fff 10%, var(--glow) 55%, #5b8cff); -webkit-background-clip: text; background-clip: text; color: transparent;
  filter: drop-shadow(0 0 22px rgba(127, 231, 255, .45)); }
.tag { margin: 6px 0 22px; font-size: clamp(16px, 2.4vw, 22px); color: var(--gold); font-weight: 800; letter-spacing: 1px; }
.small { color: var(--muted); font-size: 14px; }
.modes { display: flex; gap: 18px; flex-wrap: wrap; justify-content: center; }
.mode-btn { width: min(330px, 86vw); display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 18px 20px 16px; border-radius: 22px;
  background: rgba(10, 16, 40, .7); border: 1.5px solid rgba(127, 231, 255, .35); box-shadow: 0 0 26px rgba(127, 231, 255, .12) inset; transition: transform .12s, border-color .12s; }
.mode-btn:hover { transform: translateY(-2px); border-color: var(--gold); }
.mode-btn .glyph { font-family: Bravura; font-size: 54px; line-height: 1; height: 64px; display: flex; align-items: flex-end; padding-bottom: 14px; color: var(--glow); text-shadow: 0 0 14px rgba(127, 231, 255, .7); }
.mode-btn[data-mode="names"] .glyph::before { content: "\E050"; }
.mode-btn[data-mode="values"] .glyph::before { content: "\E1D5\2003\E1D7"; font-size: 46px; }
.mode-btn b { font-size: 22px; }
.mode-btn span { font-size: 14.5px; color: var(--muted); line-height: 1.35; }
.mode-btn em { font-style: normal; font-size: 13px; color: var(--gold); font-weight: 700; min-height: 1em; }
.big-score { margin: 10px 0 0; font-size: clamp(28px, 5vw, 44px); font-weight: 900; }
.over-btns { display: flex; gap: 12px; flex-wrap: wrap; justify-content: center; }
.go, .ghost { border-radius: 999px; padding: 13px 26px; font-weight: 900; font-size: 18px; }
.go { background: var(--gold); color: #111; border: 0; }
.ghost { background: transparent; border: 1.5px solid rgba(255, 255, 255, .4); }

/* ── Controls: the piano, or the beat buttons ── */
.controls { flex: none; padding: 10px 12px; padding-bottom: max(12px, env(safe-area-inset-bottom)); background: #03040b; border-top: 1px solid rgba(127, 231, 255, .25); }
.piano { position: relative; display: flex; height: clamp(150px, 27vh, 250px); max-width: 900px; margin: 0 auto; touch-action: none; }
.key { position: relative; -webkit-tap-highlight-color: transparent; }
.key.white { flex: 1; background: linear-gradient(#fff, #e9ecf5); border: 1px solid #0a0a14; border-top: 0; border-radius: 0 0 10px 10px; margin: 0 2px; }
.key.black { position: absolute; top: 0; width: calc(100% / 7 * .62); height: 60%; background: linear-gradient(#2a2d3a, #0c0d14); border: 1px solid #000;
  border-radius: 0 0 8px 8px; z-index: 2; box-shadow: inset 0 -6px 0 #333; }
.key .lbl { position: absolute; left: 0; right: 0; bottom: 10px; text-align: center; pointer-events: none; font-weight: 900; }
.key.white .lbl { color: #111; font-size: clamp(18px, 3vw, 28px); }
.key.black .lbl { color: #fff; font-size: clamp(11px, 1.6vw, 15px); line-height: 1.15; bottom: 8px; }
.key.down.white { background: #d7dcea; }
.key.down.black { background: #444; }
.key.right, .beat.right { animation: right .4s ease-out; }
.key.wrong-flash, .beat.wrong-flash { animation: wrong-flash .26s steps(1) 3; }
@keyframes right { 0% { box-shadow: inset 0 0 0 999px rgba(34, 211, 110, .9), 0 0 24px var(--right); } 100% { box-shadow: inset 0 0 0 999px rgba(34, 211, 110, 0); } }
@keyframes wrong-flash { 0% { box-shadow: inset 0 0 0 999px rgba(255, 64, 64, .95), 0 0 24px var(--wrong); } 60% { box-shadow: none; } }
.beats { display: flex; gap: 14px; justify-content: center; max-width: 820px; margin: 0 auto; }
.beat { flex: 1; height: clamp(90px, 18vh, 150px); border-radius: 22px; font-size: clamp(40px, 8vw, 72px); font-weight: 900; color: #111;
  background: linear-gradient(#ffe07a, var(--gold)); border: 0; box-shadow: 0 6px 0 #a87800; }
.beat:active { transform: translateY(3px); box-shadow: 0 3px 0 #a87800; }

@media (max-width: 640px) {
  .brand { font-size: 0; gap: 0; }
  .hud { gap: 14px; font-size: 13px; }
}

/* ── The top 10s ── */
#boards-btn { margin-top: 14px; color: var(--gold); border-color: var(--gold); }
.small-title { font-size: clamp(34px, 6vw, 60px); }
.boards-two { display: flex; gap: 22px; flex-wrap: wrap; justify-content: center; margin: 14px 0 18px; }
.boards-two > div { width: min(340px, 90vw); }
.boards-two h3, .over-board h3 { margin: 0 0 6px; color: var(--glow); }
.over-board { width: min(420px, 92vw); margin: 4px 0 18px; }
.board { list-style: none; padding: 0; margin: 0; counter-reset: rank; text-align: left; }
.board li { display: grid; grid-template-columns: 30px minmax(56px, max-content) 1fr auto; align-items: center; gap: 6px; padding: 6px 10px; border-radius: 10px; counter-increment: rank; }
.board li::before { content: counter(rank); font-weight: 900; color: var(--muted); }
.board li:nth-child(odd) { background: rgba(127, 231, 255, .08); }
.board li.mine { background: var(--gold); color: #111; }
.board li.mine::before, .board li.mine .cls { color: #111; }
.board .who { font-weight: 900; font-size: 18px; letter-spacing: 2px; white-space: nowrap; }
.board .cls { color: var(--muted); font-size: 14px; }
.board .pts { font-weight: 900; font-size: 18px; }
.ini-card { background: rgba(10, 16, 40, .8); border: 1.5px solid var(--gold); border-radius: 18px; padding: 14px 16px; }
.ini-card h3 { color: var(--gold) !important; font-size: 22px; }
.cls-pick { display: flex; gap: 10px; align-items: center; justify-content: center; font-weight: 700; margin: 8px 0 4px; }
.cls-pick select { font: inherit; font-size: 17px; padding: 8px 10px; border-radius: 10px; }
.ini { display: flex; gap: 10px; justify-content: center; margin: 8px 0 10px; }
.ini input { width: 72px; height: 76px; padding: 0; font-size: 40px; font-weight: 900; text-align: center; text-transform: uppercase; border: 3px solid var(--gold); border-radius: 12px; -webkit-user-select: text; user-select: text; }
.err { color: #ff8080; font-weight: 700; margin: 0 0 8px; }
/* A panel taller than the screen scrolls from its top instead of being cut off. */
.panel::before, .panel::after { content: ''; margin: auto; }
.banner.high { top: 13%; z-index: 4; }

/* ── Help: most of the screen ── */
.help { position: fixed; inset: 0; z-index: 10; background: rgba(2, 3, 10, .6); display: flex; padding: 3vh 3vw; }
.help-card { flex: 1; overflow: auto; background: #0c1130; border: 1.5px solid rgba(127, 231, 255, .4); border-radius: 22px; padding: 16px 22px 22px;
  box-shadow: 0 0 40px rgba(127, 231, 255, .2); }
.help-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.help-tabs { display: flex; background: rgba(255, 255, 255, .06); border-radius: 999px; padding: 3px; }
.help-tabs button { border: 0; background: none; padding: 9px 18px; border-radius: 999px; font-weight: 800; font-size: 16px; }
.help-tabs button.on { background: var(--gold); color: #111; }
.help-warn { color: #ff9a9a; font-weight: 800; margin: 10px 0 0; text-align: center; }
.help-body { margin-top: 14px; }
.help-stave { width: 100%; max-height: 38vh; display: block; }
.help-stave .ln, .help-val .ln { stroke: #7fe7ff; stroke-width: .9; }
.help-stave .ledger { stroke: #fff; stroke-width: 1.2; }
.mus { font-family: Bravura; font-size: 40px; fill: #fff; }
.help-stave .clef { fill: #cfefff; }
.help-stave .nm { font-size: 11px; font-weight: 900; fill: var(--gold); text-anchor: middle; }
.help-tips { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 10px; margin: 8px 0 14px; }
.help-tips p { margin: 0; background: rgba(127, 231, 255, .08); border-radius: 12px; padding: 10px 12px; font-size: 15px; line-height: 1.4; }
.help-keys { position: relative; display: flex; height: 120px; max-width: 560px; margin: 0 auto; }
.help-keys i { flex: 1; background: #fff; color: #111; border: 1px solid #000; border-radius: 0 0 8px 8px; margin: 0 1px; display: flex; align-items: flex-end; justify-content: center; padding-bottom: 8px; font-style: normal; font-size: 18px; }
.help-keys u { position: absolute; top: 0; width: calc(100% / 7 * .62); height: 62%; background: #15161f; color: #fff; text-decoration: none; border-radius: 0 0 6px 6px;
  display: flex; align-items: flex-end; justify-content: center; text-align: center; padding-bottom: 6px; font-size: 11px; font-weight: 800; line-height: 1.15; }
.help-values { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 14px; }
.hv { background: rgba(127, 231, 255, .07); border-radius: 16px; padding: 14px; display: flex; flex-direction: column; align-items: center; gap: 4px; }
.help-val { width: 110px; height: 110px; }
.help-val .ink { fill: #fff; }
.hv b { font-size: 19px; }
.hv span { color: var(--gold); font-weight: 900; font-size: 22px; }

/* ── Maths (4 Nov 2026): the Note values switch, and its tag on the board ── */
.mode-col { display: flex; flex-direction: column; align-items: center; gap: 10px; }
.maths-toggle { display: flex; background: rgba(10, 16, 40, .8); border: 1.5px solid rgba(127, 231, 255, .35); border-radius: 999px; padding: 4px; }
.maths-toggle button { border: 0; background: none; border-radius: 999px; padding: 9px 18px; font-weight: 900; font-size: 16px; color: var(--muted); }
.maths-toggle button small { font-weight: 700; font-size: 12px; margin-left: 4px; }
.maths-toggle button.on { background: var(--glow); color: #111; }
.maths-toggle button[data-maths="1"].on { background: var(--gold); }
.tag-maths { font-size: 10.5px; font-weight: 900; letter-spacing: 1px; background: var(--gold); color: #111; border-radius: 6px; padding: 2px 6px; margin-left: 6px; vertical-align: 2px; }
.board li.mine .tag-maths { background: #111; color: var(--gold); }
.help-maths { margin: 16px 0 0; background: rgba(255, 194, 26, .12); border-radius: 12px; padding: 12px 14px; font-size: 17px; }
.beat { font-variant-numeric: lining-nums; }
