:root {
  --bg: #1a1410;
  --ink: #f3ead6;
  --muted: #b7ad98;
  --gold: #d9b56c;
  --gold-deep: #a8823f;
  --card: rgba(20, 15, 12, 0.78);
  --line: rgba(217, 181, 108, 0.35);
  --font: "Noto Serif SC", "Songti SC", "STSong", "SimSun", "Source Han Serif SC", Georgia, serif;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--ink); font-family: var(--font); }
body { overflow: hidden; -webkit-font-smoothing: antialiased; }
#scene { position: fixed; inset: 0; }
#scene canvas { display: block; touch-action: none; }

.overlay {
  position: fixed; inset: 0; overflow-y: auto; overflow-x: hidden; -webkit-overflow-scrolling: touch;
  background: radial-gradient(ellipse at 50% 60%, rgba(26,20,16,0.55), rgba(26,20,16,0.92));
  transition: opacity .9s ease; z-index: 20;
}
.overlay.hide { opacity: 0; pointer-events: none; }
.landing-hero { min-height: 100vh; min-height: 100dvh; display: grid; place-items: center; padding: 24px; }
.landing-card { max-width: 560px; text-align: center; }
.eyebrow { font-size: 12px; letter-spacing: .3em; color: var(--gold); margin: 0 0 8px; }
h1 { margin: 0 0 8px; font-weight: 500; }
h1 .brand { display: block; font-size: clamp(44px, 9vw, 72px); letter-spacing: .4em; text-indent: .4em; line-height: 1.15; }
h1 .tagline { display: block; font-size: 15px; letter-spacing: .25em; color: var(--muted); margin-top: 6px; }
.more-cue { display: inline-block; margin-top: 26px; color: var(--muted); font-size: 12px; letter-spacing: .15em; text-decoration: none; opacity: .7; animation: breathe 2.8s ease-in-out infinite; }
.more-cue:hover { color: var(--gold); opacity: 1; }
.landing-more { background: linear-gradient(180deg, rgba(26,20,16,0) 0, var(--bg) 120px); padding: 40px 24px 80px; }
.more-block { max-width: 640px; margin: 0 auto 56px; }
.more-block h2 { font-size: 22px; font-weight: 500; letter-spacing: .3em; margin: 0 0 14px; color: var(--gold); }
.more-block h3 { font-size: 15px; font-weight: 500; letter-spacing: .2em; margin: 28px 0 8px; color: var(--ink); }
.lead { color: var(--muted); font-size: 14px; line-height: 1.9; margin: 0 0 16px; }
.halls, .doing { list-style: none; padding: 0; margin: 0; }
.halls li, .doing li { color: var(--muted); font-size: 14px; line-height: 1.9; padding: 8px 0; border-top: 1px solid rgba(217,181,108,0.14); }
.halls li:last-child, .doing li:last-child { border-bottom: 1px solid rgba(217,181,108,0.14); }
.halls b, .doing b { color: var(--ink); font-weight: 500; letter-spacing: .1em; margin-right: 10px; white-space: nowrap; }
.halls a, .doing a, .lead a, .landing-foot a, .page-main p a { color: var(--ink); text-decoration: none; border-bottom: 1px solid var(--line); }
.halls a:hover, .doing a:hover, .lead a:hover, .landing-foot a:hover, .page-main p a:hover { color: var(--gold); border-color: var(--gold); }
.faq { margin: 0; }
.faq dt { color: var(--ink); font-size: 15px; letter-spacing: .05em; margin: 18px 0 4px; }
.faq dd { color: var(--muted); font-size: 14px; line-height: 1.9; margin: 0; }
.landing-foot { text-align: center; margin: 36px 0 0; }
.landing-foot.small { color: var(--muted); opacity: .7; letter-spacing: .1em; margin-top: 18px; }
.noscript { position: fixed; inset: 0; z-index: 40; display: grid; place-content: center; text-align: center; padding: 24px; background: var(--bg); color: var(--muted); }
.noscript h2 { color: var(--ink); font-weight: 500; letter-spacing: .2em; }
.sub { color: var(--ink); font-size: 17px; margin: 0 0 20px; }
.intro { color: var(--muted); font-size: 14px; line-height: 1.9; text-align: justify; margin: 0 0 12px; }
.intro.small { font-size: 13px; }
.tip { color: var(--muted); font-size: 12px; margin-top: 14px; opacity: .8; }

.btn {
  font-family: inherit; font-size: 15px; letter-spacing: .15em; padding: 11px 22px; cursor: pointer;
  background: transparent; color: var(--ink); border: 1px solid var(--line); border-radius: 999px;
  transition: background .2s, border-color .2s, transform .1s;
}
.btn:hover { border-color: var(--gold); background: rgba(217,181,108,0.08); }
.btn:active { transform: translateY(1px); }
.btn.primary { background: linear-gradient(180deg, var(--gold), var(--gold-deep)); color: #1a1408; border-color: transparent; font-weight: 600; }
.btn.primary:hover { filter: brightness(1.08); }
.btn.ghost { border-color: transparent; color: var(--muted); }
.row { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 14px; }

.hint {
  position: fixed; left: 50%; bottom: 36px; transform: translateX(-50%);
  padding: 10px 18px; border-radius: 999px; background: var(--card); border: 1px solid var(--line);
  color: var(--ink); font-size: 14px; letter-spacing: .1em; backdrop-filter: blur(8px);
  animation: breathe 2.8s ease-in-out infinite; z-index: 10; white-space: nowrap;
}
@keyframes breathe { 0%,100% { opacity: .75 } 50% { opacity: 1 } }

.panel {
  position: fixed; left: 50%; bottom: 28px; transform: translateX(-50%);
  width: min(460px, calc(100vw - 32px)); padding: 22px 24px;
  background: var(--card); border: 1px solid var(--line); border-radius: 18px;
  backdrop-filter: blur(12px); box-shadow: 0 20px 60px rgba(0,0,0,.45); z-index: 15;
  animation: rise .5s ease both;
}
@keyframes rise { from { opacity: 0; transform: translate(-50%, 18px) } to { opacity: 1; transform: translate(-50%, 0) } }
.panel h2 { margin: 0 0 8px; font-size: 20px; font-weight: 500; letter-spacing: .2em; }
.muted { color: var(--muted); font-size: 13px; line-height: 1.8; margin: 0; }
.small { font-size: 12px; }
textarea {
  width: 100%; margin-top: 12px; padding: 10px 12px; font-family: inherit; font-size: 14px; line-height: 1.7;
  color: var(--ink); background: rgba(255,255,255,0.04); border: 1px solid var(--line); border-radius: 10px; resize: none;
}
textarea:focus { outline: none; border-color: var(--gold); }
textarea[readonly] { color: var(--muted); }
.label { display: block; margin-top: 14px; font-size: 12px; color: var(--gold); letter-spacing: .2em; }

.result { bottom: auto; top: 50%; transform: translate(-50%, -50%); max-height: calc(100vh - 40px); overflow: auto; }
.result h2 { font-size: 28px; letter-spacing: .3em; margin-bottom: 14px; }
.poem { display: grid; grid-template-columns: repeat(2, 1fr); gap: 6px 18px; font-size: 17px; letter-spacing: .12em; margin: 0 0 14px; color: var(--ink); }
.poem span { white-space: nowrap; }
.reading { margin: 0; font-size: 15px; line-height: 1.8; color: var(--ink); border-left: 2px solid var(--gold); padding-left: 12px; }
#result-wish { margin-top: 10px; }
.result a { color: var(--gold); word-break: break-all; }
@keyframes rise-center { from { opacity: 0; transform: translate(-50%, calc(-50% + 18px)) } to { opacity: 1; transform: translate(-50%, -50%) } }
.result { animation: rise-center .5s ease both; }

.toast {
  position: fixed; top: 24px; left: 50%; transform: translateX(-50%);
  padding: 10px 18px; border-radius: 999px; background: var(--gold); color: #1a1408; font-size: 14px; z-index: 30;
  animation: rise .3s ease both;
}
footer#about { position: fixed; right: 16px; bottom: 14px; z-index: 10; font-size: 12px; }
footer#about a { color: var(--muted); text-decoration: none; letter-spacing: .15em; opacity: .7; }
footer#about a:hover { opacity: 1; color: var(--gold); }
#about-panel { bottom: 50px; left: auto; right: 16px; transform: none; width: min(360px, calc(100vw - 32px)); animation: none; }

@media (max-width: 520px) {
  .panel { padding: 18px; }
  .poem { font-size: 15px; }
  .hint { font-size: 13px; bottom: 24px; }
}

/* ---------- 法堂版 UI ---------- */
.topbar { position: fixed; top: 14px; left: 14px; right: 14px; display: flex; gap: 8px; align-items: center; z-index: 12; }
.topbar .spacer { flex: 1; }
.pill { display: inline-flex; align-items: center; gap: 8px; padding: 8px 14px; border-radius: 999px; background: var(--card); border: 1px solid var(--line); color: var(--ink); font-size: 13px; letter-spacing: .1em; backdrop-filter: blur(8px); font-family: inherit; }
.pill .dot { width: 6px; height: 6px; border-radius: 50%; background: var(--gold); box-shadow: 0 0 8px var(--gold); }
.muted-pill { color: var(--muted); }
.muted-pill b { color: var(--ink); font-weight: 500; }
.btn-pill { cursor: pointer; }
.btn-pill:hover { border-color: var(--gold); }
.status { position: fixed; top: 64px; left: 50%; transform: translateX(-50%); padding: 7px 14px; border-radius: 999px; background: var(--card); border: 1px solid var(--line); color: var(--muted); font-size: 13px; letter-spacing: .15em; z-index: 11; backdrop-filter: blur(8px); transition: opacity .3s; }
.hint { bottom: 96px; }
.actions { position: fixed; left: 50%; bottom: 20px; transform: translateX(-50%); display: flex; gap: 6px; padding: 6px; border-radius: 999px; background: var(--card); border: 1px solid var(--line); backdrop-filter: blur(12px); z-index: 12; box-shadow: 0 16px 40px rgba(0,0,0,.4); }
.act { display: flex; flex-direction: column; align-items: center; gap: 2px; min-width: 76px; padding: 8px 12px; border-radius: 999px; background: transparent; border: 1px solid transparent; color: var(--ink); font-family: inherit; font-size: 13px; letter-spacing: .15em; cursor: pointer; transition: background .2s, border-color .2s; }
.act .ico { font-size: 15px; color: var(--gold); line-height: 1; }
.act:hover { background: rgba(217,181,108,.08); border-color: var(--line); }
.act.on { background: rgba(217,181,108,.16); border-color: var(--gold); }
.act:disabled { opacity: .4; cursor: default; }
.beads { position: fixed; inset: 0; z-index: 25; background: radial-gradient(ellipse at 50% 40%, #1b1612, #0b0907 70%); display: grid; grid-template-rows: 1fr; animation: fadein .5s ease both; }
@keyframes fadein { from { opacity: 0 } to { opacity: 1 } }
.beads canvas { width: 100%; height: 100%; touch-action: none; cursor: grab; }
.beads .back { position: absolute; top: 16px; left: 16px; }
.beads-meta { position: absolute; left: 28px; bottom: 28px; color: var(--muted); }
.beads-count b { font-size: 44px; font-weight: 500; color: var(--ink); letter-spacing: .05em; }
.beads-count span { margin-left: 8px; font-size: 14px; }
.beads-round { margin-top: 2px; font-size: 14px; letter-spacing: .15em; }
.beads-hint { margin-top: 10px; font-size: 12px; opacity: .7; letter-spacing: .1em; }
#about-panel { bottom: auto; top: 64px; left: auto; right: 14px; transform: none; width: min(360px, calc(100vw - 32px)); animation: none; }
@media (max-width: 520px) {
  .topbar { gap: 6px; } .pill { padding: 7px 10px; font-size: 12px; }
  .act { min-width: 64px; padding: 7px 8px; font-size: 12px; }
  .beads-meta { left: 18px; bottom: 18px; }
}

/* ---------- 静态页面（殿堂页等，tools/build_pages.mjs 生成） ---------- */
body.page { overflow: auto; height: auto; min-height: 100%; }
.page-head { display: flex; align-items: baseline; gap: 18px; padding: 18px 24px; border-bottom: 1px solid rgba(217,181,108,0.14); }
.page-brand { color: var(--gold); text-decoration: none; letter-spacing: .4em; font-size: 18px; }
.crumbs { color: var(--muted); font-size: 13px; letter-spacing: .08em; }
.crumbs a { color: var(--muted); text-decoration: none; }
.crumbs a:hover { color: var(--gold); }
.crumbs .sep { margin: 0 8px; opacity: .5; }
.page-main { max-width: 720px; margin: 0 auto; padding: 36px 24px 60px; }
.page-main h1 { font-size: clamp(32px, 6vw, 44px); font-weight: 500; letter-spacing: .3em; margin: 0 0 14px; }
.page-main h2 { font-size: 20px; font-weight: 500; letter-spacing: .25em; color: var(--gold); margin: 36px 0 10px; }
.page-main p { color: var(--muted); font-size: 15px; line-height: 2; margin: 0 0 12px; }
.page-main .lead { color: var(--ink); font-size: 16px; }
.hall-fig { margin: 22px 0 10px; }
.hall-fig img, .hall-cards img { display: block; width: 100%; height: auto; border-radius: 12px; border: 1px solid rgba(217,181,108,0.2); }
.hall-fig figcaption { color: var(--muted); font-size: 12px; letter-spacing: .08em; margin-top: 8px; opacity: .8; }
.facts { list-style: none; padding: 0; margin: 14px 0 20px; display: flex; flex-wrap: wrap; gap: 8px; }
.facts li { font-size: 13px; letter-spacing: .08em; color: var(--ink); padding: 6px 12px; border: 1px solid var(--line); border-radius: 999px; }
.hall-enter { margin: 24px 0; }
.hall-enter .btn { display: inline-block; text-decoration: none; }
.hall-next ul, .exterior { list-style: none; padding: 0; margin: 0; }
.hall-next li { display: inline-block; margin: 0 14px 8px 0; }
.hall-next a { color: var(--ink); text-decoration: none; letter-spacing: .1em; border-bottom: 1px solid var(--line); }
.hall-next a:hover { color: var(--gold); border-color: var(--gold); }
.hall-cards { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 18px; }
.hall-cards a { display: block; color: inherit; text-decoration: none; }
.hall-cards b { display: block; margin-top: 10px; font-weight: 500; letter-spacing: .15em; color: var(--ink); }
.hall-cards span { display: block; color: var(--muted); font-size: 13px; line-height: 1.8; }
.hall-cards a:hover b { color: var(--gold); }
.exterior li { color: var(--muted); font-size: 14px; line-height: 1.9; padding: 8px 0; border-top: 1px solid rgba(217,181,108,0.14); }
.exterior b { color: var(--ink); font-weight: 500; letter-spacing: .1em; margin-right: 10px; }
.exterior b a { color: inherit; text-decoration: none; border-bottom: 1px solid var(--line); }
.exterior b a:hover { color: var(--gold); border-color: var(--gold); }
.note .small { font-size: 12px; opacity: .7; margin-top: 28px; }
.page-foot { max-width: 720px; margin: 0 auto; padding: 24px 24px 60px; color: var(--muted); font-size: 13px; letter-spacing: .08em; border-top: 1px solid rgba(217,181,108,0.14); }
.page-foot a { color: var(--muted); text-decoration: none; }
.page-foot a:hover { color: var(--gold); }
.page-foot .small { margin-top: 12px; opacity: .7; line-height: 1.8; letter-spacing: 0; }

/* 文章页浮动底栏：滚过 40% 出现 */
.cta-bar { position: fixed; left: 50%; bottom: 18px; transform: translateX(-50%); z-index: 30; display: flex; align-items: center; gap: 4px; padding: 6px 6px 6px 18px; max-width: calc(100vw - 32px); background: var(--card); border: 1px solid var(--line); border-radius: 999px; backdrop-filter: blur(12px); box-shadow: 0 16px 40px rgba(0,0,0,.45); animation: rise .5s ease both; }
.cta-bar .cta-go { color: var(--ink); text-decoration: none; letter-spacing: .1em; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; border: 0; }
.cta-bar .cta-go:hover { color: var(--gold); }
.cta-bar .cta-x { font-family: inherit; font-size: 18px; line-height: 1; width: 32px; height: 32px; border-radius: 50%; border: 0; background: transparent; color: var(--muted); cursor: pointer; }
.cta-bar .cta-x:hover { background: rgba(217,181,108,.12); color: var(--ink); }
@media (max-width: 520px) { .cta-bar { bottom: 12px; font-size: 13px; padding-left: 14px; } }

/* 显卡提示与诊断 */
.gpu-warn { margin: 0 0 14px; padding: 10px 14px; border: 1px solid rgba(217,181,108,.5); border-radius: 12px; background: rgba(217,181,108,.08); color: var(--muted); font-size: 13px; line-height: 1.8; text-align: left; }
.gpu-warn b { color: var(--gold); font-weight: 500; }
.diag { margin-top: 10px; font-size: 11px; opacity: .7; word-break: break-all; }
