/* Tic Tac Toe - Styles */

:root {
  --cell-size: 100px;
  --board-gap: 6px;
  --bg-game: #1a1a2e;
  --cell-bg: #16213e;
  --cell-hover: #1f2f52;
  --x-color: #e94560;
  --o-color: #4ecca3;
  --win-glow: 0 0 20px rgba(233, 69, 96, 0.4);
}

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

body {
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  background: #0f0f1a;
  color: #eee;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
}

/* Header */
.game-header {
  width: 100%;
  background: #1a1a2e;
  border-bottom: 2px solid #e94560;
  padding: 16px 20px;
}

.game-header .container {
  max-width: 600px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.game-header h1 {
  font-size: 1.4rem;
  color: #eee;
}

.game-header .back-link {
  color: #a0a0b8;
  text-decoration: none;
  font-size: 0.9rem;
  transition: color 0.2s;
}

.game-header .back-link:hover {
  color: #e94560;
}

/* Game Container */
.game-container {
  max-width: 520px;
  width: 100%;
  padding: 20px;
  margin: 20px auto;
  display: flex;
  flex-direction: column;
  align-items: center;
}

/* Mode Selector */
.mode-selector {
  display: flex;
  gap: 10px;
  margin-bottom: 24px;
  width: 100%;
}

.mode-btn {
  flex: 1;
  padding: 12px;
  border: 2px solid #2a2a4a;
  border-radius: 10px;
  background: #16213e;
  color: #a0a0b8;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}

.mode-btn:hover {
  border-color: #4ecca3;
  color: #4ecca3;
}

.mode-btn.active {
  border-color: #e94560;
  background: rgba(233, 69, 96, 0.1);
  color: #e94560;
  box-shadow: 0 0 20px rgba(233, 69, 96, 0.15);
}

/* Status */
.status {
  text-align: center;
  font-size: 1.2rem;
  font-weight: 600;
  margin-bottom: 20px;
  padding: 10px 24px;
  border-radius: 10px;
  background: #1a1a2e;
  min-height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
}

.status.win {
  color: #ffc107;
  animation: pulse 0.6s ease-in-out 3;
}

.status.draw {
  color: #a0a0b8;
}

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

/* Board */
.board {
  display: grid;
  grid-template-columns: repeat(3, var(--cell-size));
  gap: var(--board-gap);
  background: #2a2a4a;
  padding: var(--board-gap);
  border-radius: 14px;
  margin-bottom: 24px;
}

.cell {
  width: var(--cell-size);
  height: var(--cell-size);
  background: var(--cell-bg);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2.5rem;
  font-weight: 800;
  cursor: pointer;
  transition: all 0.15s ease;
  user-select: none;
}

.cell:hover:empty {
  background: var(--cell-hover);
}

.cell.x {
  color: var(--x-color);
  text-shadow: 0 0 10px rgba(233, 69, 96, 0.3);
}

.cell.o {
  color: var(--o-color);
  text-shadow: 0 0 10px rgba(78, 204, 163, 0.3);
}

.cell.win {
  animation: winCell 0.5s ease infinite alternate;
}

.cell.win.x {
  box-shadow: inset 0 0 20px rgba(233, 69, 96, 0.3);
}

.cell.win.o {
  box-shadow: inset 0 0 20px rgba(78, 204, 163, 0.3);
}

@keyframes winCell {
  from { transform: scale(1); }
  to { transform: scale(1.05); }
}

/* Scoreboard */
.scoreboard {
  display: flex;
  gap: 16px;
  margin-bottom: 20px;
  width: 100%;
}

.score-item {
  flex: 1;
  text-align: center;
  padding: 12px 8px;
  background: #1a1a2e;
  border-radius: 10px;
  border: 1px solid #2a2a4a;
}

.score-item .label {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: #a0a0b8;
  margin-bottom: 4px;
}

.score-item .value {
  font-size: 1.5rem;
  font-weight: 700;
}

.score-item.x-score .value { color: var(--x-color); }
.score-item.o-score .value { color: var(--o-color); }
.score-item.draw-score .value { color: #a0a0b8; }

/* Controls */
.controls {
  display: flex;
  gap: 10px;
  width: 100%;
}

.btn {
  flex: 1;
  padding: 12px;
  border: 2px solid #2a2a4a;
  border-radius: 10px;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  text-align: center;
}

.btn-primary {
  background: #e94560;
  color: white;
  border-color: #e94560;
}

.btn-primary:hover {
  background: #ff6b81;
  transform: translateY(-1px);
}

.btn-secondary {
  background: transparent;
  color: #a0a0b8;
}

.btn-secondary:hover {
  border-color: #e94560;
  color: #e94560;
}

/* Hint */
.hint {
  margin-top: 16px;
  color: #555;
  font-size: 0.8rem;
  text-align: center;
}

/* Footer */
.game-footer {
  text-align: center;
  padding: 20px;
  color: #555;
  font-size: 0.8rem;
}

/* Responsive */
@media (max-width: 500px) {
  :root {
    --cell-size: 80px;
  }
  
  .game-container {
    padding: 10px;
  }
  
  .mode-btn {
    font-size: 0.8rem;
    padding: 10px;
  }
  
  .status {
    font-size: 1rem;
  }
}

/* Cell entrance animation */
.cell.x, .cell.o {
  animation: popIn 0.2s ease;
}

@keyframes popIn {
  0% { transform: scale(0.5); opacity: 0; }
  70% { transform: scale(1.1); }
  100% { transform: scale(1); opacity: 1; }
}
