/* ============================================
   Tablo — Tic-Tac-Toe Styles
   ============================================ */

:root {
  --color-x: #2dd4bf;
  --color-o: #ffd93d;
  --bg-dark: var(--bg-primary, #0f1923);
  --bg-panel: var(--bg-surface, #1a2332);
  --bg-input: var(--bg-surface, #1a2332);
  --accent-light: #5eead4;
  --font-primary: 'Nunito', sans-serif;
}

.game-wrapper {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 0 20px 20px;
  gap: 24px;
}

.game-wrapper::before {
  content: '';
  display: block;
  height: 12px;
  flex-shrink: 0;
}

.game-stats {
  flex-shrink: 0;
  display: flex;
  gap: 24px;
  padding: 16px 24px;
  background: var(--bg-surface, #1a2332);
  border: 1px solid var(--border-color, #2a3441);
  border-radius: var(--radius-lg, 12px);
  flex-wrap: wrap;
  justify-content: center;
  width: 100%;
  max-width: 500px;
}

.stat-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  min-width: 80px;
}

.stat-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-secondary, #8892a0);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.stat-value {
  font-size: 20px;
  font-weight: 700;
  color: var(--accent, #2dd4bf);
  font-family: 'Nunito', monospace;
}

.tic-tac-toe-board {
  flex-shrink: 0;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  max-width: 360px;
  width: 100%;
  background: var(--accent, #2dd4bf);
  padding: 8px;
  border-radius: var(--radius-lg, 12px);
}

.cell {
  aspect-ratio: 1;
  background: var(--bg-dark, #0f1923);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 3rem;
  font-weight: 800;
  transition: transform 0.15s ease, background 0.15s ease;
  position: relative;
  overflow: hidden;
}

.cell:hover { transform: scale(1.02); }
.cell.x { color: var(--color-x, #2dd4bf); }
.cell.o { color: var(--color-o, #ffd93d); }
.cell.win-cell {
  background: var(--success, #4ade80);
  animation: pulse-win 0.6s ease;
}

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

.mark {
  animation: pop-in 0.3s ease;
}

@keyframes pop-in {
  0% { transform: scale(0); }
  100% { transform: scale(1); }
}

.game-controls {
  flex-shrink: 0;
  display: flex;
  gap: 12px;
  justify-content: center;
  align-items: center;
}

.mode-select {
  background: var(--bg-input, #1a2332);
  color: var(--text-primary, #e4e7eb);
  border: 1px solid var(--border-color, #2a3441);
  border-radius: var(--radius-md, 8px);
  padding: 10px 16px;
  font-family: var(--font-primary);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}

.mode-select:hover { border-color: var(--accent, #2dd4bf); }
.mode-select:focus { border-color: var(--accent, #2dd4bf); }

.game-btn {
  background: var(--bg-surface, #1a2332);
  border: 1px solid var(--border-color, #2a3441);
  color: var(--text-primary, #e4e7eb);
  padding: 10px 20px;
  border-radius: var(--radius-md, 8px);
  font-family: var(--font-primary);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.game-btn:hover {
  background: var(--bg-hover, #243044);
  border-color: var(--accent, #2dd4bf);
  color: var(--accent, #2dd4bf);
}

.game-btn.primary {
  background: var(--accent, #2dd4bf);
  border-color: var(--accent, #2dd4bf);
  color: #0f1923;
}

.game-btn.primary:hover {
  background: var(--accent-light, #5eead4);
  border-color: var(--accent-light, #5eead4);
}

.winner-modal {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 10000;
  display: none;
  align-items: center;
  justify-content: center;
}

.winner-modal.visible {
  display: flex;
}

.winner-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.85);
}

.winner-content {
  position: relative;
  z-index: 1;
  background: var(--bg-panel, #1a2332);
  border: 2px solid var(--accent, #2dd4bf);
  border-radius: var(--radius-lg, 12px);
  padding: 32px 24px;
  text-align: center;
  max-width: 400px;
  width: 90%;
  box-shadow: 0 16px 64px rgba(0, 0, 0, 0.5);
}

.winner-icon { font-size: 48px; margin-bottom: 16px; }

.winner-title {
  font-size: 24px;
  font-weight: 700;
  margin-bottom: 24px;
}

.tablo-toast {
  position: fixed;
  bottom: 80px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: var(--bg-panel, #1a2332);
  border: 1px solid var(--border-color, #2a3441);
  color: var(--text-primary, #e4e7eb);
  padding: 12px 24px;
  border-radius: var(--radius-md, 8px);
  font-size: 13px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
  z-index: 10001;
  opacity: 0;
  transition: opacity 0.3s ease, transform 0.3s ease;
  pointer-events: none;
}

.tablo-toast.visible {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

@media (max-width: 768px) {
  .cell { font-size: 2rem; }
  .game-controls { flex-direction: column; width: 100%; }
  .mode-select, .game-btn { width: 100%; justify-content: center; }
}

@media (max-width: 480px) {
  .game-stats { gap: 16px; padding: 12px 16px; }
  .stat-value { font-size: 18px; }
  .tic-tac-toe-board { gap: 4px; padding: 6px; max-width: 300px; }
}