:root {
  color-scheme: dark;
  font-family: ui-sans-serif, system-ui, sans-serif;
  color: #eff8f8;
  background: #152a34;
  --accent: #a4efda;
  --border: #698e90;
}

*, *::before, *::after { box-sizing: border-box; }
body { margin: 0; }
.sudoku { max-inline-size: 25rem; margin-inline: auto; padding: 0.75rem 0.8rem 0.4rem; }
.toolbar, .actions { display: flex; align-items: center; flex-wrap: wrap; gap: 0.38rem; }
.toolbar { justify-content: space-between; margin-bottom: 0.48rem; }
.toolbar label, #puzzle-position { color: #c9dde0; font-size: 0.8rem; }
.actions { justify-content: center; }
button, select { min-block-size: 2rem; border: 1px solid #52777d; border-radius: 0.42rem; background: #203c48; color: inherit; font: inherit; }
button { cursor: pointer; }
button:hover, select:hover { border-color: var(--accent); }
button:disabled { opacity: 0.5; cursor: default; }
button:focus-visible, select:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.toolbar button, .toolbar select, .actions button { padding: 0.28rem 0.48rem; font-size: 0.83rem; }
#notes[aria-pressed="true"] { border-color: var(--accent); background: #a4efda; color: #183834; font-weight: 700; }

#grid { display: grid; grid-template-columns: repeat(9, minmax(0, 1fr)); border: 2px solid var(--border); border-radius: 0.36rem; }
.cell { position: relative; display: grid; min-block-size: 0; aspect-ratio: 1; place-items: center; padding: 0; border: 0; border-inline-end: 1px solid #3e5964; border-block-end: 1px solid #3e5964; border-radius: 0; background: #192f3a; color: var(--accent); font-size: clamp(1rem, 4.3vw, 1.35rem); font-weight: 720; touch-action: manipulation; }
.cell:nth-child(3n) { border-inline-end: 2px solid var(--border); }
.cell:nth-child(9n) { border-inline-end: 0; }
.cell:nth-child(n + 19):nth-child(-n + 27), .cell:nth-child(n + 46):nth-child(-n + 54) { border-block-end: 2px solid var(--border); }
.cell:nth-child(n + 73) { border-block-end: 0; }
.cell.given { color: #eef8f8; }
.cell.peer { background: #234552; }
.cell.match { background: #306158; }
.cell.invalid { background: #532e40; color: #ffd4dc; }
.cell[aria-pressed="true"] { z-index: 1; box-shadow: inset 0 0 0 2px var(--accent); }
.cell:focus-visible { z-index: 2; outline-offset: -3px; }
.pencil { display: grid; width: 94%; height: 94%; grid-template: repeat(3, 1fr) / repeat(3, 1fr); align-items: center; color: #d0e7ef; font-size: clamp(0.5rem, 2vw, 0.64rem); line-height: 1; }

#keypad { display: grid; grid-template-columns: repeat(9, minmax(0, 1fr)); gap: 0.24rem; margin-block: 0.48rem 0.38rem; }
#keypad button { min-block-size: 2.25rem; padding: 0; font-weight: 740; }
#status { min-block-size: 1rem; margin: 0.25rem 0 0; color: var(--accent); font-size: 0.82rem; text-align: center; }

@media (max-width: 21rem) {
  .sudoku { padding-inline: 0.45rem; }
  .toolbar { justify-content: flex-start; }
  .toolbar label { margin-inline-end: auto; }
}
