:root {
  --neon-blue: #6ea8ff;
  --neon-purple: #b889ff;
  --neon-glow: 0 0 10px rgba(120, 90, 255, 0.6),
               0 0 20px rgba(80, 120, 255, 0.4),
               0 0 40px rgba(150, 100, 255, 0.3);
}

/* Reset de base */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
  background: radial-gradient(circle at top left, #7f5dff 0%, #4b63d9 30%, #2b2e77 70%, #141527 100%);
  min-height: 100vh;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 20px;
  color: #f5f5ff;
}

/* Carte principale */
.container {
  background: rgba(15, 16, 40, 0.85);
  backdrop-filter: blur(16px);
  border-radius: 25px;
  padding: 40px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  box-shadow:
    0 0 20px rgba(120, 90, 255, 0.3),
    0 0 40px rgba(30, 50, 150, 0.35);
  text-align: center;
  max-width: 500px;
  width: 100%;
}

/* Titre néon */
h1 {
  color: var(--neon-purple);
  margin-bottom: 10px;
  font-size: 2.5em;
  text-shadow:
    0 0 6px var(--neon-purple),
    0 0 14px var(--neon-blue),
    0 0 28px var(--neon-purple);
}

.status {
  font-size: 1.1em;
  margin: 15px 0 20px;
  color: #e0e4ff;
  min-height: 40px;
}

/* Sélecteur de mode */
.mode-select {
  display: flex;
  justify-content: center;
  gap: 10px;
  margin-bottom: 15px;
  flex-wrap: wrap;
}

.mode-btn {
  background: rgba(255, 255, 255, 0.06);
  color: #e6e6ff;
  border: 1px solid var(--neon-purple);
  padding: 8px 16px;
  border-radius: 20px;
  cursor: pointer;
  font-size: 0.9em;
  font-weight: 600;
  transition: all 0.2s ease-out;
  box-shadow: 0 0 8px rgba(0, 0, 0, 0.4);
}

.mode-btn:hover {
  background: rgba(255, 255, 255, 0.12);
  box-shadow:
    0 0 12px var(--neon-blue),
    0 0 24px var(--neon-purple);
  transform: translateY(-2px);
}

.mode-btn.mode-active {
  background: linear-gradient(135deg, var(--neon-purple), var(--neon-blue));
  color: white;
  box-shadow:
    0 0 15px var(--neon-purple),
    0 0 30px var(--neon-blue);
}

/* Choix du symbole */
.symbol-select {
  display: flex;
  justify-content: center;
  gap: 10px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.symbol-btn {
  background: rgba(255, 255, 255, 0.06);
  color: #e6e6ff;
  border: 1px solid var(--neon-blue);
  padding: 8px 16px;
  border-radius: 20px;
  cursor: pointer;
  font-size: 0.9em;
  font-weight: 600;
  transition: all 0.2s ease-out;
  box-shadow: 0 0 8px rgba(0, 0, 0, 0.4);
}

.symbol-btn:hover {
  background: rgba(255, 255, 255, 0.12);
  box-shadow:
    0 0 12px var(--neon-blue),
    0 0 24px var(--neon-purple);
  transform: translateY(-2px);
}

.symbol-btn.symbol-active {
  background: linear-gradient(135deg, var(--neon-purple), var(--neon-blue));
  color: white;
  box-shadow:
    0 0 15px var(--neon-purple),
    0 0 30px var(--neon-blue);
}

/* Grille du morpion */
.board {
  position: relative; /* important pour le laser */
  display: grid;
  grid-template-columns: repeat(3, min(100px, 25vw));
  grid-template-rows: repeat(3, min(100px, 25vw));
  gap: 15px;
  margin: 20px auto 30px;
  justify-content: center;
  padding: 12px;
  border-radius: 22px;
  background: radial-gradient(circle at top, rgba(255, 255, 255, 0.08), rgba(0, 0, 0, 0.25));
  box-shadow: 0 0 25px rgba(120, 90, 255, 0.35);
}

/* Cases */
.cell {
  background: rgba(255, 255, 255, 0.10);
  border: 2px solid rgba(255, 255, 255, 0.18);
  border-radius: 14px;
  font-size: 3em;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.22s ease-out;
  color: var(--neon-purple);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 0 10px rgba(130, 100, 255, 0.25);
}

/* Hover discret pour ne pas masquer X / O */
.cell:hover:not(.taken) {
  background: transparent;
  transform: scale(1.015);
  box-shadow:
    0 0 8px rgba(120, 90, 255, 0.45),
    inset 0 0 6px rgba(120, 90, 255, 0.30);
}

.cell.taken {
  cursor: not-allowed;
}

.cell.x {
  color: var(--neon-blue);
  text-shadow:
    0 0 8px var(--neon-blue),
    0 0 16px var(--neon-purple);
}

.cell.o {
  color: var(--neon-purple);
  text-shadow:
    0 0 8px var(--neon-purple),
    0 0 16px var(--neon-blue);
}

/* Cases gagnantes : glow néon renforcé */
.cell.winner {
  background: rgba(255, 255, 255, 0.18);
  box-shadow:
    0 0 20px rgba(110, 168, 255, 0.8),
    0 0 45px rgba(184, 137, 255, 0.7),
    0 0 70px rgba(110, 168, 255, 0.6);
  animation: winnerPulse 0.9s infinite alternate ease-in-out;
  border: 2px solid rgba(255, 255, 255, 0.9);
  transform: scale(1.04);
}

/* Animation pulsée plus forte pour les cases gagnantes */
@keyframes winnerPulse {
  0% {
    transform: scale(1.04);
    box-shadow:
      0 0 18px rgba(110, 168, 255, 0.7),
      0 0 35px rgba(184, 137, 255, 0.5),
      0 0 50px rgba(110, 168, 255, 0.4);
  }
  100% {
    transform: scale(1.08);
    box-shadow:
      0 0 30px rgba(110, 168, 255, 1),
      0 0 60px rgba(184, 137, 255, 0.9),
      0 0 90px rgba(110, 168, 255, 0.8);
  }
}

/* LASER LUMINEUX DE VICTOIRE */
#laser {
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.3s ease-out;
  z-index: 5;
}

.laser-line {
  position: absolute;
  height: 6px;
  background: linear-gradient(
    90deg,
    rgba(110,168,255,0) 0%,
    rgba(110,168,255,1) 50%,
    rgba(110,168,255,0) 100%
  );
  border-radius: 4px;
  box-shadow:
    0 0 12px rgba(110,168,255,1),
    0 0 24px rgba(184,137,255,0.8);
  transform-origin: 0% 50%;
  --angle: 0deg;                 /* <-- angle dynamique */
  animation: laserGrow 0.45s ease-out forwards;
}

@keyframes laserGrow {
  from { transform: rotate(var(--angle)) scaleX(0); }
  to   { transform: rotate(var(--angle)) scaleX(1); }
}


/* Animation quand un symbole est posé */
@keyframes cellPop {
  0% {
    transform: scale(0.4);
    opacity: 0;
    box-shadow: none;
  }
  60% {
    transform: scale(1.1);
    opacity: 1;
    box-shadow:
      0 0 14px rgba(110, 168, 255, 0.9),
      0 0 26px rgba(184, 137, 255, 0.7);
  }
  100% {
    transform: scale(1);
    opacity: 1;
    box-shadow:
      0 0 10px rgba(130, 100, 255, 0.25);
  }
}

.cell.placed {
  animation: cellPop 0.18s ease-out;
}

/* Boutons de contrôle */
.controls {
  display: flex;
  gap: 15px;
  justify-content: center;
  flex-wrap: wrap;
  margin-bottom: 20px;
}

/* Uniquement les boutons de contrôle, pas les cases du plateau */
.controls button {
  background: linear-gradient(135deg, var(--neon-blue), var(--neon-purple));
  color: white;
  border: none;
  padding: 12px 20px;
  font-size: 0.95em;
  border-radius: 25px;
  cursor: pointer;
  transition: all 0.2s ease-out;
  font-weight: 600;
  box-shadow: var(--neon-glow);
}

.controls button:hover {
  background: linear-gradient(135deg, var(--neon-purple), var(--neon-blue));
  transform: translateY(-3px) scale(1.03);
  box-shadow:
    0 0 18px var(--neon-blue),
    0 0 30px var(--neon-purple);
}

/* Scores */
.scores {
  display: flex;
  justify-content: center;
  gap: 20px;
  margin-top: 20px;
  font-size: 1.05em;
  flex-wrap: wrap;
}

.score-item {
  padding: 10px 16px;
  background: rgba(255, 255, 255, 0.06);
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.19);
  box-shadow: 0 0 10px rgba(0, 0, 0, 0.35);
}

.score-label {
  font-weight: 600;
  color: #d0d4ff;
}

.score-value {
  font-size: 1.4em;
  font-weight: 700;
  margin-left: 6px;
}

.x-score {
  color: var(--neon-blue);
}

.o-score {
  color: var(--neon-purple);
}

.draw-score {
  color: #bbbbff;
}

/* Responsive */
@media (max-width: 480px) {
  .container {
    padding: 26px;
  }

  h1 {
    font-size: 2em;
  }

  .board {
    gap: 10px;
    padding: 10px;
  }
}
