/* HotelDelta V1.18 — stabilité responsive Carte / Couches */

/* Les éléments cachés ne doivent JAMAIS intercepter un tap après rotation. */
#panel-backdrop.hidden,
#layers-panel.hidden,
#dpif-panel.hidden,
#surface-panel.hidden,
#meteo-panel.hidden,
#doctrine-panel.hidden,
#parametres-panel.hidden,
#about-panel.hidden,
#legende-panel.hidden,
#glossaire-panel.hidden,
#info-journaliere-panel.hidden,
#feux-liste-panel.hidden{
  display:none!important;
  pointer-events:none!important;
}
#panel-backdrop:not(.hidden){pointer-events:auto!important}

/* Les contrôles terrain restent toujours interactifs. */
#hd-map-tools,
#hd-map-tools button,
#hd-map-home,
.maplibregl-ctrl-top-right,
.maplibregl-ctrl-top-right button{
  pointer-events:auto!important;
}

/* Carte & couches : portrait uniquement.
   La marge droite exacte est ensuite calculée en JS depuis la position réelle
   du rail d'outils : le panneau ne peut donc jamais passer dessous. */
@media (orientation:portrait){
  #layers-panel{
    position:fixed!important;
    left:calc(12px + env(safe-area-inset-left,0px))!important;
    right:112px!important; /* repli avant mesure JS */
    top:auto!important;
    bottom:calc(96px + env(safe-area-inset-bottom,0px))!important;
    width:auto!important;
    max-width:none!important;
    height:auto!important;
    min-height:0!important;
    max-height:min(54dvh,590px)!important;
    margin:0!important;
    overflow-x:hidden!important;
    overflow-y:auto!important;
    box-sizing:border-box!important;
    z-index:9700!important;
  }
}

/* Le rail doit rester au-dessus du panneau pour permettre la fermeture. */
#hd-map-tools{z-index:9850!important}

/* Aucun ancien style V1.17 ne doit déformer le bouton Couches. */
#hd-map-tools #btn-layers{
  position:relative!important;
  inset:auto!important;
  left:auto!important;
  right:auto!important;
  top:auto!important;
  bottom:auto!important;
  width:46px!important;
  min-width:46px!important;
  max-width:46px!important;
  margin:0!important;
  box-sizing:border-box!important;
}
