/* ★ 本文件已接入 ming-games 共用设计 token（../shared/tokens.css）。
     圆角 / 阴影 / 间距 / 字阶 / 动效时长与缓动 / 层级 一律用 var(--mg-*)，
     主色（--brand / --bg / --surface …）保持本项目自己的深夜便利店气质，**不统一**。 */
/* 夜班便利店 · 色彩令牌与 HUD 样式
   R5（需求E）改造：色值唯一来源迁移到 src/art.mjs，本文件是它的 CSS 投影。
   规范：LowPoly 电玩城 · 夜晚室内霓虹 · 深色底 + 霓虹紫/冰蓝/暖黄 · 半透磨砂玻璃圆角 UI */
:root {
  /* 中性 / 表面（深色底阶梯，对齐 art.BASE_COLORS） */
  --bg: #10151F;            /* art.BASE_COLORS.deep */
  --surface: #1A2230;       /* art.BASE_COLORS.mid */
  --surface-raised: #232C3D;/* art.BASE_COLORS.raise */
  --surface-sunken: #141A26;
  --border: #2C3646;
  --border-strong: #465468;

  /* 文本 */
  --text: #ECF1F8;          /* art.SEMANTIC.textHi */
  --text-muted: #A8B4C6;    /* art.SEMANTIC.textMid */
  --text-subtle: #6C7889;   /* art.SEMANTIC.textLo */
  --text-on-brand: #1C1402;
  --text-on-dark: #ECF1F8;

  /* 品牌（霓虹暖黄 · art.NEON.warm） */
  --brand: #E8A94E;
  --brand-600: #D4942F;
  --brand-100: rgba(232, 169, 78, .15);

  /* 霓虹主色（art.NEON —— 需求E 点名的电玩城三色） */
  --neon-purple: #B15BD8;
  --neon-ice: #4FD1E8;
  --neon-warm: #E8A94E;
  --neon-purple-dim: #6B2E8C;
  --neon-ice-dim: #2A7C93;

  /* 霓虹的透明变体（光晕用；直接写 rgba 便于 backdrop 叠加） */
  --neon-purple-a18: rgba(177, 91, 216, .18);
  --neon-purple-a35: rgba(177, 91, 216, .35);
  --neon-ice-a18: rgba(79, 209, 232, .18);

  /* 语义色 */
  --money: #6FCF97;      /* 进账 / 成功 */
  --warning: #EB5757;    /* 损耗 / 警告 */
  --danger-text: #F08A8A;/* 深色底小号红字变体（对比度兜底） */
  --info: #5AA9E6;       /* 信息 / 提示 */

  /* ---------- 磨砂玻璃（art.UI —— 需求E 的 UI 规范） ---------- */
  --glass-bg: rgba(35, 42, 56, .62);
  --glass-bg-strong: rgba(28, 34, 47, .78);
  --glass-border: 1px solid rgba(180, 200, 230, .16);
  --glass-blur: blur(16px) saturate(1.3);
  --glass-glow-purple: 0 0 0 1px rgba(177, 91, 216, .35), 0 0 28px rgba(177, 91, 216, .22);
  --glass-glow-warm: 0 0 0 1px rgba(232, 169, 78, .35), 0 0 28px rgba(232, 169, 78, .20);

  --radius: 8px;
  --radius-lg: 18px;      /* art.UI.radius */
  --radius-sm: 12px;      /* art.UI.radiusSm */
  --shadow: 0 4px 16px rgba(0, 0, 0, .45);
  --shadow-float: 0 18px 48px rgba(0, 0, 0, .45);
  --font: system-ui, -apple-system, "Segoe UI", "Noto Sans SC", "Microsoft YaHei", sans-serif;
}

/* ---------- 通用磨砂玻璃面板工具类（需求E/G） ----------
   所有浮层（登录 / 排行榜 / 小游戏 / 弹窗）统一继承它，
   避免每个面板各写一套玻璃参数导致观感漂移。 */
.glass {
  background: var(--glass-bg);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border: var(--glass-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-float);
}
.glass-strong {
  background: var(--glass-bg-strong);
  backdrop-filter: blur(22px) saturate(1.4);
  -webkit-backdrop-filter: blur(22px) saturate(1.4);
  border: var(--glass-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-float);
}
/* 霓虹强调态：需要玩家注意的面板（如维修确认、低满意度警告） */
.glass.is-neon-purple { box-shadow: var(--shadow-float), var(--glass-glow-purple); }
.glass.is-neon-warm { box-shadow: var(--shadow-float), var(--glass-glow-warm); }


* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  overflow: hidden;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
}

/* P1-12：dvh 双写 —— iOS Safari 地址栏伸缩时 100vh 会大于可视高度，
 * 底部按钮被顶到可视区外（"点不到"）。老浏览器取第一条 100vh。 */
#app { position: relative; width: 100vw; height: 100vh; height: 100dvh; }

#scene-canvas { display: block; width: 100%; height: 100%; }

#hud-root {
  position: absolute;
  inset: 0;
  pointer-events: none; /* HUD 默认不挡鼠标；可交互面板单独开启 */
  user-select: none;
}

/* ---------- 层级契约（P0：弹窗按钮"真实鼠标点不动"） ----------
 * 症状：弹窗按钮用 JS 的 element.click() 能触发，真实鼠标点却毫无反应，
 *      且 elementFromPoint 在按钮位置上返回的是**底层 HUD**。
 * 根因类别：HUD 层里某块元素能吃指针且盖在弹窗之上。这里做两道结构性防护：
 *
 * ① 弹窗打开期间（hud.mjs 给 #hud-root 挂 has-modal）—— 底层 HUD 一律不吃指针。
 *    用 !important 是刻意的兜底：必须压过任何单块的 pointer-events:auto，
 *    否则将来某块 HUD 一加 auto，就又会长出同样的 bug。
 * ② 弹窗 / 开始页的容器提到 z-index:100，保证永远画在 HUD 之上。
 *    （容器自身 pointer-events:none，真正接收鼠标的是里面的 .modal-mask / .start-mask。） */
#hud-root.has-modal > :not([data-el="modal"]):not([data-el="start"]) {
  pointer-events: none !important;
}
#hud-root > [data-el="modal"],
#hud-root > [data-el="start"] {
  position: absolute;
  inset: 0;
  z-index: 100;
  pointer-events: none;
}

/* 纯展示型的 HUD 块显式声明不吃指针（默认继承 #hud-root 的 none，写出来是为了"意图可见"）：
 *   .hintbar（快捷键提示条）/ .topbar（顶部时间轴）/ .corner（左右角信息）/ .queue（队列）
 * 它们全屏或半屏地铺在画面中央区域，一旦哪天被谁改成 auto，弹窗就会被无声吞掉点击。 */
.crosshair, .topbar, .corner, .hintbar, .prompt, .held,
.questpanel, .incident, .tutorial, .queue, .regulars, .doze {
  pointer-events: none;
}

/* 引导字幕在与不在，决定顶部横幅要不要让位。
 * 首夜开夜时"主题横幅"和"引导 1/3"必定同时出现，两者都是顶部居中：
 *   横幅容器 top:64px / z-index:36，引导条 top:54px / z-index:35 —— 横幅正好把引导条盖死。
 * 由 hud.mjs 的 showTutorial/hideTutorial 挂这个类，让横幅整体下移一条字幕的高度。
 * （用 margin-top 而不是 transform：横幅容器的 transform 是内联的 translateX(-50%)，不该去覆盖它。） */
.has-tutorial { margin-top: 46px; }

/* ---------- 准星 ---------- */
.crosshair {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 6px;
  height: 6px;
  margin: -3px 0 0 -3px;
  border-radius: 50%;
  background: rgba(230, 226, 214, .85);
  box-shadow: 0 0 0 1.5px rgba(0, 0, 0, .55);
  transition: transform .1s ease, background .1s ease, width .12s ease, height .12s ease,
    margin .12s ease, border-radius .12s ease, border-color .12s ease;
}
/* 手感 2：对准可交互物时，准星从"圆点"变成"小方框"（并高亮） */
.crosshair.is-hover {
  width: 13px;
  height: 13px;
  margin: -6.5px 0 0 -6.5px;
  border-radius: var(--mg-r-xs);
  background: transparent;
  border: 2px solid var(--brand);
  box-shadow: 0 0 8px rgba(232, 169, 78, .75), 0 0 0 1.5px rgba(0, 0, 0, .5);
}

/* P0-4：首次加载指示（纯 CSS 转圈，不新增图片/字体） */
#boot {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 14px;
  color: var(--text-muted);
  font-size: 14px;
  letter-spacing: .08em;
  background: var(--bg);
  z-index: 60;
}
#boot .ring {
  width: 34px; height: 34px;
  border: 3px solid rgba(150, 170, 200, .25);
  border-top-color: var(--brand);
  border-radius: 50%;
  animation: boot-spin .9s linear infinite;
}
@keyframes boot-spin { to { transform: rotate(360deg); } }

/* ---------- 顶部时间轴 ---------- */
.topbar {
  position: absolute;
  top: calc(12px + env(safe-area-inset-top));
  left: 50%;
  transform: translateX(-50%);
  width: min(560px, 80vw);
  padding: 10px 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  text-align: center;
}
.topbar .clock {
  font-size: 15px;
  font-weight: 600;
  letter-spacing: .04em;
}
.topbar .segment { color: var(--brand); margin-left: 8px; font-size: 13px; }
.topbar .track {
  margin-top: 8px;
  height: 6px;
  background: var(--surface-sunken);
  border-radius: var(--mg-r-xs);
  overflow: hidden;
}
.topbar .track > i {
  display: block;
  height: 100%;
  width: 0%;
  background: var(--brand);
  transition: width .2s ease-out;
}

/* ---------- 角落信息 ---------- */
.corner {
  position: absolute;
  padding: 10px 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  font-size: 14px;
  line-height: 1.7;
  min-width: 150px;
}
.corner.tl { top: calc(12px + env(safe-area-inset-top)); left: calc(12px + env(safe-area-inset-left)); }
.corner.tr { top: calc(12px + env(safe-area-inset-top)); right: calc(12px + env(safe-area-inset-right)); text-align: right; }
.corner .label { color: var(--text-muted); font-size: 13px; }
.corner .value { font-size: 19px; font-weight: 700; }

/* ---------- 经营环境读数（P2-9：拆两行 + 加大字号 + 事件倒计时高亮） ---------- */
.envline {
  margin-top: 8px;
  padding-top: 6px;
  border-top: 1px solid var(--border);
}
.envline .env-row {
  display: flex;
  gap: 12px;
  justify-content: flex-end;
  align-items: baseline;
  font-variant-numeric: tabular-nums;
}
.envline .env-row .label { color: var(--text-muted); font-size: 12px; }
.envline .env-row .value { font-size: 15px; font-weight: 700; }
.envline .env-events {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  margin-top: 4px;
}
.envline .ev {
  font-size: 14px;
  font-weight: 800;
  padding: 1px 8px;
  border-radius: var(--mg-r-sm);
  font-variant-numeric: tabular-nums;
}
.envline .ev-bad { color: #FFD9D9; background: rgba(235, 87, 87, .26); border: 1px solid rgba(235, 87, 87, .5); }
.envline .ev-brand { color: var(--brand); background: var(--brand-100); border: 1px solid rgba(232, 169, 78, .45); }
.envline .ev-ice { color: var(--neon-ice); background: var(--neon-ice-a18); border: 1px solid rgba(79, 209, 232, .45); }
/* 2026-10-05 促销可视化：促销倒计时用高饱和橙红，一眼可辨 */
.envline .ev-hot { color: #FFE3C2; background: rgba(240, 108, 60, .32); border: 1px solid rgba(255, 150, 80, .6); }
.value.warn { color: var(--warning); }

/* 手感 5：金币 / 满意度变化的"跳字"反馈 */
@keyframes num-jump {
  0% { transform: scale(1); }
  40% { transform: scale(1.18); }
  100% { transform: scale(1); }
}
.value.jump { display: inline-block; animation: num-jump .28s ease; }
.value.money { color: var(--money); }
.value.warn { color: var(--danger-text); }
.value.brand { color: var(--brand); }

/* ---------- 交互提示 ---------- */
.prompt {
  position: absolute;
  left: 50%;
  top: calc(50% + 34px);
  transform: translateX(-50%);
  padding: 6px 12px;
  background: var(--surface-raised);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  font-size: 14px;
  white-space: nowrap;
}
.prompt kbd {
  display: inline-block;
  padding: 1px 6px;
  margin-right: 6px;
  background: var(--brand);
  color: var(--text-on-brand);
  border-radius: var(--mg-r-xs);
  font-weight: 700;
  font-family: var(--font);
}
.prompt.denied { border-color: var(--warning); }
.prompt.denied kbd { background: var(--warning); color: #fff; }

/* 美术接入：顾客交互小头像（100×100 圆角）。挂在准星**左侧**、E 提示左侧，
   不挡准星与提示；默认 display:none，命中身份才显示（见 hud.setCustomerPortrait）。 */
.cust-portrait {
  position: absolute;
  left: calc(50% - 128px);
  top: calc(50% - 22px);
  width: 100px;
  height: 100px;
  border-radius: var(--mg-r-md);
  border: 2px solid var(--brand);
  background: var(--surface-raised);
  object-fit: cover;
  box-shadow: 0 8px 22px rgba(0, 0, 0, .5);
  pointer-events: none;
}

/* ---------- 手持 / 底部提示条 ---------- */
.held {
  position: absolute;
  left: 50%;
  bottom: 86px;
  transform: translateX(-50%);
  padding: 6px 14px;
  background: var(--brand-100);
  border: 1px solid var(--brand);
  border-radius: var(--radius);
  font-size: 14px;
  color: var(--brand);
}
.hintbar {
  position: absolute;
  left: 50%;
  bottom: 18px;
  transform: translateX(-50%);
  padding: 6px 14px;
  background: rgba(35, 42, 56, .78);
  border-radius: var(--radius);
  font-size: 12px;
  color: var(--text-muted);
  white-space: nowrap;
}

/* ---------- 队列信息 ---------- */
.queue {
  position: absolute;
  right: 12px;
  bottom: 18px;
  padding: 10px 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  font-size: 13px;
  min-width: 180px;
}
.queue .head { color: var(--text-muted); font-size: 12px; margin-bottom: 6px; }
.queue .empty { color: var(--text-subtle); }
.queue .alert { color: var(--warning); font-weight: 700; }

/* ---------- 店员状态条（R1：体力 / 疲惫 / 饱食 / 心理） ---------- */
.statusbars {
  position: absolute;
  left: 12px;
  bottom: 18px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 10px 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  width: 188px;
}
.statusbars .stat {
  display: grid;
  grid-template-columns: 32px 1fr 30px;
  align-items: center;
  gap: 8px;
  font-size: 12px;
}
.statusbars .stat-label { color: var(--text-muted); }
.statusbars .stat-bar {
  position: relative;
  height: 8px;
  background: var(--surface-sunken);
  border-radius: var(--mg-r-xs);
  overflow: hidden;
}
.statusbars .stat-bar > i {
  display: block;
  height: 100%;
  width: 100%;
  border-radius: var(--mg-r-xs);
  transition: width .2s ease-out, background .2s ease-out;
}
.statusbars .stat-val {
  text-align: right;
  color: var(--text);
  font-variant-numeric: tabular-nums;
}

/* ---------- Toast ----------
 * 提示不再压在画面正中（准星/交互提示/3D 视野都在这里，玩家反馈"遮视野"）。
 * 改到屏幕左侧竖排：从角落信息下方起、到状态条上方止，靠左贴边、窄列半透明，
 * 既不挡中央视野，也不吃指针（.toasts 继承 #hud-root 的 pointer-events:none）。 */
.toasts {
  position: absolute;
  left: calc(12px + env(safe-area-inset-left));
  top: 132px;
  bottom: auto;
  transform: none;
  display: flex;
  flex-direction: column;
  gap: 5px;
  align-items: flex-start;
  max-width: min(280px, 40vw);
  pointer-events: none;
}
.toast {
  padding: 5px 10px;
  background: var(--glass-bg-strong, rgba(20, 24, 33, .82));
  backdrop-filter: var(--glass-blur, blur(8px));
  -webkit-backdrop-filter: var(--glass-blur, blur(8px));
  border: 1px solid var(--border-strong);
  border-left-width: 3px;
  border-radius: var(--radius);
  font-size: 11.5px;
  line-height: 1.45;
  box-shadow: var(--shadow);
  animation: toast-in .18s ease;
  opacity: .9;
}
.toast.ok { border-left-color: var(--money); }
.toast.bad { border-left-color: var(--warning); color: var(--danger-text); }
.toast.info { border-left-color: var(--info); }
/* P1-6：新提示从下方淡入（队列由 hud.mjs 保证同屏最多 2 条） */
@keyframes toast-in { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
.toast.out { animation: toast-out .2s ease forwards; }
@keyframes toast-out { from { opacity: 1; transform: none; } to { opacity: 0; transform: translateY(-6px); } }
/* 块4：toast 手动关闭（+ 3s 自动淡出由 notify-center 的 ttl 控制） */
.toast-label{display:inline-block;max-width:min(230px,34vw)}
.toast-close{pointer-events:auto;float:right;margin:1px 0 0 8px;padding:0 4px;min-width:18px;height:18px;line-height:16px;border:0;border-radius:4px;background:#ffffff14;color:inherit;font:inherit;font-size:13px;cursor:pointer}
.toast-close:hover{background:#ffffff30}

/* ---------- 存档提示（右上角 · 半透磨砂 · 2s 自动消失） ----------
   与普通 toast（顶部居中）分开：存档反馈需要"一眼能看到但不打断操作"，
   放右上角既不遮准星、也不挡顶部时钟，符合需求 5。 */
.save-toast {
  position: fixed;
  top: 18px;
  right: 18px;
  z-index: 80;
  padding: 10px 18px;
  border-radius: var(--mg-r-md);
  font: 600 14px/1.4 var(--font);
  color: var(--text);
  background: var(--glass-bg-strong);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border: var(--glass-border);
  box-shadow: var(--shadow-float, 0 8px 28px rgba(0, 0, 0, .45));
  pointer-events: none;
  /* 默认隐藏：用 opacity/transform 过渡，避免 display 切换导致的布局抖动 */
  opacity: 0;
  transform: translateY(-8px) scale(.96);
  transition: opacity .18s ease, transform .18s ease;
}
.save-toast.show {
  opacity: 1;
  transform: none;
}
.save-toast.ok { box-shadow: var(--shadow-float, 0 8px 28px rgba(0, 0, 0, .45)), var(--glass-glow-warm); }
.save-toast.info { box-shadow: var(--shadow-float, 0 8px 28px rgba(0, 0, 0, .45)), var(--glass-glow-purple); }
.save-toast.bad {
  color: var(--danger-text);
  box-shadow: var(--shadow-float, 0 8px 28px rgba(0, 0, 0, .45)),
              0 0 0 1px rgba(235, 87, 87, .38), 0 0 26px rgba(235, 87, 87, .18);
}

/* ---------- 模态面板（采购 / 结算 / 开始） ---------- */
.modal-mask {
  position: absolute;
  inset: 0;
  background: rgba(10, 13, 19, .72);
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: auto; /* 面板需要接收鼠标 */
  /* 手感 4：菜单打开 0.15s 淡入，不再瞬间硬切 */
  animation: overlay-in .15s ease;
}
.modal {
  width: min(560px, 92vw);
  max-height: 84vh;
  max-height: 84dvh;   /* P1-12：dvh 双写，避免移动端地址栏伸缩顶掉底部按钮 */
  overflow: auto;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--mg-r-md);
  box-shadow: var(--shadow);
  padding: 20px 22px;
  animation: panel-in .15s ease;
}
@keyframes overlay-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes panel-in { from { opacity: 0; transform: translateY(8px) scale(.99); } to { opacity: 1; transform: none; } }
@keyframes overlay-out { from { opacity: 1; } to { opacity: 0; } }
@keyframes panel-out { from { opacity: 1; transform: none; } to { opacity: 0; transform: translateY(6px) scale(.99); } }
.modal-mask.closing { animation: overlay-out .15s ease forwards; pointer-events: none; }
.modal-mask.closing .modal { animation: panel-out .15s ease forwards; }
.modal h2 { margin: 0 0 4px; font-size: 19px; }
.modal .sub { color: var(--text-muted); font-size: 13px; margin-bottom: 16px; }

.rows { display: flex; flex-direction: column; gap: 8px; margin-bottom: 14px; }
.row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 12px;
  background: var(--surface-sunken);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.row .name { font-weight: 600; }
.row .meta { color: var(--text-muted); font-size: 12px; }
.row .qty { display: flex; align-items: center; gap: 6px; }
.row button {
  width: 28px; height: 28px;
  border: 1px solid var(--border-strong);
  background: var(--surface-raised);
  color: var(--text);
  border-radius: var(--mg-r-sm);
  cursor: pointer;
  font-size: 15px;
  line-height: 1;
}
.row button:hover:not(:disabled) { background: var(--brand); color: var(--text-on-brand); }
.row button:disabled { opacity: .4; cursor: not-allowed; }
.row input {
  width: 62px;
  padding: 5px 6px;
  text-align: center;
  background: var(--bg);
  border: 1px solid var(--border-strong);
  border-radius: var(--mg-r-sm);
  color: var(--text);
  font-family: var(--font);
}

.report { margin-bottom: 14px; }
.report .line {
  display: flex;
  justify-content: space-between;
  padding: 7px 2px;
  border-bottom: 1px dashed var(--border);
  font-size: 14px;
  white-space: nowrap;   /* 任务5#3：打烊清场等明细行在移动端不换行/截断 */
}
.report .line > span { min-width: 0; }
.report .line.total {
  border-bottom: none;
  border-top: 2px solid var(--border-strong);
  margin-top: 6px;
  padding-top: 10px;
  font-size: 16px;
  font-weight: 700;
}
.report .line .pos { color: var(--money); }
.report .line .neg { color: var(--danger-text); }
.stars { font-size: 22px; color: var(--brand); letter-spacing: 3px; }

.upgrades { margin-bottom: 14px; }
.upgrade {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  background: var(--surface-sunken);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 8px;
}
.upgrade .u-name { font-weight: 600; }
.upgrade .u-eff { color: var(--text-muted); font-size: 12px; }
.upgrade button {
  padding: 6px 12px;
  background: var(--brand);
  color: var(--text-on-brand);
  border: none;
  border-radius: var(--mg-r-sm);
  font-weight: 700;
  cursor: pointer;
  font-family: var(--font);
}
.upgrade button:disabled { background: var(--surface-raised); color: var(--text-subtle); cursor: not-allowed; }

.actions { display: flex; gap: 10px; justify-content: flex-end; }
.btn {
  padding: 10px 18px;
  border-radius: var(--radius);
  border: 1px solid var(--border-strong);
  background: var(--surface-raised);
  color: var(--text);
  cursor: pointer;
  font-size: 14px;
  font-family: var(--font);
}
.btn.primary { background: var(--brand); color: var(--text-on-brand); border-color: var(--brand); font-weight: 700; }
.btn:disabled { opacity: .45; cursor: not-allowed; }

/* ---------- 开始遮罩 ---------- */
.start-mask {
  position: absolute;
  inset: 0;
  background: rgba(10, 13, 19, .88);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  pointer-events: auto;
  text-align: center;
  padding: 24px;
}
.start-mask h1 { margin: 0; font-size: 30px; letter-spacing: .06em; }
.start-mask .tag { color: var(--brand); font-size: 14px; }
.start-mask .keys {
  margin-top: 10px;
  color: var(--text-muted);
  font-size: 13px;
  line-height: 2;
}
.start-mask .keys b { color: var(--text); }

/* ---------- 账号登录（需求B）· 半透磨砂玻璃圆角（美术圣经 UI 规范） ---------- */
.login-mask {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  pointer-events: auto;
  background:
    radial-gradient(1200px 600px at 50% 0%, rgba(177, 91, 216, .18), transparent 60%),
    rgba(10, 13, 19, .88);
}
.login-card {
  width: min(420px, 92vw);
  padding: 24px 24px 20px;
  border-radius: var(--mg-r-lg);
  /* 磨砂玻璃：半透底 + 背景模糊 + 极细高光边 */
  background: rgba(35, 42, 56, .62);
  backdrop-filter: blur(16px) saturate(1.3);
  -webkit-backdrop-filter: blur(16px) saturate(1.3);
  border: 1px solid rgba(150, 170, 200, .22);
  box-shadow: 0 18px 48px rgba(0, 0, 0, .55), inset 0 1px 0 rgba(255, 255, 255, .07);
  color: var(--text);
}
.login-card h2 { margin: 0; font-size: 21px; letter-spacing: .04em; }
.login-card .lead { color: var(--text-muted); font-size: 13px; margin: 6px 0 16px; }

/* 账号选择：三个内测号卡位 */
.acc-list { display: flex; gap: 10px; margin-bottom: 16px; }
.acc-item {
  flex: 1;
  padding: 12px 8px;
  border-radius: var(--mg-r-md);
  text-align: center;
  cursor: pointer;
  background: rgba(20, 26, 36, .55);
  border: 1px solid rgba(150, 170, 200, .18);
  transition: border-color .15s, background .15s, transform .1s;
}
.acc-item:hover { border-color: rgba(177, 91, 216, .55); transform: translateY(-1px); }
.acc-item.active {
  border-color: var(--brand);
  background: rgba(232, 169, 78, .14);
  box-shadow: 0 0 0 1px rgba(232, 169, 78, .35), 0 0 18px rgba(232, 169, 78, .18);
}
.acc-item .acc-emoji { font-size: 22px; line-height: 1.1; }
.acc-item .acc-id { font-weight: 700; font-size: 15px; }
.acc-item .acc-name { color: var(--text-muted); font-size: 11px; margin-top: 2px; }
.acc-item .acc-state { font-size: 10px; margin-top: 4px; letter-spacing: .04em; }
.acc-item .acc-state.on { color: var(--money); }
.acc-item .acc-state.off { color: var(--text-subtle); }

.login-field { margin-bottom: 12px; }
.login-field label { display: block; font-size: 12px; color: var(--text-muted); margin-bottom: 5px; }
.login-field input {
  width: 100%;
  box-sizing: border-box;
  padding: 10px 12px;
  border-radius: var(--mg-r-md);
  background: rgba(12, 16, 23, .72);
  border: 1px solid rgba(150, 170, 200, .22);
  color: var(--text);
  font: 15px var(--font);
  outline: none;
  transition: border-color .15s, box-shadow .15s;
}
.login-field input:focus {
  border-color: rgba(177, 91, 216, .8);
  box-shadow: 0 0 0 3px rgba(177, 91, 216, .18);
}
.login-field .hint { color: var(--text-subtle); font-size: 11px; margin-top: 4px; }

.login-err {
  display: none;
  margin: 0 0 12px;
  padding: 9px 12px;
  border-radius: var(--mg-r-sm);
  font-size: 13px;
  background: rgba(235, 87, 87, .14);
  border: 1px solid rgba(235, 87, 87, .45);
  color: var(--danger-text);
}
.login-err.show { display: block; }

.login-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 16px; }
.login-foot { margin-top: 14px; font-size: 11px; color: var(--text-subtle); text-align: center; }
.login-foot .net-off { color: var(--text-subtle); }

/* ---------- 本地排行榜（需求D） ---------- */
.lb-list { display: flex; flex-direction: column; gap: 14px; margin-bottom: 16px; }
.lb-sec {
  border-radius: var(--mg-r-md);
  padding: 10px 12px;
  background: rgba(20, 26, 36, .5);
  border: 1px solid rgba(150, 170, 200, .16);
}
.lb-head { font-weight: 700; font-size: 14px; margin-bottom: 8px; }
.lb-head .lb-sub { color: var(--text-subtle); font-weight: 400; font-size: 12px; }
.lb-row {
  display: grid;
  grid-template-columns: 26px 1fr auto auto;
  gap: 8px;
  align-items: center;
  padding: 5px 0;
  font-size: 13px;
  border-top: 1px solid rgba(150, 170, 200, .10);
}
.lb-row:first-of-type { border-top: none; }
.lb-rank {
  text-align: center;
  font-weight: 700;
  color: var(--text-muted);
  border-radius: var(--mg-r-sm);
  background: rgba(150, 170, 200, .12);
}
.lb-rank.top { color: var(--text-on-brand); background: var(--brand); }
.lb-name { color: var(--text); }
.lb-meta { color: var(--text-subtle); font-size: 11px; }
.lb-val { color: var(--money); font-weight: 700; font-variant-numeric: tabular-nums; }
.lb-empty { color: var(--text-subtle); font-size: 12px; padding: 6px 0; }
/* 分组标题（P1-4 / P1-5）：街机 vs 经营。刻意做得比 .lb-head 更轻、
 * 更靠上留白 —— 它是"章"，.lb-head 是"节"，视觉层级不能同级。 */
.lb-group-head,
.ach-group-head {
  margin: 14px 0 8px;
  font-size: 13px;
  font-weight: 800;
  letter-spacing: .04em;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 8px;
}
.lb-group-head:first-child,
.ach-group-head:first-child { margin-top: 0; }
.lb-group-head::after,
.ach-group-head::after {
  content: '';
  flex: 1;
  height: 1px;
  background: rgba(150, 170, 200, .18);
}

/* ---------- 周终七夜条形图（内容批 P1-3） ----------
 * 七根等宽条：柱高按 |净利| 相对最大值归一（最高那夜顶满 100%），
 * 颜色语义与结算面板一致（赚 = --money / 亏 = --warning）。
 * 负值条**不**画到基线以下 —— 这个尺寸下上下分轴会让"亏 50"和"赚 2000"
 * 高度接近，反而看不出塌方；这里用颜色表达正负、高度只表达量级。 */
.we-bars {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 6px;
  align-items: end;
  height: 132px;
  margin-top: 10px;
  padding: 8px 6px 0;
  border-radius: var(--mg-r-md);
  background: rgba(20, 26, 36, .5);
  border: 1px solid rgba(150, 170, 200, .16);
}
.we-bar {
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  align-items: center;
  gap: 4px;
  height: 100%;
}
.we-bar-v { font-size: 10px; font-weight: 700; font-variant-numeric: tabular-nums; }
.we-bar-fill {
  width: 100%;
  max-width: 34px;
  border-radius: var(--mg-r-xs) 4px 0 0;
  min-height: 3px;
  /* 高度由内联 style 给出（每条不同），这里只兜过渡动画 */
  transition: height .18s ease-out;
}
.we-bar-n { font-size: 10px; color: var(--text-subtle); }


/* ==================================================================
   需求I：玩法叠加新增的三块 UI
     ① 左下角限时任务面板（②）
     ② 突发事件横幅（⑥）
     ③ 商店分区 / 背包面板（①③④⑦）
   —— 全部沿用既有磨砂玻璃令牌，不新增色值（R5 单一色源）
   ================================================================== */

/* ---------- ② 限时任务面板（左下角） ---------- */
.questpanel {
  position: absolute;
  left: 12px;
  bottom: 158px;          /* 让开店员四状态条（bottom:18px，高约 126px） */
  width: 236px;
  padding: 10px 12px 11px;
  background: var(--glass-bg);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border: var(--glass-border);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-float), var(--glass-glow-purple);
  font-size: 13px;
}
.questpanel .q-head {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 6px;
}
.questpanel .q-tag {
  font-size: 11px; font-weight: 700; letter-spacing: .06em;
  color: var(--neon-purple);
}
.questpanel .q-left {
  font-size: 11px; color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}
.questpanel .q-left.urgent { color: var(--danger-text); font-weight: 700; }
.questpanel .q-body { color: var(--text); font-weight: 600; }
.questpanel .q-body b { color: var(--brand); font-variant-numeric: tabular-nums; }
.questpanel .q-bar {
  height: 5px; margin: 7px 0 5px;
  border-radius: var(--mg-r-pill);
  background: rgba(150, 170, 200, .16);
  overflow: hidden;
}
.questpanel .q-bar > i {
  display: block; height: 100%; border-radius: var(--mg-r-pill);
  background: linear-gradient(90deg, var(--neon-purple), var(--neon-ice));
  transition: width .25s ease;
}
.questpanel .q-reward { color: var(--text-subtle); font-size: 11px; }

/* ---------- ⑥ 突发事件横幅 ---------- */
.incident {
  position: absolute;
  left: 50%; top: 74px;
  transform: translateX(-50%);
  display: flex; align-items: center; gap: 10px;
  padding: 11px 18px;
  background: var(--glass-bg-strong);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border: 1px solid rgba(235, 87, 87, .55);
  border-radius: var(--mg-r-pill);
  box-shadow: var(--shadow-float), 0 0 26px rgba(235, 87, 87, .28);
  background: var(--glass-bg-strong, rgba(20, 24, 33, .86));
  backdrop-filter: var(--glass-blur, blur(8px));
  -webkit-backdrop-filter: var(--glass-blur, blur(8px));
  font-size: 12.5px; font-weight: 600;
  padding: 7px 14px;
  opacity: .92;
  animation: incident-in .28s ease;
}
.incident .ic-emoji { font-size: 20px; }
.incident .ic-name { color: var(--warning); font-weight: 700; }
.incident .ic-desc { color: var(--text-muted); font-weight: 400; font-size: 12px; }
@keyframes incident-in {
  from { opacity: 0; transform: translate(-50%, -10px); }
  to   { opacity: 1; transform: translate(-50%, 0); }
}

/* ---------- ①③④⑦ 商店分区 / 背包 ---------- */
.shop-sec {
  margin: 14px 0 0;
  padding: 10px 12px;
  border-radius: var(--mg-r-md);
  background: rgba(20, 26, 36, .5);
  border: 1px solid rgba(150, 170, 200, .16);
}
.shop-sec .sec-head {
  font-weight: 700; font-size: 14px; margin-bottom: 8px;
  display: flex; align-items: center; justify-content: space-between;
}
.shop-sec .sec-head .sec-sub { color: var(--text-subtle); font-weight: 400; font-size: 11px; }

/* 设备升级行 */
.dev-row {
  display: grid; grid-template-columns: 1fr auto auto; gap: 8px; align-items: center;
  padding: 6px 0;
  border-top: 1px solid rgba(150, 170, 200, .10);
  font-size: 13px;
}
.dev-row:first-of-type { border-top: none; }
.dev-row .d-name { font-weight: 600; }
.dev-row .d-meta { color: var(--text-subtle); font-size: 11px; margin-top: 2px; }
.dev-row .d-meta .warn { color: var(--danger-text); }
.lv-badge {
  padding: 2px 8px; border-radius: var(--mg-r-pill);
  font-size: 11px; font-weight: 700;
  background: rgba(150, 170, 200, .14); color: var(--text-muted);
}
.lv-badge.lv2 { background: rgba(79, 209, 232, .18); color: var(--neon-ice); }
.lv-badge.lv3 { background: rgba(177, 91, 216, .22); color: var(--neon-purple); }

/* 通用小按钮（商店分区内的操作） */
.mini-btn {
  padding: 5px 11px;
  border-radius: var(--mg-r-sm);
  border: 1px solid var(--border-strong);
  background: var(--surface-raised);
  color: var(--text);
  font: 600 12px var(--font);
  cursor: pointer;
  white-space: nowrap;
}
.mini-btn:hover:not(:disabled) { background: var(--brand); color: var(--text-on-brand); border-color: var(--brand); }
.mini-btn:disabled { opacity: .4; cursor: not-allowed; }
.mini-btn.danger:hover:not(:disabled) { background: var(--warning); border-color: var(--warning); color: #fff; }

/* 改装：设备选择 chips */
.mod-devs { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 8px; }
.mod-devs .chip {
  padding: 4px 10px; border-radius: var(--mg-r-pill); cursor: pointer;
  font: 600 12px var(--font);
  background: rgba(150, 170, 200, .10);
  border: 1px solid rgba(150, 170, 200, .18);
  color: var(--text-muted);
}
.mod-devs .chip:hover { border-color: rgba(177, 91, 216, .5); }
.mod-devs .chip.active {
  border-color: var(--neon-purple);
  background: var(--neon-purple-a18);
  color: var(--text);
}
.mod-row {
  display: grid; grid-template-columns: 1fr auto; gap: 8px; align-items: center;
  padding: 6px 0;
  border-top: 1px solid rgba(150, 170, 200, .10);
  font-size: 13px;
}
.mod-row:first-of-type { border-top: none; }
.mod-row .m-name { font-weight: 600; }
.mod-row .m-eff { color: var(--text-subtle); font-size: 11px; margin-top: 2px; }
.mod-row .m-eff .on { color: var(--money); }
.mod-slots { color: var(--text-subtle); font-size: 11px; }
/* 分区内"为什么点不动"的原因文案（现金不足 / 故障中需先维修 …） */
.shop-sec .warn { color: var(--danger-text); }

/* 扩建行 */
.exp-row {
  display: grid; grid-template-columns: 1fr auto; gap: 10px; align-items: center;
  padding: 8px 0;
  border-top: 1px solid rgba(150, 170, 200, .10);
  font-size: 13px;
}
.exp-row:first-of-type { border-top: none; }
.exp-row .e-name { font-weight: 700; }
.exp-row .e-desc { color: var(--text-subtle); font-size: 11px; margin-top: 2px; }
.exp-row .e-owned { color: var(--money); font-weight: 700; font-size: 12px; }

/* ---------- ③ 背包面板（B） ---------- */
.inv-list { display: flex; flex-direction: column; gap: 8px; margin-bottom: 12px; }
.inv-row {
  display: grid; grid-template-columns: 34px 1fr auto auto; gap: 10px; align-items: center;
  padding: 9px 11px;
  border-radius: var(--mg-r-md);
  background: rgba(20, 26, 36, .5);
  border: 1px solid rgba(150, 170, 200, .16);
  cursor: pointer;
  transition: border-color .15s, background .15s;
}
.inv-row:hover { border-color: rgba(177, 91, 216, .45); }
.inv-row.selected {
  border-color: var(--brand);
  background: rgba(232, 169, 78, .12);
  box-shadow: 0 0 0 1px rgba(232, 169, 78, .3);
}
.inv-row .i-emoji { font-size: 21px; text-align: center; }
.inv-row .i-name { font-weight: 600; font-size: 13px; }
.inv-row .i-desc { color: var(--text-subtle); font-size: 11px; margin-top: 2px; }
.inv-row .i-count { color: var(--text-muted); font-size: 12px; font-variant-numeric: tabular-nums; }
.inv-empty { color: var(--text-subtle); font-size: 12px; padding: 6px 0; }

/* ---------- 需求J：经营面板四分页（进货 / 商店 / 店员 / 仓库） ---------- */
.tabbar { display: flex; gap: 6px; margin-bottom: 14px; flex-wrap: wrap; }
.tab {
  flex: 1; min-width: 64px; padding: 8px 6px; text-align: center;
  background: rgba(20, 26, 36, .5); border: 1px solid rgba(150, 170, 200, .16);
  border-radius: var(--mg-r-md); cursor: pointer; font: 600 13px var(--font); color: var(--text-muted);
  transition: border-color .15s, background .15s;
}
.tab:hover { border-color: rgba(177, 91, 216, .45); }
.tab.active {
  border-color: var(--neon-purple);
  background: var(--neon-purple-a18);
  color: var(--text);
  box-shadow: 0 0 0 1px rgba(177, 91, 216, .3);
}

/* 店员分页 */
.staff-row {
  display: grid; grid-template-columns: 34px 1fr auto; gap: 10px; align-items: center;
  padding: 10px 12px; border-radius: var(--mg-r-md); margin-bottom: 8px;
  background: rgba(20, 26, 36, .5); border: 1px solid rgba(150, 170, 200, .16);
}
/* 美术接入：店员页头部的玩家（clerk）肖像 + 文案横排 */
.staff-head { display: flex; align-items: center; gap: 12px; }
.staff-head .clerk-portrait {
  width: 52px; height: 52px; flex: none;
  border-radius: var(--mg-r-md); border: 2px solid var(--brand);
  background: var(--surface-raised); object-fit: cover;
}
.staff-row.hired { border-color: rgba(177, 91, 216, .35); }
.staff-row .s-emoji { font-size: 22px; text-align: center; }
.staff-row .s-name { font-weight: 700; font-size: 14px; }
.staff-row .s-desc { color: var(--text-subtle); font-size: 11px; margin-top: 2px; }
.staff-row .s-meta { color: var(--text-muted); font-size: 11px; margin-top: 3px; }
.staff-row .s-meta .warn { color: var(--danger-text); }
.staff-row .s-status {
  display: inline-block; margin-top: 5px; padding: 2px 8px; border-radius: var(--mg-r-pill);
  font-size: 11px; font-weight: 600; background: rgba(150, 170, 200, .14); color: var(--text-muted);
}
.s-status.idle { background: rgba(150, 170, 200, .14); color: var(--text-muted); }
.s-status.working, .s-status.repair, .s-status.clean,
.s-status.stock-shelf, .s-status.stock-vending, .s-status.stock-claw {
  background: rgba(111, 207, 151, .16); color: var(--money);
}
.s-status.resting { background: rgba(90, 169, 230, .16); color: var(--info); }
.s-status.errand { background: rgba(232, 169, 78, .16); color: var(--brand); }
.s-status.stopped { background: rgba(235, 87, 87, .16); color: var(--danger-text); }
.staff-row .s-bar { height: 6px; margin-top: 6px; border-radius: var(--mg-r-pill); background: rgba(150, 170, 200, .14); overflow: hidden; }
.staff-row .s-bar > i { display: block; height: 100%; border-radius: var(--mg-r-pill); transition: width .2s, background .2s; }

/* 员工培训树（店员详情内展开） */
.staff-train {
  margin-top: var(--mg-sp-2);
  border-top: 1px dashed rgba(150, 170, 200, .18);
  padding-top: var(--mg-sp-2);
}
.staff-train > summary {
  cursor: pointer; list-style: none;
  font-size: var(--mg-fs-xs); font-weight: 600; color: var(--neon-ice);
  padding: var(--mg-sp-1) 0;
}
.staff-train > summary::-webkit-details-marker { display: none; }
.staff-train > summary::before { content: '▾ '; color: var(--text-subtle); }
.staff-train:not([open]) > summary::before { content: '▸ '; }
.tn-list { display: flex; flex-direction: column; gap: var(--mg-sp-1); margin-top: var(--mg-sp-1); }
.train-node {
  display: flex; align-items: center; gap: var(--mg-sp-2);
  padding: 6px var(--mg-sp-2);
  border-radius: var(--mg-r-sm);
  background: rgba(20, 26, 36, .45);
  border-left: 2px solid rgba(150, 170, 200, .2);
}
.train-node.done { border-left-color: var(--money); opacity: .82; }
.train-node.ready { border-left-color: var(--brand); }
.train-node.locked { border-left-color: rgba(150, 170, 200, .18); }
.train-node .tn-main { flex: 1; min-width: 0; }
.train-node .tn-name { font-size: var(--mg-fs-xs); font-weight: 600; }
.train-node .tn-desc { font-size: var(--mg-fs-xs); line-height: var(--mg-lh-normal); color: var(--text-subtle); margin-top: 1px; }
.train-node .tn-reason { font-size: var(--mg-fs-xs); color: var(--danger-text); margin-top: 1px; }
.train-node .tn-act { flex: none; }
.train-node .tn-owned { font-size: var(--mg-fs-xs); color: var(--money); white-space: nowrap; }
.train-node .tn-buy { min-height: var(--mg-tap-sm); }
.train-node.locked .tn-buy { opacity: .55; }

/* 仓库分页 */
.wh-cap { margin-bottom: 12px; }
.wh-cap .wh-cap-text { font-size: 12px; color: var(--text-muted); }
.wh-cap .wh-cap-bar { height: 10px; border-radius: var(--mg-r-pill); background: rgba(150, 170, 200, .14); overflow: hidden; margin: 6px 0 2px; }
.wh-cap .wh-cap-bar > i { display: block; height: 100%; border-radius: var(--mg-r-pill); transition: width .2s; }
.wh-row {
  display: grid; grid-template-columns: 30px 1fr auto; gap: 10px; align-items: center;
  padding: 9px 11px; border-radius: var(--mg-r-md); margin-bottom: 8px;
  background: rgba(20, 26, 36, .5); border: 1px solid rgba(150, 170, 200, .16);
}
.wh-row.low { border-color: rgba(235, 87, 87, .5); box-shadow: 0 0 0 1px rgba(235, 87, 87, .25); }
.wh-row .w-emoji { font-size: 20px; text-align: center; }
.wh-row .w-name { font-weight: 600; font-size: 13px; }
.wh-row .w-meta { color: var(--text-subtle); font-size: 11px; margin-top: 2px; }
.wh-row .w-buy { display: flex; align-items: center; gap: 5px; }
.wh-row .w-buy input {
  width: 54px; padding: 5px 6px; text-align: center; background: var(--bg);
  border: 1px solid var(--border-strong); border-radius: var(--mg-r-sm); color: var(--text); font-family: var(--font);
}
.wh-tip { color: var(--text-subtle); font-size: 11px; margin-top: 10px; line-height: 1.6; }

/* ================= 设置页（Esc 暂停菜单 → ⚙ 设置） ================= */
/* 滑杆必须自己写样式：原生 range 在深色底上是浅灰轨道，与磨砂玻璃面板完全不搭。 */
.set-list { display: flex; flex-direction: column; gap: 14px; }
.set-group-title {
  font-size: 12px; font-weight: 700; letter-spacing: .08em;
  color: var(--neon-ice); margin-bottom: 8px;
}
.set-row { margin-bottom: 12px; }
.set-head {
  display: flex; align-items: baseline; justify-content: space-between;
  margin-bottom: 5px;
}
.set-label { font-size: 13px; font-weight: 600; color: var(--text); }
.set-val {
  font-size: 13px; font-weight: 700; color: var(--brand);
  font-variant-numeric: tabular-nums;
}
.set-hint { font-size: 11px; color: var(--text-subtle); margin-top: 4px; }

.set-row input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 6px;
  border-radius: var(--mg-r-xs);
  background: linear-gradient(90deg, var(--neon-ice) 0%, var(--neon-purple) 100%);
  outline: none;
  cursor: pointer;
}
.set-row input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 16px; height: 16px; border-radius: 50%;
  background: var(--text);
  border: 2px solid var(--brand);
  box-shadow: 0 2px 8px rgba(0, 0, 0, .55);
  cursor: pointer;
}
.set-row input[type="range"]::-moz-range-thumb {
  width: 14px; height: 14px; border-radius: 50%;
  background: var(--text); border: 2px solid var(--brand);
  box-shadow: 0 2px 8px rgba(0, 0, 0, .55); cursor: pointer;
}
.set-row input[type="range"]:focus-visible { box-shadow: 0 0 0 3px var(--neon-ice-a18); }

/* ================= 任务追踪：空闲态 / 完成绿闪 ================= */
.questpanel .q-idle {
  color: var(--text-muted); font-size: 12.5px;
}
.questpanel .q-idle b { color: var(--brand); }

/* ---- 首夜目标卡（P1-12）+ 常客条头部（P1-13 并入追踪块） ---- */
.questpanel .q-goal {
  display: flex; align-items: center; gap: 7px;
  font-size: 12.5px; color: var(--text-muted); line-height: 1.7;
}
.questpanel .q-goal b { margin-left: auto; font-weight: 700; }
.questpanel .q-goal.done { color: rgba(111, 207, 151, .95); }
.questpanel .q-goal.done b { color: rgba(111, 207, 151, .95); }
.questpanel .q-box {
  display: inline-flex; align-items: center; justify-content: center;
  width: 14px; height: 14px; flex: 0 0 14px;
  border-radius: var(--mg-r-xs); border: 1px solid var(--border-soft);
  font-size: 10px; line-height: 1;
}
.questpanel .q-goal.done .q-box {
  border-color: rgba(111, 207, 151, .6); background: rgba(111, 207, 151, .18);
}
.questpanel .q-regs {
  display: flex; flex-wrap: wrap; align-items: center; gap: 6px;
  padding-bottom: 6px; margin-bottom: 4px;
  border-bottom: 1px solid var(--border-soft);
}

.questpanel.done {
  border-color: rgba(111, 207, 151, .55);
  box-shadow: var(--shadow-float), 0 0 0 1px rgba(111, 207, 151, .45), 0 0 26px rgba(111, 207, 151, .35);
  animation: quest-done-flash .45s ease-out 2;
}
.questpanel .q-check { color: var(--money); font-weight: 800; }
@keyframes quest-done-flash {
  0%   { transform: translateX(0); }
  35%  { transform: translateX(3px); }
  70%  { transform: translateX(-2px); }
  100% { transform: translateX(0); }
}

/* ================= 新手引导字幕条（第 1 夜前 3 分钟） ================= */
/* 做成"顶部一条字幕"而不是弹窗：引导期间玩家要能继续操作，不能挡视野、不能抢鼠标。 */
.tutorial {
  position: absolute;
  top: 54px;                /* 让开顶栏（时钟 / 进度条） */
  left: 50%;
  transform: translateX(-50%);
  z-index: 35;
  display: flex; align-items: center; gap: 12px;
  padding: 9px 18px;
  max-width: min(680px, 88vw);
  border-radius: var(--mg-r-pill);
  background: var(--glass-bg-strong);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border: 1px solid rgba(79, 209, 232, .35);
  box-shadow: var(--shadow-float), 0 0 26px rgba(79, 209, 232, .22);
  color: var(--text);
  font: 600 14px/1.5 var(--font);
  pointer-events: none;     /* 字幕条绝不能吃掉点击 */
  animation: tut-in .22s ease-out;
}
.tutorial .tut-step {
  flex: none;
  padding: 3px 9px; border-radius: var(--mg-r-pill);
  background: var(--neon-ice-a18); border: 1px solid rgba(79, 209, 232, .45);
  color: var(--neon-ice); font-size: 11px; font-weight: 700; letter-spacing: .04em;
}
.tutorial .tut-text { font-weight: 700; }
.tutorial .tut-hint { color: var(--text-muted); font-weight: 500; font-size: 12.5px; }
@keyframes tut-in {
  from { opacity: 0; transform: translate(-50%, -8px); }
  to   { opacity: 1; transform: translate(-50%, 0); }
}

/* ============================================================
 * 成长线扩展：结算分段 / 定价页 / 成就面板 / 抉择弹窗 / 顶部横幅
 * ========================================================== */

/* 结算里的分段（主题 / 事件账本 / 星级） */
.set-sec {
  margin: 10px 0 4px;
  padding: 10px 12px;
  border-radius: var(--mg-r-md);
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
}
.set-sec .sec-head { font-size: 13.5px; font-weight: 700; color: var(--brand); }
.set-sec .sec-sub { margin-top: 4px; font-size: 12px; color: var(--text-muted); line-height: 1.5; }
/* P1-12：结算页的折叠段（事件账本 / 本周常客 / 店铺星级）。
 * summary 复用 .sec-head 的排版，但必须给"可点开"的视觉提示；去掉浏览器默认三角。 */
details.set-sec > summary.sec-head {
  cursor: pointer;
  user-select: none;
  list-style: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
details.set-sec > summary.sec-head::-webkit-details-marker { display: none; }
details.set-sec > summary.sec-head::after { content: '展开 ▾'; font-size: 11px; font-weight: 400; color: var(--text-muted); }
details.set-sec[open] > summary.sec-head::after { content: '收起 ▴'; }

/* 定价页 */
.price-row {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 9px 12px; margin-bottom: 8px;
  border-radius: var(--mg-r-md);
  background: var(--glass-bg); border: 1px solid var(--glass-border);
}
.price-row.up { border-color: rgba(235, 87, 87, .4); }
.price-row.down { border-color: rgba(111, 207, 151, .4); }
.price-row .p-name { font-size: 14px; font-weight: 700; }
.price-row .p-meta { margin-top: 3px; font-size: 11.5px; color: var(--text-muted); }
.price-row .p-btns { display: flex; gap: 6px; flex: none; }

/* 成就面板 */
.ach-list { max-height: 52vh; overflow-y: auto; padding-right: 4px; }
.a-count { font-size: 14px; color: var(--text-muted); font-weight: 500; }
.ach-row {
  display: flex; align-items: center; gap: 11px;
  padding: 9px 12px; margin-bottom: 8px;
  border-radius: var(--mg-r-md);
  background: var(--glass-bg); border: 1px solid var(--glass-border);
}
.ach-row.done { border-color: rgba(232, 169, 78, .45); background: rgba(232, 169, 78, .09); }
.ach-row .a-emoji { font-size: 24px; flex: none; width: 30px; text-align: center; }
.ach-row .a-name { font-size: 13.5px; font-weight: 700; }
.ach-row .a-desc { margin-top: 2px; font-size: 11.5px; color: var(--text-muted); }
.ach-row .a-prog { margin-top: 3px; font-size: 11px; color: var(--neon-ice); }
.ach-row .a-done { font-size: 11.5px; font-weight: 700; color: var(--brand); }
.ach-row .a-tok { font-size: 11.5px; color: var(--text-subtle); }

/* 抉择弹窗（暂停级） */
.modal.choice { max-width: 520px; }
.choice-body {
  margin: 6px 0 16px; padding: 12px 14px;
  border-radius: var(--mg-r-md); background: var(--glass-bg); border: 1px solid var(--glass-border);
  font-size: 13.5px; line-height: 1.65; color: var(--text);
}
.choice-opts { display: flex; flex-direction: column; gap: 10px; }
.choice-opt {
  display: block; width: 100%; text-align: left; cursor: pointer;
  padding: 11px 14px; border-radius: var(--mg-r-md);
  background: var(--glass-bg-strong); border: 1px solid var(--glass-border);
  color: var(--text); font-family: var(--font);
  transition: border-color .15s ease, background .15s ease;
}
.choice-opt:hover { border-color: var(--brand); background: rgba(232, 169, 78, .12); }
.choice-opt .c-label { font-size: 14.5px; font-weight: 700; }
.choice-opt .c-hint { margin-top: 3px; font-size: 11.5px; color: var(--text-muted); }

/* ============================================================
 * 任务6：CG 覆盖层（A 批事件卡 / B 批序章 / C 批里程碑）
 * 色板沿用暗夜蓝紫霓虹（--neon-purple / --neon-ice / --brand），与 HUD 同一套令牌。
 * ========================================================== */
.cg-mask {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  pointer-events: auto;
  padding: 16px;
  /* 比普通弹窗更沉的底：CG 是全屏沉浸时刻，不该看见后面的货架与顾客 */
  background:
    radial-gradient(120% 90% at 50% 40%, rgba(43, 26, 66, .55) 0%, rgba(8, 10, 16, .94) 70%),
    rgba(8, 10, 16, .9);
  animation: overlay-in .2s ease;
}
.cg-mask.skippable { cursor: pointer; }
.cg-mask.closing { animation: overlay-out .15s ease forwards; pointer-events: none; }

.cg-card {
  display: flex; gap: 14px;
  width: min(940px, 94vw); max-height: 88vh;
  padding: 14px;
  border-radius: var(--mg-r-md);
  background: linear-gradient(180deg, var(--surface) 0%, var(--surface-sunken) 100%);
  /* 像素风双描边：外层霓虹紫实边 + 内层冰蓝高光，暗色底上能压住大面积插画 */
  border: 2px solid #33254C;
  box-shadow:
    inset 0 0 0 1px var(--neon-ice-a18),
    0 0 34px var(--neon-purple-a18),
    0 18px 60px rgba(0, 0, 0, .62);
  animation: panel-in .2s ease;
  overflow: hidden;
}

/* ---------- 插画区 ---------- */
.cg-figure {
  flex: 1 1 62%; min-width: 0;
  position: relative;
  aspect-ratio: 16 / 9;
  display: flex; align-items: center; justify-content: center;
  border-radius: var(--mg-r-md); overflow: hidden;
  border: 1px solid var(--border-strong);
  background: linear-gradient(160deg, #151C2B 0%, #0B0E15 100%);
}
.cg-img {
  width: 100%; height: 100%;
  object-fit: contain;              /* 不裁切：16:9 原图整张进框 */
  display: block;
  opacity: 0; transition: opacity .25s ease;
  image-rendering: pixelated;       /* 像素复古风：缩放不许糊成一团 */
  image-rendering: crisp-edges;
}
.cg-img.ready { opacity: 1; }
.cg-ph {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  color: var(--text-subtle); font-size: 12px; letter-spacing: .08em;
}
.cg-figure.loaded .cg-ph { display: none; }
/* 图挂了（线上白名单漏文件就是这症状）→ 整块插画区消失，退化成纯文字卡，
 * 而不是留一个裂图图标让玩家以为游戏坏了 */
.cg-figure.failed { display: none; }

/* ---------- 文字区 ---------- */
.cg-text {
  flex: 1 1 38%; min-width: 0;
  display: flex; flex-direction: column; gap: 10px;
  padding: 6px 8px 8px; overflow-y: auto;
}
.cg-caption { font-size: 11.5px; color: var(--brand); letter-spacing: .06em; }
.cg-title { margin: 0; font-size: 18px; letter-spacing: .04em; color: var(--text); }
.cg-lines { display: flex; flex-direction: column; gap: 7px; }
.cg-line {
  margin: 0;
  font-size: 13.5px; line-height: 1.75; color: var(--text-muted);
  word-break: break-word;      /* 390px 窄屏长句不许横向溢出 */
  opacity: 0;
  animation: cg-line-in .5s ease forwards;
}
@keyframes cg-line-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.cg-opts { display: flex; flex-direction: column; gap: 10px; margin-top: 2px; }
.cg-go { margin-top: auto; align-self: flex-start; padding: 10px 20px; }
.cg-tip { margin-top: 6px; }

/* 抉择弹窗里的内联插画（A 批：插画在上、事件文字在下） */
.modal.choice.has-cg { max-width: 560px; }
.cg-figure.inline { flex: none; width: 100%; margin-bottom: 12px; }

/* 竖屏 / 窄屏：上下分栏（图在上、文字 + 选项在下） */
@media (orientation: portrait), (max-width: 720px) {
  .cg-card { flex-direction: column; width: min(560px, 94vw); max-height: 92vh; gap: 10px; }
  .cg-figure { flex: 0 0 auto; width: 100%; }
  .cg-text { flex: 0 1 auto; }
}
/* 390px 级窄屏：卡片留白收紧，标题/正文降一号，保证不溢出 */
@media (max-width: 430px) {
  .cg-mask { padding: 8px; }
  .cg-card { padding: 9px; border-radius: var(--mg-r-md); }
  .cg-title { font-size: 16px; }
  .cg-line { font-size: 12.5px; line-height: 1.65; }
  .cg-go { align-self: stretch; text-align: center; }
}

/* 顶部横幅：主题（常驻） / 促销（醒目） */
.theme-banner, .promo-banner {
  padding: 8px 18px; border-radius: var(--mg-r-pill);
  font: 600 13px/1.4 var(--font);
  backdrop-filter: var(--glass-blur); -webkit-backdrop-filter: var(--glass-blur);
  box-shadow: var(--shadow-float);
}
.theme-banner {
  background: var(--glass-bg-strong); border: 1px solid rgba(177, 91, 216, .45);
  color: var(--text);
}
.theme-banner .tb-desc { margin-left: 8px; font-weight: 400; font-size: 12px; color: var(--text-muted); }
/* P0-2 的叙事引导语：横幅**第二行**。
 * 必须 display:block —— 挤在同一行会和主题名+描述抢宽度，
 * 在 375px 竖屏上直接换行成三截、读不成句子。 */
.theme-banner .tb-intro {
  display: block;
  margin-top: 2px;
  font-weight: 400;
  font-size: 11px;
  color: var(--neon-ice, #4FD1E8);
  opacity: .9;
}
.promo-banner {
  background: linear-gradient(90deg, rgba(235, 87, 87, .9), rgba(232, 169, 78, .9));
  border: 1px solid rgba(255, 255, 255, .3);
  color: #fff; font-weight: 700; letter-spacing: .02em;
  animation: promo-pulse 1.2s ease-in-out infinite;
}
@keyframes promo-pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.045); }
}

/* 满意度临时加成角标 */
.sat-bonus {
  margin-left: 6px; padding: 1px 7px; border-radius: var(--mg-r-pill);
  background: var(--neon-a18); border: 1px solid rgba(111, 207, 151, .45);
  color: var(--money); font-size: 11px; font-weight: 700;
}

/* 疲劳系统：玩家疲劳读数（左上角，独立于店员状态条） */
.pfatigue { display: flex; align-items: center; gap: 6px; }
.pfatigue .value { transition: color .3s ease; }

/* 疲劳系统：打瞌睡遮罩（重度未处理时短暂失去控制的可视化） */
.doze {
  position: fixed; inset: 0; z-index: 70; pointer-events: none;
  background: radial-gradient(circle at 50% 45%, rgba(8,11,17,0) 0%, rgba(8,11,17,.55) 72%, rgba(8,11,17,.82) 100%);
  animation: doze-blink 1.1s ease-in-out infinite;
}
@keyframes doze-blink {
  0%, 100% { opacity: .55; }
  50% { opacity: .95; }
}

/* ---------- 前台手机（按 O 打开）· 旧屏风格 ----------
 * 深色机身 + 绿色荧光 LCD 屏 + 等宽字体，营造"老式功能机"的怀旧感。
 * 配色刻意脱离主 HUD 的霓虹紫/冰蓝，用 LCD 绿自成一体，避免与经营面板混淆。 */
.phone {
  width: min(380px, 92vw);
  max-height: 84vh;
  max-height: 84dvh;   /* P1-12：dvh 双写 */
  display: flex;
  flex-direction: column;
  background: #1C2322;
  border: 1px solid #2E3A36;
  border-radius: var(--mg-r-lg);
  box-shadow: 0 18px 50px rgba(0, 0, 0, .55);
  padding: 14px;
  animation: panel-in .15s ease;
}
.phone-status {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 2px 8px 10px;
  font-family: ui-monospace, "Cascadia Mono", Consolas, monospace;
  font-size: 12px;
  color: #A7C6B4;
  letter-spacing: .5px;
}
.phone-screen {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 320px;
  overflow: hidden;
  background: #0C1F14;
  background-image: radial-gradient(circle at 50% 0%, rgba(125, 232, 160, .08), transparent 60%);
  border: 1px solid #1E3A2A;
  border-radius: var(--mg-r-md);
  padding: 12px;
  box-shadow: inset 0 0 24px rgba(0, 0, 0, .6);
}
.phone-tabs {
  display: flex;
  gap: 6px;
  margin-bottom: 10px;
}
.phone-tab {
  position: relative;
  flex: 1;
  padding: 7px 4px;
  font-family: ui-monospace, "Cascadia Mono", Consolas, monospace;
  font-size: 13px;
  color: #3F7A54;
  background: transparent;
  border: 1px solid #1E3A2A;
  border-radius: var(--mg-r-sm);
  cursor: pointer;
  transition: color .12s, background .12s, border-color .12s;
}
.phone-tab:hover { color: #6FCF97; border-color: #2A5A3C; }
.phone-tab.active {
  color: #0C1F14;
  background: #5FD48A;
  border-color: #5FD48A;
  font-weight: 600;
}
.phone-badge {
  position: absolute;
  top: -6px;
  right: -4px;
  min-width: 16px;
  height: 16px;
  line-height: 16px;
  padding: 0 4px;
  border-radius: var(--mg-r-sm);
  background: #EB5757;
  color: #fff;
  font-size: 10px;
  font-weight: 700;
}
.phone-body {
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.phone-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 12px;
  background: rgba(125, 232, 160, .05);
  border: 1px solid #173322;
  border-radius: var(--mg-r-md);
}
.phone-item.bad { border-color: rgba(235, 87, 87, .35); background: rgba(235, 87, 87, .06); }
.phone-item.active { border-color: #2A5A3C; }
.phone-item.unread { border-color: #3F7A54; background: rgba(125, 232, 160, .1); }
.pi-emoji { font-size: 20px; line-height: 1.3; }
.pi-main { flex: 1; min-width: 0; }
.pi-text { font-family: ui-monospace, "Cascadia Mono", Consolas, monospace; font-size: 13px; color: #BFF0D2; line-height: 1.4; }
.phone-item.bad .pi-text { color: #F0A5A5; }
.pi-meta { font-family: ui-monospace, "Cascadia Mono", Consolas, monospace; font-size: 11px; color: #4E7A5E; margin-top: 3px; }

/* ---------- 进货运输（2026-10-06 块5） ---------- */
/* 在途/已到货 标签：橙黄=在路上，绿=已到（后者更醒目，因为那是"可以搬了"） */
.tag-transit {
  display: inline-block;
  margin-left: 6px;
  padding: 1px 6px;
  border-radius: var(--mg-r-xs);
  font-size: 10px;
  font-family: ui-monospace, "Cascadia Mono", Consolas, monospace;
  background: rgba(232, 169, 78, .18);
  color: #E8A94E;
  border: 1px solid rgba(232, 169, 78, .4);
}
.tag-transit::after { content: none; }

/* ---------- 任务板（2026-10-06 块4） ---------- */
/* 目标数字内联在标题里（"接待顾客 6位"），比另起一行更紧凑 */
.pi-meta-inline { font-family: ui-monospace, "Cascadia Mono", Consolas, monospace; font-size: 11px; color: #7DE8A0; margin-left: 4px; }
/* 任务卡的接/弃按钮：手机端是主要点击目标，必须不被左侧文字挤扁。
 * .phone-item 是 flex，.pi-main 不设 min-width 的话内容会把按钮压成一条 ——
 * flex 子项默认 min-width:auto 会被内容顶开，所以这里显式 min-width:0 让它可收缩。 */
.phone-item .pi-main { min-width: 0; flex: 1 1 auto; }
.phone-item .phone-btn { flex: 0 0 auto; align-self: center; }
.pi-dot { width: 8px; height: 8px; border-radius: 50%; background: #5FD48A; margin-top: 5px; flex-shrink: 0; box-shadow: 0 0 6px rgba(95, 212, 138, .8); }
.phone-empty {
  font-family: ui-monospace, "Cascadia Mono", Consolas, monospace;
  font-size: 13px;
  color: #3F7A54;
  text-align: center;
  padding: 18px 8px;
}
.phone-remedy {
  margin-bottom: 10px;
  padding: 10px 12px;
  background: rgba(232, 169, 78, .08);
  border: 1px solid rgba(232, 169, 78, .4);
  border-radius: var(--mg-r-md);
}
.phone-remedy .pr-head { font-family: ui-monospace, "Cascadia Mono", Consolas, monospace; font-size: 13px; font-weight: 700; color: #E8A94E; margin-bottom: 4px; }
.phone-remedy .pr-body { font-family: ui-monospace, "Cascadia Mono", Consolas, monospace; font-size: 12px; color: #C9B27A; }
.phone-remedy .pr-bar, .phone-item .pr-bar {
  height: 6px;
  margin-top: 8px;
  background: #173322;
  border-radius: var(--mg-r-xs);
  overflow: hidden;
}
.phone-remedy .pr-bar i, .phone-item .pr-bar i {
  display: block;
  height: 100%;
  background: #5FD48A;
  border-radius: var(--mg-r-xs);
}
.phone-actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  padding-top: 12px;
}
.phone-btn {
  font-family: ui-monospace, "Cascadia Mono", Consolas, monospace;
  font-size: 14px;
  font-weight: 600;
  color: #0C1F14;
  background: #5FD48A;
  border: 1px solid #5FD48A;
  border-radius: var(--mg-r-md);
  padding: 10px 18px;
  cursor: pointer;
  transition: filter .12s;
}
.phone-btn:hover { filter: brightness(1.1); }
.phone-btn:disabled { opacity: .4; cursor: not-allowed; }
.phone-btn.ghost {
  color: #5FD48A;
  background: transparent;
  border-color: #2A5A3C;
}
.phone-btn.ghost:hover { background: rgba(95, 212, 138, .12); }

/* 尊重系统减弱动效偏好（美术圣经 §9.6） */
@media (prefers-reduced-motion: reduce) {
  .crosshair, .topbar .track > i, .toast,
  .ns-rotate-icon { transition: none !important; animation: none !important; }
  .acc-item { transition: none; }
  .questpanel.done { animation: none !important; }
  .tutorial { animation: none !important; }
  .promo-banner { animation: none !important; }
  .doze { animation: none !important; }
  /* 任务6：序章/里程碑的逐句浮现改为直接显示（不靠它传达信息，去掉也不损失） */
  .cg-line { animation: none !important; opacity: 1 !important; }
  .cg-img { transition: none !important; }
  /* 手感批四 P1-3：补全未覆盖的动效（结算/商店面板淡入、数字跳字、事件横幅、各进度条过渡） */
  .modal-mask, .modal, .value.jump, .incident,
  .we-bar-fill, .questpanel .q-bar > i, .wh-cap .wh-cap-bar > i, .staff-row .s-bar > i {
    transition: none !important; animation: none !important;
  }
}

/* ---------- 监控室（模块 4 子功能①） ---------- */
.mon-modal { max-width: 560px; }
.cam-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin: 6px 0 10px;
}
.cam-tile {
  border-radius: var(--mg-r-md);
  padding: 10px;
  background: rgba(14, 20, 28, .7);
  border: 1px solid rgba(150, 170, 200, .18);
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.cam-tile.alert { border-color: rgba(235, 87, 87, .7); box-shadow: 0 0 0 2px rgba(235, 87, 87, .25); }
.cam-head { font-weight: 700; font-size: 13px; color: var(--text); }
.cam-view {
  height: 92px; border-radius: var(--mg-r-sm);
  background: repeating-linear-gradient(45deg, #0c1118, #0c1118 8px, #0f161f 8px, #0f161f 16px);
  display: flex; align-items: center; justify-content: center;
  font-size: 13px;
}
.cam-ok { color: #5fd08a; letter-spacing: 1px; }
.cam-thief {
  color: #ff6b6b; font-weight: 800; font-size: 16px;
  display: flex; align-items: center; gap: 8px;
  animation: camBlink .7s steps(2, start) infinite;
}
.cam-count { color: #ffd166; font-variant-numeric: tabular-nums; }
@keyframes camBlink { 0%, 100% { opacity: 1; } 50% { opacity: .35; } }
.mon-status { padding: 7px 10px; border-radius: var(--mg-r-sm); font-size: 13px; margin-bottom: 6px; }
.mon-status.ok { background: rgba(95, 208, 138, .14); color: #6fe0a0; }
.mon-status.alert { background: rgba(235, 87, 87, .16); color: var(--danger-text); font-weight: 700; }

/* ---------- 二手市场列表（模块 4 子功能②） ---------- */
.sh-row {
  display: flex; align-items: center; justify-content: space-between;
  gap: 10px; padding: 9px 11px; margin-bottom: 8px;
  border-radius: var(--mg-r-md); background: rgba(20, 26, 36, .5);
  border: 1px solid rgba(150, 170, 200, .14);
}
.sh-name { font-weight: 700; font-size: 13px; }
.sh-meta { color: var(--text-subtle); font-size: 12px; margin-top: 2px; }
.sh-btns { display: flex; gap: 6px; }

/* ---------- 常客在场指示（模块 4 子功能③） ---------- */
.regulars {
  position: absolute; left: 16px; bottom: 64px; z-index: 6;
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  font-size: 12px;
}
.reg-label { color: var(--text-subtle); }
.reg-chip {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 8px; border-radius: var(--mg-r-pill);
  background: rgba(177, 91, 216, .16); border: 1px solid rgba(177, 91, 216, .5);
  color: #e9c6ff; font-weight: 600;
}
.reg-tag {
  font-style: normal; font-size: 10px; line-height: 1;
  padding: 2px 4px; border-radius: var(--mg-r-xs);
  background: #b15bd8; color: #fff; font-weight: 800;
}

/* ---------- 账号重开：设置里的入口 + 二次确认弹窗 ----------
 * 不可逆动作的视觉语言：一律走 --warning 橙红，且不用"主要按钮"蓝，
 * 避免和旁边的"关闭"抢注意力 —— 玩家的默认动作应该是取消。 */
.btn.danger {
  background: rgba(235, 87, 87, .16);
  border-color: rgba(235, 87, 87, .55);
  color: var(--danger-text);
  font-weight: 700;
}
.btn.danger:hover:not(:disabled) {
  background: var(--warning); border-color: var(--warning); color: #fff;
}
.set-group.danger .set-group-title { color: var(--danger-text); }
.set-group.danger .set-row .btn { margin-top: 8px; }

.reset-modal { max-width: 560px; }
.reset-scope {
  display: grid; grid-template-columns: 1fr 1fr; gap: 12px;
  margin: 6px 0 14px;
}
.reset-col {
  padding: 10px 12px; border-radius: var(--mg-r-md);
  background: rgba(20, 26, 36, .5);
  border: 1px solid rgba(150, 170, 200, .14);
}
.reset-col:first-child { border-color: rgba(235, 87, 87, .4); }
.reset-col-title { font-size: 12px; font-weight: 700; margin-bottom: 6px; color: var(--text-muted); }
.reset-col ul { margin: 0; padding-left: 16px; }
.reset-col li { font-size: 12px; line-height: 1.6; color: var(--text-muted); }
.reset-col li.del::marker { color: var(--danger-text); }
.reset-col li.keep::marker { color: var(--ok-text, #7ed6a5); }

/* ============================================================
 * 双端适配 · 移动端（模拟经营手机可用 · 2026-10-02）
 * 仅通过媒体查询影响触屏/窄屏设备；桌面端（鼠标+键盘）零侵入。
 * 控件层级：画布(0) < 移动控件(50/60) < 弹窗(100) < 横屏旋转遮罩(9999)
 *            —— 遮罩在最顶层，所以它「隐藏时不吃指针」是硬约束（见 #ns-rotate 注释）
 * ============================================================ */

/* 防止页面级滚动/橡皮筋（移动端拖拽转视角时浏览器抢手势）
 * 另外三条是"手指拖视角时被浏览器抢手势"的其余成因：
 *   - user-select：长按 HUD 文本会被判成"选中文字"，弹出选择手柄并吞掉这次拖拽
 *   - tap-highlight：轻触时闪一下灰底
 *   - touch-action: manipulation：去掉 300ms 双击缩放判定
 * ⚠ 这四条原先只存在于 Pages 仓库的 shared/tokens.css 末尾一行（手工补的），
 *   源里没有 → 任何一次镜像就丢，且丢了没有任何报错，只能靠手感发现。2026-11-15 回流到源。 */
html, body {
  overscroll-behavior: none;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
  -webkit-user-select: none;
}
#scene-canvas { touch-action: none; }

/* 触屏设备：可点元素最小 44px，去掉 300ms 点击延迟 + 禁止双击缩放 */
@media (pointer: coarse) {
  button, .btn, .mini-btn, .phone-btn, .tab, .chip, .acc-item,
  input[type="number"], [data-act] {
    min-height: var(--mg-tap);
    min-width: var(--mg-tap);
    touch-action: manipulation;
  }
  .modal-mask { padding: 12px; }
  .row, .grid, .acc-grid { gap: 10px; }
  .prompt, .hintbar, .topbar, .corner { font-size: 14px; }
  /* 手机横屏视野窄：右上角信息面板（现金/代币/营收 + 经营环境行）整体压缩，
   * 别让一块 200px 的统计牌占掉屏幕右上角一大片（2026-10-05 手感反馈）。 */
  .corner { padding: 6px 10px; font-size: 12px; line-height: 1.45; min-width: 0; }
  .corner .label { font-size: 11px; }
  .corner .value { font-size: 15px; }
  .corner .envline { margin-top: 5px; padding-top: 4px; }
  .envline .env-row { gap: 8px; }
  .envline .env-row .label { font-size: 11px; }
  .envline .env-row .value { font-size: 13px; }
  .envline .ev { font-size: 12px; padding: 0 6px; }
  /* 手机横屏视野窄：toast 继续贴左竖排（不回中央），只压小字号与内边距。
   * 顶部弹窗会遮掉大半视野（2026-10-05 反馈），中央更会压住准星 —— 一律靠左。 */
  .toasts { top: 108px; left: calc(8px + env(safe-area-inset-left)); max-width: min(240px, 46vw); }
  .toast { font-size: 10.5px; padding: 4px 8px; }
}

/* ---------- P1-12：窄屏/触屏下弹窗按钮常驻 ----------
 * 结算面板有 20+ 行账目 + 4 项升级，横屏 667×375 时 `.modal` 的 84dvh ≈ 315px，
 * 主按钮在滚动区最底部 = 要滚 3 屏才点得到。sticky 让按钮组贴着面板底部常驻，
 * 内容仍可滚（`.modal` 的 max-height + overflow 不变）。
 * 桌面 `(pointer: fine)` 且宽度 > 600px 时不命中 → 布局与改前一致。 */
@media (max-width: 600px), (pointer: coarse) {
  .modal .actions {
    position: sticky;
    bottom: 0;
    z-index: 2;
    padding: 10px 0 calc(6px + env(safe-area-inset-bottom));
    background: linear-gradient(180deg, rgba(20, 24, 33, 0) 0%, var(--surface, #1A2230) 38%);
  }
}

/* ---------- 手机竖屏紧凑适配（窄屏 ≤600px：HUD 整体收一号） ----------
 * 放在 (pointer: coarse) 之后：手机同时命中两条时，这里更紧凑的字号/内边距压过 coarse 的默认。
 * 注意：角块真实类名为 .corner.tl / .corner.tr（见 src/hud.mjs），不是 left/right；
 *       .toasts 同时补 bottom:auto，否则会和 base / coarse 块的 bottom 一起把容器竖向拉伸。 */
@media (max-width: 600px) {
/* 窄屏弹窗按钮：改**竖排**。
 * 横排时两个按钮平分宽度，"进入第 2 周 · ×1.25" 这种带数值的文案会被折成两行，
 * 按钮高度随之跳动、两个按钮高度还不一致。竖排之后每个按钮独占一行，文案一行放得下。 */
.actions { flex-direction: column-reverse; align-items: stretch; }
.actions .btn { width: 100%; }
.topbar { font-size: 12px; padding: 6px 10px; }
.topbar .segment { font-size: 11px; margin-left: 6px; }
.corner { padding: 8px 10px; }
.corner .label { font-size: 10px; }
.corner .value { font-size: 15px; }
.envline .env-row .label { font-size: 10px; }
.envline .env-row .value { font-size: 12px; }
.hintbar { font-size: 10px; padding: 5px 8px; bottom: 6px; }
.prompt { font-size: 13px; padding: 8px 14px; }
.toast { font-size: 11px; padding: 6px 10px; }
.toasts { top: 112px; left: calc(8px + env(safe-area-inset-left)); max-width: min(230px, 52vw); }
.queue .head { font-size: 10px; }
/* 左右角数据块在手机上缩小宽度 */
.corner.tl, .corner.tr { max-width: 42%; }
}

/* ---------- 手机竖屏布局（P0-2：不锁横屏，竖屏也是可玩状态） ----------
 * 放在 (max-width:600px) 之后、横屏规则之前：375×667 真机同时命中 600px 与本条，
 * 靠"后者胜"让竖屏的左右角 calc(50% - 12px) 压过 600px 块的 42%。
 * 与后面的横屏块互斥（orientation 不同时成立），不存在互相覆盖问题。 */
@media (pointer: coarse) and (orientation: portrait) {
  .corner.tl, .corner.tr { max-width: calc(50% - 12px); padding: 6px 8px; }
  .envline .env-row { gap: 6px; font-size: 10px; }
  .queue { bottom: 96px; }              /* 让开右下按钮组 */
  #ns-joy { bottom: 18px; }
  .topbar { padding: 5px 8px; }
  /* P1-12：竖屏升级区改单列 —— 效果文案与价格按钮上下排，避免挤成两行/截断。 */
  .upgrades .upgrade { flex-direction: column; align-items: stretch; gap: 8px; }
  .upgrades .upgrade button { width: 100%; }
}

/* 手机横屏（高度紧张）：手机面板的 .phone-screen 有 320px 硬性最小高 + overflow:hidden，
 * 会把整个面板撑出屏幕上下两端 —— 关闭按钮在 .phone-actions（面板底部）就永远点不到（2026-10-05 实测）。
 * 横屏下让 screen 收缩到视口内 + 屏幕内滚动，关闭按钮恒可见。 */
@media (pointer: coarse) and (orientation: landscape) {
  .phone { max-height: calc(100vh - 24px); max-height: calc(100dvh - 24px); }
  .phone-screen { min-height: 0; overflow-y: auto; }
}

/* 手机横屏·矮高度（逻辑高度 < 500px）：整体再收一号，腾出纵向空间 */
@media (pointer: coarse) and (max-height: 500px) {
.topbar { font-size: 11px; padding: 4px 8px; }
.topbar .segment { font-size: 10px; margin-left: 5px; }
.corner.tl, .corner.tr { padding: 5px 8px; max-width: 38%; }
.corner .label { font-size: 9px; }
.corner .value { font-size: 13px; }
.envline { display: none; }  /* 环境行横屏太占高度，直接藏 */
.hintbar { font-size: 9px; padding: 3px 6px; bottom: 4px; }
.prompt { font-size: 12px; padding: 6px 12px; }
.toast { font-size: 10px; padding: 4px 8px; }
.toasts { top: 72px; left: calc(6px + env(safe-area-inset-left)); max-width: min(220px, 50vw); gap: 3px; }
.theme-banner, .promo-banner { font-size: 12px; padding: 5px 10px; }
.theme-banner .tb-desc { font-size: 10px; }
.theme-banner .tb-intro { font-size: 10px; }   /* 竖屏：引导语跟描述同级缩一号，别抢主题名 */
}

/* 触屏点击反馈：桌面 :hover 在手机上不会触发，用 :active / :focus-visible 补 */
.btn:hover, .btn:active, .mini-btn:hover, .mini-btn:active,
.row button:hover, .row button:active, .phone-btn:hover, .phone-btn:active,
.tab:hover, .tab:active, .chip:hover, .chip:active, .acc-item:hover, .acc-item:active {
  filter: brightness(1.12);
}
.btn:focus-visible, .mini-btn:focus-visible, .phone-btn:focus-visible,
.tab:focus-visible, .chip:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }

/* ---------- 移动端控件容器（固定全屏，本身不吃指针，子元素才吃） ---------- */
#ns-mc-root {
  position: fixed; inset: 0; z-index: 50; pointer-events: none;
  font-family: system-ui, -apple-system, "PingFang SC", "Microsoft YaHei", sans-serif;
}
#ns-mc-root > * { pointer-events: auto; }

/* 左下虚拟摇杆 */
/* 左半屏浮动摇杆（2026-10-05 触摸分区）：默认隐藏，手指按在左半屏任意位置时
 * 由 JS 显示并定位到触摸点（inline left/top 覆盖这里的占位值） */
#ns-joy {
  display: none;
  position: fixed; left: 0; top: 0;
  width: 112px; height: 112px; border-radius: 50%;
  background: rgba(20, 26, 36, .42); border: 1px solid rgba(177, 91, 216, .4);
  backdrop-filter: blur(2px); touch-action: none; z-index: 50;
}
#ns-joy-knob {
  position: absolute; left: 50%; top: 50%; width: 48px; height: 48px; margin: -24px 0 0 -24px;
  border-radius: 50%; background: rgba(232, 169, 78, .85);
  box-shadow: 0 0 10px rgba(232, 169, 78, .6);
}

/* 右下动作按钮（交互 / 冲刺 / 菜单） */
#ns-actions {
  position: fixed; right: calc(16px + env(safe-area-inset-right)); bottom: calc(24px + env(safe-area-inset-bottom));
  display: flex; flex-direction: column; gap: 12px; align-items: flex-end; z-index: 50;
}
.ns-act {
  width: 64px; height: 64px; border-radius: 50%; border: 1px solid rgba(177, 91, 216, .5);
  background: rgba(20, 26, 36, .6); color: #f0ece2; font-size: 14px; font-weight: 700;
  touch-action: manipulation; user-select: none; backdrop-filter: blur(2px);
}
.ns-act:active { background: rgba(177, 91, 216, .5); }
.ns-act.on { background: var(--brand, #b15bd8); color: #fff; }

/* 菜单面板（底部抽屉） */
#ns-menu {
  position: fixed; left: 50%; bottom: calc(96px + env(safe-area-inset-bottom)); transform: translateX(-50%);
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; width: min(92vw, 420px);
  padding: 14px; border-radius: var(--mg-r-md); z-index: 60;
  background: rgba(14, 17, 24, .92); border: 1px solid rgba(177, 91, 216, .4);
  backdrop-filter: blur(6px);
}
#ns-menu.ns-hidden { display: none; }
#ns-menu button {
  min-height: var(--mg-tap); border-radius: var(--mg-r-md); border: 1px solid rgba(150, 170, 200, .2);
  background: rgba(30, 38, 52, .9); color: #f0ece2; font-size: 14px; touch-action: manipulation;
}
#ns-menu button:active { background: rgba(177, 91, 216, .4); }
#ns-menu .ns-menu-close { grid-column: 1 / -1; background: rgba(235, 87, 87, .25); }

/* 横屏提示条（仅触屏 + 竖屏 + 游戏进行中由 JS 显示）
 * 2026-10-27（P0-2）起从"全屏遮罩"降级为**底部 44px 提示条**：不锁方向、不挡视野、
 * 8 秒自动消失、整条可点关闭。2026-10-03 真机事故的三条硬约束仍成立：
 * 默认 pointer-events:none，JS 显示时才置 auto；隐藏必须 display:none 不留透明层；
 * 出口不依赖旋转（可点 + 自动消失）。500ms 轮询在 mobile-controls.mjs，不能删。 */
#ns-rotate {
  position: fixed; left: 0; right: 0; bottom: 0; height: 44px; z-index: 9999; display: none;
  pointer-events: none;   /* 未显示/判定不出来时绝不吃点击；JS 显式开时才 auto */
  flex-direction: row; align-items: center; justify-content: center; gap: 10px;
  background: rgba(8, 10, 16, .88); color: #f0ece2;
  border-top: 1px solid rgba(177, 91, 216, .35);
  padding: 0 16px; touch-action: manipulation;
}
/* ⚠ 这两个子元素在 mobile-controls.mjs 里是 class，不是 id —— 此前写成 #id 选择器导致
 * 整段样式完全失效（2026-10-24 修正）。改这里务必保持 .class 写法。 */
.ns-rotate-icon {
  width: 14px; height: 24px; border: 2px solid #b15bd8; border-radius: var(--mg-r-xs);
  flex: none;
  animation: ns-rotate-hint 1.6s ease-in-out infinite;
}
.ns-rotate-text { font-size: 13px; font-weight: 600; line-height: 1.4; }
/* 隐藏态兜底：就算别处误把 display 改回来，也不允许它挡住下方 UI（要求③） */
#ns-rotate[style*="display: none"], #ns-rotate[hidden] { pointer-events: none !important; }
/* 「转过去并停住」比原对称摆动更直观：0~20% 竖着等，20~60% 转过去，60~100% 停在横屏 */
@keyframes ns-rotate-hint {
  0%, 20% { transform: rotate(0); }
  60%, 100% { transform: rotate(90deg); }
}

/* ---------- 任务块 H-2：通知中心 ----------
 * 三级提示：bad=紧急（同屏限 1）/ warn=重要 / info=普通。
 * +N 折叠按钮必须单独开 pointer-events（父容器 .toasts 继承 none）。 */
.toast.warn { border-left-color: var(--warning); }
.toast-more {
  pointer-events: auto;
  align-self: flex-start;
  padding: 3px 9px;
  font: inherit;
  font-size: 10.5px;
  color: var(--text);
  opacity: .82;
  background: var(--glass-bg-strong, rgba(20, 24, 33, .82));
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  cursor: pointer;
  touch-action: manipulation;
}
.toast-more:hover { opacity: 1; border-color: var(--info); }
.set-enum { display: flex; gap: 6px; margin: 6px 0 2px; flex-wrap: wrap; }
.set-enum .mini-btn.on { border-color: var(--info); box-shadow: inset 0 0 0 1px var(--info); }

/* 窄于 900px：左下窄列改底部单行横向滚动，彻底离开中心 50% 视区。 */
@media (max-width: 900px) {
  .toasts {
    top: auto;
    bottom: calc(46px + env(safe-area-inset-bottom));
    left: calc(6px + env(safe-area-inset-left));
    right: calc(6px + env(safe-area-inset-right));
    max-width: none;
    flex-direction: row;
    align-items: center;
    gap: 5px;
    overflow-x: auto;
    overflow-y: hidden;
    white-space: nowrap;
    scrollbar-width: none;
  }
  .toasts::-webkit-scrollbar { display: none; }
  .toast, .toast-more { flex: 0 0 auto; max-width: 68vw; }
}
