/* ============================================================
   旧电脑（Win98 复古桌面网站）— 自定义样式
   （98.css 负责组件外观，这里负责桌面布局、任务栏、开始菜单、响应式）
   ============================================================ */

:root {
  --taskbar-h: 40px;          /* 任务栏高度 */
  --desktop-teal: #008080;    /* 经典 Win98 青色桌面 */
  --navy: #000080;            /* 经典选中蓝 */
}

* {
  -webkit-tap-highlight-color: transparent;
}

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  overflow: hidden;
  overscroll-behavior: none;
  /* iOS 10+ 忽略 user-scalable=no：双击空白处会缩放整页、布局错位、点击偏移。
     manipulation 禁掉双击缩放（浏览器取触摸目标祖先链上 touch-action 的交集，故在 body 设全站生效） */
  touch-action: manipulation;
}

/* 中文字体回退：98.css 的像素字体没有中文字形，补全回退链 */
body, button, input, textarea, select, option, label, .title-bar-text, .window-body {
  font-family: "Pixelated MS Sans Serif", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", Arial, sans-serif;
}

img {
  image-rendering: pixelated;
  image-rendering: crisp-edges;
}

/* ---------------- 桌面 ---------------- */

#desktop {
  position: fixed;
  /* 底部让出任务栏（含 iPhone 底部横条安全区，viewport-fit=cover 后 env 生效） */
  inset: 0 0 calc(var(--taskbar-h) + env(safe-area-inset-bottom, 0px)) 0;
  background: var(--desktop-teal);
  display: flex;
  flex-direction: column;      /* 经典布局：从左上角逐列向下排 */
  flex-wrap: wrap;
  align-content: flex-start;
  gap: 6px;
  padding: 10px;
  padding-top: calc(10px + env(safe-area-inset-top, 0px));   /* 避开刘海/状态栏 */
  padding-left: calc(10px + env(safe-area-inset-left, 0px)); /* 横屏避开左侧刘海 */
  box-sizing: border-box;
  user-select: none;
  -webkit-user-select: none;
  touch-action: manipulation;
}

.desktop-icon {
  width: 80px;
  padding: 6px 2px 4px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  cursor: pointer;
  border: 1px dotted transparent;
  box-sizing: border-box;
}

.desktop-icon:focus-visible {
  outline: none;
  border-color: #fff;
}

.desktop-icon img {
  width: 32px;
  height: 32px;
  pointer-events: none;
}

.desktop-icon .icon-label {
  color: #fff;
  font-size: 11px;
  line-height: 1.25;
  text-align: center;
  text-shadow: 1px 1px 0 #000;
  word-break: break-all;
  pointer-events: none;
  padding: 0 2px;
}

/* 选中态：蓝底白字 + 虚线框 */
.desktop-icon.selected .icon-label {
  background: var(--navy);
  outline: 1px dotted #fff;
}

/* ---------------- 窗口层 ---------------- */

#windows {
  position: fixed;
  /* 顶/左/右都让出 iPhone 不安全区：窗口最大化时标题栏按钮若陷进刘海/状态栏区域，
     iOS 会把那里的触摸拦截给系统，最小化/最大化/关闭全部「点不动」（真机专属，无头测不出） */
  inset: env(safe-area-inset-top, 0px) env(safe-area-inset-right, 0px) calc(var(--taskbar-h) + env(safe-area-inset-bottom, 0px)) env(safe-area-inset-left, 0px);
  pointer-events: none;   /* 空白处不挡桌面点击，窗口本身恢复可点 */
  z-index: 10;
}

.app-window {
  position: absolute;
  pointer-events: auto;
  display: flex;
  flex-direction: column;
  min-width: 200px;
  min-height: 120px;
  box-sizing: border-box;   /* 让 style.width 与 offsetWidth 一致，最大化还原时不漂移 */
}

.app-window .window-body {
  flex: 1;
  min-height: 0;
  overflow: auto;
  box-sizing: border-box;
}

.app-window.maximized {
  top: 0 !important;
  left: 0 !important;
  width: 100% !important;
  height: 100% !important;
}

/* 右下角缩放拖柄：经典斜纹小三角（clip-path 裁出三角，条纹只落在里面） */
.window-resize-grip {
  position: absolute;
  right: 2px;
  bottom: 2px;
  width: 16px;
  height: 16px;
  cursor: nwse-resize;
  touch-action: none;   /* 触屏拖动时阻止页面滚动 */
  clip-path: polygon(100% 0, 100% 100%, 0 100%);
  background: repeating-linear-gradient(135deg,
    #808080 0, #808080 1px,
    #fff 1px, #fff 2px,
    transparent 2px, transparent 4px);
}

/* 最大化时没有缩放可言，藏掉拖柄 */
.app-window.maximized .window-resize-grip {
  display: none;
}

/* 拖拽时禁用文本选择 */
body.dragging {
  user-select: none;
  -webkit-user-select: none;
  cursor: move;
}

/* 标题栏可拖拽（触屏拖拽时阻止页面滚动） */
.app-window .title-bar {
  touch-action: none;
}

/* 标题栏里的小图标 */
.title-bar-text img {
  width: 16px;
  height: 16px;
  vertical-align: -3px;
  margin-right: 4px;
}

/* 触屏加大标题栏按钮热区（98.css 原尺寸约 20×18，手指容易点空） */
@media (pointer: coarse) {
  .app-window .title-bar-controls button {
    min-width: 32px;
    min-height: 28px;
  }
}

/* ---------------- 任务栏 ---------------- */

#taskbar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  /* 高度 + 底部 padding 都计入 iPhone 底部横条安全区，开始按钮不被 home 指示条压住 */
  height: calc(var(--taskbar-h) + env(safe-area-inset-bottom, 0px));
  background: #c0c0c0;
  border-top: 2px solid #fff;
  display: flex;
  align-items: stretch;
  gap: 4px;
  padding: 3px 4px;
  padding-bottom: calc(3px + env(safe-area-inset-bottom, 0px));
  box-sizing: border-box;
  z-index: 1000;
  user-select: none;
  -webkit-user-select: none;
}

#start-button {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 0 8px;
  flex-shrink: 0;
}

#start-button.active {
  /* 按下状态复用 98.css 的 :active 凹陷效果 */
  box-shadow: inset -1px -1px #fff, inset 1px 1px #0a0a0a, inset -2px -2px #dfdfdf, inset 2px 2px #808080;
}

#task-buttons {
  display: flex;
  gap: 4px;
  flex: 1;
  min-width: 0;
  overflow-x: auto;
  scrollbar-width: none;
}

#task-buttons::-webkit-scrollbar {
  display: none;
}

.task-button {
  display: flex;
  align-items: center;
  gap: 4px;
  min-width: 110px;
  max-width: 160px;
  padding: 0 6px;
  flex-shrink: 0;
  overflow: hidden;
}

.task-button img {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}

.task-button span {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-size: 11px;
}

.task-button.active {
  box-shadow: inset -1px -1px #fff, inset 1px 1px #0a0a0a, inset -2px -2px #dfdfdf, inset 2px 2px #808080;
  background: repeating-conic-gradient(#fff 0% 25%, #c0c0c0 0% 50%) 0 / 2px 2px;
  font-weight: bold;
}

#taskbar-tray {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 10px;
  box-shadow: inset -1px -1px #fff, inset 1px 1px #808080;
  margin: 1px;
}

/* 备案号：任务栏托盘小字，贴近 98 系统默认观感 */
#beian-link,
#beian-gongan-link {
  font-size: 11px;
  color: #222;
  text-decoration: none;
  white-space: nowrap;
}

#beian-link:hover,
#beian-gongan-link:hover {
  text-decoration: underline;
}

/* 公安备案国徽小图标与文字对齐 */
#beian-gongan-link {
  display: inline-flex;
  align-items: center;
  gap: 3px;
}

#clock {
  font-size: 11px;
}

/* ---------------- 开始菜单 ---------------- */

#start-menu {
  position: fixed;
  left: 2px;
  bottom: calc(var(--taskbar-h) + env(safe-area-inset-bottom, 0px));
  z-index: 1100;
  display: flex;
  padding: 3px;
  min-width: 190px;
}

/* hidden 属性优先级必须高于上面的 display 设置，否则菜单/遮罩会一直显示 */
#start-menu[hidden],
#shutdown-overlay[hidden] {
  display: none;
}

.start-menu-banner {
  width: 26px;
  background: linear-gradient(to bottom, #1084d0 0%, #000080 100%);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: 6px 0;
  flex-shrink: 0;
}

.start-menu-banner span {
  writing-mode: vertical-rl;
  transform: rotate(180deg);
  color: #c0c0c0;
  font-size: 16px;
  letter-spacing: 1px;
}

.start-menu-banner strong {
  color: #fff;
}

#start-menu-items {
  list-style: none;
  margin: 0;
  padding: 0;
  flex: 1;
}

#start-menu-items li {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 18px 6px 8px;
  font-size: 12px;
  cursor: pointer;
  user-select: none;
  -webkit-user-select: none;
}

#start-menu-items li img {
  width: 24px;
  height: 24px;
  flex-shrink: 0;
}

#start-menu-items li:hover,
#start-menu-items li:focus-visible {
  background: var(--navy);
  color: #fff;
  outline: none;
}

#start-menu-items li.menu-separator {
  padding: 0;
  margin: 3px 2px;
  height: 0;
  border-top: 1px solid #808080;
  border-bottom: 1px solid #fff;
  cursor: default;
}

#start-menu-items li.menu-separator:hover {
  background: none;
}

/* ---------------- 关机彩蛋 ---------------- */

#shutdown-overlay {
  position: fixed;
  inset: 0;
  background: #000;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 24px;
  cursor: pointer;
}

#shutdown-overlay p {
  color: #ffa500;
  font-size: 22px;
  font-weight: bold;
  margin: 0;
  text-align: center;
  padding: 0 16px;
}

#shutdown-overlay .shutdown-hint {
  color: #666;
  font-size: 12px;
  font-weight: normal;
}

/* ---------------- 应用通用小样式 ---------------- */

.app-about p { margin: 0 0 10px; }
.app-about ul { margin: 4px 0; padding-left: 20px; }

/* 欢迎窗头部：星空跃迁 Canvas + 乱序解码标题（现代的芯，原生 Canvas 实现、零依赖） */
.app-about-banner {
  position: relative;
  height: 122px;
  margin: 0 0 10px;
  overflow: hidden;
  background: #020412;
  border: 2px inset #dfdfdf;
  box-sizing: border-box;
}
.app-about-stars { display: block; }
.app-about-banner-text {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}
.app-about-glitch {
  font-size: 26px;
  font-weight: bold;
  letter-spacing: 10px;
  color: #aee6ff;
  text-shadow: 0 0 8px rgba(110, 210, 255, 0.9), 0 0 28px rgba(110, 210, 255, 0.45);
}
.app-about-sub {
  margin-top: 8px;
  font-size: 10px;
  letter-spacing: 4px;
  color: #6f8fc7;
}

/* ---------------- 扫雷 ---------------- */

.app-mine {
  --mine-cell: 24px;         /* 格子边长；改动后窗口尺寸由 js 实测自动适配，无需同步其他代码 */
  display: flex;
  flex-direction: column;
  gap: 6px;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;   /* iOS 长按格子不弹系统菜单 */
}

/* 面板水平居中用 margin:auto 而非 align-items:center：
   后者在棋盘比窗口窄屏更宽时产生「负向溢出」，左侧内容永远滚不到（手机端 bug）；
   auto 边距在空间不足时解析为 0，内容左对齐、右侧溢出可完整滚动 */
.mine-panel {
  margin-inline: auto;
}

.mine-toolbar {
  display: flex;
  gap: 4px;
  width: 100%;
}

.mine-toolbar button {
  min-width: 52px;
}

/* 当前难度最佳时间（经典「扫雷英雄榜」的精简版） */
.mine-best {
  margin-left: auto;
  align-self: center;
  white-space: nowrap;
}

/* 当前难度的按钮保持按下态（同任务栏 active 样式） */
.mine-toolbar button.active {
  box-shadow: inset -1px -1px #fff, inset 1px 1px #0a0a0a, inset -2px -2px #dfdfdf, inset 2px 2px #808080;
  font-weight: bold;
}

/* 面板 = 凸起边框把计数器头和雷区包成一体（经典扫雷窗口的观感） */
.mine-panel {
  padding: 6px;
  background: silver;
  box-shadow: inset -1px -1px #0a0a0a, inset 1px 1px #fff, inset -2px -2px #808080, inset 2px 2px #dfdfdf;
}

/* 凹框默认白底（98.css .sunken-panel），经典扫雷的计数器头和雷区都是银灰底 */
.mine-header,
.mine-board {
  background: silver;
}

.mine-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 4px 6px;
  margin-bottom: 6px;
}

/* 红字黑底 LED 计数器 */
.mine-lcd {
  background: #000;
  color: #f00;
  font-family: monospace;
  font-weight: bold;
  font-size: 18px;
  line-height: 1;
  padding: 2px 3px;
  letter-spacing: 1px;
}

.mine-face,
.mine-face:active {
  min-width: 0;
  width: 32px;
  height: 32px;
  padding: 0;
  font-size: 17px;
  line-height: 1;
  color: #222;
  text-shadow: none;         /* 重置 98.css 的文字阴影 hack，否则笑脸只剩一团黑影 */
}

/* 格子与笑脸里的像素图标（引擎 CORE.px 内联 SVG；fill 已逐 path 写死——
   98.css 按钮文字是 color:transparent + text-shadow 画的，currentColor 会全透明，
   此处只管尺寸与对齐；.px-core 专供引擎/经典模式，与地下城 .px-icon 规则互不干扰） */
.app-mine .mine-cell svg.px-core {
  width: 18px;
  height: 18px;
}

/* 笑脸钮改 flex 居中放像素脸（原 emoji 靠 line-height 居中） */
.app-mine .mine-face {
  display: flex;
  align-items: center;
  justify-content: center;
}

.app-mine .mine-face svg.px-core {
  width: 24px;
  height: 24px;
}

.mine-board {
  display: grid;
  gap: 0;
  padding: 4px;
  touch-action: manipulation;
  /* iOS 长按弹放大镜/选中菜单会抢手势，长按插旗就靠这个保住 */
  -webkit-touch-callout: none;
  user-select: none;
  -webkit-user-select: none;
}

/* 格子：覆盖 98.css 按钮的 min-width/padding/text-shadow  hack */
.mine-cell,
.mine-cell:active {
  min-width: 0;
  min-height: 0;
  width: var(--mine-cell);
  height: var(--mine-cell);
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: bold;
  line-height: 1;
  color: #222;
  text-shadow: none;         /* 98.css 用 text-shadow 画按钮文字，数字配色必须关掉它 */
  cursor: pointer;
}

.mine-cell:focus {
  outline: none;
}

/* 已翻开的格子：拍平 + 细灰边框连成网格（:active 也要压住 98.css 的按下态） */
.mine-cell.revealed,
.mine-cell.revealed:active {
  box-shadow: none;
  border: 1px solid #808080;
  cursor: default;
}

/* 踩中的那颗雷：红底 */
.mine-cell.mine-hit,
.mine-cell.mine-hit:active {
  background: #f00;
}

/* 经典数字配色 1~8 */
.mine-cell.n1 { color: #0000ff; }
.mine-cell.n2 { color: #008000; }
.mine-cell.n3 { color: #ff0000; }
.mine-cell.n4 { color: #000080; }
.mine-cell.n5 { color: #800000; }
.mine-cell.n6 { color: #008080; }
.mine-cell.n7 { color: #000000; }
.mine-cell.n8 { color: #808080; }

/* ---------------- 扫雷：模式容器（Tab 行 / 挂载点）与自定义难度对话框 ---------------- */

/* 模式挂载点与 .app-mine 同布局（flex 列 + 6px 缝）：
   .mine-panel 的 margin-inline:auto 收缩贴合只在 flex 容器里成立（块级容器里 auto 边距解析为 0、
   面板被撑满），fitWindowToContent 的实测宽度依赖这一收缩 */
.mine-mode-body {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

/* 模式切换 Tab：按压式按钮，激活态凹陷加粗（同 .mine-toolbar button.active） */
.mine-tabs {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;      /* 手机窄屏允许换行 */
  width: 100%;
}

.mine-tabs button {
  min-width: 64px;
}

.mine-tabs button.active {
  box-shadow: inset -1px -1px #fff, inset 1px 1px #0a0a0a, inset -2px -2px #dfdfdf, inset 2px 2px #808080;
  font-weight: bold;
}

/* 难度加到四档后工具栏可能超宽，允许换行（手机 390px 不溢出） */
.mine-toolbar {
  flex-wrap: wrap;
}

/* 自定义对话框覆盖层的定位锚点：relative 无偏移，对其他模块零影响
   （about 横幅锚在 .app-about-banner、poker 锚在 .app-poker，均不受影响） */
.app-window .window-body {
  position: relative;
}

/* 覆盖窗口内容区的模态层；覆盖期间棋盘输入由 core 的 canInteract 钩子拦截 */
.mine-dialog-overlay {
  position: absolute;
  inset: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(192, 192, 192, 0.6);
  touch-action: none;   /* 模态期间禁掉底层滚动：锚在 window-body 的覆盖层会被滚动卷走 */
}

.mine-dialog {
  width: 240px;
  max-width: calc(100% - 16px);
}

/* 输入框等宽，范围提示不换行 */
.mine-dialog input[type="number"] {
  width: 56px;
}

.mine-dialog-hint {
  white-space: nowrap;
  color: #444;
}

/* 确认对话框（误触保护）的提示语 */
.mine-dialog-text {
  margin-bottom: 8px;
}

/* 按钮行右对齐（98.css 的 field-row 本身是 flex） */
.mine-dialog-buttons {
  justify-content: flex-end;
}

@media (max-width: 640px) {
  /* Tab 按钮与难度按钮（见下方手机端区块 .mine-toolbar button）同样加高，方便手指点按 */
  .mine-tabs button {
    min-height: 32px;
  }
}

/* ---------------- 扫雷·寻找时间胶囊（mine-dungeon）专属样式 ----------------
 * 选择器全部挂在 .app-mine-dg 下，不与现有规则冲突。
 * 复用：.mine-panel/.mine-header/.mine-lcd/.mine-face/.mine-board/.mine-cell
 *       均为顶层类，此处不重复定义；--mine-cell 在本作用域覆盖为 30px
 *       （比经典 24px 大，最大楼层 12 列 × 30px ≈ 380px，手机 390px 刚好放下）。 */

/* 根容器（覆盖层/toast 的定位锚） */
.app-mine-dg {
  --mine-cell: 30px;
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 6px;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;   /* iOS 长按格子不弹系统菜单 */
}

/* HUD（第一排）：层数徽章/心心/增益/最深纪录 */
.app-mine-dg .mine-dg-hud {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;               /* 手机端 390px 允许换行、不溢出 */
  width: 100%;
}

/* 层数徽章「B1」：小号凸起铭牌 */
.app-mine-dg .mine-dg-floor {
  font-weight: bold;
  padding: 1px 6px;
  background: silver;
  box-shadow: inset -1px -1px #0a0a0a, inset 1px 1px #fff, inset -2px -2px #808080, inset 2px 2px #dfdfdf;
  white-space: nowrap;
}

.app-mine-dg .mine-dg-hearts {
  font-size: 14px;
  line-height: 1;
  letter-spacing: 1px;
  white-space: nowrap;
}

.app-mine-dg .mine-dg-perks {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  font-size: 14px;
  line-height: 1;
}

.app-mine-dg .mine-dg-perk {
  cursor: help;                  /* title 里有名称+描述 */
  white-space: nowrap;
}

/* 护甲本层已消耗：置灰提示 */
.app-mine-dg .mine-dg-perk.off {
  opacity: 0.35;
}

/* 最深纪录（同经典扫雷 .mine-best 的右对齐位） */
.app-mine-dg .mine-dg-deepest {
  margin-left: auto;
  align-self: center;
  white-space: nowrap;
}

/* HUD 金币 / 记忆碎片 */
.app-mine-dg .mine-dg-gold,
.app-mine-dg .mine-dg-frags {
  white-space: nowrap;
}

/* 装备栏（棋盘下方的展示/操作位）：技能按钮 + 消耗品 + 已拥有装备图标。
   margin-inline:auto 收缩贴合居中，与 .mine-panel 同一套思路（见经典模式注释） */
.app-mine-dg .mine-dg-belt {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;               /* 手机窄屏允许换行 */
  margin-inline: auto;
  padding: 4px 6px;
  background: silver;
  box-shadow: inset -1px -1px #0a0a0a, inset 1px 1px #fff, inset -2px -2px #808080, inset 2px 2px #dfdfdf;
}

.app-mine-dg .mine-dg-skill {
  min-width: 0;
  white-space: nowrap;
}

.app-mine-dg .mine-dg-items {
  display: flex;
  gap: 4px;
}

/* 消耗品按钮：图标×数量，显示即所得（数量 = 可用次数），0 或没布雷时 disabled 置灰 */
.app-mine-dg .mine-dg-item {
  min-width: 0;
  padding: 1px 5px;
  white-space: nowrap;
}

/* 装备图标靠右，纯展示（title 悬浮描述）；护甲本层已消耗时置灰（复用 .mine-dg-perk.off） */
.app-mine-dg .mine-dg-gear {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-left: auto;
  font-size: 14px;
  line-height: 1;
}

/* 像素图标（pixelarticons 内联 SVG，fill=currentColor 继承文字色）：
   装备栏/技能按钮里随文字大小，选择卡片里放大对齐原 emoji 观感。
   注意：98.css 按钮文字是 color:transparent + text-shadow 画出来的，currentColor 是透明——
   按钮内的 svg 必须显式给 fill（disabled 时同步置灰） */
.app-mine-dg svg.px-icon {
  width: 17px;
  height: 17px;
  vertical-align: -3px;
  flex: none;
}
.app-mine-dg button svg.px-icon { fill: #222; }
.app-mine-dg button:disabled svg.px-icon { fill: grey; }
.app-mine-dg .mine-dg-card-icon svg.px-icon {
  width: 24px;
  height: 24px;
  vertical-align: 0;
}

/* 语义色图标：按钮内 currentColor 是透明（见上方注释），这些一律显式给死颜色。
   类名由 mine-dungeon.js 的 px(name, cls) 第二参数产出 */
.app-mine-dg .px-icon.px-hp { fill: #d03030; }        /* 满心 */
.app-mine-dg .px-icon.px-hp-empty { fill: #8a8a8a; }  /* 空心（已损失生命） */
.app-mine-dg .px-icon.px-gold { fill: #8a6d00; }      /* 金币（HUD/商店） */
.app-mine-dg .px-icon.px-frag { fill: #6b2d8b; }      /* 记忆碎片（HUD/结局） */
.app-mine-dg .px-icon.px-boom { fill: #d03030; }      /* 已爆星 */
.app-mine-dg .px-icon.px-hole { fill: #111; }         /* 出口洞 */
.app-mine-dg .px-icon.px-radar { fill: #0a50c0; }     /* 雷达标记 */

/* HUD 心心略小一号，与 14px 文字行高对齐 */
.app-mine-dg .mine-dg-hearts svg.px-icon {
  width: 15px;
  height: 15px;
  vertical-align: -2px;
}

/* 格子（30px）/脸按钮里的图标尺寸 */
.app-mine-dg .mine-cell svg.px-icon {
  width: 19px;
  height: 19px;
  vertical-align: -3px;
}
.app-mine-dg .mine-face svg.px-icon {
  width: 20px;
  height: 20px;
  vertical-align: -3px;
}

/* toast 的定位锚：压在棋盘面板下缘，不再盖住棋盘下方的装备栏 */
.app-mine-dg .mine-panel {
  position: relative;
}

/* 棋盘装饰（配合 decorateCell 钩子） */

/* 已显形的出口：呼吸闪 + 手型，提示「点我下楼」 */
.app-mine-dg .mine-cell.mine-dg-exit,
.app-mine-dg .mine-cell.mine-dg-exit:active {
  cursor: pointer;
  animation: mine-dg-exit-blink 1.2s ease-in-out infinite;
}

@keyframes mine-dg-exit-blink {
  0%, 100% { background: silver; }
  50% { background: #e0ffe0; }
}

/* 覆盖层（抽卡 / 本局结束） */
.app-mine-dg .mine-dg-overlay {
  position: absolute;
  inset: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 10px;
  overflow: auto;                /* 卡片换行后超高时可滚，不顶破小窗口 */
  background: rgba(192, 192, 192, 0.88);   /* 半透明银灰：压住棋盘又不全遮死 */
}

/* 对话框：经典凸起面板 */
.app-mine-dg .mine-dg-dialog {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  max-width: 100%;
  padding: 12px;
  background: silver;
  box-shadow: inset -1px -1px #0a0a0a, inset 1px 1px #fff, inset -2px -2px #808080, inset 2px 2px #dfdfdf;
}

.app-mine-dg .mine-dg-title {
  font-weight: bold;
  text-align: center;
}

/* 职业选择 / 结局的宽对话框（卡片缝收窄一档，三张职业卡在小窗口里尽量不滚） */
.app-mine-dg .mine-dg-wide {
  max-width: min(340px, 100%);
  gap: 8px;
}

.app-mine-dg .mine-dg-wide .mine-dg-cards {
  gap: 6px;
}

/* 故事引入 / 坏结局补言 */
.app-mine-dg .mine-dg-story {
  font-size: 12px;
  line-height: 1.6;
  text-align: left;
}

/* 「时间胶囊已解封」徽章 */
.app-mine-dg .mine-dg-badge {
  font-size: 12px;
}

/* 结局信纸：白底等宽字体模拟记事本；限高可滚，不顶破小窗口 */
.app-mine-dg .mine-dg-letter {
  background: #fff;
  color: #111;
  font-family: monospace;
  font-size: 12px;
  line-height: 1.7;
  text-align: left;
  white-space: pre-wrap;
  padding: 8px 12px;
  max-width: 320px;
  max-height: 40vh;
  overflow: auto;
  box-shadow: inset 1px 1px #808080, inset -1px -1px #fff, inset 2px 2px #0a0a0a, inset -2px -2px #dfdfdf;
}

/* 信纸顶部的「时间胶囊.txt」文件名行 */
.app-mine-dg .mine-dg-notepad {
  display: block;
  margin: -2px 0 6px;
  padding-bottom: 2px;
  font-size: 11px;
  color: #444;
  border-bottom: 1px solid #808080;
}

.app-mine-dg .mine-dg-stats {
  text-align: center;
}

/* 三选一抽卡：纵排行式卡（icon 左 + 名称/描述右）。
   不用横排三栏——B1 小棋盘窗口仅 ~260px 宽，横排必裁切；纵排任何楼层尺寸都放得下 */
.app-mine-dg .mine-dg-cards {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 8px;
  width: 100%;
  max-width: 250px;
}

.app-mine-dg .mine-dg-card,
.app-mine-dg .mine-dg-card:active {
  display: grid;
  grid-template-columns: auto 1fr;
  column-gap: 8px;
  align-items: center;
  text-align: left;
  padding: 6px 10px;
  color: #222;                   /* 98.css 按钮 color:transparent + text-shadow 画字 */
  text-shadow: none;             /* emoji/描述要原色，两个 hack 都得关 */
  white-space: normal;
}

.app-mine-dg .mine-dg-card-icon {
  grid-row: span 2;              /* icon 纵向居中跨名称/描述两行 */
  font-size: 22px;
  line-height: 1;
}

.app-mine-dg .mine-dg-card-name {
  font-weight: bold;
}

.app-mine-dg .mine-dg-card-desc {
  font-size: 11px;
  line-height: 1.4;
}

/* toast（底部居中淡出小条） */
.app-mine-dg .mine-dg-toast {
  position: absolute;
  left: 50%;
  bottom: 8px;
  transform: translateX(-50%);
  z-index: 11;
  max-width: 90%;
  padding: 2px 8px;
  background: #ffffe1;           /* 经典 tooltip 黄 */
  border: 1px solid #000;
  font-size: 12px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  opacity: 0;
  pointer-events: none;          /* 纯提示，不挡棋盘点击 */
  transition: opacity 0.25s;
}

.app-mine-dg .mine-dg-toast.show {
  opacity: 1;
}

/* 手机端适配（≤640px）：HUD 换行由 .mine-dg-hud 的 flex-wrap 处理，抽卡默认纵排无需覆写 */

/* ---------------- 手机端适配（≤640px） ---------------- */

@media (max-width: 640px) {
  :root {
    --taskbar-h: 44px;
  }

  #desktop {
    flex-direction: row;      /* 手机上横向排列、自动换行更自然 */
    flex-wrap: wrap;
    align-content: flex-start;
    gap: 4px;
    padding: 8px;
  }

  .desktop-icon {
    width: 72px;
    padding: 8px 2px 6px;     /* 加大触控热区 */
  }

  .desktop-icon .icon-label {
    font-size: 12px;
  }

  .task-button {
    min-width: 44px;
    max-width: 44px;
    padding: 0;
    justify-content: center;  /* 手机上任务按钮只显示图标 */
  }

  .task-button span {
    display: none;
  }

  #start-menu-items li {
    padding: 12px 24px 12px 10px;  /* 菜单项加高，方便手指点按 */
    font-size: 13px;
  }

  #start-menu-items li.menu-separator {
    padding: 0;
  }

  .app-window .title-bar {
    min-height: 24px;
  }

  .title-bar-controls button {
    min-width: 32px;
    min-height: 28px;
  }

  /* 扫雷工具栏按钮加高，方便手指点按 */
  .mine-toolbar button {
    min-height: 32px;
  }

  /* 地下城装备栏按钮（技能/消耗品）同样加高 */
  .app-mine-dg .mine-dg-skill,
  .app-mine-dg .mine-dg-item {
    min-height: 32px;
  }
}

/* ============================================================
 * 德州扑克模块（js/apps/poker.js）—— 深色赌场风游戏界面
 * 全部样式以 .app-poker 为作用域（移植自独立版 德州扑克.html）：
 * 原 :root 变量收敛进 .app-poker；弹窗/彩带改为容器内 absolute 定位。
 * ============================================================ */
/* ============================================================
   设计系统 — 深色赌场风
   ============================================================ */
.app-poker{
  --card-w: 62px;
  --card-h: 88px;
  --gold: #e9c46a;
  --gold-deep: #c9a227;
  --felt-1: #20714a;
  --felt-2: #0c4a2c;
  --felt-3: #083a22;
  --bg-1: #07120c;
  --bg-2: #0b1f14;
  --panel: rgba(8, 20, 14, 0.82);
  --line: rgba(233, 196, 106, 0.22);
  --txt: #e8f0ea;
  --txt-dim: #9db8a7;
  --danger: #d64545;
  --info: #3f8ef7;
  --success: #2fae64;
  --warn: #e8873a;
  --radius: 14px;
  --safe-b: env(safe-area-inset-bottom, 0px);
}
.app-poker *{ box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }
.app-poker{
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", "Segoe UI", sans-serif;
  background:
    radial-gradient(1200px 600px at 50% -10%, rgba(32,113,74,0.35), transparent 60%),
    radial-gradient(900px 500px at 50% 115%, rgba(32,113,74,0.22), transparent 60%),
    linear-gradient(160deg, var(--bg-1), var(--bg-2) 55%, #060d09);
  color: var(--txt);
  height: 100%;
  display: flex; flex-direction: column;
  user-select: none; -webkit-user-select: none;
  overflow-x: hidden;
}

/* ============ 顶栏 ============ */
.app-poker .topbar{
  display: flex; align-items: center; justify-content: space-between;
  padding: 8px 14px; gap: 8px;
  background: linear-gradient(180deg, rgba(0,0,0,0.45), rgba(0,0,0,0.15));
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(8px);
  z-index: 50;
}
.app-poker .brand{ font-size: 16px; font-weight: 800; letter-spacing: 1px; display: flex; align-items: center; gap: 8px; white-space: nowrap; }
.app-poker .brand .suits{ color: var(--gold); }
.app-poker .brand small{ font-size: 10px; color: var(--txt-dim); font-weight: 500; letter-spacing: 0.5px; }
.app-poker .top-actions{ display: flex; gap: 6px; }
.app-poker .icon-btn{
  width: 36px; height: 36px; border-radius: 10px;
  background: rgba(255,255,255,0.06); border: 1px solid rgba(255,255,255,0.12);
  color: var(--txt); font-size: 16px; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: all .15s;
}
.app-poker .icon-btn:hover{ background: rgba(233,196,106,0.15); border-color: var(--line); }
.app-poker .icon-btn.off{ opacity: 0.45; }
.app-poker .icon-btn.on{ background: rgba(233,196,106,0.2); border-color: var(--gold); color: var(--gold); }

/* ============ 主区域 ============ */
.app-poker .main{
  flex: 1; display: flex; flex-direction: column; align-items: center;
  padding: 10px 12px 6px; gap: 8px; min-height: 0;
}

/* ============ 牌桌 ============ */
.app-poker .table{
  position: relative; width: 100%; max-width: 860px;
  flex: 1; min-height: 380px;
  border-radius: 220px / 46%;
  background:
    radial-gradient(ellipse at 50% 42%, var(--felt-1) 0%, var(--felt-2) 62%, var(--felt-3) 100%);
  border: 10px solid #2c1a10;
  outline: 2px solid rgba(233,196,106,0.35);
  outline-offset: -6px;
  box-shadow:
    0 24px 60px rgba(0,0,0,0.6),
    inset 0 0 90px rgba(0,0,0,0.45),
    inset 0 2px 0 rgba(255,255,255,0.06);
  display: flex; flex-direction: column; justify-content: space-between;
  padding: 18px 26px;
  overflow: hidden;
}
.app-poker .table::before{ /* 呢绒噪点 */
  content: ""; position: absolute; inset: 0; pointer-events: none; opacity: 0.5;
  background-image: radial-gradient(rgba(255,255,255,0.035) 1px, transparent 1px);
  background-size: 5px 5px;
}
.app-poker .table::after{ /* 中央装饰 */
  content: "♠ ♥ ♦ ♣";
  position: absolute; top: 50%; left: 50%; transform: translate(-50%,-50%);
  font-size: 15px; letter-spacing: 12px; color: rgba(255,255,255,0.05);
  pointer-events: none; white-space: nowrap;
}

/* ============ 座位 ============ */
.app-poker .seat{
  position: relative; display: flex; align-items: center; justify-content: center;
  gap: 14px; z-index: 2; transition: filter .25s;
}
.app-poker .seat.me{ flex-direction: row; }
.app-poker .seat .who{
  display: flex; flex-direction: column; align-items: center; gap: 3px;
  min-width: 86px; padding: 8px 10px; border-radius: 12px;
  background: rgba(0,0,0,0.35); border: 1px solid rgba(255,255,255,0.08);
  transition: box-shadow .3s, border-color .3s;
}
.app-poker .seat .avatar{ font-size: 26px; line-height: 1; filter: drop-shadow(0 2px 4px rgba(0,0,0,0.5)); }
.app-poker .seat .name{ font-size: 12px; font-weight: 700; color: var(--txt); display:flex; align-items:center; gap:5px; }
.app-poker .seat .stack{ font-size: 13px; font-weight: 800; color: var(--gold); font-variant-numeric: tabular-nums; }
.app-poker .seat .stack.low{ color: #ff8a6a; }
.app-poker .role-tag{
  font-size: 9px; padding: 1px 6px; border-radius: 20px; font-weight: 700;
  background: rgba(255,255,255,0.12); color: var(--txt-dim);
}
.app-poker .role-tag.blind{ background: rgba(63,142,247,0.25); color: #9cc6ff; }

.app-poker .seat.turn .who{
  border-color: var(--gold);
  box-shadow: 0 0 0 2px rgba(233,196,106,0.35), 0 0 24px rgba(233,196,106,0.35);
  animation: turnPulse 1.4s ease-in-out infinite;
}
@keyframes turnPulse{
  0%,100% { box-shadow: 0 0 0 2px rgba(233,196,106,0.35), 0 0 14px rgba(233,196,106,0.25); }
  50% { box-shadow: 0 0 0 2px rgba(233,196,106,0.6), 0 0 30px rgba(233,196,106,0.5); }
}
.app-poker .seat.winner .who{ border-color: #7bed7b; box-shadow: 0 0 26px rgba(123,237,123,0.5); }

/* 庄家按钮 */
.app-poker .dealer-btn{
  position: absolute; width: 26px; height: 26px; border-radius: 50%;
  background: linear-gradient(180deg, #fff, #d9d9d9); color: #1a1a1a;
  font-size: 12px; font-weight: 900; display: none;
  align-items: center; justify-content: center;
  box-shadow: 0 2px 6px rgba(0,0,0,0.5); z-index: 5;
}
.app-poker .seat.ai .dealer-btn{ right: calc(50% - 150px); bottom: -4px; }
.app-poker .seat.me .dealer-btn{ left: calc(50% - 150px); top: -4px; }
.app-poker .dealer-btn.show{ display: flex; }

/* 下注徽章 */
.app-poker .bet-badge{
  position: absolute; display: none; align-items: center; gap: 5px;
  font-size: 13px; font-weight: 800; color: #fff; font-variant-numeric: tabular-nums;
  background: rgba(0,0,0,0.55); border: 1px solid rgba(233,196,106,0.4);
  padding: 4px 12px 4px 6px; border-radius: 20px; z-index: 4;
}
.app-poker .seat.ai .bet-badge{ bottom: -34px; left: 50%; transform: translateX(-50%); }
.app-poker .seat.me .bet-badge{ top: -34px; left: 50%; transform: translateX(-50%); }
.app-poker .bet-badge.show{ display: flex; animation: betPop .3s ease; }
@keyframes betPop{ 0% { transform: translateX(-50%) scale(0.5); opacity: 0; } 100% { transform: translateX(-50%) scale(1); opacity: 1; } }
.app-poker .bet-badge .mini-chip{
  width: 20px; height: 20px; border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, #ffdf8e, var(--gold-deep) 70%);
  border: 2px dashed rgba(0,0,0,0.35); border-color: rgba(90,60,0,0.5);
  box-shadow: 0 1px 3px rgba(0,0,0,0.5);
}

/* 行动气泡 */
.app-poker .toast{
  position: absolute; left: 50%; transform: translateX(-50%) translateY(6px);
  padding: 6px 16px; border-radius: 22px; font-size: 14px; font-weight: 800;
  background: rgba(10,25,18,0.95); border: 1px solid var(--line);
  color: var(--gold); opacity: 0; pointer-events: none; z-index: 8;
  transition: opacity .25s, transform .25s; white-space: nowrap;
  box-shadow: 0 6px 18px rgba(0,0,0,0.5);
}
.app-poker .seat.ai .toast{ top: calc(100% + 2px); }
.app-poker .seat.me .toast{ bottom: calc(100% + 2px); }
.app-poker .toast.show{ opacity: 1; transform: translateX(-50%) translateY(0); }
.app-poker .toast.fold{ color: #ff8a8a; }
.app-poker .toast.raise, .app-poker .toast.allin{ color: #ffd76a; }
.app-poker .toast.allin{ border-color: #ff9d45; animation: allinGlow 0.8s ease infinite alternate; }
@keyframes allinGlow{ from { box-shadow: 0 0 8px rgba(255,157,69,0.4);} to { box-shadow: 0 0 22px rgba(255,157,69,0.9);} }

/* ============ 中央区域 ============ */
.app-poker .center-area{
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  z-index: 2; padding: 6px 0;
}
.app-poker .pot-display{
  display: flex; align-items: center; gap: 8px;
  background: rgba(0,0,0,0.45); border: 1px solid var(--line);
  padding: 5px 18px; border-radius: 24px;
  font-size: 16px; font-weight: 800; color: var(--gold);
  font-variant-numeric: tabular-nums;
}
.app-poker .pot-display .lbl{ font-size: 11px; color: var(--txt-dim); font-weight: 600; }
.app-poker .pot-display.bump{ animation: potBump .35s ease; }
@keyframes potBump{ 40% { transform: scale(1.12); } }

.app-poker .phase-label{ font-size: 12px; color: var(--txt-dim); letter-spacing: 2px; font-weight: 600; }
.app-poker .phase-label b{ color: var(--gold); }

/* ============ 卡牌 ============ */
.app-poker .cards{ display: flex; gap: 8px; justify-content: center; align-items: center; min-height: calc(var(--card-h) + 4px); }
.app-poker .card{
  position: relative; width: var(--card-w); height: var(--card-h);
  background: linear-gradient(160deg, #ffffff 0%, #f2f0ea 100%);
  border-radius: calc(var(--card-w) * 0.11);
  box-shadow: 0 3px 8px rgba(0,0,0,0.45), inset 0 0 0 1px rgba(0,0,0,0.08);
  color: #151a17; flex-shrink: 0;
  transform-style: preserve-3d;
}
.app-poker .card.red{ color: #c62828; }
.app-poker .card .c-top{
  position: absolute; top: 5%; left: 8%;
  display: flex; flex-direction: column; align-items: center; line-height: 1.05;
}
.app-poker .card .c-top b{ font-size: calc(var(--card-w) * 0.30); font-weight: 900; }
.app-poker .card .c-top span{ font-size: calc(var(--card-w) * 0.26); }
.app-poker .card .c-pip{
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  font-size: calc(var(--card-w) * 0.52); opacity: 0.92;
  transform: translateY(8%);
}
.app-poker .card.back{
  background:
    radial-gradient(circle at 50% 50%, rgba(255,255,255,0.14) 0 18%, transparent 19%),
    repeating-linear-gradient(45deg, #1b3f74 0 6px, #16345f 6px 12px);
  border: 3px solid #eef2ff;
  display: flex; align-items: center; justify-content: center;
}
.app-poker .card.back::after{
  content: "♠"; color: rgba(255,255,255,0.85); font-size: calc(var(--card-w) * 0.4);
  text-shadow: 0 2px 4px rgba(0,0,0,0.6);
}
.app-poker .card.slot{
  background: rgba(255,255,255,0.04); border: 1px dashed rgba(255,255,255,0.16);
  box-shadow: none;
}
.app-poker .card.deal{ animation: cardDeal .38s cubic-bezier(.2,.9,.3,1.2) backwards; }
@keyframes cardDeal{
  0% { transform: translateY(-70px) scale(0.3) rotate(-14deg); opacity: 0; }
  100% { transform: none; opacity: 1; }
}
.app-poker .card.flip{ animation: cardFlip .5s ease backwards; }
@keyframes cardFlip{
  0% { transform: rotateY(90deg) scale(0.85); opacity: 0.4; }
  100% { transform: rotateY(0) scale(1); opacity: 1; }
}
.app-poker .card.win-card{ box-shadow: 0 0 18px rgba(233,196,106,0.9), 0 3px 8px rgba(0,0,0,0.4); }

/* ============ 手牌强度条 ============ */
.app-poker .strength-bar{
  display: flex; align-items: center; gap: 10px;
  background: var(--panel); border: 1px solid var(--line);
  border-radius: 12px; padding: 6px 14px; font-size: 13px;
  max-width: 860px; width: 100%; justify-content: center; min-height: 34px;
}
.app-poker .strength-bar .hand-name{ font-weight: 800; color: var(--gold); }
.app-poker .strength-bar .eq-wrap{ display: none; align-items: center; gap: 6px; flex: 1; max-width: 260px; }
.app-poker .strength-bar .eq-wrap.show{ display: flex; }
.app-poker .eq-track{ flex: 1; height: 8px; border-radius: 6px; background: rgba(255,255,255,0.1); overflow: hidden; }
.app-poker .eq-fill{ height: 100%; border-radius: 6px; background: linear-gradient(90deg, #d64545, #e9c46a 55%, #2fae64); transition: width .5s ease; }
.app-poker .eq-num{ font-size: 12px; font-weight: 800; color: var(--txt); min-width: 40px; text-align: right; font-variant-numeric: tabular-nums; }

/* ============ 日志 ============ */
.app-poker .log{
  width: 100%; max-width: 860px; min-height: 64px; max-height: 64px; overflow-y: auto;
  background: rgba(0,0,0,0.35); border: 1px solid rgba(255,255,255,0.07);
  border-radius: 10px; padding: 6px 12px; font-size: 12px; line-height: 1.7;
  color: var(--txt-dim);
}
.app-poker .log .l-win{ color: #7bed7b; font-weight: 700; }
.app-poker .log .l-fold{ color: #ff8a8a; }
.app-poker .log .l-gold{ color: var(--gold); }
.app-poker .log .l-sys{ color: #8fb8ff; }

/* ============ 操作栏 ============ */
.app-poker .action-bar{
  position: sticky; bottom: 0; z-index: 60;
  background: linear-gradient(180deg, rgba(6,14,10,0.9), rgba(4,10,7,0.98));
  border-top: 1px solid var(--line);
  backdrop-filter: blur(10px);
  padding: 10px 14px calc(10px + var(--safe-b));
  display: flex; flex-direction: column; gap: 8px;
}
/* 牌桌零抖动策略：操作栏三态（加注面板/按钮行/思考中）恒定等高，
   牌桌 flex:1 吃到的剩余空间才不随状态切换变化——
   加注面板用 visibility 隐藏但永远占位；快捷注额预留一行高度（未填充时也不塌）；
   按钮行 min-height 对齐最高的「带副行金额」按钮 */
.app-poker .raise-panel{ display: flex; flex-direction: column; gap: 6px; max-width: 860px; width: 100%; margin: 0 auto; visibility: hidden; }
.app-poker .raise-panel.show{ visibility: visible; }
.app-poker .raise-top{ display: flex; align-items: center; gap: 12px; }
.app-poker .raise-amt{
  min-width: 86px; text-align: center; font-size: 18px; font-weight: 900; color: var(--gold);
  font-variant-numeric: tabular-nums;
  background: rgba(0,0,0,0.4); padding: 4px 10px; border-radius: 8px; border: 1px solid var(--line);
}
.app-poker input[type="range"].raise-slider{
  flex: 1; -webkit-appearance: none; appearance: none; height: 8px; border-radius: 6px;
  background: linear-gradient(90deg, var(--gold-deep), var(--gold));
  outline: none; cursor: pointer;
}
.app-poker input[type="range"].raise-slider::-webkit-slider-thumb{
  -webkit-appearance: none; appearance: none; width: 26px; height: 26px; border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, #fff, #d8d8d8);
  border: 3px solid var(--gold-deep); box-shadow: 0 2px 8px rgba(0,0,0,0.5); cursor: pointer;
}
.app-poker input[type="range"].raise-slider::-moz-range-thumb{
  width: 22px; height: 22px; border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, #fff, #d8d8d8);
  border: 3px solid var(--gold-deep); box-shadow: 0 2px 8px rgba(0,0,0,0.5); cursor: pointer;
}
.app-poker .quick-bets{ display: flex; gap: 6px; justify-content: center; min-height: 30px; }
.app-poker .quick-bets button{
  flex: 1; max-width: 130px; padding: 6px 4px; font-size: 12px; font-weight: 700;
  background: rgba(255,255,255,0.07); color: var(--txt); border: 1px solid rgba(255,255,255,0.14);
  border-radius: 8px; cursor: pointer;
  /* 不用 transition:all——会连带过渡 visibility，面板隐藏时按钮残影 150ms（且期间可点） */
  transition: border-color .15s, color .15s, background-color .15s;
}
.app-poker .quick-bets button:hover{ border-color: var(--gold); color: var(--gold); }

.app-poker .btn-row{ display: flex; gap: 8px; justify-content: center; max-width: 860px; width: 100%; margin: 0 auto; min-height: 58px; }
.app-poker .act-btn{
  flex: 1; max-width: 200px; padding: 13px 8px; border: none; border-radius: 12px;
  font-size: 15px; font-weight: 800; cursor: pointer; letter-spacing: 0.5px;
  transition: transform .12s, box-shadow .12s, filter .12s;
  color: #fff; position: relative;
}
.app-poker .act-btn small{ display: block; font-size: 10px; font-weight: 600; opacity: 0.75; margin-top: 1px; }
.app-poker .act-btn:hover{ transform: translateY(-2px); filter: brightness(1.12); }
.app-poker .act-btn:active{ transform: translateY(0) scale(0.97); }
.app-poker .act-btn:disabled{ opacity: 0.35; cursor: not-allowed; transform: none; }
.app-poker .act-btn.fold{ background: linear-gradient(180deg, #c74b4b, #a03333); box-shadow: 0 4px 14px rgba(199,75,75,0.35); }
.app-poker .act-btn.check{ background: linear-gradient(180deg, #3f8ef7, #2a6cd4); box-shadow: 0 4px 14px rgba(63,142,247,0.35); }
.app-poker .act-btn.raise{ background: linear-gradient(180deg, #35b36b, #23824c); box-shadow: 0 4px 14px rgba(53,179,107,0.35); }
.app-poker .act-btn.allin{ background: linear-gradient(180deg, #e8873a, #c45f16); box-shadow: 0 4px 14px rgba(232,135,58,0.4); }
.app-poker .act-btn.gold{ background: linear-gradient(180deg, #e9c46a, #b98f1f); color: #241a05; box-shadow: 0 4px 16px rgba(233,196,106,0.45); }
.app-poker .act-btn.ghost{ background: rgba(255,255,255,0.08); border: 1px solid rgba(255,255,255,0.16); box-shadow: none; }
.app-poker .kbd-hint{
  font-size: 9px; opacity: 0.6; border: 1px solid rgba(255,255,255,0.35);
  border-radius: 4px; padding: 0 4px; margin-left: 4px; font-weight: 600;
}
@media (pointer: coarse){ .app-poker .kbd-hint{ display: none; }}

.app-poker .thinking{
  display: flex; align-items: center; justify-content: center; gap: 10px;
  color: var(--gold); font-size: 14px; font-weight: 700; padding: 12px;
}
.app-poker .thinking .dots span{ animation: blink 1.2s infinite; display: inline-block; }
.app-poker .thinking .dots span:nth-child(2){ animation-delay: .2s; }
.app-poker .thinking .dots span:nth-child(3){ animation-delay: .4s; }
@keyframes blink{ 0%,60%,100% { opacity: .2; } 30% { opacity: 1; } }

/* ============ 弹窗 ============ */
.app-poker .overlay{
  position: absolute; inset: 0; z-index: 200;
  background: rgba(3,8,6,0.8); backdrop-filter: blur(6px);
  display: none; align-items: center; justify-content: center; padding: 16px;
}
.app-poker .overlay.show{ display: flex; animation: fadeIn .25s ease; }
@keyframes fadeIn{ from { opacity: 0; } }
.app-poker .modal{
  background: linear-gradient(165deg, #10301f, #08170f);
  border: 1px solid var(--line); border-radius: 18px;
  box-shadow: 0 30px 80px rgba(0,0,0,0.7), 0 0 60px rgba(233,196,106,0.08);
  padding: 26px 28px; text-align: center; max-width: 480px; width: 100%;
  max-height: 85%; overflow-y: auto;
  animation: popIn .3s cubic-bezier(.2,.9,.3,1.3);
}
@keyframes popIn{ 0% { transform: scale(0.8); opacity: 0; } }
.app-poker .modal h2{ font-size: 26px; margin-bottom: 10px; }
.app-poker .modal h2.win{ color: #7bed7b; } .app-poker .modal h2.lose{ color: #ff8a8a; } .app-poker .modal h2.tie{ color: var(--gold); }
.app-poker .modal .detail{ font-size: 15px; margin: 6px 0; }
.app-poker .modal .sub{ font-size: 13px; color: var(--txt-dim); margin: 4px 0 12px; }
.app-poker .modal .showdown-cards{ display: flex; flex-direction: column; gap: 10px; margin: 14px 0; }
.app-poker .modal .sc-row{ display: flex; align-items: center; justify-content: center; gap: 10px; font-size: 13px; }
.app-poker .modal .sc-row .who-lbl{ min-width: 54px; text-align: right; color: var(--txt-dim); }
.app-poker .modal .sc-row .hand-tag{ min-width: 70px; text-align: left; font-weight: 800; color: var(--gold); font-size: 12px; }
.app-poker .modal .sc-row .mini-card{
  width: 30px; height: 42px; border-radius: 4px; background: #fff; color: #151a17;
  display: inline-flex; flex-direction: column; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 800; line-height: 1.1; margin: 0 2px;
  box-shadow: 0 2px 4px rgba(0,0,0,0.4);
}
.app-poker .modal .sc-row .mini-card.red{ color: #c62828; }
.app-poker .modal .btn-col{ display: flex; gap: 10px; margin-top: 16px; }
.app-poker .modal .btn-col .act-btn{ max-width: none; }

/* 战绩/规则弹窗共用 */
.app-poker .stat-grid{ display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 14px 0; }
.app-poker .stat-cell{ background: rgba(0,0,0,0.3); border-radius: 10px; padding: 10px 6px; }
.app-poker .stat-cell .v{ font-size: 20px; font-weight: 900; color: var(--gold); }
.app-poker .stat-cell .k{ font-size: 11px; color: var(--txt-dim); margin-top: 2px; }
.app-poker .history-list{ text-align: left; font-size: 12px; max-height: 220px; overflow-y: auto; margin-top: 8px; }
.app-poker .history-list .h-item{
  display: flex; justify-content: space-between; gap: 8px; padding: 7px 8px;
  border-bottom: 1px solid rgba(255,255,255,0.06); color: var(--txt-dim);
}
.app-poker .history-list .h-item b{ font-weight: 700; }
.app-poker .history-list .h-item .w{ color: #7bed7b; } .app-poker .history-list .h-item .l{ color: #ff8a8a; } .app-poker .history-list .h-item .t{ color: var(--gold); }
.app-poker .rules-body{ text-align: left; font-size: 13px; line-height: 1.9; color: var(--txt-dim); }
.app-poker .rules-body h3{ color: var(--gold); font-size: 14px; margin: 12px 0 4px; }
.app-poker .rules-body .rank-line{ display: flex; justify-content: space-between; padding: 2px 0; }
.app-poker .rules-body .rank-line b{ color: var(--txt); }
.app-poker .rules-body kbd{
  background: rgba(255,255,255,0.12); border-radius: 4px; padding: 1px 6px;
  font-size: 11px; color: var(--txt); font-family: inherit;
}

/* ============ 彩带 ============ */
.app-poker #confetti-canvas{ position: absolute; inset: 0; pointer-events: none; z-index: 300; }

/* ============================================================
   移动端适配
   ============================================================ */
@media (max-width: 768px){
  .app-poker{ --card-w: 44px; --card-h: 62px; }
  .app-poker .topbar{ padding: 6px 10px; }
  .app-poker .brand{ font-size: 14px; } .app-poker .brand small{ display: none; }
  .app-poker .icon-btn{ width: 34px; height: 34px; font-size: 15px; }
  .app-poker .main{ padding: 6px 8px 4px; gap: 6px; }
  .app-poker .table{
    border-radius: 22px; border-width: 5px; padding: 10px 10px;
    min-height: 0;
  }
  .app-poker .table::after{ display: none; }
  .app-poker .seat{ gap: 8px; }
  .app-poker .seat .who{ min-width: 64px; padding: 5px 7px; }
  .app-poker .seat .avatar{ font-size: 20px; }
  .app-poker .seat .name{ font-size: 10px; }
  .app-poker .seat .stack{ font-size: 12px; }
  .app-poker .cards{ gap: 5px; }
  .app-poker .seat.ai .dealer-btn{ right: calc(50% - 120px); }
  .app-poker .seat.me .dealer-btn{ left: calc(50% - 120px); }
  .app-poker .dealer-btn{ width: 20px; height: 20px; font-size: 10px; }
  .app-poker .seat.ai .bet-badge{ bottom: -30px; }
  .app-poker .seat.me .bet-badge{ top: -30px; }
  .app-poker .bet-badge{ font-size: 11px; padding: 3px 10px 3px 4px; }
  .app-poker .bet-badge .mini-chip{ width: 16px; height: 16px; }
  .app-poker .toast{ font-size: 12px; padding: 5px 12px; }
  .app-poker .pot-display{ font-size: 14px; padding: 4px 14px; }
  .app-poker .phase-label{ font-size: 10px; }
  .app-poker .log{ min-height: 48px; max-height: 48px; font-size: 10.5px; padding: 4px 10px; line-height: 1.6; }
  .app-poker .strength-bar{ font-size: 12px; padding: 5px 10px; min-height: 30px; }
  .app-poker .action-bar{ padding: 8px 10px calc(8px + var(--safe-b)); gap: 6px; }
  .app-poker .act-btn{ padding: 13px 4px; font-size: 14px; border-radius: 10px; }
  .app-poker .act-btn small{ font-size: 9px; }
  .app-poker .quick-bets{ min-height: 29px; }
  .app-poker .quick-bets button{ font-size: 11px; padding: 6px 2px; }
  .app-poker .raise-amt{ font-size: 16px; min-width: 72px; }
  .app-poker .modal{ padding: 20px 16px; }
  .app-poker .modal h2{ font-size: 22px; }}

/* 手机横屏：压缩 + 允许滚动 */
@media (max-height: 520px) and (max-width: 960px){
  .app-poker{ --card-w: 38px; --card-h: 54px; }
  .app-poker .topbar{ padding: 3px 10px; }
  .app-poker .brand{ font-size: 12px; }
  .app-poker .icon-btn{ width: 30px; height: 30px; font-size: 13px; }
  .app-poker .main{ padding: 3px 8px; gap: 4px; overflow-y: auto; }
  .app-poker .table{ padding: 4px 10px; border-width: 4px; flex: none; min-height: 235px; }
  .app-poker .log{ display: none; }
  .app-poker .strength-bar{ display: none; }
  .app-poker .center-area{ gap: 3px; padding: 2px 0; }
  .app-poker .pot-display{ font-size: 12px; padding: 2px 12px; }
  .app-poker .phase-label{ font-size: 10px; }
  .app-poker .seat{ gap: 10px; }
  .app-poker .seat .who{ flex-direction: row; min-width: 0; padding: 4px 8px; gap: 6px; align-items: center; }
  .app-poker .seat .avatar{ font-size: 16px; }
  .app-poker .seat .name{ font-size: 10px; }
  .app-poker .seat .stack{ font-size: 11px; }
  .app-poker .action-bar{ padding: 6px 10px calc(6px + var(--safe-b)); gap: 5px; }
  .app-poker .act-btn{ padding: 9px 4px; font-size: 13px; }
  .app-poker .raise-top{ gap: 8px; }
  .app-poker input[type="range"].raise-slider{ height: 6px; }
  .app-poker input[type="range"].raise-slider::-webkit-slider-thumb{ width: 20px; height: 20px; }}

/* 窗口化适配补充：游戏撑满窗口体，根容器作为弹窗/彩带的定位上下文 */
.app-window .window-body.poker-body { margin: 0; padding: 0; overflow: hidden; }
.app-poker { position: relative; overflow: hidden; }
/* 顶栏空间留给功能按钮：隐藏与窗口标题重复的副标题（独立版宽屏时才有位置显示） */
.app-poker .brand small { display: none; }
/* 98.css 给 button 设的 75px 最小宽度会撑爆游戏顶栏与快捷注额排，模块内重置 */
.app-poker button { min-width: 0; min-height: 0; }
/* 加注滑块：清掉 98.css 的黑色 Win98 轨道，恢复游戏的金色轨道 */
.app-poker input[type="range"].raise-slider::-webkit-slider-runnable-track {
  background: transparent; border: none; box-shadow: none; height: 8px; border-radius: 6px;
}
.app-poker input[type="range"].raise-slider::-moz-range-track {
  background: transparent; border: none; box-shadow: none; height: 8px; border-radius: 6px;
}
/* 窄屏（手机/窄窗口）顶栏再紧凑一点：品牌文字可收缩裁切，给功能按钮让位 */
@media (max-width: 768px) {
  .app-poker .topbar { padding: 6px 8px; gap: 6px; }
  .app-poker .brand { min-width: 0; overflow: hidden; }
  .app-poker .top-actions { gap: 4px; flex-shrink: 0; }
  .app-poker .icon-btn { width: 32px; height: 32px; }
}

/* ---------------- 像素图标与矢量花色（poker.js 内联 SVG，替代 emoji） ----------------
   非 98.css 按钮体系，currentColor 可用：图标随所在文字变色（金色按钮→深色图标等） */
.app-poker svg.px-icon { width: 15px; height: 15px; vertical-align: -2px; flex: none; }
.app-poker .icon-btn svg.px-icon { width: 18px; height: 18px; vertical-align: 0; }
.app-poker .seat .avatar svg.px-icon { width: 27px; height: 27px; vertical-align: 0; }
.app-poker .modal h2 svg.px-icon { width: 20px; height: 20px; vertical-align: -3px; }
.app-poker #result-title svg.px-icon { width: 22px; height: 22px; vertical-align: -3px; }
.app-poker .log svg.px-icon, .app-poker .rules-body svg.px-icon { width: 12px; height: 12px; vertical-align: -2px; }
.app-poker .stack svg.px-icon, .app-poker .pot-display svg.px-icon, .app-poker .modal .detail svg.px-icon,
.app-poker .stat-cell .v svg.px-icon { width: 14px; height: 14px; vertical-align: -2px; }
.app-poker .strength-bar svg.px-icon { width: 14px; height: 14px; vertical-align: -2px; }
.app-poker .thinking svg.px-icon { width: 16px; height: 16px; }
/* 牌面花色：c-top 角标与中央大 pip 随 --card-w 缩放，fill 继承 .card/.red 的红黑 */
.app-poker svg.suit-icon { vertical-align: -2px; flex: none; }
.app-poker .brand .suits { display: inline-flex; gap: 3px; }
.app-poker .brand .suits svg.suit-icon { width: 15px; height: 15px; vertical-align: 0; }
.app-poker .card .c-top svg.suit-icon { width: calc(var(--card-w) * 0.26); height: calc(var(--card-w) * 0.26); vertical-align: 0; }
.app-poker .card .c-pip svg.suit-icon { width: calc(var(--card-w) * 0.48); height: calc(var(--card-w) * 0.48); }
.app-poker .log svg.suit-icon, .app-poker .history-list svg.suit-icon { width: 11px; height: 11px; vertical-align: -1px; }
.app-poker .modal .sc-row .mini-card svg.suit-icon { width: 13px; height: 13px; vertical-align: 0; }
@media (max-width: 768px) {
  .app-poker .seat .avatar svg.px-icon { width: 21px; height: 21px; }
}
@media (max-height: 520px) and (max-width: 960px) {
  .app-poker .seat .avatar svg.px-icon { width: 17px; height: 17px; }
}

/* ---------------- 展柜（exhibits/ iframe 特效展品页） ---------------- */
/* 同 poker-body 的做法：去掉窗口体内边距，让展品 iframe 铺满窗口体 */
.app-window .window-body.exhibit-body { margin: 0; padding: 0; overflow: hidden; }
.exhibit-frame { display: block; width: 100%; height: 100%; border: 0; }

/* ============================================================
   卡带随身听（js/apps/tapeplayer.js）—— 深色现代风，壳守 98 芯自由
   选择器全部挂在 .app-tape（= 窗口体）下；--accent 由模块按磁带主题色设置
   ============================================================ */
.app-tape {
  --accent: #d8c27a;
  background: #16161c;
  font-family: "Pixelated MS Sans Serif", "PingFang SC", "Microsoft YaHei", Arial, sans-serif;
}
.app-tape .tp-zones { display: flex; gap: 18px; padding: 18px; align-items: flex-start; }

/* --- 左：磁带架（书脊行） --- */
.app-tape .tp-shelf { width: 196px; flex: none; display: flex; flex-direction: column; gap: 6px; }
.app-tape .tp-shelf-h { font-size: 10px; color: #6a6a76; letter-spacing: 2px; padding: 0 2px 4px; }
.app-tape .tp-row { display: flex; align-items: center; gap: 10px; width: 100%; padding: 6px 8px;
  background: none; border: 1px solid transparent; border-radius: 4px; cursor: pointer;
  text-align: left; transition: transform .15s, background .15s; box-sizing: border-box; }
.app-tape .tp-row:hover { background: rgba(255,255,255,.06); transform: translateX(4px); }
.app-tape .tp-row:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.app-tape .tp-mini { width: 56px; flex: none; }
.app-tape .tp-mini svg { width: 100%; height: auto; display: block; }
.app-tape .tp-meta { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.app-tape .tp-t { font-size: 11px; color: #e8e8f0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.app-tape .tp-a { font-size: 9px; color: #8a8a96; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.app-tape .tp-row.in-deck { border-color: #3a3a46; box-shadow: inset 3px 0 0 var(--accent); }
.app-tape .tp-row.in-deck .tp-mini svg { opacity: .25; }
.app-tape .tp-eq { display: none; align-items: flex-end; gap: 2px; height: 10px; }
.app-tape .tp-row.playing .tp-eq { display: flex; }
.app-tape .tp-eq i { width: 3px; background: var(--accent); animation: tp-eq 0.9s ease-in-out infinite; }
.app-tape .tp-eq i:nth-child(1) { height: 60%; }
.app-tape .tp-eq i:nth-child(2) { height: 100%; animation-delay: .3s; }
.app-tape .tp-eq i:nth-child(3) { height: 40%; animation-delay: .6s; }
@keyframes tp-eq { 50% { transform: scaleY(.35); } }

/* 架内搜索框 + VOL 分辑标签 + 空结果提示 */
.app-tape .tp-search { width: 100%; box-sizing: border-box; background: #101016; border: 1px solid #2a2a32;
  border-radius: 4px; color: #e8e8f0; font-size: 11px; padding: 5px 8px; outline: none; font-family: inherit; }
.app-tape .tp-search:focus { border-color: var(--accent); }
.app-tape .tp-search::placeholder { color: #5a5a66; }
.app-tape .tp-volcap { font-size: 9px; color: #565660; letter-spacing: 2px; padding: 8px 2px 2px;
  display: flex; align-items: center; gap: 6px; user-select: none; }
.app-tape .tp-volcap::after { content: ''; flex: 1; height: 1px; background: #26262e; }
.app-tape .tp-empty { font-size: 10px; color: #6a6a76; padding: 10px 2px; }
/* 架子独立滚动（PC）：自动定位只滚列表、不顶走机身；手机上仍整窗滚动。
   必须 overflow-x:hidden——否则 hover 行 translateX(4px) 会顶出横向滚动条，
   滚动条出现/消失挪动行位置 → hover 丢失/恢复死循环，整个架子抖动 */
.app-tape .tp-slots { max-height: 336px; overflow-y: auto; overflow-x: hidden; scrollbar-width: thin; scrollbar-color: #2a2a32 transparent; }
.app-tape .tp-slots::-webkit-scrollbar { width: 8px; }
.app-tape .tp-slots::-webkit-scrollbar-thumb { background: #2a2a32; border-radius: 4px; }

/* --- 中：卡带机（斜二轴测 2.5D 机身，SVG 内部类名由 tapeplayer.js 生成） --- */
.app-tape .tp-stage { flex: 1; position: relative; display: flex; flex-direction: column; align-items: center; gap: 6px; min-width: 0; }
.app-tape .tp-player-wrap { position: relative; width: 100%; max-width: 500px; }
.app-tape .tp-glow { position: absolute; inset: 15% 10%; background: var(--accent); opacity: .16;
  filter: blur(48px); pointer-events: none; transition: background .4s; }
.app-tape svg.tp-player { position: relative; width: 100%; height: auto; display: block;
  filter: drop-shadow(0 18px 20px rgba(0,0,0,.5)); }
.app-tape .tp-hint { font-size: 11px; color: #6a6a76; text-align: center; line-height: 1.7; }
.app-tape .acc { fill: var(--accent); }
.app-tape .tp-btn { cursor: pointer; }
.app-tape .tp-btn-body { transition: transform .05s; }
.app-tape .tp-btn.pressed .tp-btn-body { transform: translateY(2px); }
.app-tape .tp-deck-tape { transition: opacity .18s; }
.app-tape .tp-deck-tape.playing .reel-spin { animation: tp-spin 2.8s linear infinite; transform-box: fill-box; transform-origin: center; }
.app-tape .tp-deck-tape.seeking .reel-spin { animation-duration: .5s; }
@keyframes tp-spin { to { transform: rotate(360deg); } }
.app-tape .tp-vol-hit, .app-tape .tp-vol-knob { cursor: pointer; }

/* --- 右：相框封面 + 波形 --- */
.app-tape .tp-side { width: 208px; flex: none; display: flex; flex-direction: column; gap: 10px; align-items: center; }
.app-tape .tp-frame { background: #f2efe6; padding: 12px; box-shadow: 0 5px 0 rgba(0,0,0,.35), inset 0 0 0 1px #d8d4c6;
  transition: opacity .3s, filter .3s; }
.app-tape .tp-frame-inner { width: 184px; height: 184px; background: #101016; box-shadow: inset 0 0 0 1px #2a2a32; overflow: hidden; }
.app-tape .tp-frame-inner img { width: 100%; height: 100%; object-fit: cover; display: block; }
.app-tape .tp-wf-wrap { width: 208px; }
.app-tape canvas.tp-wf { width: 100%; height: 36px; display: block; background: #101016; box-shadow: inset 0 0 0 1px #2a2a32;
  cursor: pointer; transition: opacity .3s, filter .3s; touch-action: none; }
.app-tape .tp-cap { font-size: 11px; color: #b8b8c4; text-align: center; min-height: 14px; margin-top: 4px; }
.app-tape .dim { opacity: .3; filter: grayscale(.9); }

/* --- 飞行中的磁带（挂 body，fixed 定位） --- */
.tp-flyer { position: fixed; z-index: 99; pointer-events: none; margin: 0;
  transition: left .6s cubic-bezier(.35,.7,.25,1), top .6s cubic-bezier(.35,.7,.25,1),
              width .6s cubic-bezier(.35,.7,.25,1), height .6s cubic-bezier(.35,.7,.25,1),
              transform .6s cubic-bezier(.35,.7,.25,1), opacity .3s; }
.tp-flyer svg { width: 100%; height: 100%; display: block; }

/* --- 手机竖排 --- */
@media (max-width: 640px) {
  .app-tape .tp-zones { flex-direction: column; align-items: center; padding: 12px; gap: 14px; }
  .app-tape .tp-stage { order: 1; width: 100%; }
  .app-tape .tp-side { order: 2; width: 100%; }
  .app-tape .tp-frame-inner { width: min(280px, 78vw); height: min(280px, 78vw); }
  .app-tape .tp-wf-wrap { width: min(304px, 84vw); }
  .app-tape .tp-shelf { order: 3; width: 100%; }
  .app-tape .tp-slots { max-height: none; overflow-y: visible; }
  .app-tape .tp-row:hover { transform: none; }
}
