/* La scène : la maquette posée sur le céruléen, le pupitre de la sortie en dessous. */
.scene { position: relative; background: var(--ceruleen); color: var(--encre); display: flex; flex-direction: column; }
.vue { position: relative; overflow: hidden; }
.vue canvas {
  position: absolute; inset: 0; width: 100%; height: 100%; z-index: 1;
  opacity: 0; transition: opacity 0.7s ease; touch-action: pan-y; cursor: grab;
}
.vue canvas:active { cursor: grabbing; }
.maquette-active canvas { opacity: 1; }
.maquette-repli canvas { display: none; }

/* Photo de repli : visible sans JavaScript, ou quand la maquette ne peut pas tourner */
.scene-photo { position: absolute; z-index: 0; display: block; }
.scene-photo img { width: 100%; height: 100%; object-fit: cover; object-position: 50% 55%; }
.js .scene-photo { display: none; }
.js .maquette-repli .scene-photo { display: block; }

.scene-texte { position: relative; z-index: 2; pointer-events: none; }
.scene-texte h1 { font-size: clamp(54px, 7vw, 146px); }
.scene-texte h1 span { display: block; }
.chapo { margin-top: 16px; font-size: clamp(18px, 1.25vw, 22px); font-weight: 520; max-width: 30ch; }
.prix-ligne { display: flex; flex-wrap: wrap; gap: 4px 28px; margin-top: 18px; font-size: 16px; font-weight: 520; }
.prix-ligne span { display: inline-flex; align-items: baseline; gap: 10px; }
.prix-ligne b { font-size: clamp(26px, 1.9vw, 34px); font-weight: 600; letter-spacing: -0.01em; }
.prix-note { margin-top: 6px; font-size: 14px; }

/* Repères posés sur la maquette (placés par maquette.js) */
.reperes { position: absolute; inset: 0; z-index: 3; pointer-events: none; display: none; }
.maquette-active .reperes { display: block; }
.repere {
  position: absolute; left: 0; top: 0; translate: calc(-50% + var(--dx, 0px)) calc(-100% - var(--tige, 16px)); transform: translate3d(-999px, -999px, 0);
  display: flex; align-items: center; gap: 6px; min-height: 34px; padding: 0 10px;
  background: var(--blanc); color: var(--encre); border: 0; border-radius: 0;
  font-size: 14px; font-weight: 620; white-space: nowrap; pointer-events: auto;
  box-shadow: 0 6px 18px rgba(4, 30, 46, 0.22);
}
.repere::after { content: ""; position: absolute; left: calc(50% - var(--dx, 0px)); top: 100%; width: 2px; height: var(--tige, 16px); margin-left: -1px; background: var(--blanc); }
.repere::before { content: ""; position: absolute; inset: -5px -4px; }
.repere small { font-size: 12px; font-weight: 500; color: var(--gris); }
.repere[aria-pressed="true"] { background: var(--encre); color: var(--blanc); z-index: 2; }
.repere[aria-pressed="true"]::after { background: var(--encre); }
.repere[aria-pressed="true"] small { color: var(--gris-sombre); }
.repere.info { background: none; box-shadow: none; color: var(--encre); padding: 0; min-height: 0; font-size: 13px; pointer-events: none; }
.repere.info::after { background: var(--encre); width: 1px; margin-left: 0; }
.repere.hors-champ { visibility: hidden; }
.repere.repere-ponton { background: var(--encre); color: var(--blanc); pointer-events: none; font-size: 13px; min-height: 28px; }
.repere.repere-ponton::after { background: var(--encre); }

.scene-outils { position: absolute; z-index: 4; display: flex; align-items: center; gap: 8px; }
.aide { font-size: 14px; font-weight: 520; max-width: 32ch; margin-right: 8px; }
.tourner { width: 44px; height: 44px; display: grid; place-items: center; background: var(--encre); color: var(--blanc); border: 0; }
.tourner svg { width: 22px; height: 22px; }
.tourner:hover { background: #22323b; }
.maquette-repli .scene-outils { display: none; }
.credits { position: absolute; z-index: 4; font-size: 12px; font-weight: 500; color: var(--encre); opacity: 0.85; }
.maquette-repli .credits { display: none; }

/* Pupitre */
.pupitre { position: relative; z-index: 5; background: var(--encre); color: var(--blanc); }
.p-case { margin: 0; padding: 0; border: 0; min-width: 0; }
.p-case legend, .p-case > label, .p-lib, .p-resultat dt { font-size: 13px; font-weight: 560; color: var(--gris-sombre); padding: 0; }
.p-allure { display: flex; flex-direction: column; gap: 6px; }
.p-allure legend { margin-bottom: 8px; }
.choix { position: relative; display: block; cursor: pointer; }
.choix input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.choix span { display: flex; align-items: baseline; gap: 8px; min-height: 44px; align-items: center; padding: 0 12px; background: var(--pupitre-2); font-weight: 640; font-size: 17px; }
.choix small { font-size: 13px; font-weight: 500; color: var(--gris-sombre); }
.choix input:checked + span { background: var(--ceruleen); color: var(--encre); }
.choix input:checked + span small { color: var(--encre); }
.choix input:focus-visible + span { outline: 3px solid var(--blanc); outline-offset: 2px; }

.p-dest-ligne { display: flex; align-items: center; gap: 4px; margin-top: 8px; }
.p-dest select {
  flex: 1; min-width: 0; height: 52px; padding: 0 8px; border: 0; border-radius: 0; background: var(--pupitre-2); color: var(--blanc);
  font-family: var(--titre); font-size: 30px; line-height: 1; -webkit-appearance: none; appearance: none; text-align: center;
}
.p-dest select option { font-family: var(--texte); font-size: 16px; color: var(--encre); background: var(--blanc); }
.p-fleche { width: 44px; height: 52px; flex: none; display: grid; place-items: center; background: var(--pupitre-2); color: var(--blanc); border: 0; }
.p-fleche svg { width: 20px; height: 20px; }
.p-fleche:hover, .p-dest select:hover { background: #26363e; }

.p-depart > label { display: flex; justify-content: space-between; align-items: baseline; }
.p-depart output { font-size: 30px; font-weight: 560; color: var(--blanc); letter-spacing: -0.01em; }
.p-depart input[type="range"] { width: 100%; height: 44px; margin: 0; background: none; -webkit-appearance: none; appearance: none; cursor: pointer; }
.p-depart input[type="range"]::-webkit-slider-runnable-track { height: 6px; background: linear-gradient(90deg, #f08a4b, #ffd27a 30%, #ffffff 50%, #ffd27a 70%, #f08a4b); }
.p-depart input[type="range"]::-moz-range-track { height: 6px; background: linear-gradient(90deg, #f08a4b, #ffd27a 30%, #ffffff 50%, #ffd27a 70%, #f08a4b); }
.p-depart input[type="range"]::-webkit-slider-thumb { -webkit-appearance: none; width: 26px; height: 26px; margin-top: -10px; background: var(--ceruleen); border: 3px solid var(--encre); box-shadow: 0 0 0 2px var(--ceruleen); }
.p-depart input[type="range"]::-moz-range-thumb { width: 22px; height: 22px; border-radius: 0; background: var(--ceruleen); border: 3px solid var(--encre); }
.p-soleil { font-size: 13px; color: var(--gris-sombre); }

.pas { display: flex; align-items: center; margin-top: 8px; }
.pas button { width: 48px; height: 52px; border: 0; background: var(--pupitre-2); color: var(--blanc); font-size: 24px; line-height: 1; }
.pas button:hover:not([disabled]) { background: #26363e; }
.pas button[disabled] { color: #56656c; cursor: not-allowed; }
.pas output { flex: 1; min-width: 92px; text-align: center; font-size: 24px; font-weight: 560; }

.p-resultat dl { margin: 0; display: grid; gap: 4px; }
.p-resultat dl > div { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
.p-resultat dd { margin: 0; font-weight: 560; font-size: 16px; text-align: right; }
.p-resultat .r-fort dd { font-size: 30px; font-weight: 600; color: var(--ceruleen); letter-spacing: -0.01em; }
.p-regle { margin: 8px 0 12px; font-size: 14px; color: #c9d4d9; min-height: 2.6em; }
.p-regle.alerte { color: #ffd27a; }
.p-resultat .btn { width: 100%; }

/* Téléphone d'abord : texte, maquette, pupitre empilés */
.scene-texte { padding: 24px var(--marge) 16px; }
.vue { height: min(64svh, 560px); min-height: 380px; }
.scene-photo { inset: 0; }
.scene-outils { right: 12px; bottom: 12px; }
.aide { display: none; }
.credits { left: 12px; bottom: 14px; max-width: calc(100% - 140px); font-size: 11px; line-height: 1.3; padding: 3px 6px; background: rgba(255, 255, 255, 0.86); }
.pupitre { display: grid; gap: 22px; padding: 24px var(--marge) 28px; }
.p-allure { flex-direction: row; flex-wrap: wrap; }
.p-allure legend { width: 100%; }
.p-allure .choix { flex: 1 1 140px; }

@media (max-width: 640px) {
  .prix-ligne { gap: 2px 20px; margin-top: 12px; }
  .prix-ligne b { font-size: 24px; }
  .chapo { font-size: 17px; }
}
@media (min-width: 700px) and (max-width: 1023px) {
  .pupitre { grid-template-columns: 1fr 1fr; }
  .p-resultat { grid-column: 1 / -1; }
}
@media (min-width: 1024px) {
  .scene { height: calc(100svh - var(--barre) - 36px); min-height: 700px; max-height: 1200px; }
  .vue { flex: 1 1 auto; height: auto; min-height: 0; }
  .scene-texte { position: absolute; z-index: 2; left: var(--marge); top: clamp(24px, 5vh, 72px); padding: 0; max-width: 36%; }
  .scene-photo { left: 38%; right: var(--marge); top: 32px; bottom: 32px; }
  .scene-outils { right: var(--marge); top: 28px; bottom: auto; }
  .aide { display: block; text-align: right; }
  .credits { left: var(--marge); bottom: 16px; max-width: 40%; padding: 0; background: none; }
  .pupitre { grid-template-columns: minmax(170px, 0.9fr) minmax(230px, 1.1fr) minmax(240px, 1.25fr) minmax(170px, 0.8fr) minmax(330px, 1.7fr); gap: clamp(20px, 2vw, 44px); padding: 20px var(--marge) 22px; align-items: start; }
  .p-allure { flex-direction: column; flex-wrap: nowrap; }
  .p-allure .choix { flex: none; }
  .p-resultat { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 0 24px; }
  .p-resultat dl { grid-column: 1; }
  .p-regle { grid-column: 1; margin-bottom: 0; }
  .p-resultat .btn { grid-column: 2; grid-row: 1 / span 2; align-self: end; width: auto; min-height: 52px; }
  .p-resultat dd { white-space: nowrap; }
}
@media (min-width: 1280px) and (max-width: 1679px) {
  .pupitre { grid-template-columns: minmax(150px, 0.8fr) minmax(210px, 1fr) minmax(220px, 1.1fr) minmax(160px, 0.75fr) minmax(340px, 1.6fr); }
  .p-resultat dl { grid-column: 1 / -1; }
  .p-regle { grid-column: 1; grid-row: 2; }
  .p-resultat .btn { grid-column: 2; grid-row: 2; align-self: end; padding: 0 16px; }
  .p-resultat .r-fort dd { font-size: 26px; }
}
@media (min-width: 1024px) and (max-width: 1279px) {
  .pupitre { grid-template-columns: 1fr 1fr 1fr 1fr; }
  .p-resultat { grid-column: 1 / -1; }
}
.vue.maquette-repli { margin-top: 0; }
@media (max-width: 1023px) { .vue.maquette-repli { height: auto; min-height: 0; aspect-ratio: 16 / 10; } }
