/* ===========================================================
   Mini-Jeux de la Famille — styles
   Palette volontairement vive et non genree, gros boutons tactiles
   (min 44px de haut) pour une utilisation facile sur tablette par
   des enfants de 8 a 12 ans.
   =========================================================== */

:root {
  --fond: #f4f7ff;
  --carte: #ffffff;
  --texte: #26324a;
  --texte-doux: #6b7690;
  --bleu: #4a7bff;
  --bleu-fonce: #3660d6;
  --violet: #8b5bff;
  --vert: #2fbf71;
  --orange: #ff9a3d;
  --rose: #ff5b9c;
  --jaune: #ffd93b;
  --rouge: #ff5b5b;
  --ombre: 0 6px 18px rgba(38, 50, 74, 0.12);
  --rayon: 18px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: linear-gradient(180deg, #eaf0ff 0%, #f9f5ff 100%);
  color: var(--texte);
  font-family: "Segoe UI", "Trebuchet MS", system-ui, sans-serif;
  min-height: 100vh;
}

h1 { font-size: 1.6rem; margin: 0 0 20px; text-align: center; }
h2 { font-size: 1.2rem; margin: 24px 0 12px; }

#app { max-width: 900px; margin: 0 auto; padding: 20px 16px 60px; }

/* ---------- En-tete profil actif ---------- */
.entete {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 16px;
  background: var(--carte);
  box-shadow: var(--ombre);
  position: sticky;
  top: 0;
  z-index: 10;
  flex-wrap: wrap;
}
.entete-profil { display: flex; align-items: center; gap: 10px; }
.entete-avatar { font-size: 2rem; }
.entete-texte { display: flex; flex-direction: column; }
.entete-nom { font-weight: 700; font-size: 1.05rem; }
.entete-etoiles { color: var(--texte-doux); font-size: 0.9rem; }

/* ---------- Ecrans ---------- */
.ecran[hidden] { display: none; }
.entete[hidden] { display: none; }

/* ---------- Boutons generaux ---------- */
.btn {
  font-family: inherit;
  font-size: 1rem;
  font-weight: 700;
  border: none;
  border-radius: 14px;
  padding: 14px 18px;
  min-height: 48px;
  cursor: pointer;
  transition: transform 0.08s ease, box-shadow 0.08s ease;
  box-shadow: var(--ombre);
}
.btn:active { transform: scale(0.97); }
.btn-principal { background: linear-gradient(135deg, var(--vert), #1f9d5c); color: #fff; }
.btn-secondaire { background: #eef1fb; color: var(--texte); }
.btn-niveau { background: #eef1fb; color: var(--texte); flex: 1; }
.btn-niveau.actif { background: linear-gradient(135deg, var(--bleu), var(--bleu-fonce)); color: #fff; }

/* ---------- Ecran profils ---------- */
.grille-profils {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 16px;
}
.carte-profil {
  background: var(--carte);
  border-radius: var(--rayon);
  box-shadow: var(--ombre);
  border: none;
  padding: 22px 14px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  font-family: inherit;
}
.carte-profil:active { transform: scale(0.97); }
.carte-profil .avatar { font-size: 3rem; }
.carte-profil .nom { font-weight: 700; font-size: 1.1rem; }
.carte-profil .sous-titre { color: var(--texte-doux); font-size: 0.85rem; }
.carte-profil .modifier { color: var(--bleu); font-size: 0.8rem; margin-top: 4px; }

/* ---------- Editeur de profil ---------- */
.editeur-profil {
  background: var(--carte);
  border-radius: var(--rayon);
  box-shadow: var(--ombre);
  padding: 22px;
  max-width: 480px;
  margin: 0 auto;
}
.label-section { font-weight: 700; margin: 16px 0 8px; }
.grille-avatars {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 8px;
}
.btn-avatar {
  font-size: 1.8rem;
  background: #eef1fb;
  border: 3px solid transparent;
  border-radius: 12px;
  padding: 8px 0;
  cursor: pointer;
}
.btn-avatar.actif { border-color: var(--bleu); background: #dce7ff; }
.champ-texte {
  width: 100%;
  font-size: 1.1rem;
  padding: 12px 14px;
  border-radius: 12px;
  border: 2px solid #dfe4f5;
  font-family: inherit;
}
.choix-niveau { display: flex; gap: 10px; }
.actions { display: flex; gap: 10px; margin-top: 20px; }
.actions .btn { flex: 1; }

/* ---------- Menu des jeux ---------- */
.grille-jeux {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 16px;
}
.carte-jeu {
  background: var(--carte);
  border: none;
  border-radius: var(--rayon);
  box-shadow: var(--ombre);
  padding: 24px 12px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  font-family: inherit;
}
.carte-jeu:active { transform: scale(0.97); }
.carte-jeu-emoji { font-size: 2.6rem; }
.carte-jeu-titre { font-weight: 700; font-size: 1.05rem; }
.carte-jeu-categorie { color: var(--texte-doux); }

.section-badges, .section-sauvegarde { margin-top: 8px; }
.grille-badges { display: flex; flex-wrap: wrap; gap: 10px; }
.badge {
  background: var(--carte);
  border-radius: 14px;
  box-shadow: var(--ombre);
  padding: 10px 14px;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.9rem;
  opacity: 0.35;
}
.badge.debloque { opacity: 1; }
.badge .emoji { font-size: 1.4rem; }
.section-sauvegarde { display: flex; gap: 10px; flex-wrap: wrap; }

/* ---------- Zone de jeu ---------- */
.entete-jeu { display: flex; justify-content: space-between; gap: 10px; margin-bottom: 16px; flex-wrap: wrap; }

.carte-question {
  background: var(--carte);
  border-radius: var(--rayon);
  box-shadow: var(--ombre);
  padding: 24px;
  text-align: center;
}
.progression-jeu { color: var(--texte-doux); margin-bottom: 8px; font-weight: 700; }
.enonce-question { font-size: 1.3rem; font-weight: 700; margin: 12px 0 20px; }
.grille-reponses {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 12px;
}
.btn-reponse {
  background: #eef1fb;
  border: 3px solid transparent;
  border-radius: 14px;
  padding: 16px 10px;
  font-size: 1.05rem;
  font-weight: 700;
  font-family: inherit;
  cursor: pointer;
  min-height: 56px;
}
.btn-reponse.correcte { background: #d8f7e4; border-color: var(--vert); }
.btn-reponse.incorrecte { background: #ffe1e1; border-color: var(--rouge); }
.btn-reponse:disabled { cursor: default; }

.ecran-fin-jeu { text-align: center; }
.ecran-fin-jeu .etoiles-resultat { font-size: 2.4rem; margin: 14px 0; }

/* ---------- Jeu de dessin ---------- */
.zone-dessin { display: flex; flex-direction: column; gap: 12px; align-items: center; }
#canevas-dessin {
  background: #ffffff;
  border-radius: 14px;
  box-shadow: var(--ombre);
  touch-action: none;
  max-width: 100%;
}
.barre-outils-dessin {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  justify-content: center;
  background: var(--carte);
  border-radius: 14px;
  box-shadow: var(--ombre);
  padding: 12px;
  width: 100%;
}
.palette-couleurs { display: flex; gap: 6px; flex-wrap: wrap; }
.pastille-couleur {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 3px solid transparent;
  cursor: pointer;
  padding: 0;
}
.pastille-couleur.actif { border-color: var(--texte); }
.reglage-taille { display: flex; align-items: center; gap: 6px; }

/* ---------- Overlay de victoire ---------- */
.overlay {
  position: fixed;
  inset: 0;
  background: rgba(38, 50, 74, 0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 50;
  padding: 20px;
}
.overlay[hidden] { display: none; }
.carte-victoire {
  background: var(--carte);
  border-radius: 22px;
  padding: 30px;
  text-align: center;
  max-width: 360px;
  width: 100%;
  position: relative;
  overflow: hidden;
}
.carte-victoire h2 { margin-top: 0; font-size: 1.6rem; }
.confettis { position: absolute; inset: 0; pointer-events: none; overflow: hidden; }
.confetti-piece {
  position: absolute;
  top: -20px;
  width: 10px;
  height: 14px;
  border-radius: 2px;
  animation: chute 1.6s ease-in forwards;
}
@keyframes chute {
  to { transform: translateY(340px) rotate(360deg); opacity: 0.2; }
}

/* ---------- Marque de l'application ---------- */
.marque-app { font-weight: 800; letter-spacing: 0.02em; color: var(--bleu-fonce); font-size: 1.05rem; }
.marque-accueil { text-align: center; font-weight: 800; letter-spacing: 0.08em; color: var(--bleu); margin: 0 0 4px; }

/* ---------- Rythme ---------- */
.grille-pads-rythme {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  max-width: 320px;
  margin: 0 auto;
}
.pad-rythme {
  aspect-ratio: 1 / 1;
  border: none;
  border-radius: 18px;
  cursor: pointer;
  opacity: 0.75;
  transition: opacity 0.1s, transform 0.1s;
}
.pad-rythme.actif { opacity: 1; transform: scale(0.96); }
.pad-rythme:nth-child(1) { background: var(--rouge); }
.pad-rythme:nth-child(2) { background: var(--bleu); }
.pad-rythme:nth-child(3) { background: var(--jaune); }
.pad-rythme:nth-child(4) { background: var(--vert); }

@media (max-width: 480px) {
  h1 { font-size: 1.3rem; }
  .entete-jeu { flex-direction: column; align-items: stretch; }
}
