/* ================================================================
   Marseille Wrapped — design system poster
   Fonts:
     - Anton / Archivo Black : titres oversized (display)
     - Helvetica Neue : corps de texte
   Palette pilotee par data-wrapped-theme (4 themes), via CSS variables.
   Chaque module (onboarding, cards, map header) consomme uniquement les
   variables, jamais les hex en dur.
   ================================================================ */

@import url('https://fonts.googleapis.com/css2?family=Anton&family=Archivo+Black&display=swap');

:root {
  /* Theme par defaut = "om". Reecrit par applyTheme(). */
  --paper: #F4F1EA;
  --ink: #0E0E0C;
  --primary: #2FAEE0;
  --secondary: #BEA064;
  --accent: #1E5BFF;
  --card-cream: #F4F1EA;
  --card-ink: #0A2942;

  /* Tokens derives (statiques, non reecrits par applyTheme). */
  --paper-soft: rgba(241, 236, 224, 0.92);
  --ink-soft: rgba(14, 14, 12, 0.55);
  --ink-faint: rgba(14, 14, 12, 0.16);
  --shadow-poster: 5px 5px 0 var(--ink);
  --shadow-card: 0 20px 50px rgba(0, 0, 0, 0.25), 0 4px 14px rgba(0, 0, 0, 0.18);
  --radius-card: 28px;
  --radius-pill: 999px;

  /* Fonts */
  --font-display: "Anton", "Archivo Black", Impact, sans-serif;
  --font-body: "Helvetica Neue", Helvetica, Arial, sans-serif;

  /* Map dimming overlay couleur (theme dependent). */
  --dim-color: #1a1a1a;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  overflow: hidden;
  font-family: var(--font-body);
  color: var(--ink);
  background: var(--paper);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

button { font-family: inherit; }

/* ================================================================
   Map (Leaflet container)
   ================================================================ */
#map {
  position: absolute;
  inset: 0;
  /* Fond exact des tiles HD (cf. _BG_COLOR dans pipeline/render_full_graph.py
     = (250, 250, 246) = #fafaf6). Sans cela on voit le bord de l'image rendu. */
  background: #fafaf6;
  transition: opacity 0.5s ease;
}
#map.boot-hidden {
  opacity: 0;
  pointer-events: none;
}

.leaflet-container {
  background: #fafaf6;
  outline: none;
  font-family: var(--font-body);
}
body.focused .leaflet-container { cursor: pointer; }

/* ================================================================
   Loading screen (fallback initial)
   ================================================================ */
#loading {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--paper);
  z-index: 9999;
  font-family: var(--font-display);
  font-size: 28px;
  letter-spacing: -0.02em;
  color: var(--ink);
  pointer-events: none;
  transition: opacity 0.4s;
}
#loading.gone { opacity: 0; }

/* ================================================================
   Halftone / grain helpers (utilises par cards et onboarding)
   ================================================================ */
.grain-layer {
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: 0.22;
  mix-blend-mode: multiply;
  z-index: 1;
}
.grain-layer.dark {
  opacity: 0.18;
  mix-blend-mode: screen;
}

.watermark-layer {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background-repeat: repeat;
  background-size: 420px 200px;
  transform: rotate(-12deg) scale(1.4);
  transform-origin: center;
  mix-blend-mode: multiply;
  z-index: 1;
}
.watermark-layer.dark { mix-blend-mode: screen; }

/* Title strips ("TU ES DANS LE", "TON CREW", etc.) */
.title-strip {
  display: inline-block;
  background: var(--ink);
  color: #fff;
  padding: 8px 16px;
  font-family: var(--font-body);
  font-weight: 800;
  font-size: 14px;
  letter-spacing: 0.18em;
  transform: rotate(-1deg);
  white-space: nowrap;
}
.title-strip.light {
  background: #fff;
  color: var(--ink);
}

/* ================================================================
   Onboarding overlays (intro / loading / reveal / outro)
   Chaque overlay couvre tout l'ecran. main.js bascule la classe
   .visible pour le step actif.
   ================================================================ */
.onb-overlay {
  position: fixed;
  inset: 0;
  z-index: 4000;
  background: var(--paper);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 32px 20px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.4s ease;
}
.onb-overlay.visible {
  opacity: 1;
  pointer-events: auto;
}
.onb-overlay::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background-image:
    radial-gradient(circle at 20% 30%, var(--primary) 0%, transparent 38%),
    radial-gradient(circle at 80% 70%, var(--secondary) 0%, transparent 36%);
  opacity: 0.10;
  z-index: 0;
}

/* === Intro step === */
.onb-intro-inner {
  position: relative;
  z-index: 2;
  width: 100%;
  max-width: 460px;
  display: flex;
  flex-direction: column;
  gap: 24px;
  align-items: stretch;
}
.onb-logo {
  font-family: var(--font-display);
  font-size: 44px;
  letter-spacing: -0.04em;
  text-align: center;
  color: var(--ink);
  line-height: 0.9;
}
.onb-logo small {
  display: block;
  font-family: var(--font-body);
  font-size: 11px;
  letter-spacing: 0.22em;
  font-weight: 800;
  margin-top: 4px;
  opacity: 0.7;
}
.onb-intro-title {
  font-family: var(--font-display);
  font-size: 56px;
  line-height: 0.92;
  letter-spacing: -0.03em;
  text-align: center;
  margin: 0;
  color: var(--ink);
}
.onb-intro-title em {
  color: var(--primary);
  font-style: normal;
  text-shadow: 3px 3px 0 var(--ink);
  -webkit-text-stroke: 1.5px var(--ink);
}
.onb-input-wrap {
  position: relative;
  display: flex;
  align-items: center;
  background: #fff;
  border: 2.5px solid var(--ink);
  border-radius: 14px;
  padding: 4px 4px 4px 16px;
  box-shadow: 5px 5px 0 var(--ink);
}
.onb-input-prefix {
  font-family: var(--font-display);
  font-size: 22px;
  color: var(--ink);
  margin-right: 6px;
}
.onb-input {
  flex: 1;
  border: 0;
  outline: 0;
  background: transparent;
  font-family: var(--font-body);
  font-size: 18px;
  font-weight: 600;
  color: var(--ink);
  padding: 14px 8px;
  min-width: 0;
}
.onb-input::placeholder { color: var(--ink-soft); font-weight: 500; }
.onb-input-go {
  flex-shrink: 0;
  width: 50px;
  height: 50px;
  border-radius: 12px;
  border: 0;
  background: var(--ink);
  color: #fff;
  font-size: 22px;
  cursor: pointer;
  transition: background 0.15s;
}
.onb-input-go:hover { background: var(--primary); }
.onb-input-go:disabled { opacity: 0.4; cursor: not-allowed; }

.onb-suggest {
  background: #fff;
  border: 2px solid var(--ink);
  border-radius: 14px;
  overflow: hidden;
  box-shadow: 4px 4px 0 var(--ink);
  display: none;
}
.onb-suggest.show { display: block; }
.onb-suggest-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  cursor: pointer;
  border-bottom: 1px solid var(--ink-faint);
  min-height: 56px;
}
.onb-suggest-row:last-child { border-bottom: 0; }
.onb-suggest-row:hover, .onb-suggest-row.active {
  background: var(--paper);
}
.onb-suggest-row img {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  object-fit: cover;
  background: var(--paper);
  border: 2px solid var(--ink);
  flex-shrink: 0;
}
.onb-suggest-info { flex: 1; min-width: 0; line-height: 1.2; }
.onb-suggest-info .un {
  font-weight: 700;
  font-size: 14px;
  color: var(--ink);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.onb-suggest-info .nm {
  font-size: 12px;
  color: var(--ink-soft);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  margin-top: 2px;
}

.onb-error {
  background: var(--ink);
  color: #fff;
  padding: 10px 14px;
  font-size: 13px;
  font-weight: 600;
  border-radius: 10px;
  transform: rotate(-1deg);
  box-shadow: 4px 4px 0 var(--primary);
  text-align: left;
}
.onb-error.hidden { display: none; }

.onb-skip {
  font-family: var(--font-body);
  font-weight: 700;
  font-size: 12px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--ink-soft);
  background: none;
  border: 0;
  cursor: pointer;
  padding: 12px;
  margin-top: 4px;
  transition: color 0.15s;
}
.onb-skip:hover { color: var(--ink); text-decoration: underline; }

/* === Loading step === */
.onb-loading-inner {
  position: relative;
  z-index: 2;
  width: 100%;
  max-width: 460px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 28px;
  text-align: center;
}
.onb-load-photo {
  position: relative;
  width: 160px;
  height: 160px;
}
.onb-load-photo img {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  object-fit: cover;
  background: var(--paper);
  border: 4px solid var(--ink);
  box-shadow: 6px 6px 0 var(--primary);
  position: relative;
  z-index: 2;
  animation: onb-pulse 1.4s ease-in-out infinite;
}
.onb-load-photo::after {
  content: "";
  position: absolute;
  inset: -16px;
  border-radius: 50%;
  border: 2px dashed var(--ink-soft);
  animation: onb-spin 8s linear infinite;
  z-index: 1;
}
@keyframes onb-pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.03); }
}
@keyframes onb-spin {
  to { transform: rotate(360deg); }
}

.onb-load-username {
  font-family: var(--font-display);
  font-size: 48px;
  line-height: 0.95;
  letter-spacing: -0.03em;
  color: var(--ink);
  margin: 0;
}
.onb-load-fullname {
  font-family: var(--font-body);
  font-size: 14px;
  font-weight: 600;
  color: var(--ink-soft);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  margin: -16px 0 0 0;
}

.onb-progress-wrap {
  width: 100%;
  background: #fff;
  border: 2.5px solid var(--ink);
  border-radius: 14px;
  padding: 16px 18px;
  box-shadow: 5px 5px 0 var(--ink);
  text-align: left;
}
.onb-progress-bar {
  width: 100%;
  height: 14px;
  background: var(--paper);
  border: 1.5px solid var(--ink);
  border-radius: 999px;
  overflow: hidden;
  position: relative;
  margin-bottom: 12px;
}
.onb-progress-fill {
  height: 100%;
  background: var(--ink);
  width: 0%;
  border-radius: 999px;
  transition: width 0.25s ease-out;
  position: relative;
}
.onb-progress-fill::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.4), transparent);
  animation: onb-shimmer 1.5s linear infinite;
}
@keyframes onb-shimmer {
  0% { transform: translateX(-100%); }
  100% { transform: translateX(100%); }
}
.onb-phases {
  list-style: none;
  margin: 0;
  padding: 0;
  font-size: 13px;
  font-weight: 600;
  color: var(--ink);
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.onb-phases li {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 0;
  opacity: 0.4;
  transition: opacity 0.3s;
}
.onb-phases li::before {
  content: "○";
  font-size: 12px;
  width: 14px;
  text-align: center;
  flex-shrink: 0;
  color: var(--ink-soft);
}
.onb-phases li.active {
  opacity: 1;
  color: var(--primary);
}
.onb-phases li.active::before {
  content: "●";
  color: var(--primary);
}
.onb-phases li.done {
  opacity: 0.7;
}
.onb-phases li.done::before {
  content: "✓";
  color: var(--ink);
}

/* === Reveal step (carousel) === */
.onb-reveal {
  position: fixed;
  inset: 0;
  z-index: 4000;
  background: var(--paper);
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  padding: 28px 12px 16px;
}
.onb-reveal.visible { display: flex; }
.onb-reveal::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background-image:
    radial-gradient(circle at 15% 25%, var(--primary) 0%, transparent 36%),
    radial-gradient(circle at 85% 75%, var(--secondary) 0%, transparent 36%);
  opacity: 0.08;
  z-index: 0;
}

.onb-reveal-bar {
  position: relative;
  z-index: 5;
  width: 100%;
  max-width: 1200px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 0 12px;
  margin-bottom: 18px;
}
.onb-reveal-back, .onb-reveal-close, .onb-reveal-switch {
  flex-shrink: 0;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 2px solid var(--ink);
  background: #fff;
  color: var(--ink);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  padding: 0;
  transition: background 0.15s, color 0.15s, transform 0.15s;
}
.onb-reveal-back:hover, .onb-reveal-close:hover, .onb-reveal-switch:hover {
  background: var(--ink);
  color: #fff;
}
.onb-reveal-switch:hover {
  transform: rotate(180deg);
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}
.onb-reveal-bar-right {
  display: flex;
  gap: 10px;
  align-items: center;
}
.onb-reveal-brand {
  font-family: var(--font-display);
  font-size: 22px;
  letter-spacing: -0.02em;
  color: var(--ink);
  text-align: center;
  flex: 1;
}
.onb-reveal-brand small {
  display: block;
  font-family: var(--font-body);
  font-size: 9px;
  letter-spacing: 0.22em;
  font-weight: 800;
  margin-top: -2px;
  opacity: 0.7;
}

/* Stage : container statique. Pas d'overflow:hidden : les drop-shadows des
   cards (jusqu'a ~70px de blur) restent visibles tout autour. Le scroll
   horizontal est gere par transform sur .onb-reveal-track (pas de scroll natif).
   Le padding-y du stage englobe les drop-shadows mais reste contenu visuellement. */
.onb-reveal-stage {
  position: relative;
  z-index: 2;
  flex: 1 1 auto;
  width: 100%;
  min-height: 0;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  overflow: visible;
  touch-action: pan-y;
}
.onb-reveal-track {
  display: flex;
  align-items: center;
  gap: 40px;
  will-change: transform;
  transition: transform 0.45s cubic-bezier(0.2, 0.8, 0.2, 1);
  user-select: none;
  pointer-events: none;
}
.onb-reveal-track.dragging {
  transition: none;
}
.onb-reveal-track .card-wrap { pointer-events: auto; }

.card-wrap {
  flex: 0 0 auto;
  width: min(380px, calc(100vw - 48px));
  aspect-ratio: 9 / 16;
  height: auto;
  max-height: calc(100dvh - 260px);
  border-radius: var(--radius-card);
  filter: drop-shadow(0 18px 36px rgba(0, 0, 0, 0.22)) drop-shadow(0 4px 10px rgba(0, 0, 0, 0.16));
  position: relative;
  transition: transform 0.4s cubic-bezier(0.2, 0.8, 0.2, 1);
}
.card-wrap > div {
  border-radius: var(--radius-card);
  overflow: hidden;
}
.card-wrap.active { transform: scale(1.02); }
.card-wrap.inactive { transform: scale(0.94); opacity: 0.85; }

.onb-reveal-pagination {
  display: flex;
  gap: 10px;
  justify-content: center;
  align-items: center;
  margin: 8px 0;
  position: relative;
  z-index: 100;
  padding: 6px 0;
}
.onb-reveal-actions, .onb-theme-picker {
  position: relative;
  z-index: 100;
  padding: 4px 0;
}
.onb-reveal-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--ink-faint);
  cursor: pointer;
  transition: all 0.2s;
}
.onb-reveal-dot.active {
  background: var(--ink);
  width: 24px;
  border-radius: 4px;
}

.onb-reveal-actions {
  display: flex;
  gap: 12px;
  justify-content: center;
  align-items: center;
  flex-wrap: wrap;
  padding: 6px 0 4px;
}
.onb-action-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--ink);
  color: #fff;
  border: 0;
  padding: 12px 20px;
  border-radius: var(--radius-pill);
  font-weight: 700;
  font-size: 13px;
  letter-spacing: 0.04em;
  cursor: pointer;
  font-family: inherit;
  transition: background 0.15s;
  min-height: 44px;
}
.onb-action-btn:hover { background: var(--primary); }
.onb-action-btn.ghost {
  background: transparent;
  border: 2px solid var(--ink);
  color: var(--ink);
}
.onb-action-btn.ghost:hover { background: var(--ink); color: #fff; }
.onb-action-btn svg {
  width: 14px;
  height: 14px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.5;
}

.onb-theme-picker {
  display: flex;
  gap: 10px;
  justify-content: center;
  align-items: center;
  padding: 4px 0 0;
  flex-wrap: wrap;
}
.onb-theme-swatch {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 2px solid var(--ink);
  cursor: pointer;
  position: relative;
  overflow: hidden;
  background: #fff;
  display: flex;
  flex-wrap: wrap;
  padding: 0;
  transition: transform 0.15s;
}
.onb-theme-swatch:hover { transform: scale(1.08); }
.onb-theme-swatch.active {
  transform: scale(1.12);
  box-shadow: 0 0 0 3px var(--paper), 0 0 0 5px var(--ink);
}
.onb-theme-swatch span {
  width: 50%;
  height: 50%;
  display: block;
}

/* === Outro step === */
.onb-outro-inner {
  position: relative;
  z-index: 2;
  width: 100%;
  max-width: 460px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 22px;
  text-align: center;
}
.onb-outro-title {
  font-family: var(--font-display);
  font-size: 64px;
  line-height: 0.9;
  letter-spacing: -0.03em;
  color: var(--ink);
  margin: 0;
}
.onb-outro-photo {
  width: 130px;
  height: 130px;
  border-radius: 50%;
  background: var(--paper);
  border: 4px solid var(--ink);
  box-shadow: 5px 5px 0 var(--primary);
  object-fit: cover;
  display: block;
}
.onb-outro-handle {
  font-family: var(--font-display);
  font-size: 32px;
  color: var(--primary);
  letter-spacing: -0.02em;
  margin: 0;
  text-shadow: 2px 2px 0 var(--ink);
}
.onb-cta-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  background: var(--ink);
  color: #fff;
  border: 0;
  padding: 18px 36px;
  border-radius: var(--radius-pill);
  font-family: var(--font-display);
  font-size: 24px;
  letter-spacing: 0.04em;
  cursor: pointer;
  box-shadow: 6px 6px 0 var(--primary);
  transition: transform 0.15s, box-shadow 0.15s;
  text-transform: uppercase;
  min-height: 56px;
}
.onb-cta-primary:hover { transform: translate(-2px, -2px); box-shadow: 8px 8px 0 var(--primary); }
.onb-cta-primary:active { transform: translate(2px, 2px); box-shadow: 2px 2px 0 var(--primary); }
.onb-outro-hint {
  font-family: var(--font-body);
  font-size: 12px;
  font-weight: 600;
  color: var(--ink-soft);
  letter-spacing: 0.06em;
  margin: 0;
  line-height: 1.5;
}

/* ================================================================
   Map UI : header simplifie + drawer hamburger + ME glow
   ================================================================ */
#app-header {
  position: fixed;
  top: 14px;
  left: 14px;
  right: 14px;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: space-between;
  pointer-events: none;
}
#app-header > * { pointer-events: auto; }

.me-badge {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  background: #fff;
  border: 2px solid var(--ink);
  border-radius: var(--radius-pill);
  padding: 6px 14px 6px 6px;
  cursor: pointer;
  box-shadow: 4px 4px 0 var(--ink);
  font-family: var(--font-body);
  transition: transform 0.15s, box-shadow 0.15s;
  max-width: 240px;
  min-height: 44px;
}
.me-badge:hover { transform: translate(-1px, -1px); box-shadow: 5px 5px 0 var(--primary); }
.me-badge img {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  object-fit: cover;
  background: var(--paper);
  flex-shrink: 0;
}
.me-badge .nm {
  font-weight: 700;
  font-size: 13px;
  color: var(--ink);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  letter-spacing: -0.01em;
}
.me-badge .lbl {
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.16em;
  color: var(--ink-soft);
  text-transform: uppercase;
}
.me-badge.me-badge-empty {
  background: #fff;
  border-color: var(--ink);
  border-style: dashed;
}
.me-empty-pic {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--paper);
  border: 2px dashed var(--ink);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-display);
  font-size: 22px;
  color: var(--ink-soft);
  flex-shrink: 0;
}

#app-header-actions {
  display: flex;
  gap: 8px;
}
.icon-btn {
  width: 44px;
  height: 44px;
  background: #fff;
  border: 2px solid var(--ink);
  border-radius: 50%;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-shadow: 4px 4px 0 var(--ink);
  font-size: 18px;
  color: var(--ink);
  transition: transform 0.15s, box-shadow 0.15s;
}
.icon-btn:hover { transform: translate(-1px, -1px); box-shadow: 5px 5px 0 var(--primary); }
.icon-btn svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.5;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* === Search popup (apparait sous le bouton, pas plein ecran) === */
#search-popup {
  position: fixed;
  top: 70px;
  right: 14px;
  z-index: 2000;
  width: min(360px, calc(100vw - 28px));
  display: flex;
  flex-direction: column;
  gap: 10px;
  pointer-events: auto;
  animation: search-pop-in 0.18s ease-out;
}
#search-popup.hidden { display: none; }
@keyframes search-pop-in {
  from { opacity: 0; transform: translateY(-8px); }
  to { opacity: 1; transform: translateY(0); }
}
#search-input {
  width: 100%;
  padding: 12px 16px;
  font-size: 15px;
  font-weight: 600;
  border: 2.5px solid var(--ink);
  border-radius: 12px;
  background: #fff;
  color: var(--ink);
  outline: none;
  box-shadow: 4px 4px 0 var(--ink);
  font-family: var(--font-body);
  min-height: 44px;
}
#search-input::placeholder { color: var(--ink-soft); font-weight: 500; }
#search-suggestions {
  background: #fff;
  border: 2px solid var(--ink);
  border-radius: 12px;
  max-height: 60vh;
  overflow-y: auto;
  box-shadow: 4px 4px 0 var(--ink);
}

/* === Hamburger drawer === */
#drawer {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: 320px;
  max-width: 90vw;
  background: var(--paper);
  border-left: 3px solid var(--ink);
  z-index: 2200;
  transform: translateX(100%);
  transition: transform 0.3s cubic-bezier(0.2, 0.8, 0.2, 1);
  display: flex;
  flex-direction: column;
  padding: 20px 18px;
  gap: 16px;
  overflow-y: auto;
  box-shadow: -10px 0 30px rgba(0, 0, 0, 0.15);
}
#drawer.open { transform: translateX(0); }
.drawer-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(14, 14, 12, 0.45);
  z-index: 2150;
  display: none;
  cursor: pointer;
}
.drawer-backdrop.visible { display: block; }
.drawer-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.drawer-head h3 {
  margin: 0;
  font-family: var(--font-display);
  font-size: 28px;
  letter-spacing: -0.02em;
  color: var(--ink);
}
.drawer-section {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding-bottom: 12px;
  border-bottom: 1.5px dashed var(--ink-faint);
}
.drawer-section:last-child { border-bottom: 0; }
.drawer-label {
  font-family: var(--font-body);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--ink-soft);
  margin-bottom: 4px;
}
.drawer-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.drawer-row select,
.drawer-row button {
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 13px;
  padding: 10px 14px;
  border: 2px solid var(--ink);
  background: #fff;
  color: var(--ink);
  border-radius: 10px;
  cursor: pointer;
  min-height: 40px;
  max-width: 100%;
  min-width: 0;
}
.drawer-row select {
  flex: 1 1 0;
  min-width: 0;
  max-width: 200px;
  text-overflow: ellipsis;
  overflow: hidden;
  white-space: nowrap;
}
.drawer-row { flex-wrap: wrap; gap: 8px; }
.drawer-row button { background: var(--ink); color: #fff; }
.drawer-row button.ghost { background: #fff; color: var(--ink); }
.drawer-row button:hover { background: var(--primary); color: #fff; }
.drawer-row button.ghost:hover { background: var(--ink); color: #fff; }

/* === ME "TU ES ICI" indicateur (style poster MAILLE) === */
#me-here-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px 8px 12px;
  background: #fff;
  color: var(--ink);
  border: 2.5px solid var(--ink);
  border-radius: 4px;
  font-family: var(--font-display);
  font-weight: 900;
  font-size: 18px;
  letter-spacing: 0.04em;
  box-shadow: 4px 4px 0 var(--primary);
  cursor: default;
  user-select: none;
  white-space: nowrap;
  transform: rotate(-2deg);
  transform-origin: center;
}
#me-here-badge .me-here-pin {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--primary);
  color: #fff;
  border: 2px solid var(--ink);
  flex-shrink: 0;
}
#me-here-badge .me-here-pin svg { display: block; }
#me-here-badge .me-here-label {
  display: inline-block;
  line-height: 1;
}
#me-here-layer svg path {
  color: var(--ink);
  filter: drop-shadow(0 1px 0 rgba(0,0,0,0.18));
}

/* ================================================================
   Profile / cluster / path panels (gardent leur fonction mais
   restyles dans l'esprit poster)
   ================================================================ */
#profile {
  position: fixed;
  bottom: 14px;
  left: 14px;
  z-index: 1000;
  background: var(--paper);
  border: 2.5px solid var(--ink);
  border-radius: 18px;
  box-shadow: 6px 6px 0 var(--ink);
  width: 380px;
  max-width: calc(100vw - 28px);
  padding: 18px 20px;
  font-family: var(--font-body);
  color: var(--ink);
}
#profile.hidden { display: none; }
#profile-actions {
  position: absolute;
  top: 8px;
  right: 8px;
  display: flex;
  gap: 4px;
  z-index: 2;
}
.profile-icon-btn {
  width: 32px;
  height: 32px;
  background: none;
  border: 0;
  cursor: pointer;
  color: var(--ink-soft);
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  transition: background 0.15s, color 0.15s;
}
.profile-icon-btn:hover { color: var(--ink); background: var(--paper); }
.profile-icon-btn svg { transition: transform 0.25s ease; display: block; }
#profile.collapsed #profile-collapse svg { transform: rotate(180deg); }
#profile.collapsed { padding-bottom: 14px; }
#profile.collapsed .pf-bio,
#profile.collapsed .pf-row,
#profile.collapsed .pf-section,
#profile.collapsed .pf-actions { display: none; }
#profile.collapsed .pf-counts { display: none; }

.pf-head { display: flex; gap: 14px; align-items: center; margin-bottom: 12px; }
.pf-pic {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  object-fit: cover;
  background: var(--paper);
  border: 3px solid var(--ink);
  flex-shrink: 0;
}
.pf-info { flex: 1; min-width: 0; }
.pf-name {
  font-family: var(--font-display);
  font-size: 24px;
  letter-spacing: -0.02em;
  margin: 0;
  line-height: 1;
}
.pf-handle {
  font-size: 13px;
  color: var(--ink-soft);
  font-weight: 600;
}
.pf-handle-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 4px;
}
.pf-chip-inline {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: white;
  border: 1.5px solid var(--ink);
  max-width: 180px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  line-height: 1.2;
}
.pf-counts {
  display: flex;
  gap: 16px;
  margin-top: 8px;
  font-size: 13px;
  font-weight: 600;
}
.pf-counts span { color: var(--ink-soft); font-weight: 500; }
.pf-counts b { color: var(--ink); font-variant-numeric: tabular-nums; }
.pf-bio {
  font-size: 12px;
  color: var(--ink);
  white-space: pre-wrap;
  margin: 8px 0;
  max-height: 80px;
  overflow-y: auto;
  line-height: 1.45;
}
.pf-row {
  display: flex;
  justify-content: space-between;
  padding: 6px 0;
  border-top: 1px dashed var(--ink-faint);
  font-size: 12px;
}
.pf-row:first-of-type { border-top: 0; }
.pf-row .k { color: var(--ink-soft); font-weight: 600; }
.pf-row .v { font-weight: 800; font-variant-numeric: tabular-nums; }

.pf-actions { display: flex; gap: 8px; margin-top: 14px; flex-wrap: wrap; }
.pf-actions button {
  flex: 1;
  min-width: 100px;
  padding: 10px 12px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.04em;
  border: 2px solid var(--ink);
  border-radius: 999px;
  background: #fff;
  cursor: pointer;
  color: var(--ink);
  min-height: 40px;
  text-transform: uppercase;
}
.pf-actions button:hover { background: var(--ink); color: #fff; }
.pf-actions button.primary { background: var(--ink); color: #fff; }
.pf-actions button.primary:hover { background: var(--primary); }
.pf-actions button.wrapped-cta { background: var(--primary); color: #fff; border-color: var(--ink); }
.pf-actions button.wrapped-cta:hover { background: var(--ink); }

.pf-chips { display: flex; gap: 6px; flex-wrap: wrap; margin: 6px 0 8px 0; }
.pf-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: white;
  border: 1.5px solid var(--ink);
}
.pf-chip .dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.85);
}
.pf-section { margin-top: 12px; padding-top: 12px; border-top: 1.5px dashed var(--ink-faint); }
.pf-section-title {
  font-size: 11px;
  color: var(--ink-soft);
  text-transform: uppercase;
  letter-spacing: 0.18em;
  margin-bottom: 8px;
  font-weight: 800;
}
.pf-mini-list { display: flex; gap: 10px; flex-wrap: wrap; }
.pf-mini {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  cursor: pointer;
  width: 56px;
}
.pf-mini img {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  object-fit: cover;
  background: var(--paper);
  border: 2px solid var(--ink);
  transition: transform 0.15s;
}
.pf-mini:hover img { transform: scale(1.08); border-color: var(--primary); }
.pf-mini .label {
  font-size: 10px;
  font-weight: 600;
  color: var(--ink);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 56px;
  text-align: center;
}
.pf-distance { font-size: 13px; color: var(--ink-soft); line-height: 1.5; font-weight: 600; }
.pf-distance b { color: var(--ink); }

/* === Cluster panel + path + stats : meme look poster === */
#cluster-panel, #stats-panel {
  position: fixed;
  right: 14px;
  top: 70px;
  z-index: 1100;
  background: var(--paper);
  border: 2.5px solid var(--ink);
  border-radius: 18px;
  box-shadow: 6px 6px 0 var(--ink);
  width: 320px;
  max-width: calc(100vw - 28px);
  padding: 16px 18px;
  color: var(--ink);
  max-height: calc(100vh - 100px);
  overflow-y: auto;
}
#cluster-panel.hidden, #stats-panel.hidden { display: none; }
#stats-panel { width: 380px; }
.cl-head { display: flex; gap: 12px; align-items: center; margin-bottom: 10px; }
.cl-color {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  flex-shrink: 0;
  border: 2.5px solid var(--ink);
}
.cl-name {
  flex: 1;
  font-family: var(--font-display);
  font-size: 20px;
  letter-spacing: -0.02em;
  overflow: hidden;
  text-overflow: ellipsis;
}
.cl-count {
  font-size: 12px;
  color: var(--ink-soft);
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.cl-close {
  background: none;
  border: 0;
  font-size: 22px;
  cursor: pointer;
  color: var(--ink-soft);
  padding: 0;
}
.cl-close:hover { color: var(--ink); }
.cl-members { margin-top: 12px; }
.cl-member {
  display: flex;
  gap: 10px;
  align-items: center;
  padding: 8px 0;
  border-bottom: 1px dashed var(--ink-faint);
  cursor: pointer;
  min-height: 44px;
}
.cl-member:hover { background: var(--paper-soft); }
.cl-member img {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  object-fit: cover;
  background: var(--paper);
  border: 2px solid var(--ink);
  flex-shrink: 0;
}
.cl-member .nm {
  flex: 1;
  min-width: 0;
  font-size: 13px;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.cl-actions { margin-top: 14px; }
.cl-actions button {
  width: 100%;
  padding: 12px;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.06em;
  border: 2px solid var(--ink);
  background: var(--ink);
  color: #fff;
  border-radius: 999px;
  cursor: pointer;
  min-height: 44px;
  text-transform: uppercase;
}
.cl-actions button:hover { background: var(--primary); }

#path-panel {
  position: fixed;
  bottom: 14px;
  left: 14px;
  z-index: 1000;
  background: var(--paper);
  border: 2.5px solid var(--ink);
  border-radius: 18px;
  box-shadow: 6px 6px 0 var(--ink);
  width: 380px;
  max-width: calc(100vw - 28px);
  padding: 14px 18px;
}
#path-panel.hidden { display: none; }
.path-head {
  font-family: var(--font-display);
  font-size: 18px;
  letter-spacing: -0.01em;
  margin-bottom: 10px;
}
.path-chain { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin: 8px 0; }
.path-step { display: flex; flex-direction: column; align-items: center; cursor: pointer; gap: 4px; }
.path-step img {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  object-fit: cover;
  background: var(--paper);
  border: 2px solid var(--ink);
  transition: transform 0.15s;
}
.path-step:hover img { transform: scale(1.08); border-color: var(--primary); }
.path-step .lbl {
  font-size: 10px;
  font-weight: 600;
  color: var(--ink);
  max-width: 50px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.path-arrow { color: var(--ink-soft); font-size: 16px; align-self: center; padding-bottom: 14px; font-weight: 700; }
.path-actions { margin-top: 12px; display: flex; gap: 8px; }
.path-actions button {
  flex: 1;
  padding: 10px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.06em;
  border: 2px solid var(--ink);
  border-radius: 999px;
  background: #fff;
  color: var(--ink);
  cursor: pointer;
  min-height: 40px;
  text-transform: uppercase;
}
.path-actions button:hover { background: var(--ink); color: #fff; }

/* === Stats panel === */
#stats-bar {
  position: fixed;
  left: 50%;
  transform: translateX(-50%);
  bottom: 14px;
  z-index: 999;
  background: #fff;
  border: 2px solid var(--ink);
  border-radius: 999px;
  box-shadow: 4px 4px 0 var(--ink);
  padding: 8px 18px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: var(--ink);
  max-width: calc(100vw - 200px);
  cursor: pointer;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-variant-numeric: tabular-nums;
}
#stats-bar:hover { background: var(--ink); color: #fff; }
#stats-bar.hidden { display: none; }

.stats-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; }
.stats-head h3 {
  margin: 0;
  font-family: var(--font-display);
  font-size: 22px;
  letter-spacing: -0.02em;
}
.stats-close {
  background: none;
  border: 0;
  font-size: 22px;
  cursor: pointer;
  color: var(--ink-soft);
  padding: 0;
  line-height: 1;
}
.stats-close:hover { color: var(--ink); }
.stats-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 16px; margin-bottom: 14px; font-size: 13px; }
.stats-grid .k { color: var(--ink-soft); font-weight: 600; }
.stats-grid .v { font-weight: 800; font-variant-numeric: tabular-nums; }
.stats-section { margin-top: 12px; padding-top: 12px; border-top: 1.5px dashed var(--ink-faint); }
.stats-section h4 {
  margin: 0 0 10px 0;
  font-family: var(--font-body);
  font-size: 11px;
  font-weight: 800;
  color: var(--ink-soft);
  text-transform: uppercase;
  letter-spacing: 0.18em;
}
.histo { display: flex; align-items: flex-end; gap: 2px; height: 80px; padding: 4px 0; }
.histo-bar {
  flex: 1;
  background: var(--ink);
  border-radius: 2px 2px 0 0;
  min-height: 2px;
  cursor: pointer;
  opacity: 0.7;
  transition: opacity 0.15s;
}
.histo-bar:hover { opacity: 1; background: var(--primary); }
.histo-bar.active { opacity: 1; background: var(--primary); }
.dist-row { display: flex; justify-content: space-between; align-items: center; padding: 6px 0; font-size: 12px; cursor: pointer; }
.dist-row:hover { background: var(--paper-soft); }
.dist-row .deg { color: var(--ink-soft); font-weight: 600; }
.dist-row .cnt { font-weight: 800; font-variant-numeric: tabular-nums; color: var(--primary); }

/* === Perspective modal (style poster) === */
#perspective-modal {
  position: fixed;
  inset: 0;
  z-index: 2400;
  background: rgba(14, 14, 12, 0.55);
  display: flex;
  align-items: center;
  justify-content: center;
}
#perspective-modal.hidden { display: none; }
.psp-card {
  background: var(--paper);
  border: 2.5px solid var(--ink);
  border-radius: 18px;
  box-shadow: 6px 6px 0 var(--ink);
  width: 420px;
  max-width: calc(100vw - 28px);
  padding: 22px 26px;
  font-family: var(--font-body);
  color: var(--ink);
}
.psp-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 14px; }
.psp-head strong { font-family: var(--font-display); font-size: 20px; letter-spacing: -0.02em; }
#psp-close {
  background: none;
  border: 0;
  font-size: 22px;
  cursor: pointer;
  color: var(--ink-soft);
}
#psp-close:hover { color: var(--ink); }
.psp-row { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; font-size: 13px; }
.psp-row label { color: var(--ink-soft); font-weight: 700; letter-spacing: 0.04em; }
.psp-row select {
  padding: 10px 12px;
  border: 2px solid var(--ink);
  border-radius: 10px;
  font-size: 13px;
  background: #fff;
  color: var(--ink);
  font-family: inherit;
}
.psp-actions { display: flex; justify-content: flex-end; margin-top: 8px; }
.psp-actions button {
  padding: 12px 20px;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  border: 2px solid var(--ink);
  border-radius: 999px;
  cursor: pointer;
  background: var(--ink);
  color: #fff;
}
.psp-actions button:hover { background: var(--primary); }
.psp-stage {
  font-family: var(--font-body);
  font-size: 13px;
  font-weight: 700;
  color: var(--ink);
  margin: 14px 0 8px 0;
  text-align: center;
  min-height: 18px;
  letter-spacing: 0.04em;
}
.psp-bar {
  width: 100%;
  height: 12px;
  background: var(--paper);
  border: 1.5px solid var(--ink);
  border-radius: 999px;
  overflow: hidden;
  margin: 0 0 10px 0;
  position: relative;
}
.psp-bar-fill {
  height: 100%;
  background: var(--ink);
  width: 0%;
  transition: width 0.35s ease-out;
  position: relative;
}
.psp-bar-fill::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.4), transparent);
  animation: onb-shimmer 1.4s linear infinite;
}
.psp-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  font-size: 11px;
  color: var(--ink-soft);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  min-height: 16px;
}
.psp-pct { font-weight: 800; color: var(--primary); flex-shrink: 0; }
.psp-detail { flex: 1; text-align: center; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.psp-time { flex-shrink: 0; }
#psp-progress.hidden { display: none; }

#perspective-card {
  display: flex;
  gap: 12px;
  align-items: center;
  margin: -10px -10px 12px -10px;
  padding: 12px 14px;
  background: var(--paper-soft);
  border-bottom: 2px dashed var(--ink-faint);
  border-radius: 18px 18px 0 0;
}
#perspective-card .psp-back {
  width: 36px;
  height: 36px;
  border: 2px solid var(--ink);
  border-radius: 10px;
  background: #fff;
  cursor: pointer;
  font-size: 16px;
  line-height: 32px;
  text-align: center;
  color: var(--ink);
  flex-shrink: 0;
  font-weight: 700;
}
#perspective-card .psp-back:hover { background: var(--ink); color: #fff; }
#perspective-card .psp-pic {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  object-fit: cover;
  background: var(--paper);
  border: 2px solid var(--ink);
  flex-shrink: 0;
}
#perspective-card .psp-id { flex: 1; min-width: 0; line-height: 1.2; }
#perspective-card .psp-name {
  font-family: var(--font-display);
  font-size: 18px;
  letter-spacing: -0.02em;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--ink);
}
#perspective-card .psp-handle {
  font-size: 12px;
  color: var(--ink-soft);
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ================================================================
   Leaflet zoom buttons (bottom-left, poster style)
   ================================================================ */
.leaflet-bottom.leaflet-left { bottom: 14px; left: 14px; }
.leaflet-control-zoom {
  box-shadow: 4px 4px 0 var(--ink);
  border: 2px solid var(--ink);
  border-radius: 12px;
  overflow: hidden;
}
.leaflet-control-zoom a {
  background: #fff;
  color: var(--ink);
  border: 0;
  font-weight: 700;
}
.leaflet-control-zoom a:hover { background: var(--ink); color: #fff; }

/* Hidden helper (shared) */
.hidden { display: none !important; }

/* ================================================================
   Mobile responsive
   ================================================================ */
@media (max-width: 600px) {
  .onb-intro-title { font-size: 40px; }
  .onb-load-username { font-size: 36px; }
  .onb-outro-title { font-size: 44px; }
  .onb-cta-primary { font-size: 18px; padding: 14px 24px; }

  #profile, #path-panel {
    left: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    max-width: 100%;
    border-radius: 18px 18px 0 0;
    border-bottom: 0;
    box-shadow: 0 -6px 0 var(--ink);
    padding: 14px 16px 24px 16px;
    max-height: 70vh;
    overflow-y: auto;
  }
  #profile::before {
    content: "";
    display: block;
    width: 40px;
    height: 4px;
    background: var(--ink);
    border-radius: 2px;
    margin: -6px auto 12px auto;
  }
  #cluster-panel, #stats-panel {
    left: 0;
    right: 0;
    top: 0;
    bottom: 0;
    width: 100%;
    max-width: 100%;
    height: 100vh;
    max-height: 100vh;
    border-radius: 0;
    border: 0;
    box-shadow: none;
  }
  #stats-bar {
    font-size: 11px;
    padding: 6px 12px;
    max-width: calc(100vw - 28px);
  }
  #app-header { left: 8px; right: 8px; top: 8px; }
  .me-badge { padding: 4px 12px 4px 4px; }
  .me-badge img { width: 28px; height: 28px; }
  .me-badge .nm { font-size: 12px; }

  .card-wrap {
    width: min(360px, calc(100vw - 32px));
  }
  .onb-reveal-deck { padding: 8px 0 16px; gap: 16px; }
}
