:root {
  --bg: #0f1114;
  --bg-elevated: #171a1f;
  --panel: #1c2128;
  --panel-2: #242b34;
  --border: #2e3640;
  --text: #e8ecef;
  --muted: #8b95a1;
  --accent: #ff4d6d;
  --accent-dim: #c73854;
  --ok: #3ecf8e;
  --danger: #e85d5d;
  --pad: #2a313b;
  --pad-label: #6b7582;
  --shadow: 0 12px 40px rgba(0, 0, 0, 0.45);
  --radius: 12px;
  --c1: #ff4d6d;
  --c2: #3db8ff;
  --c3: #f0c040;
  --c4: #3ecf8e;
  --c5: #c084fc;
  --c6: #fb923c;
  --c7: #67e8f9;
  --c8: #f472b6;
  font-family: "IBM Plex Sans", system-ui, sans-serif;
  color: var(--text);
  background: var(--bg);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  background:
    radial-gradient(1200px 600px at 10% -10%, rgba(255, 77, 109, 0.12), transparent 55%),
    radial-gradient(900px 500px at 100% 0%, rgba(61, 184, 255, 0.08), transparent 50%),
    var(--bg);
}

body {
  line-height: 1.45;
}

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

.app {
  max-width: 1180px;
  margin: 0 auto;
  padding: 28px 20px 60px;
}

.header {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 12px;
  margin-bottom: 24px;
}

.header-top {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 16px 20px;
}

.header-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
}

.tuner-open-btn {
  border: 1px solid var(--border);
  background: var(--panel);
  color: var(--text);
  padding: 8px 14px;
  border-radius: 999px;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  transition: border-color 160ms ease, background 160ms ease, color 160ms ease;
}

.tuner-open-btn:hover {
  border-color: rgba(255, 255, 255, 0.2);
  background: var(--panel-2);
}

/* —— Chromatic tuner modal —— */
.tuner-modal {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: grid;
  place-items: center;
  padding: 20px;
}

.tuner-modal[hidden] {
  display: none !important;
}

.tuner-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.62);
}

.tuner-dialog {
  position: relative;
  z-index: 1;
  width: min(420px, 100%);
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 18px;
  box-shadow: var(--shadow);
  padding: 18px 20px 20px;
}

.tuner-dialog-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 4px;
}

.tuner-dialog-head h2 {
  margin: 0;
  font-size: 1.15rem;
  letter-spacing: -0.02em;
}

.tuner-close {
  width: 34px;
  height: 34px;
  border: 0;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.06);
  color: var(--muted);
  font-size: 1.35rem;
  line-height: 1;
  cursor: pointer;
}

.tuner-close:hover {
  color: var(--text);
  background: rgba(255, 255, 255, 0.1);
}

.tuner-hint {
  margin: 0 0 16px;
  color: var(--muted);
  font-size: 0.82rem;
}

.tuner-display {
  text-align: center;
  padding: 8px 0 4px;
}

.tuner-note {
  font-family: "IBM Plex Mono", monospace;
  font-size: 3.4rem;
  font-weight: 600;
  line-height: 1;
  letter-spacing: -0.03em;
  color: var(--text);
  min-height: 1.1em;
}

.tuner-cents {
  margin-top: 8px;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--muted);
  min-height: 1.4em;
}

.tuner-display[data-state="in"] .tuner-note,
.tuner-display[data-state="in"] .tuner-cents {
  color: var(--ok);
}

.tuner-display[data-state="flat"] .tuner-cents,
.tuner-display[data-state="sharp"] .tuner-cents {
  color: var(--c3);
}

.tuner-meter {
  margin: 18px auto 10px;
  max-width: 320px;
}

.tuner-meter-track {
  position: relative;
  height: 10px;
  border-radius: 999px;
  background: linear-gradient(
    90deg,
    rgba(240, 192, 64, 0.35),
    rgba(62, 207, 142, 0.45) 45%,
    rgba(62, 207, 142, 0.45) 55%,
    rgba(240, 192, 64, 0.35)
  );
  border: 1px solid var(--border);
}

.tuner-meter-mark {
  position: absolute;
  top: -4px;
  left: calc(var(--p) * 1%);
  width: 1px;
  height: 18px;
  background: rgba(255, 255, 255, 0.28);
  transform: translateX(-50%);
}

.tuner-meter-mark.mid {
  width: 2px;
  background: rgba(255, 255, 255, 0.55);
}

.tuner-needle {
  position: absolute;
  top: -8px;
  left: calc(50% + (var(--cents) / 50) * 50%);
  width: 4px;
  height: 26px;
  margin-left: -2px;
  border-radius: 2px;
  background: #fff;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.45);
  transition: left 160ms ease-out, background 160ms ease, opacity 180ms ease;
}

.tuner-display[data-state="in"] .tuner-needle {
  background: var(--ok);
}

.tuner-display[data-state="idle"] .tuner-needle {
  opacity: 0.4;
}

.tuner-meter-labels {
  display: flex;
  justify-content: space-between;
  margin-top: 8px;
  font-size: 0.72rem;
  color: var(--muted);
  font-family: "IBM Plex Mono", monospace;
}

.tuner-hz {
  margin-top: 10px;
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.9rem;
  color: var(--muted);
}

.tuner-status {
  margin: 12px 0 0;
  min-height: 1.3em;
  font-size: 0.82rem;
  color: var(--danger);
  text-align: center;
}

.tuner-status:empty {
  display: none;
}

/* —— Pads / Strings (static top row) —— */
.family-toggle {
  position: relative;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 3px;
  padding: 3px;
  width: 188px;
  flex-shrink: 0;
  border-radius: 999px;
  background: var(--panel);
  border: 1px solid var(--border);
}

.family-glider {
  position: absolute;
  top: 3px;
  left: 3px;
  width: calc(50% - 3px);
  height: calc(100% - 6px);
  border-radius: 999px;
  background: linear-gradient(145deg, rgba(255, 77, 109, 0.95), rgba(255, 122, 89, 0.88));
  box-shadow: 0 4px 12px rgba(255, 77, 109, 0.28);
  transition: left 220ms cubic-bezier(0.22, 1, 0.36, 1);
  pointer-events: none;
  z-index: 0;
}

.family-toggle[data-family="strings"] .family-glider {
  left: calc(50%);
}

.family-btn {
  position: relative;
  z-index: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  border: 0;
  background: transparent;
  color: var(--muted);
  padding: 8px 10px;
  border-radius: 999px;
  cursor: pointer;
  transition: color 180ms ease;
}

.family-btn:hover {
  color: var(--text);
}

.family-btn.active {
  color: #fff;
}

.family-glyph {
  width: 16px;
  height: 16px;
  display: grid;
  place-items: center;
  flex-shrink: 0;
  opacity: 0.9;
}

.glyph-pads,
.glyph-strings {
  display: block;
  width: 12px;
  height: 12px;
}

.glyph-pads {
  background:
    linear-gradient(currentColor, currentColor) 0 0 / 4px 4px no-repeat,
    linear-gradient(currentColor, currentColor) 8px 0 / 4px 4px no-repeat,
    linear-gradient(currentColor, currentColor) 0 8px / 4px 4px no-repeat,
    linear-gradient(currentColor, currentColor) 8px 8px / 4px 4px no-repeat;
}

.glyph-strings {
  background:
    linear-gradient(currentColor, currentColor) center 0 / 1.5px 12px no-repeat,
    linear-gradient(currentColor, currentColor) calc(50% - 3.5px) 0 / 1.5px 12px no-repeat,
    linear-gradient(currentColor, currentColor) calc(50% + 3.5px) 0 / 1.5px 12px no-repeat;
}

.family-name {
  font-weight: 700;
  font-size: 0.82rem;
  letter-spacing: 0.01em;
  line-height: 1;
}

/* —— Options tray (changes; reserved height so page doesn't jump) —— */
.instrument-tray {
  display: flex;
  align-items: center;
  min-height: 52px;
  padding: 8px 10px;
  border-radius: 14px;
  background: var(--panel);
  border: 1px solid var(--border);
}

.tray-label {
  flex-shrink: 0;
  margin-right: 12px;
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}

.option-panel {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  width: 100%;
  animation: tray-in 180ms ease;
}

.option-panel[hidden] {
  display: none !important;
}

@keyframes tray-in {
  from {
    opacity: 0;
    transform: translateY(3px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.option-toggle {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.option-btn {
  display: inline-flex;
  align-items: baseline;
  gap: 8px;
  border: 1px solid var(--border);
  background: rgba(0, 0, 0, 0.18);
  color: var(--muted);
  padding: 7px 12px;
  border-radius: 999px;
  cursor: pointer;
  transition: border-color 160ms ease, background 160ms ease, color 160ms ease;
}

.option-btn:hover {
  color: var(--text);
  border-color: rgba(255, 255, 255, 0.16);
}

.option-btn.active {
  color: var(--text);
  background: rgba(61, 184, 255, 0.12);
  border-color: rgba(61, 184, 255, 0.45);
}

.option-title {
  font-family: "IBM Plex Mono", monospace;
  font-weight: 700;
  font-size: 0.85rem;
  letter-spacing: 0.02em;
}

.option-meta {
  font-size: 0.68rem;
  opacity: 0.75;
}

.string-chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  align-items: center;
}

.string-chip {
  border: 1px solid var(--border);
  background: rgba(0, 0, 0, 0.18);
  color: var(--muted);
  padding: 7px 11px;
  border-radius: 999px;
  cursor: pointer;
  font-size: 0.74rem;
  font-weight: 600;
  line-height: 1.15;
  white-space: nowrap;
  transition: border-color 160ms ease, background 160ms ease, color 160ms ease;
}

.string-chip:hover {
  color: var(--text);
  border-color: rgba(255, 255, 255, 0.16);
}

.string-chip.active {
  color: #111;
  background: linear-gradient(145deg, #f0c040, #e8a83a);
  border-color: transparent;
  box-shadow: 0 4px 12px rgba(240, 192, 64, 0.25);
}

@media (max-width: 760px) {
  .header-controls {
    width: 100%;
    justify-content: stretch;
  }

  .family-toggle {
    width: 100%;
    max-width: 280px;
  }

  .header-controls .tabs {
    width: 100%;
    overflow-x: auto;
  }

  .instrument-tray {
    min-height: 64px;
  }
}

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

.capo-field input {
  width: 4.5rem;
}

/* Fretboard / fingerboard diagrams */
.fretboard {
  position: relative;
  margin-top: 8px;
  padding: 8px 6px 6px;
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.22);
  border: 1px solid var(--border);
  min-width: 160px;
}

.fretboard.many-strings {
  min-width: 200px;
  max-height: 420px;
  overflow-y: auto;
  padding: 6px 4px 4px;
}

.fretboard.many-strings .fret-string-row {
  min-height: 14px;
}

.fretboard.many-strings .fret-string-name {
  font-size: 0.58rem;
  width: 1.4rem;
}

.fretboard.many-strings .fret-cells {
  min-height: 12px;
}

.fretboard.many-strings.scale .fret-string-row,
.fretboard.many-strings.scale .fret-cells,
.fretboard.many-strings.scale .fret-cell {
  min-height: 18px;
}

.fretboard.many-strings.scale .fret-dot {
  width: 16px;
  height: 16px;
  font-size: 0.42rem;
}

.fretboard.many-strings.scale .fret-dot.accidental {
  font-size: 0.36rem;
}

.fret-meta {
  display: flex;
  gap: 8px;
  margin-bottom: 6px;
  font-size: 0.7rem;
  font-family: "IBM Plex Mono", monospace;
  color: var(--muted);
}

.fret-tuning-badge {
  color: var(--text);
  font-weight: 600;
  letter-spacing: 0.04em;
}

.fret-orient-label {
  color: var(--muted);
  font-weight: 500;
  letter-spacing: 0.02em;
}

.fret-capo-badge {
  color: var(--c2);
}

.fret-base-label {
  color: var(--c3);
}

.fret-stringset-badge {
  color: var(--accent);
  font-weight: 600;
}

.fret-grid {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.fret-string-row {
  display: flex;
  align-items: center;
  gap: 4px;
}

.fret-string-row.muted {
  opacity: 0.72;
}

.fret-string-row.disabled {
  opacity: 0.42;
}

.fret-string-row.muted .fret-string-name,
.fret-string-row.muted .fret-nut-mark {
  color: #a8b0ba;
}

.fret-string-row.muted .fret-cells {
  background: rgba(0, 0, 0, 0.22) !important;
  border-left-color: rgba(255, 255, 255, 0.22);
}

.fret-string-row.muted .fret-cell {
  border-right-color: rgba(255, 255, 255, 0.08);
}

.fret-string-name {
  width: 1.15rem;
  font-size: 0.7rem;
  font-weight: 600;
  font-family: "IBM Plex Mono", monospace;
  color: var(--text);
  text-align: right;
  flex-shrink: 0;
}

.fret-nut-mark {
  width: 1rem;
  text-align: center;
  font-size: 0.75rem;
  color: var(--text);
  flex-shrink: 0;
  line-height: 1;
}

.fret-cells {
  display: grid;
  grid-template-columns: repeat(var(--frets, 4), 1fr);
  flex: 1;
  gap: 0;
  border-left: 3px solid rgba(255, 255, 255, 0.55);
  min-height: 20px;
  border-radius: 0 4px 4px 0;
  overflow: hidden;
}

/* Alternating string lanes — light tints; 1px borders separate strings */
.fret-string-row:nth-child(odd) .fret-cells {
  background: rgba(255, 255, 255, 0.035);
}

.fret-string-row:nth-child(even) .fret-cells {
  background: rgba(255, 255, 255, 0.06);
}

.fret-string-row + .fret-string-row .fret-cells {
  border-top: 1px solid rgba(255, 255, 255, 0.14);
}

.fretboard.fingerboard .fret-cells {
  border-left-color: rgba(255, 255, 255, 0.25);
}

.fret-cell {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  border-right: 1px solid rgba(255, 255, 255, 0.14);
  min-height: 20px;
}

.fret-cell:has(.fret-dot) {
  background: rgba(255, 255, 255, 0.08);
}

.fretboard.fingerboard .fret-cell {
  border-right-style: dotted;
  border-right-color: rgba(255, 255, 255, 0.12);
}

.fret-dot {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.62rem;
  font-weight: 700;
  font-family: "IBM Plex Mono", monospace;
  color: #111;
  line-height: 1;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.35);
}

.fretboard.scale .fret-cell {
  min-height: 24px;
}

.fretboard.scale .fret-dot {
  width: 20px;
  height: 20px;
  font-size: 0.52rem;
  letter-spacing: -0.04em;
  white-space: nowrap;
}

.fretboard.scale .fret-dot.accidental {
  font-size: 0.42rem;
  letter-spacing: -0.08em;
}

.fret-dot.barre {
  border-radius: 4px;
  width: 14px;
}

.fret-dot.root {
  box-shadow: 0 0 0 2px #fff;
}

.fret-method-badge {
  color: var(--c3);
  font-weight: 600;
}

/* Upright / standing-bass chart (Simandl and future methods) */
.bass-method-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 10px;
  flex: 1 0 100%;
  padding-top: 6px;
  margin-top: 2px;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
}

.bass-method-bar[hidden] {
  display: none !important;
}

.bass-method-chips,
.bass-pos-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  align-items: center;
}

.bass-pos-chip {
  border: 1px solid var(--border);
  background: rgba(0, 0, 0, 0.18);
  color: var(--muted);
  padding: 5px 9px;
  border-radius: 999px;
  cursor: pointer;
  font-size: 0.72rem;
  font-weight: 700;
  font-family: "IBM Plex Mono", monospace;
  line-height: 1.15;
  min-width: 2rem;
  transition: border-color 160ms ease, background 160ms ease, color 160ms ease;
}

.bass-pos-chip:hover {
  color: var(--text);
  border-color: rgba(255, 255, 255, 0.2);
}

.bass-pos-chip.active {
  color: #fff;
}

.bass-pos-all,
.bass-pos-none {
  font-family: "IBM Plex Sans", system-ui, sans-serif;
  font-weight: 600;
  letter-spacing: 0.02em;
}

.card.upright-card {
  min-width: min(100%, 280px);
}

.upright-split {
  display: flex;
  flex-direction: column;
  gap: 14px;
  width: 100%;
  max-width: 460px;
}

.fret-region-badge {
  color: var(--c3);
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  font-size: 0.68rem;
}

.fretboard.upright {
  min-width: 240px;
  width: 100%;
  max-width: 420px;
  padding: 10px 8px 8px;
  background:
    linear-gradient(180deg, rgba(72, 48, 28, 0.35), rgba(28, 18, 10, 0.5)),
    rgba(0, 0, 0, 0.28);
}

.preview-area .fretboard.upright {
  --neck-h: 780px;
  max-width: 460px;
}

.preview-area .upright-split {
  max-width: 460px;
}

.preview-area .upright-split .fretboard.upright.region-neck {
  --neck-h: 620px;
}

.preview-area .upright-split .fretboard.upright.region-thumb {
  --neck-h: 420px;
}

.grid-gallery .fretboard.upright,
.song-sections .fretboard.upright,
#player-chord-ref .fretboard.upright,
.overlay-preview .fretboard.upright {
  --neck-h: 420px;
  max-width: 320px;
}

.grid-gallery .upright-split,
.song-sections .upright-split,
#player-chord-ref .upright-split,
.overlay-preview .upright-split {
  max-width: 320px;
}

.grid-gallery .upright-split .fretboard.upright.region-neck,
.song-sections .upright-split .fretboard.upright.region-neck,
#player-chord-ref .upright-split .fretboard.upright.region-neck,
.overlay-preview .upright-split .fretboard.upright.region-neck {
  --neck-h: 340px;
}

.grid-gallery .upright-split .fretboard.upright.region-thumb,
.song-sections .upright-split .fretboard.upright.region-thumb,
#player-chord-ref .upright-split .fretboard.upright.region-thumb,
.overlay-preview .upright-split .fretboard.upright.region-thumb {
  --neck-h: 240px;
}

.upright-frame {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.upright-head,
.upright-nut-row,
.upright-fret-row {
  display: grid;
  grid-template-columns: 1.6rem repeat(var(--strings, 4), 1fr) 2.6rem;
  align-items: stretch;
}

.upright-gutter,
.upright-pos-gutter {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 2px;
  font-size: 0.62rem;
  font-family: "IBM Plex Mono", monospace;
  color: var(--muted);
  padding-right: 4px;
}

.upright-pos-gutter {
  justify-content: flex-start;
  padding-left: 6px;
  padding-right: 0;
}

.upright-string-name {
  text-align: center;
  font-size: 0.78rem;
  font-weight: 700;
  font-family: "IBM Plex Mono", monospace;
  color: var(--text);
  padding-bottom: 4px;
}

.upright-string-name.disabled {
  opacity: 0.4;
}

.upright-nut-row {
  border-bottom: 5px solid rgba(245, 236, 220, 0.88);
  min-height: 28px;
  margin-bottom: 2px;
}

.upright-harmonic-row {
  display: grid;
  grid-template-columns: 1.6rem repeat(var(--strings, 4), 1fr) 2.6rem;
  align-items: stretch;
  border-bottom: 5px double rgba(240, 192, 64, 0.75);
  min-height: 28px;
  margin-bottom: 2px;
}

.upright-nut-cell,
.upright-cell {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  border-left: 1px solid rgba(255, 255, 255, 0.06);
  overflow: visible;
}

.upright-nut-cell.disabled,
.upright-cell.disabled {
  opacity: 0.35;
}

.upright-open {
  border: 0;
  background: transparent;
  color: var(--text);
  font: inherit;
  font-size: 0.85rem;
  cursor: pointer;
  padding: 0;
  line-height: 1;
}

.upright-open.root {
  font-size: 0.68rem;
  font-weight: 700;
  font-family: "IBM Plex Mono", monospace;
  color: #111;
  background: #fff;
  border-radius: 50%;
  width: 16px;
  height: 16px;
}

.upright-open.dim {
  opacity: 0.32;
}

.upright-mute {
  color: #c5ccd4;
  font-size: 0.8rem;
}

.upright-neck {
  display: flex;
  flex-direction: column;
  height: var(--neck-h, 420px);
  background: linear-gradient(90deg, rgba(0, 0, 0, 0.18), transparent 8%, transparent 92%, rgba(0, 0, 0, 0.18));
  border-radius: 0 0 6px 6px;
  overflow: visible;
}

.upright-fret-row {
  flex-grow: var(--ratio, 1);
  flex-shrink: 1;
  flex-basis: 0;
  min-height: 0;
  border-bottom: 2px solid rgba(210, 190, 150, 0.28);
}

.upright-fret-row.has-pos {
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.03);
}

.upright-fret-row.octave {
  border-bottom-width: 3px;
  border-bottom-color: rgba(240, 192, 64, 0.55);
}

.upright-wire {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 50%;
  width: 1.5px;
  transform: translateX(-50%);
  background: linear-gradient(180deg, rgba(220, 220, 220, 0.7), rgba(160, 160, 160, 0.45));
  pointer-events: none;
}

.upright-dot {
  position: relative;
  z-index: 1;
  border: 0;
  cursor: pointer;
  width: 16px;
  height: 16px;
  min-width: 16px;
}

.upright-dot.dim {
  opacity: 0.32;
  transform: scale(0.78);
}

.upright-pos-labels {
  flex-wrap: wrap;
}

.upright-pos-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid;
  border-radius: 999px;
  padding: 1px 5px;
  font-size: 0.58rem;
  font-weight: 700;
  color: #fff;
  line-height: 1.2;
}

.upright-bridge {
  height: 8px;
  margin-top: 2px;
  border-radius: 0 0 4px 4px;
  background: linear-gradient(180deg, rgba(180, 140, 80, 0.55), rgba(80, 50, 20, 0.8));
}

.fret-dot.upright-dot.root {
  box-shadow: 0 0 0 2px #fff;
}

.string-player {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 180px;
}

.string-pluck {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  color: inherit;
  cursor: pointer;
  font: inherit;
}

.string-pluck:hover {
  border-color: var(--c2);
}

.string-pluck.is-disabled,
.string-pluck:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  border-style: dashed;
}

.string-pluck.is-disabled:hover,
.string-pluck:disabled:hover {
  border-color: var(--border);
}

.string-pluck-name {
  font-weight: 600;
  font-family: "IBM Plex Mono", monospace;
}

.string-pluck-note {
  color: var(--muted);
  font-size: 0.9rem;
}

.tuning-studio {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.tuning-summary {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 10px 14px;
}

.tuning-summary-label {
  color: var(--muted);
  font-size: 0.85rem;
}

.tuning-summary-notes {
  font-family: "IBM Plex Mono", monospace;
  font-size: 1.35rem;
  font-weight: 700;
  letter-spacing: 0.12em;
}

.tuning-presets {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.tuning-strip {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(132px, 1fr));
  gap: 10px;
}

.tuning-string-card {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 12px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--bg-elevated);
}

.tuning-string-card.is-disabled {
  opacity: 0.55;
  border-style: dashed;
}

.tuning-string-index {
  font-size: 0.72rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.tuning-string-open {
  font-family: "IBM Plex Mono", monospace;
  font-size: 1.6rem;
  font-weight: 700;
  line-height: 1;
}

.tuning-string-full {
  font-size: 0.85rem;
  color: var(--muted);
  font-family: "IBM Plex Mono", monospace;
}

.tuning-string-toggle {
  align-self: stretch;
  font-size: 0.78rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.tuning-string-toggle.on {
  border-color: color-mix(in srgb, var(--accent) 55%, var(--border));
  color: var(--accent);
}

.tuning-summary-strings {
  font-size: 1.05rem;
  letter-spacing: 0.04em;
}

.tuning-nudge {
  display: flex;
  gap: 6px;
}

.tuning-nudge .btn {
  flex: 1;
  padding: 6px 8px;
}

.tuning-editor {
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)) !important;
}

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

.brand-mark {
  width: 54px;
  height: 54px;
  border-radius: 15px;
  display: block;
  flex-shrink: 0;
  box-shadow: 0 8px 24px rgba(255, 77, 109, 0.35);
}

.brand h1 {
  margin: 0;
  font-size: 1.65rem;
  letter-spacing: -0.02em;
}

.brand-pro {
  display: inline-block;
  margin-left: 0.15em;
  padding: 0.12em 0.42em 0.14em;
  border-radius: 6px;
  font-size: 0.55em;
  font-weight: 700;
  letter-spacing: 0.06em;
  vertical-align: middle;
  text-transform: uppercase;
  color: #111;
  background: linear-gradient(145deg, #f0c040, #e8a83a);
  box-shadow: 0 2px 8px rgba(240, 192, 64, 0.28);
}

.tagline {
  margin: 2px 0 0;
  color: var(--muted);
  font-size: 0.92rem;
}

.tabs {
  display: flex;
  gap: 6px;
  background: var(--panel);
  padding: 5px;
  border-radius: 999px;
  border: 1px solid var(--border);
}

.tab {
  border: 0;
  background: transparent;
  color: var(--muted);
  padding: 9px 16px;
  border-radius: 999px;
  cursor: pointer;
  font-weight: 500;
}

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

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

.panel {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: calc(var(--radius) + 4px);
  padding: 20px;
  box-shadow: var(--shadow);
}

.panel[hidden] {
  display: none !important;
}

.toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: end;
  margin-bottom: 16px;
}

.toolbar.secondary {
  margin-top: -4px;
  margin-bottom: 20px;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 110px;
}

.field[hidden] {
  display: none !important;
}

.field.grow {
  flex: 1;
  min-width: 160px;
}

.field label {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  font-weight: 600;
}

select,
input[type="text"] {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 9px 11px;
  outline: none;
}

select:focus,
input[type="text"]:focus {
  border-color: var(--accent);
}

.color-row {
  display: flex;
  gap: 7px;
  align-items: center;
  min-height: 38px;
}

.swatch {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 2px solid transparent;
  cursor: pointer;
  padding: 0;
}

.swatch.selected {
  border-color: #fff;
  box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.15);
}

.category-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 16px;
}

.chip {
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  color: var(--muted);
  border-radius: 999px;
  padding: 6px 12px;
  cursor: pointer;
  font-size: 0.85rem;
}

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

.chip.active {
  background: rgba(255, 77, 109, 0.15);
  border-color: var(--accent);
  color: #ffb3c1;
}

.split {
  display: grid;
  grid-template-columns: minmax(180px, 240px) 1fr;
  gap: 18px;
}

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

.formula-list {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  max-height: 520px;
  overflow: auto;
  padding: 6px;
}

.formula-item {
  width: 100%;
  text-align: left;
  border: 0;
  background: transparent;
  color: var(--text);
  padding: 10px 12px;
  border-radius: 8px;
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  gap: 8px;
  font-size: 0.92rem;
}

.formula-item:hover {
  background: var(--panel-2);
}

.formula-item.active {
  background: rgba(255, 77, 109, 0.18);
  color: #fff;
}

.formula-item .badge {
  color: var(--muted);
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.72rem;
}

.preview-area {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 14px;
}

.preview-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.btn {
  border: 1px solid var(--border);
  background: var(--panel-2);
  color: var(--text);
  border-radius: 8px;
  padding: 9px 14px;
  cursor: pointer;
  font-weight: 500;
}

.btn:hover {
  border-color: #4a5563;
}

.btn.primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.btn.primary:hover {
  background: var(--accent-dim);
}

.btn.ghost {
  background: transparent;
}

.btn.danger {
  color: #ffb4b4;
  border-color: rgba(232, 93, 93, 0.4);
}

.btn.danger:hover {
  background: rgba(232, 93, 93, 0.15);
}

.hint {
  color: var(--muted);
  font-size: 0.88rem;
  max-width: 42rem;
}

.hint.inline {
  margin: 0;
  align-self: center;
  max-width: none;
}

.card {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  display: inline-flex;
  flex-direction: column;
  gap: 12px;
  min-width: 0;
}

.card-title {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.card-title .notes {
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--muted);
}

.grid {
  display: grid;
  grid-template-columns: repeat(var(--cols, 4), 54px);
  grid-template-rows: repeat(var(--rows, 4), 54px);
  gap: 8px;
}

.grid.cols-2 { --cols: 2; }
.grid.cols-3 { --cols: 3; }
.grid.cols-4 { --cols: 4; }
.grid.cols-6 { --cols: 6; }
.grid.cols-8 { --cols: 8; }
.grid.rows-2 { --rows: 2; }
.grid.rows-3 { --rows: 3; }
.grid.rows-4 { --rows: 4; }

.grid.dual-bank {
  grid-template-columns: repeat(4, 54px) 10px repeat(4, 54px);
}

.pad-bank-gap {
  width: 10px;
  pointer-events: none;
}

.pad {
  background: var(--pad);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--pad-label);
  user-select: none;
  border: 1px solid transparent;
}

.pad.on {
  color: #fff;
}

.pad.primary {
  outline: 3px solid #fff;
  outline-offset: -2px;
  box-shadow:
    0 0 0 1px rgba(0, 0, 0, 0.4),
    0 0 18px rgba(255, 255, 255, 0.7),
    0 0 14px currentColor;
  z-index: 1;
  position: relative;
}

.pad.root-mark:not(.primary) {
  outline: 2px solid rgba(255, 255, 255, 0.55);
  outline-offset: -3px;
}

.card.clickable {
  cursor: pointer;
  transition: transform 0.12s ease, border-color 0.12s ease;
}

.card.clickable:hover {
  transform: translateY(-2px);
  border-color: #4a5563;
}

.card.clickable:active {
  transform: translateY(0);
}

.grid-gallery {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  margin-top: 20px;
  padding-top: 20px;
  border-top: 1px solid var(--border);
}

.song-strip,
.song-sections {
  display: flex;
  flex-direction: column;
  gap: 16px;
  min-height: 120px;
}

.song-section {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 14px 14px;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.song-section.dragging {
  opacity: 0.55;
}

.song-section.drag-over {
  border-color: var(--c2);
  box-shadow: 0 0 0 1px rgba(61, 184, 255, 0.35);
}

.song-section-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 10px;
  margin-bottom: 12px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border);
}

.section-handle {
  cursor: grab;
  color: var(--muted);
  font-size: 1.1rem;
  user-select: none;
  line-height: 1;
}

.section-index {
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.75rem;
  color: var(--muted);
  min-width: 1.2em;
}

.section-role {
  min-width: 7.5rem;
}

.section-name {
  flex: 1 1 140px;
  min-width: 120px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: inherit;
  padding: 6px 10px;
  font: inherit;
}

.section-genre {
  font-size: 0.75rem;
  color: var(--muted);
  padding: 2px 8px;
  border: 1px solid var(--border);
  border-radius: 999px;
}

.song-section-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-left: auto;
}

.song-section-actions .btn {
  padding: 6px 8px;
  font-size: 0.8rem;
  min-width: 2rem;
}

.song-section-actions .btn.playing,
.btn.playing {
  background: rgba(255, 77, 109, 0.18);
  border-color: rgba(255, 77, 109, 0.45);
}

.song-section-chords {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  min-height: 40px;
}

.section-empty {
  color: var(--muted);
  font-size: 0.9rem;
  margin: 4px 0;
}

.song-card.dragging {
  opacity: 0.5;
}

.song-card.drag-over {
  outline: 2px solid var(--c2);
  outline-offset: 2px;
}

#song-tempo {
  width: 5.5rem;
}

.hint#song-structure-hint {
  margin: 0 0 14px;
}

.empty-state {
  color: var(--muted);
  margin: 24px auto;
  text-align: center;
}

.song-card {
  position: relative;
}

.song-card .bar-num {
  position: absolute;
  top: 8px;
  right: 10px;
  font-size: 0.7rem;
  color: var(--muted);
  font-family: "IBM Plex Mono", monospace;
}

.song-card-actions {
  display: flex;
  gap: 6px;
}

.song-card-actions .btn {
  flex: 1;
  padding: 6px 8px;
  font-size: 0.8rem;
}

.overlay-preview {
  margin-bottom: 18px;
  padding: 14px;
  border-radius: var(--radius);
  background: rgba(61, 184, 255, 0.08);
  border: 1px dashed rgba(61, 184, 255, 0.35);
}

.overlay-preview .card {
  background: transparent;
  border: 0;
  padding: 0;
}

.song-legend {
  margin-top: 18px;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.prog-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.prog-card {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px 16px;
  align-items: start;
}

.prog-card-main {
  min-width: 0;
}

.prog-card-top {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 8px 12px;
  margin-bottom: 4px;
}

.prog-card-top h3 {
  margin: 0;
  font-size: 1.05rem;
}

.prog-genre-tag {
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #ffb3c1;
  background: rgba(255, 77, 109, 0.12);
  border: 1px solid rgba(255, 77, 109, 0.28);
  border-radius: 999px;
  padding: 3px 8px;
}

.prog-aka {
  margin: 0;
  color: var(--muted);
  font-size: 0.88rem;
}

.prog-numerals {
  margin: 8px 0 0;
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.82rem;
  color: #c5ced8;
  line-height: 1.4;
  word-break: break-word;
}

.prog-preview-chords {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 10px;
}

.prog-chip {
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.78rem;
  font-weight: 600;
  padding: 4px 8px;
  border-radius: 6px;
  color: #fff;
}

.prog-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 140px;
}

@media (max-width: 640px) {
  .prog-card {
    grid-template-columns: 1fr;
  }

  .prog-actions {
    flex-direction: row;
    flex-wrap: wrap;
    min-width: 0;
  }
}

.pads-intro {
  margin: 0;
  max-width: none;
}

.pads-editor {
  margin-top: 8px;
}

.pads-editor-grid {
  display: grid;
  grid-template-columns: repeat(var(--cols, 4), minmax(120px, 1fr));
  gap: 12px;
}

.pads-editor-grid.cols-2 { --cols: 2; }
.pads-editor-grid.cols-3 { --cols: 3; }
.pads-editor-grid.cols-4 { --cols: 4; }
.pads-editor-grid.cols-6 { --cols: 6; }
.pads-editor-grid.cols-8 { --cols: 8; }

.pads-editor-grid.dual-bank {
  grid-template-columns: repeat(4, minmax(110px, 1fr)) 10px repeat(4, minmax(110px, 1fr));
}

.pads-editor-grid .pad-bank-gap {
  min-height: 1px;
}

.pad-edit-cell {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  position: relative;
}

.pad-edit-cell.middle-c {
  border-color: rgba(240, 192, 64, 0.55);
  box-shadow: 0 0 0 1px rgba(240, 192, 64, 0.2);
}

.pad-edit-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.middle-c-tag {
  text-transform: none;
  letter-spacing: 0;
  font-size: 0.72rem;
  font-weight: 600;
  color: #1a1a1a;
  background: var(--c3);
  border-radius: 999px;
  padding: 2px 8px;
}

.pad-edit-controls {
  display: flex;
  gap: 6px;
}

.pad-edit-controls select {
  flex: 1;
  min-width: 0;
}

.pad-edit-midi {
  font-family: "IBM Plex Mono", monospace;
  font-size: 1.15rem;
  font-weight: 600;
}

.pad-audition {
  position: absolute;
  top: 8px;
  right: 8px;
  padding: 4px 8px;
  min-width: 0;
}

@media (max-width: 760px) {
  .pads-editor-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

.legend-item {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 0.85rem;
  color: var(--muted);
}

.legend-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
}

.player-wrap {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 28px;
  align-items: start;
}

@media (max-width: 760px) {
  .player-wrap {
    grid-template-columns: 1fr;
  }
}

.big-grid {
  display: grid;
  grid-template-columns: repeat(var(--cols, 4), 72px);
  grid-template-rows: repeat(var(--rows, 4), 72px);
  gap: 10px;
}

.big-grid.cols-2 { --cols: 2; }
.big-grid.cols-3 { --cols: 3; }
.big-grid.cols-4 { --cols: 4; }
.big-grid.cols-6 { --cols: 6; }
.big-grid.cols-8 { --cols: 8; }
.big-grid.rows-2 { --rows: 2; }
.big-grid.rows-3 { --rows: 3; }
.big-grid.rows-4 { --rows: 4; }

.big-grid.dual-bank {
  grid-template-columns: repeat(4, 72px) 12px repeat(4, 72px);
}

.big-grid .pad-bank-gap {
  width: 12px;
}

.big-grid .pad {
  font-size: 0.95rem;
  cursor: pointer;
  transition: transform 0.08s ease, background 0.08s ease;
}

.big-grid .pad:hover {
  border-color: #556070;
}

.big-grid .pad:active,
.big-grid .pad.playing {
  transform: scale(0.96);
}

.player-side h2 {
  margin: 0 0 8px;
  font-size: 1.15rem;
}

.player-side p {
  color: var(--muted);
  margin: 0 0 16px;
}

.footer {
  margin-top: 22px;
  color: var(--muted);
  font-size: 0.82rem;
  text-align: center;
}

.footer-status,
.footer-support,
.footer-links {
  margin: 0;
}

.footer-support {
  margin-top: 10px;
  max-width: 36rem;
  margin-left: auto;
  margin-right: auto;
  line-height: 1.45;
}

.footer-links {
  margin-top: 8px;
}

.footer-sep {
  margin: 0 0.35em;
  opacity: 0.7;
}

.footer a {
  color: var(--c2);
  text-decoration: none;
}

.footer a:hover {
  text-decoration: underline;
}

@media print {
  html,
  body {
    background: #fff !important;
    color: #111 !important;
  }

  .header .tabs,
  .header-controls,
  .family-toggle,
  .instrument-tray,
  .toolbar,
  .toolbar.secondary,
  .footer,
  .preview-actions,
  .song-card-actions,
  .category-chips,
  .formula-list,
  #panel-library,
  #panel-progressions,
  #panel-pads,
  #panel-play,
  .overlay-preview {
    display: none !important;
  }

  #panel-song {
    display: block !important;
    background: transparent;
    border: 0;
    box-shadow: none;
    padding: 0;
  }

  .brand-mark {
    box-shadow: none;
    print-color-adjust: exact;
    -webkit-print-color-adjust: exact;
  }

  .song-strip,
  .song-sections {
    gap: 12px;
  }

  .song-section {
    break-inside: avoid;
    border: 1px solid #ccc;
    background: #fff;
  }

  .song-section-actions,
  .section-handle {
    display: none !important;
  }

  .card {
    break-inside: avoid;
    border: 1px solid #ccc;
    background: #fff;
  }

  .pad {
    border: 1px solid #ddd;
    background: #f3f3f3;
    color: #999;
    print-color-adjust: exact;
    -webkit-print-color-adjust: exact;
  }

  .pad.on {
    color: #fff !important;
    print-color-adjust: exact;
    -webkit-print-color-adjust: exact;
  }

  .pad.primary {
    outline: 3px solid #111 !important;
    outline-offset: -2px;
  }

  .tagline,
  .card-title .notes,
  .song-legend {
    color: #444;
  }

  .fretboard.upright {
    background: #f6f1e8 !important;
    border-color: #ccc;
    print-color-adjust: exact;
    -webkit-print-color-adjust: exact;
  }

  .upright-fret-row {
    border-bottom-color: #bbb;
  }

  .upright-dot,
  .upright-pos-pill,
  .upright-open.root {
    print-color-adjust: exact;
    -webkit-print-color-adjust: exact;
  }
}
