:root {
  --bg: #1c1917;
  --surface: #292524;
  --ink: #fafaf9;
  --muted: #a8a29e;
  --accent: #f59e0b;
  --cell: #44403c;
  --cell-hover: #57534e;
  --revealed: #e7e5e4;
  --danger: #ef4444;
  --ok: #22c55e;
}
* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  font-family: "Segoe UI", system-ui, sans-serif;
  background: radial-gradient(1200px 600px at 50% -10%, #44403c 0%, var(--bg) 55%);
  color: var(--ink);
}
#app { min-height: 100vh; display: grid; place-items: start center; padding: 28px 16px 40px; }
.container { width: min(920px, 100%); }
.header { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 16px; }
h1 { margin: 0; font-size: 1.6rem; letter-spacing: 0.04em; }
.difficulty-selector { display: flex; gap: 8px; flex-wrap: wrap; }
.difficulty-btn, .new-game-btn {
  border: 0; cursor: pointer; color: var(--ink); background: var(--cell);
}
.difficulty-btn {
  border-radius: 999px; padding: 8px 12px; font-weight: 600;
}
.difficulty-btn.active, .difficulty-btn:hover { background: var(--accent); color: #1c1917; }
.game-info {
  display: grid; grid-template-columns: 1fr auto 1fr; align-items: center;
  background: var(--surface); border-radius: 16px; padding: 10px 14px; margin-bottom: 10px;
}
.info-item { display: flex; flex-direction: column; }
.info-item:last-child { align-items: flex-end; }
.info-label { color: var(--muted); font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.08em; }
.info-value { font-variant-numeric: tabular-nums; font-size: 1.4rem; font-weight: 700; }
.new-game-btn { width: 52px; height: 52px; border-radius: 14px; font-size: 1.6rem; }
.best-time { min-height: 1.2em; color: var(--accent); margin: 0 0 10px; font-weight: 600; }
.best-time.hidden, .game-message.hidden { display: none; }
.board-container { overflow: auto; padding-bottom: 8px; }
.board {
  display: grid; gap: 3px; width: max-content; max-width: 100%;
  background: #0c0a09; padding: 8px; border-radius: 16px;
}
.cell {
  width: clamp(22px, 7vw, 36px); height: clamp(22px, 7vw, 36px);
  border: 0; border-radius: 6px; background: var(--cell); color: #1c1917;
  font-weight: 800; font-size: 0.95rem; cursor: pointer; padding: 0;
}
.cell:hover { background: var(--cell-hover); }
.cell:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.cell.revealed { background: var(--revealed); cursor: default; }
.cell.flagged, .cell.mine { background: #78716c; }
.cell.exploded { background: var(--danger); }
.number-1 { color: #2563eb; }
.number-2 { color: #15803d; }
.number-3 { color: #dc2626; }
.number-4 { color: #1d4ed8; }
.number-5 { color: #b45309; }
.number-6 { color: #0f766e; }
.number-7 { color: #111827; }
.number-8 { color: #57534e; }
.game-message {
  margin-top: 12px; background: var(--surface); border-radius: 12px; padding: 10px 14px; font-weight: 700;
}
