/* Plongéo — l'outil, dans la même lumière que le site :
   la photo occupe tout l'écran, les réglages flottent par-dessus en panneaux sombres (nuit),
   repères blancs, un seul bleu d'action. Pas de flou d'arrière-plan : la photo bouge, il coûterait trop cher. */
:root {
  --nuit: #0B1220;
  --chrome: rgba(15, 23, 40, 0.86);
  --chrome-fort: rgba(15, 23, 40, 0.94);
  --verre: rgba(255, 255, 255, 0.08);
  --verre-fort: rgba(255, 255, 255, 0.14);
  --texte: #F5F5F7;
  --gris: #A1A1AA;
  --trait: rgba(255, 255, 255, 0.10);
  --accent: #0A84FF;
  --accent-fonce: #0071E3;
  --lagon: #46E3F0;
  --vert: #30D158;
  --rouge: #FF6B5E;
  --piquet: #FF9F0A;
  --ombre: 0 18px 50px rgba(0, 0, 0, 0.35), 0 2px 6px rgba(0, 0, 0, 0.25);
  --rayon: 18px;
  --haut: calc(70px + env(safe-area-inset-top));
  --feuille: 0px;
  font-family: Inter, -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, sans-serif;
  color: var(--texte);
  -webkit-font-smoothing: antialiased;
  color-scheme: dark;
}
* { box-sizing: border-box; min-width: 0; }
html, body { margin: 0; height: 100%; background: var(--nuit); }
body { overflow: hidden; }
button { font: inherit; color: inherit; touch-action: manipulation; -webkit-tap-highlight-color: transparent; }
.barre, .inspecteur, .outils, .statut, .deplier, .volet { -webkit-user-select: none; user-select: none; }
.flottant { background: var(--chrome); border-radius: var(--rayon); box-shadow: var(--ombre); border: 1px solid var(--trait); color: var(--texte); }

/* ---------- barre du haut : une pilule sombre posée sur la photo */
.barre {
  position: fixed; z-index: 20; top: calc(12px + env(safe-area-inset-top)); left: max(12px, env(safe-area-inset-left)); right: max(12px, env(safe-area-inset-right));
  height: 52px; padding: 0 8px 0 14px; border-radius: 16px;
  display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 12px;
  background: var(--chrome); border: 1px solid var(--trait); box-shadow: var(--ombre);
}
.marque { text-decoration: none; display: flex; align-items: center; }
.marque img { height: 28px; display: block; }
.marque .logo-court { display: none; }
.actions { display: flex; gap: 6px; justify-content: flex-end; align-items: center; }

.btn {
  border: 0; background: var(--verre); color: var(--texte);
  font-size: 14px; font-weight: 500; padding: 8px 16px; border-radius: 980px; cursor: pointer;
  transition: background .2s, transform .1s; white-space: nowrap; min-height: 36px;
}
.btn:hover { background: var(--verre-fort); }
.btn:active { transform: scale(0.97); }
.btn.primaire { background: var(--accent); color: #fff; }
.btn.primaire:hover { background: var(--accent-fonce); }
.btn.grand { font-size: 17px; padding: 13px 26px; min-height: 50px; }
.btn.clair { background: rgba(255, 255, 255, 0.16); border: 1px solid rgba(255, 255, 255, 0.4); }
.btn:focus-visible, .segment button:focus-visible, .puces button:focus-visible, .lien:focus-visible, .outils button:focus-visible { outline: 3px solid rgba(70, 227, 240, 0.6); outline-offset: 2px; }
.icone { width: 36px; height: 36px; border: 0; border-radius: 50%; background: transparent; cursor: pointer; display: grid; place-items: center; color: var(--gris); }
.icone:hover { background: var(--verre); color: var(--texte); }
.icone svg { width: 18px; height: 18px; }
.avec-icone { display: inline-flex; align-items: center; gap: 6px; }
.avec-icone svg { width: 18px; height: 18px; flex: none; }
.lien { border: 0; background: none; color: var(--lagon); font-size: 14px; padding: 6px 0; cursor: pointer; }
.lien.danger { color: var(--rouge); }

.segment { display: inline-grid; grid-auto-flow: column; grid-auto-columns: 1fr; background: var(--verre); border-radius: 11px; padding: 3px; }
.segment button { border: 0; background: transparent; font-size: 13.5px; font-weight: 500; padding: 6px 18px; border-radius: 8px; cursor: pointer; color: var(--gris); transition: background .2s, color .2s; min-height: 32px; }
.segment button:hover { color: var(--texte); }
.segment button.actif { background: rgba(255, 255, 255, 0.95); color: var(--nuit); }
.segment.large { display: grid; width: 100%; margin: 4px 0 12px; }

/* ---------- scène : la photo sous tout le reste */
.scene { position: fixed; inset: 0; background: var(--nuit); }
#scene, #plan { position: absolute; inset: 0; width: 100%; height: 100%; touch-action: none; }
#scene { cursor: crosshair; }
#plan { display: none; cursor: grab; }
body.vue-plan #plan { display: block; }
body.vue-plan .accueil, body.vue-plan .outils, body.vue-plan .volet { display: none; }

/* accueil : le jardin du site en fond, voile nuit, texte blanc */
.accueil {
  position: absolute; inset: 0; display: flex; flex-direction: column; align-items: flex-start; justify-content: flex-end;
  padding: 0 max(5vw, 24px) clamp(48px, 12vh, 120px); color: #fff;
  background: linear-gradient(90deg, rgba(11, 18, 32, 0.86), rgba(11, 18, 32, 0.2) 60%, rgba(11, 18, 32, 0)),
              linear-gradient(0deg, rgba(11, 18, 32, 0.7), rgba(11, 18, 32, 0) 50%),
              url(../img/jardin.webp) 55% 60% / cover no-repeat, var(--nuit);
}
.accueil h1 { font-size: clamp(38px, 5.4vw, 72px); line-height: 1.03; letter-spacing: -0.035em; font-weight: 600; margin: 0 0 18px; max-width: 13em; }
.accueil p { font-size: clamp(16px, 1.5vw, 19px); line-height: 1.5; color: rgba(255, 255, 255, 0.86); max-width: 520px; margin: 0 0 28px; }
.accueil .petit-texte { font-size: 13px; margin: 18px 0 0; color: rgba(255, 255, 255, 0.7); }
.ligne-boutons { display: flex; gap: 10px; flex-wrap: wrap; }
body.avec-photo .accueil { display: none; }
.scene.survol::after {
  content: 'Déposez le fichier'; position: absolute; inset: 16px; border-radius: 24px;
  border: 2px dashed var(--lagon); background: rgba(70, 227, 240, 0.1);
  display: grid; place-items: center; font-size: 22px; font-weight: 600; color: #fff; pointer-events: none;
}

/* barre d'outils du bas : avant/après et zoom */
.outils {
  position: absolute; left: 50%; bottom: max(16px, env(safe-area-inset-bottom)); transform: translateX(calc(-50% - 180px));
  display: flex; align-items: center; gap: 2px; padding: 5px; border-radius: 980px;
}
.outils button { border: 0; background: transparent; height: 38px; min-width: 38px; padding: 0 14px; border-radius: 980px; cursor: pointer; font-size: 14px; font-weight: 500; color: var(--texte); white-space: nowrap; }
.outils button:hover { background: var(--verre); }
.outils button.actif { background: var(--verre-fort); }
.outils .zoom-pas { font-size: 19px; padding: 0; }
.outils #zoomValeur { font-size: 13px; min-width: 64px; padding: 0 6px; font-variant-numeric: tabular-nums; color: var(--gris); }
.outils .sep { width: 1px; height: 22px; background: var(--trait); margin: 0 4px; }
body:not(.avec-photo) .outils { display: none; }
body.replie .outils { transform: translateX(-50%); }

/* comparaison avant / après : une ligne qu'on fait glisser */
.volet { position: absolute; top: 0; height: 100%; width: 0; z-index: 5; display: none; pointer-events: none; }
body.comparer .volet { display: block; }
.volet::before { content: ''; position: absolute; top: 0; bottom: 0; left: -1.5px; width: 3px; background: #fff; box-shadow: 0 0 14px rgba(0, 0, 0, 0.45); }
.volet button {
  position: absolute; top: 50%; left: -24px; width: 48px; height: 48px; margin-top: -24px; border: 0; border-radius: 50%;
  background: #fff; color: var(--nuit); font-size: 18px; font-weight: 700; cursor: ew-resize; pointer-events: auto; touch-action: none;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
}
.volet b { position: absolute; top: 14px; font-size: 12px; font-weight: 600; color: #fff; background: rgba(11, 18, 32, 0.78); padding: 5px 11px; border-radius: 980px; white-space: nowrap; }
.volet b:first-of-type { right: 14px; }
.volet b:last-of-type { left: 14px; }

/* messages : pilules sombres sous la barre */
.statut { position: absolute; left: 50%; top: calc(var(--haut) + 12px); transform: translateX(calc(-50% - 180px)); display: flex; flex-direction: column; align-items: center; gap: 6px; pointer-events: none; max-width: min(560px, 60vw); }
.statut span { background: var(--chrome); color: #fff; font-size: 13px; line-height: 1.35; padding: 8px 14px; border-radius: 980px; text-align: center; box-shadow: 0 6px 20px rgba(0, 0, 0, 0.25); }
.statut span:empty { display: none; }
body:not(.avec-photo):not(.vue-plan) #statut, body.comparer #statut { display: none; }
body.replie .statut { transform: translateX(-50%); }
body.vue-plan .statut { top: auto; bottom: max(18px, env(safe-area-inset-bottom)); }

/* ---------- inspecteur : carte sombre à droite */
.inspecteur {
  position: absolute; top: calc(var(--haut) + 10px); right: max(12px, env(safe-area-inset-right)); width: 340px;
  max-height: calc(100% - var(--haut) - 26px - env(safe-area-inset-bottom));
  display: flex; flex-direction: column; overflow: hidden; transition: transform .35s cubic-bezier(.2, .8, .2, 1), opacity .25s;
}
.tete-inspecteur { display: flex; align-items: center; gap: 4px; padding: 10px 8px 10px 12px; border-bottom: 1px solid var(--trait); flex: none; }
.etapes { display: flex; gap: 2px; overflow-x: auto; scrollbar-width: none; flex: 1; }
.etapes::-webkit-scrollbar { display: none; }
.etapes button { flex: none; border: 0; background: transparent; border-radius: 9px; padding: 7px 10px; font-size: 13px; font-weight: 500; color: var(--gris); cursor: pointer; white-space: nowrap; }
.etapes button:hover { color: var(--texte); background: var(--verre); }
.etapes button.actif { color: var(--nuit); background: rgba(255, 255, 255, 0.95); }
.corps-inspecteur { overflow-y: auto; padding: 0 20px 18px; overscroll-behavior: contain; flex: 1; scroll-behavior: smooth; scrollbar-width: thin; scrollbar-color: rgba(255,255,255,.2) transparent; }
body.replie .inspecteur { transform: translateX(calc(100% + 32px)); opacity: 0; pointer-events: none; }
.deplier { position: absolute; top: calc(var(--haut) + 10px); right: max(12px, env(safe-area-inset-right)); display: none; align-items: center; gap: 8px; border: 1px solid var(--trait); padding: 9px 16px; border-radius: 980px; font-size: 14px; font-weight: 500; cursor: pointer; }
.deplier svg { width: 18px; height: 18px; }
body.replie .deplier { display: inline-flex; }
kbd { font: inherit; font-size: 11.5px; background: var(--verre); border: 1px solid var(--trait); border-bottom-width: 2px; border-radius: 5px; padding: 0 5px; color: var(--texte); }
@media (hover: none) { .raccourcis { display: none; } }
.inspecteur section { padding: 16px 0; scroll-margin-top: 4px; border-bottom: 1px solid var(--trait); }
.inspecteur section:last-child { border-bottom: 0; }
.poignee { display: none; }
h2 { font-size: 17px; font-weight: 600; letter-spacing: -0.015em; margin: 0 0 10px; }
.aide { font-size: 13px; color: var(--gris); margin: 4px 0 6px; line-height: 1.45; }
.inspecteur .ligne-boutons { justify-content: flex-start; gap: 8px; }
.inspecteur .btn { font-size: 13px; padding: 8px 14px; }
.reglages { margin-top: 8px; }

.interrupteur, .valeur { display: flex; align-items: center; justify-content: space-between; gap: 12px; font-size: 14px; min-height: 42px; cursor: pointer; }
.interrupteur input { position: absolute; opacity: 0; pointer-events: none; }
.interrupteur i { flex: none; width: 46px; height: 28px; border-radius: 980px; background: rgba(255, 255, 255, 0.16); position: relative; transition: background .25s; }
.interrupteur i::after { content: ''; position: absolute; top: 2px; left: 2px; width: 24px; height: 24px; border-radius: 50%; background: #fff; box-shadow: 0 3px 8px rgba(0, 0, 0, 0.3); transition: transform .25s; }
.interrupteur input:checked + i { background: var(--vert); }
.interrupteur input:checked + i::after { transform: translateX(18px); }
.interrupteur input:focus-visible + i { outline: 3px solid rgba(70, 227, 240, 0.6); outline-offset: 2px; }
.valeur input { width: 70px; }
.valeur em, .champ em { font-style: normal; color: var(--gris); font-size: 13px; }

input[type=number] {
  font: inherit; font-size: 16px; color: var(--texte); text-align: right; font-variant-numeric: tabular-nums;
  border: 1px solid transparent; background: var(--verre); border-radius: 10px; padding: 8px 10px; -moz-appearance: textfield;
}
input[type=number]:focus { outline: none; border-color: var(--accent); background: rgba(10, 132, 255, 0.12); }
input::-webkit-inner-spin-button, input::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }
.grille2 { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 12px; }
.champ { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 4px 6px; font-size: 13px; }
.champ span { grid-column: 1 / -1; color: var(--gris); }
.champ input { width: 100%; }
.champ[hidden], .interrupteur[hidden] { display: none; }

.puces { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 6px; }
.puces button { border: 1px solid var(--trait); background: var(--verre); border-radius: 980px; padding: 8px 14px; font-size: 13px; font-weight: 500; cursor: pointer; }
.puces button::before { content: '+ '; color: var(--lagon); }
.puces button:hover { border-color: rgba(70, 227, 240, 0.6); }
.nom-esc { font-weight: 600; font-size: 14px; margin: 12px 0 8px; }

.nuancier { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 8px; margin-bottom: 10px; }
.teinte { border: 0; background: none; padding: 0; cursor: pointer; display: grid; justify-items: center; gap: 5px; font-size: 10.5px; color: var(--gris); }
.teinte b { width: 34px; height: 34px; border-radius: 50%; box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.22); transition: box-shadow .2s; }
.teinte.actif b { box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.22), 0 0 0 2px var(--nuit), 0 0 0 4px #fff; }
.teinte.actif { color: var(--texte); font-weight: 600; }

.curseur { display: grid; gap: 6px; font-size: 13px; color: var(--gris); padding: 6px 0; }
input[type=range] { -webkit-appearance: none; appearance: none; width: 100%; height: 28px; background: transparent; cursor: pointer; }
input[type=range]::-webkit-slider-runnable-track { height: 4px; border-radius: 4px; background: rgba(255, 255, 255, 0.18); }
input[type=range]::-moz-range-track { height: 4px; border-radius: 4px; background: rgba(255, 255, 255, 0.18); }
input[type=range]::-webkit-slider-thumb { -webkit-appearance: none; width: 22px; height: 22px; border-radius: 50%; background: #fff; margin-top: -9px; box-shadow: 0 3px 8px rgba(0, 0, 0, 0.4); }
input[type=range]::-moz-range-thumb { width: 22px; height: 22px; border: 0; border-radius: 50%; background: #fff; box-shadow: 0 3px 8px rgba(0, 0, 0, 0.4); }

/* ---------- édition Bati Azur : catalogue des modèles */
html:not([data-edition="batiazur"]) .seulement-batiazur { display: none !important; }
.champ-select { display: grid; gap: 6px; font-size: 13px; color: var(--gris); margin-bottom: 8px; }
.champ-select select {
  font: inherit; font-size: 15px; color: var(--texte); background: var(--verre); border: 1px solid transparent; border-radius: 10px;
  padding: 10px 34px 10px 12px; appearance: none; -webkit-appearance: none; cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' fill='none' stroke='%23A1A1AA' stroke-width='1.6' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 12px center; background-size: 12px 8px;
}
.champ-select select:focus { outline: none; border-color: var(--accent); }
.champ-select optgroup, .champ-select option { background: #121B2E; color: var(--texte); }
#retourner[hidden], #escModele[hidden] { display: none; }
.lanceur { display: inline-flex; align-items: center; color: var(--texte); }

/* ---------- compte */
.compte { border: 0; background: transparent; display: flex; align-items: center; gap: 8px; padding: 2px 10px 2px 2px; border-radius: 980px; cursor: pointer; font-size: 14px; font-weight: 500; min-height: 36px; }
.compte:hover { background: var(--verre); }
.avatar { width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; background: linear-gradient(135deg, var(--lagon), var(--accent)); color: #fff; font-weight: 600; font-size: 14px; flex: none; }
.avatar.vide { background: var(--verre-fort); color: var(--texte); }
.avatar svg { width: 20px; height: 20px; }
.avatar.grand { width: 44px; height: 44px; font-size: 18px; }
#exporter { position: relative; }
#exporter[data-restant]:not([data-restant=''])::after {
  content: attr(data-restant); position: absolute; top: -6px; right: -6px; min-width: 20px; height: 20px; padding: 0 6px;
  border-radius: 980px; background: #fff; color: var(--accent-fonce); font-size: 11px; font-weight: 700; line-height: 20px; text-align: center;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
}
.panneau-compte { position: fixed; top: calc(var(--haut) + 8px); right: max(12px, env(safe-area-inset-right)); width: 340px; max-width: calc(100vw - 24px); z-index: 30; padding: 20px; background: #121B2E; }
.panneau-compte[hidden] { display: none; }
.panneau-compte h3 { font-size: 19px; letter-spacing: -0.02em; margin: 0 0 14px; }
.tete-compte { display: flex; gap: 12px; align-items: center; margin-bottom: 16px; }
.tete-compte b { display: block; font-size: 16px; }
.tete-compte span:not(.avatar) { font-size: 13px; color: var(--gris); word-break: break-all; }
.jauge { background: var(--verre); border-radius: 14px; padding: 14px; margin-bottom: 14px; display: grid; gap: 8px; }
.jauge-texte { font-size: 14px; }
.jauge-texte b { font-size: 22px; letter-spacing: -0.02em; }
.jauge span { font-size: 13px; color: var(--gris); }
.barre-jauge { height: 6px; border-radius: 6px; background: rgba(255, 255, 255, 0.14); overflow: hidden; }
.barre-jauge i { display: block; height: 100%; background: linear-gradient(90deg, var(--lagon), var(--accent)); border-radius: 6px; }
.offre { font-size: 13px; line-height: 1.45; color: var(--gris); margin-bottom: 10px; }
.offre b { display: block; color: var(--texte); font-size: 14px; margin-bottom: 2px; }
.onglets { margin: 0 0 14px; }
.cadeau { font-size: 14px; margin: 0 0 12px; color: var(--gris); }
.cadeau b { color: var(--texte); }
.note { font-size: 13.5px; line-height: 1.4; background: rgba(70, 227, 240, 0.1); color: var(--lagon); border-radius: 10px; padding: 10px 12px; margin: 0 0 12px; }
.form-compte label { display: grid; gap: 6px; font-size: 13px; color: var(--gris); margin-bottom: 10px; }
.form-compte input { font: inherit; font-size: 16px; border: 1px solid transparent; background: var(--verre); border-radius: 10px; padding: 11px 12px; color: var(--texte); }
.form-compte input:focus { outline: none; border-color: var(--accent); background: rgba(10, 132, 255, 0.12); }
.aide-compte { font-size: 12.5px; color: var(--gris); margin: -4px 0 10px; }
.erreur-compte { font-size: 13px; color: var(--rouge); margin: 0 0 10px; }
.erreur-compte[hidden] { display: none; }
.btn.plein { width: 100%; padding: 11px; font-size: 15px; }

/* ---------- tablette */
@media (min-width: 821px) and (max-width: 1180px) {
  .inspecteur { width: 310px; }
  .outils, .statut { transform: translateX(calc(-50% - 165px)); }
}

/* ---------- téléphone : la barre se resserre, l'inspecteur devient une feuille à trois crans */
@media (max-width: 820px) {
  :root { --haut: calc(62px + env(safe-area-inset-top)); }
  .barre { top: calc(8px + env(safe-area-inset-top)); left: 8px; right: 8px; height: 48px; grid-template-columns: auto 1fr auto; gap: 6px; padding: 0 4px 0 10px; border-radius: 14px; }
  .vues { justify-self: center; }
  .vues button { padding: 6px 12px; }
  .marque .logo-long { display: none; }
  .marque .logo-court { display: block; height: 30px; }
  .actions { gap: 2px; }
  .avec-icone span, .texte-compte { display: none; }
  .avec-icone { padding: 8px; width: 36px; height: 36px; justify-content: center; border-radius: 50%; }
  #ouvrir { background: transparent; }
  .compte { padding: 2px; }
  .accueil { padding: 0 22px calc(var(--feuille) + 28px); background-position: 62% 60%; }
  .accueil h1 { font-size: 36px; }
  .accueil p { font-size: 16px; margin-bottom: 20px; }
  .inspecteur {
    top: auto; left: 0; right: 0; bottom: 0; width: auto; max-height: none; border-radius: 22px 22px 0 0;
    height: var(--feuille); padding-bottom: env(safe-area-inset-bottom);
    transition: height .35s cubic-bezier(.2, .8, .2, 1);
    border-bottom: 0; background: var(--chrome-fort);
  }
  .inspecteur.glisse { transition: none; }
  .tete-inspecteur { flex-wrap: wrap; padding: 0 10px 8px; touch-action: none; cursor: grab; }
  .poignee { display: block; width: 100%; height: 22px; position: relative; }
  .poignee::after { content: ''; position: absolute; left: 50%; top: 8px; width: 40px; height: 5px; margin-left: -20px; border-radius: 3px; background: rgba(255, 255, 255, 0.3); }
  .etapes { touch-action: pan-x; }
  .replier, .deplier, body.replie .deplier { display: none; }
  body.replie .inspecteur { transform: none; opacity: 1; pointer-events: auto; }
  .outils, body.replie .outils { bottom: calc(var(--feuille) + 10px); transform: translateX(-50%); }
  .outils button { padding: 0 10px; font-size: 13px; }
  .statut, body.replie .statut { transform: translateX(-50%); max-width: 92vw; }
  .statut span { font-size: 12.5px; padding: 7px 12px; }
  .panneau-compte { right: 8px; left: 8px; width: auto; }
}
@media (max-width: 380px) {
  .marque .logo-court { height: 26px; }
  .vues button { padding: 6px 9px; }
  #annuler { display: none; }
  .outils #zoomValeur { min-width: 52px; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
#champMireTest[hidden] { display: none; }
#escNbMarches { margin: 10px 0 4px; }
#escNbMarches button::before { content: none; }
#escNbMarches button.actif { background: var(--accent, #0A84FF); border-color: transparent; color: #fff; }
