/* ============================================================
   Thème cyberpunk — noir & bleu néon
   ============================================================ */

:root {
  --bg: #06080f;
  --bg-panel: #0a0f1c;
  --bg-panel-2: #0d1526;
  --neon: #29b6ff;
  --neon-dim: #1477b8;
  --neon-glow: rgba(41, 182, 255, 0.55);
  --magenta: #ff2e88;
  --text: #cfe6f5;
  --text-dim: #7c93a6;
  --danger: #ff4d4d;
  --ok: #38e88b;
  --border: rgba(41, 182, 255, 0.25);
  --font-title: "Orbitron", sans-serif;
  --font-body: "Rajdhani", sans-serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

/* L'attribut hidden doit toujours l'emporter, même sur un display: flex. */
[hidden] { display: none !important; }

html, body {
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  overflow: hidden;
}

body {
  background: radial-gradient(ellipse at 50% -10%, #0c1a33 0%, var(--bg) 55%);
}

/* Fond réactif (canvas), tout au fond */
#fond {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
}

/* Scanlines très légères par-dessus tout */
body::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 5000;
  pointer-events: none;
  background: repeating-linear-gradient(
    0deg,
    rgba(255, 255, 255, 0.025) 0px,
    rgba(255, 255, 255, 0.025) 1px,
    transparent 1px,
    transparent 3px
  );
}

/* ---------- Barre du haut ---------- */

.topbar {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: 56px;
  z-index: 1100;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 18px;
  background: linear-gradient(180deg, rgba(10, 15, 28, 0.97), rgba(10, 15, 28, 0.88));
  border-bottom: 1px solid var(--border);
  box-shadow: 0 0 24px rgba(41, 182, 255, 0.12);
}

.topbar-title {
  display: flex;
  align-items: baseline;
  gap: 10px;
}

.topbar-title .glyph {
  color: var(--neon);
  font-size: 18px;
  text-shadow: 0 0 8px var(--neon-glow);
}

.topbar h1 {
  font-family: var(--font-title);
  font-weight: 900;
  font-size: 20px;
  letter-spacing: 3px;
  color: #fff;
  text-shadow: 0 0 12px var(--neon-glow);
}

.topbar h1 .accent { color: var(--neon); }

.topbar .subtitle {
  font-size: 14px;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--text-dim);
}

.topbar-right { display: flex; gap: 10px; }

.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
  font-family: var(--font-title);
  font-size: 10px;
  letter-spacing: 2px;
  padding: 5px 10px;
  border: 1px solid var(--border);
  border-radius: 3px;
  color: var(--text-dim);
  background: rgba(41, 182, 255, 0.05);
}

.topbar-right { flex-shrink: 0; }
.topbar-title { min-width: 0; }
.topbar h1 { white-space: nowrap; }

.badge-role { color: var(--neon); }

.badge-bouton {
  cursor: pointer;
  transition: border-color 0.15s, color 0.15s;
}
.badge-bouton:hover { color: #fff; border-color: var(--neon); }
.badge-actif { color: var(--neon); border-color: var(--neon); background: rgba(41, 182, 255, 0.12); }

/* ---------- Carte ---------- */

#map {
  position: fixed;
  inset: 56px 0 30px 0;
  z-index: 1;
  background: transparent;
  cursor: crosshair;
  opacity: 0;
  transition: opacity 0.9s ease-out;
}
#map.pret { opacity: 1; }

.leaflet-container { background: transparent; font-family: var(--font-body); }

/* Contrôles zoom */
.leaflet-bar a {
  background: var(--bg-panel) !important;
  color: var(--neon) !important;
  border-color: var(--border) !important;
}
.leaflet-bar a:hover { background: var(--bg-panel-2) !important; }

/* ---------- Label district (survol) ---------- */

.leaflet-tooltip.district-label {
  background: rgba(10, 15, 28, 0.92);
  border: 1px solid var(--neon-dim);
  border-radius: 3px;
  box-shadow: 0 0 12px rgba(41, 182, 255, 0.2);
  color: var(--neon);
  font-family: var(--font-title);
  font-size: 11px;
  letter-spacing: 2px;
  text-transform: uppercase;
  padding: 4px 10px;
}
.leaflet-tooltip.district-label::before { display: none; }

/* ---------- Pins ---------- */

.pin {
  position: relative;
  width: var(--pin, 22px);
  height: var(--pin, 22px);
  animation: pin-spawn 0.6s cubic-bezier(.2,.9,.3,1.3) both;
}

@keyframes pin-spawn {
  from { transform: scale(0); opacity: 0; }
  to   { transform: scale(1); opacity: 1; }
}

.pin .pin-core {
  position: absolute;
  inset: 5px;
  border-radius: 50%;
  background: var(--neon);
  box-shadow: 0 0 10px var(--neon-glow), 0 0 22px var(--neon-glow);
}

.pin .pin-ring {
  position: absolute;
  inset: 0;
  border: 2px solid var(--neon);
  border-radius: 50%;
  animation: pin-pulse 2s ease-out infinite;
}

.pin.pin-complete .pin-core { background: var(--magenta); box-shadow: 0 0 10px rgba(255,46,136,.5); }
.pin.pin-complete .pin-ring { border-color: var(--magenta); animation: none; opacity: .5; }

/* Run jouée : pin éteint, cerclé, sans pulsation */
.pin.pin-jouee .pin-core { background: var(--bg-panel); box-shadow: inset 0 0 0 2px var(--text-dim); }
.pin.pin-jouee .pin-ring { border-color: var(--text-dim); border-style: dashed; animation: none; opacity: .7; }

/* Run annulée : rouge sombre */
.pin.pin-annulee .pin-core { background: var(--danger); opacity: .6; box-shadow: none; }
.pin.pin-annulee .pin-ring { border-color: var(--danger); animation: none; opacity: .3; }

@keyframes pin-pulse {
  0%   { transform: scale(0.7); opacity: 1; }
  100% { transform: scale(2.1); opacity: 0; }
}

/* ---------- Sidebar run ---------- */

.sidebar {
  position: fixed;
  top: 56px; bottom: 30px; right: 0;
  width: min(400px, 92vw);
  z-index: 1200;
  background: linear-gradient(200deg, var(--bg-panel-2), var(--bg-panel));
  border-left: 1px solid var(--neon-dim);
  box-shadow: -8px 0 30px rgba(0, 0, 0, 0.6), inset 1px 0 0 rgba(41,182,255,.15);
  transform: translateX(105%);
  transition: transform 0.28s cubic-bezier(.2,.8,.25,1);
  overflow-y: auto;
  padding: 22px;
}

.sidebar.open { transform: translateX(0); }

.sidebar-close {
  position: absolute;
  top: 10px; right: 12px;
  background: none;
  border: 1px solid var(--border);
  border-radius: 3px;
  color: var(--text-dim);
  font-size: 14px;
  width: 30px; height: 30px;
  cursor: pointer;
}
.sidebar-close:hover { color: var(--neon); border-color: var(--neon); }

.run-kicker {
  font-family: var(--font-title);
  font-size: 10px;
  letter-spacing: 2px;
  color: var(--text-dim);
  text-transform: uppercase;
}

.run-titre {
  font-family: var(--font-title);
  font-size: 20px;
  font-weight: 700;
  color: #fff;
  text-shadow: 0 0 14px var(--neon-glow);
  margin: 6px 0 16px;
  line-height: 1.3;
}

.run-meta {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 16px;
}

.meta-item {
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 8px 10px;
  background: rgba(41, 182, 255, 0.04);
}

.meta-item .meta-label {
  font-size: 10px;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: var(--text-dim);
}

.meta-item .meta-value { font-size: 16px; font-weight: 600; color: var(--text); }
.meta-item .meta-value-small { font-size: 14px; line-height: 1.35; }
.meta-item.meta-large { grid-column: 1 / -1; }
.meta-value.paiement { color: var(--ok); }
.date-libre { color: var(--text-dim); font-style: italic; }

.lien-sondage {
  color: var(--neon);
  text-decoration: none;
  border-bottom: 1px dashed var(--neon-dim);
}
.lien-sondage:hover { color: #fff; border-bottom-color: #fff; }

.tag-tw {
  color: #ffb547;
  border-color: rgba(255, 181, 71, 0.5);
  background: rgba(255, 181, 71, 0.08);
}

.run-texte {
  font-size: 15px;
  line-height: 1.5;
  color: var(--text);
  margin-bottom: 18px;
}

.difficulte-ligne { margin-bottom: 8px; font-size: 18px; }

.kicker-lien { color: var(--neon); cursor: pointer; }
.kicker-lien:hover { text-decoration: underline; }

/* Liste des runs dans la fiche district */

.runs-district { list-style: none; margin-bottom: 18px; }

.runs-district .run-lien {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 9px 10px;
  margin-bottom: 6px;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: rgba(41, 182, 255, 0.04);
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}

.runs-district .run-lien:hover {
  border-color: var(--neon);
  background: rgba(41, 182, 255, 0.1);
}

.run-lien-titre { font-size: 15px; font-weight: 600; }

.run-lien-places {
  font-family: var(--font-title);
  font-size: 10px;
  letter-spacing: 1.5px;
  color: var(--neon);
  white-space: nowrap;
}

.run-lien-complete .run-lien-places { color: var(--magenta); }

.runs-district .run-lien-jouee { border-style: dashed; opacity: 0.8; }
.run-lien-jouee .run-lien-places { color: var(--text-dim); }

/* Historique saisi à la main (pas de fiche à ouvrir) */
.runs-district .run-lien-histo { cursor: default; border-style: dashed; opacity: 0.6; }
.runs-district .run-lien-histo:hover { border-color: var(--border); background: rgba(41, 182, 255, 0.04); }

.run-titre-jouee { color: var(--text-dim); text-shadow: none; }
.statut-complete.statut-jouee { color: var(--text-dim); }
.compte-rendu { border-left-color: var(--text-dim); color: var(--text); font-style: italic; }

.difficulte { color: var(--neon); letter-spacing: 2px; }

.run-tags { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 16px; }

.tag {
  font-size: 12px;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--neon);
  border: 1px solid var(--neon-dim);
  border-radius: 999px;
  padding: 2px 10px;
  background: rgba(41, 182, 255, 0.07);
}

.run-synopsis {
  font-size: 15.5px;
  line-height: 1.55;
  color: var(--text);
  border-left: 2px solid var(--neon-dim);
  padding-left: 12px;
  margin-bottom: 20px;
}

.section-title {
  font-family: var(--font-title);
  font-size: 11px;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--neon);
  margin-bottom: 8px;
}

.inscrites { list-style: none; margin-bottom: 14px; }

.inscrites li {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 2px;
  font-size: 15px;
  border-bottom: 1px dashed rgba(41, 182, 255, 0.15);
}

.inscrites li::before {
  content: "▸";
  color: var(--neon);
  font-size: 12px;
}

.slot-libre { color: var(--text-dim); font-style: italic; }

.inscription-form { display: flex; gap: 8px; margin-top: 4px; }

.inscription-form input {
  flex: 1;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 3px;
  color: var(--text);
  font-family: var(--font-body);
  font-size: 15px;
  padding: 8px 10px;
  outline: none;
}
.inscription-form input:focus { border-color: var(--neon); box-shadow: 0 0 8px rgba(41,182,255,.25); }

.btn {
  font-family: var(--font-title);
  font-size: 11px;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: var(--bg);
  background: var(--neon);
  border: none;
  border-radius: 3px;
  padding: 8px 14px;
  cursor: pointer;
  box-shadow: 0 0 12px rgba(41, 182, 255, 0.35);
}
.btn:hover { background: #5ecbff; }
.btn:disabled { background: var(--text-dim); cursor: not-allowed; box-shadow: none; }

.statut-complete {
  color: var(--magenta);
  font-family: var(--font-title);
  font-size: 11px;
  letter-spacing: 2px;
}

/* ---------- Désinscription ---------- */

.inscrites li { justify-content: flex-start; }
.ins-nom { flex: 1; }

.ins-suppr {
  background: none;
  border: 1px solid transparent;
  border-radius: 3px;
  color: var(--text-dim);
  font-size: 11px;
  width: 22px; height: 22px;
  cursor: pointer;
  opacity: 0.5;
}
.ins-suppr:hover { color: var(--danger); border-color: var(--danger); opacity: 1; }

.sidebar-erreur {
  margin-top: 10px;
  color: var(--danger);
  font-size: 14px;
  min-height: 18px;
}

/* ---------- Écran de connexion ---------- */

.login-overlay {
  position: fixed;
  inset: 0;
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  background:
    radial-gradient(ellipse at 30% 20%, rgba(41, 182, 255, 0.08), transparent 55%),
    radial-gradient(ellipse at 75% 80%, rgba(255, 46, 136, 0.05), transparent 55%),
    rgba(6, 8, 15, 0.72);
  backdrop-filter: blur(3px);
}

.login-panel {
  display: flex;
  flex-direction: column;
  gap: 14px;
  width: min(360px, 90vw);
  padding: 34px 30px;
  background: rgba(10, 15, 28, 0.92);
  border: 1px solid var(--neon-dim);
  border-radius: 6px;
  box-shadow: 0 0 40px rgba(41, 182, 255, 0.15);
  text-align: center;
  animation: panneau-in 0.6s cubic-bezier(.2,.8,.25,1) both;
}

@keyframes panneau-in {
  from { opacity: 0; transform: translateY(14px) scale(0.97); }
  to   { opacity: 1; transform: none; }
}

.secousse { animation: secousse 0.4s ease-in-out; }
@keyframes secousse {
  0%, 100% { transform: translateX(0); }
  20%, 60% { transform: translateX(-7px); }
  40%, 80% { transform: translateX(7px); }
}

.login-glyph {
  color: var(--neon);
  font-size: 22px;
  text-shadow: 0 0 12px var(--neon-glow);
}

.login-panel h2 {
  font-family: var(--font-title);
  font-weight: 900;
  font-size: 22px;
  letter-spacing: 3px;
  color: #fff;
  text-shadow: 0 0 14px var(--neon-glow);
}

.login-panel h2 .accent { color: var(--neon); }

.login-sub { color: var(--text-dim); font-size: 15px; }

.login-panel input {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 3px;
  color: var(--text);
  font-family: var(--font-body);
  font-size: 16px;
  padding: 10px 12px;
  outline: none;
  text-align: center;
}
.login-panel input:focus { border-color: var(--neon); box-shadow: 0 0 10px rgba(41,182,255,.25); }

.login-erreur { color: var(--danger); font-size: 14px; min-height: 18px; }

/* ---------- Interface MJ ---------- */

.badge-mj { color: var(--magenta); border-color: rgba(255, 46, 136, 0.45); }
.badge-mj:hover { color: #fff; border-color: var(--magenta); }

.mj-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  margin-top: 22px;
  padding-top: 14px;
  border-top: 1px dashed rgba(255, 46, 136, 0.35);
}

.mj-label {
  font-family: var(--font-title);
  font-size: 10px;
  letter-spacing: 2px;
  color: var(--magenta);
  margin-right: 4px;
}

.btn-secondaire {
  background: transparent;
  color: var(--neon);
  border: 1px solid var(--neon-dim);
  box-shadow: none;
}
.btn-secondaire:hover { background: rgba(41, 182, 255, 0.1); border-color: var(--neon); box-shadow: none; }

.btn-danger {
  background: transparent;
  color: var(--danger);
  border: 1px solid rgba(255, 77, 77, 0.5);
  box-shadow: none;
}
.btn-danger:hover { background: rgba(255, 77, 77, 0.12); border-color: var(--danger); box-shadow: none; }

.formulaire {
  display: flex;
  flex-direction: column;
  gap: 12px;
  color-scheme: dark;
}

.champ { display: flex; flex-direction: column; gap: 4px; flex: 1; min-width: 0; }
.champ-label { font-size: 10px; letter-spacing: 1.5px; text-transform: uppercase; color: var(--text-dim); }
.champ-aide { font-size: 12px; color: var(--text-dim); font-style: italic; }
.champ-ligne { display: flex; gap: 10px; }

.formulaire input, .formulaire select, .formulaire textarea {
  width: 100%;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 3px;
  color: var(--text);
  font-family: var(--font-body);
  font-size: 15px;
  padding: 7px 9px;
  outline: none;
}
.formulaire input:focus, .formulaire select:focus, .formulaire textarea:focus {
  border-color: var(--neon);
  box-shadow: 0 0 8px rgba(41, 182, 255, 0.25);
}
.formulaire input[readonly] { color: var(--text-dim); }
.formulaire textarea { resize: vertical; line-height: 1.45; }

.champ-date, .champ-position { display: flex; gap: 6px; align-items: center; }
.champ-position input { width: 84px; }
.champ-date .btn, .champ-position .btn { white-space: nowrap; padding: 8px 10px; }
.cache { position: absolute; width: 0; height: 0; opacity: 0; pointer-events: none; }

.formulaire-actions { display: flex; gap: 8px; margin-top: 6px; }

#map.placement { cursor: cell; }
.pin.pin-temp .pin-core { background: #fff; box-shadow: 0 0 12px #fff; }
.pin.pin-temp .pin-ring { border-color: #fff; }

/* ---------- Animations ---------- */

/* Apparition en cascade du contenu de la sidebar */
@keyframes apparition {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: none; }
}
#sidebar-content > * { animation: apparition 0.4s cubic-bezier(.2,.8,.25,1) both; }
#sidebar-content > :nth-child(1)  { animation-delay: 0.05s; }
#sidebar-content > :nth-child(2)  { animation-delay: 0.10s; }
#sidebar-content > :nth-child(3)  { animation-delay: 0.15s; }
#sidebar-content > :nth-child(4)  { animation-delay: 0.20s; }
#sidebar-content > :nth-child(5)  { animation-delay: 0.25s; }
#sidebar-content > :nth-child(6)  { animation-delay: 0.30s; }
#sidebar-content > :nth-child(7)  { animation-delay: 0.35s; }
#sidebar-content > :nth-child(8)  { animation-delay: 0.40s; }
#sidebar-content > :nth-child(9)  { animation-delay: 0.45s; }
#sidebar-content > :nth-child(n+10) { animation-delay: 0.50s; }

/* Glitch : deux copies du texte décalées et découpées */
.glitch { position: relative; display: inline-block; }
.run-titre.glitch { display: block; }
.glitch::before, .glitch::after {
  content: attr(data-text);
  position: absolute;
  left: 0; top: 0;
  width: 100%;
  opacity: 0;
  pointer-events: none;
  text-shadow: none;
}
.glitch.glitch-actif::before { color: var(--magenta); animation: glitch-a 0.45s steps(1) both; }
.glitch.glitch-actif::after  { color: var(--neon);    animation: glitch-b 0.45s steps(1) both; }

@keyframes glitch-a {
  0%   { opacity: .9; clip-path: inset(10% 0 60% 0); transform: translate(-4px, 0); }
  20%  { clip-path: inset(55% 0 15% 0); transform: translate(4px, 0); }
  40%  { clip-path: inset(30% 0 45% 0); transform: translate(-3px, 0); }
  60%  { clip-path: inset(75% 0 5% 0);  transform: translate(3px, 0); }
  80%  { clip-path: inset(5% 0 80% 0);  transform: translate(-2px, 0); }
  100% { opacity: 0; }
}
@keyframes glitch-b {
  0%   { opacity: .9; clip-path: inset(60% 0 10% 0); transform: translate(4px, 0); }
  20%  { clip-path: inset(15% 0 55% 0); transform: translate(-4px, 0); }
  40%  { clip-path: inset(45% 0 30% 0); transform: translate(3px, 0); }
  60%  { clip-path: inset(5% 0 75% 0);  transform: translate(-3px, 0); }
  80%  { clip-path: inset(80% 0 5% 0);  transform: translate(2px, 0); }
  100% { opacity: 0; }
}

.btn, .badge-bouton, .tag, .runs-district .run-lien { transition: all 0.18s ease; }
.btn:hover { box-shadow: 0 0 18px rgba(41, 182, 255, 0.6); }

/* ---------- Onglet Personnages ---------- */

#personnages {
  position: fixed;
  inset: 56px 0 30px 0;
  z-index: 1;
  overflow-y: auto;
  padding: 30px clamp(16px, 4vw, 56px) 50px;
}

.perso-section + .perso-section { margin-top: 38px; }

.perso-titre-section {
  font-family: var(--font-title);
  font-size: 14px;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--neon);
  text-shadow: 0 0 10px var(--neon-glow);
  margin-bottom: 16px;
}

.perso-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 16px;
}

.perso-vide { grid-column: 1 / -1; color: var(--text-dim); font-style: italic; }

.perso-card {
  background: rgba(10, 15, 28, 0.75);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 14px;
  cursor: pointer;
  transition: border-color 0.15s, transform 0.15s, box-shadow 0.15s;
}
.perso-card:hover {
  border-color: var(--neon);
  box-shadow: 0 0 16px rgba(41, 182, 255, 0.18);
  transform: translateY(-2px);
}

.perso-card-img {
  width: 100%;
  aspect-ratio: 1 / 1;
  border-radius: 4px;
  margin-bottom: 10px;
  background-size: cover;
  background-position: center;
  background-color: rgba(41, 182, 255, 0.06);
  display: flex;
  align-items: center;
  justify-content: center;
}
.perso-card-img-vide {
  font-family: var(--font-title);
  font-size: 32px;
  color: var(--neon-dim);
}

.perso-card-nom { font-family: var(--font-title); font-weight: 700; font-size: 15px; color: #fff; }
.perso-card-sub { font-size: 13px; color: var(--text-dim); margin-top: 3px; }

.champ-image { display: flex; flex-direction: column; gap: 10px; }

.champ-image-apercu {
  width: 120px;
  height: 120px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: rgba(41, 182, 255, 0.05);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}
.champ-image-apercu img { width: 100%; height: 100%; object-fit: cover; }
.champ-image-vide { font-size: 12px; color: var(--text-dim); text-align: center; padding: 0 8px; }

.champ-image-boutons { display: flex; gap: 8px; flex-wrap: wrap; }
.champ-image-parcourir { text-align: center; }

.perso-portrait {
  width: 100%;
  max-height: 260px;
  object-fit: cover;
  border-radius: 6px;
  border: 1px solid var(--border);
  margin-bottom: 16px;
}

/* ---------- Toast ---------- */

.toast {
  position: fixed;
  left: 50%;
  bottom: 46px;
  z-index: 3000;
  max-width: min(420px, 86vw);
  text-align: center;
  background: var(--bg-panel);
  border: 1px solid var(--neon-dim);
  color: var(--text);
  padding: 10px 20px;
  border-radius: 999px;
  font-size: 14px;
  box-shadow: 0 0 22px rgba(41, 182, 255, 0.25);
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, 10px);
  transition: opacity 0.25s ease, transform 0.25s ease;
}
.toast.visible { opacity: 1; transform: translate(-50%, 0); }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  #map { opacity: 1; }
}

/* ---------- Responsive ---------- */

@media (pointer: coarse) {
  :root { --pin: 30px; }
  .pin .pin-core { inset: 7px; }
}

/* Fenêtre étroite : on gagne de la place dans la barre du haut */
@media (max-width: 960px) {
  .topbar .subtitle { display: none; }
  .badge { padding: 5px 8px; letter-spacing: 1.5px; }
}

/* Mobile */
@media (max-width: 640px) {
  .topbar { padding: 0 10px; gap: 8px; }
  .topbar h1 { font-size: 13px; letter-spacing: 1px; overflow: hidden; text-overflow: ellipsis; }
  .topbar-title { gap: 6px; overflow: hidden; }
  .topbar-title .glyph { display: none; }
  .topbar-right { gap: 6px; }
  .badge { padding: 7px 9px; font-size: 11px; }
  .badge .txt { display: none; }          /* icônes seules */
  .badge-role .txt { display: none; }

  /* La sidebar devient un panneau qui monte du bas */
  .sidebar {
    top: auto;
    left: 0; right: 0; bottom: 30px;
    width: 100%;
    height: min(72vh, calc(100% - 86px));
    border-left: none;
    border-top: 1px solid var(--neon-dim);
    border-radius: 12px 12px 0 0;
    padding: 30px 16px 20px;
    box-shadow: 0 -8px 30px rgba(0, 0, 0, 0.6);
    transform: translateY(105%);
  }
  .sidebar::before {                        /* poignée */
    content: "";
    position: absolute;
    top: 9px; left: 50%;
    width: 44px; height: 3px;
    margin-left: -22px;
    border-radius: 2px;
    background: var(--neon-dim);
  }
  .sidebar.open { transform: translateY(0); }
  .sidebar-close { top: 12px; right: 12px; }

  .run-titre { font-size: 18px; }
  .run-meta { gap: 8px; }
  .champ-ligne { flex-direction: column; gap: 12px; }

  /* 16px minimum : évite le zoom automatique d'iOS au focus */
  .formulaire input, .formulaire select, .formulaire textarea,
  .inscription-form input, .login-panel input { font-size: 16px; }

  #status-coords, .status-sep { display: none; }
  .statusbar { font-size: 12px; padding: 0 10px; }

  .leaflet-bar a { width: 34px; height: 34px; line-height: 34px; }

  #personnages { padding: 20px 14px 40px; }
  .perso-grid { grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 12px; }
  .toast { bottom: 40px; font-size: 13px; }
}

/* ---------- Barre de statut ---------- */

.statusbar {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  height: 30px;
  z-index: 1100;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 14px;
  font-size: 12.5px;
  letter-spacing: 1px;
  color: var(--text-dim);
  background: var(--bg-panel);
  border-top: 1px solid var(--border);
}

.status-sep { color: var(--neon-dim); }

#status-coords { color: var(--neon); font-variant-numeric: tabular-nums; }
