:root {
  color-scheme: light;
  --page: #eef1f4;
  --surface: #ffffff;
  --surface-soft: #f9fafb;
  --surface-muted: #f3f4f6;
  --text: #101828;
  --text-strong: #1e2939;
  --text-secondary: #4a5565;
  --muted: #6a7282;
  --quiet: #99a1af;
  --line: #d1d5dc;
  --line-soft: #e5e7eb;
  --accent: #c8102e;
  --button: #2c2c2c;
  --success: #287a4f;
  --danger: #a52929;
  --radius: 4px;
  --shell-radius: 12px;
}

* { box-sizing: border-box; }
html { min-width: 320px; min-height: 100%; background: var(--page); }
body {
  min-height: 100dvh;
  margin: 0;
  color: var(--text);
  background: var(--page);
  font-family: "Noto Sans SC", "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
}
button, input { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
button { color: inherit; }
[hidden] { display: none !important; }

.app-viewport { min-height: 100dvh; display: grid; place-items: start center; padding: 20px; }
.phone-shell {
  width: min(100%, 390px);
  min-height: min(844px, calc(100dvh - 40px));
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--shell-radius);
  background: var(--surface);
  box-shadow: 0 1px 3px rgb(0 0 0 / 10%), 0 1px 2px rgb(0 0 0 / 6%);
}
.h5-bar {
  min-height: 44px;
  padding: 0 16px;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  border-bottom: 1px solid var(--line-soft);
  background: var(--surface);
}
.brand-wordmark { justify-self: start; color: var(--accent); font-size: 16px; line-height: 24px; letter-spacing: -.02em; }
.bar-spacer { grid-column: 2; }
.icon-button, .text-button, .inline-link, .claim-button, .restart-link {
  padding: 0;
  border: 0;
  background: transparent;
  cursor: pointer;
}
.icon-button { width: 32px; min-height: 40px; display: grid; place-items: center; justify-self: start; color: var(--muted); font-size: 28px; line-height: 1; }
.text-button { grid-column: 3; justify-self: end; min-height: 40px; color: var(--muted); font-size: 12px; }

.screen-stack { min-height: min(767px, calc(100dvh - 116px)); }
.screen {
  min-height: min(767px, calc(100dvh - 116px));
  padding: 16px;
  display: none;
  flex-direction: column;
  gap: 16px;
}
.screen.is-active { display: flex; animation: screen-in 180ms ease-out; }
@keyframes screen-in { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: translateY(0); } }

.home-screen { padding: 24px; gap: 20px; }
.hero-copy { padding-top: 16px; }
.hero-copy h1 { margin: 0; color: var(--text); font-size: clamp(34px, 9.2vw, 36px); line-height: 1.25; letter-spacing: -.025em; }
.hero-copy p { margin: 16px 0 0; color: var(--muted); font-size: 14px; line-height: 22px; text-align: center; }
.hero-button { min-height: 56px; margin-top: 0; }

.screen-title, .screen-heading h1, .field-title { margin: 0; color: var(--text); font-size: 16px; font-weight: 600; line-height: 24px; }
.screen-heading p { margin: 0; color: var(--muted); font-size: 14px; line-height: 20px; }
.field-group { display: grid; gap: 8px; }
.field-title { color: var(--text-strong); font-size: 14px; line-height: 20px; }
.two-column-options { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px 12px; }
.choice-button {
  min-height: 44px;
  padding: 8px;
  border: 2px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  color: #364153;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}
.choice-button.is-selected { color: #fff; border-color: var(--button); background: var(--button); }
.choice-button:disabled { color: var(--line); border-color: var(--surface-muted); background: var(--surface-muted); cursor: not-allowed; }
.persona-options .choice-button { min-height: 40px; border-width: 1px; font-size: 12px; }
.persona-options .choice-button[data-pending]::after { content: " · 待模板"; color: var(--quiet); font-size: 10px; font-weight: 400; }
.helper-text, .section-label { margin: 0; color: var(--quiet); font-size: 11px; line-height: 16px; text-align: center; }
.persona-banner { min-height: 44px; padding: 12px; border-radius: var(--radius); color: #fff; background: var(--button); font-size: 14px; font-weight: 600; line-height: 20px; text-align: center; }
.tag-options { gap: 8px; }
.tag-options .choice-button { min-height: 40px; border-width: 1px; font-size: 12px; }
.selected-tags { display: flex; align-items: center; gap: 6px; color: var(--muted); font-size: 12px; }
.selected-tags > div, .result-tags > div { display: flex; flex-wrap: wrap; gap: 6px; }
.selected-tags b, .result-tags b { padding: 2px 8px; border-radius: 3px; background: var(--surface-muted); color: #364153; font-size: 12px; font-weight: 400; line-height: 16px; }

.screen-heading { display: grid; gap: 0; }
.requirement-box, .provider-note, .waiting-note, .coupon-box { border: 1px solid var(--line-soft); border-radius: var(--radius); background: var(--surface-soft); }
.requirement-box { padding: 13px; }
.requirement-box h2 { margin: 0; color: var(--text-secondary); font-size: 11px; font-weight: 600; line-height: 17px; }
.requirement-box ul { margin: 8px 0 0; padding: 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 4px 16px; list-style: none; }
.requirement-box li { position: relative; padding-left: 8px; color: var(--text-secondary); font-size: 11px; line-height: 16.5px; }
.requirement-box li::before { content: ""; position: absolute; top: .58em; left: 0; width: 4px; height: 4px; border-radius: 50%; background: var(--quiet); }
.photo-example-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.photo-example-grid p { margin: 0 0 6px; color: var(--muted); font-size: 11px; line-height: 17px; }
.example-list { min-height: 84px; padding: 9px; display: grid; align-content: center; gap: 0; border: 1px solid var(--line-soft); border-radius: var(--radius); }
.example-list span { color: var(--muted); font-size: 10px; line-height: 15px; }
.example-list span::before { margin-right: 4px; }
.example-list.is-good span::before { content: "✓"; color: var(--success); }
.example-list.is-bad span::before { content: "×"; color: var(--quiet); }
.photo-picker {
  position: relative;
  width: 100%;
  min-height: 128px;
  overflow: hidden;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 8px;
  color: var(--muted);
  border: 2px dashed var(--line);
  border-radius: var(--radius);
  background: var(--surface-soft);
  cursor: pointer;
}
.photo-picker.has-photo { min-height: 184px; padding: 0; border-style: solid; background: var(--surface-muted); }
.photo-picker img { position: absolute; inset: 0; width: 100%; height: 100%; display: block; object-fit: contain; }
.photo-picker.has-photo #photo-picker-label, .photo-picker.has-photo .camera-mark { display: none; }
.camera-mark { position: relative; width: 20px; height: 15px; border: 2px solid var(--quiet); border-radius: 3px; }
.camera-mark::before { content: ""; position: absolute; top: 2px; left: 5px; width: 6px; height: 6px; border: 2px solid var(--quiet); border-radius: 50%; }
.inline-message { min-height: 16px; margin: -8px 0 0; color: var(--muted); font-size: 11px; line-height: 16px; }
.inline-message[data-tone="error"] { color: var(--danger); }
.inline-message[data-tone="success"] { color: var(--success); }
.consent-list { display: grid; gap: 8px; }
.consent-row { display: grid; grid-template-columns: 16px 1fr; align-items: start; gap: 8px; color: var(--text-secondary); font-size: 11px; line-height: 18px; }
.consent-row input { width: 16px; height: 16px; margin: 1px 0 0; accent-color: var(--button); }
.inline-link { min-height: 20px; color: var(--muted); font-size: inherit; text-decoration: underline; text-underline-offset: 2px; }
.provider-note { padding: 9px 11px; color: var(--muted); font-size: 11px; line-height: 16px; }
.provider-note[data-tone="success"] { color: var(--success); border-color: #cfe6d9; background: #f5faf7; }
.provider-note[data-tone="error"] { color: var(--danger); border-color: #ecd0d0; background: #fff8f8; }

.primary-button, .secondary-button, .save-button {
  width: 100%;
  min-height: 44px;
  padding: 0 18px;
  border-radius: var(--radius);
  font-size: 14px;
  font-weight: 600;
  line-height: 20px;
  white-space: nowrap;
  cursor: pointer;
  transition: transform 120ms ease, background-color 120ms ease, border-color 120ms ease;
}
.primary-button, .save-button { color: #fff; border: 1px solid var(--button); background: var(--button); }
.secondary-button { color: var(--text-secondary); border: 1px solid var(--line); background: var(--surface); }
.primary-button:disabled { color: var(--quiet); border-color: var(--line-soft); background: var(--line-soft); cursor: not-allowed; }
.primary-button:active:not(:disabled), .secondary-button:active, .save-button:active, .choice-button:active:not(:disabled), .photo-picker:active, .icon-button:active, .text-button:active, .inline-link:active { transform: scale(.98); }
.primary-button:focus-visible, .secondary-button:focus-visible, .save-button:focus-visible, .choice-button:focus-visible, .photo-picker:focus-visible, .icon-button:focus-visible, .text-button:focus-visible, .inline-link:focus-visible, input:focus-visible { outline: 3px solid rgb(200 16 46 / 22%); outline-offset: 2px; }

.check-preview { width: 80px; height: 80px; margin: 24px auto 0; overflow: hidden; border: 1px solid var(--line-soft); border-radius: var(--radius); background: var(--surface-muted); }
.check-preview img, .confirm-preview img { width: 100%; height: 100%; display: block; object-fit: cover; }
.loader-ring { width: 40px; height: 40px; margin: 0 auto; border: 2px solid var(--line-soft); border-top-color: #364153; border-radius: 50%; animation: spin 900ms linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.progress-track { height: 4px; overflow: hidden; border-radius: 999px; background: var(--surface-muted); }
.progress-track span { width: 5%; height: 100%; display: block; border-radius: inherit; background: #364153; transition: width 400ms ease; }
.status-list { margin: 0; padding: 0; display: grid; list-style: none; }
.status-list p, .status-list li { position: relative; margin: 0; padding: 4px 0 4px 18px; color: var(--line); font-size: 12px; line-height: 16px; }
.status-list p::before, .status-list li::before { content: ""; position: absolute; top: 8px; left: 0; width: 8px; height: 8px; border-radius: 50%; background: var(--line-soft); }
.status-list .is-current { color: var(--text-strong); font-weight: 600; }
.status-list .is-current::before { background: var(--button); }
.status-list .is-done { color: var(--quiet); }
.status-list .is-done::before { content: "✓"; top: 3px; width: auto; height: auto; color: var(--quiet); background: transparent; font-size: 11px; }
.bottom-note { margin-top: auto; display: grid; justify-items: center; gap: 8px; text-align: center; }
.bottom-note p { margin: 0; color: var(--quiet); font-size: 12px; line-height: 16px; }
.confirm-preview { height: 176px; overflow: hidden; border: 1px solid var(--line-soft); border-radius: var(--radius); background: var(--surface-muted); }
.confirm-preview img { object-fit: contain; }
.check-success { padding: 12px; color: var(--text-secondary); border: 1px solid var(--line-soft); border-radius: var(--radius); font-size: 12px; }
.check-success::before { content: "✓"; margin-right: 8px; color: var(--success); }
.screen-actions { display: grid; gap: 8px; }
.push-bottom { margin-top: auto; }
.generation-steps li { padding-block: 4px; }
.waiting-note { padding: 12px; color: var(--muted); font-size: 12px; line-height: 19px; text-align: center; }
.video-placeholder { min-height: 144px; display: grid; place-items: center; border: 1px solid var(--line-soft); border-radius: var(--radius); background: var(--surface-muted); color: var(--quiet); font-size: 14px; }
.error-box { padding: 12px; color: var(--danger); border: 1px solid #ecd0d0; border-radius: var(--radius); background: #fff8f8; font-size: 12px; line-height: 18px; }

.result-screen { gap: 12px; }
.result-heading { text-align: center; }
.result-heading h1, .result-heading p { margin: 0; font-size: 14px; line-height: 20px; }
.result-heading p { color: var(--text-secondary); }
.result-poster { margin: 0; padding: 10px 18px; display: grid; place-items: center; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface-muted); }
.result-poster img { width: min(100%, 318px); max-height: 56vh; display: block; object-fit: contain; }
.result-tags { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; color: var(--muted); font-size: 12px; }
.save-button { min-height: 36px; display: flex; align-items: center; justify-content: center; text-decoration: none; }
.coupon-box { padding: 12px; display: grid; gap: 5px; text-align: center; }
.coupon-box p { margin: 0; color: #364153; font-size: 12px; line-height: 19px; }
.claim-button { color: var(--accent); font-size: 16px; font-weight: 600; line-height: 24px; text-decoration: underline; text-underline-offset: 2px; }
.claim-button:disabled { color: var(--quiet); cursor: not-allowed; }
.claim-message { min-height: 16px; color: var(--muted) !important; font-size: 11px !important; }
.restart-link { align-self: center; color: var(--muted); font-size: 12px; }

.site-footer {
  min-height: 32px;
  padding: 7px 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-top: 1px solid var(--line-soft);
  background: var(--surface);
}
.site-footer small { color: var(--quiet); font-size: 10px; line-height: 17px; }

.rules-dialog { width: min(calc(100% - 32px), 410px); max-height: min(720px, calc(100dvh - 32px)); padding: 0; border: 0; border-radius: 12px; box-shadow: 0 24px 80px rgb(16 24 40 / 28%); }
.rules-dialog::backdrop { background: rgb(16 24 40 / 55%); }
.rules-dialog form { padding: 18px; display: grid; gap: 14px; }
.dialog-heading { display: flex; align-items: center; justify-content: space-between; }
.dialog-heading h2 { margin: 0; font-size: 18px; }
.dialog-content { overflow: auto; }
.dialog-content h3 { margin: 14px 0 4px; font-size: 13px; }
.dialog-content h3:first-child { margin-top: 0; }
.dialog-content p { margin: 0; color: var(--muted); font-size: 12px; line-height: 20px; }

@media (max-width: 520px) {
  .app-viewport { padding: 0; }
  .phone-shell { width: 100%; min-height: 100dvh; border: 0; border-radius: 0; box-shadow: none; }
  .screen-stack, .screen { min-height: calc(100dvh - 76px); }
}

@media (max-width: 360px) {
  .screen { padding: 14px; gap: 13px; }
  .home-screen { padding: 20px; }
  .requirement-box ul { gap: 4px 8px; }
  .photo-picker { min-height: 112px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
