:root {
  color-scheme: light;
  --ink: #202039;
  --muted: #68667d;
  --purple: #6c4bff;
  --pink: #ff579b;
  --mint: #48d8c1;
  --paper: #fffdfd;
  --lavender: #f0edff;
  --border: #e4e0f1;
  --shadow: 0 24px 65px rgba(61, 39, 135, 0.14);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  min-width: 320px;
  color: var(--ink);
  background: linear-gradient(180deg, #fbf9ff 0, #fff 34rem, #fff9fc 100%);
  font-family: Inter, "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
}
a { color: inherit; text-decoration: none; }
button, input { font: inherit; }
button { cursor: pointer; }

.site-header {
  width: min(1180px, calc(100% - 40px));
  min-height: 82px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  margin: 0 auto;
}
.brand { display: inline-flex; align-items: center; gap: 9px; font-size: 1.3rem; font-weight: 850; letter-spacing: -0.06em; }
.brand img { border-radius: 13px; object-fit: cover; box-shadow: 0 7px 16px rgba(105, 76, 255, 0.24); }
.brand-accent { color: var(--pink); }
nav { display: flex; align-items: center; gap: 30px; font-size: 0.94rem; font-weight: 650; color: var(--muted); }
nav a:hover { color: var(--purple); }
.header-action { padding: 11px 16px; border: 1px solid #d8d1ff; border-radius: 999px; color: var(--purple); font-size: .9rem; font-weight: 750; }

.hero {
  width: min(1180px, calc(100% - 40px));
  display: grid;
  grid-template-columns: minmax(0, .72fr) minmax(0, 1.28fr);
  align-items: center;
  gap: clamp(36px, 5vw, 72px);
  min-height: 510px;
  margin: 0 auto;
  padding: 44px 0 72px;
}
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
.eyebrow { margin: 0 0 12px; color: var(--purple); font-size: .75rem; font-weight: 850; letter-spacing: .14em; text-transform: uppercase; }
h1, h2, h3, p { margin-top: 0; }
h1 { max-width: 680px; margin-bottom: 21px; font-size: clamp(2.7rem, 5.2vw, 5rem); line-height: .99; letter-spacing: -.085em; }
h1 em { color: var(--purple); font-style: normal; }
.hero-description { max-width: 500px; color: var(--muted); font-size: 1.1rem; line-height: 1.8; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 13px; margin-top: 29px; }
.button { min-height: 45px; display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 11px 18px; border: 1px solid transparent; border-radius: 13px; font-weight: 750; transition: transform .18s ease, box-shadow .18s ease, background .18s ease; }
.button:hover { transform: translateY(-2px); }
.button-primary { color: #fff; background: linear-gradient(135deg, var(--purple), #8b6dff 70%, var(--pink)); box-shadow: 0 11px 23px rgba(101, 68, 245, .25); }
.button-primary:hover { box-shadow: 0 15px 29px rgba(101, 68, 245, .34); }
.button-quiet { border-color: var(--border); background: #fff; color: var(--ink); }
.hero-stats { display: flex; gap: clamp(18px, 4vw, 44px); margin: 48px 0 0; }
.hero-stats div { display: grid; gap: 5px; }
.hero-stats dt { font-size: 1.1rem; font-weight: 850; letter-spacing: -.05em; }
.hero-stats dd { margin: 0; color: var(--muted); font-size: .8rem; }
.hero-art { min-width: 0; display: flex; justify-content: flex-end; }
.hero-art img { width: min(100%, 640px); display: block; border-radius: 22px; box-shadow: 0 22px 48px rgba(74, 47, 146, .16); }

.creator-section, .how-section { width: min(1180px, calc(100% - 40px)); margin: 0 auto; padding: 88px 0; }
.section-heading { display: flex; align-items: end; justify-content: space-between; gap: 24px; margin-bottom: 30px; }
.section-heading h2 { margin-bottom: 0; font-size: clamp(2rem, 4vw, 3rem); letter-spacing: -.07em; }
.section-heading > p { max-width: 360px; margin-bottom: 4px; color: var(--muted); line-height: 1.65; }
.creator-grid { display: grid; grid-template-columns: minmax(220px, .42fr) minmax(0, 1fr); overflow: hidden; border: 1px solid var(--border); border-radius: 24px; background: #fff; box-shadow: var(--shadow); }
.template-panel { min-height: 635px; padding: 20px; border-right: 1px solid var(--border); background: linear-gradient(180deg, #faf9ff, #fff); }
.search-field { display: flex; align-items: center; gap: 8px; padding: 0 12px; border: 1px solid var(--border); border-radius: 12px; background: #fff; color: var(--purple); }
.search-field input { width: 100%; height: 42px; border: 0; outline: 0; background: transparent; color: var(--ink); }
.template-tools { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; margin-top: 10px; }
.template-filters { display: flex; min-width: 0; gap: 5px; }
.template-filters button, .category-filter select, .template-favorite { min-height: 32px; border: 1px solid var(--border); border-radius: 9px; background: #fff; color: #514c6b; font-size: .74rem; font-weight: 750; }
.template-filters button { min-width: 0; flex: 1; padding: 5px 7px; }
.template-filters button[aria-pressed="true"] { border-color: #a695ff; background: #f0edff; color: var(--purple); }
.category-filter select { max-width: 112px; padding: 5px 24px 5px 8px; outline: 0; }
.template-meta { display: flex; gap: 4px; margin: 17px 2px 10px; color: var(--muted); font-size: .78rem; }
.template-list { position: relative; max-height: 535px; overflow: auto; padding-right: 5px; }
.template-list-spacer { width: 1px; pointer-events: none; }
.template-list-rows { position: absolute; inset: 0 5px auto 0; }
.template-button { width: 100%; height: 56px; display: grid; align-content: center; gap: 3px; margin-bottom: 5px; padding: 8px 11px; border: 0; border-radius: 10px; background: transparent; color: #4d4a65; text-align: left; transition: background .16s ease, color .16s ease; }
.template-name { overflow: hidden; font-size: .86rem; font-weight: 700; text-overflow: ellipsis; white-space: nowrap; }
.template-key { overflow: hidden; color: #88839f; font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-size: .69rem; font-weight: 500; text-overflow: ellipsis; white-space: nowrap; }
.template-button[aria-selected="true"] .template-key { color: #765ce2; }
.template-button:hover, .template-button[aria-selected="true"] { background: #ece8ff; color: #5636dd; font-weight: 750; }
.template-empty { padding: 25px 10px; color: var(--muted); font-size: .9rem; text-align: center; }

.workbench { padding: clamp(22px, 4vw, 44px); background: radial-gradient(circle at 94% 3%, #f2eeff 0, transparent 24rem), #fff; }
.selected-template { display: grid; grid-template-columns: minmax(160px, 210px) 1fr; align-items: center; gap: 25px; padding-bottom: 26px; border-bottom: 1px solid var(--border); }
.preview-frame { position: relative; min-height: 150px; display: grid; place-items: center; overflow: hidden; border-radius: 17px; background: linear-gradient(135deg, #e2dcff, #ffe0ed); }
.preview-frame img { width: 100%; min-height: 150px; object-fit: cover; }
.preview-fallback { position: absolute; color: #675d94; font-size: .86rem; }
.template-summary h3, .result-heading h3 { margin-bottom: 7px; font-size: 1.55rem; letter-spacing: -.045em; }
.template-summary p:last-child { margin-bottom: 0; color: var(--muted); font-size: .9rem; line-height: 1.65; }
.template-favorite { margin-top: 13px; padding: 6px 10px; color: var(--purple); }
.template-favorite[aria-pressed="true"] { border-color: #b894ff; background: #f0edff; }
.template-favorite:disabled { cursor: not-allowed; opacity: .55; }
.generator-form { display: grid; gap: 24px; padding-top: 28px; }
fieldset { min-width: 0; margin: 0; padding: 0; border: 0; }
legend { margin-bottom: 11px; font-size: .98rem; font-weight: 800; }
legend span { color: var(--muted); font-size: .79rem; font-weight: 500; }
.upload-zone { min-height: 120px; display: grid; place-content: center; justify-items: center; gap: 7px; border: 1.5px dashed #c9c0f3; border-radius: 15px; background: #fbfaff; color: #635b83; text-align: center; cursor: pointer; transition: border-color .16s ease, background .16s ease; }
.upload-zone:hover, .upload-zone.dragging { border-color: var(--purple); background: #f2efff; }
.upload-zone strong { color: var(--purple); }
.upload-zone small { color: #88839f; }
.upload-icon { color: var(--purple); font-size: 1.7rem; line-height: 1; }
#imageInput { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0, 0, 0, 0); }
.field-note { min-height: 20px; margin: 8px 2px 0; color: var(--muted); font-size: .8rem; }
.local-image-previews { display: grid; grid-template-columns: repeat(auto-fill, minmax(94px, 1fr)); gap: 9px; margin-top: 11px; }
.local-image-preview { position: relative; min-width: 0; margin: 0; padding: 5px; border: 1px solid var(--border); border-radius: 11px; background: #fff; }
.local-image-preview img { display: block; width: 100%; aspect-ratio: 1; border-radius: 7px; background: #f5f2ff; object-fit: cover; }
.local-image-preview figcaption { overflow: hidden; margin-top: 5px; color: var(--muted); font-size: .68rem; text-align: center; text-overflow: ellipsis; white-space: nowrap; }
.local-image-remove { position: absolute; top: 9px; right: 9px; width: 23px; height: 23px; display: grid; place-items: center; padding: 0; border: 1px solid #fff; border-radius: 999px; background: rgba(43, 36, 75, .78); color: #fff; font-size: 1rem; line-height: 1; box-shadow: 0 2px 7px rgba(33, 28, 55, .2); }
.local-image-remove:hover { background: #c62d5f; }
.image-source-switch { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 12px; }
.image-source-option { display: inline-flex; align-items: center; gap: 6px; min-height: 34px; padding: 7px 10px; border: 1px solid var(--border); border-radius: 10px; color: #514c6b; font-size: .84rem; font-weight: 700; cursor: pointer; }
.image-source-option:has(input:checked) { border-color: #a695ff; background: #f1efff; color: var(--purple); }
.image-source-option input { accent-color: var(--purple); }
.qq-avatar-fields { padding: 14px; border: 1px solid #d9d2ff; border-radius: 15px; background: #fbfaff; }
.qq-avatar-note { margin: 0 0 12px; color: #635b83; font-size: .82rem; line-height: 1.65; }
.qq-avatar-inputs { display: grid; gap: 10px; }
.qq-avatar-slot { display: grid; gap: 6px; color: #514c6b; font-size: .82rem; font-weight: 750; }
.qq-role-label { margin-left: 4px; color: var(--purple); font-size: .72rem; }
.qq-avatar-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; }
.qq-avatar-row input { min-width: 0; min-height: 42px; padding: 9px 10px; border: 1px solid var(--border); border-radius: 10px; outline: 0; color: var(--ink); }
.qq-avatar-row input:focus { border-color: #9c88ff; box-shadow: 0 0 0 3px #eeeaff; }
.qq-role-button { min-height: 42px; padding: 8px 10px; border: 1px solid #d8d1ff; border-radius: 10px; background: #fff; color: var(--purple); font-size: .76rem; font-weight: 750; }
.qq-role-button[aria-pressed="true"] { border-color: var(--purple); background: #edeaff; }
.text-inputs { display: grid; gap: 9px; }
.text-input { width: 100%; min-height: 43px; padding: 10px 12px; border: 1px solid var(--border); border-radius: 11px; outline: 0; color: var(--ink); transition: border-color .16s ease, box-shadow .16s ease; }
.text-input:focus, .search-field:focus-within { border-color: #9c88ff; box-shadow: 0 0 0 3px #eeeaff; }
.text-add { margin-top: 10px; padding: 0; border: 0; background: transparent; color: var(--purple); font-size: .85rem; font-weight: 750; }
.form-actions { display: flex; align-items: center; justify-content: space-between; gap: 18px; padding-top: 4px; }
.form-status { margin: 0; color: var(--muted); font-size: .82rem; line-height: 1.5; }
.generation-actions { display: flex; flex-shrink: 0; align-items: center; gap: 9px; }
.cancel-generate { min-height: 42px; padding: 8px 13px; font-size: .82rem; }
.generate-button:disabled { cursor: not-allowed; opacity: .55; transform: none; box-shadow: none; }
.result-panel { margin-top: 35px; padding-top: 28px; border-top: 1px solid var(--border); }
.result-heading { display: flex; align-items: center; justify-content: space-between; gap: 20px; margin-bottom: 17px; }
.result-heading .eyebrow { margin-bottom: 6px; }
.result-heading h3 { margin: 0; }
.result-panel img { display: block; max-width: 100%; max-height: 680px; margin: 0 auto; border-radius: 14px; box-shadow: 0 16px 34px rgba(49, 39, 89, .17); }

.how-section { padding-top: 40px; padding-bottom: 98px; }
.steps { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; padding: 0; margin: 0; list-style: none; }
.steps li { min-height: 190px; padding: 25px; border: 1px solid var(--border); border-radius: 20px; background: #fff; }
.steps span { display: inline-grid; width: 36px; height: 29px; place-items: center; border-radius: 9px; background: #eeeaff; color: var(--purple); font-size: .76rem; font-weight: 850; }
.steps h3 { margin: 20px 0 7px; font-size: 1.18rem; letter-spacing: -.04em; }
.steps p { margin: 0; color: var(--muted); font-size: .9rem; line-height: 1.65; }
footer { width: min(1180px, calc(100% - 40px)); display: flex; align-items: center; justify-content: space-between; gap: 22px; margin: 0 auto; padding: 29px 0 34px; border-top: 1px solid var(--border); }
footer .brand { font-size: 1.05rem; } footer p { margin: 0; color: var(--muted); font-size: .78rem; }

@media (max-width: 1050px) {
  .hero { grid-template-columns: 1fr; gap: 34px; min-height: auto; padding-top: 38px; }
  .hero-copy { max-width: 620px; }
  .hero-art { order: -1; justify-content: center; }
  .hero-art img { max-width: 620px; }
}
@media (max-width: 820px) {
  .site-header { min-height: 70px; } nav { display: none; }
  .hero { padding-top: 35px; } .hero-art img { max-width: 460px; }
  .creator-grid { grid-template-columns: 1fr; } .template-panel { min-height: auto; border-right: 0; border-bottom: 1px solid var(--border); } .template-list { max-height: 260px; }
}
@media (max-width: 560px) {
  .site-header, .hero, .creator-section, .how-section, footer { width: min(100% - 28px, 1180px); }
  .header-action { display: none; } .hero { min-height: auto; padding-bottom: 55px; } h1 { font-size: clamp(2.5rem, 13vw, 3.8rem); } .hero-stats { gap: 16px; }
  .section-heading, .form-actions, footer { align-items: flex-start; flex-direction: column; } .creator-section { padding-top: 58px; } .workbench { padding: 20px; }
  .selected-template { grid-template-columns: 1fr; } .preview-frame { max-height: 200px; } .preview-frame img { max-height: 200px; }
  .template-tools { grid-template-columns: 1fr; } .category-filter select { max-width: none; width: 100%; } .steps { grid-template-columns: 1fr; } .result-heading { align-items: flex-start; flex-direction: column; }
  .local-image-previews { grid-template-columns: repeat(auto-fill, minmax(82px, 1fr)); }
  .qq-avatar-row { grid-template-columns: 1fr; } .qq-role-button { justify-self: start; } .generation-actions { width: 100%; } .generation-actions .button { flex: 1; }
}
