* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: 'Segoe UI', sans-serif;
  background: linear-gradient(-45deg, #1a1a2e, #0f3460, #ff4d4d, #007bff);
  background-size: 400% 400%;
  animation: gradientBG 12s ease infinite;
  color: #fff;
  height: 100vh;
  overflow-x: hidden;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 20px;
}

@keyframes gradientBG {
  0% {
    background-position: 0% 50%;
  }
  50% {
    background-position: 100% 50%;
  }
  100% {
    background-position: 0% 50%;
  }
}

.container {
  text-align: center;
  padding: 20px;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 16px;
  box-shadow: 0 0 30px rgba(0, 0, 0, 0.3);
  backdrop-filter: blur(6px);
  width: 100%;
  max-width: 450px;
}

.title {
  font-size: clamp(1.8rem, 5vw, 2.5rem);
  margin-bottom: 20px;
  color: #ffffff;
}

.mode-toggle {
  margin-bottom: 20px;
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 10px;
}

.mode-toggle button {
  background: linear-gradient(45deg, #ff4d4d, #ff1a1a); 
  color: white;
  border: none;
  padding: 10px 20px;
  font-size: 1rem;
  border-radius: 30px;
  cursor: pointer;
  transition: 0.3s ease;
  min-width: 120px;
}

.mode-toggle button:hover {
  background: linear-gradient(45deg, #ff3333, #cc0000);
  transform: scale(1.05);
}

.board {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.5vw;
  width: 90vw;
  max-width: 360px;
  margin: 0 auto 20px;
}

.cell {
  aspect-ratio: 1 / 1;
  width: 100%;
  font-size: clamp(2rem, 8vw, 4rem);
  font-weight: bold;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.1);
  cursor: pointer;
  color: #fff;
  transition: transform 0.3s ease, color 0.3s ease;
  user-select: none;
}

.cell.show {
  animation: popIn 0.25s ease forwards;
}

.cell[data-value="X"] {
  color: #ff4d4d; 
}

.cell[data-value="O"] {
  color: #00aaff; 
}

.cell.winning {
  animation: glow 0.8s ease-in-out infinite alternate;
  border: 2px solid yellow;
}

.status {
  font-size: clamp(1rem, 3vw, 1.25rem);
  margin-bottom: 10px;
  color: #ffffff;
}

.restart {
  background: linear-gradient(45deg, #007bff, #1e90ff); 
  color: white;
  border: none;
  padding: 10px 25px;
  border-radius: 30px;
  font-size: 1rem;
  cursor: pointer;
  transition: 0.3s ease;
}

.restart:hover {
  background: linear-gradient(45deg, #0056b3, #008cff);
  transform: scale(1.05);
}

@keyframes glow {
  from {
    box-shadow: 0 0 10px rgba(255, 255, 0, 0.5);
  }
  to {
    box-shadow: 0 0 20px rgba(255, 255, 0, 1);
  }
}

@keyframes popIn {
  from {
    transform: scale(0.6);
    opacity: 0;
  }
  to {
    transform: scale(1);
    opacity: 1;
  }
}