html {
  margin: 0;
  padding: 0;
}
* {
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
  -webkit-tap-highlight-color: transparent;
}
body {
  min-height: 100dvh;
  font-family: 'Roboto', system-ui, -apple-system, sans-serif;
  background-color: #121212;
  color: #e0e0e0;
  max-width: 900px;
  margin: 0 auto;
  padding: 20px;
  padding-bottom: calc(210px + env(safe-area-inset-bottom, 0px));
  touch-action: manipulation;
  -ms-touch-action: manipulation;
}
h1, h2 { color: #ffffff; }
.control-panel {
  background: #1e1e1e;
  padding: 20px;
  border-radius: 8px;
  margin-bottom: 20px;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 20px;
}
.control-group {
  display: flex;
  flex-direction: column;
}
label {
  margin-bottom: 5px;
  font-size: 0.9em;
  color: #aaaaaa;
}
input[type="range"] {
  width: 100%;
  cursor: pointer;
  touch-action: none;
}
/* Slider color categories */
.cat-shape > label { color: #7ab880; }
.cat-filter > label { color: #58b0b8; }
.cat-filter input[type="range"] { accent-color: #58b0b8; }
.cat-amp > label { color: #c88060; }
.cat-amp input[type="range"] { accent-color: #c88060; }
.cat-lpg > label { color: #c06880; }
.cat-lpg input[type="range"] { accent-color: #c06880; }
.cat-pitch > label { color: #a878b8; }
.cat-pitch input[type="range"] { accent-color: #a878b8; }
.cat-tuning > label { color: #68a898; }
.cat-tuning input[type="range"] { accent-color: #68a898; }
.cat-delay > label { color: #5878b8; }
.cat-delay input[type="range"] { accent-color: #5878b8; }
.cat-reverb > label { color: #7858b0; }
.cat-reverb input[type="range"] { accent-color: #7858b0; }
.cat-spatial > label { color: #c8a858; }
.cat-spatial input[type="range"] { accent-color: #c8a858; }
.btn-group {
  display: flex;
  gap: 0;
  border-radius: 6px;
  overflow: hidden;
}
.btn-group button {
  flex: 1;
  padding: 6px 2px;
  font-size: 0.78em;
  font-weight: 600;
  background: #2a2a2a;
  color: #aaa;
  border: 1px solid #444;
  border-right: none;
  cursor: pointer;
  transition: all 0.05s;
  white-space: nowrap;
}
.btn-group button:last-child { border-right: 1px solid #444; }
.btn-group button.active {
  background: #587858;
  color: #fff;
  border-color: #587858;
}
.cat-filter .btn-group button.active {
  background: #387078;
  border-color: #58b0b8;
}
.cat-amp .btn-group button.active {
  background: #885838;
  border-color: #c88060;
}
.cat-lpg .btn-group button.active {
  background: #783850;
  border-color: #c06880;
}
.cat-shape .btn-group button.active {
  background: #486840;
  border-color: #7ab880;
}
.btn-group button:not(.active):hover {
  background: #3a3a3a;
  color: #ccc;
}
/* Focus indicators for keyboard navigation */
.btn-group button:focus-visible,
button.chord-btn:focus-visible,
button.prog-btn:focus-visible,
/* .inversion-btn:focus-visible, */
.piano-mode-btn:focus-visible,
.chord-builder-open-btn:focus-visible,
.chord-builder-roots button:focus-visible,
.chord-builder-qualities button:focus-visible,
.chord-builder-actions button:focus-visible,
.preset-section button:focus-visible {
  outline: 2px solid #7ab880;
  outline-offset: 1px;
  z-index: 1;
}
.transpose-section {
  background: #1e1e1e;
  padding: 12px 16px;
  border-radius: 8px;
  margin-bottom: 12px;
}
.transpose-row {
  margin-bottom: 8px;
}
.transpose-row:last-child { margin-bottom: 0; }
.transpose-row label {
  display: block;
  margin-bottom: 4px;
  font-size: 0.85em;
  color: #aaa;
}
.transpose-row .btn-group button {
  padding: 5px 1px;
  font-size: 0.72em;
  min-width: 0;
}
.voice-canvases {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 3px;
  margin-bottom: 3px;
}
.voice-canvases canvas {
  background: #000;
  border-radius: 4px;
  width: 100%;
  height: 40px;
  border: 1px solid #333;
  touch-action: none;
}
canvas#master-visualizer {
  background: #000;
  border-radius: 4px;
  width: 100%;
  height: 30px;
  margin-bottom: 4px;
  border: 1px solid #333;
  touch-action: none;
}
.chord-buttons {
  display: flex;
  gap: 10px;
  margin-bottom: 20px;
  touch-action: manipulation;
}
button.chord-btn {
  flex: 1;
  padding: 20px;
  font-size: 1.2em;
  font-weight: bold;
  background: #3a3a3a;
  color: #fff;
  border: 2px solid #555;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.1s;
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}
button.chord-btn:hover {
  background: #484848;
  border-color: #777;
}
button.chord-btn:active, button.chord-btn.active {
  background: #587858;
  border-color: #7ab880;
  transform: scale(0.98);
}
.progression-groups {
  margin-bottom: 20px;
}
.progression-group-label {
  font-size: 0.78em;
  font-weight: 600;
  color: #777;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin: 12px 0 4px 2px;
}
.progression-group-label:first-child {
  margin-top: 0;
}
.progression-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 6px;
}
button.prog-btn {
  padding: 8px 12px;
  font-size: 0.82em;
  font-weight: 500;
  background: #2a2a2a;
  color: #ccc;
  border: 1px solid #444;
  border-radius: 6px;
  cursor: pointer;
  text-align: left;
  transition: all 0.1s;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
button.prog-btn:hover {
  background: #3a3a3a;
  border-color: #666;
}
button.prog-btn.active {
  background: #486840;
  border-color: #587858;
  color: #fff;
}

/* iPhone 13 mini (375px) */
@media (max-width: 430px) {
  body { padding: 8px; padding-bottom: calc(180px + env(safe-area-inset-bottom, 0px)); }
  h1 { font-size: 1.3em; margin: 8px 0; }
  .control-panel {
    grid-template-columns: 1fr;
    gap: 10px;
    padding: 12px;
  }
  .chord-row { gap: 3px; }
  /* .inversion-btn { width: 30px; min-width: 30px; font-size: 0.9em; } */
  .chord-buttons { gap: 4px; }
  button.chord-btn {
    padding: 12px 4px;
    font-size: 0.9em;
  }
  button.chord-btn small { font-size: 0.7em; }
  .progression-grid {
    grid-template-columns: 1fr;
    gap: 4px;
  }
  .voice-canvases canvas { height: 30px; }
  canvas#master-visualizer { height: 22px; }
  .instructions { font-size: 0.8em; padding: 10px; }
  .btn-group button { font-size: 0.7em; padding: 5px 1px; }
  .transpose-row .btn-group button { font-size: 0.6em; padding: 4px 0; }
  .transpose-section { padding: 8px 10px; }
  .chord-builder-panel { padding: 10px 8px 14px; }
  .chord-builder-roots button,
  .chord-builder-qualities button { padding: 12px 2px; font-size: 0.85em; }
}

/* Tablets / iPad Pro (768-1024px) */
@media (min-width: 768px) and (max-width: 1199px) {
  body { max-width: 1000px; }
  .bottom-bar { max-width: 1000px; }
  .control-panel {
    grid-template-columns: repeat(3, 1fr);
  }
  .progression-grid {
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  }
}

/* Large screens / 4K (1200px+) */
@media (min-width: 1200px) {
  body { max-width: 1800px; font-size: 1.1em; }
  .control-panel {
    grid-template-columns: repeat(4, 1fr);
    gap: 24px;
    padding: 24px;
  }
  .voice-canvases canvas { height: 50px; }
  canvas#master-visualizer { height: 40px; }
  button.chord-btn {
    padding: 28px;
    font-size: 1.4em;
  }
  .progression-grid {
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 8px;
  }
  button.prog-btn { font-size: 0.95em; padding: 10px 14px; }
  .bottom-bar { max-width: 1800px; }
}
.instructions {
  background: #1e1e1e;
  padding: 15px;
  border-radius: 8px;
  font-size: 0.9em;
  line-height: 1.5;
}
.theme-link {
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid #333;
}
.theme-link a {
  color: #7ab880;
  text-decoration: none;
}
.theme-link a:hover {
  text-decoration: underline;
}
.bottom-bar {
  position: fixed;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%) translateZ(0);
  -webkit-transform: translateX(-50%) translateZ(0);
  width: 100%;
  max-width: 900px;
  background: #1a1a1a;
  border-top: 1px solid #333;
  padding: 6px 20px calc(8px + env(safe-area-inset-bottom, 0px));
  z-index: 100;
  box-sizing: border-box;
}
.bottom-bar .chord-buttons {
  margin-bottom: 0;
}
.grid-size-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 4px;
}
.grid-size-label {
  font-size: 0.75em;
  color: #999;
  white-space: nowrap;
}
.grid-size-row input[type="range"] {
  flex: 1;
  height: 4px;
}
.chord-buttons.grid-mode {
  display: grid !important;
  flex: unset !important;
}
.chord-buttons.grid-mode button.chord-btn {
  aspect-ratio: 1;
  padding: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.85em;
  overflow: hidden;
  text-overflow: ellipsis;
}
.chord-row {
  display: flex;
  align-items: stretch;
  gap: 6px;
}
.chord-row .chord-buttons {
  flex: 1;
  margin-bottom: 0;
}
/* .inversion-btn {
  width: 38px;
  min-width: 38px;
  padding: 0;
  font-size: 1.2em;
  font-weight: bold;
  background: #2a2a2a;
  color: #999;
  border: 2px solid #444;
  border-radius: 8px;
  cursor: pointer;
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  transition: all 0.1s;
}
.inversion-btn:hover {
  background: #3a3a3a;
  color: #ccc;
}
.inversion-btn:active,
.inversion-btn.active {
  background: #385878;
  border-color: #5878b8;
  color: #fff;
} */
.modifier-indicator {
  display: flex;
  flex-direction: column;
  gap: 2px;
  justify-content: center;
}
.modifier-indicator:empty {
  display: none;
}
.mod-badge {
  font-size: 0.65em;
  font-weight: bold;
  padding: 2px 5px;
  border-radius: 4px;
  white-space: nowrap;
  line-height: 1.2;
  text-align: center;
}
.mod-badge.mod-inv {
  background: #385878;
  color: #fff;
}
.mod-badge.mod-sus {
  background: #583878;
  color: #fff;
}
.mod-badge.mod-slash {
  background: #995020;
  color: #fff;
}
.mod-badge.mod-dom7 {
  background: #784838;
  color: #fff;
}
.mod-badge.mod-dim {
  background: #505058;
  color: #fff;
}
.mod-badge.mod-aug {
  background: #586838;
  color: #fff;
}
.mod-badge.mod-spread {
  background: #385050;
  color: #fff;
}
.piano-mode-row {
  display: flex;
  gap: 4px;
  margin-bottom: 4px;
}
.piano-mode-btn {
  padding: 2px 10px;
  font-size: 0.75em;
  background: #2a2a2a;
  color: #888;
  border: 1px solid #444;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.1s;
}
.piano-mode-btn:not(.active):hover {
  background: #3a3a3a;
  color: #bbb;
}
.piano-mode-btn.active {
  background: #385878;
  color: #fff;
  border-color: #5878b8;
}
.mode-hidden {
  display: none !important;
}
.harp-range-label {
  display: none;
  align-items: center;
  gap: 4px;
  font-size: 0.7em;
  color: #888;
  margin-left: 4px;
}
.harp-range-label.visible {
  display: flex;
}
.harp-range-label input[type="range"] {
  width: 70px;
  height: 12px;
}
.harp-scale-toggle {
  display: none;
  gap: 4px;
  margin-left: 4px;
}
.harp-scale-toggle.visible {
  display: flex;
}
.piano-strip {
  height: 32px;
  width: 100%;
  margin-bottom: 6px;
  border-radius: 2px;
  overflow: hidden;
  cursor: pointer;
  touch-action: none;
  transition: height 0.15s ease;
}
.piano-strip.harp-mode {
  height: 64px;
}
/* .inversion-group {
  display: flex;
  gap: 4px;
} */
/* --- Matrix Bar --- */
.matrix-bar-container {
  width: 100%;
  touch-action: none;
  -webkit-user-select: none;
  user-select: none;
}
.matrix-bar-controls {
  display: flex;
  justify-content: center;
  gap: 12px;
  margin-bottom: 4px;
}
.matrix-bar-ctrl {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
}
.matrix-bar-ctrl-label {
  font-size: 0.55em;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: #555;
}
.matrix-bar-ctrl-row {
  display: flex;
  align-items: center;
  gap: 4px;
}
.matrix-bar-ctrl-btn {
  background: #222;
  border: 1px solid #333;
  color: #ccc;
  width: 24px;
  height: 24px;
  border-radius: 3px;
  display: flex;
  justify-content: center;
  align-items: center;
  cursor: pointer;
  font-weight: bold;
  font-size: 0.75em;
  padding: 0;
}
.matrix-bar-ctrl-btn:active {
  background: #fff;
  color: #000;
}
.matrix-bar-ctrl-val {
  font-size: 0.7em;
  min-width: 20px;
  text-align: center;
  color: #fff;
}
.matrix-bar-grids {
  display: flex;
  gap: 6px;
  width: 100%;
}
.matrix-bar-grid-section {
  flex: 1;
  min-width: 0;
}
.matrix-bar-grid-section:first-child {
  flex: 2;
}
.matrix-bar-grid-header {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-bottom: 2px;
}
.matrix-bar-grid-header label {
  font-size: 0.55em;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: #555;
  white-space: nowrap;
}
.matrix-bar-grid-header input[type="range"] {
  flex: 1;
  height: 4px;
  accent-color: #888;
  min-width: 30px;
}
.matrix-bar-grid-header span {
  font-size: 0.65em;
  color: #fff;
  min-width: 20px;
  text-align: center;
}
.matrix-bar-grid {
  display: grid;
  gap: 2px;
  width: 100%;
}
.matrix-bar-pad {
  background-color: var(--pad-bg, #1a1a1a);
  border: 1px solid #2a2a2a;
  border-radius: 2px;
  cursor: pointer;
  display: flex;
  justify-content: center;
  align-items: center;
  text-align: center;
  font-size: 0.45em;
  line-height: 1.1;
  padding: 1px;
  aspect-ratio: 1;
  word-break: break-word;
  color: #ccc;
  transition: background-color 4.5s ease, transform 0.05s, color 4.5s ease;
}
.matrix-bar-pad:active,
.matrix-bar-pad.active-touch {
  transform: scale(0.92);
  background-color: #fff !important;
  color: #000 !important;
  transition: transform 0.05s, background-color 0s;
}
.matrix-bar-pad.root-pad {
  background-color: var(--pad-bg, #122238);
  font-size: 0.6em;
  font-weight: bold;
}
.matrix-bar-pad.root-pad.active-root {
  border: 2px solid #fff;
}
/* --- Chord Builder --- */
.chord-builder-open-btn {
  padding: 8px 16px;
  background: #2a2a2a;
  color: #ccc;
  border: 1px solid #444;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.85em;
  margin-bottom: 12px;
}
.chord-builder-open-btn:hover { background: #3a3a3a; }
.chord-builder-modal {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.75);
  z-index: 200;
  display: flex;
  align-items: flex-end;
  justify-content: center;
}
.chord-builder-panel {
  background: #1a1a1a;
  border-top: 1px solid #444;
  border-radius: 12px 12px 0 0;
  width: 100%;
  max-width: 500px;
  padding: 12px 12px 16px;
  max-height: 85vh;
  overflow-y: auto;
}
.chord-builder-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
  font-weight: 600;
  font-size: 1em;
  color: #fff;
}
.chord-builder-x {
  background: none;
  border: none;
  color: #888;
  font-size: 1.5em;
  cursor: pointer;
  padding: 0 4px;
  line-height: 1;
}
.chord-builder-sequence {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  min-height: 40px;
  padding: 8px;
  background: #111;
  border-radius: 6px;
  margin-bottom: 12px;
  align-items: center;
}
.chord-builder-placeholder {
  color: #777;
  font-size: 0.82em;
}
.chord-builder-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: #486840;
  color: #fff;
  padding: 5px 8px;
  border-radius: 4px;
  font-size: 0.88em;
  font-weight: 600;
  cursor: pointer;
  border: none;
}
.chord-builder-chip:hover, .chord-builder-chip:active {
  background: #884040;
}
.chord-builder-chip::after {
  content: "\00d7";
  font-size: 1.1em;
  opacity: 0.7;
}
.chord-builder-section {
  margin-bottom: 10px;
}
.chord-builder-section label {
  display: block;
  font-size: 0.75em;
  color: #777;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 4px;
}
.chord-builder-roots, .chord-builder-qualities {
  display: grid;
  gap: 4px;
}
.chord-builder-roots {
  grid-template-columns: repeat(6, 1fr);
}
.chord-builder-qualities {
  grid-template-columns: repeat(5, 1fr);
}
.chord-builder-roots button,
.chord-builder-qualities button {
  padding: 10px 2px;
  font-size: 0.88em;
  font-weight: 600;
  background: #2a2a2a;
  color: #ccc;
  border: 1px solid #444;
  border-radius: 6px;
  cursor: pointer;
}
.chord-builder-roots button:hover,
.chord-builder-qualities button:hover {
  background: #3a3a3a;
  border-color: #666;
}
.chord-builder-roots button.active {
  background: #385878;
  border-color: #5878b8;
  color: #fff;
}
.chord-builder-qualities button:active {
  background: #587858;
  border-color: #7ab880;
  color: #fff;
}
.chord-builder-actions {
  display: flex;
  gap: 8px;
  margin-top: 8px;
}
.chord-builder-actions button {
  flex: 1;
  padding: 10px;
  font-size: 0.9em;
  font-weight: 600;
  border-radius: 6px;
  cursor: pointer;
  border: 1px solid #444;
  background: #2a2a2a;
  color: #ccc;
}
.chord-builder-use-btn {
  background: #486840 !important;
  border-color: #587858 !important;
  color: #fff !important;
}

/* --- Chord Explorer --- */
.chord-explorer-panel {
  max-width: 600px;
}
.chord-explorer-roots,
.chord-explorer-qualities {
  display: grid;
  gap: 4px;
}
.chord-explorer-roots {
  grid-template-columns: repeat(6, 1fr);
}
.chord-explorer-qualities {
  grid-template-columns: repeat(5, 1fr);
}
.chord-explorer-roots button,
.chord-explorer-qualities button {
  padding: 10px 2px;
  font-size: 0.88em;
  font-weight: 600;
  background: #2a2a2a;
  color: #ccc;
  border: 1px solid #444;
  border-radius: 6px;
  cursor: pointer;
}
.chord-explorer-roots button:hover,
.chord-explorer-qualities button:hover {
  background: #3a3a3a;
  border-color: #666;
}
.chord-explorer-roots button.active {
  background: #385878;
  border-color: #5878b8;
  color: #fff;
}
.chord-explorer-qualities button.active {
  background: #587858;
  border-color: #7ab880;
  color: #fff;
}
.chord-explorer-preview {
  margin-top: 10px;
  padding: 8px;
  background: #111;
  border-radius: 6px;
  font-size: 0.9em;
  color: #aaa;
  text-align: center;
  min-height: 30px;
}
.chord-explorer-panel .btn-group {
  margin-bottom: 4px;
}

/* --- Preset Section --- */
.preset-section {
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
  flex-wrap: wrap;
  align-items: center;
}
.preset-btn {
  padding: 6px 14px;
  background: #2a2a2a;
  color: #ccc;
  border: 1px solid #444;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.85em;
}
.preset-btn:hover {
  background: #3a3a3a;
  border-color: #666;
}
.reset-audio-btn {
  width: 28px;
  height: 28px;
  padding: 0;
  background: transparent;
  color: #c62828;
  border: 1px solid #c62828;
  border-radius: 50%;
  cursor: pointer;
  font-size: 14px;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.reset-audio-btn:hover {
  background: #c62828;
  color: #fff;
}
.preset-status {
  color: #7ab880;
  font-size: 0.85em;
}
.record-btn.recording {
  background: #b83840;
  border-color: #d84848;
  color: #fff;
  animation: record-pulse 1.2s ease-in-out infinite;
}
.record-status {
  color: #d84848;
  font-size: 0.85em;
  font-variant-numeric: tabular-nums;
}
@keyframes record-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.6; }
}
.midi-status {
  color: #888;
  font-size: 0.85em;
  margin-left: auto;
}
.chord-builder-actions button:hover {
  background: #3a3a3a;
  border-color: #666;
}
.chord-builder-use-btn:hover {
  background: #588060 !important;
}

/* --- MIDI Mode Toggle --- */
.midi-mode-toggle {
  display: flex;
  align-items: center;
  gap: 6px;
}
.midi-mode-toggle label {
  font-size: 0.82em;
  color: #888;
  margin-bottom: 0;
}
.midi-mode-toggle .btn-group button {
  padding: 4px 10px;
  font-size: 0.78em;
}

.compressor-toggle {
  display: flex;
  align-items: center;
  gap: 6px;
}
.compressor-toggle label {
  font-size: 0.82em;
  color: #888;
  margin-bottom: 0;
}
.compressor-toggle .btn-group button {
  padding: 4px 10px;
  font-size: 0.78em;
}

.pitch-readouts {
  font-size: 0.72em;
  font-family: monospace;
  margin-bottom: 4px;
}
.pitch-row {
  display: flex;
  justify-content: center;
  line-height: 1.4;
}
.pitch-label {
  color: #777;
  width: 76px;
  text-align: right;
  padding-right: 6px;
  flex-shrink: 0;
}
.pitch-val {
  width: 52px;
  text-align: right;
  flex-shrink: 0;
  opacity: 0.85;
}
.pitch-unit {
  color: #666;
  width: 10px;
  padding-left: 2px;
  flex-shrink: 0;
}

/* --- Synth Preset Selector --- */
#synth-preset-select {
  width: 100%;
  padding: 6px 8px;
  background: #2a2a2a;
  color: #ccc;
  border: 1px solid #444;
  border-radius: 6px;
  font-size: 0.85em;
  cursor: pointer;
  appearance: auto;
}
#synth-preset-select:focus {
  outline: 1px solid #7ab880;
  border-color: #7ab880;
}
#synth-preset-select optgroup {
  color: #7ab880;
  font-weight: 600;
  font-style: normal;
}
#synth-preset-select option {
  color: #ccc;
  background: #2a2a2a;
  font-weight: normal;
}

/* --- Vertical Drag Destination Selector --- */
#vdrag-dest-select {
  width: 100%;
  padding: 6px 8px;
  background: #2a2a2a;
  color: #ccc;
  border: 1px solid #444;
  border-radius: 6px;
  font-size: 0.85em;
  cursor: pointer;
  appearance: auto;
}
#vdrag-dest-select:focus {
  outline: 1px solid #c8a858;
  border-color: #c8a858;
}
#vdrag-dest-select optgroup {
  color: #c8a858;
  font-weight: 600;
  font-style: normal;
}
#vdrag-dest-select option {
  color: #ccc;
  background: #2a2a2a;
  font-weight: normal;
}

/* --- Folk Song Library --- */
.folk-modal {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.75);
  z-index: 200;
  display: flex;
  align-items: flex-end;
  justify-content: center;
}
.folk-panel {
  background: #1a1a1a;
  border-top: 1px solid #444;
  border-radius: 12px 12px 0 0;
  width: 100%;
  max-width: 540px;
  padding: 12px 12px 16px;
  max-height: 85vh;
  overflow-y: auto;
}
.folk-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
  font-weight: 600;
  font-size: 1em;
  color: #fff;
}
.folk-search {
  width: 100%;
  padding: 8px 10px;
  background: #111;
  color: #e0e0e0;
  border: 1px solid #444;
  border-radius: 6px;
  font-size: 0.88em;
  margin-bottom: 8px;
  box-sizing: border-box;
}
.folk-search:focus {
  outline: 1px solid #7ab880;
  border-color: #7ab880;
}
.folk-results {
  max-height: 40vh;
  overflow-y: auto;
  margin-bottom: 12px;
}
.folk-result {
  display: flex;
  flex-direction: column;
  gap: 2px;
  width: 100%;
  padding: 8px 10px;
  background: #2a2a2a;
  border: 1px solid #333;
  border-radius: 6px;
  cursor: pointer;
  text-align: left;
  margin-bottom: 4px;
}
.folk-result:hover {
  background: #3a3a3a;
  border-color: #587858;
}
.folk-result-title {
  font-weight: 600;
  font-size: 0.9em;
  color: #e0e0e0;
}
.folk-result-origin {
  font-size: 0.75em;
  color: #888;
}
.folk-result-chords {
  font-size: 0.78em;
  color: #7ab880;
  font-family: monospace;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.folk-empty {
  color: #666;
  font-size: 0.85em;
  padding: 12px;
  text-align: center;
}
.folk-import-section {
  border-top: 1px solid #333;
  padding-top: 10px;
}
.folk-import-section label {
  display: block;
  font-size: 0.75em;
  color: #777;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 6px;
}
.folk-import-title {
  width: 100%;
  padding: 6px 8px;
  background: #111;
  color: #e0e0e0;
  border: 1px solid #444;
  border-radius: 6px;
  font-size: 0.85em;
  margin-bottom: 6px;
  box-sizing: border-box;
}
.folk-import-title:focus {
  outline: 1px solid #7ab880;
  border-color: #7ab880;
}
.folk-import-text {
  width: 100%;
  padding: 6px 8px;
  background: #111;
  color: #e0e0e0;
  border: 1px solid #444;
  border-radius: 6px;
  font-size: 0.85em;
  font-family: monospace;
  resize: vertical;
  margin-bottom: 6px;
  box-sizing: border-box;
}
.folk-import-text:focus {
  outline: 1px solid #7ab880;
  border-color: #7ab880;
}
.folk-import-btn {
  width: 100%;
  padding: 8px;
  font-size: 0.9em;
  font-weight: 600;
  border-radius: 6px;
  cursor: pointer;
  border: 1px solid #587858;
  background: #486840;
  color: #fff;
}
.folk-import-btn:hover {
  background: #588060;
}
