* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  font-family: system-ui, sans-serif;
  background: #f1f5f9;
  color: #0f172a;
  text-align: center;
}

:focus-visible {
  outline: 2px solid #1d4ed8;
  outline-offset: 1px;
}

.hud {
  width: 100%;
  padding: 0.75rem;
  background: #0f172a;
  color: #f8fafc;
}

.hud h1 {
  margin: 0;
  font-size: 1.25rem;
}

.hud__score {
  margin: 0.25rem 0 0;
  font-size: 1rem;
  font-variant-numeric: tabular-nums;
}

main {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.6rem;
  padding: 1rem;
}

.grid {
  display: grid;
  grid-template-columns: repeat(9, minmax(26px, 34px));
  gap: 0;
  border: 2px solid #0f172a;
  border-radius: 4px;
  overflow: hidden;
  background: #cbd5e1;
}

.cell {
  aspect-ratio: 1;
  padding: 0;
  border: 0;
  border-right: 1px solid #cbd5e1;
  border-bottom: 1px solid #cbd5e1;
  background: #fff;
  color: #0f172a;
  font: inherit;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  touch-action: manipulation;
  font-variant-numeric: tabular-nums;
}

.cell:nth-child(3n) {
  border-right: 1px solid #0f172a;
}

.cell:nth-child(n+19):nth-child(-n+27),
.cell:nth-child(n+46):nth-child(-n+54) {
  border-bottom: 1px solid #0f172a;
}

.cell.given {
  background: #e2e8f0;
  color: #334155;
  cursor: default;
}

.cell.selected {
  background: #bfdbfe;
}

.cell.same {
  background: #dbeafe;
}

.cell.error {
  background: #fecaca;
  color: #b91c1c;
}

.cell:disabled {
  cursor: default;
}

.status {
  min-height: 1.5rem;
  margin: 0;
  font-weight: 600;
}

.pad {
  display: grid;
  grid-template-columns: repeat(9, minmax(26px, 34px));
  gap: 4px;
}

.pad__btn {
  aspect-ratio: 1;
  padding: 0;
  border: 0;
  border-radius: 6px;
  background: #0f172a;
  color: #f8fafc;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
  touch-action: manipulation;
}

.pad__btn:hover {
  background: #1e293b;
}

.controls {
  display: flex;
  gap: 0.75rem;
}

.button {
  padding: 0.5rem 1.25rem;
  border: 0;
  border-radius: 8px;
  background: #e2e8f0;
  color: #0f172a;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  touch-action: manipulation;
}

.button:hover {
  background: #cbd5e1;
}

.hint {
  margin: 0;
  max-width: 320px;
  color: #64748b;
  font-size: 0.875rem;
}
