* { box-sizing: border-box; margin: 0; padding: 0; }
body {
  background: #0d0f16; color: #dfe3ee;
  font-family: "Microsoft YaHei", "PingFang SC", sans-serif;
  display: flex; justify-content: center; align-items: flex-start;
  min-height: 100vh; padding: 20px;
}
.stage { display: flex; gap: 0; align-items: stretch; }

/* ---- 两侧经典石墙风格侧栏 ---- */
.side {
  width: 170px; padding: 12px 10px;
  background:
    repeating-linear-gradient(0deg, #7f7fae 0 14px, #6d6d9c 14px 16px, #8888b5 16px 30px, #75759f 30px 32px),
    #7f7fae;
  border: 3px solid #4a4a70; display: flex; flex-direction: column; gap: 8px;
  box-shadow: inset 0 0 0 2px #9d9dc4;
}
.floorTag {
  background: #3c3c5c; color: #ffd54f; font-size: 14px; font-weight: bold;
  text-align: center; padding: 7px 4px; border: 2px solid #26263c; border-radius: 3px;
}
.statBox {
  display: flex; align-items: center; gap: 6px;
  background: #c8c8dc; border: 2px solid #4a4a70; border-radius: 3px; padding: 3px 6px;
}
.statBox .txt { width: 28px; text-align: center; color: #8a91a5; font-size: 12px; flex: none; }
.statBox .ico { width: 28px; height: 28px; image-rendering: pixelated; flex: none; }
.statBox .val {
  flex: 1; background: #2c2c44; color: #fff; text-align: center;
  font-size: 15px; font-weight: bold; padding: 5px 0; border-radius: 2px;
}
.msgBox {
  flex: 1; background: #3c3c5c; border: 2px solid #26263c; border-radius: 3px;
  padding: 8px; font-size: 12px; line-height: 1.7; color: #d6d6ee;
  overflow-y: auto; max-height: 320px; min-height: 120px;
}
.msgBox div { margin-bottom: 4px; }

/* 右侧装备栏 */
.equipLabel {
  text-align: center; font-weight: bold; font-size: 15px; letter-spacing: 6px;
  padding: 4px 0; border-radius: 3px; border: 2px solid #26263c;
}
.equipLabel.red { color: #ff5252; background: #3c2c4c; }
.equipLabel.blue { color: #40c4ff; background: #2c3a5c; }
.equipBox {
  min-height: 64px; background: #565678; border: 2px solid #3a3a56; border-radius: 3px;
  display: flex; align-items: center; justify-content: center; gap: 8px;
  font-size: 14px; font-weight: bold; color: #ffd54f;
}
.equipBox .none { color: #8a8aa8; font-weight: normal; }
.equipBox canvas { width: 44px; height: 44px; image-rendering: pixelated; }
.pickBtn { padding: 7px 0; border: 2px solid #26263c; border-radius: 4px; cursor: pointer; background: #795548; color: #fff; font-size: 13px; font-family: inherit; }
.pickBtn.hidden { display: none; }
.bookBtn { padding: 7px 0; border: 2px solid #26263c; border-radius: 4px; cursor: pointer; background: #2e7d32; color: #fff; font-size: 13px; font-family: inherit; }
.bookBtn:hover { background: #43a047; }
.keysRow { display: flex; gap: 6px; }
.keyBox {
  flex: 1; text-align: center; padding: 6px 0; font-weight: bold; font-size: 15px; color: #222;
  border: 2px solid #26263c; border-radius: 3px;
}
.keyBox.y { background: #fdd835; } .keyBox.b { background: #64b5f6; } .keyBox.r { background: #ef5350; }
.settings { display: flex; flex-direction: column; gap: 5px; margin-top: 6px; }
.settings label { font-size: 13px; display: flex; align-items: center; gap: 6px; cursor: pointer; }
.settings input { accent-color: #ffd54f; }
#restart {
  padding: 8px 0; border: 2px solid #26263c; border-radius: 4px; cursor: pointer;
  background: #c62828; color: #fff; font-size: 14px; font-family: inherit;
}
#restart:hover { background: #e53935; }
.hint { font-size: 11px; color: #3c3c5c; line-height: 1.7; }

canvas#game { border: 3px solid #4a4a70; image-rendering: pixelated; }

/* ---- 覆盖层：标题 / 剧情 / 战斗 ---- */
.overlay {
  position: fixed; inset: 0; z-index: 10;
  background: rgba(0,0,0,.65);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 24px;
}
.overlay.hidden { display: none; }
#title.show { background: #26263c; }

.titleArt {
  font-size: 96px; font-weight: 900; color: #fff; letter-spacing: 18px;
  text-shadow: 4px 4px 0 #3f51b5, 8px 8px 0 #1a1a2e;
  font-family: "STXingkai", "KaiTi", "Microsoft YaHei", serif;
}
.menuBox {
  background: linear-gradient(#4a4ac0, #2c2c8c); border: 3px solid #dfe3ee;
  border-radius: 10px; padding: 18px 30px; display: flex; flex-direction: column; gap: 12px;
  box-shadow: 0 8px 30px rgba(0,0,0,.5);
}
.menuBox button {
  padding: 10px 40px; font-size: 18px; font-weight: bold; font-family: inherit;
  background: transparent; color: #fff; border: 2px solid transparent; border-radius: 6px; cursor: pointer;
}
.menuBox button:hover:not(:disabled) { border-color: #fff; background: rgba(255,255,255,.08); }
.menuBox button:disabled { color: #8a8ac8; cursor: default; }

.eventBox, .battleBox {
  width: 380px; background: #26263c; border: 3px solid #9d9dc4; border-radius: 10px;
  padding: 18px 22px; box-shadow: 0 8px 40px rgba(0,0,0,.6);
}
.eventBox h2, .battleBox h2 { font-size: 18px; color: #ffd54f; }
.battleHead { display: flex; align-items: center; gap: 14px; justify-content: center; margin-bottom: 12px; }
#bFace { width: 64px; height: 64px; image-rendering: pixelated; background: #3c3c5c; border: 2px solid #565678; flex: none; }
.bTitle { display: flex; flex-direction: column; gap: 4px; }
.bTitle h2 { margin-bottom: 0; }
#bTags { font-size: 12px; color: #ff8a80; text-align: center; }
.evBody { display: flex; gap: 14px; align-items: flex-start; }
.evBody canvas { image-rendering: pixelated; background: #3c3c5c; border: 2px solid #565678; flex: none; }
.evBody p { font-size: 14px; line-height: 1.9; color: #d6d6ee; }
#evOk {
  display: block; margin: 14px auto 0; padding: 8px 36px; font-family: inherit; font-size: 15px;
  background: #3949ab; color: #fff; border: none; border-radius: 6px; cursor: pointer;
}
#evOk:hover { background: #4a5ac9; }

.versus { display: flex; align-items: stretch; justify-content: center; gap: 52px; position: relative; }
.fighter { display: flex; flex-direction: column; align-items: center; gap: 4px; flex: 1; }
.fName { font-size: 12px; color: #8a91a5; }
.fighter canvas { image-rendering: pixelated; background: #3c3c5c; border: 2px solid #565678; border-radius: 4px; }
.fStats { width: 100%; }
.bRow { display: flex; align-items: center; gap: 5px; margin: 6px 0; font-size: 12px; }
.bLabel { width: 28px; color: #8a91a5; flex: none; text-align: right; }
.bar { flex: 1; height: 12px; background: #12141c; border-radius: 6px; overflow: hidden; border: 1px solid #2c3040; }
.fill { height: 100%; width: 100%; transition: width .25s ease; border-radius: 6px; }
.fill.mon { background: linear-gradient(90deg, #e53935, #ff7043); }
.fill.hero { background: linear-gradient(90deg, #43a047, #9ccc65); }
.fill.monAtk { background: linear-gradient(90deg, #ff7043, #ffab91); }
.fill.monDef { background: linear-gradient(90deg, #9575cd, #b39ddb); }
.fill.heroAtk { background: linear-gradient(90deg, #2e7d32, #81c784); }
.fill.heroDef { background: linear-gradient(90deg, #1565c0, #64b5f6); }
.bRow b { min-width: 40px; text-align: right; color: #fff; font-size: 12px; }
.vsMark {
  position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%) rotate(-12deg) scale(1.15);
  font-family: "STXingkai", "STCaiyun", "KaiTi", "Comic Sans MS", cursive;
  font-size: 34px; font-weight: 900; font-style: italic; top: 42%;
  color: #ffd54f; z-index: 2; pointer-events: none;
  text-shadow: 3px 3px 0 #7f1d1d, -2px -2px 0 rgba(0,0,0,.6), 0 0 18px rgba(255,213,79,.45);
  opacity: .96;
}
#bMsg { text-align: center; font-size: 13px; color: #b9c0d4; min-height: 20px; margin: 10px 0; }
.bBtns { display: flex; gap: 10px; }
.bBtns button {
  flex: 1; padding: 9px 0; border: none; border-radius: 8px; cursor: pointer;
  font-size: 14px; font-family: inherit;
}
#bFight { background: #c62828; color: #fff; }
#bFight:hover { background: #e53935; }
#bCancel { background: #3949ab; color: #fff; }
#bCancel:hover { background: #4a5ac9; }
.bBtns button:disabled { opacity: .45; cursor: default; }

/* 战斗飘字 */
.float {
  position: absolute; right: 30px; top: -2px; font-size: 15px; font-weight: bold;
  pointer-events: none; animation: floatUp .85s ease-out forwards; text-shadow: 0 1px 3px #000;
}
.float.dmg-mon { color: #ff5252; }
.float.dmg-hero { color: #ff8a80; right: auto; left: 60px; }
@keyframes floatUp {
  from { opacity: 1; transform: translateY(0); }
  to { opacity: 0; transform: translateY(-26px); }
}

#curtain {
  position: fixed; inset: 0; background: #000; opacity: 0;
  pointer-events: none; transition: opacity .6s ease; z-index: 9;
}
#curtain.on { opacity: 1; }

#evText { white-space: pre-line; }

.toast {
  position: absolute; left: 50%; bottom: 60px; transform: translateX(-50%);
  background: rgba(0,0,0,.82); color: #ffd54f; font-size: 14px; font-weight: bold;
  padding: 8px 18px; border-radius: 8px; border: 1px solid #ffd54f55;
  pointer-events: none; z-index: 5; animation: toastFade 1.4s ease-out forwards;
  white-space: nowrap;
}
@keyframes toastFade {
  0% { opacity: 0; transform: translateX(-50%) translateY(8px); }
  15% { opacity: 1; transform: translateX(-50%) translateY(0); }
  75% { opacity: 1; }
  100% { opacity: 0; transform: translateX(-50%) translateY(-6px); }
}

/* ---- 怪物手册 ---- */
.bookBox {
  width: 480px; max-width: 94vw; background: #26263c; border: 3px solid #9d9dc4; border-radius: 10px;
  padding: 16px 20px; box-shadow: 0 8px 40px rgba(0,0,0,.6);
}
.bookBox h2 { font-size: 18px; color: #ffd54f; }
.bkCount { font-size: 12px; color: #8a91a5; margin: 4px 0 10px; }
.bkList { max-height: 56vh; overflow-y: auto; display: flex; flex-direction: column; gap: 8px; }
.bkRow {
  display: flex; gap: 10px; align-items: center;
  background: #31314c; border: 2px solid #3a3a56; border-radius: 6px; padding: 6px 10px;
}
.bkRow canvas { width: 44px; height: 44px; image-rendering: pixelated; background: #3c3c5c; border: 1px solid #565678; flex: none; }
.bkRow.dead { opacity: .45; }
.bkInfo { flex: 1; min-width: 0; }
.bkName { font-size: 14px; font-weight: bold; color: #fff; }
.bkName i { font-style: normal; font-size: 12px; color: #ff8a80; margin-left: 6px; }
.bkName em { font-style: normal; font-size: 11px; color: #ffd54f; border: 1px solid rgba(255,213,79,.4); border-radius: 3px; padding: 0 5px; margin-left: 6px; }
.bkStats { font-size: 12px; color: #b9c0d4; margin-top: 3px; }
.bkCalc { font-size: 12px; margin-top: 3px; display: flex; gap: 12px; flex-wrap: wrap; }
.bkCalc .ok { color: #fff; }
.bkCalc .warn { color: #ffd54f; }
.bkCalc .bad { color: #ff5252; }
.bkCalc .crit { color: #b0bec5; }
#bkClose {
  display: block; margin: 12px auto 0; padding: 8px 36px; font-family: inherit; font-size: 15px;
  background: #3949ab; color: #fff; border: none; border-radius: 6px; cursor: pointer;
}
#bkClose:hover { background: #4a5ac9; }

/* ---- 24层魔塔增补 ---- */
.titleArt { font-size: 72px; letter-spacing: 10px; }
.val.hp { color: #ff8a80; }
.val.gold { color: #ffd54f; }
.debuffRow { min-height: 18px; font-size: 12px; color: #ff8a80; text-align: center; }
.toolBtn { padding: 8px 0; border: 2px solid #26263c; border-radius: 4px; cursor: pointer; color: #fff; font-size: 13px; font-family: inherit; }
.toolBtn.green { background: #2e7d32; }
.toolBtn.green:hover { background: #43a047; }
.toolBtn.blue { background: #1565c0; }
.toolBtn.blue:hover { background: #1e88e5; }
.flyTag { text-align: center; font-size: 11px; color: #8a91a5; }
.shopChoices { display: flex; flex-direction: column; gap: 8px; margin-top: 12px; }
.shopChoices button {
  padding: 9px 10px; border: none; border-radius: 8px; cursor: pointer;
  font-size: 13px; font-family: inherit; background: #3949ab; color: #fff; text-align: left;
}
.shopChoices button:hover { background: #4a5ac9; }
.shopChoices button.shLeave { background: #546e7a; text-align: center; }
.flyList button {
  padding: 9px 10px; border: none; border-radius: 8px; cursor: pointer;
  font-size: 14px; font-family: inherit; background: #3949ab; color: #fff;
}
.flyList button:hover:not(:disabled) { background: #4a5ac9; }
.flyList button:disabled { opacity: .4; cursor: default; }

/* ---- 电影式叙事（片头/结局） ---- */
#cinema {
  position: fixed; inset: 0; z-index: 40; background: #000;
  display: flex; align-items: center; justify-content: center;
  opacity: 1; transition: opacity 1.2s ease; cursor: pointer;
}
#cinema.hidden { display: none; }
#cinema.fadeout { opacity: 0; pointer-events: none; }
.cinText {
  max-width: 660px; padding: 0 34px; text-align: center;
  font-family: "KaiTi", "STKaiti", "Microsoft YaHei", serif;
  font-size: 23px; line-height: 2.15; letter-spacing: 4px;
  color: #d9d9e4; text-shadow: 0 0 22px rgba(150,165,255,.28);
  opacity: 0; transition: opacity .75s ease;
  white-space: pre-line;
}
.cinText.show { opacity: 1; }
.cinHint {
  position: absolute; bottom: 28px; right: 36px;
  font-size: 12px; color: #4a4a55; letter-spacing: 3px;
}

.toolBtn.amber { background: #b26a00; }
.toolBtn.amber:hover { background: #ef6c00; }
.saveRow {
  display: flex; gap: 8px; align-items: center;
  background: #31314c; border: 2px solid #3a3a56; border-radius: 6px; padding: 8px 10px;
}
.saveMeta { flex: 1; min-width: 0; }
.saveMeta .svName { font-size: 13px; font-weight: bold; color: #ffd54f; }
.saveMeta .svInfo { font-size: 12px; color: #b9c0d4; margin-top: 2px; }
.saveRow button {
  padding: 6px 12px; border: none; border-radius: 6px; cursor: pointer;
  font-size: 12px; font-family: inherit; background: #3949ab; color: #fff; flex: none;
}
.saveRow button:hover:not(:disabled) { background: #4a5ac9; }
.saveRow button.svDel { background: #6d3a3a; }
.saveRow button.svDel:hover:not(:disabled) { background: #8a4a4a; }
.saveRow button:disabled { opacity: .35; cursor: default; }

/* ---- 右上角 × 关闭钮 ---- */
.bookBox { position: relative; }
.modalX {
  position: absolute; top: 12px; right: 14px; z-index: 2;
  width: 34px; height: 34px; border-radius: 50%;
  background: #3a3a56; color: #b9c0d4; border: 2px solid #4a4a70;
  font-size: 20px; line-height: 1; font-family: inherit;
  cursor: pointer; transition: background .15s ease, color .15s ease;
}
.modalX:hover { background: #c62828; color: #fff; border-color: #26263c; }

/* ---- 存档面板即时反馈 ---- */
.savesMsg {
  min-height: 20px; margin-bottom: 6px; text-align: center;
  font-size: 13px; font-weight: bold; color: #69f0ae;
  opacity: 0; transition: opacity .35s ease;
}
.savesMsg.show { opacity: 1; }

.toolBtn.purple { background: #6a1b9a; }
.toolBtn.purple:hover { background: #8e24aa; }
.qsList button {
  padding: 10px 12px; border: none; border-radius: 8px; cursor: pointer;
  font-size: 14px; font-family: inherit; background: #3949ab; color: #fff;
}
.qsList button:hover { background: #4a5ac9; }

/* 移动端 / 桌面端各自专用的文案，靠媒体查询切换 */
.mobileOnly { display: none; }
/* 移动端专用元素（图标、短标签、标题页副文案），桌面端一律不渲染 */
.mOnly, .keyLabel, .tico, .tShort { display: none; }

/* ================================================================
   移动端 H5 适配（≤860px）—— 视觉与结构对齐微信小程序版
   配色：墨蓝底 #171d26 / 面板 #242e3b / 描边 #465365 / 金色 #d3b477
   结构：楼层+钥匙 → 主属性 4 格 → 资源 3 格 → 地图 → 最近日志 → 工具栏
   弹窗：剧情/商店/手册/楼传/存档/快捷商店从底部滑出，战斗框居中
   做法：用 display:contents 消解左右侧栏盒子，子元素排进 .stage 四列栅格，
        再用 grid-row / grid-column / order 重排。桌面端完全不进这段。
   ================================================================ */
@media (max-width: 860px) {
  body {
    display: block; padding: 0; min-height: 100%;
    background: #171d26; color: #ece6da;
    font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", sans-serif;
    -webkit-tap-highlight-color: transparent;
    -webkit-text-size-adjust: 100%;
    touch-action: manipulation;
  }
  .mOnly { display: block; }

  .stage {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 0;
    width: 100%; max-width: 560px; margin: 0 auto;
    padding: 16px 16px calc(86px + env(safe-area-inset-bottom));
    align-items: stretch;
    user-select: none; -webkit-user-select: none;
  }
  /* 侧栏盒子消解：背景/边框/宽度全部失效，子元素直接排进上面的栅格 */
  .side { display: contents; }

  /* ---------- 第 1 行：楼层标签 + 三色钥匙（钥匙带文字标签） ---------- */
  .floorTag {
    grid-row: 1; grid-column: 1 / 3;
    background: transparent; border: none; border-radius: 0;
    padding: 0; text-align: left; color: #ece6da;
    font-size: 17px; font-weight: 600;
    align-self: baseline; min-width: 0;
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  }
  .keysRow {
    grid-row: 1; grid-column: 3 / 5;
    display: flex; gap: 12px; justify-content: flex-end;
    align-self: baseline;
  }
  .keyBox {
    flex: none; background: transparent; border: none; border-radius: 0;
    padding: 0; font-size: 12px; font-weight: 400; color: #aab5c4;
  }
  /* 桌面端的三色块背景特异性更高（.keyBox.y），这里必须按类逐个压掉 */
  .keyBox.y, .keyBox.b, .keyBox.r { background: transparent; border: none; }
  .keyLabel { display: inline; margin-right: 4px; }
  .keyBox.y #ky { color: #d3b477; font-weight: 600; }
  .keyBox.b #kb { color: #86b4d8; font-weight: 600; }
  .keyBox.r #kr { color: #db9292; font-weight: 600; }

  /* ---------- 属性格：拆成「主属性 4 格」+「资源 3 格」两级 ----------
     DOM 顺序：1 楼层 2 等级 3 生命 4 攻击 5 防御 6 护盾 7 金币 8 经验 */
  .side > .statBox {
    background: transparent; border: none; border-radius: 0;
    flex-direction: column; align-items: flex-start; gap: 3px;
    padding: 14px 8px 0 0; min-width: 0; overflow: hidden;
  }
  .side > .statBox .txt { width: auto; font-size: 11px; color: #aab5c4; line-height: 1.3; }
  .side > .statBox .val {
    min-width: 0; width: 100%; background: transparent; color: #ece6da;
    font-size: 15px; font-weight: 600; line-height: 1.3;
    text-align: left; padding: 0;
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  }
  .side > .statBox .val.hp { color: #db9292; }
  /* 主属性：生命 攻击 防御 护盾 */
  .side > .statBox:nth-child(3) { grid-row: 2; grid-column: 1; }
  .side > .statBox:nth-child(4) { grid-row: 2; grid-column: 2; }
  .side > .statBox:nth-child(5) { grid-row: 2; grid-column: 3; }
  .side > .statBox:nth-child(6) { grid-row: 2; grid-column: 4; }
  /* 资源：等级 金币 经验（横排小字，与主属性同一层级下） */
  .side > .statBox:nth-child(2),
  .side > .statBox:nth-child(7),
  .side > .statBox:nth-child(8) {
    flex-direction: row; align-items: baseline; gap: 6px; padding: 10px 8px 0 0;
  }
  .side > .statBox:nth-child(2) { grid-row: 3; grid-column: 1; }
  .side > .statBox:nth-child(7) { grid-row: 3; grid-column: 2; }
  .side > .statBox:nth-child(8) { grid-row: 3; grid-column: 3; }
  .side > .statBox:nth-child(2) .val,
  .side > .statBox:nth-child(7) .val,
  .side > .statBox:nth-child(8) .val { font-size: 13px; font-weight: 600; width: auto; }

  .debuffRow {
    grid-column: 1 / -1; min-height: 0;
    font-size: 12px; color: #db9292; text-align: left; padding-top: 6px;
  }

  /* ---------- 地图 ---------- */
  .canvasWrap {
    grid-column: 1 / -1; order: 10;
    margin: 14px 0 0; display: flex; justify-content: center;
  }
  canvas#game {
    width: 100%; height: auto; max-width: min(100%, 74vh);
    border: 1px solid #465365; image-rendering: pixelated;
    touch-action: none;
  }

  /* ---------- 最近日志：单行细线，对齐小程序的 latestLog ---------- */
  .msgBox {
    grid-column: 1 / -1; order: 20;
    background: transparent; border: none; border-radius: 0;
    border-bottom: 1px solid #465365;
    max-height: 3.6em; min-height: 0; overflow-y: auto;
    margin-top: 12px; padding: 10px 2px;
    font-size: 13px; line-height: 1.7; color: #aab5c4;
  }
  .msgBox div { margin-bottom: 0; }

  /* ---------- 开关 / 重开 / 提示（轻量化，不抢主界面） ---------- */
  .settings {
    grid-column: 1 / -1; order: 30;
    flex-direction: row; flex-wrap: wrap; gap: 6px 22px; margin-top: 18px;
  }
  .settings label { font-size: 14px; color: #ece6da; padding: 4px 0; }
  .settings input { accent-color: #d3b477; transform: scale(1.2); }
  #restart {
    grid-column: 1 / -1; order: 40; margin-top: 10px;
    background: transparent; border: 1px solid #465365; border-radius: 8px;
    color: #db9292; font-size: 14px; padding: 12px 0;
  }
  .flyTag {
    grid-column: 1 / -1; order: 50;
    font-size: 12px; color: #aab5c4; text-align: left; margin-top: 14px;
  }
  .hint {
    grid-column: 1 / -1; order: 60;
    font-size: 12px; color: #aab5c4; line-height: 1.8; margin-top: 6px;
  }
  .desktopOnly { display: none; }
  .mobileOnly { display: inline; }

  /* ---------- 底部工具栏：4 个图标按钮，图标用 CSS 画 ---------- */
  #btnBook, #btnFly, #btnSaves, #btnShops {
    position: fixed; bottom: 0; z-index: 10;
    width: 25%; height: calc(64px + env(safe-area-inset-bottom));
    margin: 0; padding: 0 0 env(safe-area-inset-bottom);
    border: none; border-radius: 0;
    border-top: 1px solid #465365;
    background: rgba(23,29,38,.96);
    color: #ece6da; font-size: 12px; line-height: 1.5;
    display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 5px;
    box-shadow: none;
  }
  #btnBook  { left: 0; }
  #btnFly   { left: 25%; }
  #btnSaves { left: 50%; }
  #btnShops { left: 75%; }
  .tFull { display: none; }
  .tShort { display: block; }
  .tico {
    display: block; position: relative; width: 17px; height: 17px;
    color: #d3b477; border: 1px solid currentColor;
  }
  .icoBook { border-radius: 1px 3px 3px 1px; border-left-width: 3px; }
  .icoBook::after {
    content: ''; position: absolute; left: 3px; right: 2px; top: 4px; height: 4px;
    border-top: 1px solid currentColor; border-bottom: 1px solid currentColor;
  }
  .icoFly { border-radius: 50%; }
  .icoFly::after {
    content: ''; position: absolute; left: 5px; top: 3px; width: 4px; height: 8px;
    border: 1px solid currentColor; transform: rotate(35deg);
  }
  .icoSave::before {
    content: ''; position: absolute; left: 3px; right: 3px; top: -1px; height: 5px;
    border: 1px solid currentColor;
  }
  .icoSave::after {
    content: ''; position: absolute; left: 3px; right: 3px; bottom: 2px; height: 4px;
    border: 1px solid currentColor;
  }
  .icoShop { border-radius: 2px; }
  .icoShop::after {
    content: ''; position: absolute; left: 3px; right: 3px; top: 4px; height: 6px;
    border: 1px solid currentColor; border-top: none;
  }

  /* ---------- 弹窗：默认从底部滑出（对齐小程序的 sheetOverlay） ---------- */
  .overlay {
    gap: 0; padding: 0;
    align-items: center; justify-content: flex-end;
    background: rgba(12,17,24,.88);
  }
  .eventBox, .battleBox, .bookBox {
    width: 100%; max-width: 560px; max-height: 88vh;
    background: #242e3b;
    border: 1px solid #465365; border-top: 3px solid #d3b477;
    border-radius: 20px 20px 0 0;
    padding: 22px 22px calc(22px + env(safe-area-inset-bottom));
    box-shadow: 0 -12px 40px rgba(0,0,0,.4);
    overflow-y: auto;
  }
  .eventBox h2, .battleBox h2, .bookBox h2 {
    font-size: 19px; font-weight: 600; color: #ece6da; margin-bottom: 14px;
  }
  /* 弹窗上方的小字分类标题（对齐小程序的 panelCaption） */
  .eventBox h2::before, .battleBox h2::before, .bookBox h2::before {
    display: block; font-size: 11px; font-weight: 400;
    letter-spacing: 3px; color: #aab5c4; margin-bottom: 7px;
  }
  #event  .eventBox h2::before { content: '旅途中'; }
  #battle .battleBox h2::before { content: '遭遇战'; }
  #shop   .eventBox h2::before { content: '交易'; }
  #book   .bookBox h2::before { content: '圣光徽'; }
  #fly    .bookBox h2::before { content: '风之罗盘'; }
  #saves  .bookBox h2::before { content: '冒险进度'; }
  #qshops .bookBox h2::before { content: '补给'; }
  .bookBox { position: relative; }
  .modalX {
    top: 14px; right: 14px; width: 40px; height: 40px;
    background: transparent; border: none;
    color: #aab5c4; font-size: 26px; line-height: 1;
  }
  /* 关闭钮同时带 #bkClose / #flyClose 等 id，id 特异性更高，这里一并压掉桌面样式 */
  #bkClose, #flyClose, #savesClose {
    display: block; width: 40px; height: 40px;
    margin: 0; padding: 0; border-radius: 4px;
    background: transparent; border: none; color: #aab5c4; font-size: 26px;
  }
  #bkClose:hover, #flyClose:hover, #savesClose:hover { background: transparent; color: #ece6da; }
  .bkCount, .savesMsg { font-size: 13px; color: #aab5c4; margin: 0 0 14px; }

  /* 剧情 / 商店本体 */
  .evBody { gap: 14px; }
  .evBody canvas { width: 64px; height: 64px; background: #171d26; border: 1px solid #465365; }
  .evBody p { font-size: 15px; line-height: 1.9; color: #ece6da; }
  #evOk {
    display: block; width: 100%; margin: 18px auto 0; padding: 15px 0;
    background: #d3b477; color: #171d26; font-weight: 600; font-size: 16px; border-radius: 8px;
  }
  .bBtns { margin-top: 16px; gap: 12px; }
  .bBtns button { flex: 1; padding: 14px 10px; font-size: 15px; border-radius: 8px; }
  #evChoices { flex-direction: column; }
  #evChoices button {
    flex: none; text-align: left;
    background: #171d26; border: 1px solid #465365; color: #ece6da;
  }
  .shopChoices { gap: 12px; }
  .shopChoices button, .flyList button, .qsList button {
    background: #171d26; border: 1px solid #465365; color: #ece6da;
    border-radius: 8px; font-size: 15px; padding: 14px 16px;
  }
  .shopChoices button.shLeave { background: #171d26; color: #aab5c4; text-align: center; }

  /* 战斗框：居中（小程序里它没走 sheetOverlay） */
  #battle { align-items: center; justify-content: center; padding: 18px; }
  #battle .battleBox {
    border-radius: 10px; border-top-width: 1px;
    padding: 20px 20px calc(20px + env(safe-area-inset-bottom));
    box-shadow: 0 12px 40px rgba(0,0,0,.5);
    overflow: visible;
  }
  .versus { gap: 14px; align-items: flex-start; }
  .fighter canvas { width: 54px; height: 60px; background: #171d26; border: 1px solid #465365; }
  .fName { font-size: 12px; color: #aab5c4; }
  .vsMark { font-size: 28px; color: #d3b477; text-shadow: 2px 2px 0 #171d26; }
  .bRow { font-size: 13px; margin: 9px 0 5px; gap: 6px; }
  .bLabel { width: 28px; color: #aab5c4; }
  .bRow b { min-width: 38px; font-size: 13px; color: #ece6da; }
  .bar { height: 6px; background: #171d26; border: none; border-radius: 3px; }
  #bMsg { font-size: 14px; color: #ece6da; margin: 14px 0 0; padding: 12px; border-left: 3px solid #d3b477; background: #171d26; text-align: left; }
  #bFight { background: #d3b477; color: #171d26; font-weight: 600; }
  #bCancel { background: #171d26; color: #ece6da; border: 1px solid #465365; }
  .float { font-size: 13px; right: 16px; }
  .float.dmg-hero { left: 32px; }

  /* 怪物手册 */
  .bkList { max-height: 54vh; gap: 0; }
  .bkRow {
    background: transparent; border: none; border-radius: 0;
    border-bottom: 1px solid #465365; padding: 14px 0; gap: 14px;
  }
  .bkRow canvas { width: 40px; height: 40px; background: #171d26; border: 1px solid #465365; border-radius: 4px; }
  .bkName { font-size: 15px; color: #ece6da; }
  .bkStats, .bkCalc { font-size: 12.5px; color: #aab5c4; }
  .bkCalc .ok { color: #ece6da; }
  .bkCalc .warn { color: #d3b477; }
  .bkCalc .bad { color: #db9292; }

  /* 存档行 */
  .saveRow {
    background: transparent; border: 1px solid #465365; border-radius: 8px;
    padding: 14px; margin-bottom: 12px;
  }
  .saveMeta .svName { font-size: 15px; color: #ece6da; }
  .saveMeta .svInfo { font-size: 12.5px; color: #aab5c4; }
  .saveRow button {
    background: #171d26; border: 1px solid #465365; color: #ece6da;
    border-radius: 6px; font-size: 13px; padding: 9px 14px;
  }
  .saveRow button.svDel { background: transparent; color: #db9292; }

  /* ---------- 标题页：副标题 + 大字 + 金色横线 ---------- */
  #title.show {
    align-items: center; justify-content: center;
    background: #171d26; padding: 30px 30px calc(30px + env(safe-area-inset-bottom));
  }
  .titleEdition { font-size: 12px; letter-spacing: 4px; color: #aab5c4; text-align: center; }
  .titleArt {
    margin: 18px 0 0; font-size: 62px; font-weight: 600; letter-spacing: 14px;
    padding-left: 14px; line-height: 1.3; color: #ece6da; text-shadow: none;
    font-family: "Kaiti SC", "KaiTi", "STKaiti", "Songti SC", serif;
  }
  .titleRule { width: 32px; height: 2px; background: #d3b477; margin: 20px auto 0; }
  .titleIntro { font-size: 13px; letter-spacing: 3px; color: #aab5c4; margin-top: 16px; text-align: center; }
  .menuBox {
    width: 100%; max-width: 330px; margin-top: 46px; gap: 14px;
    background: transparent; border: none; box-shadow: none; padding: 0;
  }
  .menuBox button {
    width: 100%; padding: 16px 0; font-size: 17px; border-radius: 8px;
    background: #242e3b; color: #ece6da; border: 1px solid #465365;
  }
  #btnStart { background: #d3b477; border-color: #d3b477; color: #171d26; font-weight: 600; }
  #btnLoad:disabled { color: #aab5c4; opacity: .5; }
  .titleSub { font-size: 11px; color: #aab5c4; margin-top: 34px; text-align: center; }

  /* ---------- 电影式叙事 ---------- */
  .cinText { font-size: 16px; line-height: 2; letter-spacing: 2px; padding: 0 24px; color: #ece6da; }
  .cinHint { bottom: 26px; right: 26px; font-size: 12px; color: #aab5c4; }
}

/* 手机横屏：竖向空间紧张，继续压缩 */
@media (max-width: 860px) and (max-height: 520px) {
  .msgBox { max-height: 2.4em; }
  canvas#game { max-width: min(100%, 60vh); }
  .titleArt { font-size: 44px; }
  .menuBox { margin-top: 24px; }
  .titleIntro, .titleSub { display: none; }
}
