/* =====================================================================
   GeekHuang Lab — 极客坦克大战
   用站点变量（--bg、--surface、--line、--line-2、--text、--text-2、
   --text-3、--cyan、--ok、--down）。样式都收在 .bo-page / .bo-* 里。
   ===================================================================== */

.bo-page {
  min-width: 0;
  padding-block: clamp(28px, 5vw, 64px) clamp(64px, 8vw, 120px);
}

.bo-back { display: inline-flex; gap: 8px; color: var(--text-3); margin-bottom: 28px; }
.bo-back:hover { color: var(--text); }

/* ---------- 页头 ---------- */
.bo-eyebrow { display: flex; align-items: center; gap: 12px; color: var(--text-3); }
.bo-eyebrow__rule { flex: 0 1 64px; height: 1px; background: var(--line-2); }
.bo-title {
  margin-top: 14px;
  font-size: clamp(30px, 4vw, 52px);
  line-height: 1.1;
  letter-spacing: -0.03em;
  font-weight: 600;
}
.bo-intro { margin-top: 14px; max-width: 62ch; color: var(--text-2); }
.bo-pill {
  margin-top: 14px;
  display: inline-block;
  padding: 8px 14px;
  border: 1px solid var(--line-2);
  border-radius: 999px;
  background: var(--surface);
  color: var(--text);
  font-size: 14px;
}

/* ---------- 游戏区 ---------- */
.bo-game {
  position: relative;
  margin: clamp(24px, 4vw, 40px) auto 0;
  max-width: 520px;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  padding: clamp(12px, 2.4vw, 20px);
}

.bo-page .corner {
  position: absolute; width: 14px; height: 14px; pointer-events: none;
  border: 0 solid var(--line-3);
}
.bo-page .corner--tl { top: 8px; left: 8px; border-top-width: 1px; border-left-width: 1px; }
.bo-page .corner--br { bottom: 8px; right: 8px; border-bottom-width: 1px; border-right-width: 1px; }

/* ---------- HUD ---------- */
.bo-hud {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 12px;
}
.bo-hud__item {
  min-width: 0;
  padding: 8px 6px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--bg);
  text-align: center;
}
.bo-hud__label { display: block; color: var(--text-3); font-size: 12px; }
.bo-hud__value {
  display: block;
  margin-top: 2px;
  font-weight: 600;
  font-size: 16px;
  font-variant-numeric: tabular-nums;
}
#lives { color: var(--down); letter-spacing: 0.1em; }

/* ---------- 画布 ---------- */
.bo-stage {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--bg);
  overflow: hidden;
}
#tank-canvas {
  display: block;
  width: 100%;
  height: auto;
  margin: 0 auto; /* 全屏等比缩放时居中 */
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  -webkit-tap-highlight-color: transparent;
}

/* ---------- 按钮 ---------- */
.bo-actions {
  margin-top: 12px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.bo-actions .btn { flex: 1 1 auto; min-width: 0; }

.bo-help {
  margin: 20px auto 0;
  max-width: 520px;
  color: var(--text-3);
  font-size: 13px;
  line-height: 1.7;
}

/* 全屏与伪全屏共享布局；页面其他区域在伪全屏隐藏。 */
html.bo-pseudo-fs, html.bo-pseudo-fs body { overflow: hidden; height: 100%; }
html.bo-pseudo-fs .bg-grid, html.bo-pseudo-fs .nav,
html.bo-pseudo-fs footer, html.bo-pseudo-fs .bo-back,
html.bo-pseudo-fs .bo-head, html.bo-pseudo-fs .bo-help { display: none !important; }
html.bo-pseudo-fs .bo-game { position: fixed; inset: 0; z-index: 1000; }
.bo-game:fullscreen, html.bo-pseudo-fs .bo-game {
  max-width: none; border: 0; border-radius: 0; background: var(--bg);
  display: flex; flex-direction: column;
}
.bo-fs-exit {
  display: none; position: absolute;
  top: calc(8px + env(safe-area-inset-top)); right: calc(8px + env(safe-area-inset-right));
  z-index: 1001;
}
html.bo-pseudo-fs .bo-fs-exit { display: inline-flex; padding: 5px 10px; font-size: 12px; }

/* 窄屏收紧 */
@media (max-width: 480px) {
  .bo-game { padding: 10px; }
  .bo-hud { gap: 6px; }
  .bo-hud__item { padding: 6px 4px; }
  .bo-hud__value { font-size: 14px; }
}

/* 道具与说明 */
.bo-combo-line { color:var(--text-2); font-size:13px; margin:0 0 8px; }
#combo { color:var(--cyan); font-size:18px; }
#bo-effects { display:flex; flex-wrap:wrap; gap:5px; margin-bottom:8px; min-height:4px; }
.bo-effect { color:var(--text); font-size:11px; padding:4px 6px; border:1px solid var(--effect-color); border-radius:5px; }
.bo-effect b { color:var(--effect-color); }
.bo-effect progress { display:block; width:100%; height:3px; margin-top:3px; accent-color:var(--effect-color); }
.bo-help-panel[hidden] { display:none; }
.bo-help-panel { position:absolute; inset:0; z-index:1010; background:var(--bg); border-radius:inherit; overflow:auto; overscroll-behavior:contain; color:var(--text); }
.bo-help-content { max-width:720px; padding:20px; margin:auto; line-height:1.75; }
.bo-help-content h2,.bo-help-content h3 { margin:18px 0 10px; }
.bo-help-content p { color:var(--text-2); }
.bo-help-items { list-style:none; padding:0; display:grid; gap:8px; }
.bo-help-items i { display:inline-flex; width:26px; height:22px; align-items:center; justify-content:center; background:var(--sample); color:#101520; font-style:normal; font-weight:bold; margin-right:8px; }
.bo-game:fullscreen,html.bo-pseudo-fs .bo-game { box-sizing:border-box; height:100dvh; margin:0; overflow:hidden; gap:8px; padding:10px; }
.bo-game:fullscreen .bo-stage,html.bo-pseudo-fs .bo-stage { flex:1; min-height:0; width:100%; display:flex; align-items:center; justify-content:center; }
.bo-game:fullscreen .bo-info,html.bo-pseudo-fs .bo-info { flex:none; }
.bo-game:fullscreen .bo-actions,html.bo-pseudo-fs .bo-game .bo-actions { flex:none; margin:0; }
html.bo-pseudo-fs .bo-game { padding-top:calc(48px + env(safe-area-inset-top)); padding-bottom:calc(10px + env(safe-area-inset-bottom)); }
@media (orientation:landscape) {
 .bo-game:fullscreen,html.bo-pseudo-fs .bo-game { display:grid; grid-template-columns:130px minmax(0,1fr) 120px; grid-template-rows:minmax(0,1fr); padding:8px; gap:10px; }
 .bo-game:fullscreen .bo-info,html.bo-pseudo-fs .bo-info { overflow:auto; align-self:center; max-height:100%; }
 .bo-game:fullscreen .bo-hud,html.bo-pseudo-fs .bo-game .bo-hud { grid-template-columns:1fr; margin:0 0 8px; }
 .bo-game:fullscreen .bo-stage,html.bo-pseudo-fs .bo-stage { height:100%; box-sizing:border-box; }
 .bo-game:fullscreen .bo-actions,html.bo-pseudo-fs .bo-game .bo-actions { flex-direction:column; align-self:center; flex-wrap:nowrap; max-height:100%; overflow:auto; }
 html.bo-pseudo-fs .bo-hud { margin-right:0; }
 html.bo-pseudo-fs .bo-game .bo-actions { padding-top:36px; }
 .bo-game:fullscreen .bo-actions .btn,html.bo-pseudo-fs .bo-actions .btn { flex:none; }
}
/* Tank-specific presentation */
.bo-game { max-width:640px; }
.bo-intro { line-height:1.8; }
.bo-stage { border-radius:3px; }
#tank-canvas { image-rendering:pixelated; image-rendering:crisp-edges; aspect-ratio:1; outline:none; }
#tank-canvas:focus-visible { outline:2px solid var(--cyan); outline-offset:-2px; }
.bo-combo-line { display:flex; align-items:center; gap:8px; }
#mission { margin-left:auto; color:var(--text-3); font-size:11px; }
#loadout { display:flex; flex-wrap:wrap; gap:6px; margin-bottom:10px; font-size:11px; min-height:25px; }
.loadout-player { display:flex; align-items:center; flex-wrap:wrap; gap:4px; }
.weapon-chip { font:inherit; border:1px solid var(--line-2); color:var(--text-2); background:var(--bg); border-radius:3px; padding:4px 6px; cursor:pointer; }
.weapon-chip.active { background:var(--cyan); color:#10232b; border-color:var(--cyan); font-weight:700; }
.effect { color:var(--ok); }
.touch-controls { display:flex; align-items:center; justify-content:space-between; padding:12px 4px 2px; gap:10px; }
#joystick { position:relative; flex:0 0 92px; width:92px; height:92px; border:1px solid var(--line-2); border-radius:50%; background:var(--bg); touch-action:none; user-select:none; }
.joy-cross { position:absolute; inset:0; display:grid; place-items:center; color:var(--text-3); font-size:56px; opacity:.35; }
#joy-stick { position:absolute; width:36px; height:36px; top:27px; left:27px; border:1px solid var(--cyan); border-radius:50%; background:var(--surface); box-shadow:0 0 16px #38bdf822; pointer-events:none; }
.touch-hint { color:var(--text-3); font-size:11px; }
.touch-fire { display:flex; gap:10px; align-items:center; }
.touch-fire button { border:1px solid var(--line-2); border-radius:50%; background:var(--bg); color:var(--text); font:inherit; cursor:pointer; touch-action:none; user-select:none; }
#cycle { width:55px; height:55px; font-size:11px; }
#fire { width:78px; height:78px; border-color:var(--cyan); background:var(--cyan); color:#10232b; font-weight:700; }
#fire.held { transform:scale(.94); box-shadow:0 0 22px #38bdf866; }
[hidden] { display:none !important; }
.bo-game:fullscreen .bo-fs-exit { display:block; }
.bo-game:fullscreen .touch-controls,html.bo-pseudo-fs .touch-controls { flex:none; padding:0; }
@media (pointer:fine) and (min-width:700px) { .touch-controls { display:none; } }
@media (orientation:landscape) {
 .bo-game:fullscreen,html.bo-pseudo-fs .bo-game { grid-template-columns:150px minmax(0,1fr) 150px; grid-template-rows:minmax(0,1fr) auto; }
 .bo-game:fullscreen .bo-info,html.bo-pseudo-fs .bo-info { grid-column:1; grid-row:1; }
 .bo-game:fullscreen .bo-stage,html.bo-pseudo-fs .bo-stage { grid-column:2; grid-row:1 / 3; }
 .bo-game:fullscreen .bo-actions,html.bo-pseudo-fs .bo-actions { grid-column:3; grid-row:1; }
 .bo-game:fullscreen .touch-controls,html.bo-pseudo-fs .touch-controls { grid-column:1 / 4; grid-row:2; justify-content:space-between; pointer-events:none; }
 .bo-game:fullscreen .touch-controls>*,html.bo-pseudo-fs .touch-controls>* { pointer-events:auto; }
 .bo-game:fullscreen .touch-hint,html.bo-pseudo-fs .touch-hint { display:none; }
}
@media (max-width:480px) { .bo-game { padding:10px; } .bo-actions { gap:6px; } .bo-actions .btn { padding:8px 10px; font-size:12px; } }
@media (prefers-reduced-motion:reduce) { #fire { transition:none; } }

/* Thumb controls stay outside the battlefield. */
@media (max-width:480px) {
  .container.bo-page { width:100%; max-width:none; box-sizing:border-box; padding-inline:4px; }
  .bo-game { padding:4px; margin-top:16px; border-radius:6px; }
  .bo-hud { gap:4px; margin-bottom:6px; }
  .bo-combo-line { margin-bottom:4px; }
  #loadout { margin-bottom:6px; min-height:0; }
  .touch-controls { padding:12px 8px 6px; min-height:104px; }
  #joystick { flex-basis:104px; width:104px; height:104px; }
  #joy-stick { top:33px; left:33px; }
  #fire { width:88px; height:88px; font-size:17px; }
  #cycle { width:60px; height:60px; }
  .touch-hint { display:none; }
}
@media (orientation:landscape) {
  .bo-game:fullscreen,html.bo-pseudo-fs .bo-game {
    grid-template-columns:124px minmax(0,1fr) 124px;
    grid-template-rows:minmax(0,1fr) 110px;
    padding:8px max(8px, env(safe-area-inset-right)) 8px max(8px, env(safe-area-inset-left));
  }
  .bo-game:fullscreen .touch-controls,html.bo-pseudo-fs .touch-controls {
    display:contents;
  }
  .bo-game:fullscreen #joystick,html.bo-pseudo-fs #joystick {
    grid-column:1; grid-row:2; justify-self:center; align-self:center;
  }
  .bo-game:fullscreen .touch-fire,html.bo-pseudo-fs .touch-fire {
    grid-column:3; grid-row:2; justify-self:center; align-self:center; gap:6px;
  }
  .bo-game:fullscreen #fire,html.bo-pseudo-fs #fire { width:72px; height:72px; }
  .bo-game:fullscreen #cycle,html.bo-pseudo-fs #cycle { width:46px; height:56px; border-radius:12px; }
}
