:root {
  --bg: #0b0b0b;
  --panel: #141414;
  --panel-2: #1a1a1a;
  --line: #2c2c2c;
  --line-strong: #d7d7d7;
  --text: #f3f3f3;
  --muted: #b3b3b3;
  --accent: #ffffff;
  --root: #ffb703;
  --tone: #7b7b7b;
  --selected: #d8d8d8;
  --shadow: 8px 8px 0 #000;
  --radius: 0;
  --cell: 84px;
  --label-col: 86px;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: 'Smooch Sans', sans-serif;
  font-size: 20px;
  user-select: none;
}

body {
  padding: 18px;
}

button,
input,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

.app {
  max-width: 1660px;
  margin: 0 auto;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 18px;
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: 32px;
  line-height: 1;
  margin-bottom: 8px;
}

h1 {
  font-family: 'Saira Stencil', sans-serif;
}

h2 {
  font-size: 18px;
  margin-bottom: 12px;
}

h2 {
  font-family: 'Barlow', sans-serif;
}

.subtitle,
.muted {
  color: var(--muted);
}

.subtitle {
  font-family: 'Bebas Neue', sans-serif;
}

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

.layout {
  display: grid;
  grid-template-columns: 420px 1fr;
  gap: 18px;
  align-items: start;
}

.panel {
  background: var(--panel);
  border: 2px solid var(--accent);
  box-shadow: var(--shadow);
}

.controls-panel {
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  position: sticky;
  top: 18px;
}

.panel-section {
  background: var(--panel-2);
  border: 2px solid var(--line);
  padding: 14px;
}

.field-grid {
  display: grid;
  gap: 12px;
}

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

.six-col {
  grid-template-columns: repeat(6, minmax(0, 1fr));
}

label {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

label span {
  font-size: 18px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
}

input,
select {
  width: 100%;
  background: #0b0b0b;
  color: var(--text);
  border: 2px solid var(--accent);
  padding: 10px 12px;
  border-radius: var(--radius);
  outline: none;
}

input[type="range"] {
  padding: 0;
}

button {
  background: #0b0b0b;
  color: var(--text);
  border: 2px solid var(--accent);
  padding: 12px 14px;
  border-radius: var(--radius);
  transition: transform 0.06s ease;
}

button:active {
  transform: translate(2px, 2px);
}

.primary-btn {
  background: var(--accent);
  color: #000;
  font-weight: 700;
}

.ghost-btn {
  background: #0b0b0b;
}

.inline-row {
  display: flex;
  gap: 10px;
}

.wrap-row {
  flex-wrap: wrap;
}

.grow {
  flex: 1;
}

.suggestion-list {
  display: grid;
  gap: 8px;
}

.suggestion-btn {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  text-align: left;
  background: #0d0d0d;
  border-color: var(--line);
}

.suggestion-btn strong {
  font-size: 14px;
}

.suggestion-btn span {
  color: var(--muted);
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.suggestion-btn.active {
  background: var(--accent);
  color: #000;
  border-color: var(--accent);
}

.suggestion-btn.active span {
  color: #202020;
}

.voicing-meta {
  display: grid;
  gap: 6px;
  margin-bottom: 12px;
}

.meta-line {
  border: 2px solid var(--line);
  background: #0d0d0d;
  padding: 8px 10px;
  color: var(--muted);
}

.voicing-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-height: 64px;
}

.empty-state {
  color: var(--muted);
}

.voicing-item {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  border: 2px solid var(--line);
  padding: 10px;
  background: #0d0d0d;
}

.neck-panel {
  padding: 16px;
  overflow: hidden;
}

.neck-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 18px;
}

.legend {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
  color: var(--muted);
  font-size: 12px;
}

.legend-dot {
  width: 14px;
  height: 14px;
  display: inline-block;
  margin-right: 6px;
  border: 2px solid var(--accent);
  vertical-align: middle;
}

.note-root { background: var(--root); }
.note-chord { background: var(--tone); }
.note-selected { background: var(--selected); }

.fretboard-wrap {
  overflow: auto;
  border: 2px solid var(--line);
  background: radial-gradient(circle at 50% 10%, #131313 0%, #090909 70%);
  padding: 20px;
}

.fretboard {
  min-width: fit-content;
  display: inline-flex;
  flex-direction: column;
  gap: 16px;
  align-items: center;
}

.diagram-caption {
  color: var(--muted);
  font-size: 1.3rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

/* .tilt-stage {
  padding: 18px 22px 26px;
  transform: perspective(1400px) rotateX(18deg) rotateZ(-7deg);
  transform-origin: 50% 0%;
  transform: rotate(-1.25deg);
  transform-origin: center top;
} */

.diagram-top,
.diagram-string-labels,
.diagram-row,
.diagram-bottom {
  display: grid;
  grid-template-columns: var(--label-col) repeat(6, var(--cell));
}

.diagram-corner,
.top-marker,
.string-name,
.fret-number,
.note-name-cell {
  display: flex;
  align-items: center;
  justify-content: center;
}

.top-marker,
.string-name,
.note-name-cell {
  min-height: 44px;
}

.top-marker {
  font-size: 28px;
  font-weight: 700;
  color: var(--accent);
}

.top-marker.muted {
  color: #f2f2f2;
}

.top-marker.open {
  color: #f2f2f2;
}

.string-name {
  color: var(--muted);
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.board-grid {
  border: 4px solid var(--line-strong);
  background: linear-gradient(180deg, #0a0a0a 0%, #060606 100%);
}

.diagram-row:first-child .cell {
  border-top: 0;
}

.diagram-row:first-child .fret-number {
  border-top: 0;
}

.fret-number {
  min-height: var(--cell);
  color: var(--muted);
  border-top: 2px solid var(--line-strong);
  padding-right: 12px;
  justify-content: flex-end;
  font-size: 13px;
  letter-spacing: 0.04em;
}

.cell {
  min-height: var(--cell);
  border-left: 2px solid var(--line-strong);
  border-top: 2px solid var(--line-strong);
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  background: rgba(255, 255, 255, 0.01);
}

.cell:nth-child(odd) {
  background: rgba(255, 255, 255, 0.02);
}

.cell.marker-cell::after {
  content: '';
  position: absolute;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.2);
}

.open-row {
  margin-bottom: 0;
}

.open-fret-label {
  min-height: 54px;
  color: var(--muted);
  display: flex;
  align-items: center;
  justify-content: flex-end;
  padding-right: 12px;
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.open-note-cell {
  min-height: 54px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.note-btn {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  border: 2px solid #0b0b0b;
  background: var(--tone);
  color: #000;
  font-weight: 700;
  font-size: 1rem;
  padding: 0;
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.note-btn.root {
  background: var(--root);
  color: #000;
  border-color: #000;
  font-size: 0.8rem;
  box-shadow: inset 0 0 0 2px rgba(0,0,0,0.18);
}

.note-btn.selected {
  box-shadow: 0 0 0 3px #000, 0 0 0 5px var(--selected);
}

.note-btn.fingered {
  padding-top: 2px;
}

.note-label {
  font-size: 18px;
  line-height: 1;
}

.note-btn.selected .note-label {
  font-size: 16px;
}

.finger-badge {
  position: absolute;
  right: -4px;
  top: -4px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #000;
  color: #fff;
  border: 2px solid #fff;
  font-size: 11px;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.note-name-cell {
  color: #dfdfdf;
  font-size: 16px;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.note-name-cell.muted {
  color: #555;
}

.bottom-label {
  color: var(--muted);
  justify-content: flex-end;
  padding-right: 12px;
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.info-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-self: stretch;
}

.info-chip {
  border: 2px solid var(--line);
  background: #0d0d0d;
  color: var(--muted);
  padding: 8px 10px;
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

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

  .controls-panel {
    position: static;
  }
}

@media (max-width: 860px) {
  body {
    padding: 10px;
  }

  .topbar,
  .neck-header {
    flex-direction: column;
  }

  .fretboard-wrap {
    padding: 12px;
  }

  .tilt-stage {
    transform: none;
    padding: 8px 8px 12px;
  }

  :root {
    --cell: 66px;
    --label-col: 70px;
  }

  .note-btn {
    width: 42px;
    height: 42px;
	font-size: 1.2rem;
    font-weight: 600;
  }

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


.section-help {
  margin-top: 12px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.active-mode {
  background: var(--accent);
  color: #000;
  font-weight: 700;
}


.tuning-summary {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 8px;
}

.tuning-chip {
  border: 2px solid var(--line);
  background: #0d0d0d;
  padding: 8px 6px;
  text-align: center;
  font-size: 12px;
  color: var(--text);
}

.tuning-chip strong {
  display: block;
  font-size: 11px;
  color: var(--muted);
  margin-bottom: 4px;
  letter-spacing: 0.08em;
}

.tuning-note-input {
  text-align: center;
  font-weight: 700;
  padding-inline: 6px;
}

.section-note {
  margin-top: 8px;
  font-size: 12px;
  color: var(--muted);
}

@media (max-width: 1200px) {
  .tuning-summary,
  .six-col {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 720px) {
  .tuning-summary,
  .six-col,
  .two-col,
  .layout {
    grid-template-columns: 1fr;
  }
}


.custom-action-btn{
  border-style: dashed;
}


.dropdown {
  position: relative;
}

.dropdown-menu {
  position: absolute;
  right: 0;
  top: calc(100% + 8px);
  min-width: 260px;
  background: var(--panel);
  border: 2px solid var(--accent);
  box-shadow: var(--shadow);
  padding: 8px;
  display: grid;
  gap: 8px;
  z-index: 30;
}

.dropdown-item {
  width: 100%;
  text-align: left;
}

.song-sections {
  display: grid;
  gap: 12px;
}

.song-section-card {
  border: 2px solid var(--line);
  background: #0d0d0d;
  padding: 12px;
  display: grid;
  gap: 12px;
}

.song-section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.song-chords-grid {
  display: grid;
  gap: 10px;
}

.song-chord-item {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  align-items: start;
}

.song-chord-card {
  display: grid;
  gap: 6px;
  text-align: left;
  border-color: var(--line);
}

.song-chord-card.active {
  background: var(--accent);
  color: #000;
}

.song-chord-card small {
  color: var(--muted);
}

.song-chord-card.active small {
  color: #222;
}

.song-mini-controls {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.mini-btn {
  padding: 7px 10px;
  font-size: 12px;
}

.mini-btn:disabled {
  opacity: 0.35;
  cursor: default;
}

.section-help {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.4;
}

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

  .controls-panel {
    position: static;
  }
}


/* v15 fixes */
.dropdown-menu[hidden] {
  display: none !important;
}

.topbar-actions {
  align-items: center;
}

#chordsheetBuilderSection {
  scroll-margin-top: 20px;
}

@media (min-width: 1025px) {
  .layout {
    grid-template-columns: minmax(360px, 390px) minmax(0, 1fr);
  }

  .controls-panel {
    position: sticky;
    top: 18px;
  }
}

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

  .controls-panel {
    position: static;
  }
}


/* --- V18 CHORDSHEET + CAPO POLISH --- */
.song-section-card.v18 {
  border: 2px solid #111;
  background: #f6f2e8;
  box-shadow: 6px 6px 0 #111;
  padding: 12px;
  display: grid;
  gap: 12px;
}

.song-section-header.v18 {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  flex-wrap: wrap;
}

.song-section-title-wrap {
  display: grid;
  gap: 6px;
  min-width: 240px;
  flex: 1;
}

.song-section-title-input {
  width: 100%;
  min-height: 42px;
  border: 2px solid #111;
  background: #fff;
  padding: 8px 10px;
  font: inherit;
}

.song-section-count {
  font-size: 12px;
  opacity: 0.8;
}

.song-mini-controls.v18,
.song-mini-controls.chord-controls {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.song-chords-grid.v18 {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 12px;
}

.song-chord-item.v18 {
  display: grid;
  gap: 8px;
  align-content: start;
}

.song-chord-card.v18 {
  min-height: 112px;
  text-align: left;
  border: 2px solid #111;
  background: #fff;
  box-shadow: 5px 5px 0 #111;
  padding: 10px;
  display: grid;
  gap: 8px;
}

.song-chord-item.v18.active .song-chord-card.v18,
.song-chord-card.v18:focus-visible {
  outline: 3px solid #111;
  outline-offset: 2px;
}

#capoRange {
  width: 100%;
  max-width: 320px;
}

body > button {
  margin-left: 0;
}

@media (max-width: 1100px) {
  .song-section-header.v18 {
    flex-direction: column;
    align-items: stretch;
  }
}


.toggle-row {
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.toggle-row span {
  margin: 0;
}

.toggle-row input[type="checkbox"] {
  width: 22px;
  height: 22px;
  accent-color: #ffffff;
  padding: 0;
  flex: 0 0 auto;
}


/* --- V22 MOBILE DIAGRAM FIT FIX --- */
.fretboard-wrap,
.fretboard,
.tilt-stage {
  min-width: 0;
  max-width: 100%;
}

.board-grid,
.diagram-top,
.diagram-string-labels,
.diagram-row,
.diagram-bottom {
  min-width: 0;
}

@media (max-width: 900px) {
  :root {
    --cell: 64px;
    --label-col: 64px;
  }

  .panel.main-panel,
  .main-panel,
  .fretboard-panel,
  .panel {
    min-width: 0;
  }

  .fretboard {
    width: 100%;
    overflow-x: hidden;
  }

  .tilt-stage {
    width: 100%;
    overflow-x: hidden;
  }

  .note-btn {
    width: 40px;
    height: 40px;
  }

  .note-label {
    font-size: 15px;
  }

  .string-name,
  .fret-number,
  .note-name-cell {
    font-size: 13px;
  }

  .finger-badge {
    width: 16px;
    height: 16px;
    font-size: 9px;
    right: -2px;
    top: -2px;
  }
}

@media (max-width: 680px) {
  :root {
    --cell: calc((100vw - 72px) / 6);
    --label-col: 42px;
  }

  .app {
    max-width: 100%;
  }

  body {
    padding: 10px;
  }

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

  .controls-panel {
    position: static;
    top: auto;
  }

  .fretboard {
    width: 100%;
    overflow-x: hidden;
  }

  .tilt-stage {
    width: 100%;
    transform: none;
    transform-origin: center top;
  }

  .diagram-caption,
  .info-strip {
    width: 100%;
  }

  .note-btn {
    width: min(36px, calc(var(--cell) - 6px));
    height: min(36px, calc(var(--cell) - 6px));
    border-width: 2px;
  }

  .note-label {
    font-size: 13px;
  }

  .string-name,
  .fret-number,
  .note-name-cell,
  .top-marker,
  .open-fret-label {
    font-size: 11px;
  }

  .cell,
  .open-note-cell,
  .string-name,
  .top-marker,
  .note-name-cell {
    min-width: 0;
    width: 100%;
  }

  .fret-number,
  .open-fret-label,
  .diagram-corner,
  .bottom-label {
    width: var(--label-col);
    min-width: var(--label-col);
  }

  .info-chip {
    font-size: 11px;
    padding: 6px 8px;
  }
}

@media (max-width: 430px) {
  :root {
    --cell: calc((100vw - 56px) / 6);
    --label-col: 34px;
  }

  .note-btn {
    width: min(32px, calc(var(--cell) - 4px));
    height: min(32px, calc(var(--cell) - 4px));
  }

  .note-label {
    font-size: 11px;
  }

  .string-name,
  .fret-number,
  .note-name-cell,
  .top-marker,
  .open-fret-label {
    font-size: 10px;
  }

  .finger-badge {
    width: 14px;
    height: 14px;
    font-size: 8px;
  }
}


/* --- V23 MOBILE NO ZOOM --- */
html, body {
  touch-action: manipulation;
  overscroll-behavior: none;
  -webkit-text-size-adjust: 100%;
}

button,
input,
select,
textarea,
label,
.note-btn,
.song-chord-card,
.suggestion-btn,
.primary-btn,
.ghost-btn,
.dropdown-item {
  touch-action: manipulation;
}

input[type="range"] {
  touch-action: pan-x;
}


/* --- V24 MOBILE FULL DIAGRAM FIT --- */
@media (max-width: 680px) {
  .fretboard-wrap,
  .main-panel,
  .panel,
  .diagram-panel,
  .fretboard-panel {
    min-width: 0 !important;
    width: 100% !important;
    overflow: hidden !important;
  }

  .fretboard {
    width: 100% !important;
    max-width: 100% !important;
    overflow: hidden !important;
  }

  .tilt-stage {
    width: 100% !important;
    max-width: 100% !important;
    overflow: hidden !important;
    padding-right: 0 !important;
    margin-right: 0 !important;
  }

  .diagram-top,
  .diagram-string-labels,
  .diagram-row,
  .diagram-bottom {
    width: 100% !important;
    max-width: 100% !important;
    display: grid !important;
    grid-template-columns: var(--label-col) repeat(6, minmax(0, 1fr)) !important;
  }

  .board-grid {
    width: 100% !important;
    max-width: 100% !important;
  }

  .cell,
  .open-note-cell,
  .string-name,
  .top-marker,
  .note-name-cell {
    min-width: 0 !important;
    width: auto !important;
    justify-self: stretch !important;
  }

  .cell,
  .open-note-cell {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    overflow: visible !important;
  }

  .note-btn {
    width: min(30px, calc(100% - 4px)) !important;
    height: min(30px, calc(100% - 4px)) !important;
    min-width: 22px !important;
    min-height: 22px !important;
    max-width: 30px !important;
    max-height: 30px !important;
    margin: 0 auto !important;
  }

  .note-label {
    font-size: 10px !important;
  }

  .finger-badge {
    width: 13px !important;
    height: 13px !important;
    font-size: 7px !important;
    right: -1px !important;
    top: -1px !important;
  }

  .fret-number,
  .open-fret-label,
  .diagram-corner,
  .bottom-label {
    width: var(--label-col) !important;
    min-width: var(--label-col) !important;
  }
}

@media (max-width: 430px) {
  :root {
    --label-col: 30px;
  }

  .note-btn {
    width: min(27px, calc(100% - 3px)) !important;
    height: min(27px, calc(100% - 3px)) !important;
    max-width: 27px !important;
    max-height: 27px !important;
  }

  .note-label {
    font-size: 9px !important;
  }

  .string-name,
  .fret-number,
  .note-name-cell,
  .top-marker,
  .open-fret-label {
    font-size: 9px !important;
  }
}


.history-disabled,
button.history-disabled {
  opacity: 0.45;
  pointer-events: none;
}


/* --- V26 UI SPACING SYSTEM --- */

.panel-section {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.inline-row {
  display: flex;
  gap: 10px;
}

.wrap-row {
  flex-wrap: wrap;
}

.panel-section input,
.panel-section select,
.panel-section button,
.panel-section textarea {
  margin: 0;
}

.panel-section > * + * {
  margin-top: 4px;
}

/* ensure buttons don't touch */
button {
  margin: 0;
}

button + button {
  margin-left: 8px;
}

/* inputs spacing */
input, select, textarea {
  margin-bottom: 8px;
}

/* chordsheet builder specific */
.chordsheet-builder {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.chordsheet-builder .row {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.chordsheet-builder .column {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

/* fix overlapping buttons */
.chordsheet-builder button {
  width: 100%;
}

/* mobile safe spacing */
@media (max-width: 768px) {
  .panel-section {
    gap: 10px;
  }
  .inline-row {
    gap: 8px;
  }
}



/* --- V27 CHORDSHEET EDITOR FEEL --- */

.song-section-card,
.song-chord-item,
.song-chords-grid,
.song-chord-card {
  transition: background-color 0.12s ease, border-color 0.12s ease, box-shadow 0.12s ease, transform 0.12s ease, opacity 0.12s ease;
}

.song-section-card,
.song-chord-item {
  position: relative;
}

.song-section-header,
.song-chord-card {
  cursor: grab;
}

.song-section-card.drag-source,
.song-chord-item.drag-source {
  opacity: 0.55;
  transform: scale(0.985);
}

.song-section-card.drag-target {
  outline: 3px dashed var(--accent);
  outline-offset: 4px;
  background: rgba(255,255,255,0.05);
}

.song-chord-item.drag-target .song-chord-card {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(255,255,255,0.08), 8px 8px 0 #000;
  transform: translateY(-2px);
}

.song-chords-grid.drag-over-grid {
  border: 2px dashed var(--accent);
  padding: 10px;
  background: rgba(255,255,255,0.04);
}

.song-mini-controls button {
  min-width: 44px;
}

.song-section-header {
  align-items: center;
}

.song-chord-card {
  min-height: 118px;
}

.song-chord-card strong {
  display: block;
  margin-bottom: 6px;
}

.song-chord-card small {
  display: block;
  margin-top: 6px;
  color: var(--muted);
}

.song-section-card::after,
.song-chord-item::after {
  content: '';
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: 0;
}

.song-section-card.drag-target::after,
.song-chord-item.drag-target::after {
  opacity: 1;
}

.song-section-card.drag-target::after {
  border: 2px dashed rgba(255,255,255,0.7);
}

.song-chord-item.drag-target::after {
  border: 2px dashed rgba(255,255,255,0.7);
  border-radius: 2px;
}

.section-help {
  line-height: 1.45;
}

@media (max-width: 768px) {
  .song-mini-controls {
    gap: 8px;
  }

  .song-mini-controls button {
    flex: 1 1 auto;
  }

  .song-chord-card {
    min-height: 104px;
  }
}


/* --- V28 EXPORT DROPDOWN LAYOUT FIX --- */
.export-dropdown {
  position: relative;
  display: inline-block;
}

.dropdown-menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  left: auto;
  min-width: 280px;
  width: max-content;
  max-width: min(92vw, 360px);
  padding: 10px;
  display: grid;
  gap: 10px;
  background: #111;
  border: 2px solid #fff;
  box-shadow: 8px 8px 0 #000;
  z-index: 1000;
}

.dropdown-menu[hidden] {
  display: none !important;
}

.dropdown-item {
  width: 100%;
  display: block;
  text-align: left;
  white-space: normal;
  margin: 0 !important;
}

.dropdown-menu .dropdown-item + .dropdown-item {
  margin-left: 0 !important;
}

.topbar-actions {
  align-items: flex-start;
}

@media (max-width: 768px) {
  .export-dropdown {
    flex: 1 1 auto;
  }

  .export-dropdown > button {
    width: 100%;
  }

  .dropdown-menu {
    right: 0;
    left: auto;
    min-width: 0;
    width: min(92vw, 340px);
    max-width: min(92vw, 340px);
    padding: 8px;
    gap: 8px;
  }

  .dropdown-item {
    padding: 14px 16px;
    line-height: 1.2;
  }
}

@media (max-width: 480px) {
  .dropdown-menu {
    width: min(94vw, 320px);
    max-width: min(94vw, 320px);
  }
}


/* --- V29 MOBILE DROPDOWN VIEWPORT FIX --- */
@media (max-width: 768px) {
  .topbar {
    overflow: visible !important;
  }

  .topbar-actions {
    width: 100%;
    overflow: visible !important;
    position: relative;
  }

  .export-dropdown {
    position: relative;
    overflow: visible !important;
  }

  .dropdown-menu {
    position: fixed !important;
    top: auto !important;
    left: 50% !important;
    right: auto !important;
    bottom: 16px !important;
    transform: translateX(-50%) !important;
    width: min(94vw, 360px) !important;
    max-width: min(94vw, 360px) !important;
    min-width: 0 !important;
    max-height: min(70vh, 520px);
    overflow-y: auto;
    z-index: 9999 !important;
    margin: 0 !important;
  }

  .dropdown-item {
    width: 100% !important;
  }
}

@media (max-width: 480px) {
  .dropdown-menu {
    width: 94vw !important;
    max-width: 94vw !important;
    bottom: 12px !important;
  }
}


/* --- V30 PROJECT MENU BUTTON WIDTH FIX --- */
.dropdown-menu,
.dropdown-menu * {
  box-sizing: border-box;
}

.dropdown-menu button,
.dropdown-menu .dropdown-item,
.dropdown-menu .ghost-btn,
.dropdown-menu .primary-btn {
  width: 100% !important;
  max-width: 100% !important;
  display: block !important;
  margin-left: 0 !important;
  margin-right: 0 !important;
  flex: none !important;
}

.dropdown-menu button + button,
.dropdown-menu .dropdown-item + .dropdown-item,
.dropdown-menu .ghost-btn + .ghost-btn,
.dropdown-menu .primary-btn + .primary-btn {
  margin-left: 0 !important;
}

.dropdown-menu > * {
  width: 100% !important;
  max-width: 100% !important;
}


.mobile-section-tray {
  display: none;
}

.mobile-section-header {
  display: block;
}

@media (max-width: 768px) {
  .mobile-section-tray {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 12px;
    padding: 10px;
    border: 2px solid var(--line);
    border-radius: 0;
    background: var(--panel-2);
  }

  .mobile-section-chip,
  .mobile-close-tab-btn {
    border-radius: 999px;
    box-shadow: none;
    min-height: 36px;
    border-width: 2px;
  }

  .mobile-section-chip {
    background: #0b0b0b;
    color: var(--text);
    border-color: var(--accent);
  }

  .mobile-section-chip:active,
  .mobile-close-tab-btn:active {
    transform: translate(1px, 1px);
  }

  .mobile-section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
  }

  .mobile-section-header h2 {
    margin: 0;
    flex: 1;
  }

  .mobile-close-tab-btn {
    flex: 0 0 auto;
    margin-left: 0;
    padding: 8px 12px;
    background: #0b0b0b;
    color: var(--text);
    border-color: var(--accent);
  }

  .controls-panel .panel-section.mobile-section-collapsed {
    display: none;
  }
}

@media (max-width: 768px) {
  #openChordsheetBuilderBtn {
    display: none !important;
  }
}
