/* Reset & sécurité */
html, body {
  width: 100%;
  max-width: 100%;
  overflow-x: hidden;
  margin: 0;
  height: 100vh;
  background: radial-gradient(circle at top, #0f0f0f, #000);
  font-family: system-ui, -apple-system, sans-serif;
}

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

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

/* Wrapper */
.game-wrapper {
  position: relative;
  width: 100%;
  max-width: 500px;
  margin: 20px auto;
}

/* Overlay */
.overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0,0,0,0.75);
  backdrop-filter: blur(6px);
  z-index: 10;
  pointer-events: auto;
  opacity: 1;
  transition: opacity 0.2s ease;
}

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

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

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

/* Bouton jouer */
.play-btn {
  font-family: "Zen Dots", sans-serif;
  font-size: 20px;
  padding: 12px 28px;
  border-radius: 12px;
  border: none;
  background: linear-gradient(135deg, #ff6a6a, #e74c3c);
  color: #fff;
  cursor: pointer;
  transition: 0.2s;
  box-shadow: 0 10px 30px rgba(231, 76, 60, 0.4);
}

.play-btn:hover {
  transform: translateY(-2px) scale(1.03);
  box-shadow: 0 15px 40px rgba(231, 76, 60, 0.6);
}

/* Canvas */
#game {
  display: block;
  margin: 0 auto;
  background: radial-gradient(circle, #111, #000);
  border-radius: 12px;
  border: 1px solid rgba(255,255,255,0.1);

  width: 100%;
  max-width: 500px;
  aspect-ratio: 1 / 1;

  box-shadow:
    0 0 20px rgba(255,255,255,0.05),
    inset 0 0 40px rgba(255,255,255,0.05);

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

/* HUD */
.hud {
  color: #fff;
  width: 100%;
  max-width: 500px;
  margin: 10px auto 0;
  padding: 0 12px;

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

/* Scoreline */
.scoreline {
  background: rgba(255,255,255,0.05);
  backdrop-filter: blur(6px);

  width: 100%;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: 6px 12px;

  text-align: center;
  margin: 12px 0;
  border-radius: 10px;
  font-size: 15px;
  padding: 10px 14px;

  border: 1px solid rgba(255,255,255,0.08);
}

.scoreline .item {
  white-space: nowrap;
}

.scoreline .sep {
  opacity: 0.4;
}

.scoreline span {
  max-width: 100%;
}

/* Leaderboard */
.leaderboard {
  width: 100%;
  max-width: 400px;
  margin-top: 10px;
  padding: 12px;

  background: rgba(255,255,255,0.04);
  border-radius: 10px;
  border: 1px solid rgba(255,255,255,0.08);
}

.leaderboard h3 {
  margin: 0 0 8px;
  font-size: 16px;
  opacity: 0.9;
}

.leaderboard ol {
  padding-left: 16px;
  margin: 0;
}

.leaderboard li {
  margin: 4px 0;
  opacity: 0.85;
}

#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 */
.score {
  opacity: 0.7;
}

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