/* Défis EVG — feuille de style unique, pensée mobile d'abord (ça se joue au téléphone). */

:root {
  --fond: #120c24;
  --fond-carte: #1d1636;
  --fond-carte-haut: #251c45;
  --trait: #372a5f;
  --texte: #f2eefc;
  --texte-doux: #b3a8d4;
  --vert: #35d07f;
  --vert-fond: rgba(53, 208, 127, 0.14);
  --rouge: #ff5d6c;
  --rouge-fond: rgba(255, 93, 108, 0.14);
  --or: #ffc94d;
  --rayon: 16px;
}

* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

body {
  margin: 0;
  padding: 0 0 2.5rem;
  background: radial-gradient(120% 60% at 50% 0%, #2a1d52 0%, var(--fond) 55%) no-repeat,
    var(--fond);
  color: var(--texte);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-size: 16px;
  line-height: 1.45;
  min-height: 100vh;
}

/* ─── En-tête collant : score toujours visible ─────────────────────────── */

.entete {
  position: sticky;
  top: 0;
  z-index: 10;
  padding: calc(env(safe-area-inset-top) + 0.9rem) 1rem 0;
  background: linear-gradient(180deg, #1a1236 0%, rgba(26, 18, 54, 0.97) 100%);
  border-bottom: 1px solid var(--trait);
  backdrop-filter: blur(8px);
}

.entete-haut {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

h1 {
  font-size: 1.15rem;
  margin: 0;
  letter-spacing: 0.01em;
}

.pseudo {
  width: 8.5rem;
  padding: 0.4rem 0.6rem;
  border: 1px solid var(--trait);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.05);
  color: var(--texte);
  font-size: 0.85rem;
  text-align: center;
}

.pseudo::placeholder {
  color: var(--texte-doux);
}

.pseudo:focus {
  outline: 2px solid var(--or);
  outline-offset: 1px;
}

.score {
  display: flex;
  align-items: baseline;
  justify-content: center;
  gap: 0.35rem;
  margin: 0.35rem 0 0.5rem;
}

.score-valeur {
  font-size: 3rem;
  font-weight: 800;
  line-height: 1;
  color: var(--or);
  font-variant-numeric: tabular-nums;
  transition: transform 0.18s ease;
}

.score-valeur.pulse {
  transform: scale(1.14);
}

.score-unite {
  color: var(--texte-doux);
  font-weight: 600;
}

.jauge {
  height: 7px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.1);
  overflow: hidden;
}

.jauge-barre {
  height: 100%;
  width: 0;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--or), var(--vert));
  transition: width 0.3s ease;
}

.prochaine {
  margin: 0.4rem 0 0.6rem;
  text-align: center;
  font-size: 0.82rem;
  color: var(--texte-doux);
}

/* ─── Onglets ──────────────────────────────────────────────────────────── */

.onglets {
  display: flex;
  gap: 0.4rem;
}

.onglet {
  flex: 1;
  padding: 0.6rem 0.15rem;
  border: none;
  border-bottom: 2px solid transparent;
  background: none;
  color: var(--texte-doux);
  font-family: inherit;
  /* 4 onglets doivent tenir sur un écran de 360 px sans être coupés. */
  font-size: 0.78rem;
  font-weight: 600;
  white-space: nowrap;
  cursor: pointer;
}

.onglet.actif {
  color: var(--texte);
  border-bottom-color: var(--or);
}

/* `display: inline-block` l'emporte sur la règle navigateur `[hidden]` :
   il faut donc masquer explicitement, sinon la pastille reste visible à 0. */
.pastille[hidden] {
  display: none;
}

.pastille {
  display: inline-block;
  min-width: 1.25rem;
  padding: 0 0.3rem;
  border-radius: 999px;
  background: var(--rouge);
  color: #fff;
  font-size: 0.72rem;
  line-height: 1.25rem;
}

/* ─── Contenu ──────────────────────────────────────────────────────────── */

main {
  padding: 0 1rem;
  max-width: 720px;
  margin: 0 auto;
}

.intro {
  color: var(--texte-doux);
  font-size: 0.85rem;
  margin: 1rem 0 0.5rem;
}

.categorie {
  margin: 1.25rem 0 0.6rem;
  display: flex;
  align-items: baseline;
  gap: 0.5rem;
}

.categorie h2 {
  font-size: 1rem;
  margin: 0;
}

.categorie .lieu {
  color: var(--texte-doux);
  font-size: 0.8rem;
}

.carte {
  background: linear-gradient(180deg, var(--fond-carte-haut), var(--fond-carte));
  border: 1px solid var(--trait);
  border-left: 4px solid var(--trait);
  border-radius: var(--rayon);
  padding: 0.85rem 0.9rem;
  margin-bottom: 0.7rem;
}

.carte.reussi {
  border-left-color: var(--vert);
  background: linear-gradient(180deg, var(--vert-fond), var(--fond-carte));
}

.carte.rate {
  border-left-color: var(--rouge);
  background: linear-gradient(180deg, var(--rouge-fond), var(--fond-carte));
}

.carte-titre {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.6rem;
  margin-bottom: 0.3rem;
}

.carte-titre h3 {
  font-size: 1rem;
  margin: 0;
}

.valeur {
  flex: none;
  padding: 0.15rem 0.5rem;
  border-radius: 999px;
  background: rgba(255, 201, 77, 0.16);
  color: var(--or);
  font-size: 0.78rem;
  font-weight: 700;
  white-space: nowrap;
}

.enonce {
  margin: 0 0 0.5rem;
  font-size: 0.9rem;
  color: #ded6f5;
}

.bonus {
  display: block;
  margin-top: 0.25rem;
  font-size: 0.8rem;
  color: var(--or);
}

.gage {
  margin: 0 0 0.6rem;
  font-size: 0.82rem;
  color: var(--texte-doux);
}

.gage b {
  color: var(--rouge);
  font-weight: 600;
}

.actions {
  display: flex;
  gap: 0.5rem;
}

.bouton {
  flex: 1;
  padding: 0.6rem 0.4rem;
  border: 1px solid var(--trait);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.04);
  color: var(--texte-doux);
  font-family: inherit;
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.bouton:active {
  transform: scale(0.98);
}

.bouton.on-vert {
  background: var(--vert);
  border-color: var(--vert);
  color: #06301c;
}

.bouton.on-rouge {
  background: var(--rouge);
  border-color: var(--rouge);
  color: #3d0007;
}

/* Défi cumulatif (Le Reporter) : compteur + / − */

.compteur {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin-bottom: 0.6rem;
}

.compteur button {
  width: 2.4rem;
  height: 2.4rem;
  flex: none;
  border: 1px solid var(--trait);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.05);
  color: var(--texte);
  font-size: 1.3rem;
  font-family: inherit;
  cursor: pointer;
}

.compteur button:disabled {
  opacity: 0.35;
  cursor: default;
}

.compteur-texte {
  font-size: 0.85rem;
  color: var(--texte-doux);
}

.compteur-texte b {
  color: var(--texte);
}

/* ─── Classement du groupe ─────────────────────────────────────────────── */

.bandeau {
  margin: 0.9rem 0 0;
  padding: 0.6rem 0.8rem;
  border: 1px dashed var(--or);
  border-radius: 12px;
  background: rgba(255, 201, 77, 0.1);
  color: var(--or);
  font-size: 0.85rem;
}

.etat-synchro {
  display: block;
  margin-top: 0.2rem;
}

.etat-synchro.hors-ligne {
  color: var(--or);
}

.liste-classement {
  display: grid;
  gap: 0.5rem;
}

.rang {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  padding: 0.7rem 0.85rem;
  border: 1px solid var(--trait);
  border-radius: var(--rayon);
  background: var(--fond-carte);
}

.rang.moi {
  border-color: var(--or);
  background: linear-gradient(180deg, rgba(255, 201, 77, 0.12), var(--fond-carte));
}

.place {
  flex: none;
  width: 2rem;
  text-align: center;
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--texte-doux);
}

.rang-bloc {
  flex: 1;
  min-width: 0;
}

.rang-nom {
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.rang-detail {
  font-size: 0.78rem;
  color: var(--texte-doux);
}

.rang-points {
  flex: none;
  font-size: 1.05rem;
  font-weight: 800;
  color: var(--or);
  font-variant-numeric: tabular-nums;
}

/* ─── Récompenses ──────────────────────────────────────────────────────── */

.liste-recompenses {
  display: grid;
  gap: 0.6rem;
}

.recompense {
  display: flex;
  gap: 0.75rem;
  align-items: flex-start;
  padding: 0.8rem 0.9rem;
  border: 1px solid var(--trait);
  border-radius: var(--rayon);
  background: var(--fond-carte);
  opacity: 0.72;
}

.recompense.debloquee {
  border-color: var(--vert);
  background: var(--vert-fond);
  opacity: 1;
}

.recompense .seuil {
  flex: none;
  min-width: 3.4rem;
  padding: 0.3rem 0;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.07);
  color: var(--texte-doux);
  font-weight: 700;
  font-size: 0.85rem;
  text-align: center;
}

.recompense.debloquee .seuil {
  background: var(--vert);
  color: #06301c;
}

.recompense .texte {
  font-size: 0.88rem;
}

.recompense.debloquee .texte {
  color: #c9f7de;
}

.recompense .reste {
  display: block;
  margin-top: 0.2rem;
  font-size: 0.78rem;
  color: var(--texte-doux);
}

/* ─── Gages ────────────────────────────────────────────────────────────── */

.liste-gages {
  display: grid;
  gap: 0.6rem;
}

.gage-carte {
  padding: 0.8rem 0.9rem;
  border: 1px solid var(--rouge);
  border-radius: var(--rayon);
  background: var(--rouge-fond);
}

.gage-carte h3 {
  margin: 0 0 0.25rem;
  font-size: 0.92rem;
  color: var(--rouge);
}

.gage-carte p {
  margin: 0;
  font-size: 0.9rem;
}

.vide {
  padding: 2rem 1rem;
  text-align: center;
  color: var(--texte-doux);
  font-size: 0.9rem;
}

/* ─── Pied de page ─────────────────────────────────────────────────────── */

.pied {
  max-width: 720px;
  margin: 2rem auto 0;
  padding: 0 1rem;
  text-align: center;
}

.raz {
  padding: 0.55rem 1.1rem;
  border: 1px solid var(--trait);
  border-radius: 999px;
  background: none;
  color: var(--texte-doux);
  font-family: inherit;
  font-size: 0.85rem;
  cursor: pointer;
}

.mention {
  margin: 0.6rem 0 0;
  font-size: 0.75rem;
  color: #7d729e;
}

@media (min-width: 640px) {
  .actions .bouton {
    font-size: 0.95rem;
  }
  h1 {
    font-size: 1.35rem;
  }
}
