/* Jeu : le dessin qui obéit */

.lisfais__jeu {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--espace-3);
  width: 100%;
}

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

.lisfais__phrase {
  margin: 0;
  font-family: var(--police-texte);
  font-weight: 700;
  font-size: clamp(1.35rem, 1.05rem + 1.5vw, 2rem);
  line-height: 1.35;
  text-align: center;
}

.lisfais__phrase.est-faite {
  color: var(--encre-2);
}

/* Le petit mot qui compte : allumé dans la phrase et dans ce que montre le dessin */
.lisfais__mot {
  border-radius: 6px;
  transition: background 450ms ease, color 450ms ease;
}

.lisfais__mot.est-allume {
  /* le code des couleurs (22/10/2026) : le petit mot piège est surligné en jaune */
  padding: 0 0.15em;
  background: var(--fn-piege);
  color: var(--fn-piege-texte);
}

.lisfais__lis-moi {
  font-size: var(--t-petit);
}

/* Le terrain : la chambre en haut, l'étagère des jouets en bas (100 de large sur 75 de haut) */
.lisfais__terrain {
  position: relative;
  width: 100%;
  max-width: 36rem;
  aspect-ratio: 100 / 75;
  border-radius: var(--rayon-grand);
  overflow: hidden;
  box-shadow: inset 0 0 0 3px var(--trait);
  user-select: none;
  -webkit-user-select: none;
}

.lisfais__terrain.est-gagne {
  /* le code des couleurs : c'est fait, cadre vert pâle et une coche */
  box-shadow: inset 0 0 0 5px var(--fn-juste);
}

.lisfais__terrain.est-gagne::after {
  content: '\2713';
  position: absolute;
  z-index: 20;
  top: 0.6rem;
  right: 0.6rem;
  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;
}

.lisfais__mur,
.lisfais__sol,
.lisfais__etagere {
  position: absolute;
  left: 0;
  right: 0;
}

.lisfais__mur {
  top: 0;
  height: 49.3%;
  background: var(--surface-2);
}

.lisfais__sol {
  top: 49.3%;
  height: 26.7%;
  background: color-mix(in srgb, var(--bois) 72%, var(--bois-flanc));
}

.lisfais__etagere {
  top: 76%;
  bottom: 0;
  background: var(--bois);
  border-top: 6px solid var(--bois-flanc);
}

.lisfais__decor,
.lisfais__chose {
  position: absolute;
  aspect-ratio: 1;
  display: block;
}

.lisfais__decor {
  z-index: 2;
  pointer-events: none;
}

.lisfais__decor .icone,
.lisfais__chose .icone {
  width: 100%;
  height: 100%;
}

/* Une chose à déplacer : petite à l'œil, large sous le doigt */
.lisfais__chose {
  z-index: 3;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  cursor: grab;
  touch-action: none;
  transition: left 520ms cubic-bezier(0.22, 1, 0.36, 1), top 520ms cubic-bezier(0.22, 1, 0.36, 1), transform var(--duree);
}

.lisfais__chose::after {
  content: "";
  position: absolute;
  inset: -0.45rem;
  border-radius: 50%;
}

.lisfais__chose.est-dessous {
  z-index: 1;
}

.lisfais__chose.est-choisie {
  z-index: 10;
  transform: scale(1.18);
  /* le code des couleurs : ce qu'on vient de choisir porte le contour bleu */
  filter: drop-shadow(0 0 1.5px var(--fn-change)) drop-shadow(0 0 1.5px var(--fn-change)) drop-shadow(0 0 1px var(--fn-change));
}

.lisfais__chose.est-glissee {
  z-index: 11;
  cursor: grabbing;
  transition: none;
}

.lisfais__chose.est-guidee {
  animation: lisfais-appel 1.3s ease-in-out infinite;
}

.lisfais__chose:focus-visible {
  outline: 3px solid var(--encre);
  outline-offset: 3px;
}

@keyframes lisfais-appel {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.22); }
}

/* Les places : un rond pointillé, montré seulement quand une chose est prise */
.lisfais__place {
  position: absolute;
  z-index: 9;
  width: 3rem;
  height: 3rem;
  margin: -1.5rem 0 0 -1.5rem;
  padding: 0;
  border: 3px dashed var(--encre-2);
  border-radius: 50%;
  background: color-mix(in srgb, var(--surface) 55%, transparent);
  opacity: 0;
  pointer-events: none;
  cursor: pointer;
  transition: opacity var(--duree);
}

.montre-places .lisfais__place {
  opacity: 0.85;
  pointer-events: auto;
}

.lisfais__place.est-guidee {
  border: 4px solid var(--encre);
  background: var(--accent);
  opacity: 1;
  animation: lisfais-appel 1.3s ease-in-out infinite;
}

.lisfais__place:focus-visible {
  outline: 3px solid var(--encre);
  outline-offset: 2px;
  opacity: 1;
}

.lisfais__place--etagere {
  left: 2%;
  right: 2%;
  top: 77%;
  bottom: 2%;
  width: auto;
  height: auto;
  margin: 0;
  border-radius: var(--rayon);
}

.montre-places .lisfais__place--etagere {
  opacity: 0.5;
}

.lisfais__retour {
  margin: 0;
  max-width: 36rem;
  min-height: 2.8em;
  font-weight: 700;
  font-size: var(--t-grand);
  line-height: 1.4;
  text-align: center;
}

.lisfais__truc {
  display: grid;
  gap: var(--espace-4);
  width: 100%;
  max-width: 34rem;
}

@supports not (color: color-mix(in srgb, red 50%, blue)) {
  .lisfais__place { background: transparent; }
  .lisfais__sol { background: var(--bois); }
}

@media (prefers-reduced-motion: reduce) {
  .lisfais__chose,
  .lisfais__chose.est-guidee,
  .lisfais__place.est-guidee {
    animation: none;
    transition: none;
  }
}
