:root {
  color-scheme: light;
  --fond: #fbfaf7;
  --surface: #ffffff;
  --surface-2: #f3f1ec;
  --trait: #e2ded5;
  --texte: #1d1b17;
  --texte-2: #57534a;
  --texte-3: #7a756a;
  --accent: #9c3510;
  --accent-doux: #fbeee3;
  --alerte-fond: #fff4e0;
  --alerte-trait: #e9b44c;
  /* Indice : une seule teinte, du clair au foncé (lumière OKLab 0,90 → 0,33 ; entre voisines,
     ΔE OKLab × 100 de 12,6 à 16,8). */
  --classe-1: #f9d7a6;
  --classe-2: #f2a65a;
  --classe-3: #d9662b;
  --classe-4: #9c3510;
  --classe-5: #5e1b13;
  --pastille-trait: rgba(0, 0, 0, .12);   /* le tour d'une pastille de légende */
  --hachure: #6b6b6b;
  /* Mode exploration : une teinte hors de la gamme de l'indice et du vert des forêts IGN. */
  --exploration: #6a3d9a;
  --barre: #d9662b;
  --rayon: 10px;
  --police: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --fond: #171614;
    --surface: #201f1c;
    --surface-2: #2a2925;
    --trait: #3a3833;
    --texte: #f4f2ec;
    --texte-2: #c9c5ba;
    --texte-3: #9d988c;
    --accent: #f2a65a;
    --accent-doux: #3a2a1f;
    --alerte-fond: #33291a;
    --alerte-trait: #9a7429;
    --barre: #f2a65a;
    --pastille-trait: rgba(255, 255, 255, .35);   /* « excellent », presque noir, reste lisible */
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --fond: #171614;
  --surface: #201f1c;
  --surface-2: #2a2925;
  --trait: #3a3833;
  --texte: #f4f2ec;
  --texte-2: #c9c5ba;
  --texte-3: #9d988c;
  --accent: #f2a65a;
  --accent-doux: #3a2a1f;
  --alerte-fond: #33291a;
  --alerte-trait: #9a7429;
  --barre: #f2a65a;
  --pastille-trait: rgba(255, 255, 255, .35);
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--fond);
  color: var(--texte);
  font-family: var(--police);
  font-size: 15px;
  line-height: 1.5;
}
a { color: var(--accent); }
h1, h2, h3 { line-height: 1.25; margin: 0 0 .4em; }
h1 { font-size: 1.35rem; }
h2 { font-size: 1.05rem; }
h3 { font-size: .95rem; }
p { margin: 0 0 .7em; }
.muet { color: var(--texte-3); font-size: .85rem; }

/* --- La barre du haut, sur toutes les pages ----------------------------------- */
:root { --barre: 52px; }
.barre {
  position: sticky; top: 0; z-index: 1100; height: var(--barre);
  display: flex; align-items: center; gap: 18px; padding: 0 16px;
  background: var(--surface); border-bottom: 1px solid var(--trait);
}
.barre .marque {
  display: inline-flex; align-items: center; gap: 8px; font-weight: 700; color: var(--texte);
  text-decoration: none; white-space: nowrap;
}
.barre-liens { display: flex; gap: 2px; margin-left: auto; overflow-x: auto; }
.barre-liens a, .barre-menu nav a {
  padding: 6px 10px; border-radius: 8px; color: var(--texte-2); text-decoration: none; font-size: .92rem;
  white-space: nowrap;
}
.barre-liens a:hover, .barre-menu nav a:hover { background: var(--surface-2); color: var(--texte); }
.barre-liens a[aria-current="page"], .barre-menu nav a[aria-current="page"] {
  color: var(--accent); font-weight: 600; background: var(--accent-doux);
}
.barre-menu { display: none; margin-left: auto; position: relative; }
.barre-menu summary {
  list-style: none; cursor: pointer; padding: 6px 12px; border: 1px solid var(--trait); border-radius: 8px;
  font-weight: 600; font-size: .92rem;
}
.barre-menu summary::-webkit-details-marker { display: none; }
.barre-menu summary::before { content: "☰ "; }
.barre-menu nav {
  position: absolute; right: 0; top: calc(100% + 6px); display: grid; min-width: 220px; padding: 6px;
  background: var(--surface); border: 1px solid var(--trait); border-radius: var(--rayon);
  box-shadow: 0 8px 24px rgb(0 0 0 / .18);
}
@media (max-width: 900px) {
  .barre-liens { display: none; }
  .barre-menu { display: block; }
}
.fil { font-size: .88rem; color: var(--texte-3); margin: 0 0 .4em; }

/* --- Page carte ------------------------------------------------------------- */
.appli {
  display: grid;
  grid-template-columns: 380px 1fr;
  height: calc(100vh - var(--barre));
  height: calc(100dvh - var(--barre));
}
.panneau {
  overflow-y: auto;
  background: var(--surface);
  border-right: 1px solid var(--trait);
  padding: 16px 18px 24px;
}
#carte { height: 100%; background: var(--surface-2); }
.leaflet-container { font-family: var(--police); }
.indice-image { image-rendering: pixelated; }

/* Sur téléphone : la carte plein écran, le panneau en feuille qui glisse du bas (feuille.js).
   Repliée, la feuille montre sa poignée, les espèces et les jours, sur une ligne qui défile. */
.poignee, .case-panneau .fermer { display: none; }
.lecteur { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
@media (max-width: 820px) {
  body.page-carte { overflow: hidden; overscroll-behavior: none; }
  .appli { display: block; height: calc(100dvh - var(--barre)); }
  #carte { position: fixed; inset: var(--barre) 0 0 0; height: auto; }
  .panneau {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 1000; height: 132px;
    display: flex; flex-direction: column;
    padding: 0 14px calc(18px + env(safe-area-inset-bottom, 0px));
    border: 0; border-radius: 16px 16px 0 0; box-shadow: 0 -3px 14px rgb(0 0 0 / .22);
    overflow-y: auto; overscroll-behavior: contain; transition: height .22s ease;
  }
  .panneau.glisse { transition: none; }
  .panneau[data-etat="bas"] { overflow: hidden; }
  .panneau > * { flex: none; }
  .poignee {
    order: -3; display: flex; justify-content: center; position: sticky; top: 0; z-index: 3;
    margin: 0 -14px; padding: 10px 0 9px; border: 0; background: var(--surface); cursor: grab; touch-action: none;
  }
  .barre-poignee { width: 42px; height: 5px; border-radius: 3px; background: var(--texte-3); opacity: .55; }
  .panneau > .perime, .panneau > .demenagement { order: -2; margin-top: 0; }
  .panneau > .case-panneau { order: -1; position: relative; padding: 2px 0 12px; border-bottom: 1px solid var(--trait); }
  .case-panneau .fermer {
    display: block; position: absolute; top: 0; right: -4px; width: 36px; height: 36px; border: 0; border-radius: 50%;
    background: var(--surface-2); color: var(--texte); font-size: 1.4rem; line-height: 1; cursor: pointer;
  }
  .case-panneau .case-fenetre { color: var(--texte); }
  .case-panneau h4 { margin: 4px 44px 6px 0; font-size: 1rem; }
  .onglets { margin: 10px -14px 0; padding: 0 8px; }
  .panneau > nav.pied { order: 95; }
  .panneau > #maj { order: 96; }
  .rang { margin-top: 0; }
  .rang + .rang { margin-top: 6px; }
  .rang legend { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  .rang .choix { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; margin: 0 -14px; padding: 1px 14px 3px; }
  .rang .choix::-webkit-scrollbar { display: none; }
  .rang .choix label { flex: none; }
  /* L'attribution des fonds reste visible au-dessus de la feuille repliée. */
  .page-carte .leaflet-bottom { bottom: var(--feuille-bas, 132px); }
}

.entete p { color: var(--texte-2); font-size: .9rem; }
.entete .installer { font-size: .82rem; margin-top: .4em; }

fieldset { border: 0; padding: 0; margin: 14px 0 0; min-width: 0; }
legend { font-weight: 600; font-size: .85rem; color: var(--texte-2); padding: 0; margin-bottom: 6px; }
.choix { display: flex; flex-wrap: wrap; gap: 6px; }
.choix label {
  position: relative;
  border: 1px solid var(--trait);
  background: var(--surface);
  border-radius: 999px;
  padding: 5px 11px;
  font-size: .87rem;
  cursor: pointer;
  user-select: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.choix input { position: absolute; opacity: 0; pointer-events: none; }
.choix label:has(input:checked) {
  border-color: var(--accent);
  background: var(--accent-doux);
  font-weight: 600;
}
.choix label:has(input:focus-visible) { outline: 2px solid var(--accent); outline-offset: 2px; }
.choix .niv { font-size: .75rem; color: var(--texte-3); font-weight: 400; }
/* L'espèce choisie : son dessin, son nom, son état ; un toucher ouvre la liste illustrée. */
.choix-espece-bouton {
  width: 100%; display: flex; align-items: center; gap: 10px; margin: 2px 0 10px; padding: 6px 10px;
  border: 1px solid var(--trait); border-radius: 12px; background: var(--surface); color: var(--texte);
  font: inherit; text-align: left; cursor: pointer;
}
.choix-espece-bouton:hover { border-color: var(--accent); }
.choix-espece-texte { display: grid; line-height: 1.2; flex: 1; min-width: 0; }
.choix-espece-texte strong { font-size: 1.05rem; }
.choix-espece-bouton .chevron { color: var(--texte-3); }
.niv.n4 { color: var(--accent); font-weight: 600; }
.dialogue-especes {
  width: min(460px, calc(100vw - 24px)); max-height: min(720px, 86vh); padding: 0; border: 0; border-radius: 16px;
  background: var(--surface); color: var(--texte); box-shadow: 0 12px 40px rgb(0 0 0 / .3); overflow: hidden;
}
.dialogue-especes[open] { display: flex; flex-direction: column; }
.dialogue-especes::backdrop { background: rgb(20 18 15 / .45); }
.dialogue-especes header {
  position: relative; padding: 16px 52px 12px 18px; background: var(--accent); color: #fff;
}
.dialogue-especes header h2 { margin: 0; font-size: 1.2rem; }
.dialogue-especes header p { margin: 2px 0 0; font-size: .85rem; opacity: .9; }
.dialogue-especes .fermer {
  position: absolute; top: 12px; right: 12px; width: 34px; height: 34px; border: 0; border-radius: 50%;
  background: rgb(255 255 255 / .2); color: inherit; font-size: 1.3rem; cursor: pointer;
}
.liste-especes { overflow-y: auto; padding: 6px 10px 14px; }
.liste-especes h3 { margin: 12px 6px 6px; font-size: .8rem; text-transform: uppercase; letter-spacing: .05em; color: var(--texte-3); }
.espece-choix {
  width: 100%; display: flex; align-items: center; gap: 12px; padding: 8px 10px; margin: 2px 0;
  border: 1px solid transparent; border-radius: 12px; background: none; color: var(--texte); font: inherit;
  text-align: left; cursor: pointer;
}
.espece-choix:hover, .espece-choix:focus-visible { background: var(--surface-2); }
.espece-choix.choisi { background: var(--accent-doux); border-color: var(--accent); }
.espece-choix.hors { opacity: .55; }
.espece-choix .nom { display: grid; flex: 1; min-width: 0; line-height: 1.25; }
.espece-choix em { color: var(--texte-3); font-size: .82rem; }
.espece-choix .milieu { font-size: .72rem; color: var(--texte-2); }
.espece-choix .niv { font-size: .78rem; color: var(--texte-3); white-space: nowrap; }
.espece-choix .niv.n4, .espece-choix .niv.n3 { color: var(--accent); font-weight: 600; }
@media (max-width: 820px) {
  .dialogue-especes { width: 100vw; max-width: none; max-height: 82dvh; margin: auto 0 0; border-radius: 16px 16px 0 0; }
}

/* Les onglets du panneau. */
.onglets {
  display: flex; gap: 2px; margin: 12px -18px 0; padding: 0 12px; border-bottom: 1px solid var(--trait);
  overflow-x: auto; scrollbar-width: none;
}
.onglets button {
  flex: none; padding: 8px 10px 7px; border: 0; border-bottom: 3px solid transparent; background: none;
  color: var(--texte-2); font: inherit; font-size: .9rem; font-weight: 600; cursor: pointer;
}
.onglets button[aria-selected="true"] { color: var(--accent); border-bottom-color: var(--accent); }
.onglet { padding-top: 4px; }
.onglet[hidden] { display: none; }
.fiche h3 { font-size: 1.05rem; margin: 12px 0 6px; color: var(--texte); }
.photo-fiche { display: block; width: 100%; aspect-ratio: 4 / 3; object-fit: cover; border-radius: var(--rayon); }
.pied-carte { margin-top: 16px; font-size: .85rem; }

/* Les fonds : le plan grisé fait ressortir l'indice ; l'estompage s'y multiplie. */
.leaflet-layer.fond-gris { filter: grayscale(.85) brightness(1.04) contrast(.95); }
.leaflet-layer.estompage { mix-blend-mode: multiply; opacity: .5; }
/* Une espèce des prés : pas de carte fine, le bandeau le dit par-dessus la carte. */
.bandeau-pres {
  position: fixed; z-index: 900; top: 12px; left: calc(380px + 60px); right: 200px; margin: 0;
  padding: 8px 12px; border-radius: var(--rayon); background: var(--surface); color: var(--texte);
  box-shadow: 0 1px 6px rgb(0 0 0 / .25); font-size: .88rem;
}
.bandeau-pres { top: calc(var(--barre) + 12px); }
@media (max-width: 820px) { .bandeau-pres { left: 56px; right: 12px; top: calc(var(--barre) + 64px); } }

label.case.publiques { margin-top: 10px; }
.departement { display: grid; gap: 4px; margin-top: 16px; font-size: .85rem; font-weight: 600; color: var(--texte-2); }
.departement select {
  font: inherit; font-size: .95rem; font-weight: 600; color: var(--texte); background: var(--surface);
  border: 1px solid var(--trait); border-radius: 8px; padding: 6px 8px;
}
button.lien { border: 0; background: none; padding: 0; font: inherit; color: var(--accent); text-decoration: underline; cursor: pointer; }
ol.communes { counter-reset: rang; }

/* --- Mes coins --------------------------------------------------------------- */
.coins-actions { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0; }
.coins-actions button, .coins-actions .bouton, .coin-form button {
  font: inherit; font-size: .85rem; color: var(--texte); background: var(--surface);
  border: 1px solid var(--trait); border-radius: 8px; padding: 5px 10px; cursor: pointer;
}
.coins-actions button:hover, .coins-actions .bouton:hover { background: var(--surface-2); }
.coins-actions .bouton:has(input:focus-visible) { outline: 2px solid var(--accent); outline-offset: 2px; }
label.case { display: flex; gap: 6px; align-items: center; font-size: .85rem; color: var(--texte-2); }
#coins-sources { list-style: none; padding: 0; margin: 6px 0 0; }
#coins-message:empty { display: none; }
.coin {
  display: grid; place-items: center; border-radius: 50%;
  background: var(--surface); color: var(--texte); border: 2px solid var(--texte);
  font: 700 12px/1 var(--police); box-shadow: 0 1px 3px rgb(0 0 0 / .35);
}
.coin.partage { border-style: dashed; background: var(--surface-2); }
.coin-form { display: grid; gap: 6px; font-size: .85rem; }
.coin-form label { display: grid; gap: 2px; }
.coin-form select, .coin-form input { font: inherit; padding: 3px 5px; }
.coin-form button { justify-self: start; border-color: var(--accent); }
.coin-bulle h4 { margin: 0 0 4px; }
.coin-bulle ul { margin: 6px 0 0; padding-left: 18px; }
.coin-bulle .pastille { margin-right: 6px; }

.fiche { margin-top: 12px; font-size: .86rem; color: var(--texte-2); }
.fiche details { border: 1px solid var(--trait); border-radius: var(--rayon); padding: 8px 12px; }
.fiche summary { cursor: pointer; color: var(--texte); font-size: .92rem; }
.fiche .latin { font-style: italic; color: var(--texte-3); }
.fiche p { margin: .5em 0 0; }
.fiche .confusions strong { color: var(--texte); }

.verdict {
  margin-top: 16px;
  padding: 12px 14px;
  border-radius: var(--rayon);
  background: var(--surface-2);
}
.verdict h2 { font-size: 1.1rem; margin-bottom: .3em; }
.verdict .jour { font-size: .82rem; color: var(--texte-3); margin-bottom: .2em; }
.verdict p:last-child { margin-bottom: 0; }

.verdict .fiabilite {
  margin-top: .6em;
  padding-top: .5em;
  border-top: 1px solid var(--trait);
  font-size: .82rem;
  color: var(--texte-2);
}
.verdict .fiabilite.moins { color: var(--texte); font-weight: 600; }

.section { margin-top: 18px; }
.section h3 { color: var(--texte-2); }

/* Explorer les forêts : replié par défaut, cases à cocher sur deux colonnes. */
.explorer summary, .alertes summary { cursor: pointer; }
.explorer summary h3, .alertes summary h3 { display: inline; }
.alertes form { display: grid; gap: 8px; margin-top: 8px; }
.alertes .cases { display: grid; grid-template-columns: 1fr 1fr; gap: 2px 10px; }
.explorer > p, .explorer > label { margin-top: 8px; }
.explorer > button { display: block; margin-top: 8px; font-size: .85rem; }
.explorer .cases { display: grid; grid-template-columns: 1fr 1fr; gap: 2px 10px; }
.explorer .cases label.case { font-size: .8rem; }
.explorer .altitudes { font-size: .85rem; color: var(--texte-2); }
.explorer .altitudes input { width: 5.5em; }
.pastille.exploration { display: inline-block; background: var(--exploration); vertical-align: middle; }

.tranches { display: grid; gap: 3px; }
.tranche {
  display: grid;
  grid-template-columns: 92px 1fr 46px;
  align-items: center;
  gap: 8px;
  font-size: .82rem;
  color: var(--texte-2);
}
.tranche .barre-fond { height: 12px; background: var(--surface-2); border-radius: 0 4px 4px 0; }
.tranche .barre { height: 12px; background: var(--barre); border-radius: 0 4px 4px 0; min-width: 2px; }
.tranche.meilleure { color: var(--texte); font-weight: 600; }
.tranche .val { text-align: right; font-variant-numeric: tabular-nums; }

.communes { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
.communes button {
  width: 100%;
  display: flex;
  justify-content: space-between;
  gap: 8px;
  border: 0;
  background: none;
  color: var(--texte);
  font: inherit;
  font-size: .88rem;
  padding: 4px 6px;
  border-radius: 6px;
  cursor: pointer;
  text-align: left;
}
.communes button:hover, .communes button:focus-visible { background: var(--surface-2); }
.communes .cl { color: var(--texte-3); font-size: .82rem; white-space: nowrap; }
.communes .nom { display: inline-flex; align-items: center; gap: 8px; }
.communes button.choisi { background: var(--accent-doux); font-weight: 600; }

.legende { display: grid; gap: 4px; font-size: .84rem; color: var(--texte-2); }
.legende div { display: flex; align-items: center; gap: 8px; }
.pastille {
  width: 18px; height: 12px; border-radius: 3px; flex: none;
  border: 1px solid var(--pastille-trait);
}
.pastille.hachure {
  background: repeating-linear-gradient(45deg, var(--hachure) 0 1.5px, transparent 1.5px 5px);
}
.pastille.vide { background: transparent; }

/* Bouton « Ma position », sous le zoom. */
.bouton-position {
  display: flex; align-items: center; justify-content: center; width: 30px; height: 30px;
  padding: 0; border: 0; border-radius: 4px; background: #fff; color: #333; cursor: pointer;
}
.bouton-position:hover { background: #f4f4f4; }
.bouton-position.actif { color: #1a73e8; }

/* La semaine d'un département : niveau du verdict, espèce par espèce et jour par jour. */
.tableau-semaine { overflow-x: auto; }
/* Largeurs fixes : les noms ont leur colonne, les huit jours se partagent le reste à parts égales. */
.semaine { border-collapse: separate; border-spacing: 2px; font-size: .8rem; width: 100%; table-layout: fixed; }
.semaine thead th:first-child { width: 30%; }
.semaine thead th { font-weight: 400; color: var(--texte-3); text-align: center; line-height: 1.15; padding-bottom: 2px; }
.semaine thead th.actuel { color: var(--texte); font-weight: 600; }
.semaine tbody th { font-weight: 400; text-align: left; color: var(--texte-2); padding-right: 6px; line-height: 1.15; }
.semaine td { padding: 0; }
.semaine .niveau {
  display: block; width: 100%; min-width: 22px; height: 24px; padding: 0;
  border: 1px solid var(--trait); border-radius: 4px; background: transparent;
  color: var(--texte-3); font: inherit; cursor: pointer;
}
.semaine .niveau.choisi { outline: 2px solid var(--texte); outline-offset: 1px; }
.semaine tbody th.pre { text-decoration: underline dashed var(--texte-3); text-underline-offset: 3px; }
.semaine .niveau:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.semaine .n2, .pastille.n2 { background: var(--classe-2); }
.semaine .n3, .pastille.n3 { background: var(--classe-3); }
.semaine .n4, .pastille.n4 { background: var(--classe-4); }
.legende-semaine { display: flex; flex-wrap: wrap; gap: 4px 12px; margin-top: 6px; font-size: .78rem; color: var(--texte-2); }
.legende-semaine > span { display: inline-flex; align-items: center; gap: 5px; }

.alerte {
  margin-top: 18px;
  padding: 10px 12px;
  border-left: 3px solid var(--alerte-trait);
  background: var(--alerte-fond);
  border-radius: 0 var(--rayon) var(--rayon) 0;
  font-size: .86rem;
}
.alerte p:last-child { margin-bottom: 0; }
.alerte.perime { border-left-color: #d03b3b; }
/* L'ancienne adresse (*.github.io) avant la bascule sur le domaine : demenagement.js. */
.alerte.demenagement { border-left-color: var(--accent); }
.alerte.demenagement button { margin: 4px 0; }

nav.pied { margin-top: 18px; display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: .86rem; }

/* Fenêtre d'une zone */
.leaflet-popup-content { margin: 12px 14px; font-size: .86rem; line-height: 1.45; min-width: 230px; }
.leaflet-popup-content h4 { margin: 0 0 4px; font-size: .95rem; }
.leaflet-popup-content dl { display: grid; grid-template-columns: auto 1fr; gap: 1px 10px; margin: 6px 0; }
.leaflet-popup-content dt { color: #6b665c; }
.leaflet-popup-content dd { margin: 0; }
.leaflet-popup-content .ok { color: #0a7a0a; }
.leaflet-popup-content .ko { color: #b23a1d; }
.pop-indice { display: flex; align-items: center; gap: 8px; font-weight: 600; }
/* La fenêtre d'une case : l'indice sur 100 et sa jauge, ce qui le limite, puis les tuiles. */
.case-fenetre { color: #1d1b17; }
.leaflet-popup-content .case-fenetre p { margin: 4px 0; }   /* Leaflet en met 1,3 em */
.score { display: grid; grid-template-columns: auto 1fr; align-items: baseline; gap: 0 10px; }
.score-valeur { font-size: 1.6rem; font-weight: 700; line-height: 1; font-variant-numeric: tabular-nums; }
.score-valeur small { font-size: .8rem; font-weight: 400; color: #6b665c; }
.score-classe { font-size: 1rem; font-weight: 600; }
.jauge { grid-column: 1 / -1; position: relative; display: flex; height: 8px; margin: 8px 0 2px;
  border-radius: 4px; overflow: visible; background: #efece5; }
.jauge span { height: 100%; }
.jauge span:first-child { border-radius: 4px 0 0 4px; }
.jauge span:nth-last-child(2) { border-radius: 0 4px 4px 0; }
.jauge i { position: absolute; top: -4px; width: 3px; height: 16px; margin-left: -1.5px; background: #1d1b17;
  border-radius: 2px; box-shadow: 0 0 0 1.5px #fff; }
.leaflet-popup-content .score-jour { margin: 2px 0 6px; }
.raison { margin: 6px 0; }
.detail-case { margin-top: 6px; border-top: 1px solid #e4e0d6; padding-top: 4px; }
.detail-case summary { cursor: pointer; color: #6b665c; font-size: .8rem; }
.detail-case[open] summary { margin-bottom: 6px; }
.detail-case .muet { margin: 0; font-size: .78rem; }
.tuiles { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; margin: 0 0 6px; }
.tuile { display: grid; gap: 0; padding: 5px 7px; border-radius: 6px; background: #f3f1ec;
  border-left: 3px solid #c9c4b8; font-size: .78rem; line-height: 1.3; min-width: 0; }
.tuile .t { color: #6b665c; }
.tuile strong { font-size: .86rem; overflow-wrap: anywhere; }
.tuile .n { color: #57534a; }
.tuile.ok { border-left-color: #2f8a3a; }
.tuile.moyen { border-left-color: #e0a030; }
.tuile.ko { border-left-color: #b23a1d; }
.statut { padding: 4px 8px; border-radius: 6px; font-size: .78rem; line-height: 1.35; margin: 0 0 4px; }
.statut.public { background: #e6f2e4; }
.statut.prive { background: #fbeee3; }
.itineraire { margin: 4px 0 2px; }
.itineraire a, .actions-case a { white-space: nowrap; }
.actions-case { margin: 0; }

.fonds {
  background: var(--surface);
  color: var(--texte);
  border-radius: 8px;
  box-shadow: 0 1px 4px rgba(0, 0, 0, .25);
  padding: 4px;
  display: flex;
  gap: 2px;
}
.fonds button {
  border: 0; background: none; color: inherit; font: inherit; font-size: .8rem;
  padding: 4px 8px; border-radius: 6px; cursor: pointer;
}
.fonds button[aria-pressed="true"] { background: var(--accent-doux); font-weight: 600; }

/* Présentation de la première visite (guide.js). */
dialog.guide {
  width: min(420px, calc(100vw - 32px)); border: 0; border-radius: 14px; padding: 18px 20px 16px;
  background: var(--surface); color: var(--texte); box-shadow: 0 10px 40px rgb(0 0 0 / .3);
}
dialog.guide::backdrop { background: rgb(20 18 15 / .45); }
dialog.guide h2 { font-size: 1.15rem; margin: 2px 0 8px; }
dialog.guide p { color: var(--texte-2); }
dialog.guide #guide-etape { margin: 0; }
.legende-guide { display: flex; gap: 4px; margin: 4px 0 14px; }
.legende-guide .pastille { width: 34px; height: 12px; }
.legende-guide .pastille.n1 { background: var(--classe-1); }
.guide-actions { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.guide-actions .lien[hidden] { visibility: hidden; display: inline; }
button.bouton.principal { background: var(--accent); border-color: var(--accent); color: #fff; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) button.bouton.principal { color: #1d1b17; }
}
:root[data-theme="dark"] button.bouton.principal { color: #1d1b17; }

/* --- Pages de texte ---------------------------------------------------------- */
/* Une espèce : sa photo (ou son dessin) et ses mois de saison. */
.icone { vertical-align: middle; flex: none; }
figure.photo { margin: 0; }
figure.photo img { display: block; width: 100%; height: auto; border-radius: var(--rayon); object-fit: cover; }
figure.photo figcaption { font-size: .72rem; color: var(--texte-3); margin-top: 4px; line-height: 1.3; }
figure.photo figcaption a { color: inherit; }
figure.dessin { display: grid; place-items: center; background: var(--surface-2); border-radius: var(--rayon); }
.tete-espece { display: grid; grid-template-columns: 240px 1fr; gap: 16px 20px; align-items: start; margin: 8px 0 4px; }
.tete-espece img { aspect-ratio: 4 / 3; }
@media (max-width: 600px) { .tete-espece { grid-template-columns: 1fr; } }
.mois { display: inline-flex; gap: 2px; vertical-align: middle; }
.mois span {
  width: 16px; height: 18px; border-radius: 3px; background: var(--surface-2); color: var(--texte-3);
  font-size: .6rem; line-height: 18px; text-align: center; font-weight: 600;
}
.mois .possible, .calendrier td.possible, .pastille.cal-possible { background: var(--classe-1); }
.mois .plein, .calendrier td.plein, .pastille.cal-plein { background: var(--classe-3); color: #fff; }
.mois .actuel { outline: 2px solid var(--texte); outline-offset: 0; }
.legende-mois span { width: 14px; height: 14px; line-height: 14px; }
.saison-mois { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
/* Toutes les espèces : l'espèce du moment, puis une fiche par espèce. */
.vedette {
  display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 0; margin: 18px 0 8px;
  border: 1px solid var(--trait); border-radius: 14px; overflow: hidden; background: var(--surface);
}
.vedette .vedette-photo img { height: 100%; aspect-ratio: auto; border-radius: 0; min-height: 260px; }
.vedette .vedette-photo figcaption { padding: 4px 10px 8px; }
.vedette-texte { padding: 18px 20px; display: grid; gap: 6px; align-content: start; }
.vedette-texte h2 { margin: 0; font-size: 1.5rem; }
.sur-titre { font-size: .78rem; letter-spacing: .06em; text-transform: uppercase; color: var(--accent); font-weight: 700; margin: 0; }
@media (max-width: 640px) { .vedette { grid-template-columns: 1fr; } }
.fiches-especes { list-style: none; padding: 0; display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); }
.fiches-especes li { margin: 0; }
.fiches-especes a {
  display: grid; gap: 4px; height: 100%; padding: 0 0 12px; border: 1px solid var(--trait); border-radius: 14px;
  overflow: hidden; background: var(--surface); color: var(--texte); text-decoration: none;
}
.fiches-especes a:hover { border-color: var(--accent); }
.fiches-especes a > :not(figure) { margin: 0 12px; }
.fiches-especes .vignette-espece img { aspect-ratio: 4 / 3; border-radius: 0; }
.fiches-especes .vignette-espece figcaption { display: none; }
.fiches-especes .vignette-espece.dessin { aspect-ratio: 4 / 3; border-radius: 0; }
.fiches-especes strong { font-size: 1.05rem; }
.fiches-especes .latin { font-style: italic; color: var(--texte-3); font-size: .85rem; }
/* Sur une vignette, les douze mois tiennent toujours : les cases rétrécissent au besoin (à 16 px
   fixes, une vignette de moins de 240 px coupait décembre). */
.fiches-especes .mois { display: grid; grid-template-columns: repeat(12, minmax(0, 16px)); }
.fiches-especes .mois span { width: auto; }
.badges { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 8px !important; }
.badge {
  font-size: .72rem; font-weight: 600; padding: 2px 8px; border-radius: 999px; background: var(--surface-2);
  color: var(--texte-2);
}
.badge.n2 { background: var(--classe-1); color: #3a2a10; }
.badge.n3 { background: var(--classe-2); color: #3a2a10; }
.badge.n4 { background: var(--classe-4); color: #fff; }
.calendrier { min-width: 640px; }
.calendrier th, .calendrier td { padding: 4px 3px; border-bottom: 1px solid var(--trait); }
.calendrier thead th { font-weight: 600; font-size: .75rem; text-align: center; color: var(--texte-3); }
.calendrier thead th.actuel { color: var(--accent); }
.calendrier tbody th { white-space: nowrap; font-weight: 400; }
.calendrier tbody th a { display: inline-flex; align-items: center; gap: 6px; color: var(--texte); text-decoration: none; }
.calendrier td { width: 7%; }
.calendrier td.actuel { box-shadow: inset 0 0 0 999px rgb(0 0 0 / .07); }
/* Les filtres des espèces, et les choix de la carte des départements : des pastilles. */
.filtres, .jours-dep { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0 14px; }
.filtres button, .jours-dep button {
  padding: 6px 12px; border: 1px solid var(--trait); border-radius: 999px; background: var(--surface);
  color: var(--texte); font: inherit; font-size: .88rem; cursor: pointer;
}
.filtres button[aria-pressed="true"], .jours-dep button[aria-pressed="true"] {
  border-color: var(--accent); background: var(--accent-doux); font-weight: 600;
}
.especes-dep { display: flex; flex-wrap: wrap; gap: 6px; }
.especes-dep button {
  display: inline-flex; align-items: center; gap: 6px; padding: 4px 12px 4px 6px; border: 1px solid var(--trait);
  border-radius: 999px; background: var(--surface); color: var(--texte); font: inherit; font-size: .88rem; cursor: pointer;
}
.especes-dep button.hors { opacity: .55; }
.especes-dep button[aria-pressed="true"] { border-color: var(--accent); background: var(--accent-doux); font-weight: 600; opacity: 1; }
.carte-deps-bloc { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); gap: 20px 28px; align-items: start; }
@media (max-width: 760px) { .carte-deps-bloc { grid-template-columns: 1fr; } }
.carte-deps { margin: 0; }
.carte-deps svg { display: block; width: 100%; height: auto; }
.carte-deps path { fill: #ffffff; stroke: var(--surface-2); stroke: #cfc9bd; stroke-width: .8; stroke-linejoin: round; }
.carte-deps a:hover path, .carte-deps a:focus-visible path { stroke: var(--texte); stroke-width: 2; }
.carte-deps path.n1, .pastille.n1 { fill: #efece5; background: #efece5; }
.carte-deps path.n0, .pastille.n0 { fill: #e2ded5; background: #e2ded5; }
.carte-deps path.n2 { fill: var(--classe-2); }
.carte-deps path.n3 { fill: var(--classe-3); }
.carte-deps path.n4 { fill: var(--classe-4); }
.carte-deps-cote h2 { margin-top: 0; }
.carte-deps-cote .legende-semaine { margin: 4px 0 12px; }
.credits { font-size: .8rem; color: var(--texte-3); }
.credits a { color: inherit; }
.page { max-width: 1000px; margin: 0 auto; padding: 28px 24px 56px; font-size: 16px; }
.page.large { max-width: 1180px; }
@media (max-width: 600px) { .page { padding: 20px 16px 48px; } }

.page h1 { font-size: 1.75rem; margin-top: .4em; }
.page h2 { font-size: 1.3rem; margin-top: 1.6em; }
.page li { margin-bottom: .3em; }
.page table { border-collapse: collapse; width: 100%; font-size: .88rem; margin: .6em 0 1.2em; }
.page th, .page td { text-align: left; padding: 6px 8px; border-bottom: 1px solid var(--trait); vertical-align: top; }
.page th { color: var(--texte-2); font-weight: 600; }
.page td.num, .page th.num { text-align: right; font-variant-numeric: tabular-nums; }
/* La semaine sur une page de département : la grille de la carte, pas un tableau de données. */
.page table.semaine { border-collapse: separate; font-size: .8rem; margin: .4em 0 0; }
.page .semaine th, .page .semaine td { border: 0; padding: 0 0 2px; vertical-align: middle; }
.page .semaine tbody th { padding-right: 6px; font-weight: 400; }
.page .semaine thead th { text-align: center; font-weight: 400; }
.page .semaine thead th.actuel { font-weight: 600; }
.semaine a.niveau { text-decoration: none; text-align: center; line-height: 22px; }
.page .departements { list-style: none; padding: 0; }
.page .departements li { margin: 0; }
.page .departements a {
  display: flex; justify-content: space-between; gap: 12px; padding: 7px 0;
  border-bottom: 1px solid var(--trait); color: var(--texte); text-decoration: none;
}
.page .departements a:hover { color: var(--accent); }
.page .departements .cl { color: var(--texte-3); font-size: .85rem; text-align: right; }
.page .departements a { flex-wrap: wrap; }
.tableau { overflow-x: auto; }
.carte-espece { border: 1px solid var(--trait); border-radius: var(--rayon); padding: 12px 14px; margin: 12px 0; background: var(--surface); }
.carte-espece h3 { font-size: 1.05rem; }
.carte-espece .latin { font-style: italic; color: var(--texte-3); font-weight: 400; }
code { background: var(--surface-2); padding: 1px 4px; border-radius: 4px; font-size: .9em; }
.carte-espece h2 { font-size: 1.1rem; margin-top: 0; }
.carte-espece h2 a { color: inherit; }
.page .chapeau { font-size: 1.08rem; color: var(--texte-2); }

/* Boutons-liens des pages : la carte d'abord. */
.actions { display: flex; flex-wrap: wrap; gap: 8px; margin: 14px 0 6px; }
a.bouton, button.bouton {
  display: inline-block; padding: 8px 14px; border: 1px solid var(--trait); border-radius: var(--rayon);
  background: var(--surface); color: var(--texte); text-decoration: none; font: inherit; font-weight: 600;
  font-size: .92rem; cursor: pointer;
}
button.bouton[hidden] { display: none; }
a.bouton:hover, button.bouton:hover { background: var(--surface-2); }
a.bouton.principal { background: var(--accent); border-color: var(--accent); color: #fff; }
a.bouton.principal:hover { filter: brightness(1.08); }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) a.bouton.principal { color: #1d1b17; }
}
:root[data-theme="dark"] a.bouton.principal { color: #1d1b17; }

/* Accueil : la une (la réponse du jour et la carte de France), puis des blocs. */
.une {
  display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, .85fr); gap: 20px 32px; align-items: center;
  margin: 4px 0 8px; padding: 26px 28px; border-radius: 18px; background: var(--surface);
  border: 1px solid var(--trait);
}
.une h1 { font-size: clamp(1.7rem, 3.4vw, 2.4rem); margin: 4px 0 10px; line-height: 1.15; }
.une .chapeau { margin-bottom: 12px; }
.en-bref {
  font-size: 1.05rem; font-weight: 600; color: var(--texte); background: var(--accent-doux);
  border-left: 4px solid var(--accent); border-radius: 0 var(--rayon) var(--rayon) 0; padding: 10px 14px;
}
.aller-departement { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 6px; }
.aller-departement label { font-size: .9rem; color: var(--texte-2); }
.aller-departement select {
  font: inherit; padding: 7px 8px; border: 1px solid var(--trait); border-radius: var(--rayon);
  background: var(--surface); color: var(--texte); max-width: 100%;
}
.une-carte { margin: 0; }
.une-carte img { display: block; width: 100%; height: auto; border-radius: 14px; border: 1px solid var(--trait); }
.une-carte figcaption { font-size: .8rem; color: var(--texte-3); margin-top: 6px; }
@media (max-width: 760px) {
  .une { grid-template-columns: 1fr; padding: 20px 18px; }
  .une-carte { max-width: 420px; }
}
.bloc { margin-top: 40px; }
.bloc > h2:first-child { margin-top: 0; }
.saison-cartes { list-style: none; padding: 0; display: grid; gap: 14px; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); }
.saison-cartes li {
  margin: 0; display: grid; grid-template-rows: auto 1fr; border: 1px solid var(--trait); border-radius: 14px;
  overflow: hidden; background: var(--surface);
}
.saison-photo { display: block; background: var(--surface-2); }
.saison-photo img { display: block; width: 100%; height: auto; aspect-ratio: 4 / 3; object-fit: cover; }
.saison-photo img.icone { width: 96px; height: 96px; aspect-ratio: auto; margin: 36px auto; object-fit: contain; }
.saison-cartes li > div { padding: 10px 14px 14px; }
.saison-cartes h3 { margin: 0 0 6px; font-size: 1.1rem; }
.saison-cartes h3 a { color: var(--texte); text-decoration: none; }
.saison-cartes h3 a:hover { color: var(--accent); }
.saison-cartes .badges { margin: 0 0 6px !important; }
.saison-cartes .etat { margin: 0; font-size: .9rem; color: var(--texte-2); }
/* « Météo favorable 7 années sur 10 à cette date » : ce qui est habituel, à côté du verdict. */
.habituel { font-size: .82rem; color: var(--texte-3); }
.saison-cartes .habituel { margin: 4px 0 0; }
.fiches-especes .habituel { font-size: .76rem; line-height: 1.3; }
.etapes-cartes { list-style: none; padding: 0; display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.etapes-cartes li, .fonctions li {
  margin: 0; padding: 14px 16px; border: 1px solid var(--trait); border-radius: 14px; background: var(--surface);
  color: var(--texte-2); font-size: .93rem;
}
.etapes-cartes strong, .fonctions strong { display: block; color: var(--texte); margin: 6px 0 2px; font-size: 1rem; }
.trait { display: block; color: var(--accent); }
details.detail { margin: 10px 0; }
details.detail summary { cursor: pointer; font-weight: 600; color: var(--accent); }
details.detail[open] summary { margin-bottom: 8px; }

/* Accueil et « en ce moment » */
.ce-matin-bloc { display: grid; grid-template-columns: 1fr 260px; gap: 8px 20px; align-items: start; }
@media (max-width: 640px) { .ce-matin-bloc { grid-template-columns: 1fr; } }
.vignette { margin: 0; }
.vignette img { display: block; width: 100%; height: auto; border-radius: var(--rayon); border: 1px solid var(--trait); }
.vignette figcaption { font-size: .8rem; color: var(--texte-3); margin-top: 4px; }
.ce-matin { padding-left: 1.1em; }
.ce-matin li { margin-bottom: .45em; }
.etapes li { margin-bottom: .5em; }
.fonctions, .especes { list-style: none; padding: 0; display: grid; gap: 12px;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }
.especes li { margin: 0; }
.especes a { display: flex; gap: 12px; align-items: center; height: 100%; padding: 10px 12px; border: 1px solid var(--trait);
  border-radius: var(--rayon); background: var(--surface); color: var(--texte); text-decoration: none; }
.especes a > span { display: grid; gap: 2px; }
.especes a:hover { border-color: var(--accent); }
.especes .latin { font-style: italic; color: var(--texte-3); font-size: .85rem; }
.especes .cl { color: var(--texte-2); font-size: .85rem; }
.especes .milieu { justify-self: start; font-size: .75rem; color: var(--texte-2); border: 1px dashed var(--trait);
  border-radius: 999px; padding: 0 8px; }
.liste-departements { list-style: none; padding: 0; columns: 3 12em; column-gap: 18px; font-size: .9rem; }
.liste-departements li { margin: 0 0 .25em; break-inside: avoid; }
details.question { border-bottom: 1px solid var(--trait); padding: 8px 0; }
details.question summary { cursor: pointer; font-weight: 600; }
details.question p { margin: .5em 0 .2em; color: var(--texte-2); }
/* La semaine en France : un nombre de départements dans chaque case. */
.nationale a.niveau { color: var(--texte); font-variant-numeric: tabular-nums; }
.nationale a.n3, .nationale a.n4 { color: #fff; }
.nationale tbody th a { color: inherit; text-decoration: none; }
.nationale tbody th a:hover { color: var(--accent); }
/* Le titre de la carte mène à l'accueil. */
h1 a.titre { color: inherit; text-decoration: none; }
h1 a.titre:hover { color: var(--accent); }

/* Face aux observations : une région par volet */
.region { border: 1px solid var(--trait); border-radius: var(--rayon); padding: 8px 12px; margin: 12px 0; }
.region summary { cursor: pointer; }
