:root {
  --fond: #f4f2ee;
  --panneau: rgba(251, 250, 248, 0.88);
  --panneau-plein: #fbfaf8;
  --encre: #1d1d1f;
  --doux: #6b6a68;
  --ligne: rgba(29, 29, 31, 0.1);
  --accent: #26313d;
  --accent-texte: #ffffff;
  --ombre: 0 8px 28px rgba(20, 20, 24, 0.12), 0 1px 3px rgba(20, 20, 24, 0.08);
  --rayon: 14px;
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Roboto, "Helvetica Neue", Arial, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; background: var(--fond); color: var(--encre); font-family: var(--sans); -webkit-font-smoothing: antialiased; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
canvas#vue { position: fixed; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; cursor: grab; outline: none; }
[hidden] { display: none !important; }

#voile { position: fixed; inset: 0; background: #f7f6f3; opacity: 0; pointer-events: none; transition: opacity 0.18s ease; z-index: 5; }
#voile.visible { opacity: 1; }

.marque-nom { font-family: var(--serif); font-size: 13px; letter-spacing: 0.22em; text-transform: uppercase; color: var(--accent); margin: 0; }
.discret { color: var(--doux); font-weight: 400; }
.petit { font-size: 12px; }

/* chargement */
#chargement, #sans-webgl { position: fixed; inset: 0; z-index: 50; display: grid; place-items: center; background: var(--fond); transition: opacity 0.6s ease; }
#chargement.fini { opacity: 0; pointer-events: none; }
.chargement-carte { width: min(440px, calc(100% - 48px)); text-align: center; }
.chargement-carte h1 { font-family: var(--serif); font-weight: 400; font-size: 30px; margin: 14px 0 6px; letter-spacing: -0.01em; }
.chargement-lieu { color: var(--doux); margin: 0 0 28px; }
.barre { height: 2px; background: var(--ligne); border-radius: 2px; overflow: hidden; }
.barre-remplie { height: 100%; width: 0; background: var(--accent); transition: width 0.3s ease; }
.chargement-etape { display: flex; justify-content: space-between; font-size: 12px; color: var(--doux); margin-top: 10px; font-variant-numeric: tabular-nums; }

/* en-tête */
.entete { position: fixed; top: 16px; left: 16px; z-index: 10; background: var(--panneau); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); border-radius: var(--rayon); padding: 12px 16px; box-shadow: var(--ombre); max-width: calc(100% - 32px); }
.entete-marque { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.entete-sep { width: 1px; height: 14px; background: var(--ligne); }
.entete-titre { font-family: var(--serif); font-size: 17px; }
.entete-infos { margin-top: 4px; font-size: 13px; color: var(--doux); display: flex; gap: 6px; flex-wrap: wrap; }
.entete-infos strong { color: var(--encre); font-weight: 600; }

/* outils */
.outils { position: fixed; top: 16px; right: 16px; z-index: 10; display: flex; gap: 8px; align-items: center; }
.bascule { display: flex; background: var(--panneau); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); border-radius: 999px; padding: 4px; box-shadow: var(--ombre); }
.bascule button { border: 0; background: transparent; padding: 7px 14px; border-radius: 999px; font-size: 13px; color: var(--doux); }
.bascule button.actif { background: var(--accent); color: var(--accent-texte); }
.outil { display: inline-flex; align-items: center; gap: 7px; border: 0; background: var(--panneau); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); border-radius: 999px; padding: 9px 14px; font-size: 13px; box-shadow: var(--ombre); color: var(--encre); }
.outil svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linejoin: round; }
.outil[aria-pressed="true"] { background: var(--accent); color: var(--accent-texte); }
.outil.principal { background: var(--accent); color: var(--accent-texte); }
.outil:focus-visible, .bascule button:focus-visible, .pilule:focus-visible { outline: 2px solid #7aa7d8; outline-offset: 2px; }

/* points de vue */
#points-de-vue { position: fixed; left: 50%; bottom: 20px; transform: translateX(-50%); z-index: 10; display: flex; gap: 6px; padding: 6px; background: var(--panneau); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); border-radius: 999px; box-shadow: var(--ombre); max-width: calc(100% - 470px); overflow-x: auto; scrollbar-width: none; }
#points-de-vue::-webkit-scrollbar { display: none; }
.groupe { display: flex; align-items: center; gap: 2px; padding: 0 2px; border-radius: 999px; white-space: nowrap; }
.groupe-nom { border: 0; background: transparent; font-size: 13px; padding: 7px 8px 7px 12px; border-radius: 999px; color: var(--encre); }
.groupe-num { border: 0; background: transparent; width: 26px; height: 26px; border-radius: 50%; font-size: 12px; color: var(--doux); font-variant-numeric: tabular-nums; }
.groupe-nom:hover, .groupe-num:hover { background: rgba(0, 0, 0, 0.05); }
.groupe.actif .groupe-nom { color: var(--accent); font-weight: 600; }
.groupe-num.actif { background: var(--accent); color: var(--accent-texte); }
.groupe + .groupe { border-left: 1px solid var(--ligne); border-radius: 0; padding-left: 6px; }

.pilule { display: inline-flex; align-items: center; gap: 8px; border: 0; background: var(--panneau); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); border-radius: 999px; padding: 9px 16px; font-size: 13px; box-shadow: var(--ombre); }
.pilule svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.6; }
#btn-comparer { position: fixed; left: 50%; bottom: 76px; transform: translateX(-50%); z-index: 10; }

/* plan */
.carte { position: fixed; left: 16px; bottom: 50px; z-index: 10; width: 196px; background: var(--panneau); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); border-radius: var(--rayon); box-shadow: var(--ombre); padding: 10px 10px 8px; transition: opacity 0.25s ease, transform 0.25s ease; }
.carte.cache { opacity: 0; transform: translateY(8px); pointer-events: none; }
.carte-titre { font-size: 12px; font-weight: 600; margin: 0 2px 6px; }
.plan-svg { display: block; width: 100%; height: auto; cursor: crosshair; }
.plan-piece { fill: #ece7df; }
.plan-placard { fill: #e2ddd4; }
.plan-rampant { fill: rgba(150, 130, 105, 0.12); }
.plan-niche { fill: #f4f0ea; }
.plan-meuble { fill: rgba(255, 255, 255, 0.55); stroke: #c9c1b4; stroke-width: 0.02; }
.plan-tapis { fill: rgba(0, 0, 0, 0.035); stroke: none; }
.plan-mur { fill: #3b3a38; }
.plan-baie { fill: #ece7df; }
.plan-entree { fill: #c38f5a; }
.plan-fenetre { fill: #b9d3e6; }
.plan-velux { fill: rgba(150, 190, 220, 0.35); stroke: #8fb2cc; stroke-width: 0.02; stroke-dasharray: 0.06 0.04; }
.plan-texte { font-size: 0.3px; fill: #6b6a68; font-family: var(--sans); }
.plan-texte.petit { font-size: 0.22px; }
.plan-cone { fill: rgba(38, 49, 61, 0.18); }
.plan-point { fill: var(--accent); stroke: #fff; stroke-width: 0.05; }

/* fiche */
#fiche { position: fixed; top: 0; right: 0; bottom: 0; z-index: 30; width: min(380px, 100%); background: var(--panneau-plein); box-shadow: -10px 0 40px rgba(0, 0, 0, 0.12); padding: 32px 28px; overflow-y: auto; transform: translateX(105%); transition: transform 0.35s cubic-bezier(.2, .8, .2, 1); }
#fiche.ouverte { transform: none; }
#fiche h2 { font-family: var(--serif); font-weight: 400; font-size: 26px; margin: 12px 0 4px; }
.fiche-lieu { color: var(--doux); margin: 0; }
.fiche-loyer { font-size: 22px; font-weight: 600; margin: 18px 0 18px; }
#fiche dl { display: grid; grid-template-columns: auto 1fr; gap: 10px 18px; margin: 0 0 20px; padding: 18px 0; border-top: 1px solid var(--ligne); border-bottom: 1px solid var(--ligne); font-size: 14px; }
#fiche dt { color: var(--doux); }
#fiche dd { margin: 0; text-align: right; }
.fiche-texte { font-size: 14px; line-height: 1.6; color: #3c3c3e; }
.fiche-contact { font-size: 12px; color: var(--doux); text-align: center; margin-top: 14px; }
.fermer { position: absolute; top: 14px; right: 14px; width: 34px; height: 34px; border-radius: 50%; border: 0; background: rgba(0, 0, 0, 0.05); font-size: 20px; line-height: 1; }
.bouton-plein { width: 100%; border: 0; background: var(--accent); color: var(--accent-texte); padding: 13px 18px; border-radius: 12px; font-size: 15px; font-weight: 500; margin-top: 10px; }
.bouton-plein:hover { filter: brightness(1.12); }
.bouton-texte { border: 0; background: transparent; padding: 12px 14px; color: var(--doux); }

/* comparatif */
#comparatif { position: fixed; inset: 0; z-index: 20; pointer-events: none; }
.comparatif-cadre { position: absolute; overflow: hidden; box-shadow: 0 0 0 9999px rgba(18, 18, 20, 0.55); border-radius: 4px; pointer-events: auto; touch-action: none; cursor: ew-resize; }
#comparatif-photo { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: fill; clip-path: inset(0 50% 0 0); user-select: none; -webkit-user-drag: none; }
.comparatif-poignee { position: absolute; top: 0; bottom: 0; width: 2px; left: 50%; background: #fff; box-shadow: 0 0 6px rgba(0, 0, 0, 0.4); }
.comparatif-poignee span { position: absolute; top: 50%; left: 50%; width: 38px; height: 38px; margin: -19px 0 0 -19px; border-radius: 50%; background: #fff; box-shadow: var(--ombre); }
.comparatif-poignee span::before { content: "‹ ›"; position: absolute; inset: 0; display: grid; place-items: center; font-size: 16px; letter-spacing: 4px; color: var(--accent); }
.etiquette { position: absolute; top: 12px; padding: 5px 10px; border-radius: 999px; background: rgba(20, 20, 22, 0.6); color: #fff; font-size: 12px; pointer-events: none; }
.etiquette.gauche { left: 12px; }
.etiquette.droite { right: 12px; }
.comparatif-legende { position: absolute; left: 0; right: 0; text-align: center; color: #fff; font-size: 12px; opacity: 0.85; margin: 0; }
#comparatif-fermer { position: absolute; left: 50%; transform: translateX(-50%); pointer-events: auto; }

/* mode photo, aide, mention */
#indicateur-photo { position: fixed; right: 16px; top: 66px; z-index: 10; display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--doux); background: var(--panneau); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); padding: 6px 12px; border-radius: 999px; box-shadow: var(--ombre); font-variant-numeric: tabular-nums; }
.pastille { width: 7px; height: 7px; border-radius: 50%; background: #c9a35c; }
#indicateur-photo.actif .pastille { background: #4caf7d; animation: pulse 1.6s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: 0.35; } }
.aide { position: fixed; left: 50%; bottom: 76px; transform: translateX(-50%); z-index: 9; font-size: 12px; color: var(--encre); background: var(--panneau); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); padding: 8px 14px; border-radius: 999px; box-shadow: var(--ombre); transition: opacity 0.8s ease; white-space: nowrap; }
.aide.cache { opacity: 0; pointer-events: none; }
kbd { font-family: var(--sans); font-size: 11px; background: rgba(0, 0, 0, 0.06); border-radius: 4px; padding: 1px 5px; }
.mention { position: fixed; left: 18px; bottom: 10px; z-index: 9; margin: 0; font-size: 10.5px; line-height: 1.35; color: rgba(29, 29, 31, 0.66); text-shadow: 0 0 6px rgba(255, 255, 255, 0.9); max-width: 196px; }
#bulle-piece { position: fixed; z-index: 15; pointer-events: none; transform: translate(-50%, -140%); background: var(--accent); color: #fff; font-size: 12px; padding: 5px 10px; border-radius: 999px; white-space: nowrap; }

/* joystick tactile */
#joystick { position: fixed; left: 22px; bottom: 96px; z-index: 11; width: 104px; height: 104px; border-radius: 50%; background: rgba(251, 250, 248, 0.5); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.06), var(--ombre); touch-action: none; }
.joystick-manette { position: absolute; left: 50%; top: 50%; width: 44px; height: 44px; margin: -22px 0 0 -22px; border-radius: 50%; background: rgba(38, 49, 61, 0.85); box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25); }

/* dialogue */
dialog { border: 0; border-radius: 18px; padding: 26px; width: min(420px, calc(100% - 32px)); box-shadow: 0 30px 80px rgba(0, 0, 0, 0.25); background: var(--panneau-plein); }
dialog::backdrop { background: rgba(20, 20, 22, 0.45); backdrop-filter: blur(3px); }
dialog h3 { font-family: var(--serif); font-weight: 400; font-size: 24px; margin: 0 0 4px; }
dialog label { display: block; font-size: 12px; color: var(--doux); margin-top: 12px; }
dialog input, dialog select, dialog textarea { display: block; width: 100%; margin-top: 5px; padding: 10px 12px; border: 1px solid var(--ligne); border-radius: 10px; background: #fff; font-size: 15px; color: var(--encre); }
dialog .actions { display: flex; gap: 8px; margin-top: 18px; }
dialog .actions .bouton-plein { margin-top: 0; flex: 1; }

/* capture de vérification : interface masquée */
body.capture .entete, body.capture .outils, body.capture #points-de-vue, body.capture .carte, body.capture .mention, body.capture #indicateur-photo, body.capture .aide, body.capture #btn-comparer, body.capture #joystick { display: none !important; }

/* tablettes et téléphones */
@media (max-width: 1100px) {
  #points-de-vue { max-width: none; bottom: 12px; left: 12px; right: 12px; transform: none; border-radius: 16px; }
  .carte { width: 150px; bottom: 76px; left: 12px; }
  .mention { left: auto; right: 16px; bottom: 76px; max-width: 220px; text-align: right; }
  .aide { bottom: 124px; }
  #btn-comparer { bottom: 70px; }
}
@media (max-width: 640px) {
  .entete { top: 10px; left: 10px; right: 10px; padding: 10px 12px; }
  .entete-titre { font-size: 15px; }
  .entete-sep { display: none; }
  .outils { top: auto; right: 10px; bottom: 74px; flex-direction: column; align-items: flex-end; gap: 6px; }
  .outil span { display: none; }
  .outil { padding: 10px; }
  .outil.principal span { display: inline; }
  .bascule button { padding: 7px 11px; }
  .carte { width: 128px; bottom: auto; top: 140px; left: auto; right: 10px; }
  .carte-titre .discret { display: none; }
  .mention { top: 112px; bottom: auto; left: 14px; right: 14px; max-width: none; text-align: left; font-size: 9.5px; }
  #indicateur-photo { top: auto; bottom: 280px; right: 10px; }
  .aide { display: none; }
  #joystick { bottom: 84px; left: 14px; }
  #btn-comparer { bottom: 190px; }
  #fiche { width: 100%; top: auto; height: 82%; border-radius: 20px 20px 0 0; transform: translateY(105%); padding: 24px 22px; }
  #fiche.ouverte { transform: none; }
}
