/* Jeu : le palais des miroirs */

/* Repli pour les navigateurs sans color-mix() (Safari avant 16.2, vieux iPad) : sous chaque règle qui mélange
   des couleurs, un petit bloc @supports not redonne une couleur simple de base.css (la plus présente du mélange).
   Une ligne de repli écrite juste avant ne suffirait pas : une valeur qui contient var() est jugée trop tard,
   elle devient « unset » (le noir d'un SVG, un fond transparent). */

/* ---------- Les deux salles (onglets) ---------- */

.miroir__onglets {
  display: flex;
  flex-wrap: nowrap;
  width: 100%;
  max-width: 30rem;
  justify-content: center;
  gap: var(--espace-2);
  padding: 6px;
  border-radius: calc(var(--rayon) + 6px);
  background: var(--surface-2);
  box-shadow: inset 0 0 0 2px var(--trait);
}

.miroir__onglet {
  min-height: 3rem;
  padding: 0.5rem 0.8rem;
  border: 0;
  border-radius: var(--rayon);
  background: transparent;
  color: var(--encre);
  font-weight: 700;
  font-size: 1rem;
  line-height: 1.2;
  flex: 1 1 0;
}

.miroir__onglet[aria-selected="true"] {
  background: var(--accent);
  color: var(--sur-accent);
  box-shadow: inset 0 -4px 0 rgba(0, 0, 0, 0.22);
}

.miroir__salle {
  display: grid;
  justify-items: center;
  gap: var(--espace-5);
  width: 100%;
  max-width: 44rem;
}

.miroir__consigne {
  text-align: center;
  max-width: 30rem;
}

/* ---------- Le mot de départ ---------- */

.miroir__depart {
  scroll-margin-top: 5.5rem;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: var(--espace-4);
}

.miroir__plaque {
  display: grid;
  place-items: center;
  width: 3rem;
  height: 3rem;
  flex: none;
  border-radius: 50%;
  background: var(--bois);
  box-shadow: inset 0 -4px 0 var(--bois-flanc);
  font-size: 2rem;
}

.miroir__plaque > .icone {
  width: 2rem;
  height: 2rem;
}

.miroir__lettres,
.miroir__cases {
  display: flex;
  flex-wrap: nowrap;
  justify-content: center;
  gap: clamp(3px, 0.8vw, 6px);
  transition: gap 420ms cubic-bezier(0.22, 1, 0.36, 1);
}

.miroir__cadre.est-allume .miroir__cases {
  gap: 0;
}

.miroir__cadre.est-allume .miroir__case {
  border-radius: 0;
}

.miroir__cadre.est-allume .miroir__case:first-child {
  border-radius: 14px 0 0 14px;
}

.miroir__cadre.est-allume .miroir__case:last-child {
  border-radius: 0 14px 14px 0;
}

.miroir__tuile,
.miroir__case {
  --taille: clamp(2.1rem, 1.3rem + 2.8vw, 3.2rem);
  padding: 0 0.25em;
}

.miroir__tuile.est-partie {
  pointer-events: none;
}

/* ---------- Le miroir ---------- */

.miroir__cadre {
  width: 100%;
  max-width: 34rem;
  padding: 12px;
  border-radius: 30px 30px 18px 18px;
  background:
    repeating-linear-gradient(135deg, transparent 0 10px, rgba(255, 255, 255, 0.12) 10px 14px),
    var(--accent);
  box-shadow: inset 0 -6px 0 rgba(0, 0, 0, 0.25), 0 6px 16px var(--ombre);
  transition: box-shadow 400ms;
}

.miroir__glace {
  position: relative;
  display: grid;
  justify-items: center;
  gap: var(--espace-4);
  padding: var(--espace-5) var(--espace-3);
  border-radius: 20px 20px 10px 10px;
  overflow: hidden;
  background:
    linear-gradient(115deg, transparent 0 30%, rgba(255, 255, 255, 0.2) 30% 38%, transparent 38% 46%, rgba(255, 255, 255, 0.12) 46% 49%, transparent 49%),
    linear-gradient(180deg, var(--surface), var(--surface-2));
  box-shadow: inset 0 0 0 2px rgba(0, 0, 0, 0.12);
}

/* Le code des couleurs (22/10/2026) : trouvé = vert pâle et une coche (le jaune est réservé au piège) */
.miroir__cadre {
  position: relative;
}

.miroir__cadre.est-allume {
  box-shadow: inset 0 -6px 0 rgba(0, 0, 0, 0.25), 0 0 0 5px var(--fn-juste), 0 0 0 7px var(--fn-juste-texte);
}

.miroir__cadre.est-allume::after {
  content: '\2713';
  position: absolute;
  z-index: 2;
  top: 0.5rem;
  right: 0.5rem;
  display: grid;
  place-items: center;
  width: 2.4rem;
  height: 2.4rem;
  border-radius: 50%;
  background: var(--fn-juste);
  color: var(--fn-juste-texte);
  box-shadow: inset 0 0 0 2px var(--fn-juste-texte);
  font-size: 1.4rem;
  font-weight: 800;
  line-height: 1;
  pointer-events: none;
}

/* L'indice : la lettre qu'on cherche est surlignée en jaune */
.miroir__lettres .tuile--allumee {
  background: var(--fn-piege);
  color: var(--fn-piege-texte);
  box-shadow: inset 0 -6px 0 var(--bois-flanc), 0 0 0 4px var(--fn-piege), 0 0 0 6px var(--fn-piege-texte);
}

/* La première lettre attendue : repère visuel doux dès le départ */
.miroir__tuile--repere {
  box-shadow: inset 0 -6px 0 var(--bois-flanc), 0 0 0 3px var(--accent);
  text-decoration: underline;
  text-decoration-thickness: 0.12em;
  text-underline-offset: 0.14em;
}

/* Le bouton « Un indice », plus visible (l’autrice, 11/11/2026 : « le bouton indice doit être plus visible ») :
   le jaune surligné de la lettre qu'il allume, un contour foncé, une ampoule dans une pastille claire,
   un texte un peu plus grand. Les couleurs viennent des variables du thème : clair et sombre. */
.miroir__bouton-indice {
  /* assez étroit pour que « Un autre mot » reste à côté, sur la même ligne, même sur un téléphone (390 px) */
  min-height: 3.25rem;
  gap: 0.4em;
  padding: 0.5rem 0.9rem 0.5rem 0.5rem;
  background: var(--fn-piege);
  color: var(--fn-piege-texte);
  font-size: 1.1rem;
  box-shadow: inset 0 0 0 3px var(--fn-piege-texte), inset 0 -6px 0 var(--fn-piege-texte);
}

.miroir__bouton-indice:active {
  box-shadow: inset 0 0 0 3px var(--fn-piege-texte), inset 0 -3px 0 var(--fn-piege-texte);
}

.miroir__ampoule {
  display: grid;
  place-items: center;
  width: 1.95rem;
  height: 1.95rem;
  border-radius: 50%;
  background: var(--surface);
  box-shadow: inset 0 0 0 2px var(--fn-piege-texte);
  font-size: 1.25rem;
  flex: none;
}

.miroir__cadre.est-allume .miroir__glace::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(115deg, transparent 20%, rgba(255, 255, 255, 0.55) 45%, transparent 70%);
  animation: miroir-eclair 900ms ease-out forwards;
  pointer-events: none;
}

@keyframes miroir-eclair {
  from { transform: translateX(-100%); }
  to { transform: translateX(100%); }
}

.miroir__indice-ligne {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--espace-3);
  max-width: 100%;
}

.miroir__plaque--cachee {
  width: 2.8rem;
  height: 2.8rem;
  font-size: 1.9rem;
}

.miroir__plaque--cachee > .icone {
  width: 1.9rem;
  height: 1.9rem;
}

.miroir__indice-texte {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--espace-2);
  min-width: 0;
  text-align: center;
}

.miroir__indice {
  font-weight: 700;
  font-size: 1.1rem;
  line-height: 1.35;
}

.miroir__cases .tuile--vide {
  background: color-mix(in srgb, var(--surface) 60%, transparent);
  box-shadow: inset 0 0 0 3px color-mix(in srgb, var(--accent) 45%, transparent);
}
@supports not (color: color-mix(in srgb, red 50%, blue)) { .miroir__cases .tuile--vide { background: var(--surface); } }

/* ---------- Ce qui se voit à la fin ---------- */

.miroir__resultat {
  display: grid;
  justify-items: center;
  gap: var(--espace-2);
  text-align: center;
}

.miroir__resultat:empty {
  display: none;
}

.miroir__face {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: var(--espace-3);
  font-weight: 700;
  font-size: var(--t-titre-3);
  animation: entrer 420ms cubic-bezier(0.2, 0.9, 0.3, 1.3);
}

.miroir__face-mot {
  display: inline-flex;
  align-items: center;
  gap: 0.35em;
}

.miroir__face-mot .icone {
  width: 1.4em;
  height: 1.4em;
  font-size: 1.4em;
}

.miroir__fleche {
  color: var(--accent);
  font-size: 1.4em;
}

.miroir__aussi {
  display: flex;
  align-items: center;
  gap: var(--espace-2);
  max-width: 30rem;
  text-align: left;
}

.miroir__aussi .icone {
  font-size: 1.8rem;
}

.miroir__truc {
  display: grid;
  justify-items: center;
  gap: var(--espace-4);
  width: 100%;
}

.miroir__truc .petit-savoir {
  max-width: 36rem;
  width: 100%;
}

/* ---------- Salle 2 : dans les deux sens ---------- */

.miroir__etiquette {
  font-weight: 700;
  font-size: 1.1rem;
  text-align: center;
  max-width: 30rem;
}

.miroir__champ {
  width: 100%;
  max-width: 26rem;
  min-height: 3.6rem;
  padding: 0.5rem 1rem;
  border: 0;
  border-radius: var(--rayon);
  background: var(--surface-2);
  box-shadow: inset 0 0 0 3px var(--trait);
  font-size: 1.6rem;
  font-weight: 700;
  text-align: center;
}

.miroir__champ:focus-visible {
  box-shadow: inset 0 0 0 3px var(--accent);
  outline-offset: 2px;
}

.miroir__champ::placeholder {
  color: var(--encre-2);
  opacity: 0.45;
}

.miroir__glace--reflet {
  min-height: 9rem;
  align-content: center;
}

.miroir__reflet {
  max-width: 100%;
  font-size: clamp(1.6rem, 1.1rem + 2.4vw, 2.6rem);
  font-weight: 700;
  line-height: 1.2;
  text-align: center;
  overflow-wrap: anywhere;
}

.miroir__reflet.est-vide {
  color: var(--encre-2);
  font-size: 1.2rem;
  font-weight: 400;
}

.miroir__verdict {
  font-family: var(--police-titre);
  font-size: 1rem;
  letter-spacing: 0.03em;
  color: var(--accent);
  text-align: center;
}

.miroir__verdict:empty {
  display: none;
}

.miroir__petit-titre {
  font-weight: 700;
  color: var(--encre-2);
}

.miroir__exemples {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: var(--espace-2);
}

.miroir__exemple {
  min-height: 3rem;
  padding: 0.4rem 0.9rem;
  border: 0;
  border-radius: 10px;
  background: var(--surface-2);
  color: var(--encre);
  font-size: 1.05rem;
  font-weight: 700;
  box-shadow: inset 0 0 0 2px var(--trait);
}

/* ---------- Le dessin de la niche ---------- */

.miroir__dessin {
  width: 1em;
  height: 1em;
}

.miroir-d__mur { fill: var(--bois); stroke: var(--bois-encre); stroke-width: 3; stroke-linejoin: round; }
.miroir-d__toit { fill: var(--rouge); stroke: var(--bois-encre); stroke-width: 3; stroke-linejoin: round; }
.miroir-d__porte { fill: var(--bois-encre); }
.miroir-d__nom { fill: var(--bleu); }
.miroir-d__gamelle { fill: var(--bleu); stroke: var(--bois-encre); stroke-width: 2.5; }

/* L'affiche de l'accueil : un R et son reflet */
.miroir__glyphe-inverse {
  transform: scaleX(-1);
}

@media (max-width: 420px) {
  .miroir__plaque {
    width: 2.8rem;
    height: 2.8rem;
    font-size: 1.8rem;
  }

  .miroir__plaque > .icone {
    width: 1.8rem;
    height: 1.8rem;
  }

  .miroir__indice-ligne {
    flex-direction: column;
    text-align: center;
  }
}

.miroir__commandes {
  min-height: 3.25rem;
}

/* La zone à toucher : les lettres, le miroir, le résultat et les boutons (essai du 22/10/2026) */
.miroir__jeu {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--espace-5);
  width: 100%;
}
