:root {
  color-scheme: dark;
  --bg: #17171b;
  --card: #1f1f25;
  --card-hover: #26262d;
  --border: #2e2e37;
  --border-strong: #3d3d49;
  --text: #f2f2f6;
  --muted: #9b9bab;
  --accent: #a855f7;
  --accent-strong: #9333ea;
  --accent-soft: rgba(168, 85, 247, 0.16);
  --ok: #4ade80;
  --warn: #fbbf24;
  --error: #f87171;
  --wave-active: #a855f7;
  --wave-muted: #4a4a58;
  --wave-region: rgba(168, 85, 247, 0.12);
  --wave-axis: #7b7b8b;
  font: 14px/1.45 system-ui, -apple-system, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
}

button,
input,
select {
  font: inherit;
  color: inherit;
}

button {
  cursor: pointer;
}

button:disabled {
  cursor: default;
  opacity: 0.45;
}

input:focus-visible,
label:focus-within {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.app {
  padding: 14px 18px 18px;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: var(--bg);
  min-width: 0;
}

/* ---------- Header ---------- */

.header {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 34px;
}

.brand {
  font-weight: 700;
  font-size: 16px;
  letter-spacing: -0.01em;
}

.header-fill {
  flex: 1;
}

.status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 10px;
  border-radius: 999px;
  border: 1px solid var(--border);
  color: var(--muted);
  font-size: 12px;
}

.status i {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--muted);
}

.status.live {
  color: var(--ok);
  border-color: rgba(74, 222, 128, 0.35);
  background: rgba(74, 222, 128, 0.08);
}

.status.live i {
  background: var(--ok);
}

.collapse,
.back {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--muted);
  padding: 0;
}

.collapse:hover,
.back:hover {
  background: var(--card-hover);
  color: var(--text);
}

.back {
  border-color: transparent;
}

.file-button {
  cursor: pointer;
  padding: 6px 12px;
  border-radius: 999px;
  border: 1px solid var(--border);
  font-size: 13px;
}

.file-button:hover {
  background: var(--card-hover);
}

.file-button input {
  display: none;
}

/* ---------- Messages ---------- */

.empty {
  padding: 28px 8px 14px;
  color: var(--muted);
  text-align: center;
}

.empty p {
  margin: 0;
}

.banner {
  margin: 12px 0 0;
  padding: 9px 12px;
  border-radius: 10px;
  background: rgba(251, 191, 36, 0.09);
  border: 1px solid rgba(251, 191, 36, 0.28);
  color: #f5d98a;
  font-size: 13px;
}

.problem {
  margin: 10px 0 0;
  color: var(--error);
  font-size: 13px;
}

.hint {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 13px;
}

/* ---------- Task choice ---------- */

.question {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  margin: 16px 0 12px;
}

.question h2 {
  margin: 0;
  font-size: 17px;
  letter-spacing: -0.01em;
}

.song-title {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--muted);
  font-size: 12px;
}

.task-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 10px;
}

.task-card {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 6px;
  padding: 14px;
  text-align: left;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--card);
}

.task-card:hover:not(:disabled) {
  background: var(--card-hover);
  border-color: var(--accent);
}

.task-icon {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: var(--accent-soft);
  color: #d8b4fe;
}

.task-title {
  font-weight: 650;
  font-size: 14px;
}

.task-text {
  color: var(--muted);
  font-size: 12.5px;
  line-height: 1.4;
}

/* ---------- Setup ---------- */

.setup {
  margin-top: 14px;
}

.setup-top {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
}

.task-chip {
  padding: 4px 12px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: #e9d5ff;
  font-weight: 600;
  font-size: 13px;
}

.segmented {
  display: inline-flex;
  margin-left: auto;
  padding: 3px;
  border-radius: 999px;
  background: var(--card);
  border: 1px solid var(--border);
}

.segmented button {
  padding: 5px 14px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  font-size: 13px;
}

.segmented button.active {
  background: var(--accent);
  color: #fff;
}

.section-fields,
.loop-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-top: 12px;
}

.arrow {
  color: var(--muted);
}

.length-chip {
  padding: 3px 9px;
  border-radius: 999px;
  border: 1px solid var(--border);
  color: var(--muted);
  font: 12px ui-monospace, SFMono-Regular, Menlo, monospace;
}

.time-field {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 6px 4px 10px;
  border-radius: 10px;
  background: var(--card);
  border: 1px solid var(--border);
}

.time-label {
  color: var(--muted);
  font: 600 12px ui-monospace, SFMono-Regular, Menlo, monospace;
}

.time-field input {
  width: 64px;
  padding: 2px 0;
  border: 0;
  background: transparent;
  font: 600 15px ui-monospace, SFMono-Regular, Menlo, monospace;
  font-variant-numeric: tabular-nums;
}

.time-field input:focus-visible {
  outline: none;
}

.time-field:focus-within {
  border-color: var(--accent);
}

.nudge {
  display: inline-flex;
  flex-direction: column;
}

.nudge button {
  display: grid;
  place-items: center;
  width: 18px;
  height: 12px;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--muted);
}

.nudge button:hover {
  color: var(--text);
}

.now {
  padding: 3px 9px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: #c084fc;
  font-weight: 600;
  font-size: 13px;
}

.now:hover {
  background: var(--accent-soft);
}

.wave-frame {
  position: relative;
  margin-top: 12px;
  border-radius: 12px;
  background: #121216;
  border: 1px solid var(--border);
  overflow: hidden;
  padding: 6px 8px 4px;
}

.wave-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 10px;
  padding: 0 24px;
  background: rgba(18, 18, 22, 0.82);
  font-size: 13px;
  color: var(--muted);
}

.waveform {
  position: relative;
  width: 100%;
}

/* Canvas and playhead share the same origin inside the player's padded frame. */
.waveform-plot {
  position: relative;
  width: 100%;
  height: 100%;
}

.waveform canvas {
  display: block;
  width: 100%;
  height: 100%;
  touch-action: none;
}

.playhead {
  position: absolute;
  top: 0;
  bottom: 16px;
  left: 0;
  width: 2px;
  margin-left: -1px;
  background: #fff;
  box-shadow: 0 0 6px rgba(255, 255, 255, 0.6);
  pointer-events: none;
  opacity: 0;
}

.primary {
  display: block;
  width: 100%;
  margin-top: 14px;
  padding: 12px 16px;
  border: 0;
  border-radius: 12px;
  background: linear-gradient(90deg, #a855f7, #818cf8);
  color: #fff;
  font-weight: 650;
  font-size: 15px;
}

.primary:hover:not(:disabled) {
  filter: brightness(1.08);
}

/* ---------- Progress ---------- */

.progress-card {
  margin-top: 14px;
  padding: 14px 16px;
  border-radius: 12px;
  background: var(--card);
  border: 1px solid var(--border);
}

.progress-top {
  display: flex;
  align-items: center;
  gap: 14px;
}

.progress-icon {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  height: 26px;
}

.progress-icon i {
  width: 3px;
  border-radius: 2px;
  background: linear-gradient(#a855f7, #22d3ee);
  animation: pulse 1s ease-in-out infinite;
}

.progress-icon i:nth-child(1) {
  height: 12px;
}
.progress-icon i:nth-child(2) {
  height: 24px;
  animation-delay: 0.15s;
}
.progress-icon i:nth-child(3) {
  height: 16px;
  animation-delay: 0.3s;
}
.progress-icon i:nth-child(4) {
  height: 20px;
  animation-delay: 0.45s;
}

@keyframes pulse {
  50% {
    transform: scaleY(0.45);
  }
}

@media (prefers-reduced-motion: reduce) {
  .progress-icon i {
    animation: none;
  }
}

.progress-text {
  flex: 1;
  min-width: 0;
}

.progress-title {
  font-weight: 700;
  font-size: 16px;
}

.progress-range {
  margin-left: 6px;
  color: #c084fc;
  font: 13px ui-monospace, SFMono-Regular, Menlo, monospace;
}

.progress-detail {
  color: var(--muted);
  font-size: 13px;
}

.progress-percent {
  font-size: 26px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.progress-percent small {
  color: var(--muted);
  font-size: 13px;
  margin-left: 1px;
}

.bar {
  height: 6px;
  border-radius: 999px;
  background: #121216;
  overflow: hidden;
}

.bar.tall {
  margin-top: 12px;
  height: 8px;
}

.bar-fill {
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #a855f7, #22d3ee);
  transition: width 0.25s ease;
}

.progress-actions {
  display: flex;
  justify-content: flex-end;
  margin-top: 12px;
}

.outline {
  padding: 6px 16px;
  border-radius: 10px;
  border: 1px solid var(--border-strong);
  background: transparent;
}

.outline:hover {
  background: var(--card-hover);
}

/* ---------- Player ---------- */

.player {
  margin-top: 14px;
}

.transport {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 10px;
}

.play {
  flex: none;
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
}

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

.now-playing {
  flex: 1;
  min-width: 0;
}

.now-title {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 700;
  font-size: 16px;
}

.now-song {
  color: var(--muted);
  font-weight: 400;
  font-size: 13px;
}

.now-sub {
  color: var(--muted);
  font-size: 13px;
}

.clock {
  font: 600 20px ui-monospace, SFMono-Regular, Menlo, monospace;
  font-variant-numeric: tabular-nums;
}

.clock-position {
  display: inline-block;
  min-width: 5ch;
  text-align: right;
}

.clock-total {
  color: var(--muted);
  font-size: 16px;
}

.player .waveform {
  padding: 6px 8px 4px;
  border-radius: 12px;
  background: #121216;
  border: 1px solid var(--border);
  box-sizing: border-box;
}

.toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-left: auto;
  padding: 6px 12px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--muted);
  font-weight: 600;
  font-size: 13px;
}

.toggle.on {
  color: var(--ok);
  border-color: rgba(74, 222, 128, 0.4);
  background: rgba(74, 222, 128, 0.08);
}

/* ---------- Key and speed ---------- */

.strip {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 28px;
  margin-top: 12px;
  padding: 8px 14px;
  border-radius: 12px;
  background: var(--card);
  border: 1px solid var(--border);
}

.strip-note {
  flex-basis: 100%;
  color: var(--muted);
  font-size: 12px;
}

.knob {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.knob.speed {
  flex: 1 1 180px;
}

.knob-label {
  color: var(--muted);
  white-space: nowrap;
  font-weight: 600;
}

.knob input[type="range"] {
  flex: 1;
  min-width: 60px;
}

.knob-value {
  min-width: 38px;
  text-align: center;
  font: 600 15px ui-monospace, SFMono-Regular, Menlo, monospace;
  font-variant-numeric: tabular-nums;
}

.key-value {
  min-width: 34px;
  font-size: 17px;
}

button.step-button {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  padding: 0;
  border-radius: 50%;
  border: 1px solid var(--border-strong);
  background: transparent;
  color: var(--text);
}

button.step-button:hover:not(:disabled) {
  background: var(--accent-soft);
  border-color: var(--accent);
}

button.icon {
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--muted);
}

button.icon:hover:not(:disabled) {
  background: var(--card-hover);
  color: var(--text);
}

input[type="range"] {
  flex: 1;
  min-width: 70px;
}

.knob-value {
  min-width: 34px;
  text-align: center;
  font: 600 14px ui-monospace, SFMono-Regular, Menlo, monospace;
}

button.icon {
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--muted);
}

button.icon:hover:not(:disabled) {
  background: var(--card-hover);
  color: var(--text);
}

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

/* ---------- Mixer ---------- */

.mix-section {
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
}

.mix-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 10px;
}

.mix-title {
  color: var(--muted);
  font-weight: 600;
}

.presets,
.remove-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
}

.remove-row {
  margin-bottom: 10px;
}

.remove-label {
  color: var(--muted);
  font-size: 13px;
  margin-right: 4px;
}

.chip {
  padding: 5px 13px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--card);
  font-size: 13px;
}

.chip:hover {
  background: var(--card-hover);
}

.chip.pick.active {
  background: rgba(248, 113, 113, 0.14);
  border-color: rgba(248, 113, 113, 0.5);
  color: #fecaca;
  text-decoration: line-through;
}

.mixer {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 6px 12px;
  padding: 6px;
  border-radius: 12px;
  background: var(--card);
  border: 1px solid var(--border);
}

.player .mix-section + .waveform {
  margin-top: 8px;
}

.mixer-row {
  display: grid;
  grid-template-columns: minmax(64px, 84px) minmax(60px, 1fr) 42px 28px 28px;
  align-items: center;
  gap: 8px;
  padding: 6px 8px;
  border-radius: 8px;
}

.mixer-row.silent .mixer-name,
.mixer-row.silent .mixer-percent {
  color: var(--muted);
  opacity: 0.7;
}

.mixer-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 600;
}

.mixer-percent {
  text-align: right;
  font: 12px ui-monospace, SFMono-Regular, Menlo, monospace;
  color: var(--muted);
}

button.square {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  width: 28px;
  height: 28px;
  padding: 0;
  border-radius: 7px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--muted);
  font-weight: 700;
  font-size: 12px;
}

button.square.active {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: #e9d5ff;
}

/* ---------- Chords ---------- */

.key-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 12px;
  border-radius: 999px;
  border: 1px solid var(--border-strong);
  background: var(--card);
  color: var(--muted);
  font-size: 13px;
}

.key-chip strong {
  color: var(--text);
  font-size: 15px;
}

.chord-strip {
  margin-top: 6px;
  /* Lines up with the waveform above: its border plus padding. */
  padding: 0 9px;
}

.chord-track {
  position: relative;
  height: 32px;
}

.chord {
  position: absolute;
  top: 0;
  bottom: 0;
  display: grid;
  place-items: center;
  min-width: 0;
  padding: 0;
  border: 0;
  border-right: 1px solid var(--bg);
  border-radius: 4px;
  background: #2b2540;
  color: #d8c9ff;
  font-weight: 650;
  font-size: 13px;
  overflow: hidden;
  white-space: nowrap;
}

.chord:hover {
  background: #382f55;
}

.chord.now {
  background: #a855f7;
  color: #fff;
}

.chord.none {
  background: transparent;
  cursor: default;
}

.chord-note {
  margin-top: 6px;
  padding: 0 9px;
  color: var(--muted);
  font-size: 12px;
}

/* ---------- Library ---------- */

.header-button {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--muted);
  font-size: 13px;
}

.header-button:hover,
.header-button.active {
  background: var(--card-hover);
  color: var(--text);
}

.library {
  margin-top: 14px;
}

.library-head {
  display: flex;
  align-items: center;
  gap: 10px;
}

.library-head h2 {
  margin: 0;
  font-size: 17px;
}

.library-head .hint {
  margin: 2px 0 0;
}

.library-list {
  list-style: none;
  margin: 12px 0 0;
  padding: 0;
  display: grid;
  gap: 6px;
}

.library-list li {
  position: relative;
}

.library-row {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 8px 40px 8px 8px;
  text-align: left;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--card);
}

.library-row:hover:not(:disabled) {
  background: var(--card-hover);
  border-color: var(--accent);
}

.library-row:disabled {
  opacity: 1;
  cursor: default;
}

.library-row img {
  flex: none;
  width: 96px;
  height: 54px;
  object-fit: cover;
  border-radius: 8px;
  background: #121216;
}

.library-text {
  display: flex;
  flex-direction: column;
  min-width: 0;
  flex: 1;
}

.library-title {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 650;
}

.library-sub {
  color: var(--muted);
  font-size: 13px;
}

.badge {
  flex: none;
  padding: 3px 10px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: #d8b4fe;
  font-weight: 700;
  font-size: 11px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.library-forget {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  width: 26px;
  height: 26px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--muted);
  font-size: 18px;
  line-height: 1;
}

.library-forget:hover {
  background: var(--card-hover);
  color: var(--error);
}

.option {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 10px;
  color: var(--text);
  cursor: pointer;
}

.option small {
  margin-left: 6px;
  color: var(--muted);
  font-size: 12px;
}

.option input {
  accent-color: var(--accent);
}

/* A scrolling window onto the chords of a long song. */
.chord-ribbon {
  position: relative;
  height: 40px;
  margin-top: 8px;
  overflow: hidden;
  border-radius: 8px;
  background: #121216;
  border: 1px solid var(--border);
}

.chord-rail {
  position: absolute;
  inset: 0 auto 0 0;
  width: 0;
  will-change: transform;
}

.chord-ribbon .chord {
  top: 4px;
  bottom: 4px;
  font-size: 14px;
}

.chord-ribbon .chord.past {
  opacity: 0.45;
}

.chord-now-line {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 2px;
  margin-left: -1px;
  background: rgba(255, 255, 255, 0.85);
  pointer-events: none;
}

/* ---------- Chord diagrams ---------- */

.shapes {
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
}

.shapes-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 10px;
}

.shapes-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.shapes-controls select {
  padding: 5px 10px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--card);
  font-size: 13px;
}

.segmented.small {
  margin-left: 0;
}

.segmented.small button {
  padding: 4px 12px;
  font-size: 12px;
}

.shape-row {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  align-items: end;
  gap: 8px;
  padding: 10px 8px 6px;
  border-radius: 14px;
  background: var(--card);
  border: 1px solid var(--border);
}

.shape-slot {
  min-width: 0;
  opacity: 0.55;
}

.shape-slot.current {
  opacity: 1;
}

.shape-slot.past {
  opacity: 0.4;
}

.chord-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 8px 6px 10px;
  border-radius: 12px;
  border: 1px solid transparent;
}

.chord-card.current {
  background: #26212f;
  border-color: var(--accent);
  box-shadow: 0 0 0 1px rgba(168, 85, 247, 0.25), 0 10px 28px rgba(0, 0, 0, 0.45);
  transform: scale(1.1);
  transform-origin: bottom center;
  z-index: 1;
}

.chord-card-name {
  margin-top: 4px;
  font-weight: 750;
  font-size: 18px;
}

.chord-card.current .chord-card-name {
  font-size: 22px;
}

.chord-progress {
  width: 84%;
  height: 5px;
  margin-top: 8px;
  border-radius: 999px;
  background: #121216;
  overflow: hidden;
}

.chord-progress div {
  height: 100%;
  width: 100%;
  transform: scaleX(0);
  transform-origin: left;
  border-radius: inherit;
  background: linear-gradient(90deg, #a855f7, #818cf8);
}

.diagram {
  width: 100%;
  max-width: 118px;
  height: auto;
}

.diagram.piano {
  max-width: 150px;
  margin: 12px 0 8px;
}

.diagram .nut {
  fill: var(--text);
}

.diagram .fret,
.diagram .string {
  stroke: var(--border-strong);
  stroke-width: 1;
}

.diagram .dot {
  fill: var(--accent);
}

.diagram .finger {
  fill: #fff;
  font: 700 8px system-ui, sans-serif;
}

.diagram .marker {
  fill: var(--muted);
  font: 700 11px system-ui, sans-serif;
}

.diagram .open {
  fill: none;
  stroke: var(--muted);
  stroke-width: 1.2;
}

.diagram .position {
  fill: var(--muted);
  font: 600 8.5px system-ui, sans-serif;
}

.diagram .string-name {
  fill: var(--muted);
  font: 600 7.5px system-ui, sans-serif;
}

.diagram .white {
  fill: #e9e9ef;
}

.diagram .white.lit {
  fill: #a855f7;
}

.diagram .white.lit.root {
  fill: #7c3aed;
}

.diagram .black {
  fill: #17171b;
  stroke: #000;
  stroke-width: 0.5;
}

.diagram .black.lit {
  fill: #c084fc;
}

@media (max-width: 640px) {
  .shape-row {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .shape-slot.far {
    display: none;
  }
}

/* Backing tracks: choose a part, rather than operate a mixer. */
.backing-instruments {
  min-width: 0;
  margin: 22px 0 20px;
  padding: 0;
  border: 0;
}
.backing-instruments legend {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0;
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -0.025em;
}
.backing-step {
  display: inline-grid;
  place-items: center;
  flex: none;
  width: 26px;
  height: 26px;
  border-radius: 8px;
  background: var(--accent-soft);
  color: #d8b4fe;
  font-size: 13px;
  font-weight: 700;
}
.backing-description {
  margin: 7px 0 16px;
  color: var(--muted);
  font-size: 13px;
}
.instrument-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 10px;
}
.instrument-card {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 138px;
  min-width: 0;
  padding: 20px 7px 14px;
  border: 1px solid color-mix(in srgb, var(--instrument-color) 24%, var(--border));
  border-radius: 14px;
  background: linear-gradient(155deg, color-mix(in srgb, var(--instrument-color) 7%, var(--card)), var(--card));
  transition: border-color 120ms ease, background 120ms ease;
}
.instrument-card:hover {
  border-color: var(--instrument-color);
  background: color-mix(in srgb, var(--instrument-color) 12%, var(--card));
}
.instrument-card.removed {
  border-color: var(--instrument-color);
  background: linear-gradient(145deg, color-mix(in srgb, var(--instrument-color) 21%, var(--card)), color-mix(in srgb, var(--instrument-color) 9%, var(--card)));
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--instrument-color) 30%, transparent);
}
.instrument-icon {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  margin-bottom: 3px;
  border-radius: 13px;
  color: var(--instrument-color);
  background: color-mix(in srgb, var(--instrument-color) 13%, transparent);
}
.instrument-name { font-size: 13px; font-weight: 650; }
.instrument-state { font-size: 11px; color: var(--muted); }
.removed .instrument-state { color: var(--instrument-color); }
.instrument-check {
  position: absolute;
  top: 9px;
  right: 9px;
  display: grid;
  place-items: center;
  width: 18px;
  height: 18px;
  border: 1px solid var(--border-strong);
  border-radius: 50%;
  color: var(--muted);
  font-size: 12px;
  line-height: 1;
}
.removed .instrument-check { color: #17171b; border-color: transparent; background: var(--instrument-color); }
.backing-summary {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 6px 16px;
  min-height: 35px;
  margin-top: 9px;
  font-size: 12px;
  color: var(--muted);
}
.backing-summary p { margin: 0; }
.backing-reset { padding: 7px 0; border: 0; background: none; color: #d8b4fe; font-size: 12px; }
.backing-reset:hover { text-decoration: underline; }
.setup-range-head { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; margin-top: 12px; }
.setup-range-head h3 { display: flex; align-items: center; gap: 10px; margin: 0; font-size: 16px; font-weight: 650; }
.backing-setup .setup-range-head { border-top: 1px solid var(--border); padding-top: 18px; margin-bottom: 16px; }
.analysis-options { margin: 14px 0; color: var(--muted); font-size: 12px; }
.analysis-options summary { cursor: pointer; width: fit-content; padding: 5px 0; }
.analysis-options summary:focus-visible { outline: 2px solid var(--accent); outline-offset: 4px; }
.backing-setup .primary { width: 100%; min-height: 48px; border: 0; background: linear-gradient(110deg, #c084fc, #9ca8ff); color: #191326; font-weight: 750; }
.backing-setup .primary:hover:not(:disabled) { filter: brightness(1.08); }
@media (max-width: 760px) {
  .instrument-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .instrument-card { min-height: 126px; }
}
@media (max-width: 420px) {
  .instrument-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .setup-range-head .segmented { margin-left: 0; }
  .backing-instruments legend { font-size: 16px; }
}
@media (prefers-reduced-motion: reduce) {
  .instrument-card { transition: none; }
}

/* ---------- Lyrics (Karaoke) ---------- */
.lyrics {
  margin-top: 14px;
  padding: 12px 16px 14px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: linear-gradient(180deg, rgba(168, 85, 247, 0.07), rgba(168, 85, 247, 0.02));
}

.lyrics-head {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 6px;
}

.lyrics-title {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
}

.lyrics-hint {
  font-size: 12px;
  color: var(--muted);
  opacity: 0.7;
}

.lyrics-language {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
  font-size: 12px;
  color: var(--muted);
}

.lyrics-language select {
  padding: 4px 8px;
  border: 1px solid var(--border-strong);
  border-radius: 8px;
  background: var(--card);
  font-size: 12px;
}

.lyrics-note {
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: flex-start;
  padding: 10px 0 4px;
  font-size: 13px;
  color: var(--muted);
}

.lyrics-note em {
  font-style: normal;
  opacity: 0.7;
}

.lyrics-bar {
  width: 100%;
  height: 4px;
  border-radius: 2px;
  background: var(--border);
  overflow: hidden;
}

.lyrics-bar > div {
  height: 100%;
  border-radius: 2px;
  background: var(--accent);
  transition: width 0.4s ease;
}

.lyrics-stage {
  contain: layout paint;
  position: relative;
  height: 260px;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-gutter: stable;
  padding: 80px 0;
  scroll-padding-block: 80px;
}

.lyrics-line {
  position: relative;
  display: block;
  width: 100%;
  padding: 12px;
  border: 0;
  background: none;
  text-align: center;
  font-size: 22px;
  font-weight: 700;
  line-height: 1.4;
  opacity: 0.6;
  cursor: pointer;
}
.lyrics-line.now { opacity: 1; }
.lyrics-line.past { opacity: 0.4; }
.lyrics-line:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.lyrics-follow { margin-bottom: 8px; }

.lyrics-word {
  --p: 0%;
  display: inline-block;
  margin: 0 0.14em;
  color: transparent;
  background: linear-gradient(90deg, #fff var(--p), #6e6e80 var(--p));
  -webkit-background-clip: text;
  background-clip: text;
}

.lyrics-line.now .lyrics-word {
  background: linear-gradient(90deg, #d8b4fe var(--p), #9a9aae var(--p));
  -webkit-background-clip: text;
  background-clip: text;

}

.lyrics-spacer {
  flex: 1;
}

.lyrics-language {
  margin-left: 0;
}

.lyrics-hint.busy {
  color: var(--accent);
  opacity: 1;
}

.lyrics-sync {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--muted);
}

.lyrics-sync button {
  width: 22px;
  height: 22px;
  padding: 0;
  border: 1px solid var(--border-strong);
  border-radius: 50%;
  background: var(--card);
  line-height: 1;
}

.lyrics-sync input {
  width: 70px;
  padding: 4px;
  border: 1px solid var(--border-strong);
  border-radius: 6px;
  background: var(--card);
  color: var(--text);
  text-align: center;
  font: inherit;
  font-variant-numeric: tabular-nums;
}

/* The wait before the singing starts again (an intro, a solo): a bar that fills up to it. */
.lyrics-wait {
  display: flex;
  align-items: center;
  gap: 10px;
  height: 22px;
  margin: 4px 0 2px;
  font-size: 12px;
  color: var(--muted);
  opacity: 0;
  transition: opacity 0.3s ease;
}

.lyrics-wait-bar {
  flex: 1;
  height: 6px;
  border-radius: 3px;
  background: var(--border);
  overflow: hidden;
}

.lyrics-wait-bar > div {
  width: 100%;
  height: 100%;
  border-radius: 3px;
  background: linear-gradient(90deg, var(--accent-strong), #d8b4fe);
  transform-origin: 0 50%;
  transform: scaleX(0);
}

.lyrics-wait-time {
  min-width: 28px;
  text-align: right;
  font-variant-numeric: tabular-nums;
}

/* Right-to-left lyrics (Hebrew, Arabic…) fill from the right. */
.lyrics-line:dir(rtl) .lyrics-word {
  background: linear-gradient(270deg, #fff var(--p), #6e6e80 var(--p));
  -webkit-background-clip: text;
  background-clip: text;
}

.lyrics-line.now:dir(rtl) .lyrics-word {
  background: linear-gradient(270deg, #d8b4fe var(--p), #9a9aae var(--p));
  -webkit-background-clip: text;
  background-clip: text;
}

@media (prefers-reduced-motion: reduce) {
  .lyrics-line {
    transition: none;
  }
}

/* All chord visuals belong to the optional Chords section. */
.chords-title { margin: 0; font-size: 14px; }
.chords-overview { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 10px; }
.shapes .shape-row { margin-top: 14px; }
.shapes .chord-strip { padding: 0; }
.shapes .chord-ribbon { contain: layout paint; }
.chord-progress { contain: layout paint; }

.lyrics-head {
  flex-wrap: wrap;
}

.lyrics-hint,
.lyrics-title,
.lyrics-sync,
.lyrics-language {
  white-space: nowrap;
}

/* On a video the player has no play button of its own: a back arrow, the card's name and a quiet line. */
.transport.minimal {
  gap: 10px;
  margin-bottom: 12px;
}

.transport.minimal .now-sub {
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  color: var(--muted);
  font-size: 13px;
}

.mixer-row.no-solo { grid-template-columns: minmax(64px, 84px) minmax(60px, 1fr) 42px 28px; }
.master-volume { background: var(--card); border: 1px solid var(--border); margin: 8px 0 14px; }

.count-in-live { position: absolute; left: 0; top: 50%; transform: translateY(-50%); display: flex; align-items: center; gap: 6px; white-space: nowrap; color: #d8b4fe; font-size: 13px; }
.count-in-live strong { font-size: 20px; min-width: 20px; text-align: center; font-variant-numeric: tabular-nums; }

.count-in-slot { position: relative; flex: 0 0 auto; min-height: 36px; display: flex; align-items: center; }

.audio-export { border-top: 1px solid var(--border); padding-top: 14px; margin: 16px 0; }
.export-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; }
.export-actions select { background: var(--card); color: var(--text); border: 1px solid var(--border); border-radius: 8px; padding: 7px 10px; font: inherit; }
.export-note { color: var(--muted); font-size: 12px; margin: 8px 0 0; }

.audio-drop-overlay {
  position: fixed;
  inset: 12px;
  z-index: 1000;
  display: grid;
  place-items: center;
  border: 2px dashed var(--accent);
  border-radius: 18px;
  background: rgba(23, 23, 27, 0.94);
  color: var(--text);
  font-size: 24px;
  font-weight: 650;
  pointer-events: none;
}

.brand-link { display: inline-flex; align-items: center; gap: 10px; color: inherit; text-decoration: none; }
.brand-link:hover { opacity: 0.85; }
.file-thumb { display: grid; place-items: center; background: var(--accent-soft); color: #c084fc; font-size: 32px; }
.library-row .file-thumb { width: 128px; height: 72px; flex: none; border-radius: 8px; }

.lyrics-search { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 12px; }
.lyrics-search input { flex: 1; min-width: 180px; border: 1px solid var(--border); border-radius: 8px; padding: 7px 10px; background: var(--bg); }
.lyrics-matches { display: grid; gap: 7px; margin: 12px 0; }
.lyrics-match { display: flex; flex-direction: column; align-items: flex-start; gap: 4px; text-align: left; padding: 10px 12px; border: 1px solid var(--border); border-radius: 10px; background: var(--card); }
.lyrics-match:hover { border-color: var(--accent); }
.lyrics-match span { color: var(--muted); font-size: 12px; }

.stem-volume-action { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; }
.stem-volume-action label { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); font-size: 13px; }
.stem-volume-action input { width: 64px; padding: 5px 7px; border: 1px solid var(--border-strong); border-radius: 6px; background: var(--card); color: var(--text); font: inherit; }

.loop-transport { display: inline-flex; gap: 6px; margin-left: auto; }

.practice-timing { display: inline-flex; align-items: center; flex: 0 0 auto; font-size: 12px; color: var(--muted); }
.practice-musical-settings { display: flex; flex-basis: 100%; flex-wrap: wrap; align-items: center; gap: 12px 20px; font-size: 12px; color: var(--muted); }
.practice-timing label, .practice-musical-settings label { display: inline-flex; align-items: center; gap: 8px; }
.practice-timing label:focus-within, .practice-musical-settings label:focus-within { outline: none; }
.practice-timing select:focus { outline: none; box-shadow: none; }
.practice-timing select:focus-visible { outline: none; border-color: var(--border); }
.practice-timing select, .practice-musical-settings select { color: var(--text); background: var(--bg); border: 1px solid var(--border); border-radius: 6px; padding: 5px 8px; }
.practice-musical-settings p { flex-basis: 100%; margin: 0; }

.practice-musical-settings input[type="number"] { width: 80px; color: var(--text); background: var(--bg); border: 1px solid var(--border); border-radius: 6px; padding: 5px 8px; font: inherit; }
.practice-musical-settings select,
.practice-musical-settings input[type="number"],
.practice-musical-settings .time-field-plain input { height: 30px; }

.time-field-group { display: inline-flex; align-items: center; gap: 8px; }

.time-field-inline { display: contents; }

.practice-musical-settings .time-field-plain {
  padding: 0;
  gap: 6px;
  border: 0;
  background: transparent;
}
.practice-musical-settings .time-field-plain input {
  width: 80px;
  padding: 5px 8px;
  color: var(--text);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  font: inherit;
}
.practice-musical-settings .time-field-plain input:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}
.time-field-group > .knob-label { font-weight: normal; }

.song-bpm-input { appearance: textfield; -moz-appearance: textfield; }
.song-bpm-input::-webkit-inner-spin-button,
.song-bpm-input::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }

/* Named practice sections stay compact until opened. */
.practice-sections { margin: 10px 0; }
.sections-content { margin-top: 8px; padding: 12px; background: var(--card); border: 1px solid var(--border); border-radius: 12px; }
.sections-content .hint { margin: 0 0 10px; color: var(--muted); }
.section-form, .section-item { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.section-form input { flex: 1; min-width: 150px; }
.section-item { margin-top: 8px; }
.section-load { flex: 1; min-width: 180px; text-align: left; display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.section-load span { color: var(--muted); font-size: 12px; }

.section-timeline { padding: 0 9px; margin: 6px 0 10px; }
.section-timeline-row { position: relative; height: 30px; margin-top: 4px; border-radius: 4px; background: #121216; cursor: pointer; }
.section-marker { position: absolute; top: 0; height: 30px; min-width: 0; padding: 0 5px; border-radius: 4px; border: 1px solid var(--accent); background: var(--accent-soft); color: var(--text); text-align: left; overflow: hidden; }
.section-marker span { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 12px; }
.section-marker:hover { background: #48305f; }

.section-lead { margin-bottom: 12px; }

.section-marker { display: flex; padding: 0; }
.section-marker-name { flex: 1; min-width: 0; padding: 0 5px; border: 0; border-radius: 0; background: transparent; text-align: left; }
.section-marker-practice { flex: 0 0 24px; padding: 0; border: 0; border-left: 1px solid var(--accent); border-radius: 0; background: transparent; }

/* Section controls use the same dark cards and rounded actions as the player. */
.sections-content { padding: 16px; background: linear-gradient(135deg, #24202c, var(--card) 55%); }
.section-lead { width: fit-content; padding: 8px 12px; border: 1px solid var(--border); border-radius: 12px; background: var(--bg); }
.section-form { padding-bottom: 14px; margin-bottom: 4px; border-bottom: 1px solid var(--border); }
.section-form input { height: 38px; padding: 0 12px; background: var(--bg); border: 1px solid var(--border-strong); border-radius: 9px; }
.section-form input::placeholder { color: var(--muted); }
.section-form button, .section-item > button:not(.section-load) { min-height: 34px; padding: 7px 12px; border: 1px solid var(--border-strong); border-radius: 999px; background: var(--card); color: var(--text); font-size: 12px; font-weight: 600; }
.section-form button:hover:not(:disabled), .section-item > button:hover:not(:disabled) { background: var(--card-hover); border-color: #785494; }
.section-form .section-save, .section-item > .section-practice { background: var(--accent-soft); border-color: #6d4391; color: #e4c6ff; }
.section-item { padding: 10px; border: 1px solid var(--border); border-radius: 12px; background: var(--bg); gap: 6px; }
.section-load { padding: 5px 8px; border: 0; border-radius: 8px; background: transparent; flex-direction: column; align-items: flex-start; gap: 4px; }
.section-load strong { font-size: 14px; }
.section-load span { font-variant-numeric: tabular-nums; }
.section-item > .square { width: 30px; min-height: 30px; padding: 0; color: var(--muted); }
.section-item > .square:hover:not(:disabled) { color: #fca5a5; border-color: #8a4444; background: #352126; }
.section-marker { border-color: #69478b; background: linear-gradient(120deg, #352344, #26202f); }
.section-marker-name { color: #e6d3fb; }
.section-marker-practice { color: #d4b2f7; border-left-color: #69478b; }
.section-marker-practice:hover:not(:disabled) { background: #573370; }
@media (max-width: 600px) { .section-load { flex-basis: 100%; } }

.section-item > .square { display: inline-flex; align-items: center; justify-content: center; line-height: 1; }

.section-marker-practice { display: inline-flex; align-items: center; justify-content: center; line-height: 1; }

.section-practice-margins { display: flex; gap: 16px; align-items: center; overflow-x: auto; }
.section-practice-margins .section-lead { flex-shrink: 0; }

/* Transport keys can leave a clicked button focused; keep buttons free of focus outlines. */
button:focus, button:focus-visible { outline: none; }

.song-loading { display: flex; align-items: center; justify-content: center; gap: 18px; min-height: 220px; padding: 32px; border: 1px solid var(--border); border-radius: 16px; background: var(--card); }
.song-loading strong { font-size: 18px; }
.song-loading p { margin: 8px 0 0; color: var(--muted); }
.song-loading-spinner { display: block; flex-shrink: 0; width: 32px; height: 32px; border: 3px solid var(--border-strong); border-top-color: var(--accent); border-radius: 50%; animation: song-loading-spin .8s linear infinite; }
@keyframes song-loading-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .song-loading-spinner { animation: none; } }
