:root {
  --violet: #5b3ebb;
  --violet-fonce: #3f2a8a;
  --violet-clair: #efeafb;
  --or: #ffb703;
  --argent: #9aa5c9;
  --succes: #2ead6b;
  --erreur: #e5533d;
  --texte: #2c2643;
  --fond: #f6f4fd;
  --carte: #ffffff;
  --bordure: #e3ddf7;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: "Nunito", sans-serif;
  background: var(--fond);
  color: var(--texte);
  min-height: 100vh;
}

h1, h2, h3, h4 { font-family: "Fredoka", sans-serif; margin: 0 0 6px; }

.ecran { display: none; padding: 20px 16px 60px; max-width: 760px; margin: 0 auto; }
.ecran-active { display: block; }

/* ---- En-tête / marque ---- */
.entete-mana {
  text-align: center;
  padding: 24px 0 8px;
}
.entete-mana .logo {
  font-size: 2rem;
  font-family: "Fredoka", sans-serif;
  color: var(--violet-fonce);
}
.entete-mana .logo span { color: var(--or); }
.entete-mana .sous-titre { color: #6a6285; margin-top: 4px; }

/* ---- Accueil (onboarding) ---- */
.carte-onboarding {
  background: var(--carte);
  border-radius: 20px;
  padding: 32px 24px;
  box-shadow: 0 10px 30px rgba(91, 62, 187, 0.12);
  text-align: center;
}
.carte-onboarding input {
  width: 100%;
  padding: 14px 16px;
  font-size: 1.1em;
  border-radius: 12px;
  border: 2px solid var(--bordure);
  margin: 16px 0;
  font-family: inherit;
}
.carte-onboarding input:focus { outline: none; border-color: var(--violet); }

/* ---- Boutons ---- */
.bouton {
  font-family: "Fredoka", sans-serif;
  border: none;
  border-radius: 14px;
  padding: 12px 26px;
  font-size: 1em;
  cursor: pointer;
  transition: transform 0.1s ease;
}
.bouton:active { transform: scale(0.97); }
.bouton-primaire { background: var(--violet); color: white; }
.bouton-primaire:hover { background: var(--violet-fonce); }
.bouton-secondaire { background: var(--violet-clair); color: var(--violet-fonce); }
.bouton-lien {
  background: none;
  border: none;
  color: #6a6285;
  text-decoration: underline;
  cursor: pointer;
  font-family: inherit;
  font-size: 0.9em;
}

/* ---- Barre de profil ---- */
.barre-profil {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
  background: var(--carte);
  border-radius: 16px;
  padding: 12px 18px;
  margin-bottom: 18px;
  box-shadow: 0 4px 14px rgba(91, 62, 187, 0.08);
}
.profil-contenu { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; width: 100%; }
.profil-identite { display: flex; align-items: center; gap: 10px; }
.profil-ceinture { font-size: 1.8em; }
.profil-nom { font-weight: 800; }
.profil-titre { font-size: 0.85em; color: #6a6285; }
.profil-stats { display: flex; gap: 14px; font-weight: 700; margin-left: auto; }
.mini-barre { flex-basis: 100%; height: 8px; background: var(--violet-clair); border-radius: 6px; overflow: hidden; }
.mini-barre-remplissage { height: 100%; background: linear-gradient(90deg, var(--or), var(--violet)); }

.barre-outils { text-align: right; margin-bottom: 6px; }

/* ---- Parcours des thèmes ---- */
.carte-theme {
  display: flex;
  align-items: center;
  gap: 16px;
  background: var(--carte);
  border-radius: 18px;
  padding: 16px 18px;
  margin-bottom: 14px;
  box-shadow: 0 6px 18px rgba(91, 62, 187, 0.08);
  border: 2px solid transparent;
}
.carte-theme-terminee { border-color: var(--succes); }
.carte-theme-verrouillee { opacity: 0.55; }
.carte-theme-icone { font-size: 2.2em; width: 56px; text-align: center; }
.carte-theme-corps { flex: 1; }
.carte-theme-corps p { margin: 4px 0; color: #6a6285; font-size: 0.92em; }
.etiquette-statut {
  display: inline-block;
  font-size: 0.78em;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: 999px;
  background: var(--violet-clair);
  color: var(--violet-fonce);
}
.carte-theme-terminee .etiquette-statut { background: #dff5e8; color: var(--succes); }

.bouton-stickers-flottant { display: block; margin: 20px auto 0; }

/* ---- Écran jeu ---- */
.entete-jeu { display: flex; align-items: center; justify-content: space-between; margin-bottom: 6px; }
.entete-jeu h2 { font-size: 1.2em; }
.barre-progression { height: 10px; background: var(--violet-clair); border-radius: 6px; overflow: hidden; margin-bottom: 14px; }
.barre-progression-remplissage { height: 100%; background: var(--violet); transition: width 0.3s ease; }
#progression-texte { font-size: 0.85em; color: #6a6285; margin-bottom: 4px; display: block; }

.panneau-regle {
  background: var(--violet-clair);
  border-radius: 14px;
  padding: 14px 16px;
  margin-bottom: 16px;
}
.panneau-regle.cachee { display: none; }
.bloc-regle { margin-bottom: 10px; }
.bloc-regle h4 { font-size: 0.95em; color: var(--violet-fonce); }
.bloc-regle p { margin: 2px 0; font-size: 0.9em; }
.bloc-regle ul { margin: 4px 0 0; padding-left: 18px; font-size: 0.88em; color: #443c68; }

.carte-exercice {
  background: var(--carte);
  border-radius: 18px;
  padding: 22px;
  box-shadow: 0 8px 24px rgba(91, 62, 187, 0.1);
}
.phrase-exercice { font-size: 1.15em; line-height: 2.1; }
.champ-trou {
  width: 130px;
  padding: 6px 10px;
  border: 2px solid var(--bordure);
  border-radius: 10px;
  font-family: inherit;
  font-size: 1em;
  text-align: center;
  margin: 0 4px;
}
.champ-trou:focus { outline: none; border-color: var(--violet); }
.espace-choix {
  display: inline-block;
  min-width: 90px;
  text-align: center;
  border-bottom: 3px dashed var(--violet);
  font-weight: 800;
  color: var(--violet-fonce);
  margin: 0 4px;
}

.options-choix { display: flex; flex-wrap: wrap; gap: 10px; margin: 16px 0; }
.puce-option {
  border: 2px solid var(--bordure);
  background: white;
  border-radius: 12px;
  padding: 10px 18px;
  font-family: inherit;
  font-size: 1em;
  cursor: pointer;
}
.puce-option.selectionnee { border-color: var(--violet); background: var(--violet-clair); }

.zone-action { margin-top: 16px; }
.zone-retour { margin-top: 14px; min-height: 20px; }
.indice { color: #6a6285; }
.retour-succes { color: var(--succes); font-weight: 800; font-size: 1.05em; }
.retour-erreur p { color: var(--erreur); font-weight: 700; margin-bottom: 8px; }
.rappel-regle { background: var(--violet-clair); border-radius: 12px; padding: 10px 14px; font-size: 0.9em; }
.rappel-regle p { color: var(--texte) !important; font-weight: 400 !important; margin: 6px 0; }
.bouton-continuer { margin-top: 12px; }

.toast-etoile {
  position: fixed;
  top: 40%;
  left: 50%;
  transform: translate(-50%, 0);
  font-size: 2em;
  font-weight: 800;
  color: var(--or);
  background: white;
  padding: 10px 22px;
  border-radius: 999px;
  box-shadow: 0 10px 30px rgba(0,0,0,0.15);
  animation: flotter 1.2s ease forwards;
  pointer-events: none;
  z-index: 50;
}
@keyframes flotter {
  0% { opacity: 0; transform: translate(-50%, 20px) scale(0.8); }
  20% { opacity: 1; transform: translate(-50%, 0) scale(1.1); }
  70% { opacity: 1; transform: translate(-50%, -10px) scale(1); }
  100% { opacity: 0; transform: translate(-50%, -40px) scale(0.9); }
}

/* ---- Écran fin de thème ---- */
.carte-recap {
  background: var(--carte);
  border-radius: 20px;
  padding: 32px 24px;
  text-align: center;
  box-shadow: 0 10px 30px rgba(91, 62, 187, 0.12);
}
.carte-recap .recap-icone-grande { font-size: 3.5em; }
.recap-ceinture { color: var(--violet-fonce); font-size: 1.1em; margin-top: 12px; }

/* ---- Stickers ---- */
.grille-stickers {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
  gap: 14px;
  margin: 20px 0;
}
.sticker {
  background: var(--carte);
  border-radius: 16px;
  padding: 16px 10px;
  text-align: center;
  box-shadow: 0 4px 14px rgba(91, 62, 187, 0.08);
}
.sticker-icone { font-size: 2em; }
.sticker-titre { font-size: 0.8em; margin-top: 6px; }
.sticker-verrouille { opacity: 0.4; }

@media (max-width: 480px) {
  .champ-trou { width: 100px; }
  .phrase-exercice { font-size: 1.05em; line-height: 2.4; }
}
