:root {
  --bg: #f6f7fb;
  --panel: #ffffff;
  --text: #111827;
  --muted: #6b7280;
  --border: #e5e7eb;
  --board-bg: #c9c9c9;
  --cell: #e6e6e6;
  --cell-revealed: #cfcfcf;
  --accent: #2563eb;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0b0f14;
    --panel: #111827;
    --text: #e5e7eb;
    --muted: #9ca3af;
    --border: #1f2937;
    --board-bg: #1f2937;
    --cell: #374151;
    --cell-revealed: #2a3342;
    --accent: #60a5fa;
  }
}
* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  display: flex;
  justify-content: center;
  padding: 24px;
}
.app {
  width: 100%;
  max-width: 720px;
}
header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
}
.status {
  display: flex;
  gap: 16px;
  align-items: center;
  font-weight: 600;
}
button {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 12px;
  cursor: pointer;
  font-weight: 600;
}
button:hover { border-color: var(--accent); }
select {
  background: var(--panel);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 6px 8px;
}
.board-wrap {
  display: flex;
  justify-content: center;
}
.board {
  display: grid;
  gap: 2px;
  background: var(--board-bg);
  padding: 4px;
  border-radius: 8px;
  user-select: none;
}
.cell {
  width: 32px;
  height: 32px;
  background: var(--cell);
  border: 2px outset #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 16px;
  cursor: pointer;
}
.cell.revealed {
  background: var(--cell-revealed);
  border-style: inset;
  cursor: default;
}
.cell.flagged::after { content: '🚩'; }
.cell.mine::after { content: '💣'; color: #dc2626; }
.n1 { color: #2563eb; }
.n2 { color: #16a34a; }
.n3 { color: #dc2626; }
.n4 { color: #7c3aed; }
.n5 { color: #b91c1c; }
.n6 { color: #0891b2; }
.n7 { color: #000; }
.n8 { color: #374151; }
footer {
  margin-top: 12px;
  text-align: center;
  color: var(--muted);
  font-size: 12px;
}
@media (max-width: 600px) {
  .cell { width: 28px; height: 28px; font-size: 14px; }
}
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}
