:root {
  color-scheme: light;
  --berry: #922c47;
  --berry-deep: #6f1d35;
  --rose: #c66e84;
  --rose-soft: #f4dce1;
  --paper: #fbf5ed;
  --paper-light: #fffaf4;
  --paper-deep: #f1e5da;
  --gold: #b6873f;
  --gold-soft: #eee0c3;
  --olive: #73795d;
  --ink: #342825;
  --ink-soft: #5f4e49;
  --muted: #806f69;
  --line: #decfc4;
  --danger: #a73f4f;
  --shadow: 0 24px 70px rgba(86, 46, 49, 0.12);
  --safe-bottom: max(20px, env(safe-area-inset-bottom));
  --serif: "Songti SC", "STSong", "Noto Serif CJK SC", Georgia, serif;
  --sans: "PingFang SC", "Microsoft YaHei", "Noto Sans CJK SC", system-ui, sans-serif;
}

* { box-sizing: border-box; }
html { min-width: 320px; background: var(--paper); }
body { min-width: 320px; min-height: 100vh; margin: 0; color: var(--ink); background: var(--paper); font-family: var(--sans); -webkit-font-smoothing: antialiased; }
button, input, textarea { font: inherit; }
button { -webkit-tap-highlight-color: transparent; }
button:focus-visible, input:focus-visible, textarea:focus-visible, summary:focus-visible { outline: 3px solid rgba(182, 135, 63, 0.42); outline-offset: 3px; }

.app-shell { width: min(100%, 560px); min-height: 100vh; margin: 0 auto; background: var(--paper); }
.screen { display: none; min-height: 100dvh; }
.screen.is-active { display: block; animation: screen-in 220ms ease-out; }

.brand-header { padding: max(26px, env(safe-area-inset-top)) 24px 18px; text-align: center; }
.brand-logo { display: block; width: 154px; height: auto; margin: 0 auto; object-fit: contain; }
.brand-header p { margin: 10px 0 0; color: var(--olive); font-family: var(--serif); font-size: 13px; letter-spacing: 0.08em; }

.intro-screen { padding-bottom: calc(34px + var(--safe-bottom)); }
.intro-card, .form-card, .review-card, .waiting-card { margin: 0 18px; border: 1px solid rgba(146, 44, 71, 0.1); border-radius: 30px; padding: 28px 22px; background: var(--paper-light); box-shadow: var(--shadow); }
.eyebrow { margin: 0 0 12px; color: var(--gold); font-size: 12px; font-weight: 800; letter-spacing: 0.12em; }
h1, h2, p { overflow-wrap: anywhere; }
.intro-card h1, .form-card h1, .review-card h1, .waiting-card h1 { margin: 0; color: var(--berry-deep); font-family: var(--serif); font-size: clamp(31px, 9vw, 43px); font-weight: 700; line-height: 1.25; letter-spacing: 0.01em; }
.intro-lead, .section-lead, .waiting-lead { margin: 16px 0 0; color: var(--ink-soft); font-size: 15px; line-height: 1.85; }

.promise-list { display: flex; flex-wrap: wrap; gap: 8px; margin: 22px 0 0; }
.promise-list p { margin: 0; border: 1px solid rgba(146, 44, 71, 0.16); border-radius: 999px; padding: 8px 12px; color: var(--berry-deep); background: #fff; font-size: 12px; font-weight: 700; }

.intro-facts { display: grid; gap: 0; margin: 24px 0 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.intro-facts div { padding: 14px 0; }
.intro-facts div + div { border-top: 1px solid rgba(222, 207, 196, 0.72); }
.intro-facts dt { color: var(--berry-deep); font-family: var(--serif); font-size: 17px; font-weight: 700; }
.intro-facts dd { margin: 5px 0 0; color: var(--muted); font-size: 12px; line-height: 1.55; }

.journey-card { margin-top: 24px; border-radius: 22px; padding: 18px 16px; background: var(--paper-deep); }
.journey-card h2 { margin: 0 0 14px; color: var(--berry-deep); font-family: var(--serif); font-size: 18px; }
.journey-card ol { display: grid; gap: 15px; margin: 0; padding: 0; list-style: none; }
.journey-card li { display: grid; grid-template-columns: 38px 1fr; align-items: start; gap: 11px; }
.journey-card li > b { display: grid; width: 36px; height: 36px; place-items: center; border: 1px solid rgba(182, 135, 63, 0.38); border-radius: 50%; color: var(--gold); background: var(--paper-light); font-size: 10px; }
.journey-card li span { display: grid; gap: 3px; }
.journey-card li strong { color: var(--ink); font-size: 14px; }
.journey-card li small { color: var(--muted); font-size: 11px; line-height: 1.55; }

.button { display: inline-flex; width: 100%; min-height: 54px; align-items: center; justify-content: center; border: 1px solid transparent; border-radius: 999px; padding: 13px 20px; font-weight: 750; line-height: 1.35; text-align: center; cursor: pointer; }
.button-primary { color: #fff; background: var(--berry); box-shadow: 0 12px 28px rgba(146, 44, 71, 0.22); }
.button-primary:active { background: var(--berry-deep); transform: translateY(1px); }
.button-secondary { border-color: var(--line); color: var(--ink-soft); background: var(--paper-light); }
.button:disabled { color: #907f78; background: #e8ddd4; box-shadow: none; cursor: not-allowed; }
.intro-card > .button { margin-top: 24px; }
.inline-status { min-height: 20px; margin: 10px 4px 0; color: var(--olive); font-size: 11px; line-height: 1.55; text-align: center; }
.inline-status[data-tone="error"] { color: var(--danger); }
.fine-print { margin: 16px 2px 0; color: var(--muted); font-size: 10.5px; line-height: 1.7; text-align: center; }

.step-header { position: sticky; z-index: 10; top: 0; display: grid; grid-template-columns: 72px 1fr 72px; align-items: center; min-height: 76px; padding: max(12px, env(safe-area-inset-top)) 18px 11px; border-bottom: 1px solid rgba(146, 44, 71, 0.08); background: rgba(251, 245, 237, 0.96); backdrop-filter: blur(16px); }
.step-header > div { text-align: center; }
.step-header p { margin: 0; color: var(--gold); font-size: 10px; letter-spacing: 0.12em; }
.step-header strong { display: block; margin-top: 3px; color: var(--berry-deep); font-family: var(--serif); font-size: 16px; }
.step-header > span { justify-self: end; color: var(--muted); font-size: 11px; }
.back-button { min-width: 48px; min-height: 42px; border: 0; padding: 0; color: var(--berry-deep); background: transparent; font-weight: 700; text-align: left; cursor: pointer; }

.identity-screen, .review-screen { padding-bottom: calc(30px + var(--safe-bottom)); }
.form-card, .review-card { margin-top: 16px; }
.form-card h1, .review-card h1 { font-size: clamp(28px, 8vw, 36px); }
#identity-form { display: grid; gap: 17px; margin-top: 24px; }
.field { display: grid; gap: 8px; }
.field > span, .consent-fieldset legend { color: var(--ink); font-size: 13px; font-weight: 750; }
.field em { color: var(--muted); font-size: 11px; font-style: normal; font-weight: 500; }
.field input, .number-response, .text-response { width: 100%; min-height: 52px; border: 1px solid var(--line); border-radius: 16px; padding: 13px 15px; color: var(--ink); background: #fff; font-size: 16px; line-height: 1.55; }
.field input::placeholder, .text-response::placeholder, .number-response::placeholder { color: #a59791; }
.field input[aria-invalid="true"] { border-color: var(--danger); }
.field-error { min-height: 0; margin: 0; color: var(--danger); font-size: 11px; line-height: 1.55; }
.field-error:empty { display: none; }

.consent-fieldset { display: grid; gap: 10px; margin: 3px 0 0; border: 0; padding: 0; }
.consent-fieldset legend { margin-bottom: 10px; }
.consent-card { display: grid; grid-template-columns: 24px 1fr; gap: 12px; border: 1px solid var(--line); border-radius: 18px; padding: 14px; background: #fff; cursor: pointer; }
.consent-card input { width: 22px; height: 22px; margin: 1px 0 0; accent-color: var(--berry); }
.consent-card span { display: grid; gap: 5px; }
.consent-card strong { color: var(--ink); font-size: 13px; line-height: 1.55; }
.consent-card small { color: var(--muted); font-size: 11px; line-height: 1.6; }
.consent-card-optional { border-color: rgba(115, 121, 93, 0.28); background: #fbfbf5; }
.consent-card[aria-disabled="true"] { cursor: not-allowed; opacity: 0.72; background: #f4f2ee; }
.consent-card[aria-disabled="true"] input { cursor: not-allowed; }
.consent-error { margin-top: -7px; }
.privacy-details { overflow: hidden; border: 1px solid var(--line); border-radius: 17px; color: var(--muted); background: var(--paper-deep); }
.privacy-details summary { padding: 13px 14px; color: var(--berry-deep); font-size: 12px; font-weight: 750; cursor: pointer; }
.privacy-details > div { border-top: 1px solid var(--line); padding: 10px 14px 13px; }
.privacy-details p { margin: 5px 0 0; font-size: 10.5px; line-height: 1.65; }
.privacy-details b { color: var(--ink-soft); }
.draft-note { margin: -2px 2px 0; color: var(--muted); font-size: 10.5px; line-height: 1.65; }

.question-screen { position: relative; padding-bottom: 92px; }
.question-header { position: sticky; z-index: 10; top: 0; padding: max(12px, env(safe-area-inset-top)) 18px 12px; background: rgba(251, 245, 237, 0.96); backdrop-filter: blur(16px); }
.question-header-top { display: grid; grid-template-columns: 74px 1fr 74px; align-items: center; min-height: 44px; }
.question-header img { display: block; width: 102px; height: 42px; justify-self: center; object-fit: contain; }
.question-header-top > span { justify-self: end; color: var(--muted); font-size: 11px; font-variant-numeric: tabular-nums; }
.progress-track { height: 4px; overflow: hidden; margin-top: 10px; border-radius: 999px; background: #e7dad1; }
.progress-track span { display: block; width: 0; height: 100%; border-radius: inherit; background: var(--berry); transition: width 180ms ease; }
.question-card { padding: 34px 22px 22px; }
.question-card h1 { margin: 0; color: var(--ink); font-family: var(--serif); font-size: clamp(27px, 7.8vw, 36px); font-weight: 700; line-height: 1.45; }
.question-help { margin: 13px 0 22px; color: var(--muted); font-size: 13px; line-height: 1.75; }
.response-area { display: grid; }
.text-response { min-height: 210px; resize: vertical; border-radius: 20px; line-height: 1.75; }
.character-count { justify-self: end; margin: 8px 4px 0; color: var(--muted); font-size: 10.5px; }
.number-response { max-width: 190px; }
.choice-list { display: grid; gap: 11px; }
.choice-card { display: grid; width: 100%; min-height: 58px; grid-template-columns: 34px 1fr; align-items: center; gap: 12px; border: 1px solid var(--line); border-radius: 18px; padding: 12px 14px; color: var(--ink-soft); background: #fff; text-align: left; cursor: pointer; }
.choice-card > b { display: grid; width: 31px; height: 31px; place-items: center; border: 1px solid var(--line); border-radius: 50%; color: var(--muted); font-size: 11px; }
.choice-card > span { font-size: 14px; line-height: 1.55; }
.choice-card.is-selected { border-color: rgba(146, 44, 71, 0.52); color: var(--berry-deep); background: #f9e9ed; box-shadow: 0 10px 28px rgba(146, 44, 71, 0.1); }
.choice-card.is-selected > b { border-color: var(--berry); color: #fff; background: var(--berry); }
.choice-card-multi { grid-template-columns: 23px 1fr; }
.choice-card-multi input { width: 21px; height: 21px; margin: 0; accent-color: var(--berry); }
.scale-list .choice-card { grid-template-columns: 38px 1fr; }
.question-card > .field-error { margin-top: 13px; }
.question-footer { position: fixed; z-index: 9; right: 0; bottom: 0; left: 0; display: grid; grid-template-columns: 0.82fr 1.18fr; gap: 10px; width: min(100%, 560px); margin: 0 auto; padding: 10px 18px var(--safe-bottom); border-top: 1px solid rgba(146, 44, 71, 0.1); background: rgba(251, 245, 237, 0.97); backdrop-filter: blur(16px); }
.question-footer .button { min-height: 50px; padding: 11px 14px; }

.review-summary { display: grid; gap: 12px; margin-top: 24px; }
.review-summary section { border: 1px solid var(--line); border-radius: 18px; padding: 15px; background: #fff; }
.review-summary section > div { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.review-summary h2 { margin: 0; color: var(--berry-deep); font-family: var(--serif); font-size: 17px; }
.review-summary button { min-width: 48px; min-height: 40px; border: 0; padding: 0; color: var(--gold); background: transparent; font-weight: 700; cursor: pointer; }
.review-summary p { margin: 10px 0 0; color: var(--ink-soft); font-size: 12px; line-height: 1.7; }
.review-summary ul { margin: 8px 0 0; padding-left: 18px; color: var(--muted); font-size: 11px; line-height: 1.7; }
.before-submit-note { margin: 18px 0; border-left: 4px solid var(--olive); border-radius: 0 16px 16px 0; padding: 14px 15px; background: #f5f3e9; }
.before-submit-note strong { color: var(--ink); font-size: 13px; }
.before-submit-note p { margin: 7px 0 0; color: var(--ink-soft); font-size: 12px; line-height: 1.75; }

.waiting-screen { padding-bottom: calc(34px + var(--safe-bottom)); }
.waiting-brand { padding-bottom: 16px; }
.waiting-card h1 { font-size: clamp(29px, 8.2vw, 38px); }
.receipt-card { display: grid; justify-items: center; margin-top: 24px; border: 1px solid rgba(182, 135, 63, 0.38); border-radius: 22px; padding: 18px 14px; background: #fff; text-align: center; }
.receipt-card span { color: var(--muted); font-size: 11px; }
.receipt-card strong { margin-top: 8px; color: var(--berry-deep); font-family: var(--serif); font-size: 22px; letter-spacing: 0.04em; overflow-wrap: anywhere; }
.receipt-card button { min-height: 40px; margin-top: 9px; border: 0; padding: 0 12px; color: var(--gold); background: transparent; font-size: 12px; font-weight: 750; cursor: pointer; }
.status-list { display: grid; gap: 0; margin: 24px 0 0; padding: 0; list-style: none; }
.status-list li { position: relative; display: grid; min-height: 68px; grid-template-columns: 40px 1fr; gap: 12px; }
.status-list li:not(:last-child)::after { position: absolute; top: 34px; bottom: 0; left: 17px; width: 1px; background: var(--line); content: ""; }
.status-list li > b { position: relative; z-index: 1; display: grid; width: 35px; height: 35px; place-items: center; border: 1px solid var(--line); border-radius: 50%; color: var(--muted); background: var(--paper-light); font-size: 11px; }
.status-list .is-current > b { border-color: var(--berry); color: #fff; background: var(--berry); }
.status-list span { display: grid; align-content: start; gap: 4px; padding-top: 2px; }
.status-list strong { color: var(--ink); font-size: 13px; }
.status-list small { color: var(--muted); font-size: 11px; line-height: 1.55; }
.waiting-note { margin: 18px 0 0; border-radius: 16px; padding: 13px 14px; color: var(--ink-soft); background: var(--paper-deep); font-size: 12px; line-height: 1.75; }

.leave-dialog { width: min(calc(100% - 36px), 430px); margin: auto; border: 0; border-radius: 24px; padding: 0; color: var(--ink); background: var(--paper-light); box-shadow: 0 34px 90px rgba(48, 30, 32, 0.32); }
.leave-dialog::backdrop { background: rgba(45, 31, 33, 0.55); backdrop-filter: blur(4px); }
.leave-dialog form { padding: 24px 20px 20px; }
.leave-dialog h2 { margin: 0; color: var(--berry-deep); font-family: var(--serif); font-size: 24px; }
.leave-dialog p { margin: 12px 0 20px; color: var(--ink-soft); font-size: 13px; line-height: 1.75; }
.leave-dialog form > div { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; }
.leave-dialog .button { min-height: 48px; padding: 10px 12px; }

.toast { position: fixed; z-index: 100; right: 18px; bottom: calc(22px + var(--safe-bottom)); left: 18px; width: fit-content; max-width: calc(100% - 36px); margin: 0 auto; border-radius: 999px; padding: 11px 16px; color: #fff; background: rgba(52, 40, 37, 0.94); box-shadow: 0 12px 36px rgba(0, 0, 0, 0.18); font-size: 12px; opacity: 0; pointer-events: none; transform: translateY(10px); transition: opacity 160ms ease, transform 160ms ease; }
.toast.is-visible { opacity: 1; transform: translateY(0); }

@keyframes screen-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }

@media (min-width: 700px) {
  body { padding: 24px 0; }
  .app-shell { min-height: calc(100vh - 48px); border: 1px solid rgba(146, 44, 71, 0.1); border-radius: 34px; box-shadow: var(--shadow); overflow: hidden; }
  .screen { min-height: calc(100vh - 48px); }
  .question-footer { bottom: 24px; border-radius: 0 0 34px 34px; }
}

@media (max-width: 380px) {
  .intro-card, .form-card, .review-card, .waiting-card { margin-right: 12px; margin-left: 12px; padding-right: 18px; padding-left: 18px; }
  .question-card { padding-right: 18px; padding-left: 18px; }
  .question-footer { padding-right: 12px; padding-left: 12px; }
  .step-header, .question-header-top { grid-template-columns: 62px 1fr 62px; }
  .promise-list p { padding-right: 10px; padding-left: 10px; font-size: 11px; }
}

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