:root {
  --paper: #f2eee5;
  --paper-deep: #e7e0d2;
  --ink: #181814;
  --muted: #716c62;
  --line: #cfc6b7;
  --red: #a5281f;
  --red-dark: #7f1d18;
  --white: #fffdf8;
  --header-height: 76px;
}

* { box-sizing: border-box; }

html { color-scheme: light; }

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background: var(--paper);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  -webkit-font-smoothing: antialiased;
}

button, input, textarea { font: inherit; }
button { color: inherit; }

.paper-grain {
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: .28;
  background-image:
    radial-gradient(circle at 20% 10%, rgba(255,255,255,.65) 0, transparent 32%),
    repeating-linear-gradient(0deg, transparent 0, transparent 3px, rgba(55,45,30,.018) 4px);
}

.topbar {
  height: var(--header-height);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 clamp(22px, 5vw, 72px);
  border-bottom: 1px solid rgba(102, 91, 73, .18);
  position: relative;
  z-index: 2;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  color: var(--ink);
  text-decoration: none;
  font-family: "Songti SC", "STSong", serif;
  font-weight: 700;
  font-size: 22px;
  letter-spacing: .12em;
}

.seal {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  color: var(--white);
  background: var(--red);
  border-radius: 3px 3px 5px 2px;
  font-size: 18px;
  letter-spacing: 0;
  transform: rotate(-2deg);
}

.round-label {
  color: var(--muted);
  font-size: 13px;
  letter-spacing: .08em;
}

.app-shell {
  min-height: calc(100svh - var(--header-height));
  position: relative;
  z-index: 1;
}

.welcome {
  min-height: calc(100svh - var(--header-height));
  padding: clamp(54px, 8vh, 96px) clamp(22px, 8vw, 132px) 56px;
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(300px, .65fr);
  grid-template-rows: auto auto auto 1fr;
  column-gap: clamp(48px, 10vw, 160px);
  align-content: start;
  overflow: hidden;
}

.welcome::after {
  content: "问";
  position: absolute;
  right: -3vw;
  bottom: -14vh;
  color: rgba(165, 40, 31, .045);
  font: 620px/.75 "Songti SC", "STSong", serif;
  pointer-events: none;
}

.eyebrow {
  grid-column: 1;
  color: var(--red);
  font-size: 13px;
  font-weight: 650;
  letter-spacing: .18em;
  margin-bottom: 20px;
}

.welcome h1, .complete h1 {
  grid-column: 1;
  margin: 0;
  max-width: 760px;
  font-family: "Songti SC", "STSong", serif;
  font-size: clamp(46px, 6.4vw, 92px);
  font-weight: 700;
  line-height: 1.08;
  letter-spacing: -.045em;
}

.intro {
  grid-column: 1;
  max-width: 580px;
  margin: 30px 0 0;
  color: var(--muted);
  font-size: 17px;
  line-height: 1.85;
}

.start-form {
  grid-column: 2;
  grid-row: 1 / span 4;
  align-self: center;
  display: grid;
  gap: 22px;
  position: relative;
  z-index: 1;
}

.start-form label, .note-wrap {
  display: grid;
  gap: 9px;
  color: var(--muted);
  font-size: 13px;
}

input[type="text"], .start-form input, textarea {
  width: 100%;
  border: 0;
  border-bottom: 1px solid var(--line);
  border-radius: 0;
  padding: 12px 0;
  color: var(--ink);
  background: transparent;
  outline: none;
  transition: border-color .18s ease, background-color .18s ease;
}

input:focus, textarea:focus { border-color: var(--red); }
input::placeholder, textarea::placeholder { color: #a29b90; }

.form-error {
  min-height: 20px;
  margin: -8px 0 -6px;
  color: var(--red);
  font-size: 13px;
}

.primary-button {
  min-height: 56px;
  border: 0;
  padding: 0 24px;
  display: inline-flex;
  align-items: center;
  justify-content: space-between;
  gap: 22px;
  color: var(--white);
  background: var(--red);
  cursor: pointer;
  font-weight: 650;
  transition: transform .18s ease, background-color .18s ease, opacity .18s ease;
}

.primary-button:hover:not(:disabled) { background: var(--red-dark); transform: translateY(-2px); }
.primary-button:active:not(:disabled) { transform: translateY(0); }
.primary-button:disabled { opacity: .42; cursor: not-allowed; }
.primary-button.compact { min-width: 150px; min-height: 48px; justify-content: center; }

.welcome-meta {
  grid-column: 1;
  align-self: end;
  display: flex;
  gap: 28px;
  margin-top: clamp(36px, 10vh, 120px);
  color: var(--muted);
  font-size: 12px;
}

.welcome-meta span + span::before {
  content: "·";
  margin-right: 28px;
  color: var(--red);
}

.questionnaire {
  width: min(100%, 920px);
  min-height: calc(100svh - var(--header-height));
  margin: 0 auto;
  padding: 42px 28px 32px;
  display: grid;
  grid-template-rows: auto 1fr auto;
}

.questionnaire[hidden], .welcome[hidden], .complete[hidden] { display: none; }

.progress-copy {
  display: flex;
  justify-content: space-between;
  color: var(--muted);
  font-size: 12px;
  letter-spacing: .08em;
}

.progress-track {
  height: 2px;
  margin-top: 12px;
  background: var(--line);
  overflow: hidden;
}

.progress-bar {
  height: 100%;
  background: var(--red);
  transition: width .35s cubic-bezier(.2, .8, .2, 1);
}

.save-state {
  min-height: 18px;
  padding-top: 9px;
  color: #8b857b;
  text-align: right;
  font-size: 11px;
}

.question-stage {
  align-self: center;
  padding: 44px 0 34px;
}

.question-stage.enter-forward { animation: enterForward .28s ease both; }
.question-stage.enter-back { animation: enterBack .28s ease both; }

.question-kicker {
  color: var(--red);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .16em;
}

.question-stage h2 {
  max-width: 760px;
  margin: 13px 0 9px;
  font-family: "Songti SC", "STSong", serif;
  font-size: clamp(28px, 4vw, 44px);
  line-height: 1.35;
  letter-spacing: -.02em;
}

.question-help {
  margin: 0 0 30px;
  color: var(--muted);
  font-size: 14px;
}

.options { border-top: 1px solid var(--line); }

.option-row {
  min-height: 58px;
  display: grid;
  grid-template-columns: 32px 1fr;
  align-items: center;
  gap: 14px;
  border-bottom: 1px solid var(--line);
  cursor: pointer;
  transition: padding-left .18s ease, background-color .18s ease, color .18s ease;
}

.option-row:hover { padding-left: 8px; background: rgba(255,255,255,.25); }
.option-row:has(input:checked) { color: var(--red-dark); background: rgba(165,40,31,.045); }
.option-row:has(input:disabled) { opacity: .38; cursor: not-allowed; }
.option-row input { position: absolute; opacity: 0; pointer-events: none; }

.option-marker {
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  color: var(--muted);
  font: 12px/1 ui-monospace, SFMono-Regular, Menlo, monospace;
  transition: color .18s ease, border-color .18s ease, background-color .18s ease;
}

.option-row:has(input:checked) .option-marker {
  color: var(--white);
  border-color: var(--red);
  background: var(--red);
}

.option-text { padding: 16px 0; font-size: 16px; }

.note-wrap { margin-top: 22px; }
.note-wrap textarea { resize: vertical; line-height: 1.6; }

.question-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 22px;
  border-top: 1px solid rgba(102, 91, 73, .18);
}

.text-button {
  min-height: 44px;
  border: 0;
  padding: 0;
  color: var(--muted);
  background: transparent;
  cursor: pointer;
}

.text-button:disabled { visibility: hidden; }

.complete {
  min-height: calc(100svh - var(--header-height));
  padding: clamp(70px, 12vh, 140px) clamp(22px, 10vw, 160px);
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: flex-start;
}

.complete-mark {
  width: 74px;
  height: 74px;
  display: grid;
  place-items: center;
  margin-bottom: 38px;
  color: var(--white);
  background: var(--red);
  border-radius: 50%;
  font-size: 32px;
  animation: stampIn .45s cubic-bezier(.2, .9, .25, 1.25) both;
}

.complete h1 { max-width: 880px; font-size: clamp(42px, 6vw, 78px); }
.complete p { max-width: 660px; margin: 28px 0; color: var(--muted); font-size: 17px; line-height: 1.8; }
.complete-note { padding-top: 20px; border-top: 1px solid var(--line); color: var(--red-dark); font-size: 14px; }

@keyframes enterForward {
  from { opacity: 0; transform: translateX(18px); }
  to { opacity: 1; transform: translateX(0); }
}

@keyframes enterBack {
  from { opacity: 0; transform: translateX(-18px); }
  to { opacity: 1; transform: translateX(0); }
}

@keyframes stampIn {
  from { opacity: 0; transform: scale(1.45) rotate(-8deg); }
  to { opacity: 1; transform: scale(1) rotate(0); }
}

@media (max-width: 760px) {
  :root { --header-height: 64px; }
  .topbar { padding: 0 18px; }
  .brand { font-size: 19px; }
  .seal { width: 30px; height: 30px; font-size: 16px; }
  .round-label { font-size: 11px; }

  .welcome {
    display: block;
    min-height: auto;
    padding: 42px 22px 48px;
  }
  .welcome::after { display: none; }
  .welcome h1 { font-size: clamp(42px, 13vw, 62px); }
  .intro { margin-top: 22px; font-size: 15px; }
  .start-form { margin-top: 44px; gap: 20px; }
  .welcome-meta { margin-top: 38px; gap: 0; justify-content: space-between; }
  .welcome-meta span + span::before { display: none; }

  .questionnaire { padding: 26px 18px 18px; }
  .question-stage { padding: 32px 0 26px; align-self: start; }
  .question-stage h2 { font-size: 27px; }
  .question-help { margin-bottom: 22px; }
  .option-row { min-height: 56px; }
  .option-text { font-size: 15px; }
  .question-actions { position: sticky; bottom: 0; padding: 14px 0 2px; background: var(--paper); }
  .primary-button.compact { min-width: 132px; }

  .complete { padding: 70px 22px; }
  .complete-mark { width: 62px; height: 62px; }
}

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