:root {
  color-scheme: light;
  --ink: #171717;
  --muted: #606060;
  --line: #d6d6d6;
  --surface: #fff;
  --bg: #f4f4f4;
}
.control-tooltip {
  position: fixed;
  z-index: 10000;
  inset: auto;
  width: max-content;
  max-width: min(280px, calc(100vw - 16px));
  margin: 0;
  padding: 7px 10px;
  border: 1px solid #171717;
  border-radius: 4px;
  background: #171717;
  color: #fff;
  font:
    12px/1.6 -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    sans-serif;
  white-space: pre-line;
  overflow-wrap: anywhere;
  text-align: left;
  pointer-events: auto;
}
.control-tooltip[hidden] {
  display: none;
}
* {
  box-sizing: border-box;
}
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font:
    13px -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    sans-serif;
}
button,
.button,
input,
select {
  font: inherit;
}
button,
.button {
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 8px 12px;
  background: #fff;
  color: var(--ink);
  cursor: pointer;
  white-space: nowrap;
}
button:hover,
.button:hover {
  background: #eee;
  border-color: #999;
}
.primary,
button[aria-pressed="true"] {
  background: #171717;
  color: #fff;
  border-color: #171717;
}
.primary:hover {
  background: #333;
}
button[hidden] {
  display: none;
}
:focus-visible {
  outline: 2px solid #171717;
  outline-offset: 3px;
}
input,
select {
  border: 1px solid var(--line);
  background: #fff;
  color: #171717;
  padding: 7px;
  border-radius: 4px;
  max-width: 100%;
}
input[type="number"] {
  width: 70px;
}
input[type="range"] {
  accent-color: #171717;
}
header {
  height: 56px;
  background: #fff;
  border-bottom: 1px solid var(--line);
  padding: 0 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.brand {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 16px;
  letter-spacing: 2px;
  font-weight: 700;
}
.brand span {
  font-size: 12px;
  letter-spacing: 0;
  font-weight: 400;
  color: var(--muted);
  margin-left: 6px;
}
.brand img {
  flex: none;
}
main {
  padding: 0 24px;
  max-width: 1800px;
  margin: auto;
}
nav,
.transport {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
main > nav {
  min-height: 60px;
  border-bottom: 1px solid var(--line);
  margin: 0;
}
.transport {
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
  gap: 12px;
}
.transport label {
  display: flex;
  gap: 7px;
  align-items: center;
  color: var(--muted);
  font-size: 12px;
}
#position {
  margin-left: auto;
  font-variant-numeric: tabular-nums;
  font-family: monospace;
}
.workspace {
  background: #fff;
  margin-top: 16px;
  border: 1px solid var(--line);
  border-radius: 5px;
  overflow: hidden;
}
.section-heading {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 12px 18px;
  border-bottom: 1px solid var(--line);
}
h1 {
  font-size: 14px;
  font-weight: 600;
  margin: 0;
}
#noteCount {
  font-size: 11px;
  color: var(--muted);
  margin-left: auto;
}
.score-scroll {
  overflow: auto;
  background: #fff;
}
#staff {
  display: block;
  height: 180px;
}
#roll {
  height: 125px;
  position: relative;
  overflow: hidden;
  background: #f4f4f4;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}
.fall {
  position: absolute;
  background: #595959;
  border-radius: 2px;
}
.hit-line {
  position: absolute;
  bottom: 15px;
  height: 2px;
  background: #171717;
  width: 100%;
}
.workspace > nav {
  padding: 10px 18px;
  margin: 0;
}
.workspace > nav button {
  font-size: 12px;
  padding: 6px 10px;
}
#editor:not(:empty) {
  border-top: 1px solid var(--line);
  padding: 12px 18px;
}
.note-edit {
  display: flex;
  gap: 12px;
  align-items: end;
  flex-wrap: wrap;
}
.note-edit label {
  font-size: 11px;
  color: var(--muted);
  display: grid;
  gap: 5px;
}
svg .note {
  cursor: pointer;
}
#status {
  padding: 8px 0;
  min-height: 30px;
  font-size: 12px;
  color: var(--muted);
}
.instrument {
  position: sticky;
  bottom: 0;
  background: #fff;
  border: 1px solid var(--line);
  border-bottom: 0;
  border-radius: 5px 5px 0 0;
  padding: 12px 12px 0;
  z-index: 5;
}
.piano-toolbar {
  display: flex;
  align-items: center;
  gap: 20px;
  margin-bottom: 12px;
  flex-wrap: wrap;
}
.piano-toolbar strong {
  font-size: 13px;
  font-weight: 600;
}
.piano-toolbar strong span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 400;
  margin-left: 8px;
}
.placement-controls {
  display: flex;
  gap: 6px;
  margin-left: auto;
}
.placement-controls button {
  font-size: 12px;
  padding: 6px 10px;
}
.placement-hint {
  margin: 0 0 10px;
  font-size: 12px;
  color: #444;
}
.placement-hint:empty {
  display: none;
}
.keyboard-scroll {
  overflow-x: auto;
  overflow-y: hidden;
}
#keyboard {
  position: relative;
  height: 168px;
  min-width: 1100px;
}
.key {
  position: absolute;
  top: 0;
  padding: 0;
  border-radius: 0 0 3px 3px;
  touch-action: none;
  user-select: none;
}
.white {
  height: 160px;
  background: #fff;
  color: #171717;
  border-color: #a3a3a3;
  z-index: 1;
}
.black {
  height: 100px;
  background: #171717;
  color: #fff;
  border-color: #000;
  z-index: 2;
}
.key.white:hover {
  background: #eee;
}
.key.black:hover {
  background: #333;
}
.key.active,
.key.active:hover {
  background: #737373;
  color: #fff;
}
.key.target {
  border-bottom: 7px solid #737373;
}
.key span {
  position: absolute;
  bottom: 10px;
  left: 0;
  right: 0;
  font-size: 9px;
  line-height: 1.6;
}
.key.black span {
  font-size: 8px;
}
.start-marker {
  position: absolute;
  left: 0;
  right: 0;
  top: 108px;
  font-size: 9px;
  writing-mode: vertical-rl;
  letter-spacing: 1px;
  margin: auto;
  height: 42px;
  width: 12px;
}
.black .start-marker {
  top: 8px;
  height: 45px;
}
.range-start.white {
  border-bottom: 3px solid #171717;
}
.range-start.black {
  border-bottom: 3px solid #888;
}
.placing .key {
  cursor: crosshair;
}
.placing .key:hover {
  outline: 2px dashed #737373;
  outline-offset: -3px;
}
.settings > summary {
  list-style: none;
  padding: 7px 12px;
  border: 1px solid var(--line);
  border-radius: 4px;
  cursor: pointer;
  font-size: 12px;
}
.settings[open] > summary {
  background: #171717;
  color: #fff;
}
.settings aside {
  position: absolute;
  right: 24px;
  top: 52px;
  background: #fff;
  border: 1px solid var(--line);
  padding: 20px;
  width: 290px;
  z-index: 20;
  max-height: calc(100vh - 70px);
  overflow: auto;
}
.settings label {
  display: block;
  margin: 0 0 16px;
  font-size: 12px;
  color: var(--muted);
}
.settings label input,
.settings label select {
  display: block;
  width: 100%;
  margin-top: 7px;
}
h3 {
  font-size: 13px;
  margin: 18px 0 12px;
}
hr {
  border: 0;
  border-top: 1px solid var(--line);
  margin-top: 20px;
}
#keyEditor {
  font-size: 12px;
  line-height: 1.7;
  margin-bottom: 12px;
}
#keyEditor label {
  margin: 10px 0;
}
#keyEditor input {
  width: 100%;
}
@media (min-height: 950px) {
  #roll {
    height: 220px;
  }
  #staff {
    height: 220px;
  }
}
@media (max-width: 700px) {
  header {
    padding: 0 12px;
  }
  .brand span {
    display: none;
  }
  main {
    padding: 0 10px;
  }
  main > nav {
    padding: 10px 0;
  }
  .piano-toolbar {
    gap: 10px;
  }
  .placement-controls {
    margin-left: 0;
  }
  .settings aside {
    right: 12px;
  }
  .instrument {
    padding: 10px 6px 0;
  }
  .transport {
    gap: 7px;
  }
  #staff {
    height: 150px;
  }
  .workspace > nav {
    padding: 8px;
  }
  #roll {
    height: 100px;
  }
}

.key .key-binding {
  font-size: 11px;
  bottom: 28px;
}
.key .octave-label {
  font-size: 9px;
  bottom: 8px;
  color: #666;
}
.black .key-binding {
  font-size: 10px;
  bottom: 12px;
}
.start-marker {
  top: 12px;
  height: auto;
  writing-mode: horizontal-tb;
  letter-spacing: 0;
}
.black .start-marker {
  top: 8px;
  height: auto;
}

#recordState {
  font-size: 11px;
  font-variant-numeric: tabular-nums;
  color: #555;
}
.key .key-binding {
  white-space: normal;
  overflow-wrap: anywhere;
  line-height: 1.4;
}

.notation-tools {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 18px;
  border-top: 1px solid var(--line);
  flex-wrap: wrap;
}
#durations {
  display: flex;
  gap: 3px;
}
#durations button {
  min-width: 32px;
  padding: 5px 8px;
}
#rest {
  padding: 5px 10px;
}
.section-heading #meter {
  padding: 3px 7px;
  font-size: 12px;
}
.note-edit label[hidden] {
  display: none;
}

header {
  gap: 12px;
}
.brand {
  margin-right: auto;
}
.shortcuts > summary {
  list-style: none;
  padding: 7px 12px;
  border: 1px solid var(--line);
  border-radius: 4px;
  cursor: pointer;
  font-size: 12px;
}
.shortcut-panel {
  position: absolute;
  right: 24px;
  top: 52px;
  background: #fff;
  border: 1px solid var(--line);
  width: 420px;
  max-width: calc(100vw - 24px);
  max-height: calc(100vh - 70px);
  overflow: auto;
  padding: 20px;
  z-index: 25;
}
.shortcut-panel h2 {
  font-size: 13px;
  margin: 0 0 12px;
}
.shortcut-panel h2:not(:first-child) {
  margin-top: 22px;
}
.shortcut-panel p {
  font-size: 12px;
  line-height: 1.9;
  margin: 8px 0;
  color: #505050;
}
.shortcut-panel dl {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  font-size: 12px;
}
.shortcut-panel dt {
  font-weight: 500;
}
.shortcut-panel dd {
  margin: 0;
  color: #505050;
}
.cursor-line {
  pointer-events: none;
}
.settings[open] > summary,
.shortcuts[open] > summary {
  background: #171717;
  color: #fff;
}

.notation-tools {
  background: #fafafa;
  border-top: 0;
  border-bottom: 1px solid var(--line);
  padding: 10px 18px;
  gap: 12px;
  align-items: center;
}
.notation-tools > strong {
  font-size: 12px;
  white-space: nowrap;
}
#durations {
  gap: 4px;
  flex-wrap: wrap;
}
#durations button {
  display: grid;
  grid-template-columns: 22px auto;
  grid-template-rows: auto auto;
  column-gap: 5px;
  align-items: center;
  padding: 6px 9px;
  min-width: 76px;
  text-align: left;
}
#durations .duration-symbol {
  grid-row: 1/3;
  display: flex;
  align-items: center;
  height: 35px;
  overflow: visible;
}
#durations .music {
  font-size: 27px;
  line-height: 1;
}
#durations button > span:not(.duration-symbol) {
  font-size: 11px;
}
kbd {
  font:
    10px ui-monospace,
    monospace;
  color: #666;
}
button[aria-pressed="true"] kbd {
  color: #ddd;
}
#rest {
  display: grid;
  grid-template-columns: 22px auto;
  align-items: center;
  gap: 2px 6px;
  padding: 6px 10px;
  text-align: left;
}
#rest > .music {
  font-size: 28px;
  line-height: 1;
  grid-row: 1/3;
}
#rest > span:not(.music) {
  font-size: 11px;
}
#rest > kbd {
  grid-column: 2;
}
.note.rest {
  cursor: pointer;
}
.score-scroll {
  border-bottom: 1px solid var(--line);
}
.chord-stem {
  stroke-width: 1.2;
}
@media (max-width: 700px) {
  .notation-tools {
    padding: 10px;
    gap: 8px;
  }
  .notation-tools > strong {
    flex-basis: 100%;
  }
  #durations button {
    min-width: 65px;
    padding: 5px 7px;
  }
}

#durations {
  flex: 1;
  min-width: 0;
}
#durations button {
  grid-template-columns: 22px max-content;
}
#durations kbd {
  font-size: 9px;
}
#rest {
  flex-shrink: 0;
}

.settings-tabs {
  display: flex;
  gap: 4px;
  border-bottom: 1px solid var(--line);
  padding-bottom: 8px;
  margin-bottom: 12px;
}
.settings-tabs button {
  font-size: 12px;
  padding: 5px 8px;
  border-color: transparent;
}
.settings-tabs [aria-selected="true"] {
  background: #171717;
  color: #fff;
}
.settings.show-shortcuts aside {
  width: 350px;
}
.shortcut-row {
  display: grid;
  grid-template-columns: 45px repeat(3, 1fr);
  align-items: center;
  gap: 4px;
  padding: 4px 0;
  border-bottom: 1px solid #eee;
}
.shortcut-row strong {
  font-size: 12px;
  font-weight: 500;
}
.shortcut-row button {
  font-size: 11px;
  padding: 4px 6px;
  border-radius: 3px;
}
.settings-actions {
  display: flex;
  gap: 6px;
  margin-top: 12px;
}
.settings-actions button {
  font-size: 11px;
  padding: 6px 8px;
}
#shortcutStatus {
  font-size: 11px;
  color: #555;
  min-height: 16px;
  margin: 8px 0 0;
}
.settings [role="tabpanel"][hidden] {
  display: none;
}
#performanceStatus {
  padding: 10px 14px;
  border-bottom: 1px solid var(--line);
  display: flex;
  gap: 16px;
  align-items: center;
  font-size: 12px;
}
#performanceStatus[hidden] {
  display: none;
}
#practiceState {
  font-weight: 600;
  min-width: 80px;
}
#practiceSummary {
  margin-left: auto;
  font-variant-numeric: tabular-nums;
  color: #555;
}
.notehead.practice-wrong {
  stroke: #b91c1c;
}
.notehead.practice-wrong[data-hollow="false"],
.rest.practice-wrong {
  fill: #b91c1c;
}
.chord-stem.practice-wrong,
.note-stem.practice-wrong {
  stroke: #b91c1c;
}
.notehead.practice-holding {
  stroke-width: 2;
}
.playhead {
  pointer-events: none;
}
#metroPulse {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #c9c9c9;
  display: inline-block;
}
#metroPulse.beat-on {
  background: #171717;
}
button:disabled,
input:disabled,
select:disabled,
.button:has(input:disabled) {
  opacity: 0.45;
  cursor: default;
}
.button:has(input:disabled) {
  pointer-events: none;
}
.performing #staff .note {
  cursor: default;
}
.transport {
  padding: 9px 0;
  gap: 8px;
}
.transport button {
  padding: 7px 10px;
}
.notation-tools {
  padding: 6px 12px;
  gap: 8px;
}
#durations button {
  padding: 4px 6px;
  min-width: 68px;
}
#durations .music {
  font-size: 24px;
}
#durations .duration-symbol {
  height: 30px;
}
#rest {
  padding: 4px 8px;
}
#rest > .music {
  font-size: 25px;
}
#status:empty {
  min-height: 0;
  padding: 0;
}
.section-heading {
  padding: 9px 14px;
}
.workspace > nav {
  padding: 7px 12px;
}
@media (max-width: 700px) {
  .settings.show-shortcuts aside {
    width: min(350px, calc(100vw - 24px));
  }
  #performanceStatus {
    gap: 8px;
    flex-wrap: wrap;
  }
  #practiceSummary {
    margin-left: 0;
  }
}

.ui-icon {
  display: block;
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  pointer-events: none;
}
.icon-button {
  display: inline-flex !important;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 6px !important;
  min-width: 30px;
  min-height: 30px;
  vertical-align: middle;
  line-height: 1;
}
.icon-button .icon-caption {
  font-size: 11px;
  line-height: 1;
  pointer-events: none;
}
.settings-tabs .ui-icon {
  width: 15px;
  height: 15px;
}
.settings-tabs .icon-button {
  padding: 5px 7px !important;
}
.settings-actions .icon-button {
  min-width: 30px;
}
.shortcuts > summary.icon-button,
.settings > summary.icon-button {
  list-style: none;
  padding: 6px !important;
}
.shortcuts > summary::-webkit-details-marker,
.settings > summary::-webkit-details-marker {
  display: none;
}
.transport .icon-button {
  padding: 6px !important;
}
.piano-toolbar .icon-button {
  padding: 5px 7px !important;
}
.workspace > nav .icon-button {
  padding: 5px !important;
  min-width: 28px;
  min-height: 28px;
}
.notation-tools #rest {
  grid-template-columns: 24px;
  padding: 4px 8px;
  gap: 2px;
  justify-items: center;
  min-width: 40px;
}
.notation-tools #rest > .music {
  grid-row: auto;
  font-size: 25px;
  height: 25px;
  line-height: 1;
}
.notation-tools #rest > kbd {
  grid-column: 1;
  font-size: 9px;
}
main > nav {
  min-height: 46px;
  gap: 6px;
}
.transport {
  gap: 7px;
}
.settings-actions {
  gap: 6px;
}
.note-edit .icon-button {
  align-self: end;
}
#keyEditor .icon-button {
  margin-top: 4px;
}
.icon-button[hidden] {
  display: none !important;
}
/* Keep the piano in normal flow so it never covers score editing controls. */
.instrument {
  position: relative;
  bottom: auto;
  margin-top: 8px;
}
@media (max-height: 850px) and (min-width: 701px) {
  header {
    height: 44px;
  }
  main > nav {
    min-height: 40px;
  }
  .transport {
    padding: 6px 0;
  }
  .workspace {
    margin-top: 10px;
  }
  #roll {
    height: 64px;
  }
  .instrument {
    padding-top: 8px;
  }
  .piano-toolbar {
    margin-bottom: 8px;
  }
  #performanceStatus {
    padding: 7px 12px;
  }
}
/* Compact controls, progressive detail, and explicit keyboard focus. */
.settings aside,
.settings.show-shortcuts aside {
  width: min(380px, calc(100vw - 24px));
  padding: 14px;
  box-shadow: 0 6px 20px #00000014;
}
.settings-tabs {
  gap: 2px;
  justify-content: space-between;
}
.settings label {
  margin: 12px 0;
}
.settings label input {
  margin-top: 5px;
}
.settings label input[type="range"] {
  padding: 0;
  height: 22px;
}
.settings h3 {
  margin: 12px 0 8px;
}
fieldset {
  border: 0;
  padding: 0;
  margin: 10px 0 14px;
  min-width: 0;
}
legend {
  font-size: 12px;
  color: #555;
  margin-bottom: 8px;
}
#presets {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 5px;
}
#presets button {
  padding: 7px 8px;
  font-size: 12px;
  text-align: left;
  min-height: 30px;
}
#audioState,
.setting-note {
  font-size: 11px;
  color: #606060;
  line-height: 1.6;
}
#audioState {
  display: block;
  margin-top: 7px;
}
.setting-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 12px 0;
  font-size: 12px;
}
.setting-row button {
  font-size: 11px;
  min-width: 52px;
  padding: 5px 8px;
}
.segments {
  display: flex;
  gap: 3px;
}
.segments button {
  flex: 1;
  padding: 6px;
  min-height: 30px;
}
.range-row {
  display: flex;
  align-items: center;
  gap: 12px;
}
.range-row label {
  margin: 0;
}
.range-row input {
  width: 90px !important;
}
.range-row button {
  align-self: end;
}
#practiceSettings label:has(input[type="number"]) {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
#practiceSettings input[type="number"] {
  width: 85px;
  margin: 0;
}
#practiceSettings .range-row label {
  display: grid;
  gap: 4px;
}
#draftState {
  margin-left: auto;
  font-size: 11px;
  color: #606060;
}
#emptyScore {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px;
  border-bottom: 1px solid var(--line);
  font-size: 12px;
}
#emptyScore span {
  color: #606060;
}
#emptyScore[hidden],
#roll[hidden] {
  display: none;
}
#triplet {
  font:
    12px ui-monospace,
    monospace;
  padding: 6px;
  min-width: 36px;
  min-height: 30px;
}
#staff {
  max-height: none;
  min-height: 180px;
}
.score-scroll {
  scroll-behavior: auto;
}
#roll {
  height: 64px;
}
.fall {
  border: 1px solid #fff;
}
.icon-button:focus-visible,
summary:focus-visible {
  outline: 2px solid #171717;
  outline-offset: 3px;
}
button[aria-pressed="true"]:focus-visible {
  outline-offset: 3px;
}
.black:focus-visible {
  outline-color: #737373;
  outline-offset: 2px;
}
.show-labels .icon-button:not([data-caption])::after {
  content: attr(aria-label);
  font-size: 11px;
  max-width: 145px;
  overflow: hidden;
  text-overflow: ellipsis;
}
.show-labels .settings-tabs .icon-button::after {
  display: none;
}
.show-labels .transport,
.show-labels nav {
  row-gap: 6px;
}
.practice-wrong {
  stroke-dasharray: 2 1;
}
.assessment-mark {
  fill: #b91c1c;
  font-size: 12px;
  font-weight: 700;
  pointer-events: none;
}
.note[role="button"]:focus {
  outline: none;
  stroke-width: 3;
}
.note.rest:focus {
  paint-order: stroke;
  stroke: #888;
  stroke-width: 0.7;
}
.note-edit input {
  min-height: 30px;
}
.key {
  min-width: 0;
}
.shortcut-row button {
  min-height: 28px;
}
.transport input,
.transport select {
  padding: 5px;
  min-height: 30px;
}
.settings-tabs [role="tab"] {
  min-height: 30px;
}
.settings-tabs [role="tab"]:focus-visible {
  outline-offset: 1px;
}
@media (max-width: 700px) {
  #emptyScore {
    flex-wrap: wrap;
    padding: 10px;
  }
  #emptyScore span {
    flex-basis: 100%;
  }
  .settings aside {
    top: 52px;
  }
  #draftState {
    font-size: 10px;
  }
  .brand {
    font-size: 14px;
  }
  .transport {
    column-gap: 5px;
  }
  .transport label {
    gap: 4px;
  }
  .transport input[type="number"] {
    width: 58px;
  }
  .notation-tools #durations {
    flex-basis: calc(100% - 60px);
  }
  .notation-tools > strong {
    flex-basis: 100%;
  }
  #durations button {
    min-width: 64px;
  }
  .score-scroll {
    max-width: 100%;
  }
}
@media (prefers-reduced-motion: reduce) {
  * {
    scroll-behavior: auto !important;
    animation: none !important;
    transition: none !important;
  }
}
.keyboard-bed {
  min-width: 1100px;
}
#keyboard {
  min-width: 0;
}
#roll {
  border: 0;
  border-bottom: 1px solid #999;
  background: #f4f4f4;
}
.hit-line {
  bottom: 0;
}
#roll .fall {
  border-radius: 1px;
}
.instrument {
  padding-top: 8px;
}
.keyboard-scroll #roll {
  height: 64px;
}
.keyboard-scroll {
  border-top: 1px solid var(--line);
}
.keyboard-bed #keyboard {
  height: 166px;
}
.settings {
  position: static;
}
#draftState {
  max-width: 45%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.piano-toolbar {
  gap: 12px;
}
.piano-toolbar #quickSound {
  border-color: transparent;
}
.piano-toolbar #quickSound .icon-caption {
  font-size: 11px;
  color: #555;
}
#quickSound .ui-icon {
  width: 15px;
  height: 15px;
}
.piano-toolbar .placement-controls {
  margin-left: auto;
}
.score-beam.practice-wrong {
  stroke: #b91c1c;
}
.range-value {
  float: right;
  font:
    11px ui-monospace,
    monospace;
  color: #555;
}
.settings aside {
  isolation: isolate;
}
.key.custom-key::after {
  content: "";
  position: absolute;
  top: 5px;
  right: 3px;
  width: 3px;
  height: 3px;
  border-radius: 50%;
  background: #888;
  pointer-events: none;
}
@media (max-width: 700px) {
  .notation-tools {
    display: grid;
    grid-template-columns: 1fr auto auto;
    gap: 6px;
    padding: 8px 10px;
  }
  .notation-tools > strong {
    grid-column: 1;
    grid-row: 1;
  }
  .notation-tools #rest {
    grid-column: 2;
    grid-row: 1;
    display: flex;
    gap: 5px;
    min-height: 30px;
    padding: 3px 7px;
  }
  .notation-tools #rest > .music {
    height: 25px;
  }
  .notation-tools #triplet {
    grid-column: 3;
    grid-row: 1;
  }
  .notation-tools #durations {
    grid-column: 1/4;
    grid-row: 2;
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 4px;
    width: 100%;
  }
  #durations button {
    min-width: 0;
    grid-template-columns: 18px minmax(0, 1fr);
    grid-template-rows: 24px auto;
    column-gap: 3px;
    padding: 4px;
  }
  #durations .duration-symbol {
    grid-column: 1;
    grid-row: 1;
    height: 24px;
  }
  #durations button > span:not(.duration-symbol) {
    grid-column: 2;
    grid-row: 1;
    font-size: 11px;
  }
  #durations kbd {
    grid-column: 1/3;
    grid-row: 2;
    font-size: 8px;
    white-space: nowrap;
    text-align: center;
  }
}

/* Compact, progressive audio import. */
#transcribeDialog {
  width: min(620px, calc(100vw - 32px));
  max-height: calc(100dvh - 40px);
  box-sizing: border-box;
  padding: 18px;
  border: 1px solid #999;
  border-radius: 6px;
  color: #222;
  background: #fff;
  overflow: auto;
}
#transcribeDialog::backdrop {
  background: rgb(0 0 0 / 35%);
}
.transcribe-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.transcribe-heading h2 {
  margin: 0;
  font-size: 18px;
}
#transcribeDialog p {
  margin: 10px 0;
  font-size: 13px;
}
#transcribeDialog .muted,
#transcribeDialog small {
  color: #595959;
  font-size: 12px;
  line-height: 1.5;
}
#transcribeDialog small {
  display: block;
  margin-top: 6px;
}
.audio-source,
.audio-fields {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}
.audio-source {
  margin: 14px 0 10px;
}
#audioName {
  font-size: 12px;
  overflow-wrap: anywhere;
  min-width: 0;
}
#audioOriginal {
  width: 100%;
  height: 36px;
  margin-bottom: 8px;
}
#transcribeDialog fieldset {
  border: 1px solid #ddd;
  border-radius: 4px;
  padding: 10px;
  margin: 10px 0;
  min-width: 0;
}
#transcribeDialog legend {
  font-size: 12px;
  padding: 0 4px;
}
.audio-fields label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
}
.audio-fields input[type="number"] {
  width: 74px;
  min-height: 30px;
  box-sizing: border-box;
}
.audio-fields input[type="range"] {
  width: 110px;
}
#transcribeDialog button,
#transcribeDialog .button {
  min-height: 30px;
}
#transcribeDialog button[aria-pressed="true"] {
  color: white;
  background: #222;
  border-color: #222;
}
#audioGrid {
  margin: 12px 0;
  font-size: 12px;
}
#audioProgressArea {
  display: flex;
  align-items: center;
  gap: 10px;
}
#audioProgress {
  flex: 1;
  min-width: 0;
  accent-color: #333;
}
#audioPreview {
  width: 100%;
  height: 80px;
  background: #f5f5f5;
  margin-top: 10px;
}
#audioPreview rect {
  fill: #333;
}
#transcribeDialog details summary {
  font-size: 12px;
  cursor: pointer;
  margin: 6px 0;
}
#transcribeDialog [hidden] {
  display: none !important;
}
@media (max-width: 480px) {
  #transcribeDialog {
    padding: 12px;
  }
  .audio-fields {
    gap: 6px;
  }
}

#scoreDialog {
  width: min(900px, calc(100vw - 32px));
  max-height: calc(100dvh - 40px);
  overflow: auto;
  box-sizing: border-box;
  padding: 18px;
  border: 1px solid #999;
  border-radius: 6px;
  background: #fff;
  color: #222;
}
#scoreDialog::backdrop {
  background: rgb(0 0 0 / 35%);
}
#scoreDialog p,
#scoreDialog li {
  font-size: 12px;
  line-height: 1.55;
}
#scoreDialog .muted,
#scoreDialog small {
  color: #595959;
}
#scoreDialog small {
  display: block;
  font-size: 12px;
  margin-top: 8px;
}
#scoreDialog [hidden] {
  display: none !important;
}
#scoreDialog summary,
#scoreDialog legend {
  font-size: 12px;
  cursor: pointer;
}
#scoreDialog summary {
  padding: 6px 0;
}
#scoreDialog fieldset {
  border: 1px solid #ddd;
  padding: 10px;
  margin: 10px 0;
  min-width: 0;
}
#scoreDialog button[aria-pressed="true"] {
  color: #fff;
  background: #222;
  border-color: #222;
}
#scoreDialog button {
  min-height: 30px;
}
#scoreName {
  min-width: 0;
  overflow-wrap: anywhere;
  font-size: 12px;
}
#scoreConnection {
  border-bottom: 1px solid #ddd;
  padding-bottom: 8px;
  margin-bottom: 10px;
}
#scoreToken {
  min-width: 120px;
  max-width: 100%;
  flex: 1;
}
.score-import-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 16px;
}
#scoreOriginal[hidden] + div {
  grid-column: 1/-1;
}
.score-page-tools {
  margin: 6px 0;
}
.score-page-tools input {
  width: 52px !important;
}
#scorePaper {
  max-height: 400px;
  overflow: auto;
  border: 1px solid #ccc;
  background: #f5f5f5;
}
#scorePaper canvas {
  display: block;
  width: 100%;
  height: auto;
}
#scorePaper.zoomed canvas {
  width: 200%;
  max-width: none;
}
#scoreProgressArea {
  display: flex;
  align-items: center;
  gap: 8px;
}
#scoreProgress {
  flex: 1;
  min-width: 0;
  accent-color: #333;
}
#scoreParts,
#scoreMovements {
  margin: 8px 0 12px;
}
#scoreWarnings {
  padding-left: 18px;
}
@media (max-width: 650px) {
  #scoreDialog {
    padding: 12px;
  }
  .score-import-grid {
    grid-template-columns: minmax(0, 1fr);
    gap: 4px;
  }
  #scorePaper {
    max-height: 240px;
  }
}

/* Physical keyboard configuration: compact rows, explicit key and note names. */
.keyboard-range-bar,
.direction-controls,
.keyboard-actions,
.physical-editor-title {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}
.keyboard-range-bar {
  justify-content: space-between;
  font-size: 12px;
}
#keyboardSettings button {
  min-height: 28px;
  padding: 4px 7px;
  font-size: 11px;
}
.direction-controls {
  margin: 8px 0 12px;
}
.direction-controls button {
  flex: 1;
}
#keyboardSettings [aria-pressed="true"] {
  background: #171717;
  color: #fff;
}
#keyboardLanes .keyboard-lane {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 6px 0;
}
#keyboardLanes .keyboard-lane > span {
  flex: 0 0 52px;
  font-size: 11px;
}
.keyboard-row-options {
  flex: 1;
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 3px;
}
.physical-section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 10px 0;
}
.physical-section-head h3 {
  margin: 0;
}
#keyboardSettings .keyboard-row-options button {
  padding: 4px 2px;
  white-space: nowrap;
}
#physicalKeyboard {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.physical-row {
  display: grid;
  grid-template-columns: repeat(13, minmax(0, 1fr));
  gap: 2px;
}
#physicalKeyboard button {
  padding: 4px 0;
  min-width: 0;
  min-height: 39px;
  border-radius: 3px;
  font:
    10px ui-monospace,
    monospace;
}
#physicalKeyboard button span,
#physicalKeyboard button small {
  display: block;
  line-height: 14px;
}
#physicalKeyboard button small {
  font-size: 9px;
  opacity: 0.7;
}
#physicalKeyboard .mapped-black {
  background: #303030;
  color: #fff;
  border-color: #303030;
}
#physicalKeyboard .unmapped {
  background: #f4f4f4;
  color: #777;
  border-style: dashed;
}
#physicalKeyboard [aria-pressed="true"] {
  outline: 2px solid #171717;
  outline-offset: 1px;
  background: #ddd;
  color: #111;
}
#physicalKeyboard .physical-custom {
  text-decoration: underline;
  text-underline-offset: 2px;
}
#physicalEditor {
  margin: 12px 0 8px;
  border-top: 1px solid var(--line);
  padding-top: 10px;
}
.physical-editor-title {
  justify-content: space-between;
  font-size: 12px;
}
.physical-editor-title strong {
  font:
    600 14px ui-monospace,
    monospace;
}
.physical-note-fields {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
#keyboardSettings .physical-note-fields label {
  font-size: 11px;
  margin: 8px 0;
}
#keyboardSettings input {
  min-width: 0;
}
#physicalGroup {
  margin-bottom: 8px;
}
#keyboardStatus {
  font-size: 11px;
  line-height: 1.5;
  margin: 8px 0 0;
}
#keyboardStatus:empty {
  display: none;
}
.settings-tabs {
  flex-wrap: wrap;
}

#notationDialog {
  width: min(640px, calc(100vw - 24px));
  max-height: 85vh;
  overflow: auto;
}
.notation-config {
  padding: 16px;
}
.key-choices {
  display: grid;
  grid-template-columns: repeat(8, minmax(0, 1fr));
  gap: 4px;
  margin: 10px 0;
}
.key-choices button {
  padding: 6px 4px;
  min-width: 0;
}
.repeat-config {
  padding: 8px 0;
  border-bottom: 1px solid #d4d4d4;
  line-height: 2.4;
}
.repeat-config input {
  width: 64px;
  padding: 4px;
}
.repeat-config details {
  font-size: 12px;
  line-height: 2;
}
.ending-config {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-wrap: wrap;
  margin: 5px 0;
}
.ending-config input {
  width: 52px;
}
.accidental-tools {
  display: flex;
  align-items: center;
  gap: 5px;
  margin: 8px 0;
  flex-wrap: wrap;
}
.accidental-tools span {
  min-width: 45px;
  font-weight: 600;
}
#notationError {
  color: #b91c1c;
}
#scoreDiagnostic {
  font-size: 11px;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  max-height: 160px;
  overflow: auto;
}
#notationDialog {
  padding: 0;
  border: 1px solid #999;
  border-radius: 6px;
  color: var(--ink);
  background: var(--surface);
}
#notationDialog::backdrop {
  background: rgb(0 0 0 / 35%);
}
#notationDialog .dialog-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  border-bottom: 1px solid var(--line);
}
#notationDialog h2 {
  margin: 0;
  font-size: 16px;
}
#notationDialog .segmented {
  display: flex;
  gap: 4px;
}
@media (max-width: 480px) {
  .key-choices {
    grid-template-columns: repeat(5, minmax(0, 1fr));
  }
  .repeat-config input {
    width: 48px;
  }
  .notation-config {
    padding: 12px;
  }
}
.pitch-preview {
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 8px 12px;
  margin: 6px 0 10px;
  background: var(--surface);
}
.pitch-preview[hidden] {
  display: none;
}
.pitch-preview-heading {
  display: flex;
  align-items: baseline;
  gap: 12px;
  flex-wrap: wrap;
  font-size: 12px;
}
.pitch-preview-heading output {
  color: var(--muted);
  overflow-wrap: anywhere;
}
.pitch-preview svg {
  display: block;
  width: min(100%, 520px);
  margin: 0 auto;
  overflow: visible;
}
.instrument-views {
  display: flex;
  gap: 2px;
}
.instrument-views button {
  padding: 6px 9px;
}
#pianoKeyboardView[hidden],
#computerKeyboardView[hidden] {
  display: none;
}
.computer-keyboard-scroll {
  overflow-x: auto;
  border-top: 1px solid var(--line);
  background: #f4f4f4;
}
.computer-board {
  width: min(100%, 1000px);
  min-width: 650px;
  margin: 0 auto;
  padding: 14px 12px;
}
.computer-row {
  display: grid;
  gap: 5px;
  margin-bottom: 5px;
}
.computer-row:last-child {
  margin-bottom: 0;
}
.computer-key {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  min-width: 0;
  height: 52px;
  padding: 4px 2px;
  font-size: 15px;
  border: 1px solid #999;
  border-bottom-width: 3px;
  background: #fff;
  color: #171717;
  touch-action: none;
  user-select: none;
}
.computer-key small {
  font-size: 10px;
  opacity: 0.75;
}
.computer-row.function .computer-key {
  height: 36px;
  gap: 1px;
  font-size: 11px;
}
.computer-key.black {
  background: #171717;
  color: #fff;
  border-color: #444;
}
.computer-key.white {
  background: #fff;
  color: #171717;
}
.computer-key.unmapped {
  background: #e7e7e7;
  color: #777;
  border-color: #ccc;
  border-style: dashed;
  border-bottom-width: 1px;
  cursor: default;
}
.computer-key.white:hover {
  background: #eee;
}
.computer-key.black:hover {
  background: #333;
}
.computer-key.active {
  transform: translateY(2px);
  border-bottom-width: 1px;
  outline: 2px solid #777;
  outline-offset: -5px;
}
.computer-key.target::after {
  content: "";
  position: absolute;
  right: 4px;
  top: 4px;
  width: 5px;
  height: 5px;
  border: 1px solid currentColor;
  border-radius: 50%;
  background: currentColor;
}

/* Small source/attribution links stay outside the music workspace. */
a.icon-button {
  color: var(--ink, #171717);
  text-decoration: none;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: #fff;
}
a.icon-button:hover {
  background: #eee;
}
.site-footer {
  display: flex;
  justify-content: flex-end;
  gap: 14px;
  padding: 14px 24px;
  font-size: 11px;
  color: var(--muted);
}
.site-footer a {
  color: inherit;
  text-underline-offset: 3px;
}
.credits-page main {
  max-width: 760px;
  padding: 32px 24px;
  line-height: 1.7;
}
.credits-page h1 {
  font-size: 24px;
  margin: 24px 0 16px;
}
.credits-page h2 {
  font-size: 18px;
  margin-top: 24px;
}
.credits-page a {
  color: #222;
  text-underline-offset: 3px;
}
.credits-page dt {
  font-weight: 600;
  margin-top: 16px;
}
.credits-page dd {
  margin: 4px 0 0;
}
.credits-page li {
  overflow-wrap: anywhere;
}
