:root {
  --bg: #050914;
  --panel: #101a2f;
  --panel2: #14223c;
  --panel3: #0b1328;
  --line: #263a61;
  --text: #e8f0ff;
  --muted: #9fb0d3;
  --good: #24c389;
  --gold: #d9a536;
  --red: #f25a76;
  --blue: #6aa7ff;
  --cyan: #55ead4;
  --shadow: rgba(0,0,0,.45);
}
* { box-sizing: border-box; }
html, body { margin: 0; width: 100%; height: 100%; overflow: hidden; background: radial-gradient(circle at 50% 0%, #122047 0%, var(--bg) 45%, #02040a 100%); color: var(--text); font-family: Inter, ui-sans-serif, system-ui, -apple-system, Segoe UI, Arial, sans-serif; }
button, input, select { font: inherit; }
button { cursor: pointer; }
.app-root { width: 100vw; height: 100vh; overflow: hidden; display: flex; justify-content: center; align-items: flex-start; }
.stage { width: 1920px; height: 1080px; transform-origin: top left; background: linear-gradient(135deg, rgba(9,15,31,.98), rgba(9,15,25,.96)); border: 1px solid #23345b; box-shadow: 0 30px 80px var(--shadow); display: grid; grid-template-rows: 90px 842px 128px; gap: 10px; padding: 12px; }
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 10px 12px; background: linear-gradient(90deg, #0e1830, #141f38); border: 1px solid var(--line); border-radius: 18px; overflow: hidden; }
.brand-block { display: flex; align-items: center; gap: 14px; min-width: 520px; }
.phase-badge { width: 68px; height: 58px; display: grid; place-items: center; border-radius: 18px; color: #061018; background: linear-gradient(135deg, #68f4df, #7eaffe); font-weight: 900; line-height: .9; letter-spacing: .05em; box-shadow: inset 0 -10px 20px rgba(0,0,0,.12); }
.phase-badge strong { font-size: 24px; }
h1 { margin: 0; font-size: 28px; letter-spacing: .01em; }
p { margin: 0; color: var(--muted); }
.transport { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 7px; max-width: 1225px; }
.btn { border: 1px solid var(--line); color: var(--text); background: #152242; padding: 8px 11px; border-radius: 12px; font-weight: 800; font-size: 13px; min-height: 36px; box-shadow: 0 8px 20px rgba(0,0,0,.22); }
.btn:hover { filter: brightness(1.12); }
.btn.primary { background: linear-gradient(180deg, #2b72ff, #1854bd); border-color: #4386ff; }
.btn.secondary { background: #172642; }
.btn.good { background: linear-gradient(180deg, #21b981, #147a5a); border-color: #36d99d; }
.btn.gold { background: linear-gradient(180deg, #e1b24a, #997016); border-color: #f4cb70; color: #11140f; }
.btn.danger { background: linear-gradient(180deg, #f25a76, #a51c37); border-color: #ff7891; }
.btn.big { font-size: 16px; padding: 12px 18px; }
.workspace { display: grid; grid-template-columns: 340px 1fr 376px; gap: 10px; min-height: 0; }
.panel { background: linear-gradient(180deg, rgba(18,30,55,.98), rgba(12,21,39,.98)); border: 1px solid var(--line); border-radius: 18px; padding: 12px; box-shadow: 0 14px 32px rgba(0,0,0,.28); min-height: 0; overflow: hidden; }
.panel-title-row { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 10px; }
h2 { margin: 0; font-size: 18px; }
h3 { margin: 0 0 6px; font-size: 14px; }
.pill, .phase-chip { color: #0b1222; background: linear-gradient(135deg, var(--cyan), #9ab8ff); border-radius: 999px; padding: 4px 9px; font-weight: 900; font-size: 11px; white-space: nowrap; }
label { display: grid; gap: 6px; color: var(--muted); font-weight: 800; font-size: 12px; margin: 9px 0; }
select, input[type="text"], input[type="range"] { width: 100%; }
select, input[type="text"] { color: var(--text); background: #0a1428; border: 1px solid var(--line); border-radius: 10px; padding: 8px 9px; min-height: 36px; }
output { color: var(--cyan); font-weight: 900; font-size: 12px; }
.split-row, .master-strip { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.mini-card { margin-top: 10px; border: 1px solid #2b426d; background: rgba(6,12,25,.46); border-radius: 14px; padding: 10px; }
.mini-card p, .mini-card li { font-size: 12px; line-height: 1.35; }
.contract-card { min-height: 90px; }
.main-panel { display: grid; grid-template-rows: 190px 170px 1fr; gap: 10px; min-height: 0; }
.arranger-panel { overflow: hidden; }
.timeline { display: flex; gap: 8px; overflow-x: auto; padding: 4px 2px 8px; scrollbar-color: #416097 #0c1327; }
.section-card { position: relative; display: grid; align-content: start; gap: 3px; min-width: 126px; height: 88px; border-radius: 16px; border: 1px solid #304971; background: linear-gradient(180deg, #172a4c, #0f1a31); color: var(--text); padding: 9px; text-align: left; overflow: hidden; }
.section-card.active { outline: 2px solid var(--cyan); background: linear-gradient(180deg, #1e3b67, #12213f); }
.section-card.playing { box-shadow: 0 0 0 3px rgba(217,165,54,.65), 0 0 28px rgba(217,165,54,.35); }
.section-card h4 { margin: 0; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.small { color: var(--muted); font-size: 11px; line-height: 1.1; }
.section-energy { position: absolute; left: 0; bottom: 0; height: 4px; width: 100%; transform-origin: left; background: linear-gradient(90deg, var(--cyan), var(--gold), var(--red)); }
.arrange-controls { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.lanes-panel { display: grid; grid-template-rows: auto 1fr; }
.arranger-lanes { display: grid; gap: 6px; overflow: auto; padding-right: 4px; }
.lane-section { display: grid; grid-template-columns: 140px 1fr; gap: 7px; align-items: center; }
.lane-label { border: 1px solid #30476e; background: #0c1730; border-radius: 12px; padding: 7px; font-size: 12px; font-weight: 900; color: var(--text); overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.lane-bars { display: grid; gap: 3px; min-width: 0; }
.lane-bar { height: 23px; border: 1px solid #263e6a; border-radius: 8px; background: #101d36; position: relative; overflow: hidden; }
.lane-bar::before { content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: var(--energy, 50%); background: linear-gradient(90deg, rgba(85,234,212,.75), rgba(217,165,54,.78)); }
.lane-bar.fill::after { content: 'F'; position: absolute; right: 6px; top: 3px; color: #08111c; background: var(--gold); border-radius: 6px; padding: 0 4px; font-weight: 900; font-size: 11px; }
.grid-panel { display: grid; grid-template-rows: auto 24px 1fr; }
.meter-strip { display: grid; gap: 4px; align-items: center; }
.meter-cell { text-align: center; color: var(--muted); font-size: 11px; font-weight: 900; }
.pattern-grid { display: grid; grid-template-columns: 88px 1fr; gap: 6px; min-height: 0; }
.track-labels, .steps { display: grid; gap: 6px; }
.track-label { height: 38px; display: flex; align-items: center; padding: 0 8px; border-radius: 10px; background: #0d1730; border: 1px solid #283c64; color: var(--muted); font-size: 12px; font-weight: 900; }
.step-row { display: grid; gap: 4px; height: 38px; }
.step-cell { border-radius: 9px; border: 1px solid #253b63; background: #0a1328; min-width: 0; }
.step-cell.bar-start { border-color: #47709f; }
.step-cell.on { background: linear-gradient(180deg, #48dfc9, #167a75); border-color: #72ffe9; box-shadow: 0 0 10px rgba(85,234,212,.3); }
.step-cell.accent { background: linear-gradient(180deg, #ffe49a, #bd8421); border-color: #ffe49a; }
.step-cell.ghost { opacity: .65; }
.step-cell.playing { outline: 2px solid var(--gold); filter: brightness(1.3); }
.inspector-panel { display: grid; grid-template-rows: auto auto minmax(150px, 1fr) 176px 1fr; gap: 8px; overflow: hidden; }
.section-ops { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.section-inspector { min-height: 0; overflow: auto; padding-right: 2px; }
.inspector-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 7px; }
.metric { border: 1px solid #2d456d; background: rgba(6,13,28,.54); border-radius: 12px; padding: 8px; min-height: 48px; }
.metric strong { display: block; color: var(--cyan); font-size: 11px; }
.metric span { display: block; font-size: 12px; color: var(--text); margin-top: 3px; overflow-wrap: anywhere; }
.memory-card { margin-top: 0; }
.memory-actions { display: flex; gap: 6px; margin: 7px 0; }
.memory-actions .btn { flex: 1; padding-left: 5px; padding-right: 5px; }
#patternLibrarySelect { height: 84px; }
.candidates-card { margin-top: 0; min-height: 0; overflow: auto; }
.candidate-list { display: grid; gap: 6px; margin-top: 8px; }
.candidate-item { display: grid; grid-template-columns: 1fr auto; gap: 6px; align-items: center; border: 1px solid #30476e; border-radius: 12px; background: #0b152a; padding: 6px; font-size: 12px; }
.footer-panel { background: linear-gradient(90deg, #0e1830, #111d36); border: 1px solid var(--line); border-radius: 18px; padding: 10px 12px; display: grid; grid-template-columns: 1.1fr .9fr 1.2fr; gap: 12px; overflow: hidden; }
.status-line, .playhead-line { color: var(--muted); font-size: 13px; align-self: center; }
.status-line strong, .playhead-line strong { color: var(--text); }
.event-log { font-size: 11px; color: var(--muted); overflow: auto; border-left: 1px solid var(--line); padding-left: 10px; }
.event-log div { margin-bottom: 4px; }
.modal-backdrop { position: fixed; inset: 0; background: rgba(0,0,0,.68); display: none; align-items: center; justify-content: center; z-index: 20; }
.modal-backdrop.active { display: flex; }
.modal-card { width: 760px; background: linear-gradient(180deg, #17243f, #0d162a); border: 1px solid #36517b; border-radius: 24px; box-shadow: 0 30px 90px rgba(0,0,0,.55); padding: 22px; }
.modal-head { display: flex; justify-content: space-between; gap: 16px; align-items: flex-start; margin-bottom: 16px; }
.modal-head h2 { font-size: 24px; margin-bottom: 6px; }
.modal-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 18px; }
@media (max-width: 1000px) {
  .stage { transform-origin: top left; }
}

/* Phase 3 deep bank additions retained in Phase 4 */
.inspector-panel { grid-template-rows: auto auto minmax(96px, .75fr) 262px 152px minmax(120px, 1fr); }
.bank-card { margin-top: 0; overflow: hidden; }
.bank-card label { margin: 5px 0; gap: 3px; }
.bank-card select { min-height: 30px; padding: 5px 7px; }
#bankVariantSelect { height: 74px; font-size: 11px; }
.bank-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; margin: 7px 0; }
.bank-actions .btn { padding-left: 5px; padding-right: 5px; }
.bank-card .small { min-height: 28px; }
.section-card .tags { color: var(--cyan); font-size: 10px; line-height: 1; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.lane-bar.bank::after { content: 'B'; position: absolute; left: 5px; top: 3px; color: #061018; background: var(--cyan); border-radius: 6px; padding: 0 4px; font-weight: 900; font-size: 11px; }
.pattern-bank-pill { display:inline-block; color:#061018; background:linear-gradient(135deg, var(--cyan), #9ab8ff); border-radius:999px; padding:2px 6px; font-size:10px; font-weight:900; margin:2px 3px 0 0; }

/* Phase 4 Song Form Wizard additions */
.composer-panel { overflow: auto; padding-right: 10px; }
.form-card { border-color: #435f91; background: linear-gradient(180deg, rgba(18,35,67,.72), rgba(8,15,30,.72)); }
.compact-title { margin-bottom: 4px; }
.form-card label { margin: 5px 0; gap: 4px; }
.form-card select, .form-card input[type="text"], .form-card textarea { min-height: 30px; padding: 6px 8px; font-size: 12px; }
textarea { width: 100%; color: var(--text); background: #0a1428; border: 1px solid var(--line); border-radius: 10px; padding: 8px 9px; resize: vertical; min-height: 54px; }
.checkbox-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 5px 8px; margin: 7px 0; }
.check-row { display: flex; align-items: center; gap: 6px; margin: 0; color: var(--muted); font-size: 11px; }
.check-row input { width: auto; accent-color: var(--cyan); }
.form-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; margin-top: 7px; }
.form-actions .btn { padding-left: 6px; padding-right: 6px; }
.form-blueprint { margin-top: 8px; border: 1px solid #2e4974; border-radius: 12px; background: rgba(3,8,18,.45); padding: 7px; max-height: 128px; overflow: auto; font-size: 11px; }
.blueprint-meta { color: var(--cyan); font-weight: 900; margin-bottom: 5px; }
.blueprint-row { display: flex; justify-content: space-between; gap: 8px; border-bottom: 1px solid rgba(85,234,212,.08); padding: 3px 0; color: var(--muted); }
.blueprint-row b { color: var(--gold); white-space: nowrap; }
.modal-card { max-height: 92vh; overflow: auto; }

/* Phase 5 Musical Rule Engine additions */
.inspector-panel { grid-template-rows: auto auto minmax(80px, .5fr) 250px 248px 142px minmax(90px, .65fr); overflow: auto; padding-right: 8px; }
.rule-card { margin-top: 0; overflow: auto; border-color: #3e6f69; background: linear-gradient(180deg, rgba(19,48,55,.74), rgba(8,17,30,.78)); }
.rule-card h3 { margin-bottom: 7px; }
.rule-card label { margin: 5px 0; gap: 4px; }
.rule-card select { min-height: 30px; padding: 5px 7px; font-size: 12px; }
.compact-checks { grid-template-columns: 1fr 1fr; gap: 4px 7px; margin: 6px 0; }
.compact-checks .check-row { font-size: 10.5px; }
.rule-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; margin: 7px 0; }
.rule-actions .btn { padding-left: 5px; padding-right: 5px; }
.coherence-panel { border: 1px solid #2e5c64; border-radius: 12px; background: rgba(3,9,18,.52); padding: 7px; font-size: 11px; color: var(--muted); max-height: 106px; overflow: auto; }
.score-row { display: flex; justify-content: space-between; gap: 8px; align-items: center; border-bottom: 1px solid rgba(85,234,212,.08); padding: 3px 0; }
.score-row strong { color: var(--cyan); }
.score-badge { border-radius: 999px; padding: 2px 7px; font-weight: 900; color: #061018; }
.good-score { background: #55ead4; }
.warn-score { background: #d9a536; }
.bad-score { background: #f25a76; color: #fff; }
.rule-summary { margin: 5px 0; }
.rule-issues { display: grid; gap: 3px; }
.rule-issues div { border-left: 2px solid rgba(85,234,212,.35); padding-left: 5px; }

/* Phase 6 Editable Section Composer */
.section-composer-card {
  border-color: rgba(79, 214, 255, .34);
  background: linear-gradient(180deg, rgba(79, 214, 255, .08), rgba(10, 14, 28, .76));
}
.composer-pair {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}
.composer-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 7px;
  margin-top: 8px;
}
.lane-mute-toggles {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
  margin-top: 8px;
}
.lane-mute-toggles label {
  display: flex;
  align-items: center;
  gap: 6px;
  min-height: 26px;
  border: 1px solid rgba(255,255,255,.1);
  border-radius: 10px;
  padding: 4px 7px;
  background: rgba(255,255,255,.04);
  font-size: 11px;
  color: #c7d3ee;
}
.composer-status {
  margin-top: 8px;
  padding: 8px;
  border-radius: 12px;
  background: rgba(0,0,0,.24);
  border: 1px solid rgba(255,255,255,.08);
  color: #aebce0;
  font-size: 11px;
  line-height: 1.35;
}
.lane-bar.override {
  outline: 2px solid rgba(79, 214, 255, .75);
  outline-offset: -2px;
}
.lane-bar.muted-section {
  opacity: .45;
}
.track-label.muted-row {
  color: #697794;
  text-decoration: line-through;
}
.step-row.muted-row {
  opacity: .44;
  filter: saturate(.65);
}
.step-cell.locked-anchor {
  box-shadow: inset 0 0 0 2px rgba(255, 210, 79, .8);
}
.step-cell.bar-override {
  border-color: rgba(79, 214, 255, .42);
}
.composer-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 6px;
  border-radius: 999px;
  background: rgba(79, 214, 255, .12);
  color: #d8f5ff;
  border: 1px solid rgba(79, 214, 255, .24);
}
@media (max-width: 1200px) {
  .composer-pair,
  .composer-actions,
  .lane-mute-toggles { grid-template-columns: 1fr; }
}


/* Phase 7 Bassline + Harmony Layer */
.harmony-card {
  border-color: rgba(217, 165, 54, .48);
  background: linear-gradient(180deg, rgba(217, 165, 54, .1), rgba(10, 14, 28, .76));
}
.harmony-card label { margin: 5px 0; gap: 4px; }
.harmony-card select { min-height: 30px; padding: 5px 7px; font-size: 12px; }
.harmony-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 7px;
  margin-top: 8px;
}
.harmony-actions .btn { padding-left: 5px; padding-right: 5px; }
.harmony-map {
  margin-top: 8px;
  padding: 8px;
  border-radius: 12px;
  border: 1px solid rgba(217, 165, 54, .25);
  background: rgba(0,0,0,.22);
  color: #b8c6e8;
  font-size: 11px;
  line-height: 1.35;
  max-height: 110px;
  overflow: auto;
}
.harmony-row { display:flex; justify-content:space-between; gap:8px; border-bottom:1px solid rgba(217,165,54,.12); padding:3px 0; }
.harmony-row strong { color: var(--gold); }
.harmony-chords { display:flex; flex-wrap:wrap; gap:5px; margin-top:6px; }
.harmony-chords span { display:inline-flex; border:1px solid rgba(85,234,212,.25); background:rgba(85,234,212,.08); border-radius:999px; padding:2px 7px; color:#d8f5ff; font-weight:900; }
.step-row:nth-child(8) .step-cell.on { background: linear-gradient(180deg, #caa4ff, #6d3bce); border-color: #d7b8ff; }

/* Phase 8 Melody Motif + Hook Generator */
.melody-card {
  border-color: rgba(255, 142, 220, .5);
  background: linear-gradient(180deg, rgba(255, 142, 220, .1), rgba(10, 14, 28, .78));
}
.melody-card label { margin: 5px 0; gap: 4px; }
.melody-card select { min-height: 30px; padding: 5px 7px; font-size: 12px; }
.melody-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 7px;
  margin-top: 8px;
}
.melody-actions .btn { padding-left: 5px; padding-right: 5px; }
.step-row:nth-child(9) .step-cell.on,
.step-row:nth-child(9) .step-cell.accent,
.step-row:nth-child(9) .step-cell.hold {
  background: linear-gradient(180deg, #ffb8ec, #b43b92);
  border-color: #ffd0f2;
  box-shadow: 0 0 10px rgba(255,142,220,.28);
}
.step-row:nth-child(10) .step-cell.on,
.step-row:nth-child(10) .step-cell.ghost {
  background: linear-gradient(180deg, #8cffb2, #218953);
  border-color: #b4ffd0;
  box-shadow: 0 0 10px rgba(36,195,137,.24);
}
.melody-card .harmony-row strong { color: #ffb8ec; }
.melody-card .harmony-map { border-color: rgba(255, 142, 220, .24); }


/* Phase 9 Transition Designer */
.transition-card {
  border-color: rgba(255, 214, 102, .24);
  background: linear-gradient(180deg, rgba(255, 214, 102, .08), rgba(123, 97, 255, .08));
}
.transition-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
  margin-top: 8px;
}
.transition-actions .btn:first-child { grid-column: 1 / -1; }
.transition-map {
  margin-top: 8px;
  padding: 8px;
  border: 1px solid rgba(255, 255, 255, .1);
  border-radius: 12px;
  min-height: 68px;
  background: rgba(0, 0, 0, .18);
  font-size: 12px;
  color: var(--muted);
}
.transition-flags {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-top: 8px;
}
.transition-flags .flag {
  border: 1px solid rgba(255,255,255,.14);
  border-radius: 999px;
  padding: 3px 7px;
  opacity: .52;
}
.transition-flags .flag.on {
  opacity: 1;
  color: #ffe08a;
  border-color: rgba(255, 214, 102, .45);
  background: rgba(255, 214, 102, .1);
}


/* Phase 10 Mix Console */
.mix-card {
  border-color: rgba(87, 214, 255, 0.34);
  background: linear-gradient(180deg, rgba(26, 43, 77, 0.72), rgba(12, 18, 34, 0.86));
}
.mix-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
  margin: 8px 0;
}
.mix-console {
  display: grid;
  gap: 6px;
  max-height: 268px;
  overflow: auto;
  padding-right: 4px;
}
.mix-row {
  display: grid;
  grid-template-columns: 98px 1fr 1fr 56px 56px;
  gap: 5px;
  align-items: center;
  border: 1px solid rgba(159, 176, 211, 0.16);
  border-radius: 10px;
  padding: 6px;
  background: rgba(6, 10, 20, 0.45);
}
.mix-row-muted { opacity: .55; }
.mix-name {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  color: #f6f8ff;
  min-width: 0;
}
.dot {
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: #9fb0d3;
  display: inline-block;
  box-shadow: 0 0 10px currentColor;
}
.dot.gold { color: #ffd166; background: #ffd166; }
.dot.red { color: #ff5a7a; background: #ff5a7a; }
.dot.cyan { color: #57d6ff; background: #57d6ff; }
.dot.blue { color: #6c8cff; background: #6c8cff; }
.dot.purple { color: #b071ff; background: #b071ff; }
.dot.pink { color: #ff7ad9; background: #ff7ad9; }
.dot.green { color: #64f4ac; background: #64f4ac; }
.mix-slider {
  display: grid;
  grid-template-columns: 28px 1fr 34px;
  align-items: center;
  gap: 4px;
  font-size: 10px;
  color: #9fb0d3;
  margin: 0;
}
.mix-slider input { width: 100%; }
.mix-slider output { text-align: right; font-variant-numeric: tabular-nums; }
.btn.mini {
  min-height: 24px;
  padding: 4px 5px;
  font-size: 10px;
}
.mix-status {
  margin-top: 8px;
  color: #9fb0d3;
  font-size: 11px;
  line-height: 1.35;
}


/* Phase 11 Instrument Section Foundation */
.instrument-card { border-color: rgba(116, 255, 185, 0.26); }
.instrument-actions { display:grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap:8px; margin-top:10px; }
.instrument-map { margin-top:10px; border:1px solid rgba(116,255,185,.18); background:rgba(10,20,32,.72); border-radius:12px; padding:10px; min-height:88px; font-size:12px; color:#b8c6e6; display:grid; gap:6px; }
.track-label.green .dot, .dot.green { background:#74ffb9; }
.steps { max-height: 520px; overflow:auto; padding-right:4px; }
.track-labels { max-height: 520px; overflow:hidden; }
.mix-console { max-height: 430px; overflow:auto; padding-right:4px; }


/* Phase 12.0.2 UI/playback grid hotfix
   Keep row labels and cells inside one shared scroll area so lower Phase 11/12
   instrument lanes (saxophone, trumpet, trombone, etc.) stay visually aligned. */
.pattern-grid {
  overflow: auto;
  align-items: start;
  align-content: start;
  scrollbar-color: #416097 #0c1327;
  padding-right: 4px;
}
.pattern-grid .track-labels,
.pattern-grid .steps {
  max-height: none;
  overflow: visible;
  align-content: start;
}
.pattern-grid .track-labels {
  position: sticky;
  left: 0;
  z-index: 2;
  background: linear-gradient(180deg, rgba(18,30,55,.98), rgba(12,21,39,.98));
}
.lane-section.playing .lane-label {
  outline: 2px solid rgba(217,165,54,.75);
  background: linear-gradient(180deg, #243b64, #10213d);
}


/* Phase 13.0.1 inspector recovery + generated-lane visibility
   The right sidebar is now one natural vertical scroller instead of a cramped
   fixed-row grid. This prevents Phase 11/12/13 cards from stacking into each
   other at 1920x1080 and keeps every new instrument control reachable. */
.inspector-panel {
  display: block;
  overflow-y: auto;
  overflow-x: hidden;
  padding-right: 10px;
  scrollbar-gutter: stable;
}
.inspector-panel > .mini-card,
.inspector-panel > .section-inspector,
.inspector-panel > .section-ops {
  width: 100%;
  min-width: 0;
}
.inspector-panel .mini-card {
  position: relative;
  margin-top: 10px;
  max-height: none;
  overflow: visible;
}
.inspector-panel h3 {
  line-height: 1.2;
}
.inspector-panel select,
.inspector-panel input[type="text"],
.inspector-panel textarea {
  min-width: 0;
}
.instrument-card,
.voice-leading-card,
.string-composer-card {
  box-shadow: inset 0 0 0 1px rgba(85,234,212,.08);
}
.voice-leading-card,
.string-composer-card {
  scroll-margin-top: 12px;
}
.instrument-map,
.harmony-map,
.transition-map,
.coherence-panel,
.composer-status {
  max-height: 156px;
  overflow: auto;
}
.checkbox-grid.compact-checks {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}
.check-row {
  min-width: 0;
  overflow-wrap: anywhere;
}
.pattern-grid .step-cell.previewMerged,
.step-cell.previewMerged {
  outline: 1px dashed rgba(255,255,255,.24);
}
.footer-panel {
  grid-template-columns: 1.1fr .55fr 1.45fr;
}

/* Phase 14 Guitar + Plucked Instrument Engine */
.guitar-composer-card {
  border-color: rgba(217,165,54,.35);
  box-shadow: inset 0 0 0 1px rgba(217,165,54,.08);
  scroll-margin-top: 12px;
}
.guitar-composer-map {
  border-color: rgba(217,165,54,.22);
}
.guitar-actions .btn {
  min-width: 0;
}

/* Phase 15 Wind + Woodwind Composer */
.wind-composer-card {
  border-color: rgba(87, 214, 255, .35);
  box-shadow: inset 0 0 0 1px rgba(87, 214, 255, .08);
  scroll-margin-top: 12px;
  background: linear-gradient(180deg, rgba(87, 214, 255, .08), rgba(116, 255, 185, .06));
}
.wind-composer-map {
  border-color: rgba(87, 214, 255, .24);
}
.wind-actions .btn {
  min-width: 0;
}

/* Phase 16 Brass Composer */
.brass-composer-card {
  border-color: rgba(242, 90, 118, .42);
  box-shadow: inset 0 0 0 1px rgba(242, 90, 118, .10);
  scroll-margin-top: 12px;
  background: linear-gradient(180deg, rgba(242, 90, 118, .08), rgba(217, 165, 54, .06));
}
.brass-composer-map {
  border-color: rgba(242, 90, 118, .26);
}
.brass-actions .btn {
  min-width: 0;
}

/* Phase 17 Orchestration + Role Assignment AI */
.orchestration-card {
  border-color: rgba(116, 255, 185, .42);
  box-shadow: inset 0 0 0 1px rgba(116, 255, 185, .10);
  scroll-margin-top: 12px;
  background: linear-gradient(180deg, rgba(116, 255, 185, .08), rgba(85, 234, 212, .06));
}
.orchestration-map {
  border-color: rgba(116, 255, 185, .28);
}
.orchestration-actions .btn {
  min-width: 0;
}

/* Phase 18 Articulation, Human Feel, and Performance Engine */
.performance-card {
  border-color: rgba(118, 255, 214, 0.24);
  background: linear-gradient(180deg, rgba(118,255,214,0.08), rgba(11,16,32,0.94));
}
.performance-card h3 {
  color: #b8ffe9;
}
.performance-map {
  min-height: 120px;
  border-color: rgba(118,255,214,0.18);
}
.performance-actions .btn {
  min-width: 0;
}

/* Phase 19 Modern Effects + Genre Production Layer */
.production-card {
  border-color: rgba(217, 165, 54, 0.34);
  background: linear-gradient(180deg, rgba(217,165,54,0.10), rgba(11,16,32,0.94));
}
.production-card h3 {
  color: #ffe0a1;
}
.production-map {
  min-height: 120px;
  border-color: rgba(217,165,54,0.24);
}
.production-actions .btn {
  min-width: 0;
}

/* Phase 20 Full Composition Intelligence Pass */
.composition-card {
  border-color: rgba(176, 113, 255, 0.42);
  background: linear-gradient(180deg, rgba(176,113,255,0.12), rgba(11,16,32,0.94));
  box-shadow: inset 0 0 0 1px rgba(176,113,255,0.10);
  scroll-margin-top: 12px;
}
.composition-card h3 {
  color: #d9c2ff;
}
.composition-map {
  min-height: 140px;
  border-color: rgba(176,113,255,0.28);
}
.composition-actions {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}
.composition-actions .btn {
  min-width: 0;
}
.composition-actions #makeMusicalBtn,
.composition-actions #compositionAuditBtn {
  grid-column: span 1;
}

/* Phase 20.1 Composition Generation Presets */
.preset-card {
  border-color: rgba(255, 199, 89, 0.34);
  background: linear-gradient(180deg, rgba(255,199,89,0.08), rgba(68,91,255,0.06));
}
.composition-preset-desc {
  margin-top: 10px;
  padding: 10px;
  border: 1px solid rgba(159, 176, 211, 0.18);
  border-radius: 12px;
  background: rgba(9, 14, 28, 0.58);
  color: #b8c6e6;
  font-size: 12px;
  line-height: 1.45;
  max-height: 180px;
  overflow: auto;
}
.composition-preset-desc p { margin: 6px 0 8px; }
.composition-preset-desc .blueprint-meta { color: #ffd479; }

.advanced-lead-card { border-color: rgba(255, 124, 189, 0.36); }
.advanced-lead-card h3 { color: #ffd2e6; }


/* Diversify Phase 7.0.1 composer control unlock
   The left Composer Brain can now scroll independently after the preset/DNA/form
   cards expanded beyond the 1080p panel height. Native selects stay clickable
   and are not trapped by the panel's old overflow:hidden behavior. */
.composer-panel {
  overflow-y: auto;
  overflow-x: hidden;
  padding-right: 10px;
  scrollbar-gutter: stable;
  scrollbar-color: #416097 #0c1327;
}
.composer-panel select,
.composer-panel input,
.composer-panel button {
  position: relative;
  z-index: 3;
}
.composer-panel .mini-card {
  max-height: none;
  overflow: visible;
}


.template-workflow-card { border-color: rgba(255, 202, 120, .38); box-shadow: inset 0 0 0 1px rgba(255, 202, 120, .08); }
.template-workflow-actions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.queue-result-list { margin: 8px 0 0; padding-left: 20px; color: var(--muted); font-size: .85rem; }
.queue-result-list li { margin: 4px 0; }

.offline-render-card { border-color: rgba(111, 229, 255, 0.32); box-shadow: inset 0 0 0 1px rgba(111, 229, 255, 0.08); }
.offline-render-actions { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.offline-render-card .harmony-map { max-height: 220px; overflow: auto; }

/* Diversify Phase 12.0.3 MP3 export live status toast */
.mp3-export-toast {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 60;
  width: min(390px, calc(100vw - 28px));
  border: 1px solid rgba(85,234,212,.45);
  border-radius: 16px;
  background: linear-gradient(180deg, rgba(13,24,46,.96), rgba(5,11,22,.97));
  box-shadow: 0 20px 55px rgba(0,0,0,.5), 0 0 0 1px rgba(255,255,255,.05) inset;
  padding: 12px 13px 13px;
  color: var(--text);
  pointer-events: none;
  transform: translateY(0);
  opacity: 1;
  transition: opacity .22s ease, transform .22s ease, border-color .22s ease;
}
.mp3-export-toast.hidden {
  opacity: 0;
  transform: translateY(14px);
}
.mp3-export-toast.success { border-color: rgba(85,234,212,.72); }
.mp3-export-toast.error { border-color: rgba(255,92,122,.72); }
.mp3-export-toast-head {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: center;
  margin-bottom: 6px;
}
.mp3-export-toast-head strong {
  color: var(--gold);
  font-size: 13px;
  letter-spacing: .02em;
}
#mp3ExportToastPhase {
  color: var(--cyan);
  font-size: 11px;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: .08em;
  text-align: right;
}
.mp3-export-toast-message {
  font-size: 13px;
  line-height: 1.25;
  color: var(--text);
  margin-bottom: 8px;
}
.mp3-export-toast-detail {
  min-height: 14px;
  margin-top: 7px;
  color: var(--muted);
  font-size: 11px;
  overflow-wrap: anywhere;
}
.mp3-export-toast-bar {
  height: 7px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(255,255,255,.08);
  border: 1px solid rgba(255,255,255,.08);
}
.mp3-export-toast-bar span {
  display: block;
  height: 100%;
  width: 4%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--cyan), var(--gold));
  transition: width .28s ease;
}
.mp3-export-toast.indeterminate .mp3-export-toast-bar span {
  width: 42%;
  animation: mp3ToastPulse 1.15s ease-in-out infinite alternate;
}
.mp3-export-toast.error .mp3-export-toast-bar span {
  background: linear-gradient(90deg, var(--red), var(--gold));
}
.blueprint-meta.warn { color: var(--gold); }
@keyframes mp3ToastPulse {
  from { transform: translateX(-20%); opacity: .55; }
  to { transform: translateX(135%); opacity: 1; }
}
@media (max-width: 700px) {
  .mp3-export-toast {
    right: 10px;
    left: 10px;
    bottom: 10px;
    width: auto;
  }
}
