/* Analyze studio — sleek fixed workspace */

.studio-body {
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
  background: #000;
}

.studio-body::before {
  opacity: 0.06;
}

.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;
}

.studio {
  --studio-rail-width: 300px;
  --studio-top-height: 52px;
  --studio-gutter: 20px;
  /* Live cue — teal for analyzing/live; chrome stays monochrome */
  --signal: var(--teal);
  --signal-faint: var(--teal-soft);
  position: relative;
  height: 100%;
  display: grid;
  grid-template-rows: var(--studio-top-height) 1fr;
  min-height: 0;
}

/* —— Top bar —— */
.studio-top {
  display: grid;
  /* Logo column matches source rail so the vertical rule continues through the header */
  grid-template-columns: var(--studio-rail-width) minmax(0, 1fr) auto;
  align-items: stretch;
  padding: 0;
  border-bottom: 1px solid var(--studio-rule);
  background: #000;
  /* Above stage chrome so the account menu (incl. Log out) stays clickable */
  z-index: 40;
  position: relative;
}

.studio-brand {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 4px;
  padding: 0 10px 0 14px;
  border-right: 1px solid var(--studio-rule);
  min-width: 0;
}

.studio-logo {
  display: flex;
  align-items: center;
  min-width: 0;
  flex: 1 1 auto;
}

.studio-logo .logo-word {
  font-size: var(--text-lg);
  font-weight: 700;
  letter-spacing: -0.04em;
  opacity: 1;
}

.studio-logo .logo-mark {
  opacity: 0.9;
  width: 30px;
  height: 14px;
}

.studio-tabs {
  display: flex;
  align-items: stretch;
  gap: 0;
  justify-self: stretch;
  min-width: 0;
  overflow-x: auto;
  scrollbar-width: none;
}

.studio-tabs::-webkit-scrollbar {
  display: none;
}

.studio-tab {
  appearance: none;
  border: none;
  background: transparent;
  color: #7e7e7e;
  font-family: var(--font-ui);
  font-size: var(--text-base);
  font-weight: var(--weight-medium);
  letter-spacing: var(--tracking-body);
  padding: 0 16px;
  cursor: pointer;
  position: relative;
  transition: color 0.18s var(--ease-out);
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex: 0 0 auto;
  height: 100%;
  line-height: 1;
}

.studio-tab .tab-tag {
  font-size: var(--text-xs);
  font-weight: var(--weight-semibold);
  letter-spacing: var(--tracking-label);
  text-transform: uppercase;
  color: #6a6a6a;
  border: 1px solid #3a3a3a;
  padding: 2px 5px;
  line-height: 1;
  border-radius: 3px;
}

.studio-tab.is-locked-feature .tab-tag {
  color: #9a9a9a;
  border-color: #4a4a4a;
}

.studio-tab:not(.is-locked-feature):not(:disabled) .tab-tag {
  display: none;
}

.studio-tab[aria-pressed="true"] .tab-tag {
  color: #c8c8c8;
  border-color: #5a5a5a;
}

.studio-tab:disabled {
  display: none;
}

.studio-tab:not(:disabled):hover {
  color: #d8d8d8;
}

.studio-tab[aria-pressed="true"] {
  color: #f5f5f5;
}

.studio-tab[aria-pressed="true"]::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: -1px;
  height: 2px;
  background: #e8e8e8;
}

.studio-top-end {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  padding: 0 var(--studio-gutter);
  min-width: 0;
}

.studio .nav-quota {
  display: none;
}

.studio .account-menu-trigger {
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: #d0d0d0;
  height: 36px;
  padding: 0 12px 0 4px;
  font-size: var(--text-sm);
  font-weight: var(--weight-medium);
}

.studio .account-menu-trigger:hover {
  background: rgba(255, 255, 255, 0.04);
  color: #f2f2f2;
}

.studio .nav-links a {
  font-size: 0.8125rem;
  padding: 7px 10px;
}

.studio .nav-cta {
  background: #f2f2f2 !important;
  color: #0a0a0a !important;
  padding: 7px 13px !important;
  font-size: 0.8125rem !important;
}

/* —— Grid —— */
.studio-grid {
  display: grid;
  grid-template-columns: var(--studio-rail-width) 1fr;
  min-height: 0;
  height: 100%;
  transition: grid-template-columns 0.28s ease;
}

/* Reference upload / library only on Chain — other tabs are analysis-only */
.studio:not([data-studio-view="chain"]) .studio-source {
  display: none !important;
}

.studio:not([data-studio-view="chain"]) .studio-grid {
  grid-template-columns: minmax(0, 1fr);
}

.studio:not([data-studio-view="chain"]) .source-collapse {
  display: none !important;
}

@media (prefers-reduced-motion: reduce) {
  .studio-grid {
    transition: none;
  }
}

/* —— Source rail —— */
.studio-source {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 0;
  padding: 0;
  border-right: 1px solid var(--studio-rule);
  background: #000;
  min-height: 0;
  min-width: 0;
  overflow: hidden;
}

.source-collapse {
  appearance: none;
  flex: 0 0 auto;
  width: 22px;
  height: 22px;
  margin: 0;
  padding: 0;
  border: none;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  outline: none;
  color: #9a9a9a;
  cursor: pointer;
  display: grid;
  place-items: center;
  transition: color 0.15s ease, background 0.15s ease;
}

.source-collapse:hover,
.source-collapse:focus-visible {
  color: #e8e8e8;
  background: transparent;
  border: none;
  box-shadow: none;
}

.source-collapse-icon {
  width: 0.4rem;
  height: 0.4rem;
  border-left: 1.5px solid currentColor;
  border-bottom: 1.5px solid currentColor;
  transform: rotate(45deg);
  margin-left: 2px;
  transition: transform 0.15s ease;
}

.studio.is-source-collapsed {
  --studio-rail-width: 44px;
}

.studio.is-source-collapsed .studio-brand {
  justify-content: center;
  padding: 0;
  gap: 0;
}

.studio.is-source-collapsed .studio-logo {
  flex: 0 0 auto;
}

.studio.is-source-collapsed .studio-logo .logo-word {
  display: none;
}

.studio.is-source-collapsed .studio-logo .logo-mark {
  width: 22px;
  height: 11px;
}

.studio.is-source-collapsed .source-rail-body {
  display: none;
}

/* Vertically center in the thin rail below the header (escape .studio-top containing block) */
.studio.is-source-collapsed .source-collapse {
  position: fixed;
  top: calc(var(--studio-top-height) + (100dvh - var(--studio-top-height)) / 2);
  left: 0;
  bottom: auto;
  width: var(--studio-rail-width);
  height: 48px;
  transform: translateY(-50%);
  z-index: 6;
  border: none;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  display: grid;
  place-items: center;
}

.studio.is-source-collapsed .source-collapse:hover,
.studio.is-source-collapsed .source-collapse:focus-visible {
  background: rgba(255, 255, 255, 0.03);
  color: #e8e8e8;
}

.studio.is-source-collapsed .source-collapse-icon {
  transform: rotate(-135deg);
  margin: 0;
}

.source-peek {
  display: none;
}

.source-stack {
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-height: 0;
  flex: 1 1 auto;
  overflow: hidden;
  padding: 14px 14px 10px;
}

.source-stack > .source-head,
.source-stack > .analyze-target,
.source-stack > .source-block,
.source-stack > .track-card,
.source-stack > .identity-row {
  flex: 0 0 auto;
}

.source-dock {
  flex: 0 0 auto;
  display: grid;
  gap: 8px;
  padding: 0 14px 14px;
  border-top: 1px solid var(--studio-rule);
  background: #000;
}

.source-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding-right: 4px;
}

.source-title {
  font-family: var(--font-ui);
  font-size: var(--text-xs);
  font-weight: var(--weight-semibold);
  letter-spacing: var(--tracking-label);
  text-transform: uppercase;
  color: #7a7a7a;
  margin: 0;
}

.quota-chip {
  font-size: 0.75rem;
  color: #9a9a9a;
  letter-spacing: 0.01em;
}

.quota-chip .quota-sep {
  opacity: 0.4;
  margin: 0 2px;
}

.source-block {
  display: grid;
  gap: 8px;
}

.source-or {
  margin: 2px 0 0;
  text-align: center;
  font-size: var(--text-xs);
  font-weight: var(--weight-semibold);
  letter-spacing: var(--tracking-label);
  text-transform: uppercase;
  color: #5a5a5a;
}

.dropzone.compact {
  position: relative;
  min-height: 76px;
  padding: 18px 14px;
  margin: 0;
  border-radius: var(--radius-sm);
  border-style: solid;
  border-color: rgba(255, 255, 255, 0.11);
  background: rgba(255, 255, 255, 0.028);
  gap: 5px;
}

.dropzone.compact input[type="file"] {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  cursor: pointer;
  pointer-events: auto;
  font-size: 0;
  border: 0;
  z-index: 2;
}

.dropzone.compact:hover,
.dropzone.compact:focus-within,
.dropzone.compact.is-drag {
  border-color: rgba(255, 255, 255, 0.24);
  background: rgba(255, 255, 255, 0.045);
  transform: none;
  color: #f2f2f2;
}

.dropzone.compact.is-busy,
.dropzone.is-busy {
  pointer-events: none;
  opacity: 0.72;
  cursor: wait;
}

.drop-main {
  font-size: 0.9375rem;
  font-weight: 600;
  color: #ececec;
  letter-spacing: -0.015em;
}

.dropzone.compact .drop-hint {
  font-size: 0.75rem;
  color: #7a7a7a;
  letter-spacing: 0.01em;
}

.link-row.compact {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 6px;
  margin: 0;
  align-items: stretch;
}

.link-row.compact input,
.identity-row.compact input {
  width: 100%;
  appearance: none;
  background: transparent;
  color: #ececec;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 10px;
  font: inherit;
  font-size: 0.875rem;
  padding: 10px 12px;
  transition: border-color 0.15s ease;
}

.link-row.compact input::placeholder,
.identity-row.compact input::placeholder {
  color: #666;
}

.link-row.compact input:focus,
.identity-row.compact input:focus {
  outline: none;
  border-color: rgba(255, 255, 255, 0.3);
}

.ghost-btn {
  appearance: none;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: transparent;
  color: #d4d4d4;
  font: inherit;
  font-size: 0.8125rem;
  font-weight: 600;
  padding: 0 14px;
  border-radius: 10px;
  cursor: pointer;
  transition: border-color 0.15s ease, color 0.15s ease, background 0.15s ease;
}

.link-row.compact .ghost-btn,
.identity-row.compact .ghost-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 100%;
  min-height: 100%;
  padding: 10px 14px;
  font-size: 0.875rem;
  border-color: rgba(255, 255, 255, 0.1);
  border-radius: 10px;
  box-sizing: border-box;
}

.ghost-btn:hover {
  border-color: rgba(255, 255, 255, 0.28);
  color: #f2f2f2;
  background: rgba(255, 255, 255, 0.04);
}

.ghost-btn:focus-visible {
  outline: none;
  box-shadow: var(--focus-ring);
}

.track-card.compact {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  margin: 0;
  padding: 10px 12px;
  gap: 10px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.03);
  animation: none;
  align-items: center;
}

.track-card.compact img {
  width: 42px;
  height: 42px;
  border-radius: 8px;
}

.track-card.compact .track-title {
  font-size: 0.875rem;
  font-weight: 600;
  letter-spacing: -0.015em;
  line-height: 1.25;
}

.track-card.compact .track-meta {
  margin-top: 3px;
  font-size: 0.75rem;
  color: #8a8a8a;
}

.track-card.compact .track-copy {
  flex: 1;
  min-width: 0;
}

.track-play {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.16);
  background: rgba(255, 255, 255, 0.06);
  color: #f2f2f2;
  cursor: pointer;
  display: grid;
  place-items: center;
  flex-shrink: 0;
  transition: background 0.15s ease, border-color 0.15s ease, transform 0.15s ease;
}

.track-play:hover {
  background: rgba(255, 255, 255, 0.12);
  border-color: rgba(255, 255, 255, 0.28);
}

.track-play:active {
  transform: scale(0.96);
}

.track-play.is-playing {
  background: rgba(255, 255, 255, 0.14);
  border-color: rgba(255, 255, 255, 0.35);
}

.track-play-icon {
  width: 0;
  height: 0;
  border-style: solid;
  border-width: 6px 0 6px 10px;
  border-color: transparent transparent transparent currentColor;
  margin-left: 2px;
}

.track-play.is-playing .track-play-icon {
  width: 10px;
  height: 10px;
  margin-left: 0;
  border: none;
  background:
    linear-gradient(currentColor, currentColor) left / 3px 100% no-repeat,
    linear-gradient(currentColor, currentColor) right / 3px 100% no-repeat;
}

.library-item-actions {
  display: grid;
  justify-items: center;
  align-content: center;
  gap: 4px;
  flex-shrink: 0;
  min-width: 0;
}

.library-item-btns {
  display: flex;
  align-items: center;
  gap: 4px;
}

.library-item-kind {
  width: 14px;
  height: 8px;
  flex-shrink: 0;
  opacity: 0.4;
  color: var(--silkscreen);
  background: currentColor;
  -webkit-mask: url("../assets/mark.svg") center / contain no-repeat;
  mask: url("../assets/mark.svg") center / contain no-repeat;
}

.library-item-kind.is-dry {
  color: var(--silkscreen);
  opacity: 0.7;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
  -webkit-mask: none;
  mask: none;
}

.library-item-play {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.04);
  color: #e8e8e8;
  cursor: pointer;
  display: grid;
  place-items: center;
  flex-shrink: 0;
  padding: 0;
  transition: background 0.15s ease, border-color 0.15s ease;
}

.library-item-play:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.24);
}

.library-item-play.is-playing {
  background: rgba(255, 255, 255, 0.12);
}

.library-item-play-icon {
  width: 0;
  height: 0;
  border-style: solid;
  border-width: 5px 0 5px 8px;
  border-color: transparent transparent transparent currentColor;
  margin-left: 1px;
}

.library-item-play.is-playing .library-item-play-icon {
  width: 8px;
  height: 8px;
  margin-left: 0;
  border: none;
  background:
    linear-gradient(currentColor, currentColor) left / 2.5px 100% no-repeat,
    linear-gradient(currentColor, currentColor) right / 2.5px 100% no-repeat;
}

/* —— Library —— */
.library-panel {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-height: 0;
  flex: 1 1 auto;
}

.library-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex: 0 0 auto;
}

.library-title {
  margin: 0;
  font-size: 0.75rem;
  font-weight: var(--weight-semibold);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #8a8a8a;
}

.library-count {
  font-size: 0.75rem;
  font-family: var(--font-readout, ui-monospace, monospace);
  color: #7a7a7a;
}

.library-list {
  list-style: none;
  margin: 0;
  padding: 0 2px 6px 0;
  display: grid;
  gap: 3px;
  align-content: start;
  flex: 1 1 auto;
  min-height: 4.5rem;
  max-height: none;
  overflow: auto;
  overscroll-behavior: contain;
  scrollbar-gutter: stable;
}

.library-list:empty {
  display: none;
}

.library-item {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 8px;
  align-items: center;
  width: 100%;
  padding: 8px 8px 8px 6px;
  border-radius: 9px;
  border: 1px solid transparent;
  background: transparent;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease;
}

.library-item:hover {
  background: rgba(255, 255, 255, 0.04);
}

.library-item.is-active {
  border-color: rgba(255, 255, 255, 0.16);
  background: rgba(255, 255, 255, 0.055);
}

.library-check {
  appearance: none;
  display: grid;
  place-items: center;
  width: 18px;
  height: 18px;
  border-radius: 5px;
  border: 1px solid rgba(255, 255, 255, 0.28);
  background: transparent;
  cursor: pointer;
  position: relative;
  flex-shrink: 0;
  font: inherit;
  font-size: var(--text-xs);
  font-weight: 700;
  letter-spacing: 0.02em;
  color: transparent;
  line-height: 1;
  padding: 0;
}

.library-check.is-on {
  background: #f2f2f2;
  border-color: #f2f2f2;
  color: #0a0a0a;
}

.library-check.is-on::after {
  content: none;
}

.library-item-art {
  width: 28px;
  height: 28px;
  border-radius: var(--radius-xs);
  object-fit: cover;
  background: rgba(255, 255, 255, 0.06);
  flex-shrink: 0;
}

.library-item.is-dry {
  border-left: 2px solid rgba(255, 255, 255, 0.35);
  margin-left: 6px;
  background: rgba(255, 255, 255, 0.03);
}

.library-item.is-dry .library-item-meta {
  color: #a8a8a8;
}

.library-item-main {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0;
  align-items: center;
  border: none;
  background: transparent;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
  min-width: 0;
  padding: 0;
}

.library-item-main.has-art {
  grid-template-columns: auto 1fr;
  gap: 8px;
}

.library-item-copy {
  min-width: 0;
  display: grid;
}

.library-item-title {
  margin: 0;
  font-size: 0.8125rem;
  font-weight: 600;
  letter-spacing: -0.015em;
  color: #f0f0f0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.library-item-meta {
  margin: 2px 0 0;
  font-size: var(--text-xs);
  color: #8a8a8a;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.library-item-remove {
  appearance: none;
  border: none;
  background: transparent;
  color: #666;
  font-size: 1rem;
  line-height: 1;
  padding: 4px;
  cursor: pointer;
  border-radius: 4px;
}

.library-item-remove:hover {
  color: #d0d0d0;
  background: rgba(255, 255, 255, 0.05);
}

.library-hint {
  margin: 0;
  font-size: 0.75rem;
  line-height: 1.4;
  color: #7a7a7a;
  flex: 0 0 auto;
}

.library-hint.hidden {
  display: none !important;
}

.library-hint.is-ready {
  color: #8a8a8a;
}

/* —— Blend —— */
.blend-panel {
  display: grid;
  gap: 0;
  padding: 0;
  border-radius: 8px;
  border: 1px solid transparent;
  background: transparent;
  overflow: hidden;
  flex: 0 0 auto;
}

.blend-panel.hidden {
  display: none !important;
}

.blend-panel:not(.is-collapsed) {
  border-color: rgba(255, 255, 255, 0.1);
  background: rgba(255, 255, 255, 0.03);
}

.blend-bar {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 6px;
  align-items: center;
  padding: 6px 6px 6px 4px;
}

.blend-toggle {
  appearance: none;
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 8px;
  align-items: center;
  width: 100%;
  min-width: 0;
  margin: 0;
  padding: 8px 8px 8px 10px;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.blend-toggle:hover {
  background: rgba(255, 255, 255, 0.05);
}

.blend-title {
  margin: 0;
  font-size: 0.8125rem;
  font-weight: var(--weight-semibold);
  letter-spacing: -0.015em;
  color: #f0f0f0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.blend-toggle-meta {
  font-family: var(--font-ui);
  font-size: var(--text-xs);
  font-weight: var(--weight-semibold);
  font-variant-numeric: tabular-nums;
  letter-spacing: var(--tracking-label);
  color: var(--silkscreen);
  white-space: nowrap;
}

.blend-chevron {
  width: 0.45rem;
  height: 0.45rem;
  border-right: 1.5px solid #8a8a8a;
  border-bottom: 1.5px solid #8a8a8a;
  transform: rotate(45deg);
  transition: transform 0.15s ease;
  margin-top: -3px;
}

.blend-panel:not(.is-collapsed) .blend-chevron {
  transform: rotate(-135deg);
  margin-top: 3px;
}

.blend-body {
  display: grid;
  gap: 10px;
  padding: 0 12px 12px;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  padding-top: 10px;
}

.blend-panel.is-collapsed .blend-body {
  display: none;
}

.blend-picks {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 6px;
  align-items: center;
}

.blend-slot {
  min-width: 0;
  padding: 9px 10px;
  border-radius: 8px;
  border: 1px dashed rgba(255, 255, 255, 0.14);
  font-size: 0.75rem;
  color: #8a8a8a;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  text-align: center;
  pointer-events: none;
  user-select: none;
}

.blend-slot.is-filled {
  border-style: solid;
  border-color: rgba(255, 255, 255, 0.16);
  color: #ececec;
  background: rgba(255, 255, 255, 0.04);
}

.blend-x {
  color: #666;
  font-size: var(--text-sm);
}

.blend-weights {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 4px;
  padding: 2px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.045);
}

.blend-weight {
  appearance: none;
  border: none;
  background: transparent;
  color: #8a8a8a;
  font: inherit;
  font-size: 0.75rem;
  font-weight: var(--weight-medium);
  padding: 8px 4px;
  border-radius: 6px;
  cursor: pointer;
}

.blend-weight.is-active,
.blend-weight[aria-pressed="true"] {
  background: rgba(255, 255, 255, 0.1);
  color: #f5f5f5;
}

.blend-go {
  appearance: none;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: #f2f2f2;
  color: #0a0a0a;
  font: inherit;
  font-size: 0.75rem;
  font-weight: var(--weight-semibold);
  letter-spacing: -0.01em;
  padding: 8px 12px;
  border-radius: 8px;
  cursor: pointer;
  white-space: nowrap;
}

.blend-go:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

.blend-go:not(:disabled):hover {
  background: #fff;
}

.blend-diff {
  display: grid;
  gap: 6px;
  padding: 8px 9px;
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.28);
  border: 1px solid rgba(255, 255, 255, 0.06);
}

.blend-diff.hidden {
  display: none !important;
}

.blend-diff-mix {
  margin: 0;
  font-family: var(--font-ui);
  font-size: var(--text-sm);
  font-weight: var(--weight-semibold);
  font-variant-numeric: tabular-nums;
  letter-spacing: var(--tracking-body);
  color: var(--readout);
}

.blend-diff-label {
  margin: 0;
  font-size: var(--text-xs);
  font-weight: var(--weight-medium);
  letter-spacing: var(--tracking-body);
  text-transform: none;
  color: var(--silkscreen);
}

.blend-diff-empty {
  margin: 0;
  font-size: var(--text-xs);
  line-height: 1.4;
  color: var(--silkscreen);
}

.blend-diff-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

.blend-diff-chip {
  display: inline-flex;
  align-items: baseline;
  gap: 4px;
  padding: 4px 7px;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.06);
  font-size: var(--text-xs);
  color: #d0d0d0;
  line-height: 1.2;
}

.blend-diff-chip em {
  font-style: normal;
  font-weight: 600;
  color: #9a9a9a;
}

.identity-row.compact {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 6px;
  margin: 0;
}

.source-footer {
  margin-top: 0;
  display: grid;
  gap: 10px;
  padding-top: 0;
}

.source-daw {
  display: flex;
  align-items: center;
  width: 100%;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  background: rgba(255, 255, 255, 0.05);
  flex-shrink: 0;
}

.source-daw label {
  font-size: var(--text-xs);
  font-weight: 600;
  color: #9a9a9a;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  white-space: nowrap;
}

.source-daw select {
  flex: 1;
  min-width: 0;
  appearance: none;
  border: none;
  background-color: transparent;
  color: #f2f2f2;
  font: inherit;
  font-size: 0.875rem;
  font-weight: 600;
  letter-spacing: -0.015em;
  text-align: right;
  padding: 2px 22px 2px 0;
  cursor: pointer;
  background-image:
    linear-gradient(45deg, transparent 50%, #aaa 50%),
    linear-gradient(135deg, #aaa 50%, transparent 50%);
  background-position: calc(100% - 4px) 55%, calc(100% - 0px) 55%;
  background-size: 4px 4px, 4px 4px;
  background-repeat: no-repeat;
}

.source-daw select:focus {
  outline: none;
}

.mode-row.compact {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0;
  margin: 0;
  padding: 2px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.06);
}

.target-row.compact {
  display: grid;
  grid-template-columns: 1fr 1.35fr 1.1fr;
  gap: 0;
  margin: 0;
  padding: 2px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.06);
}

.analyze-target {
  display: grid;
  gap: 6px;
  margin: 0;
}

.analyze-target-label {
  display: none;
}

.analyze-target .mode-seg {
  font-size: 0.75rem;
  padding: 9px 4px;
  white-space: nowrap;
}

.stems-panel.compact {
  margin: 0 0 10px;
  padding: 8px 10px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.02);
  color: #9a9a9a;
  font-size: var(--text-xs);
}

.stems-panel summary {
  cursor: pointer;
  font-weight: var(--weight-medium);
  color: #c8c8c8;
  list-style: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  border-radius: 6px;
  outline: none;
}

.stems-panel summary:focus,
.stems-panel summary:focus-visible {
  outline: none;
  box-shadow: var(--focus-ring);
}

.stems-panel summary::-webkit-details-marker {
  display: none;
}

.stems-soon {
  font-size: var(--text-xs);
  font-weight: 500;
  color: #6e6e6e;
  letter-spacing: 0.02em;
}

.stems-hint {
  margin: 8px 0 10px;
  line-height: 1.4;
  color: #7a7a7a;
}

.stem-field {
  display: grid;
  gap: 6px;
  margin-bottom: 10px;
  color: #a8a8a8;
}

.stem-field-label {
  font-size: var(--text-xs);
  font-weight: 600;
  letter-spacing: 0.02em;
  color: #9a9a9a;
}

.stem-picker {
  position: relative;
  display: inline-flex;
  align-items: center;
  max-width: 100%;
}

.stem-file-input {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
  opacity: 0;
}

.stem-pick-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 34px;
  padding: 0 14px;
  border-radius: var(--radius-btn, 12px);
  border: 1px solid rgba(255, 255, 255, 0.18);
  background: #f2f2f2;
  color: #0a0a0a;
  font-family: var(--font-ui, inherit);
  font-size: var(--text-xs);
  font-weight: var(--weight-semibold);
  letter-spacing: -0.02em;
  line-height: 1;
  cursor: pointer;
  transition:
    background 0.15s ease,
    border-color 0.15s ease,
    transform 0.15s ease;
}

.stem-field:hover .stem-pick-btn {
  background: #fff;
}

.stem-file-input:focus-visible + .stem-pick-btn {
  outline: none;
  box-shadow: var(--focus-ring);
}

.stem-name {
  font-size: 0.7rem;
  color: #6a6a6a;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 100%;
}

.instruments-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: var(--space-3);
}

.instrument-card {
  padding: 14px 16px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--surface-border, var(--panel-edge));
  background: var(--surface, rgba(255, 255, 255, 0.025));
  transition: border-color 0.15s ease, background 0.15s ease;
}

.instrument-card:hover {
  border-color: var(--surface-border-strong, var(--panel-edge-strong));
  background: var(--surface-hover, rgba(255, 255, 255, 0.045));
  transform: none;
}

.instrument-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
}

.instrument-glyph {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: var(--radius-xs);
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  flex-shrink: 0;
}

.instrument-glyph .studio-glyph {
  width: 14px;
  height: 14px;
}

.instrument-card-head strong {
  font-size: var(--text-md);
  font-weight: 600;
  color: #f0f0f0;
  flex: 1;
  min-width: 0;
}

.instrument-conf {
  font-family: var(--font-readout, "JetBrains Mono", monospace);
  font-size: 0.75rem;
  color: var(--silkscreen);
}

.instrument-meter {
  height: 4px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  overflow: hidden;
  margin-bottom: 10px;
}

.instrument-meter span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, rgba(255, 255, 255, 0.28), rgba(255, 255, 255, 0.7));
}

.instrument-tip {
  margin: 0;
  font-size: var(--text-sm);
  line-height: 1.45;
  color: #a0a0a0;
}

.instruments-empty {
  color: #8a8a8a;
  font-size: var(--text-base);
  line-height: 1.5;
}

.mode-seg {
  appearance: none;
  border: none;
  background: transparent;
  color: #8a8a8a;
  font: inherit;
  font-size: 0.8125rem;
  font-weight: var(--weight-medium);
  padding: 9px 8px;
  border-radius: 8px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
}

.mode-seg .lock {
  font-size: var(--text-xs);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  opacity: 0.75;
  border: 1px solid currentColor;
  border-radius: 4px;
  padding: 1px 4px;
}

.mode-seg[aria-pressed="true"] {
  background: rgba(255, 255, 255, 0.1);
  color: #f5f5f5;
}

.mode-seg:focus-visible {
  outline: none;
  box-shadow: var(--focus-ring);
}

.mode-seg:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.analyze-progress.compact {
  margin: 0;
  padding: 10px 0 2px;
  border: none;
  background: none;
  display: grid;
  gap: 8px;
}

.analyze-progress.compact .analyze-progress-head {
  margin-bottom: 0;
}

.analyze-progress.compact .analyze-progress-label,
.analyze-progress.compact .analyze-progress-pct {
  font-size: var(--text-xs);
  color: #b0b0b0;
}

.analyze-progress.compact .analyze-progress-label {
  animation: none;
  opacity: 0.85;
}

@keyframes analyze-label-pulse {
  0%,
  100% {
    opacity: 0.75;
  }
  50% {
    opacity: 1;
  }
}

.analyze-progress.compact .analyze-progress-track {
  height: 3px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 1px;
  overflow: hidden;
  position: relative;
}

.analyze-progress.compact .analyze-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--teal-dim), var(--teal-bright));
  border-radius: 1px;
  animation: none;
  transition: width 0.28s ease-out;
}

@keyframes analyze-shimmer {
  0% {
    background-position: 100% 0;
  }
  100% {
    background-position: -100% 0;
  }
}

.analyze-progress.compact .analyze-progress-stages {
  margin-top: 2px;
  gap: 6px 10px;
}

.analyze-progress.compact .analyze-progress-stages li {
  font-size: var(--text-xs);
  letter-spacing: 0.06em;
  position: relative;
}

.analyze-progress.compact .analyze-progress-stages li.is-active {
  color: #f0f0f0;
  opacity: 1;
}

.analyze-progress.compact .analyze-progress-stages li.is-active::after {
  content: "";
  display: inline-block;
  width: 4px;
  height: 4px;
  margin-left: 5px;
  border-radius: 50%;
  background: #f0f0f0;
  vertical-align: middle;
  animation: none;
  opacity: 0.85;
}

@keyframes analyze-dot {
  0%,
  100% {
    opacity: 0.4;
  }
  50% {
    opacity: 1;
  }
}

/* Studio ambient while measuring */
.studio.is-analyzing .studio-main {
  /* Avoid filter on this ancestor — it flattens child hue-rotate on iOS Safari */
  animation: none;
}

.studio.is-analyzing .studio-source {
  background: #000;
}

.studio.is-analyzing .studio-panel.is-active {
  position: relative;
}

.studio.is-analyzing .studio-panel.is-active::before {
  content: none;
}

.studio.is-analyzing .studio-panel.is-active > * {
  position: relative;
  z-index: 1;
}

.studio.is-analyzing .empty-kicker,
.studio.is-analyzing [data-empty] h2 {
  animation: none;
}

.studio.is-analyzing [data-empty] {
  display: grid;
  justify-items: center;
  gap: 14px;
}

.studio.is-analyzing [data-empty] h2 {
  font-family: var(--font-brand);
  font-size: clamp(1.15rem, 2.4vw, 1.35rem);
  font-weight: var(--weight-bold);
  letter-spacing: var(--tracking-display);
  color: var(--brand);
  line-height: var(--leading-tight);
}

.studio.is-analyzing [data-empty] p {
  font-family: var(--font-ui);
  font-size: var(--text-md);
  font-weight: var(--weight-regular);
  letter-spacing: var(--tracking-body);
  color: var(--silkscreen);
  line-height: var(--leading-body);
  max-width: 22rem;
}

.studio.is-analyzing [data-analyze-hero] {
  --mark-w: clamp(168px, 34vw, 240px);
  margin-bottom: 22px;
  color: var(--teal, #6ec4b4);
}

@keyframes analyze-main-breathe {
  0%,
  100% {
    opacity: 1;
  }
  50% {
    opacity: 0.98;
  }
}

@keyframes analyze-glow {
  0%,
  100% {
    opacity: 0.45;
  }
  50% {
    opacity: 1;
  }
}

@media (prefers-reduced-motion: reduce) {
  .analyze-progress.compact .analyze-progress-label,
  .analyze-progress.compact .analyze-progress-fill,
  .analyze-progress.compact .analyze-progress-stages li.is-active::after,
  .studio.is-analyzing .studio-main,
  .studio.is-analyzing .studio-panel.is-active::before,
  .studio.is-analyzing .empty-kicker,
  .studio.is-analyzing [data-empty] h2 {
    animation: none !important;
  }
}

.status-row.compact {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  padding: 0;
}

.status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #3a3a3a;
  flex-shrink: 0;
}

.status-dot[data-state="live"] {
  background: var(--signal);
  box-shadow: none;
}

.status-row.compact .status-text {
  font-size: var(--text-xs);
  color: #8a8a8a;
  letter-spacing: -0.01em;
}

/* —— Main —— */
.studio-main {
  position: relative;
  min-height: 0;
  min-width: 0;
  background: #000;
  display: grid;
}

/* Finger-follow tab swipe: stack current + peek peer */
.studio-main.is-tab-swiping {
  overflow: hidden;
  touch-action: none;
}

.studio-main.is-tab-swiping > .studio-panel.is-active {
  grid-area: 1 / 1;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  will-change: transform;
  backface-visibility: hidden;
}

.studio-panel.is-swipe-dragging,
.stage-focus .chain-step {
  backface-visibility: hidden;
}

.stage-focus.is-h-dragging {
  touch-action: none;
  overflow: hidden;
}

.stage-focus.is-h-dragging .chain-step {
  will-change: transform;
  pointer-events: none;
}

.studio-panel {
  display: none;
  min-height: 0;
  overflow: hidden;
}

.studio-panel.is-active {
  display: grid;
  grid-template-rows: 1fr;
  min-height: 0;
}

.studio-panel.is-entering > .panel-pad,
.studio-panel.is-entering > .chain-workspace,
.studio-panel.is-entering > .chain-empty {
  animation: none;
}

.studio-panel.is-entering .why-fact,
.studio-panel.is-entering .why-move,
.studio-panel.is-entering .design-layer,
.studio-panel.is-entering .readout,
.studio-panel.is-entering .master-note,
.studio-panel.is-entering .instrument-card,
.studio-panel.is-entering .master-step {
  animation: none;
}

@keyframes panel-enter {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

.studio-glyph {
  display: block;
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  color: var(--silkscreen);
  opacity: 0.85;
}

.panel-pad {
  padding: var(--space-4) var(--studio-gutter) var(--space-5);
  overflow: auto;
  min-height: 0;
  align-content: start;
}

/* Content panels: pack to content, never stretch short blocks into empty viewport */
.studio-panel > .panel-pad,
.design-body,
.master-body,
.match-results,
.why-panel,
.why-main,
.why-primary {
  align-content: start;
}

.panel-head {
  margin-bottom: var(--space-4);
  padding-bottom: 0;
  border: none;
}

.panel-head .panel-title {
  margin-bottom: 6px;
  font-family: var(--font-brand);
  font-size: var(--text-display);
  font-weight: var(--weight-bold);
  letter-spacing: var(--tracking-display);
  line-height: var(--leading-tight);
  color: var(--brand);
}

.panel-head .panel-sub {
  margin: 0;
  font-family: var(--font-ui);
  font-size: var(--text-sm);
  font-weight: var(--weight-regular);
  letter-spacing: var(--tracking-body);
  color: var(--silkscreen);
  line-height: var(--leading-body);
  max-width: 36rem;
}

.chain-empty {
  display: grid;
  place-content: center;
  text-align: center;
  gap: 10px;
  padding: 40px 28px;
  max-width: 28rem;
  margin: 0 auto;
  justify-items: center;
}

.chain-empty .empty-kicker {
  margin: 0;
  font-family: var(--font-ui);
  font-size: var(--text-xs);
  font-weight: var(--weight-semibold);
  letter-spacing: var(--tracking-label);
  text-transform: uppercase;
  color: var(--silkscreen);
}

.chain-empty h2 {
  font-family: var(--font-brand);
  font-size: var(--text-display);
  font-weight: var(--weight-bold);
  letter-spacing: var(--tracking-display);
  color: var(--brand);
  line-height: var(--leading-tight);
  margin: 0;
  max-width: 26rem;
  justify-self: center;
}

.chain-empty p {
  margin: 0;
  color: var(--silkscreen);
  font-family: var(--font-ui);
  font-size: var(--text-md);
  font-weight: var(--weight-regular);
  line-height: var(--leading-body);
  letter-spacing: var(--tracking-body);
  max-width: 26rem;
}

.chain-empty .empty-steps {
  margin: 10px 0 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 10px;
  text-align: left;
  color: #9a9a9a;
  font-size: var(--text-base);
  line-height: 1.45;
}

.chain-empty .empty-steps li {
  position: relative;
  padding-left: 1.6rem;
}

.chain-empty .empty-steps li::before {
  content: counter(step);
  counter-increment: step;
  position: absolute;
  left: 0;
  top: 0.05em;
  width: 1.15rem;
  height: 1.15rem;
  border-radius: 50%;
  border: 1px solid #3f3f3f;
  color: #b0b0b0;
  font-size: var(--text-xs);
  font-weight: var(--weight-semibold);
  display: grid;
  place-items: center;
  line-height: 1;
}

.chain-empty .empty-steps {
  counter-reset: step;
}

.chain-empty .empty-steps strong {
  color: #e4e4e4;
  font-weight: 600;
}

.mode-hint {
  display: none;
}

.studio.has-results .chain-empty {
  display: none;
}

.chain-workspace {
  position: relative;
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr) auto;
  grid-template-areas:
    "chrome"
    "rail"
    "focus"
    "nav";
  min-height: 0;
  height: 100%;
}

.chain-workspace > .chain-chrome {
  grid-area: chrome;
}

.chain-workspace > .stage-rail-shell {
  grid-area: rail;
}

.chain-workspace > .stage-focus {
  grid-area: focus;
}

.chain-workspace > .stage-nav {
  grid-area: nav;
}

/* Keep a11y / unused nodes out of the grid so they can't steal the 1fr row */
.chain-workspace > .honesty,
.chain-workspace > .highlights {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
  pointer-events: none;
}

.chain-workspace.hidden {
  display: none !important;
}

.studio.has-results .chain-workspace:not(.hidden) {
  display: grid;
}

/* Chain chrome: exports row, then separate preview row */
.chain-chrome {
  display: grid;
  gap: 0;
  border-bottom: 1px solid var(--studio-rule);
  background: #000;
}

.chain-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px var(--studio-gutter) 10px;
  min-height: 0;
  box-sizing: border-box;
}

.chain-toolbar-copy {
  min-width: 0;
  flex: 1 1 auto;
}

.chain-toolbar-title {
  margin: 0;
  font-family: var(--font-brand);
  font-size: var(--text-display);
  font-weight: var(--weight-bold);
  letter-spacing: var(--tracking-display);
  line-height: var(--leading-tight);
  color: var(--brand);
  text-transform: none;
}

.chain-toolbar .estimate-note {
  margin: 6px 0 0;
  font-family: var(--font-ui);
  font-size: var(--text-sm);
  font-weight: var(--weight-regular);
  letter-spacing: var(--tracking-body);
  color: var(--silkscreen);
  line-height: var(--leading-snug);
  max-width: 40rem;
}

.chain-toolbar .estimate-note:empty {
  display: none;
}

.chain-toolbar-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 0 0 auto;
  min-width: 0;
}

.hear-strip {
  display: grid;
  gap: 8px;
  padding: 8px var(--studio-gutter) 10px;
  border-top: 1px solid var(--studio-rule);
  background: rgba(255, 255, 255, 0.015);
}

.hear-strip-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  min-width: 0;
}

.hear-strip-kicker {
  margin: 0;
  font-family: var(--font-ui);
  font-size: var(--text-xs);
  font-weight: var(--weight-semibold);
  letter-spacing: var(--tracking-label);
  text-transform: uppercase;
  color: var(--silkscreen);
  line-height: 1;
  flex-shrink: 0;
}

.hear-strip-hint {
  margin: 0;
  font-family: var(--font-ui);
  font-size: var(--text-sm);
  font-weight: var(--weight-regular);
  letter-spacing: var(--tracking-body);
  color: var(--silkscreen);
  line-height: var(--leading-snug);
  text-align: right;
  min-width: 0;
}

.hear-strip-hint:empty {
  display: none;
}

.hear-strip-controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px 16px;
  flex-wrap: wrap;
}

.hear-strip-source {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  flex: 1 1 220px;
}

.hear-file {
  display: block;
  min-width: 0;
  width: 100%;
  max-width: 28rem;
}

.hear-file[hidden] {
  display: none !important;
}

.hear-file-row {
  position: relative;
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.hear-file-row .stem-file-input {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
  opacity: 0;
}

.hear-file-row .stem-pick-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
  height: 36px;
  min-height: 36px;
  padding: 0 14px;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  background: rgba(255, 255, 255, 0.08);
  color: #f0f0f0;
  font-size: 0.8125rem;
  font-weight: 600;
  letter-spacing: -0.015em;
  cursor: pointer;
  flex-shrink: 0;
}

.hear-file:hover .stem-pick-btn {
  background: rgba(255, 255, 255, 0.12);
  border-color: rgba(255, 255, 255, 0.24);
}

.hear-file-row .stem-file-input:focus-visible + .stem-pick-btn {
  outline: none;
  box-shadow: var(--focus-ring);
}

.hear-file-row .stem-name {
  font-size: 0.75rem;
  color: #7a7a7a;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
}

.preview-ab-seg {
  display: inline-flex;
  align-items: center;
  box-sizing: border-box;
  height: 36px;
  padding: 3px;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(0, 0, 0, 0.35);
  gap: 2px;
  flex-shrink: 0;
}

.preview-ab-btn {
  appearance: none;
  border: none;
  background: transparent;
  color: #8a8a8a;
  font: inherit;
  font-size: 0.8125rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  height: 100%;
  padding: 0 14px;
  border-radius: 6px;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}

.preview-ab-btn[aria-pressed="true"] {
  background: rgba(255, 255, 255, 0.12);
  color: #f4f4f4;
}

.preview-ab-btn:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

.preview-ab-btn:focus-visible {
  outline: none;
  box-shadow: var(--focus-ring);
}

.export-btn {
  appearance: none;
  box-sizing: border-box;
  height: 36px;
  min-height: 36px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: #f2f2f2;
  color: #0a0a0a;
  font-family: var(--font-ui);
  font-size: var(--text-sm);
  font-weight: var(--weight-semibold);
  letter-spacing: var(--tracking-body);
  line-height: 1;
  padding: 0 14px;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.15s ease, opacity 0.15s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  white-space: nowrap;
  flex: 0 0 auto;
}

.export-btn:hover:not(:disabled) {
  background: #fff;
}

.export-btn:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

.export-btn.is-busy {
  opacity: 0.7;
  pointer-events: none;
}

.export-btn-ghost {
  background: transparent;
  color: var(--readout, #f2f2f2);
  border-color: rgba(255, 255, 255, 0.22);
}

.export-btn-ghost:hover:not(:disabled) {
  background: rgba(255, 255, 255, 0.08);
}

.daw-picker {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.daw-picker label {
  font-size: var(--text-xs);
  font-weight: 500;
  color: #5e5e5e;
  letter-spacing: 0.02em;
  white-space: nowrap;
}

.daw-picker select {
  appearance: none;
  background: transparent;
  color: #e8e8e8;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 8px;
  font: inherit;
  font-size: 0.8125rem;
  font-weight: 500;
  padding: 7px 30px 7px 12px;
  background-image:
    linear-gradient(45deg, transparent 50%, #777 50%),
    linear-gradient(135deg, #777 50%, transparent 50%);
  background-position: calc(100% - 13px) 55%, calc(100% - 9px) 55%;
  background-size: 4px 4px, 4px 4px;
  background-repeat: no-repeat;
  cursor: pointer;
  transition: border-color 0.15s ease;
}

.source-daw.daw-picker select {
  border: none;
  border-radius: 0;
  padding: 2px 22px 2px 0;
  background-color: transparent;
  background-image:
    linear-gradient(45deg, transparent 50%, #aaa 50%),
    linear-gradient(135deg, #aaa 50%, transparent 50%);
  background-position: calc(100% - 4px) 55%, calc(100% - 0px) 55%;
  background-size: 4px 4px, 4px 4px;
  background-repeat: no-repeat;
  font-size: 0.875rem;
  font-weight: 600;
}

.daw-picker select:hover,
.daw-picker select:focus {
  outline: none;
  border-color: rgba(255, 255, 255, 0.28);
}

/* Desktop: preview strip becomes one calm row so the stage board can breathe */
@media (min-width: 901px) {
  .hear-strip {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px 20px;
    flex-wrap: nowrap;
    padding: 10px var(--studio-gutter);
  }

  .hear-strip-head {
    flex: 0 0 auto;
    gap: 10px;
  }

  .hear-strip-hint {
    display: none;
  }

  .hear-strip-controls {
    flex: 1 1 auto;
    justify-content: flex-end;
    flex-wrap: nowrap;
    min-width: 0;
  }

  .hear-strip-source {
    flex: 0 1 auto;
    max-width: 22rem;
  }
}

/* Stage rail — stepped path, wrap so every stage stays visible */
.stage-rail-shell {
  position: relative;
  z-index: 4;
  flex-shrink: 0;
  border-bottom: 1px solid var(--studio-rule);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.025), transparent 70%),
    #080808;
  overflow: visible;
}

.stage-rail-wrap {
  display: flex;
  flex-wrap: wrap;
  align-items: stretch;
  gap: 8px 6px;
  padding: 12px var(--studio-gutter) 14px;
  overflow: visible;
  scroll-behavior: smooth;
}

.stage-rail {
  display: contents;
}

.stage-rail-divider {
  width: 1px;
  align-self: stretch;
  min-height: 2.25rem;
  margin: 0 6px;
  background: linear-gradient(
    180deg,
    transparent,
    rgba(110, 196, 180, 0.35),
    transparent
  );
  flex-shrink: 0;
}

.stage-rail-more {
  display: none !important;
}

.stage-chip {
  appearance: none;
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 9px;
  flex: 0 0 auto;
  border: 1px solid rgba(255, 255, 255, 0.06);
  background: rgba(255, 255, 255, 0.025);
  color: #8a8a8a;
  border-radius: 11px;
  padding: 7px 12px 7px 8px;
  cursor: pointer;
  text-align: left;
  max-width: none;
  transition:
    color 0.18s ease,
    background 0.18s ease,
    border-color 0.18s ease,
    box-shadow 0.18s ease,
    transform 0.18s ease;
  box-shadow: none;
}

.stage-chip::after {
  content: "";
  position: absolute;
  right: -5px;
  top: 50%;
  width: 5px;
  height: 1px;
  background: rgba(255, 255, 255, 0.12);
  transform: translateY(-50%);
  pointer-events: none;
}

.stage-chip:has(+ .stage-rail-divider)::after,
[data-stage-rail-sends] > .stage-chip:last-child::after {
  display: none;
}

.stage-chip:hover {
  color: #e4e4e4;
  background: rgba(255, 255, 255, 0.055);
  border-color: rgba(255, 255, 255, 0.12);
}

.stage-chip[data-stage-state="past"] {
  color: #b8b8b8;
  border-color: rgba(110, 196, 180, 0.14);
  background: rgba(110, 196, 180, 0.04);
}

.stage-chip[data-stage-state="past"] .stage-chip-n {
  background: rgba(110, 196, 180, 0.16);
  color: #8ed9cb;
  border-color: transparent;
}

.stage-chip[data-stage-state="past"]::after {
  background: rgba(110, 196, 180, 0.35);
}

.stage-chip[aria-selected="true"],
.stage-chip[data-stage-state="current"] {
  background: rgba(110, 196, 180, 0.12);
  border-color: rgba(110, 196, 180, 0.42);
  color: #f7f7f7;
  box-shadow:
    0 0 0 1px rgba(110, 196, 180, 0.08),
    0 8px 22px rgba(0, 0, 0, 0.35);
  transform: translateY(-1px);
}

.stage-chip[aria-selected="true"] .stage-chip-n,
.stage-chip[data-stage-state="current"] .stage-chip-n {
  background: var(--teal, #6ec4b4);
  color: #041411;
  border-color: transparent;
  box-shadow: 0 0 12px rgba(110, 196, 180, 0.35);
}

.stage-chip[aria-selected="true"]::after,
.stage-chip[data-stage-state="current"]::after {
  background: rgba(110, 196, 180, 0.55);
  width: 6px;
  right: -6px;
}

.stage-chip[data-stage-kind="send"] {
  border-style: dashed;
}

.stage-chip:focus,
.stage-chip:focus-visible {
  outline: none;
  box-shadow: var(--focus-ring);
}

.stage-chip-n {
  display: grid;
  place-items: center;
  flex-shrink: 0;
  width: 1.55rem;
  height: 1.55rem;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(255, 255, 255, 0.04);
  font-family: var(--font-mono, "JetBrains Mono", ui-monospace, monospace);
  font-size: 0.62rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: #7a7a7a;
  transition: background 0.18s ease, color 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
}

.stage-chip-copy {
  display: grid;
  gap: 1px;
  min-width: 0;
}

.stage-chip-title {
  display: block;
  font-size: 0.8125rem;
  font-weight: 600;
  letter-spacing: -0.015em;
  white-space: nowrap;
  overflow: visible;
  text-overflow: clip;
  line-height: 1.2;
}

.stage-chip-type {
  display: block;
  font-size: 0.625rem;
  font-weight: 500;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #5e5e5e;
  line-height: 1.2;
}

.stage-chip[data-stage-state="past"] .stage-chip-type {
  color: #6a8f88;
}

.stage-chip[aria-selected="true"] .stage-chip-type,
.stage-chip[data-stage-state="current"] .stage-chip-type {
  color: rgba(142, 217, 203, 0.85);
}

@media (prefers-reduced-motion: reduce) {
  .stage-chip {
    transition: none;
    transform: none !important;
  }
}

.stage-focus {
  min-height: 0;
  overflow: auto;
  display: block;
  padding: clamp(20px, 3.2vh, 36px) var(--studio-gutter) clamp(20px, 3vh, 36px);
}

.stage-focus .chain-step {
  opacity: 1;
  transform: none;
  animation: none;
  border: none;
  background: transparent;
  padding: 0;
  max-width: 70rem;
  width: 100%;
  margin: 0;
  min-height: 0;
  height: auto;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(16rem, 1.1fr);
  grid-template-areas:
    "copy rack"
    "picks picks";
  gap: clamp(20px, 3vh, 36px) clamp(24px, 3.5vw, 48px);
  align-items: start;
  align-content: start;
  box-sizing: border-box;
}

.stage-focus .chain-step:not(:has(> .step-rack)) {
  grid-template-columns: minmax(0, 42rem);
  grid-template-areas:
    "copy"
    "picks";
  justify-content: start;
}

.stage-focus .chain-step:not(:has(> .pro-picks)) {
  grid-template-areas: "copy rack";
}

.stage-focus .chain-step:not(:has(> .step-rack)):not(:has(> .pro-picks)) {
  grid-template-areas: "copy";
}

.stage-focus .step-copy {
  grid-area: copy;
  display: grid;
  gap: clamp(14px, 2vh, 22px);
  align-content: start;
  min-width: 0;
  overflow: visible;
}

.stage-focus .step-intro {
  display: grid;
  gap: 8px;
  min-width: 0;
}

.stage-focus .step-rack {
  grid-area: rack;
  min-width: 0;
  display: flex;
  flex-direction: column;
  justify-content: start;
  position: sticky;
  top: 0;
}

.stage-focus > .chain-step > .pro-picks {
  grid-area: picks;
  align-self: start;
}

.stage-focus .step-head {
  display: flex;
  flex-wrap: wrap;
  margin-bottom: 0;
  gap: 8px;
  align-items: center;
}

.stage-focus .step-index {
  font-size: var(--text-xs);
  color: var(--silkscreen);
  font-weight: var(--weight-medium);
}

.stage-focus .type-badge {
  background: rgba(255, 255, 255, 0.12);
  color: #f0f0f0;
  font-size: var(--text-xs);
  padding: 4px 8px;
}

.stage-focus .tier {
  border-color: rgba(255, 255, 255, 0.12);
  color: var(--silkscreen);
  font-size: var(--text-xs);
}

.stage-focus .step-title {
  font-family: var(--font-ui);
  font-size: clamp(1.35rem, 2.1vw, 1.85rem);
  font-weight: var(--weight-semibold);
  margin: 0;
  letter-spacing: var(--tracking-title);
  line-height: var(--leading-tight);
  color: var(--brand);
}

.stage-focus .gap {
  margin: 0;
  font-size: var(--text-sm);
  color: var(--silkscreen);
  line-height: var(--leading-body);
}

@media (max-width: 1100px) {
  .stage-focus .chain-step {
    grid-template-columns: 1fr;
  }

  .stage-focus .step-rack {
    position: static;
  }

  .stage-focus .pro-pick {
    grid-template-columns: 1fr;
  }

  .stage-focus .pro-pick-buy {
    justify-self: start;
  }
}

.stage-focus .step-why .why,
.stage-focus .step-why .how {
  overflow-wrap: break-word;
}

.stage-focus .plugin-face .rack-body {
  padding: clamp(14px, 2vh, 20px);
  gap: clamp(12px, 1.8vh, 18px);
}

.stage-focus .plugin-face .rack-dials {
  gap: 10px;
  grid-template-columns: repeat(auto-fit, minmax(142px, 1fr));
}

.stage-focus .plugin-face .rack-dial {
  padding: 13px 14px;
  gap: 5px;
}

.stage-focus .plugin-face .rack-dial-val {
  font-size: clamp(0.95rem, 1.35vw, 1.12rem);
}

.stage-focus .step-why {
  margin: 0;
  padding: 0;
  display: grid;
  gap: 6px;
}

.stage-focus .step-why-label {
  margin: 0;
  font-family: var(--font-ui);
  font-size: var(--text-xs);
  font-weight: var(--weight-semibold);
  letter-spacing: var(--tracking-label);
  text-transform: uppercase;
  color: var(--silkscreen);
}

.stage-focus .step-why .why,
.stage-focus .step-why .how {
  margin: 0;
  font-family: var(--font-ui);
  font-size: var(--text-sm);
  font-weight: var(--weight-regular);
  line-height: var(--leading-body);
  letter-spacing: var(--tracking-body);
  color: var(--readout);
  max-width: 36rem;
}

.stage-focus .step-tips {
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  margin: 0;
  padding-top: 12px;
}

.stage-focus .step-tips summary {
  font-size: var(--text-sm);
  font-weight: var(--weight-medium);
  color: var(--silkscreen);
}

.stage-focus .step-tips .why,
.stage-focus .step-tips .how {
  margin: 8px 0 0;
  font-size: var(--text-base);
  line-height: 1.5;
  color: var(--silkscreen);
}

.master-empty,
.design-empty {
  color: var(--silkscreen);
  font-family: var(--font-ui);
  font-size: var(--text-md);
  font-weight: var(--weight-regular);
  line-height: var(--leading-body);
  letter-spacing: var(--tracking-body);
  max-width: 36rem;
  display: grid;
  gap: var(--space-3);
  justify-items: start;
}

.master-empty .empty-lead,
.design-empty .empty-lead {
  margin: 0;
  color: var(--readout);
  font-size: var(--text-md);
  font-weight: var(--weight-medium);
  letter-spacing: var(--tracking-body);
}

.master-empty p,
.design-empty p {
  margin: 0;
}

.master-empty strong,
.design-empty strong {
  color: var(--brand);
  font-weight: var(--weight-semibold);
}

.master-empty .btn,
.design-empty .btn {
  margin-top: var(--space-1);
}

.design-panel {
  display: flex;
  flex-direction: column;
  gap: 0;
  align-content: start;
}

.design-panel .panel-head {
  margin-bottom: var(--space-4);
}

.design-body {
  display: grid;
  gap: var(--space-4);
  max-width: none;
  align-content: start;
}

/* Keep for older markup / mobile overrides — single column now */
.design-split {
  display: contents;
}

.design-hero {
  display: grid;
  gap: 6px;
  padding: 14px 14px 12px;
  border: 1px solid var(--panel-edge);
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.03);
}

.design-kicker {
  margin: 0;
  font-family: var(--font-ui);
  font-size: var(--text-xs);
  font-weight: var(--weight-semibold);
  letter-spacing: var(--tracking-label);
  text-transform: uppercase;
  color: var(--silkscreen);
}

.design-headline {
  margin: 0;
  font-family: var(--font-ui);
  font-size: var(--text-xl);
  font-weight: var(--weight-semibold);
  letter-spacing: var(--tracking-title);
  line-height: var(--leading-tight);
  color: var(--brand);
}

.design-blurb {
  margin: 0;
  font-family: var(--font-ui);
  font-size: var(--text-md);
  font-weight: var(--weight-regular);
  line-height: var(--leading-body);
  color: var(--silkscreen);
  letter-spacing: var(--tracking-body);
}

.design-cues {
  list-style: none;
  margin: 8px 0 0;
  padding: 8px 0 0;
  border-top: 1px solid rgba(255, 255, 255, 0.07);
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(16rem, 1fr));
  gap: 8px 16px;
}

.design-cues.hidden {
  display: none !important;
}

.design-cue {
  display: grid;
  gap: 2px;
  align-content: start;
  padding: 0;
  border-radius: 0;
  background: transparent;
}

.design-cue-label {
  font-family: var(--font-ui);
  font-size: var(--text-xs);
  font-weight: var(--weight-semibold);
  letter-spacing: var(--tracking-label);
  text-transform: uppercase;
  color: var(--silkscreen);
}

.design-cue-text {
  font-family: var(--font-ui);
  font-size: var(--text-sm);
  font-weight: var(--weight-regular);
  line-height: var(--leading-snug);
  letter-spacing: var(--tracking-body);
  color: var(--readout);
}

.design-section {
  display: grid;
  gap: 8px;
  align-content: start;
}

.design-checklist-block:has(.design-checklist:empty),
.design-checklist-block.hidden {
  display: none !important;
}

.design-section-lede {
  margin: 0;
  font-family: var(--font-ui);
  font-size: var(--text-sm);
  font-weight: var(--weight-regular);
  line-height: var(--leading-body);
  letter-spacing: var(--tracking-body);
  color: var(--silkscreen);
}

.design-layers {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  align-content: start;
}

.design-layer {
  border: 1px solid var(--surface-border, var(--panel-edge));
  border-radius: var(--radius-sm);
  padding: 14px 14px 12px;
  background: var(--surface, rgba(255, 255, 255, 0.025));
  display: grid;
  gap: 12px;
  transition: border-color 0.18s var(--ease-out), background 0.18s var(--ease-out);
}

.design-layer:hover {
  border-color: var(--surface-border-strong, var(--panel-edge-strong));
  background: var(--surface-hover, rgba(255, 255, 255, 0.045));
}

.design-layer-head {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 12px;
  align-items: start;
}

.design-step {
  display: grid;
  place-items: center;
  width: 2.4rem;
  height: 2.4rem;
  margin-top: 0;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  position: relative;
  flex-shrink: 0;
  color: transparent;
  font-size: 0;
}

.design-step-glyph {
  display: grid;
  place-items: center;
}

.design-step-glyph .studio-glyph {
  width: 15px;
  height: 15px;
}

.design-step-n {
  position: absolute;
  right: -5px;
  bottom: -5px;
  min-width: 1.05rem;
  height: 1.05rem;
  padding: 0 3px;
  border-radius: 999px;
  background: #111;
  border: 1px solid rgba(255, 255, 255, 0.18);
  font-family: var(--font-ui);
  font-size: var(--text-xs);
  font-weight: var(--weight-semibold);
  font-variant-numeric: tabular-nums;
  color: #c8c8c8;
  display: grid;
  place-items: center;
  line-height: 1;
}

.design-layer-copy {
  display: grid;
  gap: 6px;
  min-width: 0;
}

.design-layer h3 {
  margin: 0;
  font-family: var(--font-ui);
  font-size: var(--text-lg);
  font-weight: var(--weight-semibold);
  letter-spacing: var(--tracking-title);
  line-height: var(--leading-snug);
  color: var(--brand);
}

.design-goal {
  margin: 0;
  font-family: var(--font-ui);
  font-size: var(--text-base);
  font-weight: var(--weight-regular);
  line-height: var(--leading-body);
  letter-spacing: var(--tracking-body);
  color: #9a9a9a;
}

.design-goal-label {
  color: #c8c8c8;
  font-weight: var(--weight-semibold);
  margin-right: 0.25em;
}

.design-goal-label::after {
  content: none;
}

.design-actions-wrap {
  display: grid;
  gap: 6px;
}

.design-actions-label {
  margin: 0;
  font-family: var(--font-ui);
  font-size: var(--text-xs);
  font-weight: var(--weight-semibold);
  letter-spacing: var(--tracking-label);
  text-transform: uppercase;
  color: var(--silkscreen);
}

.design-actions {
  margin: 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 4px;
  counter-reset: design-action;
}

.design-actions li {
  counter-increment: design-action;
  display: grid;
  grid-template-columns: 1.1rem 1fr;
  gap: 8px;
  align-items: start;
  padding: 8px 0;
  border-radius: 0;
  background: transparent;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  font-family: var(--font-ui);
  font-size: var(--text-base);
  font-weight: var(--weight-regular);
  line-height: var(--leading-body);
  letter-spacing: var(--tracking-body);
  color: var(--readout);
}

.design-actions li:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

.design-actions li::before {
  content: counter(design-action);
  font-family: var(--font-ui);
  font-size: var(--text-xs);
  font-weight: var(--weight-semibold);
  font-variant-numeric: tabular-nums;
  color: #6e6e6e;
  padding-top: 3px;
}

.design-tools {
  border-top: 1px solid rgba(255, 255, 255, 0.07);
  padding-top: 10px;
}

.design-tools summary {
  cursor: pointer;
  list-style: none;
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-ui);
  font-size: var(--text-sm);
  font-weight: var(--weight-medium);
  letter-spacing: var(--tracking-body);
  color: #a8a8a8;
  user-select: none;
}

.design-tools summary::-webkit-details-marker {
  display: none;
}

.design-tools summary::before {
  content: "";
  width: 0.35rem;
  height: 0.35rem;
  border-right: 1.5px solid #8a8a8a;
  border-bottom: 1.5px solid #8a8a8a;
  transform: rotate(-45deg);
  margin-top: -2px;
  transition: transform 0.15s ease;
}

.design-tools[open] summary::before {
  transform: rotate(45deg);
  margin-top: 1px;
}

.design-tools[open] summary {
  color: #e0e0e0;
  margin-bottom: 10px;
}

.design-tools-count {
  font-family: var(--font-ui);
  font-size: var(--text-xs);
  font-weight: var(--weight-medium);
  font-variant-numeric: tabular-nums;
  color: #6a6a6a;
  padding: 1px 6px;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.06);
}

.design-checklist {
  margin: 0;
  list-style: none;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(18rem, 1fr));
  gap: 0 20px;
  counter-reset: design-check;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 10px;
  padding: 4px 14px;
  background: rgba(255, 255, 255, 0.02);
}

.design-checklist li {
  counter-increment: design-check;
  display: grid;
  grid-template-columns: 1.1rem 1fr;
  gap: 10px;
  align-items: start;
  padding: 10px 0;
  border-radius: 0;
  border: none;
  border-bottom: 1px solid rgba(255, 255, 255, 0.07);
  background: transparent;
  font-family: var(--font-ui);
  font-size: var(--text-base);
  font-weight: var(--weight-regular);
  line-height: var(--leading-body);
  letter-spacing: var(--tracking-body);
  color: var(--readout);
}

.design-checklist li:last-child {
  border-bottom: none;
}

.design-checklist li::before {
  content: counter(design-check);
  font-family: var(--font-ui);
  font-size: var(--text-xs);
  font-weight: var(--weight-semibold);
  font-variant-numeric: tabular-nums;
  color: #6e6e6e;
  padding-top: 3px;
}

.master-body {
  display: grid;
  gap: var(--space-4);
  max-width: none;
  align-content: start;
}

.master-steps {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--space-3);
}

.master-step {
  border: 1px solid var(--panel-edge);
  border-radius: var(--radius-sm);
  padding: 14px 16px;
  background: rgba(255, 255, 255, 0.03);
  display: grid;
  gap: 10px;
}

.master-step-head {
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr) auto;
  gap: 10px;
  align-items: start;
}

.master-step-head h3 {
  margin: 0;
  font-family: var(--font-ui);
  font-size: var(--text-lg);
  font-weight: var(--weight-semibold);
  letter-spacing: var(--tracking-title);
}

.master-step-head p {
  margin: 3px 0 0;
  font-size: var(--text-sm);
  color: var(--silkscreen);
}

.master-why {
  margin: 0;
  font-size: var(--text-base);
  line-height: var(--leading-body);
  color: var(--accent-dim);
}

.aff-row {
  display: grid;
  gap: 8px;
  padding-top: 10px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.aff-row-label {
  font-size: var(--text-xs);
  font-weight: var(--weight-semibold);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #6e6e6e;
}

.aff-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.aff-chip {
  display: inline-flex;
  align-items: center;
  max-width: 100%;
  padding: 5px 11px;
  border-radius: var(--radius-btn);
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: transparent;
  color: #c8c8c8;
  font: inherit;
  font-size: var(--text-xs);
  font-weight: var(--weight-medium);
  letter-spacing: -0.01em;
  text-decoration: none;
  line-height: 1.2;
  transition: border-color 0.15s ease, color 0.15s ease, background 0.15s ease;
}

.aff-chip:hover {
  border-color: rgba(255, 255, 255, 0.35);
  color: #f2f2f2;
  background: rgba(255, 255, 255, 0.04);
}

.aff-row .pro-pick-note {
  margin: 0;
}

.section-label {
  margin: 0;
  font-family: var(--font-ui);
  font-size: var(--text-xs);
  font-weight: var(--weight-semibold);
  letter-spacing: var(--tracking-label);
  text-transform: uppercase;
  color: var(--silkscreen);
}

.stage-nav {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 18px;
  padding: 12px var(--studio-gutter) 14px;
  border-top: 1px solid var(--studio-rule);
}

.stage-nav-btn {
  appearance: none;
  border: none;
  background: transparent;
  color: var(--accent-dim);
  font: inherit;
  font-size: var(--text-base);
  font-weight: var(--weight-medium);
  padding: 6px 4px;
  cursor: pointer;
  letter-spacing: var(--tracking-body);
  transition: color 0.15s ease;
}

.stage-nav-btn:hover:not(:disabled) {
  color: var(--accent);
}

.stage-nav-btn:disabled {
  opacity: 0.25;
  cursor: not-allowed;
}

.stage-nav-count {
  font-family: var(--font-ui);
  font-size: var(--text-sm);
  font-variant-numeric: tabular-nums;
  color: var(--silkscreen);
  min-width: 4.5rem;
  text-align: center;
  letter-spacing: var(--tracking-body);
}

.highlights.compact {
  display: none;
}

.console-fold {
  margin-top: var(--space-5);
  border-top: 1px solid var(--studio-rule);
  padding-top: var(--space-3);
}

.console-fold summary {
  cursor: pointer;
  font-family: var(--font-ui);
  font-size: var(--text-sm);
  font-weight: var(--weight-medium);
  color: var(--silkscreen);
  list-style: none;
}

.console-fold summary::-webkit-details-marker {
  display: none;
}

.console-fold[open] summary {
  color: var(--readout);
  margin-bottom: 10px;
}

.console-fold .console {
  margin: 0;
  max-height: 280px;
  font-size: var(--text-xs);
}

.highlights-inline:empty {
  display: none;
}

.highlights-inline.hidden {
  display: none !important;
}

.highlights-inline {
  margin-top: 0;
  font-size: var(--text-base);
}

/* Why panel — priority + measured (story) | build order (rail) */
.why-panel {
  display: grid;
  gap: var(--space-4);
  max-width: none;
  align-content: start;
}

.why-main {
  display: grid;
  grid-template-columns: minmax(0, 1.45fr) minmax(15rem, 0.85fr);
  gap: var(--space-4) var(--space-5);
  align-items: start;
}

.why-primary {
  display: grid;
  gap: var(--space-4);
  min-width: 0;
}

.why-measured {
  padding-top: 0;
  border-top: none;
}

.why-primary:has(.why-priority:not(.hidden):not(:empty)) .why-measured {
  padding-top: 14px;
  border-top: 1px solid rgba(255, 255, 255, 0.07);
}

.why-split {
  display: contents;
}

.why-intent {
  margin: 0;
  padding: 0;
  border: none;
  border-radius: 0;
  background: transparent;
  font-family: var(--font-ui);
  font-size: var(--text-sm);
  font-weight: var(--weight-regular);
  line-height: var(--leading-body);
  letter-spacing: var(--tracking-body);
  color: var(--muted);
  max-width: 40rem;
}

.why-intent:empty {
  display: none;
}

.why-block {
  display: grid;
  gap: 8px;
}

.why-priority {
  gap: 8px;
}

.why-section-lede {
  margin: 0;
  font-family: var(--font-ui);
  font-size: var(--text-sm);
  font-weight: var(--weight-regular);
  line-height: var(--leading-body);
  letter-spacing: var(--tracking-body);
  color: var(--silkscreen);
}

.why-block:has(.why-facts:empty),
.why-block:has(.why-cards:empty),
.why-block:has(.why-order:empty),
.why-block:has(.why-moves:empty) {
  display: none;
}

.why-main:has(.why-order:empty) {
  grid-template-columns: 1fr;
}

.why-main:has(.why-priority.hidden) .why-primary,
.why-main:has(.why-priority:empty) .why-primary {
  gap: 0;
}

.why-facts,
.why-cards,
.why-moves,
.why-order {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0;
}

.why-facts {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
}

.why-measured .why-facts {
  grid-template-columns: repeat(auto-fill, minmax(11.5rem, 1fr));
}

.why-fact {
  display: grid;
  gap: 8px;
  padding: 10px 11px;
  border-radius: var(--radius-xs);
  border: 1px solid var(--surface-border, var(--panel-edge));
  background: var(--surface, rgba(255, 255, 255, 0.025));
  min-width: 0;
  transition: border-color 0.18s var(--ease-out), background 0.18s var(--ease-out);
}

.why-fact:hover {
  border-color: var(--surface-border-strong, var(--panel-edge-strong));
  background: var(--surface-hover, rgba(255, 255, 255, 0.045));
}

.why-fact.is-empty {
  grid-column: 1 / -1;
  border-style: dashed;
  color: var(--silkscreen);
}

.why-fact-top {
  display: flex;
  align-items: center;
  gap: 7px;
  min-width: 0;
}

.why-fact-glyph {
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  border-radius: 7px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  flex-shrink: 0;
}

.why-fact-glyph .studio-glyph {
  width: 14px;
  height: 14px;
}

.why-fact-label {
  font-family: var(--font-ui);
  font-size: var(--text-xs);
  font-weight: var(--weight-semibold);
  letter-spacing: var(--tracking-label);
  text-transform: uppercase;
  color: #8a8a8a;
  line-height: 1.2;
}

.why-fact-text {
  margin: 0;
  font-family: var(--font-ui);
  font-size: var(--text-sm);
  font-weight: var(--weight-regular);
  line-height: 1.4;
  letter-spacing: var(--tracking-body);
  color: var(--readout);
}

.why-card {
  display: grid;
  gap: 0;
  padding: 10px 0;
  border-radius: 0;
  border: none;
  border-bottom: 1px solid rgba(255, 255, 255, 0.07);
  background: transparent;
}

.why-card:last-child {
  border-bottom: none;
}

.why-card-text {
  margin: 0;
  font-family: var(--font-ui);
  font-size: var(--text-md);
  font-weight: var(--weight-regular);
  line-height: var(--leading-body);
  letter-spacing: var(--tracking-body);
  color: var(--readout);
}

.why-card.is-empty {
  border-style: dashed;
  border-width: 1px;
  padding: 12px;
  color: var(--silkscreen);
}

.why-moves {
  gap: 8px;
  counter-reset: none;
  grid-template-columns: 1fr;
}

.why-priority .why-moves {
  grid-template-columns: 1fr;
}

.why-move {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 12px;
  align-items: start;
  padding: 12px 12px 11px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--surface-border, var(--panel-edge));
  background: var(--surface, rgba(255, 255, 255, 0.025));
  transition: border-color 0.18s var(--ease-out), background 0.18s var(--ease-out);
}

.why-move:hover {
  border-color: var(--surface-border-strong, var(--panel-edge-strong));
  background: var(--surface-hover, rgba(255, 255, 255, 0.045));
}

.why-move:last-child {
  border-bottom: 1px solid rgba(255, 255, 255, 0.09);
}

.why-move::before {
  content: none;
}

.why-move-glyph {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: 9px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.why-move-glyph .studio-glyph {
  width: 16px;
  height: 16px;
}

.why-move-copy {
  display: grid;
  gap: 5px;
  min-width: 0;
}

.why-move-stage {
  margin: 0;
  font-family: var(--font-ui);
  font-size: var(--text-xs);
  font-weight: var(--weight-semibold);
  letter-spacing: var(--tracking-label);
  text-transform: uppercase;
  color: var(--silkscreen);
}

.why-move-action {
  margin: 0;
  font-family: var(--font-ui);
  font-size: var(--text-sm);
  font-weight: var(--weight-medium);
  line-height: var(--leading-snug);
  letter-spacing: var(--tracking-body);
  color: var(--brand);
}

.why-move-because {
  margin: 2px 0 0;
  font-family: var(--font-ui);
  font-size: var(--text-xs);
  font-weight: var(--weight-regular);
  line-height: 1.4;
  letter-spacing: var(--tracking-body);
  color: #7a7a7a;
}

.why-rail {
  position: sticky;
  top: 0;
  align-self: start;
}

.why-order {
  gap: 0;
  counter-reset: why-order;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 8px;
  padding: 2px 10px;
  background: rgba(255, 255, 255, 0.02);
  max-height: min(28rem, 70vh);
  overflow: auto;
}

.why-order li {
  counter-increment: why-order;
  display: grid;
  grid-template-columns: 1.1rem 2.75rem 1fr;
  gap: 6px;
  align-items: baseline;
  padding: 7px 0;
  border-radius: 0;
  background: transparent;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  font-family: var(--font-ui);
  font-size: var(--text-sm);
  line-height: 1.35;
  letter-spacing: var(--tracking-body);
  color: var(--readout);
}

.why-order li:last-child {
  border-bottom: none;
}

.why-order li::before {
  content: counter(why-order);
  font-family: var(--font-ui);
  font-size: var(--text-xs);
  font-weight: var(--weight-semibold);
  font-variant-numeric: tabular-nums;
  color: #6e6e6e;
}

.why-order-kind {
  font-size: var(--text-xs);
  font-weight: var(--weight-semibold);
  letter-spacing: var(--tracking-label);
  text-transform: uppercase;
  color: #6a6a6a;
}

.why-order-title {
  color: var(--readout);
  font-weight: var(--weight-medium);
  letter-spacing: var(--tracking-body);
}

.why-order li.is-empty {
  grid-template-columns: 1fr;
  border: none;
  padding: 10px 0;
  color: var(--silkscreen);
}

.why-order li.is-empty::before {
  content: none;
}

.why-order-tip {
  margin: 0;
  padding: 8px 10px;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.07);
  background: rgba(255, 255, 255, 0.02);
  font-family: var(--font-ui);
  font-size: var(--text-sm);
  font-weight: var(--weight-regular);
  line-height: 1.4;
  letter-spacing: var(--tracking-body);
  color: var(--silkscreen);
}

.why-order-tip:empty,
.why-order-tip.hidden {
  display: none !important;
}

.why-panel .console-fold {
  margin-top: 0;
}

.highlights-inline:empty,
.highlights-inline.hidden {
  display: none !important;
}

/* Studio signature / master metrics — dense pack, expand in place */
.studio .readout-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(148px, 1fr));
  gap: 6px;
  grid-auto-flow: dense;
  align-items: stretch;
}

.studio .readout {
  padding: var(--space-2) 10px 7px;
  min-width: 0;
  width: 100%;
  box-sizing: border-box;
  border-radius: var(--radius-xs);
}

.studio .readout.is-explainable {
  appearance: none;
  display: grid;
  gap: 0;
  width: 100%;
  margin: 0;
  text-align: left;
  font: inherit;
  color: inherit;
  cursor: pointer;
  transition:
    border-color 0.15s ease,
    background 0.15s ease,
    box-shadow 0.2s ease,
    padding 0.15s ease,
    transform 0.15s ease;
}

.studio .readout.is-explainable:focus-visible {
  outline: none;
  box-shadow: var(--focus-ring);
}

.studio .readout.is-explainable[aria-expanded="true"] {
  /* Grow in cell — do not span full row (that left random empty holes) */
  grid-column: auto;
  border-color: rgba(255, 255, 255, 0.28);
  background: rgba(12, 12, 12, 0.92);
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.06);
  padding: 8px 10px 9px;
  z-index: 1;
}

.studio .readout-main {
  display: grid;
  gap: 8px;
  min-width: 0;
}

.studio .readout .key {
  font-size: var(--text-xs);
  font-weight: var(--weight-semibold);
  letter-spacing: var(--tracking-label);
  margin-bottom: 0;
  color: var(--silkscreen);
  display: flex;
  align-items: center;
  gap: 6px;
  line-height: 1.2;
}

.studio .readout .key .studio-glyph {
  width: 13px;
  height: 13px;
  opacity: 0.85;
  flex-shrink: 0;
}

.studio .readout-key-text {
  min-width: 0;
}

.studio .readout-meter {
  display: block;
  height: 3px;
  margin: 0;
  border-radius: 99px;
  background: rgba(255, 255, 255, 0.08);
  overflow: hidden;
}

.studio .readout-meter-fill {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, rgba(255, 255, 255, 0.35), rgba(255, 255, 255, 0.75));
  transition: width 0.28s ease-out;
}

.studio .readout.is-explainable:hover {
  border-color: rgba(255, 255, 255, 0.22);
  background: rgba(0, 0, 0, 0.38);
  transform: none;
}

.studio .readout-hint {
  display: inline-grid;
  place-items: center;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  border: 1px solid #4a4a4a;
  color: #8a8a8a;
  font-size: 0.5rem;
  font-weight: 700;
  line-height: 1;
  letter-spacing: 0;
  text-transform: none;
  opacity: 0.85;
  flex-shrink: 0;
}

.studio .readout.is-explainable:hover .readout-hint,
.studio .readout.is-explainable[aria-expanded="true"] .readout-hint {
  border-color: #7a7a7a;
  color: #d0d0d0;
}

.studio .readout .value {
  font-family: var(--font-readout);
  font-size: var(--text-md);
  font-weight: var(--weight-medium);
  letter-spacing: -0.02em;
  line-height: 1.25;
  color: var(--brand);
  font-variant-numeric: tabular-nums;
}

.studio .readout .sub {
  margin-top: 0;
  font-size: var(--text-xs);
  line-height: 1.3;
  color: var(--silkscreen);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.studio .readout-def {
  display: grid;
  gap: 6px;
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.studio .readout-def[hidden] {
  display: none !important;
}

.studio .readout-what,
.studio .readout-reading {
  margin: 0;
  font-size: var(--text-sm);
  line-height: 1.45;
  color: #b8b8b8;
  letter-spacing: -0.01em;
  text-transform: none;
  font-weight: var(--weight-regular);
}

.studio .readout-reading-label {
  display: inline;
  color: #e8e8e8;
  font-weight: 600;
  margin-right: 0.25em;
}

.studio .readout-reading-label::after {
  content: "·";
  margin-left: 0.35em;
  color: #6a6a6a;
  font-weight: 500;
}

/* Signature panel — stacked sections that scroll; never overlap */
.studio [data-panel="signature"] .panel-pad {
  height: 100%;
  min-height: 0;
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  gap: 22px;
  padding-top: clamp(18px, 2.5vh, 26px);
  padding-bottom: clamp(24px, 3.5vh, 40px);
  overflow: auto;
  align-content: start;
}

.studio [data-panel="signature"] .panel-head {
  margin-bottom: 0;
  flex: 0 0 auto;
}

.studio [data-panel="signature"] .readout-grid {
  flex: 0 0 auto;
  gap: 10px;
  grid-template-columns: repeat(auto-fill, minmax(152px, 1fr));
  align-content: start;
}

.studio [data-panel="signature"] .readout {
  padding: 12px 12px 10px;
}

.studio [data-panel="signature"] .readout-main {
  gap: 9px;
}

.studio [data-panel="signature"] .band-meters {
  flex: 0 0 auto;
  margin-top: 0;
  display: grid;
  gap: 11px;
  padding-top: 18px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  align-content: start;
}

.studio [data-panel="signature"] .band-track {
  height: 9px;
}

.studio [data-panel="signature"] .band-row {
  gap: 12px;
  grid-template-columns: 84px minmax(0, 1fr) 52px;
}

.studio [data-panel="master"] .master-body {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.studio .band-meters {
  gap: 5px;
  margin-top: 12px;
}

.studio .band-row {
  grid-template-columns: 72px minmax(0, 1fr) 44px;
  gap: 8px;
}

.studio .band-track {
  height: 7px;
}

.studio .band-row .name,
.studio .band-row .db {
  font-size: var(--text-xs);
}

.studio .summary-list {
  gap: 8px;
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
}

.studio .summary-list li,
.studio .master-note {
  font-size: var(--text-sm);
  line-height: 1.45;
  color: #c8c8c8;
}

.studio .master-note {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 12px;
  align-items: start;
  padding: 10px 11px;
  border-radius: var(--radius-xs);
  border: 1px solid var(--surface-border, var(--panel-edge));
  background: var(--surface, rgba(255, 255, 255, 0.025));
}

.studio .master-note-glyph {
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  border-radius: 7px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.studio .master-note-glyph .studio-glyph {
  width: 13px;
  height: 13px;
}

.gate-overlay {
  position: fixed;
  inset: 0;
  z-index: 120;
  display: grid;
  place-items: center;
  background: rgba(0, 0, 0, 0.78);
  backdrop-filter: blur(12px);
  padding: 24px;
}

.gate-overlay.hidden {
  display: none !important;
}

.gate-card {
  width: min(400px, 100%);
  padding: 36px 30px;
  border-radius: var(--radius);
  background: #0b0b0b;
  border: 1px solid rgba(255, 255, 255, 0.1);
  text-align: center;
  box-shadow: 0 28px 60px rgba(0, 0, 0, 0.55);
}

.gate-card h2 {
  font-family: var(--font-brand);
  font-size: 1.4rem;
  font-weight: var(--weight-bold);
  letter-spacing: -0.035em;
  color: #f4f4f4;
  margin: 0 0 10px;
}

.gate-card p {
  color: #8a8a8a;
  font-size: var(--text-base);
  line-height: 1.5;
  margin: 0 0 24px;
}

.gate-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: center;
}

@media (max-width: 960px) {
  .studio-body {
    height: auto;
    /* svh, not dvh — dvh reflows every frame while the mobile URL bar animates */
    min-height: 100svh;
    overflow-x: hidden;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior-y: none;
    scrollbar-width: none;
    background: #000;
    --studio-sticky-offset: calc(48px + 44px + env(safe-area-inset-top, 0px));
  }

  .studio-body::-webkit-scrollbar {
    display: none;
    width: 0;
    height: 0;
  }

  .studio {
    --studio-gutter: 14px;
    --studio-top-height: auto;
    --studio-sticky-offset: calc(48px + 44px + env(safe-area-inset-top, 0px));
    height: auto;
    min-height: 100svh;
    width: 100%;
    max-width: 100%;
    grid-template-rows: auto 1fr;
    /* Do NOT set overflow here — it breaks position:sticky on the header */
    overflow: visible;
  }

  .studio-top {
    position: sticky;
    top: 0;
    z-index: 60;
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-rows: 48px 44px;
    height: auto;
    padding-top: env(safe-area-inset-top, 0);
    background: #000;
    border-bottom: 1px solid var(--studio-rule);
    /* Isolate so nested sticky children can't escape and scramble layout */
    transform: translateZ(0);
  }

  /* Cover rubber-band / overscroll so no page bg peeks above the sticky bar */
  .studio-top::before {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    bottom: 100%;
    height: 120vh;
    background: #000;
    pointer-events: none;
  }

  .studio-brand {
    grid-column: 1;
    grid-row: 1;
    border-right: none;
    padding: 0 var(--studio-gutter);
    min-width: 0;
  }

  .studio-top-end {
    grid-column: 2;
    grid-row: 1;
    padding: 0 var(--studio-gutter) 0 0;
    min-width: 0;
    align-self: center;
  }

  .studio-logo .logo-word {
    font-size: var(--text-md);
  }

  .studio-tabs {
    grid-column: 1 / -1;
    grid-row: 2;
    justify-self: stretch;
    width: 100%;
    max-width: 100%;
    min-width: 0;
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
    touch-action: pan-x;
    overscroll-behavior-x: contain;
    scrollbar-width: none;
    border-top: 1px solid var(--studio-rule);
    height: 44px;
    padding: 0;
    mask-image: none;
  }

  .studio-tabs::-webkit-scrollbar {
    display: none;
  }

  .studio-tab {
    flex: 0 0 auto;
    padding: 0 14px;
    font-size: var(--text-sm);
    height: 100%;
  }

  .studio-tab[aria-pressed="true"]::after {
    bottom: -1px;
    left: 0;
    right: 0;
  }

  .studio-grid {
    display: flex;
    flex-direction: column;
    width: 100%;
    max-width: 100%;
    min-width: 0;
  }

  /* Uploads / library first, then Chain (plugins below) */
  .studio-source {
    order: 1 !important;
    position: relative;
    top: auto;
    z-index: auto;
    border-right: none;
    border-bottom: 1px solid var(--studio-rule);
    border-top: none;
    max-height: none;
    width: 100%;
    max-width: 100%;
    min-width: 0;
    padding: 0;
    gap: 0;
    background: #000;
    box-shadow: none;
  }

  body.has-playback-dock.studio-body .studio-source {
    top: auto;
  }

  .studio-main {
    order: 2 !important;
  }

  /* No side-panel collapse on mobile — uploads stay visible */
  .source-collapse {
    display: none !important;
  }

  .source-peek {
    display: none !important;
  }

  /* Ignore collapsed state on mobile — always show upload + paste link on Chain */
  .studio.is-source-collapsed .studio-source {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    max-height: none;
    min-height: 0;
    width: 100%;
    padding: 0;
    gap: 0;
    border-top: none;
    border-bottom: 1px solid var(--studio-rule);
    overflow: hidden;
  }

  .studio.is-source-collapsed .source-rail-body {
    display: flex !important;
    flex: 1 1 auto;
    min-width: 0;
    min-height: 0;
    overflow: hidden;
    flex-direction: column;
    align-items: stretch;
  }

  .studio.is-source-collapsed .source-stack,
  .studio.is-source-collapsed .source-dock {
    display: flex !important;
  }

  .studio.is-source-collapsed .source-stack {
    flex-direction: column;
  }

  .studio.is-source-collapsed .studio-brand {
    justify-content: space-between;
    padding: 0 var(--studio-gutter);
  }

  .studio.is-source-collapsed .studio-logo .logo-word {
    display: inline;
  }

  .studio.is-source-collapsed .studio-logo .logo-mark {
    width: 30px;
    height: 14px;
  }

  .studio.is-source-collapsed {
    --studio-rail-width: 300px;
  }

  .studio.is-source-collapsed .studio-grid {
    display: flex;
    flex-direction: column;
  }

  /* One scroll container on mobile — nothing clipped, every row reachable */
  .source-stack {
    padding: 14px 14px 10px;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
  }

  .library-list {
    overflow: visible;
    max-height: none;
    scrollbar-gutter: auto;
    padding-right: 0;
  }

  .library-item-play {
    width: 38px;
    height: 38px;
  }

  .library-item-remove {
    width: 38px;
    height: 38px;
    display: grid;
    place-items: center;
    padding: 0;
  }

  .source-dock {
    padding: 8px 14px 14px;
  }

  .dropzone.compact {
    min-height: 68px;
    padding: 16px 14px;
  }

  .dropzone.compact .drop-hint {
    font-size: var(--text-xs);
  }

  .ghost-btn {
    min-height: 44px;
    padding: 0 16px;
  }

  .link-row.compact input,
  .identity-row.compact input {
    min-height: 44px;
    font-size: 16px; /* avoid iOS zoom */
  }

  .library-list {
    min-height: 5rem;
  }

  .track-play {
    width: 40px;
    height: 40px;
  }

  .source-footer {
    margin-top: 0;
    gap: 10px;
  }

  .mode-seg {
    min-height: 44px;
    padding: 8px 12px;
  }

  .studio-main {
    order: 2;
    width: 100%;
    max-width: 100%;
    min-width: 0;
    min-height: 55vh;
    padding-bottom: calc(18px + env(safe-area-inset-bottom, 0));
    overflow-x: hidden;
  }

  .studio-main.is-tab-swiping {
    overflow: hidden;
  }

  .studio-main.is-tab-swiping > .studio-panel.is-active {
    display: block;
    height: 100%;
    max-height: 100%;
    overflow: hidden;
  }

  .studio-panel {
    padding: 0;
    overflow: visible;
    width: 100%;
    max-width: 100%;
    min-width: 0;
  }

  .studio-panel.is-active {
    display: block;
    min-height: auto;
    overflow: visible;
    width: 100%;
    max-width: 100%;
  }

  .panel-pad {
    padding: 16px var(--studio-gutter) 28px;
    overflow-x: hidden;
    overflow-y: visible;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
  }

  .studio .account-menu-trigger {
    max-width: 9.5rem;
    height: 34px;
    padding: 0 10px 0 3px;
  }

  .studio .account-trigger-label {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .panel-head .panel-title {
    font-size: clamp(1.15rem, 4.5vw, var(--text-display));
  }

  .panel-head h2 {
    font-size: clamp(1.15rem, 4.5vw, var(--text-display));
  }

  .chain-empty {
    padding: 28px 20px 36px;
    max-width: 22rem;
  }

  .chain-empty h2 {
    font-size: var(--text-xl);
  }

  .chain-toolbar {
    flex-wrap: wrap;
    padding: 12px var(--studio-gutter);
    gap: 10px;
    min-height: 0;
    align-items: flex-start;
  }

  .chain-toolbar-title {
    font-size: clamp(1.15rem, 4.5vw, var(--text-display));
  }

  .chain-toolbar-actions {
    width: 100%;
    justify-content: stretch;
    flex-wrap: wrap;
    gap: 8px;
  }

  .chain-toolbar-actions .export-btn {
    flex: 1 1 calc(50% - 4px);
    min-width: 0;
  }

  .hear-strip {
    padding: 10px var(--studio-gutter) 12px;
  }

  .hear-strip-head {
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
  }

  .hear-strip-hint {
    text-align: left;
  }

  .hear-strip-controls {
    gap: 10px;
  }

  .preview-ab-seg {
    width: 100%;
  }

  .preview-ab-btn {
    flex: 1;
  }

  .export-btn {
    height: 44px;
    min-height: 44px;
  }

  .hear-file-row .stem-pick-btn {
    height: 44px;
    min-height: 44px;
  }

  .preview-ab-seg {
    height: 44px;
  }

  .chain-workspace {
    min-height: 0;
    width: 100%;
    max-width: 100%;
    min-width: 0;
    overflow-x: hidden;
    /* Upload / preview chrome above the plugin strip */
    grid-template-rows: auto auto auto minmax(0, 1fr);
    grid-template-areas:
      "chrome"
      "rail"
      "nav"
      "focus";
  }

  .stage-rail-shell {
    position: relative;
    top: auto;
    z-index: 8;
    background: #080808;
    border-bottom: 1px solid var(--studio-rule);
    width: 100%;
    max-width: 100%;
    min-width: 0;
    overflow: hidden;
  }

  .stage-rail-wrap {
    display: flex;
    flex-direction: row;
    flex-wrap: nowrap;
    align-items: center;
    gap: 6px;
    padding: 10px var(--studio-gutter);
    width: 100%;
    max-width: 100%;
    min-width: 0;
    box-sizing: border-box;
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
    touch-action: pan-x;
    overscroll-behavior-x: contain;
    overscroll-behavior-y: none;
    scrollbar-width: none;
  }

  .stage-rail-wrap::-webkit-scrollbar {
    display: none;
  }

  .stage-rail {
    display: contents;
  }

  .stage-rail-divider {
    width: 1px;
    height: 1.4rem;
    margin: 0 4px;
    flex-shrink: 0;
  }

  .stage-chip {
    padding: 7px 10px 7px 7px;
    min-height: 40px;
    gap: 7px;
    flex: 0 0 auto;
    max-width: 11rem;
  }

  .stage-chip-n {
    width: 1.5rem;
    height: 1.5rem;
  }

  .stage-chip-type {
    display: none;
  }

  .stage-chip-title {
    max-width: 7.5rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .stage-chip::after {
    display: none;
  }

  .stage-nav {
    position: relative;
    z-index: 7;
    justify-content: center;
    padding: 8px var(--studio-gutter);
    gap: 12px;
    border-bottom: 1px solid var(--studio-rule);
    background: #050505;
    width: 100%;
    max-width: 100%;
    min-width: 0;
    box-sizing: border-box;
  }

  .stage-nav-btn {
    min-height: 40px;
    padding: 8px 12px;
  }

  .stage-nav-count {
    min-width: 5.5rem;
    text-align: center;
  }

  .stage-nav-count::before {
    content: "Swipe · ";
    font-weight: var(--weight-medium);
    color: #8a8a8a;
    letter-spacing: 0.02em;
  }

  .stage-focus {
    padding: 16px var(--studio-gutter) 28px;
    align-content: start;
    width: 100%;
    max-width: 100%;
    min-width: 0;
    overflow-x: hidden;
    box-sizing: border-box;
    touch-action: pan-y;
  }

  .stage-focus .chain-step {
    grid-template-columns: minmax(0, 1fr);
    grid-template-areas:
      "copy"
      "rack"
      "picks";
    gap: 16px;
    min-height: 0;
    height: auto;
    width: 100%;
    max-width: 100%;
    min-width: 0;
    align-items: start;
    align-content: start;
  }

  .stage-focus .chain-step:not(:has(> .step-rack)) {
    grid-template-areas:
      "copy"
      "picks";
  }

  .stage-focus .chain-step:not(:has(> .pro-picks)) {
    grid-template-areas:
      "copy"
      "rack";
  }

  .stage-focus .chain-step:not(:has(> .step-rack)):not(:has(> .pro-picks)) {
    grid-template-areas: "copy";
  }

  .stage-focus .step-copy,
  .stage-focus .step-rack,
  .stage-focus .step-intro,
  .stage-focus > .chain-step > .pro-picks {
    width: 100%;
    max-width: 100%;
    min-width: 0;
  }

  .stage-focus .step-copy {
    align-content: start;
    gap: 12px;
  }

  .stage-focus .step-rack {
    justify-content: start;
    position: static;
  }

  .stage-focus .step-title {
    font-size: var(--text-xl);
    overflow-wrap: anywhere;
    word-break: break-word;
    white-space: normal;
  }

  .stage-focus .step-why .why,
  .stage-focus .step-why .how,
  .stage-focus .step-copy p,
  .chain-toolbar-copy p,
  .hear-strip-hint {
    overflow-wrap: anywhere;
    word-break: break-word;
  }

  .stage-focus .plugin-face .rack-dials {
    grid-template-columns: repeat(auto-fit, minmax(min(140px, 100%), 1fr));
  }

  .chain-chrome,
  .chain-toolbar,
  .hear-strip {
    width: 100%;
    max-width: 100%;
    min-width: 0;
    box-sizing: border-box;
  }

  .export-btn,
  .hear-file-row .stem-pick-btn,
  .preview-ab-seg {
    max-width: 100%;
    box-sizing: border-box;
  }

  .why-main,
  .why-split,
  .design-split,
  .match-split {
    grid-template-columns: 1fr;
    gap: 14px;
  }

  .why-rail {
    position: static;
  }

  .why-moves,
  .why-facts,
  .why-measured .why-facts,
  .design-layers,
  .design-cues,
  .design-checklist,
  .master-steps,
  .instruments-list {
    grid-template-columns: 1fr;
  }

  .studio .readout-grid {
    grid-template-columns: repeat(auto-fill, minmax(132px, 1fr));
    gap: 5px;
  }

  .studio .readout {
    padding: 7px 9px 6px;
  }

  .studio .readout .value {
    font-size: var(--text-base);
  }

  .design-layers,
  .master-steps {
    gap: 10px;
  }

  .design-layer,
  .master-step {
    padding: 12px 14px;
  }

  .gate-overlay {
    padding: 16px;
    padding-bottom: calc(16px + env(safe-area-inset-bottom, 0));
  }

  .gate-card {
    width: min(100%, 400px);
    padding: 24px 20px;
  }

  .gate-actions {
    flex-direction: column;
  }

  .gate-actions .btn {
    width: 100%;
    justify-content: center;
  }

  .studio.is-analyzing [data-analyze-hero] {
    --mark-w: min(160px, 52vw);
  }

  .studio.has-results .dropzone.compact {
    min-height: 56px;
    padding: 12px 14px;
  }

  .studio.has-results .library-hint {
    display: none;
  }
}

@media (max-width: 720px) {
  .studio-source {
    padding: 12px 12px 14px;
    gap: 10px;
  }

  .blend-picks {
    gap: 4px;
  }

  .blend-slot {
    font-size: 0.7rem;
    padding: 10px 8px;
  }

  .blend-weights {
    grid-template-columns: 1fr;
  }

  .blend-weight {
    min-height: 40px;
  }

  .blend-go {
    min-height: 44px;
  }

  .track-card.compact {
    padding: 10px;
  }

  .track-card.compact .track-title {
    font-size: var(--text-sm);
  }

  .identity-row.compact {
    grid-template-columns: 1fr;
  }

  .chain-toolbar-title {
    font-size: var(--text-display);
  }

  .estimate-note {
    font-size: var(--text-sm);
  }

  .stage-focus .step-title {
    font-size: 1.15rem;
  }

  .rack-bar {
    flex-wrap: wrap;
    gap: 6px 10px;
  }

  .rack-body {
    padding: 12px;
  }

  .rack-dials {
    grid-template-columns: 1fr 1fr;
  }

  .console-fold {
    margin-top: 16px;
  }

  .design-layer-head {
    gap: 10px;
  }

  .design-body {
    gap: 14px;
  }

  .why-order li {
    grid-template-columns: 1.25rem 1fr;
    grid-template-rows: auto auto;
  }

  .why-order li::before {
    grid-row: 1 / span 2;
  }

  .why-order-kind {
    grid-column: 2;
  }

  .why-order-title {
    grid-column: 2;
  }
}

@media (max-width: 480px) {
  .studio-brand {
    padding: 0 10px;
  }

  .studio-top-end {
    padding: 0 10px;
  }

  .studio-tab {
    padding: 0 12px;
    font-size: var(--text-sm);
  }

  .drop-main {
    font-size: var(--text-base);
  }

  .library-item {
    padding: 8px 6px 8px 4px;
    gap: 6px;
  }

  .library-item-title {
    font-size: 0.82rem;
  }

  .mode-row.compact {
    width: 100%;
  }

  .mode-seg {
    flex: 1;
    text-align: center;
  }

  .studio .readout-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 5px;
  }

  .rack-dials {
    grid-template-columns: 1fr;
  }

  .master-step-head {
    grid-template-columns: 24px minmax(0, 1fr);
  }

  .master-step-head .tier {
    grid-column: 2;
  }
}

/* ---------------------------------------------------------------------------
   Compare panel
--------------------------------------------------------------------------- */

.match-setup {
  display: grid;
  gap: 14px;
  max-width: none;
}

.match-lede {
  margin: 0;
  font-size: var(--text-base);
  line-height: 1.6;
  color: var(--silkscreen);
  max-width: 40rem;
}

.match-file {
  max-width: 520px;
}

.match-status {
  margin: 0;
  font-family: var(--font-ui);
  font-size: var(--text-sm);
  color: var(--readout);
}

.match-results {
  display: grid;
  gap: 14px;
  margin-top: 18px;
  align-content: start;
}

.match-split {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(0, 0.9fr);
  gap: 14px 28px;
  align-items: start;
}

.match-split-col {
  display: grid;
  gap: 10px;
  min-width: 0;
}

.match-verdict {
  margin: 0;
  font-size: var(--text-lg);
  font-weight: var(--weight-semibold);
  color: var(--readout);
}

.studio .readout.is-matched .value {
  color: var(--silkscreen);
}

.match-bands-lede {
  margin: -4px 0 8px;
  font-family: var(--font-ui);
  font-size: var(--text-sm);
  font-weight: var(--weight-regular);
  line-height: var(--leading-body);
  color: var(--muted);
}

.match-bands-axis {
  display: grid;
  grid-template-columns: 92px minmax(0, 1fr) 46px;
  align-items: center;
  gap: 10px;
  margin-bottom: 4px;
}

.match-bands-axis-gutter {
  min-width: 0;
}

.match-bands-axis-track {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 6px;
  font-family: var(--font-ui);
  font-size: var(--text-xs);
  font-weight: var(--weight-medium);
  letter-spacing: var(--tracking-label);
  text-transform: uppercase;
  color: var(--silkscreen);
}

.match-bands-axis-track > span:first-child {
  text-align: left;
  color: var(--silkscreen);
}

.match-bands-axis-track > span:last-child {
  text-align: right;
  color: var(--silkscreen);
}

.match-bands-axis-zero {
  font-weight: var(--weight-regular);
  letter-spacing: 0.04em;
  color: var(--lamp-dim);
  text-transform: lowercase;
}

.match-bands-axis-unit {
  font-family: var(--font-mono, "JetBrains Mono", monospace);
  font-size: var(--text-xs);
  color: var(--lamp-dim);
  text-align: right;
}

.match-bands {
  display: grid;
  gap: 6px;
  max-width: none;
}

.match-band-row {
  display: grid;
  grid-template-columns: 92px minmax(0, 1fr) 46px;
  align-items: center;
  gap: 10px;
}

.match-band-row .name {
  font-size: var(--text-xs);
  color: var(--silkscreen);
}

.match-band-row .db,
.match-band-row .db.is-pos,
.match-band-row .db.is-neg {
  font-family: var(--font-mono, "JetBrains Mono", monospace);
  font-size: var(--text-xs);
  font-variant-numeric: tabular-nums;
  color: var(--readout);
  text-align: right;
}

.match-band-track {
  position: relative;
  height: 6px;
  border: none;
  border-radius: 1px;
  background: rgba(255, 255, 255, 0.06);
  overflow: hidden;
}

/* center-zero marker */
.match-band-track::before {
  content: "";
  position: absolute;
  left: 50%;
  top: 0;
  bottom: 0;
  width: 1px;
  background: rgba(255, 255, 255, 0.28);
}

.match-band-fill {
  position: absolute;
  top: 0;
  bottom: 0;
  border-radius: 0;
}

.match-band-fill.is-pos,
.match-band-fill.is-neg {
  background: rgba(255, 255, 255, 0.55);
}

.match-moves {
  margin: 0;
  padding-left: 1.35rem;
  display: grid;
  gap: 12px;
  max-width: 640px;
}

.match-moves li {
  font-size: var(--text-base);
  line-height: 1.55;
}

.match-moves li strong {
  display: block;
  color: var(--readout);
  font-weight: var(--weight-semibold);
}

.match-moves li span {
  color: var(--silkscreen);
  font-size: var(--text-sm);
}

.match-note {
  margin: 0;
  font-size: var(--text-sm);
  color: #8b8b8b;
}
