:root {
  color-scheme: dark;
  --ink: #f5f6ef;
  --muted: #9ca59f;
  --panel: #151a18;
  --line: #344038;
  --amber: #ffbf47;
  --green: #69e88a;
  --blue: #7cc8ff;
  --red: #ff756d;
  --bg: #0b0e0d;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
  background: radial-gradient(circle at 78% -10%, rgba(255,191,71,0.12), transparent 28rem), linear-gradient(180deg, #0d100f 0, var(--bg) 45rem);
  color: var(--ink);
}
button, select, input { font: inherit; }
button, select { min-height: 40px; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: 0.42; }

.app-shell { width: min(1500px, 100%); margin: 0 auto; padding: 14px clamp(14px, 2.4vw, 36px) 30px; }
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 12px; }
.brand { display: flex; align-items: center; gap: 10px; }
.brand-mark { display: grid; place-items: center; width: 36px; height: 36px; border-radius: 50%; background: var(--amber); color: #171209; font-weight: 950; letter-spacing: -0.08em; }
.brand h1 { margin: 0; font-size: 1.08rem; letter-spacing: 0.09em; }
.brand p { margin: 1px 0 0; color: var(--muted); font-size: 0.78rem; }
.build-flag { padding: 6px 9px; border: 1px solid #775a27; border-radius: 999px; color: #f8cf7c; font-size: 0.73rem; font-weight: 750; letter-spacing: 0.05em; text-transform: uppercase; }

.workspace { display: grid; grid-template-columns: minmax(250px, 296px) minmax(0, 1fr); gap: 12px; align-items: start; }
.panel { border: 1px solid var(--line); border-radius: 13px; background: color-mix(in srgb, var(--panel) 95%, transparent); box-shadow: 0 12px 32px rgba(0,0,0,0.21); }
.controls { overflow: hidden; }
.control-heading { padding: 16px 18px; border-bottom: 1px solid var(--line); background: linear-gradient(135deg, rgba(255,191,71,0.12), transparent 62%); }
.eyebrow { margin: 0 0 6px; color: var(--amber); font-size: 0.7rem; font-weight: 800; letter-spacing: 0.12em; text-transform: uppercase; }
.control-heading h2 { margin: 0; font-size: 1.55rem; line-height: 1.05; }
.position-summary { display: flex; justify-content: space-between; gap: 10px; margin-top: 12px; color: var(--muted); font-size: 0.76rem; }
.position-summary strong { display: block; color: var(--ink); font-size: 0.9rem; }
.control-body { padding: 14px 18px 16px; }
.field { display: grid; gap: 6px; margin-bottom: 13px; }
.field label, .meter-heading { color: #cdd3cf; font-size: 0.82rem; font-weight: 700; }
.field-note { overflow: hidden; color: var(--muted); font-size: 0.72rem; text-overflow: ellipsis; white-space: nowrap; }
.sound-check-status { white-space: normal; overflow: visible; line-height: 1.4; }
.tuner-guidance { white-space: normal; overflow: visible; text-overflow: clip; }
select { width: 100%; padding: 0 34px 0 11px; border: 1px solid #48544d; border-radius: 9px; background: #0e1210; color: var(--ink); }
.secondary-button { min-height: 34px; border: 1px solid #58645d; border-radius: 8px; background: #111613; color: var(--ink); font-size: 0.8rem; font-weight: 750; }
.meter-heading { display: flex; justify-content: space-between; }
.meter-heading span { color: var(--muted); font-variant-numeric: tabular-nums; font-weight: 500; }
.input-meter { height: 8px; overflow: hidden; border-radius: 99px; background: #080b09; box-shadow: inset 0 0 0 1px #39443d; }
.input-meter span { display: block; width: 0; height: 100%; background: var(--blue); transition: width 50ms linear; }
.input-meter span.above-threshold { background: var(--green); }

.tempo-row { display: grid; grid-template-columns: 40px 1fr 40px; gap: 7px; align-items: center; }
.tempo-row button { border: 1px solid #48544d; border-radius: 9px; background: #111613; color: var(--ink); font-size: 1.1rem; }
.tempo-center { display: grid; gap: 5px; text-align: center; }
output { font-size: 0.86rem; font-variant-numeric: tabular-nums; font-weight: 800; }
input[type="range"] { width: 100%; accent-color: var(--amber); }
.take-status { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 14px 0; padding: 10px; border: 1px solid #3a493f; border-radius: 9px; background: #101512; }
.take-status span { display: block; color: var(--muted); font-size: 0.7rem; }
.take-status strong { font-size: 0.88rem; }
.start-button { width: 100%; border-radius: 9px; font-weight: 900; }
.start-button { border: 0; background: var(--amber); color: #171209; }
.take-actions { display: grid; gap: 8px; margin-bottom: 18px; }
.take-actions .abandon-button { width: 100%; min-height: 38px; }
.exercise-note { margin-bottom: 14px; padding: 11px; border-left: 3px solid var(--amber); border-radius: 0 8px 8px 0; background: rgba(255,191,71,0.07); }
.exercise-note strong { color: #f8cf7c; font-size: 0.74rem; letter-spacing: 0.04em; text-transform: uppercase; }
.exercise-note p { margin: 5px 0 0; color: #d5dbd7; font-size: 0.76rem; line-height: 1.45; }
.setup-panel { overflow: hidden; border: 1px solid #3a493f; border-radius: 9px; background: #101512; }
.setup-panel summary { padding: 10px 11px; color: #dfe3df; cursor: pointer; font-size: 0.78rem; font-weight: 850; }
.setup-panel[open] summary { border-bottom: 1px solid #3a493f; color: var(--amber); }
.setup-body { padding: 12px 11px 11px; }
.setup-guidance { margin: 4px 1px 0; color: var(--muted); font-size: 0.72rem; line-height: 1.4; }
.honesty-note { margin: 11px 1px 0; color: var(--muted); font-size: 0.72rem; line-height: 1.4; }

.practice-column { display: grid; gap: 12px; min-width: 0; }
.score-panel { min-width: 0; overflow: hidden; }
.panel-header { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 42px; padding: 9px 13px; border-bottom: 1px solid var(--line); }
.panel-header h3 { margin: 0; font-size: 0.84rem; letter-spacing: 0.03em; }
.panel-header span { color: var(--muted); font-size: 0.72rem; }
.view-toggle { min-height: 30px; padding: 0 10px; border: 1px solid #58645d; border-radius: 8px; background: #111613; color: #dfe3df; font-size: 0.72rem; font-weight: 800; }
.view-toggle[aria-expanded="true"] { border-color: #92702f; color: var(--amber); }
.scroll-score { overflow-x: auto; scrollbar-color: #3a453f transparent; }
.score-stack-canvas { width: 650px; min-width: 650px; margin: 0 auto; }
.score-lane-heading { display: flex; align-items: center; justify-content: space-between; height: 25px; padding: 5px 18px 0; color: var(--muted); font-size: 0.7rem; }
.score-lane-heading strong { color: #dfe3df; font-size: 0.73rem; letter-spacing: 0.02em; }
.tab-lane-heading { border-top: 1px solid var(--line); }
.score-svg { display: block; width: 650px; height: 96px; }
.staff-line, .tab-line { stroke: #707b74; stroke-width: 1; }
.bar-line { stroke: #a0a8a3; stroke-width: 1.5; }
.bar-line.final { stroke-width: 3; }
.ledger-line { stroke: #818a84; stroke-width: 1; }
.note-head { fill: var(--ink); transition: fill 80ms ease, filter 80ms ease; }
.note-head.current { fill: var(--amber); filter: drop-shadow(0 0 5px rgba(255,191,71,0.65)); }
.note-stem { stroke: var(--ink); stroke-width: 1.8; }
.clef { fill: var(--ink); font-family: serif; font-size: 54px; }
.time-signature { fill: var(--ink); font-family: Georgia, serif; font-size: 22px; font-weight: 700; text-anchor: middle; }
.tab-string { fill: var(--amber); font-size: 12px; font-weight: 800; text-anchor: middle; }
.tab-number-bg { fill: var(--panel); }
.tab-number { fill: var(--ink); font-size: 14px; font-weight: 800; text-anchor: middle; }
.tab-number-bg.current { fill: var(--amber); filter: drop-shadow(0 0 5px rgba(255,191,71,0.65)); }
.tab-number.current { fill: #171209; }

.live-panel { overflow: hidden; }
.live-header { min-height: 48px; }
.live-state-wrap { display: flex; align-items: center; gap: 9px; }
.session-state { color: var(--muted); font-size: 0.77rem; }
.countdown-badge { display: grid; place-items: center; width: 30px; height: 30px; border: 1px solid #92702f; border-radius: 8px; background: rgba(255,191,71,0.12); color: var(--amber); font-size: 1.05rem; font-weight: 950; }
.abandon-button { min-height: 30px; padding: 0 10px; border: 1px solid rgba(255,117,109,0.62); border-radius: 8px; background: rgba(255,117,109,0.09); color: #ff9a94; font-size: 0.72rem; font-weight: 800; }
.abandon-button:hover { background: rgba(255,117,109,0.17); }
.metronome-strip { display: grid; grid-template-columns: 72px minmax(560px, 1fr); gap: 8px; overflow-x: auto; padding: 10px 13px 8px; border-bottom: 1px solid var(--line); }
.metronome-scroll { min-width: 560px; overflow: hidden; }
.metronome-progress { display: grid; grid-template-columns: repeat(16, minmax(28px, 1fr)); gap: 2px; min-width: 560px; }
.metronome-tick { display: grid; place-items: center; min-height: 25px; border: 1px solid #323c36; border-radius: 3px; background: #101411; color: #69736d; font-size: 0.68rem; font-weight: 750; transition: background 90ms ease, border-color 90ms ease, color 90ms ease, transform 90ms ease; }
.metronome-tick.beat-tick { border-left: 2px solid #69736d; color: #aeb6b1; font-weight: 900; }
.metronome-tick.elapsed { border-color: rgba(255,191,71,0.36); background: rgba(255,191,71,0.14); color: #d4ad60; }
.metronome-tick.current { border-color: var(--amber); background: var(--amber); color: #171209; box-shadow: 0 0 8px rgba(255,191,71,0.38); transform: translateY(-1px); }
.evaluation-grid { display: grid; grid-template-columns: 72px minmax(560px, 1fr); gap: 3px 8px; overflow-x: auto; padding: 8px 13px 9px; }
.grid-label { display: flex; align-items: center; min-height: 25px; color: var(--muted); font-size: 0.72rem; font-weight: 750; }
.pluck-label { color: var(--blue); }
.grid-row { display: grid; grid-template-columns: repeat(4, minmax(130px, 1fr)); min-width: 560px; gap: 5px; }
.grid-cell { display: grid; place-items: center; min-height: 25px; border: 1px solid #323c36; background: #101411; color: #7f8983; font-size: 0.72rem; transition: background 90ms ease, border-color 90ms ease, transform 90ms ease; }
.event-heading { grid-template-columns: auto auto; gap: 6px; min-height: 28px; background: #202922; color: var(--ink); }
.event-heading strong { color: var(--amber); font-size: 0.8rem; }
.event-heading span { color: var(--muted); font-size: 0.67rem; }
.grid-cell.playing { outline: 2px solid var(--blue); outline-offset: -1px; }
.metric-cell.detected { background: rgba(124,200,255,0.15); border-color: rgba(124,200,255,0.6); color: var(--blue); }
.metric-cell.good { background: rgba(105,232,138,0.14); border-color: rgba(105,232,138,0.5); color: var(--green); }
.metric-cell.watch, .metric-cell.baseline { background: rgba(255,191,71,0.13); border-color: rgba(255,191,71,0.5); color: var(--amber); }
.metric-cell.miss, .pluck-cell.missing { background: rgba(255,117,109,0.14); border-color: rgba(255,117,109,0.5); color: var(--red); }
.metric-cell.unknown, .metric-cell.pending { color: #c2c9c5; }
.metric-cell.unavailable { border-color: #29312d; background: #0e1210; color: #59625d; }
.grid-legend { display: flex; flex-wrap: wrap; gap: 13px; padding: 0 13px 10px 93px; color: var(--muted); font-size: 0.68rem; }
.grid-legend i { display: inline-block; width: 7px; height: 7px; margin-right: 4px; border-radius: 50%; }
.time-key { background: var(--amber); }.good-key { background: var(--green); }.watch-key { background: var(--amber); }.miss-key { background: var(--red); }

.results-footer { display: grid; grid-template-columns: max-content 1fr; gap: 4px 18px; padding: 13px 16px; background: #101411; font-size: 0.72rem; font-variant-numeric: tabular-nums; }
.results-footer strong { grid-row: 1 / span 2; align-self: center; color: var(--green); font-size: 0.76rem; letter-spacing: 0.025em; text-transform: uppercase; }
.results-footer span { color: #d5dbd7; }
.results-footer #timing-diagnostic, .results-footer #pitch-diagnostic { color: var(--muted); }
.diagnostic-button { grid-column: 2; justify-self: start; min-height: 26px; padding: 3px 8px; border: 1px solid #58645d; border-radius: 6px; background: transparent; color: #bdc6c0; font-size: 0.68rem; }

@media (min-height: 780px) and (min-width: 901px) { .controls { position: sticky; top: 12px; } }
@media (max-width: 900px) {
  .workspace { grid-template-columns: 1fr; }
  .control-body { display: grid; grid-template-columns: 1fr 1fr; gap: 0 14px; }
  .take-status, .take-actions, .exercise-note, .setup-panel { grid-column: 1 / -1; }
}
@media (max-width: 600px) {
  .app-shell { padding-inline: 10px; }
  .brand p { display: none; }
  .build-flag { max-width: 140px; text-align: center; }
  .control-body { display: block; }
  .live-header { align-items: flex-start; flex-direction: column; }
  .results-footer { grid-template-columns: 1fr; padding-left: 13px; }
  .results-footer strong { grid-row: auto; }
  .diagnostic-button { grid-column: 1; }
  .grid-legend { padding-left: 13px; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { transition: none !important; } }
.practice-history { padding: 0; }
.practice-history > summary { cursor: pointer; font-weight: 700; padding: 14px 18px; }
.practice-history-body { border-top: 1px solid var(--line); padding: 14px 18px 18px; }
.practice-history-body p { margin: 0 0 10px; }
.practice-history-body ol { margin: 0 0 14px; padding-left: 22px; }
.practice-history-body li { margin: 0 0 7px; }

.key-signature { fill: var(--ink); font-family: Georgia, serif; font-size: 27px; text-anchor: middle; }

/* Music-paper treatment, scoped to the two notation lanes only. */
.score-stack-canvas { background: #f6f0df; color: #22231f; }
.score-stack-canvas .score-lane-heading,
.score-stack-canvas .score-lane-heading strong { color: #34352e; }
.score-stack-canvas .tab-lane-heading { border-top-color: #c9c2b3; }
.score-stack-canvas .staff-line,
.score-stack-canvas .tab-line { stroke: #79766d; }
.score-stack-canvas .bar-line { stroke: #49483f; }
.score-stack-canvas .ledger-line { stroke: #777267; }
.score-stack-canvas .note-head,
.score-stack-canvas .clef,
.score-stack-canvas .time-signature,
.score-stack-canvas .key-signature,
.score-stack-canvas .tab-number { fill: #22231f; }
.score-stack-canvas .note-stem { stroke: #22231f; }
.score-stack-canvas .tab-number-bg { fill: #f6f0df; }
.score-stack-canvas .tab-string { fill: #80540e; }
.score-stack-canvas .note-head.current,
.score-stack-canvas .tab-number-bg.current { fill: #e2a12b; }
.score-stack-canvas .tab-number.current { fill: #22231f; }

/* T-01C: eighth flags and rests on the standard-notation staff only. */
.score-stack-canvas .eighth-flag { stroke: #22231f; stroke-width: 2; fill: none; stroke-linecap: round; }
.score-stack-canvas .rest-symbol { fill: #22231f; }
.score-stack-canvas .rest-symbol-stroke { fill: none; stroke: #22231f; stroke-width: 3.5; stroke-linecap: round; stroke-linejoin: round; }

/* T-60B1: the heading and both notation lanes form one uninterrupted
   parchment. The SVGs retain their own 1:1 musical geometry. */
.score-panel {
  background: #f6f0df;
  border-color: #c6b58f;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.17);
}
.score-panel > .panel-header {
  background: #f6f0df;
  border-bottom: 1px solid #ded2b9;
  padding: 13px 18px;
}
.score-panel > .panel-header h3 { color: #342e25; font-size: 0.92rem; letter-spacing: 0.01em; }
.score-panel .view-toggle {
  background: transparent;
  color: #51483c;
  border-color: #c2b496;
}
.score-panel .view-toggle[aria-expanded="true"] { color: #6c4a11; border-color: #97743b; }
.score-panel .scroll-score {
  background: #f6f0df;
  scrollbar-color: #bbaa88 transparent;
  /* The horizontal scrollbar must sit below the E-string fret numbers. */
  padding-bottom: 20px;
}
.score-panel .score-stack-canvas { margin: 0; }
.score-panel .score-lane-heading { padding-inline: 18px; }

/* T-60B2: warm industrial-chic shell. Keep parchment music geometry untouched. */
:root {
  --ink: #eeeae0;
  --muted: #b0b4ac;
  --panel: #1b211f;
  --line: #414942;
  --amber: #e9b45d;
  --bg: #121715;
}
body {
  background: radial-gradient(ellipse at 82% -12%, rgba(179, 137, 68, 0.11), transparent 34rem),
    linear-gradient(180deg, #1c221f 0, #121715 35rem);
}
.app-shell { padding-top: 0; }
.topbar {
  min-height: 79px;
  margin-bottom: 18px;
  padding: 13px 3px 15px;
  border-bottom: 1px solid #4e554c;
}
.brand { gap: 12px; }
.brand-mark {
  background: #d5ae73;
  color: #201c15;
  border-radius: 10px;
  box-shadow: inset 0 1px rgba(255,255,255,0.2);
}
.brand h1 { font-size: 1.17rem; font-weight: 820; letter-spacing: 0.11em; }
.brand p { color: #bcb8ac; font-size: 0.77rem; letter-spacing: 0.005em; }
.build-flag {
  border-color: #5b5648;
  color: #c1b39a;
  background: rgba(226, 194, 138, 0.035);
  font-weight: 650;
  letter-spacing: 0.035em;
}
.workspace, .practice-column { gap: 14px; }
.panel {
  border-color: var(--line);
  background: var(--panel);
  box-shadow: 0 9px 25px rgba(0,0,0,0.16);
}
/* The score is a single existing parchment surface, not a dark panel. */
.score-panel { background: #f6f0df; border-color: #c6b58f; }
.field label, .meter-heading { color: #d7d8cf; font-weight: 650; }
select, .tempo-row button, .secondary-button, .view-toggle {
  border-color: #626a60;
  background: #242a26;
  color: #eeeae0;
}
select { background-color: #242a26; }
.secondary-button { font-weight: 700; }
.start-button { background: var(--amber); color: #201b13; font-weight: 850; }
.take-status, .setup-panel { background: #202723; border-color: #465048; }
.exercise-note { background: rgba(233,180,93,0.07); }
.exercise-note strong { color: #eecb91; }
.exercise-note p { color: #d8d9d0; }
.panel-header { border-bottom-color: var(--line); }
/* Keep the score heading and view toggle in the same parchment palette. */
.score-panel > .panel-header { background: #f6f0df; border-bottom-color: #ded2b9; }
.score-panel .view-toggle { background: transparent; color: #51483c; border-color: #c2b496; }
.score-panel .view-toggle[aria-expanded="true"] { color: #6c4a11; border-color: #97743b; }
button:focus-visible, select:focus-visible, input:focus-visible,
summary:focus-visible, .scroll-score:focus-visible {
  outline: 2px solid #e9b45d;
  outline-offset: 3px;
}
@media (max-width: 600px) {
  .topbar { min-height: 69px; margin-bottom: 13px; }
  .build-flag { font-size: 0.66rem; }
}

/* T-60B3: responsive polish only. Preserve the 1:1 notation/TAB coordinates. */
.workspace > *, .practice-column > *, .topbar > * { min-width: 0; }
.scroll-score { max-width: 100%; overscroll-behavior-inline: contain; }
.score-panel > .panel-header { min-width: 0; }
.score-panel > .panel-header h3 { min-width: 0; }
.score-lane-heading { gap: 12px; }
.score-lane-heading > span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

@media (max-width: 900px) {
  /* Existing two-column form remains, but long selectors can shrink safely. */
  .control-body { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .control-body > .field { min-width: 0; }
  .control-body select { min-width: 0; }
}
@media (max-width: 600px) {
  .topbar { gap: 10px; }
  .brand { min-width: 0; }
  .brand-mark { flex: 0 0 36px; }
  .build-flag { max-width: min(46vw, 140px); overflow-wrap: anywhere; }
  .control-body { grid-template-columns: minmax(0, 1fr); }
  .score-panel > .panel-header { gap: 8px; padding: 11px 12px; }
  .score-panel .view-toggle { flex-shrink: 0; max-width: 65%; white-space: normal; text-align: center; }
  .score-panel .score-lane-heading { padding-inline: 12px; }
}


/* T-62A: reclaim the music width. Practice settings remain on the main
   screen; audio setup and help stay accessible below the score until B/C. */
.workspace { grid-template-columns: minmax(0, 1fr); }
.practice-toolbar { position: static; overflow: visible; }
.practice-toolbar .control-body {
  display: grid;
  grid-template-columns: minmax(220px, 2.4fr) minmax(150px, 1.25fr) minmax(190px, 1.7fr) minmax(115px, 1fr);
  align-items: end;
  gap: 12px 16px;
  padding: 14px 18px;
}
.practice-toolbar .control-body > .field { min-width: 0; margin: 0; }
.practice-toolbar .take-status {
  grid-column: 1 / span 2;
  margin: 0;
  align-self: stretch;
}
.practice-toolbar .take-actions {
  grid-column: 3 / span 2;
  display: flex;
  flex-wrap: wrap;
  align-items: stretch;
  justify-content: flex-end;
  margin: 0;
}
.practice-toolbar .take-actions button { flex: 1 1 135px; width: auto; }
.practice-column > .exercise-note { margin: 0; }
.practice-column > .setup-panel .setup-body {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0 20px;
}
.practice-column > .setup-panel .honesty-note { grid-column: 1 / -1; }
@media (min-width: 901px) { .practice-toolbar { position: static; } }
@media (max-width: 1050px) {
  .practice-toolbar .control-body { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .practice-toolbar .take-status, .practice-toolbar .take-actions { grid-column: auto / span 1; }
}
@media (max-width: 600px) {
  .practice-toolbar .control-body { grid-template-columns: minmax(0, 1fr); }
  .practice-toolbar .take-status, .practice-toolbar .take-actions { grid-column: 1; }
  .practice-column > .setup-panel .setup-body { grid-template-columns: minmax(0, 1fr); }
}

/* T-62A2: an explicit first-use path when Live Take needs microphone permission. */
.microphone-guidance {
  flex: 1 1 100%;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 8px 12px;
  color: #e0d3b9;
  font-size: 0.76rem;
}
.practice-toolbar .microphone-guidance button { flex: 0 0 auto; width: auto; }
@media (max-width: 600px) {
  .microphone-guidance { justify-content: stretch; }
  .practice-toolbar .microphone-guidance button { flex: 1 1 100%; }
}

/* T-62B2: make the available first step visually primary, not the disabled take. */
.practice-toolbar #start-practice:disabled {
  background: #353b35;
  color: #aeb6ac;
  opacity: 1;
  border: 1px solid #4c554c;
}
.practice-toolbar .microphone-guidance .setup-first-action {
  background: var(--amber);
  color: #211b11;
  border: 1px solid var(--amber);
  font-weight: 850;
  min-height: 44px;
  padding-inline: 22px;
}
.practice-toolbar .microphone-guidance .setup-first-action:hover {
  background: #f4b03e;
}

/* T-62B: dedicated, keyboard-accessible microphone setup. */
.header-actions { display: flex; align-items: center; gap: 10px; }
.header-actions > button { min-height: 38px; padding: 0 15px; }
.setup-dialog { width: min(560px, calc(100vw - 28px)); max-height: min(92dvh, 850px); overflow-y: auto; border: 1px solid #596052; border-radius: 16px; padding: 0; background: #202923; color: var(--ink); box-shadow: 0 26px 80px rgba(0,0,0,.65); }
.setup-dialog::backdrop { background: rgba(5,8,6,.75); }
.setup-dialog-header { display: flex; justify-content: space-between; align-items: start; gap: 12px; padding: 22px 24px 16px; border-bottom: 1px solid var(--line); }
.setup-dialog-header h2 { margin: 0 0 6px; font-size: 1.3rem; }
.setup-dialog-header p, .setup-step-content > p { margin: 0; color: #b7c0b7; font-size: .84rem; line-height: 1.5; }
.setup-dialog .setup-close { width: 38px; flex-shrink: 0; }
.setup-dialog-content { padding: 12px 24px 0; }
.setup-step { display: grid; grid-template-columns: 34px minmax(0,1fr); gap: 13px; padding: 16px 0; border-bottom: 1px solid #3d493e; }
.setup-step-number { display: grid; place-items: center; width: 32px; height: 32px; border-radius: 50%; background: #d9a95c; color: #261e12; font-weight: 850; }
.setup-step-content { display: grid; gap: 10px; min-width: 0; }
.setup-step-content h3 { margin: 3px 0 0; font-size: 1rem; }
.setup-step-content .field { margin: 4px 0 0; }
.setup-optional { font-size: .73rem; color: #bfc3b8; font-weight: 500; }
.setup-step-status { margin: 0; color: #d2c7b5; font-size: .8rem; }
.setup-step-status.connected { color: #a3d9ae; }
.setup-technical { margin: 13px 0; color: #c2cbc0; font-size: .78rem; }
.setup-technical summary { cursor: pointer; padding: 9px 0; }
.setup-technical .input-meter { margin-top: 8px; }
.setup-dialog-footer { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; justify-content: space-between; padding: 16px 24px 22px; background: #1b241e; border-top: 1px solid var(--line); }
.setup-dialog-footer > span { color: #c4cfbf; font-size: .8rem; }
.setup-dialog-footer .start-button { width: auto; min-height: 42px; padding: 0 18px; }
@media (max-width: 600px) { .build-flag { display: none; } .setup-dialog-header, .setup-dialog-content, .setup-dialog-footer { padding-left: 16px; padding-right: 16px; } .setup-dialog-footer .start-button { width: 100%; } }

/* T-62C: secondary information lives off the music stand. */
.score-heading-actions { display: flex; align-items: center; gap: 12px; min-width: 0; }
.exercise-info-button { width: auto; min-height: 34px; padding: 5px 10px; border: 1px solid #d8c8a6; background: transparent; color: #685a44; font-size: .78rem; font-weight: 650; border-radius: 8px; }
.exercise-info-button:hover, .exercise-info-button:focus-visible { background: #e8dcc3; }
.student-dialog { width: min(620px, calc(100vw - 28px)); max-height: min(88dvh, 800px); overflow-y: auto; padding: 0; border: 1px solid #596052; border-radius: 16px; background: #202923; color: var(--ink); box-shadow: 0 26px 80px rgba(0,0,0,.65); }
.student-dialog::backdrop { background: rgba(5,8,6,.75); }
.student-dialog-header { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 20px 24px; border-bottom: 1px solid var(--line); }
.student-dialog-header h2 { margin: 0; font-size: 1.25rem; }
.student-dialog-header button { width: 42px; flex-shrink: 0; }
.student-dialog-body, .student-dialog .practice-history-body { padding: 20px 24px 24px; }
.student-dialog-body p { margin: 0; color: #d8d9d0; line-height: 1.6; }
.student-dialog .practice-history-body { border: 0; }
@media (max-width: 600px) { .student-dialog-header, .student-dialog-body, .student-dialog .practice-history-body { padding-left: 16px; padding-right: 16px; } }

/* Free Chug learning state belongs in the visible student practice toolbar. */
.free-chug-phase { grid-column: 1 / -1; color: #e9b45d; font-size: 0.8rem; font-weight: 650; }
.free-chug-phase[hidden] { display: none; }

.history-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 10px; }
.history-actions > button { max-width: 100%; white-space: normal; }

/* Local, nonjudgmental comparison of two compatible saved takes. */
.take-comparison { margin: 1.2rem 0; padding: 0.75rem; border: 1px solid var(--border, #7776); border-radius: 8px; }
.take-comparison h3 { margin: 0 0 0.4rem; }
.compare-pickers { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 230px), 1fr)); gap: 0.65rem; }
.compare-pickers label { display: grid; gap: 0.3rem; min-width: 0; }
.compare-pickers select { width: 100%; min-width: 0; }
#comparison-results { overflow-x: auto; margin-top: 0.65rem; }
#comparison-results table { width: 100%; border-collapse: collapse; text-align: left; }
#comparison-results th, #comparison-results td { padding: 0.35rem; border-bottom: 1px solid #8885; }

.comparison-heading { display: flex; align-items: center; gap: 0.5rem; }
.comparison-heading h3 { margin: 0; }
.comparison-help { position: relative; }
.comparison-help summary { cursor: pointer; list-style: none; font-size: 1.1rem; }
.comparison-help summary::-webkit-details-marker { display: none; }
.comparison-help[open] p { max-width: 55ch; padding: 0.6rem; border: 1px solid var(--line); border-radius: 6px; }
.history-summary-heading { margin-top: 1rem; }

/* One exercise, one measurement, one visible dot per recorded take. */
.practice-trends { margin: 1rem 0; padding: 0.75rem; border: 1px solid var(--border, #7776); border-radius: 8px; }
.practice-trends h3 { margin: 0 0 0.5rem; }
.trend-pickers { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 230px), 1fr)); gap: 0.65rem; }
.trend-pickers label { display: grid; gap: 0.3rem; min-width: 0; }
.trend-pickers select { width: 100%; min-width: 0; }
#trend-chart svg { display: block; width: 100%; height: auto; }
.trend-gridline { stroke: currentColor; opacity: 0.15; stroke-width: 1; }
.trend-axis-label { fill: currentColor; font-size: 12px; }
.trend-dot { fill: #e9b45d; stroke: #292622; stroke-width: 1.5; cursor: pointer; }
.trend-dot:focus { outline: none; stroke: #fff; stroke-width: 3; }
#trend-point-detail { min-height: 1.2em; font-size: 0.85rem; }

/* History sections have independent, keyboard-accessible views. */
.history-tabs { display: flex; flex-wrap: wrap; gap: 0.4rem; margin-bottom: 1rem; border-bottom: 1px solid var(--line); padding-bottom: 0.5rem; }
.history-tabs button { flex: 1 1 6rem; min-width: 0; border: 1px solid var(--line); border-radius: 6px; padding: 0.55rem; background: transparent; color: inherit; cursor: pointer; }
.history-tabs button[aria-selected="true"] { border-color: #e9b45d; font-weight: 700; }
.practice-history-body [role="tabpanel"][hidden] { display: none; }
/* Do not hide explanations behind ellipses. */
.practice-history-body .field-note, .practice-history-body .comparison-help p { white-space: normal; overflow: visible; text-overflow: clip; overflow-wrap: anywhere; line-height: 1.45; }
