body {
  font-family: sans-serif;
  margin: 1rem;
}

main {
  max-width: 720px;
}

#controls {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1rem;
  align-items: center;
  margin: 1rem 0;
}

#board {
  display: grid;
  grid-template-columns: repeat(9, minmax(26px, 44px));
  grid-template-rows: repeat(9, minmax(26px, 44px));
  width: min(96vw, 396px);
  aspect-ratio: 1;
}

.cell {
  font: inherit;
  font-size: 1.1rem;
  border: 1px solid #777;
  background: white;
  padding: 0;
}

.cell:nth-child(3n) {
  border-right-width: 3px;
}

.cell:nth-child(9n) {
  border-right-width: 1px;
}

.cell:nth-child(n+19):nth-child(-n+27),
.cell:nth-child(n+46):nth-child(-n+54) {
  border-bottom-width: 3px;
}

.legal {
  background: #eef;
  cursor: pointer;
}

.last {
  outline: 2px solid #111;
  outline-offset: -3px;
}

.closed {
  background: #eee;
}

.won-x {
  background: #e8f5e9;
}

.won-o {
  background: #fce4ec;
}

button:disabled {
  cursor: not-allowed;
}

#moves {
  padding-left: 1.5rem;
}
