/* The field: raised squares still to dig, flat ones dug. As big as fits
   without pushing the buttons off a short screen. */
.board {
  --cols: 9;
  --rows: 9;
  display: grid;
  grid-template-columns: repeat(var(--cols), minmax(0, 1fr));
  grid-template-rows: repeat(var(--rows), minmax(0, 1fr));
  gap: 3px;
  width: min(100%, max(240px, calc((100dvh - 330px) * var(--cols) / var(--rows))));
  aspect-ratio: var(--cols) / var(--rows);
  margin: 0 auto;
  padding: 6px;
  border: 2px solid var(--line-strong);
  border-radius: var(--radius);
  background: var(--surface);
  container-type: inline-size;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
}

.cell {
  display: grid;
  place-items: center;
  min-width: 0;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 5px;
  background: color-mix(in srgb, var(--line-strong) 45%, var(--surface-2));
  box-shadow: inset 0 -3px 0 rgba(0, 0, 0, 0.22), inset 0 2px 0 rgba(255, 255, 255, 0.14);
  color: var(--text);
  font: inherit;
  font-size: calc((100cqw - 12px) / var(--cols) * 0.56);
  font-weight: 800;
  line-height: 1;
  cursor: pointer;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}
.cell.open { background: transparent; box-shadow: none; cursor: default; }
.cell.open.n { cursor: pointer; }
.cell.boom { background: var(--error-bg); box-shadow: none; }
.cell.flag, .cell.mine { font-size: calc((100cqw - 12px) / var(--cols) * 0.5); }
.cell.n1 { color: var(--b); }
.cell.n2 { color: var(--ok); }
.cell.n3 { color: var(--error); }
.cell.n4 { color: var(--a); }
.cell.flash { animation: flash 0.9s ease; }
.cell.clue { box-shadow: inset 0 0 0 2px var(--focus); }
.cell:focus-visible { outline: 3px solid var(--focus); outline-offset: 1px; position: relative; }
.board.solved .cell { animation: pop 0.45s ease both; animation-delay: calc(var(--wave) * 25ms); }
@media (hover: hover) {
  .cell:not(.open, .boom):hover { filter: brightness(1.12); }
}

.left { color: var(--text); font-variant-numeric: tabular-nums; }
#mode[aria-pressed="true"] { background: var(--hint); border-color: var(--focus); }
[data-theme="fun"] #mode[aria-pressed="true"] { background: var(--a); color: var(--ink); }
