/* 数独练习 v1.0.0 */
* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }
html, body { height: 100%; }
body {
  font-family: -apple-system, "PingFang SC", "Microsoft YaHei", sans-serif;
  background: #f4f6fb;
  color: #1f2937;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}
.hidden { display: none !important; }
.page { flex: 1; width: 100%; max-width: 520px; margin: 0 auto; padding: 20px 16px 12px; }

/* ---------- 首页 ---------- */
.hero { text-align: center; padding: 26px 0 18px; }
.hero-icon { font-size: 54px; line-height: 1; }
.hero h1 { font-size: 28px; margin-top: 10px; color: #312e81; }
.hero-sub { font-size: 14px; color: #6b7280; margin-top: 6px; }
.sec-title { font-size: 16px; color: #374151; margin: 18px 0 10px; }
.mode-list { display: flex; flex-direction: column; gap: 10px; }
.mode-card {
  display: flex; align-items: center; gap: 12px;
  background: #fff; border: 1px solid #e5e7eb; border-radius: 14px;
  padding: 14px 16px; cursor: pointer; transition: transform .12s, box-shadow .12s;
  text-align: left; width: 100%; font-family: inherit;
}
.mode-card:active { transform: scale(.98); }
.mode-card:hover { box-shadow: 0 6px 18px rgba(99,102,241,.14); }
.mode-emoji { font-size: 30px; }
.mode-info { flex: 1; }
.mode-name { font-size: 16px; font-weight: 600; color: #111827; }
.mode-desc { font-size: 12.5px; color: #6b7280; margin-top: 2px; }
.mode-stat { font-size: 12px; color: #9ca3af; white-space: nowrap; }
.tip-list { background: #eef2ff; border-radius: 14px; padding: 14px 16px 14px 32px; }
.tip-list li { font-size: 13.5px; color: #4b5563; line-height: 1.9; }

/* ---------- 游戏页 ---------- */
.game-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.game-title { font-size: 16px; font-weight: 700; color: #312e81; }
.ghost-btn {
  background: #fff; border: 1px solid #e5e7eb; border-radius: 10px;
  padding: 7px 12px; font-size: 13px; color: #4b5563; cursor: pointer; font-family: inherit;
}
.game-meta {
  display: flex; justify-content: space-between; gap: 8px;
  margin: 10px 0 12px; font-size: 13.5px; color: #4b5563;
}
.board-wrap { position: relative; margin: 0 auto; width: min(100%, 420px); }
.board {
  display: grid; gap: 0;
  background: #6366f1; border: 2px solid #6366f1; border-radius: 10px;
  overflow: hidden; width: 100%;
  touch-action: manipulation;
}
.cell {
  background: #fff; position: relative;
  display: flex; align-items: center; justify-content: center;
  font-weight: 600; color: #1d4ed8; user-select: none; cursor: pointer;
}
.cell.given { background: #eef2ff; color: #111827; font-weight: 700; }
.cell.sel { background: #c7d2fe; }
.cell.peer { background: #e0e7ff; }
.cell.same { background: #a5b4fc; }
.cell.err { color: #dc2626; }
.cell.err::after {
  content: ""; position: absolute; inset: 0;
  border: 2px solid #fca5a5; pointer-events: none;
}
/* 宫分隔线：细 1px 由 grid gap 呈现，宫粗 2px 用 border */
.cell.br { border-right: 2px solid #6366f1; }
.cell.bb { border-bottom: 2px solid #6366f1; }
.notes {
  position: absolute; inset: 1px;
  display: grid; grid-template-columns: repeat(3, 1fr); grid-template-rows: repeat(3, 1fr);
  pointer-events: none;
}
.notes span {
  display: flex; align-items: center; justify-content: center;
  font-size: 8px; color: #64748b; font-weight: 500; line-height: 1;
}
.board6 .cell { font-size: clamp(18px, 5.4vw, 26px); }
.board9 .cell { font-size: clamp(15px, 4.2vw, 22px); }
.board-mask {
  position: absolute; inset: 0; border-radius: 10px;
  background: rgba(30, 27, 75, .55);
  display: flex; align-items: center; justify-content: center;
}
.mask-card { text-align: center; color: #fff; }
.mask-emoji { font-size: 40px; }
.mask-title { font-size: 17px; margin: 8px 0 14px; }

/* ---------- 数字键盘 ---------- */
.numpad {
  display: flex; justify-content: center; gap: 6px;
  margin: 14px auto 4px; width: min(100%, 420px);
}
.num-btn {
  flex: 1; aspect-ratio: 1; max-width: 46px;
  background: #fff; border: 1px solid #d1d5db; border-radius: 10px;
  font-size: 19px; font-weight: 700; color: #1d4ed8; cursor: pointer; font-family: inherit;
  position: relative;
}
.num-btn:active { background: #eef2ff; }
.num-btn.done { color: #cbd5e1; }
.num-btn .cnt {
  position: absolute; bottom: 2px; left: 0; right: 0;
  font-size: 9px; color: #94a3b8; font-weight: 400;
}
.tool-row {
  display: flex; gap: 8px; justify-content: center;
  margin-top: 10px; width: min(100%, 420px); margin-left: auto; margin-right: auto;
}
.tool-btn {
  flex: 1; background: #fff; border: 1px solid #e5e7eb; border-radius: 10px;
  padding: 9px 4px; font-size: 12.5px; color: #374151; cursor: pointer; font-family: inherit;
}
.tool-btn.on { background: #eef2ff; border-color: #6366f1; color: #4338ca; font-weight: 600; }

/* ---------- 弹窗 ---------- */
.modal-mask {
  position: fixed; inset: 0; z-index: 9999;
  background: rgba(15, 23, 42, .6);
  display: flex; align-items: center; justify-content: center; padding: 20px;
}
.modal-card {
  background: #fff; border-radius: 18px; max-width: 340px; width: 100%;
  padding: 28px 24px; text-align: center;
}
.win-emoji { font-size: 44px; }
.modal-card h3 { font-size: 20px; color: #111827; margin: 10px 0 6px; }
.modal-card p { font-size: 14px; color: #6b7280; line-height: 1.7; }
.modal-btns { display: flex; flex-direction: column; gap: 8px; margin-top: 18px; }
.primary-btn, .secondary-btn {
  display: block; width: 100%; padding: 12px; border-radius: 12px;
  font-size: 15px; font-weight: 600; cursor: pointer; font-family: inherit;
  text-decoration: none; border: 0; text-align: center; box-sizing: border-box;
}
.primary-btn { background: #6366f1; color: #fff; }
.secondary-btn { background: #f3f4f6; color: #374151; }

/* ---------- 页脚 ---------- */
.footer {
  text-align: center; padding: 16px 12px 22px;
  font-size: 12px; color: #9ca3af;
}
.footer a { color: #6b7280; text-decoration: none; }
.footer .dot { margin: 0 6px; }

@media (min-width: 521px) {
  .board6 .cell { font-size: 28px; }
  .board9 .cell { font-size: 24px; }
}
