:root {
  color-scheme: light;
  --ink: #2f2928;
  --ink-soft: #574947;
  --muted: #806e69;
  --paper: #fffaf6;
  --paper-deep: #f4e9e2;
  --surface: rgba(255, 253, 250, 0.94);
  --rose: #a64b63;
  --rose-deep: #7d2f49;
  --rose-soft: #f5dce3;
  --gold: #b88a43;
  --gold-soft: #f0e3c9;
  --green: #4f7b68;
  --violet: #504066;
  --line: rgba(92, 63, 58, 0.12);
  --shadow: 0 22px 60px rgba(86, 51, 49, 0.1);
  --radius: 28px;
  --safe-bottom: max(18px, env(safe-area-inset-bottom));
  --sans-cjk: "Source Han Sans SC", "Noto Sans CJK SC", "PingFang SC", "Microsoft YaHei", sans-serif;
  font-family: var(--sans-cjk);
  font-synthesis: none;
  text-rendering: optimizeLegibility;
}

* { box-sizing: border-box; }

html { min-height: 100%; background: #f8f0eb; }

body {
  min-width: 320px;
  min-height: 100vh;
  margin: 0;
  color: var(--ink);
  background:
    radial-gradient(circle at 5% -10%, rgba(218, 151, 172, 0.25), transparent 36%),
    radial-gradient(circle at 100% 20%, rgba(227, 195, 139, 0.24), transparent 28%),
    linear-gradient(180deg, #fff9f5 0%, #f7eee8 100%);
  -webkit-font-smoothing: antialiased;
}

button, input { font: inherit; }

button { -webkit-tap-highlight-color: transparent; }

button:focus-visible, [role="button"]:focus-visible {
  outline: 3px solid rgba(166, 75, 99, 0.28);
  outline-offset: 3px;
}

.ambient {
  position: fixed;
  z-index: -1;
  width: 260px;
  height: 260px;
  border-radius: 50%;
  filter: blur(26px);
  pointer-events: none;
}

.ambient-one { top: -120px; right: -110px; background: rgba(218, 128, 155, 0.18); }
.ambient-two { bottom: -140px; left: -140px; background: rgba(188, 145, 76, 0.14); }

.app-shell {
  width: min(100%, 520px);
  min-height: 100vh;
  margin: 0 auto;
}

.screen { display: none; min-height: 100vh; }
.screen.is-active { display: block; animation: screen-in 360ms cubic-bezier(.2,.75,.25,1) both; }
.is-hidden { display: none !important; }

.welcome-screen { padding: max(26px, env(safe-area-inset-top)) 20px calc(34px + var(--safe-bottom)); }

.brand-row { display: flex; align-items: center; gap: 12px; margin: 2px 4px 28px; }
.brand-logo { display: block; width: 136px; height: auto; flex: 0 0 auto; }
.brand-note { margin: 3px 0 0; color: var(--muted); font-size: 11px; letter-spacing: 0.04em; }

.hero-card, .result-card {
  border: 1px solid var(--line);
  background: var(--surface);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
}

.hero-card { position: relative; overflow: hidden; padding: 34px 26px 28px; border-radius: 34px; }
.hero-card::after {
  content: "";
  position: absolute;
  top: -86px;
  right: -76px;
  width: 190px;
  height: 190px;
  border: 1px solid rgba(184, 138, 67, 0.22);
  border-radius: 50%;
  box-shadow: 0 0 0 26px rgba(184, 138, 67, 0.05), 0 0 0 54px rgba(166, 75, 99, 0.035);
  pointer-events: none;
}

.eyebrow, .mini-label {
  margin: 0;
  color: var(--gold);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

.hero-card h1 {
  position: relative;
  z-index: 1;
  margin: 16px 0 14px;
  color: var(--rose-deep);
  font-family: var(--sans-cjk);
  font-size: clamp(30px, 8.2vw, 42px);
  font-weight: 800;
  line-height: 1.16;
  letter-spacing: -0.04em;
  white-space: nowrap;
}

.hero-copy { margin: 0; color: var(--ink-soft); font-size: 15px; line-height: 1.85; }

.fact-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  margin: 26px 0;
  padding: 17px 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.fact-grid div { display: flex; flex-direction: column; align-items: center; gap: 4px; border-right: 1px solid var(--line); }
.fact-grid div:last-child { border-right: 0; }
.fact-grid strong { color: var(--rose-deep); font-family: Georgia, "Songti SC", serif; font-size: 19px; }
.fact-grid span { color: var(--muted); font-size: 11px; }

.button {
  min-height: 54px;
  border: 0;
  border-radius: 999px;
  padding: 13px 22px;
  font-size: 15px;
  font-weight: 750;
  cursor: pointer;
  transition: transform 160ms ease, opacity 160ms ease, box-shadow 160ms ease;
}

.button:active { transform: scale(0.985); }
.button[disabled] { cursor: not-allowed; opacity: 0.42; }
.button-primary { display: flex; width: 100%; align-items: center; justify-content: center; gap: 14px; color: #fff; background: linear-gradient(135deg, #8f3c57, #ca6d7f); box-shadow: 0 16px 34px rgba(145, 48, 76, 0.22); }
.button-primary:not([disabled]):hover { box-shadow: 0 18px 40px rgba(145, 48, 76, 0.28); }
.button-secondary { border: 1px solid #ddcec7; color: var(--ink); background: rgba(255, 253, 250, 0.86); }

.text-button { display: block; margin: 18px auto 0; border: 0; padding: 4px; color: var(--rose); background: transparent; font-size: 13px; cursor: pointer; }
.entry-status { margin: 10px 4px 0; color: #a33146; font-size: 12px; line-height: 1.5; text-align: center; }
.fine-print { margin: 18px 10px 0; color: #978681; font-size: 10.5px; line-height: 1.7; text-align: center; }

.profile-screen { padding: max(16px, env(safe-area-inset-top)) 18px calc(20px + var(--safe-bottom)); }
.profile-header { display: flex; align-items: center; justify-content: space-between; margin: 0 2px 12px; }
.profile-logo { display: block; width: auto; height: 38px; max-width: 118px; object-fit: contain; }
.profile-card { border: 1px solid var(--line); border-radius: 30px; padding: 24px 22px 21px; background: var(--surface); box-shadow: var(--shadow); }
.profile-card h1 { margin: 0 0 8px; font-family: Georgia, "Songti SC", "STSong", serif; font-size: clamp(27px, 7.5vw, 34px); line-height: 1.3; }
.profile-lead { margin: 0 0 16px; color: var(--ink-soft); font-size: 12.5px; line-height: 1.6; }
#profile-form { display: grid; gap: 12px; }
.field { display: grid; gap: 7px; }
.field > span { color: var(--ink-soft); font-size: 12px; font-weight: 750; }
.field input {
  width: 100%;
  min-height: 50px;
  border: 1px solid #ddcec7;
  border-radius: 16px;
  padding: 12px 14px;
  color: var(--ink);
  background: rgba(255, 253, 250, 0.92);
  font-size: 15px;
  outline: 0;
}
.field input:focus { border-color: rgba(166, 75, 99, 0.58); box-shadow: 0 0 0 3px rgba(166, 75, 99, 0.1); }
.field input[aria-invalid="true"] { border-color: #b94355; }
.field-error { min-height: 0; color: #a33146; font-size: 10.5px; line-height: 1.4; }
.field-error:empty { display: none; }
.privacy-notice { overflow: hidden; border: 1px solid var(--line); border-radius: 16px; color: var(--muted); background: rgba(244, 233, 226, 0.52); }
.privacy-notice summary { padding: 11px 13px; color: var(--rose-deep); font-size: 12px; font-weight: 700; cursor: pointer; }
.privacy-notice-body { border-top: 1px solid var(--line); padding: 9px 13px 11px; }
.privacy-notice p { margin: 4px 0 0; font-size: 10.5px; line-height: 1.55; }
.privacy-notice b { color: var(--ink-soft); }
.consent-row { display: flex; align-items: flex-start; gap: 9px; color: var(--ink-soft); font-size: 11.5px; line-height: 1.55; cursor: pointer; }
.consent-row input { width: 18px; height: 18px; flex: 0 0 auto; margin: 0; accent-color: var(--rose); }
.consent-error { margin-top: -8px; }
.profile-submit { margin-top: 1px; }
.honeypot { position: absolute !important; left: -99999px !important; width: 1px !important; height: 1px !important; overflow: hidden !important; }

.quiz-screen { position: relative; padding-bottom: 112px; }
.quiz-header { position: sticky; z-index: 10; top: 0; padding: max(18px, env(safe-area-inset-top)) 20px 14px; background: rgba(255, 249, 245, 0.91); backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px); }
.quiz-topline { display: flex; align-items: center; justify-content: space-between; }
.quiz-logo { display: block; width: 108px; height: auto; max-height: 40px; object-fit: contain; }
.icon-button { display: grid; width: 40px; height: 40px; place-items: center; border: 1px solid var(--line); border-radius: 50%; color: var(--ink-soft); background: rgba(255, 253, 250, 0.82); font-size: 23px; cursor: pointer; }
.progress-copy { display: flex; align-items: baseline; justify-content: space-between; margin: 18px 2px 10px; color: var(--muted); font-size: 12px; }
.progress-copy b { color: var(--rose); font-variant-numeric: tabular-nums; }
.progress-track { height: 4px; overflow: hidden; border-radius: 999px; background: #eaded8; }
.progress-track span { display: block; width: 0; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--gold), var(--rose)); transition: width 260ms ease; }

.question-wrap { padding: 34px 22px 20px; }
.question-kicker { margin: 0 0 14px; color: var(--gold); font-size: 11px; font-weight: 800; letter-spacing: 0.16em; }
.question-title { margin: 0; color: var(--ink); font-family: var(--sans-cjk); font-size: clamp(25px, 7.5vw, 34px); font-weight: 800; line-height: 1.52; }
.question-help { min-height: 23px; margin: 12px 0 24px; color: var(--muted); font-size: 12px; line-height: 1.6; }
.question-help.preference-pair { display: grid; gap: 9px; margin-top: 18px; }
.question-help.preference-pair span { display: flex; align-items: flex-start; gap: 9px; border: 1px solid var(--line); border-radius: 16px; padding: 11px 13px; color: var(--ink-soft); background: rgba(255,253,250,.68); font-size: 13px; line-height: 1.65; }
.question-help.preference-pair b { display: grid; width: 24px; height: 24px; flex: 0 0 auto; place-items: center; border-radius: 50%; color: #fff; background: var(--rose); font-size: 11px; }
.answer-list { display: grid; gap: 12px; }

.answer-button {
  position: relative;
  display: flex;
  width: 100%;
  min-height: 64px;
  align-items: center;
  gap: 13px;
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 15px 17px;
  color: var(--ink-soft);
  background: rgba(255, 253, 250, 0.9);
  box-shadow: 0 9px 26px rgba(86, 51, 49, 0.05);
  text-align: left;
  cursor: pointer;
  transition: border 160ms ease, background 160ms ease, transform 160ms ease, color 160ms ease;
}

.answer-button:active { transform: scale(0.99); }
.answer-button.is-selected { border-color: rgba(166, 75, 99, 0.48); color: var(--rose-deep); background: linear-gradient(135deg, rgba(250, 232, 237, 0.95), rgba(255, 249, 244, 0.95)); box-shadow: 0 12px 30px rgba(146, 57, 81, 0.11); }
.answer-index { display: grid; width: 30px; height: 30px; flex: 0 0 auto; place-items: center; border: 1px solid #ddcec7; border-radius: 50%; color: var(--muted); background: #fff; font-size: 11px; }
.answer-button.is-selected .answer-index { border-color: var(--rose); color: #fff; background: var(--rose); }
.answer-label { font-size: 14px; font-weight: 650; line-height: 1.55; }
.answer-note { display: block; margin-top: 3px; color: var(--muted); font-size: 11px; font-weight: 450; }

.quiz-footer { position: fixed; z-index: 9; right: 0; bottom: 0; left: 0; display: grid; grid-template-columns: 0.74fr 1.26fr; gap: 12px; width: min(100%, 520px); margin: 0 auto; padding: 14px 20px var(--safe-bottom); border-top: 1px solid rgba(92, 63, 58, 0.08); background: rgba(255, 250, 246, 0.94); backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px); }
.quiz-footer .button { min-height: 50px; padding: 12px 16px; }

.result-screen { padding: max(38px, env(safe-area-inset-top)) 18px calc(42px + var(--safe-bottom)); }
.result-hero { padding: 0 13px 26px; text-align: center; }
.result-logo { display: block; width: 132px; height: auto; margin: 0 auto 18px; }
.result-hero h1 { margin: 15px 0 10px; font-family: Georgia, "Songti SC", "STSong", serif; font-size: 31px; line-height: 1.35; }
.result-lead { margin: 0 auto; color: var(--ink-soft); font-size: 14px; line-height: 1.75; }
.result-submission-note { width: fit-content; max-width: 100%; margin: 10px auto 0; border-radius: 16px; padding: 8px 11px; color: var(--green); background: rgba(79, 123, 104, 0.1); font-size: 11px; line-height: 1.45; overflow-wrap: anywhere; }
.result-submission-note p { margin: 0; }
.receipt-copy-button { margin-top: 7px; border: 1px solid rgba(79, 123, 104, 0.3); border-radius: 999px; padding: 6px 10px; color: var(--green); background: #fff; font-size: 11px; }
.type-chip { display: inline-flex; margin-top: 18px; border: 1px solid rgba(166, 75, 99, 0.2); border-radius: 999px; padding: 9px 15px; color: var(--rose-deep); background: var(--rose-soft); font-size: 13px; font-weight: 800; letter-spacing: 0.06em; }

.result-card { margin-top: 15px; padding: 22px 18px; border-radius: var(--radius); }
.section-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.section-heading h2, .story-card h2 { margin: 7px 0 0; font-family: Georgia, "Songti SC", "STSong", serif; font-size: 21px; line-height: 1.45; }
.soft-tag { flex: 0 0 auto; border-radius: 999px; padding: 7px 10px; color: var(--muted); background: var(--paper-deep); font-size: 10px; }
#radar-canvas { display: block; width: 100%; height: auto; margin: 10px auto 0; }
.top-strengths { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: -4px; }
.strength-pill { border: 1px solid var(--line); border-radius: 17px; padding: 12px; background: #fffaf6; }
.strength-pill span { color: var(--muted); font-size: 10px; }
.strength-pill strong { display: block; margin-top: 5px; color: var(--rose-deep); font-size: 14px; }

.axis-list { display: grid; gap: 20px; margin-top: 23px; }
.axis-row { display: grid; gap: 8px; }
.axis-labels { display: flex; justify-content: space-between; color: var(--muted); font-size: 11px; }
.axis-labels strong { color: var(--ink-soft); font-size: 12px; }
.axis-track { position: relative; display: grid; grid-template-columns: var(--left) var(--right); height: 13px; overflow: hidden; border-radius: 999px; background: #eee3dc; }
.axis-track::after { content: ""; position: absolute; top: 0; bottom: 0; left: 50%; width: 1px; background: rgba(255, 255, 255, 0.9); }
.axis-left { background: linear-gradient(90deg, #b88a43, #d0ab6f); }
.axis-right { background: linear-gradient(90deg, #b17a91, #8f526e); }

.story-card > p:not(.mini-label) { margin: 13px 0 0; color: var(--ink-soft); font-size: 14px; line-height: 1.85; }
.action-panel { margin-top: 20px; border-left: 3px solid var(--gold); border-radius: 0 16px 16px 0; padding: 15px 15px 15px 17px; background: linear-gradient(90deg, rgba(240, 227, 201, 0.65), rgba(255, 250, 246, 0.45)); }
.action-panel h3 { margin: 0 0 7px; color: var(--rose-deep); font-size: 13px; }
.action-panel p { margin: 0; color: var(--ink-soft); font-size: 13px; line-height: 1.75; }
.result-actions { display: grid; gap: 12px; margin-top: 22px; }
.result-actions .text-button { margin-top: 4px; }
.result-disclaimer { margin-top: 20px; }

.poster-dialog { width: min(calc(100% - 24px), 500px); max-height: calc(100vh - 24px); margin: auto; border: 0; border-radius: 28px; padding: 0; background: #fffaf6; box-shadow: 0 36px 110px rgba(46, 27, 30, 0.34); }
.poster-dialog::backdrop { background: rgba(37, 25, 29, 0.64); backdrop-filter: blur(7px); }
.poster-sheet { max-height: calc(100vh - 24px); overflow: auto; padding: 18px; }
.poster-sheet header { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 3px 2px 14px; }
.poster-sheet h2 { margin: 5px 0 0; font-size: 17px; }
.poster-sheet img { display: block; width: 100%; border: 1px solid var(--line); border-radius: 18px; background: #fff; box-shadow: 0 14px 36px rgba(62, 37, 41, 0.12); }
.poster-sheet .button { margin-top: 14px; }
.poster-sheet > p { margin: 10px 4px 2px; color: var(--muted); font-size: 11px; line-height: 1.6; text-align: center; }
.poster-canvas { position: fixed; left: -99999px; width: 1080px; height: 2100px; pointer-events: none; }

.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(47, 41, 40, 0.9); box-shadow: 0 12px 34px rgba(0,0,0,.16); font-size: 12px; opacity: 0; pointer-events: none; transform: translateY(12px); transition: opacity 180ms ease, transform 180ms ease; }
.toast.is-visible { opacity: 1; transform: translateY(0); }

@keyframes screen-in { from { opacity: 0; transform: translateY(10px); } 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(92,63,58,.1); border-radius: 38px; background: rgba(255,250,246,.58); box-shadow: 0 40px 110px rgba(78, 44, 45, .12); }
  .screen { min-height: calc(100vh - 50px); }
  .quiz-footer { bottom: 24px; border-radius: 0 0 38px 38px; }
}

@media (max-width: 600px) {
  .welcome-screen { padding: max(18px, env(safe-area-inset-top)) 18px calc(20px + var(--safe-bottom)); }
  .brand-row { margin-bottom: 16px; }
  .hero-card { padding: 26px 22px 22px; }
  .hero-card h1 { margin: 12px 0 10px; font-size: clamp(24px, 7.2vw, 30px); }
  .hero-copy { line-height: 1.7; }
  .fact-grid { margin: 18px 0; padding: 13px 0; }

  .profile-screen { padding: max(10px, env(safe-area-inset-top)) 14px calc(12px + var(--safe-bottom)); }
  .profile-header { margin-bottom: 8px; }
  .profile-card { padding: 18px 18px 16px; border-radius: 26px; }
  .profile-card h1 { margin: 0 0 6px; font-size: clamp(24px, 6.8vw, 29px); }
  .profile-lead { margin-bottom: 12px; font-size: 11.5px; line-height: 1.5; }
  #profile-form { gap: 10px; }
  .field { gap: 5px; }
  .field input { min-height: 46px; border-radius: 14px; padding: 10px 12px; font-size: 16px; }
  .privacy-notice summary { padding: 10px 11px; }
  .privacy-notice-body { padding: 8px 11px 10px; }
  .privacy-notice p { margin-top: 3px; font-size: 11px; line-height: 1.5; }
  .consent-row { font-size: 12px; line-height: 1.5; }
  .profile-submit { min-height: 48px; }

  .quiz-screen { min-height: 100dvh; padding-bottom: calc(54px + var(--safe-bottom)); }
  .quiz-header { padding: max(10px, env(safe-area-inset-top)) 16px 9px; }
  .quiz-topline { min-height: 40px; }
  .quiz-header .icon-button { width: 40px; height: 40px; font-size: 21px; }
  .quiz-logo { width: auto; height: 34px; max-width: 96px; object-fit: contain; }
  .progress-copy { margin: 7px 1px 6px; font-size: 11px; }
  .progress-track { height: 3px; }

  .question-wrap { padding: 14px 16px 12px; }
  .question-kicker { margin-bottom: 8px; font-size: 10px; line-height: 1.4; letter-spacing: 0.12em; }
  .question-title { font-size: clamp(21px, 5.8vw, 24px); line-height: 1.34; }
  .question-help { min-height: 0; margin: 8px 0 12px; font-size: 11px; line-height: 1.45; }
  .question-help.preference-pair { gap: 6px; margin-top: 9px; }
  .question-help.preference-pair span { gap: 8px; border-radius: 13px; padding: 7px 10px; font-size: 12px; line-height: 1.45; }
  .question-help.preference-pair b { width: 22px; height: 22px; font-size: 10px; }

  .answer-list { gap: 8px; }
  .answer-button { min-height: 50px; gap: 10px; border-radius: 16px; padding: 9px 12px; box-shadow: 0 6px 18px rgba(86, 51, 49, 0.045); }
  .answer-index { width: 27px; height: 27px; font-size: 10px; }
  .answer-label { font-size: 13px; line-height: 1.4; }

  .quiz-footer { gap: 8px; padding: 8px 16px max(9px, env(safe-area-inset-bottom)); }
  .quiz-footer .button { min-height: 44px; padding: 9px 14px; font-size: 14px; }
}

@media (max-width: 600px) and (max-height: 780px) {
  .quiz-header { padding-top: max(7px, env(safe-area-inset-top)); padding-bottom: 7px; }
  .quiz-logo { width: auto; height: 31px; max-width: 88px; }
  .question-wrap { padding-top: 10px; }
  .question-title { font-size: 20px; }
  .question-help.preference-pair span { padding-top: 6px; padding-bottom: 6px; font-size: 11.5px; }
  .answer-list { gap: 6px; }
  .answer-button { min-height: 46px; padding-top: 7px; padding-bottom: 7px; }
}

@media (max-width: 350px) {
  .welcome-screen { padding-right: 14px; padding-left: 14px; }
  .hero-card { padding-right: 20px; padding-left: 20px; }
  .question-wrap { padding-right: 16px; padding-left: 16px; }
  .quiz-footer { padding-right: 14px; padding-left: 14px; }
  .answer-button { padding-right: 13px; padding-left: 13px; }
}

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