/* À la recherche des héros : plateau du Petit Chaperon rouge et schéma actantiel */
:root {
  --pc: var(--corail);
  --r-sujet: var(--jaune); --r-objet: var(--orange); --r-destinateur: var(--ciel);
  --r-destinataire: var(--rose); --r-adjuvant: var(--vert); --r-opposant: var(--corail);
  --foret: #2F6B4F; --galette: #E9A93B;
}
body { background: var(--creme); }
.jeu-zone { max-width: 760px; }
.petit { font-size: .9rem; opacity: .8; }

/* ---------- Schéma du héros (toujours visible) ---------- */
.schema { margin: 0 0 16px; padding: 12px; background: var(--papier); border: var(--trait) solid var(--encre); border-radius: 22px; box-shadow: 5px 5px 0 var(--encre); }
.schema-tete { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin: 0 4px 8px; }
.schema-titre { font-family: var(--police-titre); font-size: 1.1rem; }
.schema-histoire { font-size: .85rem; font-weight: 800; opacity: .7; text-align: right; }
.schema-grille { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 8px; align-items: stretch; }
.axe { grid-column: 1 / -1; margin: 2px 4px -2px; font-size: .7rem; font-weight: 800; text-transform: uppercase; letter-spacing: .05em; opacity: .65; }
.role { display: flex; align-items: center; gap: 8px; min-height: 58px; padding: 6px 8px; text-align: left; border: var(--trait) solid var(--encre); border-radius: 16px; background: var(--papier); box-shadow: 3px 3px 0 var(--encre); cursor: pointer; font: inherit; color: inherit; }
.role:hover { transform: translate(-1px, -1px); }
.role-pastille { flex: 0 0 auto; width: 40px; height: 40px; border-radius: 50%; border: var(--trait) solid var(--encre); display: grid; place-items: center; }
.role-pastille svg { width: 28px; height: 28px; }
.role-texte { display: flex; flex-direction: column; min-width: 0; line-height: 1.15; }
.role-nom { font-family: var(--police-titre); font-size: 1rem; }
.role-info { font-size: .8rem; opacity: .75; }
.role.rempli .role-info { opacity: 1; font-weight: 800; }
.role.rempli .autocollant { display: inline-block; margin-top: 2px; padding: 1px 8px; border: 2px solid var(--encre); border-radius: 10px; background: var(--creme); transform: rotate(-2deg); animation: colle .45s backwards; }
@keyframes colle { from { transform: scale(0) rotate(-20deg); } 70% { transform: scale(1.15) rotate(3deg); } to { transform: scale(1) rotate(-2deg); } }
.fond-sujet { background: var(--r-sujet); } .fond-objet { background: var(--r-objet); }
.fond-destinateur { background: var(--r-destinateur); } .fond-destinataire { background: var(--r-destinataire); }
.fond-adjuvant { background: var(--r-adjuvant); } .fond-opposant { background: var(--r-opposant); }

/* ---------- Écrans ---------- */
.ecran { display: flex; flex-direction: column; gap: 14px; }
.guide { display: flex; align-items: flex-start; gap: 12px; text-align: left; }
.guide svg { flex: 0 0 auto; width: 84px; height: 84px; }
.bulle { position: relative; margin: 0; padding: 12px 14px; background: var(--creme); border: var(--trait) solid var(--encre); border-radius: 18px; }
.boutons { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; }
.btn-couleur { background: var(--pc); }
.btn-petit { padding: 7px 12px; font-size: .92rem; box-shadow: 3px 3px 0 var(--encre); }

/* Carnet des héros */
.carte-role { width: 100%; display: flex; flex-direction: column; align-items: center; gap: 10px; }
.carte-role .grande-pastille { width: 92px; height: 92px; border-radius: 50%; border: var(--trait) solid var(--encre); display: grid; place-items: center; box-shadow: 4px 4px 0 var(--encre); }
.carte-role .grande-pastille svg { width: 62px; height: 62px; }
.carte-role h2 { font-size: 1.8rem; }
.carte-role .question-cle { margin: 0; font-family: var(--police-titre); font-size: 1.2rem; }
.carte-role .encart { width: 100%; margin: 0; padding: 10px 12px; text-align: left; border: 2px solid var(--encre); border-radius: 14px; background: var(--creme); }
.points { display: flex; gap: 6px; justify-content: center; }
.points span { width: 12px; height: 12px; border-radius: 50%; border: 2px solid var(--encre); background: var(--papier); }
.points span.actif { background: var(--encre); }

/* Plateau */
.plateau { display: flex; flex-direction: column; gap: 14px; }
.etape-plateau { display: flex; flex-direction: column; gap: 10px; padding: 14px; background: var(--papier); border: var(--trait) solid var(--encre); border-radius: 20px; box-shadow: 4px 4px 0 var(--encre); }
.etape-plateau.fermee { background: #F1EFEA; }
.etape-tete { display: flex; align-items: center; gap: 10px; }
.etape-tete svg { flex: 0 0 auto; width: 46px; height: 46px; }
.etape-tete h2 { font-size: 1.15rem; }
.etape-tete p { margin: 0; font-size: .85rem; opacity: .75; }
.chemin { position: relative; display: flex; justify-content: space-between; gap: 6px; padding: 4px 2px; }
.chemin::before { content: ""; position: absolute; left: 24px; right: 24px; top: 50%; border-top: 4px dashed var(--foret); opacity: .45; }
.case { position: relative; z-index: 1; width: 50px; height: 50px; border-radius: 50%; border: var(--trait) solid var(--encre); background: var(--gris); font-family: var(--police-titre); font-size: 1.2rem; display: grid; place-items: center; cursor: pointer; box-shadow: 3px 3px 0 var(--encre); padding: 0; }
.case svg { width: 26px; height: 26px; }
.case.faite { background: var(--vert); }
.case.ouverte { background: var(--jaune); animation: appel 1.6s ease-in-out infinite; }
.case.fermee { cursor: not-allowed; opacity: .6; box-shadow: none; }
@keyframes appel { 50% { transform: scale(1.1); } }
.prochaine { margin: 0; font-size: .9rem; font-weight: 800; text-align: center; }

/* Épreuve */
.barre { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; }
.barre h2 { font-size: 1.15rem; }
.panier { display: flex; align-items: center; gap: 4px; }
.panier svg { width: 32px; height: 32px; transition: transform .3s, opacity .3s; }
.panier svg.tombee { opacity: .25; transform: translateY(6px) rotate(40deg); filter: grayscale(1); }
.carte-ex { align-items: stretch; text-align: left; }
.carte-ex .jeu-question { font-size: clamp(1.15rem, 3.8vw, 1.5rem); text-align: left; }
.etiquette-role { align-self: flex-start; display: inline-flex; align-items: center; gap: 6px; padding: 2px 10px 2px 4px; border: 2px solid var(--encre); border-radius: 999px; font-weight: 800; font-size: .85rem; cursor: pointer; }
.etiquette-role svg { width: 20px; height: 20px; }
.vf { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.vf .btn { justify-content: center; font-size: 1.15rem; }
.vf .btn.bonne { background: var(--vert); } .vf .btn.mauvaise { background: var(--rose); }
.choix .btn.bonne:disabled, .choix .btn.mauvaise:disabled, .vf .btn.bonne:disabled, .vf .btn.mauvaise:disabled { opacity: 1; }
.jeu-explication { font-size: 1rem; opacity: 1; padding: 10px 12px; border-radius: 14px; background: var(--creme); border: 2px solid var(--encre); }
.jeu-explication:empty { display: none; }
.suite { align-self: center; }

/* Étiquettes (trier, grille) */
.reserve { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; min-height: 54px; padding: 10px; border: 2px dashed var(--encre); border-radius: 14px; background: var(--papier); }
.jeton { font-size: .95rem; text-align: center; }
.jeton.choisi { background: var(--ciel); }
.jeton.secoue { animation: secoue .4s; }
@keyframes secoue { 20%, 60% { transform: translateX(-6px); } 40%, 80% { transform: translateX(6px); } }
.categorie { cursor: pointer; }
.categorie.cible { background: #FFF3C4; }
.cases-grille { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.case-grille { min-height: 84px; padding: 6px; border: var(--trait) solid var(--encre); border-radius: 16px; display: flex; flex-direction: column; align-items: center; gap: 4px; cursor: pointer; background: var(--papier); }
.case-grille .case-grille-tete { display: flex; align-items: center; gap: 6px; padding: 1px 8px 1px 2px; border-radius: 999px; border: 2px solid var(--encre); font-family: var(--police-titre); font-size: .95rem; }
.case-grille .case-grille-tete svg { width: 22px; height: 22px; }
.case-grille .case-grille-q { font-size: .74rem; opacity: .7; text-align: center; }
.case-grille.cible { background: #FFF3C4; }
.case-grille .jeton { cursor: default; }

/* Relier */
.relier { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.4fr); gap: 8px 12px; }
.relier-col { display: flex; flex-direction: column; gap: 8px; }
.relier .btn { width: 100%; justify-content: flex-start; text-align: left; font-size: .95rem; padding: 9px 10px; }
.relier .btn.choisi { background: var(--ciel); }
.relier .btn.relie { background: var(--vert); pointer-events: none; }
.relier .btn .num { flex: 0 0 auto; width: 24px; height: 24px; border-radius: 50%; background: var(--papier); border: 2px solid var(--encre); display: grid; place-items: center; font-size: .8rem; }

/* Récit */
.recit { display: flex; flex-direction: column; gap: 12px; text-align: left; }
.recit h3 { font-size: 1.05rem; margin-bottom: 2px; }
.recit p { margin: 0; }
.partie-recit { padding: 10px 12px; border-left: 6px solid var(--pc); background: var(--creme); border-radius: 0 12px 12px 0; }

/* Découvrir l'histoire (v2) : vidéo ou texte complet */
.choix-histoire { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 14px; width: 100%; margin: 14px 0 6px; }
.choix-carte { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 14px 12px; background: var(--creme); border: var(--trait) solid var(--encre); border-radius: 18px; box-shadow: 4px 4px 0 var(--encre); text-align: center; }
.choix-carte svg { width: 64px; height: 64px; }
.choix-carte h3 { margin: 0; font-size: 1.15rem; }
.choix-carte p { margin: 0; }
.choix-carte .boutons { margin-top: 4px; }
.lecture { width: 100%; max-width: 64ch; margin: 12px auto 0; text-align: left; font-size: 1.08rem; line-height: 1.65; }
.lecture p { margin: 0 0 .8em; }
.lecture p.replique { padding-left: 14px; }
.onglets-lecture { display: flex; flex-wrap: wrap; gap: 8px; margin: 10px 0 4px; }
.onglets-lecture .btn.actif { background: var(--jaune); }

/* Fenêtre (fiche d'un rôle, récit) */
.voile { position: fixed; inset: 0; z-index: 20; display: flex; align-items: flex-start; justify-content: center; padding: 16px; overflow-y: auto; background: rgba(43, 35, 64, .55); }
.fenetre { position: relative; width: min(620px, 100%); margin: auto 0; padding: 22px 18px 18px; background: var(--papier); border: var(--trait) solid var(--encre); border-radius: 24px; box-shadow: 7px 7px 0 var(--encre); }
.fermer { position: absolute; top: 10px; right: 10px; }
#fenetre-titre { padding-right: 84px; }

/* Loup brouille / fin */
.scene { width: 100%; max-width: 420px; }
.scene .porte { transform-origin: 170px 150px; transition: transform 1.2s ease .4s; }
.scene.ouverte .porte { transform: scaleX(.12); }
.scene .tresor { opacity: 0; transform-origin: 200px 150px; transition: opacity .8s ease 1.3s, transform 1s ease 1.3s; transform: translateY(20px) scale(.6); }
.scene.ouverte .tresor { opacity: 1; transform: translateY(-40px) scale(1); }
.scene .loup-fuit { transition: transform 1.6s ease-in 1.2s; }
.scene.ouverte .loup-fuit { transform: translateX(260px); }
.diplome { width: 100%; padding: 18px; border: var(--trait) solid var(--encre); border-radius: 18px; background: var(--jaune); box-shadow: 5px 5px 0 var(--encre); }
.diplome h2 { font-size: 1.5rem; }

@media (max-width: 600px) {
  .schema { padding: 8px; border-radius: 18px; }
  .schema-grille { gap: 5px 6px; }
  .role { min-height: 50px; padding: 4px 6px; gap: 6px; border-radius: 14px; }
  .role-pastille { width: 32px; height: 32px; }
  .role-pastille svg { width: 22px; height: 22px; }
  .role-nom { font-size: .9rem; }
  .role-info { font-size: .72rem; }
  .guide svg { width: 64px; height: 64px; }
  .case { width: 44px; height: 44px; font-size: 1.05rem; }
  .case-grille { min-height: 76px; padding: 4px; }
  .case-grille .case-grille-q { display: none; }
  .relier { grid-template-columns: minmax(0, 1fr) minmax(0, 1.5fr); gap: 6px 8px; }
  .relier .btn { font-size: .86rem; padding: 7px 7px; }
}
