/* 走进化学命理 · 元素宇宙界面（ELEMENT-08）：全屏 3D 元素宇宙背景、首页出生信息面板、沉浸式分析、结果页事件章节。 */
body.cosmos-page { background: #02040b; overflow-x: hidden; }
body.cosmos-page::before { display: none; }
.cosmos-bg { position: fixed; inset: 0; z-index: 0; pointer-events: none; }
.cosmos-bg canvas, .cosmos-stage canvas { width: 100%; height: 100%; display: block; }
.cosmos-fallback {
  position: absolute; inset: 0; pointer-events: none; opacity: 0; transition: opacity .8s;
  background:
    radial-gradient(60vmax 40vmax at 70% 30%, rgba(40,120,150,.28), transparent 60%),
    radial-gradient(50vmax 40vmax at 20% 70%, rgba(120,50,170,.22), transparent 60%),
    radial-gradient(30vmax 20vmax at 50% 50%, rgba(217,174,98,.14), transparent 70%),
    radial-gradient(1px 1px at 12% 18%, #fff9, transparent), radial-gradient(1px 1px at 67% 32%, #fff7, transparent),
    radial-gradient(1.4px 1.4px at 82% 74%, #ffe9b8, transparent), radial-gradient(1px 1px at 31% 81%, #fff6, transparent),
    #02040b;
  background-size: auto, auto, auto, 520px 520px, 520px 520px, 520px 520px, 520px 520px, auto;
}
body.no-webgl .cosmos-fallback { opacity: 1; }
body.cosmos-page .topbar { background: linear-gradient(180deg, rgba(2,4,11,.72), rgba(2,4,11,.18)); border-bottom-color: transparent; position: relative; z-index: 5; }
body.cosmos-page main { position: relative; z-index: 2; }
body.cosmos-page .foot { position: relative; z-index: 2; background: rgba(2,4,11,.78); }
.display { text-wrap: balance; font-family: var(--serif); font-size: clamp(2.4rem, 6vw, 4.6rem); line-height: 1.08; margin: .1em 0 .3em; letter-spacing: .08em; text-shadow: 0 0 40px rgba(217,174,98,.25); }
.glass-soft { background: linear-gradient(160deg, rgba(14,22,42,.62), rgba(8,12,26,.42)); border: 1px solid rgba(255,255,255,.08); border-radius: var(--radius); backdrop-filter: blur(10px) saturate(130%); -webkit-backdrop-filter: blur(10px) saturate(130%); }
.btn.glow { background: linear-gradient(120deg, #f6e2b3, #d9ae62 50%, #fff0c8); color: #1a1408; box-shadow: 0 0 0 1px rgba(255,236,190,.4), 0 8px 32px rgba(217,174,98,.35); }
.btn.glow:hover { box-shadow: 0 0 0 1px rgba(255,236,190,.6), 0 10px 44px rgba(217,174,98,.55); }
.fine { font-size: .8rem; color: var(--muted); line-height: 1.6; margin: .8em 0 0; }

/* ---------- 首页 ---------- */
.home main { max-width: 1240px; }
/* 背景画布在 main 内（position: fixed; z-index: 0），正文区块须建立更高的层级才能显示在画布之上 */
.home-hero, .home-section, .result-v2 > * { position: relative; z-index: 1; }
.home-hero { min-height: calc(100dvh - 70px); display: grid; grid-template-columns: 1.08fr .92fr; gap: clamp(20px, 4vw, 56px); align-items: center; padding: 2vh 0 6vh; }
.hero-text { position: relative; align-self: end; padding-bottom: 2vh; }
.hero-text::before { content: ""; position: absolute; inset: -12% -10% -8% -14%; background: radial-gradient(closest-side, rgba(2,4,11,.66), rgba(2,4,11,.35) 60%, rgba(2,4,11,0)); z-index: -1; pointer-events: none; }
.hero-text .lead { font-size: clamp(1rem, 1.6vw, 1.14rem); color: #d9dde8; max-width: 38em; }
.hero-points { list-style: none; padding: 0; margin: 1.4em 0 0; display: grid; gap: .7em; }
.hero-points li { padding-left: 1.4em; position: relative; color: #c9cfdc; }
.hero-points li::before { content: ""; position: absolute; left: 0; top: .62em; width: .55em; height: .55em; border-radius: 50%; background: radial-gradient(circle, #fff3d1, #d9ae62 60%, transparent 70%); box-shadow: 0 0 10px #d9ae62; }
.hero-points b { color: var(--gold-1); margin-right: .5em; font-weight: 600; }
.birth-card { padding: clamp(18px, 2.6vw, 30px); position: relative; }
.birth-card h2 { margin: 0 0 .6em; font-size: 1.35rem; }
.birth-card .form, .birth-card { display: grid; gap: 12px; }
.birth-card label { display: grid; gap: 4px; font-size: .92rem; color: #c9cfdc; }
.birth-card input[type=text], .birth-card input[type=date], .birth-card input[type=time], .birth-card select {
  background: rgba(4,8,18,.6); border: 1px solid rgba(255,255,255,.14); border-radius: 10px; color: var(--ink); padding: .6em .8em; font: inherit; width: 100%; box-sizing: border-box; min-height: 44px;
}
.birth-card input:focus, .birth-card select:focus { outline: none; border-color: #d9ae62; box-shadow: 0 0 0 3px rgba(217,174,98,.22); }
.seg { border: 0; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.seg legend { width: 100%; font-size: .92rem; color: #c9cfdc; margin-bottom: 4px; padding: 0; }
.seg legend small { color: var(--muted); }
.seg label { display: inline-flex; align-items: center; gap: 6px; padding: .45em 1em; border-radius: 999px; border: 1px solid rgba(255,255,255,.14); background: rgba(4,8,18,.45); cursor: pointer; min-height: 40px; box-sizing: border-box; }
.seg label:has(input:checked) { border-color: #d9ae62; color: #fff3d1; background: rgba(217,174,98,.14); }
.seg input { accent-color: #d9ae62; }
.birth-card .row3 { display: grid; grid-template-columns: 1.2fr 1fr 1fr; gap: 8px; }
.birth-card .check-line { display: flex; align-items: center; gap: 8px; }
.birth-card .place { position: relative; }
.birth-card .suggest { position: absolute; left: 0; right: 0; top: 100%; z-index: 20; margin: 4px 0 0; padding: 4px; list-style: none; background: rgba(8,12,24,.97); border: 1px solid rgba(255,255,255,.14); border-radius: 10px; max-height: 260px; overflow: auto; }
.birth-card .suggest li { padding: .5em .7em; border-radius: 8px; cursor: pointer; display: flex; justify-content: space-between; gap: 8px; }
.birth-card .suggest li.active, .birth-card .suggest li:hover { background: rgba(217,174,98,.16); }
.home-section { margin: 0 0 clamp(28px, 6vh, 64px); padding: clamp(18px, 3vw, 36px); }
.home-section h2 { margin-top: 0; }
.pipe { list-style: none; counter-reset: pipe; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; }
.pipe li { counter-increment: pipe; padding: 16px; border-radius: 14px; background: rgba(255,255,255,.035); border: 1px solid rgba(255,255,255,.06); display: grid; gap: 6px; position: relative; }
.pipe li::before { content: counter(pipe, decimal-leading-zero); font: 600 .78rem/1 ui-monospace, Consolas, monospace; color: #d9ae62; letter-spacing: .1em; }
.pipe b { font-family: var(--serif); font-size: 1.1rem; color: var(--gold-1); }
.pipe span { color: #b9c0cf; font-size: .92rem; }
.rx-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 14px; }
.rx-card { padding: 16px 18px; }
.rx-card h3 { margin: 0 0 .5em; font-size: 1.05rem; color: var(--gold-1); }
.rx-card p { margin: .5em 0; font-size: .9rem; color: #c3c9d6; }
.rx-card b { color: #fff; margin-right: .5em; }
.rx-glyph { display: inline-block; min-width: 6.5em; font: 500 .82rem/1.4 ui-monospace, Consolas, "Cambria Math", monospace; color: #9fd2ff; margin-right: .6em; }
.deliver-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 14px; }
.deliver-grid article { padding: 16px 18px; }
.deliver-grid h3 { margin: 0 0 .4em; font-size: 1.02rem; color: var(--gold-1); }
.deliver-grid p { margin: 0; color: #c3c9d6; font-size: .92rem; }
.principles ul { margin: 0; padding-left: 1.1em; display: grid; gap: .5em; color: #c9cfdc; }

/* ---------- 沉浸式分析 ---------- */
body.immersive main { max-width: none; padding: 0; margin: 0; }
body.immersive .topbar { position: absolute; left: 0; right: 0; top: 0; background: transparent; }
.cosmos-stage { position: relative; width: 100%; height: 100dvh; min-height: 520px; overflow: hidden; background: #02040b; }
.cosmos-stage canvas { position: absolute; inset: 0; }
.hud { position: absolute; left: clamp(16px, 3vw, 36px); bottom: clamp(16px, 4vh, 40px); width: min(400px, calc(100% - 32px)); padding: 16px 18px; z-index: 3; }
.hud-title { margin: 0 0 .6em; font-family: var(--serif); font-size: 1.1rem; color: var(--gold-1); letter-spacing: .06em; }
.hud-steps { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.hud-steps li { display: grid; gap: 2px; padding-left: 22px; position: relative; color: #6f7890; transition: color .4s; font-size: .9rem; }
.hud-steps li::before { content: ""; position: absolute; left: 2px; top: .45em; width: 9px; height: 9px; border-radius: 50%; border: 1px solid #4b556c; }
.hud-steps li.active { color: #e8ecf5; }
.hud-steps li.active::before { border-color: #d9ae62; box-shadow: 0 0 12px #d9ae62; animation: hudPulse 1.1s ease-in-out infinite; }
.hud-steps li.done { color: #b9c0cf; }
.hud-steps li.done::before { background: #d9ae62; border-color: #d9ae62; }
.hud-steps li span { font-size: .8rem; color: #8d97ad; }
.hud-steps li.done span, .hud-steps li.active span { color: #aab3c6; }
.hud-steps li small { color: #6b7590; font: .72rem ui-monospace, Consolas, monospace; }
.hud-note { margin: .8em 0 0; font-size: .74rem; color: #7d879d; }
@keyframes hudPulse { 50% { box-shadow: 0 0 2px #d9ae62; } }
.rx-caption { position: absolute; left: 50%; top: clamp(70px, 12vh, 120px); transform: translateX(-50%); z-index: 3; padding: 10px 18px; text-align: center; max-width: min(560px, calc(100% - 32px)); }
.rx-caption b { display: block; font-family: var(--serif); font-size: 1.25rem; color: #fff3d1; letter-spacing: .1em; }
.rx-caption .glyph { font: .9rem ui-monospace, Consolas, monospace; color: #9fd2ff; }
.rx-caption p { margin: .3em 0 0; font-size: .86rem; color: #c3c9d6; }
.skip { position: absolute; right: clamp(16px, 3vw, 36px); bottom: clamp(16px, 4vh, 40px); z-index: 4; }
.reveal { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); z-index: 5; width: min(520px, calc(100% - 32px)); padding: clamp(20px, 3vw, 34px); text-align: center; animation: revealIn .9s ease-out both; background: linear-gradient(160deg, rgba(10,16,32,.9), rgba(6,10,22,.84)); }
.reveal h2 { margin: .2em 0 .4em; font-size: clamp(1.4rem, 3vw, 1.9rem); }
.reveal .btn-row { justify-content: center; }
.reveal-sub { color: #c9cfdc; }
@keyframes revealIn { from { opacity: 0; transform: translate(-50%, -46%); } to { opacity: 1; transform: translate(-50%, -50%); } }
.cosmos-stage.revealed .hud { opacity: .35; }

/* ---------- 结果页（事件章节） ---------- */
.result-v2 { position: relative; z-index: 2; }
.r2-hero { min-height: 82dvh; display: grid; align-content: end; padding: 12vh 0 6vh; }
.r2-hero .core-chip { display: inline-flex; align-items: center; gap: 10px; padding: 6px 14px 6px 6px; border-radius: 999px; background: rgba(4,8,18,.55); border: 1px solid rgba(255,255,255,.12); width: max-content; max-width: 100%; }
.r2-hero .core-chip b { width: 38px; height: 38px; border-radius: 50%; display: grid; place-items: center; font: 600 1rem/1 "Segoe UI", Arial, sans-serif; color: #fff; }
.r2-hero > * { position: relative; }
.r2-hero::before { content: ""; position: absolute; left: -6%; bottom: 0; width: min(900px, 96%); height: 80%; background: radial-gradient(closest-side, rgba(2,4,11,.7), rgba(2,4,11,.35) 65%, rgba(2,4,11,0)); pointer-events: none; }
.r2-hero { position: relative; }
.r2-headline { font-family: var(--serif); font-size: clamp(1.7rem, 4.2vw, 3rem); line-height: 1.25; margin: .4em 0 .3em; max-width: 16em; text-shadow: 0 2px 24px rgba(0,0,0,.6); text-wrap: balance; }
.r2-intro { max-width: 46em; color: #d3d8e3; font-size: 1.02rem; }
.r2-events { display: grid; gap: clamp(24px, 8vh, 90px); padding: 4vh 0 10vh; }
/* ELEMENT-09：结论按领域分组的标题（紧贴其后的第一张卡片） */
.r2-domain { margin: clamp(8px, 3vh, 30px) 0 calc(-1 * clamp(14px, 6vh, 70px)); font-size: .95rem; font-weight: 600; letter-spacing: .35em; color: #d9ae62; }
.r2-event { width: min(620px, 100%); padding: clamp(18px, 2.6vw, 30px); scroll-margin-top: 80px; transition: border-color .5s, box-shadow .5s; background: linear-gradient(160deg, rgba(12,18,36,.9), rgba(6,10,22,.84)); }
.r2-event:nth-child(even) { justify-self: end; }
.r2-event.active { border-color: rgba(217,174,98,.45); box-shadow: 0 0 0 1px rgba(217,174,98,.2), 0 20px 60px rgba(0,0,0,.45); }
.r2-event .ev-head { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.r2-event .ev-theme { font-size: .78rem; letter-spacing: .12em; color: #d9ae62; }
.r2-event h3 { margin: .1em 0 .4em; font-size: clamp(1.3rem, 2.6vw, 1.7rem); }
.ev-conf { font-size: .75rem; padding: 2px 9px; border-radius: 999px; border: 1px solid rgba(255,255,255,.18); color: #c9cfdc; }
.ev-conf.multi { border-color: rgba(111,211,160,.5); color: #9ff0c4; }
.ev-conf.single { border-color: rgba(240,180,92,.45); color: #f6cf8f; }
.ev-text { color: #dde1ea; }
.ev-rx { margin: 14px 0 0; padding: 12px 14px; border-radius: 12px; background: rgba(4,8,18,.5); border: 1px solid rgba(159,210,255,.16); }
.ev-rx .rx-name { font-family: var(--serif); color: #fff3d1; font-size: 1.05rem; margin-right: .6em; }
.ev-rx .rx-glyph { color: #9fd2ff; }
.ev-rx p { margin: .35em 0 0; font-size: .9rem; color: #c3c9d6; }
.ev-windows { margin: 12px 0 0; padding: 0; list-style: none; display: grid; gap: 6px; }
.ev-windows li { font-size: .88rem; color: #c9cfdc; padding-left: 14px; border-left: 2px solid rgba(217,174,98,.45); }
.ev-windows li.caution { border-left-color: rgba(255,143,132,.55); }
.ev-windows li.change { border-left-color: rgba(159,210,255,.6); }
.ev-windows li.past { opacity: .7; }
.ev-limits { margin: 10px 0 0; font-size: .78rem; color: #8d97ad; }
.ev-play { margin-top: 10px; }
.r2-section { padding: clamp(18px, 3vw, 32px); margin: 0 0 clamp(24px, 6vh, 56px); background: linear-gradient(160deg, rgba(12,18,36,.88), rgba(6,10,22,.8)); }
.result-page .notice, .result-page .save-bar { background: rgba(6,10,22,.82); }

@media (max-width: 900px) {
  .home-hero { grid-template-columns: 1fr; min-height: auto; padding-top: 30vh; }
  .hero-text { align-self: auto; }
  .pipe { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 560px) {
  .pipe { grid-template-columns: 1fr; }
  .birth-card .row3 { grid-template-columns: 1fr 1fr 1fr; gap: 6px; }
  .hud { left: 16px; right: 16px; width: auto; bottom: 64px; padding: 12px 14px; max-height: 42dvh; overflow: auto; }
  .hud-steps li span { display: none; }
  .hud-steps li.active span { display: block; }
  .skip { bottom: 16px; right: 16px; }
  .rx-caption { top: 64px; }
  .r2-event:nth-child(even) { justify-self: stretch; }
  .r2-hero { min-height: 70dvh; }
}
@media (prefers-reduced-motion: reduce) {
  .hud-steps li.active::before { animation: none; }
  .reveal { animation: none; }
}

/* ---------- 元素视频工作室（ELEMENT-08） ---------- */
.studio-stage { position: relative; width: 100%; aspect-ratio: 16 / 9; background: #02040b; border-radius: 14px; overflow: hidden; border: 1px solid rgba(255,255,255,.1); }
.studio-stage canvas { width: 100%; height: 100%; display: block; }
.studio-caption { position: absolute; inset: 0; pointer-events: none; display: grid; grid-template-rows: auto auto 1fr auto; padding: 4% 4.5%; color: #fff3d1; }
.studio-caption small { color: rgba(217,174,98,.95); font-size: clamp(.7rem, 1.4vw, .9rem); }
.studio-caption b { font-family: var(--serif); font-size: clamp(1rem, 2.8vw, 1.8rem); text-shadow: 0 2px 10px rgba(0,0,0,.8); }
.studio-caption span { grid-row: 4; justify-self: center; text-align: center; max-width: 78%; background: rgba(0,0,0,.42); padding: .3em .8em; border-radius: 6px; color: #fff; font-size: clamp(.78rem, 1.9vw, 1.15rem); }

/* ELEMENT-10 人生关键年份：横向时间轴（窄屏横向滑动），年份节点 + 事件卡片 */
.keyyears h2 { margin-bottom: 4px; }
.ky-track { list-style: none; margin: 18px 0 4px; padding: 26px 2px 8px; display: flex; gap: 14px; overflow-x: auto; scroll-snap-type: x mandatory; position: relative; }
.ky-track::before { content: ''; position: absolute; left: 0; right: 0; top: 37px; height: 2px; background: linear-gradient(90deg, rgba(217,174,98,0), rgba(217,174,98,.55) 8%, rgba(159,210,255,.5) 92%, rgba(159,210,255,0)); }
.ky-node { flex: 0 0 min(250px, 78vw); scroll-snap-align: start; position: relative; }
.ky-pin { display: flex; flex-direction: column; align-items: flex-start; gap: 4px; background: none; border: 0; padding: 0; color: inherit; cursor: pointer; font: inherit; }
.ky-pin::before { content: ''; width: 16px; height: 16px; border-radius: 50%; margin: 3px 0 6px; background: radial-gradient(circle, #ffe7b0 0 30%, #d9ae62 60%, rgba(217,174,98,.2) 100%); box-shadow: 0 0 12px rgba(217,174,98,.8); transition: transform .3s; }
.ky-node.caution .ky-pin::before { background: radial-gradient(circle, #ffd3cd 0 30%, #ff8f84 60%, rgba(255,143,132,.2) 100%); box-shadow: 0 0 12px rgba(255,143,132,.75); }
.ky-node.change .ky-pin::before { background: radial-gradient(circle, #d9efff 0 30%, #9fd2ff 60%, rgba(159,210,255,.2) 100%); box-shadow: 0 0 12px rgba(159,210,255,.8); }
.ky-node.past { opacity: .82; }
.ky-node.active .ky-pin::before, .ky-pin:hover::before, .ky-pin:focus-visible::before { transform: scale(1.35); }
.ky-year { font-size: 1.35rem; font-weight: 700; letter-spacing: .02em; color: #f3e3c0; }
.ky-tag { font-size: .78rem; color: #aeb6c8; }
.ky-card { margin-top: 10px; padding: 12px 14px; border-radius: 14px; background: rgba(12,16,32,.55); border: 1px solid rgba(255,255,255,.08); }
.ky-node.active .ky-card { border-color: rgba(217,174,98,.55); }
.ky-event { margin: 0 0 4px; font-size: .8rem; color: #d9ae62; }
.ky-text { margin: 0 0 8px; line-height: 1.6; }
.ky-rx { margin: 0; font-size: .86rem; color: #c9cfdc; line-height: 1.55; }
@media (prefers-reduced-motion: reduce) { .ky-pin::before { transition: none; } }
