/* Empêche tout scroll horizontal */
html, body {
  width: 100%;
  max-width: 100%;
  overflow-x: hidden;
}

body {margin:0}

*, *::before, *::after {
  box-sizing: border-box;
}

.game h2 {
    font-family: "Zen Dots", sans-serif;
    margin-top: 30px;
    letter-spacing: 0.1em;
    text-align: center;
}


.game-wrapper {
  position: relative;
  width: 100%;
  max-width: 500px;
  margin: 0 auto;
}

.overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0,0,0,0.6); /* léger voile */
  z-index: 10;
}

.overlay-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  text-align: center;
}

.overlay-text {
  color: #fff;
  font-size: 18px;
  opacity: 0.9;
}

.overlay-text strong {
  font-size: 24px;
  color: #4cff9a;
}

.play-btn {
  font-family: "Zen Dots", sans-serif;
  font-size: 20px;
  padding: 12px 24px;
  border-radius: 10px;
  border: 1px solid #fff;
  background: rgba(0,0,0,0.8);
  color: #fff;
  cursor: pointer;
}

.play-btn:hover {
  background: rgba(255,255,255,0.1);
}

/* Canvas du jeu */
#game {
  display: block;
  margin: 0 auto;
  background: #000;
  border: 2px solid #fff;
  box-sizing: border-box; /* 🔥 CRUCIAL */
  width: 100%;              /* 🔥 full width */
  max-width: 500px;         /* limite desktop */
  aspect-ratio: 1 / 1;

  touch-action: none;
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;

  border-radius: 12px;
  border: 1px solid rgba(0,255,150,0.3);

  --glow-color: transparent; /* vert par défaut */
  box-shadow:
    0 0 10px rgba(var(--glow-color),0.6),
    0 0 30px rgba(var(--glow-color),0.4),
    0 0 60px rgba(var(--glow-color),0.25);

  transition: box-shadow 1.5s ease-out; /* 🔥 retour smooth */
  animation: neonPulse 5s infinite ease-in-out;
}

@keyframes neonPulse {
  0%, 100% {
    box-shadow:
      0 0 10px rgba(var(--glow-color),0.6),
      0 0 30px rgba(var(--glow-color),0.4),
      0 0 60px rgba(var(--glow-color),0.25);
  }
  50% {
    box-shadow:
      0 0 20px rgba(var(--glow-color),0.8),
      0 0 50px rgba(var(--glow-color),0.6),
      0 0 100px rgba(var(--glow-color),0.35);
  }
}

/* HUD */
.hud {
  color: #fff;

 width: 100%;
max-width: 500px;
  max-width: 100%;
  margin: 0px auto 0;
  padding: 0 12px;

  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: center;

  overflow-x: hidden; /* ✅ coupe tout débordement interne */
}

/* Ligne d'état */
.line {
  width: 100%;
  max-width: 100%;
  display: flex;
  gap: 10px;
  justify-content: center;
  align-items: center;
  flex-wrap: wrap;
}

/* Scoreline : doit pouvoir casser (sinon scroll) */
.scoreline{
    background: rgba(0, 0, 0, 0.5);
    width: 100%;
    max-width: 500px;
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    align-items: center;
    gap: 6px 10px;
    text-align: center;
    margin: 12px 0;
    border-radius: 8px;
    font-size: 16px;
    opacity: 0.95;
    overflow-x: hidden;
    padding: 10px 0;
}

.scoreline .item{
  white-space: nowrap; /* chaque item reste compact */
}

.scoreline .sep{
  opacity: 0.6;
  user-select: none;
}

/* Optionnel : évite qu'un span impose une largeur */
.scoreline span {
  max-width: 100%;
}

.status {
  min-height: 22px;
}

.btn {
  background: transparent;
  color: #fff;
  border: 1px solid #fff;
  padding: 6px 12px;
  border-radius: 6px;
  cursor: pointer;
}

.btn:hover {
  background: rgba(255,255,255,0.1);
}

/* Leaderboard */
.leaderboard {
  width: min(400px, 100%);
  max-width: 100%;
  margin: 12px auto 0;
  padding: 0 12px;
  color: #fff;
  overflow-x: hidden;
}

#leaderboardList {
  list-style: none;
  padding: 0;
  margin: 0;
}

#leaderboardList li {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 2px 0;
  font-size: 14px;
}

/* cercle */
.rank {
  width: 26px;
  height: 26px;
  min-width: 26px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: bold;
  font-size: 13px;
  background: #2c2c2c;
  color: white;
}

/* TOP 3 */
.rank.gold {
  background: linear-gradient(135deg, #ffd700, #ffb400);
  color: #000;
  box-shadow: 0 0 8px rgba(255, 215, 0, 0.6);
}

.rank.silver {
  background: linear-gradient(135deg, #c0c0c0, #9e9e9e);
  color: #000;
}

.rank.bronze {
  background: linear-gradient(135deg, #cd7f32, #a05a2c);
  color: #fff;
}

.score {
  opacity: 0.7;
}

@media (max-width: 360px){
  .scoreline .sep{ display:none; }
}
