:root {
  --bg: #12101a;
  --panel: #1c1927;
  --card: #241f33;
  --line: #352e47;
  --line-soft: #2c2640;
  --text: #ece8f5;
  --muted: #a096b8;
  --accent: #d94f8a;
  --accent-2: #7c5cff;
  --radius: 12px;
  --gap: 20px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: radial-gradient(1200px 600px at 20% -10%, #2a1d3d 0%, var(--bg) 60%);
  color: var(--text);
  font-family: "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
  min-height: 100vh;
  font-size: 14px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

/* ---------- 顶栏 ---------- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  background: #17142599;
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line-soft);
}

.topbar-inner {
  position: relative;
  max-width: 844px;
  margin: 0 auto;
  padding: 16px 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 20px;
}

.brand {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  text-align: center;
}

.topbar h1 {
  margin: 0;
  font-size: 32px;
  font-weight: 800;
  letter-spacing: 4px;
  text-indent: 4px;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  line-height: 1.3;
  text-shadow: 0 0 24px rgba(124, 92, 255, .28);
}

.tagline {
  margin: 0;
  font-size: 13.5px;
  letter-spacing: 1px;
  color: var(--muted);
}

.warn {
  position: absolute;
  right: 32px;
  top: 50%;
  transform: translateY(-50%);
  padding: 10px 14px;
  border-radius: 8px;
  background: #3a2a12;
  border: 1px solid #7a5a1e;
  color: #f3d69a;
  font-size: 13px;
}
.warn code { background: #00000055; padding: 1px 5px; border-radius: 4px; }

/* ---------- 主布局 ---------- */
.wrap {
  display: grid;
  grid-template-columns: minmax(0, 780px);
  justify-content: center;
  gap: 24px;
  max-width: 100%;
  margin: 0 auto;
  padding: 24px 32px 56px;
  align-items: start;
}

.panel { min-width: 0; width: 100%; }

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px 22px;
  margin-bottom: var(--gap);
}

.card h2 {
  margin: 0 0 14px;
  font-size: 16px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 8px;
}

.card > *:last-child { margin-bottom: 0; }

.req, .opt {
  font-size: 11px;
  font-weight: 500;
  padding: 2px 7px;
  border-radius: 999px;
}
.req { background: #4a1f30; color: #f6a8c6; }
.opt { background: #2e2a3f; color: var(--muted); }

.drop {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 150px;
  padding: 14px;
  border: 1.5px dashed #4a4066;
  border-radius: var(--radius);
  background: #1e1a2b;
  cursor: pointer;
  text-align: center;
  transition: border-color .15s, background .15s;
}
.drop:hover, .drop.over { border-color: var(--accent); background: #241d33; }
.drop.dim { opacity: .5; pointer-events: none; }

/* 缺失素材的高亮提示：点击「开始换装」但还没上传时出现 */
.drop.missing {
  border-color: #e05a5a;
  background: #2a1c24;
  animation: missingPulse 1.1s ease-in-out 2;
}

@keyframes missingPulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(224, 90, 90, 0); }
  50% { box-shadow: 0 0 0 3px rgba(224, 90, 90, .22); }
}

textarea.missing {
  border-color: #e05a5a;
  box-shadow: 0 0 0 3px rgba(224, 90, 90, .18);
}
.drop-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  width: 100%;
}
.drop-ph { display: flex; flex-direction: column; gap: 5px; }
.drop-text { font-size: 14px; }
.drop-ph .hint { margin: 0; }

.hint { color: var(--muted); font-size: 12px; margin: 8px 0 0; line-height: 1.65; }

.preview { display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; }
.preview img {
  max-width: 100%;
  max-height: 150px;
  width: auto;
  height: auto;
  object-fit: contain;
  border-radius: 10px;
  border: 1px solid var(--line);
}

.drop .preview:empty { display: none; }
.drop:has(.preview img) { min-height: 0; }
.drop:has(.preview img) .drop-ph { display: none; }

.preview { position: relative; }

.clear-btn {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  border: 1px solid #4a4066;
  background: #1a1726e6;
  color: var(--muted);
  font-size: 17px;
  line-height: 1;
  cursor: pointer;
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 2;
  padding: 0 0 2px;
}

.preview:has(img) .clear-btn { display: flex; }
.clear-btn:hover { background: var(--accent); color: #fff; border-color: var(--accent); }

.check { display: flex; align-items: center; gap: 8px; font-size: 14px; margin-bottom: 12px; }
.check input { width: 16px; height: 16px; accent-color: var(--accent); }

.modes { display: flex; flex-direction: column; gap: 9px; }

.mode {
  display: flex;
  align-items: flex-start;
  gap: 11px;
  padding: 13px 15px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: #1e1a2b;
  cursor: pointer;
  transition: border-color .15s, background .15s;
}

.mode:hover { border-color: #4a4066; }

.mode input {
  width: 17px;
  height: 17px;
  margin: 1px 0 0;
  flex-shrink: 0;
  accent-color: var(--accent);
}

.mode-body { display: flex; flex-direction: column; gap: 4px; }
.mode-title { font-size: 14px; font-weight: 600; }
.mode-desc { font-size: 12px; color: var(--muted); line-height: 1.5; }

.mode:has(input:checked) {
  border-color: var(--accent);
  background: #2a2033;
}

.mode-panel { margin-top: 16px; }
.mode-panel textarea { margin-top: 14px; }

textarea, select {
  width: 100%;
  background: #1a1726;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--text);
  padding: 11px 13px;
  font-size: 14px;
  font-family: inherit;
  resize: vertical;
  line-height: 1.6;
}
textarea:focus, select:focus { outline: 1px solid var(--accent-2); border-color: var(--accent-2); }

.field {
  display: grid;
  grid-template-columns: 88px minmax(0, 1fr);
  align-items: center;
  gap: 16px;
  font-size: 14px;
}
.field select { width: 100%; }

.btn {
  margin-top: 16px;
  width: 100%;
  padding: 12px;
  border: none;
  border-radius: var(--radius);
  font-size: 15px;
  font-weight: 600;
  color: #fff;
  cursor: pointer;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  transition: filter .15s;
}
.btn:hover { filter: brightness(1.1); }
.btn:disabled { opacity: .55; cursor: progress; }

/* ---------- CDK 兑换区 ---------- */
.cdk-box {
  margin-top: 20px;
  padding: 16px 16px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #1e1a2b;
}

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

.cdk-head h3 {
  margin: 0;
  font-size: 14px;
  font-weight: 600;
}

.cdk-buy {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  border-radius: 8px;
  border: 1px solid var(--accent);
  background: #2a2033;
  color: #f6a8c6;
  font-size: 12.5px;
  font-weight: 600;
  text-decoration: none;
  white-space: nowrap;
  transition: background .15s, color .15s;
}

.cdk-buy:hover { background: var(--accent); color: #fff; }

.cdk-buy::before {
  content: "→";
  font-size: 13px;
  line-height: 1;
}

.cdk-input-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 10px;
}

.cdk-input-row input {
  background: #1a1726;
  border: 1px solid var(--line);
  border-radius: 10px;
  color: var(--text);
  padding: 10px 13px;
  font-size: 13.5px;
  font-family: inherit;
  letter-spacing: .5px;
  min-width: 0;
}

.cdk-input-row input:focus {
  outline: 1px solid var(--accent-2);
  border-color: var(--accent-2);
}

.btn-cdk {
  padding: 10px 22px;
  border: 1px solid var(--accent);
  border-radius: 10px;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  color: #fff;
  font-size: 13.5px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  white-space: nowrap;
  transition: filter .15s;
}

.btn-cdk:hover { filter: brightness(1.1); }
.btn-cdk:disabled { opacity: .55; cursor: default; }

.cdk-state { margin-top: 12px; }

.cdk-ok {
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding: 10px 13px;
  border-radius: 10px;
  background: #1d2f26;
  border: 1px solid #2f6b4f;
  font-size: 13.5px;
}

.cdk-ok strong {
  color: #6fdca6;
  font-size: 17px;
  font-weight: 700;
}

.cdk-sub { color: var(--muted); font-size: 11.5px; }

.cdk-none {
  padding: 10px 13px;
  border-radius: 10px;
  background: #2a2033;
  border: 1px solid #4a4066;
  color: var(--muted);
  font-size: 12.5px;
}

.cdk-box .hint { margin: 8px 0 0; }
.cdk-msg-err { color: #e07a6a; }
.cdk-msg-ok { color: #6fdca6; }

.disclaimer-box {
  margin-top: 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #1e1a2b;
  overflow: hidden;
}

.disclaimer-box > summary {
  padding: 11px 14px;
  font-size: 14px;
  cursor: pointer;
  user-select: none;
  list-style: none;
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 600;
}

.disclaimer-box > summary::-webkit-details-marker { display: none; }
.disclaimer-box > summary::before {
  content: "▸";
  color: var(--accent);
  font-size: 12px;
}
.disclaimer-box[open] > summary::before { content: "▾"; }
.disclaimer-box > summary:hover { color: var(--accent); }

.disclaimer {
  padding: 4px 16px 16px;
  border-top: 1px solid var(--line);
  max-height: 340px;
  overflow-y: auto;
}

.disclaimer h3 {
  margin: 14px 0 10px;
  font-size: 14px;
  color: var(--accent);
}

.disclaimer-lead {
  margin: 0 0 12px;
  font-size: 13px;
  line-height: 1.7;
  color: var(--text);
}

.disclaimer-list {
  margin: 0;
  padding-left: 20px;
  font-size: 12.5px;
  line-height: 1.75;
  color: var(--muted);
}

.disclaimer-list li { margin-bottom: 9px; }
.disclaimer-list strong { color: var(--text); font-weight: 600; }

.disclaimer-foot {
  margin: 12px 0 0;
  font-size: 12px;
  color: var(--muted);
  padding-top: 10px;
  border-top: 1px dashed var(--line);
}

.agree {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  margin-top: 14px;
  padding: 11px 12px;
  border-radius: var(--radius);
  background: #241f33;
  border: 1px solid var(--line);
  font-size: 12.5px;
  line-height: 1.65;
  color: var(--muted);
  cursor: pointer;
}

.agree:hover { border-color: #4a4066; }
.agree input {
  width: 16px;
  height: 16px;
  margin: 2px 0 0;
  flex-shrink: 0;
  accent-color: var(--accent);
}
.agree.checked { border-color: var(--accent); background: #2a2033; color: var(--text); }

.result-box {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 14px;
  min-height: 420px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}
.result-box img { max-width: 100%; max-height: 72vh; border-radius: 10px; }
.empty { color: var(--muted); font-size: 14px; }

.result-box { position: relative; }

.ttl-notice {
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding: 11px 14px;
  margin-bottom: 16px;
  border-radius: var(--radius);
  background: #3a2a12;
  border: 1px solid #7a5a1e;
}

.ttl-notice strong { font-size: 13px; color: #f3d69a; }
.ttl-notice span { font-size: 12px; color: #c9a86a; }

.result-actions {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
  margin-top: 12px;
}

.result-actions .hint { margin: 0; }

.btn-download {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 9px 18px;
  border-radius: 9px;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  color: #fff;
  font-size: 13.5px;
  font-weight: 600;
  text-decoration: none;
  transition: filter .15s;
}

.btn-download:hover { filter: brightness(1.1); }

.btn-download::before {
  content: "↓";
  font-size: 15px;
  line-height: 1;
}

.loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  padding: 30px 20px;
}

.spinner {
  width: 54px;
  height: 54px;
  border-radius: 50%;
  border: 3px solid #3a3350;
  border-top-color: var(--accent);
  animation: spin 0.9s linear infinite;
}

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

.loading-text { font-size: 14px; color: var(--text); }
.loading-sub { font-size: 12px; color: var(--muted); }

.progress {
  width: 100%;
  max-width: 280px;
  height: 4px;
  border-radius: 999px;
  background: #322b45;
  overflow: hidden;
}

.progress-bar {
  height: 100%;
  width: 40%;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  animation: slide 1.4s ease-in-out infinite;
}

@keyframes slide {
  0% { transform: translateX(-100%); }
  100% { transform: translateX(250%); }
}

.history {
  margin-top: 0;
  background: #1e1a2b;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px 16px;
  overflow: hidden;
}

.result-card { padding: 18px 20px; }

.result-card .history-list {
  grid-template-columns: repeat(auto-fill, minmax(128px, 1fr));
}

.history > summary {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  user-select: none;
  list-style: none;
}

.history > summary::-webkit-details-marker { display: none; }

.history > summary::before {
  content: "▸";
  color: var(--accent);
  font-size: 12px;
}

.history[open] > summary::before { content: "▾"; }
.history > summary:hover { color: var(--accent); }

.history-count {
  margin-left: auto;
  font-size: 12px;
  font-weight: 400;
  color: var(--muted);
}

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

.history h2 {
  margin: 0 0 14px;
  font-size: 15px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 8px;
}

.history-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(104px, 1fr));
  gap: 12px;
}

.history-item { margin: 0; }

.history-thumb { position: relative; }

.history-thumb > a {
  display: block;
  border-radius: 9px;
  overflow: hidden;
  border: 1px solid var(--line);
  background: #1a1726;
  aspect-ratio: 3 / 4;
}

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

.history-thumb > a:hover { border-color: var(--accent); }

.history-del {
  position: absolute;
  top: 5px;
  right: 5px;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  border: 1px solid #4a4066;
  background: #1a1726e6;
  color: var(--muted);
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 0 2px;
}

.history-del:hover { background: #c0392b; color: #fff; border-color: #c0392b; }
.history-del:disabled { opacity: .5; cursor: default; }

.history-dl {
  display: block;
  margin-top: 7px;
  padding: 5px 0;
  border-radius: 7px;
  border: 1px solid var(--line);
  background: #241f33;
  color: var(--muted);
  font-size: 11.5px;
  text-align: center;
  text-decoration: none;
  transition: color .15s, border-color .15s;
}

.history-dl:hover {
  color: var(--accent);
  border-color: var(--accent);
}

.history-dl::before { content: "↓ "; }

/* ---------- 底部效果示例 ---------- */
.showcase {
  border-top: 1px solid var(--line);
  margin-top: 8px;
  padding: 36px 24px 56px;
}

.showcase-inner {
  max-width: 780px;
  margin: 0 auto;
  text-align: center;
}

.showcase-title {
  margin: 0 0 8px;
  font-size: 20px;
  font-weight: 700;
  letter-spacing: 2px;
}

.showcase-desc {
  margin: 0 0 22px;
  font-size: 13px;
  color: var(--muted);
}

.showcase-card {
  margin: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--card);
  box-shadow: 0 18px 44px rgba(0, 0, 0, .42);
}

.showcase-card img {
  display: block;
  width: 100%;
  height: auto;
}

/* ---------- 页脚 ---------- */
.site-foot {
  border-top: 1px solid var(--line);
  padding: 28px 24px 44px;
}

.foot-inner {
  max-width: 780px;
  margin: 0 auto;
  text-align: center;
}

.foot-title {
  margin: 0 0 6px;
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
}

.foot-contact {
  margin: 0 0 12px;
  font-size: 15px;
}

.foot-contact a {
  color: var(--accent);
  text-decoration: none;
  border-bottom: 1px solid rgba(217, 79, 138, .45);
}

.foot-contact a:hover { border-bottom-color: var(--accent); }

.foot-note {
  margin: 0;
  font-size: 12px;
  color: var(--muted);
  line-height: 1.7;
}

@media (max-width: 900px) {
  .wrap { grid-template-columns: 1fr; padding: 16px 16px 40px; }
  .topbar-inner { padding: 14px 16px; }
  .topbar h1 { font-size: 24px; letter-spacing: 3px; text-indent: 3px; }
  .tagline { font-size: 12.5px; }
  .warn { position: static; transform: none; margin-top: 10px; }
  .showcase { padding: 28px 16px 40px; }
  .showcase-title { font-size: 17px; }
}

@media (min-width: 901px) {
  .panel.result { margin-top: 4px; }
}

/* ---------- 生成全屏浮层 ---------- */
body.locked { overflow: hidden; }

.overlay {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: rgba(14, 12, 20, .94);
  backdrop-filter: blur(6px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.overlay[hidden] { display: none; }

.overlay-inner {
  width: 100%;
  max-width: 560px;
  max-height: 100%;
  overflow-y: auto;
  display: flex;
  justify-content: center;
}

.gen {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 15px;
  padding: 40px 26px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 18px;
  text-align: center;
  width: 100%;
}

.gen-title { font-size: 20px; font-weight: 600; }
.gen-fail { color: #e07a6a; }
.gen-reject { color: #f3b95a; }
.gen-tip { font-size: 13px; color: var(--muted); line-height: 1.6; }
.gen-sec { font-size: 12px; color: #6f6688; }
.gen-note { font-size: 11.5px; color: #6f6688; }

.gen .progress { max-width: 300px; }

.btn-cancel, .btn-close-done {
  margin-top: 6px;
  padding: 10px 26px;
  border-radius: 9px;
  border: 1px solid var(--line);
  background: #241f33;
  color: var(--text);
  font-size: 13.5px;
  cursor: pointer;
  transition: border-color .15s, background .15s;
}

.btn-cancel:hover { border-color: var(--accent); background: #2a2033; }

.done {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 13px;
  padding: 26px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 18px;
  width: 100%;
}

.done-head { font-size: 19px; font-weight: 600; color: var(--accent); }

.done-img {
  width: 100%;
  max-height: 58vh;
  border-radius: 12px;
  overflow: hidden;
  background: #1a1726;
  display: flex;
  justify-content: center;
}

.done-img img {
  max-width: 100%;
  max-height: 58vh;
  object-fit: contain;
  display: block;
}

.done-meta { font-size: 12px; color: var(--muted); }
.done-tip { font-size: 12px; color: #c9a86a; }

.btn-again {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 9px 18px;
  border-radius: 9px;
  border: 1px solid #4a4166;
  background: #241f38;
  color: var(--text);
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
  transition: border-color .15s, background .15s;
}

.btn-again:hover:not(:disabled) {
  border-color: var(--accent);
  background: #2c2545;
}

.btn-again:disabled { opacity: .6; cursor: default; }

.btn-again::before {
  content: "↻";
  font-size: 15px;
  line-height: 1;
}
