/* Jeu : je place, elle raconte */

.place__modes {
  justify-content: center;
}

/* La phrase, la pièce et les boutons, ensemble dans l'écran (audit sur tablette du 22/10/2026) */
.place__jeu {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--espace-3);
  width: 100%;
}

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

.place__consigne {
  flex: 1;
  min-width: 0;
  font-weight: 700;
  font-size: var(--t-grand);
  line-height: 1.35;
  text-align: center;
  /* trois lignes réservées : la pièce ne monte ni ne descend quand la phrase change de longueur (audit du 22/10/2026) */
  min-height: 4.05em;
  display: grid;
  place-items: center;
}

/* ---------- La pièce, vue de face ---------- */

.place__piece {
  position: relative;
  width: 100%;
  max-width: 34rem;
  aspect-ratio: 4 / 3;
  border-radius: var(--rayon-grand);
  overflow: hidden;
  background: var(--surface-2);
  box-shadow: inset 0 0 0 3px var(--trait);
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
}

.place__mur {
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(90deg, transparent 0 18%, color-mix(in srgb, var(--trait) 45%, transparent) 18% 18.6%);
}

.place__sol {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  background: var(--bois);
  box-shadow: inset 0 4px 0 var(--bois-flanc);
}

.place__etagere {
  position: absolute;
  height: 3%;
  border-radius: 4px;
  background: var(--bois-flanc);
}

.place__table {
  position: absolute;
}

.place__plateau {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 12%;
  border-radius: 6px;
  background: var(--vert);
}

.place__pied {
  position: absolute;
  top: 10%;
  bottom: 0;
  width: 7%;
  border-radius: 3px;
  background: color-mix(in srgb, var(--vert) 70%, var(--encre));
}

.place__pied--g { left: 6%; }
.place__pied--d { right: 6%; }

.place__boite {
  position: absolute;
  display: grid;
  place-items: end center;
}

.place__boite .icone {
  width: 100%;
  height: 100%;
}

/* ---------- Les objets qu'on déplace ---------- */

.place__objet {
  position: absolute;
  aspect-ratio: 1;
  padding: 0;
  border: 0;
  background: transparent;
  cursor: grab;
  touch-action: none;
  z-index: 2;
  transition: top 480ms cubic-bezier(0.5, 0, 0.8, 1.2);
}

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

.place__objet.est-pris {
  cursor: grabbing;
  z-index: 3;
  transition: none;
  filter: drop-shadow(0 8px 6px var(--ombre));
  transform: scale(1.1);
}

/* L'objet touché, qui attend qu'on touche sa place */
.place__objet.est-choisi {
  z-index: 3;
  transform: scale(1.12);
  /* le code des couleurs (22/10/2026) : 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)) drop-shadow(0 6px 4px var(--ombre));
  animation: place-choisi 900ms ease-in-out infinite alternate;
}

@keyframes place-choisi {
  from { transform: scale(1.06); }
  to { transform: scale(1.16); }
}

.place__objet:focus-visible {
  outline: 3px solid var(--fn-change);
  outline-offset: 2px;
  border-radius: 8px;
}

/* ---------- Les scènes réussies ---------- */

.place__reussies {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: var(--espace-2);
  max-width: 34rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.place__reussies:empty {
  display: none;
}

.place__reussie {
  padding: 0.3rem 0.75rem;
  border-radius: 999px;
  /* le code des couleurs : réussi = vert pâle, avec la coche */
  background: var(--fn-juste);
  color: var(--fn-juste-texte);
  box-shadow: inset 0 0 0 2px var(--fn-juste-texte);
  font-weight: 700;
  font-size: 0.95rem;
}

.place__reussie::before {
  content: "✓ ";
  color: inherit;
}

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

@media (prefers-reduced-motion: reduce) {
  .place__objet {
    transition: none;
  }
  .place__objet.est-choisi {
    animation: none;
  }
}

/* Repli pour les iPad restés en iOS 15, qui ne connaissent pas color-mix (règle 12 du CLAUDE.md, 22/10/2026) */
@supports not (color: color-mix(in srgb, red 50%, blue)) {
  .place__mur { background: repeating-linear-gradient(90deg, transparent 0 18%, var(--trait) 18% 18.6%); }
  .place__pied { background: var(--vert); }
}
