:root {
  color-scheme: light;
  --bg: #edf1f3;
  --panel: #ffffff;
  --ink: #17212b;
  --muted: #64727e;
  --line: #d8e0e5;
  --line-strong: #bdc9d0;
  --accent: #e65243;
  --accent-dark: #be3e33;
  --teal: #147c78;
  --teal-dark: #0f625f;
  --yellow: #e9ad35;
  --wave-bg: #101920;
  --wave-line: #72838e;
  --header-bg: rgba(255, 255, 255, 0.9);
  --nav-bg: rgba(255, 255, 255, 0.97);
  --surface-soft: #f5f7f8;
  --surface-hover: #e8edef;
  --surface-muted: #eef2f4;
  --input-bg: #ffffff;
  --strong-bg: #17212b;
  --on-strong: #ffffff;
  --switch-off: #a9b5bc;
  --beat-off: #ccd5da;
  --accent-soft: rgba(230, 82, 67, 0.09);
  --accent-border: rgba(230, 82, 67, 0.28);
  --teal-soft: rgba(20, 124, 120, 0.09);
  --teal-border: rgba(20, 124, 120, 0.25);
  --yellow-soft: rgba(233, 173, 53, 0.12);
  --yellow-border: rgba(233, 173, 53, 0.38);
  --yellow-ink: #77520d;
  --focus-ring: rgba(20, 124, 120, 0.28);
  --nav-shadow: 0 -8px 22px rgba(22, 33, 43, 0.08);
  --count-bg: rgba(233, 173, 53, 0.12);
  --shadow: 0 10px 28px rgba(22, 33, 43, 0.09);
  font-family: "Segoe UI", "Malgun Gothic", sans-serif;
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #15191d;
  --panel: #20262b;
  --ink: #f2f5f6;
  --muted: #a9b4ba;
  --line: #39434a;
  --line-strong: #53616a;
  --accent: #ff6658;
  --accent-dark: #ff8a80;
  --teal: #32b9ae;
  --teal-dark: #73d8d0;
  --yellow: #f4c34d;
  --wave-bg: #090d10;
  --wave-line: #81919a;
  --header-bg: rgba(27, 32, 36, 0.96);
  --nav-bg: rgba(27, 32, 36, 0.98);
  --surface-soft: #292f35;
  --surface-hover: #343c42;
  --surface-muted: #30373d;
  --input-bg: #171c20;
  --strong-bg: #0f1417;
  --on-strong: #ffffff;
  --switch-off: #65727a;
  --beat-off: #56636b;
  --accent-soft: rgba(255, 102, 88, 0.14);
  --accent-border: rgba(255, 102, 88, 0.38);
  --teal-soft: rgba(50, 185, 174, 0.14);
  --teal-border: rgba(50, 185, 174, 0.36);
  --yellow-soft: rgba(244, 195, 77, 0.15);
  --yellow-border: rgba(244, 195, 77, 0.4);
  --yellow-ink: #f4c34d;
  --focus-ring: rgba(50, 185, 174, 0.35);
  --nav-shadow: 0 -8px 24px rgba(0, 0, 0, 0.3);
  --count-bg: rgba(244, 195, 77, 0.13);
  --shadow: 0 12px 30px rgba(0, 0, 0, 0.24);
}

:root[data-theme="amp"] {
  color-scheme: dark;
  --bg: #171516;
  --panel: #262123;
  --ink: #f7f1f1;
  --muted: #bcaeae;
  --line: #483b3e;
  --line-strong: #69575b;
  --accent: #df493f;
  --accent-dark: #ff7a70;
  --teal: #43aaa2;
  --teal-dark: #83d6d0;
  --yellow: #e6b84d;
  --wave-bg: #0e0b0c;
  --wave-line: #8b7478;
  --header-bg: rgba(32, 27, 29, 0.96);
  --nav-bg: rgba(32, 27, 29, 0.98);
  --surface-soft: #30292b;
  --surface-hover: #3b3134;
  --surface-muted: #362d30;
  --input-bg: #1b1718;
  --strong-bg: #100d0e;
  --on-strong: #ffffff;
  --switch-off: #756368;
  --beat-off: #655458;
  --accent-soft: rgba(223, 73, 63, 0.16);
  --accent-border: rgba(223, 73, 63, 0.42);
  --teal-soft: rgba(67, 170, 162, 0.14);
  --teal-border: rgba(67, 170, 162, 0.36);
  --yellow-soft: rgba(230, 184, 77, 0.15);
  --yellow-border: rgba(230, 184, 77, 0.4);
  --yellow-ink: #efca71;
  --focus-ring: rgba(223, 73, 63, 0.34);
  --nav-shadow: 0 -8px 24px rgba(0, 0, 0, 0.34);
  --count-bg: rgba(223, 73, 63, 0.13);
  --shadow: 0 12px 30px rgba(0, 0, 0, 0.27);
}

:root[data-theme="mint"] {
  color-scheme: light;
  --bg: #e8f4f1;
  --panel: #ffffff;
  --ink: #17312f;
  --muted: #607875;
  --line: #c9dfda;
  --line-strong: #a7c8c1;
  --accent: #df6253;
  --accent-dark: #b9463b;
  --teal: #1f8d80;
  --teal-dark: #176d64;
  --yellow: #d7a632;
  --wave-bg: #102422;
  --wave-line: #75938e;
  --header-bg: rgba(248, 253, 252, 0.94);
  --nav-bg: rgba(248, 253, 252, 0.98);
  --surface-soft: #f0f8f6;
  --surface-hover: #dfefeb;
  --surface-muted: #e5f2ef;
  --input-bg: #ffffff;
  --strong-bg: #17312f;
  --switch-off: #9db7b2;
  --beat-off: #bcd3ce;
  --accent-soft: rgba(223, 98, 83, 0.1);
  --accent-border: rgba(223, 98, 83, 0.3);
  --teal-soft: rgba(31, 141, 128, 0.1);
  --teal-border: rgba(31, 141, 128, 0.28);
  --yellow-soft: rgba(215, 166, 50, 0.13);
  --yellow-border: rgba(215, 166, 50, 0.4);
  --yellow-ink: #75540b;
  --focus-ring: rgba(31, 141, 128, 0.28);
  --nav-shadow: 0 -8px 22px rgba(23, 49, 47, 0.09);
  --count-bg: rgba(215, 166, 50, 0.13);
  --shadow: 0 10px 28px rgba(23, 49, 47, 0.1);
}

* {
  box-sizing: border-box;
  letter-spacing: 0;
}

html,
body {
  width: 100%;
  max-width: 100%;
  height: 100%;
  margin: 0;
  overflow: hidden;
  background: var(--bg);
  color: var(--ink);
}

button,
input {
  font: inherit;
}

button,
label[for="audioFile"] {
  -webkit-tap-highlight-color: transparent;
}

button:focus-visible,
input:focus-visible,
label[for="audioFile"]:focus-visible,
canvas:focus-visible {
  outline: 3px solid var(--focus-ring);
  outline-offset: 2px;
}

.app-shell {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  height: 100%;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
}

.app-header {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  min-height: 92px;
  padding: 18px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  border-bottom: 1px solid var(--line);
  background: var(--header-bg);
}

.theme-picker {
  position: relative;
  width: 166px;
  height: 38px;
  flex: 0 0 166px;
  display: grid;
  grid-template-columns: 18px 12px minmax(0, 1fr);
  align-items: center;
  gap: 7px;
  padding: 0 9px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface-soft);
  color: var(--muted);
}

.theme-picker > svg {
  width: 17px;
  height: 17px;
}

.theme-swatch {
  width: 11px;
  height: 11px;
  border: 1px solid var(--line-strong);
  border-radius: 50%;
  background: #f7fafb;
}

.theme-picker select {
  width: 100%;
  min-width: 0;
  height: 32px;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--ink);
  font: inherit;
  font-size: 10px;
  font-weight: 700;
  cursor: pointer;
}

.brand-block,
.file-actions,
.transport-controls,
.loop-actions,
.range-with-icon,
.metro-actions,
.track-badges {
  display: flex;
  align-items: center;
}

.brand-block {
  gap: 13px;
  min-width: 260px;
}

.brand-mark {
  width: 46px;
  height: 46px;
  flex: 0 0 46px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: var(--strong-bg);
  color: var(--on-strong);
  box-shadow: inset 0 -4px 0 var(--accent);
}

.brand-mark svg {
  width: 25px;
  height: 25px;
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: 23px;
  line-height: 1.2;
}

.brand-block p {
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
}

.file-actions {
  justify-content: flex-end;
  gap: 14px;
  min-width: 0;
}

.app-nav {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--surface-soft);
}

.nav-button {
  height: 36px;
  padding: 0 13px;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  border: 0;
  border-radius: 5px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-size: 11px;
  font-weight: 700;
}

.nav-button:hover {
  color: var(--ink);
  background: var(--surface-hover);
}

.nav-button.active {
  background: var(--strong-bg);
  color: var(--on-strong);
}

.nav-button svg {
  width: 16px;
  height: 16px;
}

.file-summary {
  max-width: 390px;
  min-width: 170px;
  text-align: right;
  overflow: hidden;
}

.file-summary strong,
.file-summary span {
  display: block;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.file-summary strong {
  font-size: 13px;
}

.file-summary span {
  margin-top: 3px;
  color: var(--muted);
  font-size: 11px;
}

.workspace {
  width: 100%;
  max-width: 100%;
  min-height: 0;
  min-width: 0;
  padding: 18px 24px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 330px;
  gap: 16px;
}

.tab-page:not(.active) {
  display: none;
}

.random-page {
  min-height: 0;
  padding: 18px 24px;
  grid-template-columns: minmax(0, 1fr) 330px;
  gap: 16px;
}

.random-page.active {
  display: grid;
}

.generator-panel,
.generator-settings {
  min-height: 0;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.generator-panel {
  padding: 19px;
  display: grid;
  grid-template-rows: auto minmax(300px, 1fr) auto auto;
}

.generator-settings {
  padding: 19px;
  display: flex;
  flex-direction: column;
}

.generator-heading {
  min-height: 51px;
}

.generator-status {
  display: flex;
  align-items: center;
  gap: 8px;
  font-variant-numeric: tabular-nums;
}

.generator-status span,
.generator-status strong {
  min-width: 66px;
  padding: 5px 8px;
  border-radius: 5px;
  text-align: center;
  font-size: 10px;
}

.generator-status span {
  border: 1px solid var(--line);
  background: var(--surface-soft);
  color: var(--muted);
}

.generator-status strong {
  border: 1px solid var(--teal-border);
  background: var(--teal-soft);
  color: var(--teal-dark);
}

.random-note-stage {
  position: relative;
  min-height: 300px;
  overflow: hidden;
  display: grid;
  place-items: center;
  border: 1px solid #26343d;
  border-radius: 6px;
  background: var(--wave-bg);
  color: #ffffff;
}

.random-note-stage::before,
.random-note-stage::after {
  content: "";
  position: absolute;
  width: 86px;
  height: 86px;
  border-color: rgba(233, 173, 53, 0.45);
  pointer-events: none;
}

.random-note-stage::before {
  top: 20px;
  left: 20px;
  border-top: 1px solid;
  border-left: 1px solid;
}

.random-note-stage::after {
  right: 20px;
  bottom: 20px;
  border-right: 1px solid;
  border-bottom: 1px solid;
}

.stage-corner {
  position: absolute;
  top: 17px;
  color: #758793;
  font-size: 9px;
  font-weight: 800;
}

.stage-corner-left {
  left: 31px;
}

.stage-corner-right {
  right: 27px;
}

.random-mode-view {
  position: relative;
  z-index: 1;
  width: 100%;
  min-width: 0;
}

.random-name-view {
  min-height: 100%;
  display: grid;
  place-items: center;
}

.random-note-display {
  min-width: 0;
  padding: 24px;
  display: flex;
  align-items: baseline;
  justify-content: center;
  gap: 24px;
  color: #ffffff;
  font-size: 84px;
  line-height: 1;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}

.random-note-display .single-note,
.note-placeholder {
  font-size: 112px;
}

.random-note-display .note-separator {
  color: var(--yellow);
  font-size: 52px;
  font-weight: 400;
}

.random-note-stage.note-change .random-mode-view {
  animation: note-pop 210ms ease-out;
}

@keyframes note-pop {
  0% { opacity: 0.1; transform: scale(0.92); }
  100% { opacity: 1; transform: scale(1); }
}

.random-fretboard-view {
  height: 100%;
  min-height: 298px;
  padding: 39px 22px 20px;
  display: grid;
  grid-template-rows: 52px minmax(0, 1fr);
  gap: 8px;
}

.fretboard-result-row {
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.fretboard-result-copy {
  min-width: 0;
  display: flex;
  align-items: baseline;
  gap: 12px;
}

.fretboard-result-copy > span {
  color: #8fa2ae;
  font-size: 11px;
  font-weight: 700;
}

.fretboard-result-copy output {
  color: #ffffff;
  font-size: 38px;
  line-height: 1;
  font-weight: 800;
}

.fretboard-reveal-button {
  min-width: 110px;
  min-height: 38px;
  border: 1px solid rgba(255, 255, 255, 0.22);
  background: rgba(255, 255, 255, 0.09);
  color: #ffffff;
}

.fretboard-reveal-button:hover {
  border-color: var(--yellow);
  background: rgba(233, 173, 53, 0.14);
}

.fretboard-canvas-shell {
  min-width: 0;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.11);
  border-radius: 5px;
  background: rgba(7, 13, 17, 0.44);
}

.fretboard-canvas-shell svg {
  width: 100%;
  height: 100%;
  min-height: 185px;
  display: block;
}

.fretboard-neck {
  fill: #283941;
  stroke: #536771;
  stroke-width: 1;
}

.fretboard-fret,
.fretboard-nut,
.fretboard-string {
  vector-effect: non-scaling-stroke;
}

.fretboard-fret {
  stroke: #83929a;
  stroke-width: 1;
}

.fretboard-nut {
  stroke: #e8edf0;
  stroke-width: 5;
}

.fretboard-string {
  stroke: #dce4e8;
  stroke-width: 1.25;
}

.fretboard-string[data-string="3"] { stroke-width: 1.6; }
.fretboard-string[data-string="4"] { stroke-width: 2.1; }
.fretboard-string[data-string="5"] { stroke-width: 2.7; }
.fretboard-string[data-string="6"] { stroke-width: 3.4; }

.fretboard-inlay {
  fill: #72848d;
  opacity: 0.72;
}

.fretboard-fret-label,
.fretboard-string-label,
.fretboard-open-label {
  fill: #91a1a9;
  font-family: inherit;
  font-size: 14px;
  font-weight: 700;
}

.fretboard-string-label {
  fill: #627680;
  font-size: 12px;
}

.fretboard-open-label {
  fill: #dce5e9;
  font-size: 15px;
}

.fretboard-target {
  fill: var(--yellow);
  stroke: #fff7d5;
  stroke-width: 3;
  vector-effect: non-scaling-stroke;
}

.fretboard-target.quiz-target {
  fill: var(--teal);
  stroke: #d9fffa;
}

.fretboard-target.revealed {
  fill: var(--yellow);
  stroke: #ffffff;
}

.timer-track {
  position: absolute;
  right: 0;
  bottom: 0;
  left: 0;
  height: 5px;
  background: #2d3a43;
}

.timer-track span {
  width: 0;
  height: 100%;
  display: block;
  background: var(--teal);
  transition: width 70ms linear;
}

.generator-actions {
  min-height: 76px;
  padding: 13px 0;
  display: grid;
  grid-template-columns: 0.75fr 1.25fr;
  gap: 9px;
  border-bottom: 1px solid var(--line);
}

.generator-actions .button {
  min-height: 48px;
  font-size: 13px;
}

.random-single-button {
  border: 1px solid var(--line-strong);
  background: var(--surface-soft);
  color: var(--ink);
}

.random-single-button:hover {
  border-color: var(--ink);
  background: var(--surface-hover);
}

.random-auto-button {
  background: var(--accent);
  color: var(--on-strong);
}

.random-auto-button:hover {
  background: var(--accent-dark);
}

.random-auto-button.running {
  background: var(--strong-bg);
}

.history-band {
  min-height: 92px;
  padding-top: 13px;
  position: relative;
}

.history-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.history-heading strong {
  display: block;
  margin-top: 2px;
  font-size: 12px;
}

.history-heading .icon-button {
  width: 31px;
  height: 31px;
}

.random-history {
  min-height: 34px;
  margin-top: 9px;
  display: flex;
  align-items: center;
  gap: 5px;
  overflow: hidden;
}

.history-note {
  min-width: 43px;
  height: 29px;
  padding: 0 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: var(--surface-soft);
  color: var(--muted);
  font-size: 10px;
  font-weight: 700;
  white-space: nowrap;
}

.history-note.current {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--accent-dark);
}

.history-empty {
  position: absolute;
  bottom: 8px;
  left: 0;
  color: var(--muted);
  font-size: 10px;
}

.settings-heading {
  margin-bottom: 7px;
}

.settings-heading > svg {
  width: 19px;
  height: 19px;
  color: var(--teal);
}

.random-mode-selector {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.random-mode-selector button {
  height: 38px;
  padding: 0 6px;
  line-height: 1.2;
}

.random-setting-group {
  padding: 16px 0;
  border-bottom: 1px solid var(--line);
}

.setting-title-row {
  margin-bottom: 11px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  color: var(--ink);
  font-size: 11px;
  font-weight: 700;
}

.setting-title-row > span:last-child,
.setting-title-row output {
  color: var(--muted);
  font-size: 10px;
  font-weight: 700;
}

.count-stepper {
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr) 38px;
  align-items: center;
  gap: 8px;
}

.count-stepper .step-button {
  width: 38px;
  height: 38px;
}

.count-stepper input {
  width: 100%;
  height: 44px;
  border: 1px solid var(--line-strong);
  border-radius: 5px;
  background: var(--input-bg);
  color: var(--ink);
  text-align: center;
  font-size: 23px;
  font-weight: 800;
  appearance: textfield;
}

.count-stepper input::-webkit-inner-spin-button {
  appearance: none;
}

.count-presets {
  margin-top: 8px;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 5px;
}

.count-presets button {
  height: 29px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: var(--surface-soft);
  color: var(--muted);
  cursor: pointer;
  font-size: 10px;
  font-weight: 700;
}

.count-presets button:hover,
.count-presets button.active {
  border-color: var(--teal);
  background: var(--teal-soft);
  color: var(--teal-dark);
}

.generator-settings input[type="range"] {
  accent-color: var(--teal);
}

.range-labels {
  margin-top: 7px;
  display: flex;
  justify-content: space-between;
  color: var(--muted);
  font-size: 9px;
}

.note-selection-group {
  border-bottom: 0;
}

.note-selection-presets {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 5px;
}

.note-selection-presets button {
  height: 30px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: var(--surface-soft);
  color: var(--muted);
  cursor: pointer;
  font-size: 9px;
  font-weight: 700;
}

.note-selection-presets button:hover,
.note-selection-presets button.active {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--accent-dark);
}

.pitch-list {
  margin-top: 10px;
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 5px;
}

.selectable-pitch-list label {
  min-width: 0;
  position: relative;
}

.selectable-pitch-list input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
}

.selectable-pitch-list span {
  height: 25px;
  display: grid;
  place-items: center;
  border: 1px solid transparent;
  border-radius: 3px;
  background: var(--surface-muted);
  color: var(--muted);
  cursor: pointer;
  font-size: 9px;
  font-weight: 700;
}

.selectable-pitch-list input:checked + span {
  border-color: var(--teal);
  background: var(--teal-soft);
  color: var(--teal-dark);
}

.selectable-pitch-list input:focus-visible + span {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.selectable-pitch-list input:disabled + span {
  cursor: not-allowed;
  opacity: 0.5;
}

.player-panel,
.metronome-panel {
  max-width: 100%;
  min-height: 0;
  min-width: 0;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.player-panel {
  padding: 19px;
  display: grid;
  grid-template-rows: auto minmax(170px, 1fr) auto auto auto;
}

.metronome-panel {
  padding: 19px;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  scrollbar-width: thin;
}

.section-heading {
  min-width: 0;
  min-height: 46px;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.section-heading h2 {
  margin-top: 2px;
  font-size: 19px;
}

.eyebrow {
  color: var(--accent);
  font-size: 10px;
  font-weight: 800;
}

.eyebrow-teal {
  color: var(--teal);
}

.track-badges {
  min-width: 0;
  gap: 6px;
}

.status-badge {
  min-width: 58px;
  padding: 5px 8px;
  border: 1px solid var(--accent-border);
  border-radius: 5px;
  background: var(--accent-soft);
  color: var(--accent-dark);
  text-align: center;
  font-size: 11px;
  font-weight: 700;
}

.status-badge-teal {
  border-color: var(--teal-border);
  background: var(--teal-soft);
  color: var(--teal-dark);
}

.status-badge-pitch {
  border-color: var(--yellow-border);
  background: var(--yellow-soft);
  color: var(--yellow-ink);
}

.waveform-shell {
  --seek-thumb-size: 24px;
  --seek-track-height: 42px;
  --waveform-inset: calc(var(--seek-thumb-size) / 2);
  position: relative;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  min-height: 170px;
  overflow: hidden;
  contain: size layout paint;
  border: 1px solid #233039;
  border-radius: 6px;
  background: var(--wave-bg);
}

.waveform-seek-track {
  position: absolute;
  top: 0;
  right: 0;
  left: 0;
  height: var(--seek-track-height);
  background: rgba(255, 255, 255, 0.04);
  border-bottom: 1px solid rgba(255, 255, 255, 0.13);
}

#seekSlider {
  --seek-progress: 0%;
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  min-width: 0;
  margin: 0;
  padding: 0;
  background: transparent;
  appearance: none;
  touch-action: none;
  cursor: ew-resize;
}

#seekSlider::-webkit-slider-runnable-track {
  height: 4px;
  border-radius: 2px;
  background: linear-gradient(to right, #edf6f6 var(--seek-progress), #536570 var(--seek-progress));
}

#seekSlider::-webkit-slider-thumb {
  width: var(--seek-thumb-size);
  height: var(--seek-thumb-size);
  margin-top: -10px;
  border: 3px solid #edf6f6;
  border-radius: 50%;
  background: #183e41;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.45);
  appearance: none;
}

#seekSlider:focus-visible {
  outline-offset: -3px;
}

.waveform-plot {
  position: absolute;
  top: var(--seek-track-height);
  right: var(--waveform-inset);
  bottom: 0;
  left: var(--waveform-inset);
  overflow: hidden;
  contain: strict;
}

.waveform-playhead {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  width: 2px;
  background: #f3fbff;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.45);
  pointer-events: none;
}

.waveform-playhead[hidden] {
  display: none;
}

.waveform-shell.drag-over {
  border-color: var(--yellow);
  box-shadow: inset 0 0 0 2px rgba(233, 173, 53, 0.55);
}

#waveformCanvas {
  position: absolute;
  inset: 0;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  height: 100%;
  display: block;
  touch-action: none;
  cursor: ew-resize;
}

.waveform-empty,
.decode-state {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}

.waveform-empty {
  gap: 7px;
  color: #d5dee4;
}

.waveform-empty svg {
  width: 34px;
  height: 34px;
  margin-bottom: 2px;
  color: var(--yellow);
}

.waveform-empty strong {
  font-size: 14px;
}

.waveform-empty span {
  color: #91a2ae;
  font-size: 11px;
}

.decode-state {
  gap: 10px;
  background: rgba(16, 25, 32, 0.88);
  color: #eaf0f3;
  font-size: 12px;
}

.spinner {
  width: 24px;
  height: 24px;
  border: 3px solid #52626d;
  border-top-color: var(--yellow);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.hidden {
  display: none !important;
}

.timeline-row {
  min-height: 39px;
  display: grid;
  grid-template-columns: 86px minmax(0, 1fr) 86px;
  align-items: center;
  gap: 10px;
  color: var(--muted);
  font-size: 11px;
  font-variant-numeric: tabular-nums;
}

.timeline-row > time:last-child {
  text-align: right;
}

.selection-readout {
  min-width: 0;
  display: flex;
  justify-content: center;
  gap: 20px;
}

.selection-readout b {
  margin-right: 3px;
  color: var(--ink);
}

.transport-band {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  min-height: 102px;
  padding: 14px 0;
  display: grid;
  grid-template-columns: 185px minmax(150px, 1fr) minmax(170px, 1fr) minmax(130px, 0.7fr);
  align-items: center;
  gap: 16px;
  border-top: 1px solid var(--line);
}

.transport-controls {
  gap: 9px;
}

.button,
.icon-button,
.play-button,
.step-button,
.speed-presets button,
.segmented button {
  border: 0;
  cursor: pointer;
  transition: background-color 130ms ease, color 130ms ease, border-color 130ms ease, transform 80ms ease;
}

.button:active,
.icon-button:active,
.play-button:active,
.step-button:active {
  transform: translateY(1px);
}

button:disabled,
input:disabled {
  cursor: not-allowed;
  opacity: 0.42;
}

.button {
  min-height: 38px;
  padding: 0 14px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 700;
}

.button svg {
  width: 17px;
  height: 17px;
}

.button-primary {
  background: var(--accent);
  color: var(--on-strong);
}

.button-primary:hover {
  background: var(--accent-dark);
}

.button-secondary {
  border: 1px solid var(--line-strong);
  background: var(--input-bg);
  color: var(--ink);
}

.button-secondary:hover {
  border-color: var(--ink);
  background: var(--surface-soft);
}

.icon-button,
.step-button {
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface-soft);
  color: var(--ink);
}

.icon-button {
  width: 39px;
  height: 39px;
}

.icon-button:hover,
.step-button:hover {
  border-color: var(--line-strong);
  background: var(--surface-hover);
}

.icon-button svg,
.step-button svg {
  width: 17px;
  height: 17px;
}

.play-button {
  width: 48px;
  height: 48px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--strong-bg);
  color: var(--on-strong);
}

.play-button:hover {
  background: var(--accent);
}

.play-button svg {
  width: 21px;
  height: 21px;
}

.control-label-row {
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  color: var(--muted);
  font-size: 11px;
}

.control-label-row output {
  color: var(--ink);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

input[type="range"] {
  width: 100%;
  height: 4px;
  accent-color: var(--accent);
}

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

.speed-presets {
  margin-top: 8px;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 4px;
}

.pitch-presets {
  margin-top: 8px;
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 4px;
}

.speed-presets button,
.pitch-presets button,
.segmented button {
  height: 27px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: var(--surface-soft);
  color: var(--muted);
  font-size: 10px;
  font-weight: 700;
}

.speed-presets button:hover,
.speed-presets button.active {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--accent-dark);
}

.pitch-controls input[type="range"] {
  accent-color: var(--yellow);
}

.pitch-presets button:hover,
.pitch-presets button.active {
  border-color: var(--yellow);
  background: var(--yellow-soft);
  color: var(--yellow-ink);
}

.range-with-icon {
  gap: 8px;
}

.range-with-icon svg {
  width: 17px;
  height: 17px;
  flex: 0 0 17px;
  color: var(--muted);
}

.loop-band {
  min-height: 82px;
  padding-top: 14px;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  border-top: 1px solid var(--line);
}

.loop-copy {
  min-width: 235px;
}

.loop-copy strong,
.loop-copy > span:last-child {
  display: block;
}

.loop-copy strong {
  margin-top: 2px;
  font-size: 13px;
}

.loop-copy > span:last-child {
  margin-top: 4px;
  color: var(--muted);
  font-size: 10px;
}

.loop-controls {
  width: min(100%, 560px);
  min-width: 0;
}

.loop-actions {
  justify-content: flex-end;
  gap: 7px;
}

.loop-range-editor {
  margin-top: 10px;
  padding: 9px 10px;
  display: grid;
  gap: 7px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface-soft);
}

.loop-range-editor[hidden] {
  display: none;
}

.loop-range-row {
  min-width: 0;
  display: grid;
  grid-template-columns: 20px minmax(100px, 1fr) 64px;
  align-items: center;
  gap: 8px;
}

.loop-range-row input {
  width: 100%;
  min-width: 0;
  margin: 0;
}

.loop-range-row output {
  color: var(--ink);
  font-size: 10px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  text-align: right;
}

.marker {
  width: 18px;
  height: 18px;
  display: inline-grid;
  place-items: center;
  border-radius: 3px;
  color: var(--on-strong);
  font-size: 10px;
  font-weight: 800;
}

.marker-a {
  background: var(--yellow);
  color: var(--yellow-ink);
}

.marker-b {
  background: var(--accent);
}

.switch-control {
  position: relative;
  min-height: 36px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--ink);
  cursor: pointer;
  font-size: 11px;
  font-weight: 700;
  white-space: nowrap;
}

.switch-control input {
  position: absolute;
  z-index: 1;
  inset: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  opacity: 0;
  cursor: pointer;
}

.switch-track {
  width: 34px;
  height: 19px;
  padding: 2px;
  display: block;
  border-radius: 10px;
  background: var(--switch-off);
  transition: background-color 150ms ease;
}

.switch-track span {
  width: 15px;
  height: 15px;
  display: block;
  border-radius: 50%;
  background: var(--on-strong);
  transition: transform 150ms ease;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.25);
}

.switch-control input:checked + .switch-track {
  background: var(--teal);
}

.switch-control input:checked + .switch-track span {
  transform: translateX(15px);
}

.metronome-heading {
  margin-bottom: 8px;
}

.live-indicator {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 700;
}

.live-indicator > span {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--switch-off);
}

.live-indicator.running {
  color: var(--teal-dark);
}

.live-indicator.running > span {
  background: var(--teal);
  box-shadow: 0 0 0 4px var(--teal-soft);
}

.live-indicator.counting {
  color: var(--yellow-ink);
}

.live-indicator.counting > span {
  background: var(--yellow);
  box-shadow: 0 0 0 4px var(--yellow-soft);
}

.bpm-display {
  margin: 13px 0 10px;
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr) 34px;
  align-items: center;
  gap: 10px;
}

.bpm-display label {
  text-align: center;
}

.bpm-display input {
  width: 126px;
  border: 0;
  background: transparent;
  color: var(--ink);
  text-align: center;
  font-size: 44px;
  line-height: 1;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  appearance: textfield;
}

.bpm-display input::-webkit-inner-spin-button {
  appearance: none;
}

.bpm-display label span {
  display: block;
  margin-top: 2px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 700;
}

.step-button {
  width: 34px;
  height: 34px;
}

.metro-sound-picker {
  width: min(180px, 62%);
  min-width: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 34px;
  align-items: center;
  gap: 6px;
}

.metro-sound-picker select {
  width: 100%;
  min-width: 0;
  height: 34px;
  padding: 0 28px 0 9px;
  border: 1px solid var(--line-strong);
  border-radius: 5px;
  background: var(--input-bg);
  color: var(--ink);
  font: inherit;
  font-size: 11px;
  font-weight: 700;
}

.sound-preview-button {
  width: 34px;
  height: 34px;
  color: var(--teal-dark);
}

.metronome-option-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.compact-setting-group .segmented {
  gap: 3px;
}

.compact-setting-group .segmented button {
  min-width: 0;
  padding: 0 2px;
  font-size: 9px;
}

.setting-group,
.setting-line {
  padding: 14px 0;
  border-bottom: 1px solid var(--line);
}

.setting-label {
  display: block;
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 11px;
}

.segmented {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 5px;
}

.segmented button {
  height: 32px;
  font-size: 11px;
}

.segmented button:hover,
.segmented button.active {
  border-color: var(--teal);
  background: var(--teal-soft);
  color: var(--teal-dark);
}

.setting-line {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.setting-line strong,
.setting-line span {
  display: block;
}

.setting-line strong {
  font-size: 11px;
}

.setting-line div > span {
  margin-top: 3px;
  color: var(--muted);
  font-size: 10px;
}

.switch-only {
  min-height: auto;
}

.metronome-visual-stage {
  position: relative;
  width: 100%;
  height: 82px;
  min-height: 82px;
  margin: auto 0 12px;
  overflow: hidden;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  background: var(--surface-soft);
}

.beat-lights {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  transition: opacity 120ms ease;
}

.metronome-visual-stage.counting-in .beat-lights {
  opacity: 0;
}

.count-in-display {
  position: absolute;
  inset: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 56px minmax(0, 1fr);
  align-items: center;
  gap: 8px;
  padding: 0 13px;
  background: var(--count-bg);
  color: var(--ink);
}

.count-in-display[hidden] {
  display: none;
}

.count-in-phase,
.count-in-caption {
  font-size: 10px;
  font-weight: 800;
}

.count-in-phase {
  color: var(--yellow-ink);
}

.count-in-caption {
  color: var(--muted);
  text-align: right;
}

.count-in-display strong {
  display: grid;
  place-items: center;
  color: var(--accent);
  font-size: 42px;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

.count-in-display.pulse strong {
  animation: count-pulse 180ms ease-out;
}

@keyframes count-pulse {
  0% { opacity: 0.35; transform: scale(0.78); }
  100% { opacity: 1; transform: scale(1); }
}

.beat-light {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--beat-off);
  transition: transform 70ms ease, background-color 70ms ease;
}

.beat-light.accent {
  width: 13px;
  height: 13px;
}

.beat-light.active {
  transform: scale(1.25);
  background: var(--teal);
}

.beat-light.accent.active {
  background: var(--yellow);
}

.metro-actions {
  gap: 8px;
}

.metro-actions .button {
  flex: 1;
}

.tap-button {
  border: 1px solid var(--line-strong);
  background: var(--surface-soft);
  color: var(--ink);
}

.tap-button:hover {
  background: var(--surface-hover);
}

.metro-button {
  background: var(--teal);
  color: var(--on-strong);
}

.metro-button:hover {
  background: var(--teal-dark);
}

.metro-button.running {
  background: var(--accent);
}

.status-bar {
  min-height: 37px;
  padding: 0 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  border-top: 1px solid var(--line);
  background: var(--panel);
  color: var(--muted);
  font-size: 10px;
}

.pitch-state {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  color: var(--teal-dark);
  white-space: nowrap;
}

.pitch-state svg {
  width: 14px;
  height: 14px;
}

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

@media (max-width: 1080px) {
  .workspace {
    grid-template-columns: minmax(0, 1fr) 300px;
  }

  .random-page {
    grid-template-columns: minmax(0, 1fr) 300px;
  }

  .random-note-display {
    gap: 16px;
    font-size: 70px;
  }

  .random-note-display .single-note,
  .note-placeholder {
    font-size: 96px;
  }

  .transport-band {
    grid-template-columns: 165px minmax(145px, 1fr) minmax(165px, 1fr);
    gap: 14px;
  }

  .volume-control {
    display: none;
  }

  .loop-copy > span:last-child {
    display: none;
  }
}
