:root {
  --bg: #f5f7f6;
  --surface: #ffffff;
  --surface-raised: #fbfcfb;
  --surface-2: #eef3f1;
  --surface-3: #f6f1ea;
  --text: #14201b;
  --muted: #65736c;
  --line: #d8e1dc;
  --line-strong: #b8c8c0;
  --primary: #245c49;
  --primary-strong: #12392d;
  --primary-soft: #e7f1ec;
  --accent: #b9653d;
  --accent-soft: #fff2ea;
  --info: #395c7d;
  --warning: #9d5b19;
  --danger: #a13c3c;
  --ok: #2f7556;
  --shadow: 0 18px 42px rgba(20, 32, 27, 0.09);
  --shadow-hover: 0 22px 54px rgba(20, 32, 27, 0.13);
  --focus: 0 0 0 3px rgba(36, 92, 73, 0.16);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    linear-gradient(180deg, #f9fbfa 0%, var(--bg) 44%, #f2f5f4 100%);
  color: var(--text);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Microsoft YaHei", sans-serif;
  letter-spacing: 0;
}

body::before {
  position: fixed;
  inset: 0;
  z-index: -1;
  background-image:
    linear-gradient(rgba(20, 32, 27, 0.025) 1px, transparent 1px),
    linear-gradient(90deg, rgba(20, 32, 27, 0.025) 1px, transparent 1px);
  background-size: 28px 28px;
  content: "";
  pointer-events: none;
}

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

button {
  cursor: pointer;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 22px 28px 18px;
  border-bottom: 1px solid rgba(216, 225, 220, 0.84);
  background: rgba(255, 255, 255, 0.88);
  box-shadow: 0 10px 30px rgba(20, 32, 27, 0.05);
  backdrop-filter: blur(16px);
  position: sticky;
  top: 0;
  z-index: 20;
}

.eyebrow,
.section-kicker {
  margin: 0 0 6px;
  color: var(--accent);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
}

h1,
h2,
h3 {
  margin: 0;
  line-height: 1.2;
}

h1 {
  font-size: 25px;
  letter-spacing: 0;
}

h2 {
  font-size: 19px;
}

h3 {
  font-size: 15px;
}

.topbar__actions,
.export-bar,
.batch-toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
}

.workspace {
  display: grid;
  grid-template-columns: minmax(280px, 0.92fr) minmax(300px, 1fr) minmax(360px, 1.2fr);
  gap: 18px;
  padding: 18px;
  max-width: 1540px;
  margin: 0 auto;
}

.panel {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(251, 252, 251, 0.96));
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  min-width: 0;
  transition:
    border-color 180ms ease,
    box-shadow 180ms ease;
}

.panel:hover {
  border-color: var(--line-strong);
  box-shadow: var(--shadow-hover);
}

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

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

.status-pill,
.source-pill,
.quality-card,
.note-box {
  border: 1px solid var(--line);
  background: var(--surface-2);
}

.status-pill,
.source-pill {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 3px 9px;
  border-radius: 999px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.button,
.icon-button {
  min-height: 44px;
  border: 1px solid transparent;
  border-radius: 8px;
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.75) inset;
  touch-action: manipulation;
  transition:
    background-color 160ms ease,
    color 160ms ease,
    border-color 160ms ease,
    box-shadow 180ms ease,
    transform 180ms ease;
}

.button:hover,
.icon-button:hover {
  transform: translateY(-1px);
}

.button:active,
.icon-button:active {
  transform: translateY(1px);
}

.button {
  padding: 0 16px;
  font-weight: 700;
}

.button--primary {
  background: linear-gradient(180deg, #2f765d 0%, var(--primary) 100%);
  color: #fff;
  box-shadow:
    0 10px 22px rgba(36, 92, 73, 0.18),
    0 1px 0 rgba(255, 255, 255, 0.18) inset;
}

.button--primary:hover {
  background: linear-gradient(180deg, #28674f 0%, var(--primary-strong) 100%);
  box-shadow:
    0 16px 28px rgba(36, 92, 73, 0.22),
    0 1px 0 rgba(255, 255, 255, 0.16) inset;
}

.button--ghost {
  background: rgba(255, 255, 255, 0.9);
  color: var(--primary);
  border-color: var(--line);
}

.button--ghost:hover {
  border-color: var(--line-strong);
  background: var(--primary-soft);
  box-shadow: 0 10px 22px rgba(20, 32, 27, 0.08);
}

.button:focus-visible,
.icon-button:focus-visible {
  outline: none;
  box-shadow: var(--focus);
}

.button:disabled,
.icon-button:disabled {
  cursor: wait;
  opacity: 0.58;
}

.icon-button {
  width: 44px;
  background: rgba(255, 255, 255, 0.92);
  border-color: var(--line);
  color: var(--muted);
  font-size: 24px;
}

.icon-button:hover {
  border-color: #d9b6a2;
  background: var(--accent-soft);
  color: #7d3f25;
}

.field,
.upload-zone {
  display: grid;
  gap: 7px;
  margin-bottom: 14px;
}

.field span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.field input,
.field select,
.field textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.96);
  color: var(--text);
  min-height: 44px;
  padding: 10px 12px;
  outline: none;
  transition:
    background-color 160ms ease,
    border-color 160ms ease,
    box-shadow 160ms ease;
}

.field input:hover,
.field select:hover,
.field textarea:hover {
  border-color: var(--line-strong);
  background: #fff;
}

.field textarea {
  resize: vertical;
  line-height: 1.5;
}

.field input:focus,
.field select:focus,
.field textarea:focus {
  border-color: var(--primary);
  box-shadow: var(--focus);
}

.field--compact {
  margin-bottom: 10px;
}

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

.upload-zone {
  position: relative;
  place-items: center;
  min-height: 150px;
  padding: 20px;
  border: 1.5px dashed #94aaa0;
  border-radius: 8px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.92), rgba(240, 247, 243, 0.92));
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.78);
  text-align: center;
  color: var(--muted);
  cursor: pointer;
  transition:
    background-color 180ms ease,
    border-color 180ms ease,
    box-shadow 180ms ease,
    transform 180ms ease;
}

.upload-zone:hover {
  border-color: var(--primary);
  background:
    linear-gradient(180deg, #ffffff, var(--primary-soft));
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, 0.82),
    0 14px 28px rgba(36, 92, 73, 0.12);
  transform: translateY(-1px);
}

.upload-zone input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  appearance: none;
  color: transparent;
  font-size: 0;
  opacity: 0;
  cursor: pointer;
  z-index: 2;
}

.upload-zone input::file-selector-button {
  display: none;
}

.upload-zone > :not(input) {
  pointer-events: none;
}

.upload-zone__icon {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: linear-gradient(180deg, #327a62, var(--primary));
  color: #fff;
  font-size: 24px;
  line-height: 1;
  box-shadow: 0 12px 24px rgba(36, 92, 73, 0.22);
  transition:
    box-shadow 180ms ease,
    transform 180ms ease;
}

.upload-zone:hover .upload-zone__icon {
  box-shadow: 0 16px 30px rgba(36, 92, 73, 0.28);
  transform: scale(1.04);
}

.upload-zone strong {
  color: var(--text);
}

.upload-zone small,
.export-bar small,
.image-stage__empty small {
  color: var(--muted);
}

.batch-toolbar {
  flex-wrap: wrap;
  margin-bottom: 14px;
}

.batch-toolbar .button {
  flex: 1 1 140px;
}

.style-list {
  display: grid;
  gap: 8px;
  margin-bottom: 16px;
}

.style-card {
  display: grid;
  grid-template-columns: 58px 1fr 44px;
  align-items: center;
  gap: 10px;
  min-height: 74px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px;
  background: rgba(255, 255, 255, 0.96);
  cursor: pointer;
  transition:
    background-color 180ms ease,
    border-color 180ms ease,
    box-shadow 180ms ease,
    transform 180ms ease;
}

.style-card:hover {
  border-color: var(--line-strong);
  box-shadow: 0 12px 24px rgba(20, 32, 27, 0.08);
  transform: translateY(-1px);
}

.style-card.is-active {
  border-color: var(--primary);
  background: linear-gradient(90deg, var(--primary-soft), #fff 46%);
  box-shadow:
    inset 3px 0 0 var(--primary),
    0 14px 26px rgba(36, 92, 73, 0.12);
}

.style-card.is-loading {
  border-color: #b8cbbb;
  background: #f6faf7;
}

.style-card.has-error {
  border-color: #e3b3aa;
  background: #fff7f4;
}

.style-card__image,
.style-card__fallback {
  width: 58px;
  height: 58px;
  border-radius: 7px;
  border: 1px solid var(--line);
  background: #f7f9f8;
}

.style-card__image {
  object-fit: cover;
}

.style-card__fallback {
  display: grid;
  place-items: center;
  color: var(--muted);
  font-size: 12px;
}

.style-card strong,
.style-card span {
  display: block;
}

.style-card strong {
  overflow-wrap: anywhere;
  font-size: 14px;
}

.style-card span {
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
}

.style-card__remove {
  width: 40px;
  min-height: 40px;
  font-size: 20px;
}

.current-form {
  border-top: 1px solid var(--line);
  padding-top: 16px;
}

.current-form__title {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
}

.current-form__title span {
  color: var(--muted);
  font-size: 13px;
  overflow-wrap: anywhere;
  text-align: right;
}

.feature-list,
.fab-list,
.marketing-list,
.style-list {
  scrollbar-color: #b9cac1 transparent;
  scrollbar-width: thin;
}

.feature-list::-webkit-scrollbar,
.fab-list::-webkit-scrollbar,
.marketing-list::-webkit-scrollbar,
.style-list::-webkit-scrollbar {
  width: 8px;
}

.feature-list::-webkit-scrollbar-thumb,
.fab-list::-webkit-scrollbar-thumb,
.marketing-list::-webkit-scrollbar-thumb,
.style-list::-webkit-scrollbar-thumb {
  border: 2px solid transparent;
  border-radius: 999px;
  background: #b9cac1;
  background-clip: padding-box;
}

.image-stage {
  position: relative;
  display: grid;
  place-items: center;
  min-height: 360px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.78) 25%, transparent 25%) 0 0 / 22px 22px,
    linear-gradient(135deg, transparent 75%, rgba(255, 255, 255, 0.78) 75%) 0 0 / 22px 22px,
    linear-gradient(135deg, transparent 75%, rgba(255, 255, 255, 0.78) 75%) 11px 11px / 22px 22px,
    linear-gradient(135deg, rgba(255, 255, 255, 0.78) 25%, #eff3f1 25%) 11px 11px / 22px 22px;
  overflow: hidden;
  margin-bottom: 16px;
  box-shadow: inset 0 1px 22px rgba(20, 32, 27, 0.045);
  transition:
    border-color 180ms ease,
    box-shadow 180ms ease;
}

.image-stage.has-image {
  border-color: var(--line-strong);
  background:
    linear-gradient(180deg, #ffffff, #f6f8f7);
}

.image-stage.has-image::after {
  position: absolute;
  top: 12px;
  left: 12px;
  z-index: 2;
  padding: 5px 9px;
  border: 1px solid rgba(36, 92, 73, 0.18);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.88);
  color: var(--primary);
  content: "已上传图片";
  font-size: 12px;
  font-weight: 800;
  box-shadow: 0 8px 18px rgba(20, 32, 27, 0.08);
}

.image-stage__empty {
  display: grid;
  gap: 6px;
  place-items: center;
  color: var(--muted);
  padding: 28px;
  text-align: center;
}

.image-stage__empty[hidden] {
  display: none;
}

.image-stage img {
  width: 100%;
  height: 100%;
  max-height: 520px;
  object-fit: contain;
  padding: 18px;
  filter: drop-shadow(0 18px 28px rgba(20, 32, 27, 0.1));
}

.feature-box {
  border-top: 1px solid var(--line);
  padding-top: 16px;
}

.feature-box__title {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
}

.feature-box__title span {
  color: var(--muted);
  font-size: 13px;
}

.feature-list {
  display: grid;
  gap: 8px;
}

.feature-row {
  display: grid;
  grid-template-columns: 92px 1fr auto;
  align-items: center;
  gap: 8px;
  padding: 9px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.74);
  transition:
    border-color 160ms ease,
    box-shadow 160ms ease,
    transform 160ms ease;
}

.feature-row:hover {
  border-color: var(--line-strong);
  box-shadow: 0 10px 20px rgba(20, 32, 27, 0.06);
  transform: translateY(-1px);
}

.feature-row strong {
  font-size: 13px;
}

.feature-row span {
  color: var(--muted);
  font-size: 13px;
}

.confidence {
  border-radius: 999px;
  padding: 3px 7px;
  font-size: 12px;
  background: #edf3ef;
  color: var(--ok);
}

.confidence--低 {
  background: #fff3df;
  color: var(--warning);
}

.note-box {
  margin-top: 14px;
  padding: 12px;
  border-radius: 8px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
  background: linear-gradient(180deg, #f6f9f7, #eef3f1);
}

.quality-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 8px;
  margin-bottom: 14px;
}

.quality-card {
  min-height: 64px;
  border-radius: 8px;
  padding: 10px;
  transition:
    border-color 160ms ease,
    box-shadow 160ms ease,
    transform 160ms ease;
}

.quality-card:hover {
  box-shadow: 0 10px 20px rgba(20, 32, 27, 0.06);
  transform: translateY(-1px);
}

.quality-card strong {
  display: block;
  margin-bottom: 5px;
  font-size: 12px;
}

.quality-card span {
  color: var(--muted);
  font-size: 12px;
}

.quality-card.is-bad {
  border-color: #e9c2b9;
  background: #fff3ef;
}

.quality-card.is-good {
  border-color: #bdd8c8;
  background: #edf7f2;
}

.fab-list {
  display: grid;
  gap: 10px;
  max-height: calc(100vh - 470px);
  min-height: 230px;
  overflow: auto;
  padding-right: 4px;
}

.fab-item {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: rgba(255, 255, 255, 0.96);
  transition:
    background-color 160ms ease,
    border-color 160ms ease,
    box-shadow 160ms ease,
    transform 160ms ease;
}

.fab-item:hover {
  border-color: var(--line-strong);
  box-shadow: 0 12px 24px rgba(20, 32, 27, 0.07);
  transform: translateY(-1px);
}

.fab-item.is-selected {
  border-color: var(--primary);
  background: linear-gradient(90deg, var(--primary-soft), #fff 42%);
  box-shadow:
    inset 3px 0 0 var(--primary),
    0 12px 24px rgba(36, 92, 73, 0.1);
}

.fab-item__head,
.check-line,
.export-bar {
  display: flex;
  align-items: center;
}

.fab-item__head {
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
}

.check-line {
  gap: 8px;
  font-weight: 800;
}

.check-line input {
  width: 18px;
  height: 18px;
  accent-color: var(--primary);
}

.export-bar {
  justify-content: space-between;
  margin-top: 16px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background:
    linear-gradient(90deg, var(--primary-soft), #fff 62%);
}

.export-bar div {
  display: grid;
  gap: 4px;
}

.marketing-box {
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

.marketing-list {
  display: grid;
  gap: 8px;
}

.toast {
  position: fixed;
  right: 18px;
  bottom: 18px;
  max-width: min(420px, calc(100vw - 36px));
  padding: 12px 14px;
  border-radius: 8px;
  background: #111b17;
  color: #fff;
  box-shadow: 0 18px 44px rgba(20, 32, 27, 0.22);
  opacity: 0;
  pointer-events: none;
  transform: translateY(8px);
  transition:
    opacity 180ms ease,
    transform 180ms ease;
  z-index: 50;
}

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

@media (max-width: 1180px) {
  .workspace {
    grid-template-columns: 1fr 1fr;
  }

  .output-panel {
    grid-column: 1 / -1;
  }

  .fab-list {
    max-height: none;
  }
}

@media (max-width: 760px) {
  .topbar,
  .topbar__actions {
    align-items: stretch;
    flex-direction: column;
  }

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

  .workspace {
    padding: 10px;
  }

  .topbar {
    padding: 18px 14px;
  }

  .input-panel,
  .preview-panel,
  .output-panel {
    padding: 14px;
  }

  .feature-row {
    grid-template-columns: 1fr;
  }
}

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