@font-face {
  font-family: 'YJ Serif';
  src: url('../assets/fonts/serif-black.woff2') format('woff2');
  font-weight: 100 900;
  font-display: swap;
}
@font-face {
  font-family: 'YJ Hand';
  src: url('../assets/fonts/hand.woff2') format('woff2');
  font-weight: 100 900;
  font-display: swap;
}

:root {
  --red: #B3121F;
  --red-dark: #9E0B22;
  --red-darker: #7A0819;
  --gold: #D4A64A;
  --cream: #FFF4DC;
  --ground: #FBF6EE;
  --ink: #2A1A14;
  --ink-2: #4A3A30;
  --muted: #6B5A4E;
  --muted-2: #75665B;
  --line: #EADFCF;
  --line-2: #D8CBB9;
  --stage: #2A1A14;
  --serif: 'YJ Serif', 'Noto Serif SC', 'Source Han Serif SC', 'Songti SC', 'STSong', serif;
  --sans: -apple-system, BlinkMacSystemFont, 'PingFang SC', 'Hiragino Sans GB', 'Noto Sans SC', 'Microsoft YaHei', sans-serif;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

html, body {
  margin: 0;
  background: var(--ground);
  color: var(--ink);
  font-family: var(--sans);
  -webkit-text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
}

.wx-thumb { position: absolute; width: 0; height: 0; opacity: 0; pointer-events: none; }

.app {
  max-width: 480px;
  margin: 0 auto;
  min-height: 100vh;
  min-height: 100dvh;
}

.screen {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  padding-bottom: env(safe-area-inset-bottom);
}

.spacer { flex: 1 1 auto; min-height: 20px; }

/* ---------- 按钮 ---------- */
.btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 56px;
  border-radius: 28px;
  border: 0;
  font: 700 18px var(--sans);
  text-decoration: none;
  cursor: pointer;
}
.btn-primary { background: var(--red); color: #fff; }
.btn-primary:active { background: var(--red-dark); }
.btn-outline { background: transparent; color: var(--red); border: 1.5px solid var(--red); height: 52px; font-size: 16px; }
.btn-ghost { background: transparent; color: var(--cream); border: 1.5px solid var(--cream); height: 52px; font-size: 16px; }
.btn-text {
  background: none;
  border: 0;
  height: 44px;
  font: 500 15px var(--sans);
  color: var(--red-dark);
  cursor: pointer;
}
.btn-narrow { width: 120px; flex: 0 0 auto; }

.cta-block {
  padding: 0 24px 16px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

/* ---------- 落地页 ---------- */
.hero { padding: 32px 24px 0; display: flex; flex-direction: column; gap: 10px; }
.kicker { font-size: 13px; font-weight: 500; color: var(--red-dark); letter-spacing: 2px; }
.hero-title { margin: 0; font-family: var(--serif); font-weight: 900; font-size: 34px; line-height: 1.25; }
.hero-title .hl { color: var(--red); }
.hero-sub { margin: 0; font-size: 15px; line-height: 1.6; color: var(--muted); }

.hero-preview { display: flex; flex-direction: column; align-items: center; gap: 8px; padding-top: 24px; }
.hero-preview canvas { width: 240px; height: 240px; }
.caption { font-size: 12px; color: var(--muted-2); }

.thumb-row { display: flex; justify-content: center; gap: 8px; padding: 20px 16px 0; }
.thumb { flex: 0 1 52px; min-width: 0; display: flex; flex-direction: column; align-items: center; gap: 6px; font-size: 11px; color: var(--muted); white-space: nowrap; }
.thumb canvas { width: 100%; max-width: 52px; aspect-ratio: 1; height: auto; border-radius: 10px; }

.privacy {
  margin: 4px 0 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font-size: 12px;
  color: var(--muted);
}

.sponsor-bar {
  margin-top: 8px;
  padding: 14px 24px 22px;
  border-top: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  font-size: 12px;
  color: var(--muted);
}
.sponsor-bar .left { display: flex; align-items: center; gap: 8px; }
.sponsor-bar img { width: 28px; height: 28px; border-radius: 6px; object-fit: contain; }
.sponsor-bar b { color: var(--ink); }
.sponsor-bar a { color: var(--red-dark); text-decoration: none; white-space: nowrap; }
.ad-tag {
  font-size: 10px;
  color: var(--muted-2);
  border: 1px solid var(--line-2);
  border-radius: 3px;
  padding: 0 3px;
  line-height: 14px;
  white-space: nowrap;
  flex: 0 0 auto;
}

/* ---------- 编辑页 ---------- */
.topbar { height: 52px; padding: 0 16px; display: flex; align-items: center; justify-content: space-between; }
.topbar-btn {
  min-width: 88px;
  height: 44px;
  display: flex;
  align-items: center;
  background: none;
  border: 0;
  padding: 0;
  font: 15px var(--sans);
  color: var(--red-dark);
  cursor: pointer;
}
.topbar-title { font-size: 16px; font-weight: 700; }

.stage {
  background: var(--stage);
  padding: 30px 0 16px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
}
.stage canvas {
  width: 300px;
  height: 300px;
  outline: 1px dashed rgba(255, 244, 220, 0.5);
  outline-offset: 6px;
  touch-action: none;
  cursor: grab;
}
.stage-hint { font-size: 12px; color: #D9CFC4; }

.section-label { padding: 20px 20px 10px; font-size: 15px; font-weight: 700; }

.style-row { padding: 0 16px; display: flex; justify-content: space-between; gap: 6px; }
.style-btn {
  flex: 1 1 0;
  min-width: 0;
  max-width: 62px;
  white-space: nowrap;
  padding: 0;
  border: 0;
  background: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  font: 12px var(--sans);
  color: var(--muted);
}
.style-btn .ring {
  width: 100%;
  aspect-ratio: 1;
  padding: 2px;
  border-radius: 12px;
  border: 2.5px solid transparent;
}
.style-btn canvas { width: 100%; height: 100%; border-radius: 9px; display: block; }
.style-btn[aria-checked="true"] { color: var(--red); font-weight: 700; }
.style-btn[aria-checked="true"] .ring { border-color: var(--red); }

.style-extra { padding: 16px 20px 0; min-height: 96px; }
.extra-desc { font-size: 13px; line-height: 1.6; color: var(--muted); }
.style-extra label { display: block; font-size: 13px; color: var(--muted); margin-bottom: 8px; }
.style-extra input {
  width: 100%;
  height: 44px;
  border: 1px solid var(--line-2);
  border-radius: 10px;
  padding: 0 14px;
  font: 16px var(--sans);
  background: #fff;
  color: var(--ink);
}
.chip-row { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 10px; }
.chip {
  height: 36px;
  padding: 0 16px;
  border-radius: 18px;
  border: 1px solid var(--line-2);
  background: #fff;
  font: 14px var(--sans);
  color: var(--ink-2);
  cursor: pointer;
}
.chip[aria-checked="true"] { border-color: var(--red); color: var(--red); font-weight: 700; }

/* ---------- 结果页 ---------- */
#screen-result { align-items: center; padding: 28px 24px 24px; gap: 16px; }
.result-head { display: flex; flex-direction: column; align-items: center; gap: 6px; }
.result-title { margin: 0; font-family: var(--serif); font-weight: 900; font-size: 26px; }
.result-sub { margin: 0; font-size: 14px; color: var(--muted); }
.result-img {
  width: 280px;
  height: 280px;
  box-shadow: 0 6px 20px rgba(42, 26, 20, 0.14);
  -webkit-touch-callout: default;
}
.pill {
  display: flex;
  align-items: center;
  gap: 6px;
  height: 32px;
  padding: 0 14px;
  border-radius: 16px;
  background: var(--cream);
  font-size: 13px;
  color: var(--red-darker);
}
#btn-download { width: 200px; }
.card {
  width: 100%;
  background: #fff;
  border-radius: 16px;
  padding: 14px 16px;
}
.steps { display: flex; flex-direction: column; gap: 10px; }
.steps-title { font-size: 13px; font-weight: 700; }
.step { display: flex; align-items: center; gap: 10px; font-size: 13px; color: var(--ink-2); }
.num {
  width: 20px;
  height: 20px;
  flex: 0 0 auto;
  border-radius: 50%;
  background: var(--red);
  color: #fff;
  font-size: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.btn-row { width: 100%; display: flex; gap: 12px; }
.btn-row .btn-primary { height: 52px; font-size: 16px; flex: 1 1 auto; }
.self-link { font-size: 14px; color: var(--red-dark); }

.sponsor-cards { width: 100%; display: flex; flex-direction: column; gap: 12px; }
.sponsor-card { border: 1px solid var(--line); display: flex; align-items: center; gap: 12px; }
.sponsor-bar .names a { color: var(--ink); font-weight: 700; text-decoration: none; }
.sponsor-bar .logos { display: flex; gap: 6px; }
.sponsor-card .logo { width: 40px; height: 40px; flex: 0 0 auto; border-radius: 8px; object-fit: contain; }
.sponsor-card .body { flex: 1 1 auto; display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.sponsor-card .name { font-size: 14px; font-weight: 700; display: flex; align-items: center; gap: 6px; }
.sponsor-card .hint { font-size: 12px; color: var(--muted); }
.sponsor-card .qr { width: 64px; height: 64px; flex: 0 0 auto; }
.sponsor-card a { color: var(--red-dark); font-size: 12px; text-decoration: none; }

/* ---------- 分享引导 ---------- */
.share-guide {
  position: fixed;
  inset: 0;
  z-index: 20;
  background: rgba(30, 20, 16, 0.94);
  color: var(--cream);
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  padding: 18px 24px calc(40px + env(safe-area-inset-bottom));
}
.share-arrow { margin-right: -4px; }
.share-text { width: 100%; display: flex; flex-direction: column; gap: 12px; margin-top: 8px; }
.share-big { font-family: var(--serif); font-weight: 900; font-size: 28px; line-height: 1.35; }
.share-mid { font-size: 17px; line-height: 1.6; }
.share-small { font-size: 14px; line-height: 1.6; color: #D9CFC4; }
.share-guide .btn { margin-top: auto; }

/* ---------- 提示 ---------- */
.toast {
  position: fixed;
  left: 50%;
  bottom: calc(96px + env(safe-area-inset-bottom));
  transform: translateX(-50%);
  z-index: 30;
  max-width: 80vw;
  padding: 10px 16px;
  border-radius: 10px;
  background: rgba(42, 26, 20, 0.92);
  color: #fff;
  font-size: 14px;
  line-height: 1.5;
  text-align: center;
}
.loading::after {
  content: '';
  width: 16px;
  height: 16px;
  margin-left: 8px;
  border: 2px solid rgba(255, 255, 255, 0.5);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
