/* One token system for the complete workspace and every dialog. */
:root {
  --bg: #f4f2ec;
  --surface: #fffefa;
  --raised: #e9e7df;
  --score: #fffefa;
  --ink: #242e29;
  --muted: #59655e;
  --line: #c7ccc3;
  --control-line: #7b897e;
  --accent: #35674e;
  --accent-ink: #fff;
  --selected: #e2eddf;
  --staff: #526158;
  --focus: #286eac;
  --scrim: #14231c70;
  color-scheme: light;
}
:root[data-theme="dark"] {
  --bg: #252d29;
  --surface: #343f38;
  --raised: #46534a;
  --score: #303b33;
  --ink: #f6f5ec;
  --muted: #c0cec1;
  --line: #607463;
  --control-line: #8b9e8e;
  --accent: #b5d9b7;
  --accent-ink: #203b29;
  --selected: #4b6450;
  --staff: #b4c4b4;
  --focus: #a5d5ff;
  --scrim: #0b150f99;
  color-scheme: dark;
}
@media (prefers-color-scheme: dark) {
  :root[data-theme="system"] {
    --bg: #252d29;
    --surface: #343f38;
    --raised: #46534a;
    --score: #303b33;
    --ink: #f6f5ec;
    --muted: #c0cec1;
    --line: #607463;
    --control-line: #8b9e8e;
    --accent: #b5d9b7;
    --accent-ink: #203b29;
    --selected: #4b6450;
    --staff: #b4c4b4;
    --focus: #a5d5ff;
    --scrim: #0b150f99;
    color-scheme: dark;
  }
}
* {
  box-sizing: border-box;
}
[hidden] {
  display: none !important;
}
html,
body {
  margin: 0;
  min-height: 100%;
  background: var(--bg);
  color: var(--ink);
}
body {
  font:
    16px/1.5 -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    sans-serif;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior: none;
}
button,
input,
select,
textarea {
  font: inherit;
}
button {
  cursor: pointer;
  touch-action: manipulation;
}
button:disabled {
  opacity: 0.5;
  cursor: default;
}
button,
a,
input,
select,
textarea,
summary {
  outline-offset: 4px;
}
:focus-visible {
  outline: 3px solid var(--focus);
}
button {
  transition:
    background 160ms,
    color 160ms,
    border-color 160ms;
}
button:active:not(:disabled) {
  filter: brightness(0.94);
}
svg {
  display: block;
}
button svg,
[data-icon] svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex-shrink: 0;
}
a {
  color: var(--accent);
}
p,
h1,
h2,
h3 {
  margin: 0;
}
h1 {
  font-size: 26px;
  line-height: 1.25;
  font-weight: 600;
  letter-spacing: -0.035em;
}
h2 {
  font-size: 25px;
  line-height: 1.3;
  font-weight: 600;
  letter-spacing: -0.025em;
}
h3 {
  font-size: 15px;
  font-weight: 650;
}
.eyebrow {
  font-size: 10px;
  font-weight: 650;
  letter-spacing: 0.13em;
  color: var(--muted);
}
.app {
  height: 100vh;
  height: 100dvh;
  max-width: 1600px;
  margin: auto;
  display: flex;
  flex-direction: column;
  padding: max(12px, env(safe-area-inset-top))
    max(24px, env(safe-area-inset-right)) max(16px, env(safe-area-inset-bottom))
    max(24px, env(safe-area-inset-left));
  gap: 18px;
}
.topbar {
  display: flex;
  align-items: center;
  gap: 28px;
  min-height: 52px;
  flex: none;
}
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--ink);
  text-decoration: none;
  font-size: 16px;
  font-weight: 650;
  white-space: nowrap;
}
.brand svg {
  width: 28px;
  height: 28px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.2;
}
.brand .black-key {
  fill: currentColor;
  stroke: none;
}
.main-nav {
  display: flex;
  gap: 6px;
}
.nav-button,
.text-button {
  border: 0;
  background: transparent;
  color: var(--muted);
  min-height: 44px;
  padding: 8px 12px;
  border-radius: 8px;
  font-size: 14px;
}
.nav-button {
  color: var(--ink);
}
.chevron {
  margin-left: 8px;
}
.header-actions {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 8px;
}
.icon-btn {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  background: transparent;
  border: 0;
  border-radius: 9px;
  color: var(--ink);
  flex: none;
}
.connection {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--surface);
  color: var(--muted);
  padding: 8px 13px;
  font-size: 13px;
}
.connection-dot,
.listen-dot {
  width: 7px;
  height: 7px;
  border: 1.5px solid var(--muted);
  border-radius: 50%;
  flex: none;
}
.connection[data-connected="true"] .connection-dot,
.listen-panel[data-active="true"] .listen-dot {
  background: var(--accent);
  border-color: var(--accent);
}
.practice-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  width: min(100%, 1120px);
  align-self: center;
  flex: none;
}
.practice-heading {
  display: grid;
  gap: 3px;
}
.practice-heading p {
  font-size: 13px;
  color: var(--muted);
}
.advance-switch,
.segmented {
  display: flex;
  gap: 3px;
  padding: 4px;
  background: var(--raised);
  border-radius: 10px;
}
.advance-switch button,
.segmented button {
  flex: 1;
  min-height: 42px;
  white-space: nowrap;
  border: 1px solid transparent;
  border-radius: 7px;
  padding: 8px 16px;
  font-size: 14px;
  color: var(--muted);
  background: transparent;
}
.advance-switch button[aria-pressed="true"],
.segmented button[aria-pressed="true"] {
  background: var(--surface);
  color: var(--ink);
  border-color: var(--control-line);
  box-shadow: 0 1px 2px #0000000a;
}
.availability {
  font-size: 13px;
  align-self: center;
  color: var(--muted);
  max-width: 650px;
}
.availability:empty {
  display: none;
}
.workspace {
  flex: 1;
  min-height: 0;
  width: min(100%, 1120px);
  align-self: center;
  display: flex;
  flex-direction: column;
}
.stage {
  flex: 1;
  min-height: 180px;
  background: var(--score);
  border: 1px solid var(--line);
  border-radius: 14px;
  position: relative;
  padding: 42px 30px 18px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  cursor: pointer;
  touch-action: manipulation;
  overflow: hidden;
}
.stage[data-input="listen"] {
  cursor: default;
}
.score-heading {
  position: absolute;
  top: 15px;
  left: 22px;
  right: 22px;
  display: flex;
  justify-content: space-between;
  gap: 10px;
  font-size: 12px;
  color: var(--muted);
}
.staff-box {
  width: min(100%, 460px);
  min-height: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  flex: 1;
  max-height: 100%;
  overflow: hidden;
}
.staff-box > svg {
  display: block;
  width: 100%;
  height: 100%;
  max-height: 34dvh;
}
.stage[data-content="exercise"] .staff-box {
  width: 100%;
  max-height: 36dvh;
}
.stage[data-display="name"] .staff-box {
  display: none;
}
.stage[data-display="staff"] .note-wrap {
  display: none;
}
.stage[data-display="staff"] .tones {
  display: none;
}
.note-wrap {
  position: relative;
  display: grid;
  place-items: center;
  flex: none;
  min-width: 88px;
  min-height: 64px;
}
.note {
  font-size: clamp(36px, 5vw, 64px);
  line-height: 1.2;
  font-weight: 450;
  letter-spacing: -0.04em;
  white-space: nowrap;
}
.stage[data-display="name"] .note {
  font-size: clamp(64px, 12vw, 120px);
}
.stage[data-display="name"] .note-wrap {
  flex: 1;
}
.ring {
  position: absolute;
  width: 100px;
  height: 100px;
  transform: rotate(-90deg);
  display: none;
  pointer-events: none;
}
.ring circle {
  fill: none;
  stroke-width: 2;
}
.ring__track {
  stroke: var(--line);
}
.ring__progress {
  stroke: var(--accent);
  stroke-dasharray: 339.292;
  stroke-dashoffset: 0;
}
.note-wrap[data-running="true"][data-ring="on"] .ring {
  display: block;
}
.note-wrap[data-running="true"][data-ring="on"] {
  min-height: 108px;
}
.tones {
  font-size: 14px;
  color: var(--muted);
}
.tones:empty {
  display: none;
}
.next-up {
  display: flex;
  gap: 8px;
  align-items: baseline;
  font-size: 12px;
  color: var(--muted);
}
.next-up strong {
  font-size: 16px;
  color: var(--ink);
  font-weight: 500;
}
.stage[data-next="off"] .next-up {
  display: none;
}
.hint {
  font-size: 13px;
  color: var(--muted);
  text-align: center;
}
.score-tools {
  display: flex;
  justify-content: space-between;
  min-height: 44px;
  flex: none;
}
.score-tools button {
  font-size: 13px;
  padding-inline: 2px;
}
.key-hint {
  padding: 12px 18px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 10px;
  display: flex;
  gap: 18px;
  align-items: center;
  margin-bottom: 8px;
}
.keyboard {
  display: flex;
  position: relative;
  width: 210px;
  height: 64px;
  flex: none;
}
.piano-key {
  border: 1px solid #546258;
  border-radius: 0 0 3px 3px;
  background: #fff;
  color: #1d2921;
  width: 30px;
  height: 64px;
  display: flex;
  align-items: end;
  justify-content: center;
  font-size: 10px;
  padding-bottom: 2px;
}
.piano-key.black {
  position: absolute;
  top: 0;
  background: #25352b;
  color: #fff;
  width: 20px;
  height: 40px;
  z-index: 1;
}
.piano-key.target {
  background: #c0e1a5;
  color: #153521;
  box-shadow: inset 0 -4px #35674e;
}
.key-caption {
  font-size: 13px;
  color: var(--muted);
}
.listen-panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px 16px;
  flex: none;
}
.listen-heading {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 22px;
}
#listen-status {
  font-size: 13px;
  flex: 1;
}
meter {
  width: 90px;
  height: 12px;
  accent-color: var(--accent);
}
#listen-start-hint {
  font-size: 12px;
  color: var(--muted);
  margin: 4px 0 0 17px;
}
.listen-panel.matched {
  animation: match 350ms ease-out;
}
@keyframes match {
  from {
    border-color: var(--accent);
    background: var(--selected);
  }
  to {
    border-color: var(--line);
    background: var(--surface);
  }
}
.progress {
  height: 3px;
  width: 100%;
  max-width: 350px;
  background: var(--raised);
  display: none;
}
.progress span {
  height: 100%;
  width: 100%;
  display: block;
  background: var(--accent);
  transform-origin: left;
}
.stage[data-display="staff"][data-running="true"] .progress {
  display: block;
}
.staff__line,
.score__line,
.staff__ledger,
.score__ledger {
  stroke: var(--staff);
  stroke-width: 0.9;
}
.staff__head,
.staff__acc,
.staff__clef,
.score__head,
.score__acc,
.score__clef,
.score__rest,
.score__flag,
.score__beam {
  fill: var(--ink);
}
.staff__stem,
.score__stem,
.score__bar {
  stroke: var(--ink);
  stroke-width: 1.2;
}
.score__cursor {
  fill: var(--accent);
  opacity: 0.2;
}
.score__head--hollow {
  fill: var(--score);
  stroke: var(--ink);
  stroke-width: 1.5;
}
.score__dot {
  fill: var(--ink);
}
.score__meter {
  fill: var(--ink);
  font-size: 16px;
  font-weight: 600;
}
.score__active {
  fill: var(--accent);
}
.bar--bottom {
  flex: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 7px;
}
.transport {
  display: grid;
  grid-template-columns: 1fr 1.4fr 1fr;
  gap: 12px;
  width: min(100%, 650px);
}
.action-primary,
.action-secondary {
  display: inline-flex;
  justify-content: center;
  align-items: center;
  gap: 9px;
  min-height: 48px;
  padding: 11px 18px;
  border-radius: 9px;
  font-size: 14px;
  font-weight: 550;
  line-height: 1.3;
}
.action-primary {
  background: var(--accent);
  color: var(--accent-ink);
  border: 1px solid var(--accent);
}
.action-secondary {
  background: var(--surface);
  color: var(--ink);
  border: 1px solid var(--control-line);
}
.text-button {
  color: var(--muted);
}
.timers {
  display: flex;
  align-items: center;
  gap: 18px;
  font-size: 12px;
  font-variant-numeric: tabular-nums;
  color: var(--muted);
}
.timers[data-clocks="off"] {
  visibility: hidden;
}
.pace-toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--muted);
}
.pace-toolbar input {
  width: 62px;
  min-height: 36px;
  padding: 4px 7px;
}
.pace-toolbar .text-button {
  font-size: 12px;
  min-height: 36px;
}
.session-summary {
  margin: auto;
  text-align: center;
  padding: 40px 20px;
}
.session-summary h2 {
  font-size: 32px;
  margin: 10px 0;
}
.session-summary p {
  color: var(--muted);
  margin-bottom: 24px;
}
.summary-actions {
  display: flex;
  gap: 12px;
  justify-content: center;
}
.workspace:has(#session-summary:not([hidden])) .stage,
.workspace:has(#session-summary:not([hidden])) .score-tools,
.workspace:has(#session-summary:not([hidden])) .listen-panel,
.workspace:has(#session-summary:not([hidden])) .key-hint {
  display: none;
}
.notice-stack:empty {
  display: none;
}
.notice-stack:has(> p:not([hidden])) {
  display: grid;
  gap: 5px;
}
.notice-stack:not(:has(> p:not([hidden]))) {
  display: none;
}
.notice {
  padding: 9px 12px;
  background: var(--selected);
  color: var(--ink);
  border-radius: 7px;
  font-size: 13px;
}
.notice button {
  background: none;
  border: 0;
  color: var(--accent);
  text-decoration: underline;
  min-height: 32px;
}
.notice-stack .notice {
  max-width: 1120px;
  width: 100%;
  margin: auto;
}
/* Native dialogs provide focus containment and an inert underlying workspace. */
.dialog {
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 16px;
  width: min(600px, calc(100% - 32px));
  max-height: calc(100dvh - 48px);
  padding: 0;
  overflow: hidden;
  box-shadow: 0 20px 80px #00000026;
}
.dialog[open] {
  display: flex;
  flex-direction: column;
  animation: dialog-in 160ms ease-out;
}
.dialog::backdrop {
  background: var(--scrim);
}
.dialog-head {
  padding: 22px 24px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border-bottom: 1px solid var(--line);
  flex: none;
}
.dialog-head h2 {
  margin-top: 4px;
}
.dialog-body {
  padding: 22px 24px;
  overflow-y: auto;
  overscroll-behavior: contain;
  min-height: 0;
}
.dialog-foot {
  padding: 16px 24px;
  border-top: 1px solid var(--line);
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  flex: none;
  background: var(--surface);
}
.group {
  padding: 0 0 22px;
  margin: 0 0 22px;
  border: 0;
  border-bottom: 1px solid var(--line);
}
.group:last-child {
  border-bottom: 0;
  margin-bottom: 0;
  padding-bottom: 0;
}
.group > h3 {
  margin-bottom: 12px;
}
.group-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 12px;
}
.note-hint {
  font-size: 13px;
  line-height: 1.6;
  color: var(--muted);
  margin-top: 10px;
}
.field {
  display: grid;
  gap: 7px;
  font-size: 14px;
  font-weight: 550;
  margin-top: 16px;
}
.field:first-child {
  margin-top: 0;
}
input:not([type="range"]):not([type="checkbox"]),
select,
textarea {
  background: var(--surface);
  border: 1px solid var(--control-line);
  border-radius: 7px;
  color: var(--ink);
  padding: 10px 12px;
  width: 100%;
  min-height: 46px;
}
input[type="range"] {
  width: 100%;
  accent-color: var(--accent);
  min-height: 36px;
  margin: 0;
}
textarea {
  resize: vertical;
  line-height: 1.6;
}
.row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  min-height: 48px;
  margin-top: 14px;
  font-size: 14px;
  cursor: pointer;
}
.row span {
  display: grid;
  gap: 3px;
}
.row small {
  font-size: 12px;
  font-weight: 400;
  color: var(--muted);
  line-height: 1.5;
}
.switch {
  appearance: none;
  -webkit-appearance: none;
  width: 46px;
  height: 28px;
  background: var(--raised);
  border: 1px solid var(--control-line);
  border-radius: 18px;
  position: relative;
  flex: none;
  cursor: pointer;
  transition: background 160ms;
}
.switch::after {
  content: "";
  position: absolute;
  left: 3px;
  top: 3px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--muted);
  transition: transform 160ms;
}
.switch:checked {
  background: var(--accent);
  border-color: var(--accent);
}
.switch:checked::after {
  transform: translateX(18px);
  background: var(--accent-ink);
}
.volume-label {
  display: flex;
  justify-content: space-between;
  font-size: 14px;
  margin-top: 20px;
}
.volume-label output {
  font-variant-numeric: tabular-nums;
  color: var(--muted);
}
.presets {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
}
.presets button {
  background: transparent;
  border: 0;
  color: var(--accent);
  padding: 6px;
  min-height: 40px;
  font-size: 12px;
}
.chips {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 8px;
}
.chips button,
.qualities button {
  min-height: 44px;
  background: var(--surface);
  border: 1px solid var(--control-line);
  border-radius: 7px;
  color: var(--ink);
  font-size: 13px;
  padding: 7px;
}
.chips button[aria-pressed="true"],
.qualities button[aria-pressed="true"] {
  background: var(--selected);
  border: 2px solid var(--accent);
  padding: 6px;
}
.qualities {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}
.qualities button small {
  display: block;
  font-size: 11px;
}
details {
  font-size: 14px;
}
summary {
  cursor: pointer;
  min-height: 44px;
  display: list-item;
  align-content: center;
  font-weight: 550;
}
.group summary {
  margin-bottom: 8px;
}
.credit {
  font-size: 11px;
  line-height: 1.6;
  color: var(--muted);
  margin-top: 16px;
}
.dialog--wide {
  width: min(1000px, calc(100% - 32px));
}
.search-field {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 20px;
}
.search-field [data-icon] {
  color: var(--muted);
}
.library-layout {
  display: grid;
  grid-template-columns: minmax(200px, 1fr) minmax(240px, 1.35fr);
  gap: 24px;
}
.exercise-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
  max-height: 420px;
  overflow-y: auto;
  overscroll-behavior: contain;
}
.exercise-list h3 {
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  padding: 12px 10px 4px;
}
.exercise-option {
  background: none;
  border: 1px solid transparent;
  border-radius: 8px;
  text-align: left;
  padding: 11px 12px;
  min-height: 48px;
  color: var(--ink);
  font-size: 14px;
}
.exercise-option small {
  display: block;
  color: var(--muted);
  font-size: 11px;
  margin-top: 2px;
}
.exercise-option[aria-pressed="true"] {
  border-color: var(--accent);
  background: var(--selected);
}
.exercise-preview {
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: 10px;
  align-self: start;
  position: sticky;
  top: 0;
}
.exercise-preview h3 {
  font-size: 20px;
  margin-top: 8px;
}
.exercise-preview > button {
  width: 100%;
  margin-top: 20px;
}
#exercise-preview-score {
  margin: 20px 0;
  max-height: 160px;
  overflow: hidden;
}
#exercise-preview-score svg {
  width: 100%;
  height: 150px;
}
.editor {
  border-top: 1px solid var(--line);
  margin-top: 22px;
  padding-top: 14px;
}
.editor > button {
  margin-top: 12px;
}
.custom-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 12px;
  font-size: 13px;
}
.custom-row > span {
  flex: 1;
}
.custom-row button {
  border: 0;
  background: none;
  color: var(--accent);
  min-height: 44px;
  padding: 8px;
}
.input-check {
  border: 1px solid var(--control-line);
  border-radius: 10px;
  padding: 16px;
  margin: 20px 0;
  background: var(--bg);
}
#check-status {
  font-size: 13px;
  color: var(--muted);
}
.detected-note {
  font-size: 42px;
  line-height: 1.4;
  margin-top: 12px;
}
pre {
  font:
    11px/1.7 ui-monospace,
    monospace;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  background: var(--bg);
  padding: 12px;
  border-radius: 7px;
}
#copy-status {
  font-size: 12px;
  color: var(--muted);
}
@keyframes dialog-in {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}
@media (hover: hover) {
  .nav-button:hover,
  .icon-btn:hover,
  .text-button:hover,
  .exercise-option:hover {
    background: var(--raised);
  }
  .action-secondary:hover,
  .connection:hover {
    background: var(--raised);
  }
  .action-primary:hover {
    filter: brightness(0.95);
  }
}
@media (max-width: 760px) {
  .app {
    padding: 10px 16px max(12px, env(safe-area-inset-bottom));
    gap: 12px;
  }
  .topbar {
    gap: 12px;
    flex-wrap: wrap;
  }
  .brand span {
    display: none;
  }
  .main-nav {
    gap: 0;
  }
  .header-actions {
    gap: 1px;
  }
  .connection {
    padding: 6px 9px;
    font-size: 12px;
  }
  .practice-bar {
    gap: 12px;
    align-items: start;
    flex-direction: column;
  }
  .practice-heading h1 {
    font-size: 24px;
  }
  .advance-switch {
    width: 100%;
  }
  .advance-switch button {
    padding: 8px 12px;
  }
  .workspace {
    min-height: 0;
  }
  .stage {
    padding: 36px 18px 12px;
    gap: 8px;
    min-height: 160px;
  }
  .staff-box > svg {
    max-height: 29dvh;
  }
  .stage[data-content="exercise"] .staff-box {
    max-height: 30dvh;
  }
  .score-heading {
    top: 10px;
    left: 16px;
    right: 16px;
    font-size: 11px;
  }
  .note {
    font-size: 38px;
  }
  .note-wrap {
    min-height: 48px;
  }
  .score-tools {
    min-height: 36px;
  }
  .score-tools button {
    min-height: 36px;
  }
  .hint {
    font-size: 12px;
  }
  .transport {
    gap: 8px;
    grid-template-columns: 1fr 1.35fr 1fr;
  }
  .action-primary,
  .action-secondary {
    padding: 11px 10px;
    font-size: 13px;
  }
  .listen-panel {
    padding: 9px 11px;
  }
  #listen-status {
    font-size: 12px;
  }
  #listen-start-hint {
    font-size: 11px;
  }
  meter {
    width: 60px;
  }
  .dialog-head {
    padding: 18px;
  }
  .dialog-body {
    padding: 18px;
  }
  .dialog-foot {
    padding: 14px 18px;
  }
  .dialog {
    max-height: calc(100dvh - 24px);
  }
  .library-layout {
    grid-template-columns: 1fr;
  }
  .exercise-list {
    max-height: 220px;
  }
  .exercise-preview {
    position: static;
  }
  .key-hint {
    gap: 10px;
    padding: 8px;
  }
  .keyboard {
    width: 175px;
    height: 52px;
  }
  .piano-key {
    width: 25px;
    height: 52px;
  }
  .piano-key.black {
    width: 17px;
    height: 34px;
  }
  .key-caption {
    font-size: 12px;
  }
  .group-head {
    align-items: start;
    flex-direction: column;
  }
}
@media (max-width: 380px) {
  .app {
    padding-inline: 10px;
    gap: 8px;
  }
  .connection {
    border: 0;
    padding: 6px;
  }
  .connection-dot {
    display: none;
  }
  .main-nav .nav-button {
    padding: 8px;
    font-size: 13px;
  }
  .header-actions .icon-btn {
    width: 40px;
  }
  .topbar {
    gap: 4px;
    min-height: 44px;
  }
  .brand svg {
    width: 24px;
  }
  .stage {
    padding-inline: 12px;
  }
  .note {
    font-size: 32px;
  }
  .transport button {
    font-size: 12px;
    padding-inline: 8px;
  }
  .transport button svg {
    width: 16px;
    height: 16px;
  }
  .chips {
    grid-template-columns: repeat(4, 1fr);
  }
  .segmented button {
    font-size: 12px;
    padding: 8px;
  }
  .dialog-head h2 {
    font-size: 22px;
  }
  .listen-dot {
    display: none;
  }
  #listen-start-hint {
    margin-left: 0;
  }
}
@media (max-height: 650px) {
  .app {
    gap: 7px;
    padding-top: 6px;
    padding-bottom: 8px;
  }
  .topbar {
    min-height: 44px;
  }
  .practice-heading .eyebrow {
    display: none;
  }
  .practice-heading h1 {
    font-size: 20px;
  }
  .practice-bar {
    gap: 7px;
  }
  .advance-switch button {
    min-height: 36px;
  }
  .stage {
    gap: 5px;
    padding-top: 28px;
    min-height: 120px;
  }
  .score-heading {
    top: 7px;
  }
  .staff-box > svg {
    max-height: 23dvh;
  }
  .stage[data-content="exercise"] .staff-box {
    max-height: 25dvh;
  }
  .note {
    font-size: 30px;
  }
  .note-wrap {
    min-height: 36px;
  }
  .hint {
    font-size: 11px;
  }
  .score-tools,
  .score-tools button {
    min-height: 30px;
  }
  .transport button {
    min-height: 44px;
  }
  .note-wrap[data-running="true"][data-ring="on"] {
    min-height: 44px;
  }
  .ring {
    width: 64px;
    height: 64px;
  }
  .listen-panel {
    padding: 6px 10px;
  }
  #listen-start-hint {
    display: none;
  }
  .bar--bottom {
    gap: 3px;
  }
  .pace-toolbar {
    display: none;
  }
  .key-hint {
    position: absolute;
    z-index: 2;
    bottom: 90px;
    left: 16px;
    right: 16px;
  }
  .timers {
    font-size: 11px;
  }
}
@media (min-width: 761px) and (max-height: 650px) {
  .practice-bar {
    flex-direction: row;
    align-items: center;
  }
  .staff-box > svg {
    max-height: 35dvh;
  }
  .note-wrap {
    min-height: 38px;
  }
  .stage {
    flex-direction: column;
  }
  .practice-heading p {
    font-size: 12px;
  }
}
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
    scroll-behavior: auto !important;
  }
}
/* Notation classes used by the SVG engraver, including dark-mode accidentals. */
.staff__clef--filled,
.staff__dot,
.staff__accidental,
.score__accidental {
  fill: var(--ink);
  stroke: none;
}
.staff__accidental,
.score__accidental {
  font-family: Georgia, "Times New Roman", serif;
  font-size: 18px;
}
.staff__stem,
.score__stem {
  stroke-width: 1.7;
  stroke-linecap: round;
}
.score__barline {
  stroke: var(--staff);
  stroke-width: 1;
}
.score__head--hollow {
  fill: none;
  stroke: var(--ink);
  stroke-width: 1.8;
}
.score__head--active {
  fill: var(--accent);
}
.score__head--active.score__head--hollow {
  fill: none;
  stroke: var(--accent);
}
.score__rest-stroke {
  fill: none;
  stroke: var(--ink);
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.score__rest--active {
  fill: var(--accent);
}
.score__rest-stroke--active {
  stroke: var(--accent);
}
.input-symbol {
  display: none;
}
@media (max-width: 400px) {
  .topbar {
    flex-wrap: nowrap;
    gap: 3px;
  }
  .brand svg {
    width: 22px;
  }
  .main-nav .nav-button {
    padding-inline: 6px;
  }
  .connection {
    width: 38px;
    height: 40px;
    justify-content: center;
    padding: 0;
  }
  .connection #connection-label {
    display: none;
  }
  .input-symbol {
    display: block;
  }
  .input-symbol svg {
    width: 18px;
    height: 18px;
  }
  .header-actions {
    gap: 0;
  }
  .header-actions .icon-btn {
    width: 38px;
    min-width: 38px;
  }
}
@media (max-height: 650px) {
  .stage .hint {
    display: none;
  }
  .stage[data-display="name"] .note {
    font-size: 64px;
  }
}
@media (min-width: 761px) and (max-height: 650px) {
  .stage:not([data-display="name"]) {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 180px;
    grid-template-rows: minmax(0, 1fr) auto;
    column-gap: 20px;
    padding: 28px 24px 12px;
  }
  .stage .staff-box {
    grid-column: 1;
    grid-row: 1/3;
    height: 100%;
    width: 100%;
    max-height: none;
  }
  .stage .staff-box > svg {
    max-height: 100%;
    height: 100%;
    width: 100%;
  }
  .stage .note-wrap {
    grid-column: 2;
    grid-row: 1;
    align-self: end;
  }
  .stage .next-up {
    grid-column: 2;
    grid-row: 2;
    justify-content: center;
  }
  .stage .tones {
    grid-column: 2;
    grid-row: 2;
  }
  .stage[data-display="staff"] {
    grid-template-columns: 1fr;
  }
  .stage[data-display="staff"] .next-up {
    grid-column: 1;
    position: absolute;
    right: 18px;
    bottom: 12px;
  }
  .stage[data-content="exercise"] .staff-box {
    max-height: none;
  }
  .stage .progress {
    position: absolute;
    bottom: 5px;
    left: 24px;
    width: calc(100% - 48px);
  }
}
@media (max-width: 600px) {
  .topbar {
    flex-wrap: nowrap;
    gap: 8px;
  }
  .connection {
    width: 44px;
    height: 44px;
    justify-content: center;
    padding: 0;
  }
  .connection #connection-label,
  .connection .connection-dot {
    display: none;
  }
  .input-symbol {
    display: block;
  }
  .input-symbol svg {
    width: 18px;
    height: 18px;
  }
  .header-actions .icon-btn {
    width: 44px;
    min-width: 44px;
  }
  .header-actions {
    gap: 0;
  }
  #mode:has([data-mode="exercise"]:not([hidden])) {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
@media (max-width: 380px) {
  .topbar .brand {
    display: none;
  }
  .topbar {
    gap: 3px;
  }
  .header-actions {
    margin-left: auto;
  }
}
.field + button {
  margin-top: 14px;
}
/* Keep system cutouts clear at every breakpoint, including installed iPhones. */
.app {
  padding-top: max(var(--page-top, 12px), env(safe-area-inset-top));
  padding-right: max(var(--page-x, 24px), env(safe-area-inset-right));
  padding-bottom: max(var(--page-bottom, 16px), env(safe-area-inset-bottom));
  padding-left: max(var(--page-x, 24px), env(safe-area-inset-left));
}
@media (max-width: 760px) {
  .app {
    --page-top: 10px;
    --page-x: 16px;
    --page-bottom: 12px;
  }
}
@media (max-width: 380px) {
  .app {
    --page-x: 10px;
  }
}
@media (max-height: 650px) {
  .app {
    --page-top: 6px;
    --page-bottom: 8px;
  }
}
