:root {
  --aw-bg: #090c12;
  --aw-panel: #111620;
  --aw-panel-2: #171d28;
  --aw-line: rgba(176, 188, 214, 0.16);
  --aw-line-strong: rgba(176, 188, 214, 0.28);
  --aw-text: #e5e9f2;
  --aw-dim: #9ba6bb;
  --aw-accent: #f0a800;
  --aw-danger: #f06b72;
  --aw-ok: #75d2a5;
}

body.composer-open { overflow: hidden; }

#composerWorkspace[hidden] { display: none; }
#composerWorkspace {
  position: fixed;
  inset: 0;
  z-index: 320;
  display: grid;
  grid-template-rows: 52px minmax(0, 1fr) 26px;
  background: var(--aw-bg);
  color: var(--aw-text);
  font-family: var(--font-ui, "Inter", system-ui, sans-serif);
  letter-spacing: 0;
  overflow: hidden;
}
#composerWorkspace [hidden] { display: none !important; }

.aw-topbar {
  display: grid;
  grid-template-columns: auto minmax(150px, 280px) auto minmax(250px, 1fr) auto;
  align-items: center;
  gap: 10px;
  min-width: 0;
  padding: 6px 10px;
  border-bottom: 1px solid var(--aw-line-strong);
  background: #0d1119;
}

.aw-brand {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}
.aw-brand b {
  font: 600 18px/1 var(--font-display, Georgia, serif);
  color: #f2f4f8;
  white-space: nowrap;
}
.aw-brand b span { color: var(--aw-accent); }

.aw-icon,
.aw-btn,
.aw-segment,
.aw-track-action,
.aw-view-btn {
  border: 1px solid transparent;
  border-radius: 6px;
  background: transparent;
  color: var(--aw-dim);
  font: 500 12px/1 var(--font-ui, "Inter", system-ui, sans-serif);
  cursor: pointer;
}
.aw-icon {
  display: inline-grid;
  place-items: center;
  width: 34px;
  height: 34px;
  flex: 0 0 34px;
  font-size: 15px;
}
.aw-icon:hover,
.aw-btn:hover,
.aw-track-action:hover,
.aw-view-btn:hover { color: var(--aw-text); background: rgba(255,255,255,0.055); }
.aw-icon:disabled,
.aw-btn:disabled { opacity: 0.35; cursor: default; }
.aw-icon.aw-primary,
.aw-btn.aw-primary { color: #15110a; background: var(--aw-accent); border-color: var(--aw-accent); }
.aw-icon.aw-on { color: var(--aw-accent); background: rgba(240,168,0,0.10); }

.aw-project-title,
.aw-number,
.aw-select,
.aw-input {
  min-width: 0;
  height: 34px;
  border: 1px solid var(--aw-line);
  border-radius: 6px;
  background: rgba(255,255,255,0.035);
  color: var(--aw-text);
  padding: 0 9px;
  font: 500 12px/1 var(--font-ui, "Inter", system-ui, sans-serif);
}
.aw-project-title {
  width: 100%;
  border-color: transparent;
  background: transparent;
  font-size: 13px;
}
.aw-project-title:hover,
.aw-project-title:focus { border-color: var(--aw-line); background: rgba(255,255,255,0.035); }

.aw-history,
.aw-transport,
.aw-global,
.aw-toolbar-group {
  display: flex;
  align-items: center;
  gap: 3px;
  min-width: 0;
}
.aw-transport { justify-content: center; }
.aw-transport-time {
  min-width: 108px;
  color: var(--aw-text);
  text-align: center;
  font: 11px/1 var(--font-mono, Consolas, monospace);
  font-variant-numeric: tabular-nums;
}
.aw-global { justify-content: flex-end; }
.aw-global .aw-number { width: 74px; font-family: var(--font-mono, Consolas, monospace); }
.aw-meter { width: 82px; }

.aw-shell {
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr) 300px;
  grid-template-rows: minmax(0, 1fr) 182px;
  min-width: 0;
  min-height: 0;
}

.aw-tracks {
  grid-row: 1 / 3;
  min-width: 0;
  min-height: 0;
  border-right: 1px solid var(--aw-line-strong);
  background: var(--aw-panel);
  display: flex;
  flex-direction: column;
}
.aw-panel-head {
  min-height: 42px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 0 10px;
  border-bottom: 1px solid var(--aw-line);
}
.aw-panel-head h2,
.aw-inspector h2 {
  margin: 0;
  color: var(--aw-dim);
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
}
.aw-track-list { overflow: auto; min-height: 0; padding: 4px 0; }
.aw-track {
  position: relative;
  display: grid;
  grid-template-columns: 8px minmax(0, 1fr) auto;
  align-items: center;
  min-height: 58px;
  gap: 7px;
  padding: 6px 8px 6px 6px;
  border-bottom: 1px solid rgba(176,188,214,0.08);
  cursor: pointer;
}
.aw-track:hover { background: rgba(255,255,255,0.025); }
.aw-track.aw-selected { background: rgba(240,168,0,0.075); }
.aw-track.aw-muted { opacity: 0.48; }
.aw-track-swatch { width: 4px; height: 38px; border-radius: 2px; justify-self: center; }
.aw-track-copy { min-width: 0; }
.aw-track-copy b,
.aw-track-copy span { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.aw-track-copy b { color: var(--aw-text); font-size: 12px; font-weight: 600; }
.aw-track-copy span { margin-top: 4px; color: var(--aw-dim); font-size: 10px; }
.aw-track-controls { display: flex; gap: 2px; }
.aw-track-action { width: 25px; height: 25px; font-size: 10px; }
.aw-track-action.aw-on { color: var(--aw-accent); background: rgba(240,168,0,0.10); }

.aw-center {
  min-width: 0;
  min-height: 0;
  display: grid;
  grid-template-rows: 42px minmax(0, 1fr);
  background: var(--aw-bg);
}
.aw-workbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-width: 0;
  padding: 4px 8px;
  border-bottom: 1px solid var(--aw-line);
  background: #0f141d;
}
.aw-views { display: flex; align-items: center; gap: 2px; min-width: 0; overflow-x: auto; scrollbar-width: none; }
.aw-views::-webkit-scrollbar { display: none; }
.aw-view-btn { height: 32px; padding: 0 11px; white-space: nowrap; }
.aw-view-btn.aw-active { color: var(--aw-text); background: rgba(255,255,255,0.075); border-color: var(--aw-line); }
.aw-tools { display: flex; align-items: center; gap: 5px; min-width: 0; overflow-x: auto; scrollbar-width: none; }
.aw-tools::-webkit-scrollbar { display: none; }
.aw-tools label { color: var(--aw-dim); font-size: 10px; white-space: nowrap; }
.aw-tools .aw-select { width: 86px; height: 30px; padding-right: 3px; }
.aw-tools input[type="range"] { width: 92px; }
.aw-spiral-modes { display: flex; align-items: center; gap: 2px; flex: 0 0 auto; }
.aw-spiral-modes .aw-segment { height: 30px; }
.aw-gamma-control {
  display: grid;
  grid-template-columns: auto 68px 30px;
  align-items: center;
  gap: 4px;
  flex: 0 0 auto;
}
.aw-gamma-control input[type="range"] { width: 68px; }
.aw-gamma-control output { color: var(--aw-text); font: 10px/1 var(--font-mono, Consolas, monospace); }
.aw-tools .aw-register-select { width: 72px; }
#composerWorkspace[data-composer-view="spiral"] [data-action="add-note"],
#composerWorkspace[data-composer-view="spiral"] [data-action="multi-select"],
#composerWorkspace[data-composer-view="spiral"] label[for="awZoom"],
#composerWorkspace[data-composer-view="spiral"] #awZoom { display: none; }
#composerWorkspace[data-composer-view="spiral"] #awSnap { width: 72px; }
#composerWorkspace[data-composer-view="spiral"] .aw-center { grid-template-rows: 76px minmax(0, 1fr); }
#composerWorkspace[data-composer-view="spiral"] .aw-workbar {
  display: grid;
  grid-template-rows: 32px 32px;
  align-content: center;
  justify-content: stretch;
  gap: 2px;
  padding-block: 4px;
}
#composerWorkspace[data-composer-view="spiral"] .aw-views,
#composerWorkspace[data-composer-view="spiral"] .aw-tools { width: 100%; justify-content: flex-start; }

.aw-stage { position: relative; min-width: 0; min-height: 0; overflow: hidden; }
.aw-view { position: absolute; inset: 0; display: none; min-width: 0; min-height: 0; }
.aw-view.aw-active { display: block; }
.aw-scroll { position: absolute; inset: 0; overflow: auto; overscroll-behavior: contain; }

.aw-timeline {
  position: relative;
  min-height: 100%;
  background-color: #0b0f16;
  background-image:
    linear-gradient(to right, rgba(240,168,0,0.15) 1px, transparent 1px),
    linear-gradient(to right, rgba(176,188,214,0.09) 1px, transparent 1px);
  background-size: var(--aw-bar-px, 384px) 100%, var(--aw-beat-px, 96px) 100%;
}
.aw-ruler {
  position: sticky;
  top: 0;
  z-index: 5;
  height: 28px;
  border-bottom: 1px solid var(--aw-line-strong);
  background: rgba(15,20,29,0.97);
  font: 10px/28px var(--font-mono, Consolas, monospace);
  color: var(--aw-dim);
}
.aw-ruler-mark { position: absolute; top: 0; padding-left: 5px; border-left: 1px solid rgba(240,168,0,0.28); height: 28px; }
.aw-conductor {
  position: relative;
  height: 66px;
  border-bottom: 1px solid var(--aw-line-strong);
  background: rgba(13,18,27,0.9);
  overflow: hidden;
}
.aw-form-section {
  position: absolute;
  inset-block: 0;
  min-width: 24px;
  padding: 0;
  border: 0;
  border-left: 1px solid rgba(255,255,255,0.16);
  border-right: 1px solid rgba(255,255,255,0.08);
  border-radius: 0;
  color: var(--aw-dim);
  text-align: left;
  cursor: pointer;
}
.aw-form-section-0 { background: rgba(53,132,228,0.08); }
.aw-form-section-1 { background: rgba(61,180,142,0.07); }
.aw-form-section-2 { background: rgba(240,168,0,0.07); }
.aw-form-section:hover { filter: brightness(1.35); }
.aw-form-section > span {
  position: absolute;
  top: 5px;
  left: 6px;
  max-width: calc(100% - 12px);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font: 600 9px/1 var(--font-mono, Consolas, monospace);
}
.aw-conductor-event {
  position: absolute;
  z-index: 2;
  top: 39px;
  height: 20px;
  max-width: 260px;
  padding: 0 6px;
  border: 1px solid rgba(176,188,214,0.24);
  border-radius: 3px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  background: rgba(8,12,18,0.9);
  color: var(--aw-text);
  font: 9px/18px var(--font-mono, Consolas, monospace);
}
.aw-conductor-event:hover { border-color: rgba(240,168,0,0.6); }
.aw-conductor-marker {
  position: absolute;
  z-index: 3;
  inset-block: 0;
  width: 1px;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: rgba(240,168,0,0.68);
  color: var(--aw-accent);
  cursor: pointer;
}
.aw-conductor-marker::before {
  content: "";
  position: absolute;
  top: 0;
  left: -4px;
  border-left: 4px solid transparent;
  border-right: 4px solid transparent;
  border-top: 6px solid var(--aw-accent);
}
.aw-conductor-marker > span {
  position: absolute;
  top: 18px;
  left: 4px;
  width: max-content;
  max-width: 120px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font: 8px/1 var(--font-mono, Consolas, monospace);
}
.aw-lane {
  position: relative;
  height: 64px;
  border-bottom: 1px solid rgba(176,188,214,0.10);
}
.aw-lane.aw-muted .aw-note { opacity: 0.32; }
.aw-clip {
  position: absolute;
  z-index: 1;
  top: 6px;
  bottom: 6px;
  min-width: 18px;
  overflow: hidden;
  border: 1px solid color-mix(in srgb, var(--aw-track-color) 42%, transparent);
  border-radius: 4px;
  background: color-mix(in srgb, var(--aw-track-color) 8%, rgba(8,12,18,0.74));
  pointer-events: none;
}
.aw-clip-name {
  position: absolute;
  z-index: 1;
  top: 3px;
  left: 5px;
  right: 5px;
  overflow: hidden;
  color: color-mix(in srgb, var(--aw-track-color) 64%, white);
  text-overflow: ellipsis;
  white-space: nowrap;
  font: 8px/1 var(--font-mono, Consolas, monospace);
}
.aw-clip-density { position: absolute; inset: 17px 2px 3px; opacity: 0.24; }
.aw-clip-density > i {
  position: absolute;
  bottom: 0;
  min-width: 1px;
  background: var(--aw-track-color);
}
.aw-lane-label {
  display: none;
  position: sticky;
  left: 6px;
  top: 3px;
  z-index: 2;
  width: max-content;
  padding: 2px 5px;
  border-radius: 4px;
  background: rgba(9,12,18,0.84);
  color: var(--aw-dim);
  font-size: 9px;
  pointer-events: none;
}

.aw-note {
  position: absolute;
  z-index: 2;
  top: 13px;
  height: 38px;
  min-width: 8px;
  border: 1px solid var(--aw-track-color, rgba(255,255,255,0.55));
  border-radius: 4px;
  padding: 0 8px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: rgba(5,8,12,0.88);
  font: 600 10px/36px var(--font-mono, Consolas, monospace);
  text-align: left;
  cursor: grab;
  box-shadow: inset 0 -7px 0 rgba(0,0,0,0.12);
  opacity: var(--aw-note-opacity, 1);
}
.aw-note:hover { filter: brightness(1.12); }
.aw-note.aw-selected {
  z-index: 4;
  opacity: 1;
  outline: 2px solid #fff3c6;
  outline-offset: 1px;
  box-shadow: 0 0 0 3px rgba(240,168,0,0.46), inset 0 -7px 0 rgba(0,0,0,0.12);
}
.aw-note:active { cursor: grabbing; }
.aw-note-gate {
  position: absolute;
  inset: 0 auto 0 0;
  border-right: 1px solid rgba(255,255,255,0.62);
  background: rgba(255,255,255,0.18);
  pointer-events: none;
}
.aw-note-label { position: relative; z-index: 1; pointer-events: none; }
.aw-note.aw-overlap::after {
  content: "+";
  position: absolute;
  top: 1px;
  right: 8px;
  z-index: 2;
  color: rgba(8,10,14,0.78);
  font: 700 9px/1 var(--font-mono, Consolas, monospace);
}
.aw-note-handle {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  width: 7px;
  border-left: 1px solid rgba(0,0,0,0.28);
  background: rgba(255,255,255,0.12);
  cursor: ew-resize;
}
.aw-playhead {
  position: absolute;
  top: 0;
  bottom: 0;
  z-index: 6;
  width: 1px;
  background: var(--aw-accent);
  pointer-events: none;
  box-shadow: 0 0 0 1px rgba(240,168,0,0.18);
}
.aw-playhead::before {
  content: "";
  position: absolute;
  top: 0;
  left: -4px;
  border-left: 5px solid transparent;
  border-right: 5px solid transparent;
  border-top: 7px solid var(--aw-accent);
}

.aw-notes-layout {
  position: absolute;
  inset: 0;
  display: grid;
  grid-template-columns: 106px minmax(0, 1fr);
  min-width: 0;
  min-height: 0;
}
.aw-notes-layout > .aw-scroll { position: relative; inset: auto; min-width: 0; min-height: 0; }
.aw-pitch-palette {
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  border-right: 1px solid var(--aw-line-strong);
  background: #10151e;
}
.aw-palette-title {
  height: 28px;
  padding: 0 8px;
  border-bottom: 1px solid var(--aw-line);
  color: var(--aw-dim);
  font: 600 9px/28px var(--font-ui, "Inter", system-ui, sans-serif);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}
.aw-palette-list { height: calc(100% - 28px); overflow: auto; padding: 3px; }
.aw-palette-note {
  display: grid;
  grid-template-columns: 5px minmax(0, 1fr) auto;
  align-items: center;
  gap: 6px;
  width: 100%;
  min-height: 38px;
  padding: 3px 5px;
  border: 1px solid transparent;
  border-radius: 4px;
  background: transparent;
  color: var(--aw-text);
  text-align: left;
  cursor: pointer;
}
.aw-palette-note:hover { background: rgba(255,255,255,0.045); }
.aw-palette-note.aw-active { border-color: rgba(240,168,0,0.48); background: rgba(240,168,0,0.08); }
.aw-palette-swatch { width: 4px; height: 26px; border-radius: 2px; }
.aw-palette-note b,
.aw-palette-note small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.aw-palette-note b { font: 600 10px/1.1 var(--font-mono, Consolas, monospace); }
.aw-palette-note small { margin-top: 3px; color: var(--aw-dim); font: 8px/1 var(--font-mono, Consolas, monospace); }
.aw-palette-note em { color: #6f7a90; font: normal 8px/1 var(--font-mono, Consolas, monospace); }
.aw-pitch-grid { position: relative; min-height: 760px; background: #0b0f16; }
.aw-pitch-row {
  position: absolute;
  left: 0;
  right: 0;
  height: 1px;
  background: rgba(176,188,214,0.095);
  pointer-events: none;
}
.aw-pitch-row-chromatic { background: rgba(176,188,214,0.075); }
.aw-pitch-row-chromatic:nth-child(12n + 1) { background: rgba(240,168,0,0.16); }
.aw-pitch-row-cents { background: rgba(176,188,214,0.065); }
.aw-pitch-label {
  position: sticky;
  left: 0;
  z-index: 3;
  display: inline-block;
  width: 72px;
  transform: translateY(-11px);
  padding: 2px 6px;
  background: rgba(13,17,25,0.92);
  color: var(--aw-dim);
  font: 9px/16px var(--font-mono, Consolas, monospace);
  pointer-events: none;
}
.aw-pitch-grid .aw-note { top: auto; height: 20px; line-height: 18px; padding-left: 5px; }
.aw-pitch-grid .aw-note.aw-context { opacity: 0.34; }
.aw-pitch-grid .aw-note.aw-context:hover,
.aw-pitch-grid .aw-note.aw-context.aw-selected { opacity: 0.9; }

.aw-spiral-wrap { position: absolute; inset: 0; display: grid; grid-template-columns: minmax(0, 1fr) 250px; }
.aw-spiral-canvas { width: 100%; height: 100%; min-width: 0; min-height: 0; touch-action: none; }
.aw-spiral-legend { padding: 0 14px 2px; border-left: 1px solid var(--aw-line); background: var(--aw-panel); overflow: auto; }
.aw-spiral-legend-head { position: sticky; top: 0; z-index: 2; display: flex; align-items: center; justify-content: space-between; min-height: 36px; background: var(--aw-panel); border-bottom: 1px solid var(--aw-line); }
.aw-spiral-legend-head h2 { margin: 0; color: var(--aw-dim); font-size: 10px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.1em; }
.aw-spiral-legend section { padding: 9px 0; border-bottom: 1px solid var(--aw-line); }
.aw-spiral-legend h3 { margin: 0 0 5px; font-size: 11px; }
.aw-spiral-legend p { margin: 0; color: var(--aw-dim); font-size: 11px; line-height: 1.35; }
.aw-spiral-legend .aw-playback-status { margin-top: 4px; color: var(--aw-text); font-family: var(--font-mono, Consolas, monospace); }
.aw-lab-bridge .aw-input,
.aw-lab-bridge .aw-select { width: 100%; margin-bottom: 5px; }
.aw-lab-bridge .aw-input,
.aw-lab-bridge .aw-select { height: 32px; }
.aw-lab-bridge .aw-btn { min-height: 30px; height: auto; padding: 4px 7px; line-height: 1.15; }
.aw-ab-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; margin-bottom: 5px; }
.aw-spiral-legend .aw-lab-bridge { padding-bottom: 2px; border-bottom: 0; }
.aw-sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }

.aw-text-wrap { position: absolute; inset: 0; display: grid; grid-template-columns: 48px minmax(0, 1fr); background: #080b11; }
.aw-text-stale {
  position: absolute;
  z-index: 5;
  top: 8px;
  right: 12px;
  left: 60px;
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-height: 36px;
  padding: 5px 6px 5px 10px;
  border: 1px solid rgba(240,107,114,0.42);
  border-radius: 6px;
  background: rgba(40,17,23,0.96);
  color: #ffc0c4;
  font-size: 10.5px;
}
.aw-text-stale[hidden] { display: none; }
.aw-text-stale span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.aw-text-stale .aw-btn { flex: 0 0 auto; min-height: 26px; }
#composerWorkspace.aw-text-invalid .aw-source,
#composerWorkspace.aw-text-invalid .aw-line-numbers { padding-top: 52px; }
.aw-line-numbers {
  margin: 0;
  padding: 12px 8px;
  overflow: hidden;
  border-right: 1px solid var(--aw-line);
  color: #657086;
  background: #0b0f16;
  text-align: right;
  user-select: none;
  font: 12.5px/1.55 var(--font-mono, Consolas, monospace);
}
.aw-source {
  resize: none;
  width: 100%;
  height: 100%;
  border: 0;
  border-radius: 0;
  padding: 12px;
  background: #080b11;
  color: var(--aw-text);
  caret-color: var(--aw-accent);
  font: 12.5px/1.55 var(--font-mono, Consolas, monospace);
  tab-size: 2;
  white-space: pre;
  overflow: auto;
}
.aw-source.aw-invalid { box-shadow: inset 3px 0 0 var(--aw-danger); }

/* recording: the transport record dot + active state */
.aw-icon.aw-record { color: #ff6b72; font-size: 13px; }
.aw-icon.aw-record:hover { color: #ff8a90; }
.aw-btn.aw-recording { background: var(--aw-danger, #e0484c); color: #fff; border-color: var(--aw-danger, #e0484c); animation: aw-rec-pulse 1.1s ease-in-out infinite; }
@keyframes aw-rec-pulse { 0%,100% { box-shadow: 0 0 0 0 rgba(224,72,76,0.5); } 50% { box-shadow: 0 0 0 5px rgba(224,72,76,0); } }
.aw-check { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--aw-text-dim, #aeb8cc); margin: 5px 0; cursor: pointer; }
.aw-check input { accent-color: var(--aw-accent, #f0a800); }

/* CodeMirror 6 host — fills the text view, themed to the music-first palette */
.aw-cm-host { grid-column: 1 / -1; min-width: 0; min-height: 0; position: relative; overflow: hidden; background: #080b11; }
.aw-cm-host[hidden] { display: none; }
.aw-cm-host.aw-invalid { box-shadow: inset 3px 0 0 var(--aw-danger); }
.aw-cm-host .cm-editor { position: absolute; inset: 0; height: 100%; background: #080b11; color: var(--aw-text); font: 12.5px/1.55 var(--font-mono, Consolas, monospace); }
.aw-cm-host .cm-editor.cm-focused { outline: none; }
.aw-cm-host .cm-scroller { font-family: inherit; line-height: inherit; }
.aw-cm-host .cm-content { caret-color: var(--aw-accent); padding: 10px 0; }
.aw-cm-host .cm-gutters { background: #0b0f16; color: #657086; border-right: 1px solid var(--aw-line); }
.aw-cm-host .cm-activeLineGutter { background: rgba(240,168,0,0.10); color: #aeb8cc; }
.aw-cm-host .cm-activeLine { background: rgba(255,255,255,0.028); }
.aw-cm-host .cm-cursor, .aw-cm-host .cm-dropCursor { border-left-color: var(--aw-accent); }
.aw-cm-host .cm-selectionBackground,
.aw-cm-host .cm-content ::selection { background: rgba(120,160,255,0.26); }
.aw-cm-host.cm-focused .cm-selectionBackground { background: rgba(120,160,255,0.32); }
.aw-cm-host .cm-matchingBracket { background: rgba(240,168,0,0.20); outline: 1px solid rgba(240,168,0,0.5); color: inherit; }
/* token colours */
.aw-cm-host .cm-tok-comment { color: #5d6b82; font-style: italic; }
.aw-cm-host .cm-tok-keyword { color: var(--aw-accent, #f0a800); font-weight: 600; }
.aw-cm-host .cm-tok-number { color: #7fd0ff; }
.aw-cm-host .cm-tok-duration { color: #9ae6a0; }
.aw-cm-host .cm-tok-id { color: #d59bff; }
.aw-cm-host .cm-tok-velocity { color: #ff9bb0; }
.aw-cm-host .cm-tok-bracket { color: #c7cede; }
.aw-cm-host .cm-tok-operator { color: #c7cede; }
.aw-cm-host .cm-tok-name { color: var(--aw-text); }
/* diagnostics + tooltips */
.aw-cm-host .cm-lintRange-error { text-decoration: underline wavy var(--aw-danger); text-decoration-skip-ink: none; }
.aw-cm-host .cm-lint-marker-error { color: var(--aw-danger); }
.cm-tooltip { background: #11151f; border: 1px solid var(--aw-line); color: var(--aw-text); border-radius: 6px; font: 11.5px/1.5 var(--font-mono, Consolas, monospace); box-shadow: 0 8px 24px rgba(0,0,0,0.5); }
.cm-tooltip.cm-tooltip-autocomplete > ul { font-family: var(--font-mono, Consolas, monospace); max-height: 16em; }
.cm-tooltip.cm-tooltip-autocomplete > ul > li { padding: 3px 8px; }
.cm-tooltip-autocomplete > ul > li[aria-selected] { background: rgba(240,168,0,0.20); color: #fff; }
.cm-completionDetail { color: #8a93a6; font-style: normal; margin-left: 8px; }
.cm-completionIcon { opacity: 0.6; }
.cm-diagnostic { font: 11.5px/1.5 var(--font-mono, Consolas, monospace); }
.cm-diagnostic-error { border-left: 3px solid var(--aw-danger); }

.aw-inspector {
  grid-column: 3;
  grid-row: 1 / 3;
  min-width: 0;
  min-height: 0;
  border-left: 1px solid var(--aw-line-strong);
  background: var(--aw-panel);
  overflow: auto;
}
.aw-inspector-head {
  position: sticky;
  top: 0;
  z-index: 4;
  height: 42px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 12px;
  border-bottom: 1px solid var(--aw-line);
  background: rgba(17,22,32,0.97);
}
.aw-inspector-body { padding: 12px; }
.aw-section { padding: 0 0 14px; margin: 0 0 14px; border-bottom: 1px solid var(--aw-line); }
.aw-section:last-child { border-bottom: 0; }
.aw-section h3 {
  margin: 0 0 9px;
  color: var(--aw-dim);
  font-size: 9px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
}
.aw-field { display: grid; grid-template-columns: 88px minmax(0, 1fr); align-items: center; gap: 8px; margin: 7px 0; }
.aw-field label { color: var(--aw-dim); font-size: 10px; }
.aw-field .aw-input,
.aw-field .aw-select { width: 100%; height: 31px; font-family: var(--font-mono, Consolas, monospace); }
.aw-help { color: var(--aw-dim); font-size: 10.5px; line-height: 1.55; }
.aw-value { color: var(--aw-text); font: 11px/1.5 var(--font-mono, Consolas, monospace); overflow-wrap: anywhere; }
.aw-identity { color: var(--aw-accent); }
.aw-cents { display: flex; align-items: center; gap: 8px; }
.aw-cents-readout {
  flex: 1; min-width: 0; text-align: center;
  font: 11px/1 var(--font-mono, Consolas, monospace); color: var(--aw-text);
}
.aw-mini {
  width: 30px; height: 28px; flex: none; cursor: pointer;
  border: 1px solid var(--aw-line-strong); border-radius: 6px;
  background: rgba(255,255,255,0.03); color: var(--aw-text);
  font: 600 15px/1 var(--font-ui, Inter, system-ui, sans-serif);
}
.aw-mini:hover { border-color: var(--aw-accent); color: var(--aw-accent); }
.aw-mini:focus-visible { outline: 2px solid var(--aw-accent); outline-offset: 2px; }

.aw-auto-svg { display: block; overflow: visible; }
.aw-auto-line { stroke: var(--aw-accent); stroke-width: 1.6; stroke-linejoin: round; }
.aw-auto-dots circle { fill: var(--aw-bg); stroke: var(--aw-accent); stroke-width: 1.6; }
.aw-auto-base { stroke: var(--aw-line-strong); stroke-width: 1; stroke-dasharray: 3 3; }

.aw-view[data-work-view="score"].aw-active { display: flex; flex-direction: column; min-height: 0; }
.aw-score-bar {
  display: flex; align-items: center; gap: 12px; padding: 8px 12px;
  border-bottom: 1px solid var(--aw-line); flex: none;
}
.aw-score-title { font: 14px/1 var(--font-display, "Cormorant Garamond", serif); color: var(--aw-text); letter-spacing: 0.04em; }
.aw-score-bar .aw-btn { margin-left: auto; }
.aw-score-tools { display: flex; align-items: center; gap: 4px; }
.aw-score-tools .aw-mini { width: 30px; font-size: 17px; line-height: 1; }
.aw-score-tools .aw-mini.aw-danger { color: var(--aw-danger); border-color: var(--aw-danger); }
.aw-score-tools .aw-mini.aw-on { color: var(--aw-bg); background: var(--aw-accent); border-color: var(--aw-accent); }
.aw-score-scroll { flex: 1; min-height: 0; overflow: auto; background: #f4f1ea; padding: 18px; }
.aw-score-scroll svg { max-width: none; }
.aw-score-msg { padding: 24px; color: #555; font-size: 12.5px; font-family: var(--font-ui, Inter, sans-serif); }
.aw-score-scroll g.note { cursor: pointer; }
.aw-score-scroll g.note.aw-score-sel * { fill: var(--aw-accent); stroke: var(--aw-accent); }
.aw-score-scroll g.note.aw-score-play * { fill: #1f8f5f; stroke: #1f8f5f; }
.aw-auto-point { cursor: grab; transition: r .08s ease; }
.aw-auto-point:hover { fill: var(--aw-accent); r: 6; }
.aw-auto-svg:active .aw-auto-point { cursor: grabbing; }
.aw-auto-switch { position: absolute; right: 10px; top: 6px; display: flex; gap: 4px; }
.aw-auto-chip {
  cursor: pointer; padding: 2px 8px; border-radius: 5px;
  border: 1px solid var(--aw-line-strong); background: rgba(255,255,255,0.03);
  color: var(--aw-dim); font: 10.5px/1.4 var(--font-mono, Consolas, monospace);
}
.aw-auto-chip:hover { color: var(--aw-text); border-color: var(--aw-accent); }
.aw-auto-chip.aw-on { color: var(--aw-bg); background: var(--aw-accent); border-color: var(--aw-accent); }
.aw-auto-chip:focus-visible { outline: 2px solid var(--aw-accent); outline-offset: 2px; }
.aw-auto-tag {
  position: absolute; left: 10px; top: 6px;
  font: 10.5px/1 var(--font-mono, Consolas, monospace); color: var(--aw-dim);
  pointer-events: none;
}
.aw-lane-empty { padding: 16px 14px; color: var(--aw-dim); font-size: 11.5px; line-height: 1.6; }
.aw-lane-empty code {
  font-family: var(--font-mono, Consolas, monospace); color: var(--aw-text);
  background: rgba(255,255,255,0.05); padding: 1px 5px; border-radius: 4px;
}
.aw-stat-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 6px; }
.aw-stat { min-width: 0; padding: 8px; border: 1px solid var(--aw-line); border-radius: 6px; background: rgba(255,255,255,0.025); }
.aw-stat b,
.aw-stat span { display: block; }
.aw-stat b { color: var(--aw-text); font: 600 13px/1 var(--font-mono, Consolas, monospace); }
.aw-stat span { margin-top: 4px; color: var(--aw-dim); font-size: 9px; }
.aw-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.aw-btn { min-height: 34px; padding: 0 10px; border-color: var(--aw-line); background: rgba(255,255,255,0.025); }
.aw-btn.aw-danger { color: #ffb1b5; border-color: rgba(240,107,114,0.35); }
.aw-export-profile { width: 100%; height: 34px; margin-bottom: 7px; }
.aw-export-head .aw-help { margin: 0 0 10px; }
.aw-midi-state {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 9px;
  min-height: 34px;
  padding: 6px 8px;
  border-left: 3px solid var(--aw-ok);
  background: rgba(79,210,154,0.06);
}
.aw-midi-state b { font-size: 11px; }
.aw-midi-state span { min-width: 0; color: var(--aw-dim); font: 9.5px/1.35 var(--font-mono, Consolas, monospace); overflow-wrap: anywhere; }
.aw-midi-state.aw-midi-quantized { border-color: var(--aw-accent); background: rgba(240,168,0,0.07); }
.aw-midi-state.aw-midi-blocked { border-color: var(--aw-danger); background: rgba(240,107,114,0.07); }
.aw-midi-state.aw-midi-blocked b { color: #ffb1b5; }
.aw-section-title { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.aw-section-title span { color: var(--aw-dim); font-size: 9px; white-space: nowrap; }
.aw-midi-compare { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; margin-bottom: 8px; }
.aw-midi-compare .aw-btn.aw-on { color: var(--aw-text); border-color: rgba(240,168,0,0.52); background: rgba(240,168,0,0.1); }
.aw-midi-issues { border-top: 1px solid var(--aw-line); }
.aw-midi-issue {
  width: 100%;
  min-width: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  padding: 8px 2px;
  border: 0;
  border-bottom: 1px solid var(--aw-line);
  border-radius: 0;
  background: transparent;
  color: var(--aw-text);
  text-align: left;
}
.aw-midi-issue:hover,
.aw-midi-issue.aw-selected { background: rgba(255,255,255,0.04); }
.aw-midi-issue span,
.aw-midi-issue b,
.aw-midi-issue small { display: block; min-width: 0; }
.aw-midi-issue b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 10.5px; }
.aw-midi-issue small { margin-top: 3px; color: var(--aw-dim); font: 9px/1.35 var(--font-mono, Consolas, monospace); overflow-wrap: anywhere; }
.aw-midi-issue em { color: var(--aw-accent); font: 600 10px/1 var(--font-mono, Consolas, monospace); }
.aw-midi-losses { display: grid; gap: 7px; margin: 0; padding: 0; list-style: none; }
.aw-midi-losses li { display: grid; grid-template-columns: 22px minmax(0, 1fr); gap: 7px; color: var(--aw-dim); font-size: 10px; line-height: 1.4; }
.aw-midi-losses b { color: var(--aw-accent); font-family: var(--font-mono, Consolas, monospace); }
.aw-midi-clean { margin: 0; padding: 9px 0; color: var(--aw-ok); font-size: 10px; }

.aw-detail {
  grid-column: 2;
  grid-row: 2;
  min-width: 0;
  min-height: 0;
  border-top: 1px solid var(--aw-line-strong);
  background: #0e131c;
  display: grid;
  grid-template-rows: 32px minmax(0, 1fr);
}
.aw-detail-tabs { display: flex; align-items: center; gap: 2px; padding: 2px 8px; border-bottom: 1px solid var(--aw-line); }
.aw-segment { height: 27px; padding: 0 9px; }
.aw-segment.aw-active { color: var(--aw-text); background: rgba(255,255,255,0.075); }
.aw-lane-editor { position: relative; min-width: 0; min-height: 0; overflow: auto hidden; }
.aw-lane-content { position: relative; height: 148px; min-width: 100%; }
.aw-lane-content::before,
.aw-lane-content::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  height: 1px;
  background: var(--aw-line);
}
.aw-lane-content::before { top: 25%; }
.aw-lane-content::after { top: 75%; }
.aw-velocity-bar {
  position: absolute;
  bottom: 0;
  min-width: 4px;
  border: 0;
  border-radius: 2px 2px 0 0;
  background: rgba(240,168,0,0.58);
  cursor: ns-resize;
}
.aw-velocity-bar:hover,
.aw-velocity-bar.aw-selected { background: var(--aw-accent); }

.aw-statusbar {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 14px;
  min-width: 0;
  padding: 0 10px;
  border-top: 1px solid var(--aw-line-strong);
  background: #0b0f16;
  color: var(--aw-dim);
  font: 10px/1 var(--font-mono, Consolas, monospace);
}
.aw-status-message { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.aw-status-message.aw-error { color: #ff9fa5; }
.aw-status-message.aw-ok { color: var(--aw-ok); }
.aw-midi-status { white-space: nowrap; }
.aw-midi-status.aw-blocked { color: #ff9fa5; }
.aw-save-status { white-space: nowrap; }

.aw-empty { display: grid; place-items: center; height: 100%; color: var(--aw-dim); font-size: 12px; }
.aw-mobile-only { display: none; }

@media (max-width: 1050px) {
  .aw-topbar { grid-template-columns: auto minmax(130px, 1fr) auto auto; }
  .aw-history { display: none; }
  .aw-shell { grid-template-columns: 190px minmax(0, 1fr); }
  .aw-inspector {
    position: absolute;
    z-index: 30;
    top: 52px;
    right: 0;
    bottom: 26px;
    width: min(330px, 88vw);
    box-shadow: -18px 0 42px rgba(0,0,0,0.45);
    transform: translateX(102%);
    transition: transform 160ms ease;
  }
  #composerWorkspace.aw-inspector-open .aw-inspector { transform: translateX(0); }
  .aw-detail { grid-column: 2; }
  .aw-mobile-only { display: inline-grid; }
}

@media (max-width: 700px) {
  #composerWorkspace { grid-template-rows: 106px minmax(0, 1fr) 28px; }
  .aw-topbar {
    grid-template-columns: auto minmax(0, 1fr) auto;
    grid-template-rows: 46px 48px;
    gap: 3px 6px;
    padding: 5px 7px;
  }
  .aw-brand b { font-size: 16px; }
  .aw-project-title { grid-column: 2; }
  .aw-transport { grid-column: 1 / 3; grid-row: 2; justify-content: flex-start; gap: 4px; }
  .aw-global { grid-column: 3; grid-row: 1 / 3; gap: 4px; }
  .aw-global .aw-number,
  .aw-global .aw-meter { display: none; }
  /* ≥44px touch targets (vision §17.2) */
  .aw-icon { width: 44px; height: 44px; flex-basis: 44px; font-size: 17px; }
  .aw-global .aw-btn { width: 44px; height: 44px; overflow: hidden; padding: 0; font-size: 0; }
  /* import and export must read as distinct actions, not one ⇩ icon */
  .aw-global [data-action="import-midi"]::before { content: "📥"; font-size: 17px; }
  .aw-global [data-action="export"]::before { content: "📤"; font-size: 17px; }
  .aw-transport-time { min-width: 80px; font-size: 10px; }
  .aw-shell { display: block; position: relative; }
  .aw-tracks {
    position: absolute;
    z-index: 31;
    top: 0;
    left: 0;
    bottom: 0;
    width: min(250px, 86vw);
    box-shadow: 18px 0 42px rgba(0,0,0,0.48);
    transform: translateX(-102%);
    transition: transform 160ms ease;
  }
  #composerWorkspace.aw-tracks-open .aw-tracks { transform: translateX(0); }
  .aw-center { position: absolute; inset: 0 0 156px; grid-template-rows: 96px minmax(0, 1fr); }
  .aw-detail { position: absolute; left: 0; right: 0; bottom: 0; height: 156px; }
  .aw-inspector { top: 106px; bottom: 28px; }
  .aw-workbar {
    display: grid;
    grid-template-rows: 44px 44px;
    align-content: center;
    justify-content: stretch;
    gap: 2px;
    padding: 3px 5px;
  }
  .aw-views,
  .aw-tools { width: 100%; justify-content: flex-start; }
  .aw-views { gap: 4px; }
  .aw-view-btn { padding: 0 11px; height: 40px; }
  .aw-tools label,
  .aw-tools input[type="range"] { display: none; }
  .aw-tools .aw-gamma-control label { display: block; }
  .aw-tools .aw-gamma-control input[type="range"] { display: block; width: 58px; }
  .aw-gamma-control { grid-template-columns: auto 58px 29px; }
  .aw-tools .aw-select { width: 74px; }
  /* spiral has its own (id-specificity) workbar grid — keep it 44px-tall too */
  #composerWorkspace[data-composer-view="spiral"] .aw-center { grid-template-rows: 96px minmax(0, 1fr); }
  #composerWorkspace[data-composer-view="spiral"] .aw-workbar { grid-template-rows: 44px 44px; }
  .aw-spiral-modes .aw-segment { min-width: 54px; height: 40px; padding: 0 7px; }
  .aw-notes-layout { grid-template-columns: 68px minmax(0, 1fr); }
  .aw-palette-title { display: none; }
  .aw-palette-list { height: 100%; padding: 2px; }
  .aw-palette-note { grid-template-columns: 4px minmax(0, 1fr); min-height: 44px; gap: 4px; padding: 3px; }
  .aw-palette-note em,
  .aw-palette-note small { display: none; }
  .aw-lane-label { display: block; }
  .aw-spiral-wrap { display: block; }
  .aw-spiral-legend {
    position: absolute;
    z-index: 28;
    right: 0;
    top: 0;
    bottom: 0;
    display: block;
    width: min(286px, 92vw);
    box-shadow: -18px 0 42px rgba(0,0,0,0.48);
    transform: translateX(102%);
    transition: transform 160ms ease;
  }
  #composerWorkspace.aw-spiral-lab-open .aw-spiral-legend { transform: translateX(0); }
  .aw-statusbar { grid-template-columns: minmax(0, 1fr) auto; gap: 8px; }
  .aw-midi-status { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  .aw-inspector,
  .aw-tracks,
  .aw-spiral-legend { transition: none; }
}
