:root {
  color-scheme: light;
  --bg: #f4f4f5;
  --panel: #ffffff;
  --panel-soft: #f6f6f7;
  --text: #101116;
  --muted: #667085;
  --line: #dedfe3;
  --line-strong: #d1d3d8;
  --dark: #17171d;
  --dark-soft: #2c2d34;
  --accent: #0f766e;
  --accent-soft: #e5f4f1;
  --warn: #b45309;
  --warn-soft: #fff4df;
  --danger: #b42318;
  --danger-soft: #fff1f0;
  --shadow: 0 10px 26px rgba(16, 17, 22, 0.06);
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background: var(--bg);
}

body {
  margin: 0;
  min-width: 320px;
  color: var(--text);
  font-family: "Inter", "PingFang SC", "Microsoft YaHei", Arial, sans-serif;
  background: var(--bg);
}

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

button {
  cursor: pointer;
}

svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.app-shell {
  width: min(1240px, calc(100% - 28px));
  margin: 0 auto;
  padding: 14px 0 22px;
}

.hero {
  position: relative;
  text-align: center;
  padding: 0 16px 64px;
}

.admin-entry {
  position: absolute;
  top: 4px;
  right: 0;
  display: inline-flex;
  align-items: center;
  height: 34px;
  padding: 0 12px;
  color: var(--text);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 999px;
  text-decoration: none;
  font-size: 13px;
  box-shadow: var(--shadow);
}

.hero h1 {
  margin: 0;
  font-size: clamp(28px, 4vw, 42px);
  line-height: 1.15;
  font-weight: 850;
}

.hero p {
  max-width: 720px;
  margin: 20px auto 0;
  color: #586176;
  font-size: 18px;
  line-height: 1.6;
}

.steps {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  margin: 0 auto 18px;
  color: #667085;
}

.step {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 104px;
  position: relative;
}

.step:not(:last-child)::after {
  content: "";
  width: 34px;
  height: 1px;
  background: var(--line);
  position: absolute;
  right: -24px;
}

.step span {
  display: inline-grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 999px;
  color: #475467;
  background: transparent;
  font-size: 14px;
}

.step strong {
  font-size: 14px;
  font-weight: 500;
  white-space: nowrap;
}

.step.is-active span,
.step.is-complete span {
  color: #fff;
  background: var(--dark);
}

.step.is-active strong,
.step.is-complete strong {
  color: var(--text);
}

.workspace {
  display: grid;
  grid-template-columns: 368px minmax(0, 1fr);
  gap: 34px;
  align-items: stretch;
}

.control-column {
  display: flex;
  min-width: 0;
  flex-direction: column;
  gap: 22px;
}

.panel,
.result-panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 24px;
  box-shadow: var(--shadow);
}

.panel {
  padding: 24px;
}

.panel-heading {
  display: flex;
  align-items: flex-start;
  gap: 12px;
}

.heading-icon {
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  color: #6b7280;
  background: #f0f0f1;
  border-radius: 999px;
}

.panel-heading h2 {
  margin: 1px 0 2px;
  font-size: 16px;
  line-height: 1.2;
}

.panel-heading p {
  margin: 0;
  color: #5d6679;
  font-size: 14px;
  line-height: 1.35;
}

.image-count {
  margin-left: auto;
  color: #4f5b76;
  font-size: 14px;
  line-height: 34px;
}

.drop-zone {
  display: grid;
  place-items: center;
  gap: 8px;
  min-height: 138px;
  margin-top: 20px;
  padding: 18px;
  text-align: center;
  border: 2px dashed #d9dbe1;
  border-radius: 18px;
  background: #fbfbfc;
  transition: border-color 160ms ease, background 160ms ease;
}

.drop-zone.is-over {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.drop-zone input {
  position: fixed;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.upload-mark {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  color: #737985;
  background: #f0f0f2;
  border-radius: 999px;
}

.drop-zone strong {
  font-size: 15px;
}

.drop-zone small {
  max-width: 248px;
  color: #101116;
  font-size: 13px;
  line-height: 1.45;
}

.thumb-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-top: 14px;
}

.thumb {
  position: relative;
  overflow: hidden;
  aspect-ratio: 1;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--panel-soft);
}

.thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.thumb.is-failed img {
  opacity: 0.42;
}

.thumb-status {
  position: absolute;
  top: 6px;
  left: 6px;
  min-height: 24px;
  padding: 4px 8px;
  color: var(--text);
  background: rgba(255, 255, 255, 0.9);
  border: 1px solid rgba(222, 223, 227, 0.85);
  border-radius: 999px;
  font-size: 12px;
}

.thumb-actions {
  position: absolute;
  inset: auto 6px 6px 6px;
  display: flex;
  justify-content: space-between;
  gap: 6px;
}

.icon-button {
  display: inline-grid;
  place-items: center;
  width: 30px;
  height: 30px;
  color: var(--dark);
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid rgba(222, 223, 227, 0.85);
  border-radius: 999px;
  box-shadow: 0 4px 14px rgba(16, 17, 22, 0.12);
}

.icon-button svg {
  width: 15px;
  height: 15px;
}

.mode-switch {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 22px;
}

.mode-switch button {
  height: 36px;
  color: var(--text);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 14px;
  font-size: 14px;
  font-weight: 700;
}

.mode-switch button.is-selected {
  color: #fff;
  background: var(--dark);
  border-color: var(--dark);
}

.field,
.field-grid {
  margin-top: 16px;
}

.field:first-child {
  margin-top: 0;
}

.field label {
  display: block;
  margin-bottom: 8px;
  color: #596274;
  font-size: 14px;
}

select,
textarea {
  width: 100%;
  color: var(--text);
  background: #f4f4f5;
  border: 1px solid var(--line);
  border-radius: 14px;
  outline: none;
  font-size: 14px;
}

select {
  height: 42px;
  padding: 0 14px;
  line-height: 42px;
}

select:focus,
textarea:focus {
  border-color: var(--dark-soft);
  box-shadow: 0 0 0 3px rgba(23, 23, 29, 0.08);
}

.textarea-wrap {
  position: relative;
}

textarea {
  min-height: 126px;
  resize: vertical;
  padding: 13px 14px 48px;
  line-height: 1.55;
}

.ghost-action {
  position: absolute;
  right: 10px;
  bottom: 10px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 32px;
  padding: 0 12px;
  color: var(--text);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 999px;
  box-shadow: 0 4px 12px rgba(16, 17, 22, 0.08);
  font-size: 13px;
  font-weight: 700;
}

.ghost-action[disabled] {
  opacity: 0.68;
  cursor: wait;
}

.field-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.field-grid .field {
  margin-top: 0;
}

.primary-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  min-height: 58px;
  color: #fff;
  background: #8f8f92;
  border: 0;
  border-radius: 14px;
  box-shadow: 0 12px 24px rgba(16, 17, 22, 0.12);
  font-size: 16px;
  font-weight: 800;
}

.primary-action:not([disabled]) {
  background: var(--dark);
}

.primary-action:not([disabled]):hover {
  background: #000;
}

.primary-action[disabled] {
  cursor: not-allowed;
}

.result-panel {
  min-height: 720px;
  padding: 28px;
  display: flex;
  flex-direction: column;
}

.result-heading {
  flex: 0 0 auto;
}

.result-body {
  flex: 1;
  min-height: 0;
}

.empty-state,
.loading-state {
  min-height: 590px;
  display: grid;
  place-items: center;
  text-align: center;
  color: #596274;
}

.empty-state p,
.loading-state p {
  margin: 0;
  font-size: 15px;
  line-height: 1.55;
}

.empty-state strong,
.loading-state strong {
  display: block;
  font-size: 15px;
  line-height: 1.55;
}

.empty-icon,
.loading-icon {
  display: grid;
  place-items: center;
  width: 68px;
  height: 68px;
  margin: 0 auto 18px;
  color: #707784;
  background: #f1f1f3;
  border-radius: 999px;
}

.empty-icon svg,
.loading-icon svg {
  width: 34px;
  height: 34px;
}

.spinner {
  width: 48px;
  height: 48px;
  margin: 0 auto 18px;
  border: 4px solid #e9eaee;
  border-top-color: var(--dark);
  border-radius: 999px;
  animation: spin 900ms linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.planning-view,
.done-view,
.generating-view {
  padding-top: 28px;
}

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

.summary-item,
.plan-item,
.result-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.summary-item {
  padding: 14px;
}

.summary-item span {
  display: block;
  color: var(--muted);
  font-size: 13px;
}

.summary-item strong {
  display: block;
  margin-top: 6px;
  font-size: 15px;
  line-height: 1.35;
}

.section-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin: 26px 0 12px;
}

.section-title h3 {
  margin: 0;
  font-size: 18px;
}

.section-title p {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
}

.plan-list {
  display: grid;
  gap: 10px;
}

.plan-item {
  padding: 14px;
}

.plan-item strong {
  display: block;
  margin-bottom: 6px;
}

.plan-item p {
  margin: 0;
  color: #596274;
  line-height: 1.55;
}

.risk-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 14px;
}

.pill {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  padding: 5px 10px;
  color: var(--warn);
  background: var(--warn-soft);
  border-radius: 999px;
  font-size: 13px;
}

.action-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 22px;
}

.secondary-button,
.dark-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 40px;
  padding: 0 16px;
  border-radius: 12px;
  font-weight: 750;
}

.secondary-button {
  color: var(--text);
  background: #fff;
  border: 1px solid var(--line);
}

.dark-button {
  color: #fff;
  background: var(--dark);
  border: 1px solid var(--dark);
}

.progress-wrap {
  max-width: 520px;
  margin: 150px auto 0;
  text-align: center;
}

.progress-track {
  overflow: hidden;
  height: 10px;
  margin: 20px 0 12px;
  background: #eceef2;
  border-radius: 999px;
}

.progress-bar {
  width: 0%;
  height: 100%;
  background: var(--accent);
  border-radius: inherit;
  transition: width 260ms ease;
}

.result-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
  gap: 14px;
}

.result-card {
  overflow: hidden;
}

.result-image {
  display: block;
  width: 100%;
  aspect-ratio: 3 / 4;
  object-fit: cover;
  background: var(--panel-soft);
}

.result-art {
  display: grid;
  min-height: 230px;
  padding: 18px;
  color: #fff;
  background:
    linear-gradient(135deg, rgba(15, 118, 110, 0.94), rgba(23, 23, 29, 0.96)),
    var(--dark);
}

.result-art strong {
  align-self: end;
  max-width: 10ch;
  font-size: 24px;
  line-height: 1.15;
}

.product-chip {
  align-self: start;
  justify-self: start;
  min-height: 28px;
  padding: 5px 9px;
  color: #123;
  background: rgba(255, 255, 255, 0.88);
  border-radius: 999px;
  font-size: 12px;
}

.result-card-body {
  padding: 12px;
}

.result-card-body h4 {
  margin: 0 0 6px;
  font-size: 15px;
}

.result-card-body p {
  min-height: 40px;
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

.card-actions {
  display: flex;
  gap: 8px;
  margin-top: 12px;
}

.mini-button {
  flex: 1;
  min-height: 32px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  font-size: 13px;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 22px;
  z-index: 50;
  transform: translateX(-50%) translateY(20px);
  max-width: min(420px, calc(100% - 32px));
  padding: 12px 16px;
  color: #fff;
  background: var(--dark);
  border-radius: 999px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 160ms ease, transform 160ms ease;
}

.toast.is-visible {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.preview-dialog {
  width: min(860px, calc(100% - 32px));
  padding: 0;
  border: 0;
  border-radius: 18px;
  background: transparent;
}

.preview-dialog::backdrop {
  background: rgba(16, 17, 22, 0.72);
}

.preview-dialog img {
  display: block;
  width: 100%;
  max-height: 86vh;
  object-fit: contain;
  background: #fff;
  border-radius: 18px;
}

.close-preview {
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 2;
}

@media (max-width: 920px) {
  .hero {
    padding-bottom: 36px;
  }

  .steps {
    overflow-x: auto;
    justify-content: flex-start;
    padding-bottom: 4px;
  }

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

  .result-panel {
    min-height: 560px;
  }
}

@media (max-width: 560px) {
  .app-shell {
    width: min(100% - 18px, 1240px);
    padding-top: 18px;
  }

  .hero h1 {
    font-size: 30px;
  }

  .hero p {
    font-size: 15px;
  }

  .panel,
  .result-panel {
    padding: 18px;
    border-radius: 20px;
  }

  .field-grid,
  .summary-grid {
    grid-template-columns: 1fr;
  }

  .thumb-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .empty-state,
  .loading-state {
    min-height: 380px;
  }
}
