:root {
  --tool-page: #111827;
  --tool-panel: #f8fafc;
  --tool-stage: #17202e;
  --tool-line: #344254;
  --tool-orange: #ea580c;
  --tool-orange-hover: #c2410c;
}

.music-library-tabs {
  width: min(720px, 100%);
  display: flex;
  justify-content: center;
  gap: 30px;
  margin: -8px auto 28px;
  border-bottom: 1px solid #374151;
}

.music-library-tabs a {
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  padding: 4px 2px;
  color: #cbd5e1;
  border-bottom: 3px solid transparent;
  font-size: 15px;
  text-decoration: none;
}

.music-library-tabs a[aria-current="page"] {
  color: #fff;
  border-color: var(--tool-orange);
  font-weight: 700;
}

.tool-results-page,
.tool-result-detail-page {
  min-height: calc(100vh - 70px);
  padding: 36px 16px 80px;
  color: #fff;
  background: var(--tool-page);
}

.tool-results-wrap,
.tool-result-detail-wrap {
  width: min(1080px, 100%);
  margin: 0 auto;
}

.tool-results-wrap > h1 {
  margin: 0 0 28px;
  text-align: center;
  font-size: 36px;
  line-height: 1.2;
}

.tool-results-intro {
  margin: 0 auto 28px;
  color: #cbd5e1;
  text-align: center;
}

.operation-list { overflow: hidden; color: #1f2937; border: 1px solid #d7dde5; border-radius: 9px; background: #f8fafc; box-shadow: 0 18px 45px rgba(0,0,0,.2); }
.operation-row { display: grid; grid-template-columns: minmax(250px,1.35fr) minmax(130px,.7fr) minmax(160px,auto) auto; align-items: center; gap: 20px; padding: 24px 28px; border-bottom: 1px solid #d7dde5; background: #f8fafc; }
.operation-row:last-child { border-bottom: 0; }
.operation-identity { min-width: 0; display: grid; grid-template-columns: 56px minmax(0,1fr); align-items: center; gap: 16px; }
.operation-icon { width: 56px; height: 56px; display: grid; place-items: center; color: #374151; border-radius: 8px; background: #ffedd5; }
.operation-icon svg { width: 27px; height: 27px; }
.operation-identity h2 { margin: 0 0 3px; color: #1f2937; font-size: 16px; }
.operation-identity p { margin: 0; overflow: hidden; color: #64748b; font-size: 14px; text-overflow: ellipsis; white-space: nowrap; }
.operation-meta { display: grid; gap: 5px; color: #64748b; font-size: 14px; }
.operation-status { display: flex; align-items: center; gap: 12px; color: #1f2937; font-size: 15px; }
.operation-status .operation-state-mark { width: 22px; height: 22px; display: grid; place-items: center; flex: 0 0 auto; border-radius: 50%; font-size: 13px; font-weight: 800; }
.operation-state-mark.completed { color: #047857; background: #d1fae5; }
.operation-state-mark.failed { color: #b91c1c; background: #fee2e2; }
.status-signal { height: 24px; display: inline-flex; align-items: flex-end; gap: 3px; }
.status-signal i { width: 4px; border-radius: 3px; background: #d97706; }
.status-signal i:nth-child(1) { height: 10px; }
.status-signal i:nth-child(2) { height: 18px; }
.status-signal i:nth-child(3) { height: 23px; }
.status-signal.completed i { background: #16a34a; }
.status-signal.failed i { background: #dc2626; }
.status-signal.working i { animation: tool-wave 1.1s ease-in-out infinite alternate; }
.status-signal.working i:nth-child(2) { animation-delay: 120ms; }
.status-signal.working i:nth-child(3) { animation-delay: 240ms; }
.operation-detail-link, .result-download { min-height: 42px; display: inline-flex; align-items: center; justify-content: center; padding: 8px 13px; color: #374151; border: 1px solid #cbd5e1; border-radius: 7px; background: #fff; font-size: 14px; font-weight: 650; text-decoration: none; white-space: nowrap; }
.operation-detail-link:hover, .result-download:hover { border-color: #f97316; color: #9a3412; }
.operation-result { grid-column: 1 / -1; margin: 0 -28px -24px; border-top: 1px solid #d7dde5; background: #fff; }
.result-track { min-height: 76px; display: grid; grid-template-columns: 44px 120px 100px minmax(100px,1fr) auto; align-items: center; gap: 16px; padding: 14px 28px; border-bottom: 1px solid #e5e7eb; }
.result-track:last-child { border-bottom: 0; }
.tool-results-page .result-play { width: 42px; height: 42px; padding: 0 0 0 2px; color: #1f2937; border: 1px solid #cbd5e1; border-radius: 50%; background: #fff; cursor: pointer; }
.result-track [data-track-time] { color: #64748b; font-size: 12px; font-variant-numeric: tabular-nums; }
input.result-progress[type="range"] { appearance: none; -webkit-appearance: none; width: 100%; min-width: 0; height: 44px; margin: 0; padding: 0; border: 0; border-radius: 4px; background: transparent; cursor: pointer; }
input.result-progress[type="range"]::-webkit-slider-runnable-track { height: 4px; border-radius: 4px; background: linear-gradient(to right, #ea580c var(--seek-progress, 0%), #cbd5e1 var(--seek-progress, 0%)); }
input.result-progress[type="range"]::-moz-range-track { height: 4px; border-radius: 4px; background: linear-gradient(to right, #ea580c var(--seek-progress, 0%), #cbd5e1 var(--seek-progress, 0%)); }
input.result-progress[type="range"]::-webkit-slider-thumb { appearance: none; -webkit-appearance: none; width: 12px; height: 12px; margin-top: -4px; border: 0; border-radius: 50%; background: #ea580c; }
input.result-progress[type="range"]::-moz-range-thumb { width: 12px; height: 12px; border: 0; border-radius: 50%; background: #ea580c; }
input.result-progress[type="range"]:focus-visible { outline: 2px solid #ea580c; outline-offset: 3px; }
input.result-progress[type="range"]:disabled { opacity: .5; cursor: default; }
[data-audio-download]:disabled { opacity: .65; cursor: wait; }
.tool-download-message { grid-column: 1 / -1; margin: 0; color: #b91c1c; font-size: 13px; }
.v5-result-row .tool-download-message { color: #fecaca; }
.tool-download-message[hidden] { display: none; }
.operation-message { padding: 20px 28px; }
.operation-message p { margin: 5px 0 0; color: #64748b; overflow-wrap: anywhere; }
.operation-persona { display: flex; align-items: center; justify-content: space-between; gap: 20px; }
.tool-results-empty {
  width: min(672px, 100%);
  margin: 0 auto;
  padding: 42px 24px;
  color: #1f2937;
  text-align: center;
  border: 1px dashed #94a3b8;
  border-radius: 9px;
  background: #f8fafc;
}

.tool-results-empty > span { width: 48px; height: 48px; display: grid; place-items: center; margin: 0 auto 14px; color: #fff; border-radius: 10px; background: #263244; }
.tool-results-empty h2 { margin: 0 0 7px; font-size: 18px; }
.tool-results-empty p { margin: 0; color: #64748b; }

.tool-result-back { display: inline-flex; margin-bottom: 22px; color: #fdba74; text-decoration: none; }
.tool-result-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; margin-bottom: 20px; }
.tool-result-heading p { margin: 0 0 5px; color: #94a3b8; font-size: 12px; }
.tool-result-heading h1 { margin: 0; font-size: 32px; }
.tool-result-heading div > span { display: block; margin-top: 5px; color: #cbd5e1; }
.tool-result-body { min-height: 360px; padding: 24px; border: 1px solid #344254; border-radius: 14px; background: #17202e; }
.tool-result-waiting { min-height: 310px; display: grid; place-items: center; align-content: center; gap: 14px; }
.tool-result-waiting h2 { margin: 0; font-size: 18px; }
.tool-result-wave { height: 70px; display: flex; align-items: center; gap: 6px; color: #fb923c; }
.tool-result-wave i { width: 4px; height: 30%; border-radius: 5px; background: currentColor; animation: tool-wave 1s ease-in-out infinite alternate; }
.tool-result-wave i:nth-child(2n) { height: 75%; animation-delay: 120ms; }
.tool-result-wave i:nth-child(3n) { height: 48%; animation-delay: 240ms; }
@keyframes tool-wave { to { transform: scaleY(1.45); opacity: .55; } }
.tool-result-message { min-height: 310px; display: grid; place-items: center; align-content: center; text-align: center; }
.tool-result-message strong { font-size: 20px; }
.tool-result-message p { margin: 7px 0 0; color: #cbd5e1; }
.tool-result-assets { display: grid; gap: 10px; }
.tool-result-asset { min-height: 72px; display: grid; grid-template-columns: 44px minmax(0, 1fr) auto; align-items: center; gap: 13px; padding: 12px; border: 1px solid #46566c; border-radius: 9px; background: #202b3b; }
.tool-result-asset audio { display: none; }
.tool-result-asset strong, .tool-result-asset span { display: block; }
.tool-result-asset span { margin-top: 2px; color: #94a3b8; font-size: 12px; }
.tool-result-play { width: 42px; height: 42px; color: #fff; border: 1px solid #64748b; border-radius: 50%; background: #263244; }
.persona-result-card { min-height: 260px; display: grid; grid-template-columns: 64px minmax(0, 1fr); align-items: center; gap: 18px; padding: 26px; border: 1px solid #c65d20; border-radius: 14px; background: #33251f; }
.persona-result-card > span { width: 56px; height: 56px; display: grid; place-items: center; color: #7c2d12; border-radius: 12px; background: #fed7aa; font-size: 22px; font-weight: 900; }
.persona-result-card h2 { margin: 0; }
.persona-result-card p { margin: 6px 0 0; color: #cbd5e1; }

@media (max-width: 1000px) {
  .operation-row { grid-template-columns: minmax(0,1fr) auto; gap: 16px; }
}
@media (max-width: 620px) {
  .operation-row { grid-template-columns: 1fr; gap: 14px; padding: 20px 18px; }
  .operation-result { margin: 2px -18px -20px; }
  .result-track { grid-template-columns: 42px minmax(0,1fr); gap: 10px; padding: 16px 18px; }
  .result-track > [data-track-time] { grid-column: 2; }
  .result-track .result-progress, .result-download { grid-column: 1 / -1; }
  .operation-persona { align-items: stretch; flex-direction: column; }
  .operation-message { padding: 18px; }
  .operation-meta { justify-items: start; }
  .operation-detail-link { width: 100%; }
  .tool-result-heading { align-items: flex-start; flex-direction: column; }
  .tool-result-asset { grid-template-columns: 44px minmax(0, 1fr); }
  .tool-result-asset > a { grid-column: 1 / -1; }
}

@media (prefers-reduced-motion: reduce) {
  .tool-result-wave i, .status-signal i { animation: none; }
}

/* V5.2 已确认的新工具工作区。旧页面不使用这些作用域类。 */
.music-tool-page { background: var(--tool-page); }
.v5-tool-main [hidden], .tool-results-page [hidden] { display: none !important; }
.v5-tool-main {
  width: min(1216px, calc(100% - 32px));
  min-height: calc(100vh - 70px);
  margin: 0 auto;
  padding: 36px 0 88px;
  color: #fff;
  text-align: start;
}
.v5-tool-heading { text-align: center; }
.v5-tool-heading h1 { margin: 0; color: #fff; font-size: 36px; font-weight: 800; letter-spacing: -.025em; }
.v5-tool-heading .tool-intro { width: min(680px, 100%); margin: 9px auto 28px; color: #cbd5e1; font-size: 17px; }
.v5-tool-shell {
  width: 100%;
  display: grid;
  grid-template-columns: minmax(330px, .78fr) minmax(480px, 1.22fr);
  align-items: stretch;
  gap: 0;
  overflow: hidden;
  color: #1f2937;
  border: 1px solid #344254;
  border-radius: 16px;
  background: #17202e;
  box-shadow: 0 18px 46px rgba(0,0,0,.18);
}
.v5-tool-shell.stem-picker-open { position: relative; z-index: 2; overflow: visible; }
.v5-tool-setup { min-width: 0; padding: 22px; overflow: visible; border-right: 1px solid #344254; background: #f8fafc; }
.v5-setup-heading { min-height: 34px; display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 18px; }
.v5-setup-heading strong { display: block; color: #111827; font-size: 18px; line-height: 1.35; }
.selected-source-label,
.tool-field-title { margin: 0 0 7px; color: #374151; font-size: 13px; font-weight: 750; }
.source-choice {
  width: 100%;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin-bottom: 10px;
  overflow: hidden;
  border: 1px solid #d7dde5;
  border-radius: 10px;
  background: #eef2f6;
}
.source-choice button {
  min-width: 0;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 8px 10px;
  color: #64748b;
  border: 0;
  border-radius: 0;
  background: transparent;
  font-size: 13px;
  font-weight: 700;
  white-space: nowrap;
  cursor: pointer;
}
.source-choice button + button { border-left: 1px solid #d7dde5; }
.source-choice button[data-source-tab="song"]::before,
.source-choice button[data-source-b-tab="song"]::before { content: "♫"; font-size: 15px; }
.source-choice button[data-source-tab="upload"]::before,
.source-choice button[data-source-b-tab="upload"]::before { content: "↑"; font-size: 16px; font-weight: 800; }
.source-choice button.active { color: #9a3412; background: #fff; box-shadow: 0 1px 3px rgba(15,23,42,.1); }
.source-row { min-height: 74px; display: grid; grid-template-columns: 52px minmax(0, 1fr) auto; align-items: center; gap: 10px; padding: 10px; border: 1px solid #d7dde5; border-radius: 9px; background: #fff; }
.source-row img { width: 52px; height: 52px; object-fit: cover; border-radius: 7px; }
.source-copy { min-width: 0; }
.source-copy strong,
.source-copy span { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.source-copy strong { color: #111827; font-size: 14px; }
.source-copy span { margin-top: 3px; color: #64748b; font-size: 12px; }
.change-source { min-height: 34px; padding: 6px 9px; color: #9a3412; border: 1px solid #fdba74; border-radius: 7px; background: #fff7ed; font-size: 12px; font-weight: 700; cursor: pointer; }
.source-picker { margin-top: 8px; padding: 10px; border: 1px solid #d7dde5; border-radius: 9px; background: #fff; }
.source-picker.always-visible { margin-top: 8px; }
.source-picker label { display: block; margin-bottom: 6px; color: #475569; font-size: 12px; font-weight: 700; }
.second-source { margin-top: 18px; padding-top: 16px; border-top: 1px solid #d7dde5; }
.second-source .source-row { grid-template-columns: minmax(0, 1fr); }
.upload-input { position: absolute; width: 1px; height: 1px; overflow: hidden; opacity: 0; pointer-events: none; }
.upload-box { margin-top: 10px; overflow: hidden; border: 1px solid #cbd5e1; border-radius: 10px; background: #f8fafc; }
.source-choice:has(~ .upload-box:not([hidden])) { margin-bottom: 0; border-radius: 10px 10px 0 0; }
.source-choice ~ .upload-box { margin-top: 0; border-top: 0; border-radius: 0 0 10px 10px; }
.upload-box:not(.has-file):hover,
.upload-box:not(.has-file):focus-within { border-color: #f97316; background: #fffaf5; }
.upload-empty { width: 100%; min-height: 172px; display: flex; align-items: center; justify-content: center; flex-direction: column; padding: 20px; color: inherit; border: 0; background: transparent; text-align: center; cursor: pointer; }
.v5-upload-visual { width: min(230px, 92%); height: 70px; position: relative; display: grid; place-items: center; margin-bottom: 10px; }
.v5-upload-wave { width: 100%; height: 42px; display: flex; align-items: center; justify-content: center; gap: 5px; color: #cbd5e1; }
.v5-upload-wave i { width: 3px; height: var(--bar, 28%); display: block; border-radius: 999px; background: currentColor; }
.v5-upload-wave i:nth-child(3n+1) { --bar: 72%; }
.v5-upload-wave i:nth-child(4n+2) { --bar: 44%; }
.v5-upload-wave i:nth-child(5n+3) { --bar: 92%; }
.v5-upload-wave i:nth-child(n+8):nth-child(-n+12) { color: #fb923c; }
.upload-icon { width: 42px; height: 42px; position: absolute; inset: 50% auto auto 50%; display: grid; place-items: center; color: #fff; border: 4px solid #f8fafc; border-radius: 50%; background: #ea580c; box-shadow: 0 5px 16px rgba(194,65,12,.28); transform: translate(-50%, -50%); }
.upload-icon svg { width: 19px; height: 19px; }
.upload-empty strong { color: #111827; font-size: 14px; }
.upload-callout { min-height: 34px; display: inline-flex; align-items: center; margin-top: 8px; padding: 6px 12px; color: #9a3412; border: 1px solid #fdba74; border-radius: 999px; background: #fff; font-size: 12px; }
.upload-selected { min-height: 112px; display: grid; grid-template-columns: 48px minmax(0, 1fr); align-items: center; gap: 6px 12px; padding: 16px; }
.upload-selected::before { content: "♫"; width: 48px; height: 48px; display: grid; place-items: center; color: #fff; border-radius: 9px; background: #263244; font-size: 20px; }
.upload-file-copy { min-width: 0; padding: 0; overflow: hidden; color: #111827; border: 0; background: transparent; text-align: left; cursor: pointer; }
.upload-file-copy strong,
.upload-file-copy span { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.upload-file-copy span { margin-top: 3px; color: #64748b; font-size: 12px; }
.upload-file-actions { grid-column: 2; display: flex; gap: 8px; }
.text-button { padding: 0; color: #9a3412; border: 0; background: transparent; font-size: 12px; font-weight: 700; text-decoration: none; cursor: pointer; }
.text-button.muted { color: #64748b; }
.upload-error,
.tool-form-error { margin: 9px 0 0; color: #b91c1c; font-size: 12px; }
.tool-field { margin-top: 16px; }
fieldset.tool-field { min-inline-size: 0; margin: 16px 0 0; padding: 0; border: 0; }
fieldset.tool-field > legend { width: 100%; margin: 0 0 7px; padding: 0; }
.tool-field > label,
.field-label { display: block; margin-bottom: 7px; color: #374151; font-size: 13px; font-weight: 700; }
.v5-tool-setup input:not([type="radio"]):not([type="checkbox"]):not([type="file"]):not([type="hidden"]),
.v5-tool-setup textarea,
.v5-tool-setup select { width: 100%; min-height: 44px; padding: 10px 12px; color: #111827; border: 1px solid #cbd5e1; border-radius: 8px; background: #fff; font: inherit; }
.v5-tool-setup textarea { min-height: 102px; resize: vertical; }
.v5-tool-setup textarea.section-lyrics { height: 144px; min-height: 144px; max-height: 144px; resize: none; }
.v5-tool-setup .source-preview { display: block; width: 100%; margin: 0 0 16px; }
.v5-tool-setup input[type="radio"],
.v5-tool-setup input[type="checkbox"] { accent-color: var(--tool-orange); }
.hint { margin: 7px 0 0; color: #64748b; font-size: 12px; }
.tool-fields[inert] { opacity: .55; }
.stem-picker { position: relative; }
.stem-picker-trigger {
  width: 100%;
  min-height: 44px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
  color: #1f2937;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  background: #fff;
  font: inherit;
  text-align: left;
  cursor: pointer;
}
.stem-picker-trigger:hover { border-color: #9ca3af; }
.stem-picker-trigger:focus-visible { outline: 2px solid var(--tool-orange); outline-offset: 2px; }
.stem-picker-trigger svg { width: 18px; height: 18px; flex: 0 0 auto; color: #64748b; transition: transform .18s ease; }
.stem-picker-trigger[aria-expanded="true"] svg { transform: rotate(180deg); }
.stem-picker-backdrop { position: fixed; inset: 0; z-index: 69; padding: 0; border: 0; background: transparent; }
.stem-picker-panel {
  width: 100%;
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  z-index: 70;
  padding: 12px;
  color: #1f2937;
  border: 1px solid #d7dde5;
  border-radius: 10px;
  background: #fff;
  box-shadow: 0 6px 12px rgba(15,23,42,.14);
}
.stem-picker-panel:focus { outline: none; }
.stem-picker-mobile-head { display: none; }
.stem-picker-search { position: relative; }
.stem-picker-search svg { width: 17px; height: 17px; position: absolute; top: 50%; left: 12px; color: #64748b; transform: translateY(-50%); pointer-events: none; }
#target-stem-search { padding-left: 38px; }
.stem-picker-heading { margin: 12px 2px 7px; color: #64748b; font-size: 12px; font-weight: 700; }
.stem-picker-options { max-height: 250px; display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 4px; overflow-y: auto; overscroll-behavior: contain; }
.stem-picker-options[data-mode="all"],
.stem-picker-options[data-mode="search"] { grid-template-columns: 1fr; }
.stem-picker-option { min-height: 38px; display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 7px 9px; color: #374151; border: 0; border-radius: 6px; background: transparent; font: inherit; font-size: 13px; text-align: left; cursor: pointer; }
.stem-picker-option:hover,
.stem-picker-option:focus-visible { background: #f3f4f6; outline: none; }
.stem-picker-option[aria-selected="true"] { color: #9a3412; background: #fff7ed; font-weight: 700; }
.stem-picker-option[aria-selected="true"]::after { content: "✓"; flex: 0 0 auto; }
.stem-picker-more { min-height: 34px; margin-top: 8px; padding: 5px 2px; color: #9a3412; border: 0; background: transparent; font-size: 12px; font-weight: 700; cursor: pointer; }
.stem-picker-empty { margin: 14px 2px 6px; color: #64748b; font-size: 13px; }
.inline-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.advanced { margin-top: 15px; border: 1px solid #d7dde5; border-radius: 9px; background: #fff; }
.advanced summary { min-height: 44px; display: flex; align-items: center; padding: 9px 12px; color: #475569; font-size: 13px; font-weight: 700; cursor: pointer; }
.advanced-body { padding: 0 12px 14px; }
.v5-choice-grid { display: grid; gap: 9px; margin-top: 8px; }
.v5-choice-card { min-height: 50px; display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 10px; margin: 0; padding: 10px 11px; color: #1f2937; border: 1px solid #d7dde5; border-radius: 9px; background: #fff; cursor: pointer; }
.v5-choice-card:has(input:checked) { border-color: #f97316; box-shadow: 0 0 0 1px #f97316; }
.v5-choice-copy strong,
.v5-choice-copy small { display: block; }
.v5-choice-copy small { margin-top: 1px; color: #64748b; font-size: 12px; }
.v5-choice-meta { color: #7c2d12; font-size: 12px; font-weight: 750; white-space: nowrap; }
.v5-segmented { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 4px; padding: 4px; border-radius: 9px; background: #e5e7eb; }
.v5-segmented label { min-height: 40px; display: grid; place-items: center; margin: 0; padding: 7px; border-radius: 7px; color: #64748b; font-size: 13px; font-weight: 700; cursor: pointer; }
.v5-segmented label:has(input:checked) { color: #9a3412; background: #fff; box-shadow: 0 1px 3px rgba(15,23,42,.12); }
.v5-segmented input { position: absolute; opacity: 0; pointer-events: none; }
.v5-mini-timeline { height: 52px; display: grid; grid-template-columns: 1fr 28% 1fr; align-items: center; margin-top: 4px; }
.v5-mini-timeline span { height: 16px; background: #cbd5e1; }
.v5-mini-timeline span:first-child { border-radius: 8px 0 0 8px; }
.v5-mini-timeline span:last-child { border-radius: 0 8px 8px 0; }
.v5-mini-timeline i { height: 30px; border-block: 2px solid #f97316; background: #ffedd5; }
.tool-cta-row { display: flex; align-items: stretch; flex-direction: column; gap: 9px; margin-top: 20px; }
.tool-access { margin: 0; color: #64748b; font-size: 12px; }
.tool-primary,
.v5-stage-actions .primary,
.v5-song-details { min-height: 48px; display: inline-flex; align-items: center; justify-content: center; padding: 10px 16px; color: #fff; border: 1px solid #ea580c; border-radius: 8px; background: #ea580c; font-size: 14px; font-weight: 800; text-decoration: none; cursor: pointer; }
.tool-primary:hover,
.v5-stage-actions .primary:hover,
.v5-song-details:hover { background: #c2410c; }
.tool-primary:disabled { opacity: .65; cursor: wait; }
.v5-tool-setup.is-locked input,
.v5-tool-setup.is-locked select,
.v5-tool-setup.is-locked textarea,
.v5-tool-setup.is-locked button { pointer-events: none; }

.v5-tool-stage { min-width: 0; min-height: 520px; overflow: hidden; color: #e5e7eb; background: #17202e; }
.v5-tool-main[data-layout="split"] .v5-tool-stage { min-height: 610px; }
.v5-tool-main[data-layout="compact"] { width: min(1040px, calc(100% - 32px)); }
.v5-tool-main[data-layout="compact"] .v5-tool-shell { grid-template-columns: minmax(300px, 380px) minmax(0, 1fr); }
.v5-tool-main[data-layout="compact"] .v5-tool-stage { min-height: 470px; }
.v5-stage-shell { min-height: 518px; display: flex; flex-direction: column; }
[data-layout="split"] .v5-stage-shell { min-height: 608px; }
[data-layout="compact"] .v5-stage-shell { min-height: 468px; }
.v5-stage-head { display: flex; align-items: center; justify-content: space-between; gap: 18px; padding: 22px 24px 12px; }
.v5-stage-head h2 { margin: 0; color: #fff; font-size: 18px; letter-spacing: -.01em; }
.v5-stage-body { min-height: 0; flex: 1; display: flex; flex-direction: column; padding: 12px 24px 24px; }
.v5-stage-canvas { min-height: 290px; flex: 1; position: relative; display: grid; place-items: center; overflow: hidden; }
.v5-stage-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 10px; margin-top: 18px; }
.v5-stage-actions .secondary,
.v5-result-row .secondary { min-height: 44px; display: inline-flex; align-items: center; justify-content: center; padding: 8px 13px; color: #f8fafc; border: 1px solid #64748b; border-radius: 8px; background: #263244; font-size: 13px; font-weight: 700; text-decoration: none; cursor: pointer; }
.v5-status-mark { width: 28px; height: 28px; display: grid; place-items: center; border-radius: 50%; font-size: 16px; font-weight: 900; }
.v5-status-mark.completed { color: #064e3b; background: #6ee7b7; }
.v5-status-mark.failed { color: #7f1d1d; background: #fecaca; }
.v5-idle-stage { width: min(540px, 100%); margin: auto; text-align: center; }
.v5-failed-canvas { isolation: isolate; }
.v5-scene-echo { position: absolute; inset: 12px; display: grid; place-items: center; opacity: .12; filter: grayscale(1); pointer-events: none; }
.v5-failed-panel { width: min(540px, 100%); position: relative; z-index: 1; margin: auto; padding: 22px; text-align: center; border: 1px solid #5d3940; border-radius: 12px; background: rgba(23,32,46,.94); }
.v5-failed-panel .v5-status-mark { width: 50px; height: 50px; margin: 0 auto 14px; font-size: 23px; }
.v5-failed-panel p { margin: 0 auto; color: #cbd5e1; }
.v5-failed-panel .v5-refund-note { margin-top: 7px; color: #fdba74; font-size: 13px; }
.v5-failed-panel .v5-stage-actions { justify-content: center; }

.v5-wave-bars { height: 94px; display: flex; align-items: center; justify-content: center; gap: 4px; }
.v5-wave-bars span { width: 4px; height: var(--h,34%); border-radius: 4px; background: currentColor; transform-origin: center; }
.v5-wave-bars span:nth-child(3n+1) { --h: 72%; }
.v5-wave-bars span:nth-child(4n+2) { --h: 42%; }
.v5-wave-bars span:nth-child(5n+3) { --h: 90%; }
.v5-wave-bars span:nth-child(7n+4) { --h: 58%; }
.v5-stage-shell[data-status="generating"] .v5-wave-bars span { animation: v5-wave 1.1s ease-in-out infinite alternate; }
.v5-stage-shell[data-status="generating"] .v5-wave-bars span:nth-child(3n) { animation-delay: 160ms; }
.v5-stage-shell[data-status="generating"] .v5-wave-bars span:nth-child(4n) { animation-delay: 310ms; }
@keyframes v5-wave { from { transform: scaleY(.35); opacity: .45; } to { transform: scaleY(1); opacity: 1; } }
.v5-stems-scene { width: min(700px,94%); display: grid; gap: 14px; }
.v5-stem-source { color: #fb923c; border-radius: 10px; background: #263244; }
.v5-stem-source .v5-wave-bars { height: 72px; }
.v5-stem-lanes { display: grid; gap: 10px; }
.v5-stem-lane { min-height: 42px; display: grid; grid-template-columns: 92px minmax(0,1fr); align-items: center; gap: 12px; padding: 8px 12px; border: 1px solid #46566c; border-radius: 8px; background: #202b3b; }
.v5-stem-lane strong { color: #cbd5e1; font-size: 12px; }
.v5-stem-lane i { height: 7px; border-radius: 6px; background: #64748b; transform-origin: left; }
.v5-stage-shell[data-status="generating"] .v5-stem-lane { animation: v5-stem-open 1.7s ease-in-out infinite; }
@keyframes v5-stem-open { 0%,18% { transform: translateY(-22px) scaleX(.82); opacity:.25; } 65%,100% { transform:none; opacity:1; } }
.v5-extend-scene { width: min(720px,96%); }
.v5-timeline-labels,.v5-time-ruler { display:flex; justify-content:space-between; color:#94a3b8; font-size:12px; font-variant-numeric:tabular-nums; }
.v5-timeline-labels { margin-bottom:10px; }
.v5-extend-track { height:116px; display:grid; grid-template-columns:58% 2px 42%; align-items:center; }
.v5-extend-source,.v5-extend-tail { height:70px; overflow:hidden; border-radius:10px; }
.v5-extend-source { color:#94a3b8; background:#263244; }
.v5-extend-tail { color:#fb923c; background:#3b2a21; transform-origin:left; }
.v5-extend-source .v5-wave-bars,.v5-extend-tail .v5-wave-bars { height:70px; }
.v5-extend-join { width:2px; height:116px; background:#fb923c; }
.v5-stage-shell[data-status="generating"] .v5-extend-tail { animation:v5-extend 1.9s ease-in-out infinite; }
@keyframes v5-extend { 0%,18% { transform:scaleX(.05); opacity:.3; } 72%,100% { transform:scaleX(1); opacity:1; } }
.v5-cover-scene { width:min(680px,96%); display:grid; grid-template-columns:1fr 70px 1fr; align-items:center; gap:16px; }
.v5-performance-card { min-height:230px; display:flex; flex-direction:column; justify-content:space-between; padding:18px; border:1px solid #46566c; border-radius:12px; background:#202b3b; }
.v5-performance-card.new { border-color:#c65d20; background:#33251f; }
.v5-performance-card span { color:#94a3b8; font-size:12px; font-weight:650; }
.v5-performance-card strong { color:#fff; }
.v5-cover-bridge { position:relative; height:2px; background:#64748b; }
.v5-cover-bridge::after { content:"›"; position:absolute; top:50%; right:-2px; color:#fb923c; font-size:32px; transform:translateY(-54%); }
.v5-stage-shell[data-status="generating"] .v5-performance-card.new { animation:v5-cover-reveal 1.8s ease-in-out infinite; }
@keyframes v5-cover-reveal { 0%,20% { transform:translateX(-24px); opacity:.25; } 70%,100% { transform:none; opacity:1; } }
.v5-replace-scene { width:min(720px,96%); }
.v5-replace-track { height:126px; display:grid; grid-template-columns:1fr minmax(150px,28%) 1fr; align-items:center; }
.v5-replace-fixed { height:68px; background:#334155; }
.v5-replace-fixed:first-child { border-radius:10px 0 0 10px; }
.v5-replace-fixed:last-child { border-radius:0 10px 10px 0; }
.v5-replace-zone { height:92px; display:flex; align-items:center; justify-content:space-evenly; padding:0 12px; border-block:2px solid #fb923c; background:#3b2a21; }
.v5-replace-zone i { width:9px; height:52px; border-radius:5px; background:#fb923c; }
.v5-stage-shell[data-status="generating"] .v5-replace-zone i { animation:v5-rebuild 1.2s ease-in-out infinite alternate; }
.v5-stage-shell[data-status="generating"] .v5-replace-zone i:nth-child(2n) { animation-delay:170ms; }
@keyframes v5-rebuild { from { transform:scaleY(.22); opacity:.35; } to { transform:scaleY(1); opacity:1; } }
.v5-vocals-scene { width:min(680px,96%); display:grid; grid-template-columns:minmax(190px,.72fr) minmax(0,1.28fr); gap:22px; align-items:center; }
.v5-lyric-sheet { min-height:240px; padding:18px; border-radius:10px; color:#cbd5e1; background:#202b3b; }
.v5-lyric-sheet strong { display:block; color:#fff; }
.v5-lyric-sheet i { height:7px; display:block; margin-top:14px; border-radius:4px; background:#536176; }
.v5-vocal-stack { position:relative; padding:20px 0; }
.v5-vocal-stack .bed { color:#64748b; border-radius:10px; background:#263244; }
.v5-vocal-curve { position:absolute; left:4%; right:4%; top:50%; height:5px; border-radius:6px; background:#fb923c; box-shadow:24px -22px 0 #fb923c,56px 18px 0 #fb923c,94px -12px 0 #fb923c; }
.v5-stage-shell[data-status="generating"] .v5-vocal-curve { animation:v5-vocal 1.6s ease-in-out infinite; }
@keyframes v5-vocal { 0%,18% { transform:scaleX(.08); opacity:.25; } 70%,100% { transform:scaleX(1); opacity:1; } }
.v5-instrumental-scene { width:min(690px,96%); }
.v5-arrangement-bands { display:grid; gap:15px; }
.v5-arrangement-band { height:28px; border-radius:8px; background:#334155; transform-origin:center; }
.v5-arrangement-band:nth-child(2) { width:86%; justify-self:center; background:#46566c; }
.v5-arrangement-band:nth-child(3) { width:68%; justify-self:center; background:#7c4a2c; }
.v5-arrangement-result { height:66px; margin-top:30px; overflow:hidden; color:#fb923c; border:1px solid #8a4a24; border-radius:10px; background:#33251f; }
.v5-arrangement-result .v5-wave-bars { height:64px; }
.v5-stage-shell[data-status="generating"] .v5-arrangement-band { animation:v5-arrange 1.6s ease-in-out infinite; }
@keyframes v5-arrange { 0%,18% { transform:translateX(-34px) scaleX(.75); opacity:.25; } 68%,100% { transform:none; opacity:1; } }
.v5-mashup-scene { width:min(730px,96%); display:grid; grid-template-columns:1fr 86px 1fr; align-items:center; gap:8px; }
.v5-mash-source { display:grid; gap:9px; padding:16px; border:1px solid #46566c; border-radius:10px; background:#202b3b; }
.v5-mash-source strong { color:#fff; }
.v5-mash-source i { height:9px; border-radius:6px; background:#64748b; }
.v5-mash-merge { width:54px; height:94px; place-self:center; display:grid; place-items:center; color:#fb923c; border:2px solid #c65d20; border-radius:13px; font-size:24px; font-weight:900; }
.v5-mash-output { grid-column:1/-1; width:68%; height:42px; margin-top:24px; justify-self:center; border-radius:9px; background:#c65d20; transform-origin:center; }
.v5-stage-shell[data-status="generating"] .v5-mash-source:first-child { animation:v5-mash-a 1.8s ease-in-out infinite; }
.v5-stage-shell[data-status="generating"] .v5-mash-source:nth-child(3) { animation:v5-mash-b 1.8s ease-in-out infinite; }
.v5-stage-shell[data-status="generating"] .v5-mash-output { animation:v5-mash-out 1.8s ease-in-out infinite; }
@keyframes v5-mash-a { 0%,20% { transform:translateX(-24px); opacity:.35; } 66%,100% { transform:translateX(10px); opacity:1; } }
@keyframes v5-mash-b { 0%,20% { transform:translateX(24px); opacity:.35; } 66%,100% { transform:translateX(-10px); opacity:1; } }
@keyframes v5-mash-out { 0%,44% { transform:scaleX(.05); opacity:0; } 80%,100% { transform:scaleX(1); opacity:1; } }
.v5-sound-scene { width:min(580px,96%); }
.v5-sound-scope { padding:26px; color:#fb923c; border:1px solid #704323; border-radius:14px; background:#201d20; }
.v5-sound-scope .v5-wave-bars { height:150px; }
.v5-loop-line { display:flex; align-items:center; justify-content:space-between; margin-top:14px; color:#94a3b8; font-size:12px; }
.v5-loop-line i { flex:1; height:1px; margin:0 10px; background:#64748b; }
.v5-result-list { display:grid; gap:10px; }
.v5-result-row { min-height:68px; display:grid; grid-template-columns:44px minmax(120px,.65fr) minmax(120px,1fr) auto; align-items:center; gap:13px; padding:11px 12px; border:1px solid #46566c; border-radius:9px; background:#202b3b; }
.v5-result-row audio { display:none; }
.result-play { width:42px; height:42px; display:grid; place-items:center; color:#fff; border:1px solid #64748b; border-radius:50%; background:#263244; cursor:pointer; }
.v5-result-row strong,.v5-result-row span { display:block; }
.v5-result-row strong { color:#f8fafc; }
.v5-result-row span { margin-top:2px; color:#94a3b8; font-size:12px; }
.v5-song-result { display:grid; grid-template-columns:64px minmax(0,1fr) auto; align-items:center; gap:12px 16px; padding:16px; border:1px solid #46566c; border-radius:12px; background:#202b3b; }
.v5-song-result > img { width:64px; height:64px; grid-row:1/3; object-fit:cover; border-radius:9px; }
.v5-song-copy { min-width:0; }
.v5-song-copy strong,.v5-song-copy span { display:block; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.v5-song-copy strong { color:#fff; }
.v5-song-copy span { margin-top:2px; color:#94a3b8; font-size:12px; }
.v5-inline-player { min-width:0; grid-column:2/4; display:grid; grid-template-columns:42px auto minmax(120px,1fr) auto; align-items:center; gap:10px; }
.v5-player-time { color:#aeb9c8; font-family:ui-monospace,SFMono-Regular,Menlo,monospace; font-size:11px; }
.v5-player-seek { --player-progress:0%; min-width:0; height:38px; position:relative; padding:0; overflow:hidden; border:0; background:transparent; cursor:pointer; }
.v5-player-seek::before,.v5-player-seek::after { content:""; height:2px; position:absolute; inset:50% 0 auto; background:#526174; transform:translateY(-50%); }
.v5-player-seek::after { width:var(--player-progress); right:auto; background:#fb923c; }
.v5-player-wave { height:32px; display:flex; align-items:center; justify-content:space-between; gap:2px; color:#708096; }
.v5-player-wave i { width:2px; height:var(--bar,28%); display:block; border-radius:2px; background:currentColor; }
.v5-player-wave i:nth-child(3n+1) { --bar:78%; }.v5-player-wave i:nth-child(4n+2) { --bar:46%; }.v5-player-wave i:nth-child(5n+3) { --bar:94%; }
.v5-complete-art { margin-bottom:20px; }
.v5-complete-note { margin:0 0 16px; color:#cbd5e1; font-size:13px; }
.seo-copy { width:min(900px,100%); margin:54px auto 0; color:#e5e7eb; }
.seo-copy h2 { margin:0 0 8px; color:#fff; font-size:26px; }
.seo-copy > p { margin:0 0 22px; color:#cbd5e1; }
.seo-copy .faq { border-top:1px solid #344254; }
.seo-copy .faq summary { padding:16px 0; color:#fff; font-weight:700; cursor:pointer; }
.seo-copy .faq p { margin:0 0 16px; color:#cbd5e1; }

.song-owner-tools { margin-top: 12px; padding-top: 12px; border-top: 1px solid #e5e7eb; }
.song-mobile-version-tabs { display: none; }
.edit-song-button { width: 100%; min-height: 44px; color: #9a3412; border: 1px solid #fdba74; border-radius: 6px; background: #fff7ed; font-weight: 700; cursor: pointer; }
.edit-song-button:hover { background: #ffedd5; }
.edit-menu-backdrop { position: fixed; z-index: 79; inset: 0; background: rgba(15,23,42,.58); }
.edit-menu { position: fixed; z-index: 80; right: auto; bottom: auto; width: min(360px, calc(100% - 24px)); max-height: calc(100dvh - 24px); overflow-y: auto; padding: 16px; color: #172033; border: 1px solid #cbd5e1; border-radius: 12px; background: #fff; box-shadow: 0 24px 70px rgba(15,23,42,.34); }
.edit-menu[hidden], .edit-menu-backdrop[hidden] { display: none; }
.edit-menu h2 { margin: 0 0 10px; font-size: 18px; }
.edit-menu a, .edit-menu button { width: 100%; min-height: 42px; display: flex; align-items: center; padding: 9px 10px; color: #334155; text-align: left; text-decoration: none; border: 0; border-radius: 6px; background: transparent; font: inherit; font-weight: 650; cursor: pointer; }
.edit-menu a:hover, .edit-menu button:hover { color: #9a3412; background: #fff7ed; }
.edit-menu-divider { height: 1px; margin: 6px 0; background: #e2e8f0; }
.edit-menu .edit-menu-close { justify-content: center; margin-top: 8px; color: #64748b; border-top: 1px solid #e2e8f0; border-radius: 0; }

.song-lyrics-column { width: 100%; }
.song-lyrics-head { min-height: 42px; display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; margin-bottom: 12px; }
.song-lyrics-status { margin: 4px 0 0; color: #9ca3af; font-size: 13px; }
.timed-lyrics-panel { height: min(520px, 60vh); overflow-y: auto; overflow-x: hidden; padding-inline: 0; scrollbar-width: none; scroll-behavior: auto; }
.timed-lyrics-panel::-webkit-scrollbar { display: none; }
.timed-lyrics-panel::after { content: ''; display: block; }
.timed-lyrics-panel::after { height: var(--lyrics-trailing-space, 0px); }
.timed-lyrics-panel:focus-visible { outline: 2px solid #fdba74; outline-offset: 4px; border-radius: 4px; }
.timed-lyrics-section { display: block; margin: 22px 0 10px; color: #9ca3af; font-weight: 600; }
.timed-lyrics-section.is-current { color: #f97316; }
.timed-lyrics-line { margin: 10px 0; color: #9ca3af; line-height: 1.85; font-weight: 500; overflow-wrap: anywhere; transition: color 200ms ease-out; }
.timed-lyrics-line.is-current { color: #fff; }
.timed-lyrics-word { display: inline-block; position: relative; max-width: 100%; vertical-align: bottom; }
.timed-lyrics-fill { position: absolute; inset: 0; color: #f97316; clip-path: inset(0 calc(100% - var(--sung, 0%)) 0 0); opacity: 0; pointer-events: none; user-select: none; }
.timed-lyrics-line.is-current .timed-lyrics-fill { opacity: 1; }
.timed-lyrics-word:dir(rtl) .timed-lyrics-fill { clip-path: inset(0 0 0 calc(100% - var(--sung, 0%))); }
@media (prefers-reduced-motion: reduce) {
  .timed-lyrics-line, .timed-lyrics-section { transition: none; }
}

.v5-tool-main[data-tool="lyrics"] .ai-lyrics-state { margin: 0; }
.v5-tool-main[data-tool="lyrics"] .ai-lyrics-state > h3 { display: none; }
.v5-tool-main[data-tool="lyrics"] [data-role="generating"] { display: flex; flex: 1; }
.v5-tool-main[data-tool="lyrics"] .ai-lyrics-editor { height: 340px; min-height: 340px; max-height: 340px; resize: none; overflow-y: auto; }
.v5-tool-main[data-tool="lyrics"] .ai-lyrics-paper { background: #f8fafc; color: #1f2937; }
.v5-tool-main[data-tool="lyrics"] .ai-lyrics-error { color: #fecaca; }
.v5-tool-main[data-tool="lyrics"] .ai-lyrics-form textarea { height: 180px; min-height: 180px; max-height: 180px; resize: none; }
.lyrics-ideas { display: flex; flex-wrap: wrap; gap: 8px; }
.lyrics-ideas button { padding: 6px 10px; color: #475569; border: 1px solid #d7dde5; border-radius: 999px; background: #fff; font-size: 12px; cursor: pointer; }
.lyrics-ideas button:hover { color: #9a3412; border-color: #fdba74; }
.v5-lyrics-scene { width: min(640px,96%); min-height: 340px; padding: 26px 28px; border: 1px solid #46566c; border-radius: 12px; background: #f8fafc; color: #1f2937; }
.v5-lyrics-scene strong { color: #9a3412; }
.v5-writing-line { height: 9px; display: block; margin-top: 17px; border-radius: 6px; background: #cbd5e1; transform-origin: left; }
.v5-writing-line:nth-child(3n) { width: 78%; }
.v5-writing-line:nth-child(4n) { width: 91%; }
.v5-stage-shell[data-status="generating"] .v5-writing-line { animation: v5-write 1.8s ease-in-out infinite; }
.v5-stage-shell[data-status="generating"] .v5-writing-line:nth-child(3n) { animation-delay: 160ms; }
@keyframes v5-write { 0%,18% { transform: scaleX(.03); opacity: .25; } 70%,100% { transform: scaleX(1); opacity: 1; } }

.song-persona-context { width: min(980px, 100%); min-height: 0; margin: 34px auto 10px; padding: 0; }
.song-persona-context .v5-tool-heading h2 { margin: 0; color: #fff; font-size: clamp(26px, 3vw, 34px); font-weight: 800; letter-spacing: -.02em; }
.song-persona-context .v5-tool-heading .tool-intro { margin-bottom: 20px; }
.song-persona-context .v5-tool-heading { text-align: start; }
.song-persona-context .v5-tool-heading .tool-intro { margin-left: 0; }
.song-persona-context .v5-tool-shell { grid-template-columns: minmax(0,1fr) minmax(330px,420px); gap: 24px; padding: 28px; }
.song-persona-context .v5-tool-setup { grid-column: 2; grid-row: 1; border: 1px solid #d7dde5; border-radius: 14px; }
.song-persona-context .v5-tool-stage { grid-column: 1; grid-row: 1; }
.song-persona-context .v5-tool-stage { min-height: 500px; }
.song-persona-context .v5-stage-shell { min-height: 498px; }
.persona-source-row { grid-template-columns: 52px minmax(0,1fr); }

.v5-persona-scene { width: min(620px,100%); min-height: 260px; display: grid; grid-template-columns: minmax(0,.8fr) minmax(150px,1.05fr); gap: 16px; align-items: center; }
.v5-persona-traits { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 10px; }
.v5-persona-trait { max-width: 100%; padding: 8px 11px; border: 1px solid #64748b; border-radius: 999px; color: #cbd5e1; background: #263244; font-size: 12px; overflow-wrap: anywhere; }
.v5-persona-card { min-height: 260px; display: flex; flex-direction: column; justify-content: space-between; padding: 22px; border: 1px solid #c65d20; border-radius: 14px; background: #33251f; overflow-wrap: anywhere; }
.v5-persona-monogram { width: 56px; height: 56px; display: grid; place-items: center; border-radius: 12px; color: #7c2d12; background: #fed7aa; font-size: 22px; font-weight: 900; }
.v5-persona-card strong { color: #fff; font-size: 20px; }
.v5-persona-card p { margin: 5px 0 0; color: #cbd5e1; font-size: 13px; }
.v5-stage-shell[data-status="generating"] .v5-persona-trait { animation: v5-persona-in 1.7s ease-in-out infinite; }
.v5-stage-shell[data-status="generating"] .v5-persona-trait:nth-child(2) { animation-delay: 160ms; }
.v5-stage-shell[data-status="generating"] .v5-persona-trait:nth-child(3) { animation-delay: 320ms; }
@keyframes v5-persona-in { 0%,20% { transform: translateX(-30px); opacity: .2; } 70%,100% { transform: none; opacity: 1; } }

@media (max-width: 900px) {
  .v5-tool-shell,.v5-tool-main[data-layout="compact"] .v5-tool-shell { grid-template-columns:minmax(0,1fr); }
  .song-persona-context .v5-tool-shell { grid-template-columns:minmax(0,1fr); }
  .song-persona-context .v5-tool-setup { grid-column: 1; grid-row: 1; }
  .song-persona-context .v5-tool-stage { grid-column: 1; grid-row: 2; }
  .v5-tool-setup { border-right:0; border-bottom:1px solid #344254; }
}
@media (max-width: 620px) {
  .v5-tool-main,.v5-tool-main[data-layout="compact"] { width:min(100% - 24px,520px); padding:26px 0 64px; }
  .v5-tool-heading h1 { font-size: 30px; }
  .v5-tool-heading .tool-intro { margin-bottom:22px; font-size:16px; }
  .v5-tool-setup { padding:16px; }
  .v5-tool-stage { min-height:430px !important; }
  .v5-stage-shell { min-height:428px !important; }
  .v5-stage-head { padding:18px 18px 10px; }
  .v5-stage-body { padding:10px 18px 18px; }
  .v5-stage-canvas { min-height:250px; }
  .v5-choice-card { grid-template-columns:auto minmax(0,1fr); }
  .v5-choice-meta { grid-column:2; }
  .v5-cover-scene,.v5-vocals-scene { grid-template-columns:minmax(0,1fr); }
  .v5-cover-bridge { width:2px; height:32px; justify-self:center; }
  .v5-cover-bridge::after { top:auto; bottom:-14px; right:50%; transform:translateX(50%) rotate(90deg); }
  .v5-performance-card,.v5-lyric-sheet { min-height:150px; }
  .v5-mashup-scene { grid-template-columns:1fr; }
  .v5-mash-merge { width:80px; height:46px; }
  .v5-mash-output { grid-column:1; width:100%; }
  .v5-replace-track { grid-template-columns:1fr minmax(110px,34%) 1fr; }
  .v5-result-row,.v5-song-result { grid-template-columns:48px minmax(0,1fr); }
  .v5-result-row .secondary { grid-column:1/-1; width:100%; }
  .v5-song-result > img { width:48px; height:48px; grid-row:1; }
  .v5-song-details { grid-column:1/-1; grid-row:3; width:100%; }
  .v5-inline-player { grid-column:1/-1; grid-row:2; grid-template-columns:42px minmax(110px,1fr) auto; }
  .v5-inline-player [data-current] { display:none; }
  .tool-field .text-button, .field-label .text-button { min-height: 44px; display: inline-flex; align-items: center; }
  .source-listen { width: 44px; }
  .lyrics-ideas button { min-height: 44px; }
  .source-row { grid-template-columns:48px minmax(0,1fr) auto; }
  .persona-source-row { grid-template-columns:48px minmax(0,1fr); }
  .song-persona-context { width: min(100% - 8px, 520px); }
  .v5-persona-scene { grid-template-columns: minmax(0,1fr); }
  .v5-persona-traits { justify-content: flex-start; }
  .song-persona-context .v5-tool-shell { padding: 12px; }
  .v5-result-row .result-progress { grid-column: 1 / -1; }
  body.stem-picker-modal-open { overflow: hidden; }
  .stem-picker-backdrop { background: rgba(15,23,42,.46); }
  .stem-picker-panel {
    width: auto;
    height: 72vh;
    height: min(72dvh,580px);
    max-height: min(72vh,580px);
    max-height: min(72dvh,580px);
    position: fixed;
    inset: auto 0 0;
    display: flex;
    flex-direction: column;
    padding: 16px 16px calc(14px + env(safe-area-inset-bottom));
    border-radius: 14px 14px 0 0;
    overflow: hidden;
  }
  .stem-picker-mobile-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 12px; }
  .stem-picker-mobile-head strong { color: #1f2937; font-size: 16px; }
  .stem-picker-mobile-head button { min-height: 44px; padding: 6px 2px; color: #9a3412; border: 0; background: transparent; font-weight: 700; }
  .stem-picker-options { min-height: 0; max-height: none; flex: 1 1 auto; -webkit-overflow-scrolling: touch; }
  .stem-picker-search,
  .stem-picker-heading,
  .stem-picker-more { flex: 0 0 auto; }
  .stem-picker-options[data-mode="popular"] { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .stem-picker-option { min-height: 44px; }
  .edit-menu { inset: auto 0 0; width: 100%; max-height: 84dvh; padding-bottom: max(16px, env(safe-area-inset-bottom)); border-radius: 12px 12px 0 0; }
  .edit-menu a, .edit-menu button { min-height: 46px; }
  .song-versions-column { width: 100%; min-width: 0 !important; max-width: calc(100vw - 48px); margin-right: 0 !important; }
  .song-mobile-version-tabs {
    min-height: 46px;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(0, 1fr));
    border-bottom: 1px solid #334155;
  }
  .song-mobile-version-tabs button {
    min-width: 0;
    min-height: 44px;
    position: relative;
    padding: 0 8px;
    color: #9ca3af;
    border: 0;
    background: transparent;
    font: inherit;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
  }
  .song-mobile-version-tabs button[aria-selected="true"] { color: #fff; }
  .song-mobile-version-tabs button[aria-selected="true"]::after {
    content: '';
    height: 2px;
    position: absolute;
    right: 16px;
    bottom: -1px;
    left: 16px;
    background: #f05011;
  }
  .song-mobile-version-tabs button:focus-visible { outline: 2px solid #fdba74; outline-offset: -3px; }
  .song-version-list, .song-variant-card, .song-variant-surface { min-width: 0; max-width: 100%; }
  .song-version-list.has-mobile-version-switcher .song-variant-card { display: none; }
  .song-version-list.has-mobile-version-switcher .song-variant-card.is-mobile-active { display: block; margin-top: 0 !important; }
  .song-variant-surface { overflow: hidden; padding: 14px !important; }
  .song-variant-summary { align-items: center !important; gap: 12px; }
  .song-cover-wrap { flex: 0 0 auto; margin-bottom: 0 !important; }
  .song-cover-image { width: 64px; height: 64px; margin-right: 0 !important; object-fit: cover; }
  .song-variant-meta { min-width: 0; margin-left: 0 !important; }
  .song-variant-title { font-size: 15px !important; line-height: 1.35; }
  .song-creator-row { min-width: 0; margin-top: 6px !important; }
  .song-creator-row img { width: 24px; height: 24px; flex: 0 0 auto; }
  .song-creator-row p { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .song-created-at { margin-top: 5px !important; }
  .song-card-divider { margin-top: 12px; }
  .song-player-row { width: 100%; min-width: 0; display: flex !important; gap: 8px; overflow: hidden; padding: 12px 0 0 !important; }
  .song-player-row audio { width: calc(100% - 52px) !important; min-width: 0; max-width: calc(100% - 52px); flex: 1 1 auto; }
  .song-player-row .download-btn { width: 44px; height: 44px; flex: 0 0 44px; justify-content: center; padding: 0 !important; }
  .song-owner-tools { margin-top: 10px; padding-top: 10px; }
  .song-lyrics-column { max-width: calc(100vw - 48px) !important; }
  .song-lyrics-head { margin-bottom: 8px; }
  .timed-lyrics-panel { height: clamp(320px, 52svh, 520px); overscroll-behavior-y: contain; -webkit-overflow-scrolling: touch; }
  .timed-lyrics-section { margin: 18px 0 9px; font-size: 14px; }
  .timed-lyrics-line { margin: 12px 0; font-size: 18px; line-height: 1.6; font-weight: 600; }
}
@media (prefers-reduced-motion: reduce) {
  .v5-tool-main *, .v5-tool-main *::before, .v5-tool-main *::after { animation:none !important; transition:none !important; }
}
.tool-persona-host {
  --mg-accent: #ea580c;
  --mg-accent-dark: #c2410c;
}
.tool-persona-host #persona-field .mg-model-button > span { min-width: 0; overflow-wrap: anywhere; }
.tool-persona-host #persona-field .mg-model-button > b { flex: 0 0 auto; }
.tool-persona-host #persona-modal .mg-modal-close { flex: 0 0 auto; }
.tool-persona-host #persona-modal .mg-persona-option { overflow-wrap: anywhere; }
