/* Practice games. Only theme tokens from style.css, so light and dark both work. */

/* `hidden` must win over display rules on buttons and fields (core sets display on .btn/.field). */
.btn[hidden], .field[hidden], .check[hidden], .row[hidden], [class^="pr-"][hidden], [class*=" pr-"][hidden] { display: none !important; }

.pr-stage { gap: 16px; }
.pr-stage .prompt { overflow-wrap: anywhere; }
.pr-tight { gap: 2px; }
.pr-keys { line-height: 2; }
.pr-keys kbd { margin: 0 1px; }

/* start gate */
.pr-start { display: flex; flex-direction: column; align-items: flex-start; gap: 14px; padding: 18px 0; }

/* answer buttons */
.pr-answers .pr-ans { position: relative; flex-direction: column; gap: 0; line-height: 1.2; padding: 8px 12px; text-align: center; }
.pr-ans-label { font-weight: 600; }
.pr-sub { font: 500 12px var(--font-mono); color: var(--muted); }
.pr-ans.good .pr-sub, .pr-ans.bad .pr-sub, .pr-ans.on .pr-sub { color: inherit; }
.pr-key {
  position: absolute; top: 3px; right: 4px; font-size: 10px; padding: 0 3px; line-height: 1.3;
  opacity: 0.55; border-bottom-width: 1px;
}
.pr-key-inline { font-size: 10px; opacity: 0.6; }
@media (hover: none) { .pr-key, .pr-key-inline { display: none; } }
.pr-answers.pr-notes12 { grid-template-columns: repeat(auto-fill, minmax(76px, 1fr)); }
.pr-ans.pr-missed { border-style: dashed; border-color: var(--good); color: var(--good); background: transparent; }

/* checkbox chips */
.pr-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.pr-chip {
  display: inline-flex; align-items: center; gap: 5px; cursor: pointer;
  padding: 4px 10px 4px 7px; border-radius: 999px; border: 1px solid var(--line);
  background: var(--surface); color: var(--fg); font: 500 13px var(--font-body); text-transform: none; letter-spacing: 0;
}
.pr-chip input { width: 15px; height: 15px; margin: 0; }
.pr-chip:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); color: var(--accent); }
.pr-chip:has(input:focus-visible) { outline: 2px solid var(--accent); outline-offset: 2px; }

/* timer (note finder speed run) */
.pr-clock { display: flex; flex-direction: column; gap: 4px; min-width: 120px; align-items: flex-end; }
.pr-clock .meter { width: 120px; }
.pr-timer { font: 900 44px/1 var(--font-display); font-variant-numeric: tabular-nums; color: var(--accent); }

/* mnemonic + info */
.pr-mnemonic p { margin: 0; }
.pr-ref { align-items: end; }
.pr-best { font-size: 15px; }
.pr-best b { font: 800 22px var(--font-display); color: var(--accent); }

/* echo: answer slots and live mic readout */
.pr-slots { display: flex; flex-wrap: wrap; gap: 8px; min-height: 52px; }
.pr-slot {
  display: inline-flex; align-items: center; justify-content: center; min-width: 56px; height: 52px; padding: 0 10px;
  border: 2px dashed var(--line); border-radius: 10px; font: 800 26px var(--font-display); color: var(--muted);
}
.pr-slot.good { border-style: solid; border-color: var(--good); background: var(--good-soft); color: var(--good); }
.pr-slot.bad { border-style: solid; border-color: var(--bad); background: var(--bad-soft); color: var(--bad); }
.pr-live { display: flex; align-items: center; gap: 18px; flex-wrap: wrap; }
.pr-live-note { font: 900 56px/1 var(--font-display); min-width: 2.4ch; font-variant-numeric: tabular-nums; }
.pr-live-meters { flex: 1; min-width: 180px; gap: 6px; }
.pr-cents { position: relative; height: 22px; border-radius: 6px; background: var(--surface-2); overflow: hidden; }
.pr-cents-mid { position: absolute; left: 50%; top: 0; bottom: 0; width: 2px; margin-left: -1px; background: var(--muted); opacity: 0.6; }
.pr-needle { position: absolute; top: 3px; bottom: 3px; left: 50%; width: 4px; margin-left: -2px; border-radius: 2px; background: var(--bad); transition: left .08s linear; }
.pr-needle.ok { background: var(--good); }
.pr-level { height: 6px; }
.pr-level > i { transition: width .06s linear; }

/* song melody chips */
.pr-melody { display: flex; flex-wrap: wrap; gap: 5px; }
.pr-nchip {
  min-width: 2.4em; text-align: center; padding: 4px 6px; border-radius: 6px;
  background: var(--surface-2); border: 1px solid var(--line); font: 600 14px var(--font-mono);
  transition: background .1s, color .1s;
}
.pr-nchip.q { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }
.pr-nchip.on { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.pr-nchip.good { background: var(--good-soft); color: var(--good); border-color: var(--good); }
.pr-nchip.bad { background: var(--bad-soft); color: var(--bad); border-color: var(--bad); }

/* tab grid: one row per string, one column per note */
.pr-tab-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; padding-bottom: 4px; }
.pr-tab {
  display: grid; width: max-content; min-width: 100%;
  font: 600 13px/1 var(--font-mono); background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px;
}
.pr-tab-str { color: var(--muted); padding: 3px 6px 3px 0; text-align: right; font-weight: 500; }
.pr-tab-cell { position: relative; height: 21px; display: flex; align-items: center; justify-content: center; }
.pr-tab-cell::before { content: ''; position: absolute; left: 0; right: 0; top: 50%; height: 1px; background: var(--line); }
.pr-tab-cell b { position: relative; padding: 1px 4px; border-radius: 4px; background: var(--surface); font-weight: 600; }
.pr-tab-cell.q b { color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.pr-tab-cell.on b { background: var(--accent); color: var(--accent-ink); }
.pr-tab-cell.good b { color: var(--good); box-shadow: 0 0 0 1px var(--good); }
.pr-tab-cell.bad b { color: var(--bad); box-shadow: 0 0 0 1px var(--bad); }
.pr-tab-cell.pr-hidden b { color: transparent; }
.pr-tab-cell.pr-hidden b::after { content: '?'; position: absolute; inset: 1px 0 0; text-align: center; color: var(--accent); }

.pr-dirs .btn { min-width: 112px; }
.pr-songs-details summary { cursor: pointer; font-weight: 600; }
.pr-songlist { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 240px), 1fr)); gap: 6px; margin-top: 10px; }
.pr-songrow {
  display: flex; justify-content: space-between; gap: 8px; align-items: center; text-align: left;
  font: 500 14px var(--font-body); color: var(--fg); background: var(--surface-2); border: 1px solid var(--line);
  border-radius: 8px; padding: 7px 10px; cursor: pointer;
}
.pr-songrow:hover { border-color: var(--accent); }
.pr-songrow.done { border-color: var(--good); }
.pr-songrow.done span:first-child::after { content: ' ✓'; color: var(--good); }

/* circle of fifths */
.pr-kq-info { display: flex; flex-wrap: wrap; gap: 16px; align-items: center; }
.pr-kq-info > p { flex: 1 1 260px; }
.pr-circle { width: 260px; max-width: 100%; height: auto; flex: 0 0 auto; }
.pr-circle-ring { fill: none; stroke: var(--line); stroke-width: 1.5; }
.pr-circle-hi { fill: var(--accent); }
.pr-circle-hi2 { fill: var(--cool); }
.pr-circle-maj { font: 800 17px var(--font-display); fill: var(--fg); }
.pr-circle-min { font: 600 11px var(--font-mono); fill: var(--muted); }
.pr-circle-acc { font: 500 9.5px var(--font-mono); fill: var(--muted); opacity: 0.8; }
.pr-circle-maj.on { fill: var(--accent-ink); }
.pr-circle-min.on { fill: var(--bg); }

/* rhythm grid */
.pr-rgrid { display: flex; flex-direction: column; gap: 14px; }
.pr-rbarwrap { position: relative; }
.pr-rbar {
  display: grid; grid-template-columns: repeat(16, 1fr); gap: 3px; min-height: 52px; padding: 4px;
  background: repeating-linear-gradient(90deg, transparent 0 calc(25% - 1px), var(--line) calc(25% - 1px) 25%) var(--surface-2);
  border: 1px solid var(--line); border-radius: 8px;
}
.pr-rnote, .pr-rrest {
  display: flex; align-items: center; padding-left: 6px; border-radius: 5px; min-width: 0; overflow: hidden;
  font: 700 13px var(--font-mono); white-space: nowrap;
}
.pr-rnote { background: var(--accent-soft); color: var(--accent); border-left: 5px solid var(--accent); }
.pr-rrest { border: 1px dashed var(--line); color: var(--muted); font-weight: 500; font-size: 11px; background: var(--surface); }
.pr-rnote.perfect { background: var(--good-soft); color: var(--good); border-left-color: var(--good); }
.pr-rnote.good { background: var(--good-soft); color: var(--good); border-left-color: var(--cool); }
.pr-rnote.ok, .pr-rnote.off { background: var(--surface); color: var(--fg); border-left-color: var(--muted); }
.pr-rnote.miss { background: var(--bad-soft); color: var(--bad); border-left-color: var(--bad); }
.pr-rcounts { display: grid; grid-template-columns: repeat(16, 1fr); padding: 2px 4px 0; font: 500 11px var(--font-mono); color: var(--muted); text-align: left; }
.pr-rcounts span { padding-left: 6px; }
.pr-rcounts .beat { color: var(--fg); font-weight: 700; }
.pr-rhead { position: absolute; top: 0; height: 60px; width: 2px; margin-left: 4px; background: var(--fg); pointer-events: none; }

.pr-tapzone { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.pr-count { font: 900 54px/1 var(--font-display); color: var(--accent); min-width: 2.2ch; text-transform: uppercase; }
.pr-pad {
  flex: 1 1 200px; min-height: 96px; border-radius: 14px; cursor: pointer; touch-action: manipulation; user-select: none;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  font: 900 34px/1 var(--font-display); letter-spacing: 0.06em; color: var(--fg);
  background: var(--surface-2); border: 2px solid var(--line);
}
.pr-pad small { font: 500 12px var(--font-mono); color: var(--muted); letter-spacing: 0; }
.pr-pad.armed { border-color: var(--accent); }
.pr-pad.flash-good { animation: pr-flash-good .25s ease-out; }
.pr-pad.flash-bad { animation: pr-flash-bad .25s ease-out; }
@keyframes pr-flash-good { from { background: var(--good-soft); border-color: var(--good); } }
@keyframes pr-flash-bad { from { background: var(--bad-soft); border-color: var(--bad); } }
.pr-tapinfo { min-width: 12ch; }

.pr-results:empty { display: none; }
.pr-results { display: flex; flex-direction: column; gap: 10px; border-top: 1px solid var(--line); padding-top: 14px; }
.pr-pct { font-size: clamp(48px, 10vw, 72px); }
.chip.pr-g-perfect, .chip.pr-g-good { background: var(--good-soft); color: var(--good); }
.chip.pr-g-miss { background: var(--bad-soft); color: var(--bad); }
.pr-errplot {
  position: relative; display: flex; gap: 2px; height: 120px; padding: 0 0 18px 44px;
  background: linear-gradient(var(--muted), var(--muted)) 0 calc(50% - 9px) / 100% 1px no-repeat;
  overflow-x: auto;
}
.pr-err-axis { position: absolute; left: 0; font: 500 10px var(--font-mono); color: var(--muted); }
.pr-err-axis.top { top: 0; }
.pr-err-axis.bottom { bottom: 18px; }
.pr-errcol { position: relative; flex: 1 0 14px; max-width: 34px; border-radius: 4px; }
.pr-errcol:hover { background: var(--surface-2); }
.pr-errcol small { position: absolute; bottom: -18px; left: 0; right: 0; text-align: center; font: 500 10px var(--font-mono); color: var(--muted); }
.pr-errdot { position: absolute; left: 50%; width: 11px; height: 11px; margin: -5.5px 0 0 -5.5px; border-radius: 50%; background: var(--muted); }
.pr-errdot.perfect { background: var(--good); }
.pr-errdot.good { background: var(--cool); }
.pr-errdot.ok { background: var(--accent); }
.pr-errdot.off { background: var(--bad); opacity: 0.7; }
.pr-errdot.miss { top: 50%; background: none; color: var(--bad); width: auto; height: auto; margin: -9px 0 0 -4px; font: 700 14px var(--font-mono); }

@media (max-width: 480px) {
  .pr-rnote, .pr-rrest { padding-left: 3px; font-size: 11px; }
  .pr-rcounts { font-size: 9.5px; }
  .pr-rcounts span { padding-left: 3px; }
  .pr-live-note { font-size: 44px; }
  .pr-dirs .btn { min-width: 0; flex: 1; }
  .pr-answers.pr-notes12 { grid-template-columns: repeat(4, 1fr); }
}
