/* ===== CSS VARIABLES ===== */
:root {
  --gb-darkest:  #0f380f;
  --gb-dark:     #306230;
  --gb-mid:      #4b6e30;
  --gb-light:    #8bac0f;
  --gb-lightest: #9bbc0f;
  --gb-accent:   #c8d860;
  --font-mono: 'Courier New', Courier, monospace;
  --header-h:        52px;  /* 桌面头部高度 */
  --header-h-mobile: 44px;  /* 移动端头部高度 */
  --tabbar-h:  64px;
  --ad-h:      50px;
  --ad-h-desktop: 90px;
  --vctrl-h:   132px;
  --panel-w:   180px;
}

/* ===== RESET ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; }
body {
  font-family: var(--font-mono);
  background: var(--gb-dark);
  color: var(--gb-accent);
  min-height: 100vh;
  overflow-x: hidden;
}
a { color: var(--gb-accent); text-decoration: none; }
a:hover { text-decoration: underline; }
kbd {
  background: var(--gb-mid);
  color: var(--gb-accent);
  border: 1px solid var(--gb-light);
  border-radius: 3px;
  padding: 2px 6px;
  font-size: 1rem;
}
h1, h2, h3 { line-height: 1.3; }

/* ===== 站点头部（H1 · 响应式 · 桌面/移动均可见） ===== */
.site-header {
  background: var(--gb-darkest);
  border-bottom: 2px solid var(--gb-mid);
  height: var(--header-h);
  position: sticky;
  top: 0;
  z-index: 100;
  flex-shrink: 0;
}
.header-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 20px;
  height: 100%;
  display: flex;
  align-items: center;
  gap: 28px;
}
.site-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  flex-shrink: 0;
}
.site-logo img { image-rendering: pixelated; width: 28px; height: 28px; }
.site-logo h1 { font-size: 1.1rem; color: var(--gb-accent); white-space: nowrap; }
.d-nav { display: flex; gap: 24px; flex: 1; }
.d-nav a { font-size: 1rem; color: var(--gb-lightest); }
.d-nav a:hover { color: var(--gb-accent); }
.d-nav-ext { font-size: 1rem; color: var(--gb-light); flex-shrink: 0; }
.d-nav-ext:hover { color: var(--gb-lightest); }

/* ===== 游戏主区（桌面：占满视口以下） ===== */
.game-main {
  min-height: calc(100vh - var(--header-h));
  padding: 12px 20px 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
}
.d-subtitle {
  text-align: center;
  font-size: 1rem;
  color: var(--gb-lightest);
  margin-bottom: 12px;
  letter-spacing: 2px;
  flex-shrink: 0;
  width: 100%;
}

/* 游戏三列布局 */
.game-layout {
  display: flex;
  justify-content: center;
  gap: 14px;
  align-items: flex-start;
  max-width: 1100px;
  margin: 0 auto;
  width: 100%;
}

/* ===== 侧边面板（桌面可见） ===== */
.panel {
  background: var(--gb-darkest);
  border: 2px solid var(--gb-mid);
  border-radius: 6px;
  padding: 12px 10px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  flex-shrink: 0;
  width: var(--panel-w);
}
.panel-label {
  font-size: 1rem;
  font-weight: bold;
  color: var(--gb-accent);
  text-transform: uppercase;
  letter-spacing: 1px;
  border-bottom: 1px solid var(--gb-mid);
  padding-bottom: 5px;
  margin-bottom: 2px;
}
.panel-hint { font-size: 1rem; color: var(--gb-lightest); margin-top: 2px; }

/* Hold */
.hold-box { display: flex; flex-direction: column; gap: 6px; }
.hold-header {
  display: flex; align-items: center; justify-content: space-between; gap: 6px;
}
.hold-header .panel-label { border-bottom: none; padding-bottom: 0; margin-bottom: 0; }
.hold-header .panel-hint  { margin: 0; font-size: 0.9rem; }
.hold-canvas-wrap { display: flex; justify-content: center; align-items: center; }
#holdCanvas { image-rendering: pixelated; border: 1px solid var(--gb-mid); }

/* AI Hint Button */
.ai-hint-box { display: flex; flex-direction: column; gap: 5px; }
.ai-hint-btn {
  background: var(--gb-mid);
  border: 2px solid var(--gb-accent);
  color: var(--gb-accent);
  font-family: var(--font-mono);
  font-size: 1rem;
  font-weight: bold;
  padding: 8px 6px;
  border-radius: 4px;
  cursor: pointer;
  text-align: center;
  transition: background 0.15s;
  width: 100%;
}
.ai-hint-btn:hover  { background: var(--gb-dark); }
.ai-hint-btn:active { background: var(--gb-accent); color: var(--gb-darkest); }

/* Adaptive Speed */
.adaptive-box { display: flex; flex-direction: column; gap: 6px; }
.adaptive-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.speed-info { font-size: 1rem; color: var(--gb-lightest); }

/* GB Toggle */
.gb-toggle {
  position: relative; display: inline-block;
  width: 46px; height: 24px; cursor: pointer; flex-shrink: 0;
}
.gb-toggle input { opacity: 0; width: 0; height: 0; }
.gb-toggle-slider {
  position: absolute; inset: 0;
  background: var(--gb-dark);
  border: 1px solid var(--gb-mid);
  border-radius: 24px;
  transition: background 0.2s;
}
.gb-toggle-slider::before {
  content: '';
  position: absolute;
  width: 16px; height: 16px;
  left: 3px; top: 3px;
  background: var(--gb-light);
  border-radius: 50%;
  transition: transform 0.2s, background 0.2s;
}
.gb-toggle input:checked + .gb-toggle-slider { background: var(--gb-mid); border-color: var(--gb-accent); }
.gb-toggle input:checked + .gb-toggle-slider::before {
  transform: translateX(22px);
  background: var(--gb-accent);
}

/* Stats */
.stats-box { display: flex; flex-direction: column; gap: 7px; }
.stat-row { display: flex; justify-content: space-between; align-items: center; font-size: 1rem; }
.stat-label { color: var(--gb-lightest); }
.stat-val { color: var(--gb-accent); font-weight: bold; min-width: 54px; text-align: right; }

/* Challenge Box */
.challenge-box {
  display: flex; flex-direction: column; gap: 5px; align-items: stretch;
  cursor: pointer; border-radius: 4px; transition: background 0.15s;
}
.challenge-box:hover { background: rgba(75,110,48,0.25); }
.challenge-head { display: flex; align-items: baseline; justify-content: space-between; gap: 6px; }
.challenge-head .panel-label { border-bottom: none; padding-bottom: 0; margin-bottom: 0; flex-shrink: 0; }
#challengeCanvas,
#mChallengeCanvas {
  display: block; width: 100%; height: auto;
  image-rendering: pixelated;
  border: 1px solid var(--gb-mid);
  border-radius: 3px;
  background: var(--gb-dark);
}
.challenge-goal { font-size: 0.85rem; color: var(--gb-lightest); font-weight: normal; line-height: 1.2; text-align: right; }
.challenge-status { font-size: 0.8rem; color: var(--gb-light); line-height: 1.2; text-align: center; }

/* Key Hints */
.key-hints { display: flex; flex-direction: column; gap: 5px; }
.key-list { list-style: none; display: flex; flex-direction: column; gap: 5px; }
.key-list li { font-size: 1rem; color: var(--gb-lightest); line-height: 1.4; }
.key-list kbd { font-size: 1rem; }

/* Right Panel */
.panel-right { width: var(--panel-w); }
.next-box { display: flex; flex-direction: column; gap: 6px; align-items: center; }
#nextCanvas { image-rendering: pixelated; border: 1px solid var(--gb-mid); }

/* ===== 中间列 ===== */
.game-center {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
  width: auto;
  max-width: 100%;
}
/* 移动端顶栏：桌面隐藏 */
.m-game-top { display: none; }
/* 画布容器 */
.canvas-slot {
  display: flex;
  justify-content: center;
  align-items: flex-start;
}
#canvasUnit {
  position: relative;
  display: inline-block;
  line-height: 0;
}
#gameCanvas {
  display: block;
  image-rendering: pixelated;
  border: 2px solid rgba(255,255,255,0.12);
  border-radius: 4px;
  box-shadow: 0 0 24px rgba(0,0,0,0.5);
}

/* Overlay */
.game-overlay {
  position: absolute; inset: 0;
  display: flex; justify-content: center; align-items: center;
  background: rgba(15,56,15,0.82);
  backdrop-filter: blur(1px);
}
.game-overlay.hidden { display: none; }
.overlay-inner { text-align: center; padding: 24px 20px; }
.overlay-title {
  font-size: 1.6rem;
  color: var(--gb-accent);
  font-family: var(--font-mono);
  font-weight: bold;
  margin-bottom: 10px;
  text-shadow: 2px 2px 0 var(--gb-darkest);
}
.overlay-msg { font-size: 1rem; color: var(--gb-lightest); margin-bottom: 18px; line-height: 1.6; }
.btn-start {
  background: var(--gb-mid);
  border: 2px solid var(--gb-accent);
  color: var(--gb-accent);
  font-family: var(--font-mono);
  font-size: 1rem;
  font-weight: bold;
  padding: 10px 32px;
  border-radius: 4px;
  cursor: pointer;
  transition: background 0.15s;
}
.btn-start:hover  { background: var(--gb-dark); }
.btn-start:active { background: var(--gb-accent); color: var(--gb-darkest); }

/* 桌面端控制按钮 */
.d-game-btns {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  width: 100%;
  max-width: 320px;
}
.game-btn {
  background: var(--gb-darkest);
  border: 2px solid var(--gb-mid);
  color: var(--gb-lightest);
  font-family: var(--font-mono);
  font-size: 1rem;
  padding: 9px 8px;
  border-radius: 4px;
  cursor: pointer;
  transition: background 0.12s, border-color 0.12s;
  white-space: nowrap;
}
.game-btn:hover  { background: var(--gb-mid); border-color: var(--gb-light); color: var(--gb-accent); }
.game-btn:active { background: var(--gb-light); color: var(--gb-darkest); }
.game-btn-accent { border-color: var(--gb-accent); color: var(--gb-accent); background: var(--gb-dark); font-weight: bold; }
.game-btn-accent:hover { background: var(--gb-mid); }

/* 虚拟手柄：桌面隐藏 */
.vctrl { display: none; }

/* 广告区 */
.d-ad-row {
  width: 100%;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 12px 16px 0;
  flex-shrink: 0;
}
.ad-slot {
  width: 728px;
  max-width: 100%;
  height: var(--ad-h-desktop);
  overflow: hidden;
  flex-shrink: 0;
}
.ad-slot ins,
.ad-slot iframe,
.ad-slot > * {
  display: block !important;
  width: 100% !important;
  height: var(--ad-h-desktop) !important;
  max-height: var(--ad-h-desktop) !important;
  overflow: hidden !important;
}

/* 移动端 Tab 内容面板：桌面隐藏 */
.m-tab-panels { display: none; }
/* 移动端底部导航：桌面隐藏 */
.m-tabbar { display: none; }

/* ===== 内容区 ===== */
.page-content {
  max-width: 960px;
  margin: 20px auto 0;
  padding: 0 20px 32px;
}
.content-section { margin-bottom: 32px; }
.content-section h2 {
  font-size: 1.2rem;
  color: var(--gb-accent);
  padding-left: 10px;
  border-left: 3px solid var(--gb-accent);
  margin-bottom: 12px;
}
.content-section h3 { font-size: 1.1rem; color: var(--gb-lightest); margin: 14px 0 6px; }
.content-section p,
.content-section li { font-size: 1rem; color: var(--gb-lightest); line-height: 1.75; }
.content-section ul { padding-left: 20px; }
.content-section li { margin-bottom: 4px; }
.faq-item { margin-bottom: 16px; }
.faq-item h3 { font-size: 1.05rem; color: var(--gb-accent); margin-bottom: 6px; }
.ext-content { font-size: 1rem; color: var(--gb-mid); }

/* ===== FOOTER ===== */
.site-footer {
  background: var(--gb-darkest);
  border-top: 1px solid var(--gb-mid);
  padding: 18px 20px;
  text-align: center;
  font-size: 1rem;
  color: var(--gb-light);
}
.site-footer a { color: var(--gb-light); }
.site-footer a:hover { color: var(--gb-lightest); }

/* ===== 移动端响应式布局 ===== */
@media (max-width: 768px) {

  /* 根元素弹性布局：让所有层级高度由 flex 分配，消除跨浏览器视口差异 */
  html { height: 100%; }
  body {
    display: flex;
    flex-direction: column;
    height: 100dvh;
    height: 100vh; /* 兜底 */
    overflow: hidden;
  }

  /* 头部：紧凑，高度降低；覆盖桌面 sticky，避免移动端 flex 布局中产生多余层叠上下文 */
  .site-header {
    height: var(--header-h-mobile);
    flex-shrink: 0;
    position: relative;
    z-index: auto;
  }
  .header-inner { gap: 12px; padding: 0 12px; }
  .site-logo img { width: 20px; height: 20px; }
  .site-logo h1 { font-size: 0.9rem; }
  .d-nav    { display: none; }  /* 导航菜单移动端隐藏 */
  .d-nav-ext { display: none; }

  /* 游戏主区：flex:1 自动占满 header 与 TabBar 之间的所有空间 */
  .game-main {
    flex: 1;
    min-height: 0;
    height: auto;
    padding: 0;
    width: 100%;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    align-items: stretch;
  }

  /* 副标题：移动端隐藏 */
  .d-subtitle { display: none; }

  /* 游戏布局：改为 flex column，撑满 game-main */
  .game-layout {
    flex-direction: column;
    align-items: stretch;   /* 覆盖桌面的 flex-start，让 game-center 撑满宽度 */
    justify-content: flex-start;
    flex: 1;
    min-height: 0;
    gap: 0;
    padding: 0;
    max-width: 100%;
    margin: 0;
    overflow: hidden;
  }

  /* 左右面板：移动端隐藏 */
  .panel-left  { display: none !important; }
  .panel-right { display: none !important; }

  /* 中间列：撑满剩余空间；vctrl 已改为正常文档流，无需 padding-bottom 预留 */
  .game-center {
    flex: 1;
    width: 100%;
    min-height: 0;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    overflow: hidden;
    padding-bottom: 0;
  }

  /* 移动端顶栏：显示 */
  .m-game-top {
    background: var(--gb-darkest);
    border-bottom: 2px solid var(--gb-mid);
    padding: 8px 10px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-shrink: 0;
    min-height: 52px;
    gap: 10px;
  }
  .m-top-score-block {
    flex: 1; min-width: 0;
    display: flex; flex-direction: column; gap: 4px;
  }
  .m-score-lbl {
    font-size: 0.65rem; color: var(--gb-light);
    letter-spacing: 1px; text-transform: uppercase; line-height: 1;
  }
  .m-score-val {
    font-size: 1.35rem; color: var(--gb-accent);
    line-height: 1.1; font-weight: bold; letter-spacing: 1px;
  }
  .m-top-meta { display: flex; flex-wrap: wrap; gap: 5px; }
  .m-meta-chip {
    font-size: 0.72rem; color: var(--gb-lightest);
    background: var(--gb-dark); border: 1px solid var(--gb-mid);
    border-radius: 10px; padding: 2px 8px; white-space: nowrap;
  }
  .m-meta-chip strong { color: var(--gb-accent); font-weight: bold; }
  .m-top-next {
    display: flex; flex-direction: column;
    align-items: center; justify-content: center;
    gap: 3px; flex-shrink: 0;
    padding: 4px 8px;
    background: var(--gb-dark);
    border: 2px solid var(--gb-mid);
    border-radius: 6px; min-width: 72px;
  }
  .m-next-lbl { font-size: 0.6rem; color: var(--gb-light); letter-spacing: 1px; text-transform: uppercase; line-height: 1; }
  #mNextCanvas { display: block; image-rendering: pixelated; width: 56px; height: 42px; }

  /* 画布区：撑满剩余空间 */
  .canvas-slot {
    flex: 1;
    min-height: 0;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: hidden;
    background: var(--gb-dark);
  }

  /* 桌面端按钮：移动端隐藏 */
  .d-game-btns { display: none !important; }

  /* 虚拟手柄：正常文档流，位于 canvas-slot 正下方，不再 fixed */
  .vctrl {
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    padding: 6px 10px 8px;
    background: var(--gb-darkest);
    border-top: 2px solid var(--gb-mid);
    gap: 6px;
    width: 100%;
    overflow: hidden;
    box-sizing: border-box;
  }

  /* 辅助键行 */
  .vctrl-util { display: flex; gap: 6px; width: 100%; }
  .vbtn-util {
    flex: 1; min-width: 0;
    background: var(--gb-dark);
    border: 2px solid var(--gb-mid);
    border-radius: 8px;
    color: var(--gb-lightest);
    cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    gap: 4px; height: 36px; padding: 0 6px;
    font-family: var(--font-mono);
    font-size: 0.78rem; font-weight: bold;
    -webkit-tap-highlight-color: transparent;
    user-select: none; touch-action: manipulation;
    transition: background 0.08s;
  }
  .vbtn-util:active { background: var(--gb-mid); transform: scale(0.97); }
  .vbtn-util .vbtn-icon { font-size: 0.9rem; line-height: 1; flex-shrink: 0; }
  .vbtn-util .vbtn-label { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .vbtn-util.vbtn-ai    { border-color: var(--gb-accent); color: var(--gb-accent); }
  .vbtn-util.vbtn-pause { color: var(--gb-light); }
  .vbtn-util.vbtn-fullscreen { color: var(--gb-lightest); }

  /* 全屏图标：CSS 绘制的四角展开/收起箭头 */
  .vbtn-fs-icon {
    display: inline-block;
    width: 12px; height: 12px;
    border: 2px solid currentColor;
    border-radius: 1px;
    position: relative;
    flex-shrink: 0;
  }
  .vbtn-fs-icon::before,
  .vbtn-fs-icon::after {
    content: '';
    position: absolute;
    width: 4px; height: 4px;
    border-color: currentColor;
    border-style: solid;
  }
  .vbtn-fs-icon::before {
    top: -1px; left: -1px;
    border-width: 2px 0 0 2px;
  }
  .vbtn-fs-icon::after {
    bottom: -1px; right: -1px;
    border-width: 0 2px 2px 0;
  }
  /* 全屏激活状态：收起图标 */
  body.game-fullscreen .vbtn-fs-icon::before {
    top: 1px; left: 1px;
    border-width: 0 2px 2px 0;
  }
  body.game-fullscreen .vbtn-fs-icon::after {
    bottom: 1px; right: 1px;
    border-width: 2px 0 0 2px;
  }

  /* 主操控行 */
  .vctrl-main { display: flex; align-items: stretch; gap: 10px; width: 100%; min-height: 0; }
  .vctrl-dpad   { flex: 1.15; min-width: 0; display: flex; gap: 6px; align-items: stretch; }
  .vctrl-actions { flex: 0.85; min-width: 0; display: flex; gap: 6px; align-items: stretch; }

  .vbtn-dpad {
    flex: 1; min-width: 0;
    background: var(--gb-dark);
    border: 2px solid var(--gb-mid);
    border-radius: 12px;
    color: var(--gb-accent);
    cursor: pointer;
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    gap: 1px; min-height: 52px; padding: 4px 2px;
    font-size: 1.35rem; line-height: 1;
    font-family: var(--font-mono);
    -webkit-tap-highlight-color: transparent;
    user-select: none; touch-action: manipulation;
    transition: background 0.08s, transform 0.08s;
  }
  .vbtn-dpad:active { background: var(--gb-mid); transform: scale(0.94); }
  .vbtn-dpad-sub { font-size: 0.58rem; color: var(--gb-light); line-height: 1; }
  .vbtn-down { color: var(--gb-lightest); }

  .vbtn-action {
    flex: 1; min-width: 0;
    background: var(--gb-dark);
    border: 2px solid var(--gb-mid);
    border-radius: 12px;
    cursor: pointer;
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    gap: 2px; min-height: 52px; padding: 4px 2px;
    font-family: var(--font-mono);
    -webkit-tap-highlight-color: transparent;
    user-select: none; touch-action: manipulation;
    transition: background 0.08s, transform 0.08s;
  }
  .vbtn-action:active { transform: scale(0.94); }
  .vbtn-action-icon { font-size: 1.3rem; line-height: 1; }
  .vbtn-action-sub  { font-size: 0.58rem; color: var(--gb-light); line-height: 1; }
  .vbtn-rotate { border-color: var(--gb-accent); color: var(--gb-accent); }
  .vbtn-rotate:active { background: var(--gb-mid); }
  .vbtn-drop   { border-color: var(--gb-light); color: var(--gb-lightest); }
  .vbtn-drop:active { background: var(--gb-mid); }

  /* 广告区：正常文档流，位于 game-layout 下方 */
  .d-ad-row {
    flex-shrink: 0;
    height: var(--ad-h);
    padding: 0;
    display: flex;
    justify-content: center;
    align-items: center;
    background: var(--gb-darkest);
    border-top: 1px solid var(--gb-mid);
  }
  .ad-slot {
    width: 100%;
    height: var(--ad-h);
    overflow: hidden;
  }
  .ad-slot ins, .ad-slot iframe, .ad-slot > * {
    height: var(--ad-h) !important;
    max-height: var(--ad-h) !important;
  }

  /* 移动端 Tab 内容面板：高度由 body flex 自动分配，无需 calc */
  .m-tab-panels {
    display: none;
    overflow: hidden;
    background: var(--gb-darkest);
  }
  .m-panel {
    display: none;
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }

  /* body 加 tab-nonGame class 时切换游戏区与内容区 */
  body.tab-nonGame .game-main     { display: none; }
  body.tab-nonGame .m-tab-panels  { display: flex; flex: 1; flex-direction: column; min-height: 0; }

  /* 滚动内容区通用样式 */
  .m-scroll {
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding: 16px;
    padding-bottom: calc(16px + env(safe-area-inset-bottom, 0px));
    color: var(--gb-lightest);
    flex: 1;
    min-height: 0;
  }
  .m-scroll h2 { font-size: 1.2rem; color: var(--gb-accent); margin-bottom: 12px; }
  .m-scroll h3 { font-size: 1.05rem; color: var(--gb-lightest); margin: 14px 0 6px; }
  .m-scroll p, .m-scroll li { font-size: 1rem; color: var(--gb-lightest); line-height: 1.7; }
  .m-scroll ul { padding-left: 18px; margin-bottom: 10px; }
  .m-scroll li { margin-bottom: 5px; }

  /* 统计页 */
  .stats-cards { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 16px; }
  .stat-card {
    background: var(--gb-dark); border: 1px solid var(--gb-mid);
    border-radius: 6px; padding: 12px;
    display: flex; flex-direction: column; gap: 5px;
  }
  .sc-label { font-size: 1rem; color: var(--gb-lightest); }
  .sc-val   { font-size: 1.2rem; color: var(--gb-accent); font-weight: bold; }
  .m-adaptive-row {
    display: flex; align-items: center; justify-content: space-between;
    padding: 8px 0; margin-bottom: 4px;
  }
  .m-speed-info { font-size: 1rem; color: var(--gb-lightest); margin-bottom: 14px; }
  .m-challenge-box {
    background: var(--gb-dark); border: 1px solid var(--gb-mid);
    border-radius: 6px; padding: 12px; margin-bottom: 16px;
    display: flex; flex-direction: column; gap: 6px;
  }
  .m-challenge-box #mChallengeCanvas { width: 100%; max-width: 200px; margin: 0 auto; }
  .m-btns-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 10px; }
  .m-game-btn {
    background: var(--gb-darkest); border: 2px solid var(--gb-mid);
    color: var(--gb-lightest); font-family: var(--font-mono);
    font-size: 1rem; padding: 12px 8px;
    border-radius: 4px; cursor: pointer; text-align: center;
  }
  .m-game-btn:active { background: var(--gb-mid); color: var(--gb-accent); }
  .m-btn-accent { border-color: var(--gb-accent); color: var(--gb-accent); font-weight: bold; }

  /* Tab 栏：正常文档流，作为 body flex 的最后一个子项，自然沉底 */
  .m-tabbar {
    display: flex;
    flex-shrink: 0;
    height: var(--tabbar-h);
    padding-bottom: env(safe-area-inset-bottom, 0px);
    background: var(--gb-darkest);
    border-top: 1px solid var(--gb-mid);
    box-shadow: 0 -3px 16px rgba(0,0,0,0.5);
  }
  .m-tab {
    flex: 1; background: none; border: none;
    color: var(--gb-light); cursor: pointer;
    display: flex; flex-direction: column;
    align-items: center; justify-content: center;
    gap: 4px; font-family: var(--font-mono);
    -webkit-tap-highlight-color: transparent;
    transition: color 0.15s;
    position: relative;
  }
  .m-tab::before {
    content: '';
    position: absolute;
    top: 7px; left: 50%; transform: translateX(-50%);
    width: 44px; height: 26px;
    border-radius: 13px;
    background: transparent; transition: background 0.2s;
  }
  .m-tab.active::before { background: rgba(200,216,96,0.14); }
  .m-tab.active { color: var(--gb-accent); }
  .m-tab-icon { font-size: 1.25rem; line-height: 1; position: relative; z-index: 1; }
  .m-tab-text { font-size: 0.72rem; letter-spacing: 0.5px; position: relative; z-index: 1; }

  /* 内容区：移动端隐藏（body overflow:hidden 已截断，不影响桌面端展示） */
  .page-content { display: none; }
  .site-footer   { display: none; }

  /* 移动端精简 Tab 内导引文案 */
  .m-guide-lead { font-size: 1rem; color: var(--gb-lightest); line-height: 1.6; margin-bottom: 12px; }
  .m-more-link {
    display: inline-block; margin-top: 16px;
    color: var(--gb-accent); font-size: 0.95rem;
    border-bottom: 1px dotted var(--gb-mid); padding-bottom: 2px;
  }
  .m-footer-links { margin-top: 20px; font-size: 0.85rem; color: var(--gb-mid); line-height: 1.8; }
  .m-footer-links a { color: var(--gb-light); }

  /* ===== 页面内游戏全屏模式 ===== */
  /* header / tabbar / ad 隐藏后，body flex 自动将 game-main 撑满 100dvh */
  body.game-fullscreen .site-header { display: none; }
  body.game-fullscreen .m-tabbar   { display: none; }
  body.game-fullscreen .d-ad-row   { display: none; }
  /* 全屏时 vctrl 位于最底部，补 safe-area 留白（iPhone 底部横条） */
  body.game-fullscreen .vctrl {
    padding-bottom: calc(8px + env(safe-area-inset-bottom, 0px));
  }

  @media (max-width: 360px) {
    .vbtn-util .vbtn-label, .vbtn-dpad-sub, .vbtn-action-sub { display: none; }
    .vctrl { padding: 5px 6px 6px; gap: 5px; }
    .vbtn-dpad, .vbtn-action { min-height: 48px; border-radius: 10px; }
    .vbtn-util { height: 34px; }
  }
  @media (max-width: 768px) and (max-height: 640px) {
    .vbtn-dpad, .vbtn-action { min-height: 46px; }
    .vbtn-util { height: 32px; }
  }
}

/* ===== 强制隐藏：旧双包裹类（防止 JS 残留引用报错） ===== */
.desktop-wrap, .mobile-wrap { display: contents !important; }
