/* ---- Backing Tracks ---- */
/* Override tool-page max-width so inner 960px containers control width */
.tool-page:has(.bt-mixer) { max-width: 100%; }

/* Track name input */
.bt-name-input {
  display: block; max-width: 400px; margin: -8px auto 16px; width: 100%;
  background: transparent; border: none; border-bottom: 1px solid #2a2d3e;
  padding: 8px 4px; color: #fff; font-size: 1.1rem; font-weight: 700; font-family: inherit;
  outline: none; transition: border-color 0.15s; text-align: center;
}
.bt-name-input:focus { border-bottom-color: var(--spot); }
.bt-name-input::placeholder { color: #444; font-weight: 400; }

/* Row 1: Toolbar */
.bt-toolbar-row { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; align-items: center; margin-bottom: 1.5rem; max-width: 960px; width: 100%; }
.bt-select-wrap { position: relative; }
.bt-select { padding: 8px 32px 8px 12px; border: 1.5px solid #2a2d3a; border-radius: 10px; background: #1a1d27; color: #ccc; font-size: 0.8rem; font-weight: 600; appearance: none; -webkit-appearance: none; cursor: pointer; transition: border-color 0.15s; background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 12 12' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M2 4l4 4 4-4' fill='none' stroke='%23888' stroke-width='1.5' stroke-linecap='round'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 10px center; background-size: 12px; }
.bt-select:focus { border-color: #3a3d4a; outline: none; }
/* Dice button uses shared .lib-dice-btn from base.css */
/* Transport toolbar (matches jazz standards layout) */
.bt-toolbar-transport { display: flex; align-items: center; justify-content: center; margin-top: 4px; }
.bt-toolbar-left, .bt-toolbar-right { flex: 1; display: flex; align-items: center; gap: 6px; }
.bt-toolbar-left { justify-content: flex-end; padding-right: 28px; }
.bt-toolbar-right { justify-content: flex-start; padding-left: 28px; }
.bt-toolbar-center { display: flex; gap: 8px; align-items: center; flex-shrink: 0; }
/* BPM */
.bt-bpm-val { font-size: 0.6rem; font-weight: 700; color: #444; letter-spacing: 0.1em; }
.bt-bpm-unit { font-size: 0.6rem; font-weight: 700; color: #444; letter-spacing: 0.1em; text-transform: uppercase; margin-right: 4px; }
.bt-bpm-adj { width: 30px; height: 30px; border-radius: 50%; border: 1.5px solid #2a2d3a; background: transparent; color: #666; font-size: 0.75rem; font-weight: 700; cursor: pointer; display: flex; align-items: center; justify-content: center; transition: background 0.12s, border-color 0.12s, color 0.12s; flex-shrink: 0; }
.bt-bpm-adj:hover { border-color: #555; color: #fff; background: rgba(255,255,255,0.05); }
.bt-bpm-adj:active { border-color: #555; color: #fff; }
.bt-bpm-slider { -webkit-appearance: none; appearance: none; flex: 1; min-width: 60px; max-width: 110px; height: 3px; border-radius: 10px; background: #2a2d3a; outline: none; cursor: pointer; }
.bt-bpm-slider::-webkit-slider-thumb { -webkit-appearance: none; appearance: none; width: 14px; height: 14px; border-radius: 50%; background: #2a6cb0; cursor: pointer; border: 2px solid #4a8cd0; }
.bt-bpm-slider::-moz-range-thumb { width: 14px; height: 14px; border-radius: 50%; background: #2a6cb0; cursor: pointer; border: 2px solid #4a8cd0; }
/* Transpose */
.bt-transpose-group { display: flex; align-items: center; gap: 4px; }
.bt-transpose-label { font-size: 0.6rem; font-weight: 600; color: #444; text-transform: uppercase; letter-spacing: 0.1em; margin-right: 4px; }
.bt-trans-btn { background: #1a1d27; color: #ccc; border: 1.5px solid #2a2d3a; border-radius: 10px; width: 32px; height: 32px; font-size: 1.1rem; cursor: pointer; font-weight: 700; display: flex; align-items: center; justify-content: center; font-family: inherit; transition: all 0.15s; }
.bt-trans-btn:hover { background: #252836; border-color: #555; color: #fff; }
.bt-trans-val { font-size: 0.85rem; font-weight: 700; color: #e0e0e0; min-width: 28px; text-align: center; }

/* Panel header (shared by Chords and Mixer) */
.bt-panel-header { font-size: 0.78rem; font-weight: 700; color: #888; text-transform: uppercase; letter-spacing: 0.08em; margin-bottom: 4px; text-align: center; }
.bt-panel-header.bt-chords-header { margin-top: 4px; margin-bottom: 0; }
.bt-panel-header + .bt-channels { margin-top: -4px; }
.bt-panel-header.bt-mixer-header { margin-top: 6px; text-align: left; }
.bt-panel { max-width: 960px; width: 100%; margin-bottom: 1rem; padding: 12px; border: 1.5px solid #2a2d3a; border-radius: 10px; background: radial-gradient(circle at 50% 40%, #1a1d27, #12141c); }

/* Chord Arrangement — uses shared .kf-diatonic-btn and .kf-chord-chip from key-finder.css */
.bt-arr-palette { display: flex; gap: 4px; flex-wrap: wrap; justify-content: center; margin-bottom: 0.6rem; }
.bt-arr-palette .kf-diatonic-btn { width: 58px; height: 66px; padding: 6px 2px; display: inline-flex; flex-direction: column; align-items: center; justify-content: space-between; gap: 0; font-size: inherit; line-height: 1; box-sizing: border-box; overflow: hidden; }
.bt-arr-palette .kf-chip-degree { font-size: 0.62rem; font-weight: 600; opacity: 0.7; letter-spacing: 0.03em; }
.bt-arr-palette .kf-chip-name { font-size: 0.92rem; font-weight: 700; opacity: 1; line-height: 1; white-space: nowrap; }
.bt-arr-palette .kf-chip-function { font-size: 0.52rem; font-weight: 400; opacity: 0.6; font-style: normal; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
/* Inline + button for adding custom chords */
.bt-add-chord-btn { padding: 2px 4px; border-radius: 10px; border: none; background: transparent; color: #555; font-size: 1.1rem; font-weight: 400; cursor: pointer; transition: all 0.15s; display: flex; align-items: center; justify-content: center; align-self: stretch; }
.bt-add-chord-btn:hover { color: #ccc; }
/* Custom chord popup */
.bt-custom-popup { display: flex; gap: 6px; align-items: center; justify-content: center; margin-top: -2px; margin-bottom: 8px; flex-wrap: wrap; }
.bt-popup-select { padding: 8px 28px 8px 10px; font-size: 0.78rem; }
.bt-popup-add { padding: 8px 16px; border: 1.5px solid #2a2d3a; border-radius: 10px; background: #1a1d27; color: #ccc; font-size: 0.78rem; font-weight: 600; cursor: pointer; transition: all 0.15s; font-family: inherit; }
.bt-popup-add:hover { background: #252836; border-color: #555; color: #fff; }
/* Arrangement box wrapping slots + clear */
.bt-arr-box { width: 100%; }
/* Slots container — vertical stack of bar rows */
.bt-arr-slots { display: flex; gap: 12px; min-height: 48px; width: 100%; }
.bt-arr-slots.drag-over { border-color: #2a6cb0; background: rgba(42,108,176,0.05); }
/* Individual slot cell */
.bt-arr-slot { flex: 1; min-height: 110px; min-width: 0; display: flex; align-items: center; justify-content: center; position: relative; transition: background 0.15s; cursor: pointer; padding: 0; margin: 0; box-sizing: border-box; }
.bt-arr-slot.bt-slot-empty::after { content: ''; position: absolute; inset: 0; border: 1.5px dashed #2a2d3a; border-radius: 10px; pointer-events: none; }
.bt-arr-slot.bt-slot-empty:hover::after { border-color: #444; border-style: dashed; }
.bt-arr-slot.bt-slot-filled::after { content: ''; position: absolute; inset: 0; border: 1.5px solid #2a2d3a; border-radius: 10px; pointer-events: none; background: #1a1d27; z-index: 0; }
.bt-arr-slot.bt-slot-filled .kf-chord-chip { width: 100%; height: 100%; margin: 0; border-radius: 0; border: none; min-width: 0; background: transparent !important; box-sizing: border-box; z-index: 1; display: flex; align-items: center; justify-content: center; position: relative; }
.bt-arr-slot.bt-slot-filled .kf-chip-degree { font-size: 0.7rem; font-weight: 600; color: #666; position: absolute; top: 22px; left: 0; right: 0; text-align: center; }
.bt-arr-slot.bt-slot-filled .kf-chip-name { font-size: 1.8rem; font-weight: 800; color: #fff !important; opacity: 1 !important; white-space: nowrap; text-align: center; }
.bt-arr-slot-group .bt-arr-slot.bt-slot-filled .kf-chip-name { font-size: 0.9rem; font-weight: 700; }
.bt-arr-slot-group .bt-arr-slot.bt-slot-filled .kf-chip-degree { font-size: 0.55rem; top: 22px; }
/* Remove button — below chord, always visible */
.bt-slot-remove-btn { position: absolute; top: 12px; right: 14px; font-size: 0.75rem; padding: 0; z-index: 5; background: none; border: none; color: #444; cursor: pointer; transition: color 0.15s; line-height: 1; font-family: inherit; }
.bt-slot-remove-btn:hover { color: #e05050; }
.bt-arr-slot.bt-slot-filled .kf-chord-chip.q-major,
.bt-arr-slot.bt-slot-filled .kf-chord-chip.q-minor,
.bt-arr-slot.bt-slot-filled .kf-chord-chip.q-dim,
.bt-arr-slot.bt-slot-filled .kf-chord-chip.q-aug { background: transparent; }
.bt-arr-slot.bt-slot-playing { background: transparent; }
.bt-arr-slot.bt-slot-playing::after { border-color: #4a8cd0 !important; background: rgba(42,108,176,0.15); }
.bt-arr-slot.drag-over-slot { background: rgba(42,108,176,0.15); }
.bt-arr-slot.drag-over-slot.bt-slot-empty::after { border-color: #4a8cd0; border-style: dashed; }
/* Split indicator on empty slots */
.bt-slot-split-hint { position: absolute; bottom: 12px; font-size: 0.5rem; color: #555; pointer-events: none; opacity: 0; transition: opacity 0.15s; }
.bt-arr-slot.bt-slot-empty:hover .bt-slot-split-hint { opacity: 1; }
/* Sub-slots (when a slot is split into halves or quarters) */
.bt-arr-slot-group { flex: 1; display: flex; min-height: 110px; min-width: 0; align-items: stretch; }
.bt-arr-slot-group:last-child { border-right: none; }
.bt-arr-slot-group .bt-arr-slot { min-height: 110px; }
.bt-merge-btn {
  width: 20px; min-width: 20px; flex-shrink: 0;
  border: none; background: transparent; color: #444;
  font-size: 0.75rem; font-weight: 700; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  padding: 0; z-index: 3;
  transition: color 0.15s;
}
.bt-merge-btn:hover { color: #ccc; }
.bt-arr-slot-group .bt-arr-slot:last-child { }
.bt-arr-placeholder { color: #444; font-size: 0.72rem; text-align: center; padding: 10px; user-select: none; width: 100%; }

/* Bar row — one horizontal row per bar */
.bt-bar-row { display: flex; gap: 12px; position: relative; width: 100%; }
.bt-bar-row + .bt-bar-row { border-top: 2px solid #2a2d3a; }
/* Remove section button */
.bt-remove-section-btn { position: absolute; right: 4px; top: 4px; background: none; border: none; color: #444; font-size: 0.6rem; cursor: pointer; z-index: 5; padding: 2px; font-family: inherit; transition: color 0.15s; }
.bt-remove-section-btn:hover { color: #e05050; }
/* Add section button — just a + */
.bt-add-section-btn { width: 100%; border: none; border-top: 1px dashed #2a2d3a; background: transparent; color: #444; font-size: 1rem; cursor: pointer; transition: all 0.15s; padding: 6px 0; font-family: inherit; }
.bt-add-section-btn:hover { color: #ccc; background: rgba(255,255,255,0.03); }

/* Instrument Mixer */
.bt-mixer { display: flex; flex-direction: column; gap: 12px; max-width: 960px; width: 100%; margin-bottom: 1rem; padding: 12px; border: 1.5px solid #2a2d3a; border-radius: 10px; background: radial-gradient(circle at 50% 40%, #1a1d27, #12141c); }
.bt-channels { display: flex; gap: 12px; flex-wrap: wrap; }
.bt-channel { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 12px 10px; border: 1.5px solid #2a2d3a; border-radius: 10px; background: #1a1d27; min-width: 0; flex: 1; }
.bt-ch-label { font-size: 0.72rem; font-weight: 700; color: #fff; text-transform: uppercase; letter-spacing: 0.08em; margin-bottom: 2px; }
.bt-channel .bt-select-wrap { width: 100%; }
.bt-channel .bt-select { width: 100%; font-size: 0.7rem; padding: 5px 22px 5px 6px; box-sizing: border-box; }
/* Console fader */
/* Pan knob */
.bt-pan-wrap { display: flex; align-items: center; justify-content: center; gap: 2px; margin: 4px auto 2px; }
.bt-pan-lr { font-size: 0.4rem; color: #444; font-weight: 700; user-select: none; }
.bt-pan-knob { width: 22px; height: 22px; border-radius: 50%; background: radial-gradient(circle at 45% 35%, #3a3d4a, #1a1d27 70%); border: 1.5px solid #3a3d4a; cursor: pointer; position: relative; box-shadow: inset 0 1px 2px rgba(0,0,0,0.3), 0 1px 0 rgba(255,255,255,0.04); }
.bt-pan-knob:hover { border-color: #555; }
.bt-pan-indicator { position: absolute; top: 3px; left: 50%; width: 2px; height: 7px; background: #7cb8ff; border-radius: 1px; transform-origin: 50% 125%; margin-left: -1px; pointer-events: none; }

.bt-fader-wrap {
  position: relative; width: 36px; height: 110px; margin: 2px auto 0;
  display: flex; align-items: center; justify-content: center;
}
/* Center rail */
.bt-fader-wrap::before {
  content: ''; position: absolute; left: 50%; top: 4px; bottom: 4px;
  width: 4px; transform: translateX(-50%); border-radius: 10px;
  background: #2a2d3a; z-index: 0;
}
/* Tick marks */
.bt-fader-wrap::after {
  content: ''; position: absolute; left: 50%; top: 4px; bottom: 4px;
  width: 20px; transform: translateX(-50%);
  background: repeating-linear-gradient(to bottom, transparent 0px, transparent 9px, #333 9px, #333 10px);
  pointer-events: none; z-index: 0;
}
.bt-vol-slider {
  -webkit-appearance: none; appearance: none;
  writing-mode: vertical-lr; direction: rtl;
  width: 36px; height: 110px; background: transparent;
  cursor: pointer; position: relative; z-index: 3; margin: 0; display: block;
}
.bt-vol-slider::-webkit-slider-runnable-track {
  width: 4px; height: 100%; background: transparent; border-radius: 10px;
  margin: 0 auto;
}
.bt-vol-slider::-webkit-slider-thumb {
  -webkit-appearance: none; appearance: none;
  width: 28px; height: 16px; margin-left: -12px;
  background: linear-gradient(to bottom, #888 0%, #666 15%, #555 40%, #666 50%, #555 60%, #666 85%, #888 100%);
  border: 1px solid #999; border-radius: 10px; cursor: grab;
  box-shadow: 0 1px 6px rgba(0,0,0,0.6), inset 0 1px 0 rgba(255,255,255,0.25), inset 0 -1px 0 rgba(0,0,0,0.25);
}
.bt-vol-slider::-moz-range-track {
  width: 4px; background: transparent; border-radius: 10px;
}
.bt-vol-slider::-moz-range-thumb {
  width: 28px; height: 16px;
  background: linear-gradient(to bottom, #888 0%, #666 15%, #555 40%, #666 50%, #555 60%, #666 85%, #888 100%);
  border: 1px solid #999; border-radius: 10px; cursor: grab;
  box-shadow: 0 1px 6px rgba(0,0,0,0.6), inset 0 1px 0 rgba(255,255,255,0.25), inset 0 -1px 0 rgba(0,0,0,0.25);
}
.bt-vol-val { font-size: 0.68rem; color: #888; font-weight: 600; margin-top: -2px; margin-bottom: 4px; }
.bt-channel { position: relative; }
.bt-ch-btns { display: flex; gap: 4px; }
.bt-mute-btn, .bt-solo-btn { width: 28px; height: 22px; border-radius: 10px; border: 1.5px solid #2a2d3a; background: #1a1d27; color: #666; font-size: 0.6rem; font-weight: 700; cursor: pointer; transition: all 0.15s; }
.bt-mute-btn:hover { border-color: #a03030; color: #ccc; }
.bt-mute-btn.active { background: #5a2020; border-color: #a03030; color: #ff8a8a; }
.bt-solo-btn:hover { border-color: #a0a030; color: #ccc; }
.bt-solo-btn.active { background: #4a4a10; border-color: #c0c030; color: #ffff60; }

/* Transport */
.bt-transport-btn { background: #1a1d27; color: #888; border: 1.5px solid #2a2d3a; border-radius: 50%; width: 36px; height: 36px; cursor: pointer; display: flex; align-items: center; justify-content: center; transition: all 0.15s; flex-shrink: 0; }
.bt-transport-btn:hover { background: #222640; border-color: #555; color: #ccc; }
.bt-transport-btn svg { width: 16px; height: 16px; fill: currentColor; }
.bt-transport-btn.bt-play-btn { background: #2a6cb0; color: #fff; border: 2px solid #4a8cd0; width: 44px; height: 44px; }
.bt-transport-btn.bt-play-btn:hover { background: #3580cc; }
.bt-transport-btn.bt-play-btn:active { transform: scale(0.93); }
.bt-transport-btn.bt-play-btn svg { fill: #fff; }
.bt-transport-btn.bt-play-btn.playing { background: #c04040; border-color: #e06060; }
.bt-vol-btn svg { width: 16px; height: 16px; }

/* Actions Row */
.bt-fx-btn { width: 28px; height: 22px; border-radius: 10px; border: 1.5px solid #2a2d3a; background: #1a1d27; color: #666; font-size: 0.6rem; font-weight: 700; cursor: pointer; transition: all 0.15s; font-family: inherit; }
.bt-fx-btn:hover { border-color: #555; color: #ccc; }
.bt-fx-btn.active { background: #1a2a3c; border-color: #2a6cb0; color: #7cb8ff; }
.bt-ch-remove { position: absolute; top: 6px; right: 6px; background: none; border: none; color: #444; font-size: 0.85rem; cursor: pointer; padding: 0; transition: color 0.15s; z-index: 5; line-height: 1; }
.bt-ch-remove:hover { color: #e05050; }
.bt-fx-panel { width: 100%; padding: 6px 0; }
.bt-fx-panel .bt-fx-item { display: flex; flex-direction: column; align-items: center; padding: 6px; border-radius: 10px; background: #13151f; margin-bottom: 4px; position: relative; }
.bt-fx-panel .bt-fx-item.bt-fx-dragging { opacity: 0.4; }
.bt-fx-panel .bt-fx-item.bt-fx-dragover { outline: 1px dashed #2a6cb0; }
.bt-fx-panel .bt-fx-header { display: flex; align-items: center; justify-content: center; width: 100%; margin-bottom: 4px; position: relative; }
.bt-fx-panel .bt-fx-drag { cursor: grab; color: #3a3d4a; font-size: 0.9rem; line-height: 1; user-select: none; position: absolute; left: 0; }
.bt-fx-panel .bt-fx-drag:hover { color: #888; }
.bt-fx-panel .bt-fx-name { font-size: 0.5rem; font-weight: 700; color: #7cb8ff; text-transform: uppercase; }
.bt-fx-panel .bt-fx-remove { position: absolute; right: 0; background: none; border: none; color: #3a3d4a; font-size: 0.65rem; cursor: pointer; }
.bt-fx-panel .bt-fx-remove:hover { color: #e05050; }
.bt-fx-panel .bt-fx-knobs { display: flex; gap: 10px; align-items: flex-start; justify-content: center; }
.bt-fx-panel .bt-fx-knob-wrap { display: flex; flex-direction: column; align-items: center; gap: 3px; cursor: pointer; width: 36px; }
.bt-fx-panel .bt-fx-knob { width: 32px; height: 32px; border-radius: 50%; background: radial-gradient(circle at 45% 35%, #3a3d4a, #1a1d27 70%); border: 1.5px solid #3a3d4a; position: relative; box-shadow: inset 0 1px 2px rgba(0,0,0,0.3), 0 1px 0 rgba(255,255,255,0.04); }
.bt-fx-panel .bt-fx-knob:hover { border-color: #555; }
.bt-fx-panel .bt-fx-knob-indicator { position: absolute; top: 4px; left: 50%; width: 2px; height: 10px; background: #7cb8ff; border-radius: 1px; transform-origin: 50% 125%; margin-left: -1px; pointer-events: none; }
.bt-fx-panel .bt-fx-knob-label { font-size: 0.48rem; color: #555; text-transform: uppercase; letter-spacing: 0.03em; white-space: nowrap; text-align: center; }
.bt-fx-panel .bt-fx-add-row { display: flex; gap: 3px; flex-wrap: wrap; justify-content: center; }
.bt-fx-panel .bt-fx-add-btn { padding: 2px 6px; border-radius: 10px; border: 1px dashed #2a2d3a; background: transparent; color: #555; font-size: 0.45rem; cursor: pointer; transition: all 0.15s; font-family: inherit; }
.bt-fx-panel .bt-fx-add-btn:hover { border-color: #2a6cb0; color: #7cb8ff; }
/* Empty channel slot (instrument picker) */
.bt-channel.bt-ch-empty { display: flex; align-items: center; justify-content: center; border: 2px dashed #2a2d3a; background: transparent; min-height: 200px; cursor: pointer; }
.bt-channel.bt-ch-empty:hover { border-color: #3a3d4a; }
.bt-ch-add-select { padding: 8px 12px; border: 1.5px solid #2a2d3a; border-radius: 10px; background: #1a1d27; color: #ccc; font-size: 0.72rem; font-weight: 600; cursor: pointer; font-family: inherit; appearance: none; -webkit-appearance: none; background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 12 12' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M2 4l4 4 4-4' fill='none' stroke='%23888' stroke-width='1.5' stroke-linecap='round'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 8px center; background-size: 10px; padding-right: 26px; }

.bt-actions-row { display: flex; gap: 8px; justify-content: center; margin-bottom: 1rem; flex-wrap: wrap; max-width: 960px; width: 100%; }
.bt-action-btn { padding: 8px 16px; border-radius: 10px; border: 1.5px solid #2a2d3a; background: #1a1d27; color: #ccc; font-size: 0.78rem; font-weight: 600; cursor: pointer; transition: all 0.15s; font-family: inherit; }
.bt-action-btn:hover { border-color: #555; color: #fff; background: #252836; }
.bt-action-looper { border-color: #2a6cb0; color: #7cb8ff; background: #1a2a3c; }
.bt-action-looper:hover { background: #223a50; border-color: #4a8cd0; }

/* ---- Responsive ---- */
@media (max-width: 600px) {
  .bt-toolbar-row { gap: 4px; margin-top: -3px; margin-bottom: 21px; min-height: 40px; flex-wrap: nowrap; }
  .bt-select { font-size: 0.75rem; padding: 6px 26px 6px 8px; }
  /* Mixer: horizontal scroll with wider strips */
  .bt-mixer { gap: 8px; padding: 10px 8px; overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .bt-channels { gap: 8px; flex-wrap: nowrap; overflow-x: auto; -webkit-overflow-scrolling: touch; padding-bottom: 4px; }
  .bt-channel { min-width: 110px; flex: 0 0 110px; padding: 8px 6px; }
  .bt-ch-label { font-size: 0.62rem; }
  .bt-channel .bt-select { font-size: 0.62rem; padding: 4px 16px 4px 4px; }
  .bt-fader-wrap { height: 80px; }
  .bt-vol-slider { height: 80px; }
  .bt-arrangement { padding: 10px; }
  .bt-arr-slot { min-height: 70px; }
  /* Horizontal scroll for time sigs with many beats per bar */
  .bt-arr-box { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .bt-bar-row { flex-wrap: nowrap; gap: 6px; }
  .bt-arr-slot { min-width: calc((100% - 18px) / 4); flex: 0 0 auto; }
  .bt-arr-slot-group { min-width: calc((100% - 18px) / 4); flex: 0 0 auto; }
  .bt-arr-slot-group .bt-arr-slot { min-width: 0; flex: 1; }
  /* Scale degrees in arrangement slots */
  .bt-arr-slot.bt-slot-filled .kf-chip-degree { top: 8px; font-size: 0.55rem; }
  .bt-arr-slot.bt-slot-filled .kf-chip-name { font-size: 1.2rem; }
  .bt-arr-slot-group .bt-arr-slot.bt-slot-filled .kf-chip-degree { top: 6px; font-size: 0.45rem; }
  .bt-arr-slot-group .bt-arr-slot.bt-slot-filled .kf-chip-name { font-size: 0.75rem; }
  /* Diatonic chord pills: fit 7 on one line */
  .bt-arr-palette { gap: 3px; flex-wrap: nowrap; }
  .bt-arr-palette .kf-diatonic-btn { width: auto; min-width: 0; flex: 1; padding: 4px 1px; height: 56px; }
  .bt-arr-palette .kf-chip-name { font-size: 0.78rem; }
  .bt-arr-palette .kf-chip-degree { font-size: 0.5rem; }
  .bt-arr-palette .kf-chip-function { font-size: 0.42rem; }
  .bt-add-chord-btn { padding: 2px 2px; flex: 0 0 auto; }
  /* Transport: play on top, bpm+transpose below on one line */
  .bt-toolbar-transport { flex-wrap: wrap; justify-content: center; gap: 4px; }
  .bt-toolbar-center { order: -1; width: 100%; justify-content: center; }
  .bt-toolbar-left, .bt-toolbar-right { flex: 0 1 auto; justify-content: center; padding: 0; min-width: 0; gap: 4px; }
  .bt-toolbar-left { justify-content: flex-end; padding-right: 3px; }
  .bt-toolbar-right { justify-content: flex-start; padding-left: 3px; }
  .bt-toolbar-left .bt-bpm-slider { max-width: 55px; min-width: 40px; }
  .bt-bpm-val, .bt-bpm-unit { font-size: 0.58rem; }
  .bt-toolbar-row .lib-dice-btn svg { width: 14px; height: 14px; }
  .bt-transport-btn { width: 32px; height: 32px; }
  .bt-transport-btn svg { width: 14px; height: 14px; }
  .bt-transport-btn.bt-play-btn { width: 40px; height: 40px; }
  .bt-bpm-adj { width: 26px; height: 26px; font-size: 0.7rem; }
}
@media (max-width: 400px) {
  .bt-toolbar-row .lib-dice-btn svg { width: 12px; height: 12px; }
  .bt-select { font-size: 0.75rem; padding: 6px 26px 6px 8px; }
  .bt-transport-btn { width: 28px; height: 28px; }
  .bt-transport-btn svg { width: 12px; height: 12px; }
  .bt-transport-btn.bt-play-btn { width: 36px; height: 36px; }
}
