:root {
  color-scheme: dark;
  font-family: Georgia, serif;
  color: #f5e6c6;
  background: #17100d;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: #17100d;
}

main {
  container-type: inline-size;
  /* Keep the scene and its interactive areas in the image's 1920 × 1088 ratio. */
  position: relative;
  width: max(100%, 176.470588svh, 760px);
  aspect-ratio: 1920 / 1088;
  background: url("images/cabinet.jpg") center / 100% 100% no-repeat;
  text-align: center;
}

header {
  position: absolute;
  top: 3%;
  left: 3%;
  width: 30%;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 1.5rem;
}

h1 {
  margin: 0;
  color: #edbd65;
  font-size: clamp(1.4rem, 2.5vw, 3rem);
  text-shadow: 0 2px 6px #080504;
}

header p {
  margin: 0;
  padding: 0.65rem 1rem;
  border: 1px solid #a8793c;
  border-radius: 0.35rem;
  background: #261810;
}

section[aria-label="Le miroir"] {
  position: absolute;
  left: 41.15%;
  top: 14.7%;
  width: 17.2%;
  height: 57%;
  display: grid;
  place-content: center;
  padding: clamp(0.5rem, 1.25vw, 1.5rem);
  overflow: hidden;
  isolation: isolate;
  background: transparent;
  text-shadow: 0 2px 5px #000;
}

.contenu-miroir {
  position: relative;
  z-index: 1;
  min-width: 0;
  max-height: 100%;
  overflow: auto;
}

.brume {
  position: absolute;
  inset: 0;
  z-index: 2;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.6s ease;
}

.brume::before,
.brume::after {
  content: "";
  position: absolute;
  inset: -40%;
  background:
    radial-gradient(ellipse 35% 12% at 25% 30%, #e0f0e6b3, transparent 75%),
    radial-gradient(ellipse 42% 16% at 75% 65%, #bedbd3a6, transparent 75%),
    radial-gradient(ellipse 38% 13% at 35% 90%, #edf0dab3, transparent 75%);
  filter: blur(9px);
}

.brume::after {
  background:
    radial-gradient(ellipse 45% 10% at 70% 20%, #eaf6edb3, transparent 75%),
    radial-gradient(ellipse 32% 18% at 30% 65%, #c6e5dca6, transparent 75%);
}

.miroir-eveille .brume {
  opacity: 0.85;
}

.miroir-eveille .brume::before {
  animation: derive-brume 5s ease-in-out infinite alternate;
}

.miroir-eveille .brume::after {
  animation: derive-brume 7s ease-in-out -3s infinite alternate-reverse;
}

@keyframes derive-brume {
  0% { transform: translate(-18%, 22%) rotate(-8deg) scale(1); opacity: 0.65; }
  50% { transform: translate(15%, -4%) rotate(7deg) scale(1.2, 0.85); opacity: 1; }
  100% { transform: translate(-10%, -24%) rotate(-5deg) scale(1.05, 1.15); opacity: 0.75; }
}

.miroir-eveille #images-rebus img {
  animation: apparition-image 1.5s ease-out both;
}

@keyframes apparition-image {
  from { opacity: 0; filter: blur(8px); transform: translateY(8px); }
  to { opacity: 1; filter: blur(0); transform: translateY(0); }
}

@media (prefers-reduced-motion: reduce) {
  .brume { transition: none; }
  .miroir-eveille .brume::before,
  .miroir-eveille .brume::after,
  .miroir-eveille #images-rebus img { animation: none; }
}

#message,
#indice {
  color: #c5e6c8;
}

#jeu {
  position: absolute;
  left: 5%;
  top: 30%;
  width: 27%;
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}

#jeu button {
  align-self: flex-start;
  max-width: 100%;
}

#zone-reponse {
  width: min(100%, 170px);
  margin-bottom: 0.5rem;
}

.actions-droite {
  position: absolute;
  right: 5%;
  top: 30%;
  width: 27%;
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}

.actions-droite > button {
  align-self: flex-end;
  max-width: 100%;
}

#zone-reponse label {
  display: block;
  margin-bottom: 0.5rem;
  text-shadow: 0 2px 5px #000;
}

#reponse {
  width: 100%;
}

button,
input {
  padding: 0.65rem 0.85rem;
  border: 1px solid #a8793c;
  border-radius: 0.3rem;
  background: #302014;
  color: inherit;
  font: inherit;
}

button:not(:disabled) {
  cursor: pointer;
}

button:disabled {
  opacity: 0.55;
}

#faire-surgir { --neon: #39ff88; }
#donner-indice { --neon: #fff238; }
#verifier { --neon: #ff4055; }
#reveler { --neon: #c768ff; }

#jeu button,
.boutons-rebus > button,
.actions-droite > button {
  border: 2px solid var(--neon);
  box-shadow: 0 0 6px var(--neon), inset 0 0 5px color-mix(in srgb, var(--neon) 30%, transparent);
  transition: box-shadow 0.2s ease, background-color 0.2s ease;
}

#jeu button:not(:disabled):hover,
.boutons-rebus > button:not(:disabled):hover,
.actions-droite > button:not(:disabled):hover {
  background-color: #211710;
  box-shadow: 0 0 10px var(--neon), 0 0 20px color-mix(in srgb, var(--neon) 45%, transparent);
}

#jeu button:focus-visible,
.boutons-rebus > button:focus-visible,
.actions-droite > button:focus-visible {
  outline: 2px solid #fff;
  outline-offset: 5px;
}

footer {
  position: fixed;
  top: max(16px, env(safe-area-inset-top));
  right: max(20px, env(safe-area-inset-right));
  z-index: 20;
  color: #d0b894;
  font-size: 0.9rem;
  text-align: right;
  text-shadow: 0 2px 5px #000;
}
footer p { margin: 0; }

#images-rebus img {
  display: block;
  width: 100%;
  height: auto;
  max-height: 20svh;
  object-fit: contain;
}
#images-rebus {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  align-items: center;
  gap: 0.25rem;
  width: 100%;
  color: #edbd65;
}

/* Accommodate any number of images in an authored rebus. */
#images-rebus {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
}
#images-rebus img { width: 40%; }

.support-loupe {
  position: absolute;
  left: 9%;
  top: 64.5%;
  width: 170px;
}
#loupe {
  --diametre: calc(5.42cqw * var(--taille-loupe, 1));
  --largeur-manche: max(26px, calc(var(--diametre) * 0.22));
  display: block;
  position: relative;
  width: var(--diametre);
  height: var(--diametre);
  padding: 0;
  border: max(3px, 0.36cqw) solid #b88a43;
  border-radius: 50%;
  background: #152b2a99;
  box-shadow: 0 0 0 2px #513719, inset 0 0 12px #c9eee540, 0 5px 14px #000a;
  cursor: grab;
  touch-action: none;
  user-select: none;
  z-index: 10;
}
.manche-loupe {
  position: absolute;
  width: var(--largeur-manche);
  height: max(66px, calc(var(--diametre) * 0.75));
  top: 85%;
  left: calc(85% - var(--largeur-manche) / 2);
  transform: rotate(-40deg);
  transform-origin: top center;
  border: 2px solid #bb8d4a;
  border-radius: 5px 5px 9px 9px;
  background: linear-gradient(90deg, #29180f, #77502b 50%, #29180f);
  box-shadow: 3px 4px 7px #0008;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-evenly;
  cursor: grab;
}
.manche-loupe button {
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: #21170e;
  color: #ffe27a;
  font: bold 18px/1 Georgia, serif;
  transform: rotate(40deg);
  touch-action: manipulation;
}
.manche-loupe button:focus-visible { outline: 2px solid #fff; }
#loupe.deplacee { position: fixed; margin: 0; }
#loupe.en-main { cursor: grabbing; }
#loupe:focus-visible { outline: 2px solid #fff1bb; outline-offset: 6px; }
.verre-loupe {
  display: block;
  width: 100%;
  height: 100%;
  overflow: hidden;
  border-radius: 50%;
  background: radial-gradient(circle at 28% 25%, #e6fff63d, #8dbcb20d 55%, #10211d55);
  background-repeat: no-repeat;
  pointer-events: none;
}
#loupe.sur-image { border-color: #edc877; box-shadow: 0 0 14px #edc87788, 0 5px 14px #000a; }
#aide-loupe {
  display: block;
  margin-top: 2.5rem;
  color: #fff238;
  font-size: 0.75rem;
  line-height: 1.5;
  text-align: left;
  text-shadow: 0 2px 4px #000;
  white-space: nowrap;
}

#decomposition[hidden] { display: none; }
#decomposition {
  position: absolute;
  bottom: 4%;
  left: 6%;
  right: 6%;
  z-index: 3;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.3rem 0.5rem;
  max-height: 28%;
  overflow: auto;
  padding: 0.8rem 0.3rem;
  border-top: 1px solid #edbd6580;
  background: #0a1514d9;
  color: #ffe3a0;
  font-size: clamp(0.85rem, 1.3cqw, 1.5rem);
  line-height: 1.6;
  text-shadow: 0 0 8px #edbd6566;
}
.partie-mot { white-space: nowrap; }
.secret-revele .contenu-miroir {
  position: absolute;
  inset: 0 0 34%;
  max-height: none;
  padding: inherit;
  display: flex;
  flex-direction: column;
  justify-content: safe center;
}

.reglages-jeu {
  position: fixed;
  right: max(18px, env(safe-area-inset-right));
  bottom: max(18px, env(safe-area-inset-bottom));
  z-index: 30;
  display: flex;
  gap: 10px;
}
.reglages-jeu button {
  display: grid;
  place-items: center;
  width: 56px;
  height: 56px;
  padding: 12px;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  color: #dce5e9;
}
.reglages-jeu button[aria-pressed="true"] {
  color: #d6ffe3;
  box-shadow: none;
}
.reglages-jeu button:focus-visible {
  outline: 2px solid #fff;
  outline-offset: 4px;
}
#statut-reglages { color: #ffe0b3; text-shadow: 0 2px 4px #000; }
#statut-reglages:empty { display: none; }

#message.attente-sang {
  color: #a30c16;
  font-family: Georgia, 'Times New Roman', serif;
  font-weight: 400;
  font-style: normal;
  font-size: clamp(1.2rem, 1.75cqw, 2.2rem);
  line-height: 2.5;
  letter-spacing: -0.025em;
  text-shadow: none;
  padding-bottom: 1.3rem;
}
.texte-accessible {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}
.mot-sang { display: inline-block; white-space: nowrap; }
.lettre-sang {
  position: relative;
  display: inline-block;
  line-height: 1.15;
  color: #a30c16;
  background: linear-gradient(105deg, #4a0007 5%, #ac0e18 27%, #d63439 31%, #8c0710 42%, #b7111c 62%, #520008 95%);
  background-clip: text;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  filter: drop-shadow(0 1px 0 #290004) drop-shadow(1px 2px 1px #000b);
}
.lettre-sang:nth-child(3n) { transform: rotate(-3deg) translateY(1px); }
.lettre-sang:nth-child(4n) { transform: rotate(2deg); }
.coulure::after,
.coulure::before {
  content: '';
  position: absolute;
  left: 48%;
  top: 0.84em;
  pointer-events: none;
  background: linear-gradient(90deg, #510007, #a40c16 40%, #c63136 53%, #7b030d 85%);
}
.coulure::after {
  width: var(--largeur);
  height: var(--coulee);
  border-radius: 35% 40% 48% 45%;
  transform-origin: top;
  animation: filet-sang var(--duree) var(--delai) linear infinite;
}
.coulure::before {
  width: calc(var(--largeur) + 3px);
  height: calc(var(--largeur) + 6px);
  margin-left: -1.5px;
  border-radius: 45% 45% 55% 55% / 65% 65% 40% 40%;
  box-shadow: inset 1px 0 0 #e3606138;
  animation: goutte-sang var(--duree) var(--delai) linear infinite;
}
@keyframes filet-sang {
  0% { transform: scaleY(0.2); }
  65%, 85% { transform: scaleY(1); }
  100% { transform: scaleY(0.2); }
}
@keyframes goutte-sang {
  0% { transform: translateY(calc(var(--coulee) * 0.2)) scale(0.5); opacity: 1; }
  65% { transform: translateY(var(--coulee)) scale(1); opacity: 1; }
  82% { transform: translateY(calc(var(--coulee) + 24px)) scale(0.8, 1.3); opacity: 0; }
  100% { transform: translateY(calc(var(--coulee) * 0.2)) scale(0.5); opacity: 0; }
}
@media (prefers-reduced-motion: reduce) {
  .coulure::after, .coulure::before { animation: none; }
  .coulure::before { transform: translateY(var(--coulee)); }
}

.salon[hidden] { display: none; }
.salon {
  position: absolute;
  right: 5%;
  top: 46%;
  width: 27%;
  max-height: 46%;
  overflow: auto;
  padding: 1rem;
  border: 1px solid #b78b49;
  border-radius: 0.5rem;
  background: #17100ded;
  text-align: left;
  font-size: clamp(0.8rem, 1cqw, 1rem);
}
.salon h2 { margin: 0 0 0.7rem; font-size: 1.2em; color: #edbd65; }
.salon button { margin: 0.2rem 0; padding: 0.4rem 0.6rem; font-size: 0.9em; }
.salon ol { padding-left: 1.5rem; line-height: 1.7; }
#code-salon { letter-spacing: 0.12em; user-select: all; }
#erreur-salon, #erreur-connexion { color: #ffd197; }
#dialogue-multijoueur {
  width: min(92vw, 520px);
  max-height: 90svh;
  overflow: auto;
  padding: 1.7rem;
  border: 1px solid #c79c56;
  border-radius: 0.6rem;
  background: #211710;
  color: #f5e6c6;
  line-height: 1.6;
}
#dialogue-multijoueur::backdrop { background: #080504cf; }
#dialogue-multijoueur h2 { color: #edbd65; margin-top: 0; }
#connexion-multijoueur label { display: block; margin: 1rem 0 0.4rem; }
#connexion-multijoueur input { width: 100%; }
#code-rejoindre { text-transform: uppercase; }
.choix-multijoueur { display: flex; flex-wrap: wrap; gap: 0.6rem; margin-top: 1.2rem; }
#mode-multijoueur { --neon: #76d5e1; border-color: #76d5e1; box-shadow: 0 0 6px #76d5e144; }

#statut-reglages { flex-basis: 100%; text-align: right; }
.salon { top: 50%; max-height: 43%; }

.reglages-jeu svg { width: 30px; height: 30px; }
.reglages-jeu button:hover:not(:disabled) { background: transparent; color: #fff; }
#son[aria-pressed="false"] .ondes-son,
#son[aria-pressed="true"] .son-coupe,
#plein-ecran[aria-pressed="false"] .icone-sortir,
#plein-ecran[aria-pressed="true"] .icone-entrer { display: none; }
#statut-reglages {
  position: absolute;
  right: 0;
  bottom: calc(100% + 10px);
  width: min(320px, 80vw);
  padding: 0.6rem;
  border-radius: 0.3rem;
  background: #080e12eb;
}

/* Use only the edited interior; retain the original glass rim and the scene. */
.cloche-vide {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: url('assets/cloche-gauche-vide.png') center / 100% 100% no-repeat;
  clip-path: polygon(28.2% 34.6%, 28.2% 25.1%, 28.5% 23.5%, 29.1% 22.8%, 30.5% 22%, 31.8% 22.7%, 32.6% 24%, 32.9% 25.5%, 32.9% 34.6%);
}
.score-cloche {
  position: absolute;
  left: 28.2%;
  top: 22.3%;
  width: 4.7%;
  height: 12.3%;
  pointer-events: none;
  overflow: hidden;
  border-radius: 45% 45% 8% 8% / 27% 27% 6% 6%;
  z-index: 2;
}
.score-cloche svg { display: block; width: 100%; height: 100%; overflow: visible; }
.score-cloche::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(100deg, transparent 7%, #fff2d90b 12%, transparent 19%, transparent 84%, #fff2d914 89%, transparent 95%);
  pointer-events: none;
}
.chiffre-fumee text {
  font: italic 400 var(--taille-chiffre, 64px) Georgia, serif;
  fill: #e0e6d7;
  opacity: 0.9;
  stroke: #cbd8c5;
  stroke-width: 0.25;
  transform-origin: 60px 80px;
}
.chiffre-fumee .score-halo {
  filter: blur(2.8px);
  opacity: 0.35;
  stroke-width: 1.5;
}
.volutes-points {
  fill: none;
  stroke: #d4dfd1;
  stroke-width: 2.2;
  stroke-linecap: round;
  opacity: 0.14;
}
.volutes-points path {
  stroke-dasharray: 44 28 16 36;
  animation: volutes-au-repos 9s linear infinite;
}
.volutes-points path:nth-child(2) { animation-direction: reverse; animation-duration: 11s; }
.volutes-points path:nth-child(3) { animation-delay: -4s; }
.sans-points .chiffre-fumee { visibility: hidden; }
.sans-points .volutes-points {
  opacity: 0.65;
  transform-origin: 60px 75px;
  animation: fumee-dans-cloche 7s ease-in-out infinite alternate;
}
.sans-points .volutes-points path { animation-duration: 5s; }
@keyframes fumee-dans-cloche {
  from { transform: translateY(4px) rotate(-10deg) scale(0.9, 1); opacity: 0.45; }
  to { transform: translateY(-5px) rotate(12deg) scale(1.07, 0.9); opacity: 0.75; }
}
.materialisation .chiffre-fumee { animation: chiffre-materialise 3s ease-out both; transform-origin: 60px 80px; }
.materialisation .volutes-points { animation: rassemblement-fumee 3s ease-out both; }
@keyframes chiffre-materialise {
  0%, 12% { opacity: 0; transform: translateY(20px) scale(1.2); filter: url(#fumee-chiffre) blur(7px); }
  35% { opacity: 0.15; transform: translateY(8px) scale(1.12); filter: url(#fumee-chiffre) blur(4px); }
  70% { opacity: 0.65; transform: translateY(-2px) scale(1.02); filter: url(#fumee-chiffre) blur(1px); }
  100% { opacity: 1; transform: translateY(0) scale(1); filter: url(#fumee-chiffre) blur(0); }
}
@keyframes rassemblement-fumee {
  0% { opacity: 0; transform: translateY(18px) scale(1.1); }
  25% { opacity: 0.85; }
  60% { opacity: 0.65; transform: translateY(-5px) scale(0.9); }
  100% { opacity: 0.14; transform: translateY(0) scale(1); }
}
@keyframes volutes-au-repos { to { stroke-dashoffset: -124; } }
@media (prefers-reduced-motion: reduce) {
  .materialisation .chiffre-fumee,
  .materialisation .volutes-points,
  .sans-points .volutes-points,
  .volutes-points path { animation: none; }
}

/* Keep the opening question discreet, slightly above the rebus. */
#message.question-miroir {
  font-size: 0.8em;
  line-height: 1.35;
  position: relative;
  top: -0.65rem;
  margin-bottom: 0.4rem;
}

/* Preserve accessible image descriptions without displaying fallback text. */
#images-rebus img { font-size: 0; color: transparent; }

.boutons-rebus {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.65rem;
}
.boutons-rebus > button {
  flex: 1 1 0;
  min-width: 0;
}

#commandes-ouverture[hidden], #titre-ouverture[hidden] { display: none; }
/* Anchor the five main commands to the viewport, independently of the scene. */
#commandes-ouverture {
  position: fixed;
  left: 50vw;
  bottom: calc(max(24px, env(safe-area-inset-bottom)) + 24px);
  transform: translateX(-50%);
  z-index: 25;
  width: min(1100px, calc(100vw - 340px));
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 0.75rem;
}
#commandes-ouverture > button { height: 100%; }

@media (max-width: 1000px) {
  #commandes-ouverture {
    bottom: calc(114px + env(safe-area-inset-bottom));
    width: calc(100vw - 32px);
  }
}
@media (max-width: 600px) {
  #commandes-ouverture {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.6rem;
  }
}


/* Bright green neon outline for the rebus summon command. */
#faire-surgir {
  border: 2px solid #39ff88;
  box-shadow: 0 0 8px #39ff88, 0 0 18px #39ff8873, inset 0 0 6px #39ff8859;
}
#faire-surgir:not(:disabled):hover {
  box-shadow: 0 0 12px #39ff88, 0 0 26px #39ff8899, inset 0 0 8px #39ff8866;
}

/* Keep every game command hidden throughout the seven-second introduction. */
.ouverture-en-cours button,
.ouverture-en-cours #jeu,
.ouverture-en-cours .actions-droite,
.ouverture-en-cours .reglages-jeu,
.ouverture-en-cours .support-loupe,
.ouverture-en-cours #salon {
  visibility: hidden;
  pointer-events: none;
}

.ouverture-en-cours #message { visibility: hidden; }

/* Fade the commands in together when the introduction ends. */
body:not(.ouverture-en-cours) #commandes-ouverture,
body:not(.ouverture-en-cours) #jeu,
body:not(.ouverture-en-cours) .actions-droite,
body:not(.ouverture-en-cours) .reglages-jeu,
body:not(.ouverture-en-cours) .support-loupe,
body:not(.ouverture-en-cours) #salon {
  animation: apparition-commandes 1.5s ease-out both;
}
@keyframes apparition-commandes {
  from { opacity: 0; }
  to { opacity: 1; }
}
@media (prefers-reduced-motion: reduce) {
  body:not(.ouverture-en-cours) #commandes-ouverture,
  body:not(.ouverture-en-cours) #jeu,
  body:not(.ouverture-en-cours) .actions-droite,
  body:not(.ouverture-en-cours) .reglages-jeu,
  body:not(.ouverture-en-cours) .support-loupe,
  body:not(.ouverture-en-cours) #salon { animation: none; }
}


#description-ouverture {
  flex-basis: 100%;
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
  color: #f5e6c6;
  font-size: clamp(1rem, 1.3vw, 1.4rem);
  line-height: 1.5;
  text-shadow: 0 2px 6px #080504;
}
body:not(.ouverture-en-cours) #description-ouverture {
  display: none;
}


/* The opening words condense from vapor, linger, then drift apart. */
.ouverture-en-cours header { isolation: isolate; }
.ouverture-en-cours #titre-ouverture,
.ouverture-en-cours #description-ouverture {
  opacity: 0;
  transform-origin: 50% 65%;
}
.ouverture-animee #titre-ouverture,
.ouverture-animee #description-ouverture {
  animation: mots-de-vapeur 7s linear both;
}
.ouverture-animee #description-ouverture {
  animation-name: sous-titre-de-vapeur;
}
.ouverture-en-cours header::before,
.ouverture-en-cours header::after {
  content: '';
  position: absolute;
  inset: -35% -15%;
  z-index: -1;
  pointer-events: none;
  opacity: 0;
  background:
    radial-gradient(ellipse at 30% 65%, #e1ead347, transparent 55%),
    radial-gradient(ellipse at 70% 35%, #cde6df38, transparent 50%);
  filter: blur(16px);
}
.ouverture-animee header::before {
  animation: volute-du-titre 7s ease-in-out both;
}
.ouverture-animee header::after {
  animation: volute-du-titre 7s ease-in-out both reverse;
}



@media (prefers-reduced-motion: reduce) {
  .ouverture-en-cours #titre-ouverture,
  .ouverture-en-cours #description-ouverture {
    animation: none;
    opacity: 1;
    filter: none;
    transform: none;
  }
  .ouverture-en-cours header::before,
  .ouverture-en-cours header::after { display: none; }
}


/* Circular drift settles while reading, then widens as the words dissolve. */
@keyframes mots-de-vapeur {
  0% { opacity: 0; filter: blur(20px); transform: rotate(-230deg) translateX(72px) rotate(213.9deg) scale(0.65); }
  8% { opacity: 0.15; filter: blur(15px); transform: rotate(-170deg) translateX(60px) rotate(158.1deg) scale(0.72); }
  16% { opacity: 0.4; filter: blur(9px); transform: rotate(-100deg) translateX(42px) rotate(93deg) scale(0.84); }
  24% { opacity: 0.75; filter: blur(4px); transform: rotate(-40deg) translateX(24px) rotate(37.2deg) scale(0.94); }
  34% { opacity: 1; filter: blur(0px); transform: rotate(0deg) translateX(0px) rotate(0deg) scale(1); }
  65% { opacity: 1; filter: blur(0px); transform: rotate(0deg) translateX(0px) rotate(0deg) scale(1); }
  72% { opacity: 0.9; filter: blur(2px); transform: rotate(45deg) translateX(12px) rotate(-41.85deg) scale(1.03); }
  79% { opacity: 0.7; filter: blur(5px); transform: rotate(115deg) translateX(30px) rotate(-106.95deg) scale(1.09); }
  86% { opacity: 0.45; filter: blur(10px); transform: rotate(195deg) translateX(52px) rotate(-181.35deg) scale(1.18); }
  93% { opacity: 0.2; filter: blur(16px); transform: rotate(275deg) translateX(78px) rotate(-255.75deg) scale(1.3); }
  100% { opacity: 0; filter: blur(24px); transform: rotate(360deg) translateX(110px) rotate(-334.8deg) scale(1.45); }
}
@keyframes sous-titre-de-vapeur {
  0% { opacity: 0; filter: blur(20px); transform: rotate(230deg) translateX(72px) rotate(-213.9deg) scale(0.65); }
  8% { opacity: 0.15; filter: blur(15px); transform: rotate(170deg) translateX(60px) rotate(-158.1deg) scale(0.72); }
  16% { opacity: 0.4; filter: blur(9px); transform: rotate(100deg) translateX(42px) rotate(-93deg) scale(0.84); }
  24% { opacity: 0.75; filter: blur(4px); transform: rotate(40deg) translateX(24px) rotate(-37.2deg) scale(0.94); }
  34% { opacity: 1; filter: blur(0px); transform: rotate(0deg) translateX(0px) rotate(0deg) scale(1); }
  65% { opacity: 1; filter: blur(0px); transform: rotate(0deg) translateX(0px) rotate(0deg) scale(1); }
  72% { opacity: 0.9; filter: blur(2px); transform: rotate(-45deg) translateX(12px) rotate(41.85deg) scale(1.03); }
  79% { opacity: 0.7; filter: blur(5px); transform: rotate(-115deg) translateX(30px) rotate(106.95deg) scale(1.09); }
  86% { opacity: 0.45; filter: blur(10px); transform: rotate(-195deg) translateX(52px) rotate(181.35deg) scale(1.18); }
  93% { opacity: 0.2; filter: blur(16px); transform: rotate(-275deg) translateX(78px) rotate(255.75deg) scale(1.3); }
  100% { opacity: 0; filter: blur(24px); transform: rotate(-360deg) translateX(110px) rotate(334.8deg) scale(1.45); }
}
@keyframes volute-du-titre {
  0% { opacity: 0; transform: translate(-12%, 0) rotate(0) scale(0.8); }
  12.5% { opacity: 0.5; transform: translate(-8.5%, -8.5%) rotate(45deg) scale(0.95); }
  25% { opacity: 0.7; transform: translate(0, -12%) rotate(90deg) scale(1.1); }
  37.5% { opacity: 0.3; transform: translate(8.5%, -8.5%) rotate(135deg) scale(1.05); }
  50% { opacity: 0.15; transform: translate(12%, 0) rotate(180deg) scale(1); }
  62.5% { opacity: 0.3; transform: translate(8.5%, 8.5%) rotate(225deg) scale(1.1); }
  75% { opacity: 0.6; transform: translate(0, 12%) rotate(270deg) scale(1.2); }
  87.5% { opacity: 0.4; transform: translate(-12%, 12%) rotate(315deg) scale(1.35); }
  100% { opacity: 0; transform: translate(-20%, 0) rotate(360deg) scale(1.5); }
}


/* Horror lettering for the vapor introduction. */
#titre-ouverture,
#description-ouverture {
  font-family: 'Metal Mania', 'Chiller', Georgia, serif;
  font-weight: 400;
  letter-spacing: 0.045em;
  text-shadow: 0 2px 3px #000, 0 0 12px #a30c1666;
}
#titre-ouverture {
  color: #e0c48d;
  font-size: clamp(1.8rem, 3.2vw, 3.8rem);
}
#description-ouverture {
  color: #cfbd9d;
  font-size: clamp(1.1rem, 1.5vw, 1.65rem);
  line-height: 1.5;
}


/* Curved vapor arms turn around the opening words like a vortex. */
.ouverture-en-cours header::before,
.ouverture-en-cours header::after {
  inset: -65% -30%;
  border-radius: 50%;
  background:
    conic-gradient(from 20deg, transparent 0deg 35deg, #d9e7dc55 65deg, transparent 100deg 160deg, #c3d9d04d 195deg, transparent 235deg 295deg, #e5e2c947 330deg, transparent 360deg);
  -webkit-mask-image: radial-gradient(ellipse, transparent 12%, #000 32% 48%, transparent 70%);
  mask-image: radial-gradient(ellipse, transparent 12%, #000 32% 48%, transparent 70%);
  filter: blur(10px);
  transform-origin: center;
}
.ouverture-animee header::before {
  animation: tourbillon-vapeur 7s linear both;
}
.ouverture-animee header::after {
  animation: tourbillon-vapeur 7s linear both reverse;
  background-position: center;
  filter: blur(17px);
}
@keyframes tourbillon-vapeur {
  0% { opacity: 0; transform: rotate(-240deg) scale(0.35); }
  18% { opacity: 0.85; transform: rotate(-100deg) scale(0.8); }
  35% { opacity: 0.35; transform: rotate(30deg) scale(1); }
  50% { opacity: 0.12; transform: rotate(120deg) scale(1.05); }
  65% { opacity: 0.2; transform: rotate(210deg) scale(1.1); }
  80% { opacity: 0.8; transform: rotate(360deg) scale(1.2); }
  100% { opacity: 0; transform: rotate(560deg) scale(1.7); }
}


/* Pale toxic green gothic lettering for the vapor introduction. */
#titre-ouverture,
#description-ouverture {
  color: #d4ed9b;
  letter-spacing: 0.055em;
  -webkit-text-stroke: 0.35px #35451c;
  text-shadow:
    0 -1px 0 #f1ffd3,
    0 0 5px #b8dc65,
    0 0 12px #b8dc6599,
    0 0 24px #b8dc6555,
    0 3px 6px #000;
}
#titre-ouverture {
  font-size: clamp(1.6rem, 2.8vw, 3.35rem);
}
#description-ouverture {
  color: #dceab6;
  font-size: clamp(0.85rem, 1.1vw, 1.25rem);
  line-height: 1.55;
}


/* Each glyph releases its own small, staggered plume of toxic vapor. */
.mot-fumant { display: inline-block; white-space: nowrap; }
.lettre-fumante { position: relative; display: inline-block; }
.lettre-fumante::before,
.lettre-fumante::after {
  content: '';
  position: absolute;
  pointer-events: none;
  left: 15%;
  bottom: 65%;
  width: 0.65em;
  height: 1.3em;
  border-radius: 45% 65% 35% 60%;
  background: radial-gradient(ellipse at 50% 75%, #dceab68c, #b8dc6540 40%, transparent 72%);
  filter: blur(3px);
  opacity: 0;
}
.ouverture-animee .lettre-fumante::before,
.ouverture-animee .lettre-fumante::after {
  animation: fumee-des-lettres var(--duree-fumee) var(--retard-fumee) linear infinite;
}
.ouverture-animee .lettre-fumante::after {
  left: 40%;
  width: 0.45em;
  animation-delay: calc(var(--retard-fumee) - 1.1s);
}
@keyframes fumee-des-lettres {
  0% { opacity: 0; transform: translate(0, 0) rotate(-10deg) scale(0.45, 0.3); }
  20% { opacity: 0.55; transform: translate(3px, -0.3em) rotate(12deg) scale(0.7, 0.6); }
  45% { opacity: 0.4; transform: translate(var(--derive-fumee), -0.85em) rotate(-18deg) scale(1, 0.9); }
  70% { opacity: 0.2; transform: translate(0, -1.5em) rotate(22deg) scale(1.3, 1.15); }
  100% { opacity: 0; transform: translate(var(--derive-fumee), -2.3em) rotate(-12deg) scale(1.8, 1.4); }
}
@media (prefers-reduced-motion: reduce) {
  .ouverture-animee .lettre-fumante::before,
  .ouverture-animee .lettre-fumante::after { animation: none; display: none; }
}
