/* Play by Ear (modes/byear.js). Uses the tokens defined in index.html (--song, --yours, --match and the
   shared ones). Every class is prefixed be-. */

.be-sr {
  position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0);
  clip-path: inset(50%); white-space: nowrap; margin: -1px; padding: 0; border: 0;
}
.wrap.be-has-bar { padding-bottom: calc(150px + env(safe-area-inset-bottom, 0px)); }

/* ---------- song list ---------- */
.be-groups { display: flex; flex-direction: column; gap: 22px; }
.be-group { display: flex; flex-direction: column; gap: 10px; }
.be-group-title { font-size: 1.05rem; }
.be-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.be-row {
  width: 100%; min-height: 64px; text-align: left; display: flex; align-items: center; gap: 12px;
  padding: 12px 14px; border-radius: 14px; background: var(--card); border: 1.5px solid var(--line);
}
.be-row:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
.be-row-meta { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.be-row-meta strong { font-size: 1.05rem; }
.be-row-sub { font-size: 0.9rem; }
.be-row-pills { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 4px; }
.be-row-go { font-size: 1.6rem; color: var(--muted); flex: none; }
.be-pill {
  display: inline-flex; align-items: center; min-height: 26px; padding: 2px 10px; border-radius: 999px;
  font-size: 0.82rem; font-weight: 700; border: 1.5px solid var(--line); color: var(--muted); background: var(--paper);
}
.be-pill.good { color: var(--good); border-color: var(--good); background: var(--good-soft); }
.be-pill.learn { color: var(--learn); border-color: var(--learn); background: var(--learn-soft); }
.be-pill.best { color: var(--ink); border-color: var(--gold); }

/* ---------- step indicator ---------- */
.be-steps { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; }
.be-steps li {
  display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 6px 2px; border-radius: 10px;
  font-size: 0.8rem; font-weight: 700; color: var(--muted); text-align: center; border: 1.5px solid transparent;
}
.be-step-num {
  width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center;
  background: var(--line); color: var(--ink); font-size: 0.8rem;
}
.be-step-label { line-height: 1.2; }
.be-steps li.on { color: var(--accent); border-color: var(--accent); background: var(--accent-soft); }
.be-steps li.on .be-step-num { background: var(--accent); color: var(--on-accent); }
.be-steps li.done .be-step-num { background: var(--good-soft); color: var(--good); }
.be-body { display: flex; flex-direction: column; gap: 16px; }

/* ---------- listen ---------- */
.be-facts { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.be-fact { background: var(--card); border: 1.5px solid var(--line); border-radius: 14px; padding: 10px 14px; display: flex; flex-direction: column; }
.be-fact strong { font-family: var(--font-display); font-size: 1.25rem; }
.be-first { background: var(--card); border: 1.5px solid var(--line); border-radius: 16px; padding: 12px 14px; display: flex; flex-direction: column; gap: 8px; }
.be-first-head { display: flex; align-items: baseline; gap: 10px; }
.be-first-name { font-family: var(--font-display); font-size: 1.6rem; }
.be-first-row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.be-mini-staff { width: 136px; height: auto; flex: none; }
.be-mini-kb { flex: 1 1 160px; min-width: 0; height: 96px; }
.be-ear-note { font-size: 0.95rem; }
.be-progress { height: 8px; border-radius: 4px; }
.be-progress > div { background: var(--listen); transition: none; }
.be-speed { display: inline-flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.be-speed .speed { display: inline-flex; gap: 4px; flex-wrap: wrap; }
.be-speed .speed button {
  min-height: 40px; min-width: 56px; padding: 6px 12px; border-radius: 10px; font-weight: 700;
  background: var(--card); border: 1.5px solid var(--line);
}
.be-speed .speed button.on { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); }

/* ---------- practise ---------- */
.be-practise-head { display: flex; align-items: center; gap: 14px; }
.be-ring { width: 60px; height: 60px; flex: none; }
.be-ring circle { transition: stroke-dashoffset 0.5s linear; }
.be-timer-text { display: flex; flex-direction: column; min-width: 0; }
.be-timer-text strong { font-family: var(--font-display); font-size: 1.15rem; }
.be-live-track { transition: transform 180ms ease; }
.be-live.paused { opacity: 0.5; }
.be-keys { background: var(--card); border: 1.5px solid var(--line); border-radius: 14px; padding: 10px 12px; }
.be-keys summary { cursor: pointer; font-weight: 700; min-height: 32px; display: flex; align-items: center; }
.be-keys .keyboard { margin-top: 10px; }

/* ---------- real take ---------- */
.be-rec { display: inline-flex; align-items: center; gap: 10px; color: var(--bad); font-size: 1.05rem; }
.be-rec-dot { width: 14px; height: 14px; border-radius: 50%; background: var(--bad); animation: be-pulse 1.4s ease-in-out infinite; }
@keyframes be-pulse { 50% { opacity: 0.35; } }
.be-count { font-family: var(--font-display); font-weight: 800; font-size: 2rem; font-variant-numeric: tabular-nums; }

/* ---------- compare ---------- */
.be-summary { display: flex; flex-direction: column; gap: 6px; }
.be-summary-main { font-size: 1.3rem; }
.be-best { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; color: var(--muted); font-weight: 700; }
.be-legend { font-size: 0.9rem; font-weight: 700; }
.be-lg { white-space: nowrap; }
.be-lg.song { color: var(--song); }
.be-lg.yours { color: var(--yours); }
.be-lg.match { color: var(--match); }
.be-compare-card { padding: 8px 0; }
.be-scroll { overflow-x: auto; overflow-y: hidden; max-width: 100%; -webkit-overflow-scrolling: touch; }
.be-scroll:focus-visible { outline: 3px solid var(--accent); outline-offset: -3px; border-radius: 12px; }
.be-compare-card svg.be-compare { width: auto; max-width: none; height: auto; display: block; }
.be-hl { transition: opacity 0.12s linear; }
.be-diffs { display: flex; flex-direction: column; gap: 6px; }
.be-diffs h3 { font-size: 1.05rem; }
.be-diffs ul { margin: 0; padding-left: 20px; display: flex; flex-direction: column; gap: 4px; }

/* ---------- chord command bar (plain buttons when core/chordbar.js draws nothing) ---------- */
.be-chordbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 5;
  background: var(--card); border-top: 1.5px solid var(--line);
  padding: 10px max(16px, env(safe-area-inset-right, 0px)) calc(10px + env(safe-area-inset-bottom, 0px)) max(16px, env(safe-area-inset-left, 0px));
}
.be-cb-row { max-width: 728px; margin: 0 auto; display: grid; grid-template-columns: repeat(auto-fit, minmax(0, 1fr)); gap: 10px; }
.be-cb-chip {
  display: flex; align-items: center; gap: 10px; min-height: 56px; min-width: 0; padding: 8px 10px;
  border-radius: 12px; border: 1.5px solid var(--line); background: var(--paper); text-align: left;
  font-size: 0.9rem; line-height: 1.25; transition: background 0.2s ease, border-color 0.2s ease;
}
.be-cb-chip:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
.be-cb-keys { flex: none; }
.be-cb-text { min-width: 0; overflow-wrap: anywhere; }
.be-cb-chip.flash { background: var(--good-soft); border-color: var(--good); }
.be-cb-hint { max-width: 728px; margin: 6px auto 0; font-size: 0.85rem; text-align: center; }

@media (max-width: 420px) {
  .be-cb-chip { flex-direction: column; align-items: flex-start; gap: 4px; }
}
@media (prefers-reduced-motion: reduce) {
  .be-rec-dot { animation: none; }
}
