/* MOBB 13 — le jeu : rue, montée, palier, salon, pièces des sons.
   Plein écran sur ordinateur, scènes qu'on fait glisser du doigt sur téléphone. */

@font-face { font-family: "Big Shoulders"; src: url("fonts/bigshoulders.woff2") format("woff2"); font-weight: 100 900; font-display: swap; }
@font-face { font-family: "Hanken"; src: url("fonts/hanken.woff2") format("woff2"); font-weight: 100 900; font-display: swap; }
@font-face { font-family: "Hanken"; src: url("fonts/hanken-italic.woff2") format("woff2"); font-weight: 100 900; font-style: italic; font-display: swap; }

:root {
  --nuit: #06070f;
  --nuit-2: #0d1130;
  --texte: #f3ece4;
  --doux: #b8b3c9;
  --lumiere: #ffd59a;
  --rose: #f063b1;
  --ligne: rgba(243, 236, 228, .18);
  --titre: "Big Shoulders", "Arial Narrow", system-ui, sans-serif;
  --corps: "Hanken", system-ui, sans-serif;
  --hud-h: 64px;
}

*, *::before, *::after { box-sizing: border-box; }
html, body { height: 100%; }
html { background: var(--nuit); color-scheme: dark; }
body {
  margin: 0;
  font-family: var(--corps);
  font-size: 1rem;
  line-height: 1.5;
  color: var(--texte);
  background: var(--nuit);
  overflow: hidden;
  overscroll-behavior: none;
  touch-action: manipulation;
  user-select: none; -webkit-user-select: none;
  -webkit-font-smoothing: antialiased;
}
input, textarea { user-select: text; -webkit-user-select: text; }
button { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--lumiere); outline-offset: 3px; }
[hidden] { display: none !important; }

/* grain de pellicule sur tout le jeu */
body::after {
  content: ""; position: fixed; inset: 0; pointer-events: none; z-index: 90;
  opacity: .1; mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 0 0 .9 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

/* ---------- interface permanente ---------- */
.hud {
  position: fixed; inset: 0 0 auto 0; z-index: 60;
  height: var(--hud-h);
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  padding: 0 clamp(1rem, 3vw, 2.5rem);
  padding-top: env(safe-area-inset-top);
  background: linear-gradient(180deg, rgba(6, 7, 15, .75), rgba(6, 7, 15, 0));
  pointer-events: none;
}
.hud > * { pointer-events: auto; }
.lieu {
  margin: 0;
  font-family: var(--titre); font-weight: 600;
  font-size: clamp(1.1rem, 2vw, 1.45rem);
  letter-spacing: .02em;
  color: var(--texte);
}
.hud-actions { display: flex; gap: .5rem; }
.hud-btn {
  border: 1px solid var(--ligne); background: rgba(6, 7, 15, .45);
  backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
  border-radius: 999px; padding: .45rem .95rem;
  font-size: .88rem; font-weight: 600; cursor: pointer;
}
.hud-btn:hover { border-color: rgba(255, 213, 154, .55); }
.hud-btn span { font-variant-numeric: tabular-nums; color: var(--lumiere); margin-left: .25rem; }
.hud-btn[aria-pressed="false"] { opacity: .65; }

/* sous-titres : la voix du jeu */
.sous-titre {
  position: fixed; left: 50%; bottom: max(1.6rem, env(safe-area-inset-bottom)); z-index: 70;
  translate: -50% 0;
  width: min(92vw, 40rem);
  margin: 0; padding: .85rem 1.2rem;
  text-align: center;
  font-size: clamp(1rem, 1.6vw, 1.12rem);
  background: rgba(6, 7, 15, .78);
  border: 1px solid var(--ligne); border-radius: 14px;
  backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
  opacity: 0; visibility: hidden;
  pointer-events: none;
  transition: opacity .35s ease, visibility 0s .35s;
}
.sous-titre.visible { opacity: 1; visibility: visible; transition-delay: 0s; }

/* fondu entre les scènes */
.voile { position: fixed; inset: 0; z-index: 80; pointer-events: none; background: #000; opacity: 0; transition: opacity .6s ease; }
.voile.noir { opacity: 1; }
.voile.blanc { background: #fff7ee; opacity: 1; transition-duration: .9s; }

/* ---------- les scènes ---------- */
.scene { position: fixed; inset: 0; overflow: hidden; background: var(--nuit); }
.stage {
  position: absolute; left: 50%; top: 50%;
  width: max(100vw, calc(100svh * var(--r)));
  height: max(100svh, calc(100vw / (var(--r))));
  translate: -50% -50%;
}
.fond { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; display: block; user-select: none; -webkit-user-drag: none; }
.calque { opacity: 0; transition: opacity 1.2s ease; }
.calque.visible { opacity: 1; }

/* zones cliquables : invisibles, un halo au survol pour les curieux */
.zone {
  position: absolute; translate: -50% -50%;
  border: 0; padding: 0; background: transparent; border-radius: 10px; cursor: pointer;
  transition: box-shadow .3s ease, background .3s ease;
}
.zone:hover, .zone:focus-visible { background: rgba(255, 220, 170, .07); box-shadow: 0 0 22px 2px rgba(255, 213, 154, .22); }
.zone.secoue { animation: secoue .45s ease; }
@keyframes secoue { 25% { translate: calc(-50% - 3px) -50%; } 50% { translate: calc(-50% + 3px) -50%; } 75% { translate: calc(-50% - 2px) -50%; } }

/* --- la rue --- */
.cadre-rue { position: absolute; inset: 0; }
.stage-portrait { display: none; }
.rue-texte {
  position: absolute; left: clamp(1.2rem, 5vw, 5rem); bottom: clamp(5.5rem, 12vh, 9rem);
  max-width: 26rem;
  text-shadow: 0 2px 18px rgba(0, 0, 0, .6);
}
.titre-album {
  margin: 0;
  font-family: var(--titre); font-weight: 800;
  font-size: clamp(2.8rem, 6.5vw, 6rem);
  line-height: .88; letter-spacing: -.005em;
  text-wrap: balance;
}
.decompte { display: flex; gap: 1.1rem; margin-top: 1rem; color: var(--doux); font-size: .95rem; }
.decompte b { font-family: var(--titre); font-weight: 600; font-size: 2rem; color: var(--texte); font-variant-numeric: tabular-nums; margin-right: .15rem; }
.consigne { margin: .9rem 0 0; color: var(--lumiere); font-style: italic; }

/* zoom de la caméra sur l'interphone */
.cadre-rue { transition: transform 1s cubic-bezier(.6, 0, .2, 1), filter 1s ease; }
.zoom .cadre-rue { transform: scale(var(--zoom, 5)); filter: blur(3px) brightness(.55); }
.zoom .rue-texte { opacity: 0; transition: opacity .3s; }
.rue-texte { transition: opacity .6s ease .4s; }
.zone.attire { animation: attire 1.2s ease 2; }
@keyframes attire { 50% { box-shadow: 0 0 0 3px rgba(255, 213, 154, .8), 0 0 30px 6px rgba(255, 213, 154, .5); } }

.digicode {
  position: absolute; inset: 0; z-index: 20;
  display: grid; place-items: center; align-content: center; gap: 1.2rem;
  padding: var(--hud-h) 1rem 1rem;
  animation: approche .5s ease .55s both;
}
@keyframes approche { from { scale: .92; } }   /* sans opacité : visible même si l’animation ne joue pas */
/* le boîtier, dessiné comme la cover : aplats, gros traits noirs, trame imprimée */
.boitier {
  --encre: #0b0b18;
  position: relative;
  width: min(86vw, 320px);
  padding: 20px 20px 24px;
  border-radius: 18px;
  border: 4px solid var(--encre);
  background:
    radial-gradient(circle, rgba(11, 11, 24, .16) 1.1px, transparent 1.4px) 0 0 / 7px 7px,
    #efc6d1;
  box-shadow: 8px 8px 0 var(--encre), 0 40px 80px rgba(0, 0, 0, .55);
  display: grid; gap: 14px;
  rotate: -1.5deg;
}
.boitier::before, .boitier::after { /* les deux vis du boîtier */
  content: ""; position: absolute; top: 9px; width: 10px; height: 10px; border-radius: 50%;
  background: #f6e7ec; border: 2.5px solid var(--encre);
}
.boitier::before { right: 9px; }
.boitier::after { left: 9px; }
.boitier.illustre::before, .boitier.illustre::after { display: none; }
.boitier-marque {
  margin: 0; justify-self: center;
  padding: .15rem .7rem; border: 3px solid var(--encre); border-radius: 999px;
  background: #2b4fb0; color: #fff;
  font: 800 1rem/1.1 var(--titre); letter-spacing: .04em;
}
.ecran {
  position: relative; height: 64px; border-radius: 10px;
  display: grid; place-items: center;
  border: 4px solid var(--encre);
  background: #141a5c;
  box-shadow: inset 0 -6px 0 rgba(0, 0, 0, .35);
  font: 800 2.2rem/1 var(--titre); letter-spacing: .3em; padding-left: .3em;
  color: #9dff9a; text-shadow: 0 0 8px rgba(130, 255, 130, .5);
  font-variant-numeric: tabular-nums;
}
.ecran.erreur { color: #ff6b8a; text-shadow: 0 0 8px rgba(255, 90, 120, .6); animation: clignote .25s steps(2) 4; }
@keyframes clignote { 50% { opacity: .2; } }
.voyant { position: absolute; right: 8px; top: 8px; width: 11px; height: 11px; border-radius: 50%; background: #7a1530; border: 2.5px solid var(--encre); }
.voyant.vert { background: #6dff7a; box-shadow: 0 0 10px 2px #6dff7a; }
.touches { display: grid; grid-template-columns: repeat(3, 1fr); gap: 11px; }
.touches button, .touches-bas button {
  height: 56px; cursor: pointer;
  border: 3.5px solid var(--encre); border-radius: 12px;
  font: 800 1.7rem/1 var(--titre); color: var(--encre);
  background: #f7f0e6;
  box-shadow: 0 5px 0 var(--encre);
  transition: translate .06s, box-shadow .06s;
}
.touches button:nth-child(3n+1) { background: #bfe6ff; }
.touches button:nth-child(3n) { background: #ffd8ea; }
.touches button:active, .touches-bas button:active, .touches button.appui, .touches-bas button.appui {
  translate: 0 4px; box-shadow: 0 1px 0 var(--encre);
}
.touches-bas { display: grid; grid-template-columns: 1fr 1fr; gap: 11px; }
.touches-bas button { height: 50px; font: 800 1.15rem/1 var(--titre); letter-spacing: .02em; }
.touches-bas .effacer { background: #f063b1; color: #fff; }
.touches-bas .valider { background: #3fa9e8; color: #fff; }
.grille-hp { height: 24px; border-radius: 8px; border: 3px solid var(--encre); background: radial-gradient(circle, var(--encre) 0 2px, transparent 2.4px) 3px 3px / 10px 10px, #d9a6bd; }
/* votre propre visuel de boîtier : déposez assets/interphone.png (fond transparent) */
.boitier.illustre { background: url("interphone.png") center / 100% 100% no-repeat; border: 0; box-shadow: none; }
.reculer {
  border: 1px solid var(--ligne); background: rgba(6, 7, 15, .6); border-radius: 999px;
  padding: .5rem 1.1rem; font-weight: 600; cursor: pointer;
}
.digicode-aide { margin: 0; color: var(--doux); font-style: italic; font-size: .95rem; text-align: center; }
.retour { margin: 0; min-height: 1.4em; font-size: .92rem; color: #ffb3c8; }

.bouton {
  border: 0; border-radius: 12px; padding: .75rem 1.15rem; cursor: pointer;
  font-weight: 700; background: var(--lumiere); color: #24160a;
}
.bouton.secondaire { background: transparent; color: var(--texte); box-shadow: inset 0 0 0 1px var(--ligne); }
.bouton:hover { filter: brightness(1.06); }

/* --- la montée --- */
.scene-montee video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; background: #fff7ee; }
.passer {
  position: absolute; right: clamp(1rem, 3vw, 2.5rem); bottom: clamp(1rem, 4vh, 2.5rem); z-index: 5;
  border: 1px solid var(--ligne); background: rgba(6, 7, 15, .5); border-radius: 999px;
  padding: .45rem 1rem; font-size: .88rem; font-weight: 600; cursor: pointer;
}

/* --- le palier --- */
.cle-trouvee {
  position: absolute; translate: -50% -50%;
  width: 3.2%; aspect-ratio: 140 / 320;
  border: 0; padding: 0; background: none; cursor: pointer;
  filter: drop-shadow(0 0 10px rgba(255, 210, 130, .8));
  animation: brille 1.8s ease-in-out infinite;
  rotate: 72deg;
}
.cle-trouvee img { width: 100%; height: 100%; }
@keyframes brille { 50% { filter: drop-shadow(0 0 22px rgba(255, 210, 130, 1)); } }
.scene-palier.eteint .fond { filter: brightness(.18) saturate(.6); transition: filter .25s; }

/* --- le salon --- */
.decor { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.reflets {
  position: absolute; inset: 0; pointer-events: none; mix-blend-mode: screen; opacity: .55;
  background:
    radial-gradient(circle at 20% 30%, rgba(255, 255, 255, .5) 0 2px, transparent 3px),
    radial-gradient(circle at 70% 22%, rgba(255, 230, 255, .5) 0 2px, transparent 3px),
    radial-gradient(circle at 82% 40%, rgba(220, 240, 255, .5) 0 2px, transparent 3px),
    radial-gradient(circle at 35% 55%, rgba(255, 255, 255, .4) 0 2px, transparent 3px),
    radial-gradient(circle at 58% 35%, rgba(255, 255, 255, .45) 0 2px, transparent 3px),
    radial-gradient(circle at 12% 60%, rgba(255, 220, 255, .4) 0 2px, transparent 3px);
  animation: tourne 18s linear infinite;
}
@keyframes tourne { to { background-position: 140px 0, -120px 40px, 90px -60px, -80px 30px, 60px 60px, -50px -40px; } }

.objets { position: absolute; inset: 0; }
.objet {
  position: absolute; translate: -50% -50%;
  border: 0; padding: 0; background: none; cursor: pointer;
  filter: drop-shadow(0 6px 10px rgba(0, 0, 0, .35));
  transition: filter .25s ease, scale .25s ease;
}
.objet img { display: block; width: 100%; height: auto; pointer-events: none; }
.objet:hover, .objet:focus-visible { filter: drop-shadow(0 0 14px rgba(255, 213, 154, .95)) drop-shadow(0 6px 10px rgba(0, 0, 0, .35)); scale: 1.04; outline: none; }
.objet.nouveau { animation: arrive 1.6s cubic-bezier(.2, .8, .2, 1); }
@keyframes arrive { from { scale: .7; filter: brightness(3) blur(6px); } }
.objet.visite::after {
  content: ""; position: absolute; right: -6px; top: -6px; width: 12px; height: 12px; border-radius: 50%;
  background: var(--lumiere); box-shadow: 0 0 10px var(--lumiere);
}
.objet[data-slug="avion"] { animation: vole 26s linear infinite; }
@keyframes vole { 0% { translate: -260% -50%; } 100% { translate: 520% -110%; } }
.objet[data-slug="boule"] img { animation: balance 6s ease-in-out infinite; transform-origin: 50% 0; }
@keyframes balance { 50% { rotate: 2deg; } }

.prochain { position: absolute; translate: -50% -50%; pointer-events: none; display: grid; place-items: center; }
.prochain .halo {
  width: 100%; aspect-ratio: 1; border-radius: 50%;
  border: 2px dashed rgba(255, 213, 154, .7);
  box-shadow: 0 0 30px rgba(255, 213, 154, .25) inset;
  animation: respire 2.6s ease-in-out infinite;
}
@keyframes respire { 50% { scale: 1.08; opacity: .6; } }
.prochain .etiquette {
  position: absolute; top: 105%; white-space: nowrap;
  padding: .3rem .7rem; border-radius: 999px;
  background: rgba(6, 7, 15, .8); border: 1px solid var(--ligne);
  font-size: clamp(.8rem, 1vw, .95rem); font-weight: 600; color: var(--lumiere);
  font-variant-numeric: tabular-nums;
}
.prochain.a-droite .etiquette { right: 0; }
.prochain.a-gauche .etiquette { left: 0; }

/* --- la pièce d'un son --- */
.scene-piece {
  --couleur: #2b2f8f;
  display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(20rem, .9fr);
  background:
    linear-gradient(180deg, transparent 72%, rgba(0, 0, 0, .38) 72.2%, rgba(0, 0, 0, .7) 100%),
    radial-gradient(60% 55% at 32% 36%, color-mix(in srgb, var(--couleur) 72%, #fff 10%) 0%, var(--couleur) 55%, color-mix(in srgb, var(--couleur) 40%, #000) 100%);
}
.piece-mur {
  display: flex; flex-direction: column; align-items: center; justify-content: flex-start;
  gap: 4vh; padding: calc(var(--hud-h) + 3vh) 2rem 4vh;
}
.piece-cadre {
  position: relative; margin: 0; flex: none;
  width: min(26vw, 38vh); aspect-ratio: 4 / 5;
  padding: clamp(10px, 1.1vw, 16px);
  background: linear-gradient(135deg, #3a2a17, #1c130a);
  box-shadow: 0 25px 60px rgba(0, 0, 0, .55), inset 0 0 0 2px #5b4426;
}
.piece-cover {
  display: block; width: 100%; height: 100%;
  background-size: 760%; background-repeat: no-repeat;
  filter: brightness(.5) saturate(.75) blur(2px);
}
.piece-cadre::after { /* un rai de lumière qui n'éclaire qu'un morceau de la cover */
  content: ""; position: absolute; inset: clamp(10px, 1.1vw, 16px);
  background: radial-gradient(30% 26% at 52% 46%, transparent 0%, rgba(0, 0, 0, .82) 100%);
}
.piece-objet { position: relative; z-index: 2; flex: 1; min-height: 0; width: min(30vw, 44vh); display: grid; place-items: end center; }
.piece-objet::after { /* ombre portée au sol */
  content: ""; position: absolute; bottom: -1.2vh; left: 20%; right: 20%; height: 2.4vh; border-radius: 50%;
  background: radial-gradient(closest-side, rgba(0, 0, 0, .55), transparent);
}
.piece-objet img { max-width: 100%; max-height: 32vh; object-fit: contain; filter: drop-shadow(0 18px 22px rgba(0, 0, 0, .5)); animation: flotte 5s ease-in-out infinite; }
@keyframes flotte { 50% { translate: 0 -8px; } }

.piece-texte {
  align-self: center;
  padding: calc(var(--hud-h) + 1rem) clamp(1.5rem, 5vw, 5rem) 3rem clamp(1rem, 2vw, 2rem);
  display: grid; gap: 1rem; justify-items: start;
}
.piece-numero { margin: 0; font-family: var(--titre); font-weight: 600; font-size: 1.3rem; color: var(--lumiere); }
.piece-titre {
  margin: 0; font-family: var(--titre); font-weight: 800;
  font-size: clamp(3rem, 7vw, 7rem); line-height: .86;
  text-wrap: balance;
}
.piece-phrase { margin: 0; max-width: 34ch; font-size: clamp(1.05rem, 1.5vw, 1.25rem); font-style: italic; color: var(--doux); }
.piece-ecoute { display: grid; gap: .7rem; width: 100%; max-width: 26rem; }
.piece-ecoute audio { width: 100%; }
.piece-ecoute iframe { width: 100%; height: 80px; border: 0; border-radius: 12px; }
.lien-ecoute { color: var(--lumiere); font-weight: 600; }

.flammes { display: inline-flex; gap: .15rem; border: 0; margin: 0; padding: 0; }
.flammes legend { font-size: .9rem; color: var(--doux); margin-bottom: .2rem; }
.flammes button { border: 0; background: none; cursor: pointer; padding: .15rem; font-size: 1.6rem; line-height: 1; filter: grayscale(1) brightness(.55); transition: filter .15s, scale .15s; }
.flammes button.allumee { filter: none; }
.flammes:hover button { filter: grayscale(1) brightness(.55); }
.flammes:hover button:has(~ button:hover), .flammes:hover button:hover { filter: none; scale: 1.08; }
.moyenne { color: var(--doux); font-size: .92rem; font-variant-numeric: tabular-nums; }

/* ---------- panneaux latéraux ---------- */
.panneau {
  position: fixed; top: 0; right: 0; bottom: 0; z-index: 75;
  width: min(100vw, 28rem);
  padding: calc(var(--hud-h) + .5rem) 1.6rem 2rem;
  background: rgba(8, 9, 20, .96);
  border-left: 1px solid var(--ligne);
  overflow-y: auto;
  animation: glisse .35s cubic-bezier(.2, .8, .2, 1);
}
@keyframes glisse { from { translate: 100% 0; } }
.panneau-tete { display: flex; justify-content: space-between; align-items: baseline; gap: 1rem; }
.panneau h2 { margin: 0; font-family: var(--titre); font-weight: 800; font-size: 2.4rem; line-height: 1; }
.fermer { border: 0; background: none; color: var(--doux); cursor: pointer; text-decoration: underline; text-underline-offset: 3px; }
.panneau-intro { color: var(--doux); }
.liens { display: flex; flex-wrap: wrap; gap: .5rem; margin-top: 1.6rem; }
.liens a { padding: .45rem .9rem; border-radius: 999px; border: 1px solid var(--ligne); color: var(--texte); text-decoration: none; font-weight: 600; font-size: .9rem; }

.barres { list-style: none; margin: 1rem 0 0; padding: 0; display: grid; gap: .7rem; }
.barre { display: grid; grid-template-columns: 1fr 3rem; gap: .3rem .8rem; align-items: center; }
.barre .nom { font-family: var(--titre); font-weight: 700; font-size: 1.3rem; }
.barre .val { text-align: right; color: var(--doux); font-variant-numeric: tabular-nums; }
.barre .jauge { grid-column: 1 / -1; height: .5rem; border-radius: 999px; background: rgba(255, 255, 255, .07); overflow: hidden; }
.barre .jauge span { display: block; height: 100%; background: linear-gradient(90deg, var(--lumiere), var(--rose)); transition: width .8s ease; }

.sans-js { position: fixed; inset: auto 1rem 1rem; z-index: 99; background: #000; padding: 1rem; }

/* ---------- téléphone et écrans en hauteur ---------- */
@media (max-aspect-ratio: 1/1) {
  .stage-large { display: none; }
  .stage-portrait {
    display: block;
    width: 100vw; height: calc(100vw * 4 / 3);
    max-height: 78svh; max-width: calc(78svh * 3 / 4);
    top: 44%;
    -webkit-mask-image: linear-gradient(180deg, #000 70%, transparent);
    mask-image: linear-gradient(180deg, #000 70%, transparent);
  }
  .rue-texte { left: 1.2rem; right: 1.2rem; bottom: 1.4rem; }
  .titre-album { font-size: clamp(2.4rem, 12vw, 3.6rem); }
  .decompte b { font-size: 1.6rem; }
  .boitier { padding: 16px; gap: 10px; }
  .touches button { height: 52px; }

  /* palier et salon : plus larges que l'écran, la caméra se déplace avec les flèches */
  .pannable { overflow: hidden; }
  .pannable .stage { position: relative; left: 0; top: 0; translate: none; height: 100svh; width: calc(100svh * var(--r)); }

  .scene-piece { grid-template-columns: 1fr; grid-template-rows: auto 1fr; overflow: hidden;
    background: radial-gradient(80% 40% at 50% 22%, color-mix(in srgb, var(--couleur) 72%, #fff 10%) 0%, var(--couleur) 60%, color-mix(in srgb, var(--couleur) 40%, #000) 100%); }
  .piece-mur { gap: 2svh; padding: calc(var(--hud-h) + 1svh) 1rem 0; }
  .piece-cadre { width: min(40vw, 19svh); }
  .piece-objet { width: 52vw; flex: none; }
  .piece-objet img { max-height: 17svh; }
  .piece-texte { gap: .6rem; padding: 1.2svh 1.3rem 1.4svh; align-self: start; }
  .piece-titre { font-size: clamp(2.4rem, 11vw, 3.4rem); }
  .piece-phrase { font-size: 1rem; }
  .piece-ecoute iframe { height: 80px; }
  .piece-texte { padding: 1rem 1.3rem 3rem; }
  .hud-btn { padding: .4rem .7rem; font-size: .8rem; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}



/* ---------- la rue : lever les yeux vers le ciel ---------- */
.travelling {
  position: absolute; left: 0; right: 0; top: 0; height: 200%;
  translate: 0 -50%;
  transition: translate 1.6s cubic-bezier(.65, 0, .25, 1);
}
.en-haut .travelling { translate: 0 0; }
.plan { position: relative; height: 50%; overflow: hidden; }
.plan .stage { position: absolute; }
.en-haut .rue-texte { opacity: 0; visibility: hidden; pointer-events: none; transition: opacity .4s, visibility 0s .4s; }

.fleche {
  position: absolute; left: 50%; translate: -50% 0; z-index: 25;
  border: 0; background: none; cursor: pointer; padding: .6rem 1.2rem;
  display: grid; justify-items: center; gap: .2rem;
  color: var(--lumiere); font-weight: 600; font-size: .9rem;
  text-shadow: 0 2px 10px rgba(0, 0, 0, .8);
  opacity: 0; pointer-events: none;
  transition: opacity .35s ease;
}
.fleche::before {
  content: ""; width: 26px; height: 26px;
  border-left: 3px solid currentColor; border-top: 3px solid currentColor;
  rotate: 45deg; filter: drop-shadow(0 0 8px rgba(255, 213, 154, .7));
}
.fleche-haut { top: calc(var(--hud-h) + .3rem); }
.fleche-bas { bottom: max(6.5rem, 14vh); }
.fleche-bas::before { rotate: 225deg; order: 2; }
.fleche-haut.visible, .en-haut .fleche-bas { opacity: 1; pointer-events: auto; }
.en-haut .fleche-haut { opacity: 0 !important; pointer-events: none !important; }
@media (hover: none) { .scene-rue:not(.en-haut) .fleche-haut { opacity: .85; pointer-events: auto; } }
.fleche.appel { animation: appel 1.1s ease 3; }
@keyframes appel { 50% { translate: -50% -8px; } }
.zone-cle-ciel { border-radius: 50%; }

/* l'inventaire */
.inventaire { display: flex; gap: .4rem; margin-left: auto; margin-right: .6rem; }
.case {
  width: 42px; height: 42px; border-radius: 10px;
  border: 1px dashed var(--ligne); background: rgba(6, 7, 15, .45);
  display: grid; place-items: center;
}
.case img { filter: drop-shadow(0 0 6px rgba(255, 210, 130, .5)); }
.case.pleine { border-style: solid; border-color: rgba(255, 213, 154, .55); }
.cle-volante {
  position: fixed; z-index: 85; pointer-events: none;
  filter: drop-shadow(0 0 18px rgba(255, 210, 130, 1));
  transition: left 1.1s cubic-bezier(.5, 0, .2, 1), top 1.1s cubic-bezier(.5, 0, .2, 1), height 1.1s ease, rotate 1.1s ease;
}

/* flèches de caméra (scènes plus larges que l'écran) */
.pan {
  position: fixed; top: 50%; translate: 0 -50%; z-index: 55;
  width: 52px; height: 52px; border-radius: 50%;
  border: 1px solid var(--ligne); background: rgba(6, 7, 15, .55);
  backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
  cursor: pointer; display: grid; place-items: center;
}
.pan::before { content: ""; width: 14px; height: 14px; border-left: 3px solid var(--lumiere); border-top: 3px solid var(--lumiere); }
.pan-gauche { left: .6rem; } .pan-gauche::before { rotate: -45deg; margin-left: 5px; }
.pan-droite { right: .6rem; } .pan-droite::before { rotate: 135deg; margin-right: 5px; }

/* palier : le papier sous le paillasson */
.mot-paillasson {
  position: absolute; translate: -50% -50%; rotate: -7deg; margin: 0;
  padding: .3em .7em; font: 700 clamp(.9rem, 1.4vw, 1.4rem)/1.1 var(--corps); font-style: italic;
  color: #2a1f14; background: #f3ead6;
  box-shadow: 0 6px 14px rgba(0, 0, 0, .5);
  animation: apparait .5s ease;
}
@keyframes apparait { from { scale: .8; } }
.zoom-palier { transition: transform 1s cubic-bezier(.6, 0, .2, 1), filter 1s ease; }
.zoom .zoom-palier { transform: scale(var(--zoom, 5)); filter: blur(3px) brightness(.55); }
.digicode { position: fixed; z-index: 58; }

/* ---------- l'ardoise de la tracklist ---------- */
.ardoise-murale {
  position: absolute; left: 6%; top: 27%; width: 8.4%; height: 26%;
  transform: perspective(900px) rotateY(38deg); transform-origin: left center;
  border: 0; padding: 1.1% 1%; cursor: pointer;
  background:
    radial-gradient(circle at 30% 20%, rgba(255, 255, 255, .06), transparent 60%),
    #1f2a24;
  box-shadow: 0 0 0 6px #6b4a2a, 0 0 0 9px #0b0b18, 6px 14px 24px rgba(0, 0, 0, .45);
  display: grid; align-content: start; gap: 6%;
  z-index: 3;
  transition: box-shadow .3s ease;
}
.ardoise-murale:hover, .ardoise-murale:focus-visible { box-shadow: 0 0 0 6px #6b4a2a, 0 0 0 9px #0b0b18, 0 0 30px 6px rgba(255, 213, 154, .45); outline: none; }
.ardoise-murale.complete { animation: craie-brille 2s ease-in-out infinite; }
@keyframes craie-brille { 50% { box-shadow: 0 0 0 6px #6b4a2a, 0 0 0 9px #0b0b18, 0 0 46px 14px rgba(255, 240, 200, .55); } }
.ardoise-murale-titre { font: 700 clamp(.6rem, 1.1vw, 1.1rem)/1 var(--titre); color: #e9ecdf; opacity: .9; }
.ardoise-murale-lignes { display: grid; gap: .45em; }
.ardoise-murale-lignes i { display: block; height: 2px; border-radius: 2px; background: rgba(233, 236, 223, .75); }
.ardoise-murale-lignes i.vide { background: rgba(233, 236, 223, .14); }

.vue-ardoise {
  position: fixed; inset: 0; z-index: 72;
  display: grid; place-items: center; align-content: center; gap: 1.2rem;
  padding: calc(var(--hud-h) + .5rem) 1rem 1rem;
  background: rgba(4, 5, 10, .72);
}
.vue-ardoise .ardoise { animation: approche .45s ease; }
.ardoise {
  width: min(92vw, 34rem);
  padding: clamp(1.2rem, 3vw, 2.2rem) clamp(1.2rem, 3.5vw, 2.6rem);
  background:
    radial-gradient(120% 90% at 20% 10%, rgba(255, 255, 255, .07), transparent 55%),
    radial-gradient(circle, rgba(255, 255, 255, .025) 1px, transparent 1.5px) 0 0 / 5px 5px,
    #1d2822;
  border-radius: 6px;
  box-shadow: 0 0 0 12px #6b4a2a, 0 0 0 16px #0b0b18, 0 40px 90px rgba(0, 0, 0, .6);
  color: #eef0e6;
  rotate: -.6deg;
}
.ardoise h2 { margin: 0 0 .4rem; font: 800 clamp(2.2rem, 6vw, 3.2rem)/1 var(--titre); color: #f4f2e8; text-shadow: 0 0 1px #fff, 0 0 12px rgba(255, 255, 255, .12); }
.craie { list-style: none; margin: .6rem 0 0; padding: 0; counter-reset: p; }
.craie li {
  counter-increment: p;
  display: grid; grid-template-columns: 2.2rem 1fr; align-items: baseline;
  padding: .45rem 0; border-bottom: 1px dashed rgba(238, 240, 230, .16);
}
.craie li::before { content: counter(p); font: 700 1.35rem var(--titre); color: #ffe7b0; }
.craie .titre {
  border: 0; background: none; padding: 0; cursor: pointer; text-align: left;
  font: 700 clamp(1.3rem, 3.4vw, 1.75rem)/1.05 var(--titre); color: #f4f2e8;
  text-shadow: 0 0 1px rgba(255, 255, 255, .8);
  animation: ecrit .9s ease;
}
@keyframes ecrit { from { clip-path: inset(0 100% 0 0); } to { clip-path: inset(0 0 0 0); } }
.craie .cache { color: rgba(238, 240, 230, .32); font-style: italic; }
.craie-note { margin: .9rem 0 0; color: rgba(238, 240, 230, .7); font-size: .95rem; }
.ardoise .liens a { border-color: rgba(238, 240, 230, .25); }

@media (max-aspect-ratio: 1/1) {
  .inventaire { margin-right: .3rem; }
  .case { width: 36px; height: 36px; }
  .case img { height: 26px; }
  .lieu { font-size: 1rem; }
  .ardoise-murale { box-shadow: 0 0 0 4px #6b4a2a, 0 0 0 6px #0b0b18; }
}

/* ---------- chargement : le combiné orange sonne ---------- */
.chargement {
  position: fixed; inset: 0; z-index: 100;
  display: grid; place-items: center; align-content: center; gap: .9rem;
  background: radial-gradient(60% 50% at 50% 42%, #1a1f52 0%, var(--nuit) 70%);
  transition: opacity .7s ease, visibility 0s .7s;
}
.chargement.fini { opacity: 0; visibility: hidden; }
.appel { position: relative; width: 190px; height: 230px; display: grid; place-items: center; }
.combine { height: 190px; width: auto; rotate: -18deg; filter: drop-shadow(0 18px 24px rgba(0, 0, 0, .55)); animation: sonne 1.6s ease-in-out infinite; }
@keyframes sonne {
  0%, 46%, 100% { transform: rotate(0); }
  4%, 12%, 20%, 28%, 36% { transform: rotate(9deg) translateY(-4px); }
  8%, 16%, 24%, 32%, 40% { transform: rotate(-9deg) translateY(-4px); }
}
.decroche .combine { animation: none; transform: rotate(-40deg) translate(-10px, -16px); transition: transform .5s cubic-bezier(.2, .8, .2, 1); }
.onde {
  position: absolute; left: 50%; top: 45%; width: 120px; height: 120px; translate: -50% -50%;
  border-radius: 50%; border: 3px solid var(--rose);
  animation: onde 1.6s ease-out infinite;
}
.o2 { animation-delay: .25s; } .o3 { animation-delay: .5s; }
@keyframes onde { 0% { scale: .6; opacity: .9; } 70%, 100% { scale: 1.9; opacity: 0; } }
.decroche .onde { display: none; }
.appel-titre { margin: 0; font: 800 clamp(2rem, 6vw, 3rem)/1 var(--titre); }
.appel-etat { margin: 0; color: var(--doux); font-variant-numeric: tabular-nums; }
.appel-barre { width: min(60vw, 240px); height: 3px; border-radius: 3px; background: rgba(255, 255, 255, .12); overflow: hidden; }
.appel-barre span { display: block; height: 100%; width: 0; background: linear-gradient(90deg, var(--lumiere), var(--rose)); transition: width .3s ease; }

/* ---------- moteur d'aventure ---------- */
.points { position: absolute; inset: 0; z-index: 2; }
.point {
  position: absolute; translate: -50% -50%;
  border: 0; padding: 0; background: transparent; border-radius: 14px; cursor: pointer;
  transition: box-shadow .3s ease, background .3s ease;
}
.point:hover, .point:focus-visible, .point.survolee { background: rgba(255, 220, 170, .08); box-shadow: inset 0 0 0 2px rgba(255, 213, 154, .45), 0 0 28px rgba(255, 213, 154, .18); outline: none; }
.point .vers {
  position: absolute; left: 50%; bottom: 8%; translate: -50% 0;
  padding: .3rem .75rem; border-radius: 999px; white-space: nowrap;
  background: rgba(6, 7, 15, .78); border: 1px solid var(--ligne);
  font-size: clamp(.75rem, .95vw, .95rem); font-weight: 600; color: var(--lumiere);
  opacity: 0; transition: opacity .25s ease;
}
.point.sortie:hover .vers, .point.sortie:focus-visible .vers { opacity: 1; }
.point.verrouille .vers::before { content: ""; display: inline-block; width: .55em; height: .55em; margin-right: .4em; border: 2px solid currentColor; border-radius: 2px; vertical-align: .05em; }
@media (hover: none) { .point.sortie .vers { opacity: .85; } }
.objet.survolee { filter: drop-shadow(0 0 16px rgba(255, 213, 154, 1)); }
.scintille { animation: scintille 1.8s ease-in-out infinite; transform-origin: 1190px 760px; transform-box: view-box; }
@keyframes scintille { 50% { transform: scale(.4) rotate(45deg); } }

/* inventaire : plusieurs cases, objets qu'on glisse */
.inventaire { display: flex; gap: .35rem; margin-left: auto; margin-right: .6rem; }
.inventaire .case { width: 46px; height: 46px; padding: 4px; position: relative; cursor: grab; touch-action: none; }
.inventaire .case.vide { cursor: default; }
.inventaire .case img { width: 100%; height: 100%; object-fit: contain; rotate: 0deg; pointer-events: none; }
.inventaire .case i { position: absolute; right: -4px; bottom: -6px; font: 700 .62rem/1 var(--corps); font-style: normal; padding: .15rem .3rem; border-radius: 6px; background: var(--rose); color: #fff; }
.inventaire .case.choisie { border-color: var(--lumiere); box-shadow: 0 0 0 2px var(--lumiere), 0 0 18px rgba(255, 213, 154, .6); }
.inventaire .case.arrive { animation: arrive 1s cubic-bezier(.2, .8, .2, 1); }
.inventaire .case.survolee { box-shadow: 0 0 0 2px var(--rose); }
.fantome { position: fixed; z-index: 95; width: 64px; height: 64px; object-fit: contain; translate: -50% -50%; pointer-events: none; filter: drop-shadow(0 8px 16px rgba(0, 0, 0, .6)); }
.glisse-objet, .glisse-objet * { cursor: grabbing !important; }

/* le plan de la maison */
.btn-plan {
  position: fixed; left: clamp(1rem, 3vw, 2.5rem); bottom: max(1.4rem, env(safe-area-inset-bottom)); z-index: 62;
  width: 64px; height: 64px; border-radius: 16px; cursor: pointer;
  border: 1px solid var(--ligne); background: rgba(6, 7, 15, .6);
  backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
  font: 700 .85rem/1 var(--corps);
  display: grid; place-items: end center; padding-bottom: 8px;
  background-image: linear-gradient(var(--lumiere), var(--lumiere)), linear-gradient(var(--lumiere), var(--lumiere)), linear-gradient(var(--lumiere), var(--lumiere));
  background-size: 22px 2px, 2px 16px, 2px 16px;
  background-position: 21px 14px, 21px 14px, 41px 14px;
  background-repeat: no-repeat;
}
.plan-maison {
  position: fixed; left: clamp(1rem, 3vw, 2.5rem); bottom: calc(max(1.4rem, env(safe-area-inset-bottom)) + 76px); z-index: 74;
  width: min(92vw, 380px);
  padding: 1rem 1.1rem 1.2rem;
  background: rgba(8, 9, 20, .95); border: 1px solid var(--ligne); border-radius: 18px;
  box-shadow: 0 30px 70px rgba(0, 0, 0, .55);
}
.plan-tete { display: flex; justify-content: space-between; align-items: baseline; }
.plan-maison h2 { margin: 0; font: 800 1.6rem/1 var(--titre); }
.plan-carte {
  position: relative; height: 230px; margin-top: .8rem;
  border-radius: 12px; border: 1px dashed rgba(255, 255, 255, .14);
  background: radial-gradient(circle, rgba(255, 255, 255, .05) 1px, transparent 1.4px) 0 0 / 12px 12px;
}
.plan-liens { position: absolute; inset: 0; width: 100%; height: 100%; }
.plan-liens line { stroke: rgba(255, 213, 154, .35); stroke-width: .8; stroke-dasharray: 2 2; vector-effect: non-scaling-stroke; }
.salle {
  position: absolute; translate: -50% -50%;
  min-width: 92px; padding: .45rem .6rem; border-radius: 10px; cursor: pointer;
  border: 1px solid var(--ligne); background: #141733; color: var(--texte);
  font: 700 .95rem/1.1 var(--titre); text-align: center;
  display: grid; gap: .15rem;
}
.salle small { font: 500 .68rem/1.1 var(--corps); color: var(--doux); }
.salle.vue { border-color: rgba(255, 213, 154, .45); }
.salle.ici { background: var(--lumiere); color: #24160a; border-color: var(--lumiere); }
.salle.ici small { color: #5a3d12; }
.salle.fermee { color: #6b6f92; background: #0d0f22; }
.salle.fermee::before { content: ""; justify-self: center; width: 10px; height: 8px; border: 2px solid currentColor; border-radius: 2px; margin-bottom: .1rem; }

@media (max-aspect-ratio: 1/1) {
  .inventaire .case { width: 38px; height: 38px; }
  .btn-plan { width: 54px; height: 54px; background-position: 16px 12px, 16px 12px, 36px 12px; }
  .plan-maison { bottom: calc(max(1.4rem, env(safe-area-inset-bottom)) + 66px); }
}

/* =====================================================================
   HABILLAGE « COVER » : aplats, gros traits noirs, ombres dures, trame
   ===================================================================== */
:root {
  --encre: #0b0b18;
  --creme: #f4e4ea;
  --bleu: #3fa9e8;
  --marine: #141a4c;
  --jaune: #ffd23f;
  --ombre: 4px 4px 0 var(--encre);
  --trame-claire: radial-gradient(circle, rgba(11, 11, 24, .13) 1.1px, transparent 1.5px) 0 0 / 6px 6px;
}
:focus-visible { outline: 3px solid var(--jaune); outline-offset: 3px; }

/* le bandeau du haut */
.hud { background: none; }
.lieu {
  padding: .3rem .8rem .25rem; rotate: -1.5deg;
  font-weight: 800; text-transform: uppercase; letter-spacing: .03em; line-height: 1;
  color: var(--encre); background: var(--creme);
  border: 3px solid var(--encre); border-radius: 8px; box-shadow: var(--ombre);
}
.lieu:empty { display: none; }
.hud-btn, .reculer, .passer, .bouton, .bouton.secondaire {
  border: 3px solid var(--encre); border-radius: 10px;
  background: var(--creme); color: var(--encre);
  box-shadow: var(--ombre);
  backdrop-filter: none; -webkit-backdrop-filter: none;
  font: 800 1rem/1 var(--titre); letter-spacing: .04em; text-transform: uppercase;
  padding: .55rem .95rem .5rem;
  transition: translate .08s ease, box-shadow .08s ease;
}
.hud-btn:hover, .reculer:hover, .passer:hover, .bouton:hover { translate: -1px -1px; box-shadow: 5px 5px 0 var(--encre); filter: none; border-color: var(--encre); }
.hud-btn:active, .reculer:active, .passer:active, .bouton:active { translate: 3px 3px; box-shadow: 1px 1px 0 var(--encre); }
.hud-btn span { color: var(--rose); }
#btn-carnet { background: var(--jaune); }
#btn-classement { background: var(--rose); color: #fff; }
#btn-son { background: var(--bleu); color: #fff; }
.hud-btn[aria-pressed="false"] { opacity: 1; background: #8d8a9c; }
.bouton { background: var(--rose); color: #fff; }

/* la voix du jeu : une bulle de BD */
.sous-titre {
  color: var(--encre); background: var(--trame-claire), var(--creme);
  border: 4px solid var(--encre); border-radius: 14px;
  box-shadow: 6px 6px 0 var(--rose), 6px 6px 0 3px var(--encre);
  backdrop-filter: none; -webkit-backdrop-filter: none;
  font-weight: 600;
}

/* inventaire */
.inventaire .case {
  border: 3px solid var(--encre); border-radius: 10px;
  background: var(--trame-claire), var(--creme); box-shadow: 3px 3px 0 var(--encre);
}
.inventaire .case.vide { border-style: dashed; background: rgba(244, 228, 234, .25); box-shadow: none; }
.inventaire .case img { filter: none; }
.inventaire .case.choisie { background: var(--jaune); border-color: var(--encre); box-shadow: 3px 3px 0 var(--rose), 3px 3px 0 3px var(--encre); translate: 0 -3px; }
.inventaire .case.survolee { background: var(--rose); box-shadow: 3px 3px 0 var(--encre); }
.inventaire .case i { border: 2px solid var(--encre); font-family: var(--titre); font-weight: 800; letter-spacing: .03em; text-transform: uppercase; }

/* flèches */
.pan { border: 3px solid var(--encre); background: var(--creme); box-shadow: var(--ombre); backdrop-filter: none; -webkit-backdrop-filter: none; }
.pan::before { border-color: var(--encre); }
.fleche span {
  padding: .3rem .7rem .25rem; color: var(--encre); background: var(--creme);
  border: 3px solid var(--encre); border-radius: 8px; box-shadow: 3px 3px 0 var(--encre);
  font: 800 .95rem/1 var(--titre); text-transform: uppercase; letter-spacing: .04em; text-shadow: none;
}
.fleche::before { color: var(--creme); filter: drop-shadow(2px 2px 0 var(--encre)); border-width: 5px; }

/* les sorties et points du décor */
.point:hover, .point:focus-visible, .point.survolee { background: rgba(244, 228, 234, .08); box-shadow: inset 0 0 0 3px var(--creme), inset 0 0 0 6px rgba(11, 11, 24, .6); }
.point .vers {
  color: var(--encre); background: var(--creme);
  border: 3px solid var(--encre); border-radius: 8px; box-shadow: 3px 3px 0 var(--encre);
  font: 800 clamp(.8rem, 1vw, 1rem)/1 var(--titre); text-transform: uppercase; letter-spacing: .04em; padding: .35rem .7rem .3rem;
}
.point.verrouille .vers { background: #8d8a9c; }
.point.illustre { border-radius: 8px; }
.point.illustre img { width: 100%; height: 100%; object-fit: contain; pointer-events: none; filter: drop-shadow(3px 4px 0 rgba(11, 11, 24, .45)); }
.point.illustre:hover img { filter: drop-shadow(0 0 10px rgba(255, 240, 200, .9)); }
.prochain .etiquette { color: var(--encre) !important; background: var(--jaune) !important; border: 3px solid var(--encre) !important; box-shadow: 3px 3px 0 var(--encre) !important; font-family: var(--titre) !important; font-weight: 800 !important; text-transform: uppercase; letter-spacing: .03em; }

/* la cuisine dans le noir : seule la boule à facettes brille */
.scene-lieu.noir .decor { filter: brightness(.12) saturate(.4); transition: filter .25s; }
.scene-lieu.noir .objets .objet:not([data-slug="boule"]) { filter: brightness(.15); }
.scene-lieu.noir .reflets, .scene-lieu.noir::after { opacity: 1; }
.scene-lieu.noir .stage::after {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background: radial-gradient(circle, rgba(255, 250, 220, .9) 1.6px, transparent 2.4px) 0 0 / 54px 38px;
  -webkit-mask-image: radial-gradient(60% 55% at 46% 30%, #000, transparent); mask-image: radial-gradient(60% 55% at 46% 30%, #000, transparent);
  animation: facettes 9s linear infinite;
}
@keyframes facettes { to { background-position: 540px 0; } }

/* panneau du classement */
.panneau {
  color: var(--encre); background: var(--trame-claire), var(--creme) !important;
  border: 4px solid var(--encre) !important; box-shadow: -8px 8px 0 var(--encre) !important;
}
.panneau .fermer, .trousseau .fermer { color: var(--encre); font-weight: 700; }
.panneau-intro, .barre .val { color: #4b4560 !important; }
.barre .jauge { background: rgba(11, 11, 24, .12) !important; border: 2px solid var(--encre); height: .8rem !important; }
.barre .jauge span { background: var(--rose) !important; }
.liens a { border: 3px solid var(--encre) !important; background: var(--creme); color: var(--encre) !important; box-shadow: 3px 3px 0 var(--encre); font-family: var(--titre) !important; font-weight: 800 !important; text-transform: uppercase; letter-spacing: .04em; }

/* le carnet des codes, sur l'ardoise */
.craie-sous-titre { margin: 1.1rem 0 .3rem; font: 800 1.4rem/1 var(--titre); color: #ffe7b0; display: flex; justify-content: space-between; }
.craie-sous-titre span { font-size: 1.1rem; color: rgba(238, 240, 230, .7); }
.craie-codes { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(9.5rem, 1fr)); gap: .4rem .9rem; }
.craie-codes li { display: grid; grid-template-columns: 1.8rem 1fr auto; align-items: center; gap: .45rem; font-size: .9rem; }
.craie-codes li.cache { grid-column: 1 / -1; display: block; color: rgba(238, 240, 230, .4); font-style: italic; }
.craie-codes img { width: 1.8rem; height: 1.8rem; object-fit: contain; filter: grayscale(1) brightness(2.2) contrast(.8); }
.craie-codes b { font: 700 1.25rem/1 var(--titre); letter-spacing: .12em; color: #f4f2e8; }
.ardoise { max-height: calc(100svh - var(--hud-h) - 5rem); overflow: auto; overscroll-behavior: contain; }

/* ---------- le trousseau d'étiquettes ---------- */
.btn-plan {
  width: auto; height: auto; padding: .35rem .8rem .35rem .4rem;
  display: flex; align-items: center; gap: .3rem;
  color: var(--encre); background: var(--creme) !important; background-image: none !important;
  border: 3px solid var(--encre); border-radius: 12px; box-shadow: var(--ombre);
  backdrop-filter: none; -webkit-backdrop-filter: none;
  font: 800 1rem/1 var(--titre); text-transform: uppercase; letter-spacing: .04em;
}
.btn-plan svg { width: 38px; height: 38px; color: var(--encre); }
.btn-plan:active { translate: 3px 3px; box-shadow: 1px 1px 0 var(--encre); }
.trousseau {
  position: fixed; left: clamp(1rem, 3vw, 2.5rem); bottom: calc(max(1.4rem, env(safe-area-inset-bottom)) + 70px); z-index: 74;
  width: min(92vw, 340px); padding: .9rem 1rem 1rem;
  color: var(--encre); background: var(--trame-claire), var(--creme);
  border: 4px solid var(--encre); border-radius: 16px; box-shadow: 8px 8px 0 var(--encre);
  animation: approche .3s ease;
}
.trousseau-tete { display: flex; justify-content: space-between; align-items: baseline; }
.trousseau h2 { margin: 0; font: 800 1.9rem/1 var(--titre); text-transform: uppercase; }
.anneau { width: 46px; height: 46px; margin: .5rem 0 -14px 14px; border-radius: 50%; border: 6px solid #c9c4d6; box-shadow: 0 0 0 3px var(--encre), inset 0 0 0 3px var(--encre); position: relative; z-index: 2; }
.etiquettes { display: grid; gap: .55rem; padding-left: 26px; }
.etiquette-cle {
  --c: var(--rose);
  position: relative; display: flex; align-items: center; gap: .6rem;
  height: 50px; padding: 0 .9rem 0 2.4rem; cursor: pointer; text-align: left;
  color: var(--encre); background: var(--trame-claire), var(--c);
  border: 3px solid var(--encre); border-radius: 999px 14px 14px 999px;
  box-shadow: 4px 4px 0 var(--encre);
  rotate: calc((var(--i) - (var(--n) - 1) / 2) * 1.6deg);
  transform-origin: 0 50%;
  transition: rotate .2s ease, translate .12s ease, box-shadow .12s ease;
}
.etiquette-cle::before { /* le fil qui relie l'étiquette à l'anneau */
  content: ""; position: absolute; left: -26px; top: 50%; width: 30px; height: 3px; background: var(--encre);
}
.etiquette-cle .trou { position: absolute; left: .75rem; top: 50%; translate: 0 -50%; width: 16px; height: 16px; border-radius: 50%; background: var(--creme); border: 3px solid var(--encre); }
.etiquette-cle .nom { flex: 1; font: 800 1.25rem/1 var(--titre); text-transform: uppercase; letter-spacing: .03em; color: #fff; -webkit-text-stroke: 1.2px var(--encre); paint-order: stroke fill; text-shadow: 2px 2px 0 var(--encre); }
.etiquette-cle .num { font: 800 1rem/1 var(--titre); padding: .2rem .35rem; border-radius: 6px; background: var(--creme); border: 2px solid var(--encre); }
.etiquette-cle:hover, .etiquette-cle:focus-visible { rotate: 0deg; translate: 6px 0; box-shadow: 6px 6px 0 var(--encre); outline: none; }
.etiquette-cle.ici { box-shadow: 4px 4px 0 var(--encre), 0 0 0 4px var(--jaune), 0 0 0 7px var(--encre); }
.trousseau-reste { margin: .9rem 0 0; font-size: .88rem; font-style: italic; color: #4b4560; }

/* ---------- la malle aux cadenas ---------- */
.vue-malle {
  position: fixed; inset: 0; z-index: 72;
  display: grid; place-items: center; align-content: center; gap: 1.1rem;
  padding: calc(var(--hud-h) + .5rem) 1rem 1rem; background: rgba(4, 5, 10, .72);
}
.malle {
  width: min(94vw, 36rem); padding: 1.2rem 1.3rem 1.4rem;
  background:
    repeating-linear-gradient(90deg, rgba(0, 0, 0, .08) 0 2px, transparent 2px 46px),
    var(--trame-claire), #c26a3a;
  border: 4px solid var(--encre); border-radius: 18px; box-shadow: 10px 10px 0 var(--encre);
  animation: approche .4s ease;
}
.malle-tete { display: flex; justify-content: space-between; align-items: center; }
.malle h2 { margin: 0; font: 800 2.4rem/1 var(--titre); text-transform: uppercase; color: #fff; -webkit-text-stroke: 1.5px var(--encre); paint-order: stroke fill; text-shadow: 3px 3px 0 var(--encre); }
.malle-compte { font: 800 1.3rem/1 var(--titre); padding: .3rem .55rem; color: var(--encre); background: var(--jaune); border: 3px solid var(--encre); border-radius: 8px; box-shadow: 3px 3px 0 var(--encre); }
.malle-cadenas { display: grid; grid-template-columns: repeat(7, 1fr); gap: .5rem; margin-top: 1rem; }
.cadenas { position: relative; display: grid; justify-items: center; border: 0; padding: 0; background: none; cursor: pointer; }
.cadenas .anse { width: 58%; aspect-ratio: 1; margin-bottom: -28%; border: 5px solid #c9c4d6; border-bottom: 0; border-radius: 999px 999px 0 0; box-shadow: 0 0 0 3px var(--encre); transition: translate .3s ease; }
.cadenas .corps { position: relative; width: 100%; aspect-ratio: 1 / 1.05; display: grid; place-items: center; background: var(--jaune); border: 3px solid var(--encre); border-radius: 10px; box-shadow: 3px 3px 0 var(--encre); }
.cadenas .corps img { width: 70%; height: 70%; object-fit: contain; }
.cadenas .corps b { position: absolute; right: -6px; bottom: -8px; min-width: 1.4rem; padding: .1rem .2rem; font: 800 .9rem/1 var(--titre); text-align: center; color: #fff; background: var(--rose); border: 2px solid var(--encre); border-radius: 6px; }
.cadenas.absent { cursor: default; }
.cadenas.absent .corps { background: #8d8a9c; }
.cadenas.absent .corps b { position: static; font-size: 1.5rem; background: none; border: 0; color: var(--encre); }
.cadenas.choisi .corps { background: var(--bleu); translate: 0 -4px; box-shadow: 3px 7px 0 var(--encre); }
.cadenas.ouvert .anse { translate: 0 -30%; }
.cadenas.ouvert .corps { background: #7ee36b; }
.cadenas.ouvert .corps::after { content: "✓"; position: absolute; left: -6px; top: -8px; font: 800 1rem/1 var(--corps); color: var(--encre); background: var(--creme); border: 2px solid var(--encre); border-radius: 50%; width: 1.4rem; height: 1.4rem; display: grid; place-items: center; }
.cadenas.secoue { animation: secoue-c .45s ease; }
@keyframes secoue-c { 25% { translate: -3px 0; } 50% { translate: 3px 0; } 75% { translate: -2px 0; } }
.malle-aide { margin: .9rem 0 0; color: #fff; font-weight: 600; text-shadow: 1px 1px 0 var(--encre); }
.malle-clavier { display: grid; gap: .6rem; margin-top: .8rem; padding: .8rem; background: var(--trame-claire), #ffd8ea; border: 3px solid var(--encre); border-radius: 14px; box-shadow: 4px 4px 0 var(--encre); }
.malle-clavier .touches button, .malle-clavier .touches-bas button { height: 46px; }
.ecran-malle { height: 52px; display: grid; place-items: center; font: 800 2rem/1 var(--titre); letter-spacing: .35em; color: #6dff7a; background: #10261a; border: 3px solid var(--encre); border-radius: 8px; }
.ecran-malle.erreur { color: #ff6b8a; animation: clignote .25s steps(2) 4; }
.ecran-malle.bon { color: var(--jaune); }

/* écran de chargement */
.chargement { background: radial-gradient(circle, rgba(240, 99, 177, .18) 1.2px, transparent 1.7px) 0 0 / 9px 9px, radial-gradient(60% 50% at 50% 42%, #22297f 0%, var(--marine) 75%); }
.onde { border-width: 4px; }
.appel-titre { color: #fff; -webkit-text-stroke: 2px var(--encre); paint-order: stroke fill; text-shadow: 4px 4px 0 var(--encre); text-transform: uppercase; }
.appel-barre { height: 14px; border: 3px solid var(--encre); border-radius: 8px; background: var(--creme); box-shadow: 3px 3px 0 var(--encre); }
.appel-barre span { background: var(--rose); }
.appel-etat { color: var(--creme); font-weight: 700; }

@media (max-aspect-ratio: 1/1) {
  .hud-btn { padding: .4rem .55rem .35rem; font-size: .85rem; box-shadow: 3px 3px 0 var(--encre); }
  .lieu { font-size: .95rem; }
  .btn-plan span { display: none; }
  .btn-plan { padding: .3rem; }
  .malle-cadenas { grid-template-columns: repeat(4, 1fr); gap: .7rem .6rem; }
  .trousseau { bottom: calc(max(1.4rem, env(safe-area-inset-bottom)) + 64px); }
}
.malle-cadenas > * { min-width: 0; }
.cadenas .corps img { position: absolute; inset: 14%; width: 72%; height: 72%; object-fit: contain; }
.vue-malle .malle { justify-self: center; }
.sous-titre { z-index: 76; }

/* ---------- le puzzle de la chambre ---------- */
.vue-puzzle, .vue-tele {
  position: fixed; inset: 0; z-index: 72;
  display: grid; place-items: center; align-content: center; gap: 1rem;
  padding: calc(var(--hud-h) + .5rem) 1rem 1rem; background: rgba(4, 5, 10, .78);
}
.puzzle {
  width: min(94vw, 34rem, calc((100svh - var(--hud-h) - 6rem) * .72)); padding: 1.1rem 1.2rem 1.2rem;
  background: var(--trame-claire), #8c6bff;
  border: 4px solid var(--encre); border-radius: 18px; box-shadow: 10px 10px 0 var(--encre);
  animation: approche .4s ease;
}
.puzzle-plateau {
  --col: 3;
  display: grid; grid-template-columns: repeat(var(--col), 1fr); gap: 3px;
  aspect-ratio: 1; margin-top: .9rem; padding: 10px;
  background: #d8b25a; border: 4px solid var(--encre); border-radius: 8px; box-shadow: 4px 4px 0 var(--encre);
}
.case-puzzle { border: 2px dashed #c9a7b8; background: var(--creme); padding: 0; cursor: pointer; }
.case-puzzle.posee { border: 0; cursor: default; animation: pose .35s ease; }
@keyframes pose { from { scale: 1.12; } }
.case-puzzle.secoue { animation: secoue-c .45s ease; }
.puzzle-plateau.fini { gap: 0; }
.puzzle-plateau.fini .case-puzzle { animation: brille-cover 2.4s ease-in-out infinite; }
@keyframes brille-cover { 50% { filter: brightness(1.12); } }
.puzzle-bac { display: flex; flex-wrap: wrap; gap: .6rem; margin-top: .8rem; min-height: 4.6rem; }
.piece-puzzle {
  width: 4.4rem; aspect-ratio: 1; padding: 0; cursor: pointer;
  border: 3px solid var(--encre); border-radius: 8px; box-shadow: 3px 3px 0 var(--encre);
  rotate: calc((var(--r, 0) * 1deg)); transition: translate .12s ease;
}
.piece-puzzle:nth-child(odd) { rotate: -4deg; } .piece-puzzle:nth-child(even) { rotate: 3deg; }
.piece-puzzle.choisie { translate: 0 -6px; box-shadow: 3px 9px 0 var(--encre), 0 0 0 4px var(--jaune); rotate: 0deg; }
.bac-vide { margin: 0; color: #fff; font-style: italic; text-shadow: 1px 1px 0 var(--encre); }

/* ---------- la télé cathodique ---------- */
.tele {
  position: relative; width: min(92vw, 40rem, calc((100svh - var(--hud-h) - 6rem) * 1.25));
  aspect-ratio: 5 / 4; padding: 6% 22% 8% 6%;
  background: var(--trame-claire), var(--rose);
  border: 5px solid var(--encre); border-radius: 34px; box-shadow: 12px 12px 0 var(--encre);
  animation: approche .4s ease;
}
.tele::before, .tele::after { /* l'antenne */
  content: ""; position: absolute; top: -16%; width: 5px; height: 20%; background: var(--encre); border-radius: 3px;
}
.tele::before { left: 34%; rotate: -32deg; } .tele::after { left: 50%; rotate: 30deg; }
.ecran-tele {
  position: relative; width: 100%; height: 100%; overflow: hidden;
  background: #0d1130; border: 5px solid var(--encre); border-radius: 18% / 22%;
  box-shadow: inset 0 0 40px rgba(0, 0, 0, .8);
}
.ecran-tele::after { /* lignes de balayage et bombé du verre */
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background: repeating-linear-gradient(0deg, rgba(0, 0, 0, .28) 0 2px, transparent 2px 4px),
              radial-gradient(120% 100% at 30% 20%, rgba(255, 255, 255, .14), transparent 45%);
}
.ecran-tele video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; display: none; filter: saturate(1.3) contrast(1.1); }
.ecran-tele.video video { display: block; }
.ecran-tele.neige { background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='120'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='1.2' numOctaves='1'/%3E%3CfeColorMatrix type='saturate' values='0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E") 0 0 / 160px 120px, #777; animation: neige .12s steps(3) infinite; }
@keyframes neige { 33% { background-position: 40px 30px, 0 0; } 66% { background-position: -50px 60px, 0 0; } }
.tele-code { position: absolute; inset: 0; margin: 0; display: grid; place-items: center; font: 800 clamp(2.4rem, 9vw, 5rem)/1 var(--titre); letter-spacing: .2em; color: #b6ffb0; text-shadow: 0 0 12px #6dff7a, 0 0 2px #fff; }
.ecran-tele.code .tele-code { animation: allume .5s ease; }
@keyframes allume { from { transform: scaleY(.02); filter: brightness(4); } }
.tele-boutons { position: absolute; right: 5%; top: 12%; width: 12%; display: grid; gap: 14%; justify-items: center; }
.tele-boutons i { width: 70%; aspect-ratio: 1; border-radius: 50%; background: var(--jaune); border: 4px solid var(--encre); }
.tele-boutons i + i { background: var(--bleu); }
.tele-boutons span { width: 80%; height: 3.4rem; background: repeating-linear-gradient(0deg, var(--encre) 0 3px, transparent 3px 9px); }
.puzzle h2 { margin: 0; font: 800 2.2rem/1 var(--titre); text-transform: uppercase; color: #fff; -webkit-text-stroke: 1.5px var(--encre); paint-order: stroke fill; text-shadow: 3px 3px 0 var(--encre); }
.ecran-tele { position: absolute; left: 6%; top: 8%; right: 24%; bottom: 10%; width: auto; height: auto; }

/* transitions : fondu au noir rapide, petit combiné qui sonne si la pièce tarde à charger */
.voile { transition: opacity .2s ease; display: grid; place-items: center; }
.voile.blanc { transition-duration: .9s; }
.voile-combine { height: 70px; opacity: 0; rotate: -18deg; transition: opacity .2s ease; }
.voile.charge .voile-combine { opacity: 1; animation: sonne 1.6s ease-in-out infinite; }

/* trousseau : juste les étiquettes, sans l'anneau */
.etiquettes { padding-left: 0; margin-top: .7rem; }
.etiquette-cle::before { display: none; }
.etiquette-cle { rotate: calc((var(--i) - (var(--n) - 1) / 2) * 1deg); }
.vue-malle.coffre .malle { background: repeating-linear-gradient(90deg, rgba(0, 0, 0, .1) 0 2px, transparent 2px 30px), var(--trame-claire), #5c6b8a; }
.vue-malle.coffre .malle-cadenas { grid-template-columns: 5rem; justify-content: center; }
