:root {
  --size: 160px;
}

*,
*::after,
*::before {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: #f4f4f4;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen,
    Ubuntu, Cantarell, "Open Sans", "Helvetica Neue", sans-serif;
  display: flex;
  justify-content: center;
}

header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

header h1 {
  color: #222b45;
}

.game-status {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  display: none;
}

.game-status > * {
  margin: 0;
}

.game-status .game-status-title {
  font-size: 1.5rem;
}

.game-status.won .game-status-title {
  color: #198754;
}

.game-status.lost .game-status-title {
  color: #dc3545;
}

.game-status.draw .game-status-title {
  color: #ffc107;
}

.btn-primary {
  display: inline-block;
  font-weight: 400;
  line-height: 1.5;
  text-align: center;
  cursor: pointer;
  padding: 0.375rem 0.75rem;
  font-size: 1rem;
  border-radius: 0.25rem;
  color: #fff;
  background-color: #0d6efd;
  border: none;
}

.board {
  display: grid;
  grid-template-columns: repeat(3, minmax(var(--size), 1fr));
  grid-template-rows: repeat(3, minmax(var(--size), 1fr));
  gap: 0.5rem;
}

.board .cell {
  border: 0.0625rem solid #e4e9f2;
  background: #fff;
  border-radius: 0.25rem;
  box-shadow: rgba(0, 0, 0, 0.1) 0px 4px 12px;
  cursor: pointer;
  position: relative;
}

.board:not(.game-end) .cell:not(.x):not(.circle):hover {
  background-color: #f0f0f0;
}

.cell.x::before,
.board:not(.game-end) .cell:hover:not(.x):not(.circle):before {
  content: "";
  position: absolute;
  display: flex;
  background: red;
  width: calc(var(--size) * 0.6);
  height: calc(var(--size) * 0.6);
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  clip-path: polygon(
    20% 0%,
    0% 20%,
    30% 50%,
    0% 80%,
    20% 100%,
    50% 70%,
    80% 100%,
    100% 80%,
    70% 50%,
    100% 20%,
    80% 0%,
    50% 30%
  );
  background-color: #4158d0;
  background-image: linear-gradient(
    43deg,
    #4158d0 0%,
    #c850c0 46%,
    #ffcc70 100%
  );
}

.board .cell:hover:not(.x):not(.circle)::before {
  opacity: 0.3;
}

.board .cell.circle::after,
.board .cell.circle::before {
  content: "";
  position: absolute;
  width: calc(var(--size) * 0.7);
  height: calc(var(--size) * 0.7);
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background-color: #f7b42c;
  background-image: linear-gradient(315deg, #f7b42c 0%, #fc575e 74%);
  border-radius: 50%;
}

.board .cell.circle::before {
  width: calc(var(--size) * 0.45);
  height: calc(var(--size) * 0.45);
  background: #fff;
  z-index: 2;
}

.cell.active {
  background: turquoise;
}
