:root {
  --ink: #121212;
  --muted: #6f6f68;
  --paper: #f5f3ed;
  --card: #fff;
  --line: #dedbd2;
  --accent: #ff5c35;
  --acid: #d9ff43;
  --success: #16845b;
  --shadow: 0 18px 60px rgba(35, 31, 24, .08);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; color: var(--ink); background: var(--paper); font-family: Inter, "PingFang SC", "Microsoft YaHei", sans-serif; }
button, input, textarea, select { font: inherit; }
button, label, select { cursor: pointer; }

.topbar { height: 68px; padding: 0 max(24px, calc((100vw - 1320px) / 2)); display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid var(--line); background: rgba(245, 243, 237, .92); position: sticky; top: 0; z-index: 20; backdrop-filter: blur(12px); }
.brand { color: var(--ink); font-size: 21px; font-weight: 900; letter-spacing: -.8px; text-decoration: none; }
.brand span { padding: 3px 6px; color: #fff; background: var(--accent); font-size: 10px; letter-spacing: 1px; vertical-align: top; }
.service-status { font-size: 12px; color: var(--muted); }
.service-status.ready::before { background: var(--success); }
.service-status::before { content: ""; width: 7px; height: 7px; margin-right: 7px; display: inline-block; border-radius: 50%; background: #e3a21a; }

main { width: min(1320px, calc(100% - 48px)); margin: auto; }
.hero { padding: 88px 0 70px; display: grid; grid-template-columns: 1fr .62fr; gap: 24px 80px; align-items: end; }
.eyebrow { grid-column: 1/-1; margin: 0; font-size: 11px; font-weight: 800; letter-spacing: 2.5px; }
h1 { margin: 0; font-size: clamp(44px, 6vw, 84px); line-height: .98; letter-spacing: -5px; }
h1 em { color: var(--accent); font-style: normal; }
.hero-copy { margin: 0; color: var(--muted); font-size: 16px; line-height: 1.8; }
.notice { grid-column: 2; padding: 13px 16px; border-left: 3px solid var(--accent); background: #ebe8df; color: #59574f; font-size: 12px; line-height: 1.6; }

.workspace { display: grid; grid-template-columns: 210px 1fr; gap: 28px; padding-bottom: 100px; }
.steps { height: max-content; position: sticky; top: 96px; display: grid; }
.step { padding: 18px 0; display: flex; gap: 16px; border: 0; border-bottom: 1px solid var(--line); color: #8b8982; background: none; text-align: left; }
.step b { font-family: Georgia, serif; font-size: 24px; font-style: italic; }
.step span { font-weight: 700; }
.step small { margin-top: 4px; display: block; font-size: 11px; font-weight: 400; }
.step.active { color: var(--ink); }
.step.active b { color: var(--accent); }
.panels { display: grid; gap: 28px; }
.panel { padding: clamp(24px, 4vw, 52px); border: 1px solid var(--line); background: var(--card); box-shadow: var(--shadow); }
.panel-heading { margin-bottom: 14px; display: flex; align-items: start; justify-content: space-between; gap: 20px; }
.kicker { color: var(--accent); font-size: 10px; font-weight: 900; letter-spacing: 2px; }
h2 { margin: 7px 0 0; font-size: 32px; letter-spacing: -1.4px; }
.api-tag { padding: 7px 10px; border: 1px solid var(--line); color: var(--muted); font: 11px ui-monospace, monospace; }
.helper { margin: 0 0 28px; color: var(--muted); font-size: 13px; line-height: 1.7; }

.upload-grid { display: grid; gap: 18px; }
.upload-grid.two { grid-template-columns: 1fr 1fr; }
.image-input > label, .form-grid label, .existing-url, .action-row label { display: block; font-size: 12px; font-weight: 750; }
.image-input strong { color: var(--accent); font-size: 10px; }
.drop-zone { height: 230px; margin-top: 9px; position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; overflow: hidden; border: 1px dashed #bbb7ac; background: #f8f7f3; transition: .2s ease; }
.drop-zone:hover { border-color: var(--accent); background: #fff9f6; }
.drop-zone input { position: absolute; inset: 0; z-index: 3; opacity: 0; }
.drop-icon { width: 42px; height: 42px; margin-bottom: 12px; display: grid; place-items: center; border-radius: 50%; color: #fff; background: var(--ink); font-size: 25px; font-weight: 300; }
.drop-zone b { font-size: 13px; }
.drop-zone small { margin-top: 7px; color: var(--muted); font-size: 10px; }
.preview { width: 100%; height: 100%; display: none; position: absolute; inset: 0; z-index: 2; object-fit: contain; background: #eee; }
.drop-zone.has-image .preview { display: block; }
.url-input, .garment-url { width: 100%; margin-top: 8px; padding: 10px 12px; border: 1px solid var(--line); background: #fff; font-size: 11px; outline: none; }
.url-input:focus, .garment-url:focus, input:focus, textarea:focus, select:focus { border-color: var(--accent); }

.form-grid { margin-top: 28px; display: grid; grid-template-columns: 2fr 1fr; gap: 16px; }
.form-grid .wide { grid-column: 1/-1; }
.form-grid input, .form-grid textarea, .form-grid select, .existing-url input, .action-row select { width: 100%; margin-top: 8px; padding: 13px 14px; border: 1px solid var(--line); background: #faf9f6; resize: vertical; outline: none; }
.primary-button, .secondary-button { border: 0; font-weight: 800; }
.primary-button { min-width: 230px; margin-top: 24px; padding: 6px 7px 6px 22px; display: flex; align-items: center; justify-content: space-between; gap: 18px; color: #fff; background: var(--ink); }
.primary-button i { width: 38px; height: 38px; display: grid; place-items: center; color: var(--ink); background: var(--acid); font-size: 20px; font-style: normal; }
.primary-button:hover { background: var(--accent); }
.primary-button:disabled { cursor: not-allowed; opacity: .5; }
.secondary-button { padding: 12px 18px; color: var(--ink); background: var(--acid); white-space: nowrap; }
.divider { margin: 28px 0; display: flex; align-items: center; gap: 12px; color: #9a978e; font-size: 10px; }
.divider::before, .divider::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.existing-url > div { margin-top: 8px; display: flex; }
.existing-url input { margin: 0; }

.wardrobe-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.garment-card { min-height: 225px; padding: 22px; position: relative; overflow: hidden; border: 1px solid var(--line); background: #faf9f6; }
.garment-card.selected { border-color: var(--ink); box-shadow: inset 0 -4px var(--acid); }
.garment-number { position: absolute; right: 13px; top: 8px; color: #e5e1d8; font: italic 44px Georgia, serif; }
.garment-card h3 { margin: 0; font-size: 21px; }
.garment-card p { margin: 5px 0 20px; color: var(--muted); font-size: 11px; }
.garment-card label { padding: 9px 12px; position: relative; z-index: 2; display: inline-block; border: 1px solid var(--ink); background: #fff; font-size: 11px; font-weight: 700; }
.garment-card label input { position: absolute; inset: 0; opacity: 0; }
.garment-preview { width: 74px; height: 74px; position: absolute; right: 18px; bottom: 18px; display: none; border: 1px solid var(--line); object-fit: cover; background: #fff; }
.garment-card.selected .garment-preview { display: block; }
.garment-url { width: calc(100% - 88px); display: block; }
.action-row { margin-top: 24px; display: flex; align-items: end; justify-content: space-between; gap: 24px; }
.action-row select { min-width: 130px; }
.action-row .primary-button { margin-top: 0; }

.result-stage { min-height: 560px; position: relative; display: grid; place-items: center; overflow: hidden; background: #efede7; }
.empty-result { color: #96938a; text-align: center; }
.empty-result span { color: #dfdcd4; font: italic 130px Georgia, serif; }
.empty-result p { margin-top: -25px; font-size: 12px; }
#resultImage { width: 100%; max-height: 720px; display: none; object-fit: contain; }
.loading-overlay { position: absolute; inset: 0; z-index: 4; display: flex; flex-direction: column; align-items: center; justify-content: center; background: rgba(18, 18, 18, .88); color: #fff; text-align: center; }
.loading-overlay[hidden] { display: none; }
.loading-overlay p { color: #aaa; font-size: 12px; }
.spinner { width: 46px; height: 46px; margin-bottom: 20px; border: 3px solid #555; border-top-color: var(--acid); border-radius: 50%; animation: spin .9s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.progress-list { margin-top: 14px; display: grid; gap: 8px; }
.progress-item { padding: 11px 14px; display: flex; justify-content: space-between; border: 1px solid var(--line); font-size: 11px; }
.progress-item.done { color: var(--success); }
.progress-item.failed { color: #c33030; }
.download { margin-top: 14px; display: inline-block; text-decoration: none; }
.text-button { border: 0; border-bottom: 1px solid; background: none; font-size: 11px; }
.toast { max-width: min(420px, calc(100vw - 36px)); padding: 14px 18px; position: fixed; right: 24px; bottom: 24px; z-index: 50; transform: translateY(20px); opacity: 0; pointer-events: none; color: #fff; background: #c33d2e; box-shadow: var(--shadow); font-size: 12px; line-height: 1.5; transition: .25s ease; }
.toast.show { transform: none; opacity: 1; }

@media (max-width: 900px) {
  main { width: min(100% - 28px, 700px); }
  .hero { padding: 60px 0 45px; grid-template-columns: 1fr; }
  .hero-copy, .notice { grid-column: 1; }
  h1 { letter-spacing: -3px; }
  .workspace { grid-template-columns: 1fr; }
  .steps { position: static; grid-template-columns: repeat(3, 1fr); }
  .step { padding-right: 10px; }
  .step small { display: none; }
  .upload-grid.two, .wardrobe-grid { grid-template-columns: 1fr; }
}

@media (max-width: 560px) {
  .topbar { padding: 0 14px; }
  .service-status { max-width: 180px; text-align: right; }
  .panel { padding: 22px 16px; }
  h1 { font-size: 43px; letter-spacing: -2.5px; }
  h2 { font-size: 26px; }
  .api-tag { display: none; }
  .form-grid { grid-template-columns: 1fr; }
  .form-grid .wide { grid-column: 1; }
  .action-row { align-items: stretch; flex-direction: column; }
  .primary-button { width: 100%; }
  .result-stage { min-height: 420px; }
}

.profile-card { padding: 24px; border: 1px solid var(--line); background: #f8f7f3; }
.profile-title { margin-bottom: 18px; display: flex; align-items: baseline; justify-content: space-between; }
.profile-title span { color: var(--accent); font-size: 9px; font-weight: 900; letter-spacing: 1.8px; }
.profile-title b { font-size: 18px; }
.profile-card .form-grid { margin-top: 0; gap: 12px; }
.profile-card .form-grid input, .profile-card .form-grid select { background: #fff; }
.preserve-toggle { margin-top: 18px; padding: 14px; display: flex !important; align-items: flex-start; gap: 10px; border: 1px solid var(--ink); background: #fff; }
.preserve-toggle input { width: 17px; height: 17px; margin: 1px 0 0; accent-color: var(--accent); }
.preserve-toggle span { flex: 1; }
.preserve-toggle b { display: block; font-size: 12px; }
.preserve-toggle small { margin-top: 4px; display: block; color: var(--muted); font-size: 10px; font-weight: 400; line-height: 1.5; }
.accuracy-note { margin: 10px 0 0; color: var(--muted); font-size: 10px; line-height: 1.55; }

/* 双引擎、资产库与通用饰品 */
.asset-library { margin-top: 36px; padding-top: 30px; border-top: 1px solid var(--line); }
.asset-heading, .accessory-heading { display: flex; align-items: center; justify-content: space-between; gap: 18px; }
.asset-heading h3 { margin: 5px 0 0; font-size: 22px; }
.asset-library code { padding: 2px 5px; background: #efede7; font-size: 10px; }
.asset-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
.asset-card { padding: 0; overflow: hidden; border: 1px solid var(--line); background: #f8f7f3; text-align: left; transition: .2s ease; }
.asset-card:hover { border-color: var(--accent); transform: translateY(-2px); }
.asset-card img { width: 100%; aspect-ratio: 2 / 3; display: block; object-fit: cover; background: #eceae4; }
.asset-card span { padding: 9px; display: block; overflow: hidden; color: var(--muted); font-size: 9px; text-overflow: ellipsis; white-space: nowrap; }
.asset-empty { grid-column: 1 / -1; padding: 24px; margin: 0; border: 1px dashed var(--line); color: var(--muted); font-size: 11px; text-align: center; }
.engine-module { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.engine-card { padding: 17px; display: flex; align-items: flex-start; gap: 11px; border: 1px solid var(--line); background: #faf9f6; }
.engine-card:has(input:checked) { border-color: var(--ink); box-shadow: inset 0 -4px var(--acid); background: #fff; }
.engine-card input { margin-top: 2px; accent-color: var(--accent); }
.engine-card b, .engine-card small { display: block; }
.engine-card b { font-size: 13px; }
.engine-card small { margin-top: 5px; color: var(--muted); font-size: 10px; font-weight: 400; line-height: 1.45; }
.qwen-options { margin-top: 12px; padding: 14px; border: 1px solid var(--line); background: #f8f7f3; }
.qwen-options[hidden] { display: none; }
.qwen-options label { display: flex; align-items: center; justify-content: space-between; gap: 20px; font-size: 11px; font-weight: 700; }
.qwen-options select { min-width: 260px; padding: 10px; border: 1px solid var(--line); background: #fff; }
.engine-hint { margin-top: 12px; padding-left: 12px; border-left: 3px solid var(--acid); }
.section-title { margin: 30px 0 14px; font-size: 18px; }
.accessory-section { margin-top: 30px; padding-top: 4px; border-top: 1px solid var(--line); }
.accessory-section.disabled { opacity: .52; }
.accessory-heading p { margin: -7px 0 14px; color: var(--muted); font-size: 10px; }
.accessory-heading .secondary-button { padding: 10px 14px; }
.accessory-list { display: grid; gap: 9px; }
.accessory-row { padding: 10px; display: grid; grid-template-columns: 125px minmax(160px, 1fr) 105px minmax(140px, .8fr) 32px; gap: 8px; border: 1px solid var(--line); background: #faf9f6; }
.accessory-row select, .accessory-row > input { min-width: 0; padding: 10px; border: 1px solid var(--line); background: #fff; font-size: 10px; }
.accessory-upload { padding: 10px 8px; position: relative; overflow: hidden; border: 1px solid var(--ink); background: #fff; font-size: 10px; font-weight: 700; text-align: center; }
.accessory-upload input { position: absolute; inset: 0; opacity: 0; }
.accessory-row.has-file .accessory-upload { color: #fff; background: var(--success); border-color: var(--success); }
.accessory-row.has-file .accessory-upload span { font-size: 0; }
.accessory-row.has-file .accessory-upload span::after { content: "已选择图片"; font-size: 10px; }
.remove-accessory { border: 0; color: #777; background: transparent; font-size: 22px; }
.remove-accessory:hover { color: var(--accent); }

@media (max-width: 900px) {
  .asset-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .accessory-row { grid-template-columns: 1fr 1fr 36px; }
  .accessory-row .accessory-description { grid-column: 2 / 3; }
  .accessory-row .accessory-upload { grid-column: 1 / 2; }
  .accessory-row .accessory-url { grid-column: 2 / 3; }
  .remove-accessory { grid-column: 3; grid-row: 1 / 3; }
}

@media (max-width: 560px) {
  .asset-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .engine-module { grid-template-columns: 1fr; }
  .qwen-options label { align-items: stretch; flex-direction: column; }
  .qwen-options select { min-width: 0; width: 100%; }
  .accessory-heading { align-items: flex-start; flex-direction: column; }
  .accessory-row { grid-template-columns: 1fr 32px; }
  .accessory-row .accessory-type, .accessory-row .accessory-description, .accessory-row .accessory-upload, .accessory-row .accessory-url { grid-column: 1; }
  .remove-accessory { grid-column: 2; grid-row: 1 / 5; }
}
