:root {
  --snow: #f5f6f8;
  --ink: #1d1d1f;
  --moon: #86868b;
  --red: #a3262a;
  --red-wash: rgba(163, 38, 42, .10);
  --bamboo: #4b7461;
  --glass: rgba(255, 255, 255, .56);
  --line: rgba(29, 29, 31, .09);
  --ease: cubic-bezier(.16, 1, .3, 1);
}

* { box-sizing: border-box; }
html { min-height: 100%; background: var(--snow); }
body {
  min-width: 320px; min-height: 100vh; margin: 0; color: var(--ink);
  background: radial-gradient(circle at 13% 9%, rgba(255,255,255,.98), transparent 24%), radial-gradient(circle at 89% 12%, rgba(75,116,97,.10), transparent 22%), radial-gradient(circle at 52% 102%, rgba(163,38,42,.09), transparent 30%), var(--snow);
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  -webkit-font-smoothing: antialiased;
}
button, textarea { font: inherit; }
button { cursor: pointer; }

.realm-shell { position: relative; display: grid; place-items: center; min-height: 100vh; padding: 32px 20px; overflow: hidden; isolation: isolate; }
.ambient { position: fixed; z-index: -1; width: min(58vw, 640px); aspect-ratio: 1; border-radius: 46% 54% 61% 39%; filter: blur(44px); opacity: .65; pointer-events: none; }
.ambient-one { top: -22%; left: -14%; background: rgba(255,255,255,.95); }
.ambient-two { right: -18%; bottom: -20%; background: rgba(75,116,97,.13); }

.stage { display: none; grid-area: 1 / 1; width: min(100%, 660px); padding: clamp(34px, 7vw, 58px); border: 1px solid rgba(255,255,255,.84); border-radius: 30px; background: linear-gradient(140deg, rgba(255,255,255,.70), var(--glass)); box-shadow: 0 34px 100px rgba(29,29,31,.10), 0 2px 10px rgba(29,29,31,.025), inset 0 1px 0 rgba(255,255,255,.88); backdrop-filter: blur(34px) saturate(145%); -webkit-backdrop-filter: blur(34px) saturate(145%); }
.stage.is-active, .stage.is-leaving { display: block; }
.stage.is-active { animation: stage-in .66s var(--ease) both; }
.stage.is-leaving { z-index: 1; pointer-events: none; animation: stage-out .42s var(--ease) both; }
@keyframes stage-in { from { opacity: 0; transform: translateY(18px) scale(.985); filter: blur(8px); } 60% { filter: blur(0); } to { opacity: 1; transform: translateY(0) scale(1); filter: none; } }
@keyframes stage-out { from { opacity: 1; transform: translateY(0) scale(1); filter: none; } to { opacity: 0; transform: translateY(-12px) scale(.988); filter: blur(5px); } }

.eyebrow, .question-kicker { margin: 0 0 17px; color: var(--moon); font-size: 10px; font-weight: 650; letter-spacing: .16em; }
h1, h2 { margin: 0; font-family: "Songti SC", "STSong", "Noto Serif CJK SC", serif; font-weight: 300; letter-spacing: -.055em; }
h1 { font-size: clamp(52px, 11vw, 80px); line-height: 1.08; }
h2 { font-size: clamp(30px, 6.2vw, 45px); line-height: 1.3; text-wrap: balance; }
.site-subtitle { margin: 13px 0 0; color: var(--bamboo); font-size: 14px; letter-spacing: .2em; }
#gate-stage { text-align: center; }
.intro-copy { margin: 33px auto 25px; color: #5d5d61; font-size: 15px; line-height: 1.85; }
.disclaimer { max-width: 380px; margin: 10px auto 0; color: var(--moon); font-size: 11px; line-height: 1.6; }
.scope-notice { max-width: 490px; margin: 0 auto 17px; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); color: var(--moon); text-align: left; }
.scope-notice summary { padding: 14px 0; color: var(--bamboo); cursor: pointer; font-size: 12px; list-style: none; }
.scope-notice summary::-webkit-details-marker { display: none; }
.scope-notice summary::after { float: right; content: "+"; color: var(--red); font-size: 15px; line-height: .8; }
.scope-notice[open] summary::after { content: "−"; }
.scope-copy { padding: 0 0 5px; font-size: 11px; line-height: 1.75; }
.scope-copy p { margin: 0 0 12px; }
.scope-copy strong { color: var(--ink); font-weight: 600; }
.consent-control { display: flex; align-items: flex-start; justify-content: center; gap: 8px; margin: 0 auto 18px; color: var(--moon); font-size: 11px; line-height: 1.55; text-align: left; }
.consent-control input { width: 15px; height: 15px; margin: 1px 0 0; accent-color: var(--red); }

.primary-button { min-width: 146px; padding: 14px 28px; border: 0; border-radius: 999px; color: #fff; background: var(--red); box-shadow: 0 12px 26px rgba(163,38,42,.20); font-size: 14px; letter-spacing: .08em; transition: transform .2s var(--ease), background .2s var(--ease), box-shadow .2s var(--ease); }
.primary-button:hover { background: #8b1d22; box-shadow: 0 15px 30px rgba(163,38,42,.28); transform: translateY(-2px); }
.primary-button:active { transform: scale(.98); }
.primary-button:disabled { cursor: not-allowed; opacity: .38; box-shadow: none; transform: none; }
.primary-button.compact { min-width: 120px; padding: 11px 18px; }

.quiz-meta, .result-topline, .question-actions { display: flex; align-items: center; justify-content: space-between; gap: 20px; }
.quiz-meta { color: var(--moon); font-size: 12px; letter-spacing: .04em; }
#question-echo { color: var(--bamboo); text-align: right; }
.progress-track { height: 2px; margin: 20px 0 46px; overflow: hidden; background: rgba(29,29,31,.10); }
#progress-bar { display: block; width: 8%; height: 100%; background: var(--red); transition: width .65s var(--ease); }
.question-kicker { color: var(--red); }
.answer-label { display: block; margin: 31px 0 10px; color: var(--moon); font-size: 12px; }
textarea { width: 100%; min-height: 110px; padding: 15px 0; border: 0; border-bottom: 1px solid var(--line); outline: 0; resize: vertical; color: var(--ink); background: transparent; font-size: 16px; line-height: 1.7; transition: border-color .2s var(--ease); }
textarea::placeholder { color: #a5a5aa; }
textarea:focus { border-color: var(--red); }
.question-actions { margin-top: 18px; color: var(--moon); font-size: 11px; }
.text-button, .restart-button { padding: 5px 0; border: 0; color: var(--red); background: transparent; font-size: 14px; }
.text-button span { display: inline-block; margin-left: 6px; transition: transform .2s var(--ease); }
.text-button:hover span { transform: translateX(4px); }
.options { display: grid; gap: 10px; margin-top: 29px; }
.option { width: 100%; padding: 15px 17px; border: 1px solid var(--line); border-radius: 17px; color: var(--ink); background: rgba(255,255,255,.47); text-align: left; transition: .2s var(--ease); }
.option:hover, .option.is-selected { border-color: rgba(163,38,42,.45); color: var(--red); background: var(--red-wash); transform: translateY(-1px); }

.selection-summary { margin: 23px 0 9px; color: #55555a; font-size: 16px; line-height: 1.75; }
.selection-hint { margin: 0 0 26px; color: var(--moon); font-size: 12px; }
.anchors { display: grid; gap: 11px; }
.anchor { padding: 18px 18px 17px; border: 1px solid var(--line); border-radius: 18px; color: var(--ink); background: rgba(255,255,255,.45); text-align: left; transition: .2s var(--ease); }
.anchor small { display: block; margin-bottom: 7px; color: var(--bamboo); font-size: 10px; letter-spacing: .1em; }
.anchor:hover { border-color: rgba(163,38,42,.34); background: rgba(255,255,255,.77); box-shadow: 0 13px 27px rgba(29,29,31,.055); transform: translateY(-2px); }

.result-topline { margin-bottom: 24px; }
.result-topline .eyebrow { margin: 0; }
.result-stage.is-generating .result-topline,
.result-stage.is-generating .result-label,
.result-stage.is-generating .archetype,
.result-stage.is-generating .verse,
.result-stage.is-generating .analysis-content,
.result-stage.is-generating .ai-note,
.result-stage.is-generating .prompt-notice,
.result-stage.is-generating .result-actions,
.result-stage.is-generating .result-engagement { display: none; }
.result-stage.is-generating { display: grid; min-height: min(70vh, 520px); place-items: center; text-align: center; }
.result-stage.is-generating h2 { margin: 0; color: var(--bamboo); font-size: clamp(34px, 8vw, 52px); font-weight: 300; letter-spacing: .17em; }
.result-label { margin: 0 0 7px; color: var(--moon); font-size: 12px; }
.archetype { margin: 15px 0 0; color: var(--bamboo); font-size: 14px; letter-spacing: .07em; }
.verse { margin: 33px 0 28px; padding: 17px 0 17px 19px; border-left: 2px solid var(--red); color: #454549; font-family: "Songti SC", "STSong", serif; font-size: 18px; line-height: 1.85; white-space: pre-line; }
.analysis-content { color: #353539; font-size: 15px; line-height: 1.86; }
.analysis-content h3 { margin: 27px 0 8px; color: var(--ink); font-family: "Songti SC", serif; font-size: 20px; font-weight: 400; }
.analysis-content p { margin: 0; }
.analysis-content .remedy { padding: 15px 17px; border-radius: 16px; color: #425c50; background: rgba(75,116,97,.08); }
.ai-note { margin: 29px 0 0; color: var(--moon); font-size: 11px; line-height: 1.6; }
.prompt-notice { margin-top: 14px; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); color: var(--moon); }
.prompt-notice summary { padding: 13px 0; color: var(--bamboo); cursor: pointer; font-size: 12px; list-style: none; }
.prompt-notice summary::-webkit-details-marker { display: none; }
.prompt-notice summary::after { float: right; content: "+"; color: var(--red); font-size: 15px; line-height: .8; }
.prompt-notice[open] summary::after { content: "−"; }
.prompt-notice p { margin: 0 0 10px; font-size: 11px; line-height: 1.65; }
.prompt-notice pre { margin: 0 0 16px; padding: 13px; overflow-x: auto; border-radius: 13px; color: #4f4f54; background: rgba(29,29,31,.045); font-family: "SFMono-Regular", Consolas, monospace; font-size: 10px; line-height: 1.7; white-space: pre-wrap; }
.result-actions { margin-top: 23px; }
.result-engagement { margin-top: 39px; padding-top: 25px; border-top: 1px solid var(--line); }
.engagement-block { padding: 2px 0 24px; }
.engagement-block + .engagement-block { padding-top: 23px; border-top: 1px solid var(--line); }
.engagement-kicker { margin: 0 0 8px; color: var(--bamboo); font-size: 10px; font-weight: 650; letter-spacing: .14em; }
.engagement-block h3 { margin: 0 0 9px; font-family: "Songti SC", "STSong", serif; font-size: 20px; font-weight: 400; }
.engagement-block p { max-width: 510px; margin: 0 0 10px; color: var(--moon); font-size: 13px; line-height: 1.75; }
.engagement-link { color: var(--red); font-size: 13px; text-decoration: none; text-underline-offset: 4px; }
.engagement-link:hover { text-decoration: underline; }
.support-block { display: grid; justify-items: center; margin-top: 3px; padding: 24px; border-radius: 22px; background: rgba(75,116,97,.07); text-align: center; }
.support-block p { max-width: 330px; margin: 0 0 16px; color: #4b6257; font-size: 13px; line-height: 1.65; }
.donation-qr { display: block; width: min(170px, 55vw); margin: 0 0 11px; border-radius: 12px; background: #fff; box-shadow: 0 8px 22px rgba(29,29,31,.09); }
.support-block span { color: var(--moon); font-size: 11px; }

.care-dialog { width: min(440px, calc(100% - 34px)); padding: 29px; border: 1px solid rgba(255,255,255,.9); border-radius: 24px; color: var(--ink); background: rgba(250,250,251,.92); box-shadow: 0 28px 70px rgba(29,29,31,.18); }
.care-dialog::backdrop { background: rgba(29,29,31,.22); backdrop-filter: blur(8px); }
.care-dialog p:not(.eyebrow) { margin: 0 0 21px; line-height: 1.75; }

@media (prefers-color-scheme: dark) {
  :root { --snow: #000; --ink: #f5f5f7; --moon: #a1a1a6; --glass: rgba(25,25,27,.62); --line: rgba(255,255,255,.12); }
  body { background: radial-gradient(circle at 80% 8%, rgba(75,116,97,.22), transparent 24%), radial-gradient(circle at 10% 105%, rgba(163,38,42,.20), transparent 32%), #000; }
  .stage { border-color: rgba(255,255,255,.12); background: linear-gradient(140deg, rgba(37,37,40,.72), var(--glass)); box-shadow: 0 34px 100px rgba(0,0,0,.45), inset 0 1px 0 rgba(255,255,255,.08); }
  .intro-copy, .selection-summary, .analysis-content, .verse { color: #d0d0d4; }
  .prompt-notice pre { color: #d0d0d4; background: rgba(255,255,255,.055); }
  .option, .anchor { color: var(--ink); background: rgba(255,255,255,.045); }
  .care-dialog { color: var(--ink); background: #202023; }
  .support-block { background: rgba(75,116,97,.14); }
  .support-block p { color: #b2c3ba; }
}
@media (max-width: 540px) { .realm-shell { align-items: start; padding: 16px 12px; } .stage { margin-top: 2vh; padding: 32px 23px; border-radius: 25px; } .progress-track { margin-bottom: 34px; } }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation-duration: 1ms !important; transition-duration: 1ms !important; } }
