/* =========================================================
   《千禧年·土地庙》 style.css
   ========================================================= */

:root {
  --ink: #2a211a;
  --paper: #e8e0cc;
  --paper2: #f2ead6;
  --red: #a8321f;
  --red2: #c0392b;
  --gold: #c8a24a;
  --green: #4a6a4a;
  --line: #6b5a44;
  --shadow: rgba(0, 0, 0, 0.55);
}

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

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: #05050a;
  font-family: "SimSun", "宋体", "Songti SC", serif;
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
  user-select: none;
}

#app {
  position: fixed;
  top: 0;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: min(100vw, calc(100vh * 0.5714), 560px);
  overflow: hidden;
  background: #05050a;
  box-shadow: 0 0 100px rgba(0, 0, 0, 0.9), 0 0 0 1px rgba(120, 100, 70, 0.12);
}

/* 桌面端：中间竖屏画框，两侧暗场 */
@media (min-width: 600px) {
  body {
    background:
      radial-gradient(ellipse 60% 50% at 50% 40%, #12100e 0%, #05050a 70%),
      #05050a;
  }
}

/* ---------- 舞台 ---------- */
#stage { position: absolute; inset: 0; background: #07080b; }

#scene {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  /* 像素画的命门：放大不许插值 */
  image-rendering: pixelated;
  image-rendering: -moz-crisp-edges;
  image-rendering: crisp-edges;
  -ms-interpolation-mode: nearest-neighbor;
}

/* 斜向漏光（很淡，跟着呼吸） */
#leak {
  position: absolute;
  inset: -20%;
  pointer-events: none;
  z-index: 5;
  background:
    linear-gradient(112deg,
      rgba(255, 150, 90, 0) 26%,
      rgba(255, 160, 100, 0.10) 38%,
      rgba(255, 210, 150, 0.05) 44%,
      rgba(255, 140, 90, 0) 52%),
    linear-gradient(70deg,
      rgba(120, 170, 255, 0) 62%,
      rgba(120, 170, 255, 0.05) 74%,
      rgba(120, 170, 255, 0) 84%);
  mix-blend-mode: screen;
  animation: leakBreath 11s ease-in-out infinite;
}
@keyframes leakBreath {
  0%, 100% { opacity: 0.55; transform: translate(0, 0) scale(1); }
  50% { opacity: 1; transform: translate(-1.5%, 1%) scale(1.03); }
}

/* 胶片颗粒 */
#grain {
  position: absolute;
  inset: -40%;
  pointer-events: none;
  opacity: 0.035;
  z-index: 6;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='120' height='120'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='3'/></filter><rect width='120' height='120' filter='url(%23n)'/></svg>");
  animation: grainShift 0.55s steps(3) infinite;
}
@keyframes grainShift {
  0% { transform: translate(0, 0); }
  33% { transform: translate(-2%, 1%); }
  66% { transform: translate(1%, -2%); }
  100% { transform: translate(0, 0); }
}
/* 暗角 */
#vignette {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 7;
  background: radial-gradient(ellipse 82% 74% at 50% 46%, rgba(0, 0, 0, 0) 52%, rgba(0, 0, 0, 0.34) 100%);
}

/* 场景切换：暗场过渡 */
#fade {
  position: absolute;
  inset: 0;
  z-index: 4;
  pointer-events: none;
  background: #08070a;
  opacity: 0;
  transition: opacity 0.42s ease-out;
}
#fade.on { opacity: 1; transition: opacity 0.10s ease-in; }

/* 走动引导 */
#walkHint {
  position: absolute;
  left: 0; right: 0;
  top: 152px;
  z-index: 19;
  text-align: center;
  font-size: 11px;
  letter-spacing: 1px;
  color: rgba(244, 232, 210, 0.9);
  text-shadow: 0 1px 6px #000, 0 0 2px #000;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.5s;
  font-family: "PingFang SC", "Microsoft YaHei", sans-serif;
}
#walkHint.on { opacity: 1; }
#walkHint span {
  display: inline-block;
  padding: 5px 12px;
  border-radius: 20px;
  background: rgba(12, 10, 8, 0.42);
  backdrop-filter: blur(2px);
}
#hud {
  position: absolute;
  top: 0; left: 0; right: 0;
  z-index: 20;
  padding: 10px 12px 26px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  background: linear-gradient(to bottom, rgba(6, 8, 12, 0.82) 0%, rgba(6, 8, 12, 0.45) 60%, rgba(6, 8, 12, 0) 100%);
  pointer-events: none;
}
.hud-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  line-height: 1;
  padding: 4px 6px;
  color: #e8e0cc;
  background: rgba(20, 18, 14, 0.72);
  border: 1px solid rgba(200, 162, 74, 0.32);
  border-radius: 2px;
  letter-spacing: 0.3px;
  text-shadow: 0 1px 0 #000;
  font-family: "SimHei", "黑体", sans-serif;
}
.badge .v { color: #f0d48c; }
.badge.dim .v { color: #b8b0a0; }

#timeBadge { font-variant-numeric: tabular-nums; }

#locLabel {
  position: absolute;
  left: 14px;
  top: 96px;
  z-index: 20;
  color: #eae2cc;
  font-size: 13px;
  letter-spacing: 2px;
  text-shadow: 0 2px 6px #000, 0 0 2px #000;
  pointer-events: none;
  opacity: 0.9;
  font-family: "SimHei", "黑体", sans-serif;
}
#locLabel::before {
  content: '';
  display: inline-block;
  width: 14px; height: 1px;
  background: var(--gold);
  vertical-align: middle;
  margin-right: 6px;
}

/* ---------- 底部操作 ---------- */
#actions {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  z-index: 20;
  padding: 18px 8px calc(10px + env(safe-area-inset-bottom));
  display: flex;
  gap: 6px;
  justify-content: center;
  flex-wrap: nowrap;
  background: linear-gradient(to top, rgba(6, 8, 12, 0.9) 0%, rgba(6, 8, 12, 0.45) 60%, rgba(6, 8, 12, 0) 100%);
}

.btn {
  font-family: "SimHei", "黑体", sans-serif;
  font-size: 12.5px;
  letter-spacing: 0.5px;
  color: #2a211a;
  background: linear-gradient(to bottom, #f2ead6 0%, #ddd2b8 52%, #cdc0a4 100%);
  border: none;
  border-radius: 2px;
  padding: 8px 6px;
  min-width: 0;
  min-height: 44px;
  flex: 1 1 0;
  max-width: 96px;
  position: relative;
  box-shadow:
    inset 1px 1px 0 #fffdf5,
    inset -1px -1px 0 #9a8e74,
    0 2px 0 #4a4030,
    0 3px 6px rgba(0, 0, 0, 0.5);
  cursor: pointer;
  transition: transform 0.19s cubic-bezier(0.18, 0.9, 0.3, 1.45), box-shadow 0.12s ease, filter 0.12s ease;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.btn:active {
  transform: translateY(2.5px) scale(0.955);
  filter: brightness(0.94);
  transition-duration: 0.04s;
  box-shadow:
    inset 1px 1px 0 #9a8e74,
    inset -1px -1px 0 #fffdf5,
    0 0 0 #4a4030;
}
/* 松手回弹：手指抬起后微微弹一下，像真按键 */
.btn::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  box-shadow: inset 0 0 0 0 rgba(255, 236, 190, 0);
  transition: box-shadow 0.4s ease;
  pointer-events: none;
}
.btn:active::after { box-shadow: inset 0 0 14px 0 rgba(255, 236, 190, 0.55); transition: box-shadow 0.05s; }
.btn:disabled { opacity: 0.42; filter: grayscale(0.6); }

/* 按下涟漪 */
.ripple {
  position: absolute;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 255, 255, 0.85) 0%, rgba(255, 255, 255, 0.25) 45%, rgba(255, 255, 255, 0) 72%);
  transform: scale(0);
  animation: rippleGo 0.46s cubic-bezier(0.2, 0.7, 0.3, 1) forwards;
  pointer-events: none;
  mix-blend-mode: screen;
  z-index: 3;
}
@keyframes rippleGo {
  from { transform: scale(0); opacity: 0.9; }
  to { transform: scale(1); opacity: 0; }
}
.btn, .opt, .icon-btn, .x, .pad { position: relative; overflow: hidden; }

/* 卡片退场 */
.card.out { animation: cardOut 0.13s ease-in forwards; }
@keyframes cardOut {
  to { transform: translateY(10px) scale(0.985); opacity: 0; }
}
#modalLayer { transition: background 0.13s; }
.btn.wide { min-width: 140px; }
.btn.red {
  background: linear-gradient(to bottom, #c0392b 0%, #a8321f 55%, #8e2716 100%);
  color: #f6e8cc;
  box-shadow:
    inset 1px 1px 0 rgba(255, 220, 190, 0.5),
    inset -1px -1px 0 rgba(80, 20, 10, 0.8),
    0 2px 0 #4a1008,
    0 3px 6px rgba(0, 0, 0, 0.5);
}
.btn.dark {
  background: linear-gradient(to bottom, #4a4440 0%, #332e2a 55%, #262220 100%);
  color: #e0d8c4;
  box-shadow:
    inset 1px 1px 0 rgba(255, 255, 255, 0.2),
    inset -1px -1px 0 rgba(0, 0, 0, 0.8),
    0 2px 0 #15120f,
    0 3px 6px rgba(0, 0, 0, 0.5);
}
.btn.ghost {
  background: rgba(20, 18, 14, 0.6);
  color: #e0d8c4;
  border: 1px solid rgba(200, 162, 74, 0.4);
  box-shadow: none;
}
.btn small { display: block; font-size: 10px; opacity: 0.65; font-weight: normal; letter-spacing: 0; }

/* ---------- 弹窗 ---------- */
#modalLayer {
  position: absolute;
  inset: 0;
  z-index: 40;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 16px;
  overflow: hidden;
  background: rgba(3, 4, 8, 0.72);
  backdrop-filter: blur(1.5px);
}
#modalLayer.on { display: flex; }

/* 弹窗卡片：暗色胶片玻璃，和实景照片一个世界 */
.card {
  width: 100%;
  max-width: 420px;
  min-width: 0;
  max-height: 84vh;
  overflow-y: auto;
  overflow-x: hidden;
  word-break: break-word;
  background:
    linear-gradient(to bottom, rgba(255, 236, 200, 0.06), rgba(255, 236, 200, 0) 140px),
    rgba(14, 12, 11, 0.78);
  border: 1px solid rgba(232, 200, 150, 0.22);
  border-radius: 10px;
  box-shadow:
    inset 0 1px 0 rgba(255, 236, 200, 0.10),
    0 18px 48px rgba(0, 0, 0, 0.62),
    0 0 0 1px rgba(0, 0, 0, 0.35);
  backdrop-filter: blur(14px) saturate(1.1);
  -webkit-backdrop-filter: blur(14px) saturate(1.1);
  padding: 20px 18px 18px;
  position: relative;
  animation: cardIn 0.22s cubic-bezier(0.2, 0.9, 0.3, 1);
  scrollbar-width: thin;
}
@keyframes cardIn {
  from { transform: translateY(14px) scale(0.985); opacity: 0; }
  to { transform: none; opacity: 1; }
}
/* 细颗粒，让卡片也带一点胶片味 */
.card::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 10px;
  pointer-events: none;
  opacity: 0.045;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='100' height='100'><filter id='p'><feTurbulence type='fractalNoise' baseFrequency='0.7' numOctaves='4'/></filter><rect width='100' height='100' filter='url(%23p)'/></svg>");
}

.card h2 {
  font-size: 17px;
  letter-spacing: 3px;
  color: #f3e6cd;
  font-weight: bold;
  margin-bottom: 4px;
  font-family: "PingFang SC", "Microsoft YaHei", "SimHei", sans-serif;
  text-shadow: 0 1px 10px rgba(0, 0, 0, 0.5);
}
.card h2 .sub {
  font-size: 11px;
  letter-spacing: 1px;
  color: rgba(232, 200, 150, 0.62);
  margin-left: 6px;
  font-weight: normal;
}
.card .rule {
  height: 1px;
  background: linear-gradient(to right, rgba(232, 200, 150, 0.42), rgba(232, 200, 150, 0.04));
  margin: 10px 0 12px;
}
.card p { font-size: 14px; line-height: 1.9; color: #e8ddc9; margin-bottom: 10px; }
.card p.small { font-size: 12.5px; color: rgba(232, 221, 201, 0.72); line-height: 1.85; }
.card b { color: #f6e3bd; }
.card .quote {
  border-left: 2px solid rgba(232, 200, 150, 0.55);
  padding: 7px 0 7px 11px;
  margin: 12px 0;
  font-size: 13px;
  color: rgba(246, 233, 208, 0.92);
  line-height: 1.8;
  background: linear-gradient(to right, rgba(232, 200, 150, 0.10), rgba(232, 200, 150, 0));
  border-radius: 0 4px 4px 0;
}
.card .foot { display: flex; gap: 8px; margin-top: 14px; flex-wrap: wrap; }
.card .foot .btn {
  flex: 1 1 auto;
  max-width: none;
  padding: 11px 12px;
  font-size: 13px;
  letter-spacing: 1px;
}

/* 关闭按钮 */
.x {
  position: absolute;
  right: 8px; top: 8px;
  width: 34px; height: 34px;
  line-height: 32px;
  text-align: center;
  font-size: 17px;
  color: rgba(240, 226, 200, 0.72);
  border: 1px solid rgba(232, 200, 150, 0.22);
  background: rgba(255, 240, 210, 0.06);
  cursor: pointer;
  border-radius: 50%;
  font-family: sans-serif;
  z-index: 2;
  transition: background 0.15s, color 0.15s, transform 0.1s;
}
.x:active { background: rgba(255, 240, 210, 0.18); color: #fff; transform: scale(0.92); }

/* ---------- 选项列表 ---------- */
.opt {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 13px 12px;
  border: 1px solid rgba(232, 200, 150, 0.14);
  background: rgba(255, 240, 210, 0.045);
  border-radius: 6px;
  margin-bottom: 7px;
  cursor: pointer;
  transition: background 0.14s, transform 0.09s, border-color 0.14s;
}
.opt:active {
  background: rgba(232, 200, 150, 0.20);
  border-color: rgba(232, 200, 150, 0.36);
  transform: scale(0.988);
}
.opt .t { font-size: 14px; color: #f0e4cc; }
.opt .t em { display: block; font-style: normal; font-size: 11px; color: rgba(232, 221, 201, 0.48); margin-top: 3px; }
.opt .p { font-size: 12px; color: #e8b46a; white-space: nowrap; font-family: "PingFang SC", "Microsoft YaHei", sans-serif; }
.opt.off { opacity: 0.4; pointer-events: none; }

.sign-wrap {
  position: relative;
  padding: 34px 12px 16px;
  background:
    radial-gradient(ellipse at 50% 0%, rgba(255, 226, 170, 0.10), rgba(255, 226, 170, 0) 70%),
    rgba(255, 240, 210, 0.05);
  border: 1px solid rgba(232, 200, 150, 0.20);
  border-radius: 8px;
  margin-bottom: 12px;
  overflow: hidden;
}
.sign-wrap::before {
  content: '';
  position: absolute;
  left: 6px; top: 6px; right: 6px; bottom: 6px;
  border: 1px solid rgba(232, 200, 150, 0.14);
  border-radius: 6px;
  pointer-events: none;
}
.sign-poem {
  display: flex;
  flex-direction: row-reverse;
  justify-content: center;
  align-items: flex-start;
  gap: 12px;
  min-width: 0;
}
.sign-poem .vs {
  writing-mode: vertical-rl;
  text-orientation: upright;
  font-family: "KaiTi", "楷体", serif;
  font-size: 19px;
  line-height: 1.18;
  letter-spacing: 5px;
  color: #f6ead2;
  text-shadow: 0 1px 8px rgba(0,0,0,.45);
  white-space: nowrap;
}
.sign-level {
  position: absolute;
  right: 10px;
  top: 10px;
  font-size: 11px;
  line-height: 1.5;
  padding: 3px 8px;
  color: #fff6e0;
  background: var(--red);
  letter-spacing: 1px;
  border-radius: 3px;
  box-shadow: 0 2px 6px rgba(0,0,0,.5);
  font-family: "SimHei", sans-serif;
  z-index: 1;
}
.sign-level.mid { background: #8a7a52; }
.sign-level.low { background: #4a4a48; }

/* ---------- 图鉴 ---------- */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(58px, 1fr));
  gap: 6px;
  margin: 10px 0;
}
.gcell {
  aspect-ratio: 1 / 1.22;
  border: 1px solid rgba(232, 200, 150, 0.18);
  background: rgba(255, 240, 210, 0.07);
  border-radius: 2px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  padding: 4px 2px;
  cursor: pointer;
  position: relative;
  overflow: hidden;
}
.gcell .ic {
  width: 22px; height: 22px;
  border-radius: 2px;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.2);
}
.gcell .nm { font-size: 9.5px; line-height: 1.15; text-align: center; color: rgba(240, 226, 200, 0.82); }
.gcell.lock .ic { background: rgba(255, 240, 210, 0.14) !important; box-shadow: none; }
.gcell.lock .nm { color: rgba(232, 221, 201, 0.38); }
.gcell.lock::after { content: '?'; position: absolute; font-size: 13px; color: #b0a48c; top: 12px; }

/* ---------- 心情/数值条 ---------- */
.bar {
  height: 7px;
  background: rgba(255, 240, 210, 0.12);
  border-radius: 1px;
  overflow: hidden;
  margin-top: 5px;
}
.bar i { display: block; height: 100%; background: linear-gradient(to right, #b8903a, #d8b45a); transition: width 0.35s; }
.statline { display: flex; align-items: center; justify-content: space-between; font-size: 12px; color: rgba(232, 221, 201, 0.72); margin-top: 9px; font-family: "SimHei", sans-serif; }

/* ---------- Toast ---------- */
#toastWrap {
  position: absolute;
  left: 0; right: 0;
  bottom: 96px;
  z-index: 60;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  pointer-events: none;
}
.toast {
  background: rgba(12, 10, 8, 0.9);
  color: #f0e6cc;
  font-size: 13px;
  padding: 8px 14px;
  border: 1px solid rgba(200, 162, 74, 0.45);
  border-radius: 2px;
  animation: toastIn 0.2s ease-out;
  max-width: 88%;
  text-align: center;
  line-height: 1.5;
  font-family: "SimHei", sans-serif;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.6);
}
@keyframes toastIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: none; }
}
.toast.out { animation: toastOut 0.3s forwards; }
@keyframes toastOut {
  to { opacity: 0; transform: translateY(-8px); }
}

/* ---------- 木鱼大按钮 ---------- */
#moktakPad {
  position: absolute;
  inset: 0;
  z-index: 15;
  display: none;
  pointer-events: auto;
}
#moktakPad.on { display: block; }
#moktakPad .pad {
  position: absolute;
  left: calc(50% - 64px);
  bottom: 27%;
  width: 128px; height: 128px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #8a6a3a, #4a2e14 70%);
  box-shadow: 0 0 0 4px rgba(200, 162, 74, 0.25), 0 8px 26px rgba(0, 0, 0, 0.8), inset 0 -6px 14px rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #f0e0b8;
  font-size: 15px;
  letter-spacing: 4px;
  cursor: pointer;
  transition: transform 0.05s;
  font-family: "KaiTi", serif;
  user-select: none;
}
#moktakPad .pad:active { transform: scale(0.94); }
#moktakPad .pad.hit { animation: hitPulse 0.18s; }
@keyframes hitPulse {
  0% { box-shadow: 0 0 0 4px rgba(200, 162, 74, 0.25), 0 0 0 0 rgba(240, 200, 120, 0.6); }
  100% { box-shadow: 0 0 0 4px rgba(200, 162, 74, 0.25), 0 0 0 42px rgba(240, 200, 120, 0); }
}
#moktakCount {
  position: absolute;
  bottom: 49%;
  left: 0; right: 0;
  text-align: center;
  color: #f0d48c;
  font-size: 14px;
  letter-spacing: 3px;
  text-shadow: 0 2px 8px #000;
  pointer-events: none;
  font-family: "KaiTi", serif;
}

/* ---------- 开场 / 拨号 ---------- */
#boot {
  position: absolute;
  inset: 0;
  z-index: 100;
  background:
    radial-gradient(ellipse 76% 62% at 50% 46%, rgba(6, 8, 13, 0.72) 0%, rgba(4, 5, 9, 0.93) 58%, rgba(3, 3, 6, 0.99) 100%),
    #05060a;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 18px;
  transition: opacity 0.6s;
  padding: 24px;
  text-align: center;
}
#boot.gone { opacity: 0; pointer-events: none; }
#bootBg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  image-rendering: pixelated;
  opacity: 0.46;
  /* 画布是 #boot 的子元素，会把父级渐变盖住，所以直接把它自己压暗 */
  filter: brightness(0.42) saturate(0.85);
  /* 关键：它是定位元素，会盖在流内元素上面并吞掉点击。
     压到内容下层 + 不接事件，否则「进入」按不动 */
  z-index: 0;
  pointer-events: none;
}
/* 开场页的文字和按钮统一浮到画布之上 */
#boot > *:not(#bootBg) {
  position: relative;
  z-index: 1;
}
#boot .brand {
  font-size: 28px;
  letter-spacing: 10px;
  color: #f0e2b8;
  font-family: "KaiTi", "楷体", serif;
  text-shadow: 0 0 26px rgba(200, 162, 74, 0.55), 0 2px 6px rgba(0, 0, 0, 0.9);
}
#boot .brand small { display: block; font-size: 11px; letter-spacing: 5px; color: #8a7a5e; margin-top: 10px; font-family: "SimHei", sans-serif; }
#boot .lines {
  font-size: 12px;
  color: #9db39d;
  line-height: 2;
  font-family: "Courier New", monospace;
  min-height: 88px;
  text-align: left;
  width: 100%;
  max-width: 320px;
  /* 照片底太花，终端窗口自己带一层墨 */
  background: rgba(3, 5, 9, 0.62);
  -webkit-backdrop-filter: blur(3px);
  backdrop-filter: blur(3px);
  border-left: 1px solid rgba(200, 162, 74, 0.34);
  border-radius: 2px;
  padding: 11px 14px;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.35), 0 10px 30px rgba(0, 0, 0, 0.45);
}
#boot .lines span { display: block; opacity: 0; animation: lineIn 0.3s forwards; }
@keyframes lineIn { to { opacity: 1; } }
#boot .enter {
  margin-top: 8px;
  padding: 15px 40px;
  -webkit-appearance: none;
  appearance: none;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  font-size: 14px;
  letter-spacing: 6px;
  color: #f6ecd2;
  background: rgba(120, 92, 34, 0.42);
  border: 1px solid rgba(214, 176, 88, 0.8);
  cursor: pointer;
  opacity: 0;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.5), 0 6px 24px rgba(0, 0, 0, 0.55),
              inset 0 1px 0 rgba(255, 240, 200, 0.22);
  transition: opacity 0.5s, background 0.2s;
  font-family: "SimHei", sans-serif;
}
#boot .enter.show { opacity: 1; pointer-events: auto; }
#boot .enter:active {
  background: rgba(200, 162, 74, 0.34);
  transform: translateY(1px) scale(0.98);
  transition-duration: 0.05s;
}
#boot .tip {
  font-size: 10.5px;
  color: #9a917c;
  letter-spacing: 1px;
  line-height: 1.9;
  max-width: 300px;
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.95);
  opacity: 0;
  transition: opacity 0.7s;
}

/* ---------- 屏幕文字层 ---------- */
#subtitle {
  position: absolute;
  left: 0; right: 0;
  bottom: 84px;
  z-index: 18;
  text-align: center;
  padding: 0 18px;
  pointer-events: none;
  opacity: 0;
}
#subtitle span {
  display: inline-block;
  font-size: 12.5px;
  line-height: 1.85;
  color: #f2e8d0;
  text-shadow: 0 2px 10px #000, 0 0 3px #000, 0 0 12px #000;
  letter-spacing: 0.5px;
  max-width: 620px;
  background: rgba(8, 10, 14, 0.42);
  padding: 6px 12px;
  border-radius: 2px;
  backdrop-filter: blur(1px);
}

/* ---------- 顶部导航小按钮 ---------- */
#topRight {
  position: absolute;
  right: 10px;
  top: 96px;
  z-index: 22;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.icon-btn {
  width: 34px; height: 34px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  color: #d8c8a0;
  background: rgba(20, 18, 14, 0.66);
  border: 1px solid rgba(200, 162, 74, 0.32);
  border-radius: 2px;
  cursor: pointer;
  font-family: "SimHei", sans-serif;
}
.icon-btn:active { background: rgba(200, 162, 74, 0.3); }

/* ---------- 分享卡片画布 ---------- */
#shareCanvas { display: none; }
.share-img { width: 100%; border: 1px solid #8a7a5e; margin-top: 8px; border-radius: 2px; }

/* ---------- 滚动条 ---------- */
.card::-webkit-scrollbar { width: 5px; }
.card::-webkit-scrollbar-thumb { background: #a89878; border-radius: 3px; }
.card::-webkit-scrollbar-track { background: rgba(0, 0, 0, 0.06); }

/* ---------- 宽屏 ---------- */
@media (min-width: 600px) {
  .card { max-width: 460px; }
  #locLabel { font-size: 14px; top: 104px; }
  .btn { font-size: 13px; padding: 10px 8px; max-width: 128px; }
  #actions { gap: 8px; padding: 20px 10px 14px; }
}

/* 横屏手机：压缩 HUD */
@media (max-height: 460px) and (orientation: landscape) {
  #hud { padding: 6px 10px 14px; }
  #locLabel { top: 60px; }
  #topRight { top: 60px; }
  #subtitle { bottom: 84px; }
  #actions { padding: 22px 10px 8px; }
  .btn { min-height: 38px; padding: 8px 12px; font-size: 12px; }
  #moktakPad .pad { width: 96px; height: 96px; font-size: 13px; }
}

/* =========================================================
   像素版补充：名字标签 / 屏幕震动 / 像素涟漪
   ========================================================= */

/* 走近某个 NPC 时，头顶浮出的名字 */
.npc-tag {
  position: absolute;
  z-index: 8;
  transform: translate(-50%, -100%);
  padding: 2px 6px;
  font-size: 10.5px;
  line-height: 1.5;
  letter-spacing: 1px;
  color: #f4e8d0;
  background: rgba(10, 8, 6, 0.78);
  border: 1px solid rgba(200, 162, 74, 0.45);
  border-radius: 2px;
  pointer-events: none;
  white-space: nowrap;
  opacity: 0;
  transition: opacity 0.22s ease;
  font-family: "SimHei", "黑体", sans-serif;
  text-shadow: 0 1px 0 #000;
}
.npc-tag::after {
  content: '';
  position: absolute;
  left: 50%;
  bottom: -4px;
  width: 0; height: 0;
  margin-left: -3px;
  border-left: 3px solid transparent;
  border-right: 3px solid transparent;
  border-top: 4px solid rgba(10, 8, 6, 0.78);
}

/* 敲木鱼、求签这类动作，画面跟着顿一下 */
@keyframes stageShake {
  0%   { transform: translate(0, 0); }
  20%  { transform: translate(-1.5px, 1px); }
  45%  { transform: translate(1.5px, -1px); }
  70%  { transform: translate(-1px, -0.5px); }
  100% { transform: translate(0, 0); }
}
#stage.shake { animation: stageShake 0.22s steps(4) both; }

/* 按钮的涟漪改成硬边的方块，跟像素画更搭 */
.ripple {
  border-radius: 0 !important;
  background: rgba(255, 246, 220, 0.55) !important;
  mix-blend-mode: screen;
  animation-timing-function: steps(5, end);
}
@keyframes rippleGo {
  from { transform: scale(0); opacity: 0.85; }
  to   { transform: scale(1); opacity: 0; }
}

/* 8bit 风的小按钮（右上角那三个） */
.icon-btn {
  image-rendering: pixelated;
  box-shadow: inset 1px 1px 0 rgba(255, 250, 230, 0.28), inset -1px -1px 0 rgba(0, 0, 0, 0.5);
}

/* =========================================================
   邀请好友 / 城里的朋友 / 出错提示
   ========================================================= */

/* 开场页整块可点，iOS 对没有 pointer 光标的非交互元素不派发 click */
#boot { cursor: pointer; }

/* 邀请链接那一条 */
.invbox {
  margin: 12px 0 6px;
  padding: 10px 12px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(232, 200, 150, 0.22);
  border-radius: 6px;
  font-family: "Courier New", monospace;
  font-size: 10.5px;
  line-height: 1.75;
  color: #a9d3a9;
  word-break: break-all;
  max-height: 76px;
  overflow: auto;
  -webkit-overflow-scrolling: touch;
}

.flist { margin-top: 4px; }
.frow {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 9px 0;
  border-bottom: 1px dashed rgba(232, 200, 150, 0.16);
}
.frow:last-child { border-bottom: 0; }
.frow .n {
  font-size: 13px;
  color: #f2e6cd;
  letter-spacing: 1px;
}
.frow .m {
  font-size: 10.5px;
  color: #9a917c;
  margin-top: 3px;
  letter-spacing: 0.5px;
}

.card h2.mini {
  font-size: 13px;
  margin-top: 16px;
  letter-spacing: 2px;
}
.card h2.mini .sub { font-size: 10px; }

/* 出错时才露的一条红带，正常玩看不到 */
#errBar {
  display: none;
  position: fixed;
  left: 0; right: 0;
  top: 0;
  z-index: 100000;
  padding: 6px 12px;
  background: rgba(150, 30, 20, 0.94);
  color: #ffe8dc;
  font: 11px/1.5 "Courier New", monospace;
  text-align: center;
  pointer-events: none;
  word-break: break-all;
}

/* 新版本 iOS 用 dvh，避开地址栏把画面顶出屏幕 */
@supports (height: 100dvh) {
  #app { width: min(100vw, calc(100dvh * 0.5714), 560px); }
}

/* =========================================================
   「去哪儿」—— 全场唯一的高亮按钮，加呼吸光晕 + 一次性指引
   ========================================================= */
.btn.map {
  background: linear-gradient(to bottom, #f7d27a 0%, #e0aa42 46%, #bd8628 100%);
  color: #3a2408;
  font-weight: bold;
  letter-spacing: 1px;
  box-shadow:
    inset 1px 1px 0 rgba(255, 249, 220, 0.98),
    inset -1px -1px 0 rgba(118, 74, 14, 0.9),
    0 2px 0 #7a4f12,
    0 3px 8px rgba(0, 0, 0, 0.55);
}
/* 用伪元素做光晕，按下时不会跟 :active 的 box-shadow 打架 */
.btn.map::before {
  content: '';
  position: absolute;
  inset: -3px;
  border-radius: 3px;
  box-shadow:
    0 0 0 1px rgba(255, 214, 130, 0.5),
    0 0 15px 2px rgba(245, 190, 80, 0.55);
  animation: mapPulse 2.5s ease-in-out infinite;
  pointer-events: none;
  z-index: -1;
}
@keyframes mapPulse {
  0%, 100% { opacity: 0.28; }
  50%      { opacity: 1; }
}
.btn.map small { color: #5c3a0e; opacity: 0.8; }

/* 指向「去哪儿」的一次性小气泡 */
#mapTip {
  position: absolute;
  z-index: 26;
  transform: translate(-50%, 0) scale(0.9);
  transform-origin: 50% 100%;
  padding: 7px 11px 8px;
  background: rgba(16, 12, 8, 0.94);
  border: 1px solid rgba(240, 200, 120, 0.6);
  border-radius: 5px;
  color: #f6e8c8;
  text-align: center;
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.32s ease, transform 0.32s cubic-bezier(0.2, 1.3, 0.4, 1);
  box-shadow: 0 6px 22px rgba(0, 0, 0, 0.6), 0 0 0 1px rgba(0, 0, 0, 0.5);
}
#mapTip.on { opacity: 1; transform: translate(-50%, 0) scale(1); }
#mapTip b {
  display: block;
  font-size: 12px;
  letter-spacing: 1px;
  color: #ffe9b0;
  font-weight: normal;
}
#mapTip span {
  display: block;
  margin-top: 2px;
  font-size: 10px;
  letter-spacing: 0.5px;
  color: #b6a888;
}
#mapTip i {
  position: absolute;
  left: calc(50% + var(--tip-dx, 0px));
  bottom: -6px;
  margin-left: -6px;
  width: 0; height: 0;
  border-left: 6px solid transparent;
  border-right: 6px solid transparent;
  border-top: 6px solid rgba(240, 200, 120, 0.6);
}
#mapTip i::after {
  content: '';
  position: absolute;
  left: -5px; top: -7px;
  width: 0; height: 0;
  border-left: 5px solid transparent;
  border-right: 5px solid transparent;
  border-top: 5px solid rgba(16, 12, 8, 0.94);
}

/* 标题里的副题：请回答 1999 */
#boot .brand em {
  display: block;
  font-style: normal;
  font-size: 15px;
  letter-spacing: 7px;
  color: #d9b678;
  margin-top: 9px;
  text-shadow: 0 0 18px rgba(200, 162, 74, 0.4), 0 1px 4px rgba(0, 0, 0, 0.9);
  font-family: "SimHei", "黑体", sans-serif;
}

/* =========================================================
   小剧场：会动的像素小景
   ========================================================= */
.cine {
  position: relative;
  margin: 10px 0 10px;
  background: #08090c;
  border: 1px solid rgba(232, 200, 150, 0.22);
  border-radius: 3px;
  overflow: hidden;
  box-shadow:
    inset 0 0 0 1px rgba(0, 0, 0, 0.6),
    0 6px 18px rgba(0, 0, 0, 0.45);
}
.cine canvas {
  display: block;
  width: 100%;
  height: auto;
  image-rendering: pixelated;
  image-rendering: -moz-crisp-edges;
  image-rendering: crisp-edges;
  -ms-interpolation-mode: nearest-neighbor;
}
.cinecap {
  min-height: 48px;
  font-size: 12.5px;
  line-height: 1.85;
  color: #e8ddc9;
  letter-spacing: 0.3px;
}
.cinecap.pop { animation: capPop 0.5s ease; }
@keyframes capPop {
  from { opacity: 0.1; transform: translateY(5px); }
  to { opacity: 1; transform: none; }
}
.cine-tag {
  position: absolute;
  left: 8px;
  top: 7px;
  z-index: 2;
  font-size: 9.5px;
  letter-spacing: 1.5px;
  padding: 2px 6px;
  color: #ffe9b0;
  background: rgba(10, 8, 6, 0.6);
  border: 1px solid rgba(232, 200, 150, 0.32);
  border-radius: 2px;
  font-family: "SimHei", "黑体", sans-serif;
  pointer-events: none;
}
.card .cinefoot { gap: 6px; }
.card .cinefoot .btn {
  flex: 1 1 28%;
  max-width: none;
  min-height: 40px;
  padding: 8px 4px;
  font-size: 11.5px;
  line-height: 1.4;
}
.card .cinefoot .btn.done { opacity: 0.45; filter: grayscale(0.45); }

/* ============ 电视里的世界（toon） ============ */
.toonbar {
  position: relative;
  height: 6px;
  margin: 8px 0 0;
  background: rgba(0, 0, 0, 0.45);
  border: 1px solid rgba(232, 200, 150, 0.22);
  border-radius: 3px;
  overflow: hidden;
}
.toonbar i {
  display: block;
  height: 100%;
  width: 0;
  background: linear-gradient(to bottom, #f7d27a, #c98f2e);
  transition: width 0.18s ease;
}
.toonbar.boss i { background: linear-gradient(to bottom, #ff9a6a, #c83a2a); }
.toonrole {
  margin-top: 6px;
  font-size: 11px;
  letter-spacing: 1px;
  color: rgba(232, 221, 201, 0.5);
}
.card .btn.dim {
  opacity: 0.4;
  filter: grayscale(0.6);
}
.pocket {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  margin: 10px 0 4px;
}
.pocket .pk {
  padding: 7px 9px;
  background: rgba(255, 245, 220, 0.05);
  border: 1px solid rgba(232, 200, 150, 0.18);
  border-radius: 3px;
}
.pocket .pk b {
  display: block;
  font-size: 12.5px;
  font-weight: normal;
  color: #f6e8c8;
}
.pocket .pk i {
  float: right;
  font-style: normal;
  font-size: 11px;
  color: #e8b46a;
}
.pocket .pk span {
  display: block;
  margin-top: 3px;
  font-size: 10.5px;
  line-height: 1.6;
  color: rgba(232, 221, 201, 0.55);
}

/* CRT 吸入 */
#crtWarp {
  position: absolute;
  inset: 0;
  z-index: 70;
  display: none;
  pointer-events: none;
}
#crtWarp.on { display: block; }
#crtWarp span {
  position: absolute;
  inset: 0;
  background: #fff;
  transform: scale(1, 0.004);
  animation: crtWarp 0.8s cubic-bezier(0.5, 0, 0.9, 0.2) forwards;
}
@keyframes crtWarp {
  0% { transform: scale(1, 0.004); opacity: 1; }
  45% { transform: scale(1, 1); opacity: 1; }
  72% { transform: scale(1, 1); opacity: 1; }
  100% { transform: scale(1, 1); opacity: 0; }
}
