@font-face {
  font-family: 'Astra Square';
  src: url('../../fonts/square.ttf') format('truetype');
  font-display: swap;
}
@font-face {
  font-family: 'Astra Dot';
  src: url('../../fonts/dotm.ttf') format('truetype');
  font-display: swap;
}
@font-face {
  font-family: 'Astra Frohburg';
  src: url('../../fonts/frohburg.ttf') format('truetype');
  font-display: swap;
}
@font-face {
  font-family: 'Astra MGS';
  src: url('../../fonts/mgs.ttf') format('truetype');
  font-display: swap;
}
@font-face {
  font-family: 'Astra Mokoto';
  src: url('../../fonts/mokoto.ttf') format('truetype');
  font-display: swap;
}
@font-face {
  font-family: 'Astra Panoptic';
  src: url('../../fonts/panoptic.ttf') format('truetype');
  font-display: swap;
}
@font-face {
  font-family: 'Astra Robotroc';
  src: url('../../fonts/robotroc.ttf') format('truetype');
  font-display: swap;
}
@font-face {
  font-family: 'Astra Sarno';
  src: url('../../fonts/sarno.ttf') format('truetype');
  font-display: swap;
}

:root {
  --tracker-height: 320px;
  --divider-height: 6px;
  --tracker-font: 'Astra Frohburg', ui-monospace, monospace;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: system-ui, sans-serif;
  background: #1c1c1f;
  color: #ddd;
  overflow: hidden;
  height: 100vh;
}

.toolbar {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: 48px;
  background: #2a2a30;
  display: flex;
  align-items: center;
  padding: 0 1rem;
  gap: 0.5rem;
  border-bottom: 1px solid #444;
  z-index: 100;
}

.toolbar button {
  background: #3a3a44;
  color: #ddd;
  border: 1px solid #555;
  padding: 0.4rem 0.8rem;
  border-radius: 4px;
  cursor: pointer;
  font-size: 13px;
  font-family: inherit;
}
.toolbar button:hover { background: #4a4a55; }
.toolbar button.preset-btn {
  border-color: #6cc364;
  color: #cfecca;
}
.toolbar button.preset-btn:hover { background: #3a4a3a; }
.toolbar .sep {
  width: 1px;
  height: 24px;
  background: #444;
  margin: 0 0.4rem;
}
#palette {
  display: inline-flex;
  gap: 0.5rem;
}
.palette-group {
  position: relative;
  display: inline-flex;
}
.palette-trigger {
  /* inherits .toolbar button styles */
}
.palette-group.open .palette-trigger {
  background: #4a4a55;
  border-color: #6cc364;
}
.palette-menu {
  display: none;
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  min-width: 140px;
  background: #2a2a30;
  border: 1px solid #555;
  border-radius: 4px;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.5);
  padding: 4px;
  z-index: 1000;
  flex-direction: column;
  gap: 2px;
}
.palette-group.open .palette-menu {
  display: flex;
}
.palette-menu-item {
  text-align: left;
  background: transparent;
  border: 1px solid transparent;
  color: #ddd;
  padding: 5px 10px;
  border-radius: 3px;
  cursor: pointer;
  font-family: inherit;
  font-size: 13px;
}
.palette-menu-item:hover {
  background: #3a3a45;
  border-color: #555;
}

.midi-controls {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.midi-label {
  font-size: 11px;
  color: #999;
  letter-spacing: 0.5px;
  text-transform: uppercase;
}
.midi-arrow {
  color: #666;
  font-size: 12px;
}
.midi-select {
  background: #1f1f24;
  color: #ddd;
  border: 1px solid #555;
  border-radius: 4px;
  padding: 3px 6px;
  font-size: 12px;
  font-family: inherit;
  max-width: 160px;
}
.midi-select:disabled {
  color: #777;
  border-color: #3a3a44;
}
.midi-select:focus {
  outline: none;
  border-color: #6cc364;
}

.toolbar .spacer { flex: 1; }

.toolbar-check {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 12px;
  color: #aaa;
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
}
.toolbar-check input {
  accent-color: #6cc364;
  cursor: pointer;
  margin: 0;
}
.toolbar-check:hover { color: #ddd; }
.toolbar .status {
  font-family: ui-monospace, monospace;
  font-size: 12px;
  color: #999;
  margin-right: 0.5rem;
}

.workspace {
  position: absolute;
  top: 48px;
  left: 0; right: 0;
  bottom: calc(var(--tracker-height) + var(--divider-height));
  /* Stars off: the classic dotted grid. */
  background:
    radial-gradient(circle, #2a2a30 1px, transparent 1px) 0 0 / 20px 20px,
    #1c1c1f;
  overflow: hidden;
}
.workspace.starfield-on {
  background: #16161c;
}

.starfield-canvas {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 0;
}

.divider {
  position: absolute;
  left: 0; right: 0;
  bottom: var(--tracker-height);
  height: var(--divider-height);
  background: #2a2a30;
  border-top: 1px solid #1a1a1f;
  border-bottom: 1px solid #1a1a1f;
  cursor: ns-resize;
  z-index: 70;
  display: flex;
  align-items: center;
  justify-content: center;
}
.divider::after {
  content: '';
  width: 40px;
  height: 2px;
  background: #555;
  border-radius: 1px;
}
.divider:hover { background: #3a3a44; }
.divider:hover::after { background: #999; }
.divider.dragging { background: #4a4a55; }
.divider.dragging::after { background: #6cc364; }

.tracker {
  position: absolute;
  bottom: 0;
  left: 0; right: 0;
  height: var(--tracker-height);
  background: #16161a;
  display: flex;
  flex-direction: column;
  z-index: 60;
  outline: none;
}
.tracker:focus { box-shadow: inset 0 2px 0 #6cc364; }

.tracker-top {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.3rem;
  row-gap: 4px;
  padding: 6px 12px;
  background: #1c1c20;
  border-bottom: 1px solid #333;
  font-size: 12px;
  flex-shrink: 0;
}

.tracker-sep {
  width: 1px;
  height: 18px;
  background: #444;
  margin: 0 4px;
}

.mode-toggle {
  display: inline-flex;
  border: 1px solid #555;
  border-radius: 3px;
  overflow: hidden;
}
.mode-toggle button {
  background: #2a2a30;
  color: #aaa;
  border: none;
  padding: 4px 10px;
  font-size: 11px;
  font-family: inherit;
  cursor: pointer;
}
.mode-toggle button:hover { background: #3a3a3f; }
.mode-toggle button.active {
  background: #4a4a55;
  color: #fff;
}

.song-idx {
  font-family: ui-monospace, monospace;
  color: #888;
  width: 22px;
  text-align: right;
  cursor: pointer;
  user-select: none;
  padding: 1px 3px;
  border-radius: 2px;
}
.song-idx:hover {
  background: #2a2a30;
  color: #ddd;
}

.tracker-body {
  display: flex;
  flex: 1 1 auto;
  min-height: 0;
  overflow: hidden;
}
.tracker-main {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.tracker-editor.tracker-song-editor {
  max-height: none;
  width: 200px;
  flex: 0 0 200px;
  height: auto;
  border-right: 1px solid #333;
  border-bottom: none;
  overflow-y: auto;
}

.song-row.playing {
  background: #1f2a1f;
  border-left: 3px solid #6cc364;
  padding-left: 6px;
  margin-left: -9px;
}
.song-row.playing .song-idx {
  color: #6cc364;
  font-weight: 700;
}

.tracker-label {
  color: #888;
  font-family: ui-monospace, monospace;
  margin-left: 0.4rem;
}

.tracker-play {
  background: #3a3a44;
  color: #ddd;
  border: 1px solid #555;
  border-radius: 4px;
  width: 32px;
  height: 28px;
  cursor: pointer;
  font-size: 12px;
}
.tracker-play:hover { background: #4a4a55; }

.tracker-input {
  background: #1c1c1f;
  color: #ddd;
  border: 1px solid #555;
  padding: 3px 4px;
  border-radius: 3px;
  width: 60px;
  font-family: ui-monospace, monospace;
}

.tracker-select {
  background: #1c1c1f;
  color: #ddd;
  border: 1px solid #555;
  padding: 3px 4px;
  border-radius: 3px;
  font-family: ui-monospace, monospace;
  min-width: 110px;
  max-width: 180px;
}

.tracker-select.tracker-select-narrow {
  min-width: 0;
  width: 45px;
}

.tracker-octave {
  font-family: ui-monospace, monospace;
  font-size: 14px;
  color: #e09d3d;
  font-weight: bold;
  min-width: 14px;
  text-align: center;
}

.tracker-octave-buttons {
  display: inline-flex;
  flex-direction: column;
  gap: 1px;
  margin-left: 2px;
}
.tracker-octave-btn {
  background: #2a2a30;
  color: #ccc;
  border: 1px solid #555;
  border-radius: 2px;
  cursor: pointer;
  font-size: 8px;
  line-height: 1;
  padding: 1px 4px;
  height: 13px;
  min-width: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: inherit;
}
.tracker-octave-btn:hover {
  background: #3a3a45;
  border-color: #777;
  color: #e09d3d;
}

.tracker-hint {
  margin-left: auto;
  color: #666;
  font-family: ui-monospace, monospace;
  font-size: 11px;
}

.tracker-editor {
  background: #1a1a1f;
  border-bottom: 1px solid #333;
  padding: 8px 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 140px;
  overflow-y: auto;
  flex-shrink: 0;
}

.editor-row {
  display: flex;
  align-items: center;
  gap: 6px;
}

.editor-input {
  background: #1c1c1f;
  color: #ddd;
  border: 1px solid #555;
  padding: 3px 6px;
  border-radius: 3px;
  width: 110px;
  font-family: ui-monospace, monospace;
  font-size: 12px;
}
.editor-input.glide-input {
  width: 60px;
}

.tracker-mini {
  background: #3a3a44;
  color: #ddd;
  border: 1px solid #555;
  border-radius: 3px;
  width: 24px;
  height: 24px;
  cursor: pointer;
  font-size: 13px;
  font-family: inherit;
  padding: 0;
  line-height: 1;
}
.tracker-mini:hover { background: #4a4a55; }
.tracker-mini.active {
  background: #4a4a55;
  border-color: #6cc364;
}

.tracker-add {
  background: #2a3a2a;
  color: #cce0cc;
  border: 1px solid #4a5a4a;
  border-radius: 3px;
  padding: 4px 10px;
  cursor: pointer;
  font-size: 11px;
  align-self: flex-start;
  font-family: ui-monospace, monospace;
}
.tracker-add:hover { background: #3a4a3a; }

.multi-tag {
  font-size: 14px;
  color: #6cc8c4;
  margin: 0 4px;
  user-select: none;
}

.multi-targets {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
}

.multi-target {
  background: #2a2a30;
  color: #888;
  border: 1px solid #555;
  border-radius: 3px;
  padding: 2px 8px;
  font-size: 11px;
  font-family: ui-monospace, monospace;
  cursor: pointer;
}
.multi-target:hover { background: #3a3a40; }
.multi-target.active {
  background: #2a4a4a;
  color: #cdf2ee;
  border-color: #4c8a86;
}

.multi-empty {
  font-style: italic;
  color: #666;
  font-size: 11px;
  font-family: ui-monospace, monospace;
}

.tracker-piano {
  position: relative;
  height: 0;
  overflow: hidden;
  transition: height 0.18s ease;
  background: #1a1a1f;
  border-bottom: 1px solid #333;
  flex-shrink: 0;
  display: flex;
  justify-content: center;
  align-items: center;
}
.tracker.has-focus .tracker-piano {
  height: 68px;
}
.tracker.piano-hidden .tracker-piano,
.tracker.piano-hidden.has-focus .tracker-piano {
  height: 0;
}

.piano-scale-controls {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex-shrink: 0;
}
.piano-scale-field {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 10px;
  color: #999;
}
.piano-scale-field > span {
  width: 30px;
  text-align: right;
}
.piano-scale-select {
  background: #1c1c1f;
  color: #ddd;
  border: 1px solid #555;
  border-radius: 3px;
  font-family: ui-monospace, monospace;
  font-size: 10px;
  padding: 1px 3px;
  width: 124px;
  box-sizing: border-box;
}

.piano-wrap {
  position: relative;
  height: 60px;
  flex-shrink: 0;
}

.piano-whites {
  display: flex;
  height: 100%;
}

.piano-blacks {
  position: absolute;
  top: 0;
  left: 0;
  height: 64%;
  pointer-events: none;
}

.piano-key {
  cursor: pointer;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  align-items: center;
  user-select: none;
  font-family: ui-monospace, monospace;
  box-sizing: border-box;
}

.piano-key.white {
  width: 28px;
  flex: 0 0 28px;
  height: 100%;
  background: #e8e8ec;
  color: #444;
  border-top: 1px solid #888;
  border-bottom: 1px solid #888;
  border-right: 1px solid #888;
  border-radius: 0 0 3px 3px;
}
.piano-key.white:first-child {
  border-left: 1px solid #888;
}
.piano-key.white:hover { background: #d8d8dc; }

.piano-key.black {
  width: 18px;
  position: absolute;
  background: #1a1a1f;
  color: #ccc;
  border: 1px solid #444;
  border-bottom: 2px solid #000;
  border-radius: 0 0 2px 2px;
  height: 100%;
  pointer-events: auto;
  z-index: 2;
}
.piano-key.black:hover { background: #2a2a2f; }

/* Keys outside the selected key + scale: white keys 20% darker, black keys 20%
   lighter (relative to the normal key colors). Still fully clickable — this is
   purely a visual hint. */
.piano-key.white.off-scale {
  background: #bababd; /* #e8e8ec x 0.8 */
  color: #7a7a82;
}
.piano-key.white.off-scale:hover { background: #adadb0; } /* #d8d8dc x 0.8 */
.piano-key.black.off-scale {
  background: #48484c; /* #1a1a1f lightened 20% toward white */
  color: #8a8a92;
}
.piano-key.black.off-scale:hover { background: #555559; } /* #2a2a2f +20% */

.piano-key.pressed {
  background: #6cc364 !important;
  color: #1c1c1f !important;
  border-color: #4a8a44;
}

.piano-key .key-label {
  font-size: 10px;
  font-weight: 700;
  padding-bottom: 2px;
}
.piano-key .key-note {
  font-size: 8px;
  opacity: 0.55;
  padding-bottom: 3px;
}
.piano-key.black .key-note { display: none; }

.tracker-grid {
  flex: 1;
  overflow: auto;
  font-family: ui-monospace, monospace;
  font-size: 13px;
}

.tracker-group-bar {
  position: relative;
  height: 22px;
  background: #1a1a1f;
  border-bottom: 1px solid #2a2a2a;
}
.tracker-group-segment {
  position: absolute;
  top: 2px;
  height: 18px;
  border-radius: 3px;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 0 6px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.5px;
  cursor: pointer;
  user-select: none;
  box-sizing: border-box;
  overflow: hidden;
  opacity: 0.95;
}
.tracker-group-segment:hover { opacity: 1; }
.tracker-group-segment.collapsed { opacity: 0.6; }
.tracker-group-chevron {
  background: transparent;
  border: none;
  color: inherit;
  font-size: 9px;
  width: 14px;
  height: 14px;
  cursor: pointer;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 2px;
  opacity: 0.8;
  flex-shrink: 0;
}
.tracker-group-chevron:hover {
  background: rgba(0, 0, 0, 0.2);
  opacity: 1;
}

.tracker-group-color {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  border: 1px solid rgba(0, 0, 0, 0.3);
  cursor: pointer;
  padding: 0;
  flex-shrink: 0;
}
.tracker-group-name {
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.tracker-group-rename,
.tracker-group-delete {
  width: 14px;
  height: 14px;
  border-radius: 2px;
  background: rgba(0, 0, 0, 0.15);
  color: inherit;
  border: none;
  font-size: 10px;
  line-height: 1;
  cursor: pointer;
  padding: 0;
  opacity: 0.7;
  flex-shrink: 0;
}
.tracker-group-rename:hover,
.tracker-group-delete:hover {
  opacity: 1;
  background: rgba(0, 0, 0, 0.3);
}

.tracker-group-mute,
.tracker-group-solo {
  width: 16px;
  height: 14px;
  border-radius: 2px;
  background: rgba(0, 0, 0, 0.15);
  color: inherit;
  border: none;
  font-size: 9px;
  font-weight: 700;
  line-height: 1;
  cursor: pointer;
  padding: 0;
  opacity: 0.7;
  flex-shrink: 0;
}
.tracker-group-mute:hover,
.tracker-group-solo:hover {
  opacity: 1;
  background: rgba(0, 0, 0, 0.3);
}
.tracker-group-mute.active {
  background: #c25a4a;
  color: #fff;
  opacity: 1;
}
.tracker-group-mute.active:hover { background: #d26a5a; }
.tracker-group-solo.active {
  background: #c2a04a;
  color: #1c1c1f;
  opacity: 1;
}
.tracker-group-solo.active:hover { background: #d2b05a; }

.tracker-group-name-input {
  flex: 1;
  background: rgba(0, 0, 0, 0.25);
  color: inherit;
  border: 1px solid rgba(0, 0, 0, 0.4);
  border-radius: 2px;
  padding: 0 4px;
  font-family: inherit;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.5px;
  outline: none;
  min-width: 40px;
}

.tracker-group-menu {
  display: flex;
  flex-direction: column;
  min-width: 180px;
  background: #2a2a30;
  border: 1px solid #555;
  border-radius: 4px;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.5);
  padding: 4px;
  z-index: 1100;
  gap: 2px;
}
.tracker-group-menu-item {
  display: flex;
  align-items: center;
  gap: 8px;
  text-align: left;
  background: transparent;
  border: 1px solid transparent;
  color: #ddd;
  padding: 5px 10px;
  border-radius: 3px;
  cursor: pointer;
  font-family: inherit;
  font-size: 13px;
}
.tracker-group-menu-item:hover {
  background: #3a3a45;
  border-color: #555;
}
.tracker-group-menu-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.2);
  flex-shrink: 0;
}

.track-group-btn.active {
  border-width: 2px !important;
}

.tracker-track-bar {
  display: flex;
  align-items: center;
  position: sticky;
  top: 0;
  background: #1a1a1f;
  z-index: 5;
  border-bottom: 1px solid #333;
  padding: 4px 0;
  min-height: 32px;
}

.tracker-track-head {
  --lanes: 1;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 3px;
  width: calc(208px + 48px * var(--lanes));
  min-width: calc(208px + 48px * var(--lanes));
  padding: 2px 6px;
  box-sizing: border-box;
}
.tracker-track-head.inactive .track-num,
.tracker-track-head.inactive .tracker-track-inst {
  opacity: 0.4;
}

.tracker-track-head.collapsed {
  width: 28px;
  min-width: 28px;
  padding: 2px 2px;
  align-items: center;
  justify-content: flex-start;
}

.tracker-track-head.dragging {
  opacity: 0.5;
}
.tracker-track-head.drop-target-before {
  box-shadow: inset 3px 0 0 #6cc364;
}
.tracker-track-head.drop-target-after {
  box-shadow: inset -3px 0 0 #6cc364;
}
.tracker-group-segment.dragging {
  opacity: 0.5;
}
.tracker-track-head.collapsed .track-title-row .track-num,
.tracker-track-head.collapsed .track-controls {
  display: none;
}
.track-title-row {
  display: flex;
  align-items: center;
  gap: 6px;
}
.track-title-row .track-num {
  flex: 1;
}
.track-collapse {
  font-size: 10px !important;
  font-weight: 700;
  width: 22px !important;
  height: 18px !important;
  padding: 0 !important;
  flex-shrink: 0;
}

.tracker-cell.collapsed {
  width: 28px;
  min-width: 28px;
  padding: 0;
  justify-content: center;
  align-items: center;
  position: relative;
}
.tracker-cell.collapsed > .sub {
  display: none;
}
.tracker-cell.collapsed::after {
  content: '';
  width: 8px;
  height: 8px;
  border-radius: 2px;
  background: transparent;
}
.tracker-cell.collapsed.has-note::after {
  background: var(--note-color, #6cc364);
}
.tracker-cell.collapsed.has-off::after {
  background: #c25a4a;
  border-radius: 2px;
  height: 3px;
  width: 10px;
}

.track-mute, .track-solo {
  font-size: 10px !important;
  font-weight: 700;
  width: 22px !important;
  height: 20px !important;
  padding: 0 !important;
}

.track-lane-controls {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  margin-left: 2px;
  border: 1px solid #444;
  border-radius: 3px;
  background: #1c1c1f;
  padding: 0 2px;
}
.track-lane-btn {
  font-size: 12px !important;
  font-weight: 700;
  width: 18px !important;
  height: 18px !important;
  padding: 0 !important;
  background: transparent !important;
  border: none !important;
}
.track-lane-btn:hover {
  background: #3a3a44 !important;
}
.track-lane-count {
  font-family: ui-monospace, monospace;
  font-size: 10px;
  color: #999;
  min-width: 8px;
  text-align: center;
}
.track-mute.active {
  background: #c25a4a;
  color: #fff;
  border-color: #d27264;
}
.track-mute.active:hover { background: #d26a5a; }
.track-solo.active {
  background: #c2a04a;
  color: #1c1c1f;
  border-color: #d2b264;
}
.track-solo.active:hover { background: #d2b05a; }

.track-num {
  font-family: ui-monospace, monospace;
  font-size: 11px;
  font-weight: 700;
  color: #888;
  letter-spacing: 1px;
  text-align: center;
  cursor: text;
}

.track-num-input {
  background: #1c1c1f;
  color: #fff;
  border: 1px solid #6cc364;
  border-radius: 3px;
  padding: 0 4px;
  font-family: ui-monospace, monospace;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 1px;
  text-align: center;
  outline: none;
  box-sizing: border-box;
  width: 100%;
}

.track-controls {
  display: flex;
  align-items: center;
  gap: 4px;
}

.tracker-track-inst {
  flex: 0 0 100px;
  width: 100px;
  background: #1c1c1f;
  color: #ddd;
  border: 1px solid #555;
  padding: 2px 4px;
  border-radius: 3px;
  font-family: ui-monospace, monospace;
  font-size: 11px;
  min-width: 0;
}

.tracker-track-add {
  margin-left: 8px;
}

.tracker-row {
  display: flex;
  align-items: center;
  padding: 1px 0;
  cursor: default;
  user-select: none;
  border-left: 3px solid transparent;
  line-height: 1.6;
}
.tracker-row.cursor-row .tracker-rownum { color: #5a8fc7; }
.tracker-row.playing {
  background: #2a1f12;
  border-left-color: #e09d3d;
}
.tracker-row.playing .tracker-rownum { color: #e09d3d; }

.tracker-rownum {
  width: 36px;
  min-width: 36px;
  color: #555;
  text-align: right;
  padding-right: 10px;
  box-sizing: border-box;
  font-family: var(--tracker-font);
}

.tracker-cell {
  --lanes: 1;
  width: calc(208px + 48px * var(--lanes));
  min-width: calc(208px + 48px * var(--lanes));
  padding: 0 10px;
  box-sizing: border-box;
  display: flex;
  align-items: center;
  gap: 10px;
  border-right: 1px solid #2a2a2a;
  cursor: pointer;
}
.tracker-cell:hover { background: #1f1f24; }
.tracker-cell.selected {
  background: rgba(108, 195, 100, 0.18);
}
.tracker-cell.selected:hover {
  background: rgba(108, 195, 100, 0.24);
}

.tracker-fill-group {
  display: inline-flex;
  gap: 4px;
}
.tracker-fill-btn {
  width: auto;
  min-width: 38px;
  height: 24px;
  padding: 0 8px;
  font-variant-numeric: tabular-nums;
}

.tracker-cell .sub {
  font-family: var(--tracker-font);
  letter-spacing: 1.5px;
  white-space: pre;
  padding: 0 2px;
  border-radius: 2px;
}
.tracker-cell .sub .char {
  display: inline-block;
  white-space: pre;
}
.tracker-cell .sub.note { color: #ddd; }
.tracker-cell .sub.note.off { color: #d77; }
.tracker-cell .sub.vel { color: #8acaff; }
.tracker-cell .sub.fx { color: #e0c068; }
.tracker-cell .sub.empty { color: #3a3a40; }

.tracker-cell .sub.sub-selected {
  background: rgba(108, 195, 100, 0.22);
}

.tracker-cell .sub.cursor-sub {
  background: rgba(90, 143, 199, 0.15);
}
.tracker-cell .sub.note.cursor-sub {
  background: #5a8fc7;
  color: #fff;
}
.tracker-cell .sub .char.cursor-char {
  background: #5a8fc7;
  color: #fff;
  border-radius: 2px;
}

.viewport {
  position: absolute;
  top: 0; left: 0;
  width: 100%; height: 100%;
  transform-origin: 0 0;
  z-index: 10;
}

.lasso {
  position: absolute;
  border: 1px solid #6cc364;
  background: rgba(108, 195, 100, 0.08);
  pointer-events: none;
  z-index: 15;
}

.cables {
  position: absolute;
  top: 0; left: 0;
  width: 100%; height: 100%;
  pointer-events: none;
  z-index: 50;
}

.group-rect {
  position: absolute;
  background: rgba(var(--group-rgb, 108, 195, 100), 0.08);
  border: 1px dashed rgba(var(--group-rgb, 108, 195, 100), 0.5);
  border-radius: 8px;
  pointer-events: none;
  box-sizing: border-box;
  z-index: 5;
}
.group-rect.collapsed {
  background: transparent;
  border: none;
  width: auto;
  height: auto;
  z-index: 14;
}
.group-rect.collapsed.selected .group-label {
  outline: 2px solid #6cc364;
  outline-offset: 2px;
}

.panel.hidden-in-group {
  display: none;
}

.group-chevron {
  display: inline-block;
  vertical-align: middle;
  margin-right: 6px;
  font-size: 9px;
  line-height: 1;
  cursor: pointer;
  user-select: none;
  opacity: 0.8;
}
.group-chevron:hover { opacity: 1; }

.group-label {
  position: absolute;
  top: 0;
  left: 0;
  background: rgba(var(--group-rgb, 108, 195, 100), 0.85);
  color: var(--group-text, #1c1c1f);
  padding: 3px 10px;
  border-radius: 7px 0 6px 0;
  font-size: 11px;
  font-family: ui-monospace, monospace;
  font-weight: 600;
  letter-spacing: 0.5px;
  pointer-events: auto;
  cursor: move;
  user-select: none;
}
.group-label.collapsed {
  position: relative;
  border-radius: 6px;
  padding: 5px 12px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.35);
}
.group-label:hover {
  background: rgba(var(--group-rgb, 108, 195, 100), 0.95);
}

.group-label-name {
  display: inline-block;
  vertical-align: middle;
}

.group-color-dot {
  display: inline-block;
  vertical-align: middle;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  margin-left: 8px;
  cursor: pointer;
  border: 1px solid rgba(0, 0, 0, 0.35);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.2);
}
.group-color-dot:hover {
  outline: 1px solid #fff;
}


.group-label-input {
  background: rgba(0, 0, 0, 0.35);
  color: #fff;
  border: 1px solid rgba(var(--group-rgb, 108, 195, 100), 0.9);
  border-radius: 3px;
  padding: 0 4px;
  font-family: ui-monospace, monospace;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.5px;
  outline: none;
  width: 120px;
  cursor: text;
}

.selection-hud {
  position: absolute;
  top: 10px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 90;
  background: rgba(28, 28, 31, 0.92);
  border: 1px solid #555;
  border-radius: 4px;
  padding: 6px 10px;
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: system-ui, sans-serif;
  font-size: 12px;
  color: #ddd;
}
.selection-hud .sel-info {
  font-family: ui-monospace, monospace;
  color: #aaa;
  margin-right: 4px;
}
.selection-hud button {
  background: #3a3a44;
  color: #ddd;
  border: 1px solid #555;
  border-radius: 3px;
  padding: 3px 10px;
  font-size: 11px;
  cursor: pointer;
  font-family: inherit;
}
.selection-hud button:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}
.selection-hud button:hover:not(:disabled) {
  background: #4a4a55;
}

.zoom-hud {
  position: absolute;
  bottom: 10px;
  right: 10px;
  z-index: 80;
  background: rgba(28, 28, 31, 0.85);
  color: #ccc;
  border: 1px solid #555;
  border-radius: 4px;
  padding: 4px 10px;
  font-family: ui-monospace, monospace;
  font-size: 11px;
  cursor: pointer;
  user-select: none;
}
.zoom-hud:hover {
  background: rgba(58, 58, 68, 0.95);
  color: #fff;
}

.cables path.cable {
  fill: none;
  pointer-events: stroke;
  cursor: pointer;
}
.cables path.cable.audio {
  stroke: #6cc364;
  stroke-width: 3;
}
.cables path.cable.cv {
  stroke: #e09d3d;
  stroke-width: 2.5;
}
.cables path.cable.voice {
  stroke: #6cc8c4;
  stroke-width: 2;
  stroke-dasharray: 6 4;
}
.cables path.cable:hover {
  filter: brightness(1.4);
  stroke-width: 5;
}

.cables path.ghost {
  fill: none;
  stroke: #aaa;
  stroke-width: 2;
  stroke-dasharray: 6 4;
  pointer-events: none;
}

.panel {
  position: absolute;
  background: #2e2e36;
  border: 1px solid #555;
  border-radius: 6px;
  user-select: none;
  box-shadow: 0 4px 12px rgba(0,0,0,0.4);
  font-size: 12px;
  z-index: 10;
}
.panel.selected {
  outline: 2px solid #6cc364;
  outline-offset: 2px;
  z-index: 11;
}
.panel.spawned {
  animation: panel-spawn 0.7s ease-out;
  z-index: 12;
}
@keyframes panel-spawn {
  0% {
    box-shadow: 0 0 0 0 rgba(108, 200, 196, 0.9), 0 4px 12px rgba(0,0,0,0.4);
    transform: scale(1.06);
  }
  60% {
    box-shadow: 0 0 0 10px rgba(108, 200, 196, 0), 0 4px 12px rgba(0,0,0,0.4);
    transform: scale(1);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(108, 200, 196, 0), 0 4px 12px rgba(0,0,0,0.4);
    transform: scale(1);
  }
}

.panel-title {
  background: #3a3a44;
  padding: 6px 10px;
  cursor: move;
  border-radius: 6px 6px 0 0;
  font-weight: 600;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 12px;
  letter-spacing: 0.5px;
  text-transform: uppercase;
}
.panel-title .close {
  cursor: pointer;
  opacity: 0.5;
  font-size: 18px;
  line-height: 1;
  padding: 0 4px;
}
.title-actions {
  display: flex;
  gap: 4px;
  align-items: center;
}
.toggle-advanced {
  cursor: pointer;
  opacity: 0.55;
  font-size: 13px;
  line-height: 1;
  padding: 0 4px;
  user-select: none;
}
.toggle-advanced:hover { opacity: 1; color: #6cc364; }
.panel-info {
  cursor: pointer;
  opacity: 0.55;
  font-size: 13px;
  line-height: 1;
  padding: 0 4px;
  user-select: none;
}
.panel-info:hover { opacity: 1; color: #6cc8c4; }

.panel-info-popup {
  position: fixed;
  background: #1c1c20;
  border: 1px solid #555;
  border-radius: 5px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.5);
  color: #ddd;
  font-family: system-ui, sans-serif;
  font-size: 12px;
  min-width: 240px;
  max-width: 360px;
  z-index: 1200;
  padding: 0;
}
.panel-info-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 10px;
  background: #2a2a30;
  border-bottom: 1px solid #444;
  border-radius: 5px 5px 0 0;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  font-size: 11px;
}
.panel-info-close {
  background: transparent;
  border: none;
  color: #ddd;
  cursor: pointer;
  font-size: 16px;
  line-height: 1;
  padding: 0 4px;
  opacity: 0.5;
}
.panel-info-close:hover { opacity: 1; color: #f66; }
.panel-info-body {
  padding: 8px 10px;
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: 6px 10px;
}
.panel-info-row {
  display: contents;
}
.panel-info-label {
  color: #888;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  white-space: nowrap;
}
.panel-info-value {
  font-family: ui-monospace, monospace;
  color: #ddd;
  word-break: break-all;
  white-space: pre-wrap;
}
.panel-title-input {
  background: rgba(0, 0, 0, 0.4);
  color: #fff;
  border: 1px solid #6cc364;
  border-radius: 3px;
  padding: 0 4px;
  font-family: inherit;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  outline: none;
  min-width: 0;
  width: 100%;
}
.panel-title .close:hover { opacity: 1; color: #f66; }

.panel-body {
  display: grid;
  grid-template-columns: auto auto auto;
  gap: 12px;
  padding: 10px;
  align-items: start;
}

.socket-col {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding-top: 4px;
}
.socket-col.outlets { align-items: flex-end; }

.socket {
  display: flex;
  align-items: center;
  gap: 6px;
}
.socket.outlet { flex-direction: row-reverse; }

.socket-dot {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 2px solid #1c1c1f;
  background: #888;
  cursor: crosshair;
  flex-shrink: 0;
}
.socket-dot.audio { background: #6cc364; }
.socket-dot.cv { background: #e09d3d; }
.socket-dot.voice { background: #6cc8c4; }
.socket-dot:hover { filter: brightness(1.3); }

.socket-label {
  font-size: 9px;
  color: #aaa;
  font-family: ui-monospace, monospace;
  letter-spacing: 0.5px;
}

.controls {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 0 4px;
  min-width: 70px;
  align-items: center;
}

.panel.panel-Mixer .controls {
  display: grid;
  grid-template-columns: auto auto;
  gap: 10px 12px;
  align-items: start;
  justify-items: center;
}
.panel.panel-Mixer .controls:not(.controls-advanced) > :last-child {
  grid-column: 1 / -1;
}

.controls-wrap {
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: stretch;
}
.controls-advanced {
  border-top: 1px solid #444;
  padding-top: 8px;
}
.panel:not(.expanded) .controls-advanced {
  display: none;
}

.panel.panel-FMSynth .controls {
  display: grid;
  grid-template-columns: auto auto auto;
  gap: 8px 10px;
  align-items: start;
  justify-items: center;
}

.panel.panel-PitchSampler .controls,
.panel.panel-ChromaticSampler .controls {
  display: grid;
  grid-template-columns: auto auto auto;
  gap: 8px 10px;
  align-items: start;
  justify-items: center;
}
.panel.panel-PitchSampler .controls > :first-child,
.panel.panel-ChromaticSampler .controls > :first-child {
  grid-column: 1 / -1;
}

.scope-wrap {
  display: flex;
  justify-content: center;
  padding: 4px 0;
}
.scope-canvas {
  background: #0c0c10;
  border: 1px solid #2a2a30;
  border-radius: 3px;
  display: block;
}

.vu-wrap {
  display: flex;
  justify-content: center;
  padding: 4px 0;
}
.vu-canvas {
  background: #0c0c10;
  border: 1px solid #2a2a30;
  border-radius: 3px;
  display: block;
}

.eq-curve-wrap {
  display: flex;
  justify-content: center;
  padding: 4px 0;
}
.eq-curve-canvas {
  background: #0c0c10;
  border: 1px solid #2a2a30;
  border-radius: 3px;
  display: block;
}

.panel.panel-EQ .controls {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px 8px;
  justify-items: center;
  /* Same as the Oscilloscope: keep the column wide enough for the 240px curve
     canvas so it doesn't overflow onto the I/O sockets. */
  min-width: 252px;
}
.panel.panel-EQ .eq-curve-wrap {
  grid-column: 1 / -1;
}

.panel.panel-Oscilloscope .controls {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 8px 12px;
  align-items: start;
  justify-items: center;
  /* Keep the column at least as wide as the 220px canvas so it doesn't overflow
     (the 1fr knob tracks alone are narrower) and cover the I/O sockets. */
  min-width: 232px;
}
.panel.panel-Oscilloscope .controls > :first-child {
  grid-column: 1 / -1;
}

.pad-grid {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 280px;
}
.pad-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 4px;
}
.pad-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 6px 4px;
  background: #1c1c1f;
  border: 1px solid #444;
  border-radius: 4px;
  color: #ddd;
  cursor: pointer;
  font-family: inherit;
  font-size: 10px;
  transition: border-color 0.12s, background 0.12s;
  min-height: 40px;
}
.pad-btn:hover { border-color: #777; background: #2a2a30; }
.pad-btn.active {
  border-color: #6cc364;
  background: #1f2a1f;
}
.pad-btn.has-sample .pad-num { color: #6cc364; }
.pad-num {
  font-weight: 700;
  font-family: ui-monospace, monospace;
  font-size: 11px;
}
.pad-name {
  font-size: 9px;
  color: #888;
  max-width: 60px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.pad-controls {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding-top: 6px;
  border-top: 1px solid #444;
}
.pad-controls-header {
  font-size: 11px;
  color: #aaa;
  font-family: ui-monospace, monospace;
  text-align: center;
}
.pad-knobs {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  justify-items: center;
}

.pad-picker-buttons {
  display: flex;
  gap: 4px;
}
.pad-picker-buttons .sample-load {
  flex: 1;
}
.pad-picker-buttons .pad-preview {
  flex: 0 0 auto;
  padding: 3px 10px;
  color: #6cc364;
  font-weight: 700;
}
.pad-picker-buttons .pad-preview:hover {
  background: #1f2a1f;
  border-color: #6cc364;
}

.panel.panel-DrumKit .controls {
  display: flex;
  flex-direction: column;
  gap: 10px;
  align-items: stretch;
}

.sample-picker {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 4px;
  padding: 4px;
  border: 1px dashed #555;
  border-radius: 4px;
  background: #1c1c1f;
  min-width: 130px;
  transition: border-color 0.12s, background 0.12s;
}
.sample-picker.drag-over {
  border-color: #6cc364;
  background: #1f2a1f;
}
.sample-label {
  font-size: 11px;
  color: #ccc;
  font-family: ui-monospace, monospace;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  padding: 2px 4px;
}
.sample-load {
  font-size: 11px;
  padding: 3px 8px;
  background: #333;
  border: 1px solid #555;
  color: #ddd;
  border-radius: 3px;
  cursor: pointer;
}
.sample-load:hover {
  background: #444;
  border-color: #777;
}
.sample-btn-row {
  display: flex;
  gap: 4px;
}
.sample-btn-row .sample-load {
  flex: 1;
}

/* Sample editor modal */
.sample-editor-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.65);
  z-index: 9000;
  display: flex;
  align-items: center;
  justify-content: center;
}
.sample-editor-modal {
  background: #1c1c20;
  color: #ddd;
  border: 1px solid #444;
  border-radius: 6px;
  padding: 16px;
  min-width: 920px;
  max-width: 95vw;
  max-height: 92vh;
  display: flex;
  flex-direction: column;
  gap: 12px;
  box-shadow: 0 12px 48px rgba(0, 0, 0, 0.6);
}
.sample-editor-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.sample-editor-header h2 {
  margin: 0;
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.5px;
  cursor: text;
}
.sample-editor-title-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
}
.sample-editor-icon-btn {
  background: transparent;
  border: 1px solid #444;
  border-radius: 3px;
  color: #aaa;
  width: 22px;
  height: 22px;
  padding: 0;
  font-size: 12px;
  cursor: pointer;
  line-height: 1;
}
.sample-editor-icon-btn:hover {
  background: #2a2a30;
  color: #fff;
}
.sample-editor-title-input {
  background: #0c0c10;
  color: #fff;
  border: 1px solid #6cc364;
  border-radius: 3px;
  padding: 2px 6px;
  font-family: inherit;
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.5px;
  min-width: 280px;
  outline: none;
}
.sample-editor-close {
  background: transparent;
  border: none;
  color: #aaa;
  font-size: 20px;
  cursor: pointer;
  padding: 0 6px;
}
.sample-editor-close:hover { color: #fff; }

.sample-editor-canvas-wrap {
  background: #0c0c10;
  border: 1px solid #2a2a30;
  border-radius: 4px;
  padding: 0;
}
.sample-editor-canvas {
  display: block;
  width: 100%;
  height: 240px;
  cursor: crosshair;
}

.sample-editor-slice-list {
  font-size: 12px;
  color: #999;
  min-height: 18px;
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: baseline;
}
.sample-editor-hint {
  font-style: italic;
}
.sample-editor-view-info {
  font-family: ui-monospace, monospace;
  color: #777;
  font-size: 11px;
}
.sample-editor-zoom-hint {
  font-style: italic;
  text-transform: none;
  letter-spacing: 0;
  color: #777;
  margin-left: 4px;
}

.sample-editor-toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  padding-top: 4px;
  border-top: 1px solid #2a2a2a;
}
.sample-editor-label {
  font-size: 11px;
  color: #aaa;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.sample-editor-fill-group {
  display: inline-flex;
  gap: 4px;
}
.sample-editor-mini {
  background: #3a3a44;
  color: #ddd;
  border: 1px solid #555;
  border-radius: 3px;
  padding: 4px 10px;
  font-family: ui-monospace, monospace;
  font-size: 11px;
  cursor: pointer;
}
.sample-editor-mini:hover { background: #4a4a55; }

.sample-editor-btn {
  background: #2a3a2a;
  color: #cce0cc;
  border: 1px solid #4a5a4a;
  border-radius: 3px;
  padding: 5px 12px;
  font-family: ui-monospace, monospace;
  font-size: 11px;
  cursor: pointer;
}
.sample-editor-btn:hover { background: #3a4a3a; }
.sample-editor-btn.primary {
  background: #6cc364;
  border-color: #8ad683;
  color: #0c0c10;
  font-weight: 700;
}
.sample-editor-btn.primary:hover { background: #8ad683; }

.sample-editor-sep {
  width: 1px;
  height: 18px;
  background: #444;
  margin: 0 4px;
}

.sample-editor-footer {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  border-top: 1px solid #2a2a2a;
  padding-top: 8px;
}

/* Sample browser */
.sample-browser-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.65);
  z-index: 9000;
  display: flex;
  align-items: center;
  justify-content: center;
}
.sample-browser-modal {
  background: #1c1c20;
  color: #ddd;
  border: 1px solid #444;
  border-radius: 6px;
  padding: 14px;
  min-width: 480px;
  max-width: 80vw;
  max-height: 80vh;
  display: flex;
  flex-direction: column;
  gap: 10px;
  box-shadow: 0 12px 48px rgba(0, 0, 0, 0.6);
}
.sample-browser-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.sample-browser-header h2 {
  margin: 0;
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.5px;
}
.sample-browser-close {
  background: transparent;
  border: none;
  color: #aaa;
  font-size: 20px;
  cursor: pointer;
  padding: 0 6px;
}
.sample-browser-close:hover { color: #fff; }
.sample-browser-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
  overflow-y: auto;
  max-height: 60vh;
  border: 1px solid #2a2a2a;
  border-radius: 4px;
  padding: 4px;
  background: #0c0c10;
}
.sample-browser-empty {
  color: #777;
  font-style: italic;
  padding: 12px;
  text-align: center;
}
.sample-browser-row {
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 8px;
  align-items: center;
  padding: 5px 8px;
  border-radius: 3px;
  background: #1c1c20;
}
.sample-browser-row.current {
  background: #1f2a1f;
  border-left: 3px solid #6cc364;
  padding-left: 5px;
}
.sample-browser-name {
  font-family: ui-monospace, monospace;
  font-size: 12px;
  color: #ddd;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.sample-browser-btn {
  background: #2a3a2a;
  color: #cce0cc;
  border: 1px solid #4a5a4a;
  border-radius: 3px;
  padding: 4px 10px;
  font-family: ui-monospace, monospace;
  font-size: 11px;
  cursor: pointer;
}
.sample-browser-btn:hover { background: #3a4a3a; }
.sample-browser-btn:disabled {
  opacity: 0.5;
  cursor: default;
}
.sample-browser-btn.primary {
  background: #6cc364;
  border-color: #8ad683;
  color: #0c0c10;
  font-weight: 700;
}
.sample-browser-btn.primary:hover { background: #8ad683; }
.sample-browser-btn.primary:disabled { background: #4a5a4a; color: #cce0cc; }
.sample-browser-btn.danger {
  background: transparent;
  color: #c25a4a;
  border-color: #4a2a2a;
  width: 24px;
  padding: 4px 0;
  text-align: center;
}
.sample-browser-btn.danger:hover {
  background: #c25a4a;
  color: #fff;
  border-color: #c25a4a;
}

.algorithm-picker {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 4px;
  padding: 2px 0;
  justify-content: center;
}
.algo-item {
  cursor: pointer;
  border: 2px solid #555;
  border-radius: 4px;
  padding: 2px;
  background: #1c1c1f;
  transition: border-color 0.12s, background 0.12s;
  display: flex;
  align-items: center;
  justify-content: center;
}
.algo-item:hover {
  border-color: #888;
  background: #2a2a30;
}
.algo-item.selected {
  border-color: #6cc364;
  background: #1f2a1f;
}
.algo-svg {
  display: block;
  width: 56px;
  height: 52px;
}
.algo-op {
  fill: #2a2a30;
  stroke: #888;
  stroke-width: 0.6;
}
.algo-op.carrier {
  fill: #3a7a76;
  stroke: #6cc8c4;
}
.algo-op-label {
  fill: #ddd;
  font-size: 7px;
  font-family: ui-monospace, monospace;
  font-weight: 700;
  pointer-events: none;
  user-select: none;
}
.algo-arrow {
  stroke: #888;
  stroke-width: 0.7;
  fill: none;
}
.algo-out {
  stroke: #6cc8c4;
  stroke-width: 1.4;
}
.panel.panel-FMSynth .controls:not(.controls-advanced) > :first-child {
  grid-column: 1 / -1;
}
.panel.panel-FMSynth .controls-advanced {
  display: grid;
  grid-template-columns: repeat(6, auto);
  gap: 6px 8px;
  align-items: start;
  justify-items: center;
}
.panel:not(.expanded).panel-FMSynth .controls-advanced {
  display: none;
}

.knob {
  display: flex;
  flex-direction: column;
  align-items: center;
  font-size: 9px;
  color: #aaa;
}
.knob-svg { cursor: ns-resize; }
.knob-label {
  font-family: ui-monospace, monospace;
  letter-spacing: 0.5px;
  margin-top: 2px;
}
.knob-value {
  font-family: ui-monospace, monospace;
  font-size: 10px;
  color: #ccc;
  cursor: text;
}

.knob-value-input {
  width: 56px;
  background: #1c1c1f;
  color: #fff;
  border: 1px solid #6cc364;
  border-radius: 3px;
  padding: 0 4px;
  margin-top: 2px;
  font-family: ui-monospace, monospace;
  font-size: 10px;
  text-align: center;
  outline: none;
}

.enum {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  font-size: 9px;
  color: #aaa;
}
.enum-label {
  font-family: ui-monospace, monospace;
  letter-spacing: 0.5px;
}
.enum select {
  background: #1c1c1f;
  color: #ddd;
  border: 1px solid #555;
  padding: 2px 4px;
  border-radius: 3px;
  font-family: ui-monospace, monospace;
  font-size: 11px;
}

.gate {
  display: flex;
  justify-content: center;
}
.gate-btn {
  background: #3a3a44;
  color: #ddd;
  border: 2px solid #666;
  border-radius: 4px;
  padding: 4px 14px;
  font-family: ui-monospace, monospace;
  font-size: 11px;
  letter-spacing: 1px;
  cursor: pointer;
  user-select: none;
}
.gate-btn:hover { background: #4a4a55; }
.gate-btn.active {
  background: #e09d3d;
  color: #1c1c1f;
  border-color: #f0b860;
  box-shadow: 0 0 8px rgba(224, 157, 61, 0.6);
}
