* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 100vh;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.container {
  text-align: center;
  background: rgba(255, 255, 255, 0.95);
  padding: 40px;
  border-radius: 20px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
  max-width: 500px;
}

h1 {
  color: #333;
  margin-bottom: 30px;
  font-size: 2.5em;
}

.mode-selection {
  display: flex;
  gap: 15px;
  margin-bottom: 30px;
  justify-content: center;
}

.mode-btn {
  flex: 1;
  padding: 15px 25px;
  font-size: 1.1em;
  border: 3px solid #667eea;
  background: white;
  color: #667eea;
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.3s ease;
  font-weight: bold;
}

.mode-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
}

.mode-btn.active {
  background: #667eea;
  color: white;
}

.game-section {
  display: none;
}

.game-section.active {
  display: block;
}

.status {
  font-size: 1.5em;
  margin-bottom: 20px;
  color: #555;
  min-height: 40px;
}

.board {
  display: grid;
  grid-template-columns: repeat(3, 120px);
  grid-template-rows: repeat(3, 120px);
  gap: 10px;
  margin: 0 auto 30px;
  justify-content: center;
}

.cell {
  background: white;
  border: 3px solid #667eea;
  border-radius: 10px;
  font-size: 3em;
  font-weight: bold;
  cursor: pointer;
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  justify-content: center;
}

.cell:hover:not(.taken) {
  background: #f0f0f0;
  transform: scale(1.05);
}

.cell.taken {
  cursor: not-allowed;
}

.cell.x {
  color: #667eea;
}

.cell.o {
  color: #764ba2;
}

.cell.winner {
  background: #ffd700;
  animation: pulse 0.5s ease-in-out;
}

@keyframes pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.1); }
}

.reset-btn {
  background: #667eea;
  color: white;
  border: none;
  padding: 15px 40px;
  font-size: 1.2em;
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.3s ease;
  font-weight: bold;
}

.back-btn {
  background: #b41ece;
  color: white;
  border: none;
  padding: 10px 20px;
  font-size: 1em;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.3s ease;
  font-weight: bold;
  margin-top: 15px;
  left: 100px;
}

.space-btn {
  background: #10aad0;
  color: white;
  border: none;
  padding: 10px 20px;
  font-size: 1em;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.3s ease;
  font-weight: bold;
  margin-top: 15px;
}

.space-btn:hover {
  background: #9a17b8;
  transform: translateY(-2px);
  box-shadow: 0 5px 15px rgba(12, 12, 12, 0.604);
}

.back-btn:hover {
  background: #9a17b8;
  transform: translateY(-2px);
  box-shadow: 0 5px 15px rgba(12, 12, 12, 0.604);
}

.reset-btn:hover {
  background: #3f0bb8e6;
  transform: translateY(-2px);
  box-shadow: 0 5px 15px rgba(14, 15, 15, 0.908);
}

.score {
  display: flex;
  justify-content: center;
  gap: 30px;
  margin-bottom: 20px;
  font-size: 1.2em;
}

#footer {
  margin-top: 20px;
  font-size: 0.9em;
  color: #b41ece;
  font-weight: bold;
  
}

.score-item {
  padding: 10px 20px;
  background: #f8f9fa;
  border-radius: 10px;
  font-weight: bold;
}

.difficulty-selector {
  margin-bottom: 20px;
}

.difficulty-btn {
  padding: 8px 20px;
  margin: 0 5px;
  border: 2px solid #667eea;
  background: white;
  color: #667eea;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.3s ease;
  font-weight: bold;
}

.difficulty-btn:hover {
  background: #f0f0f0;
}

.difficulty-btn.active {
  background: #667eea;
  color: white;
}
@media (max-width: 600px) {
  .board {
    grid-template-columns: repeat(3, 80px);
    grid-template-rows: repeat(3, 80px);
    gap: 8px;
  }

  .cell {
    font-size: 2em;
  }

  .mode-btn, .reset-btn {
    padding: 10px 15px;
    font-size: 1em;
  }
}