.container {
  text-align: center;
  padding: 20px;
}
h1 {
  margin-bottom: 10px;
  font-size: 36px;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}
.mode-selector {
  margin-bottom: 20px;
  display: flex;
  gap: 15px;
  justify-content: center;
  flex-wrap: wrap;
}
.mode-btn {
  padding: 12px 24px;
  font-size: 18px;
  border: none;
  border-radius: 30px;
  cursor: pointer;
  font-weight: 600;
  transition: all 0.3s ease;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
}
.mode-btn.active {
  transform: translateY(-3px);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.3);
}
.mode-btn.pvp {
  background: linear-gradient(45deg, #e74c3c, #c0392b);
}
.mode-btn.pvai {
  background: linear-gradient(45deg, #3498db, #2980b9);
}
.mode-btn:hover {
  transform: translateY(-3px);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.3);
}
#board {
  display: grid;
  grid-template-columns: repeat(3, 110px);
  grid-template-rows: repeat(3, 110px);
  gap: 8px;
  background-color: #2c3e50;
  padding: 12px;
  border-radius: 16px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
  margin: 20px auto;
  position: relative;
}
.cell {
  display: flex;
  justify-content: center;
  align-items: center;
  background-color: #ecf0f1;
  font-size: 0;
  font-weight: bold;
  cursor: pointer;
  user-select: none;
  border-radius: 12px;
  transition: all 0.3s ease;
  position: relative;
  overflow: hidden;
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}
.cell:hover:not(.x):not(.o) {
  background-color: #d5dbdb;
  transform: translateY(-2px);
  box-shadow: 0 6px 12px rgba(0, 0, 0, 0.15);
}
.cell.x::before {
  content: "X";
  font-size: 60px;
  color: #e74c3c;
  animation: popInX 0.5s ease-out forwards;
}
.cell.o::before {
  content: "O";
  font-size: 60px;
  color: #3498db;
  animation: popInO 0.5s ease-out forwards;
}
.cell.winning {
  background-color: #f1c40f !important;
  animation: pulse 1.5s infinite;
}
#status {
  font-size: 28px;
  margin: 15px 0;
  font-weight: 600;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
  min-height: 36px;
  color: white;
}
#reset {
  padding: 12px 28px;
  font-size: 18px;
  cursor: pointer;
  background: linear-gradient(45deg, #2ecc71, #27ae60);
  color: white;
  border: none;
  border-radius: 30px;
  box-shadow: 0 6px 15px rgba(46, 204, 113, 0.4);
  transition: all 0.3s ease;
  font-weight: 600;
  margin-top: 10px;
}
.controls {
  display: flex;
  gap: 15px;
  justify-content: center;
  align-items: center;
  flex-wrap: wrap;
}
#reset:hover {
  transform: translateY(-3px);
  box-shadow: 0 8px 20px rgba(46, 204, 113, 0.5);
}
#reset:active {
  transform: translateY(1px);
}

/* Animations */
@keyframes popInX {
  0% {
    transform: scale(0) rotate(0deg);
    opacity: 0;
  }
  50% {
    transform: scale(1.3) rotate(-10deg);
  }
  100% {
    transform: scale(1) rotate(0deg);
    opacity: 1;
    font-size: 60px;
  }
}
@keyframes popInO {
  0% {
    transform: scale(0);
    opacity: 0;
  }
  60% {
    transform: scale(1.2);
  }
  100% {
    transform: scale(1);
    opacity: 1;
    font-size: 60px;
  }
}
@keyframes pulse {
  0% {
    box-shadow: 0 0 0 0 rgba(241, 196, 15, 0.7);
  }
  70% {
    box-shadow: 0 0 0 15px rgba(241, 196, 15, 0);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(241, 196, 15, 0);
  }
}
.line {
  position: absolute;
  background: #f1c40f;
  z-index: 10;
  border-radius: 8px;
  box-shadow: 0 0 15px #f1c40f;
}
.horizontal {
  height: 8px;
  width: 0;
  left: 12px;
  animation: expandHorizontal 0.6s ease-out forwards;
}
.vertical {
  width: 8px;
  height: 0;
  top: 12px;
  animation: expandVertical 0.6s ease-out forwards;
}
.diagonal1 {
  width: 8px;
  height: 0;
  transform: rotate(-45deg);
  top: 50%;
  left: 50%;
  transform-origin: center;
  animation: expandDiagonal1 0.8s ease-out forwards;
}
.diagonal2 {
  width: 8px;
  height: 0;
  transform: rotate(45deg);
  top: 50%;
  left: 50%;
  transform-origin: center;
  animation: expandDiagonal2 0.8s ease-out forwards;
}

@keyframes expandHorizontal {
  to {
    width: calc(100% - 24px);
  }
}
@keyframes expandVertical {
  to {
    height: calc(100% - 24px);
  }
}
@keyframes expandDiagonal1 {
  to {
    height: 430px;
    margin-top: -215px;
    margin-left: -4px;
  }
}
@keyframes expandDiagonal2 {
  to {
    height: 430px;
    margin-top: -215px;
    margin-left: -4px;
  }
}

.hidden {
  display: none;
}
