/* Soft UI theme layer. Loaded last so the workflow and DOM remain unchanged. */
:root {
  --soft-canvas: #e9eef3;
  --soft-canvas-deep: #e2e8ef;
  --soft-surface: #ffffff;
  --soft-surface-muted: #f5f7fa;
  --soft-surface-pressed: #eef1f6;
  --soft-ink: #2d3345;
  --soft-text: #596174;
  --soft-muted: #687286;
  --soft-faint: #929aab;
  --soft-primary: #6366f1;
  --soft-primary-strong: #4f46e5;
  --soft-primary-soft: #eef0ff;
  --soft-primary-halo: rgb(99 102 241 / 20%);
  --soft-pink: #db6e9e;
  --soft-pink-soft: #fceef5;
  --soft-emerald: #0f9f78;
  --soft-emerald-soft: #e8f8f2;
  --soft-amber: #c27a18;
  --soft-amber-soft: #fff6df;
  --soft-danger: #c94c5d;
  --soft-danger-soft: #fff0f2;
  --soft-line: #dfe5ec;
  --soft-line-strong: #cfd7e2;
  --soft-radius-control: 16px;
  --soft-radius-card: 24px;
  --soft-shadow-sm: 0 5px 14px rgb(81 94 117 / 9%), 0 1px 3px rgb(81 94 117 / 7%);
  --soft-shadow-md: 0 12px 30px rgb(81 94 117 / 12%), 0 3px 8px rgb(81 94 117 / 6%);
  --soft-shadow-lg: 0 22px 54px rgb(88 101 126 / 15%), 0 5px 16px rgb(88 101 126 / 7%);
  --soft-shadow-primary: 0 14px 30px rgb(99 102 241 / 23%), 0 4px 10px rgb(99 102 241 / 12%);
  --soft-shadow-pink: 0 12px 28px rgb(219 110 158 / 18%);
  --soft-transition: 200ms ease-in-out;

  --background: var(--soft-canvas);
  --surface: var(--soft-surface);
  --surface-soft: var(--soft-surface-muted);
  --surface-strong: var(--soft-surface-pressed);
  --text: var(--soft-ink);
  --text-muted: var(--soft-text);
  --text-subtle: var(--soft-muted);
  --border: var(--soft-line);
  --border-strong: var(--soft-line-strong);
  --primary: var(--soft-primary);
  --primary-hover: var(--soft-primary-strong);
  --primary-soft: var(--soft-primary-soft);
  --success: var(--soft-emerald);
  --success-soft: var(--soft-emerald-soft);
  --warning: var(--soft-amber);
  --warning-soft: var(--soft-amber-soft);
  --danger: var(--soft-danger);
  --danger-soft: var(--soft-danger-soft);
  --shadow: var(--soft-shadow-md);
  --ag-bg: var(--soft-canvas);
  --ag-surface: var(--soft-surface);
  --ag-surface-soft: var(--soft-surface-muted);
  --ag-ink: var(--soft-ink);
  --ag-muted: var(--soft-text);
  --ag-border: var(--soft-line);
  --ag-primary: var(--soft-primary);
  --ag-primary-hover: var(--soft-primary-strong);
  --ag-danger: var(--soft-danger);
  --ui-radius: var(--soft-radius-control);
  --ui-radius-lg: var(--soft-radius-card);
  --ui-green-1: var(--soft-primary);
  --ui-green-2: var(--soft-primary-strong);
  --ui-green-3: #4338ca;
  --ui-green-soft: var(--soft-primary-soft);
  --ui-green-softer: #f5f5ff;
  --ui-focus-ring: 0 0 0 5px var(--soft-primary-halo);
  --ui-ease: var(--soft-transition);
}

html {
  color-scheme: light;
  background: var(--soft-canvas);
}

body,
button,
input,
textarea,
select {
  font-family: "PingFang SC", "Microsoft YaHei UI", "Microsoft YaHei", Arial, sans-serif;
  letter-spacing: 0;
}

body {
  min-width: 0;
  margin: 0;
  background: var(--soft-canvas);
  color: var(--soft-ink);
  font-size: 15px;
  line-height: 1.6;
}

body::before {
  position: fixed;
  z-index: -1;
  inset: 0;
  background: linear-gradient(180deg, rgb(255 255 255 / 34%), transparent 420px);
  content: "";
  pointer-events: none;
}

a,
button,
label,
summary,
select {
  touch-action: manipulation;
}

button,
a,
summary,
label[for],
select,
input[type="radio"],
input[type="checkbox"] {
  cursor: pointer;
}

button:focus-visible,
a:focus-visible,
summary:focus-visible,
select:focus-visible,
input:focus-visible,
textarea:focus-visible,
[tabindex]:focus-visible {
  outline: 0;
  box-shadow: 0 0 0 5px var(--soft-primary-halo);
}

button:disabled,
select:disabled,
input:disabled,
textarea:disabled {
  cursor: not-allowed;
}

::selection {
  background: #dfe1ff;
  color: var(--soft-ink);
}

.skip-link {
  border-radius: var(--soft-radius-control);
  background: var(--soft-primary-strong);
  color: #fff;
  box-shadow: var(--soft-shadow-primary);
}

/* Header */
.app-header {
  position: sticky;
  z-index: 100;
  top: 0;
  border: 0;
  background: var(--soft-surface);
  box-shadow: 0 8px 28px rgb(88 101 126 / 10%);
  backdrop-filter: none;
}

.header-inner {
  width: min(100%, 1480px);
  min-height: 72px;
  margin-inline: auto;
  padding-inline: 32px;
}

.brand {
  gap: 12px;
  color: var(--soft-ink);
  font-size: 17px;
  font-weight: 700;
  text-decoration: none;
}

.brand-mark {
  width: 42px;
  height: 42px;
  border: 0;
  border-radius: 15px;
  background: var(--soft-primary);
  box-shadow: 0 10px 22px rgb(99 102 241 / 24%);
}

.brand-mark img {
  width: 21px;
  height: 21px;
  filter: brightness(0) invert(1);
}

.header-actions {
  gap: 10px;
}

.task-history-button,
.restart-button,
.history-back-button {
  min-height: 44px;
  padding: 0 15px;
  gap: 8px;
  border: 0;
  border-radius: 15px;
  background: transparent;
  color: var(--soft-text);
  font-weight: 650;
  text-decoration: none;
  box-shadow: none;
  transition: color var(--soft-transition), background var(--soft-transition), box-shadow var(--soft-transition), transform var(--soft-transition);
}

.task-history-button:hover,
.restart-button:hover,
.history-back-button:hover {
  border: 0;
  background: var(--soft-primary-soft);
  color: var(--soft-primary-strong);
  box-shadow: 0 9px 22px rgb(99 102 241 / 12%);
  transform: translateY(-1px);
}

.task-history-button:active,
.restart-button:active,
.history-back-button:active {
  transform: scale(.98);
  box-shadow: inset 0 2px 6px rgb(99 102 241 / 10%);
}

.task-history-button img,
.restart-button img,
.history-back-button img {
  width: 18px;
  height: 18px;
  opacity: .72;
}

.mode-badge,
.status-label,
.compact-badge,
.format-badge,
.image-kind-badge {
  border: 0;
  border-radius: 999px;
  font-weight: 650;
}

.mode-badge {
  min-height: 36px;
  padding: 0 13px;
  background: var(--soft-surface-muted);
  color: var(--soft-text);
  box-shadow: inset 0 1px 2px rgb(88 101 126 / 5%);
}

.mode-badge.live,
.status-label.success {
  border: 0;
  background: var(--soft-emerald-soft);
  color: #08795c;
}

.mode-badge.unconfigured,
.status-label.error {
  border: 0;
  background: var(--soft-danger-soft);
  color: #a93446;
}

.mode-dot {
  box-shadow: 0 0 0 5px rgb(15 159 120 / 11%);
}

/* Main workspace */
.workspace,
.viewing-task .workspace {
  width: min(100%, 1440px);
  max-width: 1440px;
  padding: 42px 32px max(136px, calc(var(--wizard-action-height, 84px) + 32px));
}

.editor,
.viewing-task .editor {
  border: 0;
  background: transparent;
  box-shadow: none;
}

.wizard-heading-row {
  min-height: 0;
  margin: 0 0 26px;
  padding: 2px 4px 0;
  align-items: flex-start;
}

.wizard-heading-row .page-heading,
.viewing-task .wizard-heading-row .page-heading {
  max-width: 820px;
  margin: 0;
  padding: 0;
}

.page-heading .eyebrow,
.settings-heading .eyebrow,
.task-history-heading .eyebrow,
.generation-dialog .eyebrow {
  display: inline-flex;
  width: fit-content;
  margin: 0 0 8px;
  padding: 5px 11px;
  border-radius: 999px;
  background: var(--soft-primary-soft);
  color: var(--soft-primary-strong);
  font-size: 12px;
  font-weight: 700;
}

.wizard-heading-row .page-heading h1,
.viewing-task .wizard-heading-row .page-heading h1 {
  margin: 0 0 8px;
  color: var(--soft-ink);
  font-size: 38px;
  font-weight: 720;
  line-height: 1.24;
}

.page-heading > p:last-of-type,
.settings-heading > p:last-child,
.task-history-heading > div > p:last-child {
  max-width: 720px;
  margin: 0;
  color: var(--soft-text);
  font-size: 15px;
  line-height: 1.7;
}

.wizard-heading-row > .status-label {
  min-height: 36px;
  padding: 7px 14px;
  background: var(--soft-surface);
  color: var(--soft-text);
  box-shadow: var(--soft-shadow-sm);
}

.hero-highlights {
  margin-top: 17px;
  gap: 10px;
}

.hero-highlights li {
  min-height: 38px;
  padding: 0 13px;
  border: 0;
  border-radius: 14px;
  background: var(--soft-surface);
  color: var(--soft-text);
  box-shadow: var(--soft-shadow-sm);
}

.hero-highlights li:nth-child(2) {
  color: #a84372;
  box-shadow: 0 8px 20px rgb(219 110 158 / 13%);
}

.hero-highlights li:nth-child(3) {
  color: #08795c;
  box-shadow: 0 8px 20px rgb(15 159 120 / 13%);
}

.hero-highlights img,
.section-icon img,
.settings-section-title img {
  filter: invert(40%) sepia(72%) saturate(1750%) hue-rotate(220deg) brightness(94%) contrast(92%);
}

.step-host {
  min-width: 0;
  min-height: 500px;
  padding: 36px 42px 18px;
  border: 0;
  border-radius: 28px;
  background: var(--soft-surface);
  box-shadow: var(--soft-shadow-lg);
}

.step-view-product,
.step-view-creative,
.step-view-script,
.step-view-scene,
.step-view-keyframes,
.step-view-video {
  width: 100%;
  max-width: none;
}

/* Workflow rail */
@media (min-width: 1024px) {
  .editor,
  .viewing-task .editor {
    grid-template-columns: 226px minmax(0, 1fr);
    column-gap: 34px;
  }

  .workflow-steps,
  .viewing-task .workflow-steps {
    top: 92px;
    padding: 18px 14px;
    gap: 4px;
    border: 0;
    border-radius: 24px;
    background: var(--soft-surface);
    box-shadow: var(--soft-shadow-md);
  }

  .workflow-steps::before {
    padding: 2px 10px 12px;
    color: var(--soft-muted);
    font-size: 13px;
  }

  .editor .workflow-steps li + li::before,
  .editor .workflow-steps li:nth-child(5)::before,
  .viewing-task .editor .workflow-steps li:nth-child(5)::before {
    left: 27px;
    background: #e0e4ec;
  }

  .editor .workflow-steps button {
    min-height: 58px;
    padding: 8px 10px;
    grid-template-columns: 34px minmax(0, 1fr) 18px;
    gap: 10px;
    border: 0;
    border-radius: 17px;
    transition: background var(--soft-transition), box-shadow var(--soft-transition), transform var(--soft-transition), opacity var(--soft-transition);
  }

  .editor .workflow-steps button:hover:not(:disabled) {
    border: 0;
    background: #f7f7ff;
    box-shadow: 0 8px 18px rgb(99 102 241 / 9%);
    transform: translateY(-1px);
  }

  .editor .workflow-steps span,
  .viewing-task .editor .workflow-steps span {
    width: 34px;
    height: 34px;
    border: 0;
    border-radius: 12px;
    background: var(--soft-surface-muted);
    color: var(--soft-muted);
    box-shadow: inset 0 1px 2px rgb(88 101 126 / 6%);
  }

  .editor .workflow-steps strong,
  .viewing-task .editor .workflow-steps strong {
    color: var(--soft-text);
    font-size: 14px;
    font-weight: 600;
  }

  .editor .workflow-steps li.current button {
    border: 0;
    background: var(--soft-primary-soft);
    box-shadow: 0 10px 24px rgb(99 102 241 / 14%);
  }

  .editor .workflow-steps li.current span {
    border: 0;
    background: var(--soft-primary);
    color: #fff;
    box-shadow: 0 8px 18px rgb(99 102 241 / 24%);
  }

  .editor .workflow-steps li.current strong {
    color: var(--soft-primary-strong);
  }

  .editor .workflow-steps li.complete span {
    border: 0;
    background: var(--soft-emerald-soft);
    color: var(--soft-emerald);
  }

  .editor .workflow-steps li.complete strong {
    color: #26765f;
  }

  .editor .workflow-steps li.locked button {
    opacity: .52;
  }

  .editor .workflow-steps .step-nav-icon {
    display: block;
    width: 17px;
    height: 17px;
    opacity: .48;
  }

  .editor .workflow-steps li.current .step-nav-icon {
    opacity: .78;
    filter: invert(40%) sepia(72%) saturate(1750%) hue-rotate(220deg) brightness(94%) contrast(92%);
  }

  .wizard-action-inner {
    grid-template-columns: 226px minmax(0, 1fr) auto;
    column-gap: 34px;
  }
}

/* Page sections and headings */
.form-section,
.viewing-task .form-section,
.review-section,
.viewing-task .review-section {
  position: relative;
  margin: 0;
  padding: 0 0 38px;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

.form-section + .form-section,
.review-section + .review-section {
  padding-top: 38px;
  border-top: 1px solid var(--soft-line);
}

.section-heading,
.viewing-task .section-heading,
.review-heading {
  margin-bottom: 24px;
  padding: 0;
  gap: 14px;
  border: 0;
}

.section-icon,
.viewing-task .section-icon,
.material-subheading .section-icon,
.settings-section-title > span {
  display: grid;
  width: 44px;
  height: 44px;
  flex: 0 0 44px;
  place-items: center;
  border: 0;
  border-radius: 50%;
  background: var(--soft-primary-soft);
  box-shadow: 0 8px 20px rgb(99 102 241 / 14%);
}

#productFactsSection .section-icon,
.settings-section:nth-child(2) .settings-section-title > span {
  background: var(--soft-emerald-soft);
  box-shadow: 0 8px 20px rgb(15 159 120 / 14%);
}

#productFactsSection.form-section {
  border: 0;
  border-top: 1px solid var(--soft-line);
}

#creativeSettingsSection.form-section {
  border: 0;
}

#productFactsSection .section-heading > .section-icon {
  border: 0;
  background: var(--soft-emerald-soft);
  box-shadow: 0 8px 20px rgb(15 159 120 / 14%);
}

#productFactsSection .section-icon img,
.settings-section:nth-child(2) .settings-section-title img {
  filter: invert(42%) sepia(54%) saturate(804%) hue-rotate(116deg) brightness(91%) contrast(93%);
}

#creativeSettingsSection .section-icon {
  background: var(--soft-pink-soft);
  box-shadow: var(--soft-shadow-pink);
}

#creativeSettingsSection .section-heading > .section-icon {
  border: 0;
  background: var(--soft-pink-soft);
  box-shadow: var(--soft-shadow-pink);
}

#creativeSettingsSection .section-icon img {
  filter: invert(50%) sepia(42%) saturate(1029%) hue-rotate(289deg) brightness(94%) contrast(88%);
}

.section-icon img,
.settings-section-title img {
  width: 20px;
  height: 20px;
}

.section-heading h2,
.review-heading strong,
.material-subheading h3,
.settings-section-title h2 {
  margin: 0;
  color: var(--soft-ink);
  font-size: 21px;
  font-weight: 700;
  line-height: 1.35;
}

.section-step,
.review-kicker {
  display: block;
  margin: 0 0 2px;
  padding: 0;
  background: transparent;
  color: var(--soft-primary-strong);
  font-size: 11px;
  font-weight: 750;
}

.material-subsection {
  margin-top: 28px;
  padding: 24px;
  border: 0;
  border-radius: 22px;
  background: var(--soft-surface-muted);
  box-shadow: inset 0 1px 3px rgb(88 101 126 / 6%);
}

.material-subheading {
  gap: 13px;
}

.material-subheading p,
.settings-section-title p,
.character-role-heading p,
.character-library-body > p {
  color: var(--soft-text);
}

/* Inputs and form controls */
.field-grid {
  gap: 22px 20px;
}

.field,
.script-beat-editor > div {
  gap: 8px;
}

.field label,
.field-label,
.choice-field legend,
.duration-setting legend,
.hook-fieldset legend,
.script-beat-editor label,
.task-history-search label,
.video-placement-review label {
  color: #424a5d;
  font-size: 13px;
  font-weight: 700;
}

.field small,
.script-beat-editor small,
.character-role-row label,
.character-library-row label,
.inline-status {
  color: var(--soft-muted);
}

.field input,
.field textarea,
.field select,
.script-beat-editor input,
.script-beat-editor textarea,
.script-beat-editor select,
.character-role-row input,
.character-role-row select,
.character-role-row textarea,
.character-library-row input,
.character-library-row textarea,
.task-history-search input,
.video-placement-review select,
.replace-scene-fields input[type="file"] {
  min-height: 48px;
  padding: 12px 16px;
  border: 0;
  border-radius: var(--soft-radius-control);
  background: var(--soft-surface-muted);
  color: var(--soft-ink);
  box-shadow: inset 0 1px 3px rgb(88 101 126 / 7%);
  transition: background var(--soft-transition), box-shadow var(--soft-transition), transform var(--soft-transition);
}

.settings-form .field select,
.creative-control-grid .field select,
.output-spec-grid .field select,
.character-role-row select,
.script-beat-editor select {
  min-height: 48px;
  padding: 12px 44px 12px 16px;
  border: 0;
  border-radius: var(--soft-radius-control);
  background-color: var(--soft-surface-muted);
  color: var(--soft-ink);
  box-shadow: inset 0 1px 3px rgb(88 101 126 / 7%);
}

.settings-form .field select:hover,
.creative-control-grid .field select:hover,
.output-spec-grid .field select:hover,
.character-role-row select:hover,
.script-beat-editor select:hover {
  border: 0;
  background-color: #f0f2f7;
}

.settings-form .field select:focus,
.creative-control-grid .field select:focus,
.output-spec-grid .field select:focus,
.character-role-row select:focus,
.script-beat-editor select:focus {
  border: 0;
  outline: 0;
  background-color: var(--soft-surface);
  box-shadow: 0 0 0 5px var(--soft-primary-halo), 0 10px 24px rgb(99 102 241 / 10%);
}

.field textarea,
.script-beat-editor textarea,
.character-role-row textarea,
.character-library-row textarea {
  min-height: 108px;
  line-height: 1.65;
  resize: vertical;
}

.field input:hover,
.field textarea:hover,
.field select:hover,
.script-beat-editor :is(input, textarea, select):hover,
.character-role-row :is(input, select, textarea):hover,
.character-library-row :is(input, textarea):hover,
.task-history-search input:hover {
  border: 0;
  background: #f0f2f7;
}

.field input:focus,
.field textarea:focus,
.field select:focus,
.script-beat-editor :is(input, textarea, select):focus,
.character-role-row :is(input, select, textarea):focus,
.character-library-row :is(input, textarea):focus,
.task-history-search input:focus,
.video-placement-review select:focus {
  border: 0;
  outline: 0;
  background: var(--soft-surface);
  box-shadow: 0 0 0 5px var(--soft-primary-halo), 0 10px 24px rgb(99 102 241 / 10%);
}

.field input::placeholder,
.field textarea::placeholder,
.script-beat-editor input::placeholder,
.script-beat-editor textarea::placeholder,
.task-history-search input::placeholder {
  color: #959cad;
}

.field :is(input, textarea, select):disabled,
.script-beat-editor :is(input, textarea, select):disabled {
  border: 0;
  background: #eceff3;
  color: #8f97a7;
  opacity: .72;
}

.field :is(input, textarea)[aria-invalid="true"],
.script-beat-editor :is(input, textarea)[aria-invalid="true"] {
  border: 0;
  background: var(--soft-danger-soft);
  box-shadow: 0 0 0 3px rgb(201 76 93 / 17%);
}

.field-error {
  color: #ae3346;
  font-weight: 600;
}

.field-label-row > span {
  color: var(--soft-muted);
  font-variant-numeric: tabular-nums;
}

.password-control {
  overflow: visible;
  grid-template-columns: minmax(0, 1fr) 50px;
  border-radius: var(--soft-radius-control);
  background: var(--soft-surface-muted);
  box-shadow: inset 0 1px 3px rgb(88 101 126 / 7%);
}

.password-control input {
  border-radius: var(--soft-radius-control) 0 0 var(--soft-radius-control);
  box-shadow: none;
}

.icon-button {
  min-width: 50px;
  min-height: 48px;
  border: 0;
  border-radius: 0 var(--soft-radius-control) var(--soft-radius-control) 0;
  background: transparent;
  color: var(--soft-text);
  transition: background var(--soft-transition), box-shadow var(--soft-transition);
}

.icon-button:hover {
  border: 0;
  background: var(--soft-primary-soft);
}

/* Buttons */
.primary-button,
.secondary-button,
.task-notice-action {
  min-height: 46px;
  padding: 0 20px;
  gap: 8px;
  border: 0;
  border-radius: var(--soft-radius-control);
  font-size: 14px;
  font-weight: 700;
  text-decoration: none;
  transition: color var(--soft-transition), background var(--soft-transition), box-shadow var(--soft-transition), transform var(--soft-transition), opacity var(--soft-transition);
}

.primary-button {
  border: 0;
  background: var(--soft-primary);
  color: #fff;
  box-shadow: var(--soft-shadow-primary);
  text-shadow: none;
}

.primary-button:hover:not(:disabled) {
  border: 0;
  background: var(--soft-primary-strong);
  box-shadow: 0 18px 36px rgb(99 102 241 / 28%);
  transform: translateY(-2px);
}

.primary-button:active:not(:disabled) {
  background: #4943d2;
  box-shadow: inset 0 3px 7px rgb(45 42 140 / 28%);
  transform: scale(.98);
}

.secondary-button,
.task-notice-action {
  border: 0;
  background: var(--soft-surface);
  color: var(--soft-text);
  box-shadow: var(--soft-shadow-sm);
}

.secondary-button:hover:not(:disabled),
.task-notice-action:hover:not(:disabled) {
  border: 0;
  background: #f9f9ff;
  color: var(--soft-primary-strong);
  box-shadow: 0 14px 28px rgb(99 102 241 / 16%);
  transform: translateY(-2px);
}

.secondary-button:active:not(:disabled),
.task-notice-action:active:not(:disabled) {
  background: var(--soft-primary-soft);
  box-shadow: inset 0 3px 7px rgb(99 102 241 / 10%);
  transform: scale(.98);
}

.primary-button:disabled,
.secondary-button:disabled {
  border: 0;
  background: #e9edf2;
  color: #9199a8;
  box-shadow: none;
  opacity: .72;
}

.primary-button img {
  filter: brightness(0) invert(1);
}

.secondary-button img {
  opacity: .74;
}

.text-action {
  min-height: 44px;
  padding: 0 12px;
  border: 0;
  border-radius: 14px;
  background: transparent;
  color: var(--soft-primary-strong);
  font-weight: 650;
  transition: background var(--soft-transition), color var(--soft-transition), box-shadow var(--soft-transition);
}

.text-action:hover {
  background: var(--soft-primary-soft);
  color: var(--soft-primary-strong);
}

.text-action.danger-action,
.danger-action {
  color: var(--soft-danger);
}

.text-action.danger-action:hover,
.danger-action:hover {
  background: var(--soft-danger-soft);
  color: #a93446;
}

/* Uploads */
.product-upload-shell {
  width: min(100%, 900px);
}

.dropzone {
  min-height: 174px;
  padding: 28px 22px;
  border: 1px dashed #cbd3df;
  border-radius: 22px;
  background: var(--soft-surface-muted);
  box-shadow: inset 0 1px 3px rgb(88 101 126 / 5%);
  transition: border-color var(--soft-transition), background var(--soft-transition), box-shadow var(--soft-transition), transform var(--soft-transition);
}

.dropzone::after {
  display: none;
}

.dropzone:hover,
.dropzone.dragging {
  border-color: #aeb2f6;
  background: #f5f5ff;
  box-shadow: 0 0 0 5px var(--soft-primary-halo), 0 14px 30px rgb(99 102 241 / 12%);
  transform: translateY(-2px);
}

.dropzone.has-selection {
  border: 1px dashed #83cdb7;
  background: var(--soft-emerald-soft);
}

.dropzone.disabled {
  border-color: #d9dee6;
  background: #edf0f4;
  opacity: .62;
}

.dropzone-icon {
  width: 32px;
  height: 32px;
  opacity: .72;
  filter: invert(40%) sepia(72%) saturate(1750%) hue-rotate(220deg) brightness(94%) contrast(92%);
}

.dropzone-title {
  color: var(--soft-ink);
  font-size: 15px;
  font-weight: 700;
}

.dropzone-meta {
  color: var(--soft-muted);
}

.product-upload-shell:has(#imageList .image-item) {
  border: 0;
  border-radius: 22px;
  background: var(--soft-surface-muted);
  box-shadow: inset 0 1px 3px rgb(88 101 126 / 6%);
}

.image-item,
.product-upload-shell #imageList .product-image-item,
.task-source-image {
  overflow: hidden;
  border: 0;
  border-radius: 18px;
  background: var(--soft-surface);
  box-shadow: var(--soft-shadow-sm);
}

.remove-image,
.selling-point-remove,
.generated-image-download-button,
.image-lightbox-close,
.image-lightbox-download {
  min-width: 44px;
  min-height: 44px;
  border: 0;
  border-radius: 50%;
  background: rgb(255 255 255 / 92%);
  color: var(--soft-text);
  box-shadow: var(--soft-shadow-sm);
  transition: background var(--soft-transition), color var(--soft-transition), box-shadow var(--soft-transition), transform var(--soft-transition);
}

.remove-image:hover,
.selling-point-remove:hover,
.image-lightbox-close:hover {
  border: 0;
  background: var(--soft-danger-soft);
  color: var(--soft-danger);
  box-shadow: 0 10px 24px rgb(201 76 93 / 16%);
  transform: translateY(-1px);
}

.primary-image-control {
  min-height: 38px;
  border: 0;
  background: var(--soft-surface);
  color: var(--soft-primary-strong);
}

.primary-image-control:disabled {
  background: var(--soft-primary);
  color: #fff;
}

/* Choices and settings */
.story-options {
  gap: 14px;
}

.story-option {
  min-height: 96px;
  padding: 18px;
  border: 0;
  border-radius: 20px;
  background: var(--soft-surface-muted);
  box-shadow: inset 0 1px 3px rgb(88 101 126 / 5%);
  transition: color var(--soft-transition), background var(--soft-transition), box-shadow var(--soft-transition), transform var(--soft-transition);
}

.story-option:hover {
  border: 0;
  background: var(--soft-surface);
  box-shadow: 0 13px 28px rgb(99 102 241 / 13%);
  transform: translateY(-2px);
}

.story-option:active {
  transform: scale(.985);
}

.story-option:has(input:checked) {
  border: 0;
  background: var(--soft-primary-soft);
  box-shadow: 0 0 0 2px rgb(99 102 241 / 28%), 0 14px 30px rgb(99 102 241 / 16%);
}

.story-option:has(input:checked) span {
  color: var(--soft-primary-strong);
}

.story-option small {
  color: var(--soft-text);
}

.segmented-options,
.duration-options {
  padding: 6px;
  gap: 4px;
  border: 0;
  border-radius: 19px;
  background: #eceff5;
  box-shadow: inset 0 2px 5px rgb(88 101 126 / 7%);
}

.segmented-options label,
.duration-options label,
.segmented-options span,
.duration-options span {
  border: 0;
  border-radius: 14px;
}

.segmented-options label,
.duration-options span {
  min-height: 44px;
}

.segmented-options label:has(input:checked),
.duration-options input:checked + span {
  border: 0;
  background: var(--soft-surface);
  color: var(--soft-primary-strong);
  box-shadow: 0 10px 24px rgb(99 102 241 / 16%), 0 3px 8px rgb(88 101 126 / 14%);
}

.segmented-options label:hover:not(:has(input:checked)),
.duration-options label:hover input:not(:checked):not(:disabled) + span {
  background: rgb(255 255 255 / 64%);
  color: var(--soft-primary-strong);
  box-shadow: 0 8px 18px rgb(99 102 241 / 9%);
  transform: translateY(-1px);
}

.segmented-options label:active,
.duration-options label:active input:not(:disabled) + span {
  box-shadow: inset 0 3px 7px rgb(99 102 241 / 10%);
  transform: scale(.98);
}

.segmented-options input:focus-visible + span,
.duration-options input:focus-visible + span {
  box-shadow: 0 0 0 5px var(--soft-primary-halo), 0 10px 24px rgb(99 102 241 / 16%);
}

.duration-setting {
  margin-top: 24px;
  padding-top: 0;
}

.duration-options {
  width: min(100%, 340px);
}

.generation-settings {
  display: grid;
  min-width: 0;
  margin-top: 24px;
  gap: 24px;
}

.generation-settings .duration-setting {
  min-width: 0;
  margin: 0;
  border: 0;
}

.generation-settings .toggle-row {
  min-height: 72px;
  padding: 14px 18px;
}

.generation-toggles .toggle-row:first-child {
  margin-top: 0;
}

.voiceover-rate-setting {
  min-width: 0;
  margin: 20px 0 0;
  padding: 18px 0 0;
  border: 0;
  border-top: 1px solid var(--soft-line);
}

.voiceover-rate-setting legend {
  width: 100%;
  margin-bottom: 10px;
  padding: 0;
  color: #424a5d;
  font-size: 13px;
  font-weight: 700;
}

.voiceover-rate-options {
  display: grid;
  width: min(100%, 340px);
  padding: 6px;
  grid-template-columns: repeat(var(--voiceover-rate-count, 4), minmax(0, 1fr));
  gap: 4px;
  border-radius: 19px;
  background: #eceff5;
  box-shadow: inset 0 2px 5px rgb(88 101 126 / 7%);
}

.voiceover-rate-setting[aria-invalid="true"] .voiceover-rate-options {
  background: var(--soft-danger-soft);
  box-shadow: inset 0 0 0 1px rgb(174 51 70 / 35%);
}

.voiceover-rate-options label {
  position: relative;
  min-width: 0;
  cursor: pointer;
}

.voiceover-rate-options input {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  border: 0;
  opacity: 0;
  white-space: nowrap;
}

.voiceover-rate-options span {
  display: flex;
  min-height: 44px;
  padding: 6px 8px;
  align-items: center;
  justify-content: center;
  border-radius: 14px;
  color: var(--soft-muted);
  font-size: 13px;
  font-weight: 700;
  text-align: center;
  transition: color var(--soft-transition), background var(--soft-transition), box-shadow var(--soft-transition), transform var(--soft-transition);
}

.voiceover-rate-options label:hover input:not(:checked):not(:disabled) + span {
  background: rgb(255 255 255 / 64%);
  color: var(--soft-primary-strong);
  box-shadow: 0 8px 18px rgb(99 102 241 / 9%);
  transform: translateY(-1px);
}

.voiceover-rate-options input:checked + span {
  background: var(--soft-surface);
  color: var(--soft-primary-strong);
  box-shadow: 0 10px 24px rgb(99 102 241 / 16%), 0 3px 8px rgb(88 101 126 / 14%);
}

.voiceover-rate-options input:focus-visible + span {
  box-shadow: 0 0 0 5px var(--soft-primary-halo), 0 10px 24px rgb(99 102 241 / 16%);
}

.voiceover-rate-options input:disabled + span {
  cursor: default;
  color: var(--soft-faint);
  opacity: .72;
  box-shadow: none;
}

.voiceover-rate-summary {
  margin: 9px 0 0;
  color: var(--soft-muted);
  font-size: 12px;
  line-height: 1.55;
}

.voiceover-count-note {
  display: block;
  margin-top: 7px;
  color: var(--soft-emerald);
  font-size: 12px;
  font-weight: 650;
  line-height: 1.5;
}

.voiceover-count-note[data-state="warning"] {
  color: var(--soft-amber);
}

.script-plan-note[data-voiceover-state="warning"] {
  background: var(--soft-amber-soft);
  color: #77521d;
}

@media (prefers-reduced-motion: reduce) {
  .voiceover-rate-options span {
    transition-duration: 0.01ms;
  }

  .voiceover-rate-options label:hover input:not(:checked):not(:disabled) + span {
    transform: none;
  }
}

.advanced-settings,
.prompt-details,
.replace-scene-details,
.character-library-details {
  margin-top: 20px;
  padding: 0;
  border: 0;
  border-radius: 20px;
  background: var(--soft-surface-muted);
  box-shadow: inset 0 1px 3px rgb(88 101 126 / 6%);
}

.advanced-settings summary,
.prompt-details summary,
.replace-scene-details summary,
.character-library-details summary {
  width: 100%;
  min-height: 52px;
  padding: 0 18px;
  border: 0;
  border-radius: 20px;
  background: transparent;
  color: var(--soft-text);
  font-weight: 700;
  transition: background var(--soft-transition), color var(--soft-transition), box-shadow var(--soft-transition);
}

.advanced-settings summary:hover,
.prompt-details summary:hover,
.replace-scene-details summary:hover,
.character-library-details summary:hover {
  background: var(--soft-surface);
  color: var(--soft-primary-strong);
  box-shadow: var(--soft-shadow-sm);
}

.advanced-settings[open] summary,
.prompt-details[open] summary,
.replace-scene-details[open] summary,
.character-library-details[open] summary {
  border-radius: 20px 20px 0 0;
  background: #f9f9ff;
  color: var(--soft-primary-strong);
}

.advanced-content,
.character-library-body,
.replace-scene-fields,
.prompt-details pre {
  padding: 20px;
}

.advanced-settings .advanced-content {
  padding: 22px 24px 24px;
}

.toggle-row {
  min-height: 64px;
  margin-top: 12px;
  padding: 12px 14px;
  border: 0;
  border-radius: 17px;
  background: var(--soft-surface);
  box-shadow: var(--soft-shadow-sm);
}

.advanced-settings .toggle-row {
  min-height: 72px;
  padding: 14px 18px;
}

.toggle {
  border: 0;
  background: #cfd5df;
  box-shadow: inset 0 2px 5px rgb(81 94 117 / 14%);
}

.toggle-row input:checked + .toggle,
.advanced-settings .toggle-row input:checked + .toggle {
  background: var(--soft-primary);
  box-shadow: 0 7px 16px rgb(99 102 241 / 22%);
}

/* Selling points and characters */
.selling-points-list {
  gap: 10px;
}

.selling-point-row {
  gap: 10px;
}

.selling-point-row::before {
  border: 0;
  background: var(--soft-primary-soft);
  color: var(--soft-primary-strong);
  box-shadow: inset 0 1px 3px rgb(99 102 241 / 8%);
}

.character-role-section {
  margin-top: 30px;
  padding-top: 28px;
  border-top: 1px solid var(--soft-line);
}

.character-role-heading {
  gap: 24px;
}

.character-role-heading strong {
  color: var(--soft-ink);
  font-size: 18px;
}

#addCharacterRoleButton.secondary-button {
  border: 0;
  background: var(--soft-primary);
  color: #fff;
  box-shadow: var(--soft-shadow-primary);
}

#addCharacterRoleButton.secondary-button img {
  filter: brightness(0) invert(1);
  opacity: 1;
}

#addCharacterRoleButton.secondary-button:hover:not(:disabled) {
  border: 0;
  background: var(--soft-primary-strong);
  color: #fff;
  box-shadow: 0 18px 36px rgb(99 102 241 / 26%);
}

.character-role-list,
.character-library-list {
  gap: 16px;
}

.character-role-row,
.character-library-row {
  border: 0;
  border-radius: 22px;
  background: var(--soft-surface-muted);
  box-shadow: inset 0 1px 3px rgb(88 101 126 / 5%);
}

.character-role-row::before {
  color: var(--soft-primary-strong);
}

.character-role-row-actions,
.character-library-row-actions {
  border: 0;
}

.character-role-row-actions .secondary-button,
.character-library-row-actions .secondary-button {
  background: var(--soft-surface);
  box-shadow: var(--soft-shadow-sm);
}

.character-role-empty,
.character-library-empty {
  border: 1px dashed var(--soft-line-strong);
  border-radius: 18px;
  background: var(--soft-surface-muted);
  color: var(--soft-text);
}

.character-library-details summary {
  width: 100%;
  padding-inline: 18px;
}

/* Script, reviews, and previews */
.review-heading .compact-badge,
.compact-badge,
.status-label {
  padding: 7px 12px;
  background: var(--soft-primary-soft);
  color: var(--soft-primary-strong);
}

.hook-options {
  gap: 12px;
}

.hook-option {
  min-height: 64px;
  padding: 14px 16px;
  border: 0;
  border-radius: 18px;
  background: var(--soft-surface-muted);
  box-shadow: inset 0 1px 3px rgb(88 101 126 / 5%);
  transition: background var(--soft-transition), box-shadow var(--soft-transition), transform var(--soft-transition);
}

.hook-option:hover {
  border: 0;
  background: var(--soft-surface);
  box-shadow: 0 12px 26px rgb(99 102 241 / 12%);
  transform: translateY(-1px);
}

.hook-option:has(input:checked) {
  border: 0;
  background: var(--soft-primary-soft);
  box-shadow: 0 0 0 2px rgb(99 102 241 / 24%), 0 12px 26px rgb(99 102 241 / 14%);
}

.script-timeline {
  margin-bottom: 20px;
  padding: 7px;
  gap: 7px;
  border: 0;
  border-radius: 20px;
  background: #eceff5;
  box-shadow: inset 0 2px 5px rgb(88 101 126 / 7%);
}

.script-timeline button {
  min-height: 68px;
  border: 0;
  border-radius: 15px;
  color: var(--soft-text);
}

.script-timeline button:hover {
  border: 0;
  background: rgb(255 255 255 / 64%);
  color: var(--soft-primary-strong);
}

.script-timeline button.current {
  border: 0;
  background: var(--soft-surface);
  color: var(--soft-primary-strong);
  box-shadow: 0 10px 24px rgb(99 102 241 / 16%);
}

.script-beat-editor {
  padding: 24px;
  border: 0;
  border-radius: 22px;
  background: var(--soft-surface-muted);
  box-shadow: inset 0 1px 3px rgb(88 101 126 / 5%);
}

.script-plan-note,
.locked-material-note,
.story-lock-note,
.placement-advice,
.placement-review-note,
.inline-status,
.task-history-status {
  border: 0;
  border-radius: 16px;
  background: var(--soft-primary-soft);
  color: #4e5671;
}

.placement-advice,
.story-review-warning,
.task-notice {
  border: 0;
  border-radius: 18px;
  background: var(--soft-amber-soft);
  color: #77521d;
  box-shadow: 0 10px 24px rgb(194 122 24 / 10%);
}

.story-review-warning.product-story-conflicts,
.generation-dialog-error,
.form-message:not(:empty) {
  border: 0;
  border-radius: 18px;
  background: var(--soft-danger-soft);
  color: #963246;
}

.story-review-warning.character-story-conflicts {
  background: var(--soft-primary-soft);
  color: #4c4e9c;
}

.form-message[data-tone="success"],
.inline-status[data-tone="success"] {
  border: 0;
  background: var(--soft-emerald-soft);
  color: #08795c;
}

.analysis-features li,
.story-plan-block,
.custom-story-meta > div,
.story-profile-meta > div,
.result-summary,
.story-beats li {
  border: 0;
  border-radius: 17px;
  background: var(--soft-surface-muted);
  box-shadow: inset 0 1px 3px rgb(88 101 126 / 5%);
}

.script-keyframe-status {
  display: grid;
  min-height: 64px;
  padding: 12px 16px;
  grid-template-columns: 36px minmax(0, 1fr);
  align-items: center;
  gap: 12px;
  border-radius: 17px;
  background: var(--soft-primary-soft);
  color: var(--soft-text);
}

.script-keyframe-status[hidden] {
  display: none;
}

.script-keyframe-status-icon {
  display: inline-grid;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--soft-surface);
  place-items: center;
  box-shadow: var(--soft-shadow-sm);
}

.script-keyframe-status-icon img {
  width: 18px;
  height: 18px;
  filter: invert(42%) sepia(73%) saturate(1542%) hue-rotate(215deg) brightness(93%) contrast(93%);
}

.script-keyframe-status > span:last-child {
  display: grid;
  gap: 3px;
}

.script-keyframe-status strong {
  color: var(--soft-primary-strong);
  font-size: 13px;
}

.script-keyframe-status small {
  color: var(--soft-text-subtle);
  font-size: 12px;
  line-height: 1.5;
}

.story-plan-block,
.result-summary {
  padding: 18px;
}

.custom-story-meta,
.story-profile-meta {
  gap: 10px;
}

.custom-story-meta > div,
.story-profile-meta > div {
  padding: 14px 16px;
}

.custom-story-review {
  display: grid;
  gap: 24px;
}

.custom-story-review > .review-heading,
.custom-story-review > .story-review-warning,
.custom-story-review > .compact-field,
.custom-story-review > .custom-story-meta,
.custom-story-review > .story-plan-block,
.custom-story-review > .primary-button {
  margin: 0;
}

.custom-story-review > .review-heading {
  padding-bottom: 20px;
  border-bottom: 1px solid var(--soft-line);
}

.custom-story-review > .story-review-warning {
  padding: 18px 20px;
  gap: 12px;
}

.custom-story-review > .story-review-warning ul {
  margin-top: 8px;
  line-height: 1.7;
}

.custom-story-review > .compact-field {
  display: grid;
  gap: 10px;
}

.custom-story-review > .compact-field label {
  color: var(--soft-ink);
  font-size: 14px;
  font-weight: 700;
}

.custom-story-review .compact-field textarea {
  min-height: 236px;
  padding: 18px 20px;
  border-radius: 18px;
  background: var(--soft-surface-muted);
  font-size: 14px;
  line-height: 1.8;
  box-shadow: inset 0 1px 4px rgb(88 101 126 / 8%);
}

.custom-story-review .compact-field > small {
  max-width: 72ch;
  margin: 0;
  line-height: 1.6;
}

.custom-story-review > .custom-story-meta {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  border: 0;
}

.custom-story-review > .custom-story-meta > div {
  display: flex;
  min-height: 88px;
  padding: 18px;
  flex-direction: column;
  justify-content: center;
  border: 0;
}

.custom-story-review .custom-story-meta dt {
  font-size: 12px;
}

.custom-story-review .custom-story-meta dd {
  margin-top: 8px;
  font-size: 14px;
  line-height: 1.5;
}

.custom-story-review > .story-plan-block {
  padding: 22px 24px;
}

.custom-story-review > .story-plan-block > strong {
  display: block;
  margin-bottom: 14px;
  color: var(--soft-ink);
  font-size: 14px;
}

.custom-story-review .story-plan-block ul {
  margin: 0;
  gap: 0;
}

.custom-story-review .story-plan-block li {
  display: grid;
  padding: 14px 0;
  grid-template-columns: minmax(150px, .32fr) minmax(0, 1fr);
  gap: 20px;
  line-height: 1.7;
}

.custom-story-review .story-plan-block li:first-child {
  padding-top: 0;
}

.custom-story-review .story-plan-block li:last-child {
  padding-bottom: 0;
}

.custom-story-review .story-plan-block li + li {
  border-top: 1px solid var(--soft-line);
}

.custom-story-review .story-plan-block li strong {
  line-height: 1.7;
}

.custom-story-review .story-plan-block li span,
.custom-story-review .story-plan-block p {
  max-width: 72ch;
  color: var(--soft-text);
  line-height: 1.75;
}

.custom-story-review > .primary-button {
  justify-self: end;
}

.three-view-block,
.placement-source-block,
.scene-board-block,
.final-placement-reference {
  border: 0;
  border-radius: 22px;
  background: var(--soft-surface-muted);
  box-shadow: inset 0 1px 3px rgb(88 101 126 / 5%);
}

.asset-label {
  color: var(--soft-text);
}

.generated-image-shell,
.review-image-preview,
.image-preview-button {
  border: 0;
  border-radius: 18px;
  background: var(--soft-surface-pressed);
}

.review-image-preview img,
.image-preview-button img,
.generated-image-shell img {
  border-radius: 18px;
}

.keyframe-focus {
  min-height: 520px;
  overflow: hidden;
  border: 0;
  border-radius: 24px;
  background: #202433;
  box-shadow: 0 24px 56px rgb(45 51 69 / 25%);
}

.keyframe-filmstrip {
  gap: 12px;
}

.keyframe-filmstrip .keyframe-item {
  overflow: hidden;
  border: 0;
  border-radius: 16px;
  background: var(--soft-surface-muted);
  box-shadow: var(--soft-shadow-sm);
}

.keyframe-filmstrip .keyframe-item.current {
  border: 0;
  box-shadow: 0 0 0 3px rgb(99 102 241 / 30%), 0 12px 26px rgb(99 102 241 / 16%);
}

.video-stage,
.video-main-visual .video-stage,
.viewing-task .video-main-visual .video-stage {
  overflow: hidden;
  border: 0;
  border-radius: 26px;
  background: #202433;
  box-shadow: 0 26px 60px rgb(45 51 69 / 24%);
}

.empty-preview {
  color: #dfe4ef;
}

.empty-preview .preview-play {
  width: 62px;
  height: 62px;
  border-radius: 50%;
  background: var(--soft-primary);
  box-shadow: 0 14px 32px rgb(99 102 241 / 32%);
}

.empty-preview .preview-play img {
  filter: brightness(0) invert(1);
}

.format-badge {
  background: rgb(255 255 255 / 90%);
  color: var(--soft-ink);
  box-shadow: var(--soft-shadow-sm);
}

.progress-overlay {
  background: rgb(32 36 51 / 86%);
  color: #fff;
  backdrop-filter: blur(8px);
}

.spinner {
  border-color: rgb(255 255 255 / 28%);
  border-top-color: #fff;
}

/* Video submission preflight */
.video-preflight {
  min-width: 0;
  padding-bottom: 12px;
}

.video-preflight-heading {
  align-items: center;
}

.video-preflight-heading h2 {
  margin: 0;
  color: var(--soft-ink);
  font-size: 22px;
  line-height: 1.35;
}

.video-preflight-intro {
  max-width: 72ch;
  margin: -8px 0 30px;
  color: var(--soft-muted);
  font-size: 15px;
  line-height: 1.75;
}

.video-preflight-summary {
  display: grid;
  grid-template-columns: 1.2fr 1fr 1fr;
  gap: 20px;
  margin-bottom: 38px;
}

.preflight-panel {
  min-width: 0;
  padding: 24px;
  border: 0;
  border-radius: 22px;
  background: var(--soft-surface);
  box-shadow: var(--soft-shadow-md);
}

.preflight-panel-heading {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 20px;
}

.preflight-panel-heading > span,
.preflight-advisory > span,
.preflight-warning-list > li > span {
  display: grid;
  width: 40px;
  height: 40px;
  flex: 0 0 40px;
  place-items: center;
  border-radius: 50%;
  background: var(--soft-primary-soft);
  box-shadow: 0 8px 20px rgb(99 102 241 / 12%);
}

.preflight-panel-heading img,
.preflight-advisory img,
.preflight-warning-list img {
  width: 19px;
  height: 19px;
}

.preflight-panel-heading h3,
.preflight-section-heading h3 {
  margin: 0;
  color: var(--soft-ink);
  font-size: 17px;
  line-height: 1.4;
}

.preflight-facts {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px 18px;
  margin: 0;
}

.preflight-facts > div {
  min-width: 0;
}

.preflight-facts dt {
  margin-bottom: 4px;
  color: var(--soft-muted);
  font-size: 12px;
}

.preflight-facts dd {
  margin: 0;
  overflow-wrap: anywhere;
  color: var(--soft-ink);
  font-size: 15px;
  font-weight: 650;
}

.preflight-copy > strong {
  display: block;
  overflow-wrap: anywhere;
  color: var(--soft-ink);
  font-size: 16px;
  line-height: 1.55;
}

.preflight-copy > p {
  margin: 7px 0 0;
  color: var(--soft-muted);
  font-size: 14px;
  line-height: 1.65;
}

.preflight-scene-list,
.preflight-role-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 16px 0 0;
  padding: 0;
  list-style: none;
}

.preflight-scene-list li,
.preflight-role-list li {
  max-width: 100%;
  padding: 7px 11px;
  overflow-wrap: anywhere;
  border-radius: 12px;
  background: var(--soft-surface-muted);
  color: var(--soft-text);
  font-size: 12px;
  line-height: 1.45;
}

.preflight-section {
  min-width: 0;
  padding: 34px 0;
  border-top: 1px solid var(--soft-line);
}

.preflight-section-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 20px;
}

.preflight-section-heading p {
  max-width: 64ch;
  margin: 5px 0 0;
  color: var(--soft-muted);
  font-size: 14px;
  line-height: 1.6;
}

.preflight-reference-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 18px;
}

.preflight-reference {
  min-width: 0;
  overflow: hidden;
  border-radius: 18px;
  background: var(--soft-surface);
  box-shadow: var(--soft-shadow-sm);
}

.preflight-reference-visual {
  display: grid;
  aspect-ratio: 4 / 3;
  min-height: 150px;
  place-items: center;
  overflow: hidden;
  background: var(--soft-surface-muted);
  color: var(--soft-muted);
  font-size: 13px;
}

.preflight-reference-visual .image-preview-button {
  width: 100%;
  height: 100%;
  min-height: 150px;
  border-radius: 0;
}

.preflight-reference-visual img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.preflight-reference-copy {
  display: grid;
  gap: 4px;
  padding: 16px;
}

.preflight-reference-copy > span {
  color: var(--soft-primary-strong);
  font-size: 11px;
  font-weight: 700;
}

.preflight-reference-copy strong,
.preflight-list strong,
.preflight-warning-list strong,
.preflight-advisory strong {
  color: var(--soft-ink);
}

.preflight-reference-copy small {
  overflow-wrap: anywhere;
  color: var(--soft-muted);
  font-size: 12px;
  line-height: 1.55;
}

.preflight-list,
.preflight-warning-list {
  display: grid;
  gap: 12px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.preflight-list li {
  display: grid;
  gap: 4px;
  padding: 16px 18px;
  border-radius: 16px;
  background: var(--soft-surface-muted);
}

.preflight-list span {
  overflow-wrap: anywhere;
  color: var(--soft-muted);
  font-size: 14px;
  line-height: 1.6;
}

.preflight-warning-list li {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 17px 18px;
  border-radius: 16px;
  background: #fff8e9;
}

.preflight-warning-list > li > span {
  background: #fff0c8;
  box-shadow: 0 8px 20px rgb(181 118 18 / 12%);
}

.preflight-warning-list p {
  margin: 5px 0 0;
  overflow-wrap: anywhere;
  color: var(--soft-text);
  font-size: 14px;
  line-height: 1.65;
}

.preflight-warning-section.is-clear .preflight-warning-list li {
  background: var(--soft-emerald-soft);
}

.preflight-warning-section.is-clear .preflight-warning-list > li > span {
  background: rgb(15 159 120 / 12%);
  box-shadow: 0 8px 20px rgb(15 159 120 / 12%);
}

.preflight-advisory {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  margin-top: 4px;
  padding: 20px 22px;
  border-radius: 18px;
  background: var(--soft-primary-soft);
  box-shadow: 0 12px 28px rgb(99 102 241 / 10%);
}

.preflight-advisory p {
  margin: 5px 0 0;
  color: var(--soft-text);
  font-size: 14px;
  line-height: 1.65;
}

/* Sticky action area */
html:has(.wizard-action-bar) {
  scroll-padding-bottom: calc(var(--wizard-action-height, 84px) + 16px);
}

.wizard-action-bar {
  border: 0;
  background: rgb(255 255 255 / 92%);
  box-shadow: 0 -12px 34px rgb(88 101 126 / 12%);
  backdrop-filter: blur(18px);
}

.wizard-action-inner {
  width: min(100%, 1440px);
  min-height: 84px;
  padding: 14px 32px;
}

.wizard-action-inner .primary-button,
.wizard-action-inner .secondary-button {
  min-height: 52px;
  border-radius: 17px;
}

.wizard-action-inner .primary-button {
  padding-inline: 28px;
}

.task-summary-drawer,
.task-summary-drawer[open] {
  position: fixed;
  z-index: 60;
  top: auto;
  right: 24px;
  bottom: calc(var(--wizard-action-height, 84px) + 16px);
  width: min(380px, calc(100vw - 48px));
  max-height: min(620px, calc(100dvh - var(--wizard-action-height, 84px) - var(--workspace-header-height, 72px) - 32px));
  overflow: auto;
  border: 0;
  border-radius: 22px;
  background: var(--soft-surface);
  box-shadow: var(--soft-shadow-lg);
  transform: none;
}

.task-summary-drawer:not([open]) {
  width: 180px;
  max-height: 56px;
  overflow: hidden;
}

.task-summary-drawer > summary {
  min-height: 52px;
  padding: 0 18px;
  border-radius: 22px;
}

.task-summary-drawer > summary:hover {
  background: var(--soft-primary-soft);
  color: var(--soft-primary-strong);
}

.task-summary-content section {
  border: 0;
  border-radius: 17px;
  background: var(--soft-surface-muted);
}

/* Task history */
.task-history-page {
  min-height: calc(100vh - 72px);
  padding: 40px 32px 80px;
  background: transparent;
}

.task-history-inner {
  width: min(100%, 1240px);
}

.history-back-button {
  width: fit-content;
  margin-bottom: 22px;
  background: var(--soft-surface);
  box-shadow: var(--soft-shadow-sm);
}

.task-history-heading {
  margin-bottom: 28px;
  align-items: flex-end;
}

.task-history-heading h1,
.settings-heading h1 {
  margin: 0 0 8px;
  color: var(--soft-ink);
  font-size: 36px;
  line-height: 1.25;
}

.task-history-count {
  min-height: 74px;
  padding: 12px 20px;
  border: 0;
  border-radius: 20px;
  background: var(--soft-surface);
  box-shadow: var(--soft-shadow-md);
}

.task-history-count strong {
  color: var(--soft-primary-strong);
}

.task-history-search {
  padding: 20px;
  border: 0;
  border-radius: 22px;
  background: var(--soft-surface);
  box-shadow: var(--soft-shadow-md);
}

.task-history-search-control {
  padding: 5px 5px 5px 16px;
  border: 0;
  border-radius: 18px;
  background: var(--soft-surface-muted);
  box-shadow: inset 0 1px 3px rgb(88 101 126 / 6%);
}

.task-history-search-control input {
  min-height: 44px;
  padding-inline: 10px;
  background: transparent;
  box-shadow: none;
}

.task-history-grid {
  gap: 24px;
  grid-auto-rows: 1fr;
  align-items: stretch;
}

.task-history-card {
  height: 100%;
  overflow: hidden;
  border: 0;
  border-radius: 24px;
  background: var(--soft-surface);
  box-shadow: var(--soft-shadow-md);
  transition: box-shadow 300ms ease-in-out, transform 300ms ease-in-out;
}

.task-history-card > a {
  display: grid;
  height: 100%;
  min-height: 0;
  grid-template-rows: auto 1fr;
}

.task-history-card:hover {
  border: 0;
  box-shadow: 0 24px 52px rgb(99 102 241 / 18%);
  transform: translateY(-4px);
}

.task-history-card-content {
  display: flex;
  min-height: 0;
  padding: 20px;
  flex-direction: column;
}

.task-history-card-content h2 {
  display: -webkit-box;
  min-height: 44.8px;
  overflow: hidden;
  color: var(--soft-ink);
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.task-history-card-media {
  position: relative;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
}

.task-history-card-media > img {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
}

.task-history-card-meta {
  margin-top: auto;
}

.task-history-card-meta span {
  border: 0;
  border-radius: 999px;
  background: var(--soft-surface-muted);
  color: var(--soft-text);
}

.task-history-empty {
  border: 0;
  border-radius: 26px;
  background: var(--soft-surface);
  box-shadow: var(--soft-shadow-md);
}

.task-history-empty > span {
  border-radius: 50%;
  background: var(--soft-primary-soft);
  box-shadow: 0 10px 24px rgb(99 102 241 / 14%);
}

.task-history-pagination {
  gap: 14px;
}

/* Settings */
.settings-page {
  min-width: 0;
  background: var(--soft-canvas);
}

.settings-shell {
  width: min(1080px, calc(100% - 64px));
  padding: 48px 0 88px;
}

.settings-heading {
  margin-bottom: 30px;
  padding-inline: 4px;
}

.settings-heading code {
  padding: 3px 7px;
  border-radius: 8px;
  background: var(--soft-primary-soft);
  color: var(--soft-primary-strong);
}

.settings-form {
  display: grid;
  gap: 24px;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

.settings-section {
  padding: 30px;
  border: 0;
  border-radius: 26px;
  background: var(--soft-surface);
  box-shadow: var(--soft-shadow-lg);
}

.settings-section-title {
  margin-bottom: 26px;
  gap: 15px;
}

.settings-form .field-grid {
  gap: 22px;
}

.settings-section > .secondary-button {
  margin-top: 22px;
  border: 0;
  background: var(--soft-primary-soft);
  color: var(--soft-primary-strong);
  box-shadow: 0 10px 24px rgb(99 102 241 / 13%);
}

.settings-section > .secondary-button:hover:not(:disabled) {
  border: 0;
  background: var(--soft-surface);
  color: var(--soft-primary-strong);
  box-shadow: 0 16px 32px rgb(99 102 241 / 18%);
}

.settings-section > .secondary-button img {
  filter: invert(40%) sepia(72%) saturate(1750%) hue-rotate(220deg) brightness(94%) contrast(92%);
}

.settings-section .inline-status {
  display: inline-flex;
  width: fit-content;
  min-height: 32px;
  margin-top: 14px;
  padding: 5px 11px;
  align-items: center;
}

.settings-actions {
  margin-top: 0;
  padding: 20px 4px 0;
  gap: 14px;
  border: 0;
  background: transparent;
}

.settings-actions .primary-button,
.settings-actions .secondary-button {
  min-width: 138px;
}

/* Dialogs, toasts, and overlays */
.generation-dialog,
.image-lightbox {
  border: 0;
  border-radius: 28px;
  background: var(--soft-surface);
  box-shadow: 0 34px 90px rgb(45 51 69 / 28%);
}

.generation-dialog {
  width: min(540px, calc(100vw - 48px));
  padding: 38px 40px 34px;
}

.generation-dialog::before {
  display: none;
}

.generation-dialog::backdrop,
.image-lightbox::backdrop {
  background: rgb(45 51 69 / 48%);
  backdrop-filter: blur(8px);
}

.generation-orbit {
  width: 72px;
  height: 72px;
  border: 0;
  border-radius: 50%;
  background: var(--soft-primary-soft);
  box-shadow: 0 14px 34px rgb(99 102 241 / 22%);
}

.generation-orbit img {
  filter: invert(40%) sepia(72%) saturate(1750%) hue-rotate(220deg) brightness(94%) contrast(92%);
}

.generation-orbit span {
  background: var(--soft-pink);
  box-shadow: 0 0 0 5px var(--soft-surface), 0 5px 12px rgb(219 110 158 / 25%);
}

.generation-dialog h2 {
  color: var(--soft-ink);
}

.generation-dialog-error-lead,
.generation-dialog-error-detail {
  margin: 0;
}

.generation-dialog-error-detail {
  margin-top: 8px;
  opacity: 0.78;
}

.generation-pipeline::before {
  background: var(--soft-line);
}

.generation-pipeline li > span {
  border-color: var(--soft-surface);
  background: #cbd2dd;
  box-shadow: 0 0 0 1px #cbd2dd;
}

.generation-pipeline li.current > span {
  background: var(--soft-primary);
  box-shadow: 0 0 0 3px var(--soft-primary-halo);
}

.generation-dialog progress,
.mobile-progress progress {
  overflow: hidden;
  border: 0;
  border-radius: 999px;
  background: var(--soft-surface-pressed);
}

.generation-dialog progress::-webkit-progress-bar,
.mobile-progress progress::-webkit-progress-bar {
  background: var(--soft-surface-pressed);
}

.generation-dialog progress::-webkit-progress-value,
.mobile-progress progress::-webkit-progress-value,
.generation-dialog progress::-moz-progress-bar,
.mobile-progress progress::-moz-progress-bar {
  border-radius: 999px;
  background: var(--soft-primary);
}

.toast {
  min-height: 48px;
  padding: 12px 18px 12px 44px;
  border: 0;
  border-radius: 16px;
  background: var(--soft-ink);
  color: #fff;
  box-shadow: 0 18px 42px rgb(45 51 69 / 28%);
}

.image-lightbox-header {
  border-bottom: 0;
  background: var(--soft-surface-muted);
}

.image-lightbox-image {
  background: #202433;
}

/* Desktop-only product: keep the layout stable on narrower windows. */
@media (max-width: 1180px) {
  .workspace,
  .viewing-task .workspace {
    padding-inline: 24px;
  }

  .editor,
  .viewing-task .editor {
    grid-template-columns: 210px minmax(0, 1fr);
    column-gap: 24px;
  }

  .wizard-action-inner {
    grid-template-columns: 210px minmax(0, 1fr) auto;
    column-gap: 24px;
  }

  .step-host {
    padding-inline: 32px;
  }

  .story-options {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .custom-story-review > .custom-story-meta {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .video-preflight-summary {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .preflight-reference-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 1023px) {
  body {
    padding-bottom: 112px;
  }

  .custom-story-review .story-plan-block li {
    grid-template-columns: 1fr;
    gap: 4px;
  }
}

@media (max-width: 600px) {
  .task-history-heading {
    width: 100%;
    align-items: stretch;
  }

  .task-history-heading > div:first-child {
    width: 100%;
  }

  .header-inner {
    gap: 12px;
  }

  .brand {
    flex: 0 0 auto;
  }

  .brand > span:last-child {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
  }

  .header-actions {
    min-width: 0;
    margin-left: auto;
    gap: 4px;
  }

  .header-actions .task-history-button,
  .header-actions .restart-button {
    width: 44px;
    min-width: 44px;
    padding-inline: 0;
    justify-content: center;
  }

  .header-actions .task-history-button span,
  .header-actions .restart-button span {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
  }

  .custom-story-review {
    gap: 20px;
  }

  .custom-story-review > .custom-story-meta {
    grid-template-columns: 1fr;
  }

  .custom-story-review > .story-plan-block {
    padding: 20px;
  }

  .video-preflight-summary,
  .preflight-reference-grid {
    grid-template-columns: 1fr;
  }

  .preflight-panel {
    padding: 20px;
  }

  .preflight-section-heading {
    align-items: flex-start;
  }

  .preflight-reference-visual {
    min-height: 190px;
  }

  .preflight-advisory {
    padding: 18px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
  }

  .primary-button:hover,
  .secondary-button:hover,
  .task-history-card:hover,
  .story-option:hover,
  .dropzone:hover,
  .task-history-button:hover,
  .restart-button:hover,
  .history-back-button:hover {
    transform: none;
  }
}
