* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

body {
  background: linear-gradient(135deg, #0f172a 0%, #1e293b 100%);
  min-height: 100vh;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 20px;
  color: #f8fafc;
}

.game-container {
  max-width: 800px;
  width: 100%;
  background: rgba(30, 41, 59, 0.9);
  border-radius: 24px;
  padding: 30px;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
  border: 1px solid rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(10px);
}

header {
  text-align: center;
  margin-bottom: 30px;
}

h1 {
  font-size: 3rem;
  margin-bottom: 10px;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  color: transparent;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 15px;
}

.subtitle {
  color: #94a3b8;
  font-size: 1.2rem;
  margin-bottom: 5px;
}

.game-info {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 30px;
  margin-bottom: 30px;
}

.game-controls {
  background: rgba(15, 23, 42, 0.8);
  padding: 25px;
  border-radius: 20px;
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.control-group {
  margin-bottom: 25px;
}

.control-group:last-child {
  margin-bottom: 0;
}

.control-group label {
  display: block;
  color: #cbd5e1;
  margin-bottom: 15px;
  font-weight: 600;
  font-size: 1.1rem;
  display: flex;
  align-items: center;
  gap: 10px;
}

.mode-buttons, .difficulty-buttons {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.mode-btn, .difficulty-btn {
  flex: 1;
  padding: 14px 18px;
  border: none;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.08);
  color: #cbd5e1;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-width: 140px;
}

.mode-btn:hover, .difficulty-btn:hover {
  background: rgba(255, 255, 255, 0.12);
  transform: translateY(-2px);
}

.mode-btn.active, .difficulty-btn.active {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  box-shadow: 0 6px 20px rgba(102, 126, 234, 0.4);
}

.score-board {
  background: rgba(15, 23, 42, 0.8);
  padding: 25px;
  border-radius: 20px;
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.score-title {
  text-align: center;
  color: #cbd5e1;
  margin-bottom: 20px;
  font-size: 1.3rem;
}

.score-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
}

.score-item {
  text-align: center;
  padding: 20px;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 15px;
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.score-label {
  display: block;
  color: #94a3b8;
  margin-bottom: 10px;
  font-size: 0.95rem;
}

.x-label { color: #667eea; }
.o-label { color: #f5576c; }
.draw-label { color: #10b981; }

.score-value {
  font-size: 2.5rem;
  font-weight: 800;
  color: white;
}

.game-status {
  grid-column: 1 / -1;
  text-align: center;
  padding: 20px;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 20px;
  margin-bottom: 30px;
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.status-text {
  font-size: 1.5rem;
  font-weight: 600;
  color: white;
  margin-bottom: 10px;
}

.ai-thinking {
  color: #fbbf24;
  font-size: 1rem;
  opacity: 0.9;
}

.game-board {
  display: flex;
  justify-content: center;
  margin-bottom: 30px;
}

.board {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 15px;
  background: rgba(15, 23, 42, 0.8);
  padding: 20px;
  border-radius: 20px;
  border: 2px solid rgba(255, 255, 255, 0.15);
  box-shadow: 0 15px 30px rgba(0, 0, 0, 0.4);
}

.cell {
  width: 100px;
  height: 100px;
  background: rgba(255, 255, 255, 0.05);
  border: 2px solid rgba(255, 255, 255, 0.2);
  border-radius: 15px;
  font-size: 3.5rem;
  font-weight: bold;
  color: transparent;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
}

.cell:hover {
  background: rgba(255, 255, 255, 0.1);
  transform: translateY(-4px);
}

.cell.x {
  color: #667eea;
  text-shadow: 0 0 20px rgba(102, 126, 234, 0.7);
}

.cell.o {
  color: #f5576c;
  text-shadow: 0 0 20px rgba(245, 87, 108, 0.7);
}

.cell.win {
  background: linear-gradient(135deg, #f6d365 0%, #fda085 100%);
  color: #1e293b !important;
  animation: pulse 1.5s infinite;
  border-color: #f6d365;
}

.cell:disabled {
  cursor: not-allowed;
  opacity: 0.8;
}

.cell:disabled:hover {
  background: rgba(255, 255, 255, 0.05);
  transform: none;
}

.hint {
  position: absolute;
  font-size: 1.8rem;
  opacity: 0.2;
}

.hint-x {
  color: #667eea;
}

.hint-o {
  color: #f5576c;
}

.action-buttons {
  display: flex;
  gap: 20px;
  margin-bottom: 30px;
  flex-wrap: wrap;
  justify-content: center;
}

.action-btn {
  padding: 16px 32px;
  border: none;
  border-radius: 14px;
  font-size: 1.1rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  min-width: 180px;
}

.reset-btn {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
}

.reset-btn:hover {
  transform: translateY(-3px);
  box-shadow: 0 12px 25px rgba(102, 126, 234, 0.4);
}

.score-reset-btn {
  background: rgba(245, 87, 108, 0.2);
  color: #f5576c;
  border: 2px solid rgba(245, 87, 108, 0.3);
}

.score-reset-btn:hover {
  background: rgba(245, 87, 108, 0.3);
  transform: translateY(-3px);
}

.instructions {
  margin-top: 30px;
  padding: 25px;
  background: rgba(15, 23, 42, 0.8);
  border-radius: 20px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-left: 4px solid #667eea;
}

.instructions h3 {
  color: #cbd5e1;
  margin-bottom: 15px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.instructions ul {
  list-style: none;
  padding-left: 0;
}

.instructions li {
  padding: 8px 0;
  color: #94a3b8;
  position: relative;
  padding-left: 24px;
}

.instructions li:before {
  content: '→';
  position: absolute;
  left: 0;
  color: #667eea;
}

footer {
  text-align: center;
  margin-top: 30px;
  padding-top: 20px;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  color: #94a3b8;
}

footer a {
  color: #667eea;
  text-decoration: none;
  margin: 0 10px;
}

footer a:hover {
  text-decoration: underline;
}

.heart {
  color: #f5576c;
}

@keyframes pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.05); }
}

@media (max-width: 768px) {
  .game-info {
      grid-template-columns: 1fr;
  }
  
  h1 {
      font-size: 2.2rem;
  }
  
  .cell {
      width: 80px;
      height: 80px;
      font-size: 2.8rem;
  }
  
  .action-btn {
      min-width: 160px;
      padding: 14px 24px;
  }
  
  .mode-btn, .difficulty-btn {
      min-width: 120px;
  }
}

@media (max-width: 480px) {
  .game-container {
      padding: 20px;
  }
  
  h1 {
      font-size: 1.8rem;
  }
  
  .cell {
      width: 70px;
      height: 70px;
      font-size: 2.2rem;
  }
  
  .action-buttons {
      flex-direction: column;
      align-items: center;
  }
  
  .action-btn {
      width: 100%;
  }
  
  .mode-buttons, .difficulty-buttons {
      flex-direction: column;
  }
  
  .mode-btn, .difficulty-btn {
      width: 100%;
  }
}