:root {
  --strip: #c2185b;
  --pole: #6a1b9a;
  --accent: #d81b60;
  --bg: #fff5f9;
  --bg-strong: #fde4ee;
  --fg: #3b0d22;
  --muted: #8a5670;
  --panel: rgba(255, 245, 249, 0.95);
  --border: #f6c4d8;
  --code-bg: #fce4ec;
  font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
  color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
  :root {
    --accent: #f06292;
    --bg: #1f0f17;
    --bg-strong: #33172a;
    --fg: #fbe3ee;
    --muted: #c48aa6;
    --panel: rgba(38, 17, 29, 0.95);
    --border: #5a2840;
    --code-bg: #33172a;
  }
}

* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--fg); }
a { color: var(--accent); }

.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 16px; height: 48px;
  border-bottom: 1px solid var(--border);
  background: linear-gradient(90deg, var(--bg-strong), var(--bg));
}
.topbar h1 { font-size: 1.1rem; margin: 0; color: var(--accent); }
.topbar h1 a { color: inherit; text-decoration: none; }
.topbar nav a { font-weight: 600; text-decoration: none; }

/* --- Carte --- */
.map-page { height: 100vh; height: 100dvh; display: flex; flex-direction: column; }
#map { flex: 1; }

.legend {
  position: absolute; left: 10px; bottom: 30px; z-index: 2;
  max-width: calc(100vw - 20px);
  background: var(--panel); border: 1px solid var(--border); border-radius: 8px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
  font-size: 0.9rem;
}
.legend summary { cursor: pointer; padding: 8px 12px; font-weight: 600; user-select: none; }
.legend[open] summary { border-bottom: 1px solid var(--border); }
.legend ul { list-style: none; margin: 0; padding: 8px 12px; }
.legend li + li { margin-top: 6px; }
.legend label { display: flex; align-items: center; gap: 8px; cursor: pointer; }
.legend .count { color: var(--muted); }
.legend .meta { margin: 0; padding: 0 12px 8px; font-size: 0.78rem; color: var(--muted); }

.dot {
  width: 12px; height: 12px; border-radius: 50%;
  background: var(--c); border: 2px solid #fff; box-shadow: 0 0 0 1px var(--c);
  flex: none;
}

.popup { color: #3b0d22; }
.popup h3 { margin: 4px 0 6px; font-size: 1rem; }
.popup p { margin: 2px 0; }
.popup .links { margin-top: 8px; font-size: 0.85rem; }
.popup a { color: #d81b60; }
.tag {
  display: inline-block; font-size: 0.72rem; font-weight: 600; color: #fff;
  background: var(--c); border-radius: 4px; padding: 1px 6px;
}

/* Contrôle de fond de carte (les contrôles MapLibre restent sur fond clair) */
.basemap-ctrl summary {
  list-style: none; cursor: pointer;
  width: 29px; height: 29px; display: grid; place-items: center; color: #3b0d22;
}
.basemap-ctrl summary::-webkit-details-marker { display: none; }
.basemap-ctrl fieldset { border: 0; margin: 0; padding: 6px 10px 8px; color: #3b0d22; font-size: 0.85rem; }
.basemap-ctrl legend { font-weight: 600; padding: 4px 0; }
.basemap-ctrl label { display: flex; gap: 6px; align-items: center; padding: 2px 0; white-space: nowrap; cursor: pointer; }
.basemap-ctrl input { accent-color: #d81b60; }
.legend input { accent-color: var(--accent); }

/* --- Page contribuer --- */
.doc { max-width: 760px; margin: 0 auto; padding: 24px 16px 64px; line-height: 1.6; }
.doc h1 { font-size: 1.8rem; line-height: 1.2; color: var(--accent); }
.doc h2 { margin-top: 2.2em; padding-top: 0.4em; border-top: 1px solid var(--border); }
.doc h2 .dot { display: inline-block; margin-right: 8px; vertical-align: middle; }
.doc code { background: var(--code-bg); padding: 1px 5px; border-radius: 4px; font-size: 0.9em; }
.doc table { border-collapse: collapse; width: 100%; font-size: 0.92rem; display: block; overflow-x: auto; }
.doc th, .doc td { border: 1px solid var(--border); padding: 6px 10px; text-align: left; vertical-align: top; }
.doc th { background: var(--code-bg); }
.doc .note { border-left: 4px solid var(--accent); background: var(--code-bg); padding: 10px 14px; border-radius: 0 6px 6px 0; }
