:root {
  --bg-0: #04050d;
  --bg-1: #0a0e1f;
  --ink: #e9ecf5;
  --ink-dim: #97a0bd;
  --glass: rgba(18, 24, 48, 0.55);
  --line: rgba(120, 140, 220, 0.18);
  --accent: #5b8cff;
  --font-zh: "Noto Serif SC", "Songti SC", "STSong", serif;
  --font-cal: "Ma Shan Zheng", "Noto Serif SC", serif;
  --font-en: "Orbitron", "Segoe UI", sans-serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; }

body {
  font-family: var(--font-zh);
  color: var(--ink);
  background:
    radial-gradient(1200px 800px at 15% -10%, rgba(91, 140, 255, 0.18), transparent 60%),
    radial-gradient(1000px 700px at 90% 10%, rgba(199, 125, 255, 0.16), transparent 55%),
    radial-gradient(900px 900px at 50% 120%, rgba(6, 214, 160, 0.10), transparent 60%),
    linear-gradient(180deg, var(--bg-1), var(--bg-0));
  min-height: 100vh;
  overflow-x: hidden;
  position: relative;
}

#stars {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
  pointer-events: none;
}

.wrap { position: relative; z-index: 1; max-width: 1180px; margin: 0 auto; padding: 0 24px; }

/* ---------- HERO ---------- */
.hero { text-align: center; padding: 84px 0 40px; }
.hero .kicker {
  font-family: var(--font-en);
  letter-spacing: 6px;
  font-size: 13px;
  color: var(--ink-dim);
  text-transform: uppercase;
  margin-bottom: 18px;
  opacity: 0; animation: rise 1s ease forwards;
}
.hero h1 {
  font-family: var(--font-cal);
  font-size: clamp(48px, 9vw, 110px);
  line-height: 1.05;
  letter-spacing: 8px;
  color: #fff;
  text-shadow: 0 0 18px rgba(91, 140, 255, 0.55), 0 0 50px rgba(91, 140, 255, 0.35);
  opacity: 0; animation: rise 1s ease .15s forwards;
}
.hero h1 .en {
  display: block;
  font-family: var(--font-en);
  font-size: clamp(13px, 2.2vw, 20px);
  letter-spacing: 10px;
  color: var(--ink-dim);
  margin-top: 14px;
  text-shadow: none;
}
.hero p.lede {
  max-width: 620px; margin: 22px auto 0;
  color: var(--ink-dim); font-size: 16px; line-height: 1.9;
  opacity: 0; animation: rise 1s ease .3s forwards;
}

/* ---------- GRID ---------- */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 22px;
  padding: 30px 0 90px;
}
.card {
  position: relative;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--glass);
  backdrop-filter: blur(10px);
  padding: 26px 22px 22px;
  cursor: pointer;
  overflow: hidden;
  transition: transform .35s cubic-bezier(.2,.8,.2,1), box-shadow .35s, border-color .35s;
  opacity: 0; transform: translateY(24px);
}
.card.in { opacity: 1; transform: none; }
.card::before {
  content: "";
  position: absolute; inset: 0;
  background: radial-gradient(380px 220px at 80% -20%, var(--c, var(--accent)), transparent 70%);
  opacity: .14; transition: opacity .35s;
}
.card:hover {
  transform: translateY(-6px);
  border-color: var(--c, var(--accent));
  box-shadow: 0 14px 40px rgba(0,0,0,.5), 0 0 32px color-mix(in srgb, var(--c, var(--accent)) 45%, transparent);
}
.card:hover::before { opacity: .28; }
.card .cat {
  font-family: var(--font-en); font-size: 11px; letter-spacing: 3px;
  color: var(--c, var(--accent)); text-transform: uppercase;
}
.card .zh {
  font-family: var(--font-cal); font-size: 46px; margin: 12px 0 4px;
  color: #fff; text-shadow: 0 0 16px color-mix(in srgb, var(--c, var(--accent)) 60%, transparent);
}
.card .en { font-family: var(--font-en); font-size: 12px; letter-spacing: 2px; color: var(--ink-dim); }
.card .tag { margin-top: 14px; font-size: 13.5px; line-height: 1.8; color: var(--ink-dim); min-height: 48px; }
.card .meta { margin-top: 16px; display: flex; gap: 8px; flex-wrap: wrap; }
.chip {
  font-size: 11px; padding: 4px 10px; border-radius: 999px;
  border: 1px solid var(--line); color: var(--ink-dim);
}

/* ---------- CHAPTER ---------- */
.back {
  position: fixed; top: 22px; left: 24px; z-index: 5;
  font-family: var(--font-en); font-size: 12px; letter-spacing: 2px;
  color: var(--ink); text-decoration: none;
  border: 1px solid var(--line); padding: 9px 16px; border-radius: 999px;
  background: var(--glass); backdrop-filter: blur(8px);
  transition: border-color .3s, color .3s; display: inline-flex; align-items: center; gap: 8px;
}
.back:hover { border-color: var(--accent); color: #fff; }

.chapter { max-width: 860px; margin: 0 auto; padding: 110px 24px 110px; }
.chapter .cat {
  font-family: var(--font-en); font-size: 12px; letter-spacing: 4px;
  color: var(--accent); text-transform: uppercase;
}
.chapter h2 {
  font-family: var(--font-cal); font-size: clamp(64px, 14vw, 150px);
  line-height: 1; margin: 14px 0 8px; color: #fff;
  text-shadow: 0 0 24px color-mix(in srgb, var(--accent) 65%, transparent), 0 0 70px color-mix(in srgb, var(--accent) 35%, transparent);
}
.chapter .en { font-family: var(--font-en); letter-spacing: 8px; color: var(--ink-dim); font-size: 15px; }
.chapter .tagline { margin: 26px 0 10px; font-size: 18px; color: var(--ink); line-height: 1.9; }
.divider { height: 1px; background: linear-gradient(90deg, var(--accent), transparent); margin: 36px 0; opacity: .5; }

.section { margin: 30px 0; opacity: 0; transform: translateY(20px); }
.section.in { opacity: 1; transform: none; transition: opacity .7s ease, transform .7s ease; }
.section .label {
  font-family: var(--font-en); font-size: 12px; letter-spacing: 4px;
  color: var(--accent); text-transform: uppercase; margin-bottom: 12px;
  display: flex; align-items: center; gap: 10px;
}
.section .label::before { content: ""; width: 26px; height: 2px; background: var(--accent); display: inline-block; }
.section p { font-size: 16px; line-height: 2.0; color: #cdd4e8; }
.scripture {
  border-left: 3px solid var(--accent);
  background: rgba(255,255,255,0.03);
  padding: 18px 22px; border-radius: 0 12px 12px 0;
  font-family: var(--font-zh); white-space: pre-line;
  color: #dfe4f2; line-height: 2.1; font-size: 15.5px;
  box-shadow: inset 0 0 30px color-mix(in srgb, var(--accent) 8%, transparent);
}
.attrs { display: grid; grid-template-columns: repeat(2, 1fr); gap: 14px; margin-top: 8px; }
.attr {
  border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px;
  background: var(--glass);
}
.attr .k { font-family: var(--font-en); font-size: 10px; letter-spacing: 3px; color: var(--ink-dim); text-transform: uppercase; }
.attr .v { font-size: 16px; color: #fff; margin-top: 6px; }

footer { text-align: center; padding: 40px 0 60px; color: var(--ink-dim); font-size: 12px; letter-spacing: 2px; }

@keyframes rise { to { opacity: 1; transform: none; } }

@media (max-width: 560px) {
  .attrs { grid-template-columns: 1fr; }
  .chapter { padding-top: 90px; }
  .intro-title { letter-spacing: 8px; }
  .intro-ring { width: 160px; height: 160px; }
}

/* ---------- 首屏开场动画 ---------- */
.intro {
  position: fixed; inset: 0; z-index: 50; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  background:
    radial-gradient(800px 600px at 50% 45%, rgba(91,140,255,0.14), transparent 60%),
    radial-gradient(500px 500px at 50% 55%, rgba(199,125,255,0.08), transparent 60%),
    #04050d;
  transition: opacity .9s ease, visibility .9s;
}
.intro.done { opacity: 0; visibility: hidden; pointer-events: none; }
.intro-inner { position: relative; text-align: center; }
.intro-ring {
  width: 220px; height: 220px; margin: 0 auto 26px; border-radius: 50%;
  border: 1px solid rgba(120,140,220,0.25);
  box-shadow: 0 0 60px rgba(91,140,255,0.25), inset 0 0 40px rgba(91,140,255,0.12);
  position: relative; animation: ringSpin 9s linear infinite;
}
.intro-ring::before, .intro-ring::after {
  content: ""; position: absolute; border-radius: 50%;
  border: 1px solid transparent;
}
.intro-ring::before {
  inset: -1px; border-top-color: var(--accent); border-right-color: var(--accent);
  animation: ringSpin 3.5s linear infinite;
}
.intro-ring::after {
  inset: 26px; border-bottom-color: #c77dff; border-left-color: #c77dff;
  animation: ringSpin 5s linear infinite reverse;
}
.intro-title {
  font-family: var(--font-cal); font-size: clamp(60px, 12vw, 120px);
  color: #fff; letter-spacing: 14px; margin-left: 14px;
  text-shadow: 0 0 22px rgba(91,140,255,0.6), 0 0 60px rgba(199,125,255,0.4);
  opacity: 0; transform: scale(.92); animation: titleIn 1.7s cubic-bezier(.2,.8,.2,1) .3s forwards;
}
.intro-sub {
  font-family: var(--font-en); letter-spacing: 6px; font-size: 12px;
  color: var(--ink-dim); margin-top: 14px;
  opacity: 0; animation: fadeIn 1s ease 1.5s forwards;
}
.intro-bar {
  width: 200px; height: 2px; margin: 26px auto 0; background: rgba(120,140,220,0.18);
  border-radius: 2px; overflow: hidden;
}
.intro-bar span {
  display: block; height: 100%; width: 100%; transform-origin: left;
  background: linear-gradient(90deg, var(--accent), #c77dff);
  animation: barFill 2.2s ease 1.6s forwards;
}
.intro-skip {
  margin-top: 18px; font-family: var(--font-en); font-size: 11px; letter-spacing: 3px;
  color: var(--ink-dim); opacity: 0; animation: fadeIn 1s ease 2s forwards;
}
@keyframes ringSpin { to { transform: rotate(360deg); } }
@keyframes titleIn { to { opacity: 1; transform: none; } }
@keyframes fadeIn { to { opacity: 1; } }
@keyframes barFill { from { transform: scaleX(0); } to { transform: scaleX(1); } }

/* ---------- 质感 / 流光 / 原始神面 ---------- */
.aurora {
  position: fixed; top: 0; left: 0; right: 0; height: 260px; z-index: 0;
  pointer-events: none; opacity: .28; filter: blur(46px);
  background: linear-gradient(120deg, transparent 0%, color-mix(in srgb, var(--accent) 70%, transparent) 45%, #c77dff 55%, transparent 100%);
  background-size: 220% 100%;
  animation: auroraMove 16s ease-in-out infinite alternate;
}
@keyframes auroraMove { from { background-position: 0% 0; } to { background-position: 100% 0; } }

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

.totem {
  position: absolute; color: var(--accent); opacity: .1; pointer-events: none;
  filter: drop-shadow(0 0 18px color-mix(in srgb, var(--accent) 60%, transparent));
  animation: totemBreath 9s ease-in-out infinite;
}
.totem path, .totem circle { fill: none; stroke: currentColor; stroke-width: 1.4; stroke-linecap: round; stroke-linejoin: round; }
.hero { position: relative; overflow: hidden; }
.hero .totem { top: 50%; left: 50%; transform: translate(-50%, -54%); width: min(440px, 82vw); }
.hero .kicker, .hero h1, .hero p.lede { position: relative; z-index: 1; }
.hero::after {
  content: ""; position: absolute; left: 0; right: 0; top: 0; height: 2px;
  background: linear-gradient(90deg, transparent, var(--accent), transparent);
  opacity: 0; animation: heroScan 7s linear infinite;
}
@keyframes heroScan { 0% { top: 0; opacity: 0; } 12% { opacity: .6; } 88% { opacity: .6; } 100% { top: 100%; opacity: 0; } }
@keyframes totemBreath { 0%, 100% { opacity: .07; } 50% { opacity: .16; } }

.chapter { position: relative; }
.chapter .totem { top: 30px; left: 50%; transform: translateX(-50%); width: min(280px, 66vw); }

.card::after {
  content: ""; position: absolute; top: 0; left: -60%; width: 55%; height: 100%;
  transform: skewX(-20deg);
  background: linear-gradient(90deg, transparent, color-mix(in srgb, var(--c) 42%, transparent), transparent);
  pointer-events: none;
}
.card:hover::after { animation: sweep 1.1s ease; }
@keyframes sweep { from { left: -60%; } to { left: 130%; } }

.divider {
  background: linear-gradient(90deg, transparent, var(--accent), transparent);
  background-size: 220% 100%; animation: flow 6s linear infinite;
}
@keyframes flow { from { background-position: 200% 0; } to { background-position: -200% 0; } }

/* ---------- 篇章滚动视差（前景神面 / 标题） ---------- */
.chapter .totem { transform: translateX(-50%) translateY(calc(var(--sy, 0) * 0.18px)); will-change: transform; }
.chapter .cat, .chapter h2, .chapter .en { transform: translateY(calc(var(--sy, 0) * -0.04px)); will-change: transform; }
@media (prefers-reduced-motion: reduce) {
  .chapter .totem, .chapter .cat, .chapter h2, .chapter .en { transform: none !important; }
}

/* ---------- 背景氛围音开关 ---------- */
.audio-toggle {
  position: fixed; right: 22px; bottom: 22px; z-index: 6;
  display: inline-flex; align-items: center; gap: 9px;
  font-family: var(--font-en); font-size: 11px; letter-spacing: 2px;
  color: var(--ink-dim); cursor: pointer;
  border: 1px solid var(--line); border-radius: 999px;
  padding: 10px 16px; background: var(--glass); backdrop-filter: blur(8px);
  transition: border-color .3s, color .3s, box-shadow .3s;
}
.audio-toggle:hover { border-color: var(--accent); color: #fff; }
.audio-toggle .ico {
  font-size: 14px; color: var(--accent);
  text-shadow: 0 0 10px color-mix(in srgb, var(--accent) 70%, transparent);
}
.audio-toggle.on {
  border-color: var(--accent); color: #fff;
  box-shadow: 0 0 24px color-mix(in srgb, var(--accent) 45%, transparent);
}
.audio-toggle.on .ico { animation: pulse 2.4s ease-in-out infinite; }
@keyframes pulse { 0%, 100% { opacity: .5; } 50% { opacity: 1; } }
@media (max-width: 560px) {
  .audio-toggle { right: 14px; bottom: 14px; padding: 9px 13px; }
}
