:root {
  /* — Surface, ink, lines — */
  --bg: #f3eee5;
  --bg-alt: #ece6d8;
  --surface: #faf7f0;
  --surface-elev: #fdfaf3;
  --border: #e7dfcf;
  --border-soft: #efe9da;
  --border-strong: #d4cab6;
  --text: #1d1c19;
  --text-muted: #6c6557;
  --text-faint: #726b5f;

  /* — Sage primary (rando, nature) — */
  --accent: #3f5a2e;
  --accent-soft: #4d6d39;
  --accent-bg: #e6ecd5;
  --accent-bg-soft: #eef2e0;
  --accent-dark: #2a3f1e;

  /* — Earth notes — */
  --warn: #8a5719;
  --warn-bg: #f1e4cb;
  --danger: #9a4a36;
  --danger-bg: #f1ddd0;

  /* — Lichen blue (train) — */
  --train: #3a5b6b;
  --train-soft: #4d7180;
  --train-bg: #dde7eb;

  /* — Difficulty palette: sage / honey / terracotta — */
  --c-facile: #5b7a3a;
  --c-moyen: #c08a3e;
  --c-difficile: #a55540;
  --c-poi: #7d54b3;

  /* — Source badges, harmonized warm — */
  --src-osm-bg: #ece6d6;        --src-osm-fg: #6c6557;
  --src-pnc-bg: #dfead0;        --src-pnc-fg: #3d5921;
  --src-pnrgca-bg: #f1ddbf;     --src-pnrgca-fg: #87521a;
  --src-cd48-bg: #e1d6ec;       --src-cd48-fg: #5d3d8a;
  --src-cd11-bg: #d8e3e7;       --src-cd11-fg: #3a5b6b;
  --src-cd81-bg: #d4dec3;       --src-cd81-fg: #486a26;
  --src-cd66-bg: #efd8cd;       --src-cd66-fg: #8d432a;
  --src-pymed-bg: #d2e0e3;      --src-pymed-fg: #2e596a;
  --src-pdipr32-bg: #e6ddc6;    --src-pdipr32-fg: #786134;
  --src-pdipr34-bg: #d7e1d2;    --src-pdipr34-fg: #46684a;

  /* — Geometry — */
  --r-xs: 8px;
  --r-sm: 12px;
  --r-md: 16px;
  --r-lg: 22px;
  --r-xl: 28px;
  --r-2xl: 36px;

  /* — Shadows: very diffuse, warm tone — */
  --shadow-xs: 0 1px 2px rgba(40, 36, 28, 0.04);
  --shadow-sm: 0 2px 8px rgba(40, 36, 28, 0.05);
  --shadow-md: 0 8px 24px rgba(40, 36, 28, 0.07);
  --shadow-lg: 0 20px 48px rgba(40, 36, 28, 0.10);
  --shadow-xl: 0 -16px 40px rgba(40, 36, 28, 0.10);

  /* — Motion: organic easing — */
  --ease-organic: cubic-bezier(0.32, 0.72, 0.27, 1);
  --ease-soft: cubic-bezier(0.4, 0, 0.2, 1);
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --t-fast: 200ms;
  --t-base: 320ms;
  --t-slow: 480ms;

  /* — Layout — */
  --header-h: 60px;
  --tabs-h: 50px;
  --safe-bottom: env(safe-area-inset-bottom, 0);

  /* — Typography stacks — */
  --font-display: "Fraunces", Georgia, "Times New Roman", serif;
  --font-body: "Geist", -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
  --font-mono: "Geist Mono", ui-monospace, "SF Mono", Menlo, monospace;
}

/* ============== RESET & BASE ============== */
* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; overflow: hidden; overscroll-behavior: none; }
body {
  font-family: var(--font-body);
  font-size: 14px;
  font-feature-settings: "ss01", "cv11";
  line-height: 1.55;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  -webkit-tap-highlight-color: transparent;
  background-image:
    radial-gradient(at 8% 0%, rgba(63, 90, 46, 0.045) 0%, transparent 45%),
    radial-gradient(at 92% 100%, rgba(58, 91, 107, 0.045) 0%, transparent 50%);
  background-attachment: fixed;
}
button { font-family: inherit; cursor: pointer; border: none; background: none; color: inherit; }
input, select { font-family: inherit; font-size: inherit; color: inherit; }
a { color: var(--accent); text-decoration: none; }

::selection { background: var(--accent-bg); color: var(--accent-dark); }

/* Hover-only on devices that hover */
@media (hover: hover) and (pointer: fine) {
  .hover-bg:hover { background: var(--bg-alt); }
}

/* ============== HEADER ============== */
.header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 22px;
  background: rgba(250, 247, 240, 0.78);
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  border-bottom: 1px solid var(--border-soft);
  z-index: 1000; flex-shrink: 0;
  height: var(--header-h);
  position: relative;
}
.header-brand {
  display: flex; align-items: center; gap: 12px;
  text-decoration: none; color: inherit; min-width: 0;
  transition: opacity var(--t-fast) var(--ease-soft);
}
.header-brand:hover { opacity: 0.78; }
.logo {
  width: 30px; height: 30px;
  color: var(--accent); flex-shrink: 0;
  transition: transform var(--t-base) var(--ease-out);
}
.header-brand:hover .logo { transform: rotate(-3deg) scale(1.05); }
.header-title {
  font-family: var(--font-display);
  font-size: 19px; font-weight: 500;
  font-variation-settings: "opsz" 14, "SOFT" 60;
  letter-spacing: -0.018em;
  color: var(--text);
}
.header-sub {
  font-family: var(--font-mono);
  font-size: 10px; font-weight: 400;
  color: var(--text-faint);
  text-transform: uppercase;
  letter-spacing: 0.14em;
  margin-left: 8px;
}
.header-nav { display: flex; gap: 4px; align-items: center; flex-shrink: 0; }
.header-btn {
  padding: 8px 14px;
  font-size: 13px; font-weight: 500;
  color: var(--text-muted);
  border-radius: 999px;
  text-decoration: none;
  transition: background var(--t-fast) var(--ease-soft),
              color var(--t-fast) var(--ease-soft),
              transform var(--t-fast) var(--ease-soft);
  min-height: 36px;
  display: inline-flex; align-items: center;
}
@media (hover: hover) {
  .header-btn:hover { background: var(--bg-alt); color: var(--text); }
  .header-btn.share:hover { background: var(--accent-bg); color: var(--accent-dark); }
  .header-btn.support:hover { background: var(--accent-bg); color: var(--accent-dark); }
}
.header-btn:active { transform: scale(0.96); }
.header-btn.share { color: var(--accent); font-weight: 500; }
.header-btn.support { color: var(--accent); font-weight: 500; }

/* ============== APP LAYOUT ============== */
.app { display: flex; height: 100vh; flex-direction: column; }
.body-wrap { display: flex; flex: 1; overflow: hidden; position: relative; }

/* ============== SIDEBAR (desktop) ============== */
.sidebar {
  width: 392px; min-width: 392px;
  background: var(--surface);
  border-right: 1px solid var(--border-soft);
  display: flex; flex-direction: column;
  overflow: hidden;
  position: relative;
}
.sb-handle { display: none; } /* visible uniquement en mobile (override dans @media) */

/* — Combobox custom (autocomplete gares) — */
.combobox { position: relative; }
.suggestions {
  position: absolute;
  top: calc(100% + 4px); left: 0; right: 0;
  background: var(--surface-elev);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  max-height: 260px;
  overflow-y: auto;
  z-index: 1000;
  margin: 0;
  padding: 4px;
  list-style: none;
  display: none;
  box-shadow: var(--shadow-md);
  -webkit-overflow-scrolling: touch;
}
.suggestions.open { display: block; }
.suggestions li {
  padding: 9px 12px;
  border-radius: var(--r-sm);
  cursor: pointer;
  font-size: 14px;
  font-family: var(--font-body);
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 10px;
  color: var(--text);
  user-select: none;
  -webkit-user-select: none;
}
.suggestions li:hover,
.suggestions li.active {
  background: var(--accent-bg);
  color: var(--accent-dark);
}
.suggestions li .sug-dept {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-faint);
  flex-shrink: 0;
  letter-spacing: 0.04em;
}
.suggestions li.empty {
  color: var(--text-faint);
  font-style: italic;
  cursor: default;
}
.suggestions li.empty:hover { background: transparent; color: var(--text-faint); }

/* — Bouton géolocalisation (gare la plus proche) — */
.field-label.with-action { gap: 8px; }
.field-label.with-action > span:first-child {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.geo-btn {
  display: inline-flex; align-items: center; gap: 5px;
  flex-shrink: 0;
  padding: 4px 10px;
  font-family: var(--font-body);
  font-size: 11.5px; font-weight: 500;
  text-transform: none; letter-spacing: 0;
  color: var(--accent);
  background: var(--accent-bg-soft);
  border-radius: 999px;
  min-height: 26px;
  transition: background var(--t-fast) var(--ease-soft),
              transform var(--t-fast) var(--ease-soft),
              opacity var(--t-fast) var(--ease-soft);
}
@media (hover: hover) {
  .geo-btn:hover { background: var(--accent-bg); }
}
.geo-btn:active { transform: scale(0.96); }
.geo-btn svg { width: 13px; height: 13px; flex-shrink: 0; }
.geo-btn:disabled { opacity: 0.55; cursor: default; }
.geo-btn .geo-spin {
  display: none;
  width: 13px; height: 13px;
  border: 2px solid var(--accent);
  border-top-color: transparent;
  border-radius: 50%;
  animation: geospin 0.7s linear infinite;
}
.geo-btn.loading .geo-pin { display: none; }
.geo-btn.loading .geo-spin { display: inline-block; }
@keyframes geospin { to { transform: rotate(360deg); } }

/* — Mode tabs: pill-glide indicator — */
.mode-tabs {
  display: flex;
  padding: 10px 14px 10px;
  background: var(--surface);
  gap: 4px;
  flex-shrink: 0;
  position: relative;
}
.mode-tab {
  flex: 1;
  padding: 9px 10px;
  font-size: 12.5px; font-weight: 500;
  color: var(--text-faint);
  border-radius: var(--r-sm);
  background: transparent;
  transition: color var(--t-base) var(--ease-soft),
              background var(--t-base) var(--ease-soft);
  text-align: center;
  min-height: 44px;
  position: relative;
}
@media (hover: hover) {
  .mode-tab:hover { color: var(--text-muted); }
}
.mode-tab.active {
  color: var(--text);
  background: var(--bg-alt);
}
.mode-tab .mode-tab-sub {
  display: block;
  font-size: 10px;
  color: var(--text-faint);
  margin-top: 2px;
  font-weight: 400;
  font-family: var(--font-mono);
  letter-spacing: 0.02em;
}
.mode-tab.active .mode-tab-sub { color: var(--text-muted); }

/* — Intro — */
.intro {
  padding: 12px 24px 14px;
  flex-shrink: 0;
}
.intro-text {
  font-size: 12.5px;
  color: var(--text-muted);
  line-height: 1.5;
}
.intro-suggest {
  margin-top: 10px;
}
.intro-suggest-label {
  font-size: 11px;
  color: var(--text-faint);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  display: block;
  margin-bottom: 6px;
}
.intro-suggest-chips {
  display: flex; flex-wrap: wrap; gap: 6px;
}
.intro-suggest-chip {
  padding: 5px 11px;
  font-size: 12.5px; font-weight: 500;
  color: var(--accent-dark);
  background: var(--accent-bg-soft);
  border: 1px solid var(--border-soft);
  border-radius: 999px;
  cursor: pointer;
  transition: background var(--t-fast) var(--ease-soft);
}
@media (hover: hover) {
  .intro-suggest-chip:hover { background: var(--accent-bg); }
}

/* — Filters — */
.filters {
  padding: 10px 24px 16px;
  border-top: 1px solid var(--border-soft);
  max-height: 42vh;
  overflow-y: auto;
  flex-shrink: 0;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
  scrollbar-color: var(--border-strong) transparent;
}
.filters::-webkit-scrollbar { width: 6px; }
.filters::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 3px; }
.filters::-webkit-scrollbar-track { background: transparent; }

.field { margin-bottom: 14px; }
.field:last-child { margin-bottom: 0; }
.field-label {
  display: flex; justify-content: space-between; align-items: center;
  font-family: var(--font-mono);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.10em;
  color: var(--text-muted);
  font-weight: 500;
  margin-bottom: 7px;
}
.field-val {
  font-family: var(--font-display);
  font-size: 13px;
  font-weight: 500;
  font-variation-settings: "opsz" 24, "SOFT" 50;
  color: var(--text);
  text-transform: none;
  letter-spacing: -0.005em;
}
.field-val.train { color: var(--train); }

/* — Search input — */
.field input[type="search"] {
  width: 100%;
  padding: 11px 14px;
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  background: var(--surface-elev);
  outline: none;
  transition: border-color var(--t-base) var(--ease-soft),
              box-shadow var(--t-base) var(--ease-soft),
              background var(--t-base) var(--ease-soft);
  min-height: 42px;
  font-size: 14px;
  color: var(--text);
}
.field input[type="search"]::placeholder { color: var(--text-faint); }
.field input[type="search"]:hover { border-color: var(--border-strong); }
.field input[type="search"]:focus {
  border-color: var(--accent-soft);
  background: var(--surface-elev);
  box-shadow: 0 0 0 4px rgba(63, 90, 46, 0.10);
}

/* — Range slider: thin track, generous handle — */
.field input[type="range"] {
  width: 100%;
  -webkit-appearance: none; appearance: none;
  background: transparent;
  cursor: pointer;
  height: 24px;
  touch-action: manipulation;
  outline: none;
}
.field input[type="range"]::-webkit-slider-runnable-track {
  height: 4px;
  background: var(--border);
  border-radius: 999px;
}
.field input[type="range"]::-moz-range-track {
  height: 4px;
  background: var(--border);
  border-radius: 999px;
}
.field input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none; appearance: none;
  width: 20px; height: 20px;
  background: var(--surface-elev);
  border: 2px solid var(--accent);
  border-radius: 50%;
  margin-top: -8px;
  box-shadow: 0 2px 6px rgba(40, 36, 28, 0.12);
  transition: transform var(--t-fast) var(--ease-out),
              box-shadow var(--t-fast) var(--ease-soft);
}
.field input[type="range"]::-moz-range-thumb {
  width: 20px; height: 20px;
  background: var(--surface-elev);
  border: 2px solid var(--accent);
  border-radius: 50%;
  box-shadow: 0 2px 6px rgba(40, 36, 28, 0.12);
  transition: transform var(--t-fast) var(--ease-out);
}
.field input[type="range"]:hover::-webkit-slider-thumb { transform: scale(1.1); }
.field input[type="range"]:hover::-moz-range-thumb { transform: scale(1.1); }
.field input[type="range"]:focus::-webkit-slider-thumb {
  box-shadow: 0 0 0 6px rgba(63, 90, 46, 0.16);
}
.field input[type="range"]:active::-webkit-slider-thumb { transform: scale(1.18); }
.field input[type="range"].train::-webkit-slider-thumb { border-color: var(--train); }
.field input[type="range"].train::-moz-range-thumb { border-color: var(--train); }
.field input[type="range"].train:focus::-webkit-slider-thumb {
  box-shadow: 0 0 0 6px rgba(58, 91, 107, 0.16);
}

/* — Dual range: deux curseurs (min + max) sur une meme piste — */
.dual-range {
  position: relative;
  height: 24px;
}
.dual-range .dr-track,
.dual-range .dr-fill {
  position: absolute;
  top: 10px;
  height: 4px;
  border-radius: 999px;
  pointer-events: none;
}
.dual-range .dr-track { left: 0; right: 0; background: var(--border); }
.dual-range .dr-fill  { background: var(--accent); }
.field .dual-range input[type="range"] {
  position: absolute;
  left: 0; top: 0;
  width: 100%;
  margin: 0;
  pointer-events: none; /* seuls les pouces captent les evenements */
}
.field .dual-range input[type="range"]::-webkit-slider-runnable-track { background: transparent; }
.field .dual-range input[type="range"]::-moz-range-track { background: transparent; }
.field .dual-range input[type="range"]::-webkit-slider-thumb { pointer-events: auto; }
.field .dual-range input[type="range"]::-moz-range-thumb { pointer-events: auto; }
.dual-range input.dr-min { z-index: 3; }
.dual-range input.dr-max { z-index: 2; }

/* — Chips — */
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip {
  flex: 1 0 auto;
  padding: 8px 12px;
  border: 1px solid transparent;
  background: var(--bg-alt);
  border-radius: 999px;
  font-size: 12.5px; font-weight: 500;
  color: var(--text-muted);
  transition: all var(--t-base) var(--ease-out);
  white-space: nowrap; min-width: 0;
  min-height: 36px;
}
@media (hover: hover) {
  .chip:hover { background: var(--bg); color: var(--text); transform: translateY(-1px); }
}
.chip:active { transform: scale(0.97); }
.chip.active {
  background: var(--accent-bg);
  color: var(--accent-dark);
  font-weight: 600;
}
.chip.active.diff-facile { background: var(--accent-bg); color: var(--c-facile); }
.chip.active.diff-moyen  { background: var(--warn-bg);   color: var(--warn); }
.chip.active.diff-difficile { background: var(--danger-bg); color: var(--danger); }

/* — Advanced collapse — */
.advanced {
  margin-top: 14px;
  border-top: 1px solid var(--border-soft);
  padding-top: 12px;
}
.advanced summary {
  font-family: var(--font-mono);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.10em;
  color: var(--text-muted);
  font-weight: 500;
  cursor: pointer;
  padding: 4px 0;
  user-select: none;
  list-style: none;
  transition: color var(--t-fast) var(--ease-soft);
}
.advanced summary:hover { color: var(--text); }
.advanced summary::-webkit-details-marker { display: none; }
.advanced summary::before {
  content: "›";
  display: inline-block;
  font-family: var(--font-display);
  font-size: 16px;
  line-height: 0.6;
  transition: transform var(--t-base) var(--ease-out);
  margin-right: 8px;
  vertical-align: middle;
  color: var(--text-faint);
}
.advanced[open] summary::before { transform: rotate(90deg); }
.advanced .advanced-fields { padding-top: 12px; }

.planner-info {
  padding: 11px 14px;
  background: var(--train-bg);
  color: var(--train);
  border-radius: var(--r-sm);
  font-size: 12.5px;
  margin-bottom: 14px;
  line-height: 1.5;
}

/* ============== RESULTS HEADER ============== */
.results-header {
  padding: 11px 22px 11px 24px;
  border-top: 1px solid var(--border-soft);
  background: var(--bg-alt);
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  flex-shrink: 0;
  min-height: 44px;
}
.results-meta {
  font-family: var(--font-mono);
  font-size: 10.5px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.10em;
  font-weight: 500;
}
.results-meta strong {
  color: var(--text);
  font-weight: 600;
  font-family: var(--font-display);
  font-variation-settings: "opsz" 24, "SOFT" 50;
  font-size: 14px;
  letter-spacing: -0.005em;
  text-transform: none;
}
.results-hidden {
  color: var(--warn);
}
.results-hidden-reset {
  color: var(--warn);
  text-decoration: underline;
  font-family: var(--font-mono);
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: 0.10em;
  font-weight: 600;
  cursor: pointer;
  padding: 0;
}
.sort-select {
  padding: 6px 26px 6px 12px;
  background: var(--surface-elev) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12' fill='%236c6557'%3E%3Cpath d='M3 4.5l3 3 3-3' stroke='%236c6557' stroke-width='1.4' stroke-linecap='round' stroke-linejoin='round' fill='none'/%3E%3C/svg%3E") no-repeat right 8px center;
  background-size: 11px;
  border: 1px solid var(--border);
  border-radius: 999px;
  font-size: 12px; font-weight: 500;
  color: var(--text);
  appearance: none; -webkit-appearance: none;
  cursor: pointer;
  min-height: 30px;
  transition: border-color var(--t-fast) var(--ease-soft),
              background-color var(--t-fast) var(--ease-soft);
}
.sort-select:hover { border-color: var(--border-strong); }
.sort-select:focus { border-color: var(--accent); outline: none; }
.gr-select { width: 100%; box-sizing: border-box; }

/* ============== RESULTS LIST ============== */
.results-list {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  min-height: 220px;
  padding: 8px 12px;
  scrollbar-width: thin;
  scrollbar-color: var(--border-strong) transparent;
}
.results-list::-webkit-scrollbar { width: 6px; }
.results-list::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 3px; }
.results-list::-webkit-scrollbar-track { background: transparent; }

.result-card {
  padding: 11px 12px;
  margin-bottom: 4px;
  border-radius: var(--r-md);
  cursor: pointer;
  transition: background var(--t-base) var(--ease-soft),
              transform var(--t-fast) var(--ease-out),
              box-shadow var(--t-base) var(--ease-soft);
  display: flex; gap: 12px; align-items: stretch;
  min-height: 76px;
  position: relative;
  animation: cardIn var(--t-slow) var(--ease-out) both;
}
.result-card:nth-child(1) { animation-delay: 20ms; }
.result-card:nth-child(2) { animation-delay: 40ms; }
.result-card:nth-child(3) { animation-delay: 60ms; }
.result-card:nth-child(4) { animation-delay: 80ms; }
.result-card:nth-child(5) { animation-delay: 100ms; }
.result-card:nth-child(6) { animation-delay: 120ms; }
.result-card:nth-child(7) { animation-delay: 140ms; }
.result-card:nth-child(8) { animation-delay: 160ms; }
.result-card:nth-child(n+9) { animation-delay: 180ms; }

@keyframes cardIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

@media (hover: hover) {
  .result-card:hover, .result-card.hovered {
    background: var(--bg-alt);
    transform: translateX(2px);
  }
}
.result-card:active { background: var(--bg-alt); }
.result-card.selected {
  background: var(--accent-bg-soft);
  box-shadow: inset 3px 0 0 var(--accent);
}

.rc-photo {
  width: 64px; height: 64px;
  flex-shrink: 0;
  border-radius: var(--r-sm);
  background: var(--bg-alt) center/cover no-repeat;
  border: none;
  box-shadow: var(--shadow-xs);
  transition: transform var(--t-base) var(--ease-out);
}
.result-card:hover .rc-photo { transform: scale(1.04); }
.rc-photo.no-img {
  background: linear-gradient(135deg, #d6dec5 0%, #b8c4a3 100%);
  display: flex; align-items: center; justify-content: center;
  color: rgba(255, 255, 255, 0.85);
  font-size: 20px;
}
.rc-body {
  flex: 1; min-width: 0;
  display: flex; flex-direction: column; justify-content: space-between;
  gap: 3px;
}
.rc-top { display: flex; align-items: flex-start; gap: 8px; }
.rc-name {
  font-family: var(--font-display);
  font-size: 14.5px;
  font-weight: 500;
  font-variation-settings: "opsz" 24, "SOFT" 50;
  letter-spacing: -0.01em;
  flex: 1; line-height: 1.3;
  overflow: hidden; text-overflow: ellipsis;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
  color: var(--text);
}
.rc-dot {
  width: 9px; height: 9px;
  border-radius: 50%;
  flex-shrink: 0;
  margin-top: 6px;
  box-shadow: 0 0 0 2px var(--surface);
}
.rc-meta {
  font-size: 11px; color: var(--text-muted);
  display: flex; gap: 6px; align-items: center; flex-wrap: wrap;
}
.rc-stats {
  display: flex; gap: 11px;
  font-family: var(--font-mono);
  font-size: 10.5px;
  color: var(--text-faint);
  flex-wrap: wrap;
  letter-spacing: 0.02em;
}
.rc-stats span { white-space: nowrap; }

.rc-trip {
  font-size: 11px;
  color: var(--train);
  font-weight: 500;
  background: var(--train-bg);
  padding: 3px 9px;
  border-radius: 999px;
  display: inline-block;
  max-width: 100%;
}
.rc-trip-walk { color: var(--accent); background: var(--accent-bg); }

/* — Source badges — */
.src-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  font-family: var(--font-mono);
  font-size: 9.5px; font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  white-space: nowrap;
}
.src-osm { background: var(--src-osm-bg); color: var(--src-osm-fg); }
.src-pnc { background: var(--src-pnc-bg); color: var(--src-pnc-fg); }
.src-pnrgca { background: var(--src-pnrgca-bg); color: var(--src-pnrgca-fg); }
.src-cd48 { background: var(--src-cd48-bg); color: var(--src-cd48-fg); }
.src-cd11, .src-cd11_alt { background: var(--src-cd11-bg); color: var(--src-cd11-fg); }
.src-cd81 { background: var(--src-cd81-bg); color: var(--src-cd81-fg); }
.src-cd66 { background: var(--src-cd66-bg); color: var(--src-cd66-fg); }
.src-pymed { background: var(--src-pymed-bg); color: var(--src-pymed-fg); }
.src-pdipr-cd32 { background: var(--src-pdipr32-bg); color: var(--src-pdipr32-fg); }
.src-pdipr-cd34 { background: var(--src-pdipr34-bg); color: var(--src-pdipr34-fg); }

/* — Empty state with topographic illustration — */
.empty-state {
  padding: 56px 28px 48px;
  text-align: center;
  color: var(--text-muted);
  font-size: 13px;
  line-height: 1.7;
  position: relative;
}
.empty-state::before {
  content: "";
  display: block;
  width: 120px; height: 60px;
  margin: 0 auto 20px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 120 60' fill='none' stroke='%23a39a89' stroke-width='1.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M2 50 Q 20 30, 35 38 T 65 28 T 95 32 T 118 22'/%3E%3Cpath d='M2 56 Q 25 42, 42 48 T 75 40 T 118 38' opacity='0.6'/%3E%3Cpath d='M2 44 Q 18 22, 32 28 T 58 14 T 88 18 T 118 8' opacity='0.4'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-size: contain;
  opacity: 0.7;
}
.empty-state strong {
  display: block;
  font-family: var(--font-display);
  font-variation-settings: "opsz" 24, "SOFT" 60;
  color: var(--text);
  margin-bottom: 8px;
  font-weight: 500;
  font-size: 16px;
  letter-spacing: -0.01em;
}

/* ============== MAP ============== */
.map-wrap { flex: 1; position: relative; background: #d8e1dc; }
#map { width: 100%; height: 100%; }

/* ============== DETAIL PANEL (desktop) ============== */
.map-detail {
  position: absolute;
  top: 18px; right: 18px;
  width: 360px;
  max-height: calc(100vh - 36px - var(--header-h));
  background: var(--surface-elev);
  border: 1px solid var(--border-soft);
  border-radius: var(--r-lg);
  z-index: 800;
  display: none;
  box-shadow: var(--shadow-lg);
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
  scrollbar-color: var(--border-strong) transparent;
}
.map-detail::-webkit-scrollbar { width: 6px; }
.map-detail::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 3px; }
.map-detail.show {
  display: block;
  animation: detailIn var(--t-slow) var(--ease-out);
}
.md-handle { display: none; }
@keyframes detailIn {
  from { opacity: 0; transform: translateY(8px) scale(0.985); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.md-photo {
  width: 100%; height: 180px;
  background: var(--bg-alt) center/cover no-repeat;
  border-top-left-radius: var(--r-lg);
  border-top-right-radius: var(--r-lg);
  position: relative;
  flex-shrink: 0;
}
.md-photo::after {
  content: "";
  position: absolute; inset: 0;
  background: linear-gradient(180deg, transparent 60%, rgba(40,36,28,0.18) 100%);
  border-top-left-radius: var(--r-lg);
  border-top-right-radius: var(--r-lg);
  pointer-events: none;
}
.md-photo.no-img {
  background: linear-gradient(135deg, #d6dec5 0%, #b8c4a3 100%);
  display: flex; align-items: center; justify-content: center;
  font-size: 40px;
  color: rgba(255,255,255,0.85);
}
.md-photo-credit {
  position: absolute; bottom: 8px; right: 10px;
  font-family: var(--font-mono);
  font-size: 9.5px;
  color: white;
  background: rgba(29, 28, 25, 0.55);
  padding: 3px 8px;
  border-radius: 999px;
  letter-spacing: 0.04em;
  z-index: 1;
}
.md-inner { padding: 18px 20px 20px; }
.md-lic {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text-muted);
  letter-spacing: 0.02em;
}
.md-close {
  position: absolute; top: 12px; right: 12px;
  width: 36px; height: 36px;
  background: rgba(250, 247, 240, 0.92);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  font-size: 20px;
  line-height: 1;
  text-align: center;
  color: var(--text);
  border-radius: 50%;
  z-index: 10;
  box-shadow: var(--shadow-sm);
  display: flex; align-items: center; justify-content: center;
  transition: background var(--t-fast) var(--ease-soft),
              transform var(--t-fast) var(--ease-out);
}
@media (hover: hover) {
  .md-close:hover { background: white; transform: scale(1.05); }
}
.md-close:active { transform: scale(0.92); }

.md-badges { display: flex; gap: 6px; margin-bottom: 10px; flex-wrap: wrap; }
.md-badge {
  display: inline-block; padding: 3px 10px;
  border-radius: 999px;
  font-family: var(--font-mono);
  font-size: 9.5px; font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.md-name {
  font-family: var(--font-display);
  font-size: 19px;
  font-weight: 500;
  font-variation-settings: "opsz" 32, "SOFT" 50;
  line-height: 1.2;
  letter-spacing: -0.018em;
  margin-bottom: 5px;
  color: var(--text);
}
.md-gare {
  font-size: 12.5px;
  color: var(--text-muted);
  margin-bottom: 12px;
}

.md-trip {
  display: flex; gap: 6px;
  padding: 12px 14px;
  background: var(--train-bg);
  border-radius: var(--r-sm);
  margin-bottom: 12px;
  align-items: stretch;
  font-size: 12.5px;
  flex-direction: column;
}
.md-trip-row { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.md-trip-leg { display: inline-flex; align-items: center; gap: 4px; }
.md-trip-leg.train { color: var(--train); font-weight: 500; }
.md-trip-leg.walk { color: var(--accent); font-weight: 500; }
.md-trip-arrow { color: var(--text-faint); }
.md-trip-total {
  margin-left: auto;
  font-weight: 600;
  color: var(--text);
  font-family: var(--font-display);
  font-variation-settings: "opsz" 24, "SOFT" 50;
}
.md-trip-via { font-size: 11px; color: var(--text-muted); margin-top: 4px; }

.md-description {
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 14px;
  padding: 11px 14px;
  background: var(--bg-alt);
  border-radius: var(--r-sm);
  line-height: 1.55;
  position: relative;
}
.md-description::before {
  content: "";
  position: absolute;
  left: 0; top: 14px; bottom: 14px;
  width: 2px;
  background: var(--accent);
  border-radius: 999px;
  opacity: 0.5;
}
.md-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 14px; }
.md-stat {
  background: var(--bg-alt);
  border-radius: var(--r-sm);
  padding: 10px 12px;
}
.md-sl {
  font-family: var(--font-mono);
  font-size: 9.5px;
  color: var(--text-faint);
  text-transform: uppercase;
  letter-spacing: 0.10em;
  margin-bottom: 3px;
}
.md-sv {
  font-family: var(--font-display);
  font-size: 14px;
  font-weight: 500;
  font-variation-settings: "opsz" 24, "SOFT" 50;
  letter-spacing: -0.005em;
  color: var(--text);
}

.md-elevation {
  margin-bottom: 14px;
  padding: 12px 14px;
  background: var(--bg-alt);
  border-radius: var(--r-sm);
}
.md-elevation-title {
  font-family: var(--font-mono);
  font-size: 9.5px;
  color: var(--text-faint);
  text-transform: uppercase;
  letter-spacing: 0.10em;
  margin-bottom: 8px;
}
.md-elevation-bar {
  display: flex; height: 6px;
  border-radius: 999px;
  overflow: hidden;
  background: var(--border);
  margin-bottom: 7px;
}
.md-elev-up { background: var(--c-difficile); }
.md-elev-down { background: var(--accent); }
.md-elevation-stats {
  display: flex; justify-content: space-between;
  font-family: var(--font-mono);
  font-size: 10.5px;
  color: var(--text-muted);
}
.md-elev-stat strong { color: var(--text); }

.md-carbon {
  margin-bottom: 14px;
  padding: 14px 16px 12px 18px;
  background: var(--accent-bg-soft);
  border-radius: var(--r-sm);
  position: relative;
}
.md-carbon::before {
  content: "";
  position: absolute;
  left: 0; top: 14px; bottom: 14px;
  width: 2px;
  background: var(--accent);
  border-radius: 999px;
  opacity: 0.55;
}
.md-carbon-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 6px;
  gap: 8px;
}
.md-carbon-label {
  font-family: var(--font-mono);
  font-size: 9.5px;
  text-transform: uppercase;
  letter-spacing: 0.10em;
  color: var(--accent-dark);
  font-weight: 500;
}
.md-carbon-icon {
  width: 16px; height: 16px;
  flex-shrink: 0;
  color: var(--accent);
  opacity: 0.7;
}
.md-carbon-saved {
  font-family: var(--font-display);
  font-size: 21px;
  font-weight: 500;
  font-variation-settings: "opsz" 32, "SOFT" 60;
  letter-spacing: -0.018em;
  color: var(--accent-dark);
  line-height: 1.15;
  margin-bottom: 2px;
}
.md-carbon-saved .unit {
  font-family: var(--font-body);
  font-size: 13px;
  color: var(--accent);
  font-weight: 400;
  margin-left: 4px;
  letter-spacing: normal;
  font-variation-settings: normal;
}
.md-carbon-compare {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid rgba(63, 90, 46, 0.15);
}
.md-carbon-cell {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}
.md-carbon-cell .v {
  font-family: var(--font-display);
  font-variation-settings: "opsz" 24, "SOFT" 50;
  font-weight: 500;
  font-size: 13.5px;
  letter-spacing: -0.005em;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.md-carbon-cell.train .v { color: var(--accent-dark); }
.md-carbon-cell .l {
  font-family: var(--font-mono);
  font-size: 9px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.md-carbon-note {
  font-family: var(--font-mono);
  font-size: 9.5px;
  color: var(--text-faint);
  letter-spacing: 0.02em;
  margin-top: 9px;
  line-height: 1.55;
}
.md-carbon-note a {
  color: var(--text-muted);
  text-decoration: underline;
  text-decoration-color: var(--border-strong);
  text-underline-offset: 2px;
}
.md-carbon-note a:hover { color: var(--accent); }

.md-tags { display: flex; flex-wrap: wrap; gap: 5px; margin-bottom: 12px; }
.md-tag {
  font-size: 10.5px;
  padding: 3px 9px;
  background: var(--bg-alt);
  color: var(--text-muted);
  border-radius: 999px;
}

.md-actions { display: flex; gap: 8px; margin-bottom: 10px; }
.md-btn {
  flex: 1;
  padding: 11px;
  background: var(--accent);
  color: white;
  border-radius: 999px;
  font-size: 12.5px;
  font-weight: 600;
  text-decoration: none;
  text-align: center;
  transition: background var(--t-fast) var(--ease-soft),
              transform var(--t-fast) var(--ease-out),
              box-shadow var(--t-fast) var(--ease-soft);
  display: inline-flex; align-items: center; justify-content: center;
  min-height: 40px;
  box-shadow: 0 2px 8px rgba(63, 90, 46, 0.20);
}
@media (hover: hover) {
  .md-btn:hover { background: var(--accent-soft); transform: translateY(-1px); box-shadow: 0 4px 12px rgba(63, 90, 46, 0.25); }
}
.md-btn:active { transform: scale(0.97); }
.md-btn.train {
  background: var(--train);
  box-shadow: 0 2px 8px rgba(58, 91, 107, 0.22);
}
@media (hover: hover) {
  .md-btn.train:hover { background: var(--train-soft); box-shadow: 0 4px 12px rgba(58, 91, 107, 0.28); }
}
.md-btn.secondary {
  background: var(--bg-alt);
  color: var(--accent);
  box-shadow: none;
}
@media (hover: hover) {
  .md-btn.secondary:hover { background: var(--accent-bg); transform: translateY(-1px); }
}
.md-btn.disabled {
  background: var(--bg-alt);
  color: var(--text-faint);
  cursor: not-allowed;
  pointer-events: none;
  box-shadow: none;
}

.md-actions-cta { margin-bottom: 4px; }
.md-affiliate-notice {
  font-family: var(--font-mono);
  font-size: 9.5px;
  color: var(--text-faint);
  text-align: center;
  margin-bottom: 10px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.md-pois {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--border-soft);
}
.md-pois-title {
  font-family: var(--font-mono);
  font-size: 9.5px;
  color: var(--text-faint);
  text-transform: uppercase;
  letter-spacing: 0.10em;
  margin-bottom: 8px;
}
.md-poi-list { display: flex; flex-direction: column; gap: 6px; }
.md-poi {
  font-size: 12px;
  padding: 8px 10px 8px 12px;
  background: var(--bg-alt);
  border-radius: var(--r-sm);
  position: relative;
}
.md-poi::before {
  content: "";
  position: absolute;
  left: 0; top: 8px; bottom: 8px;
  width: 2px;
  background: var(--c-poi);
  border-radius: 999px;
  opacity: 0.6;
}
.md-poi-name { font-weight: 500; color: var(--text); }
.md-poi-desc {
  color: var(--text-muted);
  font-size: 11px;
  margin-top: 2px;
  line-height: 1.45;
}
.md-poi-loading {
  color: var(--text-faint);
  font-size: 11px;
  padding: 6px 0;
  font-family: var(--font-mono);
}

.md-extra { padding-top: 10px; border-top: 1px solid var(--border-soft); }
.md-extra:empty { display: none; }
.md-extra-row { font-size: 11.5px; margin-bottom: 5px; color: var(--text-muted); }
.md-extra-row a { color: var(--accent); }
.md-note {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text-faint);
  margin-top: 10px;
  line-height: 1.5;
  letter-spacing: 0.02em;
}
.md-note.loading { color: var(--accent); }
.md-note:empty { margin: 0; }

/* ============== LEGEND / OVERLAYS ============== */
.legend {
  position: absolute;
  bottom: 26px; left: 18px;
  background: rgba(250, 247, 240, 0.92);
  backdrop-filter: blur(14px) saturate(180%);
  -webkit-backdrop-filter: blur(14px) saturate(180%);
  border: 1px solid var(--border-soft);
  border-radius: var(--r-md);
  padding: 10px 14px;
  z-index: 800;
  font-size: 11px;
  box-shadow: var(--shadow-md);
}
.legend-row {
  display: flex; align-items: center; gap: 8px;
  color: var(--text-muted);
  margin-bottom: 4px;
}
.legend-row:last-child { margin-bottom: 0; }
.legend-dot { width: 9px; height: 9px; border-radius: 50%; }
.legend-square {
  width: 10px; height: 10px;
  background: var(--text);
  border: 2px solid white;
  border-radius: 2px;
  box-shadow: 0 1px 2px rgba(0,0,0,0.2);
}
.legend-star { width: 12px; height: 12px; color: var(--train); font-size: 13px; line-height: 1; }
.legend-poi { width: 9px; height: 9px; background: var(--c-poi); border-radius: 50%; }

.attribution {
  position: absolute;
  bottom: 8px; right: 8px;
  font-family: var(--font-mono);
  font-size: 9.5px;
  color: var(--text-faint);
  background: rgba(250, 247, 240, 0.85);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  padding: 3px 9px;
  border-radius: 999px;
  z-index: 800;
}
.attribution a { color: var(--text-muted); }
.attr-support { display: none; }
.attribution a.attr-support { color: var(--accent-soft); font-weight: 500; }

/* ============== TOAST ============== */
.toast {
  position: fixed;
  bottom: 32px; left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: rgba(29, 28, 25, 0.94);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  color: white;
  padding: 11px 22px;
  border-radius: 999px;
  font-size: 13px; font-weight: 500;
  z-index: 9999;
  opacity: 0;
  transition: opacity var(--t-base) var(--ease-out),
              transform var(--t-base) var(--ease-out);
  pointer-events: none;
  box-shadow: var(--shadow-lg);
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ============== NEWSLETTER PROMPT (première visite) ============== */
.nl-prompt {
  position: fixed;
  right: 22px; bottom: 22px;
  width: 320px; max-width: calc(100vw - 44px);
  background: var(--surface-elev);
  border: 1px solid var(--border-strong);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-lg);
  padding: 20px 20px 18px 20px;
  z-index: 2000;
  transform: translateY(24px);
  opacity: 0;
  pointer-events: none;
  transition: transform var(--t-base) var(--ease-out),
              opacity var(--t-base) var(--ease-out);
}
.nl-prompt.show { transform: translateY(0); opacity: 1; pointer-events: auto; }
.nl-prompt-close {
  position: absolute; top: 10px; right: 12px;
  background: none; border: none; cursor: pointer;
  font-size: 16px; line-height: 1; color: var(--text-faint);
  padding: 4px;
}
.nl-prompt-close:hover { color: var(--text); }
.nl-prompt-title {
  font-family: var(--font-display);
  font-size: 16px; font-weight: 500;
  color: var(--text);
  margin: 0 0 6px 0;
  padding-right: 16px;
}
.nl-prompt-text {
  font-family: var(--font-body);
  font-size: 12.5px; line-height: 1.5;
  color: var(--text-muted);
  margin: 0 0 14px 0;
}
.nl-prompt-form { display: flex; gap: 8px; }
.nl-prompt-input {
  flex: 1; min-width: 0;
  padding: 9px 12px;
  font-family: var(--font-body); font-size: 13px;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--r-sm);
  outline: none;
}
.nl-prompt-input:focus { border-color: var(--accent); }
.nl-prompt-submit {
  padding: 9px 16px;
  font-family: var(--font-body); font-size: 13px; font-weight: 500;
  color: var(--surface);
  background: var(--accent);
  border: 1px solid var(--accent);
  border-radius: var(--r-sm);
  cursor: pointer;
  transition: background var(--t-fast) var(--ease-soft);
  flex-shrink: 0;
}
.nl-prompt-submit:hover { background: var(--accent-dark); }
.nl-prompt-submit:disabled { opacity: 0.6; cursor: wait; }
.nl-prompt-msg {
  font-family: var(--font-body); font-size: 12px;
  margin-top: 10px; min-height: 1.2em;
}
@media (max-width: 640px) {
  .nl-prompt { right: 12px; left: 12px; bottom: 12px; width: auto; }
}

/* ============== LEAFLET TWEAKS ============== */
.leaflet-popup-content { font-family: var(--font-body); font-size: 12px; margin: 10px 12px; }
.leaflet-popup-content-wrapper {
  border-radius: var(--r-md);
  box-shadow: var(--shadow-md);
}
.leaflet-control-attribution { display: none !important; }
.leaflet-bar {
  border-radius: var(--r-sm) !important;
  border: 1px solid var(--border-soft) !important;
  box-shadow: var(--shadow-sm) !important;
  overflow: hidden;
}
.leaflet-bar a {
  background: var(--surface-elev) !important;
  color: var(--text) !important;
  border-bottom-color: var(--border-soft) !important;
  transition: background var(--t-fast) var(--ease-soft);
}
.leaflet-bar a:hover { background: var(--bg-alt) !important; }

/* ============== MOBILE TOGGLE / BACKDROP ============== */
.mobile-toggle {
  display: none;
  position: absolute;
  top: 14px; right: 14px;
  z-index: 999;
  width: 44px; height: 44px;
  background: rgba(250, 247, 240, 0.94);
  backdrop-filter: blur(14px) saturate(180%);
  -webkit-backdrop-filter: blur(14px) saturate(180%);
  border: 1px solid var(--border-soft);
  border-radius: 50%;
  font-size: 22px;
  color: var(--text);
  align-items: center; justify-content: center;
  box-shadow: var(--shadow-md);
}

.detail-backdrop {
  display: none;
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(29, 28, 25, 0.36);
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
  z-index: 1099;
  animation: fadeIn var(--t-base) var(--ease-out);
}
.detail-backdrop.show { display: block; }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

/* ============== TABLET (640-1024) ============== */
@media (max-width: 1024px) and (min-width: 641px) {
  .sidebar { width: 332px; min-width: 332px; }
  .map-detail { width: 312px; right: 14px; top: 14px; }
  .filters { padding: 10px 18px 14px; max-height: 45vh; }
  .intro { padding: 10px 18px 12px; }
  .results-header { padding: 10px 16px 10px 18px; }
  .result-card { padding: 10px; }
  .field { margin-bottom: 12px; }
  .header-sub { display: none; }
}

/* ============== MOBILE (≤ 640px) ============== */
@media (max-width: 640px) {
  :root { --header-h: 54px; }
  .header { padding: 8px 14px; }
  .header-sub { display: none; }
  .header-btn { padding: 7px 12px; font-size: 12.5px; }
  .header-title { font-size: 17px; }
  .header-btn.support { display: none; }
  .attr-support { display: inline; }

  .body-wrap { flex-direction: column; position: relative; }

  .sidebar {
    width: 100%; min-width: 0;
    position: absolute;
    bottom: 0; left: 0; right: 0;
    height: 50vh;
    border-right: none;
    border-top: 1px solid var(--border-soft);
    border-top-left-radius: var(--r-2xl);
    border-top-right-radius: var(--r-2xl);
    box-shadow: var(--shadow-xl);
    z-index: 500;
    transition: transform var(--t-base) var(--ease-organic),
                height var(--t-base) var(--ease-organic);
    will-change: transform;
    padding-bottom: var(--safe-bottom);
    overflow: hidden;
  }
  .sidebar.collapsed { transform: translateY(calc(100% - 44px)); }
  .sidebar.expanded { height: calc(100% - 50px); }
  .sidebar.dragging, .map-detail.dragging { transition: none !important; }
  .sb-handle {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 24px;
    padding: 10px 0;
    margin: 0;
    flex-shrink: 0;
    cursor: grab;
    touch-action: none;
    user-select: none;
    -webkit-user-select: none;
    -webkit-tap-highlight-color: transparent;
    background: transparent;
    border: none;
  }
  .sb-handle:active { cursor: grabbing; }
  .sb-handle-bar {
    display: block;
    width: 44px;
    height: 4px;
    background: var(--border-strong);
    border-radius: 999px;
    transition: background var(--t-fast) var(--ease-soft), width var(--t-fast) var(--ease-soft);
  }
  .sb-handle:hover .sb-handle-bar,
  .sb-handle:focus-visible .sb-handle-bar { background: var(--accent); width: 56px; }
  .sb-handle:focus-visible { outline: none; }

  .mode-tabs { padding: 6px 10px 0; gap: 4px; }
  .mode-tab {
    padding: 8px 6px;
    font-size: 12px;
    min-height: 38px;
  }
  .mode-tab .mode-tab-sub { display: none; }

  .intro { padding: 8px 18px 10px; }
  .intro-text { font-size: 11.5px; line-height: 1.45; }

  .filters {
    padding: 12px 18px;
    max-height: none;
    overflow-y: visible;
  }
  .field { margin-bottom: 12px; }
  .field input[type="search"] { min-height: 44px; font-size: 16px; }
  .chip { padding: 8px 12px; min-height: 38px; }
  .chips { gap: 5px; }
  .chips:has(.chip:nth-child(5)) { display: grid; grid-template-columns: repeat(2, 1fr); }

  .results-header {
    padding: 10px 16px 10px 18px;
    position: sticky; top: 0;
    background: var(--bg-alt);
    z-index: 2;
  }
  .results-list {
    min-height: 0;
    padding: 8px 10px;
  }

  .result-card {
    padding: 10px;
    min-height: 80px;
  }
  .rc-photo { width: 60px; height: 60px; }
  .rc-name { font-size: 14px; }

  .map-wrap { height: 100%; }

  /* Detail panel: bottom-sheet sur mobile (comme la sidebar) */
  .map-detail {
    position: fixed;
    top: auto;
    bottom: 0;
    left: 0; right: 0;
    width: 100%;
    height: 50vh;
    max-height: none;
    border-radius: var(--r-2xl) var(--r-2xl) 0 0;
    border: none;
    border-top: 1px solid var(--border-soft);
    box-shadow: var(--shadow-xl);
    z-index: 1100;
    transition: transform var(--t-base) var(--ease-organic),
                height var(--t-base) var(--ease-organic);
    will-change: transform;
    padding-bottom: var(--safe-bottom);
  }
  .map-detail.collapsed { transform: translateY(calc(100% - 44px)); }
  .map-detail.expanded { height: calc(100% - 50px); }

  /* Handle de drag visible sur mobile */
  .md-handle {
    display: flex;
    align-items: center;
    justify-content: center;
    position: absolute;
    top: 0; left: 0; right: 0;
    width: 100%;
    height: 28px;
    padding: 10px 0;
    cursor: grab;
    touch-action: none;
    -webkit-user-select: none;
    -webkit-tap-highlight-color: transparent;
    z-index: 10;
    background: transparent;
    border: none;
  }
  .md-handle::before {
    content: "";
    width: 40px;
    height: 4px;
    background: rgba(255, 255, 255, 0.85);
    border-radius: 999px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.18);
  }

  /* Backdrop masqué sur mobile (on voit la carte derrière) */
  .detail-backdrop { display: none !important; }

  /* Sidebar masquée quand un détail est ouvert */
  body.detail-open .sidebar {
    transform: translateY(100%);
    pointer-events: none;
  }

  .md-photo {
    height: 200px;
    border-radius: 0;
  }
  .md-photo::after { border-radius: 0; }
  .md-close {
    width: 40px; height: 40px;
    top: 12px; right: 12px;
    font-size: 22px;
  }
  .md-inner { padding: 18px 20px 28px; }
  .md-actions {
    margin-bottom: 10px;
  }
  .md-btn { padding: 13px; min-height: 46px; font-size: 13.5px; }

  .legend { display: none; }
  .attribution {
    bottom: 80px;
    font-size: 9px;
    padding: 2px 7px;
  }
  .sidebar:not(.collapsed) ~ .map-wrap .attribution { display: none; }

  .mobile-toggle { display: flex; }
  .sidebar.expanded ~ .map-wrap .mobile-toggle { display: none; }

  .leaflet-control-zoom { margin-top: 14px !important; margin-right: 14px !important; }
  .leaflet-bar a { width: 36px !important; height: 36px !important; line-height: 36px !important; font-size: 18px !important; }
  .leaflet-control-layers { margin-top: 90px !important; margin-right: 14px !important; }
}

/* ============== SMALL MOBILE (≤ 380px) ============== */
@media (max-width: 380px) {
  .header { padding: 6px 12px; }
  .header-title { font-size: 16px; }
  .logo { width: 26px; height: 26px; }
  .header-btn { padding: 6px 10px; font-size: 12px; }

  .mode-tab { padding: 7px 4px; font-size: 11.5px; }
  .field { margin-bottom: 10px; }
  .field-label { font-size: 9.5px; }
  .chip { padding: 7px 10px; font-size: 12px; }

  .result-card { padding: 9px; }
  .rc-photo { width: 54px; height: 54px; }
  .rc-name { font-size: 13.5px; }

  .md-grid { grid-template-columns: 1fr; }
  .md-photo { height: 170px; }
  .md-name { font-size: 17px; }
}

/* ============== LANDSCAPE COURT ============== */
@media (max-height: 500px) and (max-width: 900px) {
  :root { --header-h: 48px; }
  .header { height: 48px; padding: 6px 14px; }
  .sidebar { height: 65vh; }
  .sidebar.expanded { height: calc(100% - 50px); }
  .intro { display: none; }
  .map-detail .md-photo { height: 110px; }
}

/* ============== HIGH DPI / RETINA ============== */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
  .rc-photo, .md-photo { background-size: cover; }
}

/* ============== PRINT ============== */
@media print {
  .sidebar, .header, .legend, .attribution, .map-detail, .mobile-toggle { display: none !important; }
  #map { width: 100% !important; height: 100vh !important; }
}

/* ============== REDUCED MOTION ============== */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* ============== FLEX LAYOUT FIX (kept from original) ============== */
body {
  display: flex !important;
  flex-direction: column !important;
  height: 100vh !important;
  height: 100dvh !important;
  overflow: hidden !important;
  margin: 0 !important;
}
.header { flex-shrink: 0 !important; }
.body-wrap {
  flex: 1 1 0 !important;
  min-height: 0 !important;
  display: flex !important;
  overflow: hidden !important;
}
.sidebar {
  height: 100% !important;
  min-height: 0 !important;
  display: flex !important;
  flex-direction: column !important;
  overflow: hidden !important;
}
.mode-tabs, .intro, .results-header { flex-shrink: 0 !important; }
.filters {
  flex-shrink: 1 !important;
  max-height: 38vh !important;
  min-height: 0;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}
.results-list {
  flex: 1 1 0 !important;
  min-height: 0 !important;
  height: auto !important;
  overflow-y: auto !important;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
}
.map-wrap { flex: 1 1 0 !important; min-height: 0; }

.fire-banner {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 16px;
  background: var(--warn-bg);
  color: var(--warn);
  border-bottom: 1px solid var(--border-strong);
  font-family: 'Geist', sans-serif;
  font-size: 0.88rem;
  line-height: 1.4;
}
.fire-banner-text { flex: 1 1 auto; }
.fire-banner-text a {
  color: var(--warn);
  text-decoration: underline;
  font-weight: 500;
}
.fire-banner-close {
  flex: 0 0 auto;
  background: none;
  border: none;
  color: var(--warn);
  font-size: 1.1rem;
  line-height: 1;
  cursor: pointer;
  padding: 4px 6px;
  border-radius: var(--r-xs);
}
.fire-banner-close:hover { background: rgba(0,0,0,0.06); }
.fire-banner.is-hidden { display: none; }
@media (max-width: 640px) {
  .fire-banner { font-size: 0.82rem; padding: 8px 12px; }
}

