:root {
  --bg: #efe8df;
  --panel: rgba(255, 251, 246, 0.93);
  --ink: #181513;
  --muted: #706760;
  --line: rgba(24, 21, 19, 0.08);
  --accent: #ffd84d;
  --accent-soft: rgba(255, 216, 77, 0.22);
  --shadow: 0 30px 80px rgba(22, 16, 12, 0.16);
  --title-font: "Noto Serif SC", serif;
  --transcript-font: "Noto Sans SC", sans-serif;
  --brand-font: "LXGW WenKai", cursive;
  --title-size-scale: 1.12;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Noto Sans SC", sans-serif;
  color: var(--ink);
  background:
    radial-gradient(circle at top left, rgba(255, 190, 134, 0.22), transparent 24%),
    radial-gradient(circle at 82% 12%, rgba(142, 171, 255, 0.14), transparent 20%),
    linear-gradient(140deg, #efe7dc 0%, #e7edf0 55%, #e7ece5 100%);
}

.hidden {
  display: none !important;
}

.login-overlay {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background:
    radial-gradient(circle at center, rgba(255, 255, 255, 0.04), transparent 28%),
    linear-gradient(180deg, #050505 0%, #0d0d0d 100%);
  z-index: 20;
}

.login-card {
  width: min(440px, 100%);
  padding: 28px;
  border-radius: 28px;
  background: rgba(18, 18, 18, 0.9);
  border: 1px solid rgba(255, 255, 255, 0.08);
  color: #fff;
  box-shadow: 0 30px 90px rgba(0, 0, 0, 0.35);
}

.login-card h1 {
  margin: 8px 0 10px;
  font-size: 2rem;
}

.login-copy {
  color: rgba(255, 255, 255, 0.66);
  line-height: 1.7;
}

.app-shell {
  display: grid;
  grid-template-columns: minmax(640px, 1fr) 420px;
  gap: 18px;
  padding: 18px;
  align-items: start;
}

.panel {
  border: 1px solid var(--line);
  border-radius: 28px;
  background: var(--panel);
  box-shadow: var(--shadow);
  backdrop-filter: blur(14px);
}

.controls,
.preview-panel {
  padding: 18px;
}

.preview-panel {
  position: sticky;
  top: 18px;
}

.controls {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px 16px;
  align-content: start;
  max-height: calc(100vh - 36px);
  overflow: auto;
}

.controls .panel-header,
.controls .group {
  grid-column: 1 / -1;
}

.session-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
}

.admin-badge {
  display: inline-flex;
  align-items: center;
  margin-bottom: 14px;
  padding: 8px 12px;
  border-radius: 999px;
  background: rgba(16, 34, 53, 0.08);
  color: #18334f;
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.08em;
}

.panel-header h1,
.preview-head h2 {
  margin: 6px 0 8px;
  font-size: 1.88rem;
  line-height: 1.08;
}

.eyebrow {
  margin: 0;
  color: #8a5c3d;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  font-size: 0.75rem;
  font-weight: 700;
}

.panel-copy,
.helper,
.note-box p,
.status-text {
  color: var(--muted);
}

.group + .group {
  margin-top: 0;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

.group h2 {
  margin: 0 0 14px;
  font-size: 1.06rem;
}

.group.editing-focus {
  border-radius: 22px;
  background: linear-gradient(180deg, rgba(255, 247, 218, 0.9), rgba(255, 251, 246, 0.93));
  box-shadow: 0 0 0 2px rgba(255, 216, 77, 0.28), 0 18px 48px rgba(22, 16, 12, 0.08);
  transition: box-shadow 220ms ease, background 220ms ease;
}

.controls .group {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px 14px;
  align-items: start;
}

.controls .group > h2,
.controls .group > .helper,
.controls .group > .audio-row,
.controls .group > .token-box,
.controls .group > .logo-preview-box,
.controls .group > .cover-preview-wrap,
.controls .group > .progress-wrap,
.controls .group > #audioName,
.controls .group > #transcriptStatus,
.controls .group > #userList,
.controls .group > #adminCreateStatus,
.controls .group > #adminEditHint {
  grid-column: 1 / -1;
}

.admin-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.field-wide {
  grid-column: 1 / -1;
}

.user-list {
  display: grid;
  gap: 10px;
  margin-top: 14px;
}

.user-card {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  padding: 12px 14px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.58);
  border: 1px solid rgba(24, 21, 19, 0.06);
}

.user-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}

.admin-user-note {
  display: inline-flex;
  align-items: center;
  padding: 8px 12px;
  border-radius: 999px;
  background: rgba(24, 21, 19, 0.08);
  color: #6d625a;
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.04em;
}

.user-card strong,
.user-card p {
  margin: 0;
}

.user-card p {
  color: var(--muted);
  font-size: 0.88rem;
}

.muted-note {
  color: #8b8b8b !important;
  font-size: 0.82rem !important;
}

.field {
  display: block;
  margin-bottom: 6px;
}

.field span,
.token-box p {
  display: block;
  margin-bottom: 8px;
  font-size: 0.92rem;
  font-weight: 600;
}

input,
textarea,
select,
button {
  font: inherit;
}

input[type="text"],
input[type="password"],
input[type="file"],
textarea,
select {
  width: 100%;
  border: 1px solid rgba(24, 21, 19, 0.12);
  border-radius: 16px;
  padding: 12px 14px;
  background: rgba(255, 255, 255, 0.82);
}

.login-card input[type="text"],
.login-card input[type="password"] {
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
  border-color: rgba(255, 255, 255, 0.12);
}

textarea {
  resize: vertical;
}

input[type="range"] {
  width: 100%;
}

.inline-field {
  display: grid;
  grid-template-columns: 1fr 64px;
  gap: 10px;
}

.audio-row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

button {
  border: 0;
  border-radius: 999px;
  padding: 11px 16px;
  cursor: pointer;
}

.primary-btn {
  background: linear-gradient(135deg, #102235, #315577);
  color: #fff;
}

.ghost-btn {
  background: rgba(24, 21, 19, 0.08);
  color: var(--ink);
}

.danger-btn {
  background: rgba(170, 26, 26, 0.09);
  color: #9b2323;
}

.tokens {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.token {
  padding: 7px 11px;
  border-radius: 999px;
  background: rgba(24, 21, 19, 0.06);
  color: var(--ink);
  font-size: 0.88rem;
}

.token.active {
  background: var(--accent-soft);
  color: #b58900;
  font-weight: 700;
}

.logo-preview-box {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 120px;
  padding: 16px;
  border-radius: 20px;
  background: rgba(8, 8, 8, 0.9);
  overflow: hidden;
}

.logo-preview-image {
  max-width: 120px;
  max-height: 120px;
  object-fit: contain;
}

.cover-preview-wrap {
  margin-top: 14px;
  border-radius: 22px;
  overflow: hidden;
  background: #0a0a0a;
  border: 1px solid rgba(24, 21, 19, 0.08);
  max-width: 176px;
}

.admin-summary {
  display: grid;
  gap: 16px;
}

.admin-plan-card {
  padding: 20px;
  border-radius: 22px;
  background: rgba(10, 10, 10, 0.92);
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.admin-preview-stage {
  padding: 10px 0 4px;
}

.admin-preview-phone {
  width: min(300px, 100%);
  margin: 0 auto;
}

.admin-preview-layout {
  inset: 54px 0 62px;
}

.admin-preview-title {
  font-size: 1.02rem;
  line-height: 1.2;
}

.admin-wave-bars {
  left: 70px;
  right: 70px;
  grid-template-columns: repeat(8, 1fr);
}

.admin-plan-card h3 {
  margin: 0 0 10px;
  font-size: 1.18rem;
}

.admin-plan-card p,
.admin-plan-card li {
  color: rgba(255, 255, 255, 0.72);
  line-height: 1.7;
}

#coverCanvas {
  width: 100%;
  height: auto;
  display: block;
}

.preview-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: end;
  margin-bottom: 18px;
}

.phone-stage {
  display: flex;
  justify-content: center;
  padding: 10px 0 22px;
}

.phone-canvas {
  position: relative;
  width: min(348px, 82vw);
  aspect-ratio: 9 / 16;
  border-radius: 38px;
  overflow: hidden;
  box-shadow: 0 40px 80px rgba(2, 4, 8, 0.46);
  background: linear-gradient(180deg, #030303 0%, #000000 100%);
}

.phone-canvas.gallery {
  background:
    radial-gradient(circle at 50% 44%, rgba(255, 255, 255, 0.03), transparent 24%),
    linear-gradient(180deg, #040404 0%, #000000 100%);
}

.phone-canvas.mist {
  background:
    radial-gradient(circle at 50% 35%, rgba(122, 176, 255, 0.18), transparent 26%),
    radial-gradient(circle at 50% 70%, rgba(197, 220, 255, 0.06), transparent 30%),
    linear-gradient(180deg, #07101a 0%, #010203 100%);
}

.phone-canvas.harvard {
  background:
    radial-gradient(circle at 50% 36%, rgba(165, 28, 48, 0.34), transparent 29%),
    radial-gradient(circle at 50% 73%, rgba(96, 12, 28, 0.2), transparent 31%),
    linear-gradient(180deg, #26040b 0%, #090104 100%);
}

.phone-canvas.amber {
  background:
    radial-gradient(circle at 50% 38%, rgba(212, 154, 64, 0.26), transparent 28%),
    radial-gradient(circle at 50% 74%, rgba(126, 78, 27, 0.15), transparent 31%),
    linear-gradient(180deg, #171006 0%, #040301 100%);
}

.phone-canvas.forest {
  background:
    radial-gradient(circle at 50% 40%, rgba(123, 188, 110, 0.18), transparent 24%),
    radial-gradient(circle at 50% 75%, rgba(69, 115, 74, 0.12), transparent 28%),
    linear-gradient(180deg, #061108 0%, #010201 100%);
}

.phone-canvas.ocean {
  background:
    radial-gradient(circle at 50% 38%, rgba(115, 170, 255, 0.2), transparent 26%),
    radial-gradient(circle at 50% 74%, rgba(68, 102, 168, 0.12), transparent 30%),
    linear-gradient(180deg, #05111b 0%, #010203 100%);
}

.phone-canvas.violet {
  background:
    radial-gradient(circle at 50% 38%, rgba(139, 92, 246, 0.26), transparent 28%),
    radial-gradient(circle at 50% 74%, rgba(83, 47, 132, 0.16), transparent 31%),
    linear-gradient(180deg, #10071c 0%, #030105 100%);
}

.phone-canvas.slate {
  background:
    radial-gradient(circle at 50% 38%, rgba(148, 163, 184, 0.2), transparent 27%),
    radial-gradient(circle at 50% 74%, rgba(71, 85, 105, 0.14), transparent 31%),
    linear-gradient(180deg, #101318 0%, #030405 100%);
}

.status-bar {
  display: none;
}

.preview-layout {
  position: absolute;
  inset: 62px 0 80px;
  display: grid;
  grid-template-rows: 0.9fr 0.5fr 0.36fr;
  gap: 0;
}

.preview-top,
.preview-middle,
.preview-bottom {
  padding-left: 28px;
  padding-right: 28px;
}

.preview-top,
.preview-middle,
.preview-bottom {
  display: flex;
  flex-direction: column;
}

.preview-top {
  justify-content: flex-end;
}

.preview-middle {
  justify-content: flex-start;
}

.preview-bottom {
  justify-content: center;
}

.transcript-shell {
  min-height: 42px;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-top: 10px;
  transform: translateY(12px);
}

.transcript-window {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0;
}

.transcript-line {
  margin: 0;
  text-align: center;
  line-height: 0.88;
  font-family: var(--transcript-font);
  max-width: 82%;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  transition: opacity 180ms ease, transform 180ms ease, filter 180ms ease, color 180ms ease;
}

.transcript-line.current {
  color: rgba(255, 255, 255, 0.5);
  font-weight: 500;
  text-shadow: none;
}

.transcript-line.side {
  color: rgba(255, 255, 255, 0.12);
  font-weight: 400;
}

.wave-stage {
  position: relative;
  height: 104px;
  width: 100%;
  padding-inline: 12px;
}

#motionCanvas {
  position: absolute;
  left: 34px;
  right: 34px;
  top: 0;
  bottom: 0;
  width: auto;
  height: 100%;
  opacity: 0.22;
}

.wave-bars {
  position: absolute;
  left: 34px;
  right: 34px;
  bottom: 22px;
  display: grid;
  grid-template-columns: repeat(88, 1fr);
  gap: 3px;
  align-items: end;
  height: 62px;
}

.wave-bar {
  width: 1px;
  justify-self: center;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.18);
  transform: scaleX(0.72);
  transform-origin: center;
}

.wave-bar.active {
  background: rgba(255, 255, 255, 0.96);
  box-shadow: 0 0 10px rgba(255, 255, 255, 0.12);
}

.progress-line {
  position: absolute;
  top: 14px;
  bottom: 20px;
  width: 1.2px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.82);
  left: 50%;
}

.wave-time {
  position: absolute;
  bottom: 2px;
  color: rgba(255, 255, 255, 0.68);
  font-size: 0.66rem;
  line-height: 1;
}

.wave-time.left {
  left: 34px;
}

.wave-time.right {
  right: 34px;
  text-align: right;
}

.player-core {
  margin-top: 8px;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 10px;
  color: rgba(255, 255, 255, 0.5);
  letter-spacing: 0.24em;
  font-size: 0.76rem;
  width: 100%;
  text-align: center;
}

.core-dot {
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.5);
}

.identity-block {
  margin-top: 6px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

.logo-frame {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.14);
  box-shadow: 0 0 24px rgba(255, 255, 255, 0.08);
}

.logo-frame img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.brand-line {
  display: flex;
  justify-content: center;
}

.brand-preview {
  font-family: var(--brand-font);
  font-size: 1rem;
  color: rgba(190, 216, 255, 0.96);
  letter-spacing: 0.08em;
  text-shadow: 0 0 18px rgba(115, 158, 227, 0.14);
}

.title-block {
  display: block;
  font-family: var(--title-font);
  font-size: clamp(1.08rem, calc(1.42rem * var(--title-size-scale)), 1.92rem);
  line-height: 1.08;
  font-weight: 800;
  letter-spacing: 0.01em;
  color: #ffffff;
  text-align: center;
  width: 100%;
  max-width: 80%;
  margin: 0 auto;
  word-break: break-all;
  overflow-wrap: anywhere;
}

.title-block.left {
  text-align: left;
}

.title-word {
  display: inline;
}

.title-word.highlight {
  color: var(--accent);
  text-shadow: 0 0 18px rgba(255, 216, 77, 0.2);
}

.title-break {
  display: block;
  height: 0.18em;
}

.note-preview {
  margin: 6px 0 0;
  text-align: center;
  color: rgba(214, 214, 214, 0.76);
  font-size: 0.68rem;
  line-height: 1.6;
  max-width: 80%;
}

.note-box {
  padding: 16px 18px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.6);
}

.progress-wrap {
  margin-top: 6px;
  margin-bottom: 10px;
}

.progress-meta {
  display: flex;
  justify-content: space-between;
  color: var(--muted);
  font-size: 0.85rem;
  margin-bottom: 6px;
}

#transcribeProgressWrap .progress-meta { justify-content: flex-end; }
.script-choice {
  margin: 0;
  padding: 0;
  display: flex;
  align-items: center;
  gap: 4px;
}
.script-choice label { position: relative; cursor: pointer; }
.script-choice input { position: absolute; opacity: 0; pointer-events: none; }
.script-choice label span {
  margin: 0 !important;
  padding: 6px 12px;
  display: block;
  border: 1px solid transparent;
  border-radius: 999px;
  color: #76666c;
  background: #f3eff0;
  font-size: .76rem !important;
  font-weight: 700;
  transition: 160ms ease;
}
.script-choice input:checked + span {
  color: #fff;
  border-color: var(--v3-wine);
  background: var(--v3-wine);
  box-shadow: 0 3px 9px rgba(111, 38, 61, .16);
}
body[data-page="user"] .workflow-step[data-workflow-step="1"] > .field,
body[data-page="user"] .workflow-step[data-workflow-step="1"] > .script-choice {
  grid-column: 1 / -1;
}
body[data-page="user"] .workflow-step[data-workflow-step="1"] > .script-choice {
  margin-top: 2px;
  justify-content: flex-start;
}
.transcript-result-head { margin-bottom: 7px; display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.transcript-result-head > span { margin: 0 !important; }
.mini-copy-btn { padding: 6px 11px; color: #fff; background: var(--v3-wine); font-size: .72rem; font-weight: 800; }

.progress-track {
  width: 100%;
  height: 8px;
  border-radius: 999px;
  background: rgba(24, 21, 19, 0.08);
  overflow: hidden;
}

.progress-bar {
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #102235, #6fb7ff);
  transition: width 240ms ease;
}

.export-progress-bar {
  background: linear-gradient(90deg, #7a351e, #ff9b62);
}

/* V3 — TAG 工作流：借鉴 English V15.2 的阶段导航与独立滚轴。 */
body[data-page="user"] {
  --v3-wine: #6f263d;
  --v3-wine-deep: #421626;
  --v3-rose: #f4e8ec;
  --v3-gold: #c89a58;
}

body[data-page="user"] .app-shell {
  min-height: 100vh;
  grid-template-columns: minmax(620px, 1fr) minmax(360px, 430px);
  gap: 16px;
}

body[data-page="user"] .controls {
  height: calc(100vh - 36px);
  max-height: none;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

body[data-page="user"] .controls .panel-header {
  flex: 0 0 auto;
  padding: 2px 4px 10px;
}

body[data-page="user"] #userModeNote {
  display: none;
}

.workflow-tabs {
  flex: 0 0 auto;
  display: flex;
  gap: 6px;
  padding: 5px;
  overflow-x: auto;
  overscroll-behavior-inline: contain;
  scrollbar-width: thin;
  scrollbar-color: rgba(111, 38, 61, .32) transparent;
  border-radius: 16px;
  background: rgba(111, 38, 61, .07);
  scroll-snap-type: x proximity;
}

.workflow-tabs::-webkit-scrollbar { height: 5px; }
.workflow-tabs::-webkit-scrollbar-thumb { border-radius: 999px; background: rgba(111, 38, 61, .28); }

.workflow-tab {
  min-width: 132px;
  flex: 1 0 132px;
  scroll-snap-align: start;
  border: 0;
  border-radius: 12px;
  padding: 9px 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  color: #725e65;
  background: transparent;
  font-weight: 800;
  text-align: left;
  transition: background 180ms ease, color 180ms ease, transform 180ms ease;
}

.workflow-tab:hover { background: rgba(255,255,255,.62); transform: translateY(-1px); }
.workflow-tab b {
  width: 24px;
  height: 24px;
  flex: 0 0 24px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  color: #684254;
  background: #e7d8de;
  font-size: .74rem;
}
.workflow-tab span { min-width: 0; display: grid; gap: 2px; line-height: 1.05; }
.workflow-tab small { color: inherit; opacity: .72; font-size: .62rem; font-weight: 600; white-space: nowrap; }
.workflow-tab.is-active {
  color: #fff;
  background: linear-gradient(145deg, var(--v3-wine-deep), var(--v3-wine));
  box-shadow: 0 8px 18px rgba(80, 24, 45, .2);
}
.workflow-tab.is-active b { color: var(--v3-wine); background: #fff; }
.workflow-tab.is-complete:not(.is-active) { color: #32694f; }
.workflow-tab.is-complete:not(.is-active) b { color: #fff; background: #4f8b6c; }

body[data-page="user"] .controls .workflow-step {
  display: none;
  min-height: 0;
  flex: 1 1 auto;
  overflow-x: hidden;
  overflow-y: auto;
  align-content: start;
  padding: 18px 16px 12px;
  border: 0;
  border-radius: 20px;
  background: rgba(255,255,255,.52);
  box-shadow: inset 0 0 0 1px rgba(111, 38, 61, .07);
  scrollbar-width: thin;
  scrollbar-color: rgba(111, 38, 61, .3) transparent;
}
body[data-page="user"] .controls .workflow-step.is-active {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 11px 14px;
}
body[data-page="user"] .workflow-step::-webkit-scrollbar { width: 7px; }
body[data-page="user"] .workflow-step::-webkit-scrollbar-thumb { border-radius: 999px; background: rgba(111, 38, 61, .25); }
body[data-page="user"] .workflow-step > h2 {
  position: sticky;
  top: -18px;
  z-index: 3;
  margin: -18px -16px 12px;
  padding: 16px;
  color: var(--v3-wine-deep);
  background: rgba(255, 252, 250, .94);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid rgba(111, 38, 61, .09);
}

.step-navigation {
  grid-column: 1 / -1;
  margin-top: 8px;
  padding-top: 14px;
  display: flex;
  justify-content: space-between;
  gap: 10px;
  border-top: 1px solid rgba(111, 38, 61, .1);
}
.step-nav-btn {
  border-radius: 12px;
  color: #fff;
  background: linear-gradient(145deg, var(--v3-wine-deep), var(--v3-wine));
  font-size: .86rem;
  font-weight: 800;
}
.step-nav-previous { color: #684254; background: #eadde2; }

body[data-page="user"] .preview-panel {
  top: 18px;
  max-height: calc(100vh - 36px);
  overflow: hidden;
}

body[data-page="user"] .primary-btn {
  background: linear-gradient(135deg, var(--v3-wine-deep), var(--v3-wine));
}

@media (max-width: 980px) {
  body[data-page="user"] .app-shell { grid-template-columns: minmax(0, 1fr); }
  body[data-page="user"] .controls { height: min(760px, calc(100vh - 24px)); }
  body[data-page="user"] .preview-panel { position: relative; top: auto; max-height: none; }
}

@media (max-width: 620px) {
  body[data-page="user"] .app-shell { padding: 8px; }
  body[data-page="user"] .controls { height: calc(100vh - 16px); padding: 12px; }
  body[data-page="user"] .controls .workflow-step.is-active { grid-template-columns: minmax(0, 1fr); }
  .workflow-tab { min-width: 116px; flex-basis: 116px; }
}

.toggle-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.72);
}

.toggle-row input {
  width: auto;
}

@media (max-width: 1024px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .controls {
    grid-template-columns: 1fr;
    max-height: none;
    overflow: visible;
  }

  .admin-grid {
    grid-template-columns: 1fr;
  }

  .controls .group {
    grid-template-columns: 1fr;
  }

  .cover-preview-wrap {
    max-width: 100%;
  }
}

@media (max-width: 640px) {
  .app-shell {
    padding: 14px;
    gap: 14px;
  }

  .controls,
  .preview-panel,
  .login-card {
    padding: 18px;
    border-radius: 22px;
  }

  .preview-head {
    align-items: flex-start;
    flex-direction: column;
  }

  .preview-layout {
    inset: 74px 0 38px;
    gap: 10px;
  }

  .preview-top,
  .preview-middle,
  .preview-bottom {
    padding-left: 22px;
    padding-right: 22px;
  }
}

/* Keep the V3 scroll workflow authoritative after legacy responsive rules. */
@media (max-width: 1024px) {
  body[data-page="user"] .controls {
    height: min(760px, calc(100vh - 24px));
    max-height: none;
    overflow: hidden;
  }
  body[data-page="user"] .controls .workflow-step { overflow-y: auto; }
  body[data-page="user"] .controls .workflow-step.is-active {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 620px) {
  body[data-page="user"] .controls { height: calc(100vh - 16px); }
  body[data-page="user"] .controls .workflow-step.is-active { grid-template-columns: minmax(0, 1fr); }
}

/* V3 compact sequence: no nested scrollbars, functions read as clear blocks. */
body[data-page="user"] .app-shell { align-items: start; }
body[data-page="user"] .controls {
  height: auto;
  min-height: 0;
  max-height: none;
  overflow: visible;
  gap: 9px;
  padding: 14px;
}
body[data-page="user"] .controls .panel-header { padding-bottom: 2px; }
body[data-page="user"] .controls .panel-header h1 { margin-bottom: 2px; font-size: 1.55rem; }
body[data-page="user"] .controls .panel-header > .helper:empty { display: none; }

.workflow-tabs {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 5px;
  overflow: visible;
  padding: 5px;
  scrollbar-width: none;
}
.workflow-tabs::-webkit-scrollbar { display: none; }
.workflow-tab {
  min-width: 0;
  width: 100%;
  min-height: 58px;
  padding: 7px 6px;
  gap: 6px;
  position: relative;
}
.workflow-tab b { width: 22px; height: 22px; flex-basis: 22px; }
.workflow-tab small { white-space: normal; font-size: .59rem; }
.workflow-tab em {
  position: absolute;
  top: 4px;
  right: 5px;
  padding: 2px 5px;
  border-radius: 999px;
  color: #775361;
  background: rgba(255,255,255,.7);
  font-size: .52rem;
  font-style: normal;
  font-weight: 800;
}
.workflow-tab.is-active em { color: var(--v3-wine); background: #fff; }

body[data-page="user"] .controls .workflow-step,
body[data-page="user"] .controls .workflow-step.is-active {
  min-height: 0;
  max-height: none;
  overflow: visible;
  padding: 12px;
  gap: 8px 10px;
}
body[data-page="user"] .workflow-step > h2 {
  position: static;
  margin: -12px -12px 2px;
  padding: 12px 14px 10px;
  font-size: 1rem;
  border-radius: 18px 18px 0 0;
}
body[data-page="user"] .workflow-step > .field,
body[data-page="user"] .workflow-step > .token-box,
body[data-page="user"] .workflow-step > .logo-preview-box,
body[data-page="user"] .workflow-step > .cover-preview-wrap {
  margin: 0;
  padding: 10px;
  border-radius: 14px;
  border: 1px solid rgba(111, 38, 61, .08);
  background: rgba(255,255,255,.76);
  box-shadow: 0 5px 14px rgba(70, 28, 43, .04);
}
body[data-page="user"] .workflow-step .field span,
body[data-page="user"] .workflow-step .token-box p { margin-bottom: 5px; font-size: .82rem; }
body[data-page="user"] .workflow-step input[type="text"],
body[data-page="user"] .workflow-step input[type="file"],
body[data-page="user"] .workflow-step textarea,
body[data-page="user"] .workflow-step select { padding: 9px 10px; border-radius: 11px; }
body[data-page="user"] .workflow-step .helper { margin-top: 4px; margin-bottom: 2px; font-size: .76rem; line-height: 1.45; }
body[data-page="user"] .workflow-step .audio-row { gap: 7px; }
.icon-action {
  min-width: 0;
  padding: 9px 13px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font-weight: 800;
}
.icon-action > span { font-size: 1rem; line-height: 1; }
.step-navigation { margin-top: 2px; padding-top: 9px; }
.step-nav-btn { padding: 8px 12px; font-size: .78rem; }
body[data-page="user"] .cover-preview-wrap { max-width: 130px; }
body[data-page="user"] .logo-preview-box { min-height: 82px; }
.export-ready-card {
  grid-column: 1 / -1;
  padding: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  border-radius: 16px;
  color: #375b48;
  background: #edf6f0;
  border: 1px solid rgba(55,91,72,.12);
}
.export-ready-icon { width: 34px; height: 34px; display: grid; place-items: center; border-radius: 50%; color: #fff; background: #4f8b6c; font-weight: 900; }
.export-ready-card div { display: grid; gap: 2px; }
.export-ready-card small { color: #698073; }
.export-action-row { grid-column: 1 / -1; justify-content: center; }
.export-final-btn { min-width: 190px; }
.upgrade-feature-note {
  grid-column: 1 / -1;
  padding: 10px 12px;
  display: flex;
  align-items: center;
  gap: 9px;
  border-radius: 14px;
  color: #704b59;
  background: linear-gradient(135deg, #f7edf1, #fff9f4);
  border: 1px solid rgba(111,38,61,.12);
}
.upgrade-feature-note > span { font-size: 1.05rem; }
.upgrade-feature-note div { display: grid; gap: 1px; }
.upgrade-feature-note strong { font-size: .82rem; }
.upgrade-feature-note small { color: #8a717a; font-size: .7rem; }
.feature-locked {
  position: relative;
  opacity: .72;
  background: rgba(246,243,244,.84) !important;
  border-style: dashed !important;
}
.feature-locked::after {
  content: "🔒 升级可用";
  position: absolute;
  top: 7px;
  right: 8px;
  padding: 3px 7px;
  border-radius: 999px;
  color: #765461;
  background: #eee3e7;
  font-size: .59rem;
  font-weight: 800;
  line-height: 1;
  pointer-events: none;
}
.feature-locked input:disabled,
.feature-locked select:disabled,
.feature-locked button:disabled,
.feature-locked-button:disabled {
  cursor: not-allowed;
  opacity: .68;
}
.feature-locked-button {
  color: #765f68;
  background: #e9e4e6;
  box-shadow: inset 0 0 0 1px rgba(111,38,61,.08);
}

/* Step 2: group controls by task, not by individual field. */
body[data-page="user"] .title-main-field {
  grid-column: 1 / -1;
  width: 100%;
}

/* Step 4 follows V15.2: one predictable two-column workspace, compact controls. */
body[data-page="user"] .workflow-step[data-workflow-step="4"] > .upgrade-feature-note,
body[data-page="user"] .workflow-step[data-workflow-step="4"] > .cover-editor-grid {
  grid-column: 1 / -1;
}
.cover-editor-grid {
  display: grid;
  grid-template-columns: minmax(300px, .86fr) minmax(430px, 1.14fr);
  gap: 10px;
  align-items: stretch;
}
.cover-editor-card {
  min-width: 0;
  padding: 11px;
  border: 1px solid rgba(111, 38, 61, .09);
  border-radius: 16px;
  background: rgba(255,255,255,.74);
  box-shadow: 0 5px 14px rgba(70, 28, 43, .04);
}
.cover-editor-card h3 {
  margin: 0 0 9px;
  color: var(--v3-wine-deep);
  font-size: .86rem;
}
.cover-editor-card .field {
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
  box-shadow: none;
}
.cover-editor-card .field > span { margin-bottom: 4px; font-size: .74rem; }
.cover-editor-card input[type="text"],
.cover-editor-card input[type="file"],
.cover-editor-card select { padding: 7px 8px !important; border-radius: 9px !important; }
.compact-field-grid {
  display: grid;
  grid-template-columns: minmax(90px, .7fr) minmax(120px, 1fr) max-content;
  gap: 8px;
  align-items: end;
  margin-bottom: 9px;
}
.compact-control { width: max-content; max-width: 100%; }
.compact-control select { width: auto; min-width: 108px; max-width: 170px; }
.logo-inline-row {
  display: grid;
  grid-template-columns: 76px minmax(0, 1fr);
  gap: 9px;
  align-items: center;
  margin-top: 9px;
}
.logo-inline-row .logo-preview-box {
  min-height: 58px !important;
  height: 58px;
  padding: 6px;
  border-radius: 11px;
}
.logo-inline-row .logo-preview-image { max-width: 58px; max-height: 46px; }
.compact-actions { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.compact-actions button { margin: 0; padding: 7px 10px; font-size: .73rem; }
.cover-design-body {
  display: grid;
  grid-template-columns: minmax(210px, 1fr) 112px;
  gap: 10px;
  align-items: start;
}
.cover-settings-stack { display: grid; gap: 8px; align-content: start; }
.cover-short-controls {
  display: grid;
  grid-template-columns: repeat(2, max-content);
  gap: 8px;
  align-items: end;
}
.cover-design-card .cover-preview-wrap {
  width: 112px;
  max-width: 112px !important;
  margin: 0;
  border-radius: 13px;
}
.cover-design-card input[type="range"] { margin: 2px 0 0; }
@media (max-width: 1180px) {
  .cover-editor-grid { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 620px) {
  .compact-field-grid,
  .cover-design-body { grid-template-columns: minmax(0, 1fr); }
  .cover-short-controls { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .cover-design-card .cover-preview-wrap { width: 104px; max-width: 104px !important; }
}
.title-main-field textarea { min-height: 118px; }
.title-workspace {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(250px, .85fr);
  gap: 12px;
  align-items: stretch;
}
.title-function-card {
  min-width: 0;
  padding: 13px;
  border-radius: 17px;
  border: 1px solid rgba(111, 38, 61, .09);
  background: rgba(255,255,255,.82);
  box-shadow: 0 7px 20px rgba(70, 28, 43, .045);
}
.title-function-card > header {
  margin-bottom: 10px;
  padding-bottom: 9px;
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  border-bottom: 1px solid rgba(111, 38, 61, .08);
}
.title-function-card > header strong { color: var(--v3-wine-deep); font-size: .9rem; }
.title-function-card > header small { color: #8b7780; font-size: .67rem; }
.highlight-function-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 176px;
  gap: 10px;
  align-content: start;
}
.highlight-function-card > header,
.highlight-candidate-box { grid-column: 1 / -1; }
.highlight-candidate-box {
  min-height: 86px;
  padding: 10px;
  border-radius: 13px;
  background: #f7f4f5;
}
.highlight-function-card .field,
.title-format-card .field { margin: 0; }
.highlight-color-field .inline-field { grid-template-columns: minmax(0, 1fr) 46px; gap: 6px; }
.highlight-color-field input[type="color"] { min-height: 39px; padding: 4px; }
.title-format-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 9px;
  align-content: start;
}
.title-format-card .field {
  padding: 9px;
  border-radius: 12px;
  background: #f7f4f5;
}
.title-size-field { align-self: end; }

@media (max-width: 940px) {
  .title-workspace { grid-template-columns: minmax(0, 1fr); }
}

@media (max-width: 560px) {
  .highlight-function-card { grid-template-columns: minmax(0, 1fr); }
  .highlight-function-card > header,
  .highlight-candidate-box { grid-column: 1; }
}

@media (max-width: 720px) {
  .workflow-tabs { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  body[data-page="user"] .controls { height: auto; overflow: visible; }
}
