:root {
  --ink: #14100c;
  --ink-2: #201a14;
  --paper: #f2e8d5;
  --paper-dim: #d9cbb2;
  --gold: #c8a35c;
  --gold-soft: #e0c68c;
  --red: #9e2b25;
  --line: rgba(200, 163, 92, 0.28);
  --shadow: 0 18px 60px rgba(0, 0, 0, 0.55);
  --font: "Songti SC", "STSong", "Noto Serif CJK SC", "Source Han Serif SC", "SimSun", serif;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
  margin: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: #0b0908;
  font-family: var(--font);
  color: var(--paper);
  overscroll-behavior: none;
}

#app { position: fixed; inset: 0; }
#scene { position: absolute; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; }

.hidden { display: none !important; }

/* ---------------------------------------------------------------- loading */
.overlay {
  position: absolute; inset: 0; z-index: 40;
  display: flex; align-items: center; justify-content: center;
  background: radial-gradient(circle at 50% 42%, #241c15 0%, #0d0a08 70%);
  transition: opacity .9s ease;
}
.overlay.fade { opacity: 0; pointer-events: none; }
.loading-inner { text-align: center; }
.seal {
  width: 62px; height: 62px; margin: 0 auto 22px;
  display: grid; place-items: center;
  border: 1px solid var(--gold); color: var(--gold);
  font-size: 20px; letter-spacing: 2px;
  background: rgba(158, 43, 37, .16);
  box-shadow: inset 0 0 22px rgba(200, 163, 92, .18);
}
.loading-title { font-size: 26px; letter-spacing: 8px; color: var(--paper); }
.loading-sub { margin-top: 10px; font-size: 13px; letter-spacing: 3px; color: rgba(242, 232, 213, .5); }
.loading-bar { width: 220px; height: 2px; margin: 26px auto 12px; background: rgba(242, 232, 213, .12); overflow: hidden; }
.loading-bar i { display: block; height: 100%; width: 0%; background: linear-gradient(90deg, #8a6a32, var(--gold-soft)); transition: width .4s ease; }
.loading-msg { font-size: 12px; letter-spacing: 2px; color: rgba(242, 232, 213, .38); }

/* ---------------------------------------------------------------- hud */
#hud { position: absolute; inset: 0; pointer-events: none; z-index: 10; }
#hud > * { pointer-events: auto; }

.topbar {
  position: absolute; top: 0; left: 0; right: 0;
  display: flex; align-items: flex-start; justify-content: space-between;
  padding: 18px 22px;
  background: linear-gradient(180deg, rgba(8, 6, 5, .62), transparent);
  pointer-events: none !important;
}
.brand { display: flex; align-items: baseline; gap: 10px; }
.brand-name { font-size: 20px; letter-spacing: 6px; color: var(--paper); }
.brand-sub { font-size: 11px; letter-spacing: 4px; color: var(--gold); opacity: .8; }
.meta {
  display: flex; align-items: center; gap: 10px;
  font-size: 12px; letter-spacing: 1px; color: rgba(242, 232, 213, .62);
  padding: 6px 12px; border: 1px solid var(--line); background: rgba(12, 9, 7, .5);
  backdrop-filter: blur(6px);
}
.dot { width: 6px; height: 6px; border-radius: 50%; background: #7a6a52; }
.dot.on { background: #7fbf7a; box-shadow: 0 0 8px #7fbf7a; }
.dot.off { background: #b45b4e; }

.prompt {
  position: absolute; left: 50%; bottom: 128px; transform: translateX(-50%);
  padding: 9px 18px; border: 1px solid var(--line);
  background: rgba(14, 11, 8, .78); backdrop-filter: blur(8px);
  font-size: 13px; letter-spacing: 1.5px; color: var(--paper);
  white-space: nowrap; animation: floatIn .25s ease;
}
.prompt b { color: var(--gold-soft); }

.queuetip {
  position: absolute; left: 50%; top: 76px; transform: translateX(-50%);
  padding: 10px 20px; border: 1px solid rgba(158, 43, 37, .6);
  background: rgba(40, 16, 12, .82); backdrop-filter: blur(8px);
  font-size: 13px; letter-spacing: 1px; color: #f0dcc4;
}
.queuetip b { color: var(--gold-soft); }

.actions {
  position: absolute; right: 22px; top: 50%; transform: translateY(-50%);
  display: flex; flex-direction: column; gap: 8px;
}
.act {
  width: 62px; padding: 9px 0 7px; display: flex; flex-direction: column; align-items: center; gap: 3px;
  background: rgba(14, 11, 8, .62); border: 1px solid var(--line); color: var(--paper-dim);
  font-family: var(--font); font-size: 11px; letter-spacing: 1px; cursor: pointer;
  backdrop-filter: blur(8px); transition: all .18s ease;
}
.act .ico { font-size: 15px; color: var(--gold); line-height: 1; }
.act:hover { border-color: rgba(200, 163, 92, .7); color: #fff; background: rgba(32, 24, 16, .8); }
.act.active { border-color: var(--gold); background: rgba(72, 50, 22, .8); color: #fff; }
.act.off { opacity: .38; cursor: default; }

.hintbar {
  position: absolute; left: 22px; bottom: 22px; transform: none;
  display: flex; flex-direction: column; gap: 4px; align-items: flex-start;
  padding: 10px 14px;
  font-size: 11.5px; letter-spacing: 1px; color: rgba(242, 232, 213, .5);
  border-top: 1px solid var(--line);
  pointer-events: none !important;
}
@media (pointer: coarse) {
  .hintbar { bottom: 150px; }   /* 移动端避让左下角摇杆 */
}
.hintbar b { color: var(--gold); font-weight: normal; margin-right: 2px; }
.hintbar .mob { display: none; }

.toast {
  position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%);
  padding: 12px 24px; background: rgba(12, 9, 7, .9); border: 1px solid var(--line);
  font-size: 14px; letter-spacing: 2px; opacity: 0; transition: opacity .3s ease;
  pointer-events: none !important; max-width: 80vw; text-align: center;
}
.toast.show { opacity: 1; }

/* ---------------------------------------------------------------- panels */
.panel {
  position: absolute; z-index: 30;
  top: 50%; left: 50%; transform: translate(-50%, -50%);
  width: min(680px, 92vw); max-height: 88vh; overflow: auto;
  background: linear-gradient(180deg, #1a1511, #13100c);
  border: 1px solid var(--line); box-shadow: var(--shadow);
  padding: 0 0 16px;
}
.panel.narrow { width: min(480px, 92vw); }
.panel-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 20px; border-bottom: 1px solid var(--line);
  position: sticky; top: 0; background: #1a1511; z-index: 2;
}
.panel-head h2 { margin: 0; font-size: 16px; letter-spacing: 4px; color: var(--paper); font-weight: normal; }
.close {
  background: none; border: none; color: var(--paper-dim); font-size: 22px; line-height: 1;
  cursor: pointer; padding: 0 4px;
}
.close:hover { color: var(--gold); }
.map-wrap { padding: 12px 16px 0; flex: 0 1 auto; }
#mapPanel { display: flex; flex-direction: column; max-height: 92vh; overflow: hidden; }
#mapPanel .panel-foot { flex: 0 0 auto; padding: 12px 20px 4px; }
.myname { color: var(--gold-soft); letter-spacing: 1px; margin-left: 10px; }
#mapCanvas { display: block; width: 100%; height: auto; }
.panel-foot {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 12px 20px 0; font-size: 12px; color: rgba(242, 232, 213, .55);
}
.ghost {
  background: none; border: 1px solid var(--line); color: var(--gold);
  padding: 7px 14px; font-family: var(--font); font-size: 12px; letter-spacing: 2px; cursor: pointer;
}
.ghost:hover { background: rgba(200, 163, 92, .12); }
#mapInfo { flex: 1; line-height: 1.75; font-size: 11.5px; color: rgba(242,232,213,.72); }
#mapInfo strong { display: block; font-size: 13px; color: var(--gold-soft); letter-spacing: 2px; font-weight: normal; margin-bottom: 3px; }
#mapInfo .poi-wish { color: #d8b465; }
#mapInfo .poi-intro {
  margin-top: 4px; color: rgba(242,232,213,.45);
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.hintbar { flex-wrap: wrap; }

.wish-body { padding: 16px 20px 0; }
.wish-note { font-size: 12px; line-height: 1.7; color: rgba(242, 232, 213, .5); margin: 0 0 14px; }
.wish-tabs { display: flex; gap: 8px; margin-bottom: 12px; }
.tab {
  flex: 1; padding: 9px 0; background: none; border: 1px solid var(--line);
  color: var(--paper-dim); font-family: var(--font); font-size: 13px; letter-spacing: 2px; cursor: pointer;
}
.tab.active { border-color: var(--gold); color: var(--gold-soft); background: rgba(200, 163, 92, .1); }
textarea#wishText {
  width: 100%; height: 104px; resize: none; padding: 12px;
  background: rgba(8, 6, 5, .6); border: 1px solid var(--line);
  color: var(--paper); font-family: var(--font); font-size: 14px; line-height: 1.7;
  outline: none;
}
textarea#wishText:focus { border-color: rgba(200, 163, 92, .65); }
.wish-name {
  width: 100%; padding: 10px 12px; margin-bottom: 10px;
  background: rgba(8, 6, 5, .6); border: 1px solid var(--line);
  color: var(--paper); font-family: var(--font); font-size: 13px; letter-spacing: 1px;
  outline: none;
}
.wish-name:focus { border-color: rgba(200, 163, 92, .65); }
.wish-limit { font-size: 11.5px; color: rgba(200, 163, 92, .75); margin: -6px 0 12px; letter-spacing: 1px; }
.wish-limit.full { color: #c96a4e; }
.mine-name { display: block; font-style: normal; font-size: 11px; color: rgba(242, 232, 213, .35); margin-top: 3px; letter-spacing: 1px; }
.wish-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin: 12px 0 16px; flex-wrap: wrap; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip {
  padding: 5px 10px; background: none; border: 1px solid var(--line);
  color: rgba(242, 232, 213, .6); font-family: var(--font); font-size: 11.5px; letter-spacing: 1px; cursor: pointer;
}
.chip.active { border-color: var(--gold); color: var(--gold-soft); }
.count { font-size: 11px; color: rgba(242, 232, 213, .35); }
.primary {
  width: 100%; padding: 12px 0; background: linear-gradient(180deg, #9e2b25, #7d1f1a);
  border: 1px solid rgba(200, 163, 92, .5); color: #f6e6cf;
  font-family: var(--font); font-size: 14px; letter-spacing: 5px; cursor: pointer;
}
.primary:hover { filter: brightness(1.12); }
.primary:disabled { opacity: .5; cursor: default; }
.mine { margin: 16px 0 0; border-top: 1px solid var(--line); padding-top: 12px; }
.mine h3 { font-size: 12px; letter-spacing: 2px; color: var(--gold); font-weight: normal; margin: 0 0 8px; }
.mine-item {
  display: flex; justify-content: space-between; gap: 10px;
  font-size: 12.5px; color: rgba(242, 232, 213, .7); padding: 6px 0; border-bottom: 1px dashed rgba(200, 163, 92, .14);
}
.mine-item span { flex: 1; }
.mine-item button { background: none; border: none; color: #a86a5e; font-size: 11px; cursor: pointer; font-family: var(--font); }

/* ---------------------------------------------------------------- intro */
.intro {
  position: absolute; inset: 0; z-index: 35; display: grid; place-items: center;
  background: radial-gradient(circle at 50% 45%, rgba(20, 16, 12, .52), rgba(6, 5, 4, .82));
  backdrop-filter: blur(1.5px);
  overflow-y: auto;   /* 窗口过矮时可滚动，入场按钮永不出界 */
}
.intro-card { text-align: center; padding: 24px; max-width: 560px; }
.intro-card h1 { font-size: 40px; letter-spacing: 14px; margin: 18px 0 6px; font-weight: normal; }
.intro-sub { color: var(--gold); letter-spacing: 5px; font-size: 12px; margin: 0 0 26px; }
.intro-text { font-size: 13.5px; line-height: 2.1; color: rgba(242, 232, 213, .68); margin: 0 0 28px; }
.intro-tip { font-size: 11px; letter-spacing: 2px; color: rgba(242, 232, 213, .35); margin: 14px 0 0; }
.intro-notice {
  font-size: 11px; letter-spacing: 1px; line-height: 1.7;
  color: rgba(242, 232, 213, .42);
  border-top: 1px solid rgba(200, 163, 92, .22);
  border-bottom: 1px solid rgba(200, 163, 92, .22);
  padding: 7px 0; margin: 0 0 22px;
}
#enterBtn { max-width: 220px; margin: 0 auto; }
/* 矮窗口（横屏手机 / 小测试视口）：压缩间距与字号，顶部对齐可滚动，保证按钮在屏内 */
@media (max-height: 460px) {
  .intro { place-items: start center; }
  .intro-card { padding: 12px 18px; }
  .intro-card h1 { font-size: 22px; letter-spacing: 7px; margin: 6px 0 3px; }
  .intro-sub { font-size: 10px; letter-spacing: 3px; margin: 0 0 10px; }
  .intro-text { font-size: 11px; line-height: 1.7; margin: 0 0 12px; }
  .intro-notice { padding: 4px 0; margin: 0 0 12px; font-size: 10px; }
  .intro-tip { margin: 8px 0 0; }
  #enterBtn { padding: 8px 20px; font-size: 13px; }
}

/* ---------------------------------------------------------------- joystick */
.joystick {
  position: absolute; left: 26px; bottom: 78px; width: 108px; height: 108px;
  border: 1px solid rgba(200, 163, 92, .35); border-radius: 50%;
  background: rgba(14, 11, 8, .35); backdrop-filter: blur(4px);
  touch-action: none;
}
.joystick i {
  position: absolute; left: 50%; top: 50%; width: 42px; height: 42px; margin: -21px 0 0 -21px;
  border-radius: 50%; background: rgba(200, 163, 92, .3); border: 1px solid rgba(200, 163, 92, .6);
}

@keyframes floatIn { from { opacity: 0; transform: translate(-50%, 8px); } to { opacity: 1; transform: translate(-50%, 0); } }

@media (max-width: 760px) {
  .brand-name { font-size: 17px; letter-spacing: 4px; }
  .brand-sub { display: none; }
  .meta { font-size: 11px; padding: 5px 9px; }
  .hintbar { display: none; }
  .hintbar .mob { display: inline; }
  .actions {
    top: auto; bottom: 150px; right: 14px; transform: none;
    display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; width: 190px;
  }
  .act { width: auto; padding: 7px 0 5px; font-size: 10px; }
  .act .ico { font-size: 13px; }
  /* 互动提示上移到按钮网格之上，避让摇杆（左下）与底部按钮（右下） */
  .prompt { bottom: 262px; font-size: 12px; white-space: normal; max-width: 72vw; text-align: center; line-height: 1.6; }
  /* 底部动作按钮靠右下角并做小（E/合掌/木鱼），避让左侧摇杆 */
  .bottom-actions { left: auto; right: 12px; bottom: 12px; transform: none; gap: 6px; }
  .bact { padding: 5px 10px; font-size: 11px; letter-spacing: 1px; }
  .bact .ico { width: 18px; height: 18px; font-size: 11px; }
  .intro-card h1 { font-size: 30px; letter-spacing: 8px; }
  .intro-text { font-size: 12.5px; line-height: 1.9; }
  .hintbar.mob { display: flex; }
}

/* ---------------------------------------------------------------- 求签 · 读经 · 排队禅语 */
.q-zen { color: rgba(232, 207, 150, .75); font-size: 12px; }
.sutra-text {
  white-space: pre-wrap; font-family: "KaiTi","STKaiti","Songti SC",serif;
  font-size: 14.5px; line-height: 2.1; color: rgba(242, 232, 213, .88);
  max-height: 46vh; overflow-y: auto; padding: 14px 16px;
  background: rgba(12, 9, 7, .5); border: 1px solid var(--line);
}
.sign-empty { text-align: center; color: rgba(242, 232, 213, .4); padding: 22px 0; font-size: 13px; }
.sign-level {
  display: inline-block; padding: 4px 14px; margin-bottom: 8px;
  border: 1px solid var(--gold); color: var(--gold); letter-spacing: 4px; font-size: 14px;
}
.sign-title { font-size: 17px; letter-spacing: 2px; color: var(--paper); margin-bottom: 12px; }
.sign-poem {
  font-family: "KaiTi","STKaiti","Songti SC",serif; font-size: 15px; line-height: 2;
  color: rgba(242, 232, 213, .85); margin: 0 0 12px; white-space: pre-wrap;
}
.sign-explain { font-size: 13px; color: rgba(242, 232, 213, .6); line-height: 1.9; }

/* ---------------------------------------------------------------- 导览图毛玻璃卡片 · 季节行 */
.season-row { gap: 8px; align-items: center; }
.season-row .ghost { min-width: 44px; padding: 6px 0; text-align: center; }
.map-card {
  position: absolute; z-index: 5; width: 244px; padding: 14px 16px 12px;
  border: 1px solid rgba(200, 163, 92, .4);
  background: rgba(18, 13, 9, .68);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  box-shadow: 0 10px 30px rgba(0, 0, 0, .45);
  font-size: 12px; line-height: 1.9; color: rgba(242, 232, 213, .82);
  animation: floatIn .22s ease;
}
.map-card strong { display: block; font-size: 16px; letter-spacing: 3px; color: var(--paper); margin-bottom: 6px; }
.map-card .poi-wish { color: var(--gold-soft); margin: 2px 0; }
.map-card .poi-intro { margin-top: 6px; font-size: 11.5px; color: rgba(242, 232, 213, .55); }
.map-card .card-close {
  position: absolute; top: 6px; right: 8px; border: none; background: none;
  color: rgba(242, 232, 213, .6); font-size: 16px; cursor: pointer; padding: 2px 6px;
}
.map-card .card-close:hover { color: #fff; }
.map-card .card-go { width: 100%; margin-top: 10px; padding: 7px 0; }

/* ---------------------------------------------------------------- 底部动作按钮 · 听经 · 木鱼 */
.bottom-actions {
  position: absolute; left: 50%; bottom: 22px; transform: translateX(-50%);
  display: flex; gap: 12px; z-index: 12;
}
.bact {
  display: flex; align-items: center; gap: 8px; padding: 10px 22px;
  border: 1px solid rgba(200, 163, 92, .45); border-radius: 22px;
  background: rgba(14, 11, 8, .66); backdrop-filter: blur(8px);
  color: var(--paper); font-family: var(--font); font-size: 14px; letter-spacing: 2px;
  white-space: nowrap;
  cursor: pointer; transition: all .18s ease;
}
.bact .ico {
  display: inline-grid; place-items: center; width: 26px; height: 26px; border-radius: 50%;
  border: 1px solid var(--gold); color: var(--gold); font-size: 13px;
}
.bact:hover { background: rgba(46, 34, 20, .85); border-color: var(--gold); }

.overlay.muyu {
  background: rgba(8, 6, 4, .45);
  backdrop-filter: blur(7px);
  -webkit-backdrop-filter: blur(7px);
  z-index: 42;
}
.muyu-card {
  position: relative; text-align: center; padding: 26px 40px 22px;
  border: 1px solid rgba(200, 163, 92, .45);
  background: rgba(20, 15, 10, .82); backdrop-filter: blur(16px);
  box-shadow: 0 18px 50px rgba(0, 0, 0, .5);
  animation: floatIn .25s ease;
}
.muyu-card h2 { font-size: 20px; letter-spacing: 8px; font-weight: normal; margin: 0 0 4px; }
.muyu-note { font-size: 12px; color: rgba(242, 232, 213, .55); letter-spacing: 2px; margin: 0 0 10px; }
.muyu-stage { cursor: pointer; user-select: none; }
.muyu-stage:active #muyuBody { transform-origin: 140px 160px; }
#muyuStage.strike #muyuMallet { transform: rotate(-30deg); transition: transform .06s ease-in; }
#muyuStage #muyuMallet { transform: rotate(0deg); transition: transform .18s cubic-bezier(.34,1.56,.64,1); }
#muyuStage.strike #muyuBody { animation: muyuPulse .14s ease; }
@keyframes muyuPulse { 40% { transform: scale(1.045); } }
#muyuRing.pulse { animation: muyuRing .5s ease-out; }
@keyframes muyuRing { 0% { opacity: .8; } 100% { opacity: 0; } }
.muyu-stats { font-size: 13px; letter-spacing: 2px; color: rgba(242, 232, 213, .7); margin-top: 6px; }
.muyu-stats b { color: var(--gold); font-size: 16px; }


/* 本殿神佛信息（求签卡顶部） */
.sign-hall {
  font-size: 12.5px; letter-spacing: 1px; line-height: 1.8;
  color: var(--gold-soft, #e8cf96);
  border: 1px solid rgba(200, 163, 92, .3);
  background: rgba(72, 50, 22, .35);
  padding: 8px 12px; margin-bottom: 12px;
}
.sign-hall strong { color: var(--paper, #f2e8d5); font-size: 14px; letter-spacing: 2px; }
