/* Jeu : le petit théâtre */

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

/* ---------- La scène, ses planches et son rideau ---------- */

.theatre__scene {
  position: relative;
  width: 100%;
  max-width: 36rem;
  padding: var(--espace-5) var(--espace-5) var(--espace-4);
  border-radius: var(--rayon-grand) var(--rayon-grand) 8px 8px;
  background: var(--surface-2);
  box-shadow: inset 0 0 0 3px var(--trait), inset 0 -14px 0 var(--bois-flanc);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--espace-2);
  overflow: hidden;
}

.theatre__personnage {
  width: 2.8rem;
  height: 2.8rem;
}

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

.theatre__titre {
  margin: 0;
  font-family: var(--police-titre);
  font-size: var(--t-titre-3);
  text-align: center;
}

.theatre__texte {
  display: flex;
  flex-direction: column;
  gap: var(--espace-2);
  padding-bottom: var(--espace-4);
}

.theatre__ligne {
  margin: 0;
  padding: 0.05em 0.25em;
  border-radius: 8px;
  font-family: var(--police-texte);
  font-weight: 700;
  font-size: clamp(1.35rem, 1.1rem + 1.2vw, 1.85rem);
  line-height: 1.45;
  text-align: center;
  transition: box-shadow 480ms ease;
}

.theatre__ligne--lue {
  box-shadow: inset 0 -0.42em 0 color-mix(in srgb, var(--accent) 55%, transparent);
}
@supports not (color: color-mix(in srgb, red 50%, blue)) { .theatre__ligne--lue { box-shadow: inset 0 -0.42em 0 var(--trait); } }

/* Le costume de la voix choisie : la souris en petit et serré, le géant en grand, le robot en carré */
.theatre__scene[data-voix="souris"] .theatre__ligne { letter-spacing: 0.02em; transform: scale(0.92); }
.theatre__scene[data-voix="geant"] .theatre__ligne { letter-spacing: 0.08em; font-size: clamp(1.5rem, 1.2rem + 1.5vw, 2.1rem); }
.theatre__scene[data-voix="robot"] .theatre__ligne { font-family: var(--police-titre); font-weight: 400; letter-spacing: 0.05em; font-size: clamp(1.1rem, 0.95rem + 1vw, 1.5rem); }

.theatre__rideau {
  position: absolute;
  inset: 0;
  display: flex;
  pointer-events: none;
}

.theatre__pan {
  flex: 1;
  background: repeating-linear-gradient(90deg, var(--rouge) 0 22px, color-mix(in srgb, var(--rouge) 78%, #000) 22px 30px);
  transition: transform 700ms cubic-bezier(0.5, 0, 0.3, 1);
}
@supports not (color: color-mix(in srgb, red 50%, blue)) { .theatre__pan { background: var(--rouge); } }

.theatre__pan--gauche { transform: translateX(-92%); }
.theatre__pan--droite { transform: translateX(92%); }

.theatre__scene.est-fermee .theatre__pan { transform: none; }

/* ---------- La salle ---------- */

.theatre__salle {
  display: flex;
  justify-content: center;
  align-items: flex-end;
  gap: var(--espace-3);
  min-height: 3.2rem;
}

.theatre__spectateur,
.theatre__bravo {
  width: 2.4rem;
  height: 2.4rem;
  animation: theatre-assis 560ms cubic-bezier(0.3, 1.6, 0.5, 1);
}

.theatre__spectateur .icone,
.theatre__bravo .icone {
  width: 100%;
  height: 100%;
}

.theatre__bravo {
  animation: theatre-bravo 700ms ease-in-out 3;
}

@keyframes theatre-assis {
  0% { transform: translateY(1.5rem); opacity: 0; }
  100% { transform: none; opacity: 1; }
}

@keyframes theatre-bravo {
  0%, 100% { transform: none; }
  50% { transform: translateY(-0.5rem) rotate(-8deg); }
}

.theatre__message {
  min-height: 1.5em;
  text-align: center;
  font-weight: 700;
}

/* ---------- Les tickets ---------- */

.theatre__tickets {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(10rem, 1fr));
  gap: var(--espace-3);
  width: 100%;
  max-width: 40rem;
}

.theatre__ticket {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--espace-2);
  padding: var(--espace-3);
  border-radius: var(--rayon);
  border: 3px dashed var(--accent);
  background: var(--surface);
  cursor: pointer;
}

/* La voix à lire maintenant : en grand, juste sous l'histoire ; les deux autres plus petites */
.theatre__ticket.est-en-cours {
  grid-column: 1 / -1;
  order: -1;
  border-style: solid;
  box-shadow: 0 0 0 3px var(--accent);
}

.theatre__ticket:not(.est-en-cours) {
  padding: var(--espace-2);
}

.theatre__ticket:not(.est-en-cours) .theatre__ticket-icone {
  width: 1.8rem;
  height: 1.8rem;
}

.theatre__ticket.est-fait {
  border-style: solid;
  background: var(--surface-2);
}

/* Le code des couleurs (22/10/2026) : la voix jouée, c'est fait : vert pâle, et une coche après « Joué » */
.theatre__ticket.est-fait .pastille { background: var(--fn-juste); color: var(--fn-juste-texte); font-weight: 700; }
.theatre__ticket.est-fait .pastille::after { content: '\00a0\2713'; font-weight: 800; }

.theatre__ticket-icone {
  width: 2.2rem;
  height: 2.2rem;
}

.theatre__ticket-icone .icone {
  width: 100%;
  height: 100%;
}

.theatre__ticket-nom {
  font-weight: 700;
  text-align: center;
}

.theatre__ticket-boutons {
  flex-wrap: wrap;
}

.theatre__petit {
  min-height: 2.6rem;
  padding: 0.3em 0.8em;
  font-size: var(--t-petit);
}

/* ---------- Mon répertoire ---------- */

.theatre__repertoire {
  width: 100%;
  max-width: 40rem;
}

.theatre__repertoire:empty {
  display: none;
}

.theatre__repertoire-titre {
  font-family: var(--police-titre);
  font-size: var(--t-titre-3);
  text-align: center;
}

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

.theatre__affiche {
  display: inline-flex;
  align-items: center;
  gap: var(--espace-2);
  min-height: 3rem;
  padding: 0.3em 0.8em;
  border: 0;
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--encre);
  box-shadow: inset 0 0 0 2px var(--trait);
  font: inherit;
  cursor: pointer;
}

.theatre__affiche .icone {
  width: 1.6rem;
  height: 1.6rem;
}

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

@media (prefers-reduced-motion: reduce) {
  .theatre__pan { transition: none; }
  .theatre__spectateur, .theatre__bravo { animation: none; }
}

/* À 390 px : une scène plus serrée et le cadre de la voix en cours sur une seule rangée,
   pour lire l'histoire et toucher « J'ai lu » sans défiler (audit du 22/10/2026) */
@media (max-width: 480px) {
  .theatre__scene { padding: var(--espace-4) var(--espace-3); gap: var(--espace-2); }
  .theatre__personnage { width: 2.6rem; height: 2.6rem; }
  .theatre__texte { gap: 0; padding-bottom: var(--espace-3); }
  .theatre__ligne { line-height: 1.3; }
  .theatre__ticket { flex-direction: row; flex-wrap: wrap; justify-content: center; padding: var(--espace-2); }
  .theatre__ticket:not(.est-en-cours) { font-size: var(--t-petit); }
}

/* À l'ordinateur : les trois voix côte à côte et une scène un peu moins haute, pour lire l'histoire
   et toucher « J'ai lu » sans défiler (essai des 48 jeux, 22/10/2026) */
@media (min-width: 700px) {
  .theatre__scene { padding: var(--espace-5) var(--espace-5) var(--espace-4); gap: var(--espace-2); }
  .theatre__personnage { width: 3rem; height: 3rem; }
  .theatre__texte { gap: var(--espace-1); padding-bottom: var(--espace-3); }
  .theatre__tickets { grid-template-columns: repeat(3, minmax(0, 1fr)); max-width: 44rem; }
  .theatre__ticket.est-en-cours { grid-column: auto; order: 0; }
  .theatre__ticket:not(.est-en-cours) { padding: var(--espace-3); }
}

/* La tablette d'abord (règle 12, 22/10/2026) : une cible assez grande pour un doigt */
.scene-jeu .bouton { min-height: 48px; }
