/* Apple-style light redesign. Visual layer only — workflow behavior untouched. */
:root {
  --background: #f5f5f7;
  --surface: #ffffff;
  --surface-soft: #fafafa;
  --surface-strong: #f5f5f7;
  --text: #1d1d1f;
  --text-muted: #6e6e73;
  --text-subtle: #86868b;
  --border: #e3e3e6;
  --border-strong: #c7c7cc;
  --primary: #0071e3;
  --primary-hover: #0077ed;
  --primary-soft: #eaf3fe;
  --success: #248a3d;
  --success-soft: #e8f6ec;
  --danger: #d70015;
  --danger-soft: #fdecec;
  --focus: #0071e3;
  --shadow: 0 4px 24px rgb(0 0 0 / 6%), 0 1px 4px rgb(0 0 0 / 4%);
  --radius: 18px;
  --transition: 200ms ease;
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro Text", "PingFang SC", "Segoe UI", "Microsoft YaHei", sans-serif;
}

body {
  background: var(--background);
  letter-spacing: -0.01em;
}

/* ---------- Header ---------- */
.app-header {
  border-bottom-color: rgb(0 0 0 / 7%);
  background: rgb(255 255 255 / 80%);
  backdrop-filter: blur(20px) saturate(180%);
  box-shadow: none;
}

.header-inner {
  min-height: 64px;
  max-width: 1400px;
}

.brand {
  gap: 12px;
  font-size: 17px;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.brand-mark {
  width: 34px;
  height: 34px;
  border: 1px solid rgb(0 0 0 / 6%);
  border-radius: 10px;
  background: var(--surface);
  box-shadow: 0 1px 3px rgb(0 0 0 / 6%);
}

.restart-button {
  min-height: 36px;
  padding-inline: 16px;
  border: 0;
  border-radius: 980px;
  background: var(--surface-strong);
  color: var(--text);
  font-weight: 500;
}

.restart-button:hover {
  border-color: transparent;
  background: #ebebee;
}

.mode-badge {
  border: 0;
  border-radius: 980px;
  background: var(--surface-strong);
  color: var(--text-muted);
  font-weight: 500;
}

.mode-badge.live {
  background: var(--success-soft);
  color: var(--success);
}

.mode-badge.live .mode-dot {
  background: #34c759;
  box-shadow: 0 0 0 4px rgb(52 199 89 / 16%);
}

/* ---------- Page frame ---------- */
.workspace,
.viewing-task .workspace {
  width: min(100%, 1400px);
  max-width: 1400px;
  padding: 44px 32px 140px;
}

.wizard-heading-row {
  min-height: 0;
  margin: 0 0 28px;
  padding: 4px 4px 0;
  align-items: center;
  border-bottom: 0;
}

.wizard-heading-row .page-heading,
.viewing-task .wizard-heading-row .page-heading {
  max-width: 780px;
}

.page-heading .eyebrow,
.eyebrow {
  color: var(--primary);
  font-size: 13px;
  font-weight: 600;
}

.wizard-heading-row .page-heading h1,
.viewing-task .wizard-heading-row .page-heading h1 {
  margin: 6px 0 10px;
  font-size: 44px;
  line-height: 1.08;
  font-weight: 700;
  letter-spacing: -0.025em;
}

.page-heading > p:last-child {
  max-width: 640px;
  color: var(--text-muted);
  font-size: 17px;
  line-height: 1.55;
}

.wizard-heading-row > .status-label {
  min-height: 34px;
  padding: 7px 14px;
  border: 0;
  border-radius: 980px;
  background: var(--success-soft);
  color: var(--success);
  font-weight: 500;
}

.status-label {
  border-radius: 980px;
}

/* ---------- Cards ---------- */
.step-host {
  min-width: 0;
  min-height: 480px;
  padding: 40px 44px 16px;
  border: 1px solid rgb(0 0 0 / 5%);
  border-radius: 24px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.step-view-product,
.step-view-creative,
.step-view-script,
.step-view-scene,
.step-view-scene:not(:has(.scene-review:not([hidden]))),
.step-view-keyframes,
.step-view-video {
  width: 100%;
  max-width: none;
  margin-inline: 0;
}

.form-section,
.viewing-task .form-section,
.review-section,
.viewing-task .review-section,
.material-subsection {
  padding-bottom: 36px;
}

.form-section + .form-section,
.review-section + .review-section {
  padding-top: 36px;
  border-top-color: var(--border);
}

.section-heading,
.viewing-task .section-heading,
.review-heading {
  margin-bottom: 24px;
}

.section-heading {
  gap: 14px;
}

.section-icon,
.viewing-task .section-icon {
  width: 42px;
  height: 42px;
  flex-basis: 42px;
  border: 0;
  border-radius: 12px;
  background: var(--primary-soft);
}

.material-subheading .section-icon {
  border: 0;
  background: var(--surface-strong);
}

.section-heading h2,
.review-heading strong {
  font-size: 21px;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.section-step,
.review-kicker {
  color: var(--primary);
  font-weight: 600;
  letter-spacing: 0;
}

/* ---------- Dropzones & uploads ---------- */
.dropzone {
  min-height: 180px;
  padding: 30px 24px;
  border: 1.5px dashed #c7c7cc;
  border-radius: 18px;
  background: #fafafa;
  box-shadow: none;
  transition: border-color var(--transition), background var(--transition), box-shadow var(--transition);
}

.dropzone:hover,
.dropzone.dragging {
  border-color: var(--primary);
  background: #f2f8ff;
  box-shadow: 0 0 0 4px rgb(0 113 227 / 8%);
}

.dropzone::after {
  display: none;
}

.compact-dropzone {
  min-height: 150px;
}

.dropzone-icon {
  width: 28px;
  opacity: .7;
}

.dropzone-title {
  color: var(--text);
  font-size: 15px;
  font-weight: 600;
}

.dropzone-meta {
  color: var(--text-subtle);
}

.dropzone.has-selection {
  border: 1.5px solid #86c98f;
  background: #f2faf3;
}

.dropzone.disabled {
  border-color: #e3e3e6;
  background: #f5f5f7;
}

.product-upload-shell {
  width: min(100%, 720px);
  min-width: 0;
  margin-inline: auto;
}

.product-upload-shell:has(#imageList .image-item) {
  display: flex;
  width: fit-content;
  max-width: 100%;
  padding: 12px;
  flex-flow: row wrap;
  align-items: flex-start;
  justify-content: center;
  gap: 12px;
  border: 1.5px dashed var(--border-strong);
  border-radius: 18px;
  background: #fafafa;
  box-shadow: inset 0 1px 0 rgb(255 255 255 / 80%);
}

.product-upload-shell:has(#imageList .image-item) #imageList {
  display: flex;
  width: auto;
  max-width: 676px;
  margin: 0;
  flex: 0 1 auto;
  flex-wrap: wrap;
  justify-content: center;
  order: 1;
  gap: 12px;
}

.product-upload-shell #imageList .image-item {
  width: 160px;
  flex: 0 0 160px;
  aspect-ratio: 1;
}

.product-upload-shell #imageList .image-item > img {
  display: block;
  width: 100%;
  height: 100%;
  background: var(--surface);
  object-fit: contain;
  object-position: center;
}

.product-upload-shell:has(#imageList .image-item) #dropzone {
  width: 160px;
  height: 160px;
  min-height: 160px;
  padding: 18px 14px;
  flex: 0 0 160px;
  order: 2;
  flex-direction: column;
  border: 1.5px dashed var(--border-strong);
  border-radius: 14px;
  background: var(--surface);
  box-shadow: 0 1px 3px rgb(0 0 0 / 5%);
}

.product-upload-shell:has(#imageList .image-item) #dropzone:hover {
  border-color: var(--primary);
  background: var(--primary-soft);
  box-shadow: 0 0 0 4px rgb(0 113 227 / 8%);
}

.product-upload-shell:has(#imageList .image-item) #dropzone .dropzone-icon {
  width: 24px;
  margin: 0 0 6px;
}

.product-upload-shell:has(#imageList .image-item) #dropzone .dropzone-meta {
  margin: 5px 0 0;
  font-size: 11px;
  line-height: 1.4;
  text-align: center;
}

.product-upload-shell:has(#imageList .image-item) #dropzone.at-capacity,
.product-upload-shell:has(#dropzone[hidden]) #dropzone {
  display: none;
}

.scene-upload-grid {
  gap: 14px;
}

.image-list {
  gap: 12px;
}

.image-item {
  overflow: hidden;
  border: 1px solid rgb(0 0 0 / 5%);
  border-radius: 14px;
  background: var(--surface);
  box-shadow: 0 2px 10px rgb(0 0 0 / 5%);
}

/* ---------- Fields ---------- */
.field-grid {
  gap: 26px 20px;
}

.field label {
  margin-bottom: 8px;
  color: var(--text);
  font-size: 14px;
  line-height: 1.35;
  font-weight: 600;
  transition: color var(--transition);
}

.field label span {
  color: var(--danger);
}

.field:focus-within > label,
.field:focus-within .field-label-row > label {
  color: var(--focus);
}

.field input,
.field textarea,
.script-beat-editor input,
.script-beat-editor textarea {
  min-height: 50px;
  padding: 13px 16px;
  border: 1px solid #d2d2d7;
  border-radius: 12px;
  background: var(--surface);
  color: var(--text);
  caret-color: var(--primary);
  box-shadow: none;
  transition: border-color var(--transition), box-shadow var(--transition), background var(--transition);
}

.field textarea,
.script-beat-editor textarea {
  min-height: 124px;
  line-height: 1.65;
}

.compact-field textarea,
.script-beat-editor textarea {
  min-height: 108px;
}

.field input::placeholder,
.field textarea::placeholder,
.script-beat-editor input::placeholder,
.script-beat-editor textarea::placeholder {
  color: #86868b;
  opacity: 1;
}

.field input:hover,
.field textarea:hover,
.script-beat-editor input:hover,
.script-beat-editor textarea:hover {
  border-color: #aeaeb2;
  background: var(--surface);
}

.field input:focus,
.field textarea:focus,
.script-beat-editor input:focus,
.script-beat-editor textarea:focus {
  border-color: var(--focus);
  outline: 0;
  background: var(--surface);
  box-shadow: 0 0 0 4px rgb(0 113 227 / 14%);
}

.field input[aria-invalid="true"],
.field textarea[aria-invalid="true"],
.script-beat-editor input[aria-invalid="true"],
.script-beat-editor textarea[aria-invalid="true"] {
  border-color: var(--danger);
  background: var(--surface);
  box-shadow: 0 0 0 4px rgb(215 0 21 / 10%);
}

.field input:disabled,
.field textarea:disabled,
.script-beat-editor input:disabled,
.script-beat-editor textarea:disabled {
  border-color: #e3e3e6;
  background: #f5f5f7;
  color: #86868b;
  box-shadow: none;
  cursor: not-allowed;
}

.field input[readonly],
.field textarea[readonly] {
  border-color: #e3e3e6;
  background: #f5f5f7;
  color: var(--text-muted);
}

.field input:-webkit-autofill,
.field textarea:-webkit-autofill {
  -webkit-text-fill-color: var(--text);
  box-shadow: inset 0 0 0 1000px #fff;
  transition: background-color 9999s ease-out;
}

/* ---------- Choices ---------- */
.story-options {
  padding: 0;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  border: 0;
  background: transparent;
}

.story-option {
  min-height: 82px;
  padding: 16px 44px 16px 18px;
  justify-content: center;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--surface);
  text-align: left;
  transition: border-color var(--transition), box-shadow var(--transition), background var(--transition);
}

.story-option:hover {
  border-color: var(--border-strong);
  background: var(--surface);
}

.story-option:has(input:checked) {
  border-color: var(--primary);
  background: #f2f8ff;
  box-shadow: 0 0 0 3px rgb(0 113 227 / 10%);
}

.story-options.locked,
.advanced-settings,
.prompt-details {
  border-color: var(--border);
  border-radius: 14px;
  background: var(--surface-soft);
}

.duration-options {
  width: 176px;
  padding: 4px;
  gap: 4px;
  border: 1px solid rgb(0 0 0 / 6%);
  border-radius: 12px;
  background: #f2f2f4;
  box-shadow: inset 0 1px 2px rgb(0 0 0 / 4%);
}

.duration-options label {
  border-radius: 9px;
  cursor: pointer;
}

.duration-options span {
  min-height: 44px;
  border: 0;
  border-radius: 9px;
  color: #6e6e73;
  font-size: 14px;
  font-weight: 600;
  transition: color var(--transition), background var(--transition), box-shadow var(--transition), transform var(--transition);
}

.duration-options label:hover input:not(:checked) + span {
  background: rgb(255 255 255 / 72%);
  color: var(--text);
}

.duration-options input:checked + span {
  border: 0;
  background: var(--primary);
  color: #fff;
  box-shadow: 0 2px 8px rgb(0 113 227 / 22%);
}

.duration-options label:active span {
  transform: scale(.98);
}

.duration-options input:focus-visible + span {
  outline: 0;
  box-shadow: 0 0 0 3px var(--surface), 0 0 0 6px rgb(0 113 227 / 18%);
}

.advanced-settings summary,
.prompt-details summary {
  min-height: 54px;
}

.advanced-settings {
  overflow: hidden;
  margin-top: 20px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--surface);
  transition: border-color var(--transition), box-shadow var(--transition);
}

.advanced-settings[open] {
  border-color: #d2d2d7;
  box-shadow: 0 4px 16px rgb(0 0 0 / 5%);
}

.advanced-settings summary {
  padding: 0 18px;
  color: var(--text);
  font-size: 14px;
  font-weight: 600;
  transition: background var(--transition);
}

.advanced-settings summary:hover {
  background: var(--surface-soft);
}

.advanced-settings summary img {
  width: 16px;
  opacity: .68;
}

.advanced-settings .advanced-content {
  padding: 0 18px 8px;
  border-top: 1px solid var(--border);
}

.advanced-settings .spec-list {
  display: grid;
  margin: 0;
  padding: 16px 0;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.advanced-settings .spec-list span {
  display: flex;
  min-height: 58px;
  padding: 10px 12px;
  flex-direction: column;
  justify-content: center;
  gap: 2px;
  border: 0;
  border-radius: 10px;
  background: var(--surface-strong);
}

.advanced-settings .spec-list small {
  color: var(--text-subtle);
  font-size: 11px;
  font-weight: 500;
}

.advanced-settings .spec-list strong {
  color: var(--text);
  font-size: 14px;
  font-weight: 600;
}

.advanced-settings .toggle-row {
  min-height: 68px;
  padding: 0 2px;
  gap: 24px;
}

.advanced-settings .toggle-row strong {
  color: var(--text);
  font-weight: 600;
}

.advanced-settings .toggle-row small {
  margin-top: 3px;
  color: var(--text-subtle);
  line-height: 1.4;
}

.advanced-settings .toggle {
  flex-basis: 46px;
  width: 46px;
  height: 28px;
  border: 1px solid rgb(0 0 0 / 5%);
  background: #d1d1d6;
  box-shadow: inset 0 1px 2px rgb(0 0 0 / 8%);
}

.advanced-settings .toggle::after {
  top: 3px;
  left: 3px;
  width: 20px;
  height: 20px;
  box-shadow: 0 1px 4px rgb(0 0 0 / 22%);
}

.advanced-settings .toggle-row input:checked + .toggle {
  border-color: var(--primary);
  background: var(--primary);
  box-shadow: inset 0 0 0 1px rgb(255 255 255 / 10%), 0 2px 7px rgb(0 113 227 / 18%);
}

.advanced-settings .toggle-row input:checked + .toggle::after {
  transform: translateX(18px);
}

.advanced-settings .toggle-row input:focus-visible + .toggle {
  outline: 0;
  box-shadow: 0 0 0 3px var(--surface), 0 0 0 6px rgb(0 113 227 / 18%);
}

.hook-options {
  gap: 12px;
}

.hook-option {
  border-color: var(--border);
  border-radius: 14px;
  background: var(--surface);
}

.hook-option:has(input:checked) {
  border-color: var(--primary);
  background: #f2f8ff;
  box-shadow: 0 0 0 3px rgb(0 113 227 / 10%);
}

.script-timeline {
  margin-bottom: 20px;
  padding: 6px;
  gap: 6px;
  border: 0;
  border-radius: 14px;
  background: var(--surface-strong);
}

.script-timeline button {
  min-height: 64px;
  border: 1px solid transparent;
  border-radius: 10px;
}

.script-timeline button:hover {
  background: rgb(255 255 255 / 80%);
}

.script-timeline button.current {
  border-color: transparent;
  border-bottom-color: transparent;
  background: var(--surface);
  color: var(--primary);
  box-shadow: 0 2px 10px rgb(0 0 0 / 8%);
}

.script-beat-editor {
  padding: 28px;
  gap: 20px;
  border: 0;
  border-radius: 18px;
  background: var(--surface-soft);
}

.compact-badge {
  border: 0;
  border-radius: 980px;
  background: var(--surface-strong);
  color: var(--text-muted);
  font-weight: 500;
}

/* ---------- Scene / review panels ---------- */
.step-view-scene {
  display: block;
}

.scene-review,
.step-review-aside,
.step-view-keyframes #keyframeReview > .compact-field {
  padding: 26px;
  border: 1px solid rgb(0 0 0 / 5%);
  border-radius: 18px;
  background: var(--surface-soft);
  box-shadow: none;
}

.scene-review {
  position: static;
  width: min(100%, 960px);
  margin: 40px auto 0;
  padding: 32px;
}

.scene-review::before {
  display: none;
}

.scene-asset-comparison {
  display: grid;
  margin-top: 28px;
  padding-top: 28px;
  grid-template-columns: minmax(0, 760px);
  justify-content: center;
  gap: 24px;
  border-top: 1px solid var(--border);
}

.scene-asset-comparison > :only-child,
.scene-asset-comparison:not(:has(.placement-source-block:not([hidden]))) .scene-board-block {
  grid-column: 1;
}

.placement-source-block {
  width: min(100%, 360px);
  margin-top: 0;
  justify-self: center;
}

.scene-board-block {
  width: min(100%, 760px);
  margin-top: 0;
  justify-self: center;
}

.scene-board-block .asset-label {
  display: flex;
  margin-bottom: 12px;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  font-size: 14px;
}

.scene-board-block .review-image-preview,
.scene-board-block .review-image-preview > img {
  border-radius: 14px;
}

.scene-board-block .review-image-preview > img {
  border-color: var(--border);
  background: var(--surface);
  box-shadow: 0 8px 28px rgb(0 0 0 / 8%);
}

#sceneConfirmationControls {
  width: min(100%, 760px);
  margin: 24px auto 0;
}

.step-view-keyframes #keyframeReview {
  grid-template-columns: minmax(0, 1fr) 300px;
  gap: 24px 30px;
}

.keyframe-focus {
  min-height: 500px;
  border-color: #1d1d1f;
  border-radius: 18px;
  box-shadow: 0 16px 40px rgb(0 0 0 / 16%);
}

.keyframe-filmstrip {
  gap: 10px;
}

.keyframe-filmstrip .keyframe-item {
  border-color: var(--border);
  border-radius: 12px;
  background: var(--surface);
  box-shadow: 0 2px 8px rgb(0 0 0 / 4%);
}

.keyframe-filmstrip .keyframe-item.current {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgb(0 113 227 / 14%);
}

.step-review-layout {
  grid-template-columns: minmax(0, 1fr) 320px;
  gap: 36px;
}

.video-main-visual .video-stage,
.viewing-task .video-main-visual .video-stage {
  width: min(100%, 420px);
  border-radius: 22px;
  box-shadow: 0 20px 48px rgb(0 0 0 / 18%);
}

.video-stage {
  border-radius: 22px;
}

.step-review-aside {
  background: var(--surface-soft);
}

/* ---------- Buttons ---------- */
.primary-button,
.secondary-button {
  min-height: 46px;
  border-radius: 980px;
  font-size: 14px;
  font-weight: 600;
  transition: color var(--transition), background var(--transition), border-color var(--transition), box-shadow var(--transition), opacity var(--transition), transform var(--transition);
}

.primary-button {
  border-color: var(--primary);
  background: var(--primary);
  box-shadow: none;
}

.primary-button:not(:disabled):hover {
  border-color: var(--primary-hover);
  background: var(--primary-hover);
  box-shadow: 0 6px 18px rgb(0 113 227 / 25%);
}

.primary-button:not(:disabled):active {
  transform: scale(.985);
}

.secondary-button {
  border-color: #d2d2d7;
  background: var(--surface);
  box-shadow: none;
}

.secondary-button:hover {
  border-color: #aeaeb2;
  background: var(--surface-soft);
}

.text-action {
  border-radius: 980px;
}

/* ---------- Wizard bar / drawer / dialog ---------- */
.wizard-action-bar {
  border-top-color: rgb(0 0 0 / 6%);
  background: rgb(255 255 255 / 85%);
  backdrop-filter: blur(20px) saturate(180%);
  box-shadow: none;
}

.wizard-action-inner {
  min-height: 76px;
  width: min(100%, 1400px);
  padding: 12px 32px;
}

.task-summary-drawer {
  right: 24px;
  bottom: 96px;
  border-color: rgb(0 0 0 / 8%);
  border-radius: 18px;
  background: rgb(255 255 255 / 96%);
  box-shadow: 0 20px 50px rgb(0 0 0 / 14%);
}

.task-summary-drawer > summary:hover {
  background: var(--surface-soft);
}

.generation-dialog {
  width: min(520px, calc(100vw - 32px));
  padding: 36px 38px 32px;
  border: 0;
  border-radius: 24px;
  background: var(--surface);
  box-shadow: 0 30px 90px rgb(0 0 0 / 24%);
}

.generation-dialog::before {
  height: 4px;
  background: var(--primary);
}

.generation-dialog::backdrop {
  background: rgb(20 23 28 / 48%);
  backdrop-filter: blur(8px);
}

.generation-orbit {
  display: grid;
  width: 68px;
  height: 68px;
  margin: 0 auto 18px;
  place-items: center;
  border: 1px solid #d9eaff;
  background: #f2f8ff;
  box-shadow: 0 0 0 8px rgb(0 113 227 / 4%);
}

.generation-orbit img {
  width: 24px;
  height: 24px;
}

.generation-orbit span {
  top: -4px;
  left: 28px;
  width: 10px;
  height: 10px;
  transform-origin: 5px 38px;
  box-shadow: 0 0 0 4px var(--surface);
}

.generation-dialog .eyebrow {
  display: inline-flex;
  margin: 0 0 8px;
  padding: 5px 9px;
  border-radius: 980px;
  background: var(--primary-soft);
  color: var(--primary);
  font-size: 12px;
  font-weight: 600;
}

.generation-dialog h2 {
  margin: 0;
  font-size: 26px;
  line-height: 1.25;
}

.generation-pipeline {
  position: relative;
  display: grid;
  margin: 22px 0 26px;
  padding: 0;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  list-style: none;
}

.generation-pipeline::before {
  position: absolute;
  top: 7px;
  right: 16.66%;
  left: 16.66%;
  height: 2px;
  background: var(--border);
  content: "";
}

.generation-pipeline li {
  position: relative;
  z-index: 1;
  display: grid;
  justify-items: center;
  gap: 8px;
  color: var(--text-subtle);
  font-size: 12px;
}

.generation-pipeline li > span {
  width: 16px;
  height: 16px;
  border: 4px solid var(--surface);
  border-radius: 50%;
  background: #d1d1d6;
  box-shadow: 0 0 0 1px #d1d1d6;
}

.generation-pipeline li > strong {
  font-weight: 500;
}

.generation-pipeline li.complete {
  color: var(--success);
}

.generation-pipeline li.complete > span {
  background: var(--success);
  box-shadow: 0 0 0 1px var(--success);
}

.generation-pipeline li.current {
  color: var(--primary);
}

.generation-pipeline li.current > span {
  background: var(--primary);
  box-shadow: 0 0 0 2px rgb(0 113 227 / 22%);
}

.generation-pipeline li.error {
  color: var(--danger);
}

.generation-pipeline li.error > span {
  background: var(--danger);
  box-shadow: 0 0 0 2px rgb(215 0 21 / 16%);
}

.generation-progress-heading {
  display: flex;
  margin-bottom: 10px;
  align-items: center;
  justify-content: space-between;
  color: var(--text-muted);
  font-size: 13px;
}

.generation-progress-heading strong {
  color: var(--text);
  font-size: 14px;
  font-variant-numeric: tabular-nums;
}

.generation-dialog progress {
  height: 10px;
  border-radius: 980px;
}

.generation-dialog progress::-webkit-progress-bar {
  background: var(--surface-strong);
}

.generation-dialog progress::-webkit-progress-value {
  background: var(--primary);
  border-radius: 980px;
  transition: width .7s ease;
}

.generation-dialog progress::-moz-progress-bar {
  background: var(--primary);
  border-radius: 980px;
}

.generation-dialog.is-error::before {
  background: var(--danger);
}

.generation-dialog.is-error .generation-orbit {
  border-color: #ffd5da;
  background: var(--danger-soft);
  box-shadow: 0 0 0 8px rgb(215 0 21 / 4%);
}

.generation-dialog.is-error .generation-orbit span {
  background: var(--danger);
  animation-play-state: paused;
}

.generation-dialog-error {
  margin-top: 22px;
  padding: 14px 16px;
  border-radius: 12px;
  line-height: 1.5;
}

@media (max-width: 560px) {
  .generation-dialog {
    padding: 30px 22px 24px;
    border-radius: 20px;
  }

  .generation-orbit {
    width: 60px;
    height: 60px;
  }

  .generation-orbit span {
    left: 24px;
    transform-origin: 5px 34px;
  }

  .generation-dialog h2 {
    font-size: 23px;
  }

  .generation-pipeline li > strong {
    font-size: 11px;
  }
}

.image-lightbox {
  border-radius: 20px;
}

.toast {
  border-radius: 980px;
}

/* ---------- Desktop layout ---------- */
@media (min-width: 1024px) {
  .editor,
  .viewing-task .editor {
    display: grid;
    grid-template-columns: 232px minmax(0, 1fr);
    column-gap: 32px;
    align-items: start;
  }

  .wizard-heading-row {
    grid-column: 2;
    grid-row: 1;
  }

  .workflow-steps,
  .viewing-task .workflow-steps {
    position: sticky;
    top: 92px;
    display: flex;
    overflow: visible;
    margin: 0;
    padding: 14px 12px 16px;
    grid-column: 1;
    grid-row: 1 / span 5;
    align-self: start;
    flex-direction: column;
    gap: 2px;
    border: 1px solid rgb(0 0 0 / 5%);
    border-radius: 20px;
    background: var(--surface);
    box-shadow: var(--shadow);
  }

  .workflow-steps::before {
    display: block;
    padding: 4px 10px 12px;
    color: var(--text-subtle);
    content: "制作流程";
    font-size: 12px;
    font-weight: 600;
  }

  .workflow-steps li,
  .viewing-task .workflow-steps li,
  .workflow-steps li.current,
  .workflow-steps li.complete,
  .workflow-steps li.locked {
    min-height: 56px;
    padding: 0;
    border: 0;
    background: transparent;
  }

  .editor .workflow-steps li + li::before,
  .editor .workflow-steps li:nth-child(5)::before,
  .viewing-task .editor .workflow-steps li:nth-child(5)::before {
    z-index: 0;
    top: -5px;
    bottom: auto;
    left: 25px;
    display: block;
    width: 1px;
    height: 10px;
    background: var(--border);
  }

  .editor .workflow-steps li.complete + li::before {
    background: #a9dcb3;
  }

  .editor .workflow-steps button {
    position: relative;
    z-index: 1;
    display: grid;
    width: 100%;
    min-height: 56px;
    padding: 8px 10px;
    grid-template-columns: 32px minmax(0, 1fr);
    align-items: center;
    justify-content: stretch;
    gap: 10px;
    border: 1px solid transparent;
    border-radius: 12px;
    background: transparent;
    text-align: left;
  }

  .editor .workflow-steps button:hover:not(:disabled) {
    border-color: transparent;
    background: var(--surface-strong);
  }

  .editor .workflow-steps span,
  .viewing-task .editor .workflow-steps span {
    display: grid;
    width: 32px;
    height: 32px;
    place-items: center;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: var(--surface);
    color: var(--text-subtle);
    font-size: 11px;
    font-weight: 600;
    box-shadow: none;
  }

  .editor .workflow-steps strong,
  .viewing-task .editor .workflow-steps strong {
    overflow: visible;
    color: var(--text-muted);
    font-size: 14px;
    font-weight: 500;
    text-overflow: clip;
    white-space: normal;
  }

  .editor .workflow-steps li.current button {
    border-color: transparent;
    background: var(--primary-soft);
  }

  .editor .workflow-steps li.current span {
    border-color: var(--primary);
    background: var(--primary);
    color: #fff;
  }

  .editor .workflow-steps li.current strong {
    color: var(--primary);
    font-weight: 600;
  }

  .editor .workflow-steps li.complete span {
    border-color: #a9dcb3;
    background: var(--success-soft);
    color: var(--success);
  }

  .editor .workflow-steps li.complete strong {
    color: var(--success);
  }

  .editor .workflow-steps li.locked button {
    opacity: .5;
  }

  #taskNotice {
    grid-column: 2;
    grid-row: 2;
  }

  #formMessage {
    grid-column: 2;
    grid-row: 3;
  }

  #stepHost {
    grid-column: 2;
    grid-row: 4;
  }

  .legacy-submit {
    grid-column: 2;
    grid-row: 5;
  }

  .wizard-action-inner {
    display: grid;
    grid-template-columns: 232px minmax(0, 1fr) auto;
    column-gap: 32px;
  }

  .wizard-action-inner #wizardBackButton {
    margin: 0;
    grid-column: 2;
    justify-self: start;
  }

  .wizard-action-inner #wizardPrimaryButton {
    grid-column: 3;
  }
}

/* ---------- Tablet & mobile ---------- */
@media (max-width: 1023px) {
  .workspace,
  .viewing-task .workspace {
    padding: 32px 22px 120px;
  }

  .editor,
  .viewing-task .editor {
    display: block;
  }

  .workflow-steps,
  .viewing-task .workflow-steps {
    display: none;
  }

  .mobile-progress {
    display: block;
    margin: 0 0 24px;
    padding: 14px 16px 15px;
    border: 1px solid rgb(0 0 0 / 5%);
    border-radius: 16px;
    background: var(--surface);
    box-shadow: var(--shadow);
  }

  .step-host {
    padding: 30px 28px 8px;
  }

  .step-view-scene,
  .step-view-scene:not(:has(.scene-review:not([hidden]))),
  .step-view-keyframes #keyframeReview,
  .step-review-layout {
    display: block;
    width: 100%;
  }

  .scene-review {
    position: static;
  }

  .scene-review,
  .step-view-keyframes #keyframeReview > .story-review-warning,
  .step-view-keyframes #keyframeReview > .compact-field,
  .step-view-keyframes #keyframeReview > .review-actions,
  .step-review-aside {
    margin-top: 28px;
  }

  .wizard-action-inner {
    display: flex;
    padding-inline: 22px;
  }

  .wizard-action-inner #wizardBackButton {
    margin-right: auto;
  }
}

@media (max-width: 600px) {
  body {
    padding-bottom: 88px;
  }

  .header-inner {
    min-height: 58px;
    padding-inline: 16px;
  }

  .brand-mark {
    width: 30px;
    height: 30px;
  }

  .workspace,
  .viewing-task .workspace {
    padding: 24px 12px 96px;
  }

  .wizard-heading-row {
    margin-bottom: 20px;
    padding: 0 4px;
  }

  .wizard-heading-row .page-heading h1,
  .viewing-task .wizard-heading-row .page-heading h1 {
    font-size: 32px;
  }

  .page-heading > p:last-child {
    font-size: 15px;
  }

  .wizard-heading-row > .status-label {
    margin-top: 12px;
  }

  .mobile-progress {
    margin-bottom: 16px;
    padding: 13px 14px 14px;
  }

  .step-host {
    min-height: 0;
    padding: 24px 16px 4px;
    border-radius: 20px;
  }

  .form-section,
  .viewing-task .form-section,
  .review-section,
  .viewing-task .review-section,
  .material-subsection {
    padding-bottom: 28px;
  }

  .form-section + .form-section,
  .review-section + .review-section {
    padding-top: 28px;
  }

  .section-heading,
  .viewing-task .section-heading,
  .review-heading {
    margin-bottom: 18px;
  }

  .section-icon,
  .viewing-task .section-icon {
    width: 38px;
    height: 38px;
    flex-basis: 38px;
  }

  .dropzone {
    min-height: 150px;
    padding: 24px 14px;
  }

  .compact-dropzone {
    min-height: 132px;
  }

  .product-upload-shell:has(#imageList .image-item) {
    padding: 10px;
    gap: 10px;
  }

  .product-upload-shell:has(#imageList .image-item) #imageList {
    max-width: 274px;
    gap: 10px;
  }

  .product-upload-shell #imageList .image-item {
    width: 132px;
    flex-basis: 132px;
  }

  .product-upload-shell:has(#imageList .image-item) #dropzone {
    width: 132px;
    height: 132px;
    min-height: 132px;
    padding: 12px 10px;
    flex-basis: 132px;
  }

  .product-upload-shell:has(#imageList .image-item) #dropzone .dropzone-meta {
    margin-top: 4px;
    font-size: 12px;
    text-align: center;
  }

  .story-options {
    grid-template-columns: 1fr;
  }

  .script-beat-editor {
    padding: 20px 16px;
  }

  .keyframe-focus,
  .keyframe-focus.is-empty {
    min-height: 380px;
  }

  .scene-review,
  .step-review-aside,
  .step-view-keyframes #keyframeReview > .compact-field {
    padding: 18px 16px;
  }

  .wizard-action-inner {
    min-height: 72px;
    padding: 10px 12px calc(10px + env(safe-area-inset-bottom));
  }

  .task-summary-drawer {
    right: 12px;
    bottom: 84px;
  }

  .task-summary-drawer:not([open]) {
    width: 156px;
  }
}

.placement-comparison {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 20px;
  align-items: start;
}

.placement-comparison > * { min-width: 0; }
.placement-comparison h3 { margin: 0 0 12px; font-size: 15px; }
.placement-comparison p,
.placement-review-guidance { color: var(--muted, #64748b); font-size: 13px; line-height: 1.7; }
.placement-comparison .image-preview-button { width: 100%; background: #f2f4f6; border-radius: 12px; }
.placement-comparison .image-preview-button img { width: 100%; height: 320px; object-fit: contain; }
.keyframe-placement-comparison .keyframe-focus { min-height: 0; padding: 0; background: transparent; border-color: #e2e8f0; border-radius: 12px; box-shadow: none; }
.keyframe-placement-comparison .keyframe-focus-meta { color: var(--text, #1d1d1f); font-size: 13px; gap: 8px; }
.keyframe-placement-comparison .generated-image-download-button img { width: 19px; height: 19px; }
#confirmKeyframeBaseButton { display: none !important; }
.keyframe-placement-comparison .keyframe-focus > .image-preview-button { height: 400px; background: #f2f4f6; }
.keyframe-placement-comparison .keyframe-focus .image-preview-button img { height: 400px; }
.keyframe-placement-comparison > section .image-preview-button img { height: 400px; }
.placement-review-guidance { margin: 0 0 20px; }

.video-placement-review { margin-top: 28px; padding-top: 24px; border-top: 1px solid #e2e8f0; }
.video-placement-review > p { font-size: 14px; line-height: 1.7; }
.video-placement-review .placement-review-note { color: #64748b; font-size: 12px; }
#videoPlacementSamples > label { display: block; font-size: 13px; font-weight: 600; margin: 20px 0 8px; }
#videoPlacementSample { width: 100%; min-height: 44px; margin-bottom: 20px; padding: 10px 12px; border: 1px solid var(--border, #d1d5db); border-radius: 12px; background: var(--surface, #fff); color: var(--text, #1d1d1f); font: inherit; font-size: 14px; }
#videoPlacementSample:focus-visible { outline: 3px solid var(--primary, #0071e3); outline-offset: 2px; }
#videoReview .review-actions { grid-template-columns: minmax(0, 1fr); align-items: start; gap: 12px; }
#videoReview .placement-acceptance { margin-top: 0; }
#videoPlacementIssues { padding-left: 20px; font-size: 14px; line-height: 1.8; }
#videoPlacementError { color: #9f3a24; overflow-wrap: anywhere; }
#videoPlacementBadge[data-status="accepted"] { color: #32624f; background: #edf7f2; }
#videoPlacementBadge[data-status="deviation"],
#videoPlacementBadge[data-status="uncertain"],
#videoPlacementBadge[data-status="error"] { color: #92400e; background: #fff4dc; }
.placement-acceptance { display: flex; align-items: flex-start; gap: 10px; min-height: 44px; margin-top: 20px; padding: 14px 12px; background: #fff8ea; border-radius: 12px; color: #754617; font-size: 13px; line-height: 1.7; cursor: pointer; }
.placement-acceptance input { flex: 0 0 20px; width: 20px; height: 20px; margin-top: 2px; accent-color: var(--accent, #e97845); }
.placement-acceptance[hidden] { display: none; }

@media (max-width: 700px) {
  .placement-comparison { grid-template-columns: minmax(0, 1fr); gap: 16px; }
  .keyframe-placement-comparison .keyframe-focus > .image-preview-button { height: 300px; }
  .placement-comparison .image-preview-button img,
  .keyframe-placement-comparison .keyframe-focus .image-preview-button img,
  .keyframe-placement-comparison > section .image-preview-button img { height: 300px; }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: .01ms !important;
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
  }
}
