:root {
  --ink: #18181b;
  --muted: #71717a;
  --line: #e4e4e7;
  --ground: #f8f8f9;
  --surface: #ffffff;
  --soft: #f4f4f5;
  --radius: 14px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; background: var(--ground); color: var(--ink); font-family: "Noto Sans SC", "Microsoft YaHei", system-ui, sans-serif; }
button, input, textarea, select { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; }
a { color: inherit; text-decoration: none; }

.app-header { position: sticky; z-index: 10; top: 0; display: flex; align-items: center; gap: 16px; height: 72px; padding: 0 max(24px, calc((100% - 1220px) / 2)); border-bottom: 1px solid var(--line); background: rgb(255 255 255 / 92%); backdrop-filter: blur(12px); }
.brand { display: inline-flex; align-items: center; gap: 10px; font-size: 17px; font-weight: 800; }
.brand img { width: 34px; height: 34px; border-radius: 10px; object-fit: cover; }
.header-title { padding-left: 16px; border-left: 1px solid var(--line); color: var(--muted); font-size: 14px; }
.admin-link { margin-left: auto; padding: 8px 12px; border: 1px solid var(--line); border-radius: 8px; color: #52525b; font-size: 13px; font-weight: 700; }
.admin-link:hover { border-color: #a1a1aa; background: var(--soft); }
main { width: min(1220px, calc(100% - 48px)); margin: auto; }

.intro { max-width: 750px; margin: 72px auto 34px; text-align: center; }
.intro p { display: inline-flex; margin: 0 0 12px; padding: 5px 9px; border-radius: 6px; background: #e5f3ff; color: #2563eb; font-size: 12px; font-weight: 800; }
.intro h1 { margin: 0; font-size: 40px; line-height: 1.2; letter-spacing: 0; text-wrap: balance; }
.intro > span { display: block; max-width: 620px; margin: 15px auto 0; color: var(--muted); font-size: 15px; line-height: 1.75; }

.workspace { overflow: hidden; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); box-shadow: 0 16px 48px rgb(24 24 27 / 6%); }
.workspace-tabs { display: flex; gap: 6px; padding: 12px 14px 0; border-bottom: 1px solid var(--line); background: #fcfcfc; }
.mode-tab { min-height: 40px; padding: 0 16px; border: 0; border-radius: 8px 8px 0 0; background: transparent; color: var(--muted); font-size: 14px; font-weight: 700; }
.mode-tab:hover { background: var(--soft); color: var(--ink); }
.mode-tab.is-active { background: var(--ink); color: #ffffff; }
.workspace-grid { display: grid; grid-template-columns: minmax(350px, 0.9fr) minmax(430px, 1.1fr); min-height: 690px; }
.creation-panel { padding: 26px; border-right: 1px solid var(--line); }
.upload-block { margin-bottom: 22px; }
.field-heading { display: flex; justify-content: space-between; gap: 16px; margin-bottom: 10px; }
.field-heading h2 { margin: 0; font-size: 15px; }
.field-heading p { margin: 4px 0 0; color: var(--muted); font-size: 12px; }
.field-heading > span { align-self: start; color: #2563eb; font-size: 12px; font-weight: 800; white-space: nowrap; }
.upload-zone { position: relative; display: grid; min-height: 128px; place-content: center; justify-items: center; gap: 5px; overflow: hidden; border: 1px dashed #c4c4cc; border-radius: 10px; background: #fcfcfc; color: var(--muted); text-align: center; transition: border-color 180ms ease, background 180ms ease; }
.upload-zone:hover, .upload-zone.is-dragging { border-color: #52525b; background: var(--soft); }
.upload-zone strong { color: #3f3f46; font-size: 13px; }
.upload-zone small { font-size: 11px; }
.upload-icon { display: grid; width: 28px; height: 28px; place-items: center; border-radius: 8px; background: #e4e4e7; color: #3f3f46; font-size: 18px; font-weight: 700; }
.reference-zone, .product-zone { cursor: pointer; }
.reference-zone.has-preview { min-height: 184px; }
.reference-zone.has-preview .upload-icon, .reference-zone.has-preview strong, .reference-zone.has-preview small { display: none; }
#reference-preview { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.product-zone { min-height: 102px; }
.file-strip { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 9px; }
.file-chip { position: relative; width: 56px; height: 56px; overflow: hidden; border: 1px solid var(--line); border-radius: 8px; background: var(--soft); }
.file-chip img { width: 100%; height: 100%; object-fit: cover; }
.file-chip button { position: absolute; top: 3px; right: 3px; width: 18px; height: 18px; padding: 0; border: 0; border-radius: 50%; background: rgb(24 24 27 / 80%); color: #ffffff; font-size: 13px; line-height: 1; }

.prompt-field { position: relative; display: block; margin: 24px 0 18px; }
.prompt-field > span { display: block; font-size: 15px; font-weight: 700; }
.prompt-field em { margin-left: 5px; color: var(--muted); font-size: 12px; font-style: normal; font-weight: 400; }
.prompt-field textarea { width: 100%; min-height: 86px; margin-top: 10px; padding: 11px 12px 24px; resize: vertical; border: 1px solid var(--line); border-radius: 9px; outline: 0; color: var(--ink); background: #ffffff; font-size: 13px; line-height: 1.6; }
.prompt-field textarea:focus, .settings-grid select:focus { border-color: #71717a; box-shadow: 0 0 0 3px rgb(24 24 27 / 8%); }
.prompt-field small { position: absolute; right: 10px; bottom: 8px; color: var(--muted); font-size: 11px; }
.prompt-field b { font-weight: 500; }
.settings-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.settings-grid label { display: grid; gap: 6px; color: #52525b; font-size: 12px; font-weight: 700; }
.settings-grid select { width: 100%; min-height: 38px; padding: 0 9px; border: 1px solid var(--line); border-radius: 7px; outline: 0; background: #ffffff; color: var(--ink); font-size: 12px; }
.speed-settings { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin: 22px 0; padding: 13px; border: 1px solid var(--line); border-radius: 10px; background: #fafafa; }
.speed-settings p { margin: 0; font-size: 13px; font-weight: 800; }
.speed-settings small { display: block; max-width: 190px; margin-top: 3px; color: var(--muted); font-size: 11px; line-height: 1.45; }
.speed-options { display: flex; flex: 0 0 auto; overflow: hidden; border: 1px solid var(--line); border-radius: 7px; background: #ffffff; }
.speed-option { min-height: 30px; padding: 0 8px; border: 0; border-left: 1px solid var(--line); background: #ffffff; color: var(--muted); font-size: 11px; font-weight: 700; }
.speed-option:first-child { border-left: 0; }
.speed-option.is-active { background: var(--ink); color: #ffffff; }
.generate-button { display: flex; width: 100%; min-height: 48px; align-items: center; justify-content: center; gap: 8px; border: 0; border-radius: 9px; background: var(--ink); color: #ffffff; font-size: 14px; font-weight: 800; transition: transform 180ms ease, background 180ms ease; }
.generate-button:not(:disabled):hover { background: #3f3f46; transform: translateY(-1px); }
.generate-button:disabled { background: #d4d4d8; color: #71717a; }
.cost-note { margin: 10px 0 0; color: var(--muted); font-size: 11px; text-align: center; }

.result-panel { display: flex; flex-direction: column; padding: 26px; background: #fafafa; }
.result-panel header { display: flex; align-items: center; justify-content: space-between; }
.result-panel header > div { display: flex; align-items: center; gap: 8px; }
.result-panel header span { display: grid; width: 28px; height: 28px; place-items: center; border-radius: 8px; background: #e5f3ff; color: #2563eb; }
.result-panel h2 { margin: 0; font-size: 16px; }
#result-state { color: var(--muted); font-size: 12px; }
.result-empty, .result-loading { display: grid; flex: 1; min-height: 570px; place-content: center; justify-items: center; color: var(--muted); text-align: center; }
.empty-mark { display: grid; width: 54px; height: 54px; margin-bottom: 14px; place-items: center; border: 1px solid var(--line); border-radius: 50%; background: #ffffff; color: #2563eb; font-size: 24px; }
.result-empty p { margin: 0; font-size: 14px; line-height: 1.8; }
.result-loading p { margin: 16px 0 4px; color: var(--ink); font-size: 14px; font-weight: 800; }
.result-loading small { max-width: 240px; font-size: 12px; line-height: 1.6; }
.loading-ring { width: 34px; height: 34px; border: 3px solid #e4e4e7; border-top-color: var(--ink); border-radius: 50%; animation: spin 850ms linear infinite; }
.result-ready { display: flex; flex: 1; flex-direction: column; justify-content: center; width: 100%; max-width: 470px; margin: auto; }
.generated-output-gallery { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; max-height: 570px; overflow-y: auto; padding: 2px; }
.generated-output-gallery:has(> :only-child) { grid-template-columns: 1fr; }
.generated-art { position: relative; aspect-ratio: 3 / 4; overflow: hidden; border: 1px solid var(--line); border-radius: 10px; background: #ffffff; box-shadow: 0 15px 32px rgb(24 24 27 / 10%); }
.generated-output-image { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.generated-art a { position: absolute; right: 8px; bottom: 8px; display: grid; width: 30px; height: 30px; place-items: center; border-radius: 7px; background: rgb(24 24 27 / 82%); color: #ffffff; font-size: 15px; }
.generated-art a:hover { background: var(--ink); }
.result-actions { display: flex; gap: 10px; margin-top: 14px; }
.result-actions button { flex: 1; min-height: 43px; border-radius: 8px; font-size: 13px; font-weight: 800; }
#regenerate-button { border: 1px solid var(--line); background: #ffffff; color: #3f3f46; }
#download-button { border: 1px solid var(--ink); background: var(--ink); color: #ffffff; }

.feature-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; padding: 36px 0 70px; }
.feature-row article { padding: 22px; border: 1px solid var(--line); border-radius: 12px; background: #ffffff; }
.feature-row span { display: grid; width: 34px; height: 34px; place-items: center; border-radius: 8px; background: var(--soft); font-size: 17px; }
.feature-row h2 { margin: 16px 0 7px; font-size: 16px; }
.feature-row p { margin: 0; color: var(--muted); font-size: 13px; line-height: 1.7; }
.visually-hidden { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
.result-empty[hidden], .result-loading[hidden], .result-ready[hidden] { display: none !important; }
:focus-visible { outline: 3px solid #a3e635; outline-offset: 2px; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { scroll-behavior: auto !important; animation-duration: 1ms !important; transition-duration: 1ms !important; } }
@media (max-width: 900px) { .workspace-grid { grid-template-columns: 1fr; } .creation-panel { border-right: 0; border-bottom: 1px solid var(--line); } .result-empty, .result-loading { min-height: 400px; } }
@media (max-width: 620px) { .app-header { height: 62px; padding: 0 16px; } .header-title { display: none; } main { width: min(100% - 24px, 1220px); } .intro { margin: 40px auto 24px; } .intro h1 { font-size: 30px; } .workspace-tabs { overflow-x: auto; } .mode-tab { flex: 0 0 auto; } .creation-panel, .result-panel { padding: 18px; } .settings-grid, .feature-row { grid-template-columns: 1fr; } .generated-output-gallery { max-height: none; } .speed-settings { flex-direction: column; align-items: flex-start; } .speed-options { width: 100%; } .speed-option { flex: 1; } .feature-row { padding: 22px 0 40px; } }
