/* 方块军棋 · Minecraft 像素风样式 */
:root {
  --ink: #1b1b1b;
  --ink-soft: #343434;
  --stone: #c6c6c6;
  --stone-2: #a8a8a8;
  --stone-3: #8a8a8a;
  --stone-4: #6f6f6f;
  --dirt: #8b5a2b;
  --dirt-dark: #5e3a1a;
  --grass: #6aa84f;
  --grass-dark: #4e7d39;
  --grass-light: #8fd06a;
  --gold: #f2c94c;
  --gold-dark: #b8860b;
  --diamond: #4aedd9;
  --red: #c0504d;
  --red-dark: #8a3a34;
  --red-team: #d94a3d;
  --red-team-light: #ff8a7a;
  --blue-team: #3b6fd4;
  --blue-team-light: #7aa8ff;
  --blue-dark: #274a9a;
  --sky: #8fd0f0;
  --white: #f6f6f6;
  --paper: #f2ead8;
  --shadow: 0 6px 0 rgba(0, 0, 0, .25);
  --font: "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans SC", system-ui, sans-serif;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100dvh;
  font-family: var(--font);
  color: var(--ink);
  background: linear-gradient(#6db9e8 0%, #a9ddf2 55%, #d9efc8 55%, #d9efc8 100%);
  overflow-x: hidden;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}
button, input, select { font: inherit; }
button { color: inherit; }
button:focus-visible, input:focus-visible, select:focus-visible {
  outline: 3px solid var(--gold);
  outline-offset: 2px;
}
.pixel-sprite { image-rendering: pixelated; vertical-align: middle; }
.muted { color: #6a6a6a; font-size: 13px; line-height: 1.55; }
.hidden { display: none !important; }

/* ---------- 世界背景 ---------- */
.world-bg {
  position: fixed;
  inset: 0;
  z-index: -1;
  overflow: hidden;
  background: linear-gradient(#6db9e8 0%, #a9ddf2 55%, #d9efc8 55%, #d9efc8 100%);
  pointer-events: none;
}
.sun {
  position: absolute;
  top: 5%;
  right: 8%;
  width: 84px;
  height: 84px;
  background: #ffe066;
  box-shadow: 0 0 0 10px rgba(255, 224, 102, .28), 0 0 0 20px rgba(255, 224, 102, .12);
}
.cloud {
  position: absolute;
  width: 64px;
  height: 18px;
  background: #fff;
  opacity: .85;
  box-shadow: 16px -16px 0 #fff, 32px 0 0 #fff, 48px -8px 0 #fff;
}
.cloud.c1 { top: 12%; left: -12%; animation: drift 70s linear infinite; }
.cloud.c2 { top: 22%; left: -30%; animation: drift 95s linear infinite; animation-delay: -30s; transform: scale(.75); }
.cloud.c3 { top: 7%; left: -55%; animation: drift 120s linear infinite; animation-delay: -60s; transform: scale(.55); }
@keyframes drift { to { transform: translateX(130vw); } }
.hill {
  position: absolute;
  bottom: 10vh;
  left: 0;
  width: 100%;
  height: 15vh;
  background: linear-gradient(#8bc34a, #6aa84f);
  clip-path: polygon(0 100%, 0 55%, 5% 55%, 5% 40%, 10% 40%, 10% 55%, 18% 55%, 18% 28%, 24% 28%, 24% 55%, 32% 55%, 32% 42%, 40% 42%, 40% 55%, 50% 55%, 50% 30%, 58% 30%, 58% 55%, 66% 55%, 66% 45%, 74% 45%, 74% 55%, 82% 55%, 82% 25%, 90% 25%, 90% 55%, 100% 55%, 100% 100%);
  opacity: .55;
}
.hill.h2 {
  bottom: 8vh;
  height: 11vh;
  background: linear-gradient(#a5d66f, #8bc34a);
  opacity: .5;
  transform: scaleX(-1);
}
.ground {
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 12vh;
  background:
    linear-gradient(#6aa84f 0 10px, #4e7d39 10px 16px, transparent 16px),
    repeating-linear-gradient(90deg, #8b5a2b 0 24px, #7a4a24 24px 48px);
  border-top: 4px solid #3f2a10;
  opacity: .85;
}
.float-block {
  position: absolute;
  width: 34px;
  height: 34px;
  opacity: .8;
  animation: floaty 7s ease-in-out infinite;
  box-shadow: inset 3px 3px 0 rgba(255,255,255,.3), inset -3px -3px 0 rgba(0,0,0,.28);
}
.float-block.fb1 { top: 18%; left: 6%; background: #6aa84f; }
.float-block.fb2 { top: 34%; right: 7%; background: #4aedd9; animation-delay: -2.5s; }
.float-block.fb3 { top: 52%; left: 12%; background: #f2c94c; animation-delay: -4s; }
@keyframes floaty { 0%, 100% { transform: translateY(0) rotate(0); } 50% { transform: translateY(-12px) rotate(6deg); } }

/* ---------- 顶栏 ---------- */
.topbar {
  position: relative;
  z-index: 20;
  max-width: 1180px;
  margin: 0 auto;
  padding: 14px 20px 8px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
body[data-screen="game"] .topbar,
body[data-screen="result"] .topbar { display: none; }
.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  border: 0;
  background: transparent;
  cursor: pointer;
  padding: 4px;
  text-align: left;
}
.brand-icon {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  background: #4a2f1a;
  border: 3px solid var(--ink);
  box-shadow: inset 3px 3px 0 #7a4a24, inset -3px -3px 0 #2b1a0c, 0 4px 0 rgba(0,0,0,.2);
}
.brand-text {
  font-size: 20px;
  font-weight: 900;
  letter-spacing: .5px;
  line-height: 1.05;
  text-shadow: 0 2px 0 rgba(255,255,255,.35);
}
.brand-text small {
  display: block;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 2px;
  color: #3f6b2d;
  text-shadow: none;
}
.top-actions { display: flex; align-items: center; gap: 8px; }
.timer-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 36px;
  padding: 0 10px;
  background: #3b3b3b;
  color: #f6f6f6;
  border: 3px solid var(--ink);
  box-shadow: inset 2px 2px 0 #5d5d5d, inset -2px -2px 0 #232323;
  font-size: 12px;
  font-weight: 800;
  cursor: default;
  white-space: nowrap;
}
.timer-chip .pixel-sprite { width: 16px; height: 16px; }
.timer-chip.warn { background: #8a3a34; color: #fff; animation: warnPulse 1s infinite; }
.timer-chip.small { height: 30px; font-size: 11px; padding: 0 8px; }
@keyframes warnPulse { 50% { box-shadow: inset 2px 2px 0 #d94a3d, inset -2px -2px 0 #4a1a14, 0 0 12px rgba(217,74,61,.8); } }
.icon-btn {
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  background: #c6c6c6;
  border: 3px solid var(--ink);
  box-shadow: inset 2px 2px 0 #fff, inset -2px -2px 0 #8a8a8a, 0 3px 0 rgba(0,0,0,.25);
  cursor: pointer;
  padding: 0;
}
.icon-btn:active { transform: translateY(2px); box-shadow: inset 2px 2px 0 #fff, inset -2px -2px 0 #8a8a8a; }
.icon-btn.off { filter: grayscale(1); opacity: .55; }
.icon-btn .pixel-sprite { width: 20px; height: 20px; }

/* ---------- 通用 ---------- */
main { position: relative; z-index: 2; }
.screen { display: none; max-width: 1180px; margin: 0 auto; padding: 8px 20px 110px; }
.screen.active { display: block; animation: screenIn .18s ease-out; }
@keyframes screenIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.panel {
  background: #3b3b3b;
  color: #eee;
  border: 4px solid var(--ink);
  box-shadow: inset 3px 3px 0 #5d5d5d, inset -3px -3px 0 #232323, var(--shadow);
  padding: 14px;
}
.panel-kicker {
  display: block;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 2px;
  color: #b8b8b8;
  margin-bottom: 6px;
}
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 42px;
  padding: 8px 16px;
  background: #c6c6c6;
  color: var(--ink);
  border: 3px solid var(--ink);
  box-shadow: inset 2px 2px 0 #fff, inset -2px -2px 0 #8a8a8a, 0 4px 0 rgba(0,0,0,.25);
  font-weight: 900;
  font-size: 14px;
  cursor: pointer;
  text-decoration: none;
  transition: transform .08s;
}
.btn:active { transform: translateY(3px); box-shadow: inset 2px 2px 0 #fff, inset -2px -2px 0 #8a8a8a, 0 1px 0 rgba(0,0,0,.25); }
.btn:disabled { opacity: .45; cursor: not-allowed; filter: grayscale(.6); }
.btn.primary {
  background: var(--gold);
  color: #3b2600;
  box-shadow: inset 2px 2px 0 #ffe9a8, inset -2px -2px 0 #b8860b, 0 4px 0 rgba(0,0,0,.25);
}
.btn.green {
  background: var(--grass);
  color: #fff;
  text-shadow: 0 1px 0 #2f5b22;
  box-shadow: inset 2px 2px 0 var(--grass-light), inset -2px -2px 0 var(--grass-dark), 0 4px 0 rgba(0,0,0,.25);
}
.btn.danger {
  background: var(--red);
  color: #fff;
  box-shadow: inset 2px 2px 0 #e0807d, inset -2px -2px 0 var(--red-dark), 0 4px 0 rgba(0,0,0,.25);
}
.btn.ghost { background: #3b3b3b; color: #f6f6f6; box-shadow: inset 2px 2px 0 #5d5d5d, inset -2px -2px 0 #232323, 0 4px 0 rgba(0,0,0,.25); }
.btn.big { min-height: 54px; padding: 12px 26px; font-size: 18px; }
.btn.small { min-height: 34px; padding: 5px 10px; font-size: 12px; }
.btn .pixel-sprite { width: 20px; height: 20px; }

/* ---------- 首页 ---------- */
.home-hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 240px;
  gap: 20px;
  align-items: center;
  padding: 18px 8px 22px;
}
.kicker {
  margin: 0 0 4px;
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 3px;
  color: #2f5b22;
  text-transform: uppercase;
}
.home-hero h1 {
  margin: 0;
  font-size: clamp(38px, 6vw, 68px);
  line-height: .95;
  letter-spacing: 2px;
  color: #fff;
  text-shadow: 0 4px 0 #4e7d39, 0 8px 0 rgba(0,0,0,.18);
}
.hero-sub {
  margin: 10px 0 18px;
  font-size: 15px;
  font-weight: 800;
  color: #2f5b22;
}
.hero-actions { display: flex; flex-wrap: wrap; gap: 10px; }
.hero-mascot {
  display: grid;
  place-items: center;
  min-height: 180px;
  animation: mascotBob 3.2s ease-in-out infinite;
}
.hero-mascot .pixel-sprite { width: 150px; height: 150px; filter: drop-shadow(0 10px 0 rgba(0,0,0,.18)); }
@keyframes mascotBob { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-10px); } }

.home-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 300px;
  gap: 16px;
  align-items: start;
}
.home-side { display: grid; gap: 14px; }
.mode-panel { display: grid; gap: 10px; }
.mode-card {
  display: grid;
  grid-template-columns: 46px minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  padding: 10px 12px;
  background: #2f2f2f;
  border: 3px solid #1b1b1b;
  box-shadow: inset 2px 2px 0 #5d5d5d, inset -2px -2px 0 #1a1a1a;
  color: #eee;
  text-align: left;
  cursor: pointer;
}
.mode-card:hover { background: #3a3a3a; }
.mode-card:active { transform: translateY(2px); }
.mode-icon {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  background: #4a2f1a;
  border: 2px solid #1b1b1b;
  box-shadow: inset 2px 2px 0 #7a4a24, inset -2px -2px 0 #2b1a0c;
}
.mode-icon .pixel-sprite { width: 28px; height: 28px; }
.mode-title { display: block; font-size: 14px; font-weight: 900; }
.mode-desc { display: block; font-size: 11px; color: #b8b8b8; margin-top: 2px; line-height: 1.4; }
.mode-tag {
  font-size: 10px;
  font-weight: 900;
  padding: 3px 7px;
  background: var(--gold);
  color: #3b2600;
  border: 2px solid #1b1b1b;
  white-space: nowrap;
}
.mode-tag.blue { background: var(--blue-team); color: #fff; }
.mode-tag.red { background: var(--red-team); color: #fff; }

.daily-panel { display: grid; gap: 8px; }
.daily-head { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.daily-title { font-size: 15px; font-weight: 900; color: #fff; }
.daily-sub { font-size: 11px; color: #b8b8b8; }
.daily-state {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  font-weight: 800;
  color: var(--gold);
}
.daily-state.done { color: var(--grass-light); }
.daily-seed {
  font-size: 11px;
  color: #b8b8b8;
  background: #2a2a2a;
  border: 2px solid #1a1a1a;
  padding: 5px 8px;
}
.progress-panel { display: grid; gap: 9px; }
.progress-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  font-size: 12px;
  font-weight: 800;
  color: #ddd;
}
.progress-row b { color: var(--gold); font-size: 15px; }
.progress-bar {
  height: 9px;
  background: #1f1f1f;
  border: 2px solid #111;
  box-shadow: inset 1px 1px 0 #000;
  overflow: hidden;
}
.progress-bar i { display: block; height: 100%; background: linear-gradient(90deg, var(--grass), var(--grass-light)); }
.quick-links { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.quick-link {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 8px;
  background: #2f2f2f;
  border: 2px solid #1b1b1b;
  color: #eee;
  font-size: 12px;
  font-weight: 800;
  cursor: pointer;
}
.quick-link .pixel-sprite { width: 20px; height: 20px; }

/* ---------- 冒险地图 ---------- */
.page-head {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  padding: 12px 0 18px;
}
.page-head h2 {
  margin: 0;
  font-size: 28px;
  color: #fff;
  text-shadow: 0 3px 0 #4e7d39, 0 5px 0 rgba(0,0,0,.15);
}
.page-sub { font-size: 12px; font-weight: 800; color: #2f5b22; }
.level-map {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 14px;
}
.level-card {
  position: relative;
  min-height: 170px;
  padding: 14px;
  border: 4px solid var(--ink);
  box-shadow: inset 3px 3px 0 rgba(255,255,255,.25), inset -3px -3px 0 rgba(0,0,0,.3), var(--shadow);
  color: #fff;
  text-align: left;
  cursor: pointer;
  overflow: hidden;
}
.level-card.grass { background: linear-gradient(160deg, #7ec850 0 42%, #8b5a2b 42% 100%); }
.level-card.forest { background: linear-gradient(160deg, #5aa84a 0 42%, #3f6b2d 42% 100%); }
.level-card.desert { background: linear-gradient(160deg, #f3d48a 0 42%, #c9a45a 42% 100%); color: #3b2600; }
.level-card.nether { background: linear-gradient(160deg, #b83a2d 0 42%, #3a1a0a 42% 100%); }
.level-card.end { background: linear-gradient(160deg, #6a4a8a 0 42%, #2a1a3a 42% 100%); }
.level-card.locked { filter: grayscale(.85) brightness(.65); cursor: not-allowed; }
.level-card .lv-num {
  font-size: 38px;
  font-weight: 900;
  line-height: 1;
  text-shadow: 0 3px 0 rgba(0,0,0,.3);
}
.level-card .lv-name { margin-top: 4px; font-size: 17px; font-weight: 900; }
.level-card .lv-desc { margin-top: 4px; font-size: 11px; line-height: 1.4; opacity: .9; max-width: 190px; }
.level-card .lv-stars { position: absolute; top: 12px; right: 12px; display: flex; gap: 2px; }
.level-card .lv-stars .pixel-sprite { width: 16px; height: 16px; }
.level-card .lv-lock { position: absolute; right: 14px; bottom: 14px; }
.level-card .lv-lock .pixel-sprite { width: 26px; height: 26px; }
.level-card .lv-cta {
  display: inline-block;
  margin-top: 10px;
  padding: 4px 9px;
  background: var(--gold);
  color: #3b2600;
  border: 2px solid var(--ink);
  font-size: 11px;
  font-weight: 900;
}

/* ---------- 对局 ---------- */
#screen-game { max-width: 1280px; padding: 8px 12px 20px; }
body[data-screen="game"] { overflow: hidden; }
.game-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 4px 4px 10px;
}
.turn-banner {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 34px;
  padding: 5px 14px;
  background: #3b3b3b;
  color: #fff;
  border: 3px solid var(--ink);
  box-shadow: inset 2px 2px 0 #5d5d5d, inset -2px -2px 0 #232323;
  font-size: 13px;
  font-weight: 900;
}
.turn-banner.red { background: var(--red-team); }
.turn-banner.blue { background: var(--blue-team); }
.turn-banner.thinking { animation: thinkPulse 1.1s infinite; }
@keyframes thinkPulse { 50% { filter: brightness(1.25); } }
.game-top-actions { display: flex; align-items: center; gap: 6px; }

.game-layout {
  display: grid;
  grid-template-columns: 178px auto 178px;
  gap: 16px;
  align-items: start;
  justify-content: center;
}
.player-panel {
  padding: 10px;
  border: 4px solid var(--ink);
  box-shadow: inset 3px 3px 0 rgba(255,255,255,.22), inset -3px -3px 0 rgba(0,0,0,.25), var(--shadow);
  color: #fff;
  min-width: 0;
}
.player-panel.red { background: linear-gradient(160deg, #c0504d, #8a3a34); }
.player-panel.blue { background: linear-gradient(160deg, #3b6fd4, #274a9a); }
.player-panel.active { outline: 4px solid var(--gold); outline-offset: 2px; }
.player-head { display: flex; align-items: center; gap: 8px; }
.player-avatar {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  background: rgba(0,0,0,.22);
  border: 2px solid var(--ink);
  box-shadow: inset 2px 2px 0 rgba(255,255,255,.25);
}
.player-avatar .pixel-sprite { width: 30px; height: 30px; }
.player-name { font-size: 14px; font-weight: 900; line-height: 1.1; }
.player-role { font-size: 10px; opacity: .85; font-weight: 700; }
.player-stats { display: grid; grid-template-columns: 1fr 1fr; gap: 5px; margin-top: 9px; }
.player-stat {
  background: rgba(0,0,0,.22);
  border: 2px solid rgba(0,0,0,.35);
  padding: 4px 5px;
  text-align: center;
}
.player-stat b { display: block; font-size: 16px; line-height: 1.1; }
.player-stat span { font-size: 9px; opacity: .85; }
.player-mines { margin-top: 7px; font-size: 10px; font-weight: 800; }
.mine-dots { display: flex; gap: 3px; margin-top: 3px; }
.mine-dot {
  width: 12px;
  height: 12px;
  background: #3a1a0a;
  border: 2px solid #1a0a05;
  box-shadow: inset 1px 1px 0 #ff7a1a;
}
.mine-dot.gone { background: #222; box-shadow: none; opacity: .35; }
.captured-row {
  display: flex;
  flex-wrap: wrap;
  gap: 2px;
  margin-top: 7px;
  min-height: 16px;
}
.captured-row .pixel-sprite { width: 15px; height: 15px; opacity: .9; }
.player-panel .flag-lock { margin-top: 6px; font-size: 10px; font-weight: 800; color: #ffe9a8; }

.board-stage { display: flex; flex-direction: column; align-items: center; gap: 10px; min-width: 0; }
.board-wrap {
  padding: 8px;
  background: #2b2b2b;
  border: 4px solid var(--ink);
  box-shadow: inset 4px 4px 0 #4a4a4a, inset -4px -4px 0 #141414, 0 10px 0 rgba(0,0,0,.25);
  max-width: 100%;
}
.board {
  --cols: 4;
  --rows: 8;
  --gap: 3px;
  --cell: min(calc((100vw - 424px) / var(--cols)), calc((100dvh - 220px) / var(--rows)), 68px);
  display: grid;
  grid-template-columns: repeat(var(--cols), var(--cell));
  grid-template-rows: repeat(var(--rows), var(--cell));
  gap: var(--gap);
  position: relative;
  touch-action: manipulation;
}
.cell {
  position: relative;
  display: block;
  width: var(--cell);
  height: var(--cell);
  border: 0;
  padding: 0;
  background: #6aa84f;
  box-shadow: inset 2px 2px 0 rgba(255,255,255,.25), inset -2px -2px 0 rgba(0,0,0,.3);
  cursor: pointer;
  overflow: hidden;
  image-rendering: pixelated;
}
.cell:disabled { cursor: default; }
.cell.tile-grass { background: linear-gradient(#8fd06a 0 16%, #6aa84f 16% 48%, #8b5a2b 48% 100%); }
.cell.tile-dirt { background: repeating-linear-gradient(90deg, #8b5a2b 0 8px, #7a4a24 8px 16px); }
.cell.tile-stone { background: repeating-linear-gradient(90deg, #b0b0b0 0 10px, #9a9a9a 10px 20px); }
.cell.tile-cobble { background: repeating-linear-gradient(90deg, #8a8a8a 0 7px, #6f6f6f 7px 14px, #9a9a9a 14px 21px); }
.cell.tile-sand { background: repeating-linear-gradient(90deg, #f3d48a 0 9px, #e6c576 9px 18px); }
.cell.tile-sandstone { background: repeating-linear-gradient(90deg, #d9b96a 0 11px, #c9a45a 11px 22px); }
.cell.tile-mossy { background: repeating-linear-gradient(90deg, #5a8a4a 0 8px, #4e7d39 8px 16px); }
.cell.tile-netherrack { background: repeating-linear-gradient(90deg, #6a2a1a 0 7px, #4a1a0a 7px 14px); }
.cell.tile-magma { background: repeating-linear-gradient(90deg, #4a1a0a 0 9px, #7a2a0a 9px 18px); }
.cell.tile-endstone { background: repeating-linear-gradient(90deg, #d8d8b8 0 10px, #c6c6a8 10px 20px); }
.cell.tile-purpur { background: repeating-linear-gradient(90deg, #6a4a8a 0 9px, #5a3a7a 9px 18px); }
.cell.tile-grass::before, .cell.tile-sand::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image: radial-gradient(rgba(255,255,255,.16) 1px, transparent 1px);
  background-size: 6px 6px;
  pointer-events: none;
}
.cell.frontline { box-shadow: inset 0 -4px 0 #3f2a10, inset 2px 2px 0 rgba(255,255,255,.2); }
.cell.rail-h::after {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  top: 50%;
  height: 7px;
  transform: translateY(-50%);
  background: repeating-linear-gradient(90deg, #d8d8d8 0 6px, #6f6f6f 6px 10px);
  box-shadow: 0 1px 0 #1b1b1b, 0 -1px 0 #1b1b1b;
  opacity: .9;
  z-index: 0;
}
.cell.rail-v::before {
  content: '';
  position: absolute;
  top: 0;
  bottom: 0;
  left: 50%;
  width: 7px;
  transform: translateX(-50%);
  background: repeating-linear-gradient(0deg, #d8d8d8 0 6px, #6f6f6f 6px 10px);
  box-shadow: 1px 0 0 #1b1b1b, -1px 0 0 #1b1b1b;
  opacity: .9;
  z-index: 0;
}
.tile-icon {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  opacity: .45;
  pointer-events: none;
  z-index: 1;
}
.tile-icon .pixel-sprite { width: 60%; height: 60%; }
.cell.sel { box-shadow: inset 0 0 0 4px var(--gold), inset 2px 2px 0 rgba(255,255,255,.3); }
.cell.can-move { box-shadow: inset 0 0 0 3px #7ed957, inset 2px 2px 0 rgba(255,255,255,.25); }
.cell.can-attack { box-shadow: inset 0 0 0 4px #ff6a5a, inset 2px 2px 0 rgba(255,255,255,.25); }
.cell.last-to { box-shadow: inset 0 0 0 3px rgba(242,201,76,.8); }
.cell.invalid { animation: shake .28s; }
@keyframes shake {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-4px); }
  40% { transform: translateX(4px); }
  60% { transform: translateX(-3px); }
  80% { transform: translateX(3px); }
}
.hint-dot {
  position: absolute;
  left: 38%;
  top: 38%;
  width: 24%;
  height: 24%;
  border-radius: 50%;
  background: #7ed957;
  border: 2px solid #2f6b1f;
  box-shadow: 0 0 8px #7ed957;
  z-index: 6;
  pointer-events: none;
  animation: dotPulse .9s infinite;
}
.hint-dot.attack { background: #ff6a5a; border-color: #8a3a34; box-shadow: 0 0 9px #ff6a5a; }
@keyframes dotPulse { 50% { transform: scale(1.2); } }
.lock-icon { position: absolute; right: 2px; bottom: 2px; z-index: 6; pointer-events: none; }
.lock-icon .pixel-sprite { width: 14px; height: 14px; }

/* 棋子 */
.piece {
  position: absolute;
  inset: 3px;
  z-index: 4;
  transform-style: preserve-3d;
  transition: transform .35s ease;
  pointer-events: none;
}
.piece.up { transform: rotateY(180deg); }
.piece .face {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  backface-visibility: hidden;
  border: 3px solid var(--ink);
  box-shadow: inset 2px 2px 0 rgba(255,255,255,.4), inset -2px -2px 0 rgba(0,0,0,.28), 0 3px 0 rgba(0,0,0,.22);
  overflow: hidden;
}
.piece .face.front { transform: rotateY(180deg); }
.piece.team-red .face.front { background: linear-gradient(#fff6f2, #f0d0c8); border-color: var(--red-dark); }
.piece.team-blue .face.front { background: linear-gradient(#f0f6ff, #c8d8f0); border-color: var(--blue-dark); }
.piece.team-red .face.back {
  background: repeating-linear-gradient(45deg, #d94a3d 0 6px, #c04034 6px 12px);
  border-color: #6a1a14;
}
.piece.team-blue .face.back {
  background: repeating-linear-gradient(45deg, #3b6fd4 0 6px, #2f5ab8 6px 12px);
  border-color: #1a2a6a;
}
.piece.team-hidden .face.back {
  background: repeating-linear-gradient(45deg, #8a8a8a 0 6px, #6f6f6f 6px 12px);
  border-color: #3a3a3a;
}
.piece.team-hidden .face.back .team-mini { display: none; }
.piece .face.back::after {
  content: '?';
  font-size: 22px;
  font-weight: 900;
  color: #fff;
  text-shadow: 0 2px 0 rgba(0,0,0,.45);
}
.piece .face.back .team-mini {
  position: absolute;
  bottom: 1px;
  right: 2px;
  opacity: .85;
}
.piece .face.back .team-mini .pixel-sprite { width: 12px; height: 12px; }
.piece .face.front .pixel-sprite { width: 58%; height: 58%; margin-top: 2px; }
.rank-badge {
  position: absolute;
  top: 2px;
  left: 2px;
  min-width: 15px;
  height: 15px;
  padding: 0 2px;
  display: grid;
  place-items: center;
  background: var(--gold);
  color: #3b2600;
  border: 2px solid var(--ink);
  font-size: 10px;
  font-weight: 900;
  line-height: 1;
  z-index: 2;
}
.rank-badge.bomb { background: #d94a3d; color: #fff; }
.rank-badge.mine { background: #6f6f6f; color: #fff; }
.rank-badge.flag { background: #7a3a9a; color: #fff; }
.piece-name {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  text-align: center;
  font-size: 9px;
  font-weight: 900;
  color: #1b1b1b;
  background: rgba(255,255,255,.45);
  line-height: 1.25;
}
.piece.just-flipped { animation: pieceFlip .38s ease-out; }
@keyframes pieceFlip { 0% { transform: rotateY(0); } 100% { transform: rotateY(180deg); } }
.piece.just-moved { animation: piecePop .28s ease-out; }
@keyframes piecePop { 0% { transform: rotateY(180deg) scale(.78); } 70% { transform: rotateY(180deg) scale(1.08); } 100% { transform: rotateY(180deg) scale(1); } }
.piece.just-hit { animation: pieceHit .3s ease-out; }
@keyframes pieceHit { 0%, 100% { transform: rotateY(180deg) translateX(0); } 30% { transform: rotateY(180deg) translateX(-4px); } 60% { transform: rotateY(180deg) translateX(4px); } }

/* 操作栏 */
.action-bar { display: flex; gap: 7px; flex-wrap: wrap; justify-content: center; }
.game-tip {
  min-height: 24px;
  margin-top: 8px;
  text-align: center;
  font-size: 12px;
  font-weight: 800;
  color: #2f5b22;
}
.game-tip .pixel-sprite { width: 18px; height: 18px; vertical-align: -4px; margin-right: 4px; }

/* ---------- 结算 ---------- */
#screen-result { padding-top: 18px; }
.result-card {
  max-width: 560px;
  margin: 0 auto;
  padding: 22px;
  background: #3b3b3b;
  border: 4px solid var(--ink);
  box-shadow: inset 4px 4px 0 #5d5d5d, inset -4px -4px 0 #232323, var(--shadow);
  color: #fff;
  text-align: center;
}
.result-badge { display: grid; place-items: center; margin: 4px 0 8px; }
.result-badge .pixel-sprite { width: 92px; height: 92px; filter: drop-shadow(0 6px 0 rgba(0,0,0,.25)); }
.result-title { font-size: 32px; font-weight: 900; margin: 0 0 4px; text-shadow: 0 3px 0 rgba(0,0,0,.3); }
.result-title.win { color: var(--gold); }
.result-title.lose { color: #ff8a7a; }
.result-sub { font-size: 13px; color: #cfcfcf; margin: 0 0 14px; }
.result-stars { display: flex; justify-content: center; gap: 8px; margin: 10px 0; }
.result-stars .pixel-sprite { width: 38px; height: 38px; }
.result-stars .off { opacity: .25; filter: grayscale(1); }
.result-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin: 14px 0;
}
.result-stat {
  background: #2a2a2a;
  border: 2px solid #1a1a1a;
  padding: 8px 4px;
}
.result-stat b { display: block; font-size: 19px; color: var(--gold); }
.result-stat span { font-size: 10px; color: #b8b8b8; }
.result-lesson {
  display: flex;
  align-items: center;
  gap: 10px;
  text-align: left;
  margin: 12px 0;
  padding: 10px;
  background: #2a2a2a;
  border: 2px solid #1a1a1a;
}
.result-lesson .pixel-sprite { width: 34px; height: 34px; }
.result-lesson b { display: block; font-size: 12px; color: var(--gold); }
.result-lesson span { font-size: 11px; color: #cfcfcf; line-height: 1.45; }
.result-actions { display: flex; gap: 9px; justify-content: center; flex-wrap: wrap; margin-top: 16px; }
.result-rewards { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; margin: 10px 0; }
.reward-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 8px;
  background: #2a2a2a;
  border: 2px solid #1a1a1a;
  font-size: 11px;
  font-weight: 800;
  color: var(--gold);
}
.reward-chip .pixel-sprite { width: 18px; height: 18px; }

/* ---------- 图鉴 ---------- */
.collection-head, .badges-head { padding: 12px 0 14px; }
.collection-head h2, .badges-head h2 {
  margin: 0;
  font-size: 28px;
  color: #fff;
  text-shadow: 0 3px 0 #4e7d39, 0 5px 0 rgba(0,0,0,.15);
}
.collection-head p, .badges-head p { margin: 4px 0 0; font-size: 12px; font-weight: 800; color: #2f5b22; }
.ladder {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-wrap: wrap;
  padding: 10px;
  margin-bottom: 14px;
  background: #3b3b3b;
  border: 3px solid var(--ink);
  box-shadow: inset 2px 2px 0 #5d5d5d, inset -2px -2px 0 #232323;
}
.ladder-item {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 7px;
  background: #2a2a2a;
  border: 2px solid #1a1a1a;
  color: #eee;
  font-size: 11px;
  font-weight: 800;
}
.ladder-item .pixel-sprite { width: 20px; height: 20px; }
.ladder-item b { color: var(--gold); }
.ladder-arrow { color: #8a8a8a; font-size: 12px; font-weight: 900; }
.collection-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 12px;
}
.mob-card {
  position: relative;
  padding: 12px;
  background: #3b3b3b;
  border: 3px solid var(--ink);
  box-shadow: inset 2px 2px 0 #5d5d5d, inset -2px -2px 0 #232323, 0 5px 0 rgba(0,0,0,.22);
  color: #eee;
  text-align: center;
  overflow: hidden;
}
.mob-card.locked { filter: grayscale(1) brightness(.65); }
.mob-card .mob-art {
  height: 78px;
  display: grid;
  place-items: center;
  background: #2a2a2a;
  border: 2px solid #1a1a1a;
  margin-bottom: 8px;
}
.mob-card .mob-art .pixel-sprite { width: 64px; height: 64px; }
.mob-card.locked .mob-art .pixel-sprite { opacity: .35; }
.mob-card .mob-name { font-size: 15px; font-weight: 900; color: #fff; }
.mob-card .mob-rank { margin-top: 3px; font-size: 11px; font-weight: 800; color: var(--gold); }
.mob-card .mob-ability {
  display: inline-block;
  margin-top: 6px;
  padding: 3px 7px;
  background: #2a2a2a;
  border: 2px solid #1a1a1a;
  font-size: 10px;
  font-weight: 800;
  color: var(--diamond);
}
.mob-card .mob-tip { margin-top: 7px; font-size: 10px; line-height: 1.45; color: #b8b8b8; text-align: left; }
.mob-card .mob-count {
  position: absolute;
  top: 8px;
  right: 8px;
  padding: 2px 6px;
  background: #1f1f1f;
  border: 2px solid #111;
  font-size: 10px;
  font-weight: 800;
  color: var(--gold);
}
.mob-card .mob-lock { position: absolute; inset: 0; display: grid; place-items: center; background: rgba(0,0,0,.35); }
.mob-card .mob-lock .pixel-sprite { width: 30px; height: 30px; opacity: .8; }

/* ---------- 成就 ---------- */
.badge-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 12px;
}
.badge-card {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  padding: 12px;
  background: #3b3b3b;
  border: 3px solid var(--ink);
  box-shadow: inset 2px 2px 0 #5d5d5d, inset -2px -2px 0 #232323, 0 5px 0 rgba(0,0,0,.22);
  color: #eee;
}
.badge-card.locked { filter: grayscale(1) brightness(.65); }
.badge-icon {
  flex: 0 0 auto;
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  background: #2a2a2a;
  border: 2px solid #1a1a1a;
}
.badge-icon .pixel-sprite { width: 30px; height: 30px; }
.badge-name { font-size: 13px; font-weight: 900; color: #fff; }
.badge-desc { margin-top: 3px; font-size: 11px; color: #b8b8b8; line-height: 1.45; }
.badge-date { margin-top: 4px; font-size: 10px; color: var(--gold); }

/* ---------- 家长 ---------- */
.parent-card {
  max-width: 680px;
  margin: 0 auto;
  padding: 18px;
  background: #3b3b3b;
  border: 4px solid var(--ink);
  box-shadow: inset 3px 3px 0 #5d5d5d, inset -3px -3px 0 #232323, var(--shadow);
  color: #eee;
}
.parent-card h2 { margin: 0 0 4px; font-size: 24px; color: #fff; }
.parent-card .parent-sub { margin: 0 0 14px; font-size: 12px; color: #b8b8b8; }
.parent-section {
  margin-top: 14px;
  padding-top: 12px;
  border-top: 2px solid #2a2a2a;
}
.parent-section h3 { margin: 0 0 8px; font-size: 13px; color: var(--gold); letter-spacing: 1px; }
.setting-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 7px 0;
  font-size: 12px;
  font-weight: 800;
}
.setting-row .seg-group { display: flex; flex-wrap: wrap; gap: 4px; justify-content: flex-end; }
.seg {
  min-height: 30px;
  padding: 4px 8px;
  background: #2a2a2a;
  color: #ddd;
  border: 2px solid #1a1a1a;
  font-size: 11px;
  font-weight: 800;
  cursor: pointer;
}
.seg.active { background: var(--gold); color: #3b2600; border-color: var(--ink); box-shadow: inset 2px 2px 0 #ffe9a8; }
.parent-note {
  margin-top: 10px;
  padding: 9px;
  background: #2a2a2a;
  border: 2px solid #1a1a1a;
  font-size: 11px;
  line-height: 1.55;
  color: #b8b8b8;
}
.parent-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.parent-stat { background: #2a2a2a; border: 2px solid #1a1a1a; padding: 8px; text-align: center; }
.parent-stat b { display: block; font-size: 18px; color: var(--gold); }
.parent-stat span { font-size: 10px; color: #b8b8b8; }
.parent-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 12px; }
.gate-box { max-width: 420px; margin: 30px auto; text-align: center; }
.gate-box .gate-icon { margin: 0 auto 10px; width: 64px; height: 64px; display: grid; place-items: center; background: #2a2a2a; border: 3px solid #1a1a1a; }
.gate-box .gate-icon .pixel-sprite { width: 42px; height: 42px; }
.gate-problem {
  margin: 14px 0;
  padding: 12px;
  background: #2a2a2a;
  border: 2px solid #1a1a1a;
  font-size: 20px;
  font-weight: 900;
  color: var(--gold);
  letter-spacing: 1px;
}
.gate-input {
  width: 100%;
  height: 46px;
  padding: 0 12px;
  background: #f2ead8;
  border: 3px solid var(--ink);
  box-shadow: inset 2px 2px 0 #fff, inset -2px -2px 0 #c9bb9a;
  font-size: 20px;
  font-weight: 900;
  text-align: center;
  color: var(--ink);
}
.gate-error { min-height: 18px; margin-top: 6px; font-size: 11px; font-weight: 800; color: #ff8a7a; }

/* ---------- 弹窗 ---------- */
.modal-layer {
  position: fixed;
  inset: 0;
  z-index: 240;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(0,0,0,.55);
  backdrop-filter: blur(2px);
}
.modal {
  width: min(520px, 100%);
  max-height: 88dvh;
  overflow: auto;
  background: #f2ead8;
  border: 4px solid var(--ink);
  box-shadow: inset 3px 3px 0 #fff, inset -3px -3px 0 #c9bb9a, 0 12px 0 rgba(0,0,0,.3);
  padding: 18px;
  color: var(--ink);
}
.modal h3 { margin: 0 0 6px; font-size: 20px; font-weight: 900; }
.modal p { margin: 0 0 10px; font-size: 13px; line-height: 1.55; color: #3a3a3a; }
.modal-actions { display: flex; gap: 8px; justify-content: flex-end; flex-wrap: wrap; margin-top: 14px; }
.modal-close { float: right; border: 0; background: transparent; font-size: 22px; font-weight: 900; cursor: pointer; line-height: 1; }
.setup-grid { display: grid; gap: 10px; margin: 10px 0; }
.setup-label { font-size: 11px; font-weight: 900; letter-spacing: 1px; color: #6a6a6a; }
.setup-opts { display: flex; flex-wrap: wrap; gap: 6px; }
.setup-opt {
  padding: 7px 10px;
  background: #e0d6bd;
  border: 2px solid var(--ink);
  box-shadow: inset 2px 2px 0 #fff, inset -2px -2px 0 #b8a888;
  font-size: 12px;
  font-weight: 800;
  cursor: pointer;
}
.setup-opt.active { background: var(--gold); color: #3b2600; box-shadow: inset 2px 2px 0 #ffe9a8, inset -2px -2px 0 #b8860b; }
.rule-list { margin: 8px 0 0; padding-left: 18px; font-size: 12px; line-height: 1.65; color: #3a3a3a; }
.rule-list li { margin-bottom: 3px; }
.rule-example { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin: 8px 0; }
.rule-chip { display: inline-flex; align-items: center; gap: 4px; padding: 3px 6px; background: #e0d6bd; border: 2px solid var(--ink); font-size: 11px; font-weight: 800; }
.rule-chip .pixel-sprite { width: 18px; height: 18px; }

/* ---------- Toast / 粒子 ---------- */
.toast-layer {
  position: fixed;
  left: 50%;
  bottom: 86px;
  transform: translateX(-50%);
  z-index: 160;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  pointer-events: none;
  width: min(90vw, 420px);
}
.toast {
  display: flex;
  align-items: center;
  gap: 7px;
  max-width: 100%;
  padding: 8px 13px;
  background: #2b2b2b;
  color: #fff;
  border: 3px solid var(--ink);
  box-shadow: inset 2px 2px 0 #5d5d5d, 0 5px 0 rgba(0,0,0,.3);
  font-size: 12px;
  font-weight: 800;
  animation: toastIn .2s ease-out;
}
.toast .pixel-sprite { width: 20px; height: 20px; }
@keyframes toastIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
#fxCanvas { position: fixed; inset: 0; z-index: 150; pointer-events: none; width: 100%; height: 100%; }

/* ---------- 休息层 ---------- */
.rest-layer {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: grid;
  place-items: center;
  background: #050505;
  color: #eee;
  overflow: hidden;
}
.rest-layer.pause-mode { background: rgba(5, 8, 12, .82); backdrop-filter: blur(4px); }
.rest-stars {
  position: absolute;
  inset: 0;
  background-image: radial-gradient(#fff 1px, transparent 1px), radial-gradient(#aaa 1px, transparent 1px);
  background-size: 90px 90px, 140px 140px;
  background-position: 0 0, 40px 60px;
  opacity: .35;
  animation: starShift 30s linear infinite;
}
@keyframes starShift { to { background-position: 90px 90px, 180px 200px; } }
.rest-moon {
  position: absolute;
  top: 12%;
  right: 16%;
  width: 70px;
  height: 70px;
  border-radius: 50%;
  background: #e8e8f0;
  box-shadow: 0 0 40px rgba(232,232,240,.45);
}
.rest-inner { position: relative; z-index: 2; text-align: center; padding: 20px; }
.rest-creeper { animation: restBob 3.4s ease-in-out infinite; }
.rest-creeper .pixel-sprite { width: 120px; height: 120px; filter: drop-shadow(0 8px 0 rgba(0,0,0,.4)); }
@keyframes restBob { 0%, 100% { transform: translateY(0) rotate(-2deg); } 50% { transform: translateY(-8px) rotate(2deg); } }
.rest-title { margin: 10px 0 4px; font-size: 26px; font-weight: 900; color: #fff; }
.rest-sub { margin: 0 0 14px; font-size: 13px; color: #b8b8b8; }
.rest-countdown {
  display: inline-block;
  min-width: 150px;
  padding: 10px 18px;
  background: #111;
  border: 3px solid #333;
  box-shadow: inset 2px 2px 0 #222;
  font-size: 34px;
  font-weight: 900;
  color: var(--gold);
  letter-spacing: 3px;
}
.rest-z {
  position: absolute;
  top: 34%;
  left: 58%;
  font-size: 20px;
  font-weight: 900;
  color: #c6c6c6;
  animation: zFloat 2.6s ease-in-out infinite;
}
@keyframes zFloat { 0% { opacity: 0; transform: translate(0, 0) scale(.8); } 40% { opacity: 1; } 100% { opacity: 0; transform: translate(14px, -26px) scale(1.15); } }
.rest-unlock {
  position: absolute;
  right: 14px;
  bottom: 14px;
  z-index: 3;
  border: 1px solid #333;
  background: rgba(255,255,255,.04);
  color: #8a8a8a;
  font-size: 11px;
  font-weight: 800;
  cursor: pointer;
  padding: 8px 10px;
}
.rest-unlock:hover { color: #bbb; border-color: #555; }
body.resting { overflow: hidden; }
.rest-pause-card {
  max-width: 420px;
  padding: 20px;
  background: #2b2b2b;
  border: 4px solid var(--ink);
  box-shadow: inset 3px 3px 0 #5d5d5d, 0 10px 0 rgba(0,0,0,.35);
}
.rest-pause-card .rest-creeper .pixel-sprite { width: 84px; height: 84px; }

/* ---------- 底部导航 ---------- */
.bottom-nav {
  position: fixed;
  left: 50%;
  bottom: 12px;
  transform: translateX(-50%);
  z-index: 80;
  display: flex;
  gap: 4px;
  padding: 5px;
  background: #3b3b3b;
  border: 4px solid var(--ink);
  box-shadow: inset 3px 3px 0 #5d5d5d, inset -3px -3px 0 #232323, 0 8px 0 rgba(0,0,0,.25);
  width: min(560px, calc(100vw - 24px));
}
.bottom-nav button {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1px;
  padding: 6px 2px;
  border: 0;
  background: transparent;
  color: #b8b8b8;
  font-size: 10px;
  font-weight: 800;
  cursor: pointer;
}
.bottom-nav button .nav-ico { font-size: 18px; line-height: 1; }
.bottom-nav button.active { background: #2a2a2a; color: var(--gold); box-shadow: inset 0 0 0 2px #1a1a1a; }
body[data-screen="game"] .bottom-nav,
body[data-screen="result"] .bottom-nav { display: none; }

/* ---------- 响应式 ---------- */
@media (max-width: 980px) and (orientation: portrait) {
  .home-grid { grid-template-columns: 1fr; }
  .home-side { grid-template-columns: 1fr 1fr; }
  .game-layout { grid-template-columns: 1fr; gap: 8px; }
  .player-panel { display: flex; align-items: center; gap: 10px; padding: 7px 9px; }
  .player-panel.red { order: -1; }
  .player-panel.blue { order: 2; }
  .player-head { flex: 0 0 auto; }
  .player-stats { flex: 1; display: flex; gap: 4px; margin: 0; }
  .player-stat { flex: 1; padding: 3px; }
  .player-stat b { font-size: 14px; }
  .player-mines { margin: 0; flex: 0 0 auto; }
  .captured-row { display: none; }
  .player-panel .flag-lock { display: none; }
  .board-stage { order: 1; }
  .board { --cell: min(calc((100vw - 36px) / var(--cols)), calc((100dvh - 344px) / var(--rows)), 72px); }
  .piece .face.front .pixel-sprite { width: 54%; height: 54%; }
  .piece-name { display: none; }
  .piece .face.back::after { font-size: 18px; }
  .rank-badge { min-width: 13px; height: 13px; font-size: 9px; border-width: 1px; }
}
@media (max-width: 620px) {
  .screen { padding-left: 12px; padding-right: 12px; padding-bottom: 100px; }
  #screen-game { padding-left: 8px; padding-right: 8px; padding-top: 4px; }
  .game-top { gap: 6px; padding: 2px 2px 6px; }
  .game-top .btn.small { padding: 0 7px; font-size: 11px; white-space: nowrap; }
  .turn-banner { min-height: 30px; padding: 4px 8px; font-size: 12px; gap: 5px; white-space: nowrap; }
  .game-top-actions { gap: 4px; }
  .game-top .timer-chip.small { height: 28px; padding: 0 6px; font-size: 10px; }
  .game-top .timer-chip .pixel-sprite { width: 13px; height: 13px; }
  .board { --cell: min(calc((100vw - 32px) / var(--cols)), calc((100dvh - 305px) / var(--rows)), 62px); }
  .game-layout { gap: 6px; }
  .board-stage { gap: 7px; }
  .game-tip { margin-top: 5px; min-height: 20px; }
  .home-hero { grid-template-columns: 1fr; text-align: center; padding-top: 8px; }
  .hero-mascot { min-height: 120px; order: -1; }
  .hero-mascot .pixel-sprite { width: 104px; height: 104px; }
  .hero-actions { justify-content: center; }
  .home-side { grid-template-columns: 1fr; }
  .mode-card { grid-template-columns: 40px minmax(0, 1fr) auto; }
  .page-head h2 { font-size: 23px; }
  .level-map { grid-template-columns: 1fr; }
  .result-title { font-size: 26px; }
  .result-grid { grid-template-columns: repeat(3, 1fr); }
  .collection-grid { grid-template-columns: 1fr 1fr; }
  .badge-grid { grid-template-columns: 1fr; }
  .parent-stats { grid-template-columns: 1fr 1fr; }
  .setting-row { flex-direction: column; align-items: flex-start; gap: 5px; }
  .setting-row .seg-group { justify-content: flex-start; }
  .toast-layer { bottom: 78px; }
  .rest-title { font-size: 22px; }
  .rest-countdown { font-size: 28px; }
}
@media (max-width: 380px) {
  .board { --cell: min(calc((100vw - 28px) / var(--cols)), calc((100dvh - 305px) / var(--rows)), 56px); --gap: 2px; }
  .collection-grid { grid-template-columns: 1fr; }
}
@media (max-width: 480px) {
  .topbar { padding: 10px 10px 4px; gap: 8px; }
  .brand { gap: 6px; }
  .brand-icon { width: 34px; height: 34px; border-width: 2px; }
  .brand-icon .pixel-sprite { width: 22px; height: 22px; }
  .brand-text { font-size: 14px; }
  .brand-text small { display: none; }
  .top-actions { gap: 5px; }
  .timer-chip { height: 32px; font-size: 11px; padding: 0 7px; border-width: 2px; }
  .icon-btn { width: 32px; height: 32px; border-width: 2px; }
  .icon-btn .pixel-sprite { width: 18px; height: 18px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; }
}

/* ---------- 补充：回合图标 / 验证键盘 ---------- */
.turn-banner .pixel-sprite { width: 16px; height: 16px; }
.gate-input {
  display: grid;
  place-items: center;
  min-height: 48px;
  line-height: 1.2;
  letter-spacing: 2px;
}
.gate-keypad {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  margin-top: 12px;
}
.gate-key {
  min-height: 44px;
  padding: 6px;
  background: #e0d6bd;
  border: 3px solid var(--ink);
  box-shadow: inset 2px 2px 0 #fff, inset -2px -2px 0 #b8a888, 0 3px 0 rgba(0,0,0,.2);
  font-size: 18px;
  font-weight: 900;
  cursor: pointer;
}
.gate-key:active { transform: translateY(2px); box-shadow: inset 2px 2px 0 #fff, inset -2px -2px 0 #b8a888; }
.gate-key.clear { background: #c6c6c6; font-size: 13px; }
.gate-key.ok { background: var(--grass); color: #fff; font-size: 14px; text-shadow: 0 1px 0 #2f5b22; }
.gate-box.shake { animation: shake .3s; }
.mode-card.resume { border-color: var(--gold); }

/* 修复 hidden 属性被 display:grid 覆盖 */
[hidden] { display: none !important; }

/* ---------- 标准陆战棋棋盘（12 行 + 界河） ---------- */
.board {
  --cell: min(calc((100vw - 430px) / var(--cols)), calc((100dvh - 196px) / var(--rows)), 72px);
}
.river {
  position: relative;
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: var(--gap);
  background: linear-gradient(180deg, #2f7fbf, #1f5f9a 50%, #2f7fbf);
  border-top: 2px solid #173f66;
  border-bottom: 2px solid #173f66;
  overflow: hidden;
  z-index: 0;
  box-shadow: inset 0 4px 0 rgba(255,255,255,.12), inset 0 -4px 0 rgba(0,0,0,.25);
}
.river::before {
  content: '';
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(90deg, rgba(255,255,255,.14) 0 10px, transparent 10px 22px);
  opacity: .55;
  pointer-events: none;
}
.river-label {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  font-size: clamp(9px, 1.2vw, 15px);
  font-weight: 900;
  letter-spacing: 8px;
  color: rgba(255,255,255,.5);
  text-shadow: 0 2px 0 rgba(0,0,0,.25);
  pointer-events: none;
  z-index: 2;
}
.river-slot {
  position: relative;
  display: grid;
  place-items: center;
  z-index: 1;
}
.bridge {
  display: block;
  width: 8px;
  height: 100%;
  background: repeating-linear-gradient(0deg, #d8d8d8 0 6px, #6f6f6f 6px 10px);
  box-shadow: 1px 0 0 #1b1b1b, -1px 0 0 #1b1b1b;
}
.mountain {
  display: block;
  width: 68%;
  height: 68%;
  background: linear-gradient(#8f8f8f, #5f5f5f);
  box-shadow: inset 2px 2px 0 rgba(255,255,255,.25), inset -2px -2px 0 rgba(0,0,0,.35), 0 2px 0 rgba(0,0,0,.25);
}
.cell.deploying { cursor: pointer; }
.cell.deploying.camp { box-shadow: inset 0 0 0 2px rgba(242,201,76,.45); }
.cell.deploying.hq { box-shadow: inset 0 0 0 3px rgba(242,201,76,.8); }
.board[data-mode="standard"] .piece-name { font-size: 8px; }
.board[data-mode="standard"] .piece .face { border-width: 2px; }
.board[data-mode="standard"] .rank-badge { min-width: 13px; height: 13px; font-size: 9px; border-width: 1px; }
.board[data-mode="standard"] .piece .face.front .pixel-sprite { width: 62%; height: 62%; }
@media (max-width: 980px) {
  .board {
    --cell: min(calc((100vw - 24px) / var(--cols)), calc((100dvh - 176px) / var(--rows)), 64px);
  }
}

/* ============================================================
   标准陆战棋棋盘重制：按真实军棋比例排版
   ============================================================ */
/* 对局时把背景装饰压暗，避免和顶部按钮、棋盘抢视觉 */
body[data-screen="game"] .sun,
body[data-screen="game"] .float-block { opacity: .28; }
body[data-screen="game"] .world-bg { filter: brightness(.94) saturate(.9); }
#screen-game {
  --board-h: min(94vh, calc(100dvh - 40px));
  --board-w: calc(var(--board-h) * 0.859375); /* 5 列 × 12 行 + 界河的自然比例 */
  position: fixed;
  inset: 0;
  max-width: none;
  margin: 0;
  padding: 0;
  overflow: hidden;
  background: transparent;
}
#screen-game .game-layout {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: clamp(10px, 2.2vw, 46px);
  padding: 0 1.5vw;
  pointer-events: none;
}
#screen-game .player-column {
  flex: 0 0 auto;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 8px;
  width: clamp(116px, 14vw, 200px);
  pointer-events: auto;
}
/* 右侧没有操作按钮，用等高的留白把蓝方面板抬到和红方面板同一高度 */
#screen-game .player-column.right {
  padding-bottom: 110px; /* 8px 间距 + 3 个 30px 按钮 + 2 个 6px 按钮间距 */
}
#screen-game .board-stage {
  position: relative;
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: auto;
}
#screen-game .board-wrap {
  width: calc(var(--board-w) + 14px);
  height: calc(var(--board-h) + 14px);
  padding: 7px;
  box-sizing: border-box;
  background: linear-gradient(160deg, #6a4626 0%, #4a2e16 48%, #2f1c0c 100%);
  border: 4px solid #1b1b1b;
  border-radius: 4px;
  box-shadow:
    inset 3px 3px 0 #8a6238,
    inset -3px -3px 0 #24150a,
    0 10px 0 rgba(0,0,0,.28);
  max-width: none;
  flex: 0 0 auto;
}
#screen-game .board {
  position: relative;
  display: block;
  width: var(--board-w);
  height: var(--board-h);
  background:
    radial-gradient(circle at 50% 0%, rgba(255,255,255,.22), transparent 58%),
    repeating-linear-gradient(0deg, rgba(120,90,40,.045) 0 2px, transparent 2px 5px),
    linear-gradient(180deg, #f0e4c6 0%, #e5d2a8 55%, #d8c294 100%);
  border-radius: 2px;
  box-shadow:
    inset 0 0 0 2px rgba(120,90,40,.22),
    inset 0 0 34px rgba(110,75,30,.16);
  overflow: hidden;
  touch-action: manipulation;
}
#screen-game .board-lines {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 2;
  pointer-events: none;
  overflow: visible;
}
#screen-game .board-lines line {
  vector-effect: non-scaling-stroke;
  stroke-linecap: round;
}
#screen-game .road {
  stroke: #7a5a2a;
  stroke-width: 1.5px;
  opacity: .62;
}
#screen-game .camp-diag {
  stroke: #9a7a3a;
  stroke-width: 1.1px;
  opacity: .5;
  stroke-dasharray: 3px 3px;
}
#screen-game .rail-base {
  stroke: #3f6b3a;
  stroke-width: 6px;
  opacity: .82;
}
#screen-game .rail-tie {
  stroke: #f2e6c8;
  stroke-width: 2px;
  opacity: .95;
  stroke-dasharray: 5px 5px;
  stroke-linecap: butt;
}

/* 界河 */
#screen-game .river-band {
  position: absolute;
  left: 0;
  width: 100%;
  z-index: 1;
  pointer-events: none;
  background: linear-gradient(180deg,
    rgba(90,160,210,.16) 0%,
    rgba(40,110,170,.30) 50%,
    rgba(90,160,210,.16) 100%);
  border-top: 1px solid rgba(30,90,140,.22);
  border-bottom: 1px solid rgba(30,90,140,.22);
}
#screen-game .river-label {
  position: absolute;
  left: 0;
  width: 100%;
  display: grid;
  place-items: center;
  z-index: 3;
  pointer-events: none;
  font-size: clamp(9px, 1vw, 15px);
  font-weight: 900;
  letter-spacing: 9px;
  color: rgba(30,80,120,.48);
  text-shadow: 0 1px 0 rgba(255,255,255,.55);
}
#screen-game .bridge {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 2.4%;
  transform: translateX(-50%);
  background: repeating-linear-gradient(90deg,
    rgba(120,80,40,.52) 0 4px,
    rgba(80,50,20,.52) 4px 8px);
  opacity: .55;
}
#screen-game .mountain {
  position: absolute;
  top: 8%;
  bottom: 8%;
  width: 5.5%;
  transform: translateX(-50%);
  background: linear-gradient(180deg, #a8aeb6, #5a6068);
  clip-path: polygon(50% 0, 100% 100%, 0 100%);
  opacity: .55;
}

/* 行营 / 大本营标记 */
#screen-game .camp-marker {
  position: absolute;
  width: 8%;
  aspect-ratio: 1 / 1;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  background: radial-gradient(circle at 35% 28%, #e0f0fa 0%, #b4d0e4 58%, #7e9eb8 100%);
  border: 2px solid #4a6a8a;
  box-shadow:
    inset 2px 2px 0 rgba(255,255,255,.55),
    inset -2px -2px 0 rgba(0,0,0,.18),
    0 2px 0 rgba(0,0,0,.14);
  display: grid;
  place-items: center;
  z-index: 3;
  pointer-events: none;
}
#screen-game .camp-marker i {
  font-style: normal;
  font-size: clamp(6px, .68vw, 12px);
  font-weight: 900;
  letter-spacing: 1px;
  color: rgba(30,70,100,.58);
}
#screen-game .hq-marker {
  position: absolute;
  width: 18%;
  height: 7.4%;
  transform: translate(-50%, -50%);
  border: 2px solid rgba(160,110,30,.78);
  border-radius: 4px;
  background: rgba(242,201,76,.10);
  box-shadow:
    inset 0 0 0 1px rgba(255,255,255,.35),
    0 0 0 1px rgba(120,80,20,.18);
  display: grid;
  place-items: center;
  z-index: 3;
  pointer-events: none;
}
#screen-game .hq-marker i {
  font-style: normal;
  font-size: clamp(6px, .66vw, 12px);
  font-weight: 900;
  letter-spacing: 1px;
  color: rgba(120,80,20,.62);
}

/* 棋位：不再是一个个方块，只有点击热区 */
#screen-game .cell {
  position: absolute;
  width: 18%;
  height: 6.6%;
  transform: translate(-50%, -50%);
  border: 0;
  padding: 0;
  background: transparent;
  box-shadow: none;
  cursor: pointer;
  overflow: visible;
  z-index: 4;
  touch-action: manipulation;
  image-rendering: pixelated;
}
#screen-game .cell:disabled { cursor: default; }
/* 走棋动画的临时棋子：沿棋盘路径滑动 */
#screen-game .move-ghost {
  position: absolute;
  width: 18%;
  height: 6.6%;
  transform: translate(-50%, -50%);
  z-index: 9;
  pointer-events: none;
  will-change: left, top;
}
#screen-game .cell.sel,
#screen-game .cell.can-move,
#screen-game .cell.can-attack,
#screen-game .cell.last-to,
#screen-game .cell.frontline,
#screen-game .cell.deploying.camp,
#screen-game .cell.deploying.hq { box-shadow: none; }

/* 棋子：长方形，头像左、名称中、军衔右 */
#screen-game .piece {
  position: absolute;
  left: 50%;
  top: 50%;
  height: 86%;
  aspect-ratio: 2.2 / 1;
  width: auto;
  transform: translate(-50%, -50%);
  transform-style: preserve-3d;
  transition: transform .35s ease;
  pointer-events: none;
  z-index: 5;
}
#screen-game .piece.up { transform: translate(-50%, -50%) rotateY(180deg); }
#screen-game .piece .face {
  position: absolute;
  inset: 0;
  display: block;
  padding: 0;
  backface-visibility: hidden;
  border: 2px solid var(--ink);
  border-radius: 4px;
  box-shadow:
    inset 2px 2px 0 rgba(255,255,255,.42),
    inset -2px -2px 0 rgba(0,0,0,.26),
    0 2px 0 rgba(0,0,0,.22);
  overflow: hidden;
}
#screen-game .piece .face.front {
  transform: rotateY(180deg);
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: center;
  gap: 6%;
  padding: 0 5%;
}
#screen-game .piece.team-red .face.front {
  background: linear-gradient(180deg, #e06050 0%, #c04034 58%, #a83028 100%);
  border-color: #6a1a14;
}
#screen-game .piece.team-blue .face.front {
  background: linear-gradient(180deg, #5a8ae0 0%, #2f5ab8 58%, #244a9a 100%);
  border-color: #1a2a6a;
}
#screen-game .piece.team-red .face.back {
  background: repeating-linear-gradient(45deg, #c04034 0 6px, #a83028 6px 12px);
  border-color: #6a1a14;
}
#screen-game .piece.team-blue .face.back {
  background: repeating-linear-gradient(45deg, #2f5ab8 0 6px, #244a9a 6px 12px);
  border-color: #1a2a6a;
}
#screen-game .piece .face.back {
  padding: 0;
}
#screen-game .piece .face.back::after { content: none; }
#screen-game .piece .team-mini {
  position: absolute;
  right: 2px;
  bottom: 0;
  opacity: .8;
}
#screen-game .piece .team-mini .pixel-sprite { width: 10px; height: 10px; }
#screen-game .piece .piece-avatar {
  position: static;
  flex: 0 0 auto;
  width: 26%;
  height: 84%;
  display: grid;
  place-items: center;
  z-index: 1;
}
#screen-game .piece .piece-avatar .pixel-sprite {
  width: 100%;
  height: 100%;
  max-width: 42px;
  max-height: 42px;
  margin: 0;
}
#screen-game .piece .piece-name {
  position: static;
  flex: 0 1 auto;
  min-width: 0;
  padding: 0;
  text-align: center;
  font-size: clamp(9px, .92vw, 18px);
  font-weight: 900;
  line-height: 1;
  color: #fff;
  text-shadow: 0 1px 0 rgba(0,0,0,.35);
  white-space: nowrap;
  overflow: hidden;
  background: transparent;
  z-index: 2;
  pointer-events: none;
}
#screen-game .rank-badge {
  position: static;
  flex: 0 0 auto;
  min-width: 20%;
  height: 68%;
  padding: 0 2px;
  display: grid;
  place-items: center;
  background: var(--gold);
  color: #3b2600;
  border: 2px solid var(--ink);
  border-radius: 3px;
  font-size: clamp(10px, 1.05vw, 20px);
  font-weight: 900;
  line-height: 1;
  z-index: 2;
  box-shadow: inset 1px 1px 0 rgba(255,255,255,.55);
}
#screen-game .rank-badge.bomb { background: #e05a4a; color: #fff; }
#screen-game .rank-badge.mine { background: #7a7a7a; color: #fff; }
#screen-game .rank-badge.flag { background: #8a4aba; color: #fff; }

/* 选中 / 可走 / 可攻击 / 上一步 */
/* 注意：不要给 .piece 加 filter，filter 会压平 3D 变换，导致棋子翻回背面 */
#screen-game .cell.sel::after {
  content: '';
  position: absolute;
  left: 50%;
  top: 50%;
  width: 82%;
  height: 92%;
  transform: translate(-50%, -50%);
  border: 2px solid #f2c94c;
  border-radius: 6px;
  box-shadow: 0 0 10px rgba(242,201,76,.9), inset 0 0 8px rgba(242,201,76,.45);
  z-index: 6;
  pointer-events: none;
}
#screen-game .cell.last-to::before {
  content: '';
  position: absolute;
  left: 50%;
  top: 50%;
  width: 82%;
  height: 92%;
  transform: translate(-50%, -50%);
  border: 2px solid rgba(242,201,76,.85);
  border-radius: 6px;
  box-shadow: 0 0 8px rgba(242,201,76,.5);
  z-index: 6;
  pointer-events: none;
}
#screen-game .cell.can-move::after {
  content: '';
  position: absolute;
  left: 50%;
  top: 50%;
  width: clamp(8px, 1.05vw, 14px);
  aspect-ratio: 1 / 1;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  background: #7ed957;
  border: 2px solid #2f6b1f;
  box-shadow: 0 0 8px #7ed957;
  z-index: 6;
  pointer-events: none;
  animation: boardDotPulse .9s infinite;
}
#screen-game .cell.can-attack::after {
  content: '';
  position: absolute;
  left: 50%;
  top: 50%;
  width: 102%;
  height: 112%;
  transform: translate(-50%, -50%);
  border: 2px solid #ff6a5a;
  border-radius: 6px;
  box-shadow: 0 0 9px rgba(255,106,90,.65);
  z-index: 6;
  pointer-events: none;
}

@keyframes boardDotPulse {
  0%, 100% { transform: translate(-50%, -50%) scale(1); }
  50% { transform: translate(-50%, -50%) scale(1.2); }
}
#screen-game .hint-dot {
  left: 50%;
  top: 50%;
  width: clamp(8px, 1.05vw, 14px);
  height: auto;
  aspect-ratio: 1 / 1;
  transform: translate(-50%, -50%);
  z-index: 7;
  animation: boardHintPulse .9s infinite;
}
@keyframes boardHintPulse {
  0%, 100% { transform: translate(-50%, -50%) scale(1); }
  50% { transform: translate(-50%, -50%) scale(1.2); }
}
#screen-game .cell.invalid { animation: boardShake .28s; }
@keyframes boardShake {
  0%, 100% { transform: translate(-50%, -50%) translateX(0); }
  20% { transform: translate(-50%, -50%) translateX(-4px); }
  40% { transform: translate(-50%, -50%) translateX(4px); }
  60% { transform: translate(-50%, -50%) translateX(-3px); }
  80% { transform: translate(-50%, -50%) translateX(3px); }
}
@keyframes piecePop {
  0% { transform: translate(-50%, -50%) rotateY(180deg) scale(.78); }
  70% { transform: translate(-50%, -50%) rotateY(180deg) scale(1.08); }
  100% { transform: translate(-50%, -50%) rotateY(180deg) scale(1); }
}
@keyframes pieceHit {
  0%, 100% { transform: translate(-50%, -50%) rotateY(180deg) translateX(0); }
  30% { transform: translate(-50%, -50%) rotateY(180deg) translateX(-4px); }
  60% { transform: translate(-50%, -50%) rotateY(180deg) translateX(4px); }
}

/* 顶部状态条：浮在棋盘外，不占棋盘高度 */
#screen-game .game-top {
  position: absolute;
  top: 1vh;
  left: 50%;
  transform: translateX(-50%);
  width: min(96vw, 1180px);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 0;
  z-index: 31;
  pointer-events: none;
}
#screen-game .game-top > * { pointer-events: auto; }
#screen-game .turn-banner {
  min-height: clamp(26px, 3.4vh, 34px);
  padding: 3px 12px;
  font-size: clamp(11px, 1vw, 13px);
  white-space: nowrap;
}
#screen-game .game-top-actions { gap: 6px; }

/* 左右玩家面板：放在棋盘两侧，不再挤占棋盘 */
#screen-game .player-panel {
  flex: 0 0 auto;
  width: 100%;
  padding: 8px;
  border-width: 3px;
  pointer-events: auto;
}
#screen-game .player-panel.red {
  background: linear-gradient(160deg, rgba(150,50,45,.95), rgba(90,25,22,.97));
}
#screen-game .player-panel.blue {
  background: linear-gradient(160deg, rgba(45,80,160,.95), rgba(25,45,105,.97));
}
#screen-game .player-panel.active { outline-width: 3px; outline-offset: 1px; }
#screen-game .player-head { gap: 6px; min-width: 0; }
#screen-game .player-head > div { min-width: 0; }
#screen-game .player-name,
#screen-game .player-role { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#screen-game .player-avatar { width: 34px; height: 34px; }
#screen-game .player-avatar .pixel-sprite { width: 26px; height: 26px; }
#screen-game .player-name { font-size: clamp(11px, 1vw, 14px); }
#screen-game .player-role { font-size: 9px; }
#screen-game .player-stats { gap: 4px; margin-top: 6px; }
#screen-game .player-stat { padding: 3px; }
#screen-game .player-stat b { font-size: clamp(13px, 1.2vw, 18px); }
#screen-game .player-stat span { font-size: 8px; }
#screen-game .player-mines { margin-top: 5px; font-size: 9px; }
#screen-game .player-panel .flag-lock { margin-top: 4px; font-size: 9px; }
#screen-game .captured-row { margin-top: 5px; gap: 2px; height: 16px; flex-wrap: nowrap; overflow: hidden; }

/* 棋盘中央气泡：回合提示和文字提示都只短暂出现 */
#screen-game .bubble-layer {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 0 4%;
  z-index: 22;
  pointer-events: none;
}
#screen-game .game-bubble {
  max-width: 92%;
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 8px 16px;
  background: rgba(30, 30, 30, .92);
  color: #fff;
  border: 3px solid var(--ink);
  border-radius: 6px;
  box-shadow:
    inset 2px 2px 0 rgba(255,255,255,.18),
    inset -2px -2px 0 rgba(0,0,0,.35),
    0 5px 0 rgba(0,0,0,.25);
  font-weight: 900;
  line-height: 1.25;
  text-align: center;
  white-space: normal;
  opacity: 0;
  transform: translateY(6px) scale(.94);
}
#screen-game .game-bubble[hidden] { display: none; }
#screen-game .game-bubble.show {
  animation: bubblePop .26s ease-out forwards;
}
@keyframes bubblePop {
  0% { opacity: 0; transform: translateY(8px) scale(.9); }
  60% { opacity: 1; transform: translateY(-1px) scale(1.03); }
  100% { opacity: 1; transform: translateY(0) scale(1); }
}
#screen-game .game-bubble .pixel-sprite {
  width: 18px;
  height: 18px;
  flex: 0 0 auto;
}
/* 回合提示只作为一行小字，加一层白底避免直接浮在棋盘上 */
#screen-game .game-bubble.turn {
  font-size: clamp(11px, .92vw, 15px);
  font-weight: 700;
  padding: 3px 10px;
  gap: 4px;
  background: rgba(255,255,255,.92);
  border: 0;
  border-radius: 999px;
  box-shadow: 0 2px 0 rgba(0,0,0,.10);
  color: #1b1b1b;
  text-shadow: none;
}
#screen-game .game-bubble.turn .pixel-sprite {
  width: 14px;
  height: 14px;
}
#screen-game .game-bubble.turn.red {
  background: rgba(255,255,255,.92);
  border-color: transparent;
  color: #a83228;
}
#screen-game .game-bubble.turn.blue {
  background: rgba(255,255,255,.92);
  border-color: transparent;
  color: #244a9a;
}
#screen-game .game-bubble.tip {
  max-width: 96%;
  background: rgba(255, 255, 255, .94);
  color: #2f4b22;
  border-color: rgba(27, 27, 27, .55);
  box-shadow:
    inset 2px 2px 0 rgba(255,255,255,.7),
    0 4px 0 rgba(0,0,0,.16);
  font-size: clamp(9px, min(.92vw, 1.55vh), 15px);
  padding: 5px 12px;
  gap: 5px;
  white-space: nowrap;
}
#screen-game .game-bubble.tip .turn-prefix {
  font-weight: 900;
  white-space: nowrap;
}
#screen-game .game-bubble.tip .turn-prefix.red { color: #a83228; }
#screen-game .game-bubble.tip .turn-prefix.blue { color: #244a9a; }
#screen-game .game-bubble.tip .tip-divider {
  color: rgba(27, 27, 27, .38);
  font-weight: 700;
}
#screen-game .game-bubble.tip .pixel-sprite {
  width: 16px;
  height: 16px;
}

/* 左侧状态栏下方的操作按钮 */
#screen-game .action-bar {
  position: static;
  transform: none;
  display: flex;
  flex-direction: column;
  gap: 6px;
  width: 100%;
  z-index: auto;
  pointer-events: auto;
}
#screen-game .action-bar .btn.small {
  width: 100%;
  min-height: 30px;
  padding: 0 8px;
  font-size: 11px;
  white-space: nowrap;
  justify-content: center;
}
#screen-game .game-tip { display: none !important; }

@media (max-height: 600px) {
  #screen-game .game-tip { display: none; }
  #screen-game .player-panel { width: clamp(104px, 13vw, 150px); padding: 6px; }
  #screen-game .player-avatar { width: 28px; height: 28px; }
  #screen-game .player-avatar .pixel-sprite { width: 22px; height: 22px; }
  #screen-game .player-stats { margin-top: 4px; }
  #screen-game .player-mines { margin-top: 3px; }
}

/* ---------- 全屏按钮 ---------- */
[data-fullscreen] { touch-action: manipulation; }
[data-fullscreen] .fs-enter,
[data-fullscreen] .fs-exit {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.2;
  stroke-linecap: round;
  stroke-linejoin: round;
  pointer-events: none;
}
[data-fullscreen] .fs-exit { display: none; }
[data-fullscreen].is-fs .fs-enter { display: none; }
[data-fullscreen].is-fs .fs-exit { display: block; }
