:root {
  color-scheme: light;
  --bg: #f7eff5;
  --surface: rgba(255, 252, 253, 0.92);
  --surface-strong: #fffafc;
  --text: #37253d;
  --muted: #79677d;
  --primary: #785482;
  --primary-dark: #56355f;
  --primary-soft: #eadbea;
  --accent: #c18a98;
  --line: rgba(126, 82, 119, 0.23);
  --glow: rgba(198, 145, 177, 0.24);
  --success: #627b69;
  --shadow: 0 22px 70px rgba(85, 52, 88, 0.13);
  --radius-lg: 28px;
  --radius-md: 20px;
  --font-display: "Songti SC", "STSong", "Noto Serif CJK SC", serif;
  --font-body: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background: var(--bg);
  font-size: 16px;
}

body {
  min-height: 100vh;
  min-height: 100dvh;
  margin: 0;
  color: var(--text);
  background:
    radial-gradient(circle at 12% 8%, rgba(255, 255, 255, 0.95), transparent 30%),
    linear-gradient(160deg, var(--bg), var(--primary-soft));
  font-family: var(--font-body);
  font-size: 17px;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
}

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

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

.ambient {
  position: fixed;
  z-index: 0;
  width: 290px;
  height: 290px;
  border-radius: 50%;
  filter: blur(2px);
  pointer-events: none;
  opacity: 0.7;
}

.ambient-one {
  top: -130px;
  right: -100px;
  border: 1px solid var(--line);
  box-shadow: inset 0 0 80px var(--glow);
}

.ambient-two {
  bottom: -150px;
  left: -150px;
  border: 1px solid var(--line);
  box-shadow: inset 0 0 90px var(--glow);
}

.app-shell {
  position: relative;
  z-index: 1;
  width: min(100%, 520px);
  min-height: 100vh;
  min-height: 100dvh;
  margin: 0 auto;
  padding: max(18px, env(safe-area-inset-top)) 18px max(30px, env(safe-area-inset-bottom));
}

.app-header {
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr) 44px;
  align-items: center;
  min-height: 48px;
  margin-bottom: 16px;
}

.brand-lockup {
  display: flex;
  gap: 9px;
  align-items: center;
  justify-content: center;
  min-width: 0;
  color: var(--primary-dark);
  font-family: var(--font-display);
  font-size: 18px;
  letter-spacing: 0.08em;
  text-align: center;
}

.brand-mark {
  color: var(--accent);
  font-size: 14px;
}

.icon-button {
  width: 42px;
  height: 42px;
  padding: 0;
  color: var(--primary-dark);
  background: rgba(255, 255, 255, 0.55);
  border: 1px solid var(--line);
  border-radius: 50%;
  font-size: 22px;
  cursor: pointer;
}

.app-header .icon-button.hidden {
  display: block !important;
  visibility: hidden;
  pointer-events: none;
}

.page {
  display: none;
  animation: page-in 320ms ease both;
}

.page.active {
  display: block;
}

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

.hidden {
  display: none !important;
}

.ornamental-card {
  position: relative;
  overflow: hidden;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.93), rgba(255, 248, 252, 0.76)),
    var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
}

.ornamental-card::before,
.ornamental-card::after {
  position: absolute;
  width: 76px;
  height: 76px;
  content: "";
  border: 1px solid var(--line);
  border-radius: 50%;
  pointer-events: none;
}

.ornamental-card::before {
  top: -38px;
  right: -26px;
  box-shadow: 0 0 0 13px var(--glow);
}

.ornamental-card::after {
  bottom: -46px;
  left: -32px;
  box-shadow: 0 0 0 13px var(--glow);
}

.hero-card {
  min-height: calc(100dvh - 150px);
  padding: 56px 26px 30px;
  text-align: center;
}

.eyebrow {
  margin: 0 0 14px;
  color: var(--accent);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.2em;
  line-height: 1.4;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  overflow-wrap: anywhere;
}

h1,
h2,
h3 {
  margin-top: 0;
  font-family: var(--font-display);
  font-weight: 600;
  line-height: 1.3;
}

h1 {
  margin-bottom: 18px;
  font-size: clamp(36px, 10vw, 50px);
  letter-spacing: 0.03em;
}

h2 {
  margin-bottom: 16px;
  font-size: clamp(29px, 8vw, 38px);
}

h3 {
  margin-bottom: 12px;
  font-size: 25px;
}

.hero-tagline {
  margin: 0 auto 18px;
  color: var(--primary-dark);
  font-family: var(--font-display);
  font-size: 21px;
  line-height: 1.6;
}

.hero-description {
  margin: 0 auto 30px;
  color: var(--muted);
  font-size: 17px;
  line-height: 1.85;
  text-align: left;
}

.primary-button,
.secondary-button,
.text-button {
  width: 100%;
  min-height: 54px;
  padding: 13px 18px;
  border-radius: 999px;
  font-size: 17px;
  font-weight: 650;
  line-height: 1.4;
  cursor: pointer;
  transition: transform 160ms ease, opacity 160ms ease, box-shadow 160ms ease;
}

.primary-button {
  color: white;
  background: linear-gradient(110deg, var(--primary), var(--primary-dark));
  border: 1px solid var(--primary-dark);
  box-shadow: 0 12px 30px var(--glow);
}

.secondary-button {
  margin-top: 12px;
  color: var(--primary-dark);
  background: rgba(255, 255, 255, 0.66);
  border: 1px solid var(--line);
}

.text-button {
  color: var(--muted);
  background: transparent;
  border: 0;
}

.primary-button:active,
.secondary-button:active,
.text-button:active,
.choice-button:active,
.option-button:active {
  transform: scale(0.985);
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.42;
  box-shadow: none;
}

.meta-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-top: 34px;
  padding-top: 22px;
  border-top: 1px solid var(--line);
}

.meta-item strong,
.meta-item span {
  display: block;
}

.meta-item strong {
  color: var(--primary-dark);
  font-family: var(--font-display);
  font-size: 21px;
}

.meta-item span {
  margin-top: 2px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.disclaimer {
  margin: 18px 10px 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.65;
  text-align: center;
}

.section-heading {
  padding: 28px 4px 20px;
  text-align: center;
}

.section-heading p:last-child {
  margin: 0;
  color: var(--muted);
  font-size: 16px;
}

.choice-list {
  display: grid;
  gap: 13px;
  margin: 12px 0 24px;
}

.choice-button,
.option-button {
  width: 100%;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  cursor: pointer;
  text-align: left;
  transition: transform 160ms ease, border-color 160ms ease, background 160ms ease, box-shadow 160ms ease;
}

.choice-button {
  min-height: 68px;
  padding: 18px 20px;
  font-size: 18px;
}

.choice-button.selected,
.option-button.selected {
  background: var(--primary-soft);
  border-color: var(--primary);
  box-shadow: 0 10px 24px var(--glow);
}

.quiz-progress {
  margin: 4px 2px 18px;
}

.quiz-progress-copy {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 9px;
  color: var(--muted);
  font-size: 14px;
}

.quiz-progress-copy strong {
  color: var(--primary-dark);
}

.progress-track {
  height: 6px;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.68);
  border: 1px solid var(--line);
  border-radius: 99px;
}

.progress-track span {
  display: block;
  width: 0;
  height: 100%;
  background: linear-gradient(90deg, var(--accent), var(--primary));
  border-radius: inherit;
  transition: width 260ms ease;
}

.question-card {
  min-height: 520px;
  padding: 30px 20px 24px;
}

.question-number {
  margin: 0 0 14px;
  color: var(--accent);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.16em;
}

.question-card h2 {
  margin-bottom: 24px;
  font-family: var(--font-body);
  font-size: 23px;
  font-weight: 650;
  line-height: 1.58;
}

.option-list {
  display: grid;
  gap: 12px;
}

.option-button {
  display: grid;
  grid-template-columns: 32px minmax(0, 1fr);
  gap: 10px;
  align-items: start;
  min-height: 66px;
  padding: 15px 16px;
  font-size: 17px;
  line-height: 1.65;
}

.option-letter {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  margin-top: 1px;
  color: var(--primary-dark);
  background: var(--primary-soft);
  border: 1px solid var(--line);
  border-radius: 50%;
  font-size: 13px;
  font-weight: 700;
}

.quiz-actions {
  display: grid;
  grid-template-columns: 0.72fr 1.28fr;
  gap: 10px;
  margin-top: 16px;
}

.result-intro {
  padding: 28px 8px 20px;
  text-align: center;
}

.result-code,
.report-code {
  margin: 0 0 10px;
  color: var(--primary);
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.12em;
}

.result-summary {
  margin: 0;
  color: var(--muted);
  font-size: 18px;
  line-height: 1.85;
  text-align: left;
}

.share-quote {
  margin: 8px 0 22px;
  padding: 24px 24px 22px;
}

.share-quote > span {
  position: absolute;
  top: 8px;
  left: 16px;
  color: var(--primary-soft);
  font-family: Georgia, serif;
  font-size: 78px;
  line-height: 1;
}

.share-quote p {
  position: relative;
  z-index: 1;
  margin: 0;
  color: var(--primary-dark);
  font-family: var(--font-display);
  font-size: 20px;
  line-height: 1.75;
}

.result-panel {
  padding: 25px 20px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
}

.panel-heading {
  margin-bottom: 22px;
  text-align: center;
}

.panel-heading h3 {
  margin: 0;
}

.dimension-list {
  display: grid;
  gap: 22px;
}

.dimension-labels,
.dimension-value-line {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.dimension-value-line {
  margin-bottom: 8px;
}

.dimension-value-line strong {
  font-size: 16px;
}

.dimension-value-line span {
  color: var(--primary);
  font-size: 14px;
  font-weight: 700;
}

.dimension-bar {
  position: relative;
  height: 10px;
  overflow: hidden;
  background: var(--primary-soft);
  border: 1px solid var(--line);
  border-radius: 99px;
}

.dimension-bar span {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  width: 50%;
  background: linear-gradient(90deg, var(--accent), var(--primary));
  border-radius: inherit;
}

.dimension-labels {
  margin-top: 6px;
  color: var(--muted);
  font-size: 12px;
}

.stacked-actions {
  margin-top: 22px;
}

.report-cover {
  padding: 34px 24px 30px;
  text-align: center;
}

.report-cover > p:last-child {
  margin: 0;
  color: var(--muted);
  font-size: 18px;
  line-height: 1.8;
  text-align: left;
}

.report-sections {
  display: grid;
  gap: 16px;
  margin-top: 18px;
}

.report-section {
  padding: 24px 21px;
  background: var(--surface-strong);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
}

.report-section h3 {
  position: relative;
  padding-left: 17px;
  font-size: 23px;
}

.report-section h3::before {
  position: absolute;
  top: 0.45em;
  left: 0;
  width: 7px;
  height: 7px;
  content: "";
  background: var(--accent);
  border-radius: 50%;
  box-shadow: 0 0 0 5px var(--glow);
}

.report-section p {
  margin: 0;
  color: var(--text);
  font-size: 18px;
  line-height: 1.95;
  white-space: pre-line;
}

.report-sources > p {
  color: var(--muted);
  font-size: 15px;
  line-height: 1.75;
}

.report-sources ul {
  display: grid;
  gap: 12px;
  padding: 0;
  margin: 18px 0 0;
  list-style: none;
}

.report-sources li {
  display: grid;
  gap: 4px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}

.report-sources a {
  display: flex;
  align-items: center;
  min-height: 44px;
  padding: 5px 0;
  color: var(--primary-dark);
  font-size: 16px;
  font-weight: 700;
  line-height: 1.55;
  overflow-wrap: anywhere;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}

.report-sources span {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

.report-actions {
  padding-bottom: 12px;
}

.assessment-instructions,
.completion-message {
  padding: 19px 21px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  color: var(--muted);
  font-size: 17px;
  line-height: 1.85;
}

.assessment-instructions {
  margin: 0 0 22px;
}

.assessment-instructions p,
.completion-message p {
  margin: 0 0 12px;
}

.assessment-instructions p:last-child,
.completion-message p:last-child {
  margin-bottom: 0;
}

.stage-description {
  margin: -2px 4px 18px;
  padding-left: 13px;
  border-left: 2px solid var(--accent);
  color: var(--muted);
  font-size: 17px;
  line-height: 1.75;
}

.profile-description {
  margin: 12px 0 0;
  color: var(--muted);
  font-family: var(--font-body);
  font-size: 15px;
  font-weight: 400;
  line-height: 1.75;
}

.profile-observation strong {
  display: block;
  color: var(--primary-dark);
  font-size: 17px;
  line-height: 1.6;
}

.profile-observation p,
p.profile-observation {
  margin: 7px 0 0;
  color: var(--muted);
  font-size: 17px;
  line-height: 1.8;
}

.coordinate-context h3 { margin: 0 0 14px; }
.coordinate-context p { font-size: 18px; line-height: 1.85; }
.coordinate-position { margin: 8px 0 18px; font-size: 18px; }
.coordinate-track { position: relative; height: 8px; margin: 14px 9px 12px; border-radius: 12px; background: linear-gradient(90deg, var(--accent), var(--surface-strong), var(--primary)); }
.coordinate-track span { position: absolute; top: 50%; width: 18px; height: 18px; transform: translate(-50%, -50%); border-radius: 50%; border: 3px solid var(--surface-strong); background: var(--primary); box-shadow: 0 0 0 1px var(--primary); }
.coordinate-note { color: var(--muted); font-size: 17px !important; line-height: 1.8; margin: 14px 0 0; }
.coordinate-item .dimension-labels { gap: 18px; }
.coordinate-item .dimension-labels span { max-width: 48%; font-size: 17px; line-height: 1.7; }
.coordinate-item .dimension-labels span:last-child { text-align: right; }

.matching-panel {
  margin-top: 18px;
}

.matching-description {
  margin: 0 0 18px;
  font-size: 17px;
  line-height: 1.85;
}

.evidence-item + .evidence-item {
  margin-top: 21px;
  padding-top: 20px;
  border-top: 1px solid var(--line);
}

.evidence-number {
  margin: 0 0 9px;
  color: var(--accent);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.04em;
}

.evidence-prompt {
  margin: 0;
  color: var(--muted);
  font-size: 17px;
  line-height: 1.85;
}

.evidence-item blockquote {
  margin: 13px 0;
  padding: 12px 15px;
  border-left: 3px solid var(--accent);
  border-radius: 0 10px 10px 0;
  background: var(--primary-soft);
  color: var(--primary-dark);
  font-size: 17px;
  line-height: 1.8;
}

.evidence-reason {
  margin: 0;
  font-size: 17px;
  line-height: 1.85;
}

.matching-counter {
  margin-top: 25px;
  padding-top: 21px;
  border-top: 1px solid var(--line);
}

.matching-counter h4 {
  margin: 0 0 15px;
  color: var(--primary-dark);
  font-size: 18px;
}

.matching-caveat {
  margin: 21px 0 0;
  color: var(--muted);
  font-size: 15px;
  line-height: 1.8;
}

.report-navigation {
  margin-top: 18px;
  padding: 20px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
}

.report-navigation > p {
  margin: 0 0 13px;
  color: var(--muted);
  font-size: 16px;
}

.report-navigation ol {
  display: grid;
  gap: 10px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.report-navigation button {
  width: 100%;
  min-height: 44px;
  padding: 10px 13px;
  color: var(--primary-dark);
  background: var(--surface-strong);
  border: 1px solid var(--line);
  border-radius: 12px;
  font-size: 16px;
  line-height: 1.55;
  cursor: pointer;
  text-align: left;
}

.report-section {
  scroll-margin-top: 20px;
}

.report-body p {
  margin: 0 0 19px;
  white-space: normal;
}

.report-body p:last-child {
  margin-bottom: 0;
}

.report-body strong {
  color: var(--primary-dark);
  font-weight: 700;
}

.report-body a,
.assessment-instructions a {
  color: var(--primary-dark);
  text-underline-offset: 3px;
  overflow-wrap: anywhere;
}

.report-body ul,
.report-body ol {
  margin: 0 0 19px;
  padding-left: 25px;
  font-size: 18px;
  line-height: 1.95;
}

.report-body li + li {
  margin-top: 8px;
}

.report-top-link {
  display: block;
  min-height: 44px;
  margin: 17px 0 -8px auto;
  padding: 8px 0 8px 12px;
  color: var(--muted);
  background: transparent;
  border: 0;
  font-size: 15px;
  cursor: pointer;
}

.report-sources summary {
  color: var(--primary-dark);
  font-family: var(--font-display);
  font-size: 21px;
  line-height: 1.5;
  cursor: pointer;
}

.report-sources[open] summary {
  margin-bottom: 15px;
}

.error-page {
  padding-top: 12vh;
}

.error-page .ornamental-card {
  padding: 34px 24px;
  text-align: center;
}

.toast {
  position: fixed;
  z-index: 10;
  bottom: max(22px, env(safe-area-inset-bottom));
  left: 50%;
  width: max-content;
  max-width: calc(100% - 40px);
  padding: 11px 18px;
  color: white;
  background: rgba(55, 37, 61, 0.92);
  border-radius: 999px;
  font-size: 14px;
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, 12px);
  transition: opacity 180ms ease, transform 180ms ease;
}

.toast.visible {
  opacity: 1;
  transform: translate(-50%, 0);
}

@media (min-width: 700px) {
  .app-shell {
    padding-top: 28px;
    padding-bottom: 44px;
  }

  .hero-card {
    min-height: 680px;
  }
}

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