:root {
  color-scheme: dark;
  font-family: system-ui, -apple-system, "PingFang SC", "Microsoft YaHei", sans-serif;
  --background: #141619;
  --panel: #1c1f24;
  --inset: #171a1e;
  --surface: #262b31;
  --line: #363b42;
  --ink: #eef0ed;
  --soft: #b4bbc2;
  --quiet: #98a1aa;
  --accent: #d2f775;
  --accent-hover: #e1ff9e;
  --purple: #bdb0f4;
  background: var(--background);
  color: var(--ink);
}

*, *::before, *::after { box-sizing: border-box; }
body { margin: 0; }
button, input, select { font: inherit; }
button, select, input[type="checkbox"], input[type="range"] { cursor: pointer; }
button:disabled, select:disabled, input:disabled { cursor: default; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--purple); outline-offset: 3px; }

.masthead {
  border-bottom: 1px solid var(--line);
  background: #181b1f;
}

.masthead-inner, .workspace {
  width: min(100%, 1180px);
  margin: 0 auto;
  padding-inline: max(16px, env(safe-area-inset-left)) max(16px, env(safe-area-inset-right));
}

.masthead-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 64px;
  gap: 12px;
}

.brand { display: flex; align-items: center; gap: 10px; font-weight: 760; letter-spacing: .035em; }
.brand-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  gap: 2px;
  border-radius: 9px;
  color: var(--accent);
  background: #2c3420;
}
.brand-mark i { width: 2px; height: 6px; border-radius: 2px; background: currentColor; }
.brand-mark i:nth-child(2), .brand-mark i:nth-child(4) { height: 12px; }
.brand-mark i:nth-child(3) { height: 19px; }
.local-note { color: var(--soft); font-size: .78rem; white-space: nowrap; }
.local-note > span { display: inline-block; width: 6px; height: 6px; margin: 0 3px 2px 0; border-radius: 50%; background: var(--accent); }

.workspace { padding-block: clamp(24px, 5vw, 54px) max(24px, env(safe-area-inset-bottom)); }
.intro { display: flex; align-items: end; justify-content: space-between; flex-wrap: wrap; gap: 12px 20px; margin-bottom: clamp(20px, 4vw, 31px); }
h1, h2, h3, p { margin: 0; }
h1 { font-size: clamp(1.85rem, 5.4vw, 3.1rem); font-weight: 780; line-height: 1.13; letter-spacing: -.04em; }
.intro p { margin-top: 11px; color: var(--soft); font-size: clamp(.9rem, 2.4vw, 1.03rem); line-height: 1.6; }
#settings { width:min(500px,calc(100% - 24px)); max-height:min(78dvh,720px); padding:14px; background:var(--panel); border:1px solid var(--line); border-radius:15px; color:var(--ink); }
#settings[open] { display:flex; flex-direction:column; gap:10px; }
#settings::backdrop { background:#080b10bb; }
.settings-scroll { overflow:auto; overscroll-behavior:contain; min-height:0; }
.settings-scroll .panel { margin-bottom:8px; }
.settings-header,.settings-nav { display:flex; align-items:center; gap:6px; }
.settings-header { justify-content:space-between; }
.settings-nav button { flex:1; min-height:44px; border:1px solid var(--line); border-radius:7px; background:var(--inset); color:var(--soft); cursor:pointer; }
.settings-nav button[aria-pressed=true] { color:var(--accent); border-color:var(--accent); }
#settings-status { font-size:.84rem; color:var(--soft); }
#settings-status:empty { display:none; }
#listen-picker { color:var(--soft); font-size:.82rem; display:flex; align-items:center; gap:8px; margin:6px 0 10px; }
#listen-picker select { flex:1; min-width:0; max-width:28rem; }
.output-panel .transport-actions { display:flex; flex-wrap:wrap; }
.output-panel .transport-actions button { flex:1; }

.studio, .prep, .mix { display: grid; min-width: 0; align-content: start; gap: 14px; }
.panel {
  min-width: 0;
  padding: clamp(14px, 3vw, 22px);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 15px;
}
h2 { font-size: 1.13rem; font-weight: 720; line-height: 1.4; }
h3, .stack-label, .range-label { font-size: .86rem; font-weight: 650; }
.section-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 12px; margin-bottom: 12px; }
.section-head h2 { padding-block: 9px; }
.stack-label { display: block; margin-bottom: 7px; color: var(--soft); }

.button, .track-list button, .variant-list button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-width: 0;
  min-height: 44px;
  padding: 9px 11px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--ink);
  font-size: .86rem;
  font-weight: 650;
  line-height: 1.3;
  text-align: center;
  text-decoration: none;
}
.button.quiet { background: transparent; color: var(--soft); }
.button.primary { background: var(--accent); border-color: var(--accent); color: #202714; font-weight: 750; }
.button:disabled, .track-list button:disabled, .variant-list button:disabled { opacity: .48; }
.button.primary:disabled { background: #2d3525; border-color: #566041; color: #c7d6a9; opacity: .76; }
@media (hover: hover) {
  .button:not(:disabled):hover, .track-list button:not(:disabled):hover, .variant-list button:not(:disabled):hover { border-color: #79818a; background: #30363d; }
  .button.primary:not(:disabled):hover { border-color: var(--accent-hover); background: var(--accent-hover); }
}

.import-actions, .transport-actions, .shift-buttons { display: grid; gap: 8px; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.plus { font-size: 1.21rem; font-weight: 500; line-height: .9; }
.file-picker { position: relative; min-width: 0; }
.file-picker input { position: absolute; width: 1px; height: 1px; padding: 0; margin: 0; clip-path: inset(50%); overflow: hidden; }
.file-picker label { width: 100%; cursor: pointer; }
.file-picker input:focus-visible + label { outline: 2px solid var(--purple); outline-offset: 3px; }
.file-picker input:disabled + label { background: #2d3525; border-color: #566041; color: #c7d6a9; opacity: .76; cursor: default; }
.track-list { display: grid; gap: 8px; margin: 12px 0 0; padding: 0; list-style: none; counter-reset: tracks; }
.track-list:empty { display: none; }
.empty-tracks, .empty-variants { color: var(--quiet); font-size: .85rem; line-height: 1.6; }
.empty-tracks { padding: 16px 12px; border: 1px dashed var(--line); border-radius: 8px; text-align: center; }
.track-item {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  min-width: 0;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--inset);
  counter-increment: tracks;
}
.track-item::before { color: var(--accent); content: counter(tracks, decimal-leading-zero); font: 600 .75rem ui-monospace, monospace; }
.track-body { display: grid; min-width: 0; gap: 3px; }
.track-title { color: var(--ink); font-size: .86rem; overflow-wrap: anywhere; }
.track-meta { color: var(--quiet); font-size: .75rem; font-variant-numeric: tabular-nums; }
.track-actions { display: flex; flex-wrap: wrap; justify-content: end; gap: 4px; }
.track-actions button { min-width: 38px; padding: 5px 6px; font-size: .77rem; }

.preferences { padding-block: 0; }
.preferences summary { position: relative; display: flex; align-items: center; min-height: 56px; padding-right: 24px; font-weight: 700; cursor: pointer; list-style: none; }
.preferences summary::-webkit-details-marker { display: none; }
.preferences summary::after {
  position: absolute;
  right: 2px;
  width: 8px;
  height: 8px;
  border-right: 2px solid var(--quiet);
  border-bottom: 2px solid var(--quiet);
  content: "";
  transform: translateY(-2px) rotate(45deg);
}
.preferences[open] summary::after { transform: translateY(2px) rotate(225deg); }
.preference-content { padding: 5px 0 16px; }
.range-field { margin-bottom: 15px; }
.range-label, .range-caption { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.range-label output { color: var(--accent); font-size: .8rem; font-variant-numeric: tabular-nums; }
.range-caption { color: var(--quiet); font-size: .75rem; }
input[type="range"] { display: block; width: 100%; height: 32px; margin: 0; accent-color: var(--accent); }
select {
  display: block;
  width: 100%;
  max-width: 100%;
  min-height: 44px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--inset);
  color: var(--ink);
  font-size: 1rem;
  text-overflow: ellipsis;
}
select:disabled { color: var(--quiet); }

.waveform-panel {
  overflow: hidden;
  margin-block: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--inset);
}
.waveform-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px 14px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  color: var(--soft);
  font-size: .75rem;
}
.waveform-legend { display: flex; gap: 10px; }
.waveform-legend span { display: flex; align-items: center; gap: 5px; }
.swatch { width: 7px; height: 7px; border-radius: 2px; background: var(--accent); }
.swatch.incoming { background: var(--purple); }
#waveform {
  display: block;
  width: 100%;
  height: auto;
  min-height: 108px;
  background: linear-gradient(to right, #272b31 1px, transparent 1px) 0 0 / 12.5% 100%,
              linear-gradient(to bottom, #272b31 1px, transparent 1px) 0 0 / 100% 25%, var(--inset);
}
.variant-list { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 128px), 1fr)); gap: 8px; margin-top: 8px; }
.variant-list button { display: grid; justify-content: stretch; gap: 5px; min-width: 0; text-align: left; }
.variant-list button span { color: var(--soft); font-size: .76rem; font-weight: 500; }
.variant-list button[aria-pressed="true"], .variant-list button.active, .variant-list button.selected { border-color: var(--accent); background: #303924; }
.empty-variants { grid-column: 1 / -1; }
.chosen-plan { margin:8px 0; font-weight:600; }
#plan-options summary { color:var(--soft); padding-block:12px; cursor:pointer; }
#auto-plan { margin-top:8px; }
.track-speed { grid-column:1 / -1; display:flex; align-items:center; gap:12px; color:var(--soft); font-size:.85rem; }
.track-bpm-open { flex:1; min-width:0; display:flex; align-items:center; justify-content:space-between; gap:8px; text-align:left; }
.track-bpm-open::after { content:'↕'; color:var(--accent); font-size:1.1rem; }
.track-speed-note { grid-column:1 / -1; color:var(--soft); font-size:.8rem; }
#bpm-picker {
  width:min(350px,calc(100vw - 28px)); max-height:calc(100dvh - 24px); padding:18px;
  margin:auto; border:1px solid #576052; border-radius:14px; background:var(--panel);
  color:var(--ink); box-shadow:0 16px 60px #0009; overflow:auto;
}
#bpm-picker::backdrop { background:#0a0d10ab; }
.bpm-picker-head { display:flex; align-items:center; justify-content:space-between; gap:8px; }
.bpm-picker-head h2 { margin:0; font-size:1.15rem; }
#bpm-picker-track { overflow-wrap:anywhere; margin:10px 0 2px; font-size:.9rem; }
#bpm-picker-hint { color:var(--soft); margin:0 0 12px; font-size:.82rem; }
#bpm-picker-error:empty { display:none; }
#bpm-picker-error { margin-top:8px; font-size:.85rem; }
.bpm-fine { display:flex; gap:8px; margin-top:10px; }
.bpm-fine button { flex:1; min-height:44px; font-variant-numeric:tabular-nums; }
.bpm-wheel-wrap { --bpm-row:44px; --bpm-pad:88px; position:relative; border:1px solid var(--line); border-radius:10px; background:var(--inset); }
.bpm-wheel-wrap::after { content:''; position:absolute; pointer-events:none; top:50%; left:3px; right:3px; height:var(--bpm-row); transform:translateY(-50%); border-block:1px solid #718752; background:#a8cf6310; }
#bpm-wheel { height:calc(var(--bpm-pad) + var(--bpm-row) + var(--bpm-pad)); overflow-y:auto; overscroll-behavior-y:contain; scroll-snap-type:y mandatory; touch-action:pan-y; scrollbar-width:thin; border-radius:inherit; }
#bpm-wheel::before,#bpm-wheel::after { content:''; display:block; height:var(--bpm-pad); }
#bpm-wheel [role="option"] { min-width:0; height:var(--bpm-row); display:grid; place-items:center; padding:0 7px; scroll-snap-align:center; color:var(--soft); font-variant-numeric:tabular-nums; cursor:pointer; user-select:none; }
#bpm-wheel [aria-selected="true"] { color:var(--accent); font-weight:750; }
@media (max-height:460px) { .bpm-wheel-wrap { --bpm-pad:44px; } }
.adjustments { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; margin-block: 14px; }
.shift-buttons { flex: 1 1 195px; }
.lock-control { display: inline-flex; align-items: center; gap: 7px; min-height: 44px; color: var(--soft); font-size: .82rem; white-space: nowrap; cursor: pointer; }
.lock-control input { width: 17px; height: 17px; margin: 0; accent-color: var(--accent); }
.play-mark { width: 0; height: 0; border-top: 5px solid transparent; border-bottom: 5px solid transparent; border-left: 8px solid currentColor; }

.output-panel { display: grid; gap: 11px; }
#output-feedback:empty, #status:empty { display:none; }
#transport-feedback { display:flex; flex-wrap:wrap; align-items:center; gap:4px 10px; }
#transport-feedback #status { flex:1 1 180px; }
#transport-feedback #progress { flex:1 0 100%; }
#transport-feedback #stop { order:1; }
#edit-feedback:not(:empty) #status:not(:empty), #edit-feedback #stop:not([hidden]) { margin-top:8px; }
.transport-actions { grid-template-columns: minmax(0, 1fr) auto minmax(0, 1.1fr); }
.transport-actions #stop { padding-inline: 12px; }
#player { display: none; }
#progress { display: block; width: 100%; height: 8px; accent-color: var(--accent); }
#status { min-height: 1.45em; color: var(--soft); font-size: .83rem; line-height: 1.55; overflow-wrap: anywhere; }
#download { justify-self: start; }

input[type="text"], input[type="number"] {
  display: block;
  width: 100%;
  min-width: 0;
  min-height: 44px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--inset);
  color: var(--ink);
  font-size: 1rem;
}
input::placeholder { color: var(--quiet); }
.course-panel h2, .duration-panel h2, .review-panel h2 { margin-bottom: 12px; }
.course-actions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; margin: 8px 0 12px; }
.course-open { grid-template-columns: minmax(0, 1fr) auto; margin: 0; }
#course-note { margin: 8px 0 0; }
#duration-info { display: block; margin-top: 9px; color: var(--soft); font-size: .84rem; line-height: 1.5; }
#review-list { display: grid; gap: 8px; }
#review-list button { min-width: 0; min-height: 44px; overflow-wrap: anywhere; }

.track-settings { grid-column: 1 / -1; margin-top: 3px; border-top: 1px solid var(--line); }
.track-settings summary { display: flex; align-items: center; min-height: 44px; gap: 7px; padding: 3px 4px; color: var(--soft); font-size: .8rem; cursor: pointer; }
.track-settings summary::before { content: '▸'; color: var(--accent); }
.track-settings[open] summary::before { content: '▾'; }
.settings-form { display: grid; gap: 8px; padding: 2px 3px 6px; min-width: 0; }
.settings-form label { display: grid; gap: 4px; color: var(--soft); font-size: .8rem; }
.settings-form audio, .settings-form canvas { display: block; width: 100%; max-width: 100%; min-width: 0; }
.track-settings input[type="file"] { display: block; width: 100%; max-width: 100%; margin-top: 5px; font-size: .81rem; }
.track-selection { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; }

.markers-panel, #marker-form { display: grid; gap: 10px; }
#marker-form { grid-template-columns: minmax(0, 1fr); }
#marker-form > .stack-label { margin: 0 0 -3px; }
.marker-fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.marker-fields > div { min-width: 0; }
.marker-help { color: var(--soft); font-size: .83rem; line-height: 1.55; }
#marker-message:empty, .marker-list:empty { display: none; }
.marker-list { display: grid; gap: 7px; margin: 0; padding: 0; list-style: none; }
.marker-list li { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 12px; padding: 9px; border: 1px solid var(--line); border-radius: 8px; background: var(--inset); }
.marker-list li > div:first-child { flex: 1 1 175px; min-width: 0; overflow-wrap: anywhere; }
.marker-list strong { font-size: .86rem; }
.marker-list li p { margin-top: 4px; color: var(--soft); font-size: .76rem; line-height: 1.5; }
.marker-actions { display: flex; flex-wrap: wrap; gap: 6px; }
.marker-cue { padding: 9px 12px; border: 1px solid var(--accent); border-radius: 8px; background: #2c3521; color: var(--accent); font-weight: 730; overflow-wrap: anywhere; }
.playback-actions { display:flex; flex-wrap:wrap; align-items:center; gap:8px; margin:10px 0; }
#settings[data-quick-plan] #pane-blends { display:flex; flex-direction:column; }
#settings[data-quick-plan] .mix-panel > :not(.variant-control),
#settings[data-quick-plan] .review-panel,
#settings[data-quick-plan] #variants-heading,
#settings[data-quick-plan] #plan-options > summary { display:none; }
#settings[data-quick-plan] .mix-panel > #blend-editor-slot { display:block; }
#settings[data-quick-plan] #mix-preferences { order:-1; }
#settings[data-quick-plan] .adjustments { display:none; }
#settings[data-quick-plan]:has(#lock:checked) .adjustments { display:flex; }
#settings[data-quick-plan] .shift-buttons { display:none; }
#quick-plan-pair { margin:0 0 10px; color:var(--ink); font-weight:650; overflow-wrap:anywhere; }
.preferences-scope { margin:0 0 12px; color:var(--soft); font-size:.83rem; }
#audition-plan { flex:none; }

.timeline { border: 1px solid var(--line); border-radius: 12px; padding: 14px; background: var(--inset); min-width: 0; }
.timeline-head,.source-title { display:flex; justify-content:space-between; align-items:baseline; gap:8px; }
.timeline-head { margin-bottom:10px; flex-wrap:wrap; }
.timeline-head span,.source-clock,.jump-time { font-variant-numeric:tabular-nums; color:var(--soft); font-size:.82rem; }
#arranger .timeline { margin-top:6px; }
#now-tracks { display:grid; gap:8px; min-width:0; }
.source-row { min-width:0; border-left:3px solid var(--track-color); padding:2px 0 2px 9px; }
.song-name, #clip-context { min-width:0; max-width:24ch; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.song-pair { display:inline-flex; align-items:baseline; gap:.3em; min-width:0; max-width:100%; vertical-align:bottom; }
.song-pair .song-name { max-width:min(18ch,34vw); }
.jump-name { min-width:0; }
.source-title small { color:var(--soft); white-space:nowrap; }
#library-message { margin-top:8px; color:var(--soft); font-size:.83rem; }
#library-message:empty { display:none; }
#transition-list { margin-top:13px; border-top:1px solid var(--line); padding-top:4px; }
#transition-list summary { padding-block:10px; cursor:pointer; font-size:.88rem; }
#jump-list { display:grid; gap:5px; }
.jump-seam { min-width:0; text-align:left; border:1px solid var(--line); background:var(--surface); color:var(--ink); border-radius:6px; padding:8px; display:grid; gap:3px; min-height:44px; }
.jump-seam[aria-current=true] { border-color:var(--accent); }

.library-panel, .arranger-panel { background: linear-gradient(160deg, #20242a, var(--panel) 75%); }
.library-panel .section-head, .arranger-panel .section-head, .output-panel .section-head { margin: 0 0 10px; }
.library-panel .section-head h2, .arranger-panel .section-head h2, .output-panel .section-head h2 { padding: 0; }
.output-panel .section-head { margin: 0; }
.desk-value { color: var(--soft); font-size: .81rem; font-variant-numeric: tabular-nums; }
.desk-value:empty { display: none; }
.library-empty {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 12px;
  padding: 11px;
  border: 1px dashed #424953;
  border-radius: 9px;
  color: var(--quiet);
  font-size: .8rem;
  line-height: 1.5;
}
#queue { display: grid; list-style: none; margin: 12px 0 0; padding: 0; gap: 6px; }
#queue:empty { display: none; }
#queue:not([hidden]):not(:empty) + .library-empty { display: none; }
#queue .library-item { min-width: 0; display:grid; grid-template-columns:minmax(0,1fr) auto; gap:5px; }
.library-remove {
  align-self:stretch; min-width:44px; min-height:44px; padding:0 7px;
  color:var(--soft); background:var(--inset); border:1px solid #414754;
  border-radius:8px; font:inherit; font-size:.78rem; cursor:pointer;
}
.library-remove:focus-visible, .library-remove:hover { color:var(--ink); border-color:var(--soft); }
.library-undo { max-width:100%; margin-top:8px; overflow:hidden; white-space:nowrap; text-overflow:ellipsis; }
.file-symbol, .empty-sequence { flex: 0 0 auto; display: grid; place-items: center; color: var(--accent); border: 1px solid #525e3c; background: #2c3424; }
.file-symbol { width: 32px; height: 32px; border-radius: 6px; font-size: 1.02rem; }
.library-pick {
  display: grid;
  position: relative;
  align-items: center;
  gap: 4px 8px;
  width: 100%;
  min-height: 50px;
  padding: 7px 24px 7px 10px;
  border: 1px solid #414754;
  border-radius: 8px;
  background: var(--inset);
  color: var(--ink);
  text-align: left;
  overflow: hidden;
}
.library-pick[draggable="true"] { cursor: grab; }
.library-pick::after { content: ''; position: absolute; top: 50%; right: 9px; width: 6px; height: 14px; transform: translateY(-50%); background: radial-gradient(circle, var(--quiet) 1px, transparent 1.4px) 0 0 / 3px 4px; }
.library-pick[aria-pressed="true"], .library-pick.selected, .library-item.selected > .library-pick { border-color: var(--accent); background: #303924; }
@media (hover: hover) { .library-pick:hover { border-color: #929aa5; } }
.library-name { grid-column: 1; display: block; color: inherit; font-size: .86rem; font-weight: 720; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.library-meta { grid-column: 1; color: var(--soft); font-size: .75rem; line-height: 1.3; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.library-thumb { grid-column: 2; grid-row: 1 / span 2; align-self: stretch; width: 56px; height: 34px; opacity: .85; }
.library-thumb,.arr-grip { touch-action:none; }
.arr-grip { position:absolute; right:0; top:0; bottom:0; width:24px; background:radial-gradient(circle,#20272c88 1px, transparent 1.5px) center / 4px 5px; background-clip:content-box; padding:13px 8px; }
#beat-result { margin:8px 0 0; }
#beat-result:empty { display:none; }

.arrange-help { margin-bottom: 13px; color: var(--soft); font-size: .83rem; line-height: 1.5; }
.arranger-heading { display: grid; gap: 3px; }
.arranger-toolbar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 7px 12px; margin-bottom: 8px; }
.arranger-toolbar .arrange-help { flex: 1 1 160px; margin: 0; }
.zoom-tools { display:flex; align-items:center; flex:1 1 245px; max-width:350px; gap:6px; color:var(--soft); font-size:.8rem; }
.zoom-tools label,.zoom-tools .button { flex:none; }
#timeline-zoom { flex:1; min-width:0; height:44px; touch-action:pan-y; }
.zoom-tools .button { min-height: 44px; padding-inline: 8px; }
.zoom-label { min-width:4em; color:var(--soft); font-size:.78rem; font-variant-numeric:tabular-nums; text-align:center; }
.arrange-seek { display:flex; align-items:center; gap:9px; padding-inline:2px; color:var(--soft); font-size:.8rem; }
.arrange-seek label { flex:none; }
#timeline-seek { flex:1; min-width:0; height:44px; }
.clip-tools { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 7px 12px; margin-top: 9px; padding: 5px 6px 5px 10px; border: 1px solid #4c5348; border-radius: 8px; background: var(--inset); }
#clip-tools { display:block; padding:6px 9px; }
.clip-tool-row { display:flex; align-items:center; flex-wrap:nowrap; gap:4px; }
#clip-song-settings { border-top:1px solid var(--line); padding:8px 3px 2px 0; min-width:0; }
#clip-song-settings .track-bpm-open { flex:1; }
#clip-song-settings .track-settings { margin-top:6px; }
#clip-context { flex:1; max-width:none; color:var(--soft); font-size:.83rem; font-weight:650; }
.clip-tool-row .button { flex:none; min-width:44px; padding-inline:6px; }
#place-slots { display:block; box-sizing:border-box; width:100%; min-height:44px; margin:5px 0 8px; padding-inline:12px; }
#clip-remove { color: #ffc2a6; }
.seam-context { flex: 1 1 155px; min-width: 0; overflow-wrap: anywhere; }
#seam-tools { position:relative; padding-right:34px; }
#deselect-seam { position:absolute; top:0; right:0; width:34px; height:36px; border:0; background:transparent; color:var(--soft); font-size:1.25rem; cursor:pointer; }
#seam-context { color: var(--ink); font-size: .85rem; font-weight: 680; }
#seam-plan { margin-top: 3px; color: var(--soft); font-size: .76rem; }
.seam-tool-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 4px; }
#inline-seam-slot { flex:1 0 100%; min-width:0; padding-top:6px; border-top:1px solid var(--line); }
.seam-editor { display:flex; flex-direction:column; gap:8px; min-width:0; }
.seam-editor .adjustments { margin:0; }
.seam-editor-actions { display:flex; align-items:center; flex-wrap:wrap; gap:6px; }
#inline-seam-slot :is(.lock-control,#chosen-plan,#variants-heading) { display:none; }
#inline-seam-slot #mix-preferences { padding-inline:10px; }
#inline-seam-slot #mix-preferences summary { min-height:44px; font-size:.86rem; }
#inline-seam-slot .variant-list { margin-top:0; }
#lock-seam[aria-pressed=true] { border-color: var(--accent); color: var(--accent); }
#arrange-scroll { overflow-x: auto; overflow-y: hidden; min-width: 0; border: 1px solid #3a404b; border-radius: 10px; background: #14171d; scrollbar-color: #64706d #171a20; }
#arrange-surface {
  position: relative;
  isolation: isolate;
  min-width: 100%;
  height: 158px;
  background: linear-gradient(to bottom, #20252d 0 26px, transparent 26px 88px, #1b2028 88px 89px, transparent 89px),
              repeating-linear-gradient(to right, #2b323b 0 1px, transparent 1px 52px), #141920;
}
#arrange-ruler, #arrange-clips, #arrange-seams { position: absolute; inset: 0; }
#arrange-ruler { z-index: 2; height: 27px; border-bottom: 1px solid #39414c; color: var(--soft); font: 650 .72rem/1.2 ui-monospace, monospace; pointer-events: none; }
.arr-tick, #arrange-ruler > span { position: absolute; top: 4px; height: 22px; padding-left: 5px; border-left: 1px solid #657284; white-space: nowrap; }
.arr-clip { position: absolute; height: 52px; min-width: 0; overflow: hidden; padding: 5px 7px; border: 1px solid #ffffff24; border-radius: 6px; background: var(--track-color, #b8db70); color: #172016; font-size: .78rem; font-weight: 800; text-align: left; }
.arr-clip:nth-child(even) { background: var(--track-color, #b9a9f1); }
.arr-clip[draggable="true"] { cursor: grab; }
.arr-clip[aria-pressed="true"], .arr-clip.selected { z-index: 1; outline: 2px solid var(--ink); outline-offset: -3px; }
.arr-clip canvas { position: absolute; inset: 12px 0 0; width: 100%; height: calc(100% - 12px); opacity: .42; pointer-events: none; }
.arr-clip .arr-beat-grid { inset: auto auto 0 0; width: auto; height: 33px; opacity: 1; pointer-events: none; }
.beat-grid-uncertain { position: absolute; left: calc(6px + var(--clip-label-inset, 0px)); bottom: 4px; max-width: max(0px, calc(100% - 29px - var(--clip-label-inset, 0px))); overflow: hidden; padding: 2px 4px; border-radius: 3px; background: #222a2b; color: #f5f5d1; font-size: .66rem; text-overflow: ellipsis; white-space: nowrap; pointer-events: none; }
.beat-grid-legend { display: flex; align-items: end; flex-wrap: wrap; gap: 4px 10px; padding: 7px 1px 0; color: var(--soft); font-size: .72rem; line-height: 1.35; }
.beat-grid-legend span { display: inline-flex; align-items: end; gap: 4px; }
.beat-grid-legend i { display: inline-block; width: 1px; margin-bottom: 1px; background: var(--soft); }
.beat-grid-legend .grid-phrase { width: 2px; height: 12px; }
.beat-grid-legend .grid-eight { height: 8px; }
.beat-grid-legend .grid-beat { height: 4px; }
.arr-name { position: absolute; z-index: 1; top: 5px; left: calc(7px + var(--clip-label-inset, 0px)); max-width: min(24ch,max(0px, calc(100% - 31px - var(--clip-label-inset, 0px)))); padding-inline: 2px; border-radius: 3px; background: #f5f4df7a; white-space: nowrap; text-overflow: ellipsis; overflow: hidden; pointer-events: none; }
#arrange-seams { pointer-events: none; }
.seam-audition { position:absolute; left:50%; top:50%; transform:translate(-50%,-50%); z-index:2; width:27px; height:27px; padding:0; border-radius:50%; background:#1a2027; color:#eef2df; border:1px solid #c7d1b8; cursor:pointer; pointer-events:auto; font-size:0; }
.seam-audition::before { content:''; position:absolute; width:10px; height:12px; top:50%; left:50%; transform:translate(-42%,-50%); background:currentColor; clip-path:polygon(0 0,100% 50%,0 100%); }
.seam-audition::after { content:''; position:absolute; inset:-7px; }
.seam-audition.is-playing::before { width:9px; height:10px; transform:translate(-50%,-50%); clip-path:none; background:linear-gradient(to right,currentColor 0 3px,transparent 3px 6px,currentColor 6px); }
.seam-audition:disabled { opacity:.55; }
.seam-slip { position:absolute; z-index:2; left:0; bottom:0; width:27px; height:29px; padding:0; border:1px solid #e6ebdfc9; border-radius:6px 6px 6px 0; background:#202832; color:#f1f3e8; cursor:ew-resize; touch-action:none; pointer-events:auto; font-size:0; }
.seam-slip::before, .seam-slip::after { content:''; position:absolute; top:50%; width:7px; height:7px; border-top:1px solid currentColor; border-left:1px solid currentColor; }
.seam-slip::before { left:5px; transform:translateY(-50%) rotate(-45deg); }
.seam-slip::after { right:5px; transform:translateY(-50%) rotate(135deg); }
.seam-slip:focus-visible { outline-offset:-3px; }
#tail-ghost { position:absolute; z-index:1; height:52px; overflow:hidden; border:1px dashed var(--track-color,#c0c7c9); border-radius:6px; background:repeating-linear-gradient(135deg,#ccd1df25 0 2px,transparent 2px 7px),#252a34b5; opacity:.8; pointer-events:none; }
#tail-ghost canvas { width:100%; height:100%; opacity:.45; }
#audition-window { position:absolute; z-index:2; inset-block:27px 0; border:1px solid #dcd1ff; border-block:2px solid #bdb0f4bb; background:#bdb0f418; pointer-events:none; }
#action-pins { position:absolute; z-index:2; inset:27px 0 0; pointer-events:none; }
.action-pin { position:absolute; top:0; height:100%; width:1px; background:#ffac60; }
.action-pin::before { content:''; display:block; width:8px; height:7px; background:#ffac60; clip-path:polygon(0 0,100% 0,0 100%); }
#arrange-playhead { position:absolute; top:0; bottom:0; width:12px; padding:0; border:none; background:transparent; transform:translateX(-50%); z-index:3; cursor:ew-resize; touch-action:none; }
#arrange-playhead::before { content:''; position:absolute; left:50%; top:15px; bottom:0; width:2px; transform:translateX(-50%); background:white; box-shadow:0 0 2px #172016; }
#arrange-playhead::after { content:''; position:absolute; top:0; left:50%; width:23px; height:23px; transform:translateX(-50%); background:#f3f8ec; clip-path:polygon(10% 5%,90% 5%,90% 55%,50% 95%,10% 55%); }
#arrange-surface.is-scrubbing { cursor:ew-resize; user-select:none; }
#arrange-surface.is-scrubbing #arrange-playhead::after { background:var(--accent); }
#arrange-ruler { touch-action:none; }
#arrange-surface.can-seek #arrange-ruler { pointer-events:auto; cursor:ew-resize; }
.arr-seam, #arrange-seams > span { position: absolute; inset-block: 27px 0; min-width: 1px; border-inline: 1px solid #fff9; background: repeating-linear-gradient(125deg, transparent 0 5px, #f2eeff55 5px 7px); }
.arr-seam.is-selected { border-inline-color: var(--accent); background: repeating-linear-gradient(125deg,#19250d48 0 5px,#e0ff9f99 5px 7px); }
.seam-select { position: absolute; inset: 0 auto 0 50%; width: 100%; min-width: 22px; transform: translateX(-50%); padding: 0; border: 0; border-radius: 3px; background: transparent; pointer-events: auto; cursor: pointer; }
.seam-select:focus-visible { background: #caff7733; outline-offset: -2px; }
@media (hover: hover) { .seam-select:hover { background: #e0ff9f30; } }
#drop-line { position: absolute; z-index: 4; inset-block: 26px 0; width: 3px; background: #f2ffb4; box-shadow: 0 0 8px #d2f775a8; pointer-events: none; }
#drop-line::before { content: ''; position: absolute; top: 0; left: -4px; width: 11px; height: 8px; clip-path: polygon(0 0,100% 0,50% 100%); background: #f2ffb4; }
#arrange-empty { position: absolute; inset: 27px 0 0; display: grid; justify-items: center; align-content: center; gap: 5px; padding: 7px; background: radial-gradient(ellipse, #141920 12%, #14192000 78%); color: var(--soft); font-size: .78rem; text-align: center; pointer-events: none; }
#arrange-empty strong { color: var(--ink); font-size: .94rem; }
.empty-sequence { width: 34px; height: 27px; margin-bottom: 2px; border-radius: 5px; }
.empty-sequence::before, .empty-sequence::after { content: ''; width: 16px; height: 4px; border: 1px solid currentColor; border-radius: 2px; }
.empty-sequence::before { margin: 5px 5px 0 0; }
.empty-sequence::after { margin: 0 0 5px 5px; }
#drop-feedback { margin-top: 8px; color: var(--soft); font-size: .83rem; line-height: 1.5; overflow-wrap: anywhere; }
#drop-feedback:empty { display: none; }

@media (min-width: 530px) {
  .masthead-inner, .workspace { padding-inline: 24px; }
  .shift-buttons { flex-grow: 0; }
}

@media (min-width: 830px) {
  .masthead-inner, .workspace { padding-inline: 36px; }
  .studio { grid-template-columns: minmax(245px, 1fr) minmax(0, 2.35fr); align-items: start; }
  .studio, .prep, .mix { gap: 14px; }
}
