/* ========== 扫雷 Minesweeper ========== */

.ms-page { max-width: 760px; }

.difficulty-bar {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}

.difficulty-bar button.active {
  background: linear-gradient(120deg, var(--accent), var(--accent-2));
  border: none;
  color: #2a1f05;
  font-weight: 700;
}

.ms-panel {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px 14px;
  max-width: 380px;
  margin: 0 auto 6px;
}

.ms-counter {
  font-family: "Cascadia Mono", Consolas, "Courier New", monospace;
  font-size: 1.6rem;
  font-weight: 700;
  color: #ff5252;
  background: #100d0a;
  border-radius: 8px;
  padding: 2px 10px;
  min-width: 76px;
  text-align: center;
  letter-spacing: .05em;
}

.face-btn {
  font-size: 1.6rem;
  line-height: 1;
  padding: 6px 12px;
  border-radius: 10px;
}

.ms-best {
  text-align: center;
  color: var(--text-dim);
  font-size: .82rem;
  min-height: 1.3em;
  margin-bottom: 10px;
}

.ms-board-wrap {
  overflow: auto;
  max-width: 100%;
  padding-bottom: 6px;
}

.ms-board {
  display: grid;
  gap: 3px;
  width: max-content;
  margin: 0 auto;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px;
  touch-action: manipulation;
  user-select: none;
}

.ms-cell {
  width: var(--ms-cell, 30px);
  height: var(--ms-cell, 30px);
  display: grid;
  place-items: center;
  border: none;
  border-radius: 5px;
  background: linear-gradient(145deg, #4a4234, #3a3327);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .12);
  font-size: calc(var(--ms-cell, 30px) * .5);
  font-weight: 800;
  font-family: system-ui, sans-serif;
  cursor: pointer;
  padding: 0;
  line-height: 1;
}

.ms-cell:hover:not(.revealed):not(.flagged) {
  background: linear-gradient(145deg, #574e3d, #453d2e);
}

.ms-cell.revealed {
  background: #211c15;
  box-shadow: inset 0 1px 3px rgba(0, 0, 0, .5);
  cursor: default;
}

.ms-cell.mine-hit { background: #b3362b; }

.ms-cell.flagged { font-size: calc(var(--ms-cell, 30px) * .48); }

.ms-cell.wrong-flag { background: #5c2f2a; }

.ms-cell[data-n="1"] { color: #64b5f6; }
.ms-cell[data-n="2"] { color: #81c784; }
.ms-cell[data-n="3"] { color: #e57373; }
.ms-cell[data-n="4"] { color: #ba68c8; }
.ms-cell[data-n="5"] { color: #ffb74d; }
.ms-cell[data-n="6"] { color: #4db6ac; }
.ms-cell[data-n="7"] { color: #f06292; }
.ms-cell[data-n="8"] { color: #aaa; }

.ms-footer {
  margin-top: 14px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.ms-footer .game-hint { text-align: center; margin: 0; }

/* 手机上缩小格子，让初级/中级一屏放下、高级尽量少滚动 */
@media (max-width: 640px) {
  :root { --ms-cell: 24px; }
  .ms-board { gap: 2px; padding: 8px; }
}

@media (max-width: 420px) {
  :root { --ms-cell: 21px; }
}

/* 棋盘超出屏幕时的滑动提示条 */
.ms-scroll-hint {
  text-align: center;
  color: var(--accent);
  font-size: .85rem;
  margin-bottom: 8px;
}
