/* ============ 方块深空 UI · 科幻霓虹玻璃拟态 v2 ============ */
:root {
  --bg0: #04060e;
  --bg1: #0a0f1e;
  --bg2: #131f38;
  --panel: rgba(13, 20, 38, 0.82);
  --panel-solid: #0d1426;
  --border: rgba(96, 168, 255, 0.26);
  --border-strong: rgba(0, 240, 255, 0.55);
  --accent: #00f0ff;
  --accent2: #4aa8ff;
  --gold: #ffd54a;
  --text: #e0f7ff;
  --text-dim: #93aacf;
  --text-faint: #5f759e;
  --danger: #ff6a6a;
  --ok: #6fe08a;
  --warn: #ffb84a;
  --r: 14px;
  --ease-pop: cubic-bezier(0.34, 1.56, 0.64, 1);
  --num: "Consolas","SF Mono","Courier New",monospace;
}
* { margin: 0; padding: 0; box-sizing: border-box; }
html, body { width: 100%; height: 100%; overflow: hidden; background: var(--bg0); color: var(--text);
  font-family: "Microsoft YaHei","PingFang SC","Segoe UI",sans-serif; user-select: none;
  overscroll-behavior: none; touch-action: manipulation; -webkit-tap-highlight-color: transparent; }
/* 面板内容仍可滚动（touch-action 在面板内恢复 pan-y） */
.panel-inner { touch-action: pan-y; }

/* ---------- 沉浸背景：星空 + 星云光晕 ---------- */
body::before {
  content: ""; position: fixed; inset: 0; z-index: 0; pointer-events: none;
  background:
    radial-gradient(1200px 600px at 75% -10%, rgba(38, 90, 180, 0.22), transparent 60%),
    radial-gradient(900px 500px at 15% 110%, rgba(88, 44, 190, 0.16), transparent 60%),
    radial-gradient(1px 1px at 12% 22%, rgba(255,255,255,.7), transparent),
    radial-gradient(1px 1px at 33% 8%, rgba(255,255,255,.5), transparent),
    radial-gradient(2px 2px at 48% 16%, rgba(160,220,255,.8), transparent),
    radial-gradient(1px 1px at 62% 5%, rgba(255,255,255,.6), transparent),
    radial-gradient(1px 1px at 78% 18%, rgba(255,255,255,.5), transparent),
    radial-gradient(2px 2px at 88% 9%, rgba(200,240,255,.75), transparent),
    radial-gradient(1px 1px at 95% 30%, rgba(255,255,255,.4), transparent),
    radial-gradient(1px 1px at 7% 55%, rgba(255,255,255,.4), transparent),
    radial-gradient(1.5px 1.5px at 22% 70%, rgba(180,220,255,.6), transparent),
    radial-gradient(1px 1px at 40% 82%, rgba(255,255,255,.45), transparent),
    radial-gradient(2px 2px at 58% 92%, rgba(150,210,255,.6), transparent),
    radial-gradient(1px 1px at 72% 78%, rgba(255,255,255,.5), transparent),
    radial-gradient(1px 1px at 90% 88%, rgba(255,255,255,.4), transparent),
    radial-gradient(1px 1px at 50% 45%, rgba(255,255,255,.35), transparent);
}
#app { position: relative; width: 100%; height: 100%; z-index: 1; }
canvas#game { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }

.hidden { display: none !important; }

/* ---------- HUD ---------- */
#hud { position: absolute; inset: 0; pointer-events: none; z-index: 10; }
/* 热栏可点击（选中槽/背包放入物品时交互） */
#hotbar { pointer-events: auto; }

/* —— 左上：生存状态（生命/氧气），参考 Minecraft 生存 HUD —— */
#hud-top-left { position: absolute; top: 14px; left: 16px; display: flex; flex-direction: column; gap: 8px; }
#vitals {
  display: flex; flex-direction: column; gap: 5px; padding: 9px 12px;
  background: linear-gradient(180deg, rgba(14, 22, 46, .82), rgba(8, 13, 30, .86));
  border: 1px solid var(--border); border-radius: 13px;
  backdrop-filter: blur(6px); box-shadow: 0 2px 12px rgba(0,0,0,.35), inset 0 1px 0 rgba(255,255,255,.05);
  min-width: 190px;
}
.vit { display: flex; align-items: center; gap: 7px; }
.vit-ico { width: 18px; text-align: center; font-size: 14px; flex: none; }
.vit.hp .vit-ico { color: #ff6a6a; text-shadow: 0 0 8px rgba(255,80,80,.6); }
.vit.oxy .vit-ico { color: #7ad0ff; text-shadow: 0 0 8px rgba(80,190,255,.6); }
.vit-bar {
  flex: 1; height: 10px; border-radius: 6px; overflow: hidden; position: relative;
  background: rgba(30, 44, 74, .8); border: 1px solid rgba(120,170,255,.18);
}
.vit-bar i {
  display: block; height: 100%; border-radius: 6px; transition: width .25s ease;
}
.vit.hp .vit-bar i { background: linear-gradient(90deg, #ff3d5e, #ff7a6a); box-shadow: 0 0 8px rgba(255,80,90,.5); }
.vit.oxy .vit-bar i { background: linear-gradient(90deg, #2fa8ff, #7ad8ff); box-shadow: 0 0 8px rgba(80,190,255,.5); }
.vit.xp .vit-ico { color: #ffd54a; text-shadow: 0 0 8px rgba(255,213,74,.6); }
.vit.xp .vit-bar { height: 7px; }
.vit.xp .vit-bar i { background: linear-gradient(90deg, #ba7517, #ffd54a); box-shadow: 0 0 8px rgba(255,213,74,.55); }
.vit-num { width: 34px; text-align: right; font-family: var(--num); font-size: 11.5px; color: #fff; }

/* ★ 左上角下：合成快捷区（点击即合成；材料够亮 / 缺材料灰） */
#res-chips { display: flex; gap: 5px; flex-wrap: wrap; max-width: 330px; }
.craft-title { width: 100%; font-size: 10px; letter-spacing: 2px; color: #ffd54a; opacity: .8; text-shadow: 0 0 8px rgba(255,213,74,.4); }
.chip.craft { cursor: pointer; transition: border-color .15s, transform .1s; }
.chip.craft:hover { border-color: rgba(255,213,74,.55); transform: translateY(-1px); }
.chip.craft.ok { border-color: rgba(110,224,138,.4); }
.chip.craft.ok b { color: #7fe89c; text-shadow: 0 0 8px rgba(110,224,138,.5); }
.chip.craft.no { opacity: .45; }
.chip.craft.no b { color: #b4b2a9; }
.chip {
  display: flex; align-items: center; gap: 6px;
  background: linear-gradient(180deg, rgba(16, 26, 50, .82), rgba(9, 15, 32, .86));
  border: 1px solid var(--border);
  border-radius: 9px; padding: 3px 9px 3px 4px; font-size: 11.5px; color: var(--text-dim);
  backdrop-filter: blur(6px); box-shadow: 0 2px 10px rgba(0, 0, 0, .35), inset 0 1px 0 rgba(255,255,255,.05);
}
.chip .ic { width: 15px; height: 15px; border-radius: 4px; flex: none; box-shadow: inset 0 -3px 6px rgba(0,0,0,.35); }
.chip b { color: #fff; font-family: var(--num); font-size: 12px; font-weight: 700; margin-left: 1px; text-shadow: 0 0 8px rgba(120,220,255,.35); }

/* —— 右上：行星信息 + 小地图 —— */
#hud-top-right {
  position: absolute; top: 14px; right: 16px; text-align: right; font-size: 13px;
  display: flex; flex-direction: column; align-items: flex-end; gap: 8px;
}
#planet-info {
  background: linear-gradient(180deg, rgba(16, 26, 50, .85), rgba(9, 15, 32, .88));
  padding: 8px 14px; border-radius: 11px;
  border: 1px solid var(--border); backdrop-filter: blur(6px);
  box-shadow: 0 2px 14px rgba(0,0,0,.4), inset 0 1px 0 rgba(255,255,255,.05);
}
#planet-info .pi-name { font-size: 16px; font-weight: 700; color: #9fe8ff; letter-spacing: 1px; text-shadow: 0 0 14px rgba(120,220,255,.45); }
#planet-info .pi-sub { color: var(--text-dim); margin-top: 2px; font-size: 12px; }
#planet-info .pi-region { color: #ffd54a; margin-top: 4px; font-size: 12px; letter-spacing: .5px;
  background: rgba(255, 213, 74, .1); border: 1px solid rgba(255,213,74,.25); border-radius: 6px; padding: 2px 8px; display: inline-block; }
/* 图鉴计数：原来是裸文字，亮天空背景下直接看不清。
   HUD 文字的对比度必须按"最坏背景"校验（渲染器可能画任何颜色），
   所以裸文字一律加底板，而不是只加 text-shadow。 */
#dex-count {
  color: #c9e58a; font-size: 12px; letter-spacing: 1px;
  padding: 2px 8px; border-radius: 8px; white-space: nowrap;
  background: linear-gradient(180deg, rgba(14, 22, 46, .8), rgba(8, 13, 30, .86));
  border: 1px solid var(--border); backdrop-filter: blur(6px);
}

/* —— 顶部中央：任务罗盘条（目标方向 + 距离，PUBG/洛克王国风横条） —— */
#compass {
  position: absolute; top: 14px; left: 50%; transform: translateX(-50%);
  display: flex; flex-direction: column; align-items: center; gap: 4px;
}
.compass-bar {
  /* ★ 两端的 N/S/E/W 刻度用 translateX(-50%) 定位，会探出条外（实测
     scrollWidth 比 clientWidth 多 24px），而父盒 .hz-box 没有 overflow，
     内容直接溢出到屏幕外。刻度本来就该收在条内，裁掉比溢出正确。 */
  overflow: hidden;
  position: relative; width: 320px; max-width: 100%; height: 36px;
  background: rgba(10, 18, 40, .28);   /* ★ v741 透明背景（原深色渐变太实） */
  border: 1px solid rgba(140, 180, 255, .35); border-radius: 18px;
  backdrop-filter: blur(4px);
  box-shadow: 0 2px 10px rgba(0,0,0,.25);
}
/* ★ v741 虚线刻度（半透明竖虚线，指南针风） */
.compass-bar::after {
  content: ''; position: absolute; left: 8px; right: 8px; top: 26px; height: 4px;
  background: repeating-linear-gradient(90deg, rgba(255,255,255,.45) 0 1px, transparent 1px 16px);
  opacity: .5;
}
/* ★ v741 方位字母 N/E/S/W */
.compass-nsew { position: absolute; inset: 0; pointer-events: none; }
.compass-nsew span { position: absolute; top: 3px; transform: translateX(-50%);
  font-size: 11px; font-weight: 700; color: rgba(255,255,255,.85); text-shadow: 0 0 6px rgba(0,0,0,.9); }
.compass-nsew span.n { color: #ff6a5a; font-size: 13px; }
/* 中心刻度线 */
.compass-bar::before {
  content: ''; position: absolute; top: 3px; bottom: 3px; left: 50%;
  width: 1px; background: rgba(255,255,255,.28);
}
.compass-arrow {
  position: absolute; top: 1px; left: 50%; transform: translateX(-50%);
  font-size: 13px; line-height: 13px; color: #ffd54a;
  text-shadow: 0 0 8px rgba(255,213,74,.7), 0 1px 2px rgba(0,0,0,.8);
  transition: left .1s linear;
}
.compass-tag {
  position: absolute; bottom: 3px; left: 50%; transform: translateX(-50%);
  font-size: 11px; color: #ffe9a8; letter-spacing: 1px; white-space: nowrap;
  text-shadow: 0 0 6px rgba(0,0,0,.9);
}


.minimap-wrap {
  position: relative; border-radius: 12px; overflow: hidden;
  border: 1px solid rgba(120, 200, 255, .35);
  box-shadow: 0 4px 18px rgba(0,0,0,.5), 0 0 16px rgba(0,170,255,.15), inset 0 0 12px rgba(0,60,120,.25);
  background: #050a16;
}
#minimap { display: block; }
.mm-label {
  position: absolute; left: 6px; bottom: 4px; font-size: 9.5px; color: rgba(190,225,255,.75);
  letter-spacing: 1px; text-shadow: 0 0 6px rgba(0,0,0,.8);
}

#hud-bottom-left { position: absolute; bottom: 16px; left: 16px; width: 400px; }
#msg-log { display: flex; flex-direction: column; gap: 5px; }
.msg {
  background: linear-gradient(90deg, rgba(12, 20, 42, .85), rgba(9, 15, 32, .6));
  border-left: 3px solid var(--accent2);
  padding: 5px 12px; font-size: 13px; border-radius: 0 8px 8px 0;
  backdrop-filter: blur(4px); box-shadow: 0 2px 8px rgba(0,0,0,.3);
  animation: msgIn .3s var(--ease-pop);
}
.msg.good { border-color: var(--ok); } .msg.bad { border-color: var(--danger); } .msg.info { border-color: var(--warn); }
@keyframes msgIn { from { opacity: 0; transform: translateX(-12px); } to { opacity: 1; transform: none; } }

/* —— 右下：资源条（NMS 风格，紧凑图标+数量） —— */
#hud-bottom-right {
  position: absolute; bottom: 16px; right: 16px;
  display: flex; flex-direction: column; align-items: flex-end; gap: 5px;
  padding: 8px 12px; border-radius: 13px;
  background: linear-gradient(180deg, rgba(14, 22, 46, .8), rgba(8, 13, 30, .84));
  border: 1px solid var(--border); backdrop-filter: blur(6px);
  box-shadow: 0 2px 12px rgba(0,0,0,.35);
}
.res-title { font-size: 10px; color: var(--text-faint); letter-spacing: 3px; }
#res-chips-b { display: grid; grid-template-columns: repeat(4, auto); gap: 4px 12px; max-width: 100%; }
.chipb { display: flex; align-items: center; gap: 5px; font-size: 12px; color: var(--text-dim); }
.chipb .ic { width: 13px; height: 13px; border-radius: 3px; box-shadow: inset 0 -2px 4px rgba(0,0,0,.35); }
.chipb b { color: #fff; font-family: var(--num); font-size: 12px; font-weight: 600; text-shadow: 0 0 6px rgba(120,220,255,.3); }
/* ★ 资源名称标签：小号、比数量暗一档，一眼看出是哪种材料 */
.chipb .k { font-size: 10.5px; color: #9fb4d8; font-family: var(--num); }

#hud-bottom-center { position: absolute; bottom: 0; left: 50%; transform: translateX(-50%); display: flex; flex-direction: column; align-items: center; gap: 12px; padding-bottom: 14px; }
#prompt {
  position: absolute; left: 50%; bottom: 108px; transform: translateX(-50%); z-index: 10;
  font-size: 16px; font-weight: 700; color: #b8ecff; letter-spacing: 2px;
  background: linear-gradient(180deg, rgba(13, 22, 46, .88), rgba(8, 14, 30, .9));
  border: 1px solid rgba(120, 210, 255, .5);
  padding: 8px 24px; border-radius: 14px;
  box-shadow: 0 0 20px rgba(0, 210, 255, .25), inset 0 1px 0 rgba(255,255,255,.06);
  backdrop-filter: blur(6px); text-shadow: 0 0 14px rgba(120, 220, 255, .8);
  animation: pulse 1.2s ease-in-out infinite;
  pointer-events: none; white-space: nowrap;
}
@keyframes pulse { 0%, 100% { transform: scale(1); opacity: 1; } 50% { transform: scale(1.04); opacity: .88; } }

#hotbar {
  display: flex; gap: 7px; padding: 8px 10px; border-radius: 16px;
  background: linear-gradient(180deg, rgba(14, 22, 44, .88), rgba(7, 12, 26, .92));
  border: 1px solid var(--border); backdrop-filter: blur(8px);
  box-shadow: 0 8px 30px rgba(0, 0, 0, .5), inset 0 1px 0 rgba(255,255,255,.06);
}
.hb-slot {
  width: 52px; height: 52px; border-radius: 11px; position: relative;
  border: 1px solid rgba(120, 170, 255, .3);
  background: linear-gradient(180deg, rgba(26, 40, 74, .7), rgba(14, 22, 44, .8));
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  font-size: 10.5px; color: var(--text-dim);
  transition: transform .15s var(--ease-pop), border-color .15s, box-shadow .15s;
}
.hb-slot .ico { font-size: 20px; line-height: 1; filter: drop-shadow(0 2px 3px rgba(0,0,0,.5)); }
/* ★ 武器槽图标（CC0 素材 base64 内联） */
.hb-slot .wico { width: 30px; height: 30px; image-rendering: pixelated; filter: drop-shadow(0 2px 4px rgba(0,0,0,.6)); }
/* 方块色块图标（非 emoji 物品） */
.hb-slot .ico.bico {
  width: 20px; height: 20px; border-radius: 5px; flex: none;
  box-shadow: inset 0 -3px 6px rgba(0,0,0,.35), 0 1px 2px rgba(0,0,0,.4);
}
.hb-slot { cursor: pointer; }
.hb-slot:hover { border-color: var(--border-strong); }
.hb-slot .hb-nm {
  font-size: 10.5px; color: var(--text-dim); line-height: 1.1;
  max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.hb-slot .cnt { font-size: 10px; color: #fff; font-weight: 600; font-family: var(--num); }
.hb-slot .key { position: absolute; top: 3px; left: 5px; font-size: 9px; color: #7d93bd; font-family: var(--num); }
.hb-slot.active {
  border-color: var(--gold);
  box-shadow: 0 0 0 1px rgba(255, 213, 74, .25), 0 0 18px rgba(255, 213, 74, .4), inset 0 1px 0 rgba(255,255,255,.08);
  transform: translateY(-4px);
}
.hb-slot.active::after { content: ""; position: absolute; left: 7px; right: 7px; bottom: -3px; height: 2px;
  border-radius: 2px; background: linear-gradient(90deg, transparent, var(--gold), transparent); box-shadow: 0 0 8px var(--gold); }
.hb-slot.active .ico { transform: scale(1.12); }
.hb-slot.disabled { opacity: .38; filter: grayscale(.6); }

/* —— 飞船 HUD（太空模式） —— */
#ship-hud { position: absolute; inset: 0; pointer-events: none; z-index: 10; }
#ship-hud-left { position: absolute; top: 16px; left: 16px; display: flex; flex-direction: column; gap: 10px; width: 230px; }
/* ★ 能源面板不能占着右下角 —— 那里是虚拟按键的位置。
   实测（tools 里量过）：飞行态 #btn-zone 与本面板几何重叠 212×144px，
   整个按键区都被盖住。之前的做法是把 #btn-zone 整体左移 214px 躲开，
   结果按键跑到屏幕正中（interact 中心 57%、dig 56%，而屏幕中心是 50%），
   直接压住飞船和准星 —— 真机截图里就是这个现象。
   正确做法：**主操作不挪，让面板让路**。这里挪到右侧中上部。 */
#ship-hud-right { position: absolute; right: 16px; width: 250px;
  /* 夹在右上菜单键（顶）与右下动作键（底）之间。
     试过 top:50% + translateY(-50%) 垂直居中，实测与按键区还差 6px 就压上
     （重叠 186x6）—— 因为动作键在移动端是两行，高度比预想的大。
     上下都写死最稳，内容再长也不会跑到按键区里。 */
  top: calc(66px + env(safe-area-inset-top, 0px));
  bottom: calc(162px + env(safe-area-inset-bottom, 0px)); transform: none;
  overflow-y: auto; pointer-events: auto; }
.sh-block {
  background: linear-gradient(180deg, rgba(14, 22, 46, .86), rgba(8, 13, 30, .9));
  border: 1px solid var(--border); border-radius: 13px; padding: 10px 14px;
  backdrop-filter: blur(6px); box-shadow: 0 2px 14px rgba(0,0,0,.4), inset 0 1px 0 rgba(255,255,255,.05);
}
/* ★ 中文标签不能加字距。letter-spacing:3px 是给拉丁字母/数字设计的（为了
   字形分开），用在中文上会把每个字都推开 —— 真机截图里"目标行星"显示成
   "目 标 行 星"、"当前任务"显示成"当 前 任 务"，看起来像渲染故障。
   数字和拉丁字母仍保留字距（用 :lang 或直接给 .sh-val）。 */
.sh-title { font-size: 10.5px; color: var(--text-faint); letter-spacing: 0; margin-bottom: 5px; }
/* 只给纯西文内容加字距（英文 UI / 缩写） */
.sh-title:lang(en), .sh-title[data-ws="1"] { letter-spacing: 1.5px; }
.sh-val { font-size: 17px; font-weight: 700; color: #9fe8ff; text-shadow: 0 0 12px rgba(120,220,255,.4); }
.sh-sub { font-size: 12px; color: var(--text-dim); margin-top: 2px; }

/* —— 对战 HUD（生物对战模式） —— */
#combat-hud { position: absolute; inset: 0; pointer-events: none; z-index: 12; }
/* ★ 背景氛围：底部深蓝半透明渐变衬托面板（战斗时场景保持可见） */
#combat-hud::before { content: ""; position: absolute; inset: 0; pointer-events: none;
  background: linear-gradient(180deg, rgba(6,10,28,0) 32%, rgba(6,10,28,.2) 55%, rgba(5,9,24,.58) 100%); }
/* ★ 伤害飘字容器（main.js 投影屏幕坐标 → DOM 绝对定位） */
#c-fx { position: absolute; inset: 0; overflow: visible; pointer-events: none; }
.c-float { position: absolute; transform: translate(-50%, -100%); font-size: 22px; font-weight: 900;
  font-family: var(--num); color: #fff; white-space: nowrap; pointer-events: none;
  text-shadow: 0 0 6px rgba(0,0,0,.9), 0 2px 0 rgba(0,0,0,.8), 0 0 16px rgba(255,140,60,.55);
  animation: floatUp 1.25s ease-out forwards; }
@keyframes floatUp { 0% { opacity: 0; transform: translate(-50%, -80%) scale(.6); }
  15% { opacity: 1; transform: translate(-50%, -115%) scale(1.18); }
  30% { transform: translate(-50%, -135%) scale(1); }
  75% { opacity: 1; } 100% { opacity: 0; transform: translate(-50%, -240%) scale(1.06); } }
/* ★ 出场横幅：金色大字缩放淡入 → 淡出（赛尔号"野生 XX 出现了！"） */
#c-banner { position: absolute; top: 30%; left: 50%; transform: translate(-50%, -50%) scale(.5);
  font-size: clamp(26px, 4.2vw, 40px); font-weight: 900; letter-spacing: 4px; white-space: nowrap;
  color: #ffe9a0; opacity: 0; pointer-events: none;
  text-shadow: 0 0 16px rgba(255,200,80,.95), 0 0 44px rgba(255,150,40,.7), 0 3px 0 rgba(110,62,0,.7);
  -webkit-text-stroke: 1px #8a5a00; }
#c-banner.show { animation: cBanner 2.4s ease-in-out forwards; }
@keyframes cBanner { 0% { opacity: 0; transform: translate(-50%, -50%) scale(.4); }
  10% { opacity: 1; transform: translate(-50%, -50%) scale(1.1); }
  18% { transform: translate(-50%, -50%) scale(1); }
  78% { opacity: 1; } 100% { opacity: 0; transform: translate(-50%, -50%) scale(1.05); } }
/* ★ 赛尔号式左右出战卡：头像 + 名字/等级 + 血条横排（左=我方绿，右=敌方红） */
.cbar { position: absolute; width: min(420px, 34vw); display: flex; align-items: center; gap: 10px; }
.cbar.enemy { top: 22px; right: 2.5%; flex-direction: row-reverse; }
.cbar.pet { top: 22px; left: 2.5%; }
.c-avatar { width: 48px; height: 48px; flex-shrink: 0; border-radius: 12px; overflow: hidden; position: relative;
  background: linear-gradient(180deg, rgba(18,30,60,.92), rgba(8,14,32,.92));
  border: 2px solid #7ec8ff; box-shadow: 0 2px 12px rgba(0,0,0,.55), inset 0 0 10px rgba(0,0,0,.5); }
.c-avatar img { width: 100%; height: 100%; object-fit: contain; image-rendering: pixelated; }
.c-ava-fb { position: absolute; inset: 4px; border-radius: 9px; display: flex; align-items: center; justify-content: center;
  font-size: 22px; font-weight: 900; color: #fff; text-shadow: 0 2px 4px rgba(0,0,0,.6); }
.c-info { flex: 1; min-width: 0; }
.cname { font-size: 13px; color: #cfe6ff; letter-spacing: 1px; margin-bottom: 4px; display: flex; align-items: center;
  gap: 8px; text-shadow: 0 0 8px rgba(120,200,255,.5); white-space: nowrap; }
.cbar.enemy .cname { justify-content: flex-end; }
.clv { font-size: 11px; color: #ffd54a; font-family: var(--num); background: rgba(255,213,74,.12);
  border: 1px solid rgba(255,213,74,.4); border-radius: 6px; padding: 0 7px; line-height: 16px; }
.cbar-bg { height: 16px; border-radius: 8px; background: rgba(10, 16, 34, .78); border: 1px solid rgba(120,170,255,.3);
  overflow: hidden; box-shadow: 0 2px 10px rgba(0,0,0,.4); position: relative; }
.cbar-bg::after { content: ""; position: absolute; left: 3px; right: 3px; top: 2px; height: 4px; border-radius: 3px;
  background: rgba(255,255,255,.22); }
.cbar-bg i { display: block; height: 100%; width: 100%; transition: width .18s; }
.cbar.enemy .cbar-bg i { background: linear-gradient(90deg, #e24b4a, #ff8a5a); box-shadow: 0 0 10px rgba(226,75,74,.5); }
.cbar.enemy .cbar-bg i.low { background: linear-gradient(90deg, #ff2a1a, #ff5a3a); box-shadow: 0 0 18px rgba(255,40,20,.9); animation: hpflash .6s infinite; }
@keyframes hpflash { 0%,100% { opacity: 1; } 50% { opacity: .55; } }
.cbar.pet .cbar-bg i { background: linear-gradient(90deg, #1d9e75, #6fe08a); box-shadow: 0 0 10px rgba(29,158,117,.5); }
.cnum { font-size: 13px; color: #dfeeff; text-align: center; font-family: var(--num); margin-top: 3px; text-shadow: 0 1px 3px rgba(0,0,0,.8); }
.cbar.enemy .cnum { text-align: right; }
.chint { position: absolute; bottom: 150px; left: 50%; transform: translateX(-50%);
  font-size: 12px; color: #9fe8ff; letter-spacing: 1px; text-align: center;
  background: rgba(10, 16, 34, .7); border: 1px solid rgba(120,210,255,.3); border-radius: 10px; padding: 6px 18px;
  backdrop-filter: blur(5px); }
/* ★ 对话式战斗日志：角色名 + 气泡（我方蓝/敌方红/系统金，新条目滑入） */
#c-log { position: absolute; top: 150px; left: 50%; transform: translateX(-50%); width: 540px;
  display: flex; flex-direction: column; align-items: center; gap: 5px; pointer-events: none; }
.cl { display: flex; align-items: center; gap: 6px; max-width: 100%; }
.cl-name { font-size: 12px; font-weight: 700; flex-shrink: 0; letter-spacing: 1px; }
.cl-pet .cl-name { color: #6fd8ff; text-shadow: 0 0 8px rgba(90,180,255,.6); }
.cl-enemy .cl-name { color: #ff6a6a; text-shadow: 0 0 8px rgba(255,90,90,.6); }
.cl-sys .cl-name { color: #ffd54a; }
.cl-bubble { font-size: 12px; color: #eaf4ff; letter-spacing: .5px; background: rgba(10, 18, 40, .6);
  border: 1px solid rgba(120,170,255,.28); border-radius: 11px; padding: 4px 12px; backdrop-filter: blur(4px);
  box-shadow: 0 2px 8px rgba(0,0,0,.35); }
.cl-sys .cl-bubble { color: #ffe9a0; border-color: rgba(255,213,74,.45); background: rgba(40,32,10,.45); }
.cl:last-child .cl-bubble { animation: logIn .3s ease-out; }
@keyframes logIn { from { opacity: 0; transform: translateY(8px) scale(.94); } to { opacity: 1; transform: none; } }
/* ★ 回合制指令面板（赛尔号风） */
#c-menu { position: absolute; bottom: 34px; left: 50%; transform: translateX(-50%); width: 540px;
  display: flex; gap: 12px; align-items: flex-end; pointer-events: auto; }
#c-skills { flex: 1; display: grid; grid-template-columns: repeat(2, 1fr); gap: 6px; }
.c-skill { position: relative; background: linear-gradient(180deg, rgba(16,26,52,.9), rgba(10,16,36,.9));
  border: 1px solid rgba(120,170,255,.35); border-left: 4px solid var(--ec, #7ec8ff); border-radius: 8px;
  padding: 6px 10px; color: #eaf4ff; font-size: 13px; text-align: left; cursor: pointer;
  transition: all .15s; backdrop-filter: blur(5px); overflow: hidden; }
.c-skill::after { content: ""; position: absolute; inset: 0 0 auto 0; height: 50%;
  background: linear-gradient(180deg, rgba(255,255,255,.07), transparent); pointer-events: none; }
.c-skill:hover { border-color: #7ec8ff; background: linear-gradient(180deg, rgba(30,52,100,.95), rgba(16,26,54,.95));
  transform: translateY(-2px); box-shadow: 0 4px 14px rgba(0,0,0,.4), 0 0 10px rgba(90,170,255,.25); }
.c-skill .sk-name { font-weight: bold; }
.c-skill .sk-sub { font-size: 10px; color: #9fc4e8; margin-top: 2px; }
#c-actions { display: flex; flex-direction: column; gap: 7px; }
.c-btn { display: flex; align-items: center; gap: 8px; border-radius: 9px; color: #fff; font-size: 14px; font-weight: 700;
  padding: 9px 16px; cursor: pointer; border: 1px solid rgba(255,255,255,.18); letter-spacing: 1px;
  box-shadow: 0 3px 10px rgba(0,0,0,.45), inset 0 1px 0 rgba(255,255,255,.22); transition: all .15s; }
.c-btn i { font-style: normal; font-size: 16px; }
.c-btn:hover { transform: translateY(-2px) scale(1.03); filter: brightness(1.18); }
.c-btn:active { transform: translateY(0) scale(.97); }
.c-btn-swap { background: linear-gradient(180deg, #3d8be8, #1c54a8); text-shadow: 0 1px 2px rgba(0,0,0,.5); }
.c-btn-catch { background: linear-gradient(180deg, #e8554f, #a62825); text-shadow: 0 1px 2px rgba(0,0,0,.5); }
.c-btn-run { background: linear-gradient(180deg, #6a7484, #3c4350); text-shadow: 0 1px 2px rgba(0,0,0,.5); }
#c-actions .c-btn { min-width: 122px; }
.c-skill.pp-out { opacity: .45; cursor: not-allowed; }
.c-skill.empty { opacity: .45; cursor: default; }
/* ★ 换宠面板 */
#c-swap-panel { position: absolute; bottom: 130px; left: 50%; transform: translateX(-50%);
  background: rgba(8, 14, 32, .92); border: 1px solid rgba(120,170,255,.4); border-radius: 14px;
  padding: 14px 16px; width: 560px; backdrop-filter: blur(8px); pointer-events: auto;
  box-shadow: 0 8px 32px rgba(0,0,0,.6); }
.csp-title { font-size: 13px; color: #9fc8f0; letter-spacing: 1px; margin-bottom: 10px; text-align: center; }
#c-swap-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-bottom: 10px; }
.csp-slot { background: rgba(24, 38, 70, .6); border: 1px solid var(--border); border-radius: 10px;
  padding: 8px 10px; cursor: pointer; text-align: center; transition: all .15s; }
.csp-slot:hover { border-color: #7ec8ff; transform: translateY(-2px); }
.csp-slot.active { border-color: #ffd54a; box-shadow: 0 0 12px rgba(255,213,74,.3); }
.csp-slot.dead { opacity: .4; cursor: not-allowed; }
.csp-ava { width: 34px; height: 34px; border-radius: 8px; object-fit: contain; image-rendering: pixelated;
  margin: 0 auto 5px; display: block; background: rgba(20,30,60,.5); border: 1px solid rgba(120,170,255,.3); }
.csp-name { font-size: 13px; font-weight: 700; color: #fff; }
.csp-lv { font-size: 11px; color: #9fc4e8; margin: 2px 0; }
.csp-bar { height: 6px; border-radius: 3px; background: rgba(255,255,255,.15); overflow: hidden; }
.csp-bar i { display: block; height: 100%; background: linear-gradient(90deg, #1d9e75, #6fe08a); }
.csp-st { font-size: 10px; color: #7d93bd; margin-top: 3px; }
.csp-cancel { display: block; margin: 0 auto; }
/* ★ v72.3 开发者控制台 */
#dev-panel { position: absolute; top: 12px; right: 12px; width: 380px; z-index: 999;
  background: rgba(6, 10, 24, .94); border: 1px solid rgba(255, 200, 80, .5); border-radius: 12px;
  padding: 12px 14px; backdrop-filter: blur(8px); box-shadow: 0 8px 32px rgba(0,0,0,.7); }
.dev-title { font-size: 13px; color: #ffd54a; font-weight: 700; margin-bottom: 8px; }
.dev-hint { font-size: 11px; color: #7d93bd; font-weight: 400; }
.dev-sec { margin-bottom: 8px; }
.dev-sec-t { font-size: 11px; color: #9fc8f0; margin-bottom: 4px; letter-spacing: 1px; }
.dev-row { display: flex; gap: 6px; flex-wrap: wrap; }
.dev-btn { background: rgba(40, 60, 110, .8); border: 1px solid rgba(120,170,255,.35); color: #cfe4ff;
  border-radius: 8px; padding: 5px 10px; font-size: 12px; cursor: pointer; transition: all .15s; }
.dev-btn:hover { background: rgba(70, 100, 170, .9); transform: translateY(-1px); }
#dev-panel select, #dev-panel input { background: rgba(20, 32, 60, .9); color: #cfe4ff; border: 1px solid rgba(120,170,255,.35);
  border-radius: 6px; padding: 4px 6px; font-size: 12px; }
#dev-panel input { width: 60px; }
.dev-state { margin-top: 8px; padding-top: 8px; border-top: 1px dashed rgba(120,170,255,.25);
  font-size: 11px; color: #7d93bd; word-break: break-all; }
.chit { font-size: 13px; color: #fff; text-align: center; text-shadow: 0 0 10px rgba(255,180,80,.8); }
.sh-row { display: flex; justify-content: space-between; font-size: 13px; color: var(--text-dim); margin: 3px 0; }
.sh-row b { color: #fff; font-family: var(--num); }
.sh-bar { height: 12px; border-radius: 7px; overflow: hidden; background: rgba(30, 44, 74, .8); border: 1px solid rgba(120,170,255,.18); margin: 5px 0 2px; }
.sh-bar i { display: block; height: 100%; border-radius: 7px; transition: width .2s ease; }
.sh-bar.fuel i { background: linear-gradient(90deg, #ff8c3a, #ffd06a); box-shadow: 0 0 8px rgba(255,160,60,.5); }
.sh-bar.wpn i { background: linear-gradient(90deg, #4aa8ff, #8fe8ff); box-shadow: 0 0 8px rgba(80,190,255,.5); }
/* ★ v769 护盾条（蓝色发光，飞船 2 级解锁） */
.sh-bar.sld i { background: linear-gradient(90deg, #2e7bff, #7fd4ff); box-shadow: 0 0 10px rgba(80,180,255,.65); }
.sh-caption { display: flex; justify-content: space-between; font-size: 11px; color: var(--text-faint); font-family: var(--num); }
.sh-caption b { color: #cfdfff; }
.sh-hint { text-align: right; font-size: 11px; color: var(--text-faint); margin-top: 6px; letter-spacing: 1px; }

#crosshair { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); width: 30px; height: 30px; z-index: 10; pointer-events: none; }
#crosshair::before, #crosshair::after { content: ""; position: absolute; background: rgba(255,255,255,.85); box-shadow: 0 0 6px rgba(120,220,255,.9); }
#crosshair::before { left: 50%; top: 0; width: 2px; height: 9px; transform: translateX(-50%); }
#crosshair::after { top: 50%; left: 0; height: 2px; width: 9px; transform: translateY(-50%); }
#crosshair .dot { position: absolute; left: 50%; top: 50%; width: 5px; height: 5px; transform: translate(-50%, -50%); background: #fff; border-radius: 50%; box-shadow: 0 0 8px rgba(255,255,255,.9); }
#crosshair .dot.capture { background: var(--gold); width: 12px; height: 12px; box-shadow: 0 0 16px rgba(255,213,74,1); }
/* ★ 准星被遮挡（角色身体/近墙挡视线）→ 变红提示（刺激战场式红叉） */
#crosshair .dot.occluded { background: #ff3d3d; width: 13px; height: 13px; box-shadow: 0 0 18px rgba(255,61,61,1); }
#crosshair.occluded::before, #crosshair.occluded::after { background: #ff3d3d; box-shadow: 0 0 6px rgba(255,61,61,.9); }

#nameplate {
  position: absolute; transform: translate(-50%, -100%);
  background: linear-gradient(180deg, rgba(20, 30, 58, .92), rgba(10, 16, 34, .95));
  border: 1px solid rgba(255, 213, 74, .55); color: var(--gold); font-size: 13px; font-weight: 600;
  padding: 4px 12px; border-radius: 10px; white-space: nowrap; pointer-events: none;
  box-shadow: 0 4px 16px rgba(0,0,0,.5), 0 0 14px rgba(255,213,74,.2);
}
#nameplate .sub { display: block; font-size: 11px; color: var(--text-dim); font-weight: 400; }

#progress-ring { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); width: 46px; height: 46px; border-radius: 50%;
  border: 3px solid rgba(255,255,255,.2); border-top-color: var(--gold);
  box-shadow: 0 0 18px rgba(255,213,74,.25); animation: spin .6s linear infinite; }
@keyframes spin { to { transform: translate(-50%, -50%) rotate(360deg); } }

/* ---------- 转场 ---------- */
.fade { position: absolute; inset: 0; z-index: 40; background: #000; opacity: 0; pointer-events: none; transition: opacity .45s ease; }
.fade.no-trans { transition: none !important; }
.fade.show { opacity: 1; pointer-events: auto; }
#flash { z-index: 41; transition: opacity .15s ease; background: radial-gradient(circle, rgba(255,255,255,.92), rgba(120,200,255,.4) 40%, transparent 70%); }

/* ---------- 跃迁 ---------- */
#overlay-warp { position: absolute; inset: 0; z-index: 38;
  background: radial-gradient(ellipse at center, #0a1030 0%, var(--bg0) 100%);
  display: flex; align-items: center; justify-content: center; }
.warp-streaks { position: absolute; inset: -20%;
  background-image: repeating-linear-gradient(90deg, transparent 0 22px, rgba(160,210,255,.35) 22px 24px);
  animation: warpMove .25s linear infinite; opacity: .8; }
@keyframes warpMove { from { transform: translateX(0); } to { transform: translateX(48px); } }
#warp-label { position: relative; font-size: 26px; font-weight: 700; color: #9fe8ff; letter-spacing: 6px;
  text-shadow: 0 0 24px rgba(120,220,255,.9); animation: pulse 1s infinite; }

/* ---------- 面板（玻璃拟态 + 开合动画） ---------- */
.panel {
  position: absolute; inset: 0; z-index: 30;
  display: flex; align-items: center; justify-content: center;
  background: rgba(3, 7, 16, .58); backdrop-filter: blur(8px);
  opacity: 0; pointer-events: none; transition: opacity .22s ease;
}
.panel.open { opacity: 1; pointer-events: auto; }
.panel.center .panel-inner { width: 660px; }
#panel-pause .panel-inner { width: 460px; }
#panel-settings .panel-inner { width: 640px; }
.panel-inner {
  position: relative;
  background: linear-gradient(165deg, rgba(17, 27, 52, .94), rgba(8, 13, 30, .97));
  border: 1px solid var(--border); border-radius: 20px;
  /* iOS Safari 的 100vh 含地址栏高度（= 地址栏收起时的大视口），
     面板底部会被推出可见区。三级回退：dvh 跟随当前可见视口 → svh 最保守 → vh 兜底。 */
  padding: 24px 28px; max-height: 88dvh; max-height: 88svh; max-height: 88vh; overflow: auto;
  box-shadow: 0 24px 80px rgba(0, 0, 0, .6), 0 0 46px rgba(0, 150, 255, .14), inset 0 1px 0 rgba(255,255,255,.07);
  transform: scale(.93) translateY(16px); opacity: 0;
  transition: transform .32s var(--ease-pop), opacity .24s ease;
}
.panel.open .panel-inner { transform: none; opacity: 1; }
.panel-inner::before {
  content: ""; position: absolute; top: 0; left: 8%; right: 8%; height: 1px;
  background: linear-gradient(90deg, transparent, rgba(0, 240, 255, .7), transparent);
  box-shadow: 0 0 12px rgba(0, 240, 255, .5);
}
.panel-inner.wide { width: 860px; }
.panel-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; }
.panel-title { font-size: 20px; font-weight: 700; letter-spacing: 2px; color: #9fe8ff; text-shadow: 0 0 14px rgba(120,220,255,.35); }
.btn-close {
  background: rgba(50, 80, 140, .3); border: 1px solid var(--border); color: #cfdfff;
  font-size: 15px; width: 44px; height: 44px; border-radius: 10px; cursor: pointer;
  transition: all .15s;
}
.btn-close:hover { background: rgba(255, 106, 106, .3); border-color: var(--danger); box-shadow: 0 0 12px rgba(255,106,106,.4); }
.panel-body { display: flex; gap: 20px; }
/* 纵向面板：暂停/设置/飞船按钮与内容竖排，避免横向挤压 */
#panel-pause .panel-body, #panel-settings .panel-body, #panel-ship .panel-body, #panel-station .panel-body { flex-direction: column; }
.panel-foot { margin-top: 16px; font-size: 12px; color: var(--text-faint); text-align: center; letter-spacing: .5px; }

/* ---------- 空间站补给面板（v760） ---------- */
#panel-station .panel-inner { width: 560px; }
#panel-station .station-name { font-size: 17px; font-weight: 700; color: #fff; letter-spacing: 1px; }
#panel-station .station-sys { font-size: 12px; color: var(--text-dim); margin: 3px 0 10px; letter-spacing: .5px; }
#panel-station .station-res-bar {
  font-size: 13px; color: #b9cbe8; letter-spacing: .5px;
  background: rgba(22, 36, 66, .45); border: 1px solid rgba(120, 170, 255, .15);
  padding: 8px 12px; border-radius: 9px; margin-bottom: 12px;
}
#panel-station .station-res-bar b { color: #fff; font-family: var(--num); }

/* ---------- 按钮 ---------- */
button { font-family: inherit; cursor: pointer; }

/* ============================================================
   ★★ 移动端触控下限 44px —— Apple HIG 硬底线
   ----------------------------------------------------------
   tools/ui_audit.js 全站审计查出（三个视口一致）：
     · .btn-close      41×41  （CSS 写的是 34px）
     · .btn-plain      41px   （padding:11px + 14px 字号 + 行高）
     · .btn-danger     41px   （同上）
     · .btn-small      ~32px  （padding:7px + 13px）
     · 星图 tab       41px
     · input           31~38px（#api-key 31 / #inv-search 38）
     · #rival-avatar   80×32
   HIG 原文：iOS/iPadOS 默认控件尺寸 44×44pt；"a button needs a hit region
   of at least 44x44 points"；并且强调**间距与尺寸同等重要**，无边框元素
   周围约 24pt、约 12pt padding。

   与其逐条去改每个规则（漏一处就复发，而且新加的按钮照样不达标），
   不如在按钮基线之后统一抬地板 —— 后续任何新按钮自动继承。
   面板有 max-height:88dvh + overflow:auto，按钮变高不会撑破，只会滚动。
   ============================================================ */
button, .btn, .btn-primary, .btn-plain, .btn-danger, .btn-small,
.m-row, .tab, .st-btn, .btn-dex-fight,
input, select, textarea, .opt-seg button, .seg button {
  min-height: 44px;
}
/* 圆形图标按钮要同时保证宽度 */
.t-btn, .btn-close, #rival-avatar, .icon-btn { min-width: 44px; }
.btn-primary {
  position: relative; overflow: hidden; display: block; width: 100%; margin: 9px 0;
  padding: 13px 22px; font-size: 17px; font-weight: 700; letter-spacing: 3px;
  color: #03101f;
  background: linear-gradient(180deg, #8fe8ff, #2fa8ff 60%, #1a86e8);
  border: none; border-radius: 12px;
  box-shadow: 0 3px 14px rgba(47, 168, 255, .32), inset 0 1px 0 rgba(255,255,255,.45);
  transition: transform .15s var(--ease-pop), box-shadow .15s, filter .15s;
}
.btn-primary:hover { filter: brightness(1.08); transform: translateY(-2px); box-shadow: 0 6px 22px rgba(0, 210, 255, .38), inset 0 1px 0 rgba(255,255,255,.5); }
.btn-primary:active { transform: translateY(0); }
.btn-primary:disabled { background: #2c3a58; color: #7d93bd; box-shadow: none; cursor: not-allowed; transform: none; filter: none; }
.btn-primary::after {
  content: ""; position: absolute; top: 0; left: -80%; width: 50%; height: 100%;
  background: linear-gradient(100deg, transparent, rgba(255,255,255,.5), transparent);
  transform: skewX(-20deg); transition: left .5s ease;
}
.btn-primary:hover::after { left: 130%; }
.btn-plain {
  display: block; width: 100%; margin: 7px 0; padding: 11px 18px; font-size: 14px; letter-spacing: 1px;
  color: #a8d8ff;
  background: linear-gradient(180deg, rgba(40, 66, 116, .35), rgba(22, 38, 70, .35));
  border: 1px solid var(--border); border-radius: 12px;
  transition: all .15s;
}
.btn-plain:hover { background: rgba(40, 66, 116, .55); border-color: var(--border-strong); box-shadow: 0 0 14px rgba(0,210,255,.18); }
.btn-danger {
  display: block; width: 100%; margin: 10px 0 0; padding: 11px 18px; font-size: 14px;
  color: #ffb8b8;
  background: linear-gradient(180deg, rgba(140, 36, 44, .4), rgba(90, 22, 30, .4));
  border: 1px solid rgba(255, 106, 106, .5); border-radius: 12px; transition: all .15s;
}
.btn-danger:hover { background: rgba(160, 44, 52, .55); box-shadow: 0 0 16px rgba(255,106,106,.35); }
.btn-small {
  display: inline-block; margin: 4px; padding: 7px 16px; font-size: 13px; font-weight: 600;
  color: #03101f;
  background: linear-gradient(180deg, #8fe8ff, #2fa8ff); border: none; border-radius: 9px;
  box-shadow: 0 2px 8px rgba(47,168,255,.35);
  transition: all .15s;
}
.btn-small:hover { filter: brightness(1.12); }
.btn-small:disabled { background: #2c3a58; color: #7d93bd; cursor: not-allowed; box-shadow: none; }

/* ---------- 主菜单 ---------- */
.game-title {
  font-size: 62px; font-weight: 900; text-align: center; letter-spacing: 12px; margin-top: 8px;
  background: linear-gradient(180deg, #d8f8ff, #5fc8ff 45%, #9a7bff);
  -webkit-background-clip: text; background-clip: text; color: transparent;
  filter: drop-shadow(0 0 22px rgba(80, 190, 255, .45));
  animation: titleGlow 3s ease-in-out infinite;
}
@keyframes titleGlow { 0%, 100% { filter: drop-shadow(0 0 18px rgba(80,190,255,.35)); } 50% { filter: drop-shadow(0 0 30px rgba(80,220,255,.6)); } }
.game-subtitle { text-align: center; color: var(--text-dim); font-size: 14px; letter-spacing: 4px; margin: 10px 0 20px; }
#start-btns { width: 330px; margin: 0 auto; }
.footer-tip { margin-top: 22px; text-align: center; font-size: 12px; color: var(--text-faint); letter-spacing: 1px; }
.version-tag { position: absolute; right: 16px; bottom: 12px; font-size: 10.5px; color: rgba(120,160,220,.45); font-family: var(--num); letter-spacing: 1px; }
#howto-box, #howto-box-pause { margin-top: 16px; background: rgba(20, 34, 64, .45); border: 1px solid var(--border); border-radius: 12px; padding: 14px 18px; font-size: 13px; line-height: 2; color: #b9cbe8; }
#howto-box h3 { color: #9fe8ff; margin-bottom: 6px; }
#howto-text table { width: 100%; border-collapse: collapse; }
#howto-text td { padding: 2px 8px; }
#howto-text td:first-child { color: var(--gold); width: 140px; white-space: nowrap; font-family: var(--num); font-size: 12px; }

/* ---------- 设置面板 ---------- */
.settings-block { margin-bottom: 18px; padding-bottom: 14px; border-bottom: 1px solid rgba(120,170,255,.12); }
.settings-block:last-of-type { border-bottom: none; margin-bottom: 0; padding-bottom: 0; }
.settings-block h4 { font-size: 13px; color: #9fe8ff; letter-spacing: 2px; margin-bottom: 10px;
  padding-bottom: 5px; border-bottom: 1px solid rgba(120,170,255,.15); }
.opt-row { display: flex; align-items: center; gap: 14px; margin: 12px 0; font-size: 14px; color: #c3d3ec; }
.opt-row .lbl { width: 88px; flex: none; color: var(--text-dim); }
.opt-row input[type=range] { flex: 1; accent-color: var(--accent2); height: 4px; }
.opt-row select, .opt-row .seg { flex: 1; }
.seg { display: flex; gap: 6px; }
.seg button {
  flex: 1; padding: 8px 6px; font-size: 13px; color: var(--text-dim);
  background: rgba(24, 38, 68, .5); border: 1px solid var(--border); border-radius: 9px; transition: all .15s;
}
.seg button.on { color: #03101f; background: linear-gradient(180deg, #8fe8ff, #2fa8ff); border-color: transparent; font-weight: 700; box-shadow: 0 2px 10px rgba(47,168,255,.4); }
.kbd { display: inline-block; min-width: 26px; text-align: center; padding: 1px 7px; margin-right: 6px;
  background: rgba(60, 90, 150, .4); border: 1px solid rgba(120,170,255,.35); border-radius: 6px;
  color: #cfe4ff; font-size: 12px; font-family: var(--num); box-shadow: inset 0 -2px 0 rgba(0,0,0,.25); }

/* ---------- 星图 ---------- */
.map-tabs { display: flex; gap: 8px; }
.map-tab {
  padding: 6px 16px; font-size: 13px; color: var(--text-dim);
  background: rgba(24, 38, 68, .5); border: 1px solid var(--border); border-radius: 9px;
  transition: all .15s; cursor: pointer;
}
.map-tab.on { color: #03101f; background: linear-gradient(180deg, #8fe8ff, #2fa8ff); border-color: transparent; font-weight: 700; box-shadow: 0 2px 10px rgba(47,168,255,.4); }
.map-wrap {
  /* ★ 这里不能写死 height。
     我为了让 canvas 的 height:100% 有参照，加了 height:min(58dvh,460px)，
     结果 .map-wrap 是 position:relative 的 flex 子项，写死高度会顶大
     .panel-body，反过来把 inventory 面板的 HUD 挤出视口 ——
     mobile_sweep 抓到 "inventory: HUD常驻出界5处(露145%/149%/130%)"。
     改成 min-height + flex:1，让容器被面板分配高度而不是自己撑。 */
  /* ★ 高度不写死、不撑开：canvas 的尺寸由 js 的 _fitMapCanvas() 按
     "容器宽度 + 目标宽高比"算出来，完全不依赖 CSS height。
     之前我加过 min-height:210px 让 height:100% 有参照，结果 .map-wrap
     作为 flex 子项会顶大 .panel-body，连带把别的面板 HUD 挤出视口
     （mobile_sweep: inventory HUD常驻出界5处）。 */
  flex: 1 1 auto; min-width: 0; position: relative; }
/* ★ 不再写死 660×460。写死尺寸 + CSS 压到容器 = 手机的 canvas 实际像素
   仍是 660 宽却被显示压到 ~380 CSS px，地形横向拉伸、文字糊、笔触失真。
   现在由 js 的 _fitMapCanvas() 按容器实测尺寸 + dpr 设置，这里只给最小值。 */
#planetmap-canvas, #starmap-canvas {
  /* 尺寸由 js 设置；这里只给一个合理默认值，js 会用实测容器宽覆盖 */
  display: block; max-width: 100%;
  background: radial-gradient(ellipse at center, #0d1a3a, #050914);
  border-radius: 14px; border: 1px solid var(--border);
  box-shadow: inset 0 0 40px rgba(30, 80, 160, .2), 0 0 18px rgba(0,150,255,.1);
}
#galaxymap-wrap { display: flex; gap: 18px; }
/* ★ 从"浮在地图左上角的绝对定位块"改成"地图下方的图例行"。
   原来 absolute + line-height:1.8 的一行中文，在窄屏上换行成一坨糊在
   地形上。现在是可换行的图例卡（圆点+文字），放在地图下面不挡视野。 */
.pm-legend {
  position: static; margin-top: 8px; font-size: 11px; color: #b9cbe8;
  background: rgba(10,16,34,.6); border: 1px solid var(--border); border-radius: 10px;
  padding: 7px 10px; line-height: 1.5; pointer-events: none;
  display: flex; flex-wrap: wrap; gap: 5px 12px; align-items: center;
}
.pm-legend .lg { display: inline-flex; align-items: center; gap: 5px; white-space: nowrap; }
.pm-legend .lg-d { width: 15px; height: 15px; border-radius: 50%; flex: none;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 9px; line-height: 1; }
.pm-legend .lg-note { flex-basis: 100%; color: #8fa4c8; opacity: .85; }
.pm-legend b { color: #fff; }
#starmap-side { width: 240px; }
#starmap-side .sys-name { font-size: 18px; font-weight: 700; color: #9fe8ff; margin-bottom: 8px; text-shadow: 0 0 12px rgba(120,220,255,.35); }
.planet-row {
  font-size: 13px; padding: 7px 10px; margin: 5px 0; border-radius: 10px;
  border: 1px solid var(--border); background: rgba(22, 36, 66, .5); transition: all .15s;
}
.planet-row:hover { border-color: var(--border-strong); box-shadow: 0 0 12px rgba(0,210,255,.15); }
.planet-row .pr-name { color: #fff; font-weight: 600; }
.planet-row .pr-bio { color: var(--text-dim); font-size: 12px; }
.planet-row.cur { border-color: var(--gold); box-shadow: 0 0 12px rgba(255,213,74,.25); }
.planet-row.visited .pr-name { color: #9fe8ff; }
.side-btns { margin-top: 12px; }
.side-note { font-size: 12px; color: var(--text-faint); margin-top: 10px; line-height: 1.7; }

/* ---------- 背包 ---------- */
#inv-resources { flex: 1.1; min-width: 0; display: flex; flex-direction: column; }
#craft-list { flex: 1; min-width: 0; }
.sec-title { font-size: 15px; font-weight: 700; color: #9fe8ff; margin-bottom: 10px; letter-spacing: 2px;
  display: flex; align-items: center; gap: 8px; }
.sec-title::after { content: ""; flex: 1; height: 1px; background: linear-gradient(90deg, rgba(120,170,255,.3), transparent); }
.res-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 6px; }
.res-item {
  font-size: 12.5px; display: flex; justify-content: space-between; align-items: center;
  background: rgba(22, 36, 66, .45); border: 1px solid rgba(120,170,255,.15); padding: 6px 10px; border-radius: 9px;
  color: #b9cbe8; transition: border-color .15s;
}
.res-item:hover { border-color: var(--border-strong); }
.res-item b { color: #fff; font-family: var(--num); font-size: 13px; }
.res-item.placeable { cursor: pointer; }
.res-item.placeable:hover { border-color: var(--gold); box-shadow: 0 0 10px rgba(255, 213, 74, .18); }
.res-item.active { border-color: var(--gold); background: rgba(255, 213, 74, .1); box-shadow: 0 0 12px rgba(255, 213, 74, .22); }
.res-item .to-hb { font-size: 10px; color: #7d93bd; margin-left: 6px; letter-spacing: .5px; }
.res-item.active .to-hb { color: var(--gold); }
.hb-tip { font-size: 11px; color: #7d93bd; font-weight: 400; letter-spacing: .5px; }
/* ★ 帕鲁式物品箱：分类页签 + 方块格子网格 + 右下数量角标 */
.inv-tabs { display: flex; gap: 6px; margin-bottom: 10px; flex-wrap: wrap; }
.inv-tab {
  padding: 5px 14px; font-size: 12px; color: var(--text-dim); cursor: pointer;
  background: rgba(24, 38, 68, .5); border: 1px solid var(--border); border-radius: 20px;
  transition: all .15s; letter-spacing: .5px;
}
.inv-tab:hover { border-color: var(--border-strong); color: var(--text); }
.inv-tab.on { color: #03101f; background: linear-gradient(180deg, #8fe8ff, #2fa8ff); border-color: transparent; font-weight: 700; box-shadow: 0 2px 10px rgba(47,168,255,.4); }
.inv-tab .t-cnt { opacity: .7; font-family: var(--num); font-size: 11px; }
.inv-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(62px, 1fr)); gap: 8px; }
.inv-slot {
  position: relative; display: flex; flex-direction: column; align-items: center; gap: 4px;
  padding: 7px 4px 4px; border-radius: 10px; cursor: pointer;
  background: linear-gradient(180deg, rgba(26, 42, 76, .5), rgba(16, 26, 50, .5));
  border: 1px solid rgba(120, 170, 255, .18);
  transition: border-color .15s, box-shadow .15s, transform .12s var(--ease-pop);
}
.inv-slot:hover { border-color: var(--border-strong); box-shadow: 0 0 10px rgba(0, 210, 255, .18); transform: translateY(-1px); }
.inv-slot.sel { border-color: var(--gold); background: rgba(255, 213, 74, .09); box-shadow: 0 0 12px rgba(255, 213, 74, .25); }
.inv-slot .inv-ico {
  width: 36px; height: 36px; border-radius: 9px; display: flex; align-items: center; justify-content: center;
  font-size: 19px; font-weight: 700; color: #fff; text-shadow: 0 1px 2px rgba(0, 0, 0, .55);
  border: 1px solid rgba(255, 255, 255, .2);
  box-shadow: inset 0 2px 4px rgba(255, 255, 255, .2), inset 0 -3px 6px rgba(0, 0, 0, .3);
}
.inv-slot .inv-ico.emoji { background: linear-gradient(180deg, rgba(40, 60, 100, .85), rgba(20, 32, 58, .85)); }
.inv-slot .inv-name {
  font-size: 10.5px; color: #b9cbe8; line-height: 1.2; max-width: 100%;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.inv-slot .inv-count {
  position: absolute; right: 2px; bottom: 2px; min-width: 18px; text-align: center;
  font-size: 11px; font-weight: 700; font-family: var(--num); color: #fff;
  background: rgba(8, 14, 30, .85); border: 1px solid rgba(120, 170, 255, .4);
  border-radius: 5px; padding: 0 3px; line-height: 15px;
}
.inv-slot.sel .inv-count { border-color: var(--gold); color: var(--gold); }
.inv-slot .inv-sub { font-size: 10px; color: #7d93bd; font-family: var(--num); }
.inv-empty { text-align: center; color: #7d93bd; font-size: 12.5px; padding: 26px 10px; border: 1px dashed rgba(120,170,255,.25); border-radius: 10px; }
.inv-tool-title { margin-top: 12px; }
/* 选中详情条：名字/数量/分类/描述/用途 + 放入按钮 */
.inv-detail {
  display: flex; align-items: center; gap: 12px; margin-top: 10px; padding: 10px 12px;
  background: linear-gradient(180deg, rgba(24, 38, 70, .6), rgba(16, 26, 50, .6));
  border: 1px solid var(--gold); border-radius: 12px; box-shadow: 0 0 14px rgba(255, 213, 74, .15);
  animation: invDetailIn .18s var(--ease-pop);
}
@keyframes invDetailIn { from { opacity: 0; transform: translateY(4px); } }
.inv-detail.hidden { display: none; }
.inv-detail .id-icon { flex: none; display: flex; }
.inv-detail .id-main { flex: 1; min-width: 0; }
.inv-detail .id-name { font-size: 13.5px; font-weight: 700; color: #fff; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.inv-detail .id-count { font-family: var(--num); color: var(--gold); font-size: 13px; }
.inv-detail .id-tag { font-size: 10px; color: #7d93bd; border: 1px solid rgba(120, 170, 255, .3); border-radius: 20px; padding: 1px 8px; }
.inv-detail .id-desc { font-size: 11.5px; color: var(--text-dim); margin-top: 2px; line-height: 1.5; }
.inv-detail .id-use { font-size: 11px; color: #7d93bd; margin-top: 2px; }
.inv-detail .btn-small { margin: 0; flex: none; white-space: nowrap; }
/* 合成配方：2 列卡片网格 */
.craft-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; align-content: start; }
.craft-grid .craft-card { margin: 0; display: flex; flex-direction: column; }
.craft-grid .craft-card .btn-small { margin-top: auto; }
/* ---------- 武器区（背包面板）：近战/远程各 3 格 ---------- */
.weapon-grid { display: flex; flex-direction: column; gap: 8px; margin-bottom: 12px; }
.wgroup { display: flex; align-items: center; gap: 8px; }
.wg-label { font-size: 11px; color: #7d93bd; width: 40px; letter-spacing: 2px; flex: none; }
.wg-slots { display: flex; gap: 6px; flex: 1; }
.wg-slot {
  flex: 1; min-width: 72px; display: flex; flex-direction: column; align-items: center; gap: 3px;
  padding: 6px 4px; border-radius: 9px; font-size: 10.5px; color: #b9cbe8;
  background: rgba(22, 36, 66, .45); border: 1px solid rgba(120,170,255,.15); cursor: pointer;
  transition: border-color .15s, box-shadow .15s;
}
.wg-slot:hover { border-color: var(--border-strong); }
.wg-slot.cur { border-color: var(--gold); box-shadow: 0 0 12px rgba(255, 213, 74, .25); color: var(--gold); }
.wg-slot.empty { opacity: .3; cursor: default; }
.wg-slot .wico { width: 26px; height: 26px; image-rendering: pixelated; }
.wg-slot span { text-align: center; line-height: 1.2; }
/* ---------- 基地传送 ---------- */
.base-list { display: flex; flex-direction: column; gap: 10px; width: 100%; max-height: 420px; overflow-y: auto; }
.base-card {
  background: linear-gradient(180deg, rgba(24, 38, 70, .55), rgba(16, 26, 50, .55));
  border: 1px solid rgba(120, 170, 255, .22); border-radius: 12px; padding: 12px 16px; cursor: pointer;
  transition: border-color .15s, box-shadow .15s, transform .15s var(--ease-pop);
}
.base-card:hover { border-color: var(--gold); box-shadow: 0 0 16px rgba(255, 213, 74, .2); transform: translateY(-1px); }
.bc-head { display: flex; align-items: center; gap: 10px; }
.bc-name { font-size: 16px; font-weight: 700; letter-spacing: 1px; text-shadow: 0 0 12px currentColor; }
.bc-biome { font-size: 11px; color: #9db4d8; border: 1px solid rgba(120,170,255,.3); border-radius: 20px; padding: 2px 10px; }
.bc-sub { font-size: 12px; color: #7d93bd; margin-top: 5px; letter-spacing: .5px; }
.base-empty { text-align: center; color: #7d93bd; font-size: 13px; line-height: 2; padding: 30px 10px; }
/* ★ v41 一键上飞船按钮（B 面板） */
.base-ship-btn {
  display: flex; align-items: baseline; gap: 10px; width: 100%; box-sizing: border-box;
  background: linear-gradient(135deg, rgba(0, 180, 220, .22), rgba(0, 120, 180, .18));
  border: 1px solid rgba(0, 220, 255, .45); border-radius: 12px; padding: 12px 16px;
  font-size: 15px; font-weight: 700; color: #aef2ff; cursor: pointer; margin-bottom: 10px;
  transition: border-color .15s, box-shadow .15s, transform .15s var(--ease-pop);
}
.base-ship-btn:hover { border-color: var(--gold); box-shadow: 0 0 18px rgba(0, 220, 255, .35); transform: translateY(-1px); }
.base-ship-btn .bs-sub { font-size: 11px; font-weight: 400; color: #7d93bd; letter-spacing: .5px; }
.craft-card {
  background: linear-gradient(180deg, rgba(24, 38, 70, .5), rgba(16, 26, 50, .5));
  border: 1px solid rgba(120,170,255,.2); border-radius: 12px; padding: 10px 12px; margin: 8px 0; transition: border-color .15s;
}
.craft-card:hover { border-color: var(--border-strong); }
.craft-card .cc-name { font-size: 13.5px; font-weight: 700; color: #fff; }
.craft-card .cc-cost { font-size: 12px; color: var(--text-dim); margin: 3px 0 7px; font-family: var(--num); }
.craft-card .cc-cost.ok { color: var(--ok); }

/* ---------- 图鉴 ---------- */
#dex-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; width: 100%; }
/* ★ v72 我的队伍（背包 6 格） */
.dex-team-title, .dex-ware-title { font-size: 13px; color: #9fc8f0; letter-spacing: 1px; margin: 6px 2px 8px; }
.dex-ware-title { margin-top: 14px; }
#dex-team { display: grid; grid-template-columns: repeat(6, 1fr); gap: 10px; width: 100%; padding-bottom: 4px; }
.dex-team-slot { position: relative; background: linear-gradient(180deg, rgba(24, 38, 70, .55), rgba(14, 23, 46, .6));
  border: 1px solid var(--border); border-radius: 12px; padding: 10px; text-align: center; cursor: pointer;
  transition: all .15s; display: flex; flex-direction: column; align-items: center; gap: 4px; }
.dex-team-slot:hover { transform: translateY(-3px); border-color: var(--border-strong); }
.dex-team-slot.active { border-color: #ffd54a; box-shadow: 0 0 14px rgba(255,213,74,.35); }
.dex-team-slot.empty { opacity: .45; cursor: default; }
.dex-team-slot img { image-rendering: pixelated; width: 48px; height: 48px; object-fit: contain; }
.dts-name { font-size: 12px; font-weight: 700; color: #fff; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dts-lv { font-size: 11px; }
.dts-active { position: absolute; top: 4px; right: 6px; font-size: 10px; color: #ffd54a; font-weight: 700; }
.dts-empty { color: #5b7299; font-size: 12px; padding: 12px 0; }
/* ★ v72.2 精元孵化行 */
#dex-essence { display: flex; align-items: center; gap: 14px; margin: 8px 2px 4px; padding: 8px 12px; background: linear-gradient(180deg, rgba(181,140,240,.14), rgba(14,23,46,.4)); border: 1px solid rgba(181,140,240,.35); border-radius: 12px; }
.dex-ess-label { font-size: 14px; color: #d3b6ff; font-weight: 700; letter-spacing: 1px; }
.dex-ess-btn { font-size: 13px; padding: 6px 16px; }
.dex-card.carried { border-color: rgba(255,213,74,.5); }
.dex-card {
  background: linear-gradient(180deg, rgba(24, 38, 70, .55), rgba(14, 23, 46, .6));
  border: 1px solid var(--border); border-radius: 14px; padding: 13px;
  transition: transform .15s var(--ease-pop), border-color .15s, box-shadow .15s;
  display: flex; flex-direction: column;
}
/* ★ v72.13 仓库卡片 AI 大头像（宝可梦箱子式）：64px 图 + 元素色描边 + 已携带角标 */
.dex-card .dc-thumb {
  position: relative; align-self: center; width: 74px; height: 74px; margin-bottom: 9px;
  display: flex; align-items: center; justify-content: center;
  background: rgba(10, 18, 40, .55); border: 1px solid; border-radius: 12px;
}
.dex-card .dc-thumb img { width: 64px; height: 64px; image-rendering: pixelated; object-fit: contain; border-radius: 8px; }
.dex-card .dc-badge {
  position: absolute; top: -8px; right: -10px; font-size: 10px; font-weight: 700; color: #ffd54a;
  background: rgba(40, 32, 8, .92); border: 1px solid rgba(255, 213, 74, .5);
  border-radius: 8px; padding: 1px 6px; white-space: nowrap; letter-spacing: .5px;
}
.dex-card:hover { transform: translateY(-3px); border-color: var(--border-strong); box-shadow: 0 6px 20px rgba(0,150,255,.15); }
.dex-card .dc-head { display: flex; justify-content: space-between; align-items: center; }
.dex-card .dc-name { font-weight: 700; font-size: 15px; color: #fff; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; margin-right: 6px; }
.dex-card .dc-rarity { font-size: 12px; font-weight: 700; flex: none; }
.dex-card .dc-meta { font-size: 12px; color: var(--text-dim); margin: 5px 0; line-height: 1.7; }
.dex-card .dc-bar { height: 5px; border-radius: 3px; background: #233250; margin: 4px 0; overflow: hidden; }
.dex-card .dc-bar i { display: block; height: 100%; border-radius: 3px;
  background: linear-gradient(90deg, #2fa8ff, #8fe8ff); box-shadow: 0 0 6px rgba(80,190,255,.6); }
/* 属性条行：标签 + 条（复用 dc-bar） */
.dex-card .dc-stat { display: flex; align-items: center; gap: 8px; font-size: 11px; color: var(--text-dim); }
.dex-card .dc-stat > span { width: 36px; flex: none; }
.dex-card .dc-stat .dc-bar { flex: 1; margin: 3px 0; }
.dex-card .dc-el { display: inline-block; font-size: 11px; padding: 1px 9px; border-radius: 10px; color: #fff;
  background: rgba(60, 100, 180, .35); border: 1px solid rgba(120,170,255,.3); }
.dex-card .dc-evo { font-size: 11px; color: #ffd54a; margin: 4px 0; line-height: 1.6;
  background: rgba(255, 213, 74, .08); border: 1px solid rgba(255, 213, 74, .25); border-radius: 6px; padding: 3px 8px; }
.rarity-c { color: #9fb4d8; } .rarity-u { color: #6fe08a; } .rarity-r { color: #00a3ff; } .rarity-l { color: var(--gold); }
.dex-card.active { border-color: var(--gold); box-shadow: 0 0 0 1px rgba(255,213,74,.3), 0 6px 24px rgba(255,180,60,.15); }
.btn-dex-fight {
  width: 100%; margin-top: 9px; padding: 7px 0; border: 1px solid rgba(120,210,255,.4); border-radius: 8px;
  background: rgba(30, 60, 110, .5); color: #9fe8ff; font-size: 12.5px; cursor: pointer;
  transition: background .15s, color .15s, box-shadow .15s;
}
.btn-dex-fight:hover { background: rgba(40, 90, 160, .6); box-shadow: 0 0 12px rgba(0,150,255,.3); }
.btn-dex-fight.on { border-color: var(--gold); color: var(--gold); background: rgba(90, 70, 20, .35); }
/* ★ v72.13 已携带按钮金色态（与卡片角标呼应） */
.btn-dex-fight.carried { border-color: rgba(255, 213, 74, .5); color: #ffd54a; background: rgba(90, 70, 20, .3); }
.btn-dex-fight.carried:hover { background: rgba(120, 90, 20, .4); box-shadow: 0 0 12px rgba(255, 213, 74, .25); }

/* ---------- 其他 ---------- */
#toast { position: absolute; left: 50%; top: 16%; transform: translateX(-50%); z-index: 50;
  display: flex; flex-direction: column; align-items: center; gap: 8px; pointer-events: none; }
.toast-item {
  background: linear-gradient(180deg, rgba(16, 26, 50, .95), rgba(8, 14, 30, .96));
  border: 1px solid var(--gold); color: var(--gold); font-size: 16px; font-weight: 700;
  padding: 10px 28px; border-radius: 14px; letter-spacing: 2px;
  box-shadow: 0 0 26px rgba(255, 213, 74, .35), 0 6px 20px rgba(0,0,0,.4);
  animation: toastIn .3s var(--ease-pop);
}
.toast-item.out { animation: toastOut .35s ease forwards; }
@keyframes toastIn { from { opacity: 0; transform: translateY(-14px) scale(.9); } to { opacity: 1; transform: none; } }
@keyframes toastOut { to { opacity: 0; transform: translateY(-10px); } }
#ship-info { font-size: 13px; color: #b9cbe8; margin-bottom: 10px; line-height: 1.8; }
#ship-info b { color: #ffb04a; font-family: var(--num); }
#refine-list { margin-bottom: 10px; }
#btn-launch { margin-top: 12px; }
::-webkit-scrollbar { width: 8px; }
::-webkit-scrollbar-thumb { background: rgba(80, 140, 220, .35); border-radius: 4px; }
::-webkit-scrollbar-track { background: transparent; }

/* ================= v735 新手引导：主宠三选一 / 任务追踪 / 村长对话 ================= */
#starter-panel .panel-inner { width: 860px; }
#starter-panel .starter-body { flex-direction: column; align-items: center; }
.starter-tip { width: 100%; color: #b9cbe8; font-size: 13px; margin-bottom: 4px; line-height: 1.8; text-align: center; letter-spacing: .5px; }
#starter-cards { display: flex; gap: 16px; justify-content: center; width: 100%; }
.st-card {
  flex: 1; max-width: 240px; display: flex; flex-direction: column; align-items: center; gap: 8px;
  padding: 16px 14px; border-radius: 16px; border: 2px solid;
  background: linear-gradient(180deg, rgba(24, 38, 70, .6), rgba(12, 20, 44, .82));
  transition: transform .18s var(--ease-pop), box-shadow .18s, border-color .18s;
}
.st-card:hover { transform: translateY(-4px); box-shadow: 0 10px 30px rgba(0, 150, 255, .25); }
.st-thumb { width: 96px; height: 96px; display: flex; align-items: center; justify-content: center;
  background: rgba(10, 18, 40, .6); border-radius: 14px; }
.st-thumb img { width: 88px; height: 88px; image-rendering: pixelated; object-fit: contain; }
.st-fallback { font-size: 34px; font-weight: 700; color: #cfdfff; }
.st-name { font-size: 18px; font-weight: 700; color: #fff; letter-spacing: 2px; }
.st-elem { font-size: 12px; font-weight: 700; color: #fff; padding: 2px 12px; border-radius: 10px; }
.st-desc { font-size: 12px; color: var(--text-dim); line-height: 1.7; text-align: center; min-height: 40px; }
.st-stats { font-size: 11px; color: #9fb4d8; letter-spacing: .5px; }
.st-card .st-btn { margin: 6px 0 0; padding: 9px 0; font-size: 14px; letter-spacing: 1px; }

/* 任务追踪面板（右下角） */
#quest-panel {
  position: absolute; right: 14px; bottom: 96px; z-index: 40; width: 236px;
  background: linear-gradient(165deg, rgba(17, 27, 52, .92), rgba(8, 13, 30, .96));
  border: 1px solid var(--border); border-radius: 12px; overflow: hidden;
  box-shadow: 0 10px 30px rgba(0, 0, 0, .5);
}
.qp-head { display: flex; justify-content: space-between; align-items: center; padding: 7px 10px;
  font-size: 13px; font-weight: 700; color: #9fe8ff; letter-spacing: 1px;
  background: linear-gradient(180deg, rgba(0, 120, 200, .16), transparent); }
#quest-toggle { background: transparent; border: none; color: #9fe8ff; font-size: 14px; padding: 0 4px; cursor: pointer; }
.qp-obj { padding: 0 10px 10px; font-size: 12px; color: #cfdfff; line-height: 1.7; }
#quest-body.collapsed { display: none; }

/* 村长对话 */
.qd-inner { width: 520px !important; }
.qd-text { font-size: 15px; line-height: 2; color: #e8f1ff; min-height: 90px; padding: 10px 14px;
  background: rgba(10, 18, 40, .5); border: 1px solid var(--border); border-radius: 12px; white-space: pre-wrap; }
.qd-next { width: 160px; margin: 0 auto; }

/* ================= v735 战斗结算面板 + BOSS 暴怒横幅 ================= */
/* ★ v735 暴怒横幅（红）：复用 #c-banner 出场动画，仅换配色 */
#c-banner.rage { color: #ff9a8a;
  text-shadow: 0 0 16px rgba(255,60,40,.95), 0 0 44px rgba(255,30,10,.75), 0 3px 0 rgba(90,15,0,.75);
  -webkit-text-stroke: 1px #7a1500; }
/* ★ v735 战斗结算面板：深蓝黑半透明 + 亮边框 + 圆角（参考 .c-swap-panel，居中顶层） */
#result-panel { position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%);
  z-index: 300; pointer-events: auto; }
.rr-body { width: min(430px, 88vw); text-align: center;
  background: linear-gradient(180deg, rgba(12, 20, 46, .95), rgba(6, 10, 26, .96));
  border: 2px solid rgba(126, 200, 255, .65); border-radius: 18px; padding: 22px 26px;
  backdrop-filter: blur(10px); box-shadow: 0 10px 40px rgba(0,0,0,.7), 0 0 26px rgba(90,170,255,.28);
  animation: rrIn .3s var(--ease-pop); }
@keyframes rrIn { from { opacity: 0; transform: translateY(16px) scale(.9); } to { opacity: 1; transform: none; } }
.rr-title { font-size: 22px; font-weight: 900; color: #fff; letter-spacing: 2px; margin-bottom: 12px;
  text-shadow: 0 0 14px rgba(255,213,74,.75), 0 2px 4px rgba(0,0,0,.6); }
.rr-ava { width: 92px; height: 92px; margin: 0 auto 12px; border-radius: 16px; overflow: hidden; position: relative;
  background: linear-gradient(180deg, rgba(18,30,60,.92), rgba(8,14,32,.92));
  border: 2px solid #7ec8ff; box-shadow: 0 4px 18px rgba(0,0,0,.5), inset 0 0 12px rgba(0,0,0,.5); }
.rr-ava img { width: 100%; height: 100%; object-fit: contain; image-rendering: pixelated; }
.rr-fb { position: absolute; inset: 4px; border-radius: 12px; display: flex; align-items: center; justify-content: center;
  font-size: 40px; font-weight: 900; color: #fff; text-shadow: 0 2px 6px rgba(0,0,0,.6); }
.rr-line { font-size: 14px; color: #dfeeff; letter-spacing: .5px; margin: 6px 0; line-height: 1.6; }
.rr-gold { color: #ffd54a; }
.rr-btn { margin-top: 14px; min-width: 140px; }

.dc-stat.exp .dc-bar i, .dc-bar i.exp { background: linear-gradient(90deg, #ffb74a, #ffe08a); }

/* ★ v741 罗盘条（透明虚线 + 方位字母 + 目标标记，参考绝地求生式） */
#compass { position: absolute; top: 10px; left: 50%; transform: translateX(-50%);
  width: min(440px, 42vw); height: 30px; z-index: 30; pointer-events: none; }
#compass-nsew { position: absolute; inset: 0; }
#compass-nsew span { position: absolute; top: 2px; transform: translateX(-50%);
  font-size: 12px; font-weight: 700; color: rgba(255,255,255,.92); text-shadow: 0 0 6px rgba(0,0,0,.8); }
#compass-nsew span.n { color: #ff6a5a; }
#compass-scale { position: absolute; top: 20px; left: 0; right: 0; height: 5px;
  background: repeating-linear-gradient(90deg, rgba(255,255,255,.5) 0 1px, transparent 1px 24px);
  opacity: .55; }
#compass-mark { position: absolute; top: 24px; transform: translateX(-50%);
  color: #ffd54a; font-size: 13px; white-space: nowrap; text-shadow: 0 0 6px rgba(0,0,0,.9); }
#compass-mark .arrow-bounce { display: inline-block; animation: cmpbounce .8s ease-in-out infinite; }
@keyframes cmpbounce { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-2px); } }

/* ★ v743 AI 对手头像 + 浮窗 + 首页开关 */
#rival-avatar { position: absolute; right: 14px; top: 50%; transform: translateY(-50%);
  min-height: 44px; min-width: 44px;
  z-index: 40; cursor: pointer; display: flex; align-items: center; gap: 4px;
  background: rgba(10,18,40,.72); border: 1px solid rgba(255,213,74,.5); border-radius: 20px;
  padding: 6px 10px; color: #ffd54a; font-size: 13px; backdrop-filter: blur(4px);
  box-shadow: 0 2px 10px rgba(0,0,0,.35); user-select: none; }
#rival-avatar:hover { background: rgba(30,45,80,.85); }
#rival-dot { width: 8px; height: 8px; border-radius: 50%; background: #6fe08a; display: inline-block;
  animation: rpulse 2s infinite; }
@keyframes rpulse { 0%,100% { opacity: 1; } 50% { opacity: .3; } }
#rival-panel { position: absolute; right: 14px; top: calc(50% - 40px); transform: translateY(-50%);
  width: 300px; z-index: 41; background: rgba(8,14,32,.94); border: 1px solid rgba(255,213,74,.45);
  border-radius: 14px; padding: 12px 14px; backdrop-filter: blur(8px); box-shadow: 0 8px 32px rgba(0,0,0,.6); }
.rp-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.rp-head span { font-size: 14px; color: #ffd54a; font-weight: 700; }
#rival-close { background: none; border: none; color: #7d93bd; font-size: 15px; cursor: pointer; }
.rp-info { font-size: 12px; color: #cfe6ff; margin-bottom: 6px; line-height: 1.6; }
.rp-prog { font-size: 11px; color: #9fc8f0; background: rgba(255,213,74,.08); border-radius: 8px;
  padding: 6px 8px; margin-bottom: 8px; }
.rp-msg { font-size: 12px; color: #ffe9c8; background: rgba(120,170,255,.1); border-radius: 8px;
  padding: 6px 8px; margin-bottom: 8px; min-height: 20px; }
.rp-input-row { display: flex; gap: 6px; margin-bottom: 8px; }
#rival-input { flex: 1; background: rgba(20,32,60,.9); color: #cfe4ff; border: 1px solid rgba(120,170,255,.35);
  border-radius: 6px; padding: 5px 8px; font-size: 12px; }
.rp-actions { display: flex; gap: 6px; }
.rp-actions .c-btn { flex: 1; padding: 6px 4px; font-size: 11px; }
.start-api-row { margin-top: 14px; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.start-api-row .lbl { color: #9fc8f0; font-size: 13px; }
.start-api-row select, .start-api-row input { background: rgba(20,32,60,.9); color: #cfe4ff;
  border: 1px solid rgba(120,170,255,.35); border-radius: 6px; padding: 5px 8px; font-size: 12px; }

/* ★ v744 对手面板 v2：聊天记录 + 小地图 */
#rival-panel { width: 420px; }
.rp-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.rp-hd-left { display: flex; align-items: baseline; gap: 8px; }
.rp-hd-left span:first-child { font-size: 14px; color: #ffd54a; font-weight: 700; }
.rp-sub { font-size: 11px; color: #9fc8f0; }
.rp-hd-right { display: flex; align-items: center; gap: 8px; }
.rp-hotkey { font-size: 10px; color: #7d93bd; border: 1px solid rgba(120,170,255,.3); border-radius: 6px; padding: 2px 6px; }
.rp-logs { height: 180px; overflow-y: auto; background: rgba(12,20,42,.7); border-radius: 10px;
  padding: 8px 10px; margin-bottom: 8px; display: flex; flex-direction: column; gap: 5px; }
.rp-log { font-size: 12px; color: #d8e8ff; line-height: 1.5; background: rgba(120,170,255,.08);
  border-radius: 8px; padding: 5px 8px; }
.rp-log.me { background: rgba(255,213,74,.1); color: #ffe9b8; align-self: flex-end; max-width: 85%; }
.rp-log.rival { align-self: flex-start; max-width: 85%; }
.rp-log-t { font-size: 9px; color: #5a6d8f; margin-right: 6px; }
.rp-log-w { font-size: 10px; font-weight: 700; margin-right: 6px; }
.rp-log.me .rp-log-w { color: #ffd54a; }
.rp-log.rival .rp-log-w { color: #6fe08a; }
.rp-log-empty { color: #5a6d8f; font-size: 12px; text-align: center; padding: 20px 0; }
.rp-map-row { display: flex; gap: 10px; }
#rival-map { border: 1px solid rgba(120,170,255,.3); border-radius: 10px; background: #050914; }
.rp-map-side { flex: 1; display: flex; flex-direction: column; gap: 8px; }
.rp-loc { font-size: 12px; color: #cfe6ff; }

/* ★ v745 对手面板按钮强化（原 .c-btn 白色看不清） */
#rival-panel .rp-actions .c-btn { color: #ffd54a; border-color: rgba(255,213,74,.55);
  background: rgba(40,55,95,.9); font-weight: 700; text-shadow: 0 1px 2px rgba(0,0,0,.6); }
#rival-panel .rp-actions .c-btn:hover { background: rgba(70,95,150,.95); border-color: #ffd54a; }
#rival-panel .rp-input-row .c-btn { color: #cfe6ff; border-color: rgba(120,170,255,.5); background: rgba(40,55,95,.9); }
/* 头像标注快捷键 O */
#rival-avatar::after { content: 'O'; position: absolute; top: -4px; right: -4px;
  width: 16px; height: 16px; border-radius: 50%; background: #ffd54a; color: #0a0f1e;
  font-size: 10px; font-weight: 700; display: flex; align-items: center; justify-content: center; }

/* ★ v746 请求帮忙菜单 */
#rival-help-menu { margin-top: 8px; display: flex; flex-direction: column; gap: 6px; }
#rival-help-menu .rhm-title { font-size: 12px; color: #9fc8f0; margin-bottom: 2px; }
#rival-help-menu .c-btn { color: #cfe6ff; border-color: rgba(120,170,255,.5); background: rgba(40,55,95,.9); }
#rival-help-menu .c-btn:hover { background: rgba(70,95,150,.95); }

/* ★ v748 队伍格经验条 */
.dts-exp { margin-top: 3px; display: flex; align-items: center; gap: 4px; }
.dts-exp-bar { flex: 1; height: 5px; border-radius: 3px; background: rgba(255,255,255,.14); overflow: hidden; }
.dts-exp-bar i { display: block; height: 100%; background: linear-gradient(90deg, #ffb74a, #ffe08a); }
.dts-exp span { font-size: 9px; color: #9fc8f0; font-family: var(--num); }

/* ★ v752 亲密度特权 */
.rp-tiers { font-size: 10px; color: #9fc8f0; background: rgba(255,120,120,.07); border-radius: 8px;
  padding: 5px 8px; margin-bottom: 8px; line-height: 1.7; }
.rp-tiers b { color: #ffd54a; }

/* ★ P3 卡关求援条 */
.rp-helpbar { display: flex; align-items: center; gap: 8px; font-size: 11px; color: #ffd54a;
  background: rgba(255,120,60,.12); border: 1px solid rgba(255,213,74,.5); border-radius: 8px;
  padding: 6px 8px; margin-bottom: 8px; }
.rp-helpbar .rph-text { flex: 1; line-height: 1.4; }
.rp-helpbar .c-btn { flex-shrink: 0; color: #ffd54a; border-color: rgba(255,213,74,.55);
  background: rgba(40,55,95,.9); font-weight: 700; font-size: 10px; padding: 4px 8px; }
.rp-helpbar .c-btn:hover { background: rgba(70,95,150,.95); }
.rp-helpbar .c-btn:disabled { opacity: .5; cursor: not-allowed; }

/* ★ v756 BOSS 击败金色横幅 */
#c-banner.win { color: #ffd54a; border-color: rgba(255,213,74,.8); text-shadow: 0 0 18px rgba(255,213,74,.9); }

/* ★ v757 基地升级 */
.base-lv { font-size: 13px; color: #ffd54a; margin-bottom: 8px; }
.base-upgrade { margin-bottom: 8px; }
.base-storage { font-size: 12px; color: #cfe6ff; margin: 8px 0; }
.base-storage-row { display: flex; gap: 6px; flex-wrap: wrap; }
.base-storage-row .btn-plain { font-size: 11px; }

/* ★ v757 飞船升级 */
.ship-lv { font-size: 13px; color: #ffd54a; margin: 8px 0; }
/* ★ v769 飞船面板护盾状态 */
.ship-shield { font-size: 12px; color: #7fd4ff; margin: 4px 0 8px; }
.ship-shield b { font-family: var(--num); }
.ship-shield.locked { color: var(--text-faint); }
#ship-upgrade { margin-bottom: 6px; }

/* ★ v758 空间站商人 */
.station-coin { font-size: 13px; color: #ffd54a; margin: 6px 0; }
.merchant-sell { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 8px; }
.merchant-pets { display: flex; flex-direction: column; gap: 5px; }
.merchant-pet { font-size: 12px; color: #cfe6ff; }

/* ★ v758 任务板 */
.mission-card { background: rgba(20,32,60,.6); border: 1px solid rgba(120,170,255,.3); border-radius: 8px;
  padding: 7px 10px; margin-bottom: 6px; }
.mission-card.done { opacity: .6; border-color: rgba(111,224,138,.5); }
.mc-name { font-size: 13px; color: #cfe6ff; }
.mc-diff { font-size: 10px; margin-left: 4px; font-weight: bold; }
.mc-tgt { font-size: 11px; color: #9fe4ff; margin: 2px 0 0; }
.mc-reward { font-size: 11px; color: #ffd54a; margin: 2px 0; }
.mc-bar { height: 5px; border-radius: 3px; background: rgba(255,255,255,.12); overflow: hidden; }
.mc-bar i { display: block; height: 100%; background: linear-gradient(90deg, #4aa8ff, #7ec8ff); }
.mc-prog { font-size: 10px; color: #7d93bd; margin-top: 2px; }

/* ★ v761 聊天头顶气泡（洛克王国式） */
#chat-bubbles { position: absolute; inset: 0; pointer-events: none; z-index: 45; }
.cbubble { position: absolute; transform: translateX(-50%);
  background: #fff; color: #333; font-size: 12px; line-height: 1.4;
  padding: 6px 10px; border-radius: 12px; border: 2px solid #222;
  box-shadow: 0 2px 8px rgba(0,0,0,.3); max-width: 220px;
  animation: bubbleIn .18s ease-out; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cbubble::after { content: ''; position: absolute; bottom: -6px; left: 50%; transform: translateX(-50%);
  border: 6px solid transparent; border-top-color: #fff; }
.cbubble::before { content: ''; position: absolute; bottom: -9px; left: 50%; transform: translateX(-50%);
  border: 7px solid transparent; border-top-color: #222; }
.cbubble.me { background: #fff8dc; }
@keyframes bubbleIn { from { transform: translateX(-50%) scale(.7); opacity: 0; } to { transform: translateX(-50%) scale(1); opacity: 1; } }

/* ★ v765 发现性：空间站/武器提示块 */
#sh-station .sh-val, #sh-weapon .sh-val { color: #ffd54a; }
#sh-station .sh-sub, #sh-weapon .sh-sub { color: #9fc8f0; }

/* 🧬 精灵融合器 */
.fu-tip { font-size: 12px; color: #9fc8f0; margin-bottom: 10px; line-height: 1.7; }
.fu-picks { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.fu-slot { flex: 1; border: 1px dashed rgba(120,170,255,.5); border-radius: 10px; padding: 14px;
  text-align: center; color: #7d93bd; background: rgba(20,32,60,.5); }
.fu-arrow { color: #ffd54a; font-size: 20px; }
.fu-preview { font-size: 13px; color: #cfe6ff; background: rgba(255,213,74,.08); border-radius: 8px;
  padding: 8px 10px; margin-bottom: 10px; }
.fu-list { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; max-height: 220px;
  overflow-y: auto; margin-bottom: 10px; }
.fu-item { border: 1px solid rgba(120,170,255,.3); border-radius: 8px; padding: 6px 8px;
  font-size: 12px; color: #cfe6ff; cursor: pointer; background: rgba(16,26,50,.6); }
.fu-item.sel { background: rgba(255,213,74,.15); border-color: #ffd54a; }

/* 🔬 研究所（科技研发） */
.res-tip { font-size: 12px; color: #9fc8f0; margin-bottom: 10px; line-height: 1.7; }
#research-list { display: flex; flex-direction: column; gap: 8px; }
.research-card { display: grid; grid-template-columns: 1fr auto; gap: 2px 12px; align-items: center;
  border: 1px solid rgba(120,170,255,.3); border-radius: 10px; padding: 10px 14px; background: rgba(16,26,50,.6); }
.research-card.done { border-color: rgba(110,220,130,.45); background: rgba(30,70,40,.35); }
.rc-head { display: flex; align-items: center; gap: 8px; }
.rc-name { font-size: 14px; font-weight: 700; color: #fff; }
.rc-lv { font-size: 11px; color: #7d93bd; border: 1px solid rgba(120,170,255,.35); border-radius: 8px; padding: 1px 7px; }
.rc-desc { font-size: 12px; color: #cfe6ff; }
.rc-cost { font-size: 12px; color: #ffb04a; font-family: var(--num); }
.rc-cost.ok { color: var(--ok); }
.rc-btn { grid-row: 1 / 4; grid-column: 2; }

/* 🏟 训练场（精灵演练） */
#training-panel-body { display: flex; flex-direction: column; gap: 10px; width: 100%; }
.train-pet { display: flex; align-items: center; gap: 12px; border: 1px solid rgba(120,170,255,.3);
  border-radius: 10px; padding: 10px 14px; background: rgba(16,26,50,.6); }
.tp-name { font-size: 15px; font-weight: 700; }
.tp-meta { font-size: 12px; color: #9fc8f0; margin-top: 3px; font-family: var(--num); }
.train-empty { border: 1px dashed rgba(120,170,255,.5); border-radius: 10px; padding: 18px;
  text-align: center; color: #7d93bd; font-size: 13px; }
.train-row { display: flex; justify-content: space-between; font-size: 13px; color: #cfe6ff; }
.train-row span b { color: #ffd54a; }
.train-go { width: 100%; }
.train-hint { font-size: 12px; color: #ff8a70; text-align: center; }

/* ================= ⛶ 全屏按钮（全局） ================= */
#btn-fullscreen {
  position: fixed; top: 12px; right: 12px; z-index: 600;
  width: 40px; height: 40px; border-radius: 11px;
  background: rgba(13, 22, 44, .72); border: 1px solid var(--border);
  color: #9fe8ff; font-size: 19px; line-height: 38px; text-align: center;
  cursor: pointer; backdrop-filter: blur(6px);
  transition: all .15s;
}
#btn-fullscreen:hover { border-color: var(--border-strong); color: #fff; box-shadow: 0 0 14px rgba(0,200,255,.35); }
#btn-fullscreen:active { transform: scale(.92); }
/* 桌面端：右上角 HUD 列整体下移，给全屏按钮让位 */
body:not(.NS_MOBILE) #hud-top-right { top: 62px; }
/* 移动端：底部与挖掘按钮错开（挖掘键右缘约在 right:90px 处），不遮挡 */
body.NS_MOBILE #btn-fullscreen { top: auto; bottom: calc(16px + env(safe-area-inset-bottom, 0px)); right: calc(100px + env(safe-area-inset-right, 0px)); }

/* ================= 移动端 / 小屏适配（横屏手机 & 窄窗口） ================= */
/* ★ 面板主操作按钮在移动端必须"吸底"。
   实测（tools/mobile_touch_test.js 真实触摸）：iphone 844×390 上打开飞船面板，
   .panel-inner 内容高 781px 而可视高度只有 366px，「🚀 起飞」按钮落在 y=735
   —— 也就是**在屏幕外 345px**，玩家必须自己发现"这里能往上滑"才够得到，
   否则就是"上了飞机没有起飞键"。吸底后无论内容多长，主操作永远可见可点。
   同理适用于空间站/基地/研究所等所有把主动作放在 .panel-body 末尾的面板。 */
/* 地图画布：把浏览器原生手势关掉，捏合/拖动才归游戏处理。
   项目 viewport 已 user-scalable=no，原生缩放本来也不会发生，但 touch-action
   缺失时浏览器仍会把手势吞掉并触发滚动回弹（表现为"捏了半天没反应"）。 */
#starmap-canvas, #planetmap-canvas { touch-action: none; }

/* 触屏没有物理键，"键位说明"整节（空格/左键/滚轮/Shift…）在手机上
   是纯粹的无意义内容，还占掉设置面板一半高度。触屏的操作入口是
   ☰ 菜单 + 右下虚拟按键，所以整节隐藏，由 touch.js 负责呈现。 */
@media (pointer: coarse), (max-width: 900px), (max-height: 560px) {
    /* 罗盘盒子在窄屏被 grid 行高压到 26px（内容需 31px）→ 上下各裁一点。
     给移动端显式一行高度，让它按内容撑开。 */
  .hz-tc { min-height: 34px; justify-content: center; }

  .desk-only { display: none !important; }

  /* ★ 触屏触控目标下限 44px（iOS HIG / Material 48dp）。
     项目原先只加固了 HUD 侧几个（.hb-slot / .btn-close / #craft-entry /
     #menu-btn / #quest-toggle / #btn-fullscreen），**面板内容里的按钮全漏了**。
     tools/mobile_sweep.js 实测移动端：.btn-small 65×29、.research-btn 77×32、
     .map-tab 101×36、.btn-primary 364×39 —— 全部低于下限。
     只抬 min-height 不改宽度，避免布局重排。 */
  .panel-body button, .panel-foot button,
  .btn-primary, .btn-plain, .btn-small, .btn-head,
  .map-tab, .seg button, .research-btn, .dex-ess-btn,
  .inv-to-craft, .craft-to-inv, .fu-go, .train-go,
  .sort-btn, .inv-tab, .slot-btn, .craft-card, .st-btn, .csp-slot, .c-skill,
  .opt-row .seg > button { min-height: 44px; }
  .btn-close, #quest-toggle { min-width: 44px; }
}
@media (max-width: 900px), (max-height: 560px), (pointer: coarse) {
  #btn-launch, #btn-station-leave, #btn-tobase,
  .panel-body > .btn-primary:last-child {
    position: sticky;
    bottom: 0;
    z-index: 2;
    box-shadow: 0 -10px 18px -8px rgba(0, 0, 0, .75),
                0 0 0 1px rgba(255, 255, 255, .10) inset;
  }
  /* 吸底会盖住最后几行内容，补一段底部留白把内容顶上来 */
  #panel-ship .panel-body, #panel-station .panel-body { padding-bottom: 8px; }
}

@media (max-width: 900px), (max-height: 560px) {
  /* —— 面板：固定宽度 → 自适应 —— */
  .panel.center .panel-inner,
  #panel-pause .panel-inner,
  #panel-settings .panel-inner,
  #panel-station .panel-inner,
  #starter-panel .panel-inner { width: auto; max-width: 860px; }
  #rival-panel { width: min(420px, 92vw); }
  .qd-inner { width: auto !important; max-width: 92vw !important; }
  .panel-inner {
    max-width: 94vw;
    max-height: calc(100dvh - 24px);
    max-height: calc(100svh - 24px);
    max-height: calc(100vh - 24px);
    padding: 14px 16px;
    margin: 0 3vw;
    touch-action: pan-y;
    /* 已移除 -webkit-overflow-scrolling: touch —— Playwright WebKit 实测
       CSS.supports('-webkit-overflow-scrolling','touch') === false。
       该属性 iOS 13 起已从 WebKit 移除，现代 iOS 的惯性滚动是默认行为。
       留着这行只会让人误以为它在生效。 */
  }
  .panel-body { gap: 12px; flex-wrap: wrap; }
  .panel-title { font-size: 17px; letter-spacing: 1px; }

  /* —— 星图画布：等比缩放 —— */
  #planetmap-canvas, #starmap-canvas {
    width: min(660px, calc(94vw - 60px));
    height: auto; aspect-ratio: 660 / 460;
  }
  #starmap-side { width: auto; min-width: 150px; }

  /* —— 开始界面 —— */
  #start-btns { width: min(330px, 82vw); }
  .game-title { font-size: clamp(38px, 11vw, 64px) !important; }
  .game-subtitle { font-size: 12px; letter-spacing: 2px; margin: 6px 0 12px; }
  .btn-primary { padding: 10px 18px; margin: 6px 0; font-size: 15px; letter-spacing: 2px; }
  .btn-plain { padding: 9px 14px; margin: 5px 0; font-size: 13px; }
  .panel-inner > .panel-inner,
  #panel-start .game-title { margin-top: 0; }
  #panel-start .panel-inner { max-height: calc(100dvh - 16px); max-height: calc(100svh - 16px); max-height: calc(100vh - 16px); }
  .start-api-row { flex-wrap: wrap; justify-content: center; gap: 8px; margin-top: 8px; }
  .start-api-row input { width: min(240px, 70vw) !important; }
  .start-api-row select, .start-api-row input { font-size: 13px; padding: 7px 9px; }
  .footer-tip { font-size: 10.5px; padding: 0 10px; margin-top: 10px; }

  /* —— 初始精灵三选一 —— */
  #starter-cards { flex-wrap: wrap; gap: 10px; }
  .st-card { min-width: 128px; max-width: 30%; padding: 10px 8px; }
  .st-thumb, .st-thumb img { width: 64px; height: 64px; }
  .st-name { font-size: 15px; }
  .st-desc { display: none; }

  /* —— HUD 布局收紧 + 刘海安全区 —— */
  #hud-top-left { top: calc(8px + env(safe-area-inset-top, 0px)); left: calc(10px + env(safe-area-inset-left, 0px)); transform-origin: left top; transform: scale(.88); }
  #hud-top-right { top: calc(8px + env(safe-area-inset-top, 0px)); right: calc(10px + env(safe-area-inset-right, 0px)); transform-origin: right top; transform: scale(.88); }
  body.NS_MOBILE #hud-top-right { right: calc(64px + env(safe-area-inset-right, 0px)); }
  #res-chips { max-width: 46vw; }
  #hud-bottom-left { width: min(400px, 44vw); bottom: calc(10px + env(safe-area-inset-bottom, 0px)); left: calc(10px + env(safe-area-inset-left, 0px)); }
  #msg-log { font-size: 11px; }
  #hotbar { gap: 5px; padding: 6px 7px; }
  .hb-slot { width: 42px; height: 42px; border-radius: 9px; }
  .hb-slot .ico { font-size: 17px; }
  .hb-slot .wico { width: 24px; height: 24px; }
  .minimap-wrap { transform: scale(.85); transform-origin: top right; }
  #compass { top: calc(6px + env(safe-area-inset-top, 0px)); }
  #quest-panel { width: 190px; bottom: 200px; right: 10px; }
  #nameplate { font-size: 12px; }

  /* —— 飞船 HUD —— */
  /* ★ 飞行态左侧这 5 张卡（目标行星/空间站/武器/飞船状态/当前任务）在横屏手机上
     竖排吃掉近半屏宽，而且底部"当前任务"被视口下沿截断（真机截图实证：
     "任务板空空如也"下面那行只露出一半）。
     改法：允许换行成 2 列，并给整列留出可滚动 + 上限高度，
     这样 5 张卡全可见，不再被切掉。 */
  /* ★ 宽度要收窄。上一轮我为了修"底部被截断"把它从 178px 改成
     min(46vw,330px)，结果在真机上吃掉近一半屏宽（截图实测：面板右沿到
     屏幕 50% 处），把半个视野和飞船都盖住了 —— 那是修一个引入一个。
     截断的真因是**高度**不是宽度，所以宽度必须保持窄，只加高度上限。 */
  #ship-hud-left { width: 176px; top: calc(8px + env(safe-area-inset-top, 0px));
    left: calc(10px + env(safe-area-inset-left, 0px)); gap: 6px;
    max-height: calc(100dvh - 20px); max-height: calc(100svh - 20px);
    max-height: calc(100vh - 20px); overflow-y: auto; overscroll-behavior: contain;
    pointer-events: auto; }
  #ship-hud-left > * { flex: 0 0 auto; }
  /* 同样让路到右侧中上部，别和虚拟按键抢右下角 */
  #ship-hud-right { width: 186px; transform: none;
    right: calc(10px + env(safe-area-inset-right, 0px));
    top: calc(58px + env(safe-area-inset-top, 0px));
    bottom: calc(146px + env(safe-area-inset-bottom, 0px)); }
  .sh-block { padding: 7px 9px; }
  .sh-title { font-size: 11px; }
  .sh-val { font-size: 13px; }
  .sh-hint { display: none; }

  /* —— 对战 HUD —— */
  #c-log { width: min(540px, 90vw); top: 110px; font-size: 12px; }
  #c-menu { width: min(540px, 94vw); bottom: calc(20px + env(safe-area-inset-bottom, 0px)); gap: 8px; flex-direction: column-reverse; align-items: stretch; }
  #c-actions { flex-direction: row; justify-content: center; }
  #c-actions .c-btn { min-width: 0; flex: 1; justify-content: center; padding: 9px 8px; font-size: 13px; }
  .c-skill { padding: 6px 8px; font-size: 12px; }
  #c-swap-panel { width: min(560px, 92vw); bottom: 170px; }
  .chint { display: none; }

  /* —— 对手面板 / 头像 —— */
  #rival-avatar { right: 10px; }
  .rp-input-row input { min-width: 0; flex: 1; }

  /* —— 开发者控制台默认收窄 —— */
  #dev-panel { width: min(380px, 92vw); }
}

/* 手机触屏设备专项（竖屏大字号补偿等） */
@media (pointer: coarse) and (max-width: 900px) {
  button, .btn-plain, .btn-primary, .m-row { -webkit-user-select: none; user-select: none; }
  .btn-close { width: 38px; height: 38px; }   /* 手指可点性 */
  .map-tab { padding: 8px 14px; }
}

/* ==========================================================================
   HUD v2 · 九宫格安全区布局层
   --------------------------------------------------------------------------
   为什么加这一层：旧版每块 HUD 都用 position:absolute + 手写 right/bottom
   魔法数字，四角互相抢同一块地（资源条被动作键盖住、教程条压罗盘、
   任务面板贴死资源条）。这里把 #hud 改成 3×3 Grid，每块 HUD 只占一格，
   对齐交给浏览器；只有"格子里放不下"的情况才由 JS 量尺寸后微调。
   ========================================================================== */

/* —— 三列安全区骨架 ——
   左列：左上 / 左中 / 左下 —— flex 纵向 space-between，同列元素不可能重叠
   中列：顶部中央（罗盘+提示）/ 底部中央（提示条+快捷栏）
   右列：右上 / 右中 / 右下（触屏动作键） */
#hud {
  position: absolute; inset: 0; pointer-events: none; z-index: 10;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  grid-template-areas: "l c r";
  gap: 8px;
  padding:
    calc(10px + env(safe-area-inset-top,    0px))
    calc(12px + env(safe-area-inset-right,  0px))
    calc(10px + env(safe-area-inset-bottom, 0px))
    calc(12px + env(safe-area-inset-left,   0px));
}
.hz-l { grid-area: l; }
.hz-c { grid-area: c; }
.hz-r { grid-area: r; }
#hud > .hz {
  display: flex; flex-direction: column; gap: 8px;
  min-width: 0; min-height: 0; max-width: 100%;
}
.hz-l { justify-content: space-between; align-items: flex-start; }
.hz-c { justify-content: space-between; align-items: center; }
.hz-r { justify-content: space-between; align-items: flex-end; }
.hz-box { display: flex; flex-direction: column; gap: 6px; min-width: 0; max-width: 100%; }
.hz-box > * { max-width: 100%; min-width: 0; }
.hz-tl, .hz-bl { align-items: flex-start; }
.hz-tr, .hz-mr, .hz-br { align-items: flex-end; }
.hz-bc { align-items: center; max-width: 100%; min-width: 0; }
.hz-tc { align-items: center; }

/* 清掉旧版四角硬定位（保留视觉样式，只废掉布局） */
#hud-top-left, #hud-top-right, #hud-bottom-left,
#hud-bottom-right, #hud-bottom-center { position: static; display: contents; }
#hud-bottom-right { padding: 0; background: none; border: 0; box-shadow: none; backdrop-filter: none; }
#compass { position: static; transform: none; width: auto; height: auto; z-index: auto; }
#prompt {
  position: static; transform: none; left: auto; bottom: auto; z-index: auto;
  display: none;                       /* 有文字时由 UI.prompt 切成 block */
  max-width: min(72vw, 460px); white-space: normal; text-align: center;
}
/* pulse 改用独立的 scale 属性，不再覆盖 translateX（修复提示条动画期间右漂） */
#prompt { animation: promptPulse 1.2s ease-in-out infinite; }
@keyframes promptPulse { 0%,100% { scale: 1;    opacity: 1;   } 50% { scale: 1.04; opacity: .9; } }

/* —— 左上：合成入口（原本摊了 7 个配方 chip，现收成一个按钮） —— */
#craft-entry {
  pointer-events: auto; cursor: pointer;
  display: inline-flex; align-items: center; gap: 6px;
  padding: 5px 12px 5px 8px; border-radius: 11px;
  background: linear-gradient(180deg, rgba(38,30,10,.86), rgba(20,16,6,.9));
  border: 1px solid rgba(255,213,74,.42);
  color: var(--gold); font-size: 12.5px; font-weight: 700; letter-spacing: 1px;
  box-shadow: 0 2px 12px rgba(0,0,0,.4), inset 0 1px 0 rgba(255,255,255,.06);
  backdrop-filter: blur(6px);
  transition: transform .12s var(--ease-pop), border-color .15s, box-shadow .15s;
}
#craft-entry:hover  { border-color: rgba(255,213,74,.75); box-shadow: 0 0 16px rgba(255,213,74,.28); }
#craft-entry:active { transform: scale(.95); }
#craft-entry .ce-ico { text-shadow: 0 0 8px rgba(255,213,74,.6); }
#craft-entry .ce-n {
  min-width: 17px; height: 17px; padding: 0 4px; border-radius: 9px;
  background: var(--gold); color: #23180a; font-family: var(--num);
  font-size: 10.5px; font-weight: 700; line-height: 17px; text-align: center;
}
#craft-entry .ce-n.hidden { display: none; }
#craft-entry.pulse { animation: craftPulse 1.6s ease-in-out infinite; }
@keyframes craftPulse {
  0%,100% { box-shadow: 0 2px 12px rgba(0,0,0,.4), 0 0 0 0 rgba(255,213,74,.4); }
  50%     { box-shadow: 0 2px 12px rgba(0,0,0,.4), 0 0 0 7px rgba(255,213,74,0); }
}
/* 合成面板打开时入口隐藏，避免"点自己又开自己" */
body.craft-open #craft-entry { display: none; }

/* —— 资源条 —— */
/* 限宽：消息/资源条不能再把第一列撑到半屏宽（原 msg-log 441px 抢走一半视口） */
.hz-bl { max-width: min(400px, 34vw); }
.hz-bl .msg { white-space: normal; line-height: 1.45; }
.hz-res {
  max-width: min(320px, 30vw);
  align-items: stretch;
  padding: 7px 11px; border-radius: 12px;
  background: linear-gradient(180deg, rgba(14,22,46,.8), rgba(8,13,30,.84));
  border: 1px solid var(--border); backdrop-filter: blur(6px);
  box-shadow: 0 2px 12px rgba(0,0,0,.35);
}
.res-title { font-size: 9.5px; color: var(--text-faint); letter-spacing: 3px; align-self: flex-start; }
#res-chips-b { display: grid; grid-template-columns: repeat(4, auto); gap: 4px 12px; }

/* —— 右上按钮行（菜单键 / 全屏键） —— */
.hz-btn-row { display: flex; gap: 8px; align-items: center; pointer-events: none; }
.hz-btn-row > * { pointer-events: auto; }
#btn-fullscreen {
  position: static; width: 40px; height: 40px; border-radius: 12px; font-size: 18px; line-height: 38px;
}
#menu-zone { position: static; }
#menu-btn { width: 44px; height: 44px; border-radius: 12px; line-height: 42px; }

/* —— 任务面板 —— */
#quest-panel { position: static; width: 224px; z-index: auto; }
#quest-panel .qp-head { cursor: pointer; user-select: none; }

/* —— 右下动作键：绝对定位交给 Grid，按钮本体不再 fixed —— */
#btn-zone {
  position: static; z-index: auto;
  display: flex; flex-direction: column; align-items: flex-end; gap: 10px;
}
body:not(.NS_MOBILE) #btn-zone { display: none; }

/* —— 一次性操作提示（不再压罗盘：罗盘在上、提示在下，同格纵向排列） —— */
#touch-hint {
  position: static; transform: none; z-index: auto;
  font-size: 11.5px; color: rgba(220,235,255,.9);
  background: rgba(10,16,34,.82); padding: 5px 12px; border-radius: 11px;
  border: 1px solid rgba(120,170,255,.24);
  box-shadow: 0 3px 14px rgba(0,0,0,.45);
  backdrop-filter: blur(6px); white-space: nowrap; pointer-events: none;
}
#touch-hint { white-space: normal; text-align: center; line-height: 1.4; }
#touch-hint.hidden { display: none; }
#touch-hint.fade { animation: hintFade .5s ease forwards; }
@keyframes hintFade { to { opacity: 0; visibility: hidden; } }

/* —— 自由定位层不参与 Grid —— */
#nameplate, #progress-ring { position: absolute; }

/* ==========================================================================
   自适应：窄屏 / 矮屏（横屏手机）
   ========================================================================== */
@media (max-width: 900px), (max-height: 560px) {
  /* 注意：这里一律用"真实尺寸"收缩，不用 transform:scale()。
     transform 不改变布局盒，格子会按缩放前的尺寸占位，
     结果就是右上一列 195px + 消息 94px 把中间行挤成 26px，资源条溢出压住消息。 */
  #hud { gap: 6px; padding:
    calc(6px + env(safe-area-inset-top,    0px))
    calc(8px + env(safe-area-inset-right,  0px))
    calc(6px + env(safe-area-inset-bottom, 0px))
    calc(8px + env(safe-area-inset-left,   0px)); }
  #hud > .hz { gap: 6px; }
  .hz-box { gap: 4px; }

  /* 右上：矮屏（手机横屏）改成横排一行 —— 宽而矮的屏幕上竖向堆叠
     会吃掉 200px 高度，把中间行压没。原来是 213px 的一根柱子。 */
  .hz-tr { flex-direction: row; flex-wrap: wrap; gap: 5px; align-items: flex-start; justify-content: flex-end; }
  .hz-tr .hz-btn-row { order: 1; align-self: flex-start; }
  .hz-tr #planet-info { order: 2; align-self: flex-start; padding: 4px 9px; }
  .hz-tr .minimap-wrap { order: 3; align-self: flex-start; width: 62px; height: 62px; }
  .hz-tr .minimap-wrap canvas { width: 62px; height: 62px; }
  .hz-tr .mm-label { display: none; }
  /* ★ "📖 已捕捉 N 只"被右上角的地图键压住了（真机 OPPO 浏览器截图实证：
     "已捕"两个字从 🗺️ 按钮后面露出来）。
     根因是**两个不同层抢同一块地方**：
       · #menu-zone 在 body 上 position:fixed 右上角（☰ 🗺️ ⛶）
       · #dex-count 在 #hud 的 .hz-tr 里，也是右上角
     body 层在上面，所以 dex-count 被盖住。
     修法：给 .hz-tr 右边留出菜单区的宽度（约 3 个 44px 键 + 间距）。
     注意别用写死的 160px —— 按键数量会变，用 --menu-w 变量跟着走。 */
  /* 留位方式很讲究：
     先试的是给 #dex-count 加 margin-right（菜单区宽度 ≈ 3×46+14=152px），
     结果在 667px 宽的小屏上把整行挤爆 —— inventory 面板 HUD 常驻出界 5 处
     （mobile_sweep 抓到 n露140%/144%/126%）。
     改成给容器 .hz-tr 加 padding-right：flex 容器本来就 flex-wrap:wrap，
     留白会把子项整体左推、空间不够就换行，而不会把行撑到屏幕外。 */
  .hz-tr { padding-right: calc(3 * 46px + 10px + env(safe-area-inset-right, 0px)); }
  .hz-tr #dex-count { order: 4; align-self: center; font-size: 10.5px; }
  .hz-tr #planet-info .pi-name { font-size: 12.5px; }
  .hz-tr #planet-info .pi-sub,
  .hz-tr #planet-info .pi-region { font-size: 10px; margin-top: 1px; padding: 1px 5px; }
  #menu-btn { width: 40px; height: 40px; line-height: 38px; }
  /* 虚拟键：58→52 / 76→64，仍高于 44px 触控下限，但省出 20px 高度 */
  .t-btn { width: 52px; height: 52px; font-size: 21px; line-height: 50px; }
  /* ⛏️ 从 64px 收到和其他键同档（56px）。原来它比同伴大一圈，摆在网格里
     视觉上明显"歪"了一块 —— 真机截图里 2 行 3 列的按键区看着乱，一半就是它。
     触控下限 44px 仍然满足（56 > 44）。 */
  .t-btn.dig { width: 56px; height: 56px; font-size: 23px; line-height: 54px; }
  #btn-zone { gap: 8px; }
  .btn-row { gap: 8px; }
  #btn-fullscreen { width: 40px; height: 40px; line-height: 38px; font-size: 17px; }

  /* 左上 */
  .hz-tl { gap: 4px; }
  #vitals { min-width: 0; padding: 5px 8px; gap: 3px; }
  .vit-ico { font-size: 12px; width: 15px; }
  .vit-bar { height: 7px; }
  .vit.xp .vit-bar { height: 5px; }
  .vit-num { font-size: 10.5px; width: 28px; }
  #craft-entry { font-size: 11.5px; padding: 3px 9px 3px 6px; }

  /* 资源条：单行横向滚动 —— 高度恒定，永不纵向溢出 */
  .hz-res { max-width: min(46vw, 260px); padding: 4px 8px; gap: 2px; }
  .hz-res .res-title { display: none; }
  #res-chips-b {
    display: flex; flex-wrap: nowrap; gap: 8px; max-width: 100%; width: 100%;
    overflow-x: auto; overflow-y: hidden;
    scrollbar-width: none; -ms-overflow-style: none;
    padding-bottom: 1px;
  }
  #res-chips-b::-webkit-scrollbar { display: none; }
  .chipb { font-size: 10.5px; flex: none; }
  .chipb .ic { width: 10px; height: 10px; }
  .chipb .k { font-size: 9.5px; }

  /* 右中任务面板 */
  #quest-panel { width: 168px; }
  .qp-head { padding: 5px 8px; font-size: 11.5px; }
  .qp-obj { padding: 0 8px 7px; font-size: 10.5px; line-height: 1.5; }

  /* 左下消息：限宽 + 换行 + 最多 2 条（由 hud_layout 兜底裁剪） */
  .hz-bl { max-width: min(38vw, 210px); }
  .hz-bl #msg-log { font-size: 10.5px; max-height: 56px; overflow: hidden; }
  .hz-bl .msg { font-size: 10.5px; padding: 3px 8px; line-height: 1.45; white-space: normal; }

  /* 底部中央 */
  .compass-bar { width: min(280px, 46vw); height: 26px; }
  #prompt { font-size: 12.5px; padding: 5px 12px; letter-spacing: 1px; max-width: min(60vw, 340px); }
  .hz-bc { gap: 4px; }
  #hotbar { gap: 4px; padding: 5px 6px; border-radius: 12px; }
  .hb-slot { width: 38px; height: 38px; border-radius: 8px; }
  .hb-slot .ico { font-size: 15px; }
  .hb-slot .wico { width: 22px; height: 22px; }
  .hb-slot .cnt { font-size: 9px; }
}

/* 竖屏（游戏本身会挡提示，横屏下极少触发）：进一步收窄 */
@media (max-width: 700px) {
  /* 窄屏三列抢地盘：左右列必须硬顶宽度，否则中间列被挤到 0，
     #prompt 溢出压到两侧（667px 上实测溢出 9px） */
  .hz-res { max-width: min(30vw, 170px); }
  .hz-bl  { max-width: min(26vw, 150px); }
  #prompt { max-width: 100%; font-size: 11px; padding: 3px 9px; letter-spacing: 0; }
  .hb-slot { width: 34px; height: 34px; border-radius: 7px; }
  .hb-slot .ico { font-size: 14px; }
  .hb-slot .wico { width: 20px; height: 20px; }
  #hotbar { gap: 3px; padding: 4px 5px; }
  #prompt { font-size: 11.5px; padding: 4px 10px; }
}

/* 触屏设备：动作键常驻右下，资源条让到左中（hz-res 的 grid-area 就是 res） */

/* 资源条：数量为 0 的压暗，但格子保留（位置固定） */
.chipb.zero { opacity: .34; }
.chipb.zero b { color: var(--text-faint); }

/* ==========================================================================
   背包 v2 · 工具条 / 搜索 / 排序 / 槽位选择
   ========================================================================== */
.inv-toolbar {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  margin-bottom: 10px;
}
.inv-search {
  flex: 1; min-width: 140px; max-width: 240px;
  padding: 7px 12px; border-radius: 10px; font-size: 13px;
  background: rgba(10,17,36,.9); color: var(--text);
  border: 1px solid var(--border); outline: none;
  font-family: system-ui, sans-serif;
}
.inv-search:focus { border-color: var(--border-strong); box-shadow: 0 0 12px rgba(0,210,255,.18); }
.inv-search::placeholder { color: var(--text-faint); }
.inv-sorts { display: flex; gap: 5px; flex-wrap: wrap; }
.sort-btn {
  padding: 5px 11px; border-radius: 9px; font-size: 11.5px; cursor: pointer;
  background: rgba(255,255,255,.05); color: var(--text-dim);
  border: 1px solid var(--border); font-family: system-ui, sans-serif;
  transition: all .15s;
}
.sort-btn:hover { border-color: var(--border-strong); color: var(--text); }
.sort-btn.on { color: #03101f; background: linear-gradient(180deg,#8fe8ff,#2fa8ff); border-color: transparent; font-weight: 700; }

/* 未拥有的格子：保留位置、压暗（位置固定 → 肌肉记忆成立） */
.inv-slot.zero { opacity: .32; filter: saturate(.5); }
.inv-slot.zero .inv-count { color: var(--text-faint); border-color: rgba(120,170,255,.2); }

/* 详情条：直接选槽放入（不再依赖"先在快捷栏点第几格"） */
.id-slots { display: flex; align-items: center; gap: 6px; margin-top: 7px; flex-wrap: wrap; }
.slot-btn {
  width: 30px; height: 30px; border-radius: 9px; cursor: pointer;
  background: linear-gradient(180deg, rgba(40,62,104,.85), rgba(22,36,66,.9));
  border: 1px solid rgba(120,170,255,.34); color: #cfe4ff;
  font-family: var(--num); font-size: 12.5px; font-weight: 700;
  transition: all .12s;
}
.slot-btn:hover:not([disabled]) { border-color: var(--gold); color: var(--gold); transform: translateY(-1px); }
.slot-btn.fixed { opacity: .32; cursor: not-allowed; }
.slot-btn.on { background: linear-gradient(180deg, #ffd54a, #e0a020); color: #23180a; border-color: transparent; }
.id-hint { font-size: 10.5px; color: var(--text-faint); }

/* ==========================================================================
   合成 v2 · 独立面板
   ========================================================================== */
.craft-toolbar {
  font-size: 13px; color: var(--ok); margin-bottom: 10px; letter-spacing: .5px;
  min-height: 18px;
}
.craft-card { display: flex; flex-direction: column; gap: 4px; }
.craft-card.ok { border-color: rgba(110,224,138,.4); }
.cc-head { display: flex; align-items: center; gap: 7px; }
.cc-ico { font-size: 15px; }
.cc-name { font-size: 13px; font-weight: 700; color: #fff; }
#craft-list .craft-grid { grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); }
#craft-list .craft-card .btn-small { margin-top: auto; }

/* 触屏：排序/搜索按钮要够大 */
@media (pointer: coarse) {
  .sort-btn { padding: 9px 14px; font-size: 12.5px; }
  .inv-search { padding: 10px 13px; font-size: 14px; }
  .slot-btn { width: 36px; height: 36px; }
}

/* ==========================================================================
   面板布局修正
   .panel-body 默认是横排 flex（星图等两栏面板在用），竖排内容必须显式声明，
   否则子块会并排挤成两列、宽度被压到一条。
   .btn-primary 默认 width:100% 的通栏大按钮，放进面板头会被拉成半屏宽。
   （.inv-pet-btn / .two-col 这两个类名在样式表里从来没有对应规则。）
   ========================================================================== */
.panel-body.col { flex-direction: column; }
.panel-head { gap: 10px; }
.panel-head > * { flex: none; }
.panel-head .btn-primary,
.panel-head .btn-head {
  width: auto; margin: 0; padding: 8px 15px; font-size: 13px;
  letter-spacing: 1px; white-space: nowrap;
}
.inv-grid { width: 100%; }

/* 合成面板：宽版容器 + 两列配方卡；按钮收窄，别喧宾夺主 */
#panel-craft .craft-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
#craft-list .craft-card { padding: 9px 11px; }
#craft-list .craft-card .btn-small { align-self: flex-start; padding: 6px 20px; font-size: 12.5px; }
@media (max-width: 760px) {
  #panel-craft .craft-grid { grid-template-columns: 1fr; }
}

/* ==========================================================================
   HUD 可点性修复（回归）
   --------------------------------------------------------------------------
   #hud 是 pointer-events:none（让 3D 场景能收到触摸）。所有需要点击的
   HUD 子元素必须显式 pointer-events:auto，否则是死的 —— 实测踩过：
   任务面板折叠、小地图都被漏掉，整个面板点不动。
   规则：能点的一律列进来，别靠"这个应该能点吧"。
   ========================================================================== */
#hud .minimap-wrap,
#hud #quest-panel,
#hud #quest-panel *,
#hud #res-chips-b,
#hud #planet-info,
#hud #dex-count,
#hud #compass { pointer-events: auto; }

/* 任务面板折叠：整条标题栏可点，命中区撑满，别只点那个 15px 的 ▾ */
#hud .qp-head { pointer-events: auto; cursor: pointer; min-height: 34px; }
#hud #quest-toggle {
  width: 34px; height: 34px; min-width: 34px; min-height: 34px;
  font-size: 15px; line-height: 32px; padding: 0; border-radius: 9px;
  display: inline-flex; align-items: center; justify-content: center;
  touch-action: manipulation; -webkit-tap-highlight-color: transparent;
}

/* 小地图：提示里写了"M 键查看大地图"，就该能点（手机上没 M 键） */
#hud .minimap-wrap { cursor: pointer; touch-action: manipulation; -webkit-tap-highlight-color: transparent; }
#hud .minimap-wrap:active { filter: brightness(1.25); }

/* ==========================================================================
   触控目标尺寸（移动端可点性）
   平台下限 44px（Apple HIG / Android 48dp），且彼此要留间距。
   ========================================================================== */
@media (pointer: coarse) {
  #hud .hb-slot        { width: 44px; height: 44px; flex: none; }
  #hud #hotbar         { gap: 6px; padding: 7px 8px; flex: none; }
  #craft-entry         { min-height: 44px; padding: 0 14px 0 10px; font-size: 13px; }
  #btn-fullscreen      { width: 44px; height: 44px; line-height: 42px; font-size: 19px; }
  #menu-btn            { width: 44px; height: 44px; line-height: 42px; }
  #quest-toggle        { width: 44px; height: 44px; min-width: 44px; min-height: 44px; }
  .hz-res .chipb       { min-height: 26px; }
  .btn-close           { width: 44px; height: 44px; font-size: 17px; }
}


/* ==========================================================================
   横屏手机实拍修正（844x390 @3x 实测）
   --------------------------------------------------------------------------
   实拍发现三个问题，都不是"3D 画质"而是移动端 HUD 排版：

   1) 底部物品栏文字溢出槽外
      触摸目标下限那条规则（@media (pointer:coarse)）把 .hb-slot 从横屏的
      38px 又覆盖回 44px，但图标 20px + 名称 + 数量 三行塞进 44px 高度，
      "捕捉球/医疗包/基地核心" 这些三字名称直接溢出到槽外面、和图标糊在一起。
      横屏手机上标准做法是"图标 + 数量"，名称靠长按/详情条看。
      → 移动端隐藏名称，保留 44px 点击区域（可点性不能降）。

   2) 右下角操作按钮压在任务面板上
      HUD 是 3×3 栅格（hz-mr 放任务面板、hz-br 放操作按钮），
      横屏 390px 高度下中间行和底部行都很矮，内容一多就互相压。
      → 任务面板限制高度 + 抬高，让出底部按钮的空间。

   3) 顶栏元素过大，横向被挤
      → 横屏矮屏下收窄星球信息/资源条，字号下调。
   ========================================================================== */
@media (pointer: coarse) and (orientation: landscape) and (max-height: 480px) {
  /* 1) 物品栏：只留图标 + 数量，名称移到详情条 */
  #hud .hb-slot .hb-nm { display: none; }   /* 名称移到 title/详情条 */
  #hud .hb-slot { width: 46px; height: 46px; padding: 0; }
  #hud .hb-slot .ico { font-size: 22px; }
  #hud .hb-slot .wico { width: 26px; height: 26px; }
  /* 数量改到角标位置，避免占用图标下方的垂直空间 */
  #hud .hb-slot .cnt {
    position: absolute; right: 3px; bottom: 2px; font-size: 10px; line-height: 1;
    padding: 1px 3px; border-radius: 4px; background: rgba(4,10,22,.82);
  }
  #hud #hotbar { gap: 5px; padding: 6px 7px; }

  /* 2) 任务面板：限高 + 上移，避开右下操作按钮
        ★ 必须显式写 position:absolute —— 移动端栅格布局把它设成了
          position:static（靠 3×3 栅格的 hz-mr 格摆放），
          static 元素上 top/right/bottom 全部无效，
          于是面板还是留在原格被右下按钮压住。 */
  #hud #quest-panel {
    position: absolute; top: 84px; right: 10px; bottom: auto;
    width: 156px; max-height: 88px; overflow: hidden; z-index: 40;
  }
  #hud #quest-panel .qp-head { padding: 4px 8px; font-size: 11px; }
  #hud #quest-panel .qp-obj {
    padding: 0 8px 6px; font-size: 10.5px; line-height: 1.45;
    display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
  }

  /* 3) 顶栏瘦身 */
  #hud #planet-info { padding: 5px 9px; }
  #hud #planet-info .pi-name { font-size: 13px; }
  #hud #planet-info .pi-sub { font-size: 9.5px; }
  #hud .hz-res { max-width: min(30vw, 168px); }
  #hud .hz-bl  { max-width: min(28vw, 158px); }
  #hud #msg-log .msg { font-size: 10px; padding: 3px 7px; }
  #hud #prompt { font-size: 11.5px; padding: 4px 10px; max-width: min(46vw, 300px); }
  #hud #compass-bar { height: 24px; }
  /* 一次性操作提示不该长期压在 NPC 名牌上 */
  #hud #touch-hint { font-size: 10.5px; opacity: .85; }

  /* 4) 左下消息：原来是「每条最多留 56px、消息可折 3 行」，
        结果永远显示一条被拦腰切断的文字（实测消息框 56px 高、
        单条消息在 158px 宽下折 3 行有 50px）。
        看起来就像界面没做完。这里改成每条最多 2 行 + 行数不够时省略号，
        日志高度正好容纳 2 条完整消息 —— 要么看全，要么干脆不显示。 */
  #hud .hz-bl #msg-log { max-height: 74px; }
  #hud .hz-bl .msg {
    display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
    overflow: hidden; text-overflow: ellipsis;
  }
}
