html, body { height: 100%; margin: 0; }
body { background:#fff; color:#111; font-family: system-ui, sans-serif; }

:root{
  --topbar-h: 64px;
}


.map-page{
  height: 100%;
  display:flex;
  flex-direction: column;
}

.map-topbar{
  height: 64px;
  display:flex;
  align-items:center;
  justify-content: space-between;
  padding: 0 18px;
  border-bottom: 1px solid rgba(0,0,0,0.08);
  background: #fff;
}

.map-title{
  font-weight: 900;
  letter-spacing: 0.12em;
  font-size: 14px;
  text-transform: uppercase;
}

.map-actions{
  display:flex;
  gap: 10px;
  align-items:center;
}

.btn{
  appearance:none;
  border: 1px solid rgba(0,0,0,0.12);
  background: #fff;
  padding: 5px 12px;
  border-radius: 12px;
  font-weight: 700;
  cursor: pointer;
  height: 40px;
  display: inline-flex;        
  align-items: center; 
}
.btn:hover{ filter: brightness(0.98); }

.btn-label--mobile {
  display: none;
}
.btn-icon-left {
  margin-right: 6px;
  font-size: 1.1em;
  line-height: 1;
  
}


/* Mobile */
@media (max-width: 720px) {
  .btn-label--desktop {
    display: none;
  }
  .btn-label--mobile {
    display: inline;
  }

}

.title-mobile {
  display: none;
}
.btn-icon i{
  font-size: 20px;
}

/* ✅ NOUVEAU : le conteneur map devient flex + relative */
.map-stage{
  position: relative;
  flex: 1;
  display: flex;
  min-height: 0; /* ✅ important dans un layout flex */
}

/* ✅ IMPORTANT : Leaflet doit avoir une hauteur réelle */
#map{
  flex: 1;
  width: 100%;
  height: 100%;
}

/* petit panneau info */
.map-hint{
  position:absolute;
  left: 50px;
  top: 18px;     /* ✅ au lieu de 84px (sinon ça part loin) */
  z-index: 500;
  background: rgba(255,255,255,0.92);
  border: 1px solid rgba(0,0,0,0.10);
  border-radius: 14px;
  padding: 10px 12px;
  font-size: 12px;
  max-width: 320px;
  box-shadow: 0 14px 40px rgba(0,0,0,0.08);
}

/* PIN FRAGMENT */

.frag-pin{
  background: transparent !important;
  border: 0 !important;
}

/* carré */
.frag-pin__box{
  width: 56px;
  height: 56px;
  border-radius: 14px;
  border: 2px solid var(--black-brand) ;
  box-shadow: 0 14px 35px rgba(0,0,0,0.18);

  background-color: #fff;
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;

  overflow: hidden;
  position: relative;
}

/* fallback "?" si pas d'image */
.frag-pin__fallback{
  width: 100%;
  height: 100%;
  display:flex;
  align-items:center;
  justify-content:center;
  font-weight: 900;
  font-size: 20px;
  color: rgba(0,0,0,0.55);
}

/* pointe */
.frag-pin__tip{
  width: 0;
  height: 0;
  margin: -2px auto 0; /* colle la pointe au carré (en compensant la bordure) */
  border-left: 10px solid transparent;
  border-right: 12px solid transparent;
  border-top: 14px solid var(--black-brand);
  filter: drop-shadow(0 8px 12px rgba(0,0,0,0.12));
}

/* petit triangle blanc par-dessus pour faire une pointe “border” propre */
.frag-pin__tip::after{
  content:"";
  position: relative;
  display:block;
  top: -14px;
  left: -8px;
  width: 0;
  height: 0;
  border-left: 8px solid transparent;
  border-right: 8px solid transparent;
  border-top: 12px solid #fff;
}
.frag-pin__img{
  position: absolute;
  inset: 6px;              /* ✅ change ça (6px -> 10px etc.) */
  border-radius: 10px;
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
}

.leaflet-control-attribution{
  display: none !important;
}

/* WAYPOINT STYLE */
.waypoint {
  width: 22px;
  height: 22px;
  border-radius: 999px;
  background: #111;
  color: #fff;
  font-weight: 800;
  font-size: 12px;
  display: grid;
  place-items: center;
  box-shadow:
    0 0 0 3px rgba(255,255,255,0.9),
    0 10px 20px rgba(0,0,0,0.18);
}

.waypoint::after{
  content:"";
  position:absolute;
  width: 34px;
  height: 34px;
  border-radius: 999px;
  background: rgba(0,0,0,0.08);
  transform: translate(-6px,-6px);
  z-index: -1;
}

/* ///////// CARTE INFO //////////////
/* =========================
   Leaflet popup wrapper
   ========================= */
/* =========================
   Leaflet popup sizing
   ========================= */

.leaflet-popup-content-wrapper{
  border-radius: 18px;
  padding: 12px;              /* ✅ tu gardes du padding côté Leaflet */
}

.leaflet-popup-content{
  margin: 0;
  width: auto !important;

  /* desktop: un peu plus petit */
  max-width: min(520px, calc(100vw - 28px)) !important;
  min-width: min(380px, calc(100vw - 28px)) !important;
}


/* =========================
   Carte interne (2 colonnes)
   ========================= */

.frag-card{
  display: flex;
  align-items: flex-start;
  gap: 12px;
  max-width: 100%;
}

/* Colonne gauche : texte */
.frag-card__body{
  flex: 1 1 auto;
  min-width: 0; /* ✅ pour le wrap des longues adresses */
}

/* Titre */
.frag-card__title{
  font-weight: 900;
  letter-spacing: 0.08em;
  font-size: 16px;
  margin: 0 0 8px;
}

/* Bloc label + valeur (valeur dessous) */
.frag-card__block{
  margin-top: 10px;
  display: flex;
  flex-direction: row;
  gap: 3px;
}

.frag-card__label{
  font-weight: 900;
  opacity: .85;
  font-size: 13px;
  margin-bottom: 3px;
}

.frag-card__value{
  font-weight: 600;
  font-size: 13px;
  line-height: 1.25;
  overflow-wrap: anywhere; /* ✅ casse les longues adresses */
}


/* Colonne droite : image + bouton dessous */
.frag-card__media{
  flex: 0 0 120px;          /* largeur de la colonne droite */
  display: flex;
  flex-direction: column;   /* ✅ empile image puis bouton */
  gap: 8px;
  align-items: stretch;     /* bouton = largeur colonne */
}

.frag-card__img{
  width: 80px;
  height: 80px;
  border-radius: 14px;
  border: 1px solid rgba(0,0,0,0.14);
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
}

/* Bouton infos sous l’image */
.frag-card__btn{
  width: 80px;
  padding: 8px 10px;
  border-radius: 12px;
  border: 1px solid rgba(0,0,0,0.18);
  background: #fff;
  font-weight: 900;
  font-size: 13px;
  cursor: pointer;
}

.frag-card__btn:hover{
  filter: brightness(0.98);
}


/* =========================
   ULTRA COMPACT MOBILE
   ========================= */
@media (max-width: 520px){

  .leaflet-popup-content{
    max-width: min(320px, calc(100vw - 22px)) !important;
    min-width: min(320px, calc(100vw - 22px)) !important;
  }

  .leaflet-popup-content-wrapper{
    border-radius: 14px;
    padding: 10px;
  }

  .frag-card{
    gap: 10px;
  }

  .frag-card__title{
    font-size: 13px;
    letter-spacing: 0.06em;
    margin-bottom: 6px;
  }

  .frag-card__label,
  .frag-card__value{
    font-size: 12px;
  }

  .frag-card__block{
    margin-top: 8px;
  }

  .frag-card__media{
    flex: 0 0 86px;
    gap: 6px;
  }

  .frag-card__img{
    width: 86px;
    height: 86px;
    border-radius: 12px;
  }

  .frag-card__btn{
    padding: 6px 8px;
    border-radius: 10px;
    font-size: 12px;
  }
}

/* Très petits écrans */
@media (max-width: 360px){
  .leaflet-popup-content{
    max-width: min(300px, calc(100vw - 18px)) !important;
    min-width: min(300px, calc(100vw - 18px)) !important;
  }
  .frag-card__media{ flex: 0 0 78px; }
  .frag-card__img{ width: 78px; height: 78px; }
}












/* ======== LISTE des FRAGMENTS DRAWER ======




/* =========================
   Drawer "Liste des fragments"
   ========================= */

.frag-drawer{
  position: fixed;
  left: 0;
  right: 0;
  top: var(--topbar-h);
  bottom: 0;
  z-index: 9999;

  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity .18s ease, visibility .18s ease;
}


.frag-drawer.is-open{
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}


.frag-drawer__overlay{
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0); /* ✅ moins sombre */
}


.frag-drawer__panel{
  position: absolute;
  top: 0;
  right: 0;
  height: 100%;
  width: min(420px, calc(100vw - 32px));
  background: #fff;
  border-left: 1px solid rgba(0,0,0,0.10);
  box-shadow: 0 24px 80px rgba(0,0,0,0.22);

  transform: translateX(110%);
  transition: transform .22s cubic-bezier(.2,.8,.2,1);

  display: flex;
  flex-direction: column;
}

.frag-drawer.is-open .frag-drawer__panel{
  transform: translateX(0);
}

.frag-drawer__head{
  height: 64px;
  padding: 0 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border-bottom: 1px solid rgba(0,0,0,0.08);
}

.frag-drawer__title{
  font-weight: 900;
  letter-spacing: 0.08em;
  font-size: 12px;
  text-transform: uppercase;
}

.frag-drawer__body{
  padding: 12px;
  overflow: auto;
}

/* Mobile: panneau qui monte du bas */
@media (max-width: 720px){
  .frag-drawer__panel{
    left: 0;
    right: 0;
    top: auto;
    bottom: 0;
    width: 100%;
    height: min(72vh, 640px);
    border-left: 0;
    border-top: 1px solid rgba(0,0,0,0.10);
    border-radius: 18px 18px 0 0;

    transform: translateY(110%);
  }
  .frag-drawer.is-open .frag-drawer__panel{
    transform: translateY(0);
  }
  .btn-back {
    display: none;
  }
    .title-full {
    display: none;
  }

  .title-mobile {
    display: inline;
  }

}


/* =========================
   Liste fragments (cartes)
   2 colonnes: infos + photo
   ========================= */

.frag-list{
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.frag-item{
  display: grid;
  grid-template-columns: 1fr 68px; /* infos + photo */
  gap: 10px;
  padding: 10px;
  border-radius: 14px;
  border: 1px solid rgba(0,0,0,0.10);
  background: #fff;
  cursor: pointer;
}

.frag-item:hover{
  filter: brightness(0.99);
}

.frag-item__meta{
  min-width: 0;
}

.frag-item__title{
  font-weight: 900;
  letter-spacing: 0.06em;
  font-size: 12px;
  text-transform: uppercase;
  margin-bottom: 6px;
}

.frag-item__row{
  font-size: 12px;
  line-height: 1.25;
  margin-top: 3px;
  overflow-wrap: anywhere;
}

.frag-item__label{
  font-weight: 900;
  opacity: .78;
}

.frag-item__value{
  font-weight: 700;
}

.frag-item__timer{
  margin-top: 6px;
  font-size: 12px;
  font-weight: 900;
}

.frag-item__timer.is-expired{
  opacity: .6;
}

/* timer affiché (00:00:00 ou LOST) */
.timer{
  font-weight: 900; /* gras */
}

.timer--active{
  color: var(--accent);
}

.timer--lost{
  color: var(--accentbluedark);
}

.frag-item__photo{
  width: 68px;
  height: 68px;
  border-radius: 12px;
  border: 2px solid rgba(0,0,0,0.10);
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
}

.frag-item__fallback{
  display: grid;
  place-items: center;
  font-weight: 900;
  color: rgba(0,0,0,0.55);
}

.relaybar{
  position: relative;
  height: 22px;
  border: 1px solid #eeeeee;
  border-radius: 8px;
  overflow: hidden;
  margin-top: 8px;

  /* ✅ le dégradé est SUR TOUTE la barre */
  background: linear-gradient(
    90deg,
    var(--accentblue),
    var(--accent)
  );
}

/* ✅ cache noir qui masque la partie NON remplie */
.relaybar__cover{
  position: absolute;
  top: 0;
  bottom: 0;
  right: 0;
  left: var(--pct);   /* ← commence au % rempli */
  background: #000000;
}

/* label centré comme toi */
.relaybar__label{
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 400;
  color: #ffffff;
  pointer-events: none;
  font-size: 14px;
}
/* Mobile: encore plus compact */
@media (max-width: 520px){
  .frag-item{
    grid-template-columns: 1fr 58px;
    padding: 9px;
    border-radius: 12px;
  }
  .frag-item__photo{
    width: 58px;
    height: 58px;
    border-radius: 10px;
  }
  .frag-item__title{
    font-size: 11px;
  }
  .frag-item__row,
  .frag-item__timer{
    font-size: 11px;
  }
}





/* =========================
   Drawer "Infos fragment" (même comportement que frag-drawer)
   ========================= */

.info-drawer{
  position: fixed;
  left: 0;
  right: 0;
  top: var(--topbar-h);
  bottom: 0;
  z-index: 9999;

  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity .18s ease, visibility .18s ease;
}

.info-drawer.is-open{
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

.info-drawer__overlay{
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0); /* même overlay "léger" */
}

.info-drawer__panel{
  position: absolute;
  top: 0;
  right: 0;
  height: 100%;
  width: min(520px, calc(100vw - 32px));
  background: #fff;

  border-left: 1px solid rgba(0,0,0,0.10);
  box-shadow: 0 24px 80px rgba(0,0,0,0.22);

  transform: translateX(110%);
  transition: transform .22s cubic-bezier(.2,.8,.2,1);

  display: flex;
  flex-direction: column;
}

.info-drawer.is-open .info-drawer__panel{
  transform: translateX(0);
}

/* Head (même hauteur que le drawer liste) */
.info-drawer__head{
  height: 64px;
  padding: 0 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border-bottom: 1px solid rgba(0,0,0,0.08);
}

.info-drawer__title{
  font-weight: 900;
  letter-spacing: 0.08em;
  font-size: 12px;
  text-transform: uppercase;
}

.info-drawer__body{
  padding: 12px;
  overflow: auto;
}

/* Photo en haut à droite */
.info-drawer__head-right{
  display: flex;
  align-items: center;
  gap: 10px;
}

.info-drawer__thumb{
  width: 44px;
  height: 44px;
  border-radius: 12px;
  border: 1px solid rgba(0,0,0,0.14);
  background: #f2f2f2 center/cover no-repeat;
}

/* Grille de champs */
.info-grid{
  display: grid;
  gap: 12px;
}

.info-row{
  display: grid;
  grid-template-columns: 160px 1fr;
  gap: 10px;
  align-items: baseline;
}

.info-label{
  font-weight: 900;
  opacity: .78;
  font-size: 12px;
  text-transform: none;
}

.info-value{
  font-weight: 700;
  font-size: 13px;
  overflow-wrap: anywhere;
}

/* Mobile : panneau qui monte du bas (même que frag-drawer) */
@media (max-width: 720px){
  .info-drawer__panel{
    left: 0;
    right: 0;
    top: auto;
    bottom: 0;
    width: 100%;
    height: min(72vh, 640px);
    border-left: 0;
    border-top: 1px solid rgba(0,0,0,0.10);
    border-radius: 18px 18px 0 0;

    transform: translateY(110%);
  }

  .info-drawer.is-open .info-drawer__panel{
    transform: translateY(0);
  }

  .info-row{
    grid-template-columns: 1fr;
  }
}

/* ===== INFO DRAWER - HERO ===== */
.info-hero{
  display: grid;
  grid-template-columns: 180px 1fr;
  gap: 30px;
  align-items: start;
  padding: 6px 0 10px;
}

/* .info-hero__meta{
  display: flex;
  align-items: flex-start;
  flex-direction: column;
} */

.info-hero__media{
  width: 100%;
  height: 180px;
  border-radius: 18px;
  background: #f2f2f2 center/cover no-repeat;
  border: 1px solid rgba(0,0,0,0.10);
}

.info-hero__title{
  font-weight: 1000;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-size: 18px;
  margin-bottom: 10px;
}

.info-hero__stats{
  display:flex;
  gap: 10px;
  align-items:center;
}

/* Badge "Relais" */
.relay-pill{
  border: 1px solid rgba(0,0,0,0.12);
  border-radius: 16px;
  padding: 10px 12px;
  display: inline-flex;
  align-items: baseline;
  gap: 10px;
  background: #fff;
}
.relay-timer{
  margin-top: 8px;
  font-weight: 900;
  letter-spacing: .06em;
  font-size: 14px;
}
.relay-timer .timer{
  font-weight: 900;
}

.relay-pill__label{
  font-weight: 900;
  opacity: .65;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: .06em;
}

.relay-pill__value{
  font-weight: 1000;
  font-size: 22px;
  line-height: 1;
}

/* Séparations + titres de section */
.info-sep{
  border: 0;
  border-top: 1px solid rgba(0,0,0,0.08);
  margin: 14px 0;
}

.info-section-title{
  font-weight: 900;
  letter-spacing: 0.08em;
  font-size: 11px;
  text-transform: uppercase;
  opacity: .75;
  margin: 0 0 10px;
}

/* Grille plus élégante sur desktop */
@media (max-width: 720px){
  .info-grid{
    gap: 10px;
  }

  .info-row{
    display: flex;          /* au lieu de grid */
    align-items: baseline;
    gap: 6px;
  }

  .info-label{
    font-weight: 900;
    font-size: 13px;
    opacity: .7;
    white-space: nowrap;
  }

  .info-label::after{
    content: " :";
  }

  .info-value{
    font-weight: 700;
    font-size: 14px;
  }
}

@media (max-width: 720px){
  .info-hero{
    grid-template-columns: 96px 1fr; /* image + texte */
    gap: 12px;
    align-items: center;
  }

  .info-hero__media{
    width: 96px;
    height: 96px;          /* ✅ carré */
    border-radius: 16px;
  }

  .info-hero__title{
    font-size: 16px;
    margin-bottom: 8px;
  }

  .info-hero__stats{
    justify-content: flex-start;
  }

  .relay-pill{
    padding: 8px 10px;
    border-radius: 14px;
  }

  .relay-pill__value{
    font-size: 18px;
  }
}

