/* =====================================================
   LE MUSÉE DU TEMPS VOLÉ — Les salles du jeu
   Carte d'énigme, décor cherchable, saisie de réponse,
   tribu, carte mémoire (une de journal), livre condamné.
   ===================================================== */

.carte-enigme {
  background: var(--carte);
  border: 2px solid var(--bord);
  border-radius: 14px;
  padding: 26px 30px;
  margin: 0 auto;
  max-width: 820px;
}
.etiquette-salle {
  display: inline-block;
  background: var(--fond2);
  border: 1px solid var(--or);
  color: var(--or-clair);
  border-radius: 20px;
  padding: 4px 14px;
  font-size: 14px;
  letter-spacing: 1px;
  text-transform: uppercase;
  margin-bottom: 10px;
}
.carte-enigme h2 { margin-bottom: 18px; }

/* ---------- Fond illustré d'une salle ---------- */
.carte-enigme.avec-fond { overflow: hidden; }
.carte-enigme.avec-fond > * { position: relative; }
.carte-enigme.avec-fond > .fond-salle {
  display: block;
  width: 100%;
  height: auto;
  opacity: 1;
  pointer-events: none;
  margin-bottom: 16px;
  border-radius: 10px;
}

/* élément à chercher dans le décor d'une salle */
.fond-salle .zone-cherchable { pointer-events: auto; cursor: pointer; outline: none; }
.fond-salle .zone-cherchable:hover .halo-cherche,
.fond-salle .zone-cherchable:focus-visible .halo-cherche { animation: none; opacity: 1; stroke-width: 3; }
.fond-salle .halo-cherche { animation: haloCherche 1.8s ease-in-out infinite; }
@keyframes haloCherche { 0%, 100% { opacity: 0.35; } 50% { opacity: 1; } }
/* lueur radium du flacon : pulsation verte bien visible sur la photo assombrie */
.fond-salle .lueur-radium { animation: lueurRadium 1.8s ease-in-out infinite; }
@keyframes lueurRadium { 0%, 100% { opacity: 0.26; } 50% { opacity: 0.62; } }
.fond-salle .zone-cherchable.trouvee { pointer-events: none; cursor: default; }
.fond-salle .zone-cherchable.trouvee .halo-cherche { display: none; }
.fond-salle .zone-cherchable.retardee { pointer-events: none; cursor: default; }
.fond-salle .zone-cherchable.retardee .halo-cherche { display: none; }
/* le poster du mur reste consultable après sa découverte : seul son halo disparaît */
.fond-salle .zone-cherchable.decouverte .halo-cherche { display: none; }
.texte-enigme { font-size: 19px; }
.texte-enigme p { margin: 12px 0; }
.texte-enigme .indice-illustre { color: var(--or-clair); font-weight: 600; }
.zone-saisie { margin-top: 22px; display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.zone-saisie input {
  font-size: 22px;
  padding: 10px 14px;
  border-radius: 8px;
  border: 2px solid var(--bord);
  background: var(--fond);
  color: var(--texte);
  min-width: 220px;
}
.zone-saisie input:focus { outline: none; border-color: var(--or); }
.retour { margin-top: 16px; font-size: 18px; min-height: 28px; }
.retour.ok { color: var(--vert); font-weight: 700; }
.retour.ko { color: var(--rouge); }

.tribu {
  display: flex;
  flex-wrap: wrap;
  gap: 20px 16px;
  margin: 22px auto 12px;
  justify-content: center;
  max-width: 420px;
}
.tribu .enfant {
  width: 28px; height: 48px;
  background: var(--fond2);
  border: 2px solid var(--or);
  border-radius: 14px 14px 4px 4px;
  position: relative;
}
.tribu .enfant::before {
  content: "";
  position: absolute;
  top: -14px; left: 5px;
  width: 14px; height: 14px;
  border-radius: 50%;
  background: var(--or);
}
.tribu .enfant:nth-child(6n+1) { border-color: #e05a5a; }
.tribu .enfant:nth-child(6n+1)::before { background: #e05a5a; }
.tribu .enfant:nth-child(6n+2) { border-color: #e0913f; }
.tribu .enfant:nth-child(6n+2)::before { background: #e0913f; }
.tribu .enfant:nth-child(6n+3) { border-color: #7fbd55; }
.tribu .enfant:nth-child(6n+3)::before { background: #7fbd55; }
.tribu .enfant:nth-child(6n+4) { border-color: #55a2bd; }
.tribu .enfant:nth-child(6n+4)::before { background: #55a2bd; }
.tribu .enfant:nth-child(6n+5) { border-color: #8d6fd1; }
.tribu .enfant:nth-child(6n+5)::before { background: #8d6fd1; }
.tribu .enfant:nth-child(6n+6) { border-color: #d1619f; }
.tribu .enfant:nth-child(6n+6)::before { background: #d1619f; }
/* Les silhouettes découpées par les Effaceurs restent invisibles ;
   l'encre invisible de la partition leur rend leurs couleurs. */
.tribu .enfant.occulte { opacity: 0; transition: opacity 1.4s ease; }
.tribu.encre-lue .enfant.occulte { opacity: 1; }

/* Lampe de la loge (salle 4) : le faisceau et l'ampoule ne s'embrasent
   qu'une fois la lampe allumée ; la partition reste muette avant. */
#zone-lampe .faisceau { opacity: 0; transition: opacity 0.8s ease; }
#zone-lampe.allumee .faisceau { opacity: 0.13; }
#zone-lampe .ampoule-lampe { transition: opacity 0.8s ease; }
#zone-lampe.allumee .ampoule-lampe { opacity: 1; }

/* Légende des figures de notes (salle 4) : chaque note vaut son temps. */
.legende-notes {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 20px;
  justify-content: center;
  margin: 12px 0 4px;
  color: var(--texte2);
  font-size: 15px;
}
.legende-notes svg { vertical-align: middle; margin-right: 5px; }

/* ---------- Badge d'astronaute (salle 5) ---------- */
.badge-astro {
  margin: 14px auto 6px;
  max-width: 420px;
  padding: 14px 18px;
  text-align: center;
  background: linear-gradient(160deg, #232338, #1a1a2c);
  border: 2px solid var(--or);
  border-radius: 8px;
  font-weight: 700;
  letter-spacing: 1px;
}

/* ---------- Carte mémoire (victoire d'énigme) ---------- */
.carte-memoire {
  display: none;
  margin-top: 24px;
  background: linear-gradient(160deg, #1d3a2a, #16281f);
  border: 2px solid var(--vert);
  border-radius: 14px;
  padding: 22px 26px;
  animation: apparait 0.5s ease;
}
.carte-memoire.visible { display: block; }
.carte-memoire h3 { color: var(--vert); font-size: 22px; margin-bottom: 8px; }
.carte-memoire .chiffre {
  font-size: 40px;
  font-weight: 800;
  color: var(--vert);
  border: 3px solid var(--vert);
  border-radius: 12px;
  display: inline-block;
  padding: 4px 18px;
  margin: 12px 0 4px;
}
.carte-memoire .legende-chiffre { color: #a8d8b8; font-size: 15px; }
.portrait-narre { width: 200px; margin: 0 auto 14px; }
.portrait-narre svg,
.portrait-narre img {
  width: 100%; height: auto; display: block;
  border-radius: 10px;
  border: 3px solid var(--or);
  filter: drop-shadow(0 4px 12px rgba(0, 0, 0, 0.45));
}
.flacon-narre { width: 130px; float: left; margin: 0 16px 8px 0; }
.flacon-narre img {
  width: 100%; height: auto; display: block;
  border-radius: 10px;
  border: 3px solid #7fe8c3;
  filter: drop-shadow(0 4px 12px rgba(0, 0, 0, 0.45));
}

/* ---------- La mémoire restaurée : une de journal ---------- */
.carte-memoire.journal {
  background: #f4ecd8;
  border: 2px solid #1d1a12;
  border-radius: 4px;
  font-family: Georgia, 'Times New Roman', serif;
  box-shadow: 7px 7px 0 rgba(0, 0, 0, 0.5);
}
.journal .journal-manche {
  display: flex; justify-content: space-between; align-items: baseline;
  border-bottom: 4px double #1d1a12;
  padding-bottom: 8px; margin-bottom: 12px;
  text-transform: uppercase; letter-spacing: 1px; font-size: 11px; color: #4d4636;
}
.journal .journal-nom { font-size: 26px; font-weight: 800; letter-spacing: 4px; color: #1d1a12; }
.journal h3 {
  color: #1d1a12; font-size: 27px; text-align: center;
  margin: 4px 0 2px; font-weight: 800;
}
.journal .journal-surtitre { text-align: center; color: #4d4636; font-size: 13px; font-style: italic; margin-bottom: 12px; }
.journal .journal-texte {
  column-count: 2; column-gap: 26px; column-rule: 1px solid rgba(29, 26, 18, 0.45);
  text-align: justify; font-size: 15.5px; line-height: 1.55; color: #26221a;
}
.journal .portrait-narre { width: 210px; margin: 0 auto 12px; }
.journal .portrait-narre img {
  border: 2px solid #1d1a12; border-radius: 3px;
  filter: sepia(0.4) contrast(1.05); box-shadow: none;
}
.journal .chiffre {
  color: #f4ecd8; background: #1d1a12;
  border: 2px solid #1d1a12; border-radius: 4px;
}
.journal .legende-chiffre { color: #4d4636; }
@media (max-width: 640px) { .journal .journal-texte { column-count: 1; } }

/* ---------- Le livre condamné : couverture et phrase codée (salle 2) ---------- */
.couverture-narre {
  width: 200px; height: 290px; margin: 0 auto 14px;
  position: relative;
  background: radial-gradient(circle at 32% 22%, #a96b32 0%, #82501f 55%, #5c3816 100%);
  border: 3px solid #d9a441;
  border-radius: 6px 14px 14px 6px;
  box-shadow: inset 0 0 26px rgba(43, 24, 8, 0.7), 0 6px 16px rgba(0, 0, 0, 0.5);
}
.couverture-texte {
  position: absolute; top: 26px; bottom: 22px; left: 18px; right: 16px;
  display: flex; flex-direction: column; justify-content: center; gap: 16px;
  text-align: center;
}
.couv-auteur { margin: 0; font-size: 11px; letter-spacing: 2.5px; text-transform: uppercase; font-style: italic; color: #e9d4a8; font-family: Georgia, 'Times New Roman', serif; }
.couv-titre {
  margin: 0; font-size: 19px; font-weight: 700; line-height: 1.45;
  font-family: 'Segoe Script', 'Brush Script MT', 'Lucida Handwriting', cursive;
  color: #f6e8c8;
}

/* le livre s'ouvre doucement : la couverture pivote sur sa charnière */
.livre-ouvert { perspective: 1100px; }
#couverture-livre.ouverture {
  transform-origin: left center;
  animation: ouvertureLivre 2.6s ease-in-out forwards;
}
@keyframes ouvertureLivre {
  0% { transform: rotateY(0deg); }
  100% { transform: rotateY(-115deg); }
}
#cache-page2 { animation: apparait 0.9s ease; }

/* page 2 du livre : l'énigme sur une page de papier ancien */
.page-livre {
  background: #f4ecd8;
  border: 1px solid #d8cba8;
  border-radius: 3px;
  color: #26221a;
  font-family: Georgia, 'Times New Roman', serif;
  padding: 26px 30px 22px;
  margin: 18px 0;
  box-shadow: inset 0 0 46px rgba(120, 100, 60, 0.20), 7px 7px 0 rgba(0, 0, 0, 0.5);
}
.page-livre h3 { color: #26221a; text-align: center; margin-bottom: 14px; font-style: italic; font-weight: 400; }
.page-livre .phrase-codee { color: #26221a; font-size: 17px; }
.page-livre .numero-page { text-align: center; color: #7a6c4d; font-size: 13px; margin: 16px 0 0; }
.phrase-codee {
  font-size: 19px; font-weight: 800; letter-spacing: 1px; line-height: 1.9;
  text-align: center; color: var(--or-clair);
  margin: 16px 0;
}

/* ---------- Les trois pages d'une salle : présentation, énigme, biographie ---------- */
.pages-salle .page-salle { display: none; }
.pages-salle .page-salle.active { display: block; }
.etapes-salle {
  display: flex; flex-wrap: wrap; gap: 6px 22px;
  margin: 12px 0 16px;
  padding-bottom: 8px;
  border-bottom: 1px dashed var(--bord);
}
.etapes-salle .etape {
  font-size: 14px;
  letter-spacing: 0.5px;
  color: var(--texte2);
  padding-bottom: 2px;
  border-bottom: 2px solid transparent;
}
.etapes-salle .etape.faite { border-bottom-color: var(--bord); }
.etapes-salle .etape.active { color: var(--or-clair); border-bottom-color: var(--or-clair); font-weight: 700; }
/* pendant la présentation, le décor se contemple : rien n'est encore fouillable */
.carte-enigme.presentation .fond-salle .zone-cherchable { pointer-events: none; cursor: default; }

/* ---------- La plaque de la salle 3 : gravure révélée lettre par lettre ---------- */
.lettres-gravees { margin: 0; }
.lettres-gravees .lettre { opacity: 0; transition: opacity 0.16s ease; }
.lettres-gravees.devoilee .lettre { opacity: 1; }

/* nuage de poussière qui s'envole au-dessus de la gravure */
.gravure { position: relative; margin: 12px 0; }
.nuage-poussiere { position: absolute; top: 0; bottom: 0; left: 0; right: 0; pointer-events: none; z-index: 1; }
.nuage-poussiere .mote {
  position: absolute; width: 92px; height: 26px; top: 50%;
  border-radius: 50%;
  background: radial-gradient(closest-side, rgba(233, 222, 195, 0.75), rgba(233, 222, 195, 0));
  filter: blur(2px);
  opacity: 0;
  animation: poussiereEnvolee 3.2s ease-out forwards;
}
.nuage-poussiere .mote:nth-child(1) { left: 2%; top: 60%; animation-delay: 0.1s; }
.nuage-poussiere .mote:nth-child(2) { left: 16%; top: 30%; animation-delay: 0.9s; }
.nuage-poussiere .mote:nth-child(3) { left: 30%; top: 70%; animation-delay: 1.7s; }
.nuage-poussiere .mote:nth-child(4) { left: 44%; top: 20%; animation-delay: 2.5s; }
.nuage-poussiere .mote:nth-child(5) { left: 58%; top: 55%; animation-delay: 3.3s; }
.nuage-poussiere .mote:nth-child(6) { left: 72%; top: 35%; animation-delay: 4.1s; }
.nuage-poussiere .mote:nth-child(7) { left: 84%; top: 60%; animation-delay: 4.9s; }
.nuage-poussiere .mote:nth-child(8) { left: 48%; top: 80%; animation-delay: 5.7s; }
@keyframes poussiereEnvolee {
  0% { opacity: 0.9; transform: translateY(6px) scale(0.7); }
  100% { opacity: 0; transform: translateY(-46px) scale(1.6); }
}
@media (prefers-reduced-motion: reduce) {
  .lettres-gravees .lettre { transition: none; }
  .nuage-poussiere .mote { animation: none; opacity: 0; }
}

/* le mot « trente » rongé par une tache d'encre des Effaceurs :
   un flou illisible qui se restaure au clic */
.mot-efface {
  display: inline-block;
  padding: 0 12px;
  border-radius: 4px;
  background: linear-gradient(100deg, #231a0e 0%, #3a2c17 55%, #231a0e 100%);
  color: #efe6cf;
  cursor: pointer;
  filter: blur(7px);
  transition: filter 0.6s ease;
}
.mot-efface.devoile { filter: blur(0); }
.mot-efface:focus-visible { outline: 2px solid var(--or-clair); outline-offset: 2px; }
@media (prefers-reduced-motion: reduce) {
  .mot-efface { filter: blur(7px); transition: none; }
  .mot-efface.devoile { filter: blur(0); }
}

/* ---------- Salle 3 : grille de conjugaison des Effaceurs ---------- */
.grille-conjugaison {
  margin-top: 16px;
  padding-top: 12px;
  border-top: 1px dashed var(--bord);
}
.grille-trente {
  display: inline-grid;
  grid-template-columns: repeat(7, 46px);
  grid-auto-rows: 46px;
  gap: 3px;
  margin: 12px 0;
}
.case-grille { position: relative; }
.case-grille input {
  width: 100%; height: 100%;
  text-align: center;
  text-transform: uppercase;
  font-family: inherit;
  font-size: 20px; font-weight: 700;
  background: #16162a;
  color: var(--texte);
  border: 1.5px solid var(--bord);
  border-radius: 5px;
  caret-color: var(--or-clair);
}
.case-grille input:focus {
  border-color: var(--or-clair);
  outline: none;
}
.case-doree input {
  background: #3d2f10;
  border-color: var(--or-clair);
  color: var(--or-clair);
}
.case-numerotee::before {
  content: attr(data-numero);
  position: absolute;
  top: 1px; left: 4px;
  font-size: 10px;
  color: var(--texte2);
  z-index: 1;
  pointer-events: none;
}
.indices-grille { margin: 12px 0 0 18px; }
.indices-grille li { margin: 4px 0; }
@media (max-width: 600px) {
  .grille-trente { grid-template-columns: repeat(7, minmax(28px, 40px)); grid-auto-rows: 38px; gap: 2px; }
  .case-grille input { font-size: 15px; }
  .case-numerotee::before { font-size: 8px; }
}
