:root {
  color-scheme: dark;
  --ink: #102b2a;
  --ink-2: #173938;
  --jade: #24534d;
  --gold: #d3b47b;
  --paper: #f7f2e8;
  --muted: #c7c9bd;
  --line: rgba(220, 202, 157, .27);
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", sans-serif;
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  min-width: 320px;
  margin: 0;
  color: var(--paper);
  background:
    radial-gradient(circle at 85% 12%, rgba(91, 126, 101, .22), transparent 28rem),
    radial-gradient(circle at -10% 70%, rgba(109, 97, 69, .16), transparent 25rem),
    var(--ink);
}
body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: .13;
  background-image: repeating-linear-gradient(0deg, transparent 0 5px, rgba(255,255,255,.08) 6px, transparent 7px);
  mix-blend-mode: soft-light;
}
button { font: inherit; cursor: pointer; }
button:focus-visible, a:focus-visible { outline: 3px solid #f6d89b; outline-offset: 3px; }
[hidden] { display: none !important; }

.site-shell { width: min(100%, 940px); min-height: 100dvh; margin: auto; display: flex; flex-direction: column; }
.site-header {
  display: flex; align-items: center; gap: .85rem;
  min-height: 88px; padding: 18px clamp(20px, 5vw, 46px);
  border-bottom: 1px solid var(--line);
}
.brand-mark {
  width: 42px; height: 42px; display: grid; place-items: center;
  border: 1px solid var(--gold); color: var(--gold);
  font-family: "Songti SC", "Noto Serif CJK SC", serif; font-size: 1.5rem;
  transform: rotate(-5deg);
}
.brand-copy { display: flex; flex-direction: column; gap: .1rem; }
.brand-copy strong { font-family: "Songti SC", "Noto Serif CJK SC", serif; font-size: 1.2rem; letter-spacing: .12em; }
.brand-copy span { color: var(--muted); font-size: .77rem; letter-spacing: .06em; }
.share-small {
  margin-left: auto; padding: 7px 14px; border: 1px solid var(--line); border-radius: 99px;
  background: transparent; color: var(--paper); font-size: .88rem;
}
.share-small:hover { background: rgba(255,255,255,.08); }
main { flex: 1; }
.screen { max-width: 700px; margin: auto; padding: clamp(28px, 6vw, 58px) clamp(22px, 5vw, 44px) 65px; }

.intro-screen { position: relative; }
.hero-ornament {
  position: absolute; top: 42px; right: 32px; display: flex; flex-direction: column;
  gap: .4rem; color: rgba(211,180,123,.18); font-family: "Songti SC", serif;
  font-size: clamp(2.8rem, 10vw, 5.4rem); line-height: 1.1; pointer-events: none;
}
.hero-ornament span:nth-child(2) { padding-left: 2rem; }
.hero-ornament span:nth-child(3) { padding-left: .8rem; }
.hero-ornament span:nth-child(4) { padding-left: 3rem; }
.hero-kicker, .result-eyebrow {
  display: inline-flex; align-items: center; gap: .6rem;
  color: var(--gold); font-size: .85rem; letter-spacing: .27em;
}
.hero-kicker::before, .result-eyebrow::before { content: ""; width: 22px; height: 1px; background: var(--gold); }
h1, h2, h3, p { margin-top: 0; }
h1, .quiz-screen h2, .result-screen h2 {
  font-family: "Songti SC", "Noto Serif CJK SC", "STSong", serif;
  font-weight: 500;
}
h1 { position: relative; max-width: 650px; margin: 20px 0 22px; font-size: clamp(2.6rem, 9vw, 5rem); line-height: 1.22; letter-spacing: .05em; }
h1 em { font-style: normal; color: var(--gold); }
.hero-lead { position: relative; max-width: 530px; margin-bottom: 30px; color: #e0e1d8; font-size: 1.06rem; line-height: 1.85; }
.hero-card {
  position: relative; display: grid; grid-template-columns: repeat(3, 1fr);
  margin: 0 0 34px; padding: 20px 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line);
}
.hero-card div { display: flex; flex-direction: column; align-items: center; gap: .4rem; text-align: center; }
.hero-card div + div { border-left: 1px solid var(--line); }
.hero-card-label { color: var(--muted); font-size: .8rem; letter-spacing: .15em; }
.hero-card strong { font-weight: 500; font-size: 1rem; }
.primary-button, .outline-button, .back-button {
  min-height: 54px; border-radius: 6px; font-weight: 650; letter-spacing: .08em;
  transition: transform .15s ease, background .15s ease, opacity .15s ease;
}
.primary-button { border: 1px solid var(--gold); background: var(--gold); color: #16312e; padding: 12px 28px; }
.primary-button:hover:not(:disabled) { background: #e5c993; transform: translateY(-1px); }
.primary-button:disabled { opacity: .45; cursor: not-allowed; }
.intro-screen > .primary-button { width: min(100%, 330px); }
.methodology { margin: 21px 0 0; padding: 14px 17px; border: 1px solid var(--line); border-radius: 7px; background: rgba(255,255,255,.025); }
.methodology summary { color: var(--gold); cursor: pointer; font-size: .92rem; }
.methodology p { margin: 14px 0 0; color: var(--muted); font-size: .88rem; line-height: 1.75; }
.gallery-toggle {
  display: block; margin: 17px 0 0; padding: 9px 0; border: 0; background: none;
  color: var(--gold); text-decoration: underline; text-underline-offset: 5px;
}
.persona-gallery { margin-top: 31px; padding-top: 24px; border-top: 1px solid var(--line); }
.persona-gallery h2 { margin-bottom: 7px; font-size: 1.55rem; }
.persona-gallery > p { margin-bottom: 20px; color: var(--muted); }
.persona-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.persona-preview {
  min-width: 0; padding: 10px 10px 14px; border: 1px solid var(--line); border-top: 2px solid var(--preview-color);
  border-radius: 8px; background: rgba(255,255,255,.035); text-align: center;
}
.persona-preview img { display: block; width: 100%; height: 165px; margin: 0 auto 8px; object-fit: contain; background: radial-gradient(circle, rgba(255,255,255,.08), transparent 68%); }
.persona-preview strong { display: block; color: var(--preview-color); font-size: 1rem; }
.persona-preview span { display: block; margin-top: 4px; color: var(--muted); font-size: .87rem; line-height: 1.5; }
@media (min-width: 680px) { .persona-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.fine-print { margin: 22px 0 0; color: #aeb8ae; font-size: .82rem; line-height: 1.7; }

.quiz-screen { padding-top: 33px; }
.quiz-topline { display: flex; justify-content: space-between; color: var(--gold); font-size: .88rem; letter-spacing: .1em; }
.progress-track { height: 4px; overflow: hidden; margin: 15px 0 45px; border-radius: 9px; background: rgba(255,255,255,.13); }
.progress-track > div { width: 4%; height: 100%; border-radius: inherit; background: var(--gold); transition: width .25s ease; }
.question-number { margin-bottom: 12px; color: var(--gold); font-size: .85rem; letter-spacing: .18em; }
.quiz-screen h2 { margin-bottom: 16px; font-size: clamp(1.8rem, 6.6vw, 2.75rem); line-height: 1.35; }
.question-note { min-height: 1.5rem; margin: 0 0 25px; color: var(--muted); line-height: 1.65; }
.option-grid { display: grid; grid-template-columns: 1fr; gap: 11px; }
.option-grid.compact { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.option-button {
  width: 100%; min-height: 70px; padding: 15px 18px; text-align: left;
  border: 1px solid rgba(220, 202, 157, .25); border-radius: 7px;
  background: rgba(255,255,255,.045); color: var(--paper);
  font-size: 1rem; line-height: 1.45;
  transition: background .15s ease, border-color .15s ease, transform .15s ease;
}
.option-button:hover { background: rgba(255,255,255,.1); border-color: rgba(220, 202, 157, .58); }
.option-button[aria-pressed="true"] {
  background: rgba(211, 180, 123, .16); border-color: var(--gold);
  box-shadow: inset 3px 0 0 var(--gold);
}
.option-grid.compact .option-button { min-height: 54px; padding: 12px 13px; text-align: center; font-size: .95rem; }
.quiz-actions { display: grid; grid-template-columns: 1fr 1.5fr; gap: 12px; margin-top: 34px; }
.back-button { border: 1px solid var(--line); background: transparent; color: var(--paper); padding: 11px 19px; }
.back-button:hover { background: rgba(255,255,255,.08); }

.result-screen { --result-color: var(--gold); padding-top: 38px; text-align: center; }
.result-eyebrow { justify-content: center; color: var(--result-color); }
.result-eyebrow::before { background: var(--result-color); }
.result-avatar-wrap {
  width: min(100%, 340px); aspect-ratio: 1; margin: 14px auto 2px;
  background: radial-gradient(circle, rgba(255,255,255,.09), transparent 68%);
}
.result-avatar-wrap img { display: block; width: 100%; height: 100%; object-fit: contain; filter: drop-shadow(0 12px 24px rgba(0,0,0,.23)); }
.result-screen h2 { margin-bottom: 10px; font-size: clamp(2.7rem, 9vw, 4.2rem); color: var(--result-color); }
.result-title { margin-bottom: 17px; font-family: "Songti SC", serif; font-size: 1.45rem; }
.result-poem { color: var(--result-color); font-family: "Songti SC", serif; font-size: 1.05rem; letter-spacing: .15em; }
.result-body {
  margin: 27px 0; padding: 26px 25px; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line);
  color: #e3e4da; text-align: left; line-height: 1.85;
}
.result-body p:last-child { margin-bottom: 0; }
.character-tip { margin: 20px 0 27px; padding: 22px 24px; border: 1px solid rgba(211,180,123,.55); border-radius: 8px; background: linear-gradient(135deg, rgba(211,180,123,.12), rgba(255,255,255,.025)); text-align: left; }
.character-tip span { display: block; margin-bottom: 7px; color: var(--gold); font-size: .83rem; letter-spacing: .12em; }
.character-tip strong { display: block; margin-bottom: 10px; font-family: "Songti SC", serif; font-size: 1.45rem; font-weight: 500; }
.character-tip p { margin-bottom: 12px; color: #e0e1d8; line-height: 1.75; }
.character-tip small { color: #aeb8ae; font-size: .78rem; }
.profile-card, .trait-card, .bond-card {
  margin: 20px 0; padding: 24px; border: 1px solid var(--line); border-radius: 8px;
  background: rgba(255,255,255,.035); text-align: left;
}
.profile-card h3, .trait-card h3, .bond-card h3 { margin-bottom: 21px; font-family: "Songti SC", serif; font-size: 1.22rem; font-weight: 500; }
.profile-card dl { margin: 0; }
.profile-card dl div { display: flex; justify-content: space-between; gap: 15px; padding: 13px 0; border-top: 1px solid rgba(255,255,255,.09); }
.profile-card dt { color: var(--muted); }
.profile-card dd { margin: 0; text-align: right; }
.trait-explain { margin: -5px 0 16px; color: var(--muted); font-size: .88rem; line-height: 1.7; }
.trait-row { display: grid; grid-template-columns: 3.5rem 1fr 2.4rem; gap: 12px; align-items: center; margin: 14px 0; font-size: .9rem; }
.trait-row .bar { height: 8px; overflow: hidden; border-radius: 10px; background: rgba(255,255,255,.1); }
.trait-row .bar > i { display: block; height: 100%; border-radius: inherit; background: var(--result-color); }
.trait-row strong { text-align: right; font-weight: 500; }
.score-details { margin-top: 21px; padding-top: 16px; border-top: 1px solid var(--line); }
.score-details summary { color: var(--gold); cursor: pointer; font-size: .88rem; }
.score-details ol { margin: 14px 0 0; padding: 0; list-style: none; }
.score-details li { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 4px 12px; padding: 11px 0; border-top: 1px solid rgba(255,255,255,.08); font-size: .84rem; line-height: 1.5; }
.score-details li strong { color: var(--gold); white-space: nowrap; font-weight: 500; }
.score-details li small { grid-column: 1 / -1; color: var(--muted); font-size: .81rem; }
.bond-intro { margin: -5px 0 17px; color: var(--muted); font-size: .88rem; line-height: 1.65; }
#relationshipGrid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 11px; }
.bond-item { padding: 17px; border: 1px solid rgba(220, 202, 157, .18); border-radius: 6px; background: rgba(255,255,255,.025); }
.bond-item img { float: right; width: 68px; height: 68px; margin: -5px -5px 3px 8px; object-fit: contain; }
.bond-item span { display: block; margin-bottom: 7px; color: var(--gold); font-size: .82rem; letter-spacing: .08em; }
.bond-item strong { display: block; margin-bottom: 8px; font-family: "Songti SC", serif; font-size: 1.25rem; font-weight: 500; }
.bond-item p { margin-bottom: 0; color: #c9d0c7; font-size: .88rem; line-height: 1.65; }
.result-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 11px; margin-top: 27px; }
.result-actions .text-button { grid-column: 1 / -1; }
.outline-button { padding: 12px 18px; color: var(--paper); border: 1px solid var(--gold); background: transparent; }
.outline-button:hover { background: rgba(211,180,123,.1); }
.text-button { min-height: 48px; border: 0; background: transparent; color: var(--muted); text-decoration: underline; text-underline-offset: 4px; }
.text-button:hover { color: var(--paper); }

.site-footer { display: flex; justify-content: space-between; gap: 15px; padding: 22px clamp(20px, 5vw, 46px) 28px; border-top: 1px solid var(--line); color: #aeb8ae; font-size: .82rem; }
.site-footer a { color: inherit; }
.toast { position: fixed; z-index: 10; left: 50%; bottom: max(25px, env(safe-area-inset-bottom)); max-width: calc(100vw - 36px); padding: 12px 18px; border: 1px solid var(--gold); border-radius: 7px; background: #234640; color: var(--paper); text-align: center; font-size: .91rem; opacity: 0; transform: translate(-50%, 20px); pointer-events: none; transition: opacity .2s, transform .2s; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }

@media (max-width: 460px) {
  .site-header { min-height: 72px; }
  .brand-copy strong { font-size: 1.07rem; }
  .brand-copy span { font-size: .68rem; }
  .hero-card strong { font-size: .88rem; }
  .quiz-screen { padding-top: 26px; }
  .progress-track { margin: 12px 0 30px; }
  .question-note { margin-bottom: 18px; }
  .option-grid { gap: 8px; }
  .option-button { min-height: 58px; padding: 12px 15px; }
  .option-grid.compact .option-button { font-size: .89rem; }
  .quiz-actions { margin-top: 22px; }
  .persona-preview img { height: 135px; }
  .result-avatar-wrap { width: min(100%, 290px); }
  .profile-card, .trait-card, .bond-card { padding: 20px; }
  #relationshipGrid { grid-template-columns: 1fr; }
}

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