/* Minesweeper's cells. The board is the bordered range starting at A1;
   cells outside it are ordinary empty cells. */

:root {
  --n1: #1d5fbf;
  --n2: #1e7a3c;
  --n3: #c42b1c;
  --n4: #3a2a9c;
  --n5: #8a2b0e;
  --n6: #0f7c80;
  --n7: #1b1b1b;
  --n8: #6b6b6b;
}
[data-theme='dark'] {
  --n1: #7fb2ff;
  --n2: #7ed99a;
  --n3: #ff8a80;
  --n4: #b9a8ff;
  --n5: #ffb38a;
  --n6: #6fd8dc;
  --n7: #f0f0f0;
  --n8: #a8a8a8;
}

/* Columns 25% wider than the default sheet's (phones keep the default 36px). */
#sheet { --s-cell: 40px; }
[data-os='phone'] #sheet { --s-cell: 36px; }

.sheet-grid td { position: relative; font-size: 13px; cursor: cell; }
.sheet-grid td.b { background: var(--w-bg); }
/* Hidden cells: plain with a "-" by default; shaded with Shading on */
.sheet-grid td.h { color: var(--w-muted); }
.shaded .sheet-grid td.h { background: var(--s-shade); }
.shaded .sheet-grid td.h:hover { background: var(--s-shade-hover); }
.shaded.playing .sheet-grid td.h:active { background: var(--w-bg); }

/* the board's outer edge */
.sheet-grid td.et { border-top: 1px solid var(--w-muted); }
.sheet-grid td.el { border-left: 1px solid var(--w-muted); }
.sheet-grid td.er { border-right: 1px solid var(--w-muted); }
.sheet-grid td.eb { border-bottom: 1px solid var(--w-muted); }

.sheet-grid td.n0 { color: var(--w-muted); }
.sheet-grid td.n1 { color: var(--n1); }
.sheet-grid td.n2 { color: var(--n2); }
.sheet-grid td.n3 { color: var(--n3); }
.sheet-grid td.n4 { color: var(--n4); }
.sheet-grid td.n5 { color: var(--n5); }
.sheet-grid td.n6 { color: var(--n6); }
.sheet-grid td.n7 { color: var(--n7); }
.sheet-grid td.n8 { color: var(--n8); }

/* flag: a comment marker in the cell's corner */
.sheet-grid td.f::after {
  content: '';
  position: absolute;
  top: 0;
  right: 0;
  border-style: solid;
  border-width: 0 11px 11px 0;
  border-color: transparent var(--s-bad) transparent transparent;
}

/* after a loss */
.sheet-grid td.mine,
.sheet-grid td.wrong { color: var(--s-bad); font-size: 9.5px; font-weight: 600; letter-spacing: -0.2px; }
.sheet-grid td.mine { background: var(--w-bg); }
.sheet-grid td.boom { background: color-mix(in srgb, var(--s-bad) 22%, var(--w-bg)); }

/* the selected cell */
.sheet-grid td.sel { box-shadow: inset 0 0 0 2px var(--s-accent); }

/* Custom size dialog */
.ms-custom .kg-dialog { display: flex; flex-direction: column; width: min(340px, 100%); font-family: var(--ui); }
.ms-custom-body { display: grid; gap: 12px; padding: 16px 18px 8px; }
.ms-custom-body label { display: grid; grid-template-columns: 1fr 88px; align-items: center; column-gap: 12px; font-size: 13.5px; font-weight: 600; }
.ms-custom-body label span { grid-row: 2; color: var(--w-muted); font-size: 12px; font-weight: 400; }
.ms-custom-body input {
  grid-row: 1 / span 2;
  grid-column: 2;
  height: 30px;
  padding: 0 8px;
  border: 1px solid var(--w-btn-border);
  border-radius: 4px;
  background: var(--w-bg);
  color: var(--w-fg);
  font: inherit;
  font-weight: 400;
  font-variant-numeric: tabular-nums;
}
.ms-custom-body input:focus { outline: 2px solid var(--s-accent); outline-offset: -1px; }
.ms-custom-range { margin-top: 2px; color: var(--w-muted); font-size: 12px; }
.ms-custom-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 10px 18px 16px; }
[data-os='phone'] .ms-custom-foot .kg-btn { width: auto; flex: 1; }
