:root {
  color-scheme: light;
  --paper: #f2eee3;
  --paper-deep: #e5ddcb;
  --ink: #17211f;
  --ink-soft: #52605c;
  --indigo: #264c5a;
  --indigo-deep: #183946;
  --cinnabar: #a43a2a;
  --cinnabar-dark: #7d291f;
  --gold: #9a7740;
  --hairline: rgba(23, 33, 31, 0.16);
  --shadow: 0 24px 80px rgba(39, 48, 43, 0.12);
  --serif: "Songti SC", "STSong", "Noto Serif CJK SC", "Source Han Serif SC", serif;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  font-family: var(--sans);
  background: var(--paper);
  color: var(--ink);
  font-synthesis: none;
}

* { box-sizing: border-box; }

html { min-height: 100%; scroll-behavior: smooth; }

body {
  min-width: 320px;
  min-height: 100vh;
  margin: 0;
  background:
    radial-gradient(circle at 8% 12%, rgba(164, 58, 42, 0.05), transparent 30rem),
    linear-gradient(120deg, #f6f2e8, var(--paper) 55%, #ece6d8);
  color: var(--ink);
  line-height: 1.7;
}

button, a { -webkit-tap-highlight-color: transparent; }
button { font: inherit; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }

.paper-grain {
  position: fixed;
  inset: 0;
  z-index: 10;
  opacity: 0.21;
  pointer-events: none;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 180 180' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='.18'/%3E%3C/svg%3E");
  mix-blend-mode: multiply;
}

.site-header {
  position: relative;
  z-index: 20;
  width: min(1180px, calc(100% - 40px));
  min-height: 76px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--hairline);
}

.brand {
  display: inline-flex;
  gap: 12px;
  align-items: center;
  color: inherit;
  text-decoration: none;
  font: 700 1.12rem/1 var(--serif);
  letter-spacing: 0.12em;
}

.brand-mark { position: relative; width: 30px; height: 30px; display: inline-grid; place-items: center; }
.brand-mark i { position: absolute; border: 1px solid var(--cinnabar); border-radius: 50%; }
.brand-mark i:nth-child(1) { width: 29px; height: 29px; opacity: .4; }
.brand-mark i:nth-child(2) { width: 19px; height: 19px; opacity: .7; }
.brand-mark i:nth-child(3) { width: 7px; height: 7px; background: var(--cinnabar); }

.header-note { color: var(--ink-soft); font: 0.84rem/1 var(--serif); letter-spacing: 0.14em; }

main { position: relative; z-index: 15; min-height: calc(100vh - 160px); }
.view { animation: page-in .55s cubic-bezier(.2,.72,.28,1) both; }

.gate-view { min-height: calc(100vh - 158px); display: grid; place-items: center; padding: 42px 20px; }
.gate-card { width: min(520px, 100%); padding: clamp(34px, 7vw, 62px); border: 1px solid var(--hairline); background: rgba(249,246,237,.88); box-shadow: var(--shadow); text-align: center; }
.gate-seal { width: 62px; height: 62px; margin: 0 auto 24px; display: grid; place-items: center; border: 2px solid var(--cinnabar); color: var(--cinnabar); font: 600 1.45rem/1 var(--serif); transform: rotate(-3deg); }
.gate-card h1 { margin: 0; font: 600 clamp(2rem, 6vw, 3rem)/1.3 var(--serif); letter-spacing: .08em; }
.gate-card > p { color: var(--ink-soft); margin: 12px auto 26px; }
.access-form { display: grid; gap: 12px; }
.access-input { width: 100%; height: 62px; border: 1px solid rgba(23,33,31,.2); border-radius: 2px; background: rgba(255,255,255,.58); color: var(--ink); text-align: center; font: 600 1.55rem/1 var(--serif); letter-spacing: .5em; padding-left: .5em; }
.access-input:focus { outline: 3px solid rgba(164,58,42,.2); border-color: var(--cinnabar); }
.gate-error { min-height: 24px; margin: 0 !important; color: var(--cinnabar-dark) !important; font-size: .86rem; }

.hero {
  width: min(1180px, calc(100% - 40px));
  margin: 36px auto 0;
  min-height: min(720px, calc(100vh - 132px));
  border: 1px solid rgba(42, 57, 51, .15);
  background: #eae5d9 url("./assets/time-river.png") center / cover no-repeat;
  box-shadow: var(--shadow);
  position: relative;
  overflow: hidden;
  display: grid;
  align-items: center;
}

.hero::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, rgba(244, 240, 230, .98) 0%, rgba(244, 240, 230, .86) 39%, rgba(244, 240, 230, .18) 72%, rgba(244, 240, 230, .05));
}

.hero-content { position: relative; z-index: 1; width: min(540px, 52%); padding: 64px clamp(34px, 6vw, 86px); }
.eyebrow { margin: 0 0 18px; color: var(--cinnabar); font-size: .78rem; font-weight: 700; letter-spacing: .28em; }
.hero h1 { margin: 0; font: 600 clamp(3.7rem, 7vw, 6.6rem)/1.05 var(--serif); letter-spacing: .1em; }
.hero-subtitle { margin: 20px 0 0; color: var(--indigo-deep); font: 500 clamp(1.12rem, 2vw, 1.4rem)/1.7 var(--serif); letter-spacing: .12em; }
.hero-intro { max-width: 32rem; margin: 30px 0; color: #394743; font-size: 1rem; }

.meta-row { display: flex; flex-wrap: wrap; gap: 10px 18px; margin: 0 0 34px; padding: 0; list-style: none; color: var(--ink-soft); font-size: .86rem; }
.meta-row li { display: inline-flex; align-items: center; gap: 8px; }
.meta-row li::before { content: ""; width: 5px; height: 5px; border-radius: 50%; background: var(--gold); }

.btn {
  min-height: 48px;
  border: 0;
  border-radius: 2px;
  padding: 0 24px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  cursor: pointer;
  transition: transform .2s ease, background .2s ease, color .2s ease, box-shadow .2s ease;
  font-size: .95rem;
  font-weight: 650;
  letter-spacing: .06em;
}
.btn:hover { transform: translateY(-2px); }
.btn:focus-visible, .option:focus-visible, .brand:focus-visible { outline: 3px solid rgba(164, 58, 42, .3); outline-offset: 3px; }
.btn-primary { color: #fffaf0; background: var(--cinnabar); box-shadow: 0 10px 24px rgba(126, 40, 30, .2); }
.btn-primary:hover { background: var(--cinnabar-dark); }
.btn-quiet { color: var(--indigo-deep); background: rgba(255,255,255,.35); border: 1px solid var(--hairline); }
.btn-link { min-height: 42px; padding: 0 8px; color: var(--ink-soft); background: transparent; }
.arrow { font-size: 1.15em; transition: transform .2s ease; }
.btn:hover .arrow { transform: translateX(3px); }
.resume-note { margin: 14px 0 0; color: var(--ink-soft); font-size: .82rem; }

.test-shell { width: min(920px, calc(100% - 32px)); margin: 40px auto 80px; }
.test-top { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 20px; margin-bottom: 26px; }
.progress-copy { font: 600 .92rem/1 var(--serif); letter-spacing: .12em; white-space: nowrap; }
.progress-track { height: 2px; background: rgba(38, 76, 90, .15); overflow: hidden; }
.progress-fill { height: 100%; background: var(--cinnabar); transition: width .35s ease; }
.progress-percent { color: var(--ink-soft); font-size: .78rem; font-variant-numeric: tabular-nums; }

.question-card {
  position: relative;
  min-height: 590px;
  padding: clamp(28px, 5vw, 58px);
  background: rgba(249, 246, 237, .82);
  border: 1px solid var(--hairline);
  box-shadow: var(--shadow);
  overflow: hidden;
}
.question-card::before { content: attr(data-number); position: absolute; right: 28px; top: -28px; color: rgba(38, 76, 90, .055); font: 700 8rem/1 var(--serif); }
.question-kicker { color: var(--cinnabar); font-size: .78rem; font-weight: 700; letter-spacing: .2em; }
.question-title { max-width: 750px; margin: 14px 0 34px; font: 600 clamp(1.45rem, 3vw, 2.15rem)/1.55 var(--serif); letter-spacing: .035em; }
.options { display: grid; gap: 12px; }
.option {
  width: 100%;
  min-height: 68px;
  padding: 15px 20px;
  border: 1px solid rgba(23, 33, 31, .14);
  background: rgba(255,255,255,.36);
  color: var(--ink);
  cursor: pointer;
  text-align: left;
  display: grid;
  grid-template-columns: 34px 1fr;
  align-items: center;
  gap: 14px;
  transition: border .18s ease, background .18s ease, transform .18s ease;
  font-size: 1rem;
  line-height: 1.55;
}
.option:hover { transform: translateX(4px); border-color: rgba(164, 58, 42, .55); background: rgba(255,255,255,.7); }
.option[aria-pressed="true"] { border-color: var(--cinnabar); background: rgba(164, 58, 42, .075); }
.option-mark { width: 30px; height: 30px; border: 1px solid rgba(164, 58, 42, .34); display: grid; place-items: center; color: var(--cinnabar); font: 600 .82rem/1 var(--serif); }
.test-actions { display: flex; justify-content: space-between; margin-top: 20px; }

.loading-view { min-height: calc(100vh - 158px); display: grid; place-items: center; padding: 40px 20px; text-align: center; }
.loading-rings { width: 132px; height: 132px; margin: 0 auto 30px; position: relative; display: grid; place-items: center; }
.loading-rings i { position: absolute; border: 1px solid var(--indigo); border-radius: 50%; animation: echo 2.2s ease-out infinite; }
.loading-rings i:nth-child(1) { width: 38px; height: 38px; }
.loading-rings i:nth-child(2) { width: 38px; height: 38px; animation-delay: .6s; }
.loading-rings i:nth-child(3) { width: 38px; height: 38px; animation-delay: 1.2s; }
.loading-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--cinnabar); }
.loading-view h1 { margin: 0; font: 600 clamp(1.8rem, 4vw, 2.5rem)/1.4 var(--serif); letter-spacing: .08em; }
.loading-view p { color: var(--ink-soft); }

.result-shell { width: min(1060px, calc(100% - 32px)); margin: 44px auto 80px; }
.result-hero { display: grid; grid-template-columns: minmax(250px, .72fr) 1.28fr; border: 1px solid var(--hairline); background: rgba(248,245,235,.86); box-shadow: var(--shadow); }
.person-panel { position: relative; min-height: 430px; padding: 42px; background: var(--indigo-deep); color: #f3eee1; display: flex; flex-direction: column; justify-content: space-between; overflow: hidden; }
.person-panel::before, .person-panel::after { content: ""; position: absolute; border: 1px solid rgba(242,238,227,.14); border-radius: 50%; }
.person-panel::before { width: 310px; height: 310px; right: -135px; top: -80px; }
.person-panel::after { width: 220px; height: 220px; right: -95px; top: -35px; }
.result-label { margin: 0; color: #cfb47b; font-size: .75rem; font-weight: 700; letter-spacing: .24em; }
.person-name { margin: 16px 0 0; font: 600 clamp(3.4rem, 7vw, 5.6rem)/1.08 var(--serif); letter-spacing: .1em; }
.person-meta { margin: 12px 0 0; color: rgba(244,240,231,.72); font-size: .9rem; }
.person-stamp { width: 76px; height: 76px; display: grid; place-items: center; align-self: flex-end; border: 2px solid #d86b55; color: #ef9a83; font: 600 1.1rem/1.2 var(--serif); transform: rotate(-3deg); }
.match-panel { padding: clamp(34px, 6vw, 64px); }
.match-index { display: flex; align-items: flex-end; gap: 12px; color: var(--cinnabar); }
.match-index strong { font: 600 clamp(3.2rem, 7vw, 5rem)/.9 var(--serif); }
.match-index span { font-size: .9rem; letter-spacing: .12em; }
.certainty { margin: 18px 0; color: var(--ink-soft); font-size: .88rem; }
.keywords { display: flex; flex-wrap: wrap; gap: 8px; margin: 20px 0 28px; }
.keywords span { padding: 5px 11px; border: 1px solid rgba(164,58,42,.28); color: var(--cinnabar-dark); font-size: .82rem; }
.essence { margin: 0; font: 500 clamp(1.15rem, 2.4vw, 1.5rem)/1.8 var(--serif); }

.report-grid { display: grid; grid-template-columns: .85fr 1.15fr; gap: 22px; margin-top: 22px; }
.report-card { padding: clamp(26px, 4vw, 42px); border: 1px solid var(--hairline); background: rgba(249,246,237,.68); }
.report-card h2 { margin: 0 0 22px; font: 600 1.35rem/1.4 var(--serif); letter-spacing: .08em; }
.reason-list { display: grid; gap: 22px; }
.reason-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.reason-head strong { font: 600 1rem/1.2 var(--serif); }
.reason-head span { color: var(--cinnabar); font-variant-numeric: tabular-nums; }
.bar { height: 4px; margin: 9px 0; background: rgba(38,76,90,.12); }
.bar i { display: block; height: 100%; background: linear-gradient(90deg, var(--indigo), var(--cinnabar)); }
.reason p { margin: 0; color: var(--ink-soft); font-size: .92rem; }
.dimension-list { display: grid; gap: 11px; }
.dimension-row { display: grid; grid-template-columns: 84px 1fr 34px; gap: 12px; align-items: center; font-size: .86rem; }
.dimension-row .bar { margin: 0; }
.dimension-row output { text-align: right; color: var(--ink-soft); font-variant-numeric: tabular-nums; }

.chapters { margin-top: 22px; border-top: 1px solid var(--hairline); }
.chapter { display: grid; grid-template-columns: 180px 1fr; gap: 36px; padding: 34px 4px; border-bottom: 1px solid var(--hairline); }
.chapter h2 { margin: 0; color: var(--indigo-deep); font: 600 1.15rem/1.5 var(--serif); letter-spacing: .08em; }
.chapter p { margin: 0; max-width: 46rem; color: #34433f; font-size: 1rem; }
.chapter.caution h2 { color: var(--cinnabar-dark); }
.closing { position: relative; margin: 38px 0 0; padding: clamp(36px, 7vw, 76px); text-align: center; background: var(--indigo-deep); color: #f3eee1; overflow: hidden; }
.closing::before { content: "千年一问"; position: absolute; inset: 50% auto auto 50%; transform: translate(-50%,-50%); font: 600 7rem/1 var(--serif); color: rgba(255,255,255,.025); white-space: nowrap; }
.closing p { position: relative; margin: 0; font: 500 clamp(1.35rem, 3vw, 2rem)/1.75 var(--serif); letter-spacing: .08em; }
.closing small { position: relative; display: block; margin-top: 14px; color: #cdb680; letter-spacing: .16em; }
.result-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 12px; margin-top: 26px; }
.privacy-note { margin: 20px auto 0; max-width: 42rem; text-align: center; color: var(--ink-soft); font-size: .78rem; }

.promo-card { margin-top: 22px; padding: clamp(28px, 5vw, 46px); text-align: center; border: 1px solid var(--hairline); background: rgba(249,246,237,.78); }
.promo-label { margin: 0 0 9px; color: var(--cinnabar); font-size: .76rem; font-weight: 700; letter-spacing: .22em; }
.promo-name { margin: 0; font: 600 clamp(1.45rem, 3vw, 2rem)/1.35 var(--serif); letter-spacing: .05em; }
.promo-help { margin: 8px 0 0; color: var(--ink-soft); font-size: .9rem; }

.error-state { width: min(620px, calc(100% - 32px)); margin: 100px auto; padding: 48px; border: 1px solid var(--hairline); background: rgba(255,255,255,.35); text-align: center; }
.error-state h1 { font: 600 2rem/1.4 var(--serif); }

.confirm-dialog { width: min(420px, calc(100% - 32px)); border: 1px solid var(--hairline); padding: 34px; background: var(--paper); color: var(--ink); text-align: center; box-shadow: var(--shadow); }
.confirm-dialog::backdrop, .save-dialog::backdrop { background: rgba(13,26,25,.48); backdrop-filter: blur(3px); }
.confirm-dialog h2 { margin: 14px 0 4px; font: 600 1.55rem/1.4 var(--serif); }
.confirm-dialog p { margin: 0 0 24px; color: var(--ink-soft); }
.dialog-seal { width: 44px; height: 44px; margin: auto; display: grid; place-items: center; border: 2px solid var(--cinnabar); color: var(--cinnabar); font: 600 1.1rem/1 var(--serif); }
.dialog-actions { display: flex; gap: 10px; }
.dialog-actions .btn { flex: 1; }

.save-dialog { width: min(620px, calc(100% - 24px)); max-height: 90vh; border: 1px solid var(--hairline); padding: 28px; background: var(--paper); color: var(--ink); box-shadow: var(--shadow); text-align: center; }
.save-dialog h2 { margin: 0; font: 600 1.55rem/1.4 var(--serif); }
.save-dialog > p { margin: 6px 0 18px; color: var(--ink-soft); font-size: .9rem; }
.save-close { position: absolute; right: 12px; top: 8px; border: 0; background: transparent; color: var(--ink-soft); font-size: 1.8rem; cursor: pointer; }
.save-preview { max-height: 56vh; margin: 0 auto 18px; overflow: auto; border: 1px solid var(--hairline); background: #ddd6c6; }
.save-preview img { display: block; width: 100%; height: auto; }

.site-footer { position: relative; z-index: 15; width: min(1180px, calc(100% - 40px)); margin: 0 auto; padding: 26px 0 38px; border-top: 1px solid var(--hairline); display: flex; justify-content: space-between; gap: 20px; color: var(--ink-soft); font-size: .75rem; }
.site-footer p { margin: 0; }
noscript { display: block; padding: 40px; text-align: center; }

@keyframes page-in { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
@keyframes echo { 0% { width: 34px; height: 34px; opacity: .9; } 100% { width: 132px; height: 132px; opacity: 0; } }

@media (max-width: 760px) {
  .site-header { min-height: 64px; width: min(100% - 28px, 1180px); }
  .header-note { display: none; }
  .hero { width: calc(100% - 24px); min-height: 690px; margin-top: 18px; align-items: end; background-position: 61% center; }
  .hero::after { background: linear-gradient(0deg, rgba(244,240,230,.98) 0%, rgba(244,240,230,.9) 52%, rgba(244,240,230,.18) 100%); }
  .hero-content { width: 100%; padding: 36px 26px 42px; }
  .hero h1 { font-size: clamp(3.25rem, 17vw, 4.8rem); }
  .hero-intro { margin: 22px 0; }
  .question-card { min-height: 600px; padding: 28px 20px; }
  .test-top { gap: 12px; }
  .option { padding: 14px; grid-template-columns: 30px 1fr; }
  .result-hero, .report-grid { grid-template-columns: 1fr; }
  .person-panel { min-height: 320px; padding: 30px; }
  .match-panel { padding: 32px 26px; }
  .chapter { grid-template-columns: 1fr; gap: 10px; padding: 28px 2px; }
  .site-footer { width: calc(100% - 28px); flex-direction: column; gap: 4px; }
}

@media (max-width: 430px) {
  .meta-row { gap: 7px 12px; }
  .btn { width: 100%; }
  .test-actions .btn { width: auto; }
  .question-title { font-size: 1.35rem; }
  .option { font-size: .94rem; }
  .result-actions { flex-direction: column; }
  .dimension-row { grid-template-columns: 76px 1fr 30px; gap: 8px; }
}

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

@media print {
  .site-header, .site-footer, .result-actions, .paper-grain { display: none !important; }
  .result-shell { width: 100%; margin: 0; }
  .result-hero, .report-card { box-shadow: none; }
  body { background: #fff; }
}
