/* =========================================================
   扫雷 · 独立样式（不依赖主页 style.css，可直接移植）
   配色与主站一致，改 --accent 等变量即可换主题
   ========================================================= */

:root {
  --bg-1: #eef7ff;
  --bg-2: #d9ecfb;
  --card: #ffffff;
  --ink: #1d3a52;
  --ink-soft: #5a7d99;
  --accent: #2f9bd8;
  --accent-2: #57c2f5;
  --border: #cfe6f7;
  --radius: 16px;
  --shadow: 0 6px 20px rgba(47, 155, 216, 0.14);
  --shadow-hover: 0 10px 28px rgba(47, 155, 216, 0.24);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: "PingFang SC", "Microsoft YaHei", "Segoe UI", system-ui, -apple-system, sans-serif;
  background: linear-gradient(160deg, var(--bg-1), var(--bg-2));
  color: var(--ink);
  min-height: 100vh;
  line-height: 1.6;
}

a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; }

/* ===== 按钮 ===== */
.btn {
  border: none;
  border-radius: 10px;
  padding: 7px 14px;
  font-size: 13px;
  background: #e3eef7;
  color: var(--ink);
  transition: transform .12s ease, background .2s ease;
}
.btn:active { transform: scale(.96); }
.btn-primary { background: linear-gradient(135deg, var(--accent), var(--accent-2)); color: #fff; }
.btn-primary:hover { filter: brightness(1.06); }

/* ===== 游戏页通用 ===== */
.game-page { max-width: 900px; margin: 0 auto; padding: 20px 16px 48px; }
.game-header { display: flex; align-items: center; gap: 16px; margin-bottom: 18px; }
.back-link { color: var(--accent); font-size: 14px; }
.back-link:hover { text-decoration: underline; }
.game-title { font-size: 26px; }
.game-panel {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 18px;
}
.game-score { text-align: center; font-size: 14px; color: var(--ink-soft); margin-bottom: 12px; }
.board-wrap { display: flex; justify-content: center; }

/* ===== 扫雷 ===== */
.ms-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin-bottom: 10px;
  font-size: 13px;
  color: var(--ink-soft);
}
.ms-controls input {
  width: 56px;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 5px 6px;
  font-size: 13px;
  text-align: center;
  outline: none;
}
.ms-controls input:focus { border-color: var(--accent); }
.ms-presets {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  margin-bottom: 12px;
}
.ms-presets .btn { font-size: 12px; padding: 5px 12px; }
#ms-flag-toggle.active {
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #fff;
  border-color: transparent;
}
.ms-hud {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 16px;
  font-size: 14px;
  font-weight: 700;
  color: var(--ink);
  margin-bottom: 14px;
}
.ms-wrap {
  display: block;
  overflow-x: auto;
  padding: 4px 0 8px;
}
.ms-board {
  display: grid;
  gap: 2px;
  margin: 0 auto;
  width: max-content;
  touch-action: manipulation;
}
.ms-cell {
  width: var(--cell, 34px);
  height: var(--cell, 34px);
  border: none;
  border-radius: 5px;
  padding: 0;
  background: #d6ecfb;
  color: #1d3a52;
  font-size: 15px;
  font-weight: 800;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
  transition: background .1s;
}
.ms-cell:hover { background: #c3e2f7; }
.ms-cell.revealed {
  background: #f4faff;
  cursor: default;
  font-size: 14px;
}
.ms-cell.flagged { background: #ffe9c9; }
.ms-cell.mine { background: #ffd6d6; }
.ms-cell.n1 { color: #1e6fd9; }
.ms-cell.n2 { color: #1a8a3a; }
.ms-cell.n3 { color: #d23b3b; }
.ms-cell.n4 { color: #6a2fa0; }
.ms-cell.n5 { color: #a0522d; }
.ms-cell.n6 { color: #0f8a8a; }
.ms-cell.n7 { color: #333; }
.ms-cell.n8 { color: #777; }

/* ===== 响应式（手机） ===== */
@media (max-width: 640px) {
  .game-page { padding: 16px 10px 40px; }
  .game-panel { padding: 12px; }
  .game-title { font-size: 22px; }
}
