A digit that clashes with another in its row, column or box turns its cell red, and so does the one it clashes with.
```js
// Does the digit at (r, c) clash with another cell in its row, column or box?
function conflict(r, c) {
const d = grid[r][c]
if (d === 0) return false
grid[r][c] = 0
const ok = canPlace(grid, r, c, d)
grid[r][c] = d
return !ok
}
if (conflict(r, c)) fill = '#fecaca'
```
What it means
An empty cell never clashes.
The cell is emptied for a moment so canPlace only sees the others, then its digit is put back.
The red rule comes last, so a mistake always shows, even on the selected cell.
Your turn
Above enter, write the comment and conflict.
In draw, write the red rule as the last color rule.