.gomoku-board,
.xiangqi-board,
.western-board,
.reversi-board,
.checkers-board,
.tic-board {
  width: min(680px, 100%);
  aspect-ratio: 1;
  display: grid;
  touch-action: manipulation;
  user-select: none;
}

.gomoku-board {
  grid-template-columns: repeat(15, 1fr);
  grid-template-rows: repeat(15, 1fr);
  padding: 8px;
  border-radius: 8px;
  background: #d8a657;
}

.gomoku-cell {
  position: relative;
  display: grid;
  place-items: center;
  min-width: 0;
  min-height: 0;
  padding: 0;
  border: 0;
  background:
    linear-gradient(#5f3a16, #5f3a16) center / 100% 1px no-repeat,
    linear-gradient(90deg, #5f3a16, #5f3a16) center / 1px 100% no-repeat;
  cursor: pointer;
}

.stone {
  display: block;
  aspect-ratio: 1;
  width: 74%;
  height: auto;
  border-radius: 50%;
  box-shadow: 0 2px 5px rgba(2, 6, 23, 0.35);
}

.stone.black {
  background: #111827;
}

.stone.white {
  background: #f8fafc;
  border: 1px solid #cbd5e1;
}

.xiangqi-board {
  grid-template-columns: repeat(9, 1fr);
  grid-template-rows: repeat(10, 1fr);
  aspect-ratio: 9 / 10;
  padding: 8px;
  border-radius: 8px;
  background: #d9a85f;
}

.xiangqi-cell,
.western-cell,
.go-cell {
  position: relative;
  display: grid;
  place-items: center;
  border: 1px solid rgba(17, 24, 39, 0.24);
  cursor: pointer;
}

.xiangqi-cell {
  background: #e7bd78;
}

.xiangqi-cell.shade {
  background: #e0b46c;
}

.xiangqi-cell.selected,
.western-cell.selected {
  outline: 3px solid #facc15;
  z-index: 2;
}

.xiangqi-piece {
  width: 82%;
  height: 82%;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: #fff7ed;
  border: 2px solid currentColor;
  font-size: clamp(16px, 4vw, 30px);
  font-weight: 900;
  box-shadow: 0 2px 5px rgba(2, 6, 23, 0.24);
}

.xiangqi-piece.red {
  color: #b91c1c;
}

.xiangqi-piece.black {
  color: #111827;
}

.go-board {
  --size: 9;
  --go-min: 270px;
  width: min(680px, 100%);
  min-width: min(680px, var(--go-min));
  aspect-ratio: 1;
  display: grid;
  grid-template-columns: repeat(var(--size), 1fr);
  grid-template-rows: repeat(var(--size), 1fr);
  padding: 8px;
  border-radius: 8px;
  background: #d8a657;
  touch-action: manipulation;
  user-select: none;
}

.go-cell {
  border: 0;
  background:
    linear-gradient(#5f3a16, #5f3a16) center / 100% 1px no-repeat,
    linear-gradient(90deg, #5f3a16, #5f3a16) center / 1px 100% no-repeat;
}

.western-board {
  grid-template-columns: repeat(8, 1fr);
  grid-template-rows: repeat(8, 1fr);
  border: 1px solid #111827;
  border-radius: 8px;
  overflow: hidden;
}

.western-cell {
  border: 0;
  font-size: clamp(26px, 7vw, 52px);
  line-height: 1;
}

.western-cell.light {
  background: #f1d9b5;
}

.western-cell.dark {
  background: #7b4f2c;
}

.white-piece {
  color: #fff;
  text-shadow: 0 2px 4px rgba(2, 6, 23, 0.75);
}

.black-piece {
  color: #111827;
  text-shadow: 0 1px 2px rgba(255, 255, 255, 0.42);
}

.reversi-board,
.checkers-board {
  grid-template-columns: repeat(8, 1fr);
  grid-template-rows: repeat(8, 1fr);
  border: 1px solid #123524;
  border-radius: 8px;
  overflow: hidden;
}

.reversi-cell,
.checkers-cell,
.tic-cell {
  position: relative;
  display: grid;
  place-items: center;
  border: 0;
  cursor: pointer;
  touch-action: manipulation;
}

.reversi-cell {
  background: #15803d;
  border: 1px solid rgba(255, 255, 255, 0.16);
}

.reversi-cell.hint::after,
.checkers-cell.hint::after {
  content: "";
  width: 28%;
  height: 28%;
  border-radius: 50%;
  background: rgba(250, 204, 21, 0.82);
  box-shadow: 0 0 0 3px rgba(250, 204, 21, 0.22);
}

.disc,
.checker-piece {
  display: grid;
  place-items: center;
  aspect-ratio: 1;
  width: 76%;
  height: auto;
  border-radius: 50%;
  box-shadow: 0 4px 10px rgba(2, 6, 23, 0.35);
}

.disc.black {
  background: #111827;
}

.disc.white {
  background: #f8fafc;
  border: 1px solid #cbd5e1;
}

.checkers-board {
  border-color: #111827;
}

.checkers-cell.light {
  background: #f1d9b5;
}

.checkers-cell.dark {
  background: #7b4f2c;
}

.checkers-cell.selected {
  outline: 3px solid #facc15;
  z-index: 2;
}

.checker-piece.red {
  background: #dc2626;
  border: 3px solid #fecaca;
}

.checker-piece.black {
  background: #111827;
  border: 3px solid #9ca3af;
}

.checker-piece.king::after {
  content: "";
  width: 44%;
  height: 44%;
  border-radius: 50%;
  border: 3px solid rgba(255, 255, 255, 0.72);
}

.tic-board {
  grid-template-columns: repeat(3, 1fr);
  grid-template-rows: repeat(3, 1fr);
  width: min(520px, 100%);
  max-width: 520px;
  gap: 8px;
  padding: 8px;
  border-radius: 8px;
  background: #172033;
}

.tic-cell {
  min-height: 120px;
  border-radius: 7px;
  background: #f8fafc;
  color: #172033;
  font-size: clamp(54px, 10vw, 92px);
  font-weight: 900;
  line-height: 1;
}

.tic-cell.x {
  color: #1d4ed8;
}

.tic-cell.o {
  color: #c2410c;
}

.tic-cell.win {
  background: #fef3c7;
}

@media (max-width: 700px) {
  .gomoku-board,
  .xiangqi-board,
  .western-board,
  .reversi-board,
  .checkers-board,
  .tic-board {
    width: 100%;
    max-width: 680px;
  }

  .go-board {
    width: 100%;
    max-width: 680px;
    min-width: min(680px, var(--go-min));
  }

  .gomoku-board,
  .xiangqi-board,
  .go-board {
    padding: 5px;
  }

  .xiangqi-piece {
    font-size: clamp(14px, 5vw, 24px);
    border-width: 1px;
  }

  .western-cell {
    font-size: clamp(28px, 10vw, 44px);
  }

  .tic-board {
    max-width: 480px;
    gap: 5px;
    padding: 5px;
  }

  .tic-cell {
    min-height: 92px;
    font-size: clamp(48px, 18vw, 76px);
  }

  .stone {
    aspect-ratio: 1;
    width: 78%;
    height: auto;
  }
}
