:root {
  color-scheme: dark;
  --bg: #080b0e;
  --panel: #0b0c0e;
  --panel-strong: #121315;
  --control: #160f10;
  --text: #eef4f8;
  --muted: #8d9aaa;
  --line: rgba(255, 114, 94, 0.18);
  --wood-1: #282727;
  --wood-2: #342f2d;
  --wood-3: #1f2021;
  --teal: #39d4b1;
  --teal-soft: rgba(57, 212, 177, 0.18);
  --root: #ff6b52;
  --root-soft: rgba(255, 107, 82, 0.22);
  --played: #efb84f;
  --played-soft: rgba(239, 184, 79, 0.2);
  --fret-height: 74px;
  --marker-height: 36px;
  --label-width: 62px;
  --ui-radius: 12px;
  --radius-lg: 24px;
  --radius-md: 12px;
  --theme: #ff725e;
  --theme-rgb: 255, 114, 94;
  --theme-soft: rgba(255, 114, 94, 0.16);
}

* {
  box-sizing: border-box;
}

html {
  background: var(--bg);
}

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  color: var(--text);
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", sans-serif;
  line-height: 1.5;
}

button,
select,
input {
  font: inherit;
}

button {
  color: inherit;
}

[hidden] {
  display: none !important;
}

.topbar {
  display: grid;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 20px 22px;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  backdrop-filter: none;
  grid-template-columns: minmax(300px, 0.76fr) minmax(650px, 2fr);
  border-color: var(--line);
  margin: 0 -22px;
  border-bottom: 1px solid rgba(210, 216, 222, 0.12);
  min-height: 98px;
  border-bottom-color: rgba(var(--theme-rgb), 0.18);
}

.brand {
  position: relative;
  display: flex;
  align-items: center;
  gap: 18px;
  min-width: 260px;
}

.brand > div {
  margin-left: 0;
}

.brand h1 {
  margin: 0;
  color: #edf4f6;
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont,
    "PingFang SC", "Microsoft YaHei", sans-serif;
  font-size: clamp(1.24rem, 2vw, 1.68rem);
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: -0.025em;
}

.brand p {
  margin: 4px 0 0;
  color: #8f9da7;
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont,
    "PingFang SC", "Microsoft YaHei", sans-serif;
  font-size: 0.9rem;
  font-weight: 400;
  line-height: 1.5;
}

.controls,
.secondary-controls {
  display: flex;
  align-items: end;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 12px;
}

.control {
  display: grid;
  gap: 6px;
  min-width: 112px;
}

.control-wide {
  min-width: 190px;
}

.control-scale {
  min-width: 360px;
}

.control span,
.segment-label,
.meta-label {
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 720;
  letter-spacing: 0.02em;
}

select,
.segment,
.settings-toggle {
  min-height: 44px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: var(--radius-md);
  background: var(--control);
  transition: border-color 150ms ease, background 150ms ease, color 150ms ease, transform 150ms ease;
}

select {
  width: 100%;
  color: var(--text);
  padding: 0 36px 0 12px;
  outline: none;
}

.scale-select {
  font-size: 0.82rem;
  font-weight: 400;
}

.scale-select optgroup {
  background: #10151a;
  color: var(--played);
  font-weight: 820;
}

.scale-select option {
  background: #10151a;
  color: var(--text);
  font-weight: 400;
}

select:hover,
.segment:hover,
.settings-toggle:hover,
.metronome-toggle:hover {
  border-color: rgba(255, 255, 255, 0.28);
  background: #151b21;
}

select:focus-visible,
.segment:focus-visible,
.settings-toggle:focus-visible,
.metronome-toggle:focus-visible,
.metronome-field input:focus-visible,
.fret-cell:focus-visible {
  outline: 2px solid #ffffff;
  outline-offset: 2px;
  box-shadow: 0 0 0 5px rgba(8, 12, 15, 0.88);
}

.segmented {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 4px;
  margin: 0;
  padding: 0;
  border: 0;
}

.segment-label {
  grid-column: 1 / -1;
  margin-bottom: 2px;
}

.segment {
  min-width: 62px;
  padding: 0 12px;
  color: var(--muted);
  cursor: pointer;
}

.segment:active {
  transform: translateY(1px);
}

.segment.is-active {
  border-color: rgba(69, 222, 208, 0.72);
  background: rgba(69, 222, 208, 0.14);
  color: var(--text);
  box-shadow: inset 0 0 0 1px rgba(69, 222, 208, 0.08);
}

.settings-toggle {
  display: none;
  align-items: center;
  justify-content: space-between;
  padding: 0 13px;
  color: var(--text);
  cursor: pointer;
}

.settings-toggle span {
  transition: transform 150ms ease;
}

.settings-toggle[aria-expanded="true"] span {
  transform: rotate(180deg);
}

.training-surface {
  width: 100%;
  max-width: 1320px;
  margin: 20px auto 0;
}

.info-strip {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 16px;
  padding: 0 4px 12px;
}

.info-strip > div {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.info-strip strong,
.info-strip output {
  color: var(--text);
  font-size: 0.96rem;
  font-weight: 760;
  white-space: nowrap;
}

#scaleNotes {
  overflow: hidden;
  text-overflow: ellipsis;
}

.practice-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 14px;
  padding: 14px 18px 14px 22px;
  min-width: 0;
  border-left: 0;
  position: relative;
  grid-column: 2;
  grid-row: 1;
}

.legend {
  display: flex;
  flex: 1 1 auto;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px 18px;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 650;
}

.legend > span {
  display: inline-flex;
  align-items: center;
  gap: 7px;
}

.legend-dot {
  width: 12px;
  height: 12px;
  border: 1px solid rgba(255, 255, 255, 0.28);
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.08);
}

.legend-pattern {
  border-color: var(--teal);
  background: var(--teal-soft);
}

.legend-root {
  border: 1px solid var(--root);
  background: var(--root-soft);
}

.legend-ghost {
  border-style: dashed;
  background: rgba(12, 16, 19, 0.72);
}

.legend-playing {
  border-color: var(--played);
  background: var(--played-soft);
  box-shadow: 0 0 0 3px rgba(255, 209, 102, 0.1);
}

.metronome-panel {
  display: grid;
  flex: 1 1 auto;
  grid-template-columns: auto auto auto minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  min-width: 0;
  padding: 0;
  border: 0;
  border-radius: var(--radius-md);
  background: transparent;
  width: min(100%, 820px);
  grid-column: auto;
  grid-row: auto;
  align-self: center;
  max-width: 820px;
  margin-left: auto;
}

.metronome-heading {
  display: grid;
  place-items: center;
  min-width: 34px;
}

.metronome-icon {
  width: 27px;
  height: 27px;
  fill: none;
  stroke: var(--teal);
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.metronome-toggle {
  display: grid;
  place-items: center;
  width: 42px;
  min-width: 42px;
  min-height: 38px;
  padding: 0;
  border: 1px solid rgba(69, 222, 208, 0.48);
  border-radius: 9px;
  background: rgba(69, 222, 208, 0.1);
  color: var(--text);
  font-weight: 720;
  cursor: pointer;
}

.metronome-action-icon {
  width: 18px;
  height: 18px;
  fill: currentColor;
}

.metronome-toggle .icon-stop {
  display: none;
}

.metronome-toggle.is-active .icon-play {
  display: none;
}

.metronome-toggle.is-active .icon-stop {
  display: block;
}

.metronome-toggle.is-active {
  border-color: rgba(255, 120, 100, 0.72);
  background: rgba(255, 120, 100, 0.14);
}

.metronome-toggle:disabled {
  cursor: wait;
  opacity: 0.65;
}

.metronome-controls {
  display: grid;
  grid-template-columns: minmax(190px, 1.12fr) minmax(170px, 1fr);
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.metronome-field {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 3px 8px;
  min-width: 0;
}

.metronome-field > span {
  grid-column: 1 / -1;
  color: var(--muted);
  font-size: 0.66rem;
  font-weight: 680;
}

.metronome-field input {
  width: 100%;
  accent-color: var(--teal);
  cursor: pointer;
}

.metronome-field output {
  color: var(--text);
  font-size: 0.76rem;
  font-weight: 720;
  text-align: right;
  white-space: nowrap;
}

.rhythm-control select {
  grid-column: 1 / -1;
  min-height: 36px;
  padding-left: 10px;
  font-size: 0.76rem;
}

.beat-lights {
  display: flex;
  align-items: center;
  gap: 5px;
}

.beat-light {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.16);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.12);
  transition: background 80ms ease, box-shadow 80ms ease, transform 80ms ease;
}

.beat-light.is-active {
  background: var(--played);
  box-shadow: 0 0 0 4px rgba(255, 209, 102, 0.12), 0 0 12px rgba(255, 209, 102, 0.36);
  transform: scale(1.18);
}

.beat-light.is-accent.is-active {
  background: var(--root);
  box-shadow: 0 0 0 4px rgba(255, 120, 100, 0.12), 0 0 12px rgba(255, 120, 100, 0.36);
}

.beat-light.is-secondary-accent.is-active {
  background: #ffad66;
  box-shadow: 0 0 0 4px rgba(255, 173, 102, 0.1), 0 0 12px rgba(255, 173, 102, 0.3);
}

.beat-light.is-active.is-subdivision {
  background: var(--teal);
  box-shadow: 0 0 0 3px rgba(69, 222, 208, 0.1), 0 0 10px rgba(69, 222, 208, 0.28);
  transform: scale(0.94);
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.scroll-hint {
  display: none;
  margin: 0 2px 8px;
  color: var(--muted);
  font-size: 0.75rem;
}

.fretboard-shell {
  overflow-x: auto;
  overscroll-behavior-inline: contain;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: var(--radius-lg);
  background:
    linear-gradient(90deg, rgba(0, 0, 0, 0.18), transparent 8%, transparent 92%, rgba(0, 0, 0, 0.22)),
    linear-gradient(180deg, var(--wood-2), var(--wood-1) 48%, var(--wood-3));
  box-shadow: 0 22px 64px rgba(0, 0, 0, 0.24);
  scrollbar-color: rgba(255, 255, 255, 0.24) transparent;
}

.fretboard {
  position: relative;
  isolation: isolate;
  display: grid;
  width: max-content;
  grid-template-rows: var(--marker-height) repeat(6, var(--fret-height));
}

.fretboard::before {
  content: "";
  position: absolute;
  inset: var(--marker-height) 0 0 var(--label-width);
  background:
    repeating-linear-gradient(15deg, rgba(255, 255, 255, 0.025) 0 2px, transparent 2px 22px),
    linear-gradient(180deg, rgba(255, 255, 255, 0.055), transparent 22%, rgba(0, 0, 0, 0.14));
  pointer-events: none;
  z-index: -1;
}

.corner,
.fret-marker,
.string-label,
.fret-cell {
  min-width: 0;
}

.corner,
.string-label {
  position: sticky;
  left: 0;
  z-index: 3;
  background: rgba(12, 15, 18, 0.9);
  border-right: 5px solid rgba(244, 238, 222, 0.88);
  box-shadow: 7px 0 14px rgba(0, 0, 0, 0.08);
}

.corner {
  grid-column: 1;
  grid-row: 1;
}

.fret-marker {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  color: rgba(245, 247, 248, 0.74);
  font-size: 0.76rem;
  font-weight: 760;
  border-right: 1px solid rgba(255, 255, 255, 0.2);
  background: rgba(0, 0, 0, 0.14);
}

.fret-marker.has-dot::after {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: rgba(245, 247, 248, 0.5);
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.24);
}

.fret-marker.is-octave::after {
  transform: translateY(-5px);
  background: var(--teal);
  box-shadow: 0 10px 0 var(--teal);
}

.string-label {
  display: grid;
  place-items: center;
  color: var(--text);
  font-weight: 820;
}

.string-label small {
  display: block;
  margin-top: 2px;
  color: var(--muted);
  font-size: 0.68rem;
  font-weight: 680;
}

.fret-cell {
  position: relative;
  display: grid;
  place-items: center;
  min-height: var(--fret-height);
  border: 0;
  border-right: 2px solid rgba(224, 232, 240, 0.34);
  background: transparent;
  color: inherit;
  cursor: pointer;
  touch-action: manipulation;
}

.fret-cell[data-fret="0"] {
  background: rgba(0, 0, 0, 0.15);
  border-right-width: 5px;
  border-right-color: rgba(244, 238, 222, 0.92);
}

.fret-cell:hover,
.fret-cell:focus-visible {
  background: rgba(255, 255, 255, 0.065);
}

.fret-cell:focus-visible {
  z-index: 4;
  outline-offset: -4px;
}

.string-line {
  position: absolute;
  left: 0;
  right: 0;
  top: 50%;
  height: var(--string-size);
  transform: translateY(-50%);
  border-radius: 999px;
  background: linear-gradient(180deg, #fbfcfd, #8998a4 55%, #35414a);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.62);
  pointer-events: none;
}

.note-dot {
  position: relative;
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 50%;
  background: rgba(7, 10, 12, 0.72);
  color: var(--text);
  font-size: 0.75rem;
  font-weight: 820;
  opacity: 0;
  transform: scale(0.76);
  transition: opacity 140ms ease, transform 140ms ease, background 140ms ease, border-color 140ms ease, box-shadow 140ms ease;
}

.fret-cell:hover .note-dot,
.fret-cell:focus-visible .note-dot,
.fret-cell.is-scale .note-dot,
.fret-cell.is-playing .note-dot {
  opacity: 1;
  transform: scale(1);
}

.fret-cell.is-scale .note-dot {
  border-color: rgba(69, 222, 208, 0.88);
  background: rgba(12, 58, 56, 0.92);
  box-shadow: 0 0 0 5px rgba(69, 222, 208, 0.09);
}

.fret-cell.is-ghost-scale .note-dot {
  opacity: 0.84;
  transform: scale(0.9);
  border-style: dashed;
  border-color: rgba(255, 255, 255, 0.42);
  background: rgba(10, 13, 16, 0.78);
  color: rgba(245, 247, 248, 0.88);
}

.fret-cell.is-root .note-dot {
  border: 3px double rgba(255, 120, 100, 0.98);
  background: rgba(91, 31, 27, 0.94);
  color: #fff8f5;
  box-shadow: 0 0 0 5px rgba(255, 120, 100, 0.12), 0 0 22px rgba(255, 120, 100, 0.22);
}

.fret-cell.is-playing .note-dot {
  opacity: 1;
  transform: scale(1.08);
  border-color: rgba(255, 209, 102, 1);
  background: rgba(92, 70, 18, 0.96);
  color: #fff8de;
  box-shadow: 0 0 0 7px rgba(255, 209, 102, 0.14), 0 0 28px rgba(255, 209, 102, 0.38);
}

.fret-cell.is-muted .note-dot {
  color: transparent;
}

.status-message {
  margin: 10px 4px 0;
  padding: 9px 12px;
  border: 1px solid rgba(255, 209, 102, 0.28);
  border-radius: var(--radius-md);
  background: rgba(255, 209, 102, 0.08);
  color: #ffe8a3;
  font-size: 0.82rem;
}

.noscript-message {
  position: fixed;
  inset: auto 16px 16px;
  z-index: 20;
  margin: 0;
  padding: 12px 14px;
  border: 1px solid rgba(255, 209, 102, 0.34);
  border-radius: var(--radius-md);
  background: #241f13;
  color: #ffe8a3;
  text-align: center;
}

@media (max-width: 900px) {
  .topbar {
    align-items: stretch;
    flex-direction: column;
  }

  .brand {
    min-width: 0;
  }

  .controls,
  .secondary-controls {
    justify-content: flex-start;
  }

  .control,
  .control-wide {
    flex: 1 1 160px;
  }

  .info-strip {
    grid-template-columns: minmax(0, 1fr) auto;
  }

  .practice-toolbar {
    align-items: stretch;
    flex-direction: column;
  }

  .metronome-panel {
    width: 100%;
    min-width: 0;
  }
}

@media (max-width: 620px) {
  :root {
    --fret-height: 62px;
    --marker-height: 32px;
    --label-width: 54px;
  }

  .topbar {
    gap: 14px;
    padding: 14px;
    border-radius: 14px;
  }

  .brand p {
    font-size: 0.82rem;
  }

  .controls {
    display: grid;
    grid-template-columns: minmax(0, 0.78fr) minmax(0, 1.22fr);
    gap: 10px;
    width: 100%;
  }

  .control,
  .control-wide {
    min-width: 0;
    width: 100%;
  }

  .settings-toggle {
    display: flex;
    grid-column: 1 / -1;
    width: 100%;
  }

  .settings-toggle[aria-expanded="false"] + .secondary-controls {
    display: none;
  }

  .secondary-controls {
    display: grid;
    grid-column: 1 / -1;
    grid-template-columns: 1fr;
    gap: 10px;
    width: 100%;
    padding-top: 2px;
  }

  .secondary-controls .segmented {
    width: 100%;
  }

  .training-surface {
    margin-top: 14px;
  }

  .info-strip {
    grid-template-columns: 1fr;
    gap: 8px;
    padding: 0 2px 10px;
  }

  .info-strip > div {
    grid-column: 1;
    justify-content: space-between;
  }

  #scaleNotes {
    max-width: 72%;
    white-space: normal;
    text-align: right;
  }

  .legend {
    gap: 7px 14px;
  }

  .practice-toolbar {
    display: grid;
    gap: 10px;
    padding: 0 2px 10px;
  }

  .metronome-panel {
    grid-template-columns: auto 1fr auto;
  }

  .metronome-heading {
    grid-column: 1;
    grid-row: 1;
  }

  .metronome-toggle {
    grid-column: 3;
    grid-row: 1;
  }

  .metronome-controls {
    grid-column: 1 / -1;
    grid-row: 2;
    grid-template-columns: 1fr;
  }

  .beat-lights {
    grid-column: 1 / -1;
    grid-row: 3;
    justify-content: center;
  }

  .scroll-hint {
    display: block;
  }

  .fretboard-shell {
    border-radius: 14px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
  }
}



.brand {
  min-width: 0;
  gap: 18px;
}

h1 {
  font-size: clamp(1.24rem, 2vw, 1.68rem);
  font-weight: 700;
}

.brand p {
  color: #8f9da7;
  font-size: 0.9rem;
}

.controls {
  display: grid;
  grid-template-columns: minmax(116px, 0.72fr) minmax(170px, 1fr) minmax(320px, 1.85fr) auto;
  align-items: end;
  gap: 14px;
  width: 100%;
}

.secondary-controls {
  display: contents;
}

.control,
.control-wide,
.control-scale {
  min-width: 0;
  width: 100%;
}

.control span,
.segment-label,
.meta-label {
  color: #8795a6;
  font-size: 0.72rem;
  font-weight: 560;
}

select,
.segment,
.settings-toggle {
  min-height: 46px;
  border-color: rgba(139, 163, 188, 0.17);
  background: rgba(8, 17, 28, 0.74);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.018);
}

select {
  color: #e8eef3;
  font-weight: 430;
}

.scale-select {
  font-size: 0.8rem;
}

.scale-select optgroup,
.scale-select option {
  background: #091522;
}

.segmented {
  align-self: end;
  gap: 6px;
}

.segment {
  min-width: 58px;
  padding: 0 14px;
  font-size: 0.85rem;
  font-weight: 450;
}

.segment.is-active {
  border-color: rgba(57, 212, 177, 0.74);
  background: linear-gradient(180deg, rgba(57, 212, 177, 0.2), rgba(57, 212, 177, 0.1));
  color: #eafff9;
  box-shadow: inset 0 0 0 1px rgba(57, 212, 177, 0.08), 0 7px 20px rgba(20, 120, 99, 0.1);
}

.training-surface {
  width: 100%;
  max-width: none;
  margin-top: 14px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 24px;
  background:
    linear-gradient(180deg, rgba(13, 25, 39, 0.96), rgba(8, 18, 30, 0.97)),
    var(--panel);
  box-shadow: 0 28px 90px rgba(0, 0, 0, 0.25);
}

.practice-dashboard {
  display: grid;
  grid-template-columns: minmax(380px, 1fr) minmax(620px, 880px);
  border: 1px solid rgba(210, 216, 222, 0.12);
  border-radius: var(--ui-radius) var(--ui-radius) 0 0;
  background: linear-gradient(180deg, rgba(20, 21, 23, 0.9), rgba(13, 14, 16, 0.92));
  overflow: hidden;
  grid-template-rows: minmax(86px, auto) auto;
  border-bottom: 0;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.025);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", sans-serif;
}

.info-strip {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-content: center;
  gap: 13px 16px;
  min-width: 0;
  padding: 18px 20px;
  border-right: 1px solid rgba(139, 163, 188, 0.12);
}

.info-strip > div {
  gap: 9px;
}

.info-strip .scale-summary {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  padding-bottom: 12px;
  border-bottom: 1px solid rgba(139, 163, 188, 0.1);
}

.info-strip strong,
.info-strip output {
  font-weight: 650;
}

#scaleNotes {
  color: #f1f5f8;
  font-size: 1.04rem;
  letter-spacing: 0.035em;
}





.metronome-heading {
  min-width: 40px;
  min-height: 42px;
  border: 1px solid rgba(139, 163, 188, 0.14);
  border-radius: 10px;
  background: rgba(8, 17, 28, 0.7);
}

.metronome-icon {
  width: 24px;
  height: 24px;
}

.metronome-toggle {
  width: 44px;
  min-width: 44px;
  min-height: 42px;
  border-color: rgba(255, 107, 82, 0.46);
  background: rgba(255, 107, 82, 0.1);
}

.metronome-controls {
  grid-template-columns: minmax(190px, 1.12fr) minmax(170px, 1fr);
  gap: 16px;
}

.metronome-field > span {
  color: #7e8c9c;
  font-weight: 520;
}

.rhythm-control select {
  border-color: rgba(139, 163, 188, 0.14);
  background: rgba(8, 17, 28, 0.7);
}

.legend {
  grid-column: 1 / -1;
  min-height: 50px;
  padding: 12px 20px;
  border-top: 1px solid rgba(139, 163, 188, 0.11);
  color: #95a3b2;
  font-weight: 480;
}

.legend-dot {
  width: 13px;
  height: 13px;
}

.scroll-hint {
  color: #7f8d9d;
}

.fretboard-shell {
  margin-top: 14px;
  border-color: rgba(239, 184, 79, 0.26);
  border-radius: 20px;
  background:
    linear-gradient(90deg, rgba(0, 0, 0, 0.24), transparent 8%, transparent 92%, rgba(0, 0, 0, 0.25)),
    linear-gradient(180deg, #302d2c, #252526 48%, #1f2021);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.035),
    0 20px 50px rgba(0, 0, 0, 0.24);
}

.fretboard::before {
  background:
    repeating-linear-gradient(15deg, rgba(255, 255, 255, 0.018) 0 2px, transparent 2px 22px),
    linear-gradient(180deg, rgba(255, 255, 255, 0.035), transparent 24%, rgba(0, 0, 0, 0.16));
}

.corner,
.string-label {
  background: rgba(8, 15, 24, 0.96);
  border-right-color: rgba(225, 226, 219, 0.84);
}

.fret-marker {
  color: #a7b2bf;
  font-weight: 560;
  border-right-color: rgba(214, 223, 231, 0.2);
  background: rgba(7, 15, 24, 0.78);
}

.fret-marker.is-octave {
  color: var(--teal);
  background: rgba(57, 212, 177, 0.08);
}

.fret-cell {
  border-right-color: rgba(219, 226, 231, 0.28);
}

.fret-cell[data-fret="12"] {
  background: linear-gradient(90deg, rgba(57, 212, 177, 0.07), rgba(57, 212, 177, 0.14), rgba(57, 212, 177, 0.07));
}

.string-label {
  font-weight: 650;
}

.note-dot {
  width: 34px;
  height: 34px;
  font-weight: 650;
}

.fret-cell.is-scale .note-dot {
  border-color: rgba(57, 212, 177, 0.9);
  background: rgba(12, 61, 54, 0.94);
  box-shadow: 0 0 0 4px rgba(57, 212, 177, 0.08), 0 0 18px rgba(57, 212, 177, 0.12);
}

.fret-cell.is-root .note-dot {
  border-color: rgba(255, 107, 82, 0.98);
  background: rgba(91, 34, 27, 0.95);
  box-shadow: 0 0 0 4px rgba(255, 107, 82, 0.11), 0 0 20px rgba(255, 107, 82, 0.22);
}

@media (max-width: 1200px) {
  .topbar {
    grid-template-columns: 1fr;
    gap: 20px;
  }

  .practice-dashboard {
    grid-template-columns: minmax(300px, 0.78fr) minmax(560px, 1.6fr);
  }

  .metronome-controls {
    grid-template-columns: minmax(160px, 1fr) minmax(150px, 0.9fr);
  }
}

@media (max-width: 1000px) {
  .practice-dashboard {
    grid-template-columns: 1fr;
  }

  .info-strip {
    border-right: 0;
    border-bottom: 1px solid rgba(139, 163, 188, 0.11);
  }

  .legend {
    grid-column: 1;
  }

  .metronome-controls {
    grid-template-columns: minmax(160px, 1fr) minmax(150px, 0.9fr);
  }
}

@media (max-width: 900px) {
  .app-shell {
    padding: 14px;
  }

  .topbar {
    display: grid;
    padding: 20px;
  }

  .controls {
    grid-template-columns: minmax(120px, 0.7fr) minmax(170px, 1fr);
  }

  .secondary-controls {
    display: grid;
    grid-column: 1 / -1;
    grid-template-columns: minmax(280px, 1fr) auto;
    align-items: end;
    gap: 14px;
  }

  .practice-dashboard {
    grid-template-columns: 1fr;
  }

  .info-strip {
    grid-template-columns: minmax(0, 1fr) auto;
    border-right: 0;
    border-bottom: 1px solid rgba(139, 163, 188, 0.11);
  }

  .practice-toolbar {
    display: flex;
    padding: 16px 18px;
  }

  .legend {
    grid-column: 1;
  }

  .metronome-controls {
    grid-template-columns: minmax(160px, 1fr) minmax(150px, 0.9fr);
  }
}

@media (max-width: 620px) {
  .app-shell {
    padding: 10px;
  }

  .topbar,
  .training-surface {
    border-radius: 18px;
  }

  .topbar {
    padding: 16px;
  }

  .controls {
    grid-template-columns: minmax(0, 0.76fr) minmax(0, 1.24fr);
  }

  .secondary-controls {
    grid-template-columns: 1fr;
  }

  .practice-dashboard {
    border-radius: 14px;
  }

  .info-strip {
    grid-template-columns: 1fr;
    padding: 15px;
  }

  .info-strip .scale-summary {
    grid-template-columns: 1fr;
    gap: 5px;
  }

  .info-strip > div {
    justify-content: space-between;
  }

  #scaleNotes {
    max-width: 100%;
    text-align: left;
  }

  .practice-toolbar {
    padding: 14px;
  }

  .metronome-controls {
    grid-template-columns: 1fr;
  }

  .legend {
    padding: 12px 15px;
  }

  .fretboard-shell {
    border-radius: 14px;
  }
}

/* Current outer layout */
.app-shell {
  width: min(calc(100% - 48px), 1600px);
  min-height: calc(100vh - 48px);
  margin: 24px auto;
  padding: 0 22px;
  border: 1px solid rgba(210, 216, 222, 0.14);
  display: flex;
  flex-direction: column;
  border-radius: var(--radius-lg);
  position: relative;
  z-index: 1;
  box-shadow: 0 28px 100px rgba(0, 0, 0, 0.4), inset 0 1px 0 rgba(255, 255, 255, 0.035);
  backdrop-filter: blur(20px) saturate(0.72);
  background: radial-gradient(circle at 8% 0%, rgba(255, 114, 94, 0.075), transparent 25%), linear-gradient(180deg, rgba(29, 21, 22, 0.97), rgba(16, 12, 14, 0.98));
  border-color: rgba(var(--theme-rgb), 0.24);
}



.training-surface {
  margin: 0;
  padding: 14px 0 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

select,
.segment,
.settings-toggle,
.metronome-heading,
.rhythm-control select,
.scale-select optgroup,
.scale-select option {
  background: #0d0e10;
}



.info-strip {
  display: contents;
}

.practice-dashboard .scale-summary {
  grid-column: 1;
  grid-row: 1;
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
  padding: 18px 20px;
  border: 0;
}



.metronome-controls {
  grid-template-columns: minmax(190px, 1.12fr) minmax(170px, 1fr);
  gap: 12px;
}

.legend {
  grid-column: 1 / 3;
  grid-row: 2;
  min-height: 48px;
  padding: 12px 20px;
  border-top: 1px solid rgba(210, 216, 222, 0.1);
  background: transparent;
}

.fretboard {
  width: 100%;
  min-width: var(--fretboard-min-width);
}

.corner,
.string-label {
  background: rgba(9, 9, 9, 0.96);
}

.fret-marker {
  background: rgba(7, 7, 7, 0.78);
}

@media (max-width: 1250px) {
  .practice-dashboard {
    grid-template-columns: minmax(210px, 0.7fr) minmax(0, 2fr) minmax(150px, auto);
  }

  .metronome-controls {
    grid-template-columns: minmax(150px, 1fr) minmax(140px, 0.9fr);
  }
}

@media (max-width: 1050px) {
  .practice-dashboard {
    grid-template-columns: minmax(220px, 0.7fr) minmax(0, 2fr);
    grid-template-rows: auto auto;
  }

  .metronome-panel {
    grid-column: 2;
  }

  .legend {
    grid-column: 1;
  }

}

@media (max-width: 900px) {
  .app-shell {
    width: calc(100% - 28px);
    min-height: calc(100vh - 28px);
    margin: 14px auto;
    padding: 0 16px;
  }

  .topbar {
    margin: 0 -16px;
    padding: 20px;
  }

  .training-surface {
    padding-top: 12px;
  }

  .practice-dashboard {
    grid-template-columns: 1fr;
    grid-template-rows: auto;
  }

  .practice-dashboard .scale-summary,
  .metronome-panel,
  .legend {
    grid-column: 1;
    grid-row: auto;
  }

  .metronome-panel {
    padding: 0;
  }

  .legend {
    padding: 11px 18px;
    border-top: 1px solid rgba(210, 216, 222, 0.1);
  }
}

@media (max-width: 620px) {
  .app-shell {
    width: calc(100% - 20px);
    min-height: calc(100vh - 20px);
    margin: 10px auto;
    padding: 0 10px;
  }

  .topbar {
    margin: 0 -10px;
    padding: 16px;
  }

  .practice-dashboard .scale-summary,
  .legend {
    padding-left: 14px;
    padding-right: 14px;
  }

  .metronome-controls {
    grid-template-columns: 1fr;
  }
}

/* Footer */


.site-footer {
  display: flex;
  width: 100%;
  min-height: 64px;
  margin-top: auto;
  padding: 0 12px;
  align-items: center;
  justify-content: center;
  flex: 0 0 64px;
  color: #9ca3af;
  font-size: 12px;
  line-height: 1.5;
  letter-spacing: 0.01em;
  text-align: center;
}

.site-footer small {
  font: inherit;
}

/* Keep only the inset divider from the final layout layer. */


/* Unified geometry and synchronized metronome motion */
select,
.segment,
.settings-toggle,
.metronome-heading,
.metronome-toggle,
.status-message,
.noscript-message {
  border-radius: var(--ui-radius);
}





.fretboard-shell {
  margin-top: 0;
  border-radius: 0 0 var(--ui-radius) var(--ui-radius);
}



.practice-toolbar::before {
  content: "";
  position: absolute;
  top: 22%;
  bottom: 22%;
  left: 0;
  width: 1px;
  background: rgba(176, 182, 188, 0.13);
  pointer-events: none;
}

.string-line {
  box-shadow: none;
}

.fret-cell.is-root .note-dot {
  border: 1px solid rgba(255, 107, 82, 0.98);
}



.metronome-heading {
  --tick-color: var(--teal);
  grid-column: 1;
  grid-row: 1;
}

.beat-lights {
  grid-column: 2;
  grid-row: 1;
  justify-content: center;
}

.metronome-toggle {
  grid-column: 3;
  grid-row: 1;
}

.metronome-controls {
  grid-column: 4;
  grid-row: 1;
}

.metronome-icon {
  stroke: var(--tick-color);
  transition: stroke 90ms ease, filter 90ms ease;
}

.metronome-needle {
  transform: rotate(var(--needle-angle, 0deg));
  transform-box: fill-box;
  transform-origin: 50% 100%;
  transition: transform 90ms cubic-bezier(0.2, 0.8, 0.2, 1), stroke 90ms ease;
  will-change: transform;
}

.metronome-icon .metronome-body {
  fill: var(--tick-color);
  stroke: none;
}

.metronome-icon .metronome-cutout,
.metronome-icon .metronome-arm,
.metronome-icon .metronome-arm-cutout {
  fill: none;
  stroke-width: 14;
  stroke-linecap: round;
}

.metronome-icon .metronome-cutout,
.metronome-icon .metronome-arm-cutout {
  stroke: #121315;
}

.metronome-icon .metronome-arm {
  stroke: var(--tick-color);
}

.metronome-heading.is-beat {
  --tick-color: var(--played);
}

.metronome-heading.is-accent {
  --tick-color: var(--root);
}

.metronome-heading.is-secondary-accent {
  --tick-color: #ffad66;
}

.metronome-heading.is-subdivision {
  --tick-color: var(--teal);
}

.metronome-heading.is-beat .metronome-icon {
  filter: drop-shadow(0 0 5px color-mix(in srgb, var(--tick-color) 48%, transparent));
}

@media (max-width: 900px) {
  .practice-toolbar::before {
    display: none;
  }

  .practice-dashboard {
    border-bottom: 0;
    border-radius: var(--ui-radius) var(--ui-radius) 0 0;
  }

  .fretboard-shell {
    border-radius: 0 0 var(--ui-radius) var(--ui-radius);
  }
}

@media (max-width: 620px) {
  .metronome-panel {
    grid-template-columns: auto auto 1fr;
  }

  .metronome-heading {
    grid-column: 1;
    grid-row: 1;
  }

  .beat-lights {
    grid-column: 2;
    grid-row: 1;
  }

  .metronome-toggle {
    grid-column: 3;
    grid-row: 1;
    justify-self: end;
  }

  .metronome-controls {
    grid-column: 1 / -1;
    grid-row: 2;
  }
}

/* Matte surface and warm wood finish */




select,
.segment,
.settings-toggle,
.metronome-heading,
.rhythm-control select,
.scale-select optgroup,
.scale-select option {
  background-color: #121315;
}

.fretboard-shell {
  border-color: rgba(198, 152, 91, 0.34);
  background:
    linear-gradient(90deg, rgba(25, 9, 4, 0.2), transparent 7%, transparent 93%, rgba(25, 9, 4, 0.24)),
    linear-gradient(180deg, #684432 0%, #563527 48%, #3d251d 100%);
  box-shadow:
    inset 0 1px 0 rgba(255, 226, 190, 0.09),
    0 20px 54px rgba(0, 0, 0, 0.3);
}

.fretboard::before {
  background:
    repeating-linear-gradient(
      2deg,
      rgba(33, 13, 7, 0.24) 0 2px,
      transparent 2px 7px,
      rgba(255, 221, 177, 0.025) 8px 9px,
      transparent 10px 17px
    ),
    repeating-linear-gradient(
      91deg,
      transparent 0 96px,
      rgba(31, 12, 7, 0.09) 98px 101px,
      transparent 103px 188px
    ),
    linear-gradient(180deg, rgba(255, 255, 255, 0.025), transparent 24%, rgba(29, 11, 6, 0.14));
}

.corner,
.string-label {
  background: rgba(27, 18, 15, 0.96);
}

.fret-marker {
  color: rgba(242, 229, 215, 0.76);
  border-right-color: rgba(228, 222, 214, 0.38);
  background: rgba(50, 31, 24, 0.94);
}

.fret-marker.is-octave {
  background: rgba(50, 31, 24, 0.94);
}

.fret-cell {
  border-right-color: rgba(226, 224, 218, 0.46);
}

.fret-cell[data-fret="0"] {
  background: rgba(24, 14, 11, 0.4);
}

.fret-cell[data-fret="12"] {
  background: transparent;
}

/* Compact summary and metronome split */
/* Aligned metronome controls and a taller joined board status. */


.metronome-panel .metronome-heading {
  display: grid;
  place-items: center;
  align-self: center;
  width: 42px;
  min-width: 42px;
  height: 44px;
  min-height: 44px;
  border: 0;
  background: transparent;
  box-shadow: none;
}

.metronome-panel .metronome-icon {
  width: 30px;
  height: 30px;
}

.metronome-panel .beat-lights {
  align-self: center;
  min-height: 44px;
}

.metronome-panel .metronome-toggle {
  position: relative;
  align-self: center;
  width: 44px;
  min-width: 44px;
  height: 44px;
  min-height: 44px;
  border: 0;
  border-radius: 50%;
  background: transparent;
  box-shadow: none;
}

.metronome-panel .metronome-toggle::before {
  content: "";
  position: absolute;
  inset: 6px;
  border: 1px solid rgba(57, 212, 177, 0.58);
  border-radius: 50%;
  background: rgba(57, 212, 177, 0.1);
}

.metronome-panel .metronome-toggle.is-active::before {
  border-color: rgba(255, 107, 82, 0.76);
  background: rgba(255, 107, 82, 0.13);
}

.metronome-panel .metronome-action-icon {
  position: relative;
  z-index: 1;
  width: 12px;
  height: 12px;
}

.metronome-panel .metronome-controls {
  grid-template-columns: minmax(190px, 1.12fr) minmax(170px, 1fr);
  align-items: center;
  gap: 12px;
}

.metronome-controls .metronome-field {
  position: relative;
  grid-template-rows: 44px;
  align-items: center;
  height: 44px;
  gap: 0 8px;
}

.metronome-controls .metronome-field > span {
  position: absolute;
  bottom: calc(100% + 5px);
  left: 0;
  line-height: 1;
}

.metronome-controls .rhythm-control select,
.metronome-controls .metronome-field input,
.metronome-controls .metronome-field output {
  grid-row: 1;
  align-self: center;
}

.metronome-controls .rhythm-control select {
  min-height: 44px;
}

.metronome-controls .tempo-control {
  grid-template-columns: minmax(0, 1fr) 56px;
}

.metronome-controls .tempo-control input {
  width: 100%;
  height: 44px;
  margin: 0;
}

.metronome-controls .tempo-control output {
  width: 56px;
  text-align: left;
}

.board-status .legend {
  align-self: stretch;
  align-items: center;
}

.board-composite .fretboard-shell {
  position: relative;
  z-index: 1;
  margin-top: -1px;
}

@media (max-width: 1180px) {
  .metronome-panel .metronome-controls {
    grid-template-columns: minmax(170px, 1.05fr) minmax(155px, 1fr);
  }
}

@media (max-width: 620px) {
  .metronome-panel .metronome-controls {
    grid-template-columns: 1fr;
  }

  .board-composite .board-status {
    min-height: 0;
  }
}

/* Three-area composition: frameless toolbar above a joined status and fretboard. */
.training-surface .practice-dashboard {
  grid-template-columns: minmax(380px, 1fr) minmax(620px, 880px);
  grid-template-rows: minmax(104px, auto);
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  overflow: visible;
}

.board-composite {
  margin-top: 0;
  border-radius: var(--ui-radius);
  box-shadow:
    0 30px 70px rgba(0, 0, 0, 0.48),
    0 10px 24px rgba(0, 0, 0, 0.34),
    0 0 30px rgba(198, 152, 91, 0.07);
}

.board-status {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  align-items: center;
  min-height: 52px;
  border: 1px solid rgba(210, 216, 222, 0.12);
  border-bottom: 0;
  border-radius: var(--ui-radius) var(--ui-radius) 0 0;
  background: linear-gradient(180deg, rgba(20, 21, 23, 0.9), rgba(13, 14, 16, 0.92));
}

.board-status .legend {
  grid-column: 1;
  grid-row: 1;
  min-height: 0;
  padding: 12px 18px;
  border: 0;
}

.board-composite .fretboard-shell {
  margin-top: -1px;
  border-radius: var(--ui-radius);
}

.board-composite .scroll-hint {
  margin: 0;
}

@media (max-width: 1180px) {
  .training-surface .practice-dashboard {
    grid-template-columns: minmax(330px, 0.9fr) minmax(0, 1.35fr);
  }
}

@media (max-width: 900px) {
  .training-surface .practice-dashboard {
    grid-template-columns: 1fr;
  }

  .board-status {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 620px) {
  .board-status {
    grid-template-columns: 1fr;
  }

  .board-status .legend {
    grid-column: 1;
    grid-row: auto;
  }

  .board-composite .scroll-hint {
    padding: 8px 12px;
    border-right: 1px solid rgba(210, 216, 222, 0.12);
    border-left: 1px solid rgba(210, 216, 222, 0.12);
    background: rgba(13, 14, 16, 0.92);
  }
}



.info-strip {
  grid-column: 1;
  grid-row: 1;
  display: flex;
  align-items: center;
  gap: 22px;
  min-width: 0;
  padding: 18px 20px;
  border: 0;
}

.practice-dashboard .scale-summary {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  padding: 0;
  border: 0;
}

.practice-dashboard .scale-summary {
  flex: 1 1 auto;
}





.metronome-controls {
  grid-template-columns: minmax(190px, 1.12fr) minmax(170px, 1fr);
  gap: 10px;
}

.legend {
  grid-column: 1;
  grid-row: 2;
}

@media (max-width: 1180px) {
  .practice-dashboard {
    grid-template-columns: minmax(330px, 0.9fr) minmax(0, 1.35fr);
  }

  .info-strip {
    gap: 14px;
  }

  .metronome-controls {
    grid-template-columns: minmax(125px, 1fr) minmax(140px, 0.9fr);
  }
}

@media (max-width: 900px) {
  .practice-dashboard {
    grid-template-columns: 1fr;
    grid-template-rows: auto;
  }

  .info-strip,
  .practice-toolbar,
  .legend {
    grid-column: 1;
    grid-row: auto;
  }

  .info-strip {
    flex-wrap: wrap;
  }

  .practice-toolbar {
    border-top: 1px solid rgba(176, 182, 188, 0.16);
    border-left: 0;
  }

  .metronome-panel {
    width: 100%;
    max-width: none;
  }

  .metronome-controls {
    grid-template-columns: minmax(150px, 1fr) minmax(150px, 0.9fr);
  }
}

@media (max-width: 620px) {
  .info-strip {
    display: grid;
    gap: 12px;
  }

  .practice-dashboard .scale-summary {
    justify-content: space-between;
  }

  .practice-toolbar {
    padding: 14px;
  }

  .metronome-controls {
    grid-template-columns: 1fr;
  }
}

/* Shared page and outer-frame background from keyboard-learning. */
html {
  background: var(--bg);
}

body {
  display: flow-root;
  background:
    radial-gradient(circle at 14% -12%, rgba(255, 114, 94, 0.13), transparent 32%),
    radial-gradient(circle at 88% 2%, rgba(214, 70, 60, 0.055), transparent 27%),
    linear-gradient(145deg, #171011 0%, #151012 48%, #0f0c0d 100%);
}



/* Keep selects the same size as adjacent controls in every browser. */
select {
  height: 46px;
  min-height: 46px;
  appearance: none;
  -webkit-appearance: none;
}

.control,
.rhythm-control {
  position: relative;
}

.control::after,
.rhythm-control::after {
  position: absolute;
  right: 14px;
  bottom: 20px;
  width: 7px;
  height: 7px;
  border-right: 1.5px solid currentColor;
  border-bottom: 1.5px solid currentColor;
  color: #cbd4da;
  content: "";
  pointer-events: none;
  transform: rotate(45deg);
  transform-origin: center;
}

.metronome-controls .rhythm-control select {
  height: 44px;
  min-height: 44px;
}

.metronome-controls .rhythm-control::after {
  bottom: 19px;
}

/* Present related choices as one segmented control. */
.segmented {
  grid-template-columns: minmax(0, 1fr);
  gap: 6px;
}

.segment-label {
  grid-column: 1;
  margin-bottom: 0;
}

.segment-group {
  display: grid;
  gap: 4px;
  width: 100%;
  min-height: 46px;
  padding: 3px;
  border: 1px solid rgba(139, 163, 188, 0.2);
  border-radius: var(--ui-radius);
  background: rgba(7, 9, 11, 0.46);
}

.segment-group-2 {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.segment-group-3 {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.segment-group-4 {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.segment-group .segment {
  width: 100%;
  min-width: 0;
  min-height: 0;
  padding: 0 12px;
  border: 1px solid transparent;
  border-radius: 9px;
  background: transparent;
  box-shadow: none;
}

.segment-group .segment:hover {
  border-color: transparent;
  background: rgba(139, 163, 188, 0.08);
}

.segment-group .segment.is-active,
.segment-group .segment.is-active:hover {
  border-color: rgba(57, 212, 177, 0.74);
  background: linear-gradient(180deg, rgba(57, 212, 177, 0.2), rgba(57, 212, 177, 0.1));
  color: #eafff9;
  box-shadow: inset 0 0 0 1px rgba(57, 212, 177, 0.08), 0 7px 20px rgba(20, 120, 99, 0.1);
}

/* Swap the settings and metronome modules between the two primary bars. */


.topbar > .practice-toolbar {
  grid-column: 2;
  grid-row: 1;
  justify-content: flex-end;
  padding: 14px 0 14px 22px;
}

.topbar > .practice-toolbar::before {
  display: none;
}

.topbar .metronome-panel {
  width: min(100%, 820px);
  margin-left: auto;
}

.training-surface .practice-dashboard {
  grid-template-columns: minmax(250px, 0.64fr) minmax(760px, 2.4fr);
  grid-template-rows: minmax(104px, auto);
}

.practice-dashboard > .info-strip {
  grid-column: 1;
  grid-row: 1;
}

.practice-dashboard > .controls {
  grid-column: 2;
  grid-row: 1;
  justify-content: end;
  min-width: 0;
  padding: 14px 18px 14px 22px;
}

.practice-dashboard > .controls .control,
.practice-dashboard > .controls .segmented {
  grid-template-rows: 18px 46px;
  row-gap: 6px;
}

.practice-dashboard > .controls .control > span,
.practice-dashboard > .controls .segment-label {
  display: block;
  width: 100%;
  height: 18px;
  margin: 0;
  padding: 0;
  line-height: 18px;
}

@media (max-width: 1200px) {
  .topbar {
    grid-template-columns: 1fr;
  }

  .topbar > .practice-toolbar {
    grid-column: 1;
    grid-row: 2;
    width: 100%;
    padding: 8px 0 0;
  }

  .topbar .metronome-panel {
    max-width: none;
  }

  .training-surface .practice-dashboard {
    grid-template-columns: 1fr;
    grid-template-rows: auto;
  }

  .practice-dashboard > .info-strip,
  .practice-dashboard > .controls {
    grid-column: 1;
    grid-row: auto;
  }

  .practice-dashboard > .controls {
    padding: 8px 18px 18px;
  }
}

@media (max-width: 900px) {
  .topbar > .practice-toolbar {
    padding-top: 6px;
  }

  .practice-dashboard > .controls {
    grid-template-columns: minmax(120px, 0.7fr) minmax(170px, 1fr);
    padding: 8px 18px 18px;
  }
}

@media (max-width: 620px) {
  .topbar > .practice-toolbar {
    padding-top: 4px;
  }

  .practice-dashboard > .controls {
    grid-template-columns: minmax(0, 0.76fr) minmax(0, 1.24fr);
    padding: 6px 14px 14px;
  }
}

@media (min-width: 1201px) {
  .practice-dashboard > .controls {
    grid-template-columns: 104px 144px 260px auto;
    justify-self: end;
    width: max-content;
  }
}

/* Match the harmonica project's primary-header geometry and typography. */


.brand {
  min-width: 0;
  gap: 18px;
}

.brand > div {
  min-width: 0;
}

.brand-icon-slot {
  display: grid;
  width: 66px;
  height: 58px;
  place-items: center;
  flex: 0 0 66px;
}

.brand h1 {
  color: #edf4f6;
  font-size: clamp(1.24rem, 2vw, 1.68rem);
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: -0.025em;
}

.brand p {
  margin: 4px 0 0;
  color: #8f9da7;
  font-size: 0.9rem;
  font-weight: 400;
  line-height: 1.5;
}

.topbar > .practice-toolbar {
  min-height: 58px;
  padding: 0;
  align-items: center;
}

.topbar .metronome-panel {
  align-self: center;
  width: min(100%, 650px);
  max-width: 650px;
}

.topbar .metronome-panel .metronome-controls {
  grid-template-columns: minmax(210px, 1.12fr) minmax(190px, 1fr);
}

@media (max-width: 1200px) {
  .topbar {
    min-height: 0;
  }

  .topbar > .practice-toolbar {
    padding-top: 8px;
  }
}

@media (max-width: 900px) {
  .topbar {
    gap: 14px;
    padding: 16px;
  }

  .topbar > .practice-toolbar {
    padding-top: 6px;
  }
}

@media (max-width: 680px) {
  .brand-icon-slot {
    width: 52px;
    height: 50px;
    flex-basis: 52px;
  }

}

@media (max-width: 620px) {
  .topbar > .practice-toolbar {
    padding-top: 4px;
  }

  .topbar .metronome-panel {
    width: 100%;
    max-width: none;
  }

  .topbar .metronome-panel .metronome-controls {
    grid-template-columns: 1fr;
  }
}

/* Separate the scale controls from the fretboard without framing the legend. */
.training-surface .practice-dashboard {
  position: relative;
}

.training-surface .practice-dashboard::after {
  position: absolute;
  right: -22px;
  bottom: 0;
  left: -22px;
  height: 1px;
  background: rgba(210, 216, 222, 0.12);
  content: "";
  pointer-events: none;
}

.board-composite {
  border-radius: 0;
  box-shadow: none;
}

.board-status {
  border: 0;
  border-radius: 0;
  background: transparent;
}

@media (max-width: 900px) {
  .training-surface .practice-dashboard::after {
    right: -16px;
    left: -16px;
  }
}

@media (max-width: 620px) {
  .training-surface .practice-dashboard::after {
    right: -10px;
    left: -10px;
  }
}

/* Match the scale summary to the controls beside it. */
.practice-dashboard .scale-summary {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: 18px 46px;
  align-items: stretch;
  gap: 6px;
}

.practice-dashboard .scale-summary .meta-label {
  display: block;
  width: 100%;
  height: 18px;
  margin: 0;
  padding: 0;
  line-height: 18px;
}

#scaleNotes {
  display: flex;
  min-height: 46px;
  padding: 0 12px;
  align-items: center;
  border: 1px solid rgba(139, 163, 188, 0.17);
  border-radius: var(--ui-radius);
  background: #121315;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.018);
}

/* Match the harmonica project's secondary-bar control system. */


.training-surface {
  padding-top: 0;
}

.training-surface .practice-dashboard {
  min-height: 102px;
  margin-right: -22px;
  margin-left: -22px;
  grid-template-rows: auto;
  border-bottom: 1px solid rgba(219, 227, 232, 0.13);
  background: rgba(8, 11, 13, 0.18);
}

.training-surface .practice-dashboard::after {
  display: none;
}

.practice-dashboard > .info-strip,
.practice-dashboard > .controls {
  padding: 18px 22px;
}

.practice-dashboard .scale-summary {
  width: 320px;
  max-width: 100%;
  flex: 0 1 320px;
  grid-template-rows: 17px 42px;
}

.practice-dashboard > .controls {
  gap: 12px;
}

.practice-dashboard > .controls .control,
.practice-dashboard > .controls .segmented {
  grid-template-rows: 17px 42px;
  gap: 6px;
}

.practice-dashboard .meta-label,
.practice-dashboard > .controls .control > span,
.practice-dashboard > .controls .segment-label {
  display: block;
  height: 17px;
  min-height: 17px;
  margin: 0;
  padding: 0;
  color: #87929d;
  font-size: 0.7rem;
  font-weight: 760;
  line-height: 1.5;
  letter-spacing: 0.03em;
}

.practice-dashboard #scaleNotes,
.practice-dashboard select {
  height: 42px;
  min-height: 42px;
  border: 1px solid rgba(219, 227, 232, 0.22);
  border-radius: 10px;
  background: #0c0f12;
  color: #f2f5f6;
  box-shadow: none;
}

.practice-dashboard #scaleNotes {
  font-size: 0.82rem;
  font-weight: 650;
}

.practice-dashboard select,
.practice-dashboard .segment {
  font-size: 1rem;
  font-weight: 400;
}

.practice-dashboard .control::after {
  bottom: 18px;
}

.practice-dashboard .segment-group {
  width: 100%;
  height: 42px;
  min-height: 42px;
  gap: 4px;
  padding: 3px;
  border: 1px solid rgba(219, 227, 232, 0.13);
  border-radius: 12px;
  background: rgba(7, 9, 11, 0.46);
}

.practice-dashboard .segment-group .segment {
  border: 1px solid transparent;
  border-radius: 10px;
  background: transparent;
  color: #87929d;
  box-shadow: none;
}

.practice-dashboard .segment-group .segment.is-active,
.practice-dashboard .segment-group .segment.is-active:hover {
  border-color: rgba(72, 216, 188, 0.46);
  background: rgba(72, 216, 188, 0.16);
  color: #f2f5f6;
  box-shadow: none;
}

.practice-dashboard > .controls .segmented,
.practice-dashboard > .controls .segmented .segment-group {
  width: 200px;
  min-width: 200px;
}

@media (min-width: 1201px) {
  .training-surface .practice-dashboard {
    grid-template-columns: 364px minmax(0, 1fr);
  }
}

@media (max-width: 900px) {
  .training-surface .practice-dashboard {
    margin-right: -16px;
    margin-left: -16px;
  }
}

@media (max-width: 620px) {
  .training-surface .practice-dashboard {
    margin-right: -10px;
    margin-left: -10px;
  }

  .practice-dashboard > .controls .segmented,
  .practice-dashboard > .controls .segmented .segment-group {
    width: 100%;
    min-width: 0;
  }
}

/* Align the summary label and share the legend system with the other tools. */
.practice-dashboard .scale-summary .meta-label {
  height: 17px;
  min-height: 17px;
  line-height: 1.5;
}

.board-status .legend {
  padding: 12px 0;
  gap: 10px 20px;
  color: #87929d;
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont,
    "PingFang SC", "Microsoft YaHei", sans-serif;
  font-size: 0.73rem;
  font-weight: 650;
  line-height: 1.5;
}

.board-status .legend > span {
  gap: 7px;
}

.board-status .legend-dot {
  width: 11px;
  height: 11px;
  flex: 0 0 11px;
  border: 0;
  border-radius: 50%;
  box-shadow: none;
}

.board-status .legend-pattern {
  background: #48d8bc;
}

.board-status .legend-root {
  background: #ff775f;
}

.board-status .legend-ghost {
  background: #66717a;
}

.board-status .legend-playing {
  background: #efbe67;
}

/* Shared scale-summary treatment across the three learning tools. */
.practice-dashboard #scaleNotes {
  border-color: rgba(72, 216, 188, 0.46);
  background: rgba(72, 216, 188, 0.16);
  color: #f2f5f6;
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont,
    "PingFang SC", "Microsoft YaHei", sans-serif;
  font-size: 0.82rem;
  font-weight: 650;
  line-height: 1.5;
  letter-spacing: 0.03em;
  box-shadow: none;
}

/* Keep all three project marks inside the same transparent circular bounds. */
.brand-icon-slot {
  width: 58px;
  height: 58px;
  flex: 0 0 58px;
  overflow: hidden;
  border: 0;
  border-radius: 50%;
  background: transparent;
  box-shadow: none;
}

.brand-icon-slot .brand-icon {
  display: block;
  width: 58px;
  height: 58px;
  object-fit: contain;
}

/* Use neutral text in the native scale menu. */
.scale-select optgroup {
  color: #7f8992;
  font-weight: 650;
}

.scale-select option {
  color: #f2f5f6;
  font-weight: 400;
}

/* Swap the complete scale and fingering controls on wider layouts. */
@media (min-width: 621px) {
  .practice-dashboard > .controls .control-scale {
    order: 1;
  }

  .practice-dashboard > .controls .control-wide {
    order: 2;
  }

  .practice-dashboard > .controls .segmented {
    order: 3;
  }
}

@media (min-width: 1201px) {
  .practice-dashboard > .controls {
    grid-template-columns: 104px 260px 144px auto;
  }
}

@media (max-width: 680px) {
  .brand-icon-slot {
    width: 50px;
    height: 50px;
    flex-basis: 50px;
  }

  .brand-icon-slot .brand-icon {
    width: 50px;
    height: 50px;
  }
}

/* Guitar UI theme: coral-red chrome with preserved note-state colors. */






.practice-toolbar::before {
  background: rgba(var(--theme-rgb), 0.18);
}

.practice-dashboard select,
.metronome-controls .rhythm-control select {
  border-color: rgba(var(--theme-rgb), 0.34);
  background: rgba(35, 17, 19, 0.9);
}

.practice-dashboard #scaleNotes {
  border-color: rgba(var(--theme-rgb), 0.38);
  background: color-mix(in srgb, #0c0f12 90%, var(--theme) 10%);
}

.practice-dashboard .segment-group {
  border-color: rgba(var(--theme-rgb), 0.22);
  background: rgba(var(--theme-rgb), 0.045);
}

.settings-toggle {
  border-color: rgba(var(--theme-rgb), 0.32);
  background: rgba(35, 17, 19, 0.9);
}

.practice-dashboard .segment-group .segment:hover {
  background: rgba(var(--theme-rgb), 0.09);
}

.practice-dashboard .segment-group .segment.is-active,
.practice-dashboard .segment-group .segment.is-active:hover {
  border-color: rgba(var(--theme-rgb), 0.54);
  background: var(--theme-soft);
  box-shadow: inset 0 0 0 1px rgba(var(--theme-rgb), 0.08);
}

select:hover,
.settings-toggle:hover {
  border-color: rgba(var(--theme-rgb), 0.52);
  background: rgba(44, 21, 23, 0.96);
}

.board-status {
  border-color: rgba(var(--theme-rgb), 0.22);
  background:
    linear-gradient(
      180deg,
      rgba(35, 20, 21, 0.92),
      rgba(20, 13, 15, 0.94)
    );
}

.board-composite {
  box-shadow:
    0 30px 70px rgba(0, 0, 0, 0.48),
    0 10px 24px rgba(0, 0, 0, 0.34),
    0 0 30px rgba(var(--theme-rgb), 0.07);
}

.board-composite .fretboard-shell {
  border-color: rgba(var(--theme-rgb), 0.3);
}

.board-composite .scroll-hint {
  border-color: rgba(var(--theme-rgb), 0.2);
  background: rgba(27, 15, 17, 0.94);
}

.metronome-panel .metronome-heading,
.metronome-panel .metronome-heading.is-beat {
  --tick-color: var(--theme);
}

.metronome-panel .metronome-heading.is-accent {
  --tick-color: #ff9a89;
}

.metronome-panel .metronome-heading.is-secondary-accent {
  --tick-color: #e85e4d;
}

.metronome-panel .metronome-heading.is-subdivision {
  --tick-color: #ffb3a6;
}

.metronome-panel .metronome-toggle::before,
.metronome-panel .metronome-toggle.is-active::before {
  border-color: rgba(var(--theme-rgb), 0.7);
  background: rgba(var(--theme-rgb), 0.14);
}

.metronome-panel .metronome-toggle:hover::before {
  border-color: rgba(var(--theme-rgb), 0.92);
  background: rgba(var(--theme-rgb), 0.22);
}

.metronome-field input[type="range"] {
  accent-color: var(--theme);
}

.beat-light.is-active,
.beat-light.is-accent.is-active,
.beat-light.is-secondary-accent.is-active,
.beat-light.is-active.is-subdivision {
  background: var(--theme);
  box-shadow:
    0 0 0 4px rgba(var(--theme-rgb), 0.12),
    0 0 12px rgba(var(--theme-rgb), 0.36);
}

/* A continuous, clock-synchronised pendulum with readable mechanical cues. */
.metronome-panel .metronome-heading {
  overflow: visible;
}

.metronome-panel .metronome-icon {
  width: 36px;
  height: 40px;
  overflow: visible;
  isolation: isolate;
}

.metronome-needle {
  transition: transform var(--swing-duration, 0ms) cubic-bezier(0.45, 0, 0.55, 1);
}

.metronome-icon .metronome-swing-track {
  fill: none;
  stroke: rgba(18, 8, 10, 0.42);
  stroke-width: 7;
  stroke-linecap: round;
}

.metronome-icon .metronome-endpoint {
  fill: rgba(18, 8, 10, 0.48);
  stroke: none;
}

.metronome-icon .metronome-weight {
  fill: #211214;
  stroke: color-mix(in srgb, var(--tick-color) 72%, white);
  stroke-width: 5;
}

.metronome-icon .metronome-pivot-ring {
  fill: rgba(18, 8, 10, 0.72);
  stroke: color-mix(in srgb, var(--tick-color) 65%, white);
  stroke-width: 5;
  transition: fill 120ms ease, stroke 120ms ease;
}

.metronome-icon .metronome-pivot {
  fill: color-mix(in srgb, var(--tick-color) 78%, white);
  stroke: none;
}

.metronome-heading.is-striking .metronome-icon {
  animation: metronome-strike 220ms cubic-bezier(0.22, 1, 0.36, 1);
}

.metronome-heading.is-striking .metronome-pivot {
  animation: metronome-pivot-strike 220ms ease-out;
}

.beat-light.is-striking {
  animation: beat-light-strike 220ms cubic-bezier(0.22, 1, 0.36, 1);
}

.beat-light.is-subdivision.is-striking {
  animation-duration: 150ms;
}

@keyframes metronome-strike {
  0% {
    filter: drop-shadow(0 0 0 transparent);
    transform: translateY(0) scale(1);
  }
  26% {
    filter: drop-shadow(0 0 7px color-mix(in srgb, var(--tick-color) 62%, transparent));
    transform: translateY(1px) scale(1.055);
  }
  100% {
    filter: drop-shadow(0 0 2px color-mix(in srgb, var(--tick-color) 24%, transparent));
    transform: translateY(0) scale(1);
  }
}

@keyframes metronome-pivot-strike {
  0%,
  100% {
    opacity: 0.78;
  }
  24% {
    opacity: 1;
  }
}

@keyframes beat-light-strike {
  0% {
    transform: scale(0.86);
  }
  32% {
    transform: scale(1.58);
  }
  100% {
    transform: scale(1.18);
  }
}

@media (prefers-reduced-motion: reduce) {
  .metronome-heading.is-striking .metronome-icon,
  .metronome-heading.is-striking .metronome-pivot,
  .beat-light.is-striking {
    animation: none;
  }
}

@media (max-width: 620px) {
  .topbar .metronome-panel .metronome-controls {
    margin-top: 24px;
  }
}

/* Portrait layout: keep the practice surface close to the page header. */
@media (orientation: portrait), (max-aspect-ratio: 1/1) {
  .app-shell {
    width: calc(100% - 24px);
    min-height: calc(100dvh - 24px);
    margin: 12px auto;
    padding-inline: 18px;
  }

  .topbar {
    grid-template-columns: minmax(0, 1fr);
    gap: 14px;
    margin-inline: -18px;
    padding: 18px;
  }

  .topbar > .practice-toolbar {
    grid-column: 1;
    grid-row: 2;
    width: 100%;
    min-height: 0;
    padding: 0;
  }

  .topbar .metronome-panel {
    width: 100%;
    max-width: none;
    margin: 0;
  }

  .training-surface .practice-dashboard {
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: auto auto;
    margin-inline: -18px;
  }

  .practice-dashboard > .info-strip,
  .practice-dashboard > .controls {
    grid-column: 1;
    grid-row: auto;
  }

  .practice-dashboard > .info-strip {
    padding: 14px 18px 8px;
  }

  .practice-dashboard .scale-summary {
    width: min(100%, 360px);
    flex-basis: 360px;
  }

  .practice-dashboard > .controls {
    width: 100%;
    padding: 8px 18px 16px;
    grid-template-columns: 108px minmax(250px, 1.65fr) minmax(170px, 1fr) 200px;
    justify-self: stretch;
  }

  .board-status .legend {
    overflow-x: auto;
    flex-wrap: nowrap;
    scrollbar-width: none;
  }

  .board-status .legend::-webkit-scrollbar {
    display: none;
  }

  .board-status .legend > span {
    flex: 0 0 auto;
  }
}

@media (max-width: 680px) {
  .app-shell {
    width: 100%;
    min-height: 100dvh;
    margin: 0;
    padding-inline: 12px;
    border-inline: 0;
    border-radius: 0;
  }

  .topbar {
    gap: 12px;
    margin-inline: -12px;
    padding: 14px 12px;
  }

  .brand {
    gap: 12px;
  }

  .brand-icon-slot,
  .brand-icon-slot .brand-icon {
    width: 44px;
    height: 44px;
  }

  .brand-icon-slot {
    flex-basis: 44px;
  }

  .brand h1 {
    font-size: 1.14rem;
  }

  .brand p {
    overflow: hidden;
    font-size: 0.76rem;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .topbar .metronome-panel {
    grid-template-columns: 36px minmax(0, 1fr) 42px;
    gap: 8px;
  }

  .topbar .metronome-panel .metronome-controls {
    grid-column: 1 / -1;
    grid-row: 2;
    grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr);
    margin-top: 0;
  }

  .topbar .metronome-panel .metronome-field > span {
    display: none;
  }

  .topbar .metronome-panel .rhythm-control select {
    height: 42px;
  }

  .training-surface .practice-dashboard {
    margin-inline: -12px;
  }

  .practice-dashboard > .info-strip {
    padding: 12px 12px 6px;
  }

  .practice-dashboard .scale-summary {
    width: 100%;
    flex-basis: auto;
  }

  .practice-dashboard > .controls {
    padding: 6px 12px 12px;
    grid-template-columns: minmax(0, 0.72fr) minmax(0, 1.28fr);
  }

  .practice-dashboard > .controls .settings-toggle,
  .practice-dashboard > .controls .secondary-controls {
    grid-column: 1 / -1;
  }

  .practice-dashboard > .controls .secondary-controls {
    grid-template-columns: 1fr;
  }

  .board-status .legend {
    padding: 10px 12px;
  }

  .board-composite .scroll-hint {
    padding-inline: 12px;
  }

  .site-footer {
    min-height: 52px;
    flex-basis: 52px;
  }
}

/* Tablet portrait: use a two-column toolbar and collapse secondary settings. */
@media (min-width: 681px) and (max-width: 900px) {
  .practice-dashboard > .info-strip {
    padding-bottom: 8px;
  }

  .practice-dashboard > .controls {
    grid-template-columns: minmax(0, 0.72fr) minmax(0, 1.28fr);
    gap: 12px;
    padding-top: 8px;
  }

  .practice-dashboard > .controls .control,
  .practice-dashboard > .controls .control-wide {
    width: 100%;
    min-width: 0;
  }

  .practice-dashboard > .controls .settings-toggle {
    display: flex;
    width: 100%;
    grid-column: 1 / -1;
  }

  .practice-dashboard > .controls .settings-toggle[aria-expanded="false"] + .secondary-controls {
    display: none;
  }

  .practice-dashboard > .controls .secondary-controls {
    display: grid;
    width: 100%;
    min-width: 0;
    grid-column: 1 / -1;
    grid-template-columns: minmax(0, 1.35fr) minmax(220px, 0.65fr);
    gap: 12px;
  }

  .practice-dashboard > .controls .secondary-controls .control,
  .practice-dashboard > .controls .secondary-controls .segmented,
  .practice-dashboard > .controls .secondary-controls .segment-group {
    width: 100%;
    min-width: 0;
  }
}

/* The complete brand lockup is the consistent route back to the tool index. */
.brand {
  border-radius: 12px;
  color: inherit;
  cursor: pointer;
  flex: 0 1 auto;
  justify-self: start;
  max-width: 100%;
  text-decoration: none;
  width: fit-content;
  -webkit-tap-highlight-color: rgba(var(--theme-rgb), 0.14);
  transition: filter 160ms ease, transform 160ms ease;
}

.brand .brand-icon {
  transition: transform 160ms ease;
}

.brand:hover {
  filter: brightness(1.08);
  transform: translateY(-1px);
}

.brand:hover .brand-icon {
  transform: scale(1.04);
}

.brand:active {
  transform: translateY(0);
}

.brand:focus-visible {
  outline: 2px solid var(--theme);
  outline-offset: 6px;
}
