* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
  background: linear-gradient(135deg, #0f2027 0%, #203a43 50%, #2c5364 100%);
  min-height: 100vh;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 20px;
  color: #e0e0e0;
}

.container {
  background-color: rgba(30, 30, 40, 0.95);
  border-radius: 20px;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.4);
  padding: 30px;
  max-width: 900px;
  width: 100%;
  border: 1px solid rgba(255, 255, 255, 0.1);
}

header {
  text-align: center;
  margin-bottom: 30px;
  padding-bottom: 20px;
  border-bottom: 2px solid rgba(100, 126, 234, 0.3);
}

header h1 {
  color: #ffffff;
  font-size: 2.8em;
  margin-bottom: 10px;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

header .subtitle {
  color: #a0a0c0;
  font-size: 1.1em;
  letter-spacing: 1px;
}

/* Player Setup Section */
.player-setup-section {
  background: rgba(40, 40, 55, 0.8);
  border-radius: 15px;
  padding: 25px;
  margin-bottom: 25px;
  border: 1px solid rgba(100, 126, 234, 0.2);
}

.player-setup-section h2 {
  color: #ffffff;
  margin-bottom: 20px;
  font-size: 1.6em;
  display: flex;
  align-items: center;
  gap: 10px;
}

.player-setup-section h2 i {
  color: #667eea;
}

.player-inputs {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 25px;
  margin-bottom: 25px;
}

.player-input-group {
  display: flex;
  flex-direction: column;
}

.player-input-group label {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
  font-weight: 600;
  color: #b0b0d0;
  font-size: 1.1em;
}

.player-input-group label i {
  color: #667eea;
  font-size: 1.1em;
}

.player-input-group input {
  width: 100%;
  padding: 14px 18px;
  background: rgba(20, 20, 30, 0.8);
  border: 2px solid rgba(100, 126, 234, 0.3);
  border-radius: 10px;
  font-size: 1.1em;
  color: #ffffff;
  transition: all 0.3s;
}

.player-input-group input:focus {
  outline: none;
  border-color: #667eea;
  box-shadow: 0 0 0 3px rgba(100, 126, 234, 0.2);
}

.player-input-group input::placeholder {
  color: #8888a8;
}

/* Game Controls Section */
.game-controls {
  background: rgba(40, 40, 55, 0.8);
  border-radius: 15px;
  padding: 25px;
  margin-bottom: 25px;
  border: 1px solid rgba(100, 126, 234, 0.2);
  text-align: center;
}

.game-controls h2 {
  color: #ffffff;
  margin-bottom: 20px;
  font-size: 1.6em;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
}

.controls {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 15px;
}

.btn {
  padding: 14px 28px;
  border: none;
  border-radius: 10px;
  font-size: 1.1em;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-width: 160px;
}

.btn:hover {
  transform: translateY(-3px);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.3);
}

.start-btn {
  background: linear-gradient(135deg, #4caf50 0%, #2e7d32 100%);
  color: white;
}

.restart-btn {
  background: linear-gradient(135deg, #2196f3 0%, #1565c0 100%);
  color: white;
}

.reset-btn {
  background: linear-gradient(135deg, #f44336 0%, #c62828 100%);
  color: white;
}

.btn:disabled {
  background: #555566;
  color: #8888a8;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

/* Game Info Section */
.game-info {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 20px;
  margin-bottom: 25px;
}

.game-info-card {
  background: rgba(40, 40, 55, 0.8);
  border-radius: 15px;
  padding: 20px;
  border: 1px solid rgba(100, 126, 234, 0.2);
}

.game-info-card h2 {
  color: #b0b0d0;
  font-size: 1.2em;
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.game-info-card span {
  color: #ffffff;
  font-weight: 600;
  font-size: 1.3em;
  display: block;
  margin-top: 5px;
}

/* Game Board */
.game-board {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  grid-template-rows: repeat(3, 1fr);
  gap: 12px;
  max-width: 450px;
  margin: 0 auto 30px;
  aspect-ratio: 1/1;
  background: rgba(40, 40, 55, 0.8);
  padding: 20px;
  border-radius: 15px;
  border: 1px solid rgba(100, 126, 234, 0.2);
}

.cell {
  background: rgba(20, 20, 30, 0.9);
  border: 3px solid rgba(100, 126, 234, 0.4);
  border-radius: 10px;
  display: flex;
  justify-content: center;
  align-items: center;
  font-size: 4.5em;
  font-weight: bold;
  cursor: pointer;
  transition: all 0.3s;
  aspect-ratio: 1/1;
  color: #ffffff;
}

.cell:hover {
  background: rgba(30, 30, 45, 0.9);
  border-color: #667eea;
  transform: scale(1.05);
  box-shadow: 0 5px 15px rgba(100, 126, 234, 0.2);
}

.cell.x {
  color: #f44336;
  text-shadow: 0 0 10px rgba(244, 67, 54, 0.3);
}

.cell.o {
  color: #2196f3;
  text-shadow: 0 0 10px rgba(33, 150, 243, 0.3);
}

.cell.winning {
  background: linear-gradient(135deg, #ffd700 0%, #ffa500 100%);
  border-color: #ffc107;
  color: #333;
  animation: pulse 1s infinite;
}

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

/* Scoreboard */
.scoreboard {
  background: rgba(40, 40, 55, 0.8);
  padding: 25px;
  border-radius: 15px;
  margin-bottom: 25px;
  border: 1px solid rgba(100, 126, 234, 0.2);
}

.scoreboard h2 {
  color: #ffffff;
  margin-bottom: 20px;
  font-size: 1.8em;
  display: flex;
  align-items: center;
  gap: 10px;
}

.scores {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 20px;
}

.score {
  background: rgba(20, 20, 30, 0.9);
  padding: 20px;
  border-radius: 10px;
  font-size: 1.3em;
  border: 2px solid rgba(100, 126, 234, 0.2);
  transition: transform 0.3s;
}

.score:hover {
  transform: translateY(-5px);
  border-color: #667eea;
}

.score span:first-child {
  color: #ffffff;
  font-weight: 600;
  display: block;
  margin-bottom: 5px;
  font-size: 1.1em;
}

.score span:last-child {
  color: #667eea;
  font-weight: 700;
  font-size: 1.5em;
}

.score.tie span:last-child {
  color: #ff9800;
}

/* Message */
.message {
  padding: 20px;
  text-align: center;
  font-size: 1.3em;
  font-weight: 600;
  background: rgba(76, 175, 80, 0.1);
  border-radius: 15px;
  border-left: 5px solid #4caf50;
  color: #4caf50;
  display: none;
  margin-top: 20px;
  border: 1px solid rgba(76, 175, 80, 0.3);
}

.message.show {
  display: block;
  animation: slideIn 0.5s ease-out;
}

@keyframes slideIn {
  from {
    opacity: 0;
    transform: translateY(-20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Footer */
footer {
  text-align: center;
  margin-top: 30px;
  padding-top: 20px;
  border-top: 1px solid rgba(100, 126, 234, 0.3);
  color: #a0a0c0;
  font-size: 0.9em;
}

/* Responsive design */
@media (max-width: 768px) {
  .container {
    padding: 20px;
  }

  header h1 {
    font-size: 2.2em;
  }

  .player-inputs {
    grid-template-columns: 1fr;
  }

  .game-info {
    grid-template-columns: 1fr;
  }

  .game-board {
    max-width: 320px;
    padding: 15px;
  }

  .cell {
    font-size: 3.5em;
  }

  .controls {
    flex-direction: column;
    align-items: stretch;
  }

  .btn {
    width: 100%;
  }

  .scores {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 480px) {
  .game-board {
    max-width: 280px;
  }

  .cell {
    font-size: 3em;
  }

  .btn {
    padding: 12px 20px;
    font-size: 1em;
  }
}
