/* Jeu : l'aiguillage (le c et le g changent de voix).
   Deux couleurs de voix : la voix dure (k, g) prend la couleur du jeu ; la voix douce (s, j) le violet ;
   gn, le vert. */

.aiguillage__salles,
.aiguillage__modes,
.aiguillage__couples {
  justify-content: center;
}

.aiguillage__modes,
.aiguillage__couples {
  margin-top: calc(-1 * var(--espace-3));
}

.aiguillage__aide {
  max-width: 34rem;
  min-height: 1.5em;
  color: var(--encre-2);
  font-weight: 700;
  text-align: center;
}

.aiguillage__plateau {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--espace-5);
  width: 100%;
  max-width: 40rem;
}

/* ---------- Les wagons ---------- */

.aiguillage__wagon {
  --taille: clamp(2.6rem, 2rem + 3vw, 3.6rem);
  position: relative;
  margin-bottom: 0.7rem;
  min-width: calc(var(--taille) * 1.15);
  cursor: pointer;
}

/* les deux roues */
.aiguillage__wagon::before,
.aiguillage__wagon::after {
  content: "";
  position: absolute;
  bottom: -0.6rem;
  width: 0.85rem;
  height: 0.85rem;
  border-radius: 50%;
  background: var(--encre-2);
  box-shadow: inset 0 0 0 3px var(--encre);
}

.aiguillage__wagon::before { left: 18%; }
.aiguillage__wagon::after { right: 18%; }

.aiguillage__lettres {
  position: relative;
}

.aiguillage__wagon.est-dure {
  background: var(--accent);
  color: var(--sur-accent);
  box-shadow: inset 0 -6px 0 rgba(0, 0, 0, 0.25);
}

.aiguillage__wagon.est-douce {
  background: var(--violet);
  color: var(--sur-violet);
  box-shadow: inset 0 -6px 0 rgba(0, 0, 0, 0.25);
}

.aiguillage__wagon.est-gn {
  background: var(--vert);
  color: var(--sur-vert);
  box-shadow: inset 0 -6px 0 rgba(0, 0, 0, 0.25);
}

.aiguillage__wagon--vide {
  background: transparent;
  box-shadow: inset 0 0 0 3px var(--trait);
  cursor: default;
}

.aiguillage__wagon.est-indiquee {
  animation: aiguillage-appel 900ms ease-in-out infinite;
  /* le wagon qui appelle : un cadre d'encre, plus de vert (le vert dit « c'est juste » dans le code des couleurs) */
  outline: 4px solid var(--encre);
  outline-offset: 3px;
}

.aiguillage__wagon.est-tenu {
  z-index: 5;
  cursor: grabbing;
  touch-action: none;
}

.aiguillage__choix .aiguillage__wagon {
  touch-action: none;
}

.aiguillage__wagon:disabled {
  cursor: default;
}

@keyframes aiguillage-appel {
  0%, 100% { transform: none; }
  25% { transform: rotate(-5deg); }
  75% { transform: rotate(5deg); }
}

/* ---------- Les rails ---------- */

.aiguillage__rails {
  display: flex;
  justify-content: center;
  align-items: flex-end;
  gap: 0.35rem;
  width: 100%;
  max-width: 24rem;
  padding: 3.2rem var(--espace-4) 0.35rem;
  border-bottom: 5px solid var(--encre-2);
  background:
    repeating-linear-gradient(90deg, var(--trait) 0 10px, transparent 10px 26px) bottom / 100% 12px no-repeat;
}

.aiguillage__loco {
  position: relative;
  display: grid;
  justify-items: center;
}

.aiguillage__wagon--lettre {
  font-size: calc(var(--taille) * 0.75);
  background: var(--encre);
  color: var(--surface);
  box-shadow: inset 0 -6px 0 rgba(0, 0, 0, 0.35);
}

.aiguillage__accroche {
  display: flex;
}

.aiguillage__bulle {
  position: absolute;
  bottom: calc(100% + 0.4rem);
  left: 50%;
  min-width: 2.6rem;
  padding: 0.1rem 0.6rem;
  border-radius: 14px;
  background: var(--surface);
  color: var(--encre);
  box-shadow: 0 0 0 3px var(--accent);
  font-family: var(--police-titre);
  font-size: 1.5rem;
  line-height: 1.4;
  text-align: center;
  transform: translateX(-50%);
}

.aiguillage__bulle:empty {
  visibility: hidden;
}

.aiguillage__bulle::after {
  content: "";
  position: absolute;
  top: 100%;
  left: 50%;
  border: 8px solid transparent;
  border-top-color: var(--accent);
  transform: translateX(-50%);
}

.aiguillage__bulle.est-douce { box-shadow: 0 0 0 3px var(--violet); }
.aiguillage__bulle.est-douce::after { border-top-color: var(--violet); }
.aiguillage__bulle.est-gn { box-shadow: 0 0 0 3px var(--vert); }
.aiguillage__bulle.est-gn::after { border-top-color: var(--vert); }

.aiguillage__garage,
.aiguillage__choix {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: var(--espace-3);
}

/* ---------- L'exemple ---------- */

.aiguillage__exemple {
  display: grid;
  place-items: center;
  width: 100%;
  min-height: 9rem;
}

.aiguillage__exemple-carte {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: var(--espace-1) var(--espace-4);
  width: 100%;
  max-width: 24rem;
  padding: var(--espace-3) var(--espace-4);
  border-radius: var(--rayon-grand);
  background: var(--surface);
  box-shadow: 0 3px 0 var(--ombre), inset 0 0 0 2px var(--trait);
}

.aiguillage__exemple-carte > .icone {
  grid-row: span 2;
  width: 2.8rem;
  height: 2.8rem;
  font-size: 2.8rem;
}

.aiguillage__exemple-carte > .bouton-voix {
  grid-row: span 2;
}

.aiguillage__exemple-mot {
  font-size: 2rem;
  font-weight: 700;
  line-height: 1.1;
}

.aiguillage__exemple-mot b,
.aiguillage__puce b,
.aiguillage__mot .aiguillage__pose {
  /* Le code des couleurs (22/10/2026) : l'écriture qu'on cherche, en jaune surligné */
  background: var(--fn-piege);
  color: var(--fn-piege-texte);
  border-radius: 0.2em;
}

.aiguillage__exemple-phrase {
  color: var(--encre-2);
  font-weight: 700;
}

/* ---------- Le mot à trou ---------- */

.aiguillage__carte {
  position: relative;
  display: grid;
  justify-items: center;
  gap: var(--espace-2);
  width: 100%;
  max-width: 26rem;
  padding: var(--espace-4) var(--espace-4);
  border-radius: var(--rayon-grand);
  background: var(--surface);
  box-shadow: 0 4px 0 var(--ombre), inset 0 0 0 2px var(--trait);
  cursor: pointer;
  transition: background 320ms ease, box-shadow 320ms ease;
}

.aiguillage__carte.est-complet {
  /* c'est juste : vert pâle, et une coche dans le coin (jamais la couleur seule) */
  background: var(--fn-juste);
  color: var(--fn-juste-texte);
  box-shadow: 0 4px 0 var(--ombre), inset 0 0 0 3px var(--accent);
}

.aiguillage__carte.est-complet::after {
  content: '\2713';
  position: absolute;
  top: var(--espace-2);
  right: var(--espace-3);
  font-size: 1.6rem;
  font-weight: 800;
  line-height: 1;
  color: var(--fn-juste-texte);
}

.aiguillage__image {
  width: 2.8rem;
  height: 2.8rem;
  font-size: 2.8rem;
  line-height: 1;
  flex: none;
}

.aiguillage__image > .icone {
  width: 2.8rem;
  height: 2.8rem;
}

.aiguillage__image.est-vide {
  display: none;
}

.aiguillage__mot {
  display: flex;
  align-items: baseline;
  justify-content: center;
  flex-wrap: nowrap;
  max-width: 100%;
  font-size: clamp(2rem, 1.4rem + 3vw, 3rem);
  font-weight: 700;
  line-height: 1.2;
  white-space: nowrap;
}

.aiguillage__mot .aiguillage__pose {
  display: inline-block;
  margin: 0;
  padding: 0 0.06em;
  border-radius: 6px;
}

.aiguillage__actions {
  min-height: 2.8rem;
}

.aiguillage__trou {
  display: inline-block;
  width: 1.3em;
  height: 0.95em;
  margin: 0 0.06em;
  border-radius: 8px;
  box-shadow: inset 0 0 0 3px var(--encre-2);
  background: var(--surface-2);
  transform: translateY(0.1em);
}

.aiguillage__trou.est-survole {
  box-shadow: inset 0 0 0 4px var(--accent);
}

.aiguillage__suivante.est-indiquee {
  display: inline-block;
  padding: 0 0.14em;
  margin-left: 0.04em;
  border-radius: 6px;
  background: var(--fn-piege);
  color: var(--fn-piege-texte);
  box-shadow: 0 0.12em 0 var(--accent);
  text-decoration: underline;
  text-decoration-thickness: 0.12em;
  text-underline-offset: 0.12em;
  animation: aiguillage-clin 1200ms ease-in-out infinite;
}

@keyframes aiguillage-clin {
  0%, 100% { color: inherit; }
  50% { color: var(--accent); }
}

/* ---------- Ce qui se passe ---------- */

.aiguillage__message {
  display: grid;
  place-items: center;
  width: 100%;
  max-width: 34rem;
  min-height: 3rem;
  text-align: center;
}

/* Dans « Les mots à finir », la réponse se pose entre le mot et les wagons : vide, elle ne prend pas de place */
.aiguillage__plateau > .aiguillage__message:empty {
  display: none;
}

.aiguillage__raison,
.aiguillage__regarde {
  font-size: var(--t-grand);
  font-weight: 700;
}

/* le haut-parleur de la raison ne fait pas grandir la ligne */
.aiguillage__raison .bouton-voix {
  vertical-align: middle;
  margin-block: -0.75rem;
}

.aiguillage__regarde {
  margin-top: var(--espace-2);
  color: var(--encre-2);
  font-size: var(--t-texte);
}

.aiguillage__grimace {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: var(--espace-3) var(--espace-5);
  width: 100%;
  padding: var(--espace-3);
  border-radius: var(--rayon);
  background: var(--surface-2);
  text-align: left;
}

.aiguillage__visage {
  position: relative;
  display: block;
  width: 2.6rem;
  height: 2.6rem;
  margin-top: 0.4rem;
}

.aiguillage__visage .icone {
  display: block;
  width: 100%;
  height: 100%;
}

.aiguillage__visage .icone svg {
  width: 100%;
  height: 100%;
}

.aiguillage__son-faux {
  position: absolute;
  top: -0.8rem;
  right: -1.2rem;
  padding: 0 0.35rem;
  border-radius: 10px;
  background: var(--surface);
  color: var(--encre);
  box-shadow: 0 0 0 2px var(--encre-2);
  font-family: var(--police-titre);
  font-size: 0.9rem;
  line-height: 1.5;
  white-space: nowrap;
}

/* ---------- Le tableau des voix, le dépôt ---------- */

.aiguillage__bas {
  width: 100%;
  max-width: 34rem;
}

.aiguillage__tableau {
  display: grid;
  gap: var(--espace-2);
  padding: var(--espace-4);
  border-radius: var(--rayon-grand);
  background: var(--surface-2);
}

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

.aiguillage__ligne {
  display: flex;
  align-items: center;
  gap: var(--espace-3);
  min-height: 2.6rem;
}

.aiguillage__son {
  flex: none;
  display: grid;
  place-items: center;
  min-width: 2.6rem;
  height: 2.4rem;
  padding: 0 0.4rem;
  border-radius: 9px;
  background: var(--accent);
  color: var(--sur-accent);
  font-family: var(--police-titre);
  font-size: 1.2rem;
}

.aiguillage__ligne--douce .aiguillage__son {
  background: var(--violet);
  color: var(--sur-violet);
}

.aiguillage__ligne--gn .aiguillage__son {
  background: var(--vert);
  color: var(--sur-vert);
}

.aiguillage__son--ecriture {
  background: var(--bois);
  color: var(--bois-encre);
  font-family: var(--police-texte);
  font-weight: 700;
  font-size: 1.4rem;
}

.aiguillage__devant,
.aiguillage__puces {
  display: flex;
  flex-wrap: wrap;
  gap: 0.2rem 0.6rem;
  font-size: var(--t-grand);
}

.aiguillage__puce {
  font-weight: 700;
}

.aiguillage__rien {
  color: var(--encre-2);
}

.aiguillage__truc {
  display: flex;
  flex-direction: column;
  gap: var(--espace-4);
  width: 100%;
  max-width: 34rem;
}

@media (max-width: 420px) {
  .aiguillage__exemple-mot { font-size: 1.6rem; }
  .aiguillage__grimace { grid-template-columns: auto 1fr; }
  .aiguillage__grimace .bouton-voix { grid-column: 2; justify-self: start; }
}

@media (prefers-reduced-motion: reduce) {
  .aiguillage__wagon.est-indiquee,
  .aiguillage__suivante.est-indiquee {
    animation: none;
  }
}
