/* Jeu : le filet à syllabes */

.filet__niveaux {
  justify-content: flex-start;
  justify-content: safe center;
}

.filet__tete {
  display: flex;
  align-items: center;
  gap: var(--espace-3);
  width: 100%;
  max-width: 36rem;
}

.filet__consigne {
  flex: 1;
  min-width: 0;
  font-weight: 700;
  font-size: var(--t-grand);
  line-height: 1.35;
  text-align: center;
  min-height: 2.7em;
  display: grid;
  place-items: center;
}

/* ---------- Le panneau de la syllabe à attraper ---------- */

.filet__panneau {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--espace-2);
  padding: var(--espace-3) var(--espace-5);
  border-radius: var(--rayon-grand);
  background: var(--surface-2);
  box-shadow: inset 0 0 0 3px var(--accent);
  cursor: pointer;
}

.filet__etiquette {
  flex-basis: 100%;
  text-align: center;
  color: var(--encre-2);
}

.filet__cible {
  display: flex;
  gap: 0.3rem;
}

.filet__tuile {
  --taille: clamp(2.6rem, 2rem + 2.4vw, 3.4rem);
}

/* ---------- La ligne de mots et son filet ---------- */

.filet__piste {
  position: relative;
  width: 100%;
  max-width: 50rem;
  padding: var(--espace-4) var(--espace-2) 4.2rem;
  border-radius: var(--rayon-grand);
  background: var(--surface-2);
}

.filet__ligne {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-start;
  align-items: center;
  gap: 3.6rem clamp(0.4rem, 1.5vw, 0.9rem);
  touch-action: manipulation;
}

.filet__bout {
  display: inline-flex;
  flex-wrap: nowrap;
  align-items: center;
  gap: clamp(0.4rem, 1.5vw, 0.9rem);
}

/* Un point : aussi haut qu'un mot (le filet se pose dessous), petit rond coloré au milieu */
.filet__point {
  position: relative;
  flex: none;
  width: 2.2rem;
  height: 3rem;
  padding: 0;
  border: 0;
  border-radius: 10px;
  background: transparent;
}

.filet__point::before {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  width: 1.4rem;
  height: 1.4rem;
  margin: -0.7rem 0 0 -0.7rem;
  border-radius: 50%;
  box-shadow: 0 0 0 4px var(--surface);
}

.filet__point--vert::before {
  background: var(--vert);
}

.filet__point--rouge {
  width: 3rem;
  cursor: pointer;
}

.filet__point--rouge::before {
  background: var(--rouge);
}

/* Fin de la recherche (l’autrice, 11/11/2026) : le point rouge tombe dans le filet, posé dessous.
   Il passe devant le filet pour qu'on le voie dans la poche. */
.filet__point--rouge.est-tombe {
  z-index: 3;
  pointer-events: none;
}

.filet__point--rouge.est-tombe::before {
  box-shadow: none;
  animation: filet-tombe 650ms cubic-bezier(0.5, 0, 0.75, 0) 180ms both;
}

@keyframes filet-tombe {
  0% { transform: translateY(0) scale(1); }
  65% { transform: translateY(2.9rem) scale(0.6); }
  80% { transform: translateY(2.55rem) scale(0.6); }
  100% { transform: translateY(2.75rem) scale(0.6); }
}

.filet__mot {
  display: inline-flex;
  align-items: baseline;
  min-height: 3rem;
  padding: 0.25rem 0.55rem;
  border: 0;
  border-radius: 10px;
  background: var(--surface);
  color: var(--encre);
  font-family: var(--police-texte);
  /* Les mots à lire (l’autrice, 11/11/2026 : « les d et b ne sont pas faciles à discriminer, la barre verticale
     est courte » ; « l'espacement entre les lettres est faible, les mots sont très ramassés ») :
     Andika normal plutôt que gras (la hampe du d et du b se voit mieux, la boucle reste ouverte),
     et un peu d'air entre les lettres. */
  font-weight: 400;
  letter-spacing: 0.08em;
  font-size: clamp(1.35rem, 1rem + 1.8vw, 2rem);
  line-height: 1.3;
  box-shadow: inset 0 0 0 2px var(--trait);
  transition: opacity var(--duree), background var(--duree), box-shadow var(--duree);
}

.filet__mot.est-sous-filet {
  box-shadow: inset 0 0 0 3px var(--accent);
}

.filet__mot.est-derriere {
  opacity: 0.55;
}

.filet__mot.est-pris {
  /* Le code des couleurs (22/10/2026) : attrapé, c'est juste : le cartouche vert pâle, et une coche dans le coin */
  position: relative;
  opacity: 1;
  background: var(--fn-juste);
  color: var(--fn-juste-texte);
  box-shadow: inset 0 0 0 2px var(--fn-juste-texte);
}

/* la coche, posée sur le coin : elle ne pousse pas le mot ni ses voisins (les cibles ne bougent pas) */
.filet__mot.est-pris::after {
  content: '\2713';
  position: absolute;
  top: -0.5rem;
  right: -0.45rem;
  display: grid;
  place-items: center;
  width: 1.35rem;
  height: 1.35rem;
  border-radius: 50%;
  background: var(--fn-juste-texte);
  color: var(--fn-juste);
  font-family: var(--police-texte);
  font-size: 0.85rem;
  font-weight: 800;
  line-height: 1;
  pointer-events: none;
}

.filet__lettre {
  display: inline-block;
}

.filet__lettre--cible {
  text-decoration: underline;
  text-decoration-thickness: 0.12em;
  text-underline-offset: 0.18em;
}

/* Dans le cartouche vert d'un mot attrapé, les lettres de la syllabe ressortent (l’autrice, 22/10/2026).
   D'abord en rouge sur fond papier ; depuis le code des couleurs (22/10/2026, le soir), en jaune surligné,
   la couleur de « ce qu'on cherche », toujours soulignées (le signe de forme). */
.filet__mot.est-pris .filet__lettre--cible {
  padding: 0 0.04em;
  background: var(--fn-piege);
  color: var(--fn-piege-texte);
  text-decoration-color: var(--fn-piege-texte);
  /* couvre le fil d'un pixel qui pouvait rester entre deux lettres */
  box-shadow: 1px 0 0 var(--fn-piege);
}

.filet__mot.est-pris .filet__lettre--cible:first-child,
.filet__mot.est-pris .filet__lettre:not(.filet__lettre--cible) + .filet__lettre--cible {
  border-top-left-radius: 6px;
  border-bottom-left-radius: 6px;
}

.filet__mot.est-pris .filet__lettre--cible:has(+ .filet__lettre:not(.filet__lettre--cible)),
.filet__mot.est-pris .filet__lettre--cible:last-child {
  border-top-right-radius: 6px;
  border-bottom-right-radius: 6px;
}

.filet__lettre--presque {
  /* le piège (les mêmes lettres, mais pas dans le bon ordre, ou presque) : jaune surligné */
  border-radius: 4px;
  background: var(--fn-piege);
  color: var(--fn-piege-texte);
}

.filet__fin {
  margin-left: 0.04em;
}

/* Le filet, qu'on fait glisser ; posé sous le mot qu'il regarde */
.filet__filet {
  position: absolute;
  left: 0;
  top: 0;
  z-index: 2;
  width: 3.6rem;
  height: 3rem;
  margin-left: -1.8rem;
  border-radius: 12px;
  color: var(--encre);
  cursor: grab;
  touch-action: none;
  transition: left 260ms cubic-bezier(0.22, 1, 0.36, 1), top 260ms ease;
}

.filet__filet svg {
  display: block;
  width: 100%;
  height: 100%;
  overflow: visible;
}

.filet__filet.est-tire {
  cursor: grabbing;
  transition: none;
}

.filet__poche {
  fill: var(--surface);
  stroke: var(--encre);
  stroke-width: 2.5;
  stroke-linejoin: round;
}

.filet__maille {
  fill: none;
  stroke: var(--accent);
  stroke-width: 1.6;
  stroke-linecap: round;
}

.filet__cercle {
  fill: none;
  stroke: var(--accent);
  stroke-width: 4;
  stroke-linecap: round;
}

.filet__manche {
  fill: none;
  stroke: var(--bois-flanc);
  stroke-width: 4;
  stroke-linecap: round;
}

/* La flèche du début : elle montre qu'on va vers la droite */
.filet__guide {
  position: absolute;
  z-index: 1;
  width: 2.2rem;
  height: 2.2rem;
  margin-left: 1.6rem;
  color: var(--accent);
  pointer-events: none;
  animation: filet-guide 1200ms ease-in-out infinite;
}

.filet__guide svg {
  width: 100%;
  height: 100%;
}

@keyframes filet-guide {
  0%, 100% { transform: translateX(0); opacity: 0.4; }
  50% { transform: translateX(14px); opacity: 1; }
}

/* ---------- Les prises, la phrase, le truc ---------- */

.filet__prises {
  display: flex;
  gap: var(--espace-2);
  min-height: 1.2rem;
}

.filet__prise {
  width: 1.1rem;
  height: 1.1rem;
  border-radius: 50%;
  box-shadow: inset 0 0 0 3px var(--accent);
  transition: background var(--duree);
}

.filet__prise.est-pleine {
  background: var(--accent);
}

.filet__phrase {
  min-height: 1.5em;
  max-width: 36rem;
  text-align: center;
  font-size: var(--t-texte);
}

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

.filet__glyphe {
  font-family: var(--police-texte);
  font-weight: 700;
  font-size: 1.45rem;
}

.filet__glyphe b {
  text-decoration: underline;
  text-underline-offset: 0.15em;
}

@media (max-width: 600px) {
  .filet__panneau {
    padding: var(--espace-2) var(--espace-3);
  }
}

@media (prefers-reduced-motion: reduce) {
  .filet__guide { animation: none; opacity: 1; }
  .filet__filet { transition: none; }
  /* sans mouvement : le point est tout de suite dans le filet */
  .filet__point--rouge.est-tombe::before { animation: none; transform: translateY(2.75rem) scale(0.6); }
}

/* La zone du jeu : la ligne d'étape, le filet et la ligne de mots, d'un seul regard */
.filet__jeu {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: inherit;
  width: 100%;
}
