:root {
  color-scheme: light dark;
  --bg: #f6f3ee;
  --card: #ffffff;
  --ink: #1f1d1a;
  --muted: #6f6a62;
  --line: #d9d3c9;
  --brass: #b8860b;
  --brass-soft: #f3e3b5;
  --good: #2e7d4f;
  --good-soft: #d6efdf;
  --bad: #b23a3a;
  --bad-soft: #f6dada;
  --mid-soft: #f7ebc8;
  --warn: #b7700c;
  --valve: #e9e4da;
  --valve-down: #b8860b;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #171614;
    --card: #22201d;
    --ink: #eeeae3;
    --muted: #a39d93;
    --line: #3b3833;
    --brass: #e0b445;
    --brass-soft: #4a3c17;
    --good: #6fcf97;
    --good-soft: #1f3a2a;
    --bad: #ef7d7d;
    --bad-soft: #4a2323;
    --mid-soft: #463b1d;
    --warn: #f0a94a;
    --valve: #34312c;
    --valve-down: #e0b445;
  }
}

* { box-sizing: border-box; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 16px/1.45 system-ui, -apple-system, "Segoe UI", sans-serif;
}
button, select, input { font: inherit; color: inherit; }

.top {
  display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px;
  max-width: 760px; margin: 0 auto; padding: 14px 16px 10px;
}
.top h1 { margin-right: auto !important; }
.top .tabs { order: 3; flex-basis: 100%; overflow-x: auto; scrollbar-width: none; }
.top .tab { flex-shrink: 0; }
.top h1 { font-size: 20px; margin: 0; white-space: nowrap; }
.tabs { display: flex; gap: 4px; flex: 1; }
.tab {
  border: 0; background: transparent; padding: 6px 12px; border-radius: 8px; cursor: pointer;
}
.tab.active { background: var(--brass-soft); font-weight: 600; }
.tab:disabled { color: var(--muted); cursor: default; }
#helpBtn { font-weight: 700; font-size: 19px; width: 36px; }
.icon-btn { border: 0; background: transparent; font-size: 22px; cursor: pointer; padding: 4px 8px; border-radius: 8px; }
.icon-btn:hover { background: var(--valve); }

main { max-width: 760px; margin: 0 auto; padding: 0 16px 40px; display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; }
.panel { display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; }
.panel[hidden], #valvePanel[hidden], .controls[hidden], .card[hidden] { display: none; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 20px; }
.card h2 { margin: 0 0 4px; font-size: 17px; }
.sub { margin: 0 0 14px; color: var(--muted); font-size: 14px; }

.scorebar { display: flex; justify-content: center; gap: 32px; }
.scorebar div { display: flex; flex-direction: column; align-items: center; }
.scorebar .label { font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; }
.scorebar span:last-child { font-size: 20px; font-weight: 600; font-variant-numeric: tabular-nums; }

.staff-wrap { display: flex; justify-content: center; margin: 8px 0 0; }
#fStaff { width: 100%; max-width: 340px; height: auto; }
svg .staff-line { stroke: var(--ink); stroke-width: 1.2; }
svg .clef, svg .acc, svg .timesig, svg .rest { fill: var(--ink); }
svg .timesig { font-weight: 700; font-family: Georgia, serif; }
svg .note .head { fill: var(--ink); }
svg .note .hole { fill: var(--card); }
svg .note .under { fill: var(--muted); font-family: ui-monospace, Consolas, monospace; }
svg .note.correct .head, svg .note.correct .acc { fill: var(--good); }
svg .note.wrong .head, svg .note.wrong .acc { fill: var(--bad); }
svg .note.fixed .head, svg .note.fixed .acc { fill: var(--warn); }
svg .note.current .head, svg .note.current .acc { fill: var(--brass); }
svg .cursor { fill: var(--brass-soft); }
svg .ear-q { fill: var(--brass); font-weight: 700; font-family: Georgia, serif; }

/* Scales: the staff can be wider than the card, so it scrolls sideways. */
.staff-scroll { overflow-x: auto; margin: 8px -4px 0; padding: 0 4px; scroll-behavior: smooth; }
.staff-scroll svg { display: block; height: auto; margin: 0 auto; }
.controls { display: flex; flex-wrap: wrap; gap: 10px 14px; align-items: flex-end; margin-bottom: 8px; }
.controls label { display: flex; flex-direction: column; gap: 4px; font-size: 13px; color: var(--muted); }
.controls select { padding: 6px 8px; border-radius: 8px; border: 1px solid var(--line); background: var(--bg); color: var(--ink); }
label.check { flex-direction: row !important; align-items: center; gap: 6px; font-size: 14px; color: var(--ink); cursor: pointer; }
.actions.secondary { margin-top: 12px; align-items: center; }
.sub.center { text-align: center; margin: 10px 0 0; }

/* Rhythm */
.tempo-row { display: flex; align-items: center; gap: 8px; }
.tempo-row button {
  width: 32px; height: 32px; border-radius: 50%; border: 1px solid var(--line);
  background: var(--card); cursor: pointer; font-size: 18px; line-height: 1;
}
.tempo-row input[type=range] { width: 180px; accent-color: var(--brass); }
.bpm { color: var(--ink); font-size: 16px; font-variant-numeric: tabular-nums; min-width: 70px; }
.bpm output { font-weight: 700; font-size: 20px; }
.beat-dots { display: flex; justify-content: center; gap: 14px; margin: 14px 0; }
.beat-dots .dot { width: 18px; height: 18px; border-radius: 50%; background: var(--valve); border: 2px solid var(--line); transition: background .04s; }
.beat-dots .dot.on { background: var(--brass); border-color: var(--brass); }
.beat-dots .dot.first.on { background: var(--bad); border-color: var(--bad); }
svg .barline { stroke: var(--ink); stroke-width: 1.2; }
svg .barline-thick, svg .beam { fill: var(--ink); }
svg .rh-ev .head, svg .rh-ev .dot { fill: var(--ink); }
svg .rh-ev .head.open { fill: var(--card); stroke: var(--ink); stroke-width: 1.6; }
svg .rh-ev .stem { stroke: var(--ink); stroke-width: 1.3; }
svg .rh-ev .flag { stroke: var(--ink); stroke-width: 2.2; fill: none; stroke-linecap: round; }
svg .rh-ev .offset { fill: var(--muted); font-variant-numeric: tabular-nums; }
svg .tie { fill: none; stroke: var(--ink); stroke-width: 1.4; }
svg .tuplet { fill: var(--ink); font-style: italic; font-family: Georgia, serif; }
svg .rh-ev.active .head { fill: var(--brass); }
svg .rh-ev.active .head.open { fill: var(--brass-soft); stroke: var(--brass); }
svg .rh-ev.great .head { fill: var(--good); }
svg .rh-ev.good .head { fill: var(--warn); }
svg .rh-ev.off .head, svg .rh-ev.miss .head { fill: var(--bad); }
svg .rh-ev.great .head.open { fill: var(--good-soft); stroke: var(--good); }
svg .rh-ev.good .head.open { fill: var(--mid-soft); stroke: var(--warn); }
svg .rh-ev.off .head.open, svg .rh-ev.miss .head.open { fill: var(--bad-soft); stroke: var(--bad); }
svg .rh-ev.great .offset { fill: var(--good); }
svg .rh-ev.good .offset { fill: var(--warn); }
svg .rh-ev.off .offset, svg .rh-ev.miss .offset { fill: var(--bad); }
.feedback.count { font-size: 30px; font-weight: 700; color: var(--brass); line-height: 1.4; }
.tap-pad {
  display: block; width: 100%; max-width: 360px; height: 84px; margin: 4px auto 16px;
  border-radius: 16px; border: 2px dashed var(--line); background: var(--valve);
  font-size: 20px; font-weight: 600; cursor: pointer; user-select: none; touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}
.tap-pad.live { border-style: solid; border-color: var(--brass); }
.tap-pad.hit { background: var(--brass-soft); }

.note-name { text-align: center; font-size: 22px; font-weight: 600; min-height: 32px; }
.feedback { text-align: center; min-height: 48px; color: var(--muted); }
.feedback.good { color: var(--good); }
.feedback.bad { color: var(--bad); }

.valves { display: flex; justify-content: center; gap: 14px; margin: 12px 0 18px; }
.valve {
  width: 72px; height: 72px; border-radius: 50%;
  border: 2px solid var(--line); background: var(--valve);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  cursor: pointer; transition: transform .05s, background .05s;
  -webkit-tap-highlight-color: transparent; user-select: none;
}
.valve .num { font-size: 22px; font-weight: 700; }
.valve.fourth { margin-left: 18px; }
.valve { touch-action: none; -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }
.valve.down { background: var(--valve-down); border-color: var(--valve-down); color: #1f1d1a; transform: translateY(3px); }
.valve.answer { box-shadow: 0 0 0 4px var(--good); }

.actions { display: flex; justify-content: center; gap: 10px; flex-wrap: wrap; }
.actions button, .dialog-actions button {
  border: 1px solid var(--line); background: var(--card); padding: 8px 16px; border-radius: 10px; cursor: pointer;
}
button.primary { background: var(--brass); border-color: var(--brass); color: #1f1d1a; font-weight: 600; }
button.danger { color: var(--bad); }
kbd {
  font: 12px ui-monospace, Consolas, monospace; padding: 1px 5px; border-radius: 4px;
  border: 1px solid var(--line); background: var(--bg); color: var(--muted);
}
button.primary kbd { background: transparent; border-color: rgba(0,0,0,.25); color: inherit; }
.hint { text-align: center; color: var(--muted); font-size: 14px; margin: 14px 0 0; }

.note-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(64px, 1fr)); gap: 6px; }
.cell { border-radius: 8px; padding: 6px 4px; text-align: center; background: var(--valve); font-size: 14px; }
.cell b { display: block; font-size: 15px; }
.cell span { color: var(--muted); font-size: 12px; }
.cell.strong { background: var(--good-soft); }
.cell.ok { background: var(--mid-soft); }
.cell.weak { background: var(--bad-soft); }

/* Chart */
.chart-rows { display: grid; gap: 4px; }
.chart-rows .staff-scroll svg { margin: 0; }
svg .note.dim { opacity: .35; }
.chart-staff .note .under:not(.alt) { fill: var(--ink); font-weight: 700; }
svg .hit { fill: transparent; cursor: pointer; }
svg .hit:hover { fill: var(--brass-soft); fill-opacity: .5; }

/* Today */
.today-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 8px; }
.td-mins { margin-top: 8px; }
.prog-summary { grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); }
.prog-chart { width: 100%; height: auto; display: block; }
.prog-chart .bar { fill: var(--good); opacity: .75; }
.prog-chart .bar.now { opacity: 1; }
.prog-chart .grid { stroke: var(--line); }
.prog-chart .axis { font-size: 10px; fill: var(--muted); }
.prog-chart .trend { fill: none; stroke: var(--good); stroke-width: 2; }
.prog-chart .trend-dot { fill: var(--good); }
.prog-table { border-collapse: collapse; width: 100%; font-size: 14px; }
.prog-table th, .prog-table td { text-align: left; padding: 4px 10px 4px 0; border-bottom: 1px solid var(--line); vertical-align: top; }
.prog-table th { font-weight: 600; color: var(--muted); white-space: nowrap; }
#prJournal p { margin: 4px 0; white-space: pre-wrap; }
#tdCustomPop { display: inline-block; margin-left: 6px; }
.td-custom { display: grid; gap: 2px; min-width: 240px; }
.ring {
  --p: 0; width: 64px; height: 64px; border-radius: 50%; flex-shrink: 0;
  display: grid; place-items: center; font-weight: 700; font-variant-numeric: tabular-nums;
  background: radial-gradient(closest-side, var(--card) 76%, transparent 78% 100%), conic-gradient(var(--good) calc(var(--p) * 100%), var(--valve) 0);
}
.steps { list-style: none; padding: 0; margin: 8px 0 6px; display: grid; gap: 8px; }
.step { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 12px; }
.step.done { background: var(--good-soft); border-color: transparent; }
.step-icon { width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; background: var(--valve); font-size: 17px; flex-shrink: 0; }
.step.done .step-icon { background: var(--good); color: #fff; font-weight: 700; }
.step-text { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.step-text b { font-size: 15px; }
.step-text span { font-size: 13px; color: var(--muted); }
.step .small-btn.primary { background: var(--brass); border-color: var(--brass); color: #1f1d1a; font-weight: 600; }
.week { display: flex; justify-content: space-between; gap: 8px; height: 130px; margin: 10px 0 4px; }
.week .day { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 3px; font-size: 12px; color: var(--muted); }
.bar-v { flex: 1; width: 100%; max-width: 38px; background: var(--valve); border-radius: 6px; display: flex; align-items: flex-end; overflow: hidden; }
.bar-v span { display: block; width: 100%; background: var(--brass); border-radius: 6px 6px 0 0; min-height: 0; }
.week .day.today .dl { color: var(--ink); font-weight: 700; }
.week .m { font-variant-numeric: tabular-nums; min-height: 15px; }
.stats { display: grid; gap: 12px; }
.stat { display: grid; grid-template-columns: 1fr auto; gap: 2px 10px; align-items: center; }
.stat-name { font-size: 14px; }
.stat-val { font-weight: 700; font-variant-numeric: tabular-nums; }
.stat-extra { grid-column: 1 / -1; font-size: 12px; color: var(--muted); }
.bar-h { grid-column: 1 / -1; height: 8px; background: var(--valve); border-radius: 4px; overflow: hidden; }
.bar-h span { display: block; height: 100%; background: var(--good); border-radius: 4px; }
.bar-h.big { height: 18px; border-radius: 9px; margin: 10px 0 2px; }
.bar-h.big span { border-radius: 9px; transition: width .1s linear; }

/* Pieces: scrolling view — the music slides past a fixed gold play line */
.score-box.scroll { position: relative; overflow: hidden; height: 180px; max-height: none; padding: 0; background: var(--card); }
.score-box.scroll .score-track { position: absolute; left: 0; top: 15px; will-change: transform; }
.score-box.scroll .score-line { height: 150px; width: auto !important; margin: 0; }
.score-box.scroll .playhead { display: none; }
.play-line {
  position: absolute; left: 30%; top: 10px; bottom: 10px; width: 3px; margin-left: -1.5px; border-radius: 2px;
  background: var(--brass); box-shadow: 0 0 10px var(--brass), 0 0 2px var(--brass); pointer-events: none;
}
.score-box.scroll::before, .score-box.scroll::after {
  content: ''; position: absolute; top: 0; bottom: 0; width: 40px; z-index: 1; pointer-events: none;
}
.score-box.scroll::before { left: 0; background: linear-gradient(90deg, var(--card), transparent); }
.score-box.scroll::after { right: 0; background: linear-gradient(-90deg, var(--card), transparent); }
.hud { position: absolute; right: 12px; top: 8px; font-size: 13px; color: var(--muted); font-variant-numeric: tabular-nums; z-index: 2; }
.hud b { color: var(--ink); }
svg .playhead { fill: var(--brass); opacity: .9; }
svg .annot { fill: var(--muted); font-weight: 700; font-family: ui-monospace, Consolas, monospace; }
svg .annot.miss { fill: var(--bad); }
svg .sc-ev.current .head { filter: drop-shadow(0 0 4px var(--brass)); }
.num-input { width: 100%; padding: 6px 8px; border-radius: 8px; border: 1px solid var(--line); background: var(--bg); color: var(--ink); }

/* Pieces: score */
.score-box {
  max-height: 58vh; overflow: auto; border: 1px solid var(--line); border-radius: 10px;
  padding: 6px 2px; margin: 10px 0 4px; background: var(--card);
}
.score-box.small { max-height: 220px; }
.score-box[hidden] { display: none; }
.score-line { display: block; height: auto; margin: 0 auto 4px; }
svg .mhit { fill: transparent; cursor: pointer; }
svg .mhit:hover { fill: var(--brass-soft); fill-opacity: .35; }
svg .mhit.sel { fill: var(--brass-soft); fill-opacity: .55; }
svg .mnum { fill: var(--muted); }
svg .sc-ev .head, svg .sc-ev .dot { fill: var(--ink); }
svg .sc-ev .head.open { fill: var(--card); stroke: var(--ink); stroke-width: 1.5; }
svg .sc-ev .hole { fill: var(--card); }
svg .sc-ev .stem { stroke: var(--ink); stroke-width: 1.3; }
svg .sc-ev .flag { stroke: var(--ink); stroke-width: 2.2; fill: none; stroke-linecap: round; }
svg .sc-ev .acc, svg .sc-ev .rest { fill: var(--ink); }
svg .tie { fill: none; stroke: var(--ink); stroke-width: 1.4; }
svg .tuplet { fill: var(--ink); font-style: italic; font-family: Georgia, serif; }
svg .sc-ev.good .head, svg .sc-ev.good .acc { fill: var(--good); }
svg .sc-ev.good .head.open { fill: var(--good-soft); stroke: var(--good); }
svg .sc-ev.late .head, svg .sc-ev.late .acc { fill: var(--warn); }
svg .sc-ev.late .head.open { fill: var(--mid-soft); stroke: var(--warn); }
svg .sc-ev.miss .head, svg .sc-ev.miss .acc { fill: var(--bad); }
svg .sc-ev.miss .head.open { fill: var(--bad-soft); stroke: var(--bad); }
svg .sc-ev.oor { opacity: .35; }
svg .sc-ev.current .head, svg .sc-ev.current .acc { fill: var(--brass); }
svg .sc-ev.current .head.open { fill: var(--brass-soft); stroke: var(--brass); stroke-width: 2.2; }
svg .sc-ev.current .stem { stroke: var(--brass); }
.controls .grow { flex: 1; min-width: 200px; }
.controls .grow select { width: 100%; }
.btn-row { display: flex; gap: 6px; flex-wrap: wrap; }
.small-btn { border: 1px solid var(--line); background: var(--card); border-radius: 8px; padding: 6px 10px; cursor: pointer; font-size: 14px; }
.small-btn.danger { color: var(--bad); }
.small-btn[hidden], .link-btn[hidden] { display: none; }
.link-btn { border: 0; background: none; color: var(--muted); text-decoration: underline; cursor: pointer; font-size: 13px; padding: 4px; align-self: flex-end; }
.sub.tight { margin: 0 0 6px; }
.hint.tight { margin: 2px 0 0; font-size: 12px; }
.note-box { margin: 4px 0 8px; padding: 8px 12px; border-radius: 8px; background: var(--valve); font-size: 14px; }
.note-box.warn { background: var(--mid-soft); }
.note-box[hidden] { display: none; }

/* Import dialog */
#importDlg { width: min(640px, calc(100vw - 32px)); max-height: calc(100vh - 48px); overflow-y: auto; }
.seg { display: flex; gap: 4px; margin-bottom: 12px; background: var(--valve); padding: 3px; border-radius: 10px; }
.seg button { flex: 1; border: 0; background: transparent; padding: 7px; border-radius: 8px; cursor: pointer; }
.seg button.active { background: var(--card); font-weight: 600; }
.drop {
  display: flex !important; flex-direction: column; align-items: center; gap: 4px; text-align: center;
  border: 2px dashed var(--line); border-radius: 12px; padding: 22px 12px; cursor: pointer; color: var(--ink) !important;
}
.drop.over { border-color: var(--brass); background: var(--brass-soft); }
.drop input { display: none; }
.drop span { font-size: 13px; color: var(--muted); }
.text-input {
  width: 100%; border: 1px solid var(--line); border-radius: 8px; background: var(--bg); color: var(--ink);
  padding: 8px 10px; margin-bottom: 8px; font: 14px ui-monospace, Consolas, monospace;
}
input.text-input { font-family: inherit; }
.help-box { margin-top: 10px; font-size: 14px; }
.help-box summary { cursor: pointer; color: var(--brass); font-weight: 600; }
.help-box p, .help-box li { color: var(--ink); line-height: 1.5; }
.help-box code { background: var(--valve); padding: 0 4px; border-radius: 4px; font-size: 13px; }
#impFile[hidden], #impAbc[hidden], #impPart[hidden], .pdf-view[hidden] { display: none; }
#importDlg.transcribe { width: min(1180px, calc(100vw - 24px)); }
#importDlg.transcribe .imp-body { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); gap: 16px; align-items: start; }
.pdf-view { max-height: calc(100vh - 220px); overflow: auto; border: 1px solid var(--line); border-radius: 10px; background: #fff; padding: 6px; }
.pdf-view canvas { display: block; width: 100%; height: auto; margin-bottom: 6px; box-shadow: 0 1px 4px rgba(0,0,0,.15); }
@media (max-width: 760px) { #importDlg.transcribe .imp-body { grid-template-columns: 1fr; } .pdf-view { max-height: 45vh; } }
.controls.compact { gap: 8px 12px; margin-bottom: 6px; }
.palette { border: 1px solid var(--line); border-radius: 10px; padding: 8px; margin-bottom: 8px; background: var(--bg); }
.pal-row { display: flex; flex-wrap: wrap; gap: 4px; align-items: center; margin-bottom: 6px; }
.pal-row button {
  min-width: 34px; height: 34px; padding: 0 8px; border-radius: 8px; border: 1px solid var(--line);
  background: var(--card); cursor: pointer; font-size: 18px; line-height: 1;
}
.pal-row.notes button[data-note] { font-weight: 700; font-size: 16px; min-width: 38px; }
.pal-row button:not([data-note]):not([data-dur]):not([data-acc]) { font-size: 13px; }
.pal-row button.on { background: var(--brass); border-color: var(--brass); color: #1f1d1a; }
.pal-gap { width: 10px; }
.pal-oct { font-size: 13px; color: var(--muted); padding: 0 4px; font-variant-numeric: tabular-nums; }
.pal-oct output { font-weight: 700; color: var(--ink); }
.pal-hint { font-size: 12px; color: var(--muted); margin: 2px 0 0; }

/* Instrument switch in the title; slide positions */
.inst-btn {
  font-size: 13px; font-weight: 500; vertical-align: middle; margin-left: 6px;
  border: 1px solid var(--line); background: var(--card); border-radius: 999px; padding: 3px 10px; cursor: pointer;
}
.valves.slide { gap: 8px; flex-wrap: wrap; }
.valves.slide .valve { width: 52px; height: 64px; border-radius: 12px; }
.valves.slide .valve .num { font-size: 20px; }

/* Header: practice streak and mic switch */
.progress { font-size: 13px; color: var(--muted); white-space: nowrap; font-variant-numeric: tabular-nums; }
.progress:empty { display: none; }
.mic-btn {
  border: 1px solid var(--line); background: var(--card); border-radius: 999px; padding: 4px 12px;
  cursor: pointer; font-size: 14px; white-space: nowrap; min-width: 92px; font-variant-numeric: tabular-nums;
}
.mic-btn.on { background: var(--bad-soft); border-color: var(--bad); }
#valvePanel.mic .valves, #valvePanel.mic .hint { display: none; }

/* Tuner */
.tuner { text-align: center; }
.tun-note { font-size: 84px; font-weight: 700; line-height: 1.1; font-family: Georgia, serif; min-height: 92px; }
.tun-note sub { font-size: 36px; }
.tun-note small { font-size: 30px; color: var(--muted); font-weight: 400; }
.tun-cents { font-size: 20px; font-weight: 600; min-height: 30px; color: var(--muted); }
.tun-cents.good { color: var(--good); }
.tun-cents.close { color: var(--warn); }
.tun-cents.off { color: var(--bad); }
.tun-meter { max-width: 460px; margin: 10px auto 6px; transition: opacity .2s; }
.tun-meter.idle { opacity: .35; }
.tun-scale { display: flex; justify-content: space-between; font-size: 11px; color: var(--muted); padding: 0 2px; }
.tun-track { position: relative; height: 34px; border-radius: 10px; background: var(--valve); margin-top: 4px; overflow: hidden; }
.tun-zone { position: absolute; left: 42%; width: 16%; top: 0; bottom: 0; background: var(--good-soft); }
.tun-track::after { content: ''; position: absolute; left: 50%; top: 0; bottom: 0; width: 2px; background: var(--line); }
.tun-needle { position: absolute; left: 50%; top: 3px; bottom: 3px; width: 6px; margin-left: -3px; border-radius: 3px; background: var(--bad); transition: left .08s linear; z-index: 1; }
.tun-needle.good { background: var(--good); }
.tun-needle.close { background: var(--warn); }
.tun-freq { color: var(--muted); font-variant-numeric: tabular-nums; min-height: 24px; }
.tun-fing { font-size: 18px; font-weight: 600; min-height: 30px; margin-bottom: 10px; }

/* Toast */
.toast {
  position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 10;
  max-width: min(520px, calc(100vw - 32px)); padding: 10px 16px; border-radius: 12px;
  background: var(--ink); color: var(--bg); font-size: 14px; box-shadow: 0 6px 24px rgba(0,0,0,.25);
}
.toast[hidden] { display: none; }
/* "New version ready": at the top, so it never covers a toast */
.toast.update-bar {
  top: calc(12px + env(safe-area-inset-top)); bottom: auto; left: 16px; right: 16px; transform: none; width: fit-content; max-width: 520px; margin: 0 auto;
  z-index: 60; display: flex; align-items: center; gap: 10px; padding: 8px 8px 8px 16px;
}
.toast.update-bar[hidden] { display: none; }
.update-bar .pill { height: 32px; }
.update-later { border: 0; background: transparent; color: inherit; cursor: pointer; padding: 4px 8px; border-radius: 8px; opacity: .7; }
.update-later:hover { opacity: 1; }

/* Help */
#help { width: min(560px, calc(100vw - 32px)); max-height: calc(100vh - 48px); overflow-y: auto; }
#help h3 { margin: 16px 0 6px; font-size: 15px; color: var(--ink); }
#help p, #help li { font-size: 14px; color: var(--ink); margin: 4px 0; }
#help ul { padding-left: 18px; margin: 0; }
.dialog-actions.end { justify-content: flex-end; }

.credit { text-align: center; color: var(--muted); font-size: 12px; margin: 0; }
.credit a { color: inherit; }

dialog {
  border: 1px solid var(--line); border-radius: 14px; background: var(--card); color: var(--ink);
  width: min(440px, calc(100vw - 32px)); padding: 20px;
}
dialog::backdrop { background: rgba(0,0,0,.4); }
dialog h2 { margin: 0 0 12px; font-size: 18px; }
dialog label { display: flex; flex-direction: column; gap: 4px; margin-bottom: 12px; font-size: 14px; color: var(--muted); }
dialog label.check { flex-direction: row; align-items: center; gap: 8px; color: var(--ink); }
dialog select { padding: 6px 8px; border-radius: 8px; border: 1px solid var(--line); background: var(--bg); }
dialog .row { display: flex; gap: 12px; }
dialog .row label { flex: 1; }
.backup-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin: 4px 0 10px; font-size: 13px; color: var(--muted); }
.backup-row span { flex: 1; min-width: 160px; }
.dialog-actions { display: flex; justify-content: space-between; margin-top: 8px; }

@media (max-width: 620px) {
  .top { flex-wrap: wrap; gap: 6px 8px; padding: 12px 16px; }
  .top h1 { font-size: 18px; margin-right: auto; }
  .tabs { order: 3; flex-basis: 100%; overflow-x: auto; scrollbar-width: none; }
  .tab { padding: 6px 9px; flex-shrink: 0; }
  .progress { margin-left: 0; }
  .mic-btn { min-width: 0; padding: 4px 10px; }
}
@media (max-width: 440px) {
  .progress { display: none; }
  .top { gap: 6px; }
  .top h1 { font-size: 16px !important; }
  .inst-btn { font-size: 12px; padding: 2px 8px; margin-left: 4px; }
  .icon-btn { padding: 2px 4px; }
  #helpBtn { width: 26px; }
  .mic-btn { padding: 3px 8px; font-size: 13px; }
}
@media (max-width: 520px) {
  .valve { width: 60px; height: 60px; }
  .valves { gap: 10px; }
  .valve.fourth { margin-left: 8px; }
  .scorebar { gap: 20px; }
}

/* =====================================================================
   Design refresh: deeper colours, sidebar layout, brass valve pistons
   ===================================================================== */
:root { --side: #efe9df; --radius: 16px; }
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #141518; --card: #1d1f24; --side: #18191d; --line: #2c2f36;
    --ink: #eceef2; --muted: #9aa0aa; --brass: #f4b81d; --brass-soft: #3a3014;
    --valve: #262931; --valve-down: #f4b81d; --mid-soft: #3d3418;
  }
}
body { font-size: 15px; }
.card { border-radius: var(--radius); border-color: transparent; box-shadow: 0 1px 0 rgba(255,255,255,.03) inset, 0 6px 24px rgba(0,0,0,.12); }
.card h2 { font-size: 18px; letter-spacing: -.01em; }
button.primary { border-radius: 12px; padding: 9px 20px; box-shadow: 0 3px 0 rgba(0,0,0,.25); }
button.primary:active { transform: translateY(2px); box-shadow: 0 1px 0 rgba(0,0,0,.25); }

/* Logo */
.logo { font-weight: 900; font-size: 22px; letter-spacing: -.02em; color: var(--brass); text-transform: lowercase; }
.logo i { font-style: normal; color: var(--muted); padding: 0 1px; }

/* Tabs with icons */
.tab { display: inline-flex; align-items: center; gap: 7px; }
.ti { width: 19px; height: 19px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex-shrink: 0; }
.tab:not(.active) { color: var(--muted); }
.tab:not(.active):hover { color: var(--ink); background: var(--valve); }
.tab.active { color: var(--ink); }
.tab.active .ti { stroke: var(--brass); }

/* Sidebar on wide screens */
@media (min-width: 900px) {
  body { display: grid; grid-template-columns: 236px minmax(0, 1fr); min-height: 100vh; }
  .top {
    position: sticky; top: 0; height: 100vh; margin: 0; max-width: none; padding: 22px 14px 18px;
    display: grid; grid-template-columns: 1fr auto auto; grid-template-rows: auto 1fr auto auto;
    grid-template-areas: "logo logo logo" "tabs tabs tabs" "prog prog prog" "mic help set";
    gap: 10px 6px; background: var(--side); border-right: 1px solid var(--line); align-items: center;
  }
  .top h1 { grid-area: logo; margin: 0 0 12px !important; display: flex; flex-direction: column; align-items: flex-start; gap: 10px; }
  .top h1 .inst-btn { margin-left: 0; }
  .top .tabs { grid-area: tabs; align-self: start; flex-direction: column; gap: 3px; overflow: visible; }
  .top .tab { padding: 10px 12px; font-size: 15px; border-radius: 10px; width: 100%; }
  .top .tab.active { background: var(--brass-soft); }
  .top .progress { grid-area: prog; display: block !important; }
  .top .mic-btn { grid-area: mic; justify-self: start; }
  #helpBtn { grid-area: help; }
  #settingsBtn { grid-area: set; }
  main { max-width: 940px; width: 100%; margin: 0 auto; padding: 28px 28px 40px; }
}

/* Valve pistons: finger button, silver stem, brass casing with the key letter */
.valves { gap: 16px; align-items: flex-end; margin: 18px 0 14px; }
.valve:not(.pos) {
  width: 74px; height: 140px; padding: 0; border: 0; background: none; border-radius: 0;
  display: flex; flex-direction: column; align-items: center; justify-content: flex-start;
  transform: none !important; color: inherit; position: relative;
}
.valve:not(.pos).fourth { margin-left: 18px; }
.valve .cap {
  width: 62px; height: 28px; border-radius: 50%; position: relative; z-index: 2; flex-shrink: 0;
  background: radial-gradient(ellipse at 40% 35%, #ffffff 0%, #e4e4e4 45%, #a9a9a9 100%);
  box-shadow: 0 4px 0 #7d7d7d, 0 6px 10px rgba(0,0,0,.35);
  transition: transform .06s;
}
.valve .stem {
  width: 18px; height: 30px; margin-top: -6px; flex-shrink: 0; z-index: 1;
  background: linear-gradient(90deg, #8f8f8f, #e9e9e9 45%, #9a9a9a);
  transition: transform .06s;
}
.valve .casing {
  width: 72px; height: 82px; margin-top: -2px; border-radius: 16px 16px 12px 12px; position: relative;
  display: flex; flex-direction: column; align-items: center; justify-content: flex-end; padding-bottom: 8px;
  background: linear-gradient(90deg, #8a6508 0%, #d9a320 22%, #ffd968 48%, #e2ad2a 70%, #9b720c 100%);
  box-shadow: 0 4px 0 #6b4f06, inset 0 -6px 10px rgba(0,0,0,.18);
}
.valve .casing::before {
  content: ''; position: absolute; top: 8px; width: 44px; height: 16px; border-radius: 50%;
  background: radial-gradient(ellipse, #1d1a12 55%, #4b3b10 100%);
}
.valve .casing b { font-size: 22px; font-weight: 900; color: rgba(70, 48, 0, .55); line-height: 1; }
.valve .casing small { font-size: 11px; color: rgba(70, 48, 0, .6); font-weight: 700; }
.valve.down .cap, .valve.down .stem { transform: translateY(22px); }
.valve.down .cap { box-shadow: 0 2px 0 #7d7d7d, 0 3px 6px rgba(0,0,0,.3); }
.valve.down .casing { filter: brightness(1.12); }
.valve.answer .casing { box-shadow: 0 0 0 4px var(--good), 0 4px 0 #6b4f06; }
.valve:not(.pos):focus-visible { outline: 2px solid var(--brass); outline-offset: 4px; }
@media (max-width: 520px) {
  .valve:not(.pos) { width: 62px; height: 122px; }
  .valve .cap { width: 52px; height: 24px; }
  .valve .casing { width: 60px; height: 70px; }
  .valve .casing::before { width: 36px; }
  .valves { gap: 10px; }
  .valve:not(.pos).fourth { margin-left: 8px; }
}

/* Folded-away options */
.more { margin: 2px 0 6px; }
.more summary { cursor: pointer; color: var(--muted); font-size: 14px; list-style: none; display: inline-flex; align-items: center; gap: 6px; padding: 4px 0; }
.more summary::before { content: '▸'; transition: transform .15s; }
.more[open] summary::before { transform: rotate(90deg); }
.more summary::-webkit-details-marker { display: none; }
.more summary span { color: var(--ink); font-size: 13px; }
.more .controls { margin-top: 6px; }

/* Theme chosen in Settings (overrides the system setting) */
:root[data-theme="light"] {
  color-scheme: light;
  --bg: #f6f3ee; --card: #ffffff; --side: #efe9df; --ink: #1f1d1a; --muted: #6f6a62; --line: #d9d3c9;
  --brass: #b8860b; --brass-soft: #f3e3b5; --good: #2e7d4f; --good-soft: #d6efdf; --bad: #b23a3a; --bad-soft: #f6dada;
  --mid-soft: #f7ebc8; --warn: #b7700c; --valve: #e9e4da; --valve-down: #b8860b;
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #141518; --card: #1d1f24; --side: #18191d; --ink: #eceef2; --muted: #9aa0aa; --line: #2c2f36;
  --brass: #f4b81d; --brass-soft: #3a3014; --good: #6fcf97; --good-soft: #1f3a2a; --bad: #ef7d7d; --bad-soft: #4a2323;
  --mid-soft: #3d3418; --warn: #f0a94a; --valve: #262931; --valve-down: #f4b81d;
}

/* Key rebinding */
.keybinds { display: flex; gap: 6px; flex-wrap: wrap; }
.keybind { border: 1px solid var(--line); background: var(--bg); color: var(--ink); border-radius: 8px; padding: 5px 9px; cursor: pointer; font: 13px ui-monospace, Consolas, monospace; }
.keybind.waiting { border-color: var(--brass); color: var(--brass); }

/* Memorize: notes are hidden until they've been played */
.score-box.memorize svg .sc-ev:not(.good):not(.late):not(.miss) { opacity: .04; }

/* =====================================================================
   Stage layout: calm, focused practice screens
   toolbar of pills → the staff → one status line → the pistons
   ===================================================================== */
.stage { gap: 10px; align-content: start; }
.staff-scroll { scrollbar-width: thin; scrollbar-color: var(--line) transparent; }
.staff-scroll::-webkit-scrollbar { height: 6px; }
.staff-scroll::-webkit-scrollbar-thumb { background: var(--line); border-radius: 3px; }
.chip.empty { display: none; }
.toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.tb-spacer { flex: 1; }
.tb-group { display: inline-flex; gap: 8px; flex-wrap: wrap; }
.tb-group[hidden] { display: none; }
.pill {
  display: inline-flex; align-items: center; gap: 6px; height: 36px; padding: 0 4px 0 12px;
  border-radius: 999px; background: var(--card); border: 1px solid var(--line);
  font-size: 12.5px; color: var(--muted); white-space: nowrap; margin: 0 !important;
}
.pill > span:first-child { flex-shrink: 0; }
.pill select {
  appearance: none; -webkit-appearance: none; border: 0; color: var(--ink); font-weight: 600; font-size: 14px;
  height: 34px; padding: 0 26px 0 2px; cursor: pointer; max-width: 240px; border-radius: 999px;
  background: transparent url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M1 1l4 4 4-4' fill='none' stroke='%239aa0aa' stroke-width='1.6'/%3E%3C/svg%3E") no-repeat right 10px center;
}
.pill select:focus-visible { outline: 2px solid var(--brass); outline-offset: 2px; }
.pill.grow { flex: 1; min-width: 220px; }
.pill.grow select { flex: 1; max-width: none; }
button.pill, summary.pill { padding: 0 14px; cursor: pointer; color: var(--ink); font-weight: 600; font-size: 13.5px; }
.pill.ghost { background: transparent; }
.pill.ghost:hover, details.pop[open] > summary.pill { background: var(--valve); }
.pill kbd { margin-left: 2px; }
.stepper { padding: 0 4px; gap: 2px; }
.stepper button {
  width: 28px; height: 28px; border-radius: 50%; border: 0; background: var(--valve); color: var(--ink);
  cursor: pointer; font-size: 16px; line-height: 1;
}
.stepper button:hover { background: var(--brass-soft); }
.stepper .bpm { min-width: 62px; text-align: center; font-weight: 700; color: var(--ink); font-size: 15px; font-variant-numeric: tabular-nums; }
.stepper .bpm small { font-weight: 500; color: var(--muted); margin-left: 3px; font-size: 11px; }
details.pop { position: relative; }
details.pop > summary { list-style: none; }
details.pop > summary::-webkit-details-marker { display: none; }
details.pop > summary::after { content: '▾'; margin-left: 4px; color: var(--muted); font-size: 11px; }
.pop-body {
  position: absolute; z-index: 30; top: 42px; left: 0; min-width: 290px; padding: 14px; display: grid; gap: 10px;
  background: var(--card); border: 1px solid var(--line); border-radius: 14px; box-shadow: 0 14px 44px rgba(0,0,0,.35);
}
.pop-body .check { font-size: 14px; }
.pop-row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.chips { display: inline-flex; gap: 6px; flex-wrap: wrap; }
.chip { font-size: 12px; color: var(--muted); padding: 5px 10px; border-radius: 999px; background: var(--card); border: 1px solid var(--line); }
.chip b { color: var(--ink); font-size: 13px; margin-right: 2px; font-variant-numeric: tabular-nums; }
.meta { font-size: 12.5px; color: var(--muted); }
.piece-note { font-size: 13.5px; color: var(--muted); margin: 0 2px; }
.stage-main {
  display: flex; flex-direction: column; align-items: center; padding: 18px 12px 4px;
  background: var(--card); border-radius: var(--radius);
}
.stage-main #fStaff { width: 100%; max-width: 440px; }
.stage-main.wide { padding: 14px 10px 8px; }
.stage-main .staff-scroll { width: 100%; margin: 0; box-sizing: border-box; }
#panel-rhythm .stage-main { padding: 30px 16px 22px; }
.stage .feedback, .stage .status { text-align: center; min-height: 26px; font-size: 15px; margin: 2px 0; }
.stage .feedback.count { font-size: 28px; font-weight: 800; line-height: 1.2; }
.stage .hint { font-size: 12.5px; margin: 0; opacity: .75; }
.stage .hint.best { opacity: 1; }
.stage .hint:empty { display: none; }
#valveHint { display: none; }
.stage .valves { margin: 6px 0 10px; }
.stage .note-name { min-height: 26px; font-size: 18px; }
.stage .score-box { margin: 0; border: 0; }
.stage .tap-pad { margin: 2px auto 10px; }
details.fold { padding: 14px 18px; }
details.fold > summary { cursor: pointer; list-style: none; display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
details.fold > summary::-webkit-details-marker { display: none; }
details.fold > summary::before { content: '▸'; color: var(--muted); transition: transform .15s; }
details.fold[open] > summary::before { transform: rotate(90deg); }
details.fold > summary h2 { margin: 0; font-size: 15px; }
details.fold > summary .sub { margin: 0; }
details.fold[open] > summary { margin-bottom: 12px; }
.slider-row { display: flex; align-items: center; gap: 10px; font-size: 13px; color: var(--muted); }
.slider-row input { flex: 1; accent-color: var(--brass); }
.toolbar .beat-dots { margin: 0 4px; gap: 7px; }
.toolbar .beat-dots .dot { width: 12px; height: 12px; }
main { gap: 12px; }
@media (max-width: 620px) {
  .pill { height: 34px; }
  .pill select { max-width: 160px; font-size: 13px; }
  .chips { width: 100%; justify-content: center; }
  .tb-spacer { display: none; }
  .pop-body { min-width: 250px; }
}

/* Today: week + progress side by side when there's room */
.today-row { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }
.today-row .card { margin: 0; }
.today-row h2 { font-size: 15px; }
.week { height: 96px; }
button.pill.primary { color: #1f1d1a; border-color: var(--brass); }
.today-row .toolbar { margin: 10px 0 12px; }
.today-row .feedback { min-height: 24px; margin: 8px 0 0; }

/* Phones and narrow windows: one slim header row, tabs as a bottom bar */
@media (max-width: 899px) {
  .top {
    position: sticky; top: 0; z-index: 35; flex-wrap: nowrap; gap: 4px; max-width: none;
    padding: 10px 12px; background: var(--bg); border-bottom: 1px solid var(--line);
  }
  .top h1 { display: flex; align-items: center; gap: 8px; min-width: 0; }
  .top .logo { font-size: 19px; }
  .top .tabs {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 40; order: 0; flex-basis: auto;
    display: grid; grid-template-columns: repeat(7, 1fr); gap: 0; overflow: visible;
    padding: 4px 4px calc(4px + env(safe-area-inset-bottom)); background: var(--side); border-top: 1px solid var(--line);
  }
  .top .tab { flex-direction: column; gap: 2px; padding: 6px 0; font-size: 10.5px; border-radius: 10px; min-width: 0; }
  .top .tab span { max-width: 100%; overflow: hidden; text-overflow: ellipsis; }
  .top .tab.active { background: transparent; color: var(--brass); }
  .progress { display: none !important; }
  main { padding-top: 14px; padding-bottom: 88px; }
}
@media (max-width: 480px) {
  .top .tab .ti { width: 21px; height: 21px; }
  .mic-btn { font-size: 13px; padding: 4px 9px; }
}
@media (max-width: 899px) { .toast { bottom: calc(80px + env(safe-area-inset-bottom)); z-index: 45; } }

.pop-body { max-width: calc(100vw - 32px); }

/* Scrolling score: the opening clef/key/time pinned at the left once the start has scrolled off */
.clef-pin {
  position: absolute; left: 0; top: 15px; overflow: hidden; z-index: 2; pointer-events: none;
  background: var(--card); opacity: 0; transition: opacity .2s;
  box-shadow: 12px 0 14px -4px var(--card);
}
.clef-pin.on { opacity: 1; }
.clef-pin svg { display: block; height: 150px; max-width: none; }
.spot-btn { height: 30px; margin: 6px 0 0 6px !important; vertical-align: middle; border-color: var(--brass); color: var(--brass); }
.spot-btn:hover { background: var(--brass-soft); }
@media (max-width: 620px) {
  .score-box.scroll { height: 136px; }
  .score-box.scroll .score-line, .clef-pin svg { height: 110px; }
  .clef-pin, .score-box.scroll .score-track { top: 12px; }
}

/* First-visit welcome */
.welcome { max-width: 460px; }
.wc-logo { font-size: 30px; margin: 4px 0 2px; }
.wc-steps { list-style: none; counter-reset: wc; padding: 0; margin: 18px 0 20px; display: grid; gap: 16px; }
.wc-steps li { counter-increment: wc; display: grid; gap: 8px; padding-left: 38px; position: relative; }
.wc-steps li::before {
  content: counter(wc); position: absolute; left: 0; top: -2px; width: 26px; height: 26px; border-radius: 50%;
  display: grid; place-items: center; background: var(--brass-soft); color: var(--brass); font-weight: 800; font-size: 13px;
}
.wc-steps .pill { width: 100%; box-sizing: border-box; }
.wc-keys { display: flex; gap: 6px; }
.wc-keys kbd { font-size: 16px; font-weight: 700; padding: 6px 12px; color: var(--ink); border-radius: 8px; }
.welcome label.pill { flex-direction: row; align-items: center; display: flex; margin: 0; }
.welcome .pill select { flex: 1; max-width: none; padding-top: 0; padding-bottom: 0; border: 0; background-color: transparent; }

/* Pistons: the stem runs down into the hole in the top of the casing */
.valve .casing { z-index: 0; margin-top: -18px; }
.valve .stem {
  position: relative; z-index: 1; height: 46px; transform-origin: 50% 100%;
  border-radius: 0 0 9px 9px / 0 0 4px 4px;
  background:
    linear-gradient(180deg, transparent 70%, rgba(20,16,8,.75) 100%),
    linear-gradient(90deg, #8f8f8f, #e9e9e9 45%, #9a9a9a);
}
.valve.down .stem { transform: scaleY(.522); }
@media (max-width: 520px) {
  .valve .casing { margin-top: -18px; }
}

/* Tuning report after a mic run */
svg .annot.sharp { fill: var(--warn); }
svg .annot.flat { fill: #6fa8ef; }
.tune-report { text-align: center; font-size: 13.5px; color: var(--muted); margin: -4px 0 4px; line-height: 1.7; }
.tune-report b { color: var(--ink); }
.tune-report .sharp b { color: var(--warn); }
.tune-report .flat b { color: #6fa8ef; }
.replay-btn { height: 30px; margin: 6px 0 0 6px !important; vertical-align: middle; }

/* Settings: grouped sections, calibration */
.set-h { font-size: 11.5px; text-transform: uppercase; letter-spacing: .08em; color: var(--brass); margin: 18px 0 8px; padding-top: 12px; border-top: 1px solid var(--line); }
#settings h2 + .set-h { border-top: 0; padding-top: 0; margin-top: 6px; }
.cal-row { display: flex; gap: 6px; align-items: center; }
.cal-row .num-input { flex: 1; min-width: 0; }
.cal-box { background: var(--valve); border-radius: 12px; padding: 10px 14px; margin: 4px 0 10px; text-align: center; font-size: 14px; }
.cal-box p { margin: 0 0 6px; }
.cal-box .beat-dots { margin: 6px 0 2px; gap: 10px; }
.cal-box .dot { width: 14px; height: 14px; }
.beat-dots .dot.ghost { border-style: dashed; opacity: .7; }
.lt-graph, .tg-graph { display: block; width: 100%; height: auto; margin: 10px 0 2px; background: var(--valve); border-radius: 10px; }
.lt-graph .loud { fill: none; stroke: var(--good); stroke-width: 2; }
.lt-graph .target { fill: none; stroke: var(--ink); stroke-width: 1; stroke-dasharray: 4 3; opacity: .55; }
.lt-graph .pitch { fill: none; stroke: var(--brass); stroke-width: 1.2; }
.lt-graph .mid, .tg-graph .mid { stroke: var(--line); stroke-width: 1; }
.lt-key { font-size: 12px; color: var(--muted); }
.lt-key i { display: inline-block; width: 14px; height: 0; border-top: 2px solid; vertical-align: middle; margin: 0 4px 0 10px; }
.lt-key i:first-child { margin-left: 0; }
.lt-key .k-loud { border-color: var(--good); }
.lt-key .k-target { border-top: 1px dashed var(--ink); }
.lt-key .k-pitch { border-color: var(--brass); }
.tg-graph .beat { stroke: var(--ink); stroke-width: 1.2; opacity: .5; }
.tg-graph .sub { stroke: var(--muted); stroke-width: 1; opacity: .5; }
.tg-graph .hit { fill: var(--good); }
.tg-graph .hit.close { fill: var(--warn); }
.tg-graph .hit.off { fill: var(--bad); }
.tg-graph .missed { fill: none; stroke: var(--bad); stroke-width: 1.2; }
.br-stage { display: grid; place-items: center; height: 170px; position: relative; }
.br-circle { width: 150px; height: 150px; border-radius: 50%; background: var(--good-soft); border: 3px solid var(--good); transform: scale(.35); transition: transform 1s linear; }
.br-text { position: absolute; inset: 0; display: grid; place-content: center; text-align: center; pointer-events: none; }
.br-text b { font-size: 17px; }
.br-text span { font-size: 12px; color: var(--muted); }
.bz-graph .target { fill: none; stroke: var(--ink); stroke-width: 2; stroke-dasharray: 5 4; opacity: .6; }
.bz-graph .pt { fill: var(--good); }
.bz-graph .pt.close { fill: var(--warn); }
.bz-graph .pt.off { fill: var(--bad); }
.bz-graph .axis { font-size: 8px; fill: var(--muted); }
.rg-target { display: flex; align-items: baseline; gap: 12px; justify-content: center; margin: 8px 0 2px; }
.rg-target b { font-size: 34px; font-family: Georgia, serif; }
.rg-target span { color: var(--muted); font-size: 15px; }
svg .ptrace { fill: none; stroke: var(--good); stroke-width: 1.8; stroke-linejoin: round; opacity: .9; }
svg .ptrace.close { stroke: var(--warn); }
svg .ptrace.off { stroke: var(--bad); }
svg .annot.tip { fill: var(--brass); font-weight: 600; }
svg .annot.hint { fill: var(--muted); }
svg .dyn { fill: var(--ink); font: italic 700 15px Georgia, serif; }
.dyn-report i { font-family: Georgia, serif; font-weight: 700; }
.coach { color: var(--brass); }
svg .state-mark { fill: var(--bad); font-weight: 700; }
svg .sc-ev.late .state-mark, svg .note.fixed .state-mark { fill: var(--warn); }
.piece-note.mine { border-left: 3px solid var(--brass); padding-left: 10px; white-space: pre-wrap; }
.takes { margin-top: 10px; }
.take-row { display: flex; align-items: center; gap: 8px; font-size: 13px; padding: 3px 0; }
.take-row span { flex: 1; }
.take-play { min-width: 34px; justify-content: center; }
#pcJournal .pop-body { width: min(360px, 86vw); }
#pcJournalText, #tdJournal { width: 100%; resize: vertical; font: inherit; }
.journal-prev { margin-top: 6px; white-space: pre-wrap; }
.journal-prev::before { content: 'Last time · '; font-weight: 600; }
.echo-box { min-height: 120px; display: grid; align-items: center; }
.echo-hidden { display: flex; gap: 18px; justify-content: center; }
.echo-hidden span { width: 44px; height: 56px; border-radius: 10px; background: var(--valve); display: grid; place-items: center; font: 700 26px Georgia, serif; color: var(--muted); }
.mic-meter-row { display: flex; align-items: center; gap: 10px; margin: 8px 0 2px; }
.mic-meter { position: relative; flex: 1; height: 10px; border-radius: 5px; background: var(--valve); overflow: hidden; }
.mic-meter span { position: absolute; left: 0; top: 0; bottom: 0; width: 0; background: var(--good); transition: width 60ms linear; }
.mic-meter span.quiet { background: var(--muted); }
.mic-meter i { position: absolute; top: 0; bottom: 0; width: 2px; background: var(--ink); opacity: .6; }

/* Answer-with toggle: Keys | Mic */
.input-seg { display: inline-flex; padding: 3px; gap: 2px; border-radius: 999px; background: var(--card); border: 1px solid var(--line); }
.input-seg button {
  border: 0; background: transparent; color: var(--muted); border-radius: 999px; padding: 4px 10px;
  font-size: 13px; cursor: pointer; white-space: nowrap; font-variant-numeric: tabular-nums;
}
.input-seg button:hover { color: var(--ink); }
.input-seg button.on { background: var(--brass-soft); color: var(--ink); font-weight: 600; }
.input-seg #micBtn.on { background: var(--bad-soft); }
#micBtn #micLive { display: inline-block; min-width: 34px; text-align: left; }
@media (min-width: 900px) { .top .input-seg { grid-area: mic; justify-self: start; } }
@media (max-width: 480px) { .input-seg button { padding: 4px 7px; font-size: 12px; } #micBtn #micLive { min-width: 0; } }

/* Library browser */
.lib-dlg { width: min(760px, calc(100vw - 24px)); max-width: none; }
.lib-head { display: flex; align-items: center; gap: 12px; }
.lib-head h2 { margin: 0; }
.lib-head input {
  flex: 1; min-width: 0; height: 36px; padding: 0 14px; border-radius: 999px; border: 1px solid var(--line);
  background: var(--bg); color: var(--ink);
}
.lib-chips { display: flex; gap: 6px; flex-wrap: wrap; margin: 12px 0 6px; }
.lib-chip { border: 1px solid var(--line); background: transparent; color: var(--muted); border-radius: 999px; padding: 5px 12px; font-size: 13px; cursor: pointer; }
.lib-chip.on { background: var(--brass-soft); border-color: transparent; color: var(--ink); font-weight: 600; }
.lib-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 8px; max-height: min(60vh, 520px); overflow-y: auto; padding: 2px; }
.lib-cat { grid-column: 1 / -1; font-size: 11.5px; text-transform: uppercase; letter-spacing: .08em; color: var(--brass); margin: 10px 0 0; }
.lib-card {
  display: flex; flex-direction: column; align-items: flex-start; gap: 2px; text-align: left; cursor: pointer;
  padding: 10px 12px; border-radius: 12px; border: 1px solid var(--line); background: var(--bg); color: var(--ink);
}
.lib-card:hover { border-color: var(--brass); }
.lib-card.current { border-color: var(--brass); background: var(--brass-soft); }
.lib-title { font-weight: 600; font-size: 14px; line-height: 1.3; }
.lib-sub { font-size: 12px; color: var(--muted); min-height: 16px; }
.lib-foot { display: flex; justify-content: space-between; width: 100%; margin-top: 6px; font-size: 12px; color: var(--muted); }
.lib-level { color: var(--brass); letter-spacing: 1px; font-size: 10px; }
.lib-level i { font-style: normal; color: var(--line); }
.lib-best b { color: var(--brass); font-weight: 400; }
@media (max-width: 480px) {
  .input-seg .seg-label, #micBtn:not(.on) #micLive { display: none; }
  .top .logo { font-size: 17px; }
}
/* Touchscreens have no keyboard: hide the shortcut hints */
@media (hover: none) and (pointer: coarse) {
  .pill kbd, .actions kbd, .tap-pad kbd, .replay-btn kbd, #pcBrowse kbd { display: none; }
}
@media (max-width: 480px) { .lib-list { grid-template-columns: 1fr 1fr; gap: 6px; } .lib-card { padding: 8px 10px; } .lib-title { font-size: 13px; } }
.pop-body .sub-check { margin-left: 22px; font-size: 13px; color: var(--muted); }

/* Piece history */
.spark { width: 40px; height: 14px; }
.spark-line { fill: none; stroke: var(--brass); stroke-width: 1.6; stroke-linejoin: round; stroke-linecap: round; }
.hist-pop .pop-body { min-width: 320px; }
.hist-chart + .hist-chart { margin-top: 4px; }
.hist-title { font-size: 12px; color: var(--muted); font-weight: 600; }
.hist-svg { width: 100%; height: auto; display: block; overflow: visible; }
.hist-grid { stroke: var(--line); stroke-width: 1; }
.hist-axis { fill: var(--muted); font-size: 10px; font-variant-numeric: tabular-nums; }
.hist-line { fill: none; stroke: var(--brass); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.hist-dot { fill: var(--brass); stroke: var(--card); stroke-width: 2; }
.hist-dot.part { fill: var(--card); stroke: var(--brass); stroke-width: 1.6; }
.hist-hit { fill: transparent; cursor: default; }
.hist-pt:hover .hist-dot { r: 5; }
.hist-sum { margin-top: 6px; font-size: 12px; }

/* Intonation map */
.inton-head { display: flex; align-items: flex-start; gap: 12px; flex-wrap: wrap; }
.inton-head h2 { margin: 0 0 2px; }
.inton-live { text-align: center; background: var(--valve); border-radius: 14px; padding: 14px; margin: 12px 0 8px; }
.inton-target { display: flex; justify-content: center; align-items: baseline; gap: 12px; }
.inton-target b { font-size: 34px; }
.inton-target span { font: 600 18px ui-monospace, Consolas, monospace; color: var(--brass); }
.inton-meter { position: relative; height: 14px; max-width: 360px; margin: 10px auto 8px; border-radius: 7px; background: var(--card); }
.inton-zone { position: absolute; left: 45%; width: 10%; top: 0; bottom: 0; background: var(--good-soft); border-radius: 4px; }
.inton-needle { position: absolute; top: -4px; bottom: -4px; width: 4px; margin-left: -2px; border-radius: 2px; background: var(--muted); opacity: .4; transition: left .08s; }
.inton-needle.on { background: var(--brass); opacity: 1; }
.pop-row.center { justify-content: center; margin-top: 8px; }
.inton-chart { margin-top: 10px; }
.inton-svg { display: block; height: 150px; }
.inton-band { fill: var(--good-soft); }
.inton-grid { stroke: var(--line); stroke-width: 1; }
.inton-zero { stroke: var(--muted); stroke-width: 1; opacity: .6; }
.inton-axis { fill: var(--muted); font-size: 9.5px; font-variant-numeric: tabular-nums; }
.inton-bar.sharp { fill: var(--warn); }
.inton-bar.flat { fill: #6fa8ef; }
.inton-bar.ok { fill: var(--good); }
.inton-none { fill: var(--line); }
.inton-hit { fill: transparent; cursor: pointer; }
.inton-col:hover .inton-hit, .inton-col.now .inton-hit { fill: var(--brass-soft); fill-opacity: .5; }
.inton-key { display: flex; gap: 6px 14px; align-items: center; font-size: 12px; color: var(--muted); margin-top: 4px; flex-wrap: wrap; }
.inton-key .sw { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: -8px; }
.inton-key .sw.sharp { background: var(--warn); } .inton-key .sw.flat { background: #6fa8ef; } .inton-key .sw.ok { background: var(--good); }
.inton-advice h3 { font-size: 14px; margin: 14px 0 6px; }
.inton-row { display: grid; grid-template-columns: 48px 56px 52px 1fr; gap: 8px; align-items: baseline; font-size: 13.5px; padding: 5px 0; border-top: 1px solid var(--line); }
.inton-row .fing { font-family: ui-monospace, Consolas, monospace; color: var(--muted); }
.inton-row .cents { font-weight: 700; font-variant-numeric: tabular-nums; }
.inton-row.sharp .cents { color: var(--warn); } .inton-row.flat .cents { color: #6fa8ef; }
/* Long piece titles: truncate instead of running into the next button */
.pill.grow { min-width: 200px; flex-basis: 220px; overflow: hidden; }
.pill.grow select { min-width: 0; width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Dropdown lists: the select itself is see-through, so give the open list real colours
   (otherwise Windows draws it white while the text stays light). */
select { background-color: var(--card); color: var(--ink); }
.pill select { background-color: transparent; }
select option, select optgroup { background-color: var(--card); color: var(--ink); }
select optgroup { color: var(--muted); font-style: normal; font-weight: 600; }
select option:disabled { color: var(--muted); }
/* Page view: reserve the vertical scrollbar's room so the music never needs sideways scrolling */
.score-box:not(.scroll) { scrollbar-gutter: stable; overflow-x: hidden; }
.inton-head { flex-wrap: nowrap; }
.inton-head > div { flex: 1; min-width: 0; }
.inton-head .tb-spacer { display: none; }
/* hidden always wins over a component's display */
[hidden] { display: none !important; }
svg .breath { fill: var(--ink); font-family: Georgia, serif; font-weight: 700; }

/* Metronome (header / sidebar) */
.metro-btn { display: inline-flex; align-items: center; gap: 3px; list-style: none; color: var(--muted); }
.metro-btn .ti { width: 20px; height: 20px; }
#metroMini { font-size: 12px; font-weight: 700; color: var(--brass); font-variant-numeric: tabular-nums; }
.metro-pop.running .metro-btn .ti { stroke: var(--brass); }
.metro-pop.pulse .metro-btn .ti { transform: scale(1.12); }
.metro-pop > summary::after { content: none; }
.metro-body { min-width: 270px; color: var(--ink); }
.metro-head { display: flex; justify-content: space-between; align-items: center; }
.metro-head .beat-dots { margin: 0; gap: 6px; }
.metro-head .dot { width: 10px; height: 10px; }
.metro-bpm { display: flex; align-items: center; justify-content: center; gap: 14px; }
.metro-bpm output { font-size: 34px; font-weight: 800; font-variant-numeric: tabular-nums; }
.metro-bpm small { color: var(--muted); margin-left: 4px; }
.metro-bpm button { width: 34px; height: 34px; border-radius: 50%; border: 0; background: var(--valve); color: var(--ink); font-size: 18px; cursor: pointer; }
#metroRange { width: 100%; accent-color: var(--brass); }
.metro-body .pop-row { justify-content: space-between; }
.metro-body .pop-row .pill { flex: 1; justify-content: center; }
@media (min-width: 900px) {
  .top { grid-template-areas: "logo logo logo" "tabs tabs tabs" "prog prog metro" "mic help set"; }
  .top .metro-pop { grid-area: metro; }
  .metro-pop .pop-body { top: auto; bottom: 44px; left: auto; right: -40px; }
  .top .metro-pop { justify-self: end; }
}
@media (max-width: 899px) {
  .metro-pop .pop-body { right: -70px; left: auto; }
}
@media (min-width: 900px) {
  .top { grid-template-columns: minmax(0, 1fr) auto auto; }
  .input-seg { max-width: 100%; }
}
.metro-btn { padding: 4px 6px; min-width: 0; }
#metroMini:empty { display: none; }
@media (min-width: 900px) {
  .top {
    grid-template-rows: auto 1fr auto auto auto;
    grid-template-areas: "logo logo logo" "tabs tabs tabs" "prog prog prog" "mic mic mic" "metro help set";
  }
  .top .metro-pop { justify-self: start; }
  .top .input-seg { justify-self: stretch; }
  .top .input-seg button { flex: 1; }
  .metro-pop .pop-body { left: 0; right: auto; }
}
details.metro-pop > summary::after { content: none; }
.nav-pair { padding: 0 3px; gap: 2px; }
.nav-pair button { width: 28px; height: 28px; border: 0; border-radius: 50%; background: transparent; color: var(--ink); font-size: 18px; cursor: pointer; line-height: 1; }
.nav-pair button:hover:not(:disabled) { background: var(--valve); }
.nav-pair button:disabled { color: var(--line); cursor: default; }
a.replay-btn { text-decoration: none; color: var(--ink); font-weight: 600; font-size: 13.5px; padding: 0 12px; }

/* Colour-blind friendly grading (Settings): blue for right, orange for late, vermilion
   for wrong — the Okabe–Ito colours, which stay apart for every common colour blindness.
   Grading also shows marks (× wrong, › late), so it never rests on colour alone. */
:root[data-cb], :root[data-cb][data-theme="light"] {
  --good: #0072b2; --good-soft: #d3e6f4; --warn: #b87700; --mid-soft: #f6e6c3; --bad: #d55e00; --bad-soft: #f7dccc;
}
@media (prefers-color-scheme: dark) {
  :root[data-cb]:not([data-theme="light"]) { --good: #56b4e9; --good-soft: #17323f; --warn: #e69f00; --mid-soft: #3d3418; --bad: #ff8c4a; --bad-soft: #45291b; }
}
:root[data-cb][data-theme="dark"] { --good: #56b4e9; --good-soft: #17323f; --warn: #e69f00; --mid-soft: #3d3418; --bad: #ff8c4a; --bad-soft: #45291b; }

/* Keyboard users see where they are. */
button:focus-visible, summary:focus-visible, select:focus-visible, a:focus-visible,
input:focus-visible, textarea:focus-visible, .tab:focus-visible { outline: 2px solid var(--brass); outline-offset: 2px; }

/* ---------- Navigation: grouped sidebar; on phones four tabs and a More menu ---------- */
.nav-h { display: none; }
#tabMore { display: none; }
.more-sheet[hidden] { display: none; }
@media (min-width: 900px) {
  .nav-h { display: block; font-size: 11px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); padding: 10px 12px 2px; }
  .nav-h:first-child { padding-top: 0; }
  .top .tab { padding: 8px 12px; }
}
@media (max-width: 899px) {
  .top .tabs { grid-template-columns: repeat(5, 1fr); }
  .top .tab.tab-more { display: none; }
  #tabMore { display: inline-flex; }
  #tabMore.active { color: var(--brass); }
  .more-sheet {
    position: fixed; left: 8px; right: 8px; bottom: calc(68px + env(safe-area-inset-bottom)); z-index: 41;
    display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; padding: 10px;
    background: var(--card); border: 1px solid var(--line); border-radius: 16px; box-shadow: 0 12px 40px rgba(0, 0, 0, .3);
  }
  .more-item { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 12px 4px; border: 0; border-radius: 12px; background: var(--valve); color: var(--ink); font-size: 13px; cursor: pointer; }
  .more-item.active { background: var(--brass-soft); color: var(--brass); font-weight: 600; }
  .more-item .ti { width: 24px; height: 24px; }
}

/* ---------- Settings in sections ---------- */
.set-seg { display: flex; flex-wrap: wrap; gap: 4px; margin: 4px 0 14px; }
.set-seg button { flex: 1 1 auto; padding: 6px 10px; border-radius: 999px; border: 1px solid var(--line); background: var(--bg); color: var(--ink); cursor: pointer; font-size: 13px; }
.set-seg button.active { background: var(--brass-soft); border-color: var(--brass); font-weight: 600; }
.set-sec { min-height: 220px; }

/* ---------- Pieces on a phone: less chrome, more music ---------- */
@media (max-width: 620px) {
  #panel-pieces .toolbar { gap: 6px; margin-bottom: 6px; }
  #panel-pieces .toolbar .pill > span:first-child { display: none; }
  #panel-pieces #pcMeta { display: none; }
  #panel-pieces .piece-note { font-size: 12.5px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
  #panel-pieces .piece-note:active, #panel-pieces .piece-note:focus { -webkit-line-clamp: unset; }
  #pcImport { font-size: 0; } #pcImport::before { content: '＋'; font-size: 16px; }
  #pcBrowse kbd { display: none; }
  .score-box.scroll { height: 168px; }
  #panel-pieces .valve:not(.pos) { width: 56px; height: 108px; }
  #panel-pieces .valves { margin: 10px 0 8px; }
}

/* ---------- Stand mode: big music, no menus (js/stand.js) ---------- */
.stand-exit {
  position: fixed; top: 10px; right: 10px; z-index: 60; width: 42px; height: 42px; border-radius: 50%;
  border: 1px solid var(--line); background: var(--card); color: var(--ink); font-size: 18px; cursor: pointer;
  box-shadow: 0 4px 14px rgba(0, 0, 0, .2);
}
.stand-exit[hidden] { display: none; }
body.stand { display: block; }
body.stand .top, body.stand .toolbar, body.stand .piece-note, body.stand #pcRangeWarn,
body.stand .hint, body.stand #scBest { display: none !important; }
body.stand main { max-width: none; padding: 14px 20px 20px; }
body.stand .score-box.scroll { height: min(46vh, 360px); }
body.stand .score-box.scroll .score-line { height: min(40vh, 320px); }
body.stand .score-box:not(.scroll) { max-height: 72vh; }
body.stand .status { font-size: 18px; }
body.stand #valvePanel.mic .valves { display: none; }
@media (orientation: landscape) and (max-height: 560px) {
  body.stand .valve:not(.pos) { width: 50px; height: 92px; }
  body.stand .valves { margin: 4px 0; }
  body.stand .score-box.scroll { height: 50vh; }
  body.stand .score-box.scroll .score-line { height: 44vh; }
}

/* ---------- Today: session, setup checklist, goals ---------- */
.td-actions { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-top: 10px; }
.td-actions .hint { margin: 0; flex: 1; min-width: 200px; }
.setup-list { list-style: none; margin: 6px 0 0; padding: 0; display: grid; gap: 6px; }
.setup-list li { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; font-size: 14px; }
.setup-list li.done { color: var(--muted); }
.setup-tick { width: 20px; text-align: center; font-weight: 700; color: var(--brass); }
.setup-list li.done .setup-tick { color: var(--good); }
.setup-text { flex: 1; min-width: 180px; }
.goals { display: grid; gap: 12px; }
.goal-head { display: flex; align-items: baseline; gap: 10px; }
.goal-head b { flex: 1; }
.goal-actions { display: flex; gap: 8px; }
.goal.reached .bar-h span { background: var(--brass); }
.goal-form { display: grid; gap: 8px; width: min(420px, 88vw); }
.small-num { width: 70px; }
.session-bar {
  position: fixed; left: 50%; transform: translateX(-50%); bottom: 16px; z-index: 50;
  display: flex; align-items: center; gap: 10px; max-width: calc(100vw - 24px);
  padding: 8px 10px 8px 16px; border-radius: 999px; background: var(--card); border: 1px solid var(--brass);
  box-shadow: 0 8px 30px rgba(0, 0, 0, .25); font-size: 14px;
}
.session-bar[hidden] { display: none; }
#sbText { flex: 1; min-width: 0; }
@media (max-width: 899px) { .session-bar { bottom: calc(76px + env(safe-area-inset-bottom)); border-radius: 16px; } }
body.in-session main { padding-bottom: 96px; }

/* ---------- Warm-up: play-along routines ---------- */
.wu-routines { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.wu-routine { position: relative; display: grid; gap: 2px; text-align: left; padding: 10px 14px; border-radius: 12px; border: 1px solid var(--line); background: var(--bg); color: var(--ink); cursor: pointer; min-width: 170px; }
.wu-routine span { font-size: 12.5px; color: var(--muted); }
.wu-routine.today { border-color: var(--brass); background: var(--brass-soft); }
.pl-list { display: grid; gap: 6px; margin-top: 8px; }
.pl-row { display: flex; align-items: center; gap: 10px; }
.pl-open { flex: 1; display: grid; gap: 2px; text-align: left; padding: 8px 12px; border-radius: 10px; border: 1px solid var(--line); background: var(--bg); color: var(--ink); cursor: pointer; }
.pl-open span { font-size: 12.5px; color: var(--muted); }
.pl-row.current .pl-open { border-color: var(--brass); background: var(--brass-soft); }
.pl-wave { display: block; width: 100%; height: 90px; border-radius: 10px; background: var(--valve); cursor: crosshair; touch-action: none; }
.file-pill { cursor: pointer; }
.wu-routine i { position: absolute; top: 8px; right: 10px; font-style: normal; font-size: 11px; font-weight: 700; color: var(--brass); }

/* ---------- comparing two takes: A blue, B orange (dashed, so they differ without colour) ---------- */
svg .ptrace.ta { stroke: #3d8bd9; }
svg .ptrace.tb { stroke: var(--warn); stroke-dasharray: 5 3; }
.cmp-a, .cmp-b { display: inline-block; min-width: 18px; border-radius: 4px; color: #fff; font-weight: 700; font-size: 12px; padding: 0 5px; }
.cmp-a { background: #3d8bd9; }
.cmp-b { background: var(--warn); }
.cmp-box .pill { margin-top: 4px; }
.take-cmp { display: inline-flex; align-items: center; gap: 3px; font-size: 12px; color: var(--muted); white-space: nowrap; }

/* ---------- breaths: planned, and taken where you hadn't planned ---------- */
svg .breath.planned { fill: var(--brass); }
svg .breath.unplanned { fill: var(--bad); }
.score-box.breath-edit { cursor: crosshair; outline: 2px dashed var(--brass); outline-offset: 2px; }

/* ---------- sing, buzz, play ---------- */
.sb-steps { display: flex; gap: 8px; flex-wrap: wrap; margin: 10px 0 2px; }
.sb-step { flex: 1; min-width: 80px; display: flex; flex-direction: column; align-items: center; padding: 8px; border-radius: 10px; background: var(--valve); }
.sb-step b { font-size: 15px; }
.sb-step span { font-size: 13px; color: var(--muted); min-height: 1.3em; }
.sb-step.now { outline: 2px solid var(--brass); }
.sb-step.ok { background: var(--good-soft); }
.sb-step.miss { background: var(--bad-soft); }
.sb-log { width: 100%; font-size: 12.5px; color: var(--muted); }

/* ---------- Progress: time playing, inside each week's bar ---------- */
.prog-chart .bar.played { fill: var(--ink); opacity: .3; }

/* ---------- metronome gaps, mock audition, sharing, reminders, recordings ---------- */
.metro-drift { max-width: 280px; margin: 6px 0 0; }
.aud-dlg { max-width: 580px; }
.aud-list { display: flex; flex-direction: column; gap: 2px; max-height: 40vh; overflow: auto; margin: 8px 0; }
.aud-row { display: grid; grid-template-columns: auto 1fr auto; gap: 6px 10px; align-items: center; padding: 8px 0; border-bottom: 1px solid var(--line); }
.aud-row .aud-note { grid-column: 1 / -1; width: 100%; }
.share-dlg { max-width: 540px; }
.share-link { width: 100%; font-size: 12px; word-break: break-all; margin-top: 8px; }
.remind-form { min-width: 250px; }
.rm-days { display: flex; gap: 4px; flex-wrap: wrap; margin: 4px 0 8px; }
.rm-day { display: inline-flex; flex-direction: column; align-items: center; gap: 2px; font-size: 12px; min-width: 32px; }
.pl-music { margin-top: 10px; }
.pl-score { max-height: 280px; overflow: auto; margin-top: 8px; }
