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

body {
  font-family: 'Inter', sans-serif;
  min-height: 100vh;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  background: linear-gradient(135deg, #052e16, #14532d, #0f1a0f);
  color: #e0e0e0;
  padding: 16px;
}

#app {
  position: relative; z-index: 1;
  background: rgba(20, 20, 35, 0.55);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 24px;
  padding: 28px 24px 24px;
  max-width: 700px;
  width: 100%;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
  text-align: center;
}

.top-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}

.back-link {
  font-size: 0.85rem;
  color: #86efac;
  text-decoration: none;
  font-weight: 600;
  transition: color 0.2s;
}
.back-link:hover { color: #bbf7d0; }

h1 {
  font-size: 1.5rem;
  font-weight: 800;
  background: linear-gradient(90deg, #86efac, #22c55e, #16a34a);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.info-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
  padding: 10px 16px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  gap: 16px;
}

.info-item {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.9rem;
  font-weight: 700;
}
.info-icon { font-size: 1.1rem; }
.info-difficulte { color: #86efac; }
.info-chrono { color: #22d3ee; }
.info-niveau { color: #4ade80; }

/* Éléments masqués par l'attribut hidden (badge de record, invitation à s'inscrire) :
   l'emporte sur le display des classes (.record-badge en inline-block) */
[hidden] { display: none !important; }

/* Pads grid */
.pads-wrapper {
  display: flex;
  justify-content: center;
  margin-bottom: 12px;
}

.pads-grid {
  display: grid;
  gap: 12px;
  width: 100%;
  max-width: 500px;
}
/* Colonnes selon le nombre de pads (solo.php : 2, 3 ou 4 sur 2 rangées) */
.pads-grid.pads-cols-2 { grid-template-columns: repeat(2, 1fr); }
.pads-grid.pads-cols-3 { grid-template-columns: repeat(3, 1fr); }
.pads-grid.pads-cols-4 { grid-template-columns: repeat(4, 1fr); }

.pad {
  aspect-ratio: 4/3;
  border-radius: 16px;
  cursor: pointer;
  border: 3px solid rgba(255, 255, 255, 0.1);
  transition: filter 0.15s, transform 0.1s, box-shadow 0.15s, border-color 0.15s;
  filter: brightness(0.45);
  position: relative;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}
.pad:hover:not(.disabled) {
  filter: brightness(0.6);
  transform: scale(1.02);
}
.pad.active {
  filter: brightness(1);
  transform: scale(1.04);
  border-color: rgba(255, 255, 255, 0.5);
}
.pad.disabled {
  cursor: default;
}
.pad.error-flash {
  filter: brightness(0.2) !important;
}

.pad-rouge { background: #ef4444; box-shadow: 0 0 0 rgba(239, 68, 68, 0); }
.pad-rouge.active { box-shadow: 0 0 30px rgba(239, 68, 68, 0.7), inset 0 0 20px rgba(255, 255, 255, 0.15); }
.pad-bleu { background: #3b82f6; box-shadow: 0 0 0 rgba(59, 130, 246, 0); }
.pad-bleu.active { box-shadow: 0 0 30px rgba(59, 130, 246, 0.7), inset 0 0 20px rgba(255, 255, 255, 0.15); }
.pad-vert { background: #22c55e; box-shadow: 0 0 0 rgba(34, 197, 94, 0); }
.pad-vert.active { box-shadow: 0 0 30px rgba(34, 197, 94, 0.7), inset 0 0 20px rgba(255, 255, 255, 0.15); }
.pad-jaune { background: #facc15; box-shadow: 0 0 0 rgba(250, 204, 21, 0); }
.pad-jaune.active { box-shadow: 0 0 30px rgba(250, 204, 21, 0.7), inset 0 0 20px rgba(255, 255, 255, 0.15); }
.pad-orange { background: #f97316; box-shadow: 0 0 0 rgba(249, 115, 22, 0); }
.pad-orange.active { box-shadow: 0 0 30px rgba(249, 115, 22, 0.7), inset 0 0 20px rgba(255, 255, 255, 0.15); }
.pad-violet { background: #a855f7; box-shadow: 0 0 0 rgba(168, 85, 247, 0); }
.pad-violet.active { box-shadow: 0 0 30px rgba(168, 85, 247, 0.7), inset 0 0 20px rgba(255, 255, 255, 0.15); }
.pad-cyan { background: #06b6d4; box-shadow: 0 0 0 rgba(6, 182, 212, 0); }
.pad-cyan.active { box-shadow: 0 0 30px rgba(6, 182, 212, 0.7), inset 0 0 20px rgba(255, 255, 255, 0.15); }
.pad-rose { background: #ec4899; box-shadow: 0 0 0 rgba(236, 72, 153, 0); }
.pad-rose.active { box-shadow: 0 0 30px rgba(236, 72, 153, 0.7), inset 0 0 20px rgba(255, 255, 255, 0.15); }

.hint {
  font-size: 0.85rem;
  color: #86efac;
  margin-bottom: 12px;
  min-height: 1.4em;
  font-weight: 600;
}

/* Overlay */
.overlay {
  display: none;
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0, 0, 0, 0.85);
  z-index: 100;
  justify-content: center;
  align-items: center;
}
.overlay.visible { display: flex; }

.overlay-box {
  background: rgba(5, 46, 22, 0.95);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 20px;
  padding: 32px;
  text-align: center;
  max-width: 380px;
  width: 90%;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
}

.overlay-box h2 {
  font-size: 1.6rem;
  font-weight: 800;
  margin-bottom: 8px;
}

.overlay-box .win-text { color: #4ade80; }
.overlay-box .lose-text { color: #f87171; }

.overlay-box p {
  color: #94a3b8;
  font-size: 0.9rem;
  margin-bottom: 20px;
}

.btn {
  font-family: 'Inter', sans-serif;
  font-size: 0.9rem;
  font-weight: 700;
  padding: 10px 24px;
  border: none;
  border-radius: 10px;
  cursor: pointer;
  color: #fff;
  transition: transform 0.2s, box-shadow 0.2s;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  text-decoration: none;
}
.btn:hover { transform: translateY(-2px); }

.btn-primary {
  background: #16a34a;
  box-shadow: none;
}

.btn-secondary {
  background: #15803d;
  box-shadow: none;
}

.overlay-btns {
  display: flex;
  gap: 10px;
  justify-content: center;
}

.cta-score-msg {
  color: #86efac;
  font-size: 0.85rem;
  margin-bottom: 12px;
}

.cta-auth-btns {
  display: flex;
  gap: 10px;
  justify-content: center;
  margin-bottom: 16px;
}

.partage-score {
  margin-bottom: 16px;
}

.record-badge {
  display: inline-block;
  background: linear-gradient(135deg, #facc15, #f59e0b);
  color: #1a1a1a;
  font-weight: 800;
  font-size: 0.8rem;
  padding: 4px 12px;
  border-radius: 20px;
  margin-bottom: 12px;
}

/* Mute */
.btn-mute {
  background: none;
  border: 1px solid rgba(255,255,255,0.15);
  border-radius: 8px;
  color: #94a3b8;
  font-size: 1.1rem;
  padding: 4px 8px;
  cursor: pointer;
  transition: all 0.2s;
}
.btn-mute:hover { border-color: rgba(255,255,255,0.3); }
.btn-mute.muted { opacity: 0.4; }

/* Confetti */
.confetti {
  position: fixed;
  top: -10px;
  z-index: 200;
  pointer-events: none;
  font-size: 1.2rem;
  animation: confetti-fall 3s ease-in forwards;
}
@keyframes confetti-fall { to { transform: translateY(110vh) rotate(720deg); opacity: 0; } }

/* Footer */
footer { font-size: 0.78rem; color: #64748b; margin-top: 8px; }
footer a { color: #86efac; text-decoration: none; }
footer a:hover { color: #bbf7d0; }

@media (max-width: 480px) {
  #app { padding: 18px 12px 16px; border-radius: 18px; }
  h1 { font-size: 1.3rem; }
  .pads-grid { gap: 8px; }
  .info-bar { padding: 8px 10px; gap: 8px; }
  .info-item { font-size: 0.8rem; }
  .pad { border-radius: 12px; }
}
