@import url('https://fonts.googleapis.com/css2?family=Montserrat:wght@600&display=swap');

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: 'Montserrat', sans-serif;
  background: linear-gradient(135deg, #ff9966, #ff5e62);
  min-height: 100vh;
  display: flex;
  justify-content: center;
  align-items: center;
  flex-direction: column;
  text-align: center;
  animation: fadeIn 1s ease-in-out;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(-20px); }
  to { opacity: 1; transform: translateY(0); }
}

h1 {
  font-size: 3rem;
  color: #ffffff;
  margin: 20px;
  text-shadow: 2px 2px 5px rgba(0, 0, 0, 0.4);
  animation: zoomIn 1.2s ease-in-out;
}

@keyframes zoomIn {
  0% { transform: scale(0.8); opacity: 0; }
  100% { transform: scale(1); opacity: 1; }
}

.mode-selection {
  margin: 20px;
  display: flex;
  gap: 15px;
  justify-content: center;
  align-items: center;
  animation: slideIn 1.2s ease-in-out;
}

@keyframes slideIn {
  0% { transform: translateY(-30px); opacity: 0; }
  100% { transform: translateY(0); opacity: 1; }
}

#selected-mode {
  padding: 5px 15px;
  background-color: rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  color: #fff;
  font-weight: bold;
  border: 1px solid rgba(255, 255, 255, 0.3);
}

#difficulty-selection {
  margin-top: 10px;
  color: white;
  animation: fadeIn 1s ease-in-out;
}

.hidden {
  display: none;
}

.game-status {
  margin-top: 20px;
  font-size: 1.8rem;
  color: #fff;
  font-weight: bold;
  text-shadow: 2px 2px 5px rgba(0, 0, 0, 0.3);
  animation: bounceIn 1.5s ease-in-out;
}

@keyframes bounceIn {
  0%, 20%, 50%, 80%, 100% { transform: translateY(0); }
  40% { transform: translateY(-10px); }
  60% { transform: translateY(-5px); }
}

.game-board {
  display: inline-block;
  margin-top: 20px;
  animation: popIn 1.5s ease-in-out;
}

@keyframes popIn {
  0% { opacity: 0; transform: scale(0.7); }
  100% { opacity: 1; transform: scale(1); }
}

.row {
  display: flex;
}

.cell {
  width: 100px;
  height: 100px;
  border: 3px solid #fff;
  background-color: rgba(255, 255, 255, 0.2);
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2.5rem;
  color: white;
  cursor: pointer;
  transition: transform 0.3s ease, background-color 0.3s ease;
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
}

.cell:hover {
  transform: scale(1.1) rotate(10deg);
  background-color: rgba(255, 255, 255, 0.5);
}

.cell[data-player="X"] {
  color: #ff1a1a;
  text-shadow: 2px 2px 8px rgba(255, 26, 26, 0.6);
}

.cell[data-player="O"] {
  color: #0066ff;
  text-shadow: 2px 2px 8px rgba(0, 102, 255, 0.6);
}

.cell.winning {
  background-color: rgba(255, 255, 255, 0.7);
  animation: pulse 1s ease-in-out infinite;
}

@keyframes pulse {
  0% { transform: scale(1); box-shadow: 0 0 10px rgba(255, 255, 255, 0.8); }
  50% { transform: scale(1.05); box-shadow: 0 0 20px rgba(255, 255, 255, 1); }
  100% { transform: scale(1); box-shadow: 0 0 10px rgba(255, 255, 255, 0.8); }
}

button {
  padding: 12px 25px;
  margin: 10px;
  font-size: 1.2rem;
  cursor: pointer;
  background-color: rgba(255, 255, 255, 0.2);
  color: white;
  border: 2px solid white;
  border-radius: 8px;
  transition: all 0.3s ease;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
}

button[aria-pressed="true"] {
  background-color: rgba(255, 255, 255, 0.5);
  transform: scale(1.1);
}

@media (prefers-reduced-motion: reduce) {
  * {
    animation: none !important;
    transition: none !important;
  }
}

.ai-thinking .cell {
  cursor: progress;
  opacity: 0.7;
}

/* Responsive Design */
@media (max-width: 768px) {
  h1 { font-size: 2.5rem; }
  .cell { width: 80px; height: 80px; }
}

@media (max-width: 480px) {
  h1 { font-size: 2rem; }
  .cell { width: 70px; height: 70px; }
}
