@font-face {
  font-family: "Cormorant";
  src: url("texte.woff2") format("woff2");
  font-weight: 600;
  font-style: normal;
  font-display: swap;
}

:root {
  --encre: rgb(84, 48, 104);
  --creme: #fbf3e4;
  --or: #c9933a;
  --sat: env(safe-area-inset-top, 0px);
  --sab: env(safe-area-inset-bottom, 0px);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  overscroll-behavior: none;
  background: #e9d6cf;
}

body {
  position: fixed;
  inset: 0;
  font-family: "Cormorant", "Cormorant Garamond", Georgia, "Times New Roman", serif;
  font-weight: 600;
  color: var(--encre);
  -webkit-tap-highlight-color: transparent;
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
  -webkit-text-size-adjust: 100%;
}

/* ---------- décor : plein cadre (image) + boucles vidéo recadrées autour du chaudron */
#scene {
  position: absolute;
  left: 0;
  top: 0;
  transform-origin: 0 0;
  pointer-events: none;
  contain: layout paint;
}
#scene > * {
  position: absolute;
  display: block;
}
#decor, #decorFin {
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
}
#decorFin { opacity: 0; }
#vAmb, #vFin {
  /* 640x1080 de la scène 1920x1080, à partir de x = 640 */
  left: 33.3333%;
  top: 0;
  width: 33.3333%;
  height: 100%;
  object-fit: fill;
  opacity: 0;
  transition: opacity .6s ease;
  -webkit-mask-image: linear-gradient(to right, transparent 0, #000 9%, #000 91%, transparent 100%);
  mask-image: linear-gradient(to right, transparent 0, #000 9%, #000 91%, transparent 100%);
}
#vAmb.joue { opacity: 1; }
#vFin { transition: none; }

#fx, #fx2 {
  position: absolute;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

#voile {
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  opacity: 0;
  pointer-events: none;
}

#eclair {
  position: absolute;
  inset: 0;
  opacity: 0;
  pointer-events: none;
}

/* ---------- titre et consigne */
#haut {
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  text-align: center;
  pointer-events: none;
}
#haut h1 { margin: 0; line-height: 0; }
#titre {
  display: inline-block;
  height: auto;
}
#consigne {
  margin: .1em auto 0;
  padding: 0 1em;
  max-width: 26em;
  font-size: clamp(19px, 5.2vw, 27px);
  line-height: 1.15;
  text-shadow: 0 0 2px rgba(255, 248, 235, 1), 0 0 6px rgba(255, 246, 230, 1), 0 0 14px rgba(255, 240, 220, .95), 0 0 26px rgba(255, 236, 214, .8);
  transition: opacity .5s ease;
}
#consigne.cache { opacity: 0; }

/* ---------- médaillon */
#medaillon {
  position: absolute;
  pointer-events: none;
}
#reponse {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  transform-origin: 50% 50%;
}
#reponse.pret { opacity: 1; }
#reponse.pulse { animation: pulse 1.1s ease-out both; }
@keyframes pulse {
  0% { transform: scale(.9); }
  55% { transform: scale(1.05); }
  100% { transform: scale(1); }
}
#feuille {
  position: absolute;
  border-radius: 50%;
  touch-action: none;
  pointer-events: auto;
  cursor: grab;
  transition: opacity .75s ease, transform .75s ease;
}
#feuille.fond { opacity: 0; transform: scale(1.06); pointer-events: none; }
#feuille[hidden] { display: none; }

#neutre {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 64%;
  transform: translate(-50%, -50%);
  text-align: center;
  font-size: var(--neutre-fs, 22px);
  line-height: 1.15;
}
#neutre[hidden] { display: none; }

/* ---------- boutons */
#barre {
  position: absolute;
  left: 0;
  right: 0;
  bottom: calc(16px + var(--sab));
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 12px;
  pointer-events: none;
}
#barre button {
  pointer-events: auto;
  font: inherit;
  font-size: 19px;
  color: var(--encre);
  background: rgba(251, 243, 228, .88);
  border: 1.5px solid rgba(201, 147, 58, .9);
  border-radius: 999px;
  min-height: 44px;
  padding: 6px 20px;
  box-shadow: 0 2px 10px rgba(60, 30, 20, .18);
  -webkit-backdrop-filter: blur(4px);
  backdrop-filter: blur(4px);
}
#barre button:focus-visible, #clavier:focus-visible {
  outline: 3px solid var(--encre);
  outline-offset: 2px;
}
#son {
  width: 44px;
  padding: 0 !important;
  display: grid;
  place-items: center;
}
#son svg { width: 22px; height: 22px; }
#son .barre-son { display: none; }
#son[aria-pressed="false"] .barre-son { display: inline; }
#son[aria-pressed="false"] .ondes { display: none; }
#revoir[hidden] { display: none; }

.vh, #clavier:not(:focus) {
  position: absolute !important;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}
#clavier:focus {
  position: absolute;
  left: 50%;
  top: 10px;
  transform: translateX(-50%);
  font: inherit;
  font-size: 18px;
  color: var(--encre);
  background: var(--creme);
  border: 2px solid var(--or);
  border-radius: 10px;
  padding: 8px 14px;
  z-index: 5;
}

noscript p {
  position: absolute;
  left: 8%;
  right: 8%;
  bottom: 20%;
  text-align: center;
  font-size: 20px;
  background: rgba(251, 243, 228, .9);
  border-radius: 12px;
  padding: 12px;
}

video::-webkit-media-controls,
video::-webkit-media-controls-start-playback-button,
video::-webkit-media-controls-overlay-play-button {
  display: none !important;
  -webkit-appearance: none;
}
