:root {
  --primary-1: #8dcf8a;
  --primary-2: #5aac56;
  --primary-3: #328a2e;
  --primary-4: #156711;
  --primary-5: #034500;
  --secondary-1: #73ac97;
  --secondary-2: #489074;
  --secondary-3: #267356;
  --secondary-4: #0e563b;
  --secondary-5: #003924;
  --warm-1: #ffc4aa;
  --warm-2: #d48b6a;
  --warm-3: #aa5c39;
  --warm-4: #803615;
  --warm-5: #551a00;
  --complement-1: #fda8ab;
  --complement-2: #d3696c;
  --complement-3: #a8383b;
  --complement-4: #7e1518;
  --complement-5: #540002;
  --bg-1: #f0f0f0;
  --bg-2: #e2e2e2;
  --ink: #202020;
  --ink-soft: #5a5a5a;
  --accent: #3f3f3f;
  --accent-2: #aa5c39;
  --card: #ffffffee;
  --white-key: #fafafa;
  --white-key-border: #b0b0b0;
  --black-key: #1a1a1a;
  --selected-key: #d48b6a;
  --scale-highlight-white: #eef5ec;
  --scale-highlight-black-top: #4a4f4a;
  --scale-highlight-black-bottom: #2f342f;
  --scale-frame-white: #6da261;
  --scale-frame-black: #9ccc8d;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Manrope", sans-serif;
  color: var(--ink);
  background: #efefef;
}

.app-shell {
  width: 95vw;
  margin: 0 auto;
  padding: 1rem 0 2rem;
}

.layout-columns {
  display: grid;
  grid-template-columns: minmax(0, 2fr) minmax(280px, 1fr);
  gap: 1rem;
  align-items: start;
}

.layout-columns.keyboard-expanded {
  grid-template-columns: minmax(0, 1fr);
}

.layout-columns.keyboard-expanded .right-column {
  display: none;
}

.left-column,
.right-column {
  display: grid;
  gap: 1rem;
  min-width: 0;
}

@media (max-width: 1180px) {
  .layout-columns {
    grid-template-columns: minmax(0, 1fr) minmax(210px, 0.82fr);
    gap: 0.8rem;
  }

  .right-column {
    font-size: 0.92rem;
    gap: 0.75rem;
  }

  .right-column .card {
    padding: 0.75rem 0.85rem;
    border-radius: 13px;
  }

  .right-column button {
    padding: 0.5rem 0.65rem;
    font-size: 0.78rem;
  }

  .right-column .audio-toggle,
  .right-column .naming-mode,
  .right-column .midi-status,
  .right-column #history-select {
    font-size: 0.78rem;
  }

  .right-column .naming-mode select,
  .right-column .naming-mode input {
    padding: 0.28rem 0.42rem;
  }

  .right-column .history-list li {
    width: 126px;
  }

  .keyboard {
    height: 238px;
    padding: 0.58rem;
  }

  .key.white {
    width: 50px;
  }

  .key.black {
    width: 31px;
    margin-left: -16px;
    margin-right: -16px;
  }

  .note-label {
    font-size: 0.67rem;
  }
}

@media (max-width: 980px) {
  .layout-columns {
    grid-template-columns: minmax(0, 1fr) minmax(185px, 0.72fr);
    gap: 0.65rem;
  }

  .right-column {
    font-size: 0.86rem;
  }

  .right-column .card {
    padding: 0.62rem 0.68rem;
  }

  .right-column .history-list li {
    width: 118px;
  }

  .keyboard {
    height: 224px;
    padding: 0.5rem;
  }

  .key.white {
    width: 46px;
  }

  .key.black {
    width: 29px;
    margin-left: -15px;
    margin-right: -15px;
  }

  .note-label {
    font-size: 0.63rem;
  }
}

.card {
  background: var(--card);
  border: 1px solid #c8c8c8;
  border-radius: 16px;
  padding: 1rem 1.25rem;
  box-shadow: 0 12px 24px #00000014;
}

.hero h1 {
  font-family: "Space Grotesk", sans-serif;
  font-size: clamp(1.3rem, 3vw, 2rem);
  margin: 0.2rem 0 0.6rem;
  line-height: 1.2;
}

.eyebrow,
.label {
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--ink-soft);
  margin: 0;
}

.subtext {
  margin: 0;
  color: var(--ink-soft);
}

.result-card {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: center;
  flex-wrap: wrap;
}

.result-inline {
  padding-bottom: 0.25rem;
  margin-bottom: 0.25rem;
  border-bottom: 1px solid #dddddd;
}

.result-inline .meta {
  min-width: 220px;
}

.result {
  margin: 0.3rem 0 0;
  font-family: "Space Grotesk", sans-serif;
  font-size: clamp(1.25rem, 4vw, 2.4rem);
  line-height: 1.1;
  color: var(--accent);
  min-height: clamp(1.45rem, 4.4vw, 2.7rem);
  max-height: clamp(1.45rem, 4.4vw, 2.7rem);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.result.result-tip {
  font-family: "Manrope", sans-serif;
  font-size: clamp(0.9rem, 1.8vw, 1.08rem);
  font-weight: 700;
  line-height: 1.3;
  max-width: 26ch;
}

.notes {
  margin: 0.3rem 0 0;
  font-size: 1rem;
}

.controls {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.45rem 0.65rem;
  align-items: center;
}

.right-column .controls {
  align-content: flex-start;
}

.options-card {
  padding: 0.62rem 0.75rem;
}

.options-panel {
  width: 100%;
}

.options-panel > summary {
  cursor: pointer;
}

.options-panel > .controls {
  margin-top: 0.42rem;
}

.history-panel {
  width: 100%;
}

.history-panel > summary {
  cursor: pointer;
}

.history-panel-content {
  margin-top: 0.42rem;
  display: grid;
  gap: 0.5rem;
}

.controls > .label {
  grid-column: 1 / -1;
}

.controls > .naming-mode {
  font-size: 0.84rem;
  gap: 0.35rem;
}

.controls > .naming-mode select {
  padding: 0.28rem 0.42rem;
  font-size: 0.8rem;
}

button {
  border: 0;
  border-radius: 10px;
  padding: 0.7rem 1rem;
  background: #4c4c4c;
  color: #f6fff4;
  font-weight: 700;
  cursor: pointer;
}

#midi-connect-btn {
  background: #3f3f3f;
}

#midi-send-btn {
  background: #3f3f3f;
}

#midi-debug-c4-btn {
  background: #3f3f3f;
}

button:hover {
  filter: brightness(1.06);
}

.key-hint {
  display: inline-block;
  margin-left: 0.35rem;
  padding: 0.08rem 0.32rem;
  border: 1px solid #d6dfd3;
  border-radius: 6px;
  background: #f2f7f0;
  color: #36503a;
  font-size: 0.66em;
  font-weight: 800;
  line-height: 1.1;
  vertical-align: middle;
  white-space: nowrap;
}

.audio-toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  color: var(--ink-soft);
  font-weight: 600;
  font-size: 0.84rem;
}

.audio-toggle input {
  margin: 0;
}

.naming-mode {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  color: var(--ink-soft);
  font-weight: 700;
}

.naming-mode select {
  border: 1px solid #bdbdbd;
  border-radius: 8px;
  background: #f7f7f7;
  color: var(--ink);
  padding: 0.35rem 0.55rem;
  font-weight: 700;
  font-family: "Manrope", sans-serif;
}

.naming-mode input {
  width: 84px;
  border: 1px solid #bdbdbd;
  border-radius: 8px;
  background: #f7f7f7;
  color: var(--ink);
  padding: 0.35rem 0.55rem;
  font-weight: 700;
  font-family: "Manrope", sans-serif;
}

.midi-status {
  margin: 0;
  color: var(--ink-soft);
  font-weight: 700;
}

#midi-connect-btn,
.midi-debug-panel {
  grid-column: 1 / -1;
}

#midi-connect-btn {
  padding: 0.52rem 0.72rem;
  font-size: 0.82rem;
}

#midi-ports-status {
  font-size: 0.82rem;
  font-weight: 600;
}

#midi-connect-btn.connected {
  background: #2f6a35;
}

#midi-connect-btn.pending {
  background: #555555;
}

#midi-connect-btn.error {
  background: #7b3a2b;
}

.midi-debug-panel {
  width: 100%;
  border: 1px solid #c8c8c8;
  border-radius: 10px;
  background: #f7f7f7;
  padding: 0.35rem 0.45rem;
}

.midi-debug-panel summary {
  cursor: pointer;
  font-weight: 700;
  font-size: 0.84rem;
  color: var(--ink-soft);
}

.midi-debug-content {
  margin-top: 0.42rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.42rem;
  align-items: center;
}

.chord-builder {
  display: grid;
  gap: 0.8rem;
}

.chord-builder-row {
  display: flex;
  gap: 0.6rem;
  flex-wrap: wrap;
  align-items: center;
}

.chord-input-wrap {
  position: relative;
  flex: 0 1 390px;
  min-width: 220px;
}

#chord-name-input {
  width: 100%;
  border: 1px solid #bdbdbd;
  border-radius: 10px;
  background: #f8f8f8;
  color: var(--ink);
  padding: 0.7rem 0.8rem;
  font-weight: 700;
  font-family: "Space Grotesk", sans-serif;
}

.chord-suggestions {
  position: absolute;
  top: calc(100% + 0.35rem);
  left: 0;
  right: 0;
  margin: 0;
  padding: 0.3rem;
  list-style: none;
  border: 1px solid #bdbdbd;
  border-radius: 10px;
  background: #f8f8f8;
  box-shadow: 0 14px 28px #00000016;
  max-height: 240px;
  overflow-y: auto;
  z-index: 8;
  display: none;
}

.chord-suggestions.visible {
  display: grid;
  gap: 0.2rem;
}

.chord-suggestion-item {
  display: flex;
  justify-content: space-between;
  gap: 0.5rem;
  border-radius: 8px;
  padding: 0.4rem 0.5rem;
  cursor: pointer;
}

.chord-suggestion-item:hover,
.chord-suggestion-item.active {
  background: #e7e7e7;
}

.chord-suggestion-name {
  font-family: "Space Grotesk", sans-serif;
  font-weight: 700;
}

.chord-suggestion-meta {
  color: #666666;
  font-size: 0.82rem;
  align-self: center;
}

#show-chord-btn {
  background: #4c4c4c;
}

.history-card {
  display: grid;
  gap: 0.5rem;
}

.harmony-card {
  display: grid;
  gap: 0.45rem;
}

.harmony-panel {
  width: 100%;
}

.harmony-panel > summary {
  cursor: pointer;
}

.harmony-panel-content {
  margin-top: 0.42rem;
  display: grid;
  gap: 0.45rem;
}

.harmony-controls-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
}

.harmony-style {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  color: var(--ink-soft);
  font-size: 0.78rem;
  font-weight: 700;
}

.harmony-style select {
  border: 1px solid #bdbdbd;
  border-radius: 7px;
  background: #f7f7f7;
  color: var(--ink);
  padding: 0.28rem 0.42rem;
  font-size: 0.74rem;
  font-weight: 700;
  font-family: "Manrope", sans-serif;
}

.harmonic-cadences {
  display: grid;
  gap: 0.26rem;
}

.harmonic-cadence-btn {
  border: 1px solid #b9c5b7;
  border-radius: 8px;
  background: #eef4ec;
  color: #35503a;
  padding: 0.33rem 0.45rem;
  font-size: 0.7rem;
  line-height: 1.1;
  text-align: left;
}

.harmonic-current {
  margin: 0;
  font-size: 0.8rem;
  color: var(--ink-soft);
  font-weight: 700;
}

.harmonic-suggestion-groups {
  display: grid;
  gap: 0.35rem;
}

.harmonic-group {
  display: grid;
  gap: 0.24rem;
}

.harmonic-group-title {
  margin: 0;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: #6b6b6b;
  font-weight: 800;
}

.harmonic-group-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.26rem;
}

.harmonic-suggestion-btn {
  border: 1px solid #c2c2c2;
  border-radius: 8px;
  background: #efefef;
  color: #404040;
  padding: 0.34rem 0.46rem;
  font-size: 0.72rem;
  line-height: 1;
}

.harmonic-suggestion-btn.recommended {
  border-color: #7d9872;
  background: #edf4ea;
}

.harmonic-suggestion-btn.active {
  border-color: #3a5633;
  background: #466a3f;
  color: #f6fff4;
}

.circle-fifths-row {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 0.35rem;
  align-items: center;
}

.circle-fifths-row button {
  padding: 0.35rem 0.42rem;
  font-size: 0.7rem;
  background: #404040;
}

.circle-insight {
  margin: 0;
  font-size: 0.74rem;
  color: #666666;
  text-align: center;
  font-weight: 700;
}

.harmonic-modulation-hint {
  margin: 0;
  font-size: 0.72rem;
  color: #6a6a6a;
  font-weight: 700;
}

.history-actions {
  display: grid;
  grid-template-columns: auto auto minmax(110px, 1fr) auto auto auto;
  gap: 0.35rem;
  align-items: center;
}

#history-clear-btn,
#history-save-btn,
#history-load-btn,
#history-delete-saved-btn,
#history-export-btn {
  padding: 0.5rem 0.6rem;
  font-size: 0.78rem;
  line-height: 1.1;
}

#history-clear-btn {
  grid-column: 1;
}

#history-save-btn {
  grid-column: 2;
}

#history-load-btn {
  grid-column: 4;
}

#history-select {
  grid-column: 3;
  border: 1px solid #bdbdbd;
  border-radius: 8px;
  background: #f7f7f7;
  color: var(--ink);
  padding: 0.4rem 0.45rem;
  font-weight: 700;
  font-size: 0.8rem;
  font-family: "Manrope", sans-serif;
  min-width: 0;
  width: min(170px, 100%);
  justify-self: start;
}

.history-storage-status {
  margin: 0;
  font-size: 0.76rem;
  color: var(--ink-soft);
}

#history-delete-saved-btn {
  grid-column: 5;
}

#history-export-btn {
  grid-column: 6;
}

.history-list {
  margin: 0;
  padding: 0;
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  align-items: stretch;
  gap: 0.3rem;
}

.history-list li {
  width: 140px;
  padding: 0.28rem 0.38rem;
  border-radius: 7px;
  border: 1px solid #c8c8c8;
  background: #f8f8f8;
  font-family: "Space Grotesk", sans-serif;
}

.history-list li.history-entry-latest {
  border-color: #bf886f;
  background: #f2e4dc;
}

.history-list li.history-empty {
  width: 100%;
}

.history-entry {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.35rem;
  width: 100%;
}

.history-label {
  flex: 1;
  text-align: left;
  background: transparent;
  color: var(--ink);
  padding: 0.12rem 0;
  border-radius: 0;
  font-size: 0.88rem;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.history-label:hover {
  filter: none;
  color: #222222;
}

.history-delete {
  width: 1.2rem;
  height: 1.2rem;
  min-width: 1.2rem;
  padding: 0;
  border-radius: 999px;
  border: 1px solid #b2b2b2;
  background: #dfdfdf;
  color: #5b5b5b;
  font-size: 0.85rem;
  font-weight: 700;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.history-delete:hover {
  filter: none;
  background: #d3d3d3;
  color: #444444;
}

.staff-history-hitbox {
  fill: transparent;
  stroke: transparent;
  cursor: pointer;
}

.staff-history-hitbox:hover {
  fill: #8f8f8f1a;
}

.staff-insert-line {
  stroke: #4f7a49;
  stroke-width: 2;
  stroke-linecap: round;
  pointer-events: none;
}

.staff-chord-label {
  fill: #6a6a6a;
  font-family: "Space Grotesk", sans-serif;
  font-size: 10px;
  font-weight: 600;
  text-anchor: middle;
  pointer-events: none;
}

.staff-chord-label.highlighted {
  fill: #a54a20;
  font-weight: 700;
}

.keyboard-wrap {
  overflow-x: auto;
  padding-bottom: 0.5rem;
}

.voicing-suggestions-panel {
  display: flex;
  align-items: center;
  gap: 0.32rem;
  margin-bottom: 0.48rem;
  min-height: 1.9rem;
  flex-wrap: nowrap;
  overflow-x: auto;
  overflow-y: hidden;
  padding-bottom: 0.1rem;
}

.voicing-suggestions-panel.hidden {
  display: none;
}

.voicing-suggestion-title {
  margin: 0;
  font-size: 0.68rem;
  color: #666666;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  font-weight: 800;
  white-space: nowrap;
}

.voicing-suggestion-btn {
  border: 1px solid #c2c2c2;
  border-radius: 8px;
  background: #efefef;
  color: #404040;
  padding: 0.24rem 0.34rem;
  font-size: 0.68rem;
  line-height: 1;
  white-space: nowrap;
}

.voicing-undo-btn {
  font-weight: 800;
  width: 1.9rem;
  padding: 0.24rem 0;
  text-align: center;
}

.voicing-suggestion-btn:hover {
  filter: none;
  background: #e5e5e5;
}

.keyboard-toolbar {
  display: flex;
  gap: 0.38rem;
  margin-bottom: 0.6rem;
  flex-wrap: nowrap;
  align-items: center;
  overflow-x: auto;
  overflow-y: hidden;
  scrollbar-width: thin;
}

#inversion-left-btn,
#inversion-right-btn {
  background: #474747;
  padding: 0.4rem 0.58rem;
  font-size: 0.74rem;
  line-height: 1;
}

#pause-detection-toggle {
  background: #3c4f3a;
  padding: 0.4rem 0.58rem;
  font-size: 0.74rem;
  line-height: 1;
}

#pause-detection-toggle.active {
  background: #8f4a2e;
}

#expand-keyboard-toggle {
  background: #3f3f3f;
  padding: 0.4rem 0.58rem;
  font-size: 0.74rem;
  line-height: 1;
  margin-left: auto;
}

#expand-keyboard-toggle.active {
  background: #36623a;
}

#inversion-left-btn:disabled,
#inversion-right-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.scale-picker {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  color: var(--ink-soft);
  font-weight: 700;
  font-size: 0.74rem;
  white-space: nowrap;
}

.scale-picker select {
  border: 1px solid #bdbdbd;
  border-radius: 8px;
  background: #f7f7f7;
  color: var(--ink);
  padding: 0.24rem 0.38rem;
  font-weight: 700;
  font-size: 0.72rem;
  font-family: "Manrope", sans-serif;
  width: 7.2rem;
}

.scale-highlight-inline {
  font-size: 0.72rem;
  white-space: nowrap;
}

.scale-degree-buttons {
  display: inline-flex;
  gap: 0.22rem;
  align-items: center;
  flex-wrap: wrap;
}

.degree-btn {
  border: 1px solid #b8b8b8;
  border-radius: 7px;
  padding: 0.24rem 0.34rem;
  font-size: 0.68rem;
  line-height: 1;
  background: #efefef;
  color: #454545;
  min-width: 1.7rem;
}

.degree-btn.active {
  background: #3f633f;
  border-color: #335333;
  color: #f6fff4;
}

.keyboard {
  position: relative;
  width: max-content;
  min-width: 100%;
  height: 260px;
  display: flex;
  padding: 0.7rem;
  border-radius: 18px;
  background: linear-gradient(180deg, #e6e6e6 0%, #cfcfcf 100%);
  border: 1px solid #b7b7b7;
}

.staff-panel {
  margin-top: 0.8rem;
  border: 1px solid #bcbcbc;
  border-radius: 14px;
  background: #f7f7f7;
  padding: 0.3rem;
}

#staff-svg {
  width: 100%;
  min-height: 250px;
  display: block;
  overflow-x: auto;
  overflow-y: hidden;
}

#staff-svg svg {
  width: auto;
  min-width: 100%;
  height: auto;
  display: block;
}

.staff-line {
  stroke: #8a8a8a;
  stroke-width: 1.2;
}

.staff-divider {
  stroke: #9a9a9a;
  stroke-width: 1;
  stroke-dasharray: 5 6;
}

.staff-label {
  fill: #555;
  font-family: "Space Grotesk", sans-serif;
  font-size: 13px;
  font-weight: 700;
}

.staff-clef {
  fill: #3f3f3f;
  font-family: "Noto Music", "Bravura", "Petaluma", "Times New Roman", "Segoe UI Symbol", serif;
}

.staff-clef.treble {
  letter-spacing: -0.08em;
}

.staff-note {
  fill: #1f1f1f;
}

.staff-note.selected {
  fill: #1f1f1f;
}

.staff-note.latest {
  fill: #a54a20;
}

.staff-accidental {
  fill: #4d4d4d;
  font-family: "Space Grotesk", sans-serif;
  font-size: 16px;
  font-weight: 700;
}

.staff-key-accidental {
  fill: #666666;
  font-size: 15px;
}

.staff-accidental-latest {
  fill: #8c3c19;
}

.ledger-line {
  stroke: #6e6e6e;
  stroke-width: 1.3;
}

.ledger-line-latest {
  stroke: #9a4b24;
}

.key {
  position: relative;
  border: 1px solid var(--white-key-border);
  border-bottom: 4px solid #9c9c9c;
  border-radius: 0 0 8px 8px;
  cursor: pointer;
  user-select: none;
  touch-action: none;
  transition: transform 100ms ease, background-color 100ms ease, box-shadow 120ms ease, border-color 120ms ease;
}

.key.white {
  width: 54px;
  height: 100%;
  background: var(--white-key);
  margin-right: 2px;
}

.key.black {
  width: 34px;
  height: 64%;
  background: linear-gradient(180deg, #3a3a3a, var(--black-key));
  border-color: #111111;
  border-bottom-color: #090909;
  border-radius: 0 0 6px 6px;
  margin-left: -18px;
  margin-right: -18px;
  z-index: 3;
}

.layout-columns.keyboard-expanded .keyboard {
  height: 208px;
  padding: 0.56rem;
}

.layout-columns.keyboard-expanded .key.white {
  width: 45px;
  margin-right: 0;
}

.layout-columns.keyboard-expanded .key.black {
  width: 28px;
  margin-left: -16px;
  margin-right: -16px;
}

.key.selected.white {
  background: linear-gradient(180deg, #fff4ed, var(--selected-key));
}

.key.selected.black {
  background: linear-gradient(180deg, #d48b6a, #803615);
  border-color: #551a00;
}

.key.in-scale.white {
  border-color: #8bb086;
  box-shadow: inset 0 0 0 4.5px #8ab884;
}

.key.in-scale.black {
  border-color: var(--scale-frame-black);
  box-shadow: inset 0 0 0 3px #a7d69a;
}

.key.in-scale.white:not(.selected) {
  background: linear-gradient(180deg, #ffffff, var(--scale-highlight-white));
}

.key.in-scale.black:not(.selected) {
  background: linear-gradient(180deg, var(--scale-highlight-black-top), var(--scale-highlight-black-bottom));
}

.key.in-scale.selected.white {
  background: linear-gradient(180deg, #f7fff4, #8dbd84);
}

.key.in-scale.selected.black {
  background: linear-gradient(180deg, #89b47d, #3e5f38);
}

.key:active {
  transform: translateY(2px);
}

.midi-press-indicator {
  position: absolute;
  bottom: 8px;
  left: 50%;
  width: 9px;
  height: 9px;
  margin-left: -4.5px;
  border-radius: 999px;
  background: #2d72d9;
  border: 1px solid #dfe8ff;
  box-shadow: 0 0 0 1px #1d4f9a;
  opacity: 0;
  transform: scale(0.8);
  transition: opacity 90ms ease, transform 90ms ease;
  pointer-events: none;
}

.key.black .midi-press-indicator {
  bottom: 8px;
}

.key.midi-pressed .midi-press-indicator {
  opacity: 1;
  transform: scale(1);
}

.note-label {
  position: absolute;
  bottom: 8px;
  left: 0;
  right: 0;
  text-align: center;
  font-size: 0.72rem;
  color: #5d5d5d;
  font-weight: 700;
}

.scale-fingering-label {
  position: absolute;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  text-align: center;
  font-size: 0.58rem;
  line-height: 1;
  font-weight: 800;
  letter-spacing: 0.01em;
  color: #111111;
  text-shadow: 0 1px 0 #ffffffb3;
  padding: 0;
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
}

.key.has-scale-fingering .scale-fingering-label {
  opacity: 1;
}

.key.black .scale-fingering-label {
  bottom: 18px;
  font-size: 0.52rem;
  color: #ffffff;
  text-shadow: 0 1px 0 #000000cc;
}

.keyboard.hide-note-labels .scale-fingering-label {
  bottom: 7px;
}

.keyboard.hide-note-labels .note-label {
  display: none;
}

.key.black .note-label {
  color: #f2f2f2;
}

@media (max-width: 720px) {
  .app-shell {
    width: 94vw;
  }

  .layout-columns {
    grid-template-columns: 1fr;
  }

  .controls {
    grid-template-columns: 1fr;
    align-items: flex-start;
  }

  .history-actions {
    grid-template-columns: 1fr 1fr;
  }

  #history-clear-btn,
  #history-save-btn,
  #history-select,
  #history-load-btn,
  #history-delete-saved-btn,
  #history-export-btn {
    grid-column: auto;
  }

  .key.white {
    width: 44px;
  }

  .key.black {
    width: 28px;
    margin-left: -15px;
    margin-right: -15px;
  }

  .keyboard {
    height: 210px;
    padding: 0.46rem;
  }

  .note-label {
    font-size: 0.6rem;
    bottom: 6px;
  }

  .scale-fingering-label {
    font-size: 0.5rem;
    bottom: 20px;
  }

  .key.black .scale-fingering-label {
    bottom: 16px;
  }

  #chord-name-input {
    min-width: 100%;
  }

  .chord-input-wrap {
    min-width: 100%;
  }
}
