/* 3. Les salles et les fiches. Chaque fiche garde les mêmes outils, pas la même forme. */
.salle { position: relative; padding: clamp(40px, 5vw, 84px) var(--marge) clamp(20px, 2vw, 32px); }
.salle-nom { font-size: clamp(2.6rem, 6.4vw, 6.4rem); font-weight: 900; letter-spacing: -.035em; line-height: .94; }
.salle-mot { font-size: clamp(1.15rem, 1.6vw, 1.5rem); line-height: 1.35; max-width: 34ch; }

/* Un objet du cabinet par salle : la sonnette répond, le chronomètre attend, le ticket ne te perd pas,
   l'enseigne parle, le tambour se déroule (js/objets.js) */
.salle-objet { display: block; overflow: visible; }
button.salle-objet { border: 0; background: none; padding: 0; color: inherit; cursor: pointer; }
button.salle-objet:disabled { cursor: default; }
.salle-objet svg { display: block; width: 100%; overflow: visible; }
.salle-sonnette { width: clamp(120px, 12vw, 180px); justify-self: end; }
.salle-sonnette [data-objet="timbre"] { transform-origin: 130px 170px; }
.salle-chrono { width: clamp(104px, 10vw, 150px); }
.salle-enseigne { width: clamp(200px, 25vw, 360px); grid-column: 1; grid-row: 1 / 3; align-self: start; justify-self: start; margin-top: calc(-1 * clamp(34px, 4vw, 64px)); margin-bottom: calc(-1 * clamp(34px, 4vw, 64px)); }
/* Salle 1, l'établi : le titre et la phrase sur la même ligne, une règle dessous */
.salle--etabli, .salle--couloir { background: var(--papier); }
.salle--etabli { display: grid; grid-template-columns: auto minmax(0, 34ch) minmax(150px, 1fr); gap: 12px 56px; align-items: end; }
.salle--etabli::after { content: ""; grid-column: 1 / -1; height: 12px; margin-top: 10px; background: repeating-linear-gradient(90deg, var(--nuit) 0 2px, transparent 2px 20px), linear-gradient(var(--nuit), var(--nuit)) 0 0 / 100% 2px no-repeat; }
/* Salle 2, l'attente : une demi-ellipse un peu plus large que l'écran, elle sort toujours par les deux bords */
.salle--attente { display: grid; justify-items: center; text-align: center; gap: 14px; padding-block: clamp(64px, 7vw, 110px) 20px; overflow: hidden; }
.salle--attente::before { content: ""; position: absolute; left: 50%; top: 22px; bottom: -2px; width: max(108vw, 900px); translate: -50% 0; border-radius: 50% 50% 0 0 / 100% 100% 0 0; border: 2px solid var(--nuit); background: var(--ivoire); }
.salle--attente > * { position: relative; }
.salle--attente { background: var(--papier); }
.fiche--ronde { position: relative; }
/* Salle 3, le fil : un fil de couture traverse la page */
.salle--fil { background: #dfe3ea; }
.salle--fil { padding-left: max(var(--marge), 24vw); padding-bottom: 96px; }
.salle--fil .salle-mot { margin-top: 18px; }
/* le ticket pend au fil, par sa ficelle */
.salle-ticket { position: absolute; z-index: 2; width: 150px; right: 3.4vw; bottom: -186px; rotate: 5deg; transform-origin: 50% 0; pointer-events: none; }
@media (max-width: 1240px) { .salle-ticket { width: 112px; bottom: 12px; } .salle--fil { padding-bottom: 130px; } }
.salle-fil { position: absolute; left: 0; bottom: 0; width: 100%; height: 88px; }
.salle-fil path { fill: none; stroke: var(--vermillon); stroke-width: 4; stroke-dasharray: 16 10; stroke-linecap: round; vector-effect: non-scaling-stroke; }
/* Salle 4, la voix : tout à droite, sur vermillon */
.salle--voix h2 { padding-bottom: .12em; }
.salle--voix { background: var(--vermillon-fonce); color: #fff4e2; text-align: right; display: grid; grid-template-columns: auto minmax(0, 1fr); justify-items: end; gap: 14px; padding-block: clamp(34px, 4vw, 64px); }
/* Salle 5, le couloir : des portes l'une derrière l'autre */
.salle--couloir { display: grid; grid-template-columns: auto minmax(0, 1fr) 210px; gap: 12px 48px; align-items: end; }
.salle-tambour { width: 210px; }
/* Salle 6, la nuit : un rond de lumière */
.salle--nuit { background: var(--nuit-basse); color: var(--ivoire); }
.salle--nuit { display: grid; justify-items: center; text-align: center; gap: 16px; background: radial-gradient(52vw 120% at 50% 110%, #3a2f2a, transparent 72%) var(--nuit-basse); }
@media (max-width: 900px) {
  .salle--etabli, .salle--couloir { grid-template-columns: minmax(0, 1fr); }
  .salle-tambour { width: 140px; }
  .salle--fil { padding-left: var(--marge); padding-bottom: 210px; } .salle-ticket { right: var(--marge); }
  .salle--voix { grid-template-columns: minmax(0, 1fr); } .salle-enseigne { grid-row: auto; margin-bottom: 0; } .salle-sonnette { justify-self: start; }
}

/* Le fond d'une fiche dépend de sa famille (catalogue/familles.json) */
.fond--papier { --fond: var(--papier); --encre: var(--nuit); }
.fond--ivoire { --fond: var(--ivoire); --encre: var(--nuit); }
.fond--fil { --fond: #dfe3ea; --encre: var(--nuit); }
.fond--lampe { --fond: #f8e3b4; --encre: var(--nuit); }
.fond--nuit { --fond: var(--nuit-basse); --encre: var(--ivoire); }
.fiche { background: var(--fond); color: var(--encre); }
.fiche:focus { outline: none; }
/* Sans JavaScript, la scène est immobile : les commandes n'auraient rien à commander */
html:not([data-motion]) :is(.outils, .fiche-plan) { display: none; }
.fiche { padding: clamp(28px, 3vw, 48px) var(--marge) clamp(56px, 6vw, 92px); display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 24px clamp(16px, 2vw, 32px); align-items: start; }
.fiche > * { grid-column: 1 / -1; min-width: 0; }
.fiche-titre { font-size: clamp(1.9rem, 3.2vw, 3rem); }
.fiche-inter { font: 800 1.125rem/1.2 var(--texte); margin-bottom: 6px; }
.fiche-en { display: flex; flex-wrap: wrap; gap: 0 16px; align-items: baseline; font: italic 500 1.0625rem/1.3 var(--titre); margin-top: 8px; }
.fiche-sert { margin-top: 12px; font-size: 1.25rem; line-height: 1.38; max-width: 38ch; }
.fiche-plan { display: flex; gap: 14px; align-items: end; margin-bottom: 18px; }
.fiche-plan svg { width: 96px; height: auto; flex: none; }
.fiche-plan p { font-size: 1rem; line-height: 1.25; }
/* Chaque morceau de la miniature est dessiné deux fois : gris tant qu'il est mort, en couleur quand il vit */
.z-couleur { opacity: 0; } .vivant > .z-couleur { opacity: 1; } .vivant > .z-gris { opacity: 0; } 
html[data-motion="full"] :is(.z-couleur, .z-gris) { transition: opacity var(--longue); }
.fiche-demande p { font: 500 1.1875rem/1.5 var(--texte); padding-left: 18px; border-left: 4px solid var(--vermillon); max-width: 62ch; }
.fiche-trop p { max-width: 48ch; }
.copier { margin-top: 14px; }
.precise { margin-top: 16px; }
.precise summary, .bande > summary { min-height: 44px; display: flex; align-items: center; gap: 12px; font-weight: 700; width: fit-content; list-style: none; }
.precise summary::before, .bande > summary::before { content: ""; width: 10px; height: 10px; border: solid currentColor; border-width: 0 3px 3px 0; rotate: -45deg; transition: rotate var(--courte); }
.precise[open] summary::before, .bande[open] > summary::before { rotate: 45deg; }
summary::-webkit-details-marker { display: none; }
.precise[open] > p { margin-top: 6px; }

/* Salle 1 : le texte d'un côté, l'objet de l'autre */
.fiche--a-droite .fiche-tete { grid-column: 1 / 5; }
.fiche--a-droite > .scene { grid-column: 5 / -1; }
.fiche--a-gauche .fiche-tete { grid-column: 9 / -1; grid-row: 1; }
.fiche--a-gauche > .scene { grid-column: 1 / 9; grid-row: 1; }
.fiche--a-droite .fiche-tete, .fiche--a-gauche .fiche-tete { align-self: center; }
.fiche .fiche-demande { grid-column: 1 / 8; }
.fiche .fiche-trop { grid-column: 8 / -1; }
/* Salle 2 : tout est rond */
.fiche--ronde > .scene { grid-column: 5 / -1; justify-self: center; }
.fiche--ronde .fiche-tete { grid-column: 1 / 5; align-self: center; }
/* Salle 3 : la barre. Salle 4 : pleine largeur */
.fiche--large .fiche-tete, .fiche--plein .fiche-tete { display: grid; grid-template-columns: auto minmax(0, 1fr) minmax(0, 1.2fr); gap: 0 36px; align-items: end; }
html:not([data-motion]) #menu-ne .fiche-tete { padding-right: 190px; min-height: 156px; }
.fiche--large .fiche-plan, .fiche--plein .fiche-plan { grid-row: 1 / 3; margin: 0; }
.fiche--large .fiche-sert, .fiche--plein .fiche-sert { grid-column: 3; grid-row: 1 / 3; margin: 0; }
.fiche--large .fiche-en, .fiche--plein .fiche-en { grid-column: 2; }
.fiche--plein > .scene { margin-inline: calc(-1 * var(--marge)); border-radius: 0; }
/* Salle 5 : le couloir */
.couloir { display: grid; grid-template-columns: minmax(0, 7fr) minmax(0, 6fr); gap: clamp(24px, 4vw, 72px); align-items: start; }
.couloir-scene { position: sticky; top: calc(var(--entete) + 20px); }
.couloir-suite { min-width: 0; }
html[data-motion="reduce"] .couloir-suite { display: flex; flex-direction: column; }
html[data-motion="reduce"] .couloir-suite .outils { order: -1; margin-bottom: 30px; }
.etapes { counter-reset: e; }
.etapes li { counter-increment: e; padding: 24px 0 24px 78px; position: relative; }
.etapes li::before { content: counter(e); position: absolute; left: 0; top: 18px; font: 900 3.6rem/1 var(--titre); color: var(--vermillon); }
html[data-motion="full"] .etapes li { min-height: 55vh; display: grid; align-content: center; }
html[data-motion="full"] .etapes li::before { top: 50%; transform: translateY(-50%); }
.etapes :is(h2, h4) { font: 800 1.6rem/1.15 var(--titre); }
.etapes .etape-image { margin-top: 14px; position: relative; overflow: hidden; border-radius: 6px; }
/* Salle 6 : la nuit */
.fiche--nuit > .scene { grid-column: 1 / 9; grid-row: 1; }
.fiche--nuit .fiche-tete { grid-column: 9 / -1; grid-row: 1; align-self: center; }
.fond--nuit .fiche-demande p { border-color: var(--lampe); }

/* Les commandes */
.outils { position: relative; min-width: 0; display: grid; gap: 18px; }
.outils > * { min-width: 0; }
.commandes { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.commandes-version { margin-left: 8px; font-size: 1.0625rem; }
/* La ratée joue : le nom de son erreur, sur toute la largeur, sous les boutons */
.commandes-erreur { flex: 1 0 100%; margin: 0; padding-left: 12px; border-left: 4px solid var(--vermillon); font-size: 1.0625rem; max-width: 62ch; }
.cmd { min-height: 48px; padding: 6px 20px; border: 2px solid currentColor; border-radius: 3px; background: transparent; font-weight: 700; line-height: 1.2; }
.cmd:hover { background: var(--nuit); color: var(--ivoire); border-color: var(--nuit); }
.cmd--jouer { background: var(--vermillon); border-color: var(--vermillon); color: #fff; min-width: 116px; }
.cmd--jouer:hover { background: var(--vermillon-fonce); border-color: var(--vermillon-fonce); color: #fff; }
.fond--nuit .cmd:not(.cmd--jouer):hover { background: var(--ivoire); color: var(--nuit); border-color: var(--ivoire); }
/* Au doigt, un survol qui reste collé n'a pas de sens */
@media (hover: none) {
  .cmd:not(.cmd--jouer):hover, .fond--nuit .cmd:not(.cmd--jouer):hover { background: transparent; color: inherit; border-color: currentColor; }
}

/* Les réglages */
.reglages { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 18px 40px; max-width: 1080px; }
.reglage { display: grid; gap: 4px; align-content: start; }
.reglage label { font-weight: 700; display: flex; justify-content: space-between; gap: 12px; }
.reglage output { font-variant-numeric: tabular-nums; font-weight: 400; white-space: nowrap; }
.reglage input[type=range] { width: 100%; min-height: 32px; accent-color: var(--vermillon); margin: 0; }
.reglage-trio { display: flex; gap: 8px; }
.reglage-trio button { min-height: 34px; min-width: 52px; padding: 0 10px; border: 1px solid currentColor; border-radius: 17px; background: transparent; font-size: 1rem; font-variant-numeric: tabular-nums; }
.reglage-trio .est-choisie { background: var(--nuit); color: var(--ivoire); border-color: var(--nuit); }
.fond--nuit .reglage-trio .est-choisie { background: var(--ivoire); color: var(--nuit); }
.reglage-courbe { display: grid; grid-template-columns: 1fr 54px; gap: 12px; align-items: center; }
.reglage select { min-height: 44px; width: 100%; padding: 0 8px; background: var(--papier); color: var(--nuit); border: 2px solid currentColor; border-radius: 3px; }
.reglage svg { width: 54px; height: 54px; overflow: visible; }
.reglage svg path { fill: none; stroke: currentColor; stroke-width: 3; stroke-linecap: round; }
.reglage svg .axe { stroke-width: 1; opacity: .5; }
.reglages-note { font-style: italic; }

@media (max-width: 900px) {
  .fiche .fiche-tete, .fiche > .scene, .fiche .fiche-demande, .fiche .fiche-trop { grid-column: 1 / -1; grid-row: auto; }
  .fiche .fiche-tete { display: grid; grid-template-columns: minmax(0, 1fr) 84px; gap: 0 16px; align-items: start; }
  .fiche .fiche-tete:not(:has(.fiche-plan)) { grid-template-columns: minmax(0, 1fr); }
  .fiche .fiche-tete > * { grid-column: 1; grid-row: auto; }
  .fiche .fiche-tete .fiche-plan { grid-column: 2; grid-row: 1 / 5; margin: 0; display: grid; gap: 4px; }
  .fiche-plan svg { width: 84px; }
  .fiche-plan p { font-size: .9375rem; } .fiche-plan p br, .fiche-plan p { font-size: 0; } .fiche-plan b { font-size: .9375rem; font-weight: 500; }
  .fiche .fiche-sert { margin-top: 10px; }
  .couloir { grid-template-columns: minmax(0, 1fr); gap: 0; }
  .couloir-scene { z-index: 5; top: var(--entete); margin-inline: calc(-1 * var(--marge)); }
  html[data-motion="full"] .etapes li { min-height: 46vh; }
  .fiche--couloir .outils { padding-top: 20px; }
  .etapes li { padding-left: 54px; } .etapes li::before { font-size: 2.6rem; }
}
@media (max-width: 560px) { .commandes-version { flex: 1 0 100%; margin: 2px 0 0; } .cmd { flex: 1 1 44%; padding-inline: 10px; } .fiche-demande .cmd { flex: none; padding-inline: 20px; } }
