:root {
  --ink: #211b16;
  --muted: #74685d;
  --paper: #eee5d4;
  --paper-deep: #d8c7aa;
  --stone: #2f3330;
  --stone-light: #666a63;
  --wood: #6b3325;
  --wood-dark: #351a14;
  --cinnabar: #9f2f24;
  --gold: #b9914b;
  --moss: #476350;
  --shadow: rgba(25, 18, 12, 0.28);
  --serif: "Songti TC", "Songti SC", "STSong", "Noto Serif CJK TC", "Noto Serif CJK SC", "SimSun", serif;
  --kai: "Kaiti TC", "Kaiti SC", "STKaiti", "KaiTi", serif;
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background: #241916;
}

body {
  min-height: 100%;
  margin: 0;
  color: var(--ink);
  font-family: var(--serif);
  background:
    radial-gradient(circle at 18% 8%, rgba(185, 145, 75, 0.24), transparent 26rem),
    linear-gradient(145deg, #1e1714 0%, #4f2a20 42%, #1a1714 100%);
}

body::before {
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  content: "";
  opacity: 0.46;
  background-image:
    linear-gradient(rgba(255,255,255,0.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,0.035) 1px, transparent 1px);
  background-size: 34px 34px;
  mask-image: radial-gradient(circle at center, black, transparent 78%);
}

a {
  color: inherit;
  text-decoration: none;
}

.page {
  width: min(1180px, calc(100% - 32px));
  min-height: 100vh;
  margin: 0 auto;
  padding: 28px 0 56px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 14px 18px;
  color: #efe4cc;
  border: 1px solid rgba(225, 199, 141, 0.22);
  background: rgba(22, 17, 14, 0.62);
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.22);
  backdrop-filter: blur(14px);
  z-index: 30;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  letter-spacing: 0.08em;
  font-family: var(--serif);
}

.seal {
  display: grid;
  width: 38px;
  height: 38px;
  place-items: center;
  color: #f2dac0;
  font-family: var(--kai);
  border: 2px solid #b9914b;
  background: rgba(159, 47, 36, 0.34);
  box-shadow: inset 0 0 0 3px rgba(25, 12, 8, 0.3);
}

.nav {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.nav a,
.ghost-link {
  padding: 8px 12px;
  color: #efe4cc;
  font-family: var(--kai);
  font-size: 15px;
  border: 1px solid rgba(239, 228, 204, 0.22);
  background: rgba(255, 255, 255, 0.05);
}

.nav a[aria-current="page"],
.nav a:hover,
.ghost-link:hover {
  color: #fff8e8;
  border-color: rgba(185, 145, 75, 0.75);
  background: rgba(185, 145, 75, 0.18);
}

.hero,
.chamber {
  margin-top: 22px;
  overflow: hidden;
  border: 1px solid rgba(227, 206, 163, 0.28);
  background:
    linear-gradient(135deg, rgba(238, 229, 212, 0.95), rgba(216, 199, 170, 0.9)),
    var(--paper);
  box-shadow: 0 30px 90px rgba(0, 0, 0, 0.32);
}

.hero {
  position: relative;
  min-height: calc(100vh - 132px);
  display: grid;
  grid-template-columns: 1.05fr 0.95fr;
}

/* The tombstone arrival has no right-hand intro panel: keep the visual centered. */
.tomb-home .hero {
  grid-template-columns: minmax(0, 1fr);
}

.hero::after,
.chamber::after {
  position: absolute;
  inset: 0;
  pointer-events: none;
  content: "";
  opacity: 0.18;
  background-image:
    repeating-linear-gradient(90deg, transparent 0 24px, rgba(80, 48, 28, 0.08) 24px 25px),
    repeating-linear-gradient(0deg, transparent 0 29px, rgba(80, 48, 28, 0.07) 29px 30px);
}

.intro {
  position: relative;
  z-index: 1;
  padding: clamp(34px, 6vw, 82px);
}

.eyebrow {
  margin: 0 0 20px;
  color: var(--cinnabar);
  font-family: var(--kai);
  font-size: 18px;
  letter-spacing: 0.22em;
}

h1,
h2 {
  margin: 0;
  font-weight: 600;
  letter-spacing: 0.04em;
}

h1 {
  max-width: 9em;
  font-size: clamp(44px, 7vw, 86px);
  line-height: 1.02;
}

h2 {
  font-size: clamp(32px, 5vw, 58px);
  line-height: 1.08;
}

.lead {
  max-width: 36em;
  margin: 24px 0 0;
  color: #54483d;
  font-family: var(--kai);
  font-size: clamp(18px, 2.1vw, 24px);
  line-height: 1.8;
}

.poem {
  margin-top: 32px;
  color: #6e5640;
  font-family: var(--kai);
  font-size: 18px;
  line-height: 2;
  border-left: 4px solid var(--gold);
  padding-left: 18px;
}

.agent-strip {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 8px;
  margin-top: 24px;
}

.agent-strip a {
  display: grid;
  min-height: 70px;
  align-content: center;
  justify-items: center;
  gap: 5px;
  color: var(--ink);
  border: 1px solid rgba(84, 56, 30, 0.2);
  background:
    linear-gradient(180deg, rgba(255,255,255,0.58), rgba(185, 145, 75, 0.12)),
    rgba(238, 229, 212, 0.76);
  box-shadow: inset 0 -8px 18px rgba(96, 60, 32, 0.1);
}

.agent-strip a:hover {
  border-color: rgba(159, 47, 36, 0.46);
  background: rgba(255, 248, 232, 0.9);
}

.agent-strip b {
  color: var(--cinnabar);
  font-size: 26px;
  line-height: 1;
}

.agent-strip span {
  color: #6a5949;
  font-family: var(--kai);
  font-size: 13px;
}

.stone-scene {
  position: relative;
  display: grid;
  min-height: 620px;
  place-items: center;
  padding: 42px;
  pointer-events: auto;
  background:
    radial-gradient(circle at 50% 40%, rgba(255, 244, 214, 0.13), transparent 21rem),
    linear-gradient(160deg, #171a18, #3c423d 52%, #171817);
}

.stone-scene::before {
  position: absolute;
  bottom: 222px;
  left: calc(50% + 8px);
  z-index: 2;
  width: 18px;
  height: 168px;
  pointer-events: none;
  content: "";
  border-radius: 52% 48% 50% 50%;
  background:
    radial-gradient(ellipse at 40% 22%, rgba(240, 238, 222, 0.48), transparent 46%),
    linear-gradient(176deg, transparent, rgba(199, 218, 205, 0.32) 34%, rgba(230, 226, 210, 0.18) 74%, transparent);
  filter: blur(6px);
  animation: smoke-side 7.2s ease-in-out infinite;
}

.tablet {
  position: relative;
  z-index: 1;
  width: min(360px, 72vw);
  aspect-ratio: 0.58;
  padding: 36px 30px 30px;
  color: #efe3ce;
  text-align: center;
  border-radius: 48% 48% 10px 10px / 18% 18% 10px 10px;
  background:
    radial-gradient(ellipse at 34% 16%, rgba(255, 255, 240, 0.16), transparent 26%),
    radial-gradient(ellipse at 72% 72%, rgba(0, 0, 0, 0.26), transparent 40%),
    linear-gradient(90deg, rgba(255,255,255,0.15), transparent 18%, rgba(0,0,0,0.26) 82%),
    linear-gradient(160deg, #5f645b, #2b2f2a 55%, #121411);
  box-shadow:
    inset 12px 10px 18px rgba(255,255,235,0.09),
    inset -24px -18px 34px rgba(0,0,0,0.48),
    inset 0 0 0 1px rgba(244, 229, 185, 0.1),
    14px 20px 0 rgba(9, 10, 9, 0.34),
    28px 44px 78px rgba(0,0,0,0.55);
  transition: transform 0.9s ease, filter 0.7s ease;
}

/* 风/雨时碑轻微摇动，增加身临其境体感 */
.stone-scene.wind .tablet,
.stone-scene.rain .tablet {
  animation: stone-sway 4.2s ease-in-out infinite;
  will-change: transform;
}

#weatherCanvas {
  will-change: transform;
}
@keyframes stone-sway {
  0%,100% { transform: translateX(0); }
  50% { transform: translateX(1.5px); }
}

.portrait-slot {
  overflow: hidden;
  position: relative;
  z-index: 2;
  width: 86px;
  height: 104px;
  margin: 10px auto 18px;
  border-radius: 48% 48% 10px 10px / 28% 28% 10px 10px;
  background:
    radial-gradient(ellipse at 45% 28%, rgba(255, 245, 211, 0.14), transparent 46%),
    linear-gradient(145deg, rgba(10, 12, 10, 0.44), rgba(255, 255, 230, 0.05));
  border: 1px solid rgba(218, 199, 153, 0.22);
  box-shadow:
    inset 2px 2px 4px rgba(255, 243, 203, 0.1),
    inset -5px -6px 12px rgba(0, 0, 0, 0.58),
    0 5px 12px rgba(0, 0, 0, 0.24);
}

.portrait-photo {
  position: absolute;
  inset: 9px;
  width: calc(100% - 18px);
  height: calc(100% - 18px);
  object-fit: cover;
  opacity: 0;
  border-radius: inherit;
  filter: sepia(0.16) contrast(0.96);
  transition: opacity 900ms ease;
}

.portrait-photo.is-active {
  opacity: 1;
}

.portrait-slot::after {
  position: absolute;
  inset: 9px;
  content: "";
  border-radius: inherit;
  border: 1px solid rgba(213, 193, 145, 0.16);
  box-shadow:
    inset 0 0 12px rgba(0, 0, 0, 0.36),
    0 1px 0 rgba(255, 243, 205, 0.08);
}

.tablet::before {
  position: absolute;
  inset: 16px;
  content: "";
  border: 1px solid rgba(222, 207, 164, 0.34);
  border-radius: inherit;
  box-shadow:
    inset 2px 2px 3px rgba(255, 246, 214, 0.12),
    inset -3px -4px 8px rgba(0, 0, 0, 0.42);
}

.tablet::after {
  position: absolute;
  inset: 0;
  pointer-events: none;
  content: "";
  border-radius: inherit;
  background:
    linear-gradient(115deg, rgba(255,255,255,0.16), transparent 18%, transparent 66%, rgba(0,0,0,0.22)),
    repeating-linear-gradient(98deg, rgba(255,255,255,0.018) 0 2px, rgba(0,0,0,0.025) 2px 5px);
  mix-blend-mode: screen;
  opacity: 0.64;
}

.tablet-name {
  position: relative;
  z-index: 2;
  writing-mode: vertical-rl;
  margin: 0 auto;
  color: #d7c193;
  font-family: var(--serif);
  font-size: clamp(42px, 7vw, 66px);
  letter-spacing: 0.18em;
  text-shadow:
    1px 1px 0 rgba(255, 245, 205, 0.34),
    -1px -1px 0 rgba(12, 11, 9, 0.8),
    0 2px 4px rgba(0, 0, 0, 0.55),
    0 -1px 0 rgba(255, 241, 192, 0.2);
}

.tablet-years,
.tablet-places,
.tablet small {
  position: relative;
  z-index: 2;
  display: block;
  margin-top: 16px;
  color: #cdb98e;
  font-family: var(--serif);
  text-shadow:
    1px 1px 0 rgba(255, 244, 205, 0.2),
    -1px -1px 0 rgba(0, 0, 0, 0.72),
    0 1px 3px rgba(0, 0, 0, 0.55);
}

.tablet-years {
  font-size: clamp(13px, 1.75vw, 16px);
  letter-spacing: 0.04em;
}

.tablet-places {
  margin-top: 8px;
  color: #c8b68f;
  font-size: clamp(11px, 1.6vw, 15px);
  letter-spacing: 0.08em;
  line-height: 1.1;
}

.tablet-domain {
  margin-top: 18px;
  color: rgba(213, 196, 163, 0.62);
  font-size: 12px;
  letter-spacing: 0.08em;
}

/* Realistic multiple incense sticks */
.incense-container {
  position: absolute;
  bottom: 8px;
  left: 50%;
  z-index: 3;
  display: flex;
  gap: 5px;
  transform: translateX(-50%) perspective(220px) rotateX(12deg);
  pointer-events: auto;
}

.incense-stick {
  width: 5px;
  height: 118px;
  background: linear-gradient(#3a2a1f 0%, #2a1f15 40%, #1a120d 100%);
  border-radius: 3px;
  box-shadow: 0 0 0 1px rgba(255, 217, 172, 0.12), 0 8px 16px rgba(0, 0, 0, 0.4);
  position: relative;
  transition: transform 0.2s ease, box-shadow 0.2s;
  will-change: transform, opacity;
}

.incense-stick::after {
  content: "";
  position: absolute;
  top: -8px;
  left: 50%;
  transform: translateX(-50%);
  width: 8px;
  height: 14px;
  background: linear-gradient(#c74834, #9f2f24);
  border-radius: 50% 50% 40% 40%;
  box-shadow: 0 0 6px rgba(199, 72, 52, 0.6);
}

.incense-stick .smoke {
  position: absolute;
  top: -4px;
  left: 50%;
  width: 14px;
  height: 120px;
  transform: translateX(-50%);
  background: radial-gradient(ellipse at 50% 20%, rgba(244, 239, 221, 0.75), transparent 55%);
  filter: blur(4px);
  animation: smoke 5.5s ease-in-out infinite;
  opacity: 0.85;
  pointer-events: none;
}

/* Long-burning lamp (长明灯) - realistic glass + flame */
.long-lamp {
  position: absolute;
  bottom: 12px;
  right: 16%;
  width: 26px;
  height: 40px;
  z-index: 4;
  cursor: pointer;
}

.lamp-base {
  position: absolute;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 16px;
  height: 7px;
  background: linear-gradient(#3a2a1f, #2a2119);
  border-radius: 2px;
  box-shadow: 0 2px 3px rgba(0,0,0,0.5);
}

.lamp-glass {
  position: absolute;
  bottom: 5px;
  left: 50%;
  transform: translateX(-50%);
  width: 14px;
  height: 20px;
  background: linear-gradient(transparent, rgba(255,245,210,0.08));
  border: 1px solid rgba(170,150,110,0.35);
  border-radius: 42% 42% 28% 28%;
  box-shadow: inset 0 0 6px rgba(255,240,180,0.25), 0 0 2px rgba(0,0,0,0.2);
}

.flame {
  position: absolute;
  bottom: 18px;
  left: 50%;
  transform: translateX(-50%);
  width: 7px;
  height: 12px;
  background: linear-gradient(#ffeb3b, #ff9800, #e65100);
  border-radius: 50% 50% 35% 35%;
  box-shadow: 0 0 5px #ffeb3b, 0 0 10px #ff9800;
  opacity: 0;
  animation: flame-flicker 0.85s infinite alternate ease-in-out;
  pointer-events: none;
}

.long-lamp.lit .flame {
  opacity: 0.92;
}

@keyframes flame-flicker {
  0% { transform: translateX(-50%) scale(1, 0.95); }
  100% { transform: translateX(-50%) scale(1.05, 1.12); }
}

/* Better flower visuals (CSS art, not emoji) */
.flower {
  position: absolute;
  width: 22px;
  height: 22px;
  transform: scale(0.8);
  pointer-events: none;
}

.flower::before {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  width: 22px;
  height: 22px;
  background: radial-gradient(circle, #f8d7e0 20%, #e57373 60%, #c62828 100%);
  border-radius: 50%;
  transform: translate(-50%, -50%);
  box-shadow: 0 1px 2px rgba(0,0,0,0.2);
}

.flower::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  width: 6px;
  height: 6px;
  background: #ffeb3b;
  border-radius: 50%;
  transform: translate(-50%, -50%);
  box-shadow: 0 0 3px #fff59d;
}

.flower .petal {
  position: absolute;
  left: 50%;
  top: 2px;
  width: 7px;
  height: 11px;
  background: #e57373;
  border-radius: 50% 50% 40% 40%;
  transform-origin: 50% 90%;
  box-shadow: 0 1px 1px rgba(0,0,0,0.15);
}

.flower .petal:nth-child(1) { transform: translateX(-50%) rotate(-30deg); }
.flower .petal:nth-child(2) { transform: translateX(-50%) rotate(30deg); }
.flower .petal:nth-child(3) { transform: translateX(-50%) rotate(0deg); }
.flower .petal:nth-child(4) { transform: translateX(-50%) rotate(-60deg); }
.flower .petal:nth-child(5) { transform: translateX(-50%) rotate(60deg); }

/* Realistic rain drops */
/* Old DOM rain/leaf styles removed for performance - using canvas now */

@keyframes smoke {
  0% { opacity: 0; transform: translate3d(0, 18px, 0) rotate(-8deg) scaleX(0.5); }
  20% { opacity: 0.68; transform: translate3d(-12px, -18px, 0) rotate(7deg) scaleX(0.85); }
  52% { opacity: 0.54; transform: translate3d(16px, -70px, 0) rotate(-12deg) scaleX(1.25); }
  78% { opacity: 0.28; transform: translate3d(-10px, -118px, 0) rotate(13deg) scaleX(1.7); }
  100% { opacity: 0; transform: translate3d(12px, -164px, 0) rotate(-5deg) scaleX(2.2); }
}

@keyframes smoke-side {
  0% { opacity: 0; transform: translate3d(0, 18px, 0) rotate(10deg) scaleX(0.55); }
  24% { opacity: 0.5; transform: translate3d(16px, -24px, 0) rotate(-8deg) scaleX(0.9); }
  58% { opacity: 0.42; transform: translate3d(-12px, -84px, 0) rotate(11deg) scaleX(1.35); }
  100% { opacity: 0; transform: translate3d(20px, -162px, 0) rotate(-7deg) scaleX(2); }
}

.thresholds {
  position: relative;
  z-index: 2;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-top: 42px;
}

.gate-link,
.primary-link {
  position: relative;
  display: block;
  min-height: 138px;
  padding: 18px;
  color: var(--ink);
  border: 1px solid rgba(84, 56, 30, 0.22);
  background:
    linear-gradient(180deg, rgba(255,255,255,0.46), rgba(165, 116, 67, 0.18)),
    rgba(238, 229, 212, 0.72);
  box-shadow: inset 0 -10px 22px rgba(96, 60, 32, 0.12), 0 16px 34px rgba(88, 56, 34, 0.14);
  transition: transform 180ms ease, box-shadow 180ms ease, border-color 180ms ease;
}

.gate-link:hover,
.primary-link:hover {
  transform: translateY(-4px);
  border-color: rgba(159, 47, 36, 0.46);
  box-shadow: inset 0 -10px 22px rgba(96, 60, 32, 0.13), 0 26px 44px rgba(88, 56, 34, 0.22);
}

.gate-link b {
  display: block;
  margin-bottom: 12px;
  color: var(--cinnabar);
}

/* ========== 新扫墓沉浸流程样式 ========== */
.pure-arrival .intro,
.pure-arrival .agent-strip,
.pure-arrival .thresholds {
  display: none !important;
}

.arrival-overlay {
  position: absolute;
  top: 18px;
  left: 0;
  right: 0;
  text-align: center;
  z-index: 5;
  pointer-events: none;
}
.arrival-hint {
  font-size: 13px;
  color: rgba(213, 196, 163, 0.55);
  letter-spacing: 0.12em;
  padding: 4px 12px;
  background: rgba(0,0,0,0.1);
  border-radius: 20px;
  display: inline-block;
}

.ritual-area {
  max-width: 620px;
  margin: 18px auto 60px;
  padding: 0 16px;
  color: var(--ink-soft);
  display: none; /* 初始隐藏, 触摸后显示, 减少初始解析 */
}
.ritual-step {
  margin-bottom: 22px;
}
.gesture-btn {
  display: inline-block;
  padding: 12px 24px;
  border: 1px solid var(--line);
  background: #f7efe0;
  color: var(--ink);
  border-radius: 8px;
  font-size: 15px;
  cursor: pointer;
  min-height: 44px; /* 手机友好触控 */
  transition: transform 0.1s ease, background 0.2s ease;
}
.gesture-btn:active {
  transform: scale(0.97);
  background: #f0e4d0;
}
.gesture-btn.primary {
  background: var(--cinnabar);
  color: #fff;
  border-color: var(--cinnabar);
}
.gesture-btn.ghost {
  background: transparent;
  border-style: dashed;
}
.ritual-hint {
  font-size: 13px;
  margin-top: 8px;
  opacity: 0.75;
}

.speak-box textarea {
  width: 100%;
  border: 1px solid var(--line);
  background: #fffdf7;
  padding: 12px;
  border-radius: 6px;
  font-size: 15px;
  line-height: 1.6;
}

.incense.lit {
  box-shadow: 0 0 0 1px rgba(255, 217, 172, 0.3), 0 10px 18px rgba(0, 0, 0, 0.34), 0 0 18px rgba(199, 72, 52, 0.4);
  transition: box-shadow 0.4s ease;
}
.incense.lit::before,
.incense.lit::after {
  animation: smoke 4.8s ease-in-out infinite;
  opacity: 0.9;
}
.incense.intense::before,
.incense.intense::after {
  animation: smoke 3.2s ease-in-out infinite;
  filter: blur(3px);
}

/* 献上时的烟晃动效果 */
.incense.sway::before,
.incense.sway::after {
  animation: smoke-sway 1.8s ease-in-out forwards;
}

@keyframes smoke-sway {
  0% { transform: translate3d(0, 0, 0) rotate(0); }
  20% { transform: translate3d(-8px, -10px, 0) rotate(-6deg); }
  50% { transform: translate3d(10px, -25px, 0) rotate(8deg); }
  80% { transform: translate3d(-5px, -50px, 0) rotate(-4deg); }
  100% { transform: translate3d(0, -80px, 0) rotate(0); opacity: 0.4; }
}

/* legacy subtle panel removed for pure gesture first-screen */

.offer-confirm {
  margin-top: 10px;
  font-size: 14px;
  color: var(--cinnabar);
  opacity: 0.85;
  transition: opacity 0.6s ease;
}

/* GOAL_GATE_REV=9 weather-overlay
天气与环境效果 - 广州天河实际墓地 + 日期动态 */
/* harness visible fix: dynamic weather */
.weather-overlay {
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  pointer-events: none;
  z-index: 1;
  border-radius: 8px;
  overflow: hidden;
}
.weather-overlay.rain::after {
  content: '';
  position: absolute; inset: 0;
  background: 
    repeating-linear-gradient(
      135deg,
      transparent,
      transparent 1px,
      rgba(170,200,240,0.38) 1px,
      rgba(170,200,240,0.38) 3px
    ),
    repeating-linear-gradient(
      125deg,
      transparent,
      transparent 3px,
      rgba(150,190,230,0.22) 3px,
      rgba(150,190,230,0.22) 6px
    );
  animation: rain-fall 0.55s linear infinite;
  pointer-events: none;
}
.weather-overlay.wind-leaves::before {
  content: '🍂 🍃';
  position: absolute;
  font-size: 17px;
  animation: leaf-fall 3.8s linear infinite;
  opacity: 0.55;
  left: 12%;
}
.weather-overlay.special-day {
  box-shadow: inset 0 0 55px rgba(255,195,90,0.32);
  filter: saturate(1.08);
}

/* 拂尘层 - 可交互 */
.dust-layer {
  position: absolute;
  inset: 0;
  background: repeating-radial-gradient(circle at 30% 40%, rgba(120,90,60,0.18) 0 1px, transparent 2px 5px);
  pointer-events: auto; /* 可滑动拂拭 */
  z-index: 2;
  transition: opacity 1.2s ease;
  cursor: crosshair;
}

/* 献花 */
.flower-area {
  position: absolute;
  bottom: 6px;
  left: 8%;
  right: 8%;
  height: 70px;
  z-index: 4;
  pointer-events: auto;
  cursor: pointer;
}
.flower {
  position: absolute;
  font-size: 20px;
  transition: transform 0.6s cubic-bezier(0.23, 1, 0.32, 1), opacity 0.6s;
  z-index: 5;
  filter: drop-shadow(0 1px 2px rgba(0,0,0,0.2));
}
.flower:hover {
  transform: scale(1.1) !important;
}

/* 动作按钮并排 */
.action-row {
  display: flex;
  gap: 12px;
  justify-content: center;
}

@keyframes rain-fall {
  0% { background-position: 0 0; }
  100% { background-position: 0 40px; }
}
@keyframes leaf-fall {
  0% { top: -10%; left: 10%; }
  100% { top: 110%; left: 80%; transform: rotate(120deg); }
}
  font-size: 42px;
  line-height: 1;
}

.gate-link span {
  display: block;
  color: #584939;
  font-family: var(--kai);
  line-height: 1.7;
}

.gate-link i {
  position: absolute;
  right: 16px;
  bottom: 12px;
  color: #8a6b3c;
  font-style: normal;
}

.chamber {
  position: relative;
  min-height: calc(100vh - 132px);
  padding: clamp(28px, 5vw, 64px);
}

.crumb {
  position: relative;
  z-index: 1;
  display: flex;
  gap: 10px;
  align-items: center;
  margin-bottom: 28px;
  color: var(--muted);
  font-family: var(--kai);
}

.split {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: minmax(0, 0.92fr) minmax(0, 1.08fr);
  gap: 28px;
  align-items: start;
}

.panel {
  position: relative;
  z-index: 1;
  padding: 24px;
  border: 1px solid rgba(84, 56, 30, 0.18);
  background: rgba(255, 251, 239, 0.45);
  box-shadow: inset 0 0 40px rgba(96, 60, 32, 0.08);
}

.panel.dark {
  color: #efe4cc;
  background:
    linear-gradient(145deg, rgba(38, 30, 24, 0.94), rgba(76, 49, 34, 0.9));
  border-color: rgba(226, 204, 158, 0.22);
}

.panel h3 {
  margin: 0 0 16px;
  color: var(--wood-dark);
  font-size: 26px;
  font-weight: 500;
}

.panel.dark h3 {
  color: #f6e8cf;
}

.cards {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.ritual-card,
.mini-card {
  padding: 16px;
  border: 1px solid rgba(84, 56, 30, 0.18);
  background: rgba(255, 255, 255, 0.34);
}

.ritual-card b,
.mini-card b {
  display: block;
  margin-bottom: 8px;
  color: var(--cinnabar);
  font-size: 20px;
}

.ritual-card span,
.mini-card span,
.line {
  color: #5f5145;
  font-family: var(--kai);
  line-height: 1.8;
}

.agent-dock {
  display: grid;
  gap: 14px;
}

.bubble {
  padding: 16px 18px;
  border: 1px solid rgba(185, 145, 75, 0.28);
  background: rgba(255, 251, 239, 0.7);
  box-shadow: 0 12px 30px rgba(69, 39, 23, 0.12);
}

.bubble.agent {
  border-color: rgba(159, 47, 36, 0.3);
  background: rgba(255, 247, 228, 0.82);
}

.bubble p {
  margin: 0;
  line-height: 1.75;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 18px;
}

.primary-link {
  display: inline-flex;
  min-height: 0;
  padding: 11px 14px;
  align-items: center;
  color: var(--wood-dark);
  font-family: var(--kai);
}

.chapter-list,
.ancestor-list {
  display: grid;
  gap: 12px;
  margin-top: 18px;
}

.chapter-list a,
.ancestor-list a {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  padding: 14px 16px;
  border-left: 4px solid rgba(159, 47, 36, 0.55);
  background: rgba(255, 255, 255, 0.36);
}

.tree {
  display: grid;
  gap: 18px;
  justify-items: center;
  padding: 26px;
  overflow-x: auto;
}

.generation {
  display: flex;
  gap: 14px;
  min-width: max-content;
}

.person {
  min-width: 118px;
  padding: 12px 14px;
  text-align: center;
  border: 1px solid rgba(84, 56, 30, 0.2);
  background: rgba(255,255,255,0.42);
}

.person strong {
  display: block;
  color: var(--wood-dark);
  font-size: 18px;
}

.person small {
  color: var(--muted);
  font-family: var(--kai);
}

.wechat {
  display: grid;
  gap: 12px;
  padding: 18px;
  border: 8px solid #2f3330;
  background: #f0eadf;
  box-shadow: 0 22px 44px rgba(0,0,0,0.2);
}

.input-row {
  display: flex;
  gap: 10px;
  margin-top: 12px;
}

.input-row input {
  width: 100%;
  min-width: 0;
  padding: 13px 14px;
  color: var(--ink);
  font: 17px var(--kai);
  border: 1px solid rgba(84, 56, 30, 0.22);
  background: rgba(255, 255, 255, 0.58);
}

.input-row button {
  padding: 0 18px;
  color: #fff8e8;
  font: 17px var(--kai);
  border: 0;
  background: var(--cinnabar);
}

@media (max-width: 880px) {
  .page {
    width: min(100% - 20px, 680px);
    padding-top: 10px;
  }

  .topbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .nav {
    justify-content: flex-start;
  }

  .hero,
  .split {
    grid-template-columns: 1fr;
  }

  .hero {
    min-height: auto;
  }

  .hero .stone-scene {
    order: 1;
  }

  .hero .intro {
    order: 2;
  }

  .stone-scene {
    min-height: 520px;
  }

  .thresholds,
  .cards {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 540px) {
  .page {
    width: 100%;
    padding: 0;
  }

  .topbar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 20;
    gap: 0;
    padding: 10px 10px 9px;
    border-width: 0 0 1px;
    transition: opacity 220ms ease, transform 220ms ease;
  }

  body.tomb-home:not(.nav-visible) .topbar {
    opacity: 0;
    pointer-events: none;
    transform: translateY(-100%);
  }

  .brand {
    display: none;
  }

  .nav {
    width: 100%;
    display: grid;
    grid-template-columns: repeat(6, minmax(0, 1fr));
    gap: 5px;
  }

  .nav a {
    display: grid;
    min-height: 34px;
    place-items: center;
    padding: 6px 2px;
    font-size: 14px;
  }

  .hero {
    margin-top: 0;
    border-width: 0;
    box-shadow: none;
    background: var(--paper);
  }

  .hero::after {
    opacity: 0.08;
  }

  .stone-scene {
    height: 100vh;
    min-height: 620px;
    padding: 0 16px;
    place-items: center;
    cursor: pointer;
  }

  .tablet {
    width: min(308px, 86vw);
    aspect-ratio: 0.58;
    margin-top: 0;
    padding: 30px 24px 28px;
  }

  .portrait-slot {
    width: 64px;
    height: 78px;
    margin: 4px auto 12px;
  }

  .tablet-name {
    margin-top: 0;
    font-size: 50px;
  }

  .tablet-years {
    margin-top: 10px;
    font-size: 11px;
  }

  .tablet-places {
    margin-top: 4px;
    font-size: 10px;
    letter-spacing: 0.06em;
    line-height: 1.05;
  }

  .tablet-domain {
    margin-top: 10px;
    font-size: 9px;
  }

  .incense {
    bottom: 8px;
    height: 116px;
  }

  .incense::before,
  .incense::after {
    bottom: 102px;
    width: 18px;
    height: 150px;
    filter: blur(5px);
  }

  .stone-scene::before {
    bottom: 150px;
    height: 154px;
  }

  .intro {
    padding: 26px 24px 40px;
    background:
      linear-gradient(180deg, rgba(0,0,0,0.08), transparent 22px),
      var(--paper);
  }

  .intro .eyebrow,
  .intro h1,
  .intro .lead,
  .agent-strip,
  .thresholds {
    display: none;
  }

  .poem {
    display: block;
    margin-top: 0;
    padding-left: 14px;
    font-size: 17px;
  }

  .thresholds,
  .cards {
    grid-template-columns: 1fr;
  }

}
