:root{
  --navy:#1A2B5E;
  --cyan:#2B9FE8;
  --beige:#F1E9E9;
  --red:#D64545;
}
*{box-sizing:border-box;}
html,body{margin:0;padding:0;height:100%;font-family:'Poppins',system-ui,sans-serif;background:#000;overflow:hidden;}
#map{position:absolute;top:0;left:0;right:0;bottom:0;background:#0b1430;}

/* bandeau statut haut (heure / batterie / gps) */
#statusBar{
  position:absolute;top:0;left:0;right:0;height:26px;z-index:20;
  background:rgba(26,43,94,.92);color:var(--beige);
  display:flex;align-items:center;justify-content:space-between;
  padding:0 12px;font-size:12px;font-weight:600;
}

/* en-tête : météo + nom de la sortie */
#header{
  position:absolute;top:26px;left:0;right:0;height:52px;z-index:19;
  background:linear-gradient(180deg,rgba(26,43,94,.85),rgba(26,43,94,0));
  display:flex;align-items:center;gap:10px;padding:6px 12px;color:var(--beige);
  pointer-events:none;
}
#header .meteo{display:flex;align-items:center;gap:6px;font-size:13px;font-weight:600;background:rgba(0,0,0,.25);padding:4px 10px;border-radius:12px;pointer-events:auto;}
#header .sortie{font-size:12px;opacity:.9;margin-left:auto;background:rgba(0,0,0,.2);padding:4px 10px;border-radius:12px;}

/* pile de contrôles à droite : zoom, curseur, GPS */
#controls{
  position:absolute;top:84px;right:14px;z-index:22;display:flex;flex-direction:column;align-items:flex-end;gap:10px;
}
.ctrlGroup{
  background:rgba(26,43,94,.88);border-radius:14px;padding:6px;display:flex;flex-direction:column;gap:6px;
  box-shadow:0 3px 10px rgba(0,0,0,.35);
}
.ctrlBtn{
  width:40px;height:40px;border-radius:10px;border:none;background:rgba(255,255,255,.08);
  color:var(--beige);font-size:19px;font-weight:700;display:flex;align-items:center;justify-content:center;
}
.ctrlBtn:active{background:rgba(255,255,255,.22);}

#blendBox{
  background:rgba(26,43,94,.9);border-radius:13px;padding:10px 12px;width:150px;z-index:22;
}
#blendBox input[type=range]{width:100%;}
#blendBox .labels{display:flex;justify-content:space-between;font-size:12px;font-weight:700;color:var(--beige);margin-top:5px;}

/* boutons d'alerte (haut droit, sous le header) */
#alertStack{position:absolute;top:84px;left:14px;z-index:22;display:flex;flex-direction:column;gap:10px;align-items:flex-start;}
.btnAlerte{
  width:62px;height:62px;border-radius:50%;background:var(--red);border:3.5px solid #fff;
  box-shadow:0 3px 10px rgba(0,0,0,.4);color:#fff;font-weight:700;font-size:11px;line-height:1.1;
  display:flex;align-items:center;justify-content:center;text-align:center;padding:2px;
}
.btnAlerte:active{filter:brightness(.9);}
.btn112{
  width:46px;height:46px;border-radius:50%;background:#fff;border:2.5px solid var(--red);
  color:var(--red);display:flex;flex-direction:column;align-items:center;justify-content:center;
  text-decoration:none;box-shadow:0 3px 8px rgba(0,0,0,.3);
}
.btn112 span{font-size:9.5px;font-weight:700;margin-top:1px;}

/* bandeau bas : stats de sortie */
#bottomBar{
  position:absolute;bottom:0;left:0;right:0;z-index:20;
  background:rgba(26,43,94,.92);color:var(--beige);padding:8px 14px 12px;
  display:flex;justify-content:space-between;align-items:center;font-size:12px;
}
#bottomBar .stat{display:flex;flex-direction:column;align-items:center;min-width:52px;}
#bottomBar .stat b{font-size:14px;}
#bottomBar .stat small{opacity:.8;font-size:10px;}

/* indicateur hors-ligne */
#offlineBadge{
  position:absolute;left:14px;bottom:62px;z-index:21;background:rgba(0,0,0,.55);color:var(--beige);
  font-size:11px;padding:5px 10px;border-radius:10px;display:flex;align-items:center;gap:6px;
}
#offlineBadge .dot{width:8px;height:8px;border-radius:50%;background:#888;}
#offlineBadge.ready .dot{background:#3CCB7F;}
#offlineBadge.loading .dot{background:#E8A93B;animation:pulse 1s infinite;}
@keyframes pulse{50%{opacity:.3;}}

/* compteur inscrits connectés */
#ridersBadge{
  position:absolute;right:14px;bottom:62px;z-index:21;background:rgba(0,0,0,.55);color:var(--beige);
  font-size:11px;padding:5px 10px;border-radius:10px;
}

/* bouton import GPX + bouton téléchargement hors-ligne, regroupés en bas du bandeau de contrôle */
#fileImport{display:none;}
#importBtn,#downloadBtn{
  width:40px;height:40px;border-radius:10px;border:none;background:rgba(255,255,255,.08);
  color:var(--beige);font-size:17px;display:flex;align-items:center;justify-content:center;
}

.leaflet-control-attribution{font-size:9px;}

/* écran de motif d'alerte (14/11) */
#motifOverlay,#messageOverlay{
  position:fixed;top:0;left:0;right:0;bottom:0;z-index:50;background:rgba(0,0,0,.62);
  display:none;align-items:flex-end;justify-content:center;
}
#motifOverlay.open,#messageOverlay.open{display:flex;}
#motifPanel,#messagePanel{
  width:100%;max-width:420px;background:var(--navy);border-radius:18px 18px 0 0;padding:18px 16px 22px;
  box-shadow:0 -4px 20px rgba(0,0,0,.5);
}
#motifTitle,#messageTitle{color:var(--beige);font-weight:700;font-size:16px;text-align:center;margin-bottom:14px;}
#motifGrid,#messageGrid{display:grid;grid-template-columns:repeat(3,1fr);gap:10px;}
.motifBtn,.msgBtn{
  background:rgba(255,255,255,.08);border:none;border-radius:14px;color:var(--beige);
  display:flex;flex-direction:column;align-items:center;justify-content:center;gap:6px;
  padding:14px 4px;font-size:26px;min-height:78px;
}
.motifBtn span,.msgBtn span{font-size:12px;font-weight:700;line-height:1.15;text-align:center;}
.motifBtn:active{background:var(--red);}
.msgBtn:active{background:var(--cyan);}
#motifCancel,#messageCancel{
  width:100%;margin-top:14px;background:transparent;border:1.5px solid rgba(241,233,233,.4);
  color:var(--beige);border-radius:12px;padding:12px;font-size:14px;font-weight:600;
}
#alertToast{
  position:fixed;left:50%;bottom:90px;transform:translateX(-50%) translateY(20px);
  background:var(--red);color:#fff;font-weight:700;font-size:13px;padding:10px 18px;border-radius:12px;
  opacity:0;pointer-events:none;transition:opacity .25s, transform .25s;z-index:60;white-space:nowrap;
  box-shadow:0 3px 10px rgba(0,0,0,.4);
}
#alertToast.show{opacity:1;transform:translateX(-50%) translateY(0);}

.ctrlBtn.active{background:var(--cyan);}

/* tableau de bord encadrant + résumé de sortie (14/11) */
#dashboardOverlay,#summaryOverlay{
  position:fixed;top:0;left:0;right:0;bottom:0;z-index:55;background:rgba(0,0,0,.65);
  display:none;align-items:center;justify-content:center;padding:16px;
}
#dashboardOverlay.open,#summaryOverlay.open{display:flex;}
#dashboardPanel,#summaryPanel{
  width:100%;max-width:420px;max-height:85vh;overflow:auto;background:var(--navy);border-radius:16px;
  padding:18px 16px;box-shadow:0 6px 24px rgba(0,0,0,.5);
}
#dashboardTitle,#summaryTitle{color:var(--beige);font-weight:700;font-size:17px;margin-bottom:12px;text-align:center;}
#dashboardWarnings{margin-bottom:10px;}
.dashWarning{
  background:rgba(214,69,69,.25);border:1px solid var(--red);color:var(--beige);
  border-radius:10px;padding:8px 10px;font-size:12.5px;margin-bottom:6px;
}
#dashboardList{display:flex;flex-direction:column;gap:8px;margin-bottom:16px;}
.dashRow{
  background:rgba(255,255,255,.06);border-radius:10px;padding:9px 12px;color:var(--beige);
  display:flex;justify-content:space-between;align-items:center;font-size:13.5px;
}
.dashRow .who{font-weight:700;}
.dashRow .meta{opacity:.8;font-size:12px;}
#dashboardActions{display:flex;flex-direction:column;gap:9px;margin-bottom:12px;}
#dashboardActions button{
  background:rgba(255,255,255,.1);border:none;color:var(--beige);border-radius:10px;
  padding:12px;font-size:14px;font-weight:600;text-align:left;
}
#dashboardActions button:active{background:var(--cyan);}
#dashboardClose,#summaryClose{
  width:100%;background:transparent;border:1.5px solid rgba(241,233,233,.4);color:var(--beige);
  border-radius:12px;padding:11px;font-size:14px;font-weight:600;
}
#summaryGrid{display:grid;grid-template-columns:1fr 1fr;gap:10px;margin-bottom:16px;}
.sumStat{background:rgba(255,255,255,.08);border-radius:12px;padding:14px;text-align:center;color:var(--beige);}
.sumStat b{display:block;font-size:22px;}
.sumStat small{font-size:11px;opacity:.8;}

/* marqueur GPS en V orienté cap */
.gps-arrow{
  width:0;height:0;border-left:9px solid transparent;border-right:9px solid transparent;
  border-bottom:20px solid var(--cyan);filter:drop-shadow(0 0 3px rgba(0,0,0,.6));
}
