/* ============================================================
   3D 殿内 —— 覆盖层 + HUD
   ============================================================ */
:root {
  --gold: #d9b45b;
  --gold-bright: #f6dfa4;
  --paper: #f3e7cf;
  --serif: "Songti SC", "STSong", "SimSun", "Noto Serif SC", serif;
  --sans: "PingFang SC", "Microsoft YaHei", "Noto Sans SC", sans-serif;
  --ease: cubic-bezier(0.22, 0.61, 0.36, 1);
  --accent: #e2b45e;
  --glow: 255, 206, 120;
}

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

html, body {
  height: 100%;
  overflow: hidden;
  background: #05040a;
  color: var(--paper);
  font-family: var(--sans);
  -webkit-font-smoothing: antialiased;
  overscroll-behavior: none;
  touch-action: none;
}

#scene {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  cursor: grab;
}
#scene.dragging { cursor: grabbing; }

/* ---------- 加载 ---------- */
#loader {
  position: fixed;
  inset: 0;
  z-index: 90;
  display: grid;
  place-items: center;
  background: #06050b;
  transition: opacity 0.9s var(--ease);
}
#loader.gone { opacity: 0; pointer-events: none; }

.loader-inner { text-align: center; }
.spin {
  width: 34px;
  height: 34px;
  margin: 0 auto 20px;
  border: 1px solid rgba(217, 180, 91, 0.25);
  border-top-color: var(--gold-bright);
  border-radius: 50%;
  animation: spin 1.1s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.loader-text {
  font-family: var(--serif);
  font-size: 12.5px;
  letter-spacing: 0.3em;
  color: rgba(243, 231, 207, 0.45);
}

/* ---------- 操作提示 ---------- */
#tip {
  position: fixed;
  left: 50%;
  bottom: calc(50% - 190px);
  transform: translateX(-50%);
  z-index: 30;
  font-family: var(--serif);
  font-size: 15px;
  letter-spacing: 0.24em;
  color: rgba(243, 231, 207, 0.4);
  pointer-events: none;
  text-align: center;
  line-height: 2;
  transition: opacity 1.2s var(--ease);
}
#tip.gone { opacity: 0; }

/* ---------- HUD ---------- */
#hud {
  position: fixed;
  inset: 0;
  display: grid;
  grid-template-rows: auto 1fr auto auto auto;
  padding: clamp(14px, 2.2vw, 26px) clamp(16px, 3vw, 40px) clamp(16px, 2.4vw, 30px);
  pointer-events: none;
  opacity: 0;
  transition: opacity 1.4s var(--ease);
  z-index: 40;
}
#hud.on { opacity: 1; }
#hud > * { pointer-events: auto; }

#topbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; }

.brand { display: flex; align-items: center; gap: 10px; opacity: 0.94; }
.seal {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 5px;
  background: linear-gradient(160deg, var(--accent), #4a1108);
  color: var(--gold-bright);
  font-family: var(--serif);
  font-size: 16px;
  box-shadow: inset 0 0 0 1px rgba(246, 223, 164, 0.35), 0 4px 14px rgba(0, 0, 0, 0.5);
}
.brand-text {
  font-family: var(--serif);
  font-size: 15px;
  letter-spacing: 0.2em;
  color: rgba(243, 231, 207, 0.78);
  text-shadow: 0 1px 12px rgba(0, 0, 0, 0.9);
}

.top-actions { display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.ghost {
  appearance: none;
  border: 1px solid rgba(217, 180, 91, 0.3);
  background: rgba(12, 8, 6, 0.5);
  backdrop-filter: blur(8px);
  color: rgba(243, 231, 207, 0.8);
  font-family: var(--serif);
  font-size: 12.5px;
  letter-spacing: 0.12em;
  padding: 7px 14px;
  border-radius: 999px;
  cursor: pointer;
  transition: all 0.35s var(--ease);
}
.ghost:hover { border-color: rgba(246, 223, 164, 0.7); color: var(--gold-bright); }
.ghost.off { opacity: 0.4; }

/* 对话 */
.dialogue {
  align-self: end;
  justify-self: center;
  width: min(780px, 92vw);
  text-align: center;
  margin-bottom: clamp(10px, 1.6vh, 18px);
  min-height: 82px;
}
.speaker {
  font-family: var(--serif);
  font-size: 15px;
  letter-spacing: 0.4em;
  color: var(--accent);
  text-shadow: 0 0 18px rgba(217, 180, 91, 0.5), 0 1px 10px rgba(0, 0, 0, 0.9);
  margin-bottom: 11px;
  opacity: 0;
  transition: opacity 0.7s var(--ease);
}
.speaker.on { opacity: 1; }
.line {
  font-family: var(--serif);
  font-size: clamp(19px, 1.85vw, 26px);
  line-height: 1.92;
  letter-spacing: 0.05em;
  color: #f7ecd6;
  text-shadow: 0 2px 20px rgba(0, 0, 0, 0.98), 0 0 30px rgba(0, 0, 0, 0.85);
  min-height: 1.9em;
}

/* 选项 */
.choices {
  justify-self: center;
  display: flex;
  flex-wrap: wrap;
  gap: 9px;
  justify-content: center;
  width: min(780px, 92vw);
  margin-bottom: 12px;
}
.choice {
  appearance: none;
  border: 1px solid rgba(217, 180, 91, 0.32);
  background: linear-gradient(180deg, rgba(28, 19, 11, 0.78), rgba(12, 8, 5, 0.8));
  backdrop-filter: blur(10px);
  color: rgba(243, 231, 207, 0.9);
  font-family: var(--serif);
  font-size: 14px;
  letter-spacing: 0.06em;
  padding: 8px 16px 9px 42px;
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.25s;
  text-align: left;
  line-height: 1.35;
  display: inline-flex;
  flex-direction: column;
  justify-content: center;
  min-height: 42px;
  min-width: 150px;
  position: relative;
  overflow: hidden;
}
.choice:hover {
  border-color: rgba(246, 223, 164, 0.9);
  color: #fff6e2;
  transform: translateY(-2px);
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.6), 0 0 26px rgba(217, 180, 91, 0.24);
}
.choice .k {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 21px;
  height: 21px;
  border-radius: 50%;
  border: 1px solid rgba(217, 180, 91, 0.5);
  color: var(--gold);
  font-size: 11px;
}
@keyframes rise { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }

/* 提问 */
.ask {
  justify-self: center;
  display: flex;
  align-items: center;
  gap: 10px;
  width: min(640px, 88vw);
  margin-bottom: 4px;
  opacity: 0;
  transition: opacity 0.9s var(--ease);
}
.ask.on { opacity: 1; }
#ask-input {
  flex: 1;
  border: 1px solid rgba(217, 180, 91, 0.24);
  background: rgba(10, 7, 4, 0.68);
  backdrop-filter: blur(10px);
  border-radius: 999px;
  padding: 12px 20px;
  color: var(--paper);
  font-family: var(--serif);
  font-size: 14.5px;
  letter-spacing: 0.05em;
  outline: none;
  transition: all 0.35s var(--ease);
}
#ask-input::placeholder { color: rgba(243, 231, 207, 0.34); }
#ask-input:focus { border-color: rgba(246, 223, 164, 0.65); box-shadow: 0 0 30px rgba(217, 180, 91, 0.16); }
#ask-send {
  appearance: none;
  border: 1px solid rgba(217, 180, 91, 0.45);
  background: linear-gradient(160deg, rgba(140, 40, 30, 0.9), rgba(80, 20, 15, 0.9));
  color: var(--gold-bright);
  font-family: var(--serif);
  font-size: 14px;
  letter-spacing: 0.18em;
  width: 54px;
  height: 44px;
  border-radius: 999px;
  cursor: pointer;
  transition: all 0.35s var(--ease);
}
#ask-send:hover { box-shadow: 0 0 26px rgba(217, 180, 91, 0.3); }
#ask-send:disabled { opacity: 0.35; cursor: default; }

.hint:empty { display: none; }
.hint {
  justify-self: center;
  font-size: 15px;
  letter-spacing: 0.14em;
  color: rgba(243, 231, 207, 0.32);
  text-align: center;
  min-height: 16px;
  font-family: var(--serif);
}

/* ---------- 命盘 ---------- */
.panel {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: grid;
  place-items: center;
  background: rgba(4, 3, 10, 0.8);
  backdrop-filter: blur(8px);
}
.panel-inner {
  position: relative;
  width: min(920px, 94vw);
  max-height: 88vh;
  overflow: auto;
  padding: 30px;
  border-radius: 6px;
  background: linear-gradient(180deg, rgba(22, 18, 40, 0.96), rgba(8, 6, 16, 0.98));
  border: 1px solid rgba(180, 168, 255, 0.28);
  box-shadow: 0 40px 120px rgba(0, 0, 0, 0.8);
}
.panel-close {
  position: absolute; top: 12px; right: 14px;
  width: 30px; height: 30px;
  border: 1px solid rgba(180, 168, 255, 0.3);
  border-radius: 50%;
  background: transparent; color: rgba(226, 218, 255, 0.7);
  font-size: 17px; cursor: pointer; line-height: 1;
}
.panel-head {
  text-align: center;
  font-family: var(--serif);
  font-size: 15px;
  letter-spacing: 0.2em;
  line-height: 2;
  color: rgba(226, 218, 255, 0.72);
  margin-bottom: 24px;
  padding-bottom: 18px;
  border-bottom: 1px solid rgba(180, 168, 255, 0.16);
}
.chart-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 2px; background: rgba(180,168,255,.14); border: 1px solid rgba(180,168,255,.2); }
.palace { background: rgba(12,10,24,.94); padding: 10px; min-height: 92px; display: flex; flex-direction: column; gap: 5px; }
.palace.ming { background: rgba(80,66,150,.32); box-shadow: inset 0 0 0 1px rgba(214,200,255,.5); }
.palace-top { display: flex; justify-content: space-between; font-size: 10px; color: rgba(226,218,255,.5); font-family: var(--serif); }
.palace-name { color: #e9e2ff; font-size: 12px; }
.palace-majors { font-family: var(--serif); font-size: 12.5px; line-height: 1.6; color: #fdf6e6; }
.palace-majors .b { font-size: 9px; color: rgba(226,218,255,.55); margin-left: 1px; }
.palace-majors .m { font-size: 9px; color: #ffcf8a; margin-left: 2px; }
.palace-minors { font-size: 10px; color: rgba(226,218,255,.52); }

/* 命盘提要 + 大限 + 身宫 */
.chart-brief { display: flex; flex-wrap: wrap; justify-content: center; gap: 4px 18px; }
.chart-brief .cb { display: inline-flex; align-items: baseline; gap: 5px; font-size: 11.5px; letter-spacing: .05em; }
.chart-brief .cb i { font-style: normal; color: rgba(226,218,255,.4); font-size: 10px; }
.chart-brief .cb b { font-weight: 400; color: rgba(253,246,230,.92); }
.palace-body { margin-left: 4px; padding: 0 3px; border-radius: 3px; border: 1px solid rgba(255,207,138,.45); font-style: normal; font-size: 9px; color: #ffcf8a; }
.palace-range { margin-top: auto; font-size: 10px; letter-spacing: .08em; color: rgba(255,207,138,.72); }

/* 命盘：视图切换 / 三方四正高亮 / 运限 */
.chart-tabs { display: flex; justify-content: center; gap: 6px; margin: 14px 0 12px; }
.chart-tabs button {
  border: 1px solid rgba(180,168,255,.22); border-radius: 999px; padding: 6px 14px;
  background: rgba(20,16,36,.6); color: rgba(226,218,255,.62);
  font: inherit; font-size: 12px; letter-spacing: .08em; cursor: pointer;
  transition: color .18s ease, border-color .18s ease, background .18s ease;
}
.chart-tabs button.on { color: #fdf6e6; border-color: rgba(255,207,138,.6); background: rgba(80,66,150,.4); }
.chart-tabs button:hover { color: #fdf6e6; }

.palace.hl { box-shadow: inset 0 0 0 1px rgba(255,207,138,.4); }
.palace.hl-self { background: rgba(80,66,150,.34); box-shadow: inset 0 0 0 1px rgba(214,200,255,.55); }
.palace.hl-opposite { background: rgba(40,34,78,.92); box-shadow: inset 0 0 0 1px rgba(180,168,255,.4); }
.palace.hl-wealth { background: rgba(58,44,26,.9); box-shadow: inset 0 0 0 1px rgba(255,207,138,.28); }
.palace.hl-career { background: rgba(26,52,48,.9); box-shadow: inset 0 0 0 1px rgba(120,220,190,.28); }
.palace.hl-yearly { background: rgba(56,36,28,.92); box-shadow: inset 0 0 0 1px rgba(255,164,110,.45); }
.palace.hl-decadal { background: rgba(28,40,60,.92); box-shadow: inset 0 0 0 1px rgba(120,180,255,.4); }
.palace.picked { outline: 1px dashed rgba(255,207,138,.6); outline-offset: -3px; }
.chart-grid .palace { cursor: default; }
.chart-tabs button, .palace.hl { cursor: pointer; }

.palace-badges { display: flex; gap: 3px; }
.palace-badges span {
  font-size: 9px; padding: 0 3px; border-radius: 3px; letter-spacing: .04em;
  color: #ffcf8a; border: 1px solid rgba(255,207,138,.45);
}

/* 点击涟漪 */
.ripple {
  position: fixed;
  z-index: 45;
  width: 12px;
  height: 12px;
  margin: -6px 0 0 -6px;
  border-radius: 50%;
  border: 1px solid rgba(255, 207, 138, .62);
  box-shadow: 0 0 12px rgba(255, 207, 138, .3);
  pointer-events: none;
  animation: ripple-out .9s ease-out forwards;
}
@keyframes ripple-out {
  0% { transform: scale(.4); opacity: .85; }
  100% { transform: scale(7); opacity: 0; }
}

/* 经文（《紫微斗數全書》摘录） */
.verse {
  margin: 14px auto 0;
  max-width: 720px;
  padding: 12px 16px 12px 18px;
  border-left: 2px solid rgba(255, 207, 138, .55);
  border-radius: 4px;
  background: rgba(8, 6, 14, .62);
  backdrop-filter: blur(6px);
  font-size: 13px;
  line-height: 1.95;
  color: rgba(244, 234, 210, .86);
  text-align: left;
  letter-spacing: .02em;
}
.verse cite {
  display: block;
  margin-top: 6px;
  font-style: normal;
  font-size: 11px;
  letter-spacing: .06em;
  color: rgba(255, 207, 138, .78);
}
.verse a {
  color: rgba(255, 207, 138, .92);
  text-decoration: none;
  border-bottom: 1px dotted rgba(255, 207, 138, .5);
}
.verse a:hover { color: #ffe1a8; }
.guide-verse .vq { font-size: 13.5px !important; line-height: 1.95; }
.guide-verse cite {
  display: block;
  margin-top: 4px;
  font-style: normal;
  font-size: 11px;
  color: rgba(255, 207, 138, .62);
}
.guide-verse a {
  color: rgba(255, 207, 138, .92);
  text-decoration: none;
  border-bottom: 1px dotted rgba(255, 207, 138, .5);
}
@media (max-width: 760px) {
  .verse { font-size: 12px; padding: 10px 12px 10px 14px; line-height: 1.85; }
}

/* 续读条：关页面前那问的进度 / 未读答案 */
.resume-bar {
  margin: 10px auto 0;
  max-width: 660px;
  display: flex;
  gap: 10px;
  align-items: center;
  justify-content: space-between;
  padding: 8px 14px;
  border-radius: 10px;
  border: 1px solid rgba(217, 180, 106, .3);
  background: rgba(12, 10, 20, .72);
  backdrop-filter: blur(6px);
  font-size: 12.5px;
  color: rgba(244, 234, 210, .86);
}
.resume-bar b { color: #ffd68f; font-weight: 500; }
.resume-bar button {
  border: 1px solid rgba(217, 180, 106, .45);
  background: rgba(217, 180, 106, .14);
  color: #ffe1a8;
  border-radius: 999px;
  padding: 4px 14px;
  font-size: 12px;
  cursor: pointer;
}
.resume-bar button:hover { background: rgba(217, 180, 106, .24); }

/* 回答存疑提示（星曜白名单校验） */
.answer-warn {
  margin: 10px auto 0;
  max-width: 680px;
  padding: 8px 12px;
  border-radius: 6px;
  border: 1px solid rgba(255, 176, 120, .38);
  background: rgba(60, 24, 12, .55);
  backdrop-filter: blur(6px);
  font-size: 12px;
  line-height: 1.75;
  color: rgba(255, 214, 176, .92);
  text-align: left;
}

/* 本殿说明 */
.guide-inner { width: min(720px, 92vw); }
.guide-title { color: #fdf6e6; font-size: 20px; letter-spacing: .16em; margin-bottom: 6px; }
.guide-palace { color: rgba(255,207,138,.72); font-size: 12px; letter-spacing: .1em; }
.guide-sec { margin-top: 20px; padding-top: 16px; border-top: 1px solid rgba(180,168,255,.12); }
.guide-sec h3 { margin: 0 0 8px; font-size: 12px; font-weight: 400; letter-spacing: .18em; color: rgba(255,207,138,.88); }
.guide-sec p { margin: 0; font-size: 14px; line-height: 2; color: rgba(253,246,230,.9); }
.guide-boundary { border-top-color: rgba(180,168,255,.2); }
.guide-boundary p { font-size: 12.5px; line-height: 1.9; color: rgba(226,218,255,.6); }

/* 三方四正虚线 */
.chart-grid { position: relative; }
.chart-links { position: absolute; inset: 0; z-index: 2; pointer-events: none; overflow: visible; }
.chart-links line { stroke: rgba(255, 207, 138, .58); stroke-width: 1.2; stroke-dasharray: 5 5; filter: drop-shadow(0 0 3px rgba(255, 207, 138, .25)); }
.chart-links line.link-opposite { stroke: rgba(196, 186, 255, .55); }
.chart-links line.link-wealth { stroke: rgba(255, 207, 138, .38); }
.chart-links line.link-career { stroke: rgba(120, 220, 190, .4); }

.chart-note { margin-top: 14px; padding-top: 12px; border-top: 1px solid rgba(180,168,255,.14); }
.chart-line { display: flex; gap: 10px; align-items: baseline; font-size: 11.5px; line-height: 1.7; }
.chart-line + .chart-line { margin-top: 4px; }
.chart-line i { flex: 0 0 auto; font-style: normal; color: rgba(226,218,255,.42); font-size: 10px; letter-spacing: .08em; }
.chart-line b { font-weight: 400; color: rgba(253,246,230,.9); }
.chart-years { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; }
.chart-years button {
  border: 1px solid rgba(180,168,255,.22); border-radius: 999px; padding: 4px 10px;
  background: transparent; color: rgba(226,218,255,.6); font: inherit; font-size: 11.5px; cursor: pointer;
}
.chart-years button.on { color: #0f0d1a; background: #ffcf8a; border-color: #ffcf8a; }

/* ---------- 门槛 ---------- */
#gate {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  background: transparent;
  overflow: hidden;
  transition: opacity 1.5s var(--ease);
  perspective: 1400px;
  perspective-origin: 50% 48%;
}
#gate.opening { opacity: 1; }
#gate.gone { display: none; }

.gate-doors { position: absolute; inset: 0; transform-style: preserve-3d; }
.door {
  position: absolute;
  top: -2%; bottom: -2%;
  width: 50.6%;
  background:
    linear-gradient(180deg, rgba(56, 32, 18, 0.995), rgba(26, 13, 8, 1)),
    repeating-linear-gradient(90deg, rgba(255, 214, 158, 0.05) 0 2px, rgba(0, 0, 0, 0.3) 2px 24px);
  border: 1px solid rgba(217, 180, 91, 0.42);
  box-shadow: inset 0 0 140px rgba(0, 0, 0, 0.92);
  transition: transform 2.6s cubic-bezier(0.62, 0.02, 0.2, 1);
  transform-style: preserve-3d;
  backface-visibility: hidden;
}
.door-l { left: 0; transform-origin: left center; }
.door-r { right: 0; transform-origin: right center; }
.door::after {
  content: "";
  position: absolute;
  inset: 9% 12%;
  background-image:
    radial-gradient(circle, rgba(250, 228, 170, 0.95) 0 8px, rgba(120, 74, 24, 0.75) 8px 11px, transparent 11px),
    radial-gradient(circle, rgba(250, 228, 170, 0.8) 0 6px, rgba(120, 74, 24, 0.6) 6px 9px, transparent 9px);
  background-size: 152px 152px, 152px 152px;
  background-position: 0 0, 76px 76px;
  opacity: 0.85;
  -webkit-mask-image: linear-gradient(180deg, #000 55%, transparent 100%);
  mask-image: linear-gradient(180deg, #000 55%, transparent 100%);
}
.door-l::before, .door-r::before {
  content: "";
  position: absolute;
  top: 8%; bottom: 8%;
  width: 3px;
  background: linear-gradient(to bottom, transparent, rgba(255, 214, 140, 0.55), transparent);
  filter: blur(1px);
}
.door-l::before { right: 0; }
.door-r::before { left: 0; }
#gate.opening .door-l { transform: rotateY(-96deg) translateZ(-40px); }
#gate.opening .door-r { transform: rotateY(96deg) translateZ(-40px); }

.door-glow {
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse 30% 72% at 50% 50%, rgba(255, 214, 150, 0.55), rgba(210, 140, 60, 0.16) 42%, transparent 72%);
  opacity: 0;
  transition: opacity 1.2s var(--ease) 0.2s;
  mix-blend-mode: screen;
  pointer-events: none;
}
#gate.opening .door-glow { opacity: 1; }

.gate-frame {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    linear-gradient(90deg, rgba(4,2,2,.995) 0%, rgba(4,2,2,.93) 9%, transparent 21%, transparent 79%, rgba(4,2,2,.93) 91%, rgba(4,2,2,.995) 100%),
    linear-gradient(180deg, rgba(4,2,2,.995) 0%, rgba(4,2,2,.86) 9%, transparent 22%, transparent 76%, rgba(4,2,2,.93) 94%, rgba(4,2,2,1) 100%);
  transition: opacity 1.6s var(--ease) 1.1s;
}
#gate.opening .gate-frame { opacity: 0; }

.gate-threshold {
  position: absolute;
  left: 0; right: 0; bottom: 6%;
  height: 3.4%;
  background: linear-gradient(180deg, rgba(92, 56, 30, 0.95), rgba(30, 16, 8, 0.98));
  border-top: 1px solid rgba(217, 180, 91, 0.35);
  transition: opacity 1.2s var(--ease) 0.7s, transform 1.4s var(--ease) 0.7s;
  transform-origin: 50% 100%;
}
#gate.opening .gate-threshold { opacity: 0; transform: scaleY(0.2) translateY(40px); }

.gate-copy {
  position: relative;
  z-index: 2;
  text-align: center;
  padding: 0 24px;
  transition: opacity 1s var(--ease), transform 1.2s var(--ease);
}
#gate.opening .gate-copy { opacity: 0; transform: translateY(-14px) scale(0.97); }

.gate-kicker {
  font-family: var(--serif);
  font-size: 12px;
  letter-spacing: 0.5em;
  color: rgba(217, 180, 91, 0.6);
  margin-bottom: 26px;
}
.gate-title {
  font-family: var(--serif);
  font-weight: 400;
  font-size: clamp(40px, 6.4vw, 82px);
  letter-spacing: 0.3em;
  color: #f4e2b8;
  text-shadow: 0 0 46px rgba(217, 180, 91, 0.5), 0 0 100px rgba(217, 180, 91, 0.22);
  margin-bottom: 20px;
}
.gate-sub {
  font-family: var(--serif);
  font-size: 14.5px;
  letter-spacing: 0.1em;
  color: rgba(243, 231, 207, 0.62);
  margin-bottom: 38px;
}
.enter {
  appearance: none;
  border: 1px solid rgba(217, 180, 91, 0.55);
  background: linear-gradient(180deg, rgba(120, 32, 24, 0.55), rgba(40, 12, 8, 0.55));
  backdrop-filter: blur(4px);
  color: #f6e3b6;
  font-family: var(--serif);
  font-size: 16px;
  letter-spacing: 0.44em;
  padding: 15px 46px 15px 52px;
  border-radius: 3px;
  cursor: pointer;
  transition: all 0.5s var(--ease);
  position: relative;
  overflow: hidden;
}
.enter:hover { border-color: rgba(246, 223, 164, 0.9); box-shadow: 0 0 46px rgba(217, 180, 91, 0.32); color: #fff8e6; }
.gate-note { margin-top: 22px; font-size: 11.5px; letter-spacing: 0.14em; color: rgba(243, 231, 207, 0.26); font-family: var(--serif); }

/* 报生辰 */
.birth {
  position: relative;
  z-index: 3;
  width: min(560px, 90vw);
  padding: 34px 34px 26px;
  border-radius: 4px;
  background: linear-gradient(180deg, rgba(24, 20, 40, 0.9), rgba(10, 8, 20, 0.94));
  border: 1px solid rgba(190, 178, 255, 0.28);
  box-shadow: 0 30px 90px rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(10px);
  text-align: center;
}
.birth-kicker { font-family: var(--serif); font-size: 17px; letter-spacing: 0.26em; color: #e9e2ff; margin-bottom: 8px; }
.birth-note { font-family: var(--serif); font-size: 11.5px; color: rgba(220, 212, 255, 0.46); margin-bottom: 26px; }
.birth-row { display: flex; align-items: center; gap: 14px; margin-bottom: 15px; text-align: left; }
.birth-row > label { flex: 0 0 62px; font-family: var(--serif); font-size: 12px; color: rgba(226, 218, 255, 0.62); }
.sel-group { display: flex; align-items: center; gap: 6px; flex: 1; flex-wrap: wrap; }
.sel-group select {
  appearance: none; flex: 1 1 70px; min-width: 66px;
  padding: 9px 10px; border-radius: 3px;
  border: 1px solid rgba(190, 178, 255, 0.24);
  background: rgba(8, 6, 16, 0.72); color: #efe9ff;
  font-family: var(--serif); font-size: 13px; outline: none; cursor: pointer;
}
.shichen { font-family: var(--serif); font-style: normal; font-size: 11.5px; color: rgba(196,184,255,.8); padding: 4px 9px; border: 1px solid rgba(160,148,240,.3); border-radius: 999px; }
.gender-group { display: flex; gap: 10px; flex: 1; }
.gbtn {
  flex: 1; padding: 9px 0; border-radius: 3px;
  border: 1px solid rgba(190, 178, 255, 0.22);
  background: rgba(8, 6, 16, 0.6); color: rgba(226, 218, 255, 0.62);
  font-family: var(--serif); font-size: 13.5px; cursor: pointer; transition: all .3s;
}
.gbtn.on { border-color: rgba(214,200,255,.8); background: rgba(96,80,190,.3); color: #fff; box-shadow: 0 0 24px rgba(150,130,255,.3); }
.birth-submit {
  width: 100%; margin-top: 20px; padding: 14px;
  border: 1px solid rgba(196, 184, 255, 0.6); border-radius: 3px;
  background: linear-gradient(180deg, rgba(86,68,176,.5), rgba(40,28,90,.5));
  color: #f3eeff; font-family: var(--serif); font-size: 14.5px;
  letter-spacing: 0.4em; text-indent: 0.4em; cursor: pointer; transition: all .4s;
}
.birth-submit:hover { box-shadow: 0 0 44px rgba(150,130,255,.36); }
.birth-err { margin-top: 12px; font-size: 12px; color: #ff9b8a; min-height: 16px; }

[hidden] { display: none !important; }

/* 英文 */
html[lang="en"] .speaker { letter-spacing: 0.14em; }
html[lang="en"] .line { letter-spacing: 0.01em; line-height: 1.7; font-family: Georgia, "Times New Roman", var(--serif); font-size: clamp(15px, 1.4vw, 19px); }
html[lang="en"] .choice { letter-spacing: 0.02em; font-size: 13px; }
html[lang="en"] .brand-text { letter-spacing: 0.08em; font-size: 12.5px; }
html[lang="en"] .gate-title { letter-spacing: 0.12em; }
html[lang="en"] .gate-sub { letter-spacing: 0.04em; }
html[lang="en"] .birth-kicker { letter-spacing: 0.08em; font-size: 16px; }

@media (max-aspect-ratio: 1/1) {
  .dialogue { width: 94vw; }
  #tip { bottom: calc(50% - 210px); font-size: 10.5px; }
  .birth { padding: 24px 18px 18px; }
  .chart-grid { grid-template-columns: repeat(3, 1fr); }
}

/* 上香按钮 */
.incense-btn {
  display: block;
  margin: 14px auto 0;
  appearance: none;
  border: 1px solid rgba(246, 214, 140, 0.5);
  background: rgba(28, 18, 10, 0.6);
  backdrop-filter: blur(8px);
  color: rgba(255, 240, 208, 0.9);
  font-family: "Songti SC", "STSong", serif;
  font-size: 12.5px;
  letter-spacing: 0.3em;
  text-indent: 0.3em;
  padding: 8px 22px;
  border-radius: 999px;
  cursor: pointer;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.6s ease, border-color 0.3s ease, box-shadow 0.3s ease;
}
.incense-btn.on { opacity: 1; pointer-events: auto; }
.incense-btn:hover { border-color: rgba(255, 232, 170, 0.95); box-shadow: 0 0 28px rgba(217, 180, 91, 0.35); }
.incense-btn.done { border-color: rgba(255, 200, 120, 0.8); color: #ffe9b8; }

/* ============================================================
   香火（DOM 层，固定在画面下方，不随相机移动）
   ============================================================ */
#smoke-layer {
  position: fixed;
  left: 50%;
  bottom: 16vh;
  width: 0;
  height: 0;
  z-index: 6;
  pointer-events: none;
  opacity: 0.8;
  transition: opacity 0.6s ease;
}
#smoke-layer.burning { opacity: 1; }

#smoke-layer .puff {
  position: absolute;
  left: -22px;
  bottom: 0;
  width: 58px;
  height: 58px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255,253,246,0.72) 0%, rgba(246,242,232,0.3) 42%, rgba(240,236,226,0) 72%);
  filter: blur(5px);
  transform: translate(-50%, 0) scale(0.4);
  animation: puffRise var(--d, 3s) linear infinite;
  animation-delay: calc(var(--i) * -0.42s);
  mix-blend-mode: screen;
}
#smoke-layer.burning .puff {
  background: radial-gradient(circle, rgba(255,255,250,0.72) 0%, rgba(248,244,236,0.3) 44%, rgba(240,236,226,0) 74%);
}

@keyframes puffRise {
  0% {
    transform: translate(-50%, 0) scale(0.32);
    opacity: 0;
  }
  12% { opacity: 0.9; }
  55% {
    transform: translate(calc(-50% + 12px), -70px) scale(0.9);
    opacity: 0.5;
  }
  100% {
    transform: translate(calc(-50% - 16px), -150px) scale(1.5);
    opacity: 0;
  }
}


/* ============================================================
   可读性强化：文字压在复杂画面上必须看得清
   ============================================================ */
.speaker {
  color: #ffe9b8 !important;
  text-shadow: 0 2px 10px rgba(0, 0, 0, 1), 0 0 24px rgba(0, 0, 0, 0.9);
  letter-spacing: 0.14em;
}

.line {
  color: #fffaf0 !important;
  font-weight: 500;
  line-height: 1.75;
  text-shadow:
    0 2px 6px rgba(0, 0, 0, 0.95),
    0 4px 22px rgba(0, 0, 0, 0.9),
    0 0 46px rgba(0, 0, 0, 0.8);
  padding: 0 8px;
}

/* 台词背后的柔和暗底，避免压在亮部看不清 */
.dialogue::before {
  content: '';
  position: absolute;
  inset: -18px -32px;
  border-radius: 16px;
  background: radial-gradient(ellipse 78% 100% at 50% 60%, rgba(6, 8, 12, 0.62), rgba(6, 8, 12, 0.28) 62%, transparent 88%);
  pointer-events: none;
  z-index: -1;
}
.dialogue { position: relative; }

.choice {
  color: #fff3d6 !important;
  font-size: 15px !important;
  background: rgba(18, 12, 8, 0.72) !important;
  border-color: rgba(246, 214, 140, 0.5) !important;
  text-shadow: 0 1px 6px rgba(0, 0, 0, 0.95);
  backdrop-filter: blur(10px);
}
.choice:hover {
  background: rgba(48, 28, 12, 0.88) !important;
  border-color: rgba(255, 236, 180, 0.95) !important;
  box-shadow: 0 0 26px rgba(217, 180, 91, 0.4);
}

.hint:empty { display: none; }
.hint {
  color: rgba(255, 248, 232, 0.8) !important;
  font-size: 13px !important;
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.95);
  letter-spacing: 0.12em;
}

.brand-text {
  font-size: 15px !important;
  color: rgba(255, 250, 236, 0.95) !important;
  text-shadow: 0 2px 12px rgba(0, 0, 0, 0.95);
}

#ask-input {
  font-size: 15px !important;
  color: #fffaf0 !important;
  text-shadow: 0 1px 6px rgba(0, 0, 0, 0.9);
}
#ask-input::placeholder {
  color: rgba(255, 248, 232, 0.55) !important;
}

.ghost {
  font-size: 13.5px !important;
  color: rgba(255, 250, 236, 0.92) !important;
  background: rgba(10, 12, 16, 0.55) !important;
  border-color: rgba(217, 180, 91, 0.42) !important;
}

.incense-btn {
  font-size: 14px !important;
  color: #fff0c8 !important;
  border-color: rgba(246, 214, 140, 0.6) !important;
  background: rgba(32, 20, 10, 0.72) !important;
}


/* ============================================================
   第二遍：仍偏淡的几处
   ============================================================ */
#hint.hint, .hint:empty { display: none; }
.hint {
  opacity: 1 !important;
  color: rgba(255, 250, 240, 0.92) !important;
  font-size: 13.5px !important;
  letter-spacing: 0.16em;
  text-shadow:
    0 2px 8px rgba(0, 0, 0, 1),
    0 0 22px rgba(0, 0, 0, 0.95);
}

/* 顶栏：殿名 + 宫位名都提亮 */
.brand-text,
.brand-text span,
#brand-text {
  color: #fff6dd !important;
  font-size: 15px !important;
  letter-spacing: 0.1em;
  text-shadow:
    0 2px 10px rgba(0, 0, 0, 1),
    0 0 20px rgba(0, 0, 0, 0.9);
}
.brand-text span {
  color: rgba(255, 226, 160, 0.95) !important;
}

/* 印章图标稍微提亮 */
.seal {
  box-shadow: 0 0 18px rgba(217, 180, 91, 0.55);
}

/* 输入框：本体和占位符 */
#ask-input {
  background: rgba(12, 10, 8, 0.72) !important;
  border-color: rgba(246, 214, 140, 0.42) !important;
}
#ask-input::placeholder {
  color: rgba(255, 246, 226, 0.62) !important;
}

/* 发送按钮 */
#ask-send {
  box-shadow: 0 0 20px rgba(217, 180, 91, 0.4);
}

/* 右上角三个按钮 */
.ghost, .top-actions button {
  color: #fff6dd !important;
  background: rgba(10, 12, 16, 0.62) !important;
  border-color: rgba(246, 214, 140, 0.5) !important;
  text-shadow: 0 1px 6px rgba(0, 0, 0, 0.95);
}
.ghost:hover, .top-actions button:hover {
  border-color: rgba(255, 236, 180, 0.95) !important;
  background: rgba(40, 26, 12, 0.82) !important;
}

/* 神名（说话人） */
.speaker {
  color: #ffe0a0 !important;
  font-size: 15px !important;
}


/* ============================================================
   生辰表单独立层：推门后浮在殿内之上
   ============================================================ */
#birth {
  position: fixed !important;
  left: 50% !important;
  top: 50% !important;
  right: auto !important;
  bottom: auto !important;
  transform: translate(-50%, -50%) !important;
  z-index: 900 !important;
  width: min(560px, 88vw) !important;
  max-height: 86vh;
  overflow-y: auto;
  padding: 30px 34px 26px !important;
  border-radius: 14px;
  background: linear-gradient(180deg, rgba(26, 22, 38, 0.97), rgba(16, 14, 24, 0.98)) !important;
  border: 1px solid rgba(180, 160, 255, 0.32);
  box-shadow:
    0 30px 90px rgba(0, 0, 0, 0.85),
    0 0 60px rgba(120, 90, 220, 0.22);
  backdrop-filter: blur(18px);
}

#birth[hidden] { display: none !important; }

/* 表单浮起时压暗殿内，突出操作 */
body.birthing::after {
  content: '';
  position: fixed;
  inset: 0;
  background: radial-gradient(ellipse 70% 70% at 50% 50%, rgba(4, 3, 10, 0.55), rgba(4, 3, 10, 0.82));
  z-index: 880;
  pointer-events: none;
}

/* 表单里的字号一并放大 */
#birth .birth-kicker { font-size: 19px !important; }
#birth .birth-note { font-size: 12.5px !important; color: rgba(226, 218, 255, 0.66) !important; }
#birth .birth-row > label { font-size: 13px !important; color: rgba(232, 226, 255, 0.8) !important; }
#birth input, #birth select { font-size: 14px !important; }
#birth .shichen { font-size: 12.5px !important; }
#birth button[type="submit"] { font-size: 15px !important; }
#birth .gender-btn { font-size: 14.5px !important; }


/* ============================================================
   顶栏胶囊按钮（声 / EN / 离殿）—— 放大提亮
   ============================================================ */
.top-actions {
  display: flex;
  gap: 10px;
  align-items: center;
}

.ghost,
.top-actions button,
#btn-back,
#btn-lang,
#btn-voice,
#btn-chart {
  font-family: "Songti SC", "STSong", serif !important;
  font-size: 16px !important;
  font-weight: 500 !important;
  letter-spacing: 0.12em !important;
  line-height: 1 !important;
  padding: 11px 20px !important;
  min-width: 56px;
  border-radius: 999px !important;
  color: #fff8e4 !important;
  background: rgba(10, 10, 14, 0.78) !important;
  border: 1px solid rgba(246, 214, 140, 0.62) !important;
  text-shadow:
    0 2px 8px rgba(0, 0, 0, 1),
    0 0 16px rgba(0, 0, 0, 0.9) !important;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.55);
  cursor: pointer;
  transition: all 0.25s ease;
}

.ghost:hover,
.top-actions button:hover,
#btn-back:hover,
#btn-lang:hover,
#btn-voice:hover,
#btn-chart:hover {
  color: #fffdf6 !important;
  border-color: rgba(255, 240, 190, 0.98) !important;
  background: rgba(52, 36, 16, 0.92) !important;
  box-shadow: 0 0 26px rgba(217, 180, 91, 0.5);
}

/* EN 这种拉丁字母稍作缩窄 */
#btn-lang { letter-spacing: 0.06em !important; font-size: 15px !important; }

/* 顶栏整体高度与内边距 */
#topbar {
  padding-top: 18px;
  padding-bottom: 8px;
}

/* 未上香：话题变灰、上香按钮呼吸提示 */
body.need-incense .choice {
  opacity: 0.42 !important;
  filter: grayscale(0.6);
  pointer-events: none;
}
body.need-incense #ask-input {
  opacity: 0.55;
}
.incense-btn.urge {
  border-color: rgba(255, 208, 120, 0.95) !important;
  color: #ffe9b8 !important;
  animation: urgePulse 1.8s ease-in-out infinite;
}
@keyframes urgePulse {
  0%, 100% { box-shadow: 0 0 0 rgba(217, 180, 91, 0); }
  50% { box-shadow: 0 0 34px rgba(255, 208, 120, 0.55); }
}

/* ============================================================
   上香特效
   ============================================================ */
.incense-flash {
  position: fixed;
  inset: 0;
  z-index: 60;
  pointer-events: none;
  background: radial-gradient(
    ellipse 60% 55% at 50% 42%,
    rgba(255, 224, 150, 0.42),
    rgba(255, 190, 90, 0.18) 40%,
    transparent 72%
  );
  opacity: 0;
  transition: opacity 0.5s ease-out;
  mix-blend-mode: screen;
}
.incense-flash.go { opacity: 1; animation: flashOut 1.5s ease-out forwards; }

@keyframes flashOut {
  0%   { opacity: 0; }
  12%  { opacity: 1; }
  100% { opacity: 0; }
}

.incense-ember {
  position: fixed;
  width: 7px;
  height: 7px;
  margin-left: -3px;
  margin-top: -3px;
  border-radius: 50%;
  z-index: 62;
  pointer-events: none;
  background: radial-gradient(circle, #fff6d0 0%, #ffb347 42%, rgba(255, 96, 20, 0) 72%);
  box-shadow: 0 0 14px rgba(255, 170, 60, 0.95), 0 0 30px rgba(255, 120, 30, 0.5);
  animation: emberIgnite 2.4s ease-out forwards;
}

@keyframes emberIgnite {
  0%   { transform: scale(0.2); opacity: 0; }
  10%  { transform: scale(1.9); opacity: 1; }
  30%  { transform: scale(1.1); opacity: 1; }
  100% { transform: scale(0.6) translateY(-6px); opacity: 0; }
}

.incense-spark {
  position: fixed;
  width: 3px;
  height: 3px;
  border-radius: 50%;
  z-index: 61;
  pointer-events: none;
  background: #ffcf7a;
  box-shadow: 0 0 8px rgba(255, 190, 90, 0.9);
  animation-name: sparkRise;
  animation-timing-function: ease-out;
  animation-fill-mode: forwards;
}

@keyframes sparkRise {
  0%   { transform: translate(0, 0) scale(1); opacity: 0; }
  15%  { opacity: 1; }
  100% { transform: translate(var(--dx, 0px), var(--dy, -120px)) scale(0.2); opacity: 0; }
}

.incense-halo {
  position: fixed;
  left: 50%;
  top: 42%;
  width: 120px;
  height: 120px;
  margin-left: -60px;
  margin-top: -60px;
  border-radius: 50%;
  z-index: 59;
  pointer-events: none;
  border: 1px solid rgba(255, 226, 158, 0.55);
  opacity: 0;
  mix-blend-mode: screen;
}
.incense-halo.go { animation: haloSpread 2s ease-out forwards; }

@keyframes haloSpread {
  0%   { transform: scale(0.35); opacity: 0.9; }
  100% { transform: scale(9); opacity: 0; }
}

/* 声音按钮静音态 */
#btn-voice.muted {
  color: rgba(255, 246, 226, 0.55) !important;
  border-color: rgba(217, 180, 91, 0.3) !important;
}


/* ============================================================
   每殿氛围：飘落物
   ============================================================ */
#ambience-layer {
  position: fixed;
  inset: 0;
  z-index: 5;
  pointer-events: none;
  overflow: hidden;
}

#ambience-layer .mote {
  position: absolute;
  top: -6vh;
  width: var(--size, 5px);
  height: var(--size, 5px);
  opacity: 0;
  animation: moteFall var(--dur, 9s) linear var(--delay, 0s) infinite;
  will-change: transform, opacity;
}

@keyframes moteFall {
  0%   { transform: translate(0, -8vh) rotate(0deg); opacity: 0; }
  8%   { opacity: 0.9; }
  85%  { opacity: 0.7; }
  100% { transform: translate(var(--drift, 0px), 108vh) rotate(calc(360deg * var(--spin, 1))); opacity: 0; }
}

/* 铜钱：金色小圆片 */
[data-kind="coin"] .mote {
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #fff2c0, var(--mote-color) 62%, #a8791f);
  box-shadow: 0 0 8px rgba(255, 214, 106, 0.7);
}
/* 花瓣：椭圆带缺口 */
[data-kind="petal"] .mote {
  border-radius: 50% 0 50% 50%;
  background: var(--mote-color);
  box-shadow: 0 0 6px rgba(255, 180, 200, 0.5);
  opacity: 0.85;
}
/* 墨点 */
[data-kind="ink"] .mote {
  border-radius: 50% 40% 55% 45%;
  background: var(--mote-color);
  filter: blur(0.6px);
  opacity: 0.55;
}
/* 药草叶 */
[data-kind="leaf"] .mote {
  border-radius: 0 100% 0 100%;
  background: var(--mote-color);
  opacity: 0.7;
}
/* 火星 */
[data-kind="ember"] .mote {
  border-radius: 50%;
  background: radial-gradient(circle, #fff0c0, var(--mote-color) 55%, transparent);
  box-shadow: 0 0 10px rgba(255, 138, 60, 0.9);
  animation-name: emberUp;
}
@keyframes emberUp {
  0%   { transform: translate(0, 108vh) scale(0.6); opacity: 0; }
  10%  { opacity: 1; }
  100% { transform: translate(var(--drift, 0px), -8vh) scale(0.2); opacity: 0; }
}
/* 浮尘 */
[data-kind="dust"] .mote {
  border-radius: 50%;
  background: var(--mote-color);
  filter: blur(1.2px);
  opacity: 0.4;
}
/* 水光 */
[data-kind="water"] .mote {
  border-radius: 50%;
  background: radial-gradient(circle, rgba(200, 235, 255, 0.9), transparent 70%);
  filter: blur(1px);
}
/* 松针/鹤羽 */
[data-kind="feather"] .mote {
  border-radius: 50% 50% 50% 0;
  background: var(--mote-color);
  opacity: 0.65;
}
/* 纸灰 */
[data-kind="ash"] .mote {
  border-radius: 40%;
  background: var(--mote-color);
  filter: blur(1px);
  opacity: 0.45;
  animation-name: ashFall;
}
@keyframes ashFall {
  0%   { transform: translate(0, -8vh) rotate(0); opacity: 0; }
  12%  { opacity: 0.7; }
  100% { transform: translate(var(--drift, 0px), 104vh) rotate(200deg); opacity: 0; }
}
/* 星尘 */
[data-kind="star"] .mote {
  border-radius: 50%;
  background: var(--mote-color);
  box-shadow: 0 0 10px rgba(200, 216, 255, 0.95);
  animation-name: starTwinkle;
}
@keyframes starTwinkle {
  0%, 100% { opacity: 0; transform: scale(0.4); }
  50%      { opacity: 1; transform: scale(1.2); }
}

/* 氛围光晕 */
.ambience-glow {
  position: fixed;
  inset: 0;
  z-index: 4;
  pointer-events: none;
  background: radial-gradient(
    ellipse 70% 60% at 50% 38%,
    color-mix(in srgb, var(--glow-color) 12%, transparent),
    transparent 70%
  );
  opacity: 0.5;
  animation: glowBreath 9s ease-in-out infinite;
}
@keyframes glowBreath {
  0%, 100% { opacity: 0.34; }
  50%      { opacity: 0.6; }
}


/* ============================================================
   殿内移动端
   ============================================================ */

/* ---- 手机竖屏 ---- */
@media (max-width: 820px) and (orientation: portrait) {
  /* 对话与操作上移，操作区收进拇指范围 */
  .dialogue {
    bottom: calc(158px + env(safe-area-inset-bottom)) !important;
    padding: 0 16px;
  }
  .line {
    font-size: clamp(16px, 4.4vw, 20px) !important;
    line-height: 1.85 !important;
  }
  .speaker { font-size: 13px !important; }

  .choices {
    bottom: calc(104px + env(safe-area-inset-bottom)) !important;
    gap: 8px !important;
    padding: 0 12px;
    flex-wrap: wrap;
    justify-content: center;
  }
  .choice {
    font-size: 13px !important;
    padding: 9px 14px 9px 36px !important;
  }

  .incense-btn {
    bottom: calc(62px + env(safe-area-inset-bottom)) !important;
    font-size: 13px !important;
    padding: 9px 22px !important;
  }

  .ask {
    bottom: calc(10px + env(safe-area-inset-bottom)) !important;
    padding: 0 12px;
    gap: 8px;
  }
  #ask-input {
    font-size: 14px !important;
    padding: 12px 14px !important;
  }
  #ask-send {
    min-width: 46px;
    font-size: 14px !important;
  }

  .hint:empty { display: none; }
.hint {
    bottom: calc(220px + env(safe-area-inset-bottom)) !important;
    font-size: 11.5px !important;
    padding: 0 20px;
    line-height: 1.6;
  }

  /* 顶栏收窄 */
  #topbar { padding: 10px 12px; }
  .brand-text { font-size: 13px !important; letter-spacing: 0.04em; }
  .seal { width: 26px; height: 26px; font-size: 14px; }
  .top-actions { gap: 6px; }
  .ghost, .top-actions button, #btn-back, #btn-lang, #btn-voice, #btn-chart {
    font-size: 13px !important;
    padding: 8px 12px !important;
    min-width: 44px !important;
    letter-spacing: 0.06em !important;
  }

  /* 命盘面板：全屏抽屉 */
  #chart-panel, .chart-panel {
    inset: 0 !important;
    border-radius: 0 !important;
    max-height: 100vh;
    overflow-y: auto;
    padding: calc(20px + env(safe-area-inset-top)) 12px calc(20px + env(safe-area-inset-bottom)) !important;
  }
  .chart-grid, #chart-grid {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 6px !important;
  }
  .chart-brief { gap: 3px 12px !important; }
  .chart-brief .cb { font-size: 11px !important; }
  .chart-brief .cb b { font-size: 11.5px !important; }

  /* 生辰表单 */
  #birth {
    width: 92vw !important;
    padding: 24px 20px 20px !important;
  }
  .birth-row > label { flex: 0 0 56px; font-size: 12px !important; }
  .birth-row input { padding: 11px 10px !important; font-size: 14.5px !important; }
  .gender-btn { padding: 11px !important; }
}

/* ---- 手机横屏（推荐）---- */
@media (max-height: 500px) and (orientation: landscape) {
  .dialogue {
    bottom: calc(118px + env(safe-area-inset-bottom)) !important;
  }
  .line {
    font-size: clamp(14px, 2.1vw, 18px) !important;
    line-height: 1.7 !important;
  }
  .choices {
    bottom: calc(72px + env(safe-area-inset-bottom)) !important;
    gap: 7px !important;
  }
  .choice { font-size: 12.5px !important; padding: 7px 12px 7px 36px !important; }
  .incense-btn {
    bottom: calc(42px + env(safe-area-inset-bottom)) !important;
    font-size: 12px !important;
    padding: 7px 18px !important;
  }
  .ask {
    bottom: calc(6px + env(safe-area-inset-bottom)) !important;
  }
  #ask-input { padding: 10px 12px !important; font-size: 13.5px !important; }
  .hint:empty { display: none; }
.hint {
    bottom: calc(160px + env(safe-area-inset-bottom)) !important;
    font-size: 11px !important;
  }
  #topbar { padding: 8px 10px; }
  .brand-text { font-size: 12.5px !important; }
  .ghost, .top-actions button, #btn-back, #btn-lang, #btn-voice, #btn-chart {
    font-size: 12px !important;
    padding: 7px 11px !important;
    min-width: 40px !important;
  }
  .chart-grid, #chart-grid { grid-template-columns: repeat(4, 1fr) !important; gap: 4px !important; }
}

/* ---- 触屏：不要 hover 效果 ---- */
@media (hover: none) {
  .choice:hover { transform: none; }
  .incense-btn:hover { box-shadow: none; }
}

/* ---- 安全区 ---- */
@supports (padding: env(safe-area-inset-bottom)) {
  .ask { padding-bottom: max(10px, env(safe-area-inset-bottom)); }
}


/* ============================================================
   往事面板
   ============================================================ */
#memories {
  position: fixed;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%) scale(0.97);
  z-index: 700;
  width: min(620px, 92vw);
  max-height: 78vh;
  display: flex;
  flex-direction: column;
  border-radius: 14px;
  background: linear-gradient(180deg, rgba(26, 22, 18, 0.97), rgba(14, 12, 10, 0.98));
  border: 1px solid rgba(217, 180, 91, 0.32);
  box-shadow: 0 30px 90px rgba(0, 0, 0, 0.85);
  backdrop-filter: blur(18px);
  opacity: 0;
  transition: opacity 0.28s ease, transform 0.28s ease;
}
#memories[hidden] { display: none; }
#memories.on { opacity: 1; transform: translate(-50%, -50%) scale(1); }

.mem-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 22px 14px;
  border-bottom: 1px solid rgba(217, 180, 91, 0.16);
}
.mem-title {
  font-family: "Songti SC", "STSong", serif;
  font-size: 17px;
  letter-spacing: 0.42em;
  text-indent: 0.42em;
  color: #f2d99a;
}
.mem-x {
  appearance: none;
  background: none;
  border: none;
  color: rgba(242, 232, 210, 0.55);
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
  padding: 2px 8px;
}
.mem-x:hover { color: #fff3d6; }

.mem-list {
  flex: 1;
  overflow-y: auto;
  padding: 14px 22px;
  -webkit-overflow-scrolling: touch;
}

.mem-item {
  padding: 13px 0;
  border-bottom: 1px solid rgba(217, 180, 91, 0.1);
}
.mem-item:last-child { border-bottom: none; }

.mem-meta {
  display: flex;
  align-items: baseline;
  gap: 10px;
  margin-bottom: 7px;
}
.mem-hall {
  font-family: "Songti SC", "STSong", serif;
  font-size: 12px;
  letter-spacing: 0.14em;
  color: rgba(242, 217, 154, 0.8);
  padding: 2px 9px;
  border-radius: 999px;
  background: rgba(217, 180, 91, 0.12);
  border: 1px solid rgba(217, 180, 91, 0.22);
}
.mem-time {
  font-size: 11.5px;
  color: rgba(242, 232, 210, 0.38);
}
.mem-q {
  font-size: 13.5px;
  color: rgba(255, 248, 232, 0.88);
  line-height: 1.65;
  margin-bottom: 5px;
}
.mem-q::before { content: '问 · '; color: rgba(242, 217, 154, 0.55); }
.mem-a {
  font-size: 13px;
  color: rgba(240, 232, 214, 0.62);
  line-height: 1.75;
  padding-left: 12px;
  border-left: 2px solid rgba(217, 180, 91, 0.16);
}

.mem-empty {
  text-align: center;
  padding: 60px 20px;
  font-size: 13.5px;
  color: rgba(242, 232, 210, 0.4);
  letter-spacing: 0.1em;
}

.mem-foot {
  padding: 12px 22px 18px;
  border-top: 1px solid rgba(217, 180, 91, 0.14);
  text-align: right;
}
.mem-clear {
  appearance: none;
  background: none;
  border: 1px solid rgba(217, 180, 91, 0.28);
  border-radius: 999px;
  color: rgba(242, 232, 210, 0.6);
  font-family: "Songti SC", "STSong", serif;
  font-size: 12px;
  letter-spacing: 0.14em;
  padding: 7px 18px;
  cursor: pointer;
}
.mem-clear:hover { color: #ffb0a0; border-color: rgba(210, 130, 110, 0.6); }

/* 手机 */
@media (max-width: 820px) and (orientation: portrait) {
  #memories {
    width: 94vw;
    max-height: 80vh;
    border-radius: 16px;
  }
  .mem-head { padding: 16px 18px 12px; }
  .mem-title { font-size: 16px; }
  .mem-list { padding: 10px 18px; }
  .mem-q { font-size: 13px; }
  .mem-a { font-size: 12.5px; }
  .mem-foot { padding: 10px 18px 16px; }
  #btn-history { display: inline-block !important; }
}

@media (max-height: 500px) and (orientation: landscape) {
  #memories { max-height: 88vh; width: min(560px, 70vw); }
  .mem-head { padding: 12px 18px 10px; }
  .mem-list { padding: 8px 18px; }
  .mem-item { padding: 10px 0; }
}


/* ============================================================
   全站双语基础样式
   ============================================================ */
[data-i18n] > b {
  font-weight: inherit;
  display: block;
}
[data-i18n] > i {
  font-style: normal;
  display: block;
  margin-top: 2px;
  font-size: 0.72em;
  letter-spacing: 0.06em;
  opacity: 0.62;
}
button[data-i18n] > b,
button[data-i18n] > i {
  display: inline;
}
button[data-i18n] > i {
  margin-left: 5px;
  margin-top: 0;
  font-size: 0.84em;
}


/* 详情卡：中英并列 */
#hud-name b, #hud-deity b, #hud-tag b { display: block; font-weight: inherit; }
#hud-name i {
  font-style: normal;
  display: block;
  margin-top: 6px;
  font-size: 13px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: rgba(242, 217, 154, 0.68);
}
#hud-deity i {
  font-style: normal;
  display: block;
  margin-top: 4px;
  font-size: 11px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  opacity: 0.6;
}
#hud-tag i {
  font-style: normal;
  display: block;
  margin-top: 3px;
  font-size: 0.84em;
  opacity: 0.6;
}
#hud-intro b { display: block; font-weight: 400; }
#hud-intro i {
  font-style: normal;
  display: block;
  margin-top: 6px;
  font-size: 0.92em;
  color: rgba(255, 244, 214, 0.5);
  line-height: 1.7;
}

/* 神的回答：英文段 */
#line .en {
  display: block;
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid rgba(217, 180, 91, 0.16);
  font-size: 0.9em;
  color: rgba(255, 244, 214, 0.62);
  line-height: 1.75;
}


/* 话题按钮：中文上、英文下 */
.choice b {
  font-weight: 500;
  display: block;
  white-space: nowrap;
}
.choice i {
  font-style: normal;
  display: block;
  margin-top: 2px;
  font-size: 10.5px;
  letter-spacing: 0.02em;
  white-space: nowrap;
  color: rgba(242, 217, 154, 0.62);
}
.choice .k {
  flex: 0 0 auto;
}


/* 顶部品牌：英文换行 */
#brand-text b, #brand-text { display: block; }
#brand-text i {
  font-style: normal;
  display: block;
  margin-top: 2px;
  font-size: 10px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: rgba(242, 217, 154, 0.5);
}


/* ============================================================
   手机适配（竖屏）
   ============================================================ */
@media (max-width: 820px) and (orientation: portrait) {
  /* 顶部栏：按钮收窄、允许换行 */
  #topbar {
    padding: 10px 10px 0;
    gap: 6px;
  }
  #topbar .ghost {
    padding: 5px 9px;
    font-size: 11px;
    letter-spacing: 0.02em;
    border-radius: 8px;
    white-space: nowrap;
  }
  #topbar .ghost b { display: inline; }
  #topbar .ghost i {
    display: none;   /* 手机上只留中文/主语言，英文靠详情卡 */
  }

  /* 品牌：只显示殿名，不换行 */
  #brand-text {
    font-size: 15px;
    letter-spacing: 0.06em;
    max-width: 42vw;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  #brand-text b, #brand-text i { display: none; }
  #brand-text::before { content: none; }
  .brand .seal { width: 26px; height: 26px; font-size: 12px; }

  /* 话题按钮：一行一个，英文完整 */
  #choices {
    display: flex;
    flex-direction: column;
    gap: 7px;
    width: 92vw;
    margin: 0 auto;
  }
  .choice {
    width: 100%;
    min-width: 0;
    padding: 9px 14px 9px 38px;
    font-size: 13.5px;
  }
  .choice i { font-size: 10px; }
  .choice .k { left: 10px; width: 19px; height: 19px; font-size: 10px; }

  /* 神明说话：字号略小 */
  #line { font-size: 17px; line-height: 1.75; max-width: 92vw; }
  #speaker { font-size: 12px; }

  /* 输入框：用 100% 跟随 HUD padding，避免 92vw 在窄屏溢出到屏幕外 */
  .ask { width: 100%; max-width: 100%; }
  .ask input { font-size: 13px; }
}

/* 手机横屏：按钮更紧凑 */
@media (max-height: 500px) and (orientation: landscape) {
  #topbar { padding: 8px 10px 0; gap: 5px; }
  #topbar .ghost { padding: 4px 8px; font-size: 10px; }
  #topbar .ghost i { display: none; }
  #brand-text { font-size: 13px; max-width: 30vw; white-space: nowrap; overflow: hidden; }
  .choice { padding: 6px 12px 7px 34px; font-size: 12.5px; min-width: 130px; }
  .choice i { font-size: 9.5px; }
  #line { font-size: 15px; }
}

/* ============================================================
   双语换行与间距（防止中英粘连）
   ============================================================ */
#brand-text i {
  display: block !important;
  margin-top: 2px !important;
  font-size: 0.62em !important;
  letter-spacing: 0.1em !important;
  opacity: 0.55 !important;
  text-transform: uppercase !important;
}

.choice .k {
  margin-right: 9px !important;
}
.choice b, .choice i {
  display: block !important;
}

#speaker i {
  display: block !important;
  margin-top: 2px !important;
  font-size: 0.72em !important;
  opacity: 0.65 !important;
}

/* 顶部按钮内的双语也分开 */
#topbar .ghost b { display: inline !important; }
#topbar .ghost i {
  display: none !important;
}

/* ============================================================
   话题按钮：保证可读的背景
   ============================================================ */
#choices {
  display: flex !important;
  flex-wrap: wrap !important;
  justify-content: center !important;
  gap: 8px !important;
  max-width: 1000px !important;
  margin: 0 auto !important;
}

.choice {
  background: rgba(12, 8, 5, 0.82) !important;
  border: 1px solid rgba(217, 180, 91, 0.34) !important;
  backdrop-filter: blur(12px) !important;
  color: rgba(243, 231, 207, 0.92) !important;
  min-width: 150px !important;
}
.choice:hover {
  background: rgba(28, 18, 10, 0.92) !important;
  border-color: rgba(246, 214, 140, 0.7) !important;
}
.choice b {
  color: #fff6e2 !important;
}
.choice i {
  color: rgba(242, 217, 154, 0.72) !important;
}
.choice .k {
  color: #e8c98a !important;
  border-color: rgba(217, 180, 91, 0.55) !important;
}

/* 上香前：话题按钮可见但不可点 */
#choices button.choice,
#choices button.choice:disabled {
  opacity: 1 !important;
  background: rgba(12, 8, 5, 0.78) !important;
  border: 1px solid rgba(217, 180, 91, 0.22) !important;
  color: rgba(243, 231, 207, 0.62) !important;
  cursor: not-allowed !important;
}
#choices button.choice b {
  color: rgba(255, 246, 226, 0.72) !important;
}
#choices button.choice i {
  color: rgba(242, 217, 154, 0.5) !important;
}
#choices button.choice .k {
  color: rgba(232, 201, 138, 0.6) !important;
  border-color: rgba(217, 180, 91, 0.3) !important;
}

/* 上香后：恢复正常 */
#choices.ready button.choice,
#choices button.choice:not(:disabled) {
  opacity: 1 !important;
  background: rgba(12, 8, 5, 0.86) !important;
  border-color: rgba(217, 180, 91, 0.36) !important;
  color: rgba(243, 231, 207, 0.95) !important;
  cursor: pointer !important;
}
#choices button.choice:not(:disabled):hover {
  background: rgba(30, 20, 12, 0.94) !important;
  border-color: rgba(246, 214, 140, 0.72) !important;
  transform: translateY(-1px);
}
#choices button.choice:not(:disabled) b { color: #fff6e2 !important; }
#choices button.choice:not(:disabled) i { color: rgba(242, 217, 154, 0.75) !important; }
#choices button.choice:not(:disabled) .k {
  color: #e8c98a !important;
  border-color: rgba(217, 180, 91, 0.55) !important;
}

/* 上香提示 */
.hint.warn {
  color: #f0b878 !important;
  text-shadow: 0 0 18px rgba(240, 184, 120, 0.5) !important;
}

@keyframes nudgeShake {
  0%, 100% { transform: translateX(0) }
  20% { transform: translateX(-4px) }
  40% { transform: translateX(4px) }
  60% { transform: translateX(-2px) }
  80% { transform: translateX(2px) }
}
#btn-incense.nudge {
  animation: nudgeShake 0.5s ease 2;
  border-color: rgba(246, 214, 140, 0.95) !important;
  box-shadow: 0 0 26px rgba(240, 190, 110, 0.55) !important;
}

/* 话题按钮：可点击但提示"先上香"的视觉 */
#choices button.choice {
  cursor: pointer !important;
}
#choices button.choice:not(.ready)::after {
  content: '';
  position: absolute;
  right: 10px;
  top: 8px;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: rgba(217, 180, 91, 0.45);
}

/* ============================================================
   殿内：报生辰浮层
   ============================================================ */
#ask-birth {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(4, 4, 8, 0.55);
  backdrop-filter: blur(6px);
}

#ask-birth[hidden] { display: none; }

#ask-birth .ab-inner {
  width: min(420px, 92vw);
  max-height: 88vh;
  overflow-y: auto;
  padding: 26px 26px 22px;
  border-radius: 14px;
  background: linear-gradient(180deg, rgba(24, 18, 12, 0.96), rgba(10, 8, 6, 0.98));
  border: 1px solid rgba(217, 180, 91, 0.32);
  box-shadow: 0 26px 80px rgba(0, 0, 0, 0.85);
}

.ab-kicker {
  font-family: var(--serif);
  font-size: 10px;
  letter-spacing: 0.3em;
  color: rgba(217, 180, 91, 0.8);
  margin-bottom: 10px;
}

.ab-note {
  margin: 0 0 20px;
  font-family: var(--serif);
  font-size: 12.5px;
  line-height: 1.8;
  color: rgba(255, 248, 232, 0.62);
}

.ab-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 13px;
}

.ab-row > label {
  flex: 0 0 52px;
  font-family: var(--serif);
  font-size: 12px;
  color: rgba(217, 180, 91, 0.85);
}

.ab-inputs {
  display: flex;
  align-items: center;
  gap: 7px;
  flex: 1;
  flex-wrap: wrap;
}

.ab-inputs input {
  width: 68px;
  padding: 8px 9px;
  border-radius: 7px;
  border: 1px solid rgba(217, 180, 91, 0.28);
  background: rgba(6, 6, 9, 0.85);
  color: #fff6e2;
  font-family: var(--serif);
  font-size: 13px;
  outline: none;
}
.ab-inputs input:focus { border-color: rgba(217, 180, 91, 0.72); }
.ab-inputs select {
  flex: 1;
  min-width: 0;
  padding: 8px 9px;
  border-radius: 7px;
  border: 1px solid rgba(217, 180, 91, 0.28);
  background: rgba(6, 6, 9, 0.85);
  color: #fff6e2;
  font-family: var(--serif);
  font-size: 13px;
  outline: none;
  appearance: none;
}
.ab-inputs select:focus { border-color: rgba(217, 180, 91, 0.72); }
.ab-inputs select option { background: #0b0a10; color: #fff6e2; }

.ab-shichen {
  font-family: var(--serif);
  font-size: 11px;
  color: rgba(217, 180, 91, 0.65);
  white-space: nowrap;
}

.ab-gender { display: flex; gap: 8px; flex: 1; }

.ab-g {
  flex: 1;
  appearance: none;
  padding: 8px 0;
  border-radius: 8px;
  border: 1px solid rgba(217, 180, 91, 0.26);
  background: rgba(6, 6, 9, 0.8);
  color: rgba(255, 246, 226, 0.6);
  font-family: var(--serif);
  font-size: 13px;
  cursor: pointer;
  transition: all 0.2s;
}
.ab-g.on {
  border-color: rgba(217, 180, 91, 0.75);
  background: rgba(58, 40, 16, 0.8);
  color: #fff3d6;
}

.ab-err {
  min-height: 16px;
  margin: 4px 0 10px;
  font-family: var(--serif);
  font-size: 12px;
  color: #e88070;
}

.ab-actions {
  display: flex;
  gap: 10px;
  margin-top: 4px;
}

.ab-cancel {
  flex: 0 0 auto;
  appearance: none;
  padding: 11px 18px;
  border-radius: 9px;
  border: 1px solid rgba(217, 180, 91, 0.2);
  background: transparent;
  color: rgba(255, 248, 232, 0.5);
  font-family: var(--serif);
  font-size: 12.5px;
  cursor: pointer;
}
.ab-cancel:hover { border-color: rgba(217, 180, 91, 0.45); color: rgba(255, 248, 232, 0.75); }

.ab-submit {
  flex: 1;
  appearance: none;
  padding: 11px 0;
  border-radius: 9px;
  border: 1px solid rgba(217, 180, 91, 0.55);
  background: linear-gradient(180deg, rgba(96, 66, 24, 0.92), rgba(52, 36, 14, 0.96));
  color: #ffeec4;
  font-family: var(--serif);
  font-size: 13.5px;
  letter-spacing: 0.18em;
  cursor: pointer;
  transition: all 0.22s;
}
.ab-submit:hover { border-color: rgba(246, 214, 140, 0.9); }
.ab-submit:disabled { opacity: 0.5; cursor: default; }

/* 问事被拦时，输入框抖一下 */
@keyframes askShake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-5px); }
  75% { transform: translateX(5px); }
}
.ask.denied { animation: askShake 0.4s ease; }

@media (max-width: 640px) {
  #ask-birth .ab-inner { padding: 22px 18px 18px; }
  .ab-row { flex-direction: column; align-items: flex-start; gap: 7px; }
  .ab-row > label { flex: none; }
  .ab-inputs, .ab-gender { width: 100%; }
}

#ask-birth input[type="number"]::-webkit-outer-spin-button,
#ask-birth input[type="number"]::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}
#ask-birth input[type="number"] { -moz-appearance: textfield; appearance: textfield; }

/* ============================================================
   窄屏顶栏：殿内按钮多，必须压扁否则会顶出屏幕（之前 375px 下顶栏宽 573px）
   ============================================================ */
@media (max-width: 560px) {
  #topbar {
    padding: 10px 10px 0 !important;
    gap: 6px !important;
    flex-wrap: nowrap !important;
  }
  #topbar .brand-text { display: none !important; }
  #topbar .seal { width: 28px !important; height: 28px !important; font-size: 14px !important; }
  #topbar .top-actions {
    gap: 5px !important;
    flex-wrap: nowrap !important;
    min-width: 0;
  }
  #topbar .top-actions .ghost,
  #topbar .top-actions button,
  #topbar #btn-back,
  #topbar #btn-lang,
  #topbar #btn-voice,
  #topbar #btn-chart,
  #topbar #btn-account,
  #topbar #btn-history {
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    font-size: 11px !important;
    line-height: 1 !important;
    padding: 0 6px !important;
    min-width: 30px !important;
    height: 28px !important;
    letter-spacing: 0.02em !important;
    white-space: nowrap;
  }
}

@media (max-width: 380px) {
  #topbar .top-actions .ghost,
  #topbar .top-actions button,
  #topbar #btn-history { padding: 0 6px !important; font-size: 11px !important; }
}

/* 殿封面的静态正文：给搜索引擎可读内容，也给游客一句说明 */
.gate-intro {
  font-family: var(--serif);
  font-size: 13px;
  line-height: 1.8;
  color: rgba(244, 234, 210, 0.62);
  max-width: 34em;
  margin: 18px auto 0;
}
.gate-topics {
  list-style: none;
  margin: 14px auto 0;
  padding: 0;
  max-width: 36em;
  text-align: left;
  font-size: 12px;
  line-height: 1.7;
  color: rgba(244, 234, 210, 0.5);
}
.gate-topics li { margin: 0 0 6px; padding-left: 10px; position: relative; }
.gate-topics li::before { content: '·'; position: absolute; left: 0; color: rgba(217, 180, 106, 0.7); }
.gate-topics b { color: rgba(244, 234, 210, 0.72); font-weight: 500; margin-right: 6px; }
@media (max-width: 760px) {
  .gate-topics { display: none; }
  .gate-intro { font-size: 12px; margin-top: 12px; }
}

/* 殿封面内链 */
.gate-links {
  margin: 14px auto 0;
  max-width: 36em;
  font-size: 12px;
  line-height: 1.9;
  color: rgba(244, 234, 210, 0.5);
  text-align: center;
}
.gate-links b { color: rgba(244, 234, 210, 0.72); font-weight: 500; margin-right: 8px; }
.gate-links a {
  color: rgba(217, 180, 106, 0.85);
  text-decoration: none;
  margin: 0 7px;
  border-bottom: 1px solid rgba(217, 180, 106, 0.25);
}
.gate-links a:hover { color: #ffe1a8; border-bottom-color: rgba(255, 225, 168, 0.6); }
@media (max-width: 760px) {
  .gate-links { font-size: 11px; }
  .gate-links a { margin: 0 5px; }
}

/* 键盘可达性：焦点可见 */
a:focus-visible, button:focus-visible, [tabindex]:focus-visible, input:focus-visible {
  outline: 2px solid rgba(246, 223, 164, 0.9);
  outline-offset: 3px;
  border-radius: 4px;
}
/* 尊重系统「减少动态效果」 */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
}

/* ---------- 英文殿页导览（SEO 正文 + FAQ 折叠，2026-11-25） ---------- */
.gate-copy .gate-guide{max-width:620px;margin:16px auto 6px;text-align:left}
.gate-copy .gate-guide-about{margin:0 0 10px;font-size:13px;line-height:1.95;letter-spacing:.01em;opacity:.9}
.gate-copy .gate-guide details{margin:7px 0;border:1px solid rgba(217,180,106,.26);border-radius:9px;padding:8px 12px;background:rgba(0,0,0,.24)}
.gate-copy .gate-guide summary{cursor:pointer;font-size:12.5px;letter-spacing:.05em;color:#f2e2bf;list-style:none}
.gate-copy .gate-guide summary::-webkit-details-marker{display:none}
.gate-copy .gate-guide summary::before{content:"▸ ";color:rgba(217,180,106,.8)}
.gate-copy .gate-guide details[open] summary::before{content:"▾ "}
.gate-copy .gate-guide details p{margin:8px 0 2px;font-size:12.5px;line-height:1.9;opacity:.88}
@media (max-width:820px){
  .gate-copy .gate-guide{max-width:92vw}
  .gate-copy .gate-guide-about{font-size:12.5px;line-height:1.9}
}

/* 导览变长后允许门内文案区滚动（桌面端） */
#gate .gate-copy{max-height:92vh;overflow-y:auto;padding-bottom:14px;scrollbar-width:thin;scrollbar-color:rgba(217,180,106,.45) transparent}
#gate .gate-copy::-webkit-scrollbar{width:6px}
#gate .gate-copy::-webkit-scrollbar-thumb{background:rgba(217,180,106,.4);border-radius:3px}
@media (max-width:820px){
  #gate .gate-copy{max-height:86vh;overflow-y:auto;padding-bottom:18px}
}

/* ---------- 殿页静态导览：按语言只显示一块（2026-11-25） ---------- */
html[lang="en"] .gate-seo-zh{display:none !important}
html:not([lang="en"]) .gate-seo-en{display:none !important}
