* { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

/* 修复：移动端 WebView 按钮点击后 :focus 残留高亮（必须点击空白处才消失）—— 全局去焦点环 */
*:focus { outline: none !important; }
*:focus-visible { outline: none !important; }
button:focus, button:focus-visible { outline: none; box-shadow: none; }
:root {
  --bg: #1b2230;
  --panel: #232c3d;
  --panel2: #2c384d;
  --ink: #e8eef7;
  --muted: #9fb0c7;
  --accent: #ffcf5c;
  --good: #6bd08a;
  --bad: #ff7a7a;
  --line: #3a4760;
}
html, body { height: 100%; overscroll-behavior: none; }
body {
  font-family: "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
  background: var(--bg);
  color: var(--ink);
  -webkit-user-select: none;
  user-select: none;
  overflow: hidden;
}
#app { display: flex; flex-direction: column; height: 100vh; height: 100dvh; }

/* HUD */
#hud {
  display: flex; gap: 14px; align-items: center;
  padding: max(8px, env(safe-area-inset-top, 0px)) 14px 8px; background: var(--panel);
  border-bottom: 2px solid var(--line);
  flex-wrap: wrap;
}
.hud-item { display: flex; align-items: baseline; gap: 4px; font-size: 15px; }
.hud-label { color: var(--muted); font-size: 12px; }
#hudMoney { color: var(--accent); font-weight: 700; font-size: 17px; }
#hudRep { color: var(--good); font-weight: 700; }
#hudGrade { color: var(--accent); font-weight: 700; }
#hudPetCoin { color: #f6c453; font-weight: 700; text-shadow: 0 0 6px rgba(246,196,83,.35); }
/* 顶部状态栏：科技状态条（4 条科技线激活状态，替代建筑上的徽章） */
.tech-bar { display: flex; gap: 6px; align-items: center; margin-left: auto; }
.tech-chip {
  width: 26px; height: 26px; border-radius: 8px; padding: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 14px; cursor: pointer; border: 1px solid var(--line);
  background: var(--panel2); opacity: .35; filter: grayscale(1); transition: .15s;
}
.tech-chip .tc-ico { line-height: 1; }
.tech-chip.on {
  opacity: 1; filter: none; border-color: var(--tc);
  background: rgba(255,255,255,0.08); box-shadow: 0 0 8px -1px var(--tc);
}
.tech-chip:active { transform: translateY(1px); }

/* Stage */
#stage { position: relative; flex: 1; overflow: hidden; background: #2a3320; touch-action: none; }
/* 修复：canvas 已 100% 铺满 stage 并由 game.js blitScene 渲染周边草地/夜色背景，
   #stage 背景色仅在 canvas 初始化/失败时短暂可见，恢复墨绿色作为兜底（v1.6 用户反馈） */
#game { display: block; position: absolute; inset: 0; image-rendering: pixelated; touch-action: none; }
/* 修复：原 position:absolute + top/right/bottom/left:0 + margin:auto 是 canvas 居中模式，
   canvas DOM 尺寸 < stage 时会留白。改为 inset:0 强制 100% 铺满 stage，
   canvas 周边（场景外的区域）由 game.js blitScene 按昼夜 fillRect 草地/夜色（v1.6 用户反馈） */

/* Build info */
/* Build info：屏幕中间偏上的悬浮提示气泡（v1.6 玩家反馈左下角太挡中央圈地/建造视野，
   移到屏幕 40% 高度水平居中位置，远离顶部副本/目标/园区规划提示堆叠区，也不挡底部工具栏） */
.build-info {
  position: absolute; top: 40%; left: 50%; transform: translate(-50%, -50%);
  z-index: 12;
  background: rgba(20,26,38,.9); border: 1px solid var(--line);
  padding: 7px 14px; border-radius: 20px; font-size: 12px; color: var(--muted);
  max-width: 70vw; text-align: center;
  box-shadow: 0 6px 18px rgba(0,0,0,.4);
}
.build-info b { color: var(--accent); }

/* Bld info（屏幕居中卡片 + 背景遮罩） */
/* 建筑详情不再使用全屏遮罩：遮罩会挡住 canvas 导致弹窗后无法再点其它建筑查看。
   改为悬浮面板 + 关闭按钮，点击穿透到 canvas 由 handleTap 负责切换/关闭。 */
.bld-backdrop { display: none; }
.bld-info {
  position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%);
  width: min(260px, 80vw); z-index: 16;
  background: rgba(20,26,38,.97); border: 1px solid var(--line);
  border-radius: 12px; padding: 14px 16px; font-size: 13px; line-height: 1.7;
  max-height: 82vh; overflow-y: auto;
  /* v1.6.2 详情面板触屏滚动修复：纵滑明确、惯性滚动、阻止滚动手势穿透到 canvas 平移 */
  touch-action: pan-y; -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain; scrollbar-width: thin;
  box-shadow: 0 12px 40px rgba(0,0,0,.5); animation: pop .2s ease;
}
.bld-info h3 { font-size: 15px; margin-bottom: 2px; color: var(--accent); }
.bld-info .bld-sub { font-size: 12px; color: var(--muted); margin-bottom: 8px; }
.bld-info .bld-tag { display: inline-block; font-size: 11px; padding: 1px 7px; border-radius: 999px; margin: 0 4px 8px 0; border: 1px solid var(--line); color: var(--muted); }
.bld-info .row { display: flex; justify-content: space-between; color: var(--muted); }
.bld-info .row span:last-child { color: var(--ink); }
.bld-info button { margin-top: 8px; width: 100%; }

/* Modal */
.modal {
  position: absolute; top: 0; right: 0; bottom: 0; left: 0; background: rgba(8,11,17,.6);
  display: flex; align-items: flex-start; justify-content: center;
  padding: 5vh 12px;     /* 顶部/底部始终留出空间，避免内容贴边被系统栏遮挡 */
  overflow-y: auto;       /* 唯一滚动容器：内容超高时整体可滚动，保证顶/底都能看到 */
  -webkit-overflow-scrolling: touch;   /* iOS/WebView 惯性滚动 */
  overscroll-behavior: contain;        /* 阻止滚动链穿透到背景 canvas */
  touch-action: pan-y;                 /* 明确纵向滚动，消除触屏首次滚动的启动延迟 */
  z-index: 21;
}
/* 创业弹窗盖在创业层之上（ventureLayer z=40）：否则滚到顶/底时，
   顶部状态栏/进度条和底部按钮条会把弹窗首尾内容遮住 */
#ventureModal { z-index: 200; }
/* 收支/结算通用着色（此前结算弹窗引用但从未定义样式） */
.green { color: #4caf7d; }
.red { color: #e0564b; }
.modal-card {
  width: min(440px, 90%); background: var(--panel);
  border: 2px solid var(--line); border-radius: 16px; padding: 20px;
  margin: auto 0;          /* 有空余时垂直居中；超高时贴顶，由外层 .modal 统一滚动 */
  box-shadow: 0 12px 40px rgba(0,0,0,.5);
  animation: pop .25s ease;
}
@keyframes pop { from { transform: scale(.9); opacity: 0; } to { transform: scale(1); opacity: 1; } }
/* 建筑寿命到期弹窗（v1.6.0）：翻新 / 拆除 */
.reno-card { text-align: center; }
.reno-card h3 { font-size: 17px; margin: 0 0 10px; }
.reno-msg { font-size: 13px; line-height: 1.6; margin: 0 0 14px; }
.reno-opts { display: flex; gap: 10px; margin: 0 0 10px; }
.reno-opts .act-btn { flex: 1; font-size: 13px; }
.reno-tip { font-size: 11px; color: var(--muted); line-height: 1.5; margin: 0; }
.modal-tag {
  display: inline-block; background: var(--accent); color: #2a2200;
  font-size: 12px; font-weight: 700; padding: 2px 10px; border-radius: 10px; margin-bottom: 8px;
}
.modal-card h2 { font-size: 20px; margin-bottom: 8px; }
.modal-card p { color: var(--muted); line-height: 1.7; margin-bottom: 16px; }
/* 经营分析：净收入折线图 */
.trend-canvas {
  display: block; width: 100%; height: 130px;
  background: var(--panel2); border: 1px solid var(--line);
  border-radius: 10px; margin-bottom: 6px;
}
/* 存档导出 / 导入面板 */
.save-io-text {
  width: 100%; min-height: 120px; resize: vertical; box-sizing: border-box;
  background: var(--panel2); color: var(--ink); border: 1px solid var(--line);
  border-radius: 10px; padding: 10px; font-family: ui-monospace, Menlo, Consolas, monospace;
  font-size: 12px; line-height: 1.5; word-break: break-all; margin-bottom: 12px;
}
.save-io-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.save-io-actions .act-btn { flex: 1 1 auto; min-width: 90px; }
.choices { display: flex; flex-direction: column; gap: 10px; }
.choice-btn {
  text-align: left; background: var(--panel2); border: 1px solid var(--line);
  color: var(--ink); border-radius: 10px; padding: 10px 12px; cursor: pointer;
  transition: .15s; font-size: 14px;
}
.choice-btn:hover { border-color: var(--accent); transform: translateY(-1px); }
.choice-btn .eff { display: block; font-size: 12px; color: var(--muted); margin-top: 3px; }
.modal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.modal-head span { font-size: 18px; font-weight: 700; color: var(--accent); }
.modal-x { background: none; border: none; color: var(--muted); font-size: 18px; cursor: pointer; line-height: 1; padding: 4px 6px; }
.modal-x:hover { color: var(--ink); }
.modal-body { display: flex; flex-direction: column; gap: 10px; }
.modal-body .muted { font-size: 12px; line-height: 1.6; color: var(--muted); }
.choice-btn.disabled { opacity: .45; cursor: not-allowed; }
.choice-btn.disabled:hover { border-color: var(--line); transform: none; }
.choice-label { font-weight: 600; }
/* 招商/营销：品牌与营销活动改成等长网格卡片，避免格子长短不一 */
.inv-section { margin-bottom: 16px; }
.inv-h { font-size: 15px; font-weight: 700; margin: 4px 0 6px; }
.inv-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; align-items: stretch; }
.inv-grid .choice-btn { display: flex; flex-direction: column; gap: 4px; text-align: left; height: 100%; align-items: flex-start; }
.inv-grid .choice-btn .eff { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 4; overflow: hidden; }
/* 经营分析：收支 + 数据 两段分区卡片 */
.an-sec { background: rgba(255,255,255,.03); border: 1px solid var(--line); border-radius: 12px; padding: 12px; margin-bottom: 12px; }
.an-h { font-size: 15px; font-weight: 700; margin-bottom: 8px; color: var(--accent); }
.an-net { border-top: 1px solid var(--line); margin-top: 6px; padding-top: 8px; font-weight: 700; }
/* 产业链集群：三条链明细卡片 + 业态芯片 */
.cluster-row { border: 1px solid var(--line); border-radius: 10px; padding: 9px 10px; margin-top: 8px; background: rgba(255,255,255,.02); }
.cluster-row.on { border-color: rgba(255,210,90,.55); box-shadow: 0 0 14px rgba(255,200,70,.18) inset; }
.cluster-row.off { opacity: .82; }
.cr-top { display: flex; justify-content: space-between; align-items: baseline; font-weight: 700; }
.cr-name { font-size: 14px; }
.cr-bonus { font-size: 13px; }
.cr-types { margin: 6px 0 4px; display: flex; flex-wrap: wrap; align-items: center; gap: 4px; }
.chip { display: inline-flex; align-items: center; gap: 3px; padding: 2px 8px; border-radius: 999px; font-size: 12px; border: 1px solid var(--line); }
.chip.on { background: rgba(255,210,90,.16); border-color: rgba(255,210,90,.5); color: #ffd86e; }
.chip.off { background: rgba(255,255,255,.04); color: var(--muted); }
.cr-note { font-size: 12px; }
/* 事件结果弹窗：选择后才揭晓的具体结果 */
.result-stats { font-size: 15px; font-weight: 700; color: var(--accent); margin: 2px 0 18px; }
.result-stats:empty { display: none; }
.result-ok { width: 100%; margin-top: 4px; }

/* 成就面板 */
.ach-card { max-height: 84vh; display: flex; flex-direction: column; }
#achBody { flex: 1 1 auto; min-height: 0; overflow-y: auto; gap: 4px; }
.ach-summary { font-size: 13px; color: var(--muted); margin-bottom: 4px; }
.ach-summary b { color: var(--accent); font-size: 16px; }
.ach-cat { font-size: 14px; font-weight: 700; color: var(--ink); margin: 10px 0 6px; border-left: 3px solid var(--accent); padding-left: 8px; }
.ach-grid { display: flex; flex-direction: column; gap: 6px; }
.ach-item { display: flex; align-items: center; gap: 10px; background: var(--panel2); border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px; opacity: .55; }
.ach-item.done { opacity: 1; border-color: var(--accent); background: rgba(255,196,0,.08); }
.ach-ico { font-size: 22px; width: 30px; text-align: center; flex: 0 0 auto; filter: grayscale(1); }
.ach-item.done .ach-ico { filter: none; }
.ach-main { flex: 1 1 auto; min-width: 0; }
.ach-name { font-size: 14px; font-weight: 700; color: var(--ink); }
.ach-desc { font-size: 11px; color: var(--muted); line-height: 1.4; margin: 2px 0 5px; }
.ach-bar { height: 5px; background: rgba(255,255,255,.08); border-radius: 3px; overflow: hidden; }
.ach-bar span { display: block; height: 100%; background: var(--accent); border-radius: 3px; transition: width .3s; }
.ach-prog { flex: 0 0 auto; font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; min-width: 44px; text-align: right; }
.ach-item.done .ach-prog { color: var(--good); }
/* 成就右侧栏：进度 + 单独分享按钮 */
.ach-side { flex: 0 0 auto; display: flex; flex-direction: column; align-items: flex-end; gap: 6px; }
.ach-share-one {
  background: rgba(255,196,0,.14); color: var(--accent); border: 1px solid var(--accent);
  border-radius: 8px; padding: 4px 9px; font-size: 11px; font-weight: 700; cursor: pointer; white-space: nowrap;
  transition: .15s;
}
.ach-share-one:active { transform: translateY(1px); filter: brightness(.95); }

/* 成就分享按钮（面板顶部） */
.ach-share {
  width: 100%; background: var(--accent); color: #2a2200; border: none;
  border-radius: 10px; padding: 11px; font-size: 15px; font-weight: 700; cursor: pointer;
  margin-bottom: 6px; transition: .15s;
}
.ach-share:active { transform: translateY(1px); filter: brightness(.95); }

/* 成就徽章墙（顶部）：每种大类全部达成解锁一枚，金色勋章 + 呼吸辉光；未获=灰色剪影 */
.badge-head { font-size: 15px; font-weight: 700; color: var(--ink); margin: 2px 0 8px; display: flex; align-items: center; gap: 8px; }
.badge-count { font-size: 13px; color: var(--muted); font-weight: 400; }
.badge-wall { display: flex; flex-wrap: wrap; gap: 12px; margin-bottom: 14px; padding: 14px 10px; background: var(--panel2); border: 1px solid var(--line); border-radius: 12px; justify-content: space-around; }
.badge { position: relative; width: 76px; display: flex; flex-direction: column; align-items: center; gap: 5px; }
.badge-ico {
  width: 64px; height: 64px; display: flex; align-items: center; justify-content: center;
  background: transparent; position: relative;
}
.medal-svg { width: 100%; height: 100%; display: block; pointer-events: none; }
.badge-name { font-size: 11px; color: var(--muted); text-align: center; line-height: 1.25; font-weight: 600; }
.badge-lock { position: absolute; top: -2px; right: 6px; font-size: 13px; filter: drop-shadow(0 1px 1px rgba(0,0,0,.4)); z-index: 2; }
/* 未获：灰色剪影 */
.badge.locked { filter: grayscale(1) brightness(.85); opacity: .42; }
/* 已获：16-bit 像素勋章 + cyan/magenta 霓虹辉光 + 微微摆动 */
.badge.earned .badge-name { color: #19f6ff; font-weight: 700; text-shadow: 0 0 6px rgba(25,246,255,.5); }
.badge.earned .badge-ico { animation: badgeRock 5s ease-in-out infinite; }
/* 内层 cyan 霓虹溢出辉光 */
.badge.earned .badge-ico::before {
  content: ''; position: absolute; left: 50%; top: 50%; width: 64px; height: 64px;
  border-radius: 50%; transform: translate(-50%, -50%); pointer-events: none;
  background: radial-gradient(circle, rgba(25,246,255,.6) 0%, rgba(25,246,255,.24) 45%, rgba(25,246,255,0) 75%);
  animation: badgeHalo 2.6s ease-in-out infinite; filter: blur(3px); z-index: -1;
}
/* 外层 magenta 霓虹溢出辉光 */
.badge.earned .badge-ico::after {
  content: ''; position: absolute; left: 50%; top: 50%; width: 94px; height: 94px;
  transform: translate(-50%, -50%); pointer-events: none; border-radius: 50%;
  background: radial-gradient(circle, rgba(255,43,214,.45) 0%, rgba(255,43,214,0) 65%);
  animation: badgeHaloOuter 3.4s ease-in-out infinite; z-index: -2;
}
@keyframes badgeRock {
  0%, 100% { transform: rotate(-3deg); }
  50%      { transform: rotate(3deg); }
}
@keyframes badgeHalo {
  0%, 100% { opacity: .55; transform: translate(-50%, -50%) scale(.92); }
  50%      { opacity: 1;   transform: translate(-50%, -50%) scale(1.15); }
}
@keyframes badgeHaloOuter {
  0%, 100% { opacity: .35; transform: translate(-50%, -50%) scale(.95); }
  50%      { opacity: .8;  transform: translate(-50%, -50%) scale(1.32); }
}

/* 成就分享弹窗 */
.share-card { width: min(360px, 88%); }
.share-body { gap: 12px; align-items: stretch; }
.share-img { width: 100%; border-radius: 12px; border: 1px solid var(--line); display: block; background: #141a26; }
.share-dl { width: 100%; background: var(--accent); color: #2a2200; font-weight: 700; border: none; }

/* 通用确认弹窗 */
.confirm-card { width: min(340px, 86%); }
/* white-space: pre-line —— 文案里作者写的 \n 要能真的换行。
   showConfirm 用 textContent 赋值，没有这条的话换行会被 HTML 折叠成一个空格。 */
.confirm-msg { font-size: 14px; line-height: 1.6; color: var(--ink); margin: 4px 2px 2px; white-space: pre-line; }
.confirm-actions { display: flex; gap: 10px; margin-top: 14px; }
.confirm-actions .act-btn { flex: 1; border: 1px solid var(--line); background: var(--panel2); color: var(--ink); font-weight: 700; padding: 10px; border-radius: 10px; cursor: pointer; }
.confirm-actions .danger-btn { background: #e0564b; color: #fff; border-color: #e0564b; }
.confirm-actions .act-btn:active { transform: translateY(1px); filter: brightness(.95); }
.share-dl:active { transform: translateY(1px); }

/* Toast */
.toast {
  position: absolute; top: 14px; left: 50%; transform: translateX(-50%);
  background: var(--good); color: #06210f; font-weight: 700;
  padding: 8px 18px; border-radius: 20px; z-index: 30; font-size: 14px;
  max-width: 92vw; white-space: nowrap; text-align: center;
  box-shadow: 0 6px 20px rgba(0,0,0,.4); animation: pop .25s ease;
}
.toast.bad { background: var(--bad); color: #4a0e0e; }

/* Toolbar：建造栏横滑 + 操作栏横滑，竖屏双行布局 */
#toolbar {
  position: relative;
  display: flex; flex-direction: column; gap: 6px; padding: 8px 10px;
  padding-bottom: max(28px, env(safe-area-inset-bottom, 0px));
  background: var(--panel); border-top: 2px solid var(--line);
}
.tool-build {
  display: flex; flex-direction: column; gap: 6px;
}
.cat-tabs {
  display: flex; gap: 6px; overflow-x: auto; padding-bottom: 2px;
  scrollbar-width: none; -webkit-overflow-scrolling: touch;
}
.cat-tabs::-webkit-scrollbar { display: none; }
.cat-tab {
  flex: 0 0 auto; background: var(--panel2); border: 1px solid var(--line); color: var(--muted);
  border-radius: 999px; padding: 5px 13px; font-size: 12.5px; cursor: pointer;
  white-space: nowrap; transition: .15s;
}
.cat-tab.active { background: var(--accent); color: #2a2200; border-color: var(--accent); font-weight: 700; }
.tool-row {
  display: flex; gap: 8px; overflow-x: auto; padding-bottom: 2px;
  scrollbar-width: none; -webkit-overflow-scrolling: touch;
}
.tool-row::-webkit-scrollbar { display: none; }
.tool-build::-webkit-scrollbar { display: none; }
.tool-btn {
  flex: 0 0 auto; min-width: 60px;
  background: var(--panel2); border: 1px solid var(--line); color: var(--ink);
  border-radius: 10px; padding: 7px 8px; cursor: pointer; font-size: 13px;
  display: flex; flex-direction: column; align-items: center; gap: 2px; transition: .15s;
}
.tool-btn .sw { width: 27px; height: 30px; image-rendering: pixelated; display: block; }
.tool-btn .sw.dem { width: 16px; height: 16px; border-radius: 4px; background: #ff7a7a; margin: 7px 0; }
.tool-btn .sw.sp { width: 16px; height: 16px; border-radius: 4px; background: #5b8def; color: #fff; margin: 7px 0; display: flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 700; }
.tool-btn .nm { font-weight: 600; }
.tool-btn .cost { color: var(--muted); font-size: 11px; }
.tool-btn.active { border-color: var(--accent); box-shadow: 0 0 0 2px rgba(255,207,92,.3); }
.tool-btn:hover { transform: translateY(-1px); }
/* 夜市建筑按钮（v1.6.0 夜景经济）：深色底 + 暖色描边 + emoji 大图标，夜市区专属辨识 */
.tool-btn.night-btn { background: #2c2430; border-color: #6a4a2a; }
.tool-btn.night-btn .sw.sp.night-ico { width: 22px; height: 22px; background: #1e1822; border: 1px solid #8a6a3a; font-size: 15px; margin: 4px 0; }
.tool-btn.night-btn .nm { color: #ffd9a0; }
.tool-btn.night-btn .cost { color: #d9a45a; }
/* 宠物栏按钮（v1.6.2）：三态——pet-off 灰（无收养机会）/ pet-ready 橙光呼吸闪（已同意腾地、待安家）/ pet-home 常亮（已收养） */
.tool-btn .sw.pet-svg { width: 26px; height: 26px; margin: 2px 0 0; filter: drop-shadow(0 1px 1px rgba(0,0,0,.35)); }
.tool-btn.pet-off { opacity: .5; filter: grayscale(1); border-style: dashed; }
.tool-btn.pet-off .nm { color: var(--muted); font-weight: 400; }
.tool-btn.pet-ready { border-color: #f2a13d; animation: petPulse 1.6s ease-in-out infinite; }
.tool-btn.pet-ready .cost { color: #f2a13d; font-weight: 700; }
.tool-btn.pet-home { border-color: var(--accent); }
.tool-btn.pet-home .cost { color: var(--accent); }
@keyframes petPulse {
  0%, 100% { box-shadow: 0 0 0 2px rgba(242,161,61,.18); }
  50% { box-shadow: 0 0 0 4px rgba(242,161,61,.5); }
}
.tool-act {
  display: flex; gap: 6px; overflow-x: auto; padding-bottom: 2px;
  scrollbar-width: none; -webkit-overflow-scrolling: touch;
}
.tool-act::-webkit-scrollbar { display: none; }
.act-btn {
  flex: 0 0 auto;
  background: var(--panel2); border: 1px solid var(--line); color: var(--ink);
  border-radius: 10px; padding: 10px 12px; cursor: pointer; font-size: 13px;
  min-height: 44px; transition: .15s; white-space: nowrap;
}
.act-btn:hover { border-color: var(--accent); }
.act-btn:active { background: var(--accent); color: #2a2200; }

/* 菜单面板（低频操作，点击 ☰ 展开） */
.menu-panel {
  position: absolute; left: 10px; right: 10px; bottom: calc(100% + 6px);
  background: var(--panel); border: 1px solid var(--line); border-radius: 14px;
  padding: 8px; display: flex; flex-direction: column; gap: 6px; z-index: 40;
  box-shadow: 0 10px 30px rgba(0,0,0,.5);
  /* ⚠️ 面板是"向上弹"的（bottom:100%+6px）。菜单项一多就会比屏幕还高，
     顶上那几项被挤出屏幕上沿、点不到（用户反馈："看不到最上面的主界面按钮"）。
     加上高度上限 + 内部滚动，保证顶项永远在屏幕内。 */
  max-height: calc(100vh - 170px);
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
}
.menu-item {
  text-align: left; background: var(--panel2); border: 1px solid var(--line);
  color: var(--ink); border-radius: 10px; padding: 12px 14px; font-size: 14px; cursor: pointer;
  min-height: 46px; display: flex; align-items: center;
}
.menu-item:active { border-color: var(--accent); }
.menu-item.danger { color: var(--bad); }

/* 收支明细行 */
.row { display: flex; justify-content: space-between; align-items: center; padding: 5px 0; }
.row .good { color: var(--good); }
.row .bad { color: var(--bad); }

.hidden { display: none !important; }

/* 浮动缩放 / 视角控件（移动端必备） */
#zoomCtl { position: absolute; right: 10px; bottom: calc(10px + env(safe-area-inset-bottom, 0px)); display: flex; flex-direction: column; gap: 8px; z-index: 15; }
/* UI 长按拖拽反馈（提示框/缩放组）：金色描边 + 半透明，提示"可拖动" */
.ui-dragging { opacity: .85; box-shadow: 0 0 0 2px rgba(255,207,92,.9); cursor: grabbing !important; transition: none; }
.zbtn {
  width: 44px; height: 44px; border-radius: 12px; border: 1px solid var(--line);
  background: rgba(35,44,61,.82); color: var(--ink); font-size: 22px; font-weight: 700;
  line-height: 1; cursor: pointer; display: flex; align-items: center; justify-content: center;
  -webkit-backdrop-filter: blur(4px); backdrop-filter: blur(4px);
}
.zbtn:active { background: var(--accent); color: #2a2200; }

/* 移动端竖屏适配 */
@media (max-width: 720px) {
  #hud { gap: 8px; padding: 6px 10px; }
  .hud-item { font-size: 13px; }
  .hud-label { font-size: 11px; }
  #hudMoney { font-size: 15px; }
  #toolbar { padding: 6px 8px; gap: 6px; padding-bottom: max(24px, env(safe-area-inset-bottom, 0px)); }
  .tool-btn { min-width: 56px; padding: 6px 7px; }
  .act-btn { padding: 9px 11px; font-size: 12px; }
  .bld-info { width: min(220px, 72vw); }
  .modal-card { padding: 16px; }
  #zoomCtl { right: 8px; bottom: 8px; gap: 6px; }
  .zbtn { width: 40px; height: 40px; font-size: 20px; }
}

/* 竖屏锁定：横屏（矮屏）时提示旋转 */
#rotateTip {
  display: none; position: fixed; top: 0; right: 0; bottom: 0; left: 0; z-index: 200;
  background: rgba(15,19,28,.97); color: var(--ink);
  flex-direction: column; align-items: center; justify-content: center;
  text-align: center; gap: 18px;
}
#rotateTip .rotate-ico { font-size: 60px; animation: spin 2.4s ease-in-out infinite; }
#rotateTip p { font-size: 16px; line-height: 1.9; }
#rotateTip span { color: var(--muted); font-size: 13px; }
@keyframes spin { 0%,100% { transform: rotate(0); } 50% { transform: rotate(90deg); } }
@media (orientation: landscape) and (max-height: 480px) {
  #rotateTip { display: flex; }
}

/* 开局选图界面 */
.start-screen {
  position: fixed; top: 0; right: 0; bottom: 0; left: 0; z-index: 100; overflow-y: auto;
  background: radial-gradient(120% 120% at 50% 0%, #243044 0%, #141a26 70%);
  display: flex; flex-direction: column; align-items: center; justify-content: flex-start;
  padding: 24px 16px;
}

/* 开场动画层（覆盖在选图之上，z-index 最高） */
.intro-screen { position: fixed; top: 0; right: 0; bottom: 0; left: 0; z-index: 300; background: #101725; }
.intro-screen.hidden { display: none !important; }
#introCanvas { display: block; width: 100%; height: 100%; }
.start-card {
  width: min(560px, 94vw); background: rgba(28,36,52,.92);
  border: 1px solid var(--line); border-radius: 18px; padding: 22px;
  box-shadow: 0 20px 60px rgba(0,0,0,.5); text-align: center;
  margin: auto 0;   /* 内容矮时垂直居中；过高时退化为顶对齐且可滚动，避免顶部被裁 */
}
.start-card h1 { font-size: 26px; color: var(--accent); letter-spacing: 2px; }
.start-card .sub { color: var(--muted); margin: 6px 0 16px; font-size: 14px; }
.continue-wrap { margin-bottom: 14px; }
.primary-btn {
  width: 100%; padding: 12px; font-size: 15px; font-weight: 700;
  background: var(--accent); color: #2a2200; border: none; border-radius: 12px; cursor: pointer;
}
.primary-btn:active { transform: translateY(1px); }
.modal-actions { display: flex; gap: 10px; margin-top: 2px; }
.modal-actions .primary-btn, .modal-actions .ghost-btn { width: auto; flex: 1; padding: 12px 8px; }
.ghost-btn {
  background: transparent; color: var(--ink); border: 1px solid var(--line);
  border-radius: 12px; font-size: 15px; font-weight: 700; cursor: pointer;
}
.ghost-btn:active { transform: translateY(1px); }
.map-list { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.map-card {
  display: flex; flex-direction: column; gap: 8px; text-align: left;
  background: var(--panel2); border: 1px solid var(--line); border-radius: 12px;
  padding: 10px; cursor: pointer; color: var(--ink); transition: .15s;
}
.map-card:hover, .map-card:active { border-color: var(--accent); transform: translateY(-2px); }
/* 创业之路卡片：与园区地图并列、视觉强区分（新玩法） */
.venture-card {
  border-color: #7c5cff;
  background: linear-gradient(160deg, rgba(124,92,255,.14), rgba(50,80,180,.10) 60%, var(--panel2));
  box-shadow: 0 6px 22px rgba(124,92,255,.18), inset 0 0 0 1px rgba(124,92,255,.10);
  position: relative;
}
.venture-card:hover, .venture-card:active {
  border-color: #a48bff;
  box-shadow: 0 10px 28px rgba(124,92,255,.35), inset 0 0 0 1px rgba(124,92,255,.22);
}
.venture-thumb {
  /* 缩略图 = ventureThumb() 生成的像素办公室俯视 dataURL（内联 background-image 覆盖此兜底色）；
     与 .map-thumb-wrap 同规格 cover + no-repeat + center，不能 repeat */
  background: #1e1b4b;
}
.venture-tag {
  position: absolute; top: 8px; left: 8px;
  padding: 3px 8px; border-radius: 999px;
  background: linear-gradient(180deg, #ffd24a, #f4a93b);
  color: #2a1f00; font-size: 11px; font-weight: 800;
  letter-spacing: .5px; box-shadow: 0 2px 6px rgba(0,0,0,.35);
  z-index: 2;
}
/* 固定比例缩略图框：用 padding-top 百分比 hack（兼容老 WebView，不依赖 aspect-ratio）。
   比例 = ROWS/COLS (22/38 ≈ 57.89%，v1.6 地图扩为 38 列含夜市区)，与地图网格一致；
   内部既支持 <img class="map-thumb"> 用 object-fit:cover 铺满，
   也支持 <div style="background-image:url(...)"> 模式（绕开 S9+ 老 WebView data URL <img> 兼容问题）——
   所以 background 默认就要 cover + no-repeat + center，绝不能 repeat（否则 130×90 原图会在 330×228 卡片里 2×2 重复拼贴）。 */
.map-thumb-wrap {
  position: relative; width: 100%; padding-top: 57.9%;
  border-radius: 8px; overflow: hidden; border: 1px solid var(--line); background: #2a3320;
  background-size: cover; background-repeat: no-repeat; background-position: center;
}
.map-thumb {
  position: absolute; inset: 0; width: 100%; height: 100%;
  object-fit: cover; image-rendering: pixelated; display: block;
}
.story-thumb { display: none; }
.map-name { font-weight: 700; font-size: 15px; }
.map-desc {
  color: var(--muted); font-size: 12px; line-height: 1.5;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.start-card .tip { color: var(--muted); font-size: 12px; margin-top: 16px; }

/* 存档列表（最多 5 个） */
.saves-list { width: 100%; margin: 4px auto 8px; display: flex; flex-direction: column; gap: 8px; }
.saves-title { color: var(--muted); font-size: 13px; text-align: left; margin-top: 6px; }
.save-row { display: flex; align-items: center; gap: 10px; background: rgba(40,52,72,.6); border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; }
.save-info { flex: 1 1 auto; min-width: 0; text-align: left; }
.save-name { font-weight: 700; font-size: 15px; color: var(--ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.save-name.muted { color: var(--muted); font-weight: 600; }
.save-sub { color: var(--muted); font-size: 12px; margin-top: 2px; }
.save-act { flex: 0 0 auto; min-width: 56px; padding: 9px 14px; border-radius: 10px; border: 1px solid var(--line); background: var(--panel2); color: var(--ink); font-size: 14px; font-weight: 700; cursor: pointer; }
.save-act.primary { background: var(--accent); color: #2a2200; border-color: var(--accent); }
.save-act.danger { color: var(--bad); }
.save-act:active { filter: brightness(.95); }

/* 命名存档弹窗 */
.name-card { width: min(360px, 88%); }
.name-input { width: 100%; padding: 12px; font-size: 16px; border-radius: 10px; border: 1px solid var(--line); background: var(--bg); color: var(--ink); margin: 4px 0 14px; }

/* 确认 / 命名弹窗需盖在开局界面之上（开局界面 z-index:100） */
#confirmModal, #nameModal, #storyModal { position: fixed; z-index: 400; }

/* 离线收益结算面板 */
.offline-card { width: min(380px, 90%); text-align: center; padding: 26px 22px 22px; }
.offline-tag { display: inline-block; font-size: 13px; letter-spacing: 2px; color: var(--muted); border: 1px solid var(--line); border-radius: 999px; padding: 3px 12px; margin-bottom: 14px; }
.offline-time { color: #f5c542; font-size: 20px; font-weight: 800; line-height: 1.4; text-shadow: 0 1px 0 rgba(0,0,0,.35); }
.offline-amount { color: #ffd24d; font-size: 40px; font-weight: 900; margin: 10px 0 8px; line-height: 1.1; text-shadow: 0 2px 6px rgba(255,180,0,.35), 0 1px 0 rgba(0,0,0,.4); }
.offline-sub { color: var(--muted); font-size: 13px; margin: 0 0 18px; }
.offline-btn { width: 100%; background: linear-gradient(180deg,#ffd24d,#f0b429); color: #5a3d00; font-weight: 800; font-size: 16px; border: none; padding: 12px; border-radius: 12px; cursor: pointer; }
.offline-btn:active { transform: translateY(1px); filter: brightness(.96); }
#offlineModal { position: fixed; z-index: 500; }

/* 音量调节面板 */
.vol-panel {
  position: fixed; right: 12px; bottom: calc(72px + env(safe-area-inset-bottom, 0px)); z-index: 60;
  width: 200px; padding: 14px; border-radius: 14px;
  background: rgba(28,36,52,.96); border: 1px solid var(--line);
  box-shadow: 0 12px 32px rgba(0,0,0,.45); color: var(--ink);
}
.vol-title { font-size: 13px; color: var(--muted); margin-bottom: 10px; }
.vol-row { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; }
/* 原来写死 width:30px —— 中文「音乐」「音效」两个字刚好放得下，
   英文 "Music"/"Sound" 宽得多就溢出到滑杆上去了（用户反馈截图）。
   改成按内容自适应 + 不换行，滑杆自己 flex 收缩。 */
.vol-row span { flex: 0 0 auto; min-width: 30px; font-size: 13px; white-space: nowrap; }
.vol-row input[type=range] { flex: 1; accent-color: var(--accent); }
.vol-mute { width: 100%; padding: 8px; font-size: 13px; border-radius: 10px;
  background: var(--panel2); color: var(--ink); border: 1px solid var(--line); cursor: pointer; }
.vol-divider { height: 1px; background: var(--line); margin: 12px 0; }
.vol-sub { font-size: 11px; color: var(--muted); margin: -4px 0 8px; }
.track-list { display: flex; flex-direction: column; gap: 6px; }
.track-btn {
  display: flex; flex-direction: column; align-items: flex-start; gap: 1px;
  text-align: left; padding: 7px 9px; border-radius: 10px; cursor: pointer;
  background: var(--panel2); color: var(--ink); border: 1px solid var(--line); transition: .15s;
}
.track-btn:hover { border-color: var(--accent); }
.track-btn.active { background: rgba(247,200,90,.16); border-color: var(--accent); }
.track-name { font-size: 13px; font-weight: 700; }
.track-btn.active .track-name { color: var(--accent); }
.track-desc { font-size: 10.5px; color: var(--muted); line-height: 1.3; }
/* 创业之路：BGM 选择网格（3 首一排，整齐等宽） */
.v-sound-tracks { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-bottom: 10px; }
.v-track-card {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  padding: 12px 6px 10px; border-radius: 10px; cursor: pointer;
  background: #fff7e3; color: #5a2a1a; border: 2px solid #d8b279; transition: .15s; text-align: center;
}
.v-track-card:hover { border-color: #c0504d; transform: translateY(-1px); }
.v-track-card.active { background: #fff0c9; border-color: #c0504d; box-shadow: 0 0 0 2px rgba(192,80,77,.25); }
.v-track-card .v-track-ico { font-size: 22px; line-height: 1; }
.v-track-card .v-track-name { font-size: 13px; font-weight: 800; }
.v-track-card.active .v-track-name { color: #c0504d; }
.v-track-card .v-track-desc { font-size: 10px; color: #8a6a3a; line-height: 1.3; }
.v-track-card .v-track-cur { font-size: 9px; color: #c0504d; font-weight: 700; }
@media (max-width: 480px) {
  .map-list { grid-template-columns: 1fr; }
}

/* 顶部通知堆叠容器（v1.6 优化）：body 直接子元素 + fixed 定位 + 高 z-index，
   永远在 stage 内 canvas 之上；按 DOM 顺序从上往下排，前一个消失后底下的自动上移，
   避免多元素独立定位导致窄屏重叠。top 由 game.js resize() 动态跟随 HUD 底部（手机状态栏高度不等） */
#stageHints {
  position: fixed; top: 78px; left: 8px; z-index: 50;
  display: flex; flex-direction: column; align-items: flex-start; gap: 6px;
  pointer-events: none; /* 容器不拦截点击；内部可点击元素单独开 pointer-events */
  max-width: calc(100vw - 16px);
}
#stageHints > * { pointer-events: auto; }

/* 收起/展开切换按钮（解决多提示条遮挡成就徽章墙等问题） */
.hints-toggle {
  align-self: flex-start;
  background: rgba(20,28,42,.88); color: #eaf2ff;
  border: 1px solid rgba(255,255,255,.18); border-radius: 14px;
  padding: 4px 10px; font-size: 12px; line-height: 1.4; cursor: pointer;
  backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px);
  box-shadow: 0 4px 14px rgba(0,0,0,.35);
}
.hints-toggle:hover { background: rgba(40,54,78,.95); }
.hints-toggle:active { transform: scale(.96); }
/* 收起态：除切换按钮外，所有提示条隐藏，腾出空间（如成就徽章墙） */
#stageHints.collapsed > *:not(#hintsToggle) { display: none !important; }

/* 目标引导横幅（新手留存：当前目标 + 进度条，点按打开目标列表） */
.goal-banner {
  display: flex; align-items: center; gap: 8px;
  max-width: min(280px, 72vw);
  padding: 7px 10px; border-radius: 12px;
  background: rgba(28,36,52,.92); border: 1px solid var(--accent);
  box-shadow: 0 6px 20px rgba(0,0,0,.4); cursor: pointer;
  animation: pop .2s ease;
}
.gb-ico { font-size: 18px; flex: 0 0 auto; }
.gb-tag { flex: 0 0 auto; font-size: 10px; font-weight: 700; color: #2a2200; background: var(--accent); border-radius: 6px; padding: 2px 6px; white-space: nowrap; }
.gb-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.gb-title { font-size: 12.5px; font-weight: 700; color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.gb-bar { height: 5px; border-radius: 3px; background: var(--panel2); overflow: hidden; }
.gb-fill { display: block; height: 100%; background: var(--accent); transition: width .3s ease; }
.gb-prog { flex: 0 0 auto; font-size: 11px; color: var(--muted); font-weight: 700; }

/* 目标列表（弹窗内） */
.goal-list { display: flex; flex-direction: column; gap: 8px; margin-top: 10px; }
.goal-item { display: flex; gap: 10px; padding: 10px; border-radius: 12px; background: var(--panel2); border: 1px solid var(--line); }
.goal-item.done { opacity: .55; }
.goal-item.current { border-color: var(--accent); box-shadow: 0 0 0 2px rgba(255,207,92,.25); }
.goal-ico { font-size: 22px; flex: 0 0 auto; }
.goal-main { flex: 1; min-width: 0; }
.goal-name { font-weight: 700; font-size: 14px; }
.goal-now { font-size: 10px; color: #2a2200; background: var(--accent); border-radius: 6px; padding: 1px 6px; margin-left: 6px; vertical-align: middle; }
.goal-desc { font-size: 12px; color: var(--muted); margin: 3px 0; }
.goal-bar { height: 6px; border-radius: 4px; background: var(--panel); overflow: hidden; margin-top: 5px; }
.goal-bar span { display: block; height: 100%; background: var(--accent); }
.goal-prog { font-size: 11px; color: var(--muted); margin-top: 3px; }
.goal-tip { font-size: 11px; color: var(--accent); margin-top: 4px; }
.goal-side { flex: 0 0 auto; display: flex; align-items: flex-start; }
.goal-bonus { font-size: 11px; color: var(--good); font-weight: 700; text-align: right; }

/* 经营数据面板 */
.good { color: var(--good); }
.bad { color: var(--bad); }
.stat-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-bottom: 4px; }
.stat-card { background: var(--panel2); border: 1px solid var(--line); border-radius: 10px; padding: 8px 4px; text-align: center; }
.stat-card .v { font-size: 15px; font-weight: 800; color: var(--ink); line-height: 1.2; word-break: break-all; }
.stat-card .k { font-size: 10.5px; color: var(--muted); margin-top: 2px; }
.stat-sec { font-size: 13px; font-weight: 700; margin: 12px 0 4px; color: var(--accent); }
.chart-row { display: flex; align-items: center; gap: 8px; margin: 4px 0; font-size: 12px; }
.chart-lab { width: 64px; flex: 0 0 auto; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chart-track { flex: 1; height: 12px; background: var(--panel2); border-radius: 6px; overflow: hidden; }
.chart-fill { display: block; height: 100%; background: var(--accent); border-radius: 6px; transition: width .3s ease; }
.chart-fill.good { background: var(--good); }
.chart-fill.bad { background: var(--bad); }
.chart-val { width: 54px; flex: 0 0 auto; text-align: right; font-weight: 700; }

/* 研发科技树面板 */
.tech-summary { font-size: 12.5px; color: var(--muted); text-align: center; margin-bottom: 10px; line-height: 1.6; }
.tech-summary b { color: var(--accent); }
.tech-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; }
.tech-col { display: flex; flex-direction: column; gap: 8px; }
.tech-branch { font-size: 13px; font-weight: 700; color: var(--accent); border-left: 3px solid var(--accent); padding-left: 8px; }
.tech-node {
  display: flex; flex-direction: column; gap: 6px;
  background: var(--panel2); border: 1px solid var(--line); border-radius: 10px;
  padding: 8px; transition: .15s;
}
.tech-node .tn-top { display: flex; align-items: center; gap: 8px; }
.tech-node .tn-ico { font-size: 22px; flex: 0 0 auto; width: 26px; text-align: center; }
.tech-node .tn-main { flex: 1; min-width: 0; }
.tech-node .tn-name { font-size: 12.5px; font-weight: 700; color: var(--ink); }
.tech-node .tn-desc { font-size: 11px; color: var(--muted); line-height: 1.35; margin-top: 1px; }
.tech-node .tn-foot { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.tech-node .tn-status { font-size: 11px; color: var(--muted); }
.tech-node .tn-cost { flex: 0 0 auto; font-size: 12px; font-weight: 800; text-align: right; white-space: nowrap; }
.tech-node.avail { cursor: pointer; border-color: var(--accent); }
.tech-node.avail:hover { transform: translateY(-1px); box-shadow: 0 0 0 2px rgba(255,207,92,.3); }
.tech-node.avail .tn-cost { color: var(--accent); }
.tech-node.avail .tn-status { color: var(--accent); }
.tech-node.done { border-color: var(--good); background: rgba(107,208,138,.1); }
.tech-node.done .tn-cost { color: var(--good); }
.tech-node.done .tn-status { color: var(--good); }
.tech-node.poor { border-color: #e0a23c; }
.tech-node.poor .tn-cost { color: #e0a23c; }
.tech-node.poor .tn-status { color: #e0a23c; }
.tech-node.locked { opacity: .5; }
.tech-node.locked .tn-cost { color: var(--muted); }
.tech-node.locked .tn-status { color: var(--muted); }
.tech-foot { font-size: 11.5px; color: var(--muted); text-align: center; margin-top: 12px; line-height: 1.7; }
.tech-foot b { color: var(--good); }


/* 地图背景故事弹窗（选图后、命名前） */
.story-card { max-width: 360px; }
/* story-thumb 现复用 .map-thumb-wrap + .map-thumb（absolute cover），仅补充与下方文字的间距 */
.story-card .map-thumb-wrap { margin-bottom: 12px; }
.story-desc { font-size: 14px; line-height: 1.7; color: var(--text, #e8edf2); margin: 4px 0 18px; white-space: pre-wrap; }

/* 副本挑战弹窗（v1.5.0）：剧情节点 + 分支选择 + 多结局 */
.dungeon-card { border-color: #6f5bd0; box-shadow: 0 12px 40px rgba(0,0,0,.5), 0 0 0 1px rgba(111,91,208,.4); }
.dg-prev { font-size: 12.5px; color: var(--muted); line-height: 1.6; background: rgba(255,255,255,.05); border-left: 3px solid var(--accent); padding: 8px 10px; border-radius: 6px; margin-bottom: 12px; }

/* 进行中副本事件常驻提示（已改为左上角堆叠容器内的 flex item，避免与新手目标横幅窄屏重叠） */
#dungeonIndicator {
  display: flex; align-items: center; gap: 7px;
  background: rgba(22,27,38,.82);
  border: 1px solid rgba(140,120,220,.5);
  backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
  padding: 7px 14px 7px 11px; border-radius: 999px;
  font-size: 13px; font-weight: 600; color: #fff; line-height: 1.2; max-width: min(320px, 72vw);
  box-shadow: 0 4px 16px rgba(0,0,0,.35);
  animation: dgpulse 2.6s ease-in-out infinite;
  pointer-events: none;
}
#dungeonIndicator.hidden { display: none; }
#dungeonIndicator .dg-ind-ico { font-size: 15px; }
@keyframes dgpulse {
  0%, 100% { box-shadow: 0 4px 16px rgba(0,0,0,.35); border-color: rgba(140,120,220,.5); }
  50% { box-shadow: 0 4px 20px rgba(140,120,220,.55); border-color: rgba(160,140,245,.85); }
}

/* ===== TapTap 防沉迷合规拦截遮罩（v1.5.0 接入） ===== */
/* 全屏覆盖，挡住所有底层 UI；仅卡片内「重新认证」按钮可点 */
.compliance-gate {
  position: fixed; inset: 0; z-index: 9999;
  display: flex; align-items: center; justify-content: center;
  background: rgba(12,15,22,.92);
  backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px);
  padding: 24px;
}
.compliance-gate.hidden { display: none; }
.compliance-gate .cg-card {
  width: min(86vw, 380px);
  background: linear-gradient(160deg, #1c2233, #161b26);
  border: 1px solid rgba(140,120,220,.45);
  border-radius: 16px;
  padding: 26px 22px;
  text-align: center;
  box-shadow: 0 18px 50px rgba(0,0,0,.55);
}
.compliance-gate .cg-title {
  font-size: 19px; font-weight: 700; color: #fff; margin-bottom: 14px;
  display: flex; align-items: center; justify-content: center; gap: 8px;
}
.compliance-gate .cg-title::before { content: '🛡️'; font-size: 20px; }
.compliance-gate .cg-msg {
  font-size: 14px; line-height: 1.7; color: #c7cdda; margin-bottom: 20px;
}
.compliance-gate .cg-btn {
  appearance: none; border: none; cursor: pointer;
  background: linear-gradient(135deg, #7b5cff, #5b8bff);
  color: #fff; font-size: 15px; font-weight: 600;
  padding: 11px 28px; border-radius: 10px;
  transition: transform .12s ease, box-shadow .12s ease;
}
.compliance-gate .cg-btn:hover { transform: translateY(-1px); box-shadow: 0 6px 18px rgba(123,92,255,.45); }
.compliance-gate .cg-btn:active { transform: translateY(0); }

/* ----------------------------- 园区规划 ----------------------------- */
/* 园区规划开发进度条：作为 #stageHints 的子项，与副本/目标同侧、按序排列；多个开发中分区逐行展示 */
.zone-prog {
  background: rgba(20,24,40,.82); color: #ffe496;
  font-size: 12.5px; line-height: 1.45; padding: 8px 14px; border-radius: 10px;
  border: 1px solid rgba(255,228,150,.35);
  max-width: min(360px, 76vw);
  box-shadow: 0 4px 14px rgba(0,0,0,.4);
  pointer-events: none;
}
.zone-prog-row { white-space: nowrap; }
.zone-prog-row + .zone-prog-row { margin-top: 2px; }
.zone-summary {
  font-size: 13px; color: #c7cdda; margin-bottom: 12px;
  padding: 8px 10px; background: rgba(255,255,255,.04); border-radius: 8px;
}
.zone-summary b { color: #ffcf5c; }
.zone-grid { display: flex; flex-direction: column; gap: 10px; }
.zone-card {
  border: 1px solid rgba(255,255,255,.12); border-radius: 10px;
  padding: 11px 13px; background: rgba(255,255,255,.03);
}
.zone-card.done { border-color: rgba(90,210,140,.5); }
.zone-card.building { border-color: rgba(255,200,90,.5); }
.zone-card.locked { border-color: rgba(160,170,200,.3); opacity: .92; }
.zc-top { display: flex; justify-content: space-between; align-items: center; }
.zc-name { font-size: 15px; font-weight: 700; color: #fff; }
.zone-card.done .zc-name { color: #8fe6b0; }
.zone-card.building .zc-name { color: #ffd98a; }
.zc-status { font-size: 12px; color: #aeb6c8; }
.zc-desc { font-size: 12px; color: #9fe0ff; margin: 5px 0; }
.zc-cost { font-size: 12px; color: #c7cdda; margin-bottom: 8px; }
.zc-action { display: flex; align-items: center; }
.zone-unlock {
  appearance: none; border: none; cursor: pointer;
  background: linear-gradient(135deg, #7b5cff, #5b8bff); color: #fff;
  font-size: 14px; font-weight: 600; padding: 8px 18px; border-radius: 8px;
}
.zone-unlock.disabled {
  background: rgba(255,255,255,.12); color: #8a90a2; cursor: not-allowed;
}
.zone-prog-txt { font-size: 12px; color: #d6b8ff; }

/* 竞品压力条（招商/营销面板顶部） */
.rival-bar {
  height: 12px; border-radius: 7px; background: var(--panel2);
  border: 1px solid var(--line); overflow: hidden; margin: 6px 0 4px;
}
.rival-fill {
  height: 100%; width: 0; border-radius: 7px;
  background: linear-gradient(90deg, #4a8fd6, #f0b429);
  transition: width .35s ease;
}
.rival-bar.hot .rival-fill {
  background: linear-gradient(90deg, #f0b429, #e0564b);
  animation: rivalFlash 1s ease-in-out infinite;
}
@keyframes rivalFlash { 0%, 100% { opacity: 1; } 50% { opacity: .55; } }

/* 竞品压力常驻指示（#stageHints 内，跟随 HUD 底部） */
.rival-hint {
  display: flex; align-items: center; gap: 6px;
  background: rgba(0, 0, 0, .45); border: 1px solid var(--line);
  border-radius: 999px; padding: 4px 10px; font-size: 12px; color: var(--ink);
  backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px);
  margin-top: 6px;
}
.rival-hint.hot { border-color: #e0564b; animation: rivalFlash 1s ease-in-out infinite; }
.rival-hint .rh-bar {
  width: 72px; height: 8px; border-radius: 5px; background: var(--panel2);
  overflow: hidden; border: 1px solid var(--line);
}
.rival-hint .rh-fill {
  display: block; height: 100%; width: 0;
  background: linear-gradient(90deg, #4a8fd6, #f0b429);
  transition: width .4s ease;
}
.rival-hint.hot .rh-fill { background: linear-gradient(90deg, #f0b429, #e0564b); }
.rival-hint .rh-pct { font-variant-numeric: tabular-nums; min-width: 30px; text-align: right; }

/* ===================== 创业之路（独立玩法，与园区样式隔离） ===================== */
/* 星露谷风 UI：暖木边框 + 浅黄底，圆角立体感 */
.venture-layer {
  position: fixed; inset: 0; z-index: 40;
  pointer-events: none;                 /* 容器不挡 canvas，仅上下栏可点 */
  display: flex; flex-direction: column; justify-content: space-between;
}
.venture-layer.hidden { display: none; }
.venture-head {
  pointer-events: none;
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  padding-top: calc(env(safe-area-inset-top, 0px) + 12px);   /* 顶部空 2 行：状态栏 + 进度条 + 间隔 */
  padding-bottom: 8px;
}
.venture-top {
  pointer-events: auto;
  position: relative;
  display: flex; gap: 8px; flex-wrap: wrap;
  padding: 6px 10px 8px;
  background: linear-gradient(180deg, #f4d488, #e8c270);  /* 星露谷浅黄底 */
  border: 2px solid #6b4a2e;                              /* 深木边框 */
  border-radius: 14px;
  box-shadow: 0 3px 0 #3a2a1a, 0 4px 6px rgba(0,0,0,0.3);  /* 立体凸起 */
  color: #3a2a1a; font-size: 14px; width: 92vw; max-width: 460px;
  font-weight: 600;
}
.vgear {
  /* 已废弃：⚙ 设置按钮已移入底部菜单栏（vBtnMenu 用 .vbtn.vbtn-gear），此规则保留兼容 */
  pointer-events: auto;
}
.vbtn-gear { font-size: 16px; line-height: 1; }
.venture-progress {
  pointer-events: auto;
  display: flex; flex-wrap: wrap; align-items: center; gap: 5px 8px;
  padding: 5px 10px 6px; width: 92vw; max-width: 460px;
  background: linear-gradient(180deg, #e8c270, #d8a350);
  border: 2px solid #6b4a2e;
  border-radius: 10px;
  box-shadow: 0 2px 0 #3a2a1a, 0 3px 4px rgba(0,0,0,0.25);
  color: #3a2a1a; font-size: 11px; font-weight: 600;
}
.vprog-slot { display: flex; align-items: center; gap: 5px; flex: 1 1 44%; min-width: 150px; }
.vprog-name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100px; color: #5a2a1a; }
.vbar { flex: 1; height: 6px; background: #6b4a2e; border-radius: 999px; overflow: hidden; border: 1px solid #3a2a1a; }
.vfill { display: block; height: 100%; width: 0; background: linear-gradient(90deg, #5aa0c8, #7fd0e8); }
.vproj-pct { font-variant-numeric: tabular-nums; min-width: 30px; text-align: right; color: #5a2a1a; font-size: 11px; }
.vstat { display: flex; align-items: baseline; gap: 4px; white-space: nowrap; }
.vstat .vlabel { color: #6b4a2e; font-size: 12px; }
.vstat span:not(.vlabel) { font-weight: 700; font-variant-numeric: tabular-nums; color: #3a2a1a; }
.vstat #vCash { color: #5a2a1a; }
/* 底部按钮 = 星露谷工具栏横板（暖木色，紧凑不挡地图） */
.venture-bottom {
  pointer-events: auto;
  display: flex; gap: 6px; justify-content: center; flex-wrap: wrap;
  padding: 8px 10px; margin: 0 auto calc(env(safe-area-inset-bottom, 0px) + 10px);
  background: linear-gradient(180deg, #e8c270, #d8a350);
  border-top: 2px solid #6b4a2e;
  border-radius: 0;
  box-shadow: 0 -2px 6px rgba(0,0,0,0.2);
}
.vbtn {
  pointer-events: auto;
  border: 2px solid #6b4a2e; background: linear-gradient(180deg, #e8c270, #d8a350);
  color: #3a2a1a; font-size: 12px; padding: 6px 8px; border-radius: 8px;
  min-width: 0; font-weight: 700; line-height: 1.2;
  box-shadow: 0 2px 0 #3a2a1a, 0 3px 4px rgba(0,0,0,0.25);
}
.vbtn:active { transform: translateY(2px); box-shadow: 0 1px 0 #3a2a1a; }
.vbtn-primary { background: linear-gradient(180deg, #6ba3d8, #4a82b8); border-color: #3a5a78; color: #fff; }
.vbtn.disabled-btn, .vbtn[disabled] { opacity: .45; }

/* 创业弹窗内容样式 */
.venture-card-modal .modal-card { max-width: 460px; }
.v-sec { font-weight: 700; color: #ffd24a; margin: 12px 0 6px; font-size: 14px; }
.v-sec:first-child { margin-top: 0; }
.v-label { display: block; color: #9fb0cc; font-size: 12px; margin: 10px 0 4px; }
.v-sel {
  width: 100%; padding: 10px; border-radius: 10px; font-size: 14px;
  background: var(--panel2, #1c2436); color: #fff; border: 1px solid var(--line, #2a3550);
}
.v-primary { width: 100%; margin-top: 14px; background: linear-gradient(180deg, #3f8be0, #2f6fc0); border: none; font-weight: 700; }
.v-hire-row, .v-staff, .v-hist {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding: 8px 0; border-bottom: 1px solid rgba(255,255,255,.08);
}
.v-hire-row .v-hire-ico { font-size: 22px; }
.v-hire-info { flex: 1; }
.v-hire-name { font-weight: 600; }
.v-danger { color: #ff8f8f !important; }
.v-staff > span:first-child { font-weight: 600; }
.v-proj { margin: 8px 0; }
.v-proj-top { display: flex; justify-content: space-between; font-size: 13px; margin-bottom: 4px; }
.v-bar { height: 10px; border-radius: 6px; background: rgba(255,255,255,.12); overflow: hidden; }
.v-fill { display: block; height: 100%; background: linear-gradient(90deg, #3f8be0, #7fd0e8); }
.muted { color: #9fb0cc; font-size: 12px; }

/* 创业·手机适配 + 新手引导 + 解雇按钮 */
.vgear { /* ⚙ 已移入底部栏，此 fixed 规则废弃 */ }
.venture-head { padding-top: calc(env(safe-area-inset-top, 0px) + 8px); gap: 5px; }
.venture-top { width: calc(100vw - 64px); max-width: 460px; margin: 0 auto; padding: 6px 10px; gap: 6px; font-size: 13px; flex-wrap: nowrap; }
.vstat { font-size: 13px; }
.venture-bottom { flex-wrap: nowrap; gap: 6px; padding: 8px calc(env(safe-area-inset-bottom, 0px) + 8px) calc(env(safe-area-inset-bottom, 0px) + 10px); }
.vbtn { flex: 1 1 0; min-width: 0; padding: 13px 4px; font-size: 13px; }
.vbtn-primary { flex: 1 1 0; }
/* 引导气泡 = 羊皮纸卷边（星露谷对话风格）
   位置：屏幕正中。原来贴底 76px，正好压住底部那排按钮（招聘/升级/公司…），
   玩家点不到按钮（用户反馈）。挪到中间只挡视线、不挡操作。 */
.vguide { position: fixed; left: 50%; top: 50%; transform: translate(-50%, -50%); z-index: 55; max-width: 92vw; display: flex; align-items: center; gap: 8px; background: linear-gradient(180deg, #f4d488, #e8c270); border: 2px solid #6b4a2e; color: #3a2a1a; font-size: 13px; padding: 10px 14px; border-radius: 10px; box-shadow: 0 3px 0 #3a2a1a, 0 4px 6px rgba(0,0,0,.3); pointer-events: auto; font-weight: 600; }
.vguide.hidden { display: none; }
.vguide-txt { line-height: 1.5; }
.vguide-x { background: linear-gradient(180deg, #e8c270, #d8a350); border: 2px solid #6b4a2e; color: #3a2a1a; border-radius: 8px; padding: 6px 10px; font-size: 12px; white-space: nowrap; font-weight: 700; box-shadow: 0 2px 0 #3a2a1a; }
.vguide-hl { box-shadow: 0 0 0 3px #ffd24a, 0 0 14px #ffd24a; animation: vhl 1.1s ease-in-out infinite; }
@keyframes vhl { 0%,100% { box-shadow: 0 0 0 3px #ffd24a, 0 0 8px #ffd24a; } 50% { box-shadow: 0 0 0 4px #ffd24a, 0 0 18px #ffd24a; } }
.v-row-btns { display: flex; gap: 6px; }
.v-row-btns .act-btn { padding: 7px 12px; font-size: 13px; }
.v-fire-btn { background: rgba(200, 70, 70, .92); border-color: #c84646; }
.v-fire-btn:active { transform: translateY(1px); }
.v-mini-fire { background: rgba(200, 70, 70, .92); border: 1px solid #c84646; color: #fff; border-radius: 8px; padding: 2px 8px; font-size: 11px; margin-left: 6px; }
/* A+C 玩法：阶段徽章 / 发售结算行 / 每周决策 / 疲劳角标 */
.v-badge-dev { display: inline-block; background: #3f6fa0; color: #fff; border-radius: 6px; padding: 0 6px; font-size: 10px; vertical-align: 1px; }
.v-badge-beta { display: inline-block; background: #c89a3c; color: #fff; border-radius: 6px; padding: 0 6px; font-size: 10px; vertical-align: 1px; }
.v-release-row { display: flex; justify-content: space-between; align-items: center; padding: 5px 4px; border-bottom: 1px dashed rgba(216,195,154,.6); font-size: 13px; }
.v-release-row span { color: #6b5a3a; }
.v-release-row b { font-variant-numeric: tabular-nums; }
.v-release-final { background: #fdf1cf; border: 1px solid #d8b279; border-radius: 8px; padding: 8px 10px; margin: 4px 0; }
.v-release-final b { font-size: 20px; color: #c0504d; }
.v-post-row { display: flex; gap: 6px; margin: 8px 0 2px; flex-wrap: wrap; }
.v-post-row .act-btn { flex: 1; min-width: 0; padding: 9px 4px; font-size: 12px; }
.v-decide-row { border: 1px solid rgba(216,195,154,.7); border-radius: 10px; padding: 8px 10px; margin-bottom: 8px; background: #fffdf5; }
.v-decide-btns { display: flex; gap: 6px; margin-top: 6px; }
.v-decide-btns .act-btn { flex: 1; padding: 9px 4px; font-size: 12.5px; }
.v-decide-sel { background: linear-gradient(180deg, #e8c270, #d8a350); border-color: #8a5a30 !important; color: #3a2a1a !important; font-weight: 700; box-shadow: 0 0 0 2px rgba(216,163,80,.6); }
.v-fat { color: #c87d2a; font-size: 11px; }
.v-fat-hi { color: #d84848; font-size: 11px; font-weight: 700; }
.v-trait { color: #7a5bc0; font-size: 11px; font-weight: 600; }

/* ============================ 园区猫·胖橘（v1.1 设计稿） ============================ */
.cat-card { text-align: center; }
.cat-hero canvas { image-rendering: pixelated; display: block; margin: 0 auto 8px; background: #8bc98f; border-radius: 10px; }
.cat-tip { font-size: 11px; }
.cat-card .modal-actions { display: flex; gap: 10px; margin-top: 4px; }
.cat-card .modal-actions .act-btn { flex: 1; }
.cat-panel { width: min(300px, 88vw); text-align: left; }
.cat-p-head { display: flex; gap: 10px; align-items: center; }
.cat-p-head canvas { image-rendering: pixelated; background: #8bc98f; border-radius: 8px; }
.cat-p-name { font-size: 17px; color: var(--accent); font-weight: 700; }
.cat-p-sub { font-size: 11px; color: var(--muted); margin-top: 2px; }
.cat-bar { height: 12px; border-radius: 8px; background: var(--panel2); border: 1px solid var(--line); overflow: hidden; margin: 10px 0 4px; position: relative; }
.cat-bar-fill { height: 100%; background: linear-gradient(90deg, #ffd98a, #ff9db0); border-radius: 8px; transition: width .35s ease; }
.cat-bar-txt { font-size: 11px; color: var(--muted); text-align: right; margin-bottom: 10px; }
.cat-acts { display: flex; gap: 8px; }
.cat-act { flex: 1; border: 1px solid var(--line); background: var(--panel2); color: var(--ink); border-radius: 10px; padding: 9px 4px; font-size: 13px; cursor: pointer; display: flex; flex-direction: column; align-items: center; gap: 3px; }
.cat-act small { font-size: 10px; color: var(--muted); }
.cat-act.disabled { opacity: .4; cursor: not-allowed; }
.cat-act:not(.disabled):active { transform: translateY(1px); filter: brightness(.95); }
/* 碎碎念整行按钮（v1.6.3）：独立一行、点击收起面板后胖橘头顶弹语录气泡 */
.cat-muse { flex: none; width: 100%; margin-top: 8px; flex-direction: row; justify-content: center; gap: 6px; background: linear-gradient(90deg, rgba(246,196,83,.18), rgba(255,157,176,.14)); }
.cat-muse span { font-size: 13.5px; }
.cat-muse small { font-size: 10px; }
/* 胖橘头顶碎碎念气泡（DOM 层，盖在 canvas 上；中文不画 canvas，铁律 18） */
.cat-bubble {
  position: absolute; z-index: 26; max-width: 170px; box-sizing: border-box;
  background: #fffdf5; color: #4a3728;
  border: 1.5px solid #e8c98a; border-radius: 12px;
  padding: 7px 10px; font-size: 12.5px; line-height: 1.55;
  box-shadow: 0 3px 10px rgba(0,0,0,.28); text-align: center;
  transform: translate(-50%, -100%); cursor: pointer; user-select: none;
  animation: catBubbleIn .18s ease-out;
}
.cat-bubble::after {
  content: ''; position: absolute; left: 50%; bottom: -5.5px; transform: translateX(-50%);
  border: 5.5px solid transparent; border-top-color: #fffdf5; border-bottom: 0;
}
.cat-bubble::before {
  content: ''; position: absolute; left: 50%; bottom: -7px; transform: translateX(-50%);
  border: 6px solid transparent; border-top-color: #e8c98a; border-bottom: 0;
}
.cat-bubble.out { opacity: 0; transition: opacity .45s ease; }
@keyframes catBubbleIn {
  from { opacity: 0; transform: translate(-50%, -90%) scale(.86); }
  to   { opacity: 1; transform: translate(-50%, -100%) scale(1); }
}
.cat-snack { display: flex; align-items: center; justify-content: space-between; border: 1px dashed var(--line); border-radius: 10px; padding: 8px 10px; margin-top: 10px; font-size: 12px; }
.cat-snack button:disabled { opacity: .5; cursor: not-allowed; }
/* 宠物币钱包区（v1.1.1：园区资金换宠物币，单向不可兑回，宠物用品专用） */
.cat-coin { border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px; margin-top: 10px; background: linear-gradient(180deg, rgba(246,196,83,.08), transparent); }
.cat-coin-head { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--ink); }
.cat-coin-head .cc-ico { display: inline-flex; filter: drop-shadow(0 1px 1px rgba(0,0,0,.25)); }
.cat-coin-btns { display: flex; gap: 6px; margin-top: 8px; }
.cat-coin-btns button {
  flex: 1; border: 1px solid var(--line); background: var(--panel2); color: var(--ink);
  border-radius: 8px; font-size: 12px; line-height: 1.15; padding: 6px 2px; cursor: pointer;
}
.cat-coin-btns button small { display: block; font-size: 10px; color: var(--muted); font-weight: 400; }
.cat-coin-btns button:active { transform: scale(.96); }
.cat-coin-btns button:disabled { opacity: .45; cursor: not-allowed; }
.cat-status { font-size: 11px; color: var(--muted); margin-top: 10px; line-height: 1.65; }
@media (max-width: 480px) {
  .cat-panel { width: min(300px, 92vw); }
  .cat-act { padding: 8px 2px; font-size: 12px; }
}
