*:not(dialog) {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: 'Lexend Deca', sans-serif;
}

body {
  text-align: center;
  display: grid;
  place-items: center;
  min-height: 100vh;
}

h1 {
  font-weight: 200;
}

.board {
  display: grid;
  width: 300px;
  margin-top: 2rem;
  grid-template-columns: repeat(3, 1fr);
}

.cell {
  position: relative;
  cursor: pointer;
  width: 100px;
  font-size: 4rem;
  font-weight: 700;
  display: grid;
  place-items: center;
  aspect-ratio: 1;
  border-right: 2px solid black;
  border-bottom: 2px solid black;
}

.cell:nth-of-type(3n) {
  border-right: none;
}

.cell:nth-of-type(7),
.cell:nth-of-type(8),
.cell:nth-of-type(9) {
  border-bottom: none;
}

.cell.x,
.cell.o {
  cursor: not-allowed;
}

.cell.x::before,
.cell.x::after {
  background-color: black;
}

.board.x .cell:not(.x):not(.o):hover::before,
.board.x .cell:not(.x):not(.o):hover::after {
  background-color: lightgray;
}

.cell.x::before,
.cell.x::after,
.board.x .cell:not(.x):not(.o):hover::before,
.board.x .cell:not(.x):not(.o):hover::after {
  position: absolute;
  content: '';
  transform: rotate(45deg);
}

.cell.x::before,
.board.x .cell:not(.x):not(.o):hover::before {
  left: 50%;
  margin-left: -7.5%; /* negative half of the width */
  width: 15%;
  height: 80%;
}

.cell.x::after,
.board.x .cell:not(.x):not(.o):hover::after {
  width: 80%;
  height: 15%;
  top: 50%;
  margin-top: -7.5%;
}

.cell.o::before,
.board.o .cell:not(.x):not(.o):hover::before {
  position: absolute;
  content: '';
  width: 50px;
  height: 50px;
  border-radius: 50%;
  border: 15px solid black;
}

.board.o .cell:not(.x):not(.o):hover::before {
  border-color: lightgray;
}
