/* =====================================================================================================
   Champichampion — feuille unique. Pas de SCSS pour l'instant : le site est petit et interne.
   Direction artistique : pixel art, couleurs vives (palette inspirée de « Sweetie 16 »), ciel et herbe.
   Polices : Jersey 10 (interface) et Press Start 2P (logo, gros chiffres), hébergées dans assets/css/fonts ;
   Nunito (Google Fonts, cf. _Layout) pour les textes longs et les aides, plus lisible en petit.
   Cadres « pixel » : pas d'arrondis ; un contour de 3 px aux coins crantés et une ombre portée nette, dessinés
   par box-shadow (--cadre-px, --ombre-px) : ils ne prennent pas de place, les parents gardent une marge.
   Sprites : assets/images/pixel/ (générés par tools/pixel-art.mjs), affichés à 2× ou 4× leur grille.
   ===================================================================================================== */

/* Polices pixel hébergées ici (licence OFL) : utilisables hors ligne. Jersey 10 dessine petit : size-adjust la
   remet à la taille d'un texte ordinaire, les tailles en rem de la feuille restent donc valables. */
@font-face {
    font-family: "Champi UI"; font-display: swap; size-adjust: 140%;
    src: url(/css/fonts/jersey10-latin.woff2) format("woff2");
    unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
    font-family: "Champi UI"; font-display: swap; size-adjust: 140%;
    src: url(/css/fonts/jersey10-latin-ext.woff2) format("woff2");
    unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
    font-family: "Champi Arcade"; font-display: swap;
    src: url(/css/fonts/pressstart2p-latin.woff2) format("woff2");
}

:root {
    color-scheme: light;
    --police: "Champi UI", "Nunito", system-ui, sans-serif;
    --police-titre: "Champi UI", system-ui, sans-serif;
    --police-arcade: "Champi Arcade", "Champi UI", monospace;
    --police-lecture: "Nunito", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;

    --surface-0: #fff4dc;      /* page : papier crème… */
    --surface-0b: #ffedca;     /* … en damier */
    --surface-1: #fffdf6;      /* blocs */
    --surface-2: #fde8c0;
    --surface-3: #f5d697;
    --bordure: #e3c995;
    --texte-1: #1a1c2c;
    --texte-2: #333c57;
    --texte-3: #5d6b82;

    --cadre: #1a1c2c;          /* contours pixel */
    --ombre-c: rgba(26, 28, 44, .28);
    --px: 3px;
    --cadre-px: 0 calc(var(--px) * -1) 0 0 var(--cadre), 0 var(--px) 0 0 var(--cadre), calc(var(--px) * -1) 0 0 0 var(--cadre), var(--px) 0 0 0 var(--cadre);
    --ombre-px: calc(var(--px) * 2) var(--px) 0 0 var(--ombre-c), var(--px) calc(var(--px) * 2) 0 0 var(--ombre-c);
    --cadre-px2: 0 -2px 0 0 var(--cadre), 0 2px 0 0 var(--cadre), -2px 0 0 0 var(--cadre), 2px 0 0 0 var(--cadre);
    --ombre-px2: 4px 2px 0 0 var(--ombre-c), 2px 4px 0 0 var(--ombre-c);

    /* Ciel (barre du haut, mode live) */
    --ciel-haut: #3b5dc9;
    --ciel: #41a6f6;
    --ciel-bas: #73c8ff;
    --ciel-clair: #9be9ff;
    --brume: #c8f4ff;
    --nuage-opacite: 1;

    --herbe: #38b764;
    --herbe-fonce: #257179;
    --herbe-clair: #a7f070;
    --or: #ffd23f;
    --or-clair: #fff3a8;
    --or-fonce: #e89a1a;
    --rouge: #c62f1c;
    --bleu-ami: #41a6f6;      /* amis : cueillettes liées (journal, carte) */

    --foret: #2a9d55;          /* choix actifs, focus */
    --foret-fonce: #257179;
    --foret-clair: #dcf7c8;
    --lien: #1d7a42;
    --accent: #ffd23f;         /* action principale : bouton or */
    --accent-2: #e89a1a;
    --accent-texte: #1a1c2c;
    --critique: #e8402a;
    --succes: #38b764;
    --bonus: #7c4dff;

    /* Classes de la carte : mêmes couleurs que Champi.CLASSES (commun.js). */
    --classe-tres-bon: #e8402a; --classe-tres-bon-trait: #9c1f0e;
    --classe-bon: #ff8c1a;      --classe-bon-trait: #a85300;
    --classe-normal: #ffd23f;   --classe-normal-trait: #a98400;
    --classe-nul: #d6c8a8;

    --grille: #f1dfba;
    --rayon: 0;
    --ombre: var(--cadre-px), var(--ombre-px);
    --ombre-forte: var(--cadre-px), 6px 6px 0 0 var(--ombre-c);
}
@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) {
        color-scheme: dark;
        --surface-0: #1a1c2c; --surface-0b: #1f2235; --surface-1: #29304a; --surface-2: #333c57; --surface-3: #42507a; --bordure: #566c86;
        --texte-1: #f4f4f4; --texte-2: #c9d6e3; --texte-3: #94b0c2;
        --cadre: #0b0c14; --ombre-c: rgba(0, 0, 0, .5);
        --ciel-haut: #1a1c2c; --ciel: #29366f; --ciel-bas: #3b4f9a; --ciel-clair: #566c86; --brume: #6d84a3; --nuage-opacite: .35;
        --foret: #4fd27e; --foret-clair: #213f36; --lien: #7ee59f;
        --critique: #ff6b5e; --bonus: #a78bfa;
        --classe-nul: #4a5a6f; --grille: #333c57;
    }
}
:root[data-theme="dark"] {
    color-scheme: dark;
    --surface-0: #1a1c2c; --surface-0b: #1f2235; --surface-1: #29304a; --surface-2: #333c57; --surface-3: #42507a; --bordure: #566c86;
    --texte-1: #f4f4f4; --texte-2: #c9d6e3; --texte-3: #94b0c2;
    --cadre: #0b0c14; --ombre-c: rgba(0, 0, 0, .5);
    --ciel-haut: #1a1c2c; --ciel: #29366f; --ciel-bas: #3b4f9a; --ciel-clair: #566c86; --brume: #6d84a3; --nuage-opacite: .35;
    --foret: #4fd27e; --foret-clair: #213f36; --lien: #7ee59f;
    --critique: #ff6b5e; --bonus: #a78bfa;
    --classe-nul: #4a5a6f; --grille: #333c57;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; height: 100%; }
body {
    font: 16px/1.45 var(--police);
    background-color: var(--surface-0);
    background-image: repeating-conic-gradient(var(--surface-0b) 0 25%, transparent 0 50%);
    background-size: 32px 32px;
    color: var(--texte-1);
    display: flex;
    flex-direction: column;
    font-synthesis: none;   /* pas de faux gras sur les polices pixel (une seule graisse) */
}
a { color: var(--lien); font-weight: 700; text-underline-offset: 3px; text-decoration-thickness: 2px; }
h1, h2, h3, h4 { font-family: var(--police-titre); font-weight: 700; margin: 0 0 .6rem; line-height: 1.15; }
h2 { font-size: 1.2rem; display: flex; align-items: center; gap: .55rem; }
img { image-rendering: pixelated; }

/* --- Sprites pixel : icônes 16 × 16 affichées en 32 px --------------------------------------------- */
.px, .ico {
    display: inline-block; flex: none; width: 32px; height: 32px; vertical-align: middle;
    background: var(--img) center / contain no-repeat; image-rendering: pixelated;
}
.px-carte { --img: url(/images/pixel/carte.svg); }
.px-manette { --img: url(/images/pixel/manette.svg); }
.px-panier { --img: url(/images/pixel/panier.svg); }
.px-loupe { --img: url(/images/pixel/loupe.svg); }
.px-joueur { --img: url(/images/pixel/joueur.svg); }
.px-cloche { --img: url(/images/pixel/cloche.svg); }
.px-cepe { --img: url(/images/pixel/cepe.svg); }
.px-epingle { --img: url(/images/pixel/epingle.svg); }
.px-boussole { --img: url(/images/pixel/boussole.svg); }
.px-trophee { --img: url(/images/pixel/trophee.svg); }
.px-calendrier { --img: url(/images/pixel/calendrier.svg); }
.px-livre { --img: url(/images/pixel/livre.svg); }
.px-legende { --img: url(/images/pixel/legende.svg); }
.px-crayon { --img: url(/images/pixel/crayon.svg); }
.px-disquette { --img: url(/images/pixel/disquette.svg); }
.px-etoile { --img: url(/images/pixel/etoile.svg); }
.px-cadenas { --img: url(/images/pixel/cadenas.svg); }
.px-amis { --img: url(/images/pixel/amis.svg); }
.px-installer { --img: url(/images/pixel/installer.svg); }

/* Contour d'encre autour d'un texte (titres arcade). */
.titre-arcade {
    font-family: var(--police-arcade); font-weight: 400; line-height: 1.35; letter-spacing: .02em; color: #fff;
    text-shadow: -2px 0 0 var(--cadre), 2px 0 0 var(--cadre), 0 -2px 0 var(--cadre), 0 2px 0 var(--cadre),
                 -2px -2px 0 var(--cadre), 2px -2px 0 var(--cadre), -2px 2px 0 var(--cadre), 2px 2px 0 var(--cadre), 4px 4px 0 var(--cadre);
}

/* --- Barre du haut : ciel, nuages et herbe ------------------------------------------------------------ */
.topbar {
    display: flex; align-items: center; gap: 1rem;
    height: 64px; padding: 0 12px 0 6px; flex: none; position: relative; z-index: 1100;
    background:
        url(/images/pixel/nuage.svg) no-repeat 38% 6px / 48px 22px,
        url(/images/pixel/nuage.svg) no-repeat 64% 16px / 48px 22px,
        linear-gradient(var(--ciel-haut) 0 14px, var(--ciel) 14px 36px, var(--ciel-bas) 36px);
    border-bottom: 3px solid var(--cadre);
}
.topbar::after {   /* bande d'herbe */
    content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 12px; pointer-events: none;
    background: url(/images/pixel/herbe.svg) repeat-x left bottom / 32px 12px; image-rendering: pixelated;
}
.topbar .logo {
    position: relative; z-index: 1; display: flex; align-items: flex-end; gap: .5rem; height: 100%;
    color: #fff; text-decoration: none;
}
.logo-mascotte { display: block; width: 64px; height: 64px; margin-bottom: -1px; }
.logo-nom {
    align-self: center; margin-bottom: 6px; font: 400 .92rem/1 var(--police-arcade); color: #fff; letter-spacing: .02em;
    text-shadow: -2px 0 0 var(--cadre), 2px 0 0 var(--cadre), 0 -2px 0 var(--cadre), 0 2px 0 var(--cadre), 2px 2px 0 var(--cadre), -2px 2px 0 var(--cadre), 2px -2px 0 var(--cadre), -2px -2px 0 var(--cadre), 3px 3px 0 var(--cadre);
}
.logo-nom b { color: var(--or); font-weight: 400; }
.badge-beta {
    display: inline-block; align-self: center; margin: 0 0 6px 4px; padding: 3px 6px 2px;
    font: 700 .72rem/1 var(--police); text-transform: uppercase; letter-spacing: .08em;
    background: var(--rouge); color: #fff; box-shadow: var(--cadre-px2); transform: rotate(-6deg);
}
.badge-beta.grand { font-size: .9rem; padding: 5px 9px 4px; }
.topbar nav { display: flex; gap: 12px; overflow-x: auto; margin-left: auto; padding: 6px 8px 14px 4px; scrollbar-width: none; }
.topbar nav :is(a, button) {
    display: flex; align-items: center; gap: 6px; padding: 2px 10px 2px 4px; text-decoration: none; white-space: nowrap;
    color: #1a1c2c; background: #fffdf6; font-family: inherit; font-weight: 700; font-size: 1rem; line-height: inherit;
    border: 0; cursor: pointer;
    box-shadow: var(--cadre-px2), inset 0 -3px 0 #f5d697, 3px 3px 0 0 rgba(26, 28, 44, .35);
}
.topbar nav :is(a, button):hover { background: var(--or-clair); }
.topbar nav :is(a, button):active { transform: translate(2px, 2px); box-shadow: var(--cadre-px2); }
.topbar nav button[hidden] { display: none; }
.topbar nav a.selected { background: var(--or); box-shadow: var(--cadre-px2), inset 0 -3px 0 var(--or-fonce), 3px 3px 0 0 rgba(26, 28, 44, .35); }
.topbar nav .px { width: 32px; height: 32px; }

/* --- Pages carte : panneau + carte ------------------------------------------------------------------- */
main#Carte, main#Journal { flex: 1; display: grid; grid-template-columns: 390px 1fr; min-height: 0; position: relative; }
.panneau { overflow-y: auto; padding: 18px 22px 22px 16px; display: flex; flex-direction: column; gap: 24px; border-right: 3px solid var(--cadre); }
.carte { min-height: 300px; height: 100%; }
.leaflet-container { font-family: var(--police); background: #dfe9c8; }

.bloc { background: var(--surface-1); border: 0; border-radius: 0; padding: 14px 16px; box-shadow: var(--cadre-px), var(--ombre-px); }
.bloc label { display: flex; flex-direction: column; gap: .3rem; margin-bottom: .75rem; font-size: .95rem; font-weight: 600; color: var(--texte-2); }
.bloc label.case { flex-direction: row; align-items: center; gap: .55rem; color: var(--texte-1); font-weight: 500; cursor: pointer; }
.bloc .ligne { display: grid; grid-template-columns: 1fr 1fr; gap: .7rem; }
input, select, textarea {
    font: 500 1rem var(--police); color: var(--texte-1); background: var(--surface-1);
    border: 3px solid var(--cadre); border-radius: 0; padding: .4rem .6rem; width: 100%;
    box-shadow: inset 3px 3px 0 var(--surface-2);
}
input:focus, select:focus, textarea:focus { outline: none; box-shadow: inset 3px 3px 0 var(--surface-2), 0 0 0 3px var(--or); }
select { cursor: pointer; }
/* Cases à cocher pixel. */
input[type=checkbox] {
    appearance: none; -webkit-appearance: none; flex: none; width: 20px; height: 20px; margin: 0; padding: 0; cursor: pointer;
    border: 3px solid var(--cadre); background: var(--surface-1); box-shadow: inset 2px 2px 0 var(--surface-2);
}
input[type=checkbox]:checked {
    background: var(--herbe) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 6 5' shape-rendering='crispEdges'%3E%3Cpath fill='%231a1c2c' d='M5 0h1v1H5zM4 1h2v1H4zM0 2h1v1H0zM3 2h2v1H3zM0 3h4v1H0zM1 4h2v1H1z'/%3E%3C/svg%3E") center / 12px 10px no-repeat;
    box-shadow: inset -2px -2px 0 var(--herbe-fonce);
}
input[type=checkbox]:indeterminate { background: var(--or) linear-gradient(var(--cadre), var(--cadre)) center / 8px 3px no-repeat; }
input[type=checkbox]:focus-visible { outline: 3px solid var(--or); outline-offset: 2px; }
input[type=range] { padding: 0; border: 0; box-shadow: none; accent-color: var(--herbe); }
input[type=date] { cursor: pointer; }

.btn {
    font: 700 1.05rem var(--police); cursor: pointer; border: 0; border-radius: 0;
    display: inline-flex; align-items: center; justify-content: center; gap: .45rem; text-decoration: none;
    padding: .55rem 1rem; width: 100%; color: var(--accent-texte); background: var(--accent);
    box-shadow: var(--cadre-px), inset -3px -3px 0 var(--accent-2), inset 3px 3px 0 var(--or-clair), var(--ombre-px);
}
.btn:hover { filter: brightness(1.06); }
.btn:active { transform: translate(3px, 3px); box-shadow: var(--cadre-px), inset 3px 3px 0 var(--accent-2); }
.btn:focus-visible { outline: 3px dashed var(--cadre); outline-offset: 6px; }
.btn:disabled { filter: grayscale(.7); cursor: progress; }
.btn.secondaire {
    background: var(--surface-1); color: var(--texte-1); width: auto; padding: .4rem .8rem; font-weight: 700;
    box-shadow: var(--cadre-px), inset -3px -3px 0 var(--surface-3), var(--ombre-px);
}
.btn.secondaire:hover { background: var(--surface-2); filter: none; }
.btn.secondaire:active { box-shadow: var(--cadre-px), inset 3px 3px 0 var(--surface-3); }
.aide { font: 400 .84rem/1.45 var(--police-lecture); color: var(--texte-3); margin: .45rem 0 0; }
.texte { font: 400 .9rem/1.5 var(--police-lecture); color: var(--texte-2); margin: 0; }
.alerte {
    font: 600 .88rem/1.45 var(--police-lecture); margin: .7rem 0 0; padding: .55rem .7rem;
    background: color-mix(in srgb, var(--critique) 14%, var(--surface-1)); box-shadow: inset 4px 0 0 var(--critique);
}
.alerte::before { content: "! "; font: 700 1rem var(--police); color: var(--critique); }
.credits { font: 400 .76rem/1.5 var(--police-lecture); color: var(--texte-3); margin: 0; padding: 0 4px 8px; }

/* --- Choix des espèces : étiquettes pixel ---------------------------------------------------------------- */
.especes { display: flex; flex-direction: column; gap: .9rem; }
.groupe { display: flex; flex-direction: column; gap: .5rem; }
.groupe-tete { display: flex; align-items: center; justify-content: space-between; font-family: var(--police-titre); font-weight: 700; font-size: 1.02rem; }
.bloc label.tout {
    flex-direction: row; align-items: center; gap: .35rem; margin: 0; cursor: pointer;
    font: 700 .8rem var(--police); color: var(--texte-3); text-transform: uppercase; letter-spacing: .06em;
}
.bloc label.tout input { width: 16px; height: 16px; border-width: 2px; }
.chips { display: flex; flex-wrap: wrap; gap: .7rem .65rem; padding: 2px; }
.bloc label.chip-espece {
    --c: #6b4a2b;
    position: relative; flex-direction: row; align-items: center; gap: .4rem; margin: 0; cursor: pointer;
    padding: .25rem .6rem .25rem .4rem; border: 0; border-radius: 0;
    background: var(--surface-1); color: var(--texte-2); font-size: .95rem; font-weight: 600;
    box-shadow: var(--cadre-px2), var(--ombre-px2);
    user-select: none;
}
.bloc label.chip-espece:hover { background: var(--surface-2); }
.bloc label.chip-espece:active { transform: translate(2px, 2px); box-shadow: var(--cadre-px2); }
.chip-espece input { position: absolute; opacity: 0; width: 1px; height: 1px; pointer-events: none; }
.chip-espece .pastille { width: 16px; height: 16px; margin: 0; background: var(--c); box-shadow: 0 0 0 2px var(--cadre); }
.bloc label.chip-espece:has(input:checked) {
    background: color-mix(in srgb, var(--c) 22%, var(--surface-1)); color: var(--texte-1);
    box-shadow: var(--cadre-px2), inset 0 -4px 0 var(--c), var(--ombre-px2);
}
.chip-espece:has(input:checked) .pastille {
    background: var(--c) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 6 5' shape-rendering='crispEdges'%3E%3Cpath fill='%23fff' d='M5 0h1v1H5zM4 1h2v1H4zM0 2h1v1H0zM3 2h2v1H3zM0 3h4v1H0zM1 4h2v1H1z'/%3E%3C/svg%3E") center / 12px 10px no-repeat;
}
.chip-espece:has(input:focus-visible) { outline: 3px solid var(--or); outline-offset: 4px; }
.latin { color: var(--texte-3); font: italic 400 .78rem var(--police-lecture); }
.pastille { display: inline-block; flex: none; width: 12px; height: 12px; margin: .3rem .1rem 0 0; box-shadow: 0 0 0 2px var(--cadre); }
summary .pastille, .puce .pastille { margin: 0 .45rem 0 0; vertical-align: middle; }

.segments { display: flex; padding: 0; margin: 1rem 3px 3px; gap: 0; background: var(--surface-2); border: 0; box-shadow: var(--cadre-px); }
.bloc .segments label { flex: 1; margin: 0; flex-direction: row; cursor: pointer; position: relative; }
.segments input { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; opacity: 0; pointer-events: none; }
.segments span { flex: 1; text-align: center; padding: .4rem .5rem; font-size: .92rem; font-weight: 700; color: var(--texte-2); }
.segments input:checked + span { background: var(--herbe); color: #1a1c2c; box-shadow: inset 0 -3px 0 var(--herbe-fonce), inset 0 3px 0 var(--herbe-clair); }
.segments input:focus-visible + span { outline: 3px solid var(--or); outline-offset: -3px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.fiche { margin-bottom: .6rem; padding: .5rem .7rem; background: var(--surface-0); box-shadow: inset 0 0 0 2px var(--bordure); }
.fiche summary { cursor: pointer; font-weight: 700; font-size: .98rem; }
.fiche .texte { margin-top: .4rem; }

/* --- Résultats ------------------------------------------------------------------------------------------ */
.suggestion { font: 400 .9rem/1.5 var(--police-lecture); margin: .7rem 0; padding: .55rem .7rem; background: var(--foret-clair); box-shadow: inset 4px 0 0 var(--herbe); }
.lien { font: inherit; background: none; border: 0; padding: 0; color: var(--lien); text-decoration: underline; text-underline-offset: 3px; text-decoration-thickness: 2px; cursor: pointer; font-weight: 700; }
.puces { display: flex; flex-wrap: wrap; gap: .2rem .7rem; margin-top: .2rem; }
.puce { font-size: .8rem; color: var(--texte-2); white-space: nowrap; font-variant-numeric: tabular-nums; }

.repartition { list-style: none; padding: 2px; margin: .4rem 0 .9rem; display: grid; grid-template-columns: repeat(3, 1fr); gap: .7rem; }
.stat {
    --c: var(--classe-nul);
    display: flex; flex-direction: column; gap: .25rem; padding: .55rem .5rem .5rem;
    background: color-mix(in srgb, var(--c) 22%, var(--surface-1)); box-shadow: var(--cadre-px2), inset 0 -4px 0 var(--c);
}
.stat b { font: 400 .78rem/1.3 var(--police-arcade); font-variant-numeric: tabular-nums; }
.stat span { font-size: .82rem; font-weight: 600; color: var(--texte-2); }
.stat.tres-bon { --c: var(--classe-tres-bon); }
.stat.bon { --c: var(--classe-bon); }
.stat.normal { --c: var(--classe-normal); }
.stat.vide { opacity: .55; }
.sous-titre { font-size: 1.1rem; margin-top: .9rem; }

/* --- Légende ------------------------------------------------------------------------------------------ */
.legende ul { margin: .5rem 0; padding-left: 1rem; font-size: .9rem; color: var(--texte-2); }
.rampe-classes { display: flex; height: 12px; margin: .2rem 2px .8rem; box-shadow: var(--cadre-px2); }
.rampe-classes i { flex: 1; }
.rampe-classes .normal { background: var(--classe-normal); }
.rampe-classes .bon { background: var(--classe-bon); }
.rampe-classes .tres-bon { background: var(--classe-tres-bon); }

/* Graphe de la vue : une barre par tranche de 5 (20 à 100), cliquable ; la plus haute valeur au-dessus. */
.plus-haut {
    display: flex; align-items: center; width: calc(100% - 6px); gap: .1rem; margin: .2rem 3px .8rem; padding: .45rem .7rem;
    border: 0; background: var(--surface-0); color: var(--texte-1); box-shadow: var(--cadre-px2);
    font: 600 .95rem var(--police); cursor: pointer; text-align: left;
}
.plus-haut b { font: 400 .85rem var(--police-arcade); margin-left: .4rem; }
.plus-haut span { margin-left: auto; color: var(--lien); font-weight: 700; }
.plus-haut:hover { background: var(--or-clair); color: #1a1c2c; }
.histo-barres { display: grid; grid-template-columns: repeat(17, 1fr); align-items: end; gap: 2px; height: 64px; border-bottom: 3px solid var(--cadre); }
.histo-barres button { height: 100%; padding: 0; border: 0; background: none; display: flex; align-items: flex-end; cursor: pointer; }
.histo-barres button:disabled { cursor: default; }
.histo-barres button i { display: block; width: 100%; background: var(--c); min-height: 2px; box-shadow: inset 0 2px 0 rgba(255, 255, 255, .45); }
.histo-barres button:disabled i { min-height: 2px; background: var(--grille); box-shadow: none; }
.histo-barres button:not(:disabled):hover i, .histo-barres button:focus-visible i { outline: 2px solid var(--cadre); outline-offset: 1px; }
.histo-barres .normal { --c: var(--classe-normal); }
.histo-barres .bon { --c: var(--classe-bon); }
.histo-barres .tres-bon { --c: var(--classe-tres-bon); }
.histo-echelle { display: grid; grid-template-columns: repeat(17, 1fr); gap: 2px; font-size: .75rem; color: var(--texte-3); margin-top: 3px; }
.histo-echelle span:nth-child(1) { grid-column: 1; }
.histo-echelle span:nth-child(2) { grid-column: 5; }
.histo-echelle span:nth-child(3) { grid-column: 9; }
.histo-echelle span:nth-child(4) { grid-column: 13; }
.histo-echelle span:nth-child(5) { grid-column: 17; }
.histo-vue .aide { margin-top: .3rem; }
/* Case atteinte depuis le graphe : cadre qui clignote quelques secondes. */
.repere-case { animation: repere 1s steps(2) 5; }
@keyframes repere { 50% { stroke-opacity: .15; } }
@media (prefers-reduced-motion: reduce) { .repere-case { animation: none; } }

/* --- Calendrier (barres colorées par classe) ---------------------------------------------------------------- */
.calendrier { position: relative; height: 150px; margin-top: .6rem; }
.calendrier svg { width: 100%; height: 100%; display: block; overflow: visible; shape-rendering: crispEdges; }
.calendrier .axe { font-size: 11px; fill: var(--texte-3); font-family: var(--police); font-weight: 600; }
.calendrier .grille { stroke: var(--grille); stroke-width: 1; }
.calendrier .aujourdhui { stroke: var(--texte-2); stroke-width: 2; stroke-dasharray: 3 3; }
.calendrier .barre { fill: var(--classe-nul); }
.calendrier .barre.classe-normal { fill: var(--classe-normal); }
.calendrier .barre.classe-bon { fill: var(--classe-bon); }
.calendrier .barre.classe-tres-bon { fill: var(--classe-tres-bon); }
.calendrier .barre.choisi { stroke: var(--cadre); stroke-width: 2; }
.calendrier .barre-prev { fill: url(#hachures); pointer-events: none; }
.calendrier .repere { fill: var(--texte-1); }
.calendrier .cible { fill: transparent; cursor: pointer; }
.calendrier .cible:hover { fill: color-mix(in srgb, var(--texte-1) 8%, transparent); }
.calendrier .repere-classe { stroke-width: 2; stroke-dasharray: 6 4; }
.calendrier .repere-classe.bon { stroke: var(--classe-bon-trait); }
.calendrier .repere-classe.tres-bon { stroke: var(--classe-tres-bon-trait); }
.calendrier .repere-texte { font-weight: 700; fill: var(--texte-2); }
.info-bulle {
    position: absolute; pointer-events: none; z-index: 5; white-space: nowrap;
    background: #1a1c2c; color: #f4f4f4; padding: .45rem .6rem; font-size: .85rem; line-height: 1.35;
    box-shadow: 0 0 0 2px #f4f4f4, 4px 4px 0 2px rgba(26, 28, 44, .4);
}
.tableau-donnees { margin-top: .7rem; font-size: .9rem; }
.tableau-donnees summary { cursor: pointer; font-weight: 700; color: var(--texte-2); }
.tableau-donnees table { width: 100%; border-collapse: collapse; margin-top: .4rem; }
.tableau-donnees td, .tableau-donnees th { padding: 3px 4px; border-bottom: 2px solid var(--grille); text-align: right; }
.tableau-donnees td:first-child, .tableau-donnees th:first-child { text-align: left; }

/* --- Meilleurs coins ---------------------------------------------------------------------------------- */
.coins { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: .35rem; }
.coins li { display: grid; grid-template-columns: 34px 1fr auto; gap: .65rem; align-items: center; padding: .45rem .5rem; cursor: pointer; }
.coins li:hover { background: var(--surface-2); box-shadow: inset 4px 0 0 var(--or-fonce); }
.coins .num {
    width: 30px; height: 30px; margin: 2px; display: grid; place-items: center;
    font: 400 .72rem var(--police-arcade); background: var(--classe-nul); color: var(--texte-1); box-shadow: var(--cadre-px2);
}
.coins .num.classe-tres-bon { background: var(--classe-tres-bon); color: #fff; }
.coins .num.classe-bon { background: var(--classe-bon); color: #1a1c2c; }
.coins .num.classe-normal { background: var(--classe-normal); color: #1a1c2c; }
.coins .titre { font-size: .98rem; font-weight: 600; }
.coins .sous { font: 400 .8rem var(--police-lecture); color: var(--texte-3); }
.coins .indice { font: 400 .9rem var(--police-arcade); font-variant-numeric: tabular-nums; }

/* --- Listes (journal) ------------------------------------------------------------------------------ */
.liste { margin: 0; padding: 2px; list-style: none; display: flex; flex-direction: column; gap: .8rem; }
.liste li { padding: .6rem .7rem; font-size: .95rem; background: var(--surface-0); box-shadow: var(--cadre-px2); }
.liste .actions { display: flex; gap: .5rem; margin-top: .4rem; flex-wrap: wrap; }
.barre-progression { display: block; height: 12px; background: var(--surface-2); overflow: hidden; margin-top: .3rem; box-shadow: var(--cadre-px2); }
.barre-progression i {
    display: block; height: 100%; transition: width .3s steps(6);
    background: repeating-linear-gradient(90deg, var(--herbe) 0 10px, var(--herbe-fonce) 10px 12px);
}
.statut { font-size: .8rem; font-weight: 700; padding: 1px 8px; background: var(--surface-2); color: var(--texte-2); box-shadow: var(--cadre-px2); }

/* --- Popups Leaflet (fond clair dans les deux thèmes) ------------------------------------------------------ */
.leaflet-popup-content-wrapper { border-radius: 0; background: #fffdf6; color: #1a1c2c; box-shadow: 0 -3px 0 0 #1a1c2c, 0 3px 0 0 #1a1c2c, -3px 0 0 0 #1a1c2c, 3px 0 0 0 #1a1c2c, 6px 6px 0 0 rgba(26, 28, 44, .35); }
.leaflet-popup-tip { background: #fffdf6; box-shadow: 0 0 0 3px #1a1c2c; }
.leaflet-popup-content { font-size: .95rem; margin: 12px 14px; min-width: 240px; max-height: 60vh; overflow-y: auto; color: #1a1c2c; }
.leaflet-container a.leaflet-popup-close-button { color: #1a1c2c; font: 700 20px/24px var(--police); }
.diag .indice { font: 400 1.6rem/1 var(--police-arcade); }
.diag .classe { color: #5d6b82; margin-left: .3rem; font-weight: 600; }
.diag ul { margin: .4rem 0 0; padding-left: 1rem; }
.diag li { margin-bottom: .2rem; }
.diag-titre { font-size: .8rem; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; color: #5d6b82; margin-bottom: .3rem; }
.diag details { margin-top: .35rem; }
.diag summary { cursor: pointer; }

/* Épingle numérotée des meilleurs coins : losange pixel, couleur de la classe. */
.epingle {
    --c: var(--classe-nul);
    width: 28px; height: 28px; margin: 2px auto 0; transform: rotate(-45deg);
    background: var(--c); border: 3px solid #1a1c2c; box-shadow: 3px -3px 0 rgba(26, 28, 44, .35);
    display: grid; place-items: center;
}
.epingle span { transform: rotate(45deg); font: 400 9px var(--police-arcade); color: #fff; text-shadow: 1px 1px 0 #1a1c2c, -1px -1px 0 #1a1c2c, 1px -1px 0 #1a1c2c, -1px 1px 0 #1a1c2c; }
.epingle.classe-tres-bon { --c: var(--classe-tres-bon); }
.epingle.classe-bon { --c: var(--classe-bon); }
.epingle.classe-normal { --c: var(--classe-normal); }
.leaflet-marker-icon:hover .epingle { transform: rotate(-45deg) translate(2px, -2px); }

/* Contrôles Leaflet : boutons carrés pixel (fond clair dans les deux thèmes). */
.leaflet-bar a, .leaflet-bar a:hover { border-radius: 0 !important; color: #1a1c2c; font-family: var(--police); border-bottom: 3px solid #1a1c2c; }
.leaflet-bar a:last-child { border-bottom: 0; }
.leaflet-touch .leaflet-bar, .leaflet-control-layers, .leaflet-touch .leaflet-control-layers {
    border: 0 !important; border-radius: 0 !important; overflow: visible;
    box-shadow: 0 -3px 0 0 #1a1c2c, 0 3px 0 0 #1a1c2c, -3px 0 0 0 #1a1c2c, 3px 0 0 0 #1a1c2c, 6px 6px 0 0 rgba(26, 28, 44, .35) !important;
}
.leaflet-top.leaflet-left, .leaflet-top.leaflet-right { padding-top: 4px; }
.leaflet-left { padding-left: 4px; }
.leaflet-right { padding-right: 6px; }
.leaflet-control-layers-expanded { font: 500 .95rem var(--police); color: #1a1c2c; background: #fffdf6; }
.leaflet-control-scale-line { border-color: #1a1c2c; border-width: 0 3px 3px; font: 600 .75rem var(--police); background: rgba(255, 253, 246, .85); }
.leaflet-control-attribution { font: 400 .7rem var(--police-lecture); }

/* Localiser : champ de recherche en haut à gauche de la carte, suggestions en dessous. */
.leaflet-control.localiser { position: relative; z-index: 801; width: min(300px, calc(100vw - 150px)); }   /* liste au-dessus du zoom */
.localiser input {
    width: 100%; padding: .45rem .7rem .45rem 2.1rem; border: 3px solid #1a1c2c; font: 500 1rem var(--police);
    color: #1a1c2c; box-shadow: 6px 6px 0 0 rgba(26, 28, 44, .35);
    background: #fffdf6 url(/images/pixel/loupe.svg) no-repeat .45rem center / 20px 20px;
}
.localiser input:focus { box-shadow: 6px 6px 0 0 rgba(26, 28, 44, .35), 0 0 0 3px var(--or); }
.localiser ul {
    position: absolute; top: calc(100% + 8px); left: 0; right: 0; margin: 0; padding: 4px; list-style: none; z-index: 1001;
    background: #fffdf6; max-height: 60vh; overflow-y: auto;
    box-shadow: 0 0 0 3px #1a1c2c, 6px 6px 0 3px rgba(26, 28, 44, .35);
}
.localiser li { display: flex; gap: .55rem; align-items: center; padding: .45rem .6rem; cursor: pointer; font-size: .98rem; color: #1a1c2c; }
.localiser li[aria-selected="true"], .localiser li[data-i]:hover { background: var(--or-clair); }
.localiser li small { display: block; color: #5d6b82; font: 400 .8rem var(--police-lecture); }
.localiser li.vide { color: #5d6b82; cursor: default; }

.chargement { position: absolute; top: 12px; left: calc(390px + 50%); transform: translateX(-50%); z-index: 1000; background: var(--surface-1); padding: .4rem .9rem; box-shadow: var(--cadre-px2); font-size: .95rem; }

/* --- Page méthode ------------------------------------------------------------------------------------- */
main#Methode { width: 100%; overflow-y: auto; padding: 28px 16px 64px; }
main#Methode > section { max-width: 860px; margin: 0 auto 1.6rem; background: var(--surface-1); padding: 18px 22px; box-shadow: var(--cadre-px), var(--ombre-px); }
main#Methode h1 { font-size: 2rem; color: var(--texte-1); }
main#Methode h2 { font-size: 1.35rem; }
main#Methode p, main#Methode li, main#Methode td { font-family: var(--police-lecture); font-size: .95rem; line-height: 1.6; }
main#Methode table { width: 100%; border-collapse: collapse; }
main#Methode td, main#Methode th { border-bottom: 2px solid var(--bordure); padding: .5rem; text-align: left; vertical-align: top; }
main#Methode th { font-family: var(--police-titre); font-weight: 700; }
main#Methode code { background: var(--surface-2); padding: 1px 5px; }
main#Methode pre { background: var(--surface-2); padding: 12px; overflow-x: auto; box-shadow: inset 3px 3px 0 var(--surface-3); }

/* --- Connexion, inscription, compte : écran titre ------------------------------------------------------ */
main#Compte { overflow-y: auto; }
.connexion { width: min(420px, calc(100vw - 32px)); margin: 8vh auto 48px; padding: 24px; }
.connexion h1 { font-size: 1.7rem; }
.connexion h2 { font-size: 1.15rem; margin: 1.3rem 0 .7rem; }
.connexion .btn { width: 100%; }
.connexion .aide { margin-top: .8rem; }
.ecran-titre { display: flex; flex-direction: column; align-items: center; gap: .6rem; margin: -4px 0 1rem; text-align: center; }
.ecran-titre h1.titre-arcade { font-size: 1.3rem; margin: 0; }
.ecran-titre.petit { flex-direction: row; justify-content: center; gap: .8rem; }
.ecran-titre.petit h1 { margin: 0; }
.ecran-titre.petit .badge-beta { margin: 0; }
.mascotte-titre { display: block; image-rendering: pixelated; }
.ecran-titre > .mascotte-titre { animation: saute 1.6s steps(2) infinite; }
@keyframes saute { 50% { transform: translateY(-6px); } }
.beta-info {
    margin: 0 0 .4rem; padding: .65rem .8rem; font: 400 .9rem/1.5 var(--police-lecture);
    background: color-mix(in srgb, var(--or) 28%, var(--surface-1)); box-shadow: var(--cadre-px2);
}
.beta-info b { font-family: var(--police); font-size: 1rem; }

.compte-actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: .7rem; }
.connexion .compte-actions .btn { width: auto; }
.connexion .form + .form, .connexion section + .form { margin-top: 1.4rem; }
/* Nombre de demandes en attente, dans le menu (admins). */
.pastille { min-width: 20px; padding: 2px 4px 1px; font: 400 .85rem/1 var(--police); text-align: center; background: var(--rouge); color: #fff; box-shadow: var(--cadre-px2); }

/* --- Formulaires par l'API (Champi.Formulaire, commun.js), site et back-office ------------------------------ */
.form label.invalide, .form .invalide { color: var(--critique); }
.form label.invalide input, .form label.invalide select, .form label.invalide textarea, .form input.invalide {
    border-color: var(--critique); box-shadow: inset 3px 3px 0 color-mix(in srgb, var(--critique) 18%, var(--surface-1));
}
.envoi-en-cours { opacity: .6; pointer-events: none; cursor: progress; transition: opacity .15s steps(2); }
.btn.danger { background: var(--critique); color: #fff; box-shadow: var(--cadre-px), inset -3px -3px 0 #9c1f0e, inset 3px 3px 0 #ff8c7a, var(--ombre-px); }
.btn.danger:active { box-shadow: var(--cadre-px), inset 3px 3px 0 #9c1f0e; }
.btn.petit { width: auto; padding: .3rem .65rem; font-size: .95rem; }
.btn.secondaire.petit { padding: .25rem .6rem; }

/* Toasts : petits messages en bas de l'écran (Champi.toast). */
.toasts { position: fixed; z-index: 5000; left: 50%; bottom: 20px; transform: translateX(-50%); display: flex; flex-direction: column; align-items: center; gap: 12px; pointer-events: none; }
.toast {
    max-width: min(460px, calc(100vw - 40px)); padding: .55rem .9rem .5rem 2.2rem; position: relative;
    font: 600 .92rem/1.4 var(--police-lecture); color: var(--texte-1); background: var(--surface-1);
    box-shadow: var(--cadre-px), var(--ombre-px); animation: ouvre .2s steps(3);
}
.toast::before { content: "✓"; position: absolute; left: .7rem; top: .45rem; font: 400 1rem var(--police); color: var(--herbe); }
.toast.erreur { background: color-mix(in srgb, var(--critique) 14%, var(--surface-1)); }
.toast.erreur::before { content: "!"; color: var(--critique); }
.toast.info::before { content: "i"; color: var(--ciel); }
.toast.part { opacity: 0; transition: opacity .3s steps(3); }

/* Boîtes de dialogue (Champi.message, Champi.confirmer). */
dialog.boite { width: min(420px, calc(100vw - 32px)); }
dialog.boite h2 { font-size: 1.25rem; }
dialog.boite.erreur { box-shadow: var(--cadre-px), inset 0 6px 0 var(--critique), var(--ombre-px); }
dialog.boite.attention { box-shadow: var(--cadre-px), inset 0 6px 0 var(--or), var(--ombre-px); }
.boite-actions { display: flex; justify-content: flex-end; flex-wrap: wrap; gap: 14px; margin-top: 1.1rem; }
.boite-actions .btn { width: auto; }

/* Marche à suivre pour installer l'application (Champi.installer, commun.js). */
.etapes-installer { margin: .4rem 0 0; padding-left: 1.4rem; display: flex; flex-direction: column; gap: .45rem; font: 400 .95rem/1.45 var(--police-lecture); }
.etapes-installer b { font-weight: 700; }
dialog.boite .note { margin: .8rem 0 0; font: 400 .85rem/1.4 var(--police-lecture); color: var(--texte-3); }

/* --- Classes de la carte (mêmes couleurs que Champi.CLASSES dans commun.js) ------------------------------- */
.case-classe { display: inline-block; flex: none; width: 16px; height: 16px; border: 2px solid; vertical-align: -3px; margin-right: .45rem; }
.case-classe.tres-bon { background: var(--classe-tres-bon); border-color: var(--classe-tres-bon-trait); }
.case-classe.bon { background: var(--classe-bon); border-color: var(--classe-bon-trait); }
.case-classe.normal { background: var(--classe-normal); border-color: var(--classe-normal-trait); }
.case-classe.nul { background: transparent; border-color: var(--bordure); border-style: dashed; }
/* Forêt privée : mêmes traits fins que sur la carte (carte.js, motifForetsPrivees). */
.case-classe.prive {
    border-color: rgba(74, 52, 96, .7);
    background: repeating-linear-gradient(45deg, rgba(74, 52, 96, .6) 0 2px, transparent 2px 5px);
}
.classes { list-style: none; padding: 0 !important; margin: .2rem 0 .4rem !important; display: flex; flex-direction: column; gap: .45rem; }
.classes li { display: flex; align-items: center; font-size: .95rem; color: var(--texte-1); }

/* --- Bas de la carte : pastille d'état et frise des 7 jours ---------------------------------------------- */
.action-carte {
    position: absolute; bottom: 28px; left: calc(390px + (100% - 390px) / 2); transform: translateX(-50%);
    z-index: 1000; display: flex; flex-direction: column; align-items: center; gap: 12px; pointer-events: none;
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }
/* Pastille d'état de la carte en direct : analyse du terrain, « zoome », calcul. */
.statut-carte {
    pointer-events: auto; display: flex; flex-direction: column; align-items: center; gap: 6px;
    padding: .5rem 1.1rem; border: 0; cursor: default;
    background: var(--surface-1); color: var(--texte-1); font: 700 1rem var(--police);
    box-shadow: var(--cadre-px), var(--ombre-px); white-space: nowrap;
}
.statut-carte[hidden] { display: none; }
.statut-carte.cliquable { cursor: pointer; color: #1a1c2c; background: var(--or); animation: appel 1.2s steps(2) infinite; }
@keyframes appel { 50% { background: var(--or-clair); } }
.statut-carte.cliquable:active { transform: translate(3px, 3px); }
/* « Calcul… » n'apparaît que si le calcul dure : pas de clignotement quand tout est en mémoire. */
.statut-carte.discret { font-weight: 600; color: var(--texte-2); animation: apparaitre .2s .5s both; }
@keyframes apparaitre { from { opacity: 0; } to { opacity: 1; } }
.statut-carte .barre-progression { width: 240px; margin: 0; }
.statut-carte .barre-progression[hidden] { display: none; }

/* --- Bulle courte (popup Leaflet) ------------------------------------------------------------------------ */
.diag-especes { list-style: none; padding: 0 !important; margin: .5rem 0 0 !important; display: flex; flex-direction: column; gap: .25rem; }
.diag-especes li { display: grid; grid-template-columns: auto 1fr auto auto; align-items: center; gap: .4rem; margin: 0 !important; }
.diag-especes b { font-variant-numeric: tabular-nums; }
.mini-classe { font-size: .85rem; color: #333c57; white-space: nowrap; font-weight: 600; }
.mini-classe .case-classe { width: 12px; height: 12px; margin-right: .25rem; }
.diag-prive { margin-top: .25rem; font-size: .9rem; font-weight: 700; color: #4a3460; }   /* bulle Leaflet : fond clair dans les deux thèmes */
.parcelle .ref { display: block; font: 400 .8rem var(--police-lecture); color: var(--texte-3); font-variant-numeric: tabular-nums; }
.diag-actions { display: flex; align-items: center; gap: 1rem; margin-top: .8rem; }
.diag-actions .btn { width: auto; padding: .4rem .9rem; font-size: .95rem; }

/* --- Fiche détaillée (popin) ------------------------------------------------------------------------------ */
.popin {
    padding: 0; border: 0; border-radius: 0; background: var(--surface-1); color: var(--texte-1); overflow: visible;
    width: min(660px, calc(100vw - 32px)); max-height: calc(100vh - 48px);
    box-shadow: var(--cadre-px), 8px 8px 0 0 rgba(0, 0, 0, .45);
}
.popin::backdrop { background: rgba(26, 28, 44, .6); }
.popin[open] { display: flex; flex-direction: column; animation: ouvre .25s steps(3); }
@keyframes ouvre { from { opacity: 0; transform: translateY(12px); } }
.popin-tete {
    display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem; padding: 16px 20px 14px;
    background: var(--herbe); color: #1a1c2c; box-shadow: inset 0 -3px 0 var(--cadre), inset 0 -6px 0 var(--herbe-fonce);
}
.popin-tete h2 { font-size: 1.4rem; margin: .15rem 0 0; }
.popin-tete .diag-titre { color: #1a1c2c; opacity: .75; }
.fermer {
    font: 700 1.4rem/1 var(--police); background: #fffdf6; border: 0; color: #1a1c2c; cursor: pointer; flex: none;
    width: 36px; height: 36px; box-shadow: var(--cadre-px2), 3px 3px 0 0 rgba(26, 28, 44, .35);
}
.fermer:hover { background: var(--or-clair); }
.fermer:active { transform: translate(2px, 2px); box-shadow: var(--cadre-px2); }
.popin-corps { overflow-y: auto; padding: 18px 22px 22px; }
.popin-resume { display: flex; align-items: center; gap: 1rem; }
.gros-indice b { font: 400 2.4rem/1 var(--police-arcade); font-variant-numeric: tabular-nums; }
.gros-indice span { color: var(--texte-3); margin-left: .15rem; font-weight: 700; }
.badge-classe { display: inline-flex; align-items: center; font-weight: 700; font-size: 1.1rem; }
.badge-classe .case-classe { width: 20px; height: 20px; margin-right: .45rem; }
.popin-lieu { display: grid; grid-template-columns: auto 1fr; gap: .35rem 1rem; margin: 1.1rem 2px 0; font-size: .98rem; padding: .7rem .9rem; background: var(--surface-0); box-shadow: var(--cadre-px2); }
.popin-lieu dt { color: var(--texte-3); font-weight: 700; }
.popin-lieu dd { margin: 0; font-weight: 500; }
.popin-actions { display: flex; flex-wrap: wrap; gap: .8rem; margin-top: 1rem; }
.popin-actions .btn { width: auto; padding: .5rem 1.1rem; }
.lecture { margin-top: 1rem; }

.onglets { display: flex; flex-wrap: wrap; gap: .6rem; margin: 1rem 0 0; padding: 2px 2px .5rem; }
.onglets button {
    font: 600 .95rem var(--police); cursor: pointer; display: inline-flex; align-items: center; gap: .35rem;
    background: var(--surface-2); color: var(--texte-2); border: 0; padding: .3rem .7rem; box-shadow: var(--cadre-px2);
}
.onglets button b { color: var(--texte-1); font-variant-numeric: tabular-nums; }
.onglets button .pastille { margin: 0; }
.onglets button .case-classe { width: 12px; height: 12px; margin: 0; }
.onglets button[aria-selected="true"] { background: var(--or); color: #1a1c2c; }
.onglets button[aria-selected="true"] b { color: #1a1c2c; }

.panneau-espece { margin-top: 1rem; }
.espece-tete { display: flex; justify-content: space-between; align-items: baseline; gap: 1rem; flex-wrap: wrap; font-size: 1.05rem; }
.espece-indice b { font: 400 1.1rem var(--police-arcade); font-variant-numeric: tabular-nums; }
.espece-indice .mini-classe { color: var(--texte-2); margin-left: .3rem; }
.frein { margin: .7rem 0 0; padding: .6rem .8rem; font: 400 .92rem/1.5 var(--police-lecture); background: color-mix(in srgb, var(--critique) 12%, var(--surface-1)); box-shadow: inset 4px 0 0 var(--critique); }
.frein b { font-family: var(--police); font-size: 1rem; }
.frein.ok { background: color-mix(in srgb, var(--succes) 14%, var(--surface-1)); box-shadow: inset 4px 0 0 var(--succes); }
.theme { margin-top: 1.2rem; }
.theme h4 { margin: 0 0 .5rem; font-size: .9rem; text-transform: uppercase; letter-spacing: .08em; color: var(--texte-2); }
.theme h4 span { text-transform: none; letter-spacing: 0; font: 400 .85rem var(--police-lecture); color: var(--texte-3); margin-left: .3rem; }
.facteurs { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: .7rem; }
.facteur { display: grid; grid-template-columns: 9.5rem 1fr auto; align-items: center; gap: .25rem .8rem; }
.f-nom { font-weight: 700; font-size: .95rem; }
/* Jauge segmentée, comme une barre de vie. */
.f-jauge { height: 14px; background: var(--surface-2); overflow: hidden; box-shadow: var(--cadre-px2); margin: 0 2px; }
.f-jauge i {
    display: block; height: 100%; background-color: var(--succes);
    background-image: repeating-linear-gradient(90deg, transparent 0 10px, rgba(26, 28, 44, .35) 10px 12px);
}
.facteur.ton-moyen .f-jauge i { background-color: var(--classe-bon); }
.facteur.ton-frein .f-jauge i { background-color: var(--critique); }
.facteur.ton-bonus .f-jauge i { background-color: var(--bonus); }
.f-effet { font-size: .95rem; font-weight: 700; text-align: right; font-variant-numeric: tabular-nums; color: var(--texte-2); }
.facteur.ton-frein .f-effet { color: var(--critique); }
.facteur.ton-bonus .f-effet { color: var(--bonus); }
.f-detail { grid-column: 1 / -1; font: 400 .85rem/1.45 var(--police-lecture); color: var(--texte-3); }
@media (max-width: 600px) {
    .facteur { grid-template-columns: 1fr auto; }
    .f-jauge { grid-column: 1 / -1; grid-row: 2; }
}

/* --- Frise des 7 jours (bas de la carte) ----------------------------------------------------------------- */
.frise {
    pointer-events: auto; display: flex; align-items: stretch; gap: 2px; padding: 6px;
    background: var(--surface-1); box-shadow: var(--cadre-px), var(--ombre-px);
}
.frise-jours { display: grid; grid-template-columns: repeat(7, 60px); gap: 4px; }
.frise-jour {
    font: inherit; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 5px 2px 4px;
    border: 0; background: none; color: var(--texte-2); cursor: pointer;
}
.frise-jour:hover { background: var(--surface-2); }
.frise-jour.choisi { background: var(--or); color: #1a1c2c; box-shadow: inset 0 0 0 2px var(--cadre), inset 0 -4px 0 var(--or-fonce); }
.frise-jour:focus-visible { outline: 3px solid var(--or); outline-offset: 1px; }
.fj-nom { font-size: .8rem; font-weight: 700; text-transform: capitalize; }
.fj-num { font: 400 .8rem/1.3 var(--police-arcade); color: inherit; }
.frise-jour:not(.choisi) .fj-num { color: var(--texte-1); }
.fj-barre { width: 22px; height: 46px; margin-top: 3px; background: var(--surface-2); display: flex; align-items: flex-end; overflow: hidden; box-shadow: var(--cadre-px2); }
.frise-jour.choisi .fj-barre { background: #fffdf6; }
.fj-barre i { display: block; width: 100%; box-shadow: inset 0 2px 0 rgba(255, 255, 255, .45); }
.fj-barre i.classe-tres-bon { background: var(--classe-tres-bon); }
.fj-barre i.classe-bon { background: var(--classe-bon); }
.fj-barre i.classe-normal { background: var(--classe-normal); }
.fj-barre i.classe-nul { background: var(--classe-nul); }
/* Jours de prévision : rayés, comme dans le calendrier. */
.frise-jour.prev .fj-barre i { background-image: repeating-linear-gradient(135deg, rgba(255, 255, 255, .55) 0 2px, transparent 2px 5px); }
.fj-val { font-size: .88rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.frise-fleche { font: 700 1.3rem var(--police); width: 30px; border: 0; background: none; color: var(--texte-2); cursor: pointer; }
.frise-fleche:hover:not(:disabled) { background: var(--surface-2); }
.frise-fleche:disabled { opacity: .3; cursor: default; }

/* --- Mes zones ------------------------------------------------------------------------------------------ */
.ligne-zone { display: flex; gap: .7rem; }
.ligne-zone select { flex: 1; min-width: 0; }
.btn.icone { display: grid; place-items: center; padding: 0 .4rem; }
.btn.icone .px { width: 24px; height: 24px; }
#nouvelleZone { width: 100%; }
.form-zone { display: flex; flex-direction: column; gap: .7rem; margin-top: .2rem; }
.form-zone .ligne { display: flex; gap: .8rem; }
.form-zone .ligne .btn { width: auto; padding: .45rem 1rem; }
.bloc label.espace-haut, .bloc .btn.espace-haut { margin-top: 1rem; }
#horsLigne { width: 100%; }

/* --- Alertes (zones surveillées) ------------------------------------------------------------------- */
.liste-alertes { list-style: none; margin: .3rem 0 0; padding: 2px; display: flex; flex-direction: column; gap: .7rem; }
.alerte-zone {
    width: 100%; display: flex; flex-direction: column; gap: .15rem; text-align: left; cursor: pointer;
    padding: .5rem .7rem; border: 0; background: var(--surface-0); box-shadow: var(--cadre-px2);
    color: var(--texte-1); font: 600 .95rem var(--police);
}
.alerte-zone:hover { background: var(--surface-2); }
.alerte-zone.atteinte { background: color-mix(in srgb, var(--or) 30%, var(--surface-1)); box-shadow: var(--cadre-px2), inset 0 -4px 0 var(--or-fonce); }
.alerte-zone .sous { color: var(--texte-3); font: 400 .82rem var(--police-lecture); }
.alerte-oui { display: flex; align-items: center; gap: .1rem; }
.alerte-oui b { font-family: var(--police-arcade); font-weight: 400; font-size: .8rem; margin-right: .35rem; }
#alerteZone[aria-pressed="true"] { background: var(--or); }

/* --- Filtres de biotope ----------------------------------------------------------------------------- */
.versants { border: 0; margin: 0; padding: 0; min-width: 0; }
.versants legend { font-size: .95rem; font-weight: 600; color: var(--texte-2); margin-bottom: .4rem; padding: 0; }
.bloc .versants label.chip-espece { --c: var(--herbe); }
#effacerFiltres { margin-top: .7rem; }

/* --- Autour de moi (sous le zoom) ------------------------------------------------------------------- */
.autour-de-moi a { font-size: 18px; font-weight: 700; color: #1a1c2c; }   /* barre Leaflet : fond clair dans les deux thèmes */
.autour-de-moi a.actif { color: #fff; background: #41a6f6; }

/* --- Bouton « Live » (en haut à droite de la carte) ---------------------------------------------------- */
.bouton-live {
    display: flex; align-items: center; gap: 4px; padding: 2px 12px 2px 4px; border: 0; cursor: pointer;
    font: 700 1.1rem var(--police); text-transform: uppercase; letter-spacing: .06em; color: #fff; background: var(--rouge);
    box-shadow: 0 -3px 0 0 #1a1c2c, 0 3px 0 0 #1a1c2c, -3px 0 0 0 #1a1c2c, 3px 0 0 0 #1a1c2c, 6px 6px 0 0 rgba(26, 28, 44, .35);
    text-shadow: 2px 2px 0 #1a1c2c; animation: appel-live 1.4s steps(2) infinite;
}
.bouton-live img { width: 32px; height: 32px; }
.bouton-live:hover { background: #e8402a; }
.bouton-live:active { transform: translate(3px, 3px); }
.leaflet-control.bouton-live { margin-top: 14px; }
@keyframes appel-live { 50% { background: #e8402a; } }

/* --- Vue inclinée (3D) et grille cachée (carte.js) ---------------------------------------------------- */
/* Le plan de la carte bascule en arrière ; les boutons, hors de ce plan, restent droits. Le live a sa propre inclinaison. */
body:not(.live) .leaflet-container.vue-3d { perspective: var(--perspective-3d); }
body:not(.live) .vue-3d .leaflet-map-pane { rotate: x var(--inclinaison-3d); transform-origin: var(--origine-3d); }
body:not(.live) .vue-3d::after {   /* brume au loin, par bandes */
    content: ""; position: absolute; left: 0; right: 0; top: 0; height: 14%; z-index: 450; pointer-events: none;
    background: linear-gradient(color-mix(in srgb, var(--brume) 70%, transparent) 0 30%, color-mix(in srgb, var(--brume) 35%, transparent) 30% 65%, transparent);
}
body:not(.live) .grille-cachee .leaflet-cases-pane { display: none; }
.vue-carte a { font: 400 1.05rem var(--police); }
.vue-carte a[aria-pressed="true"], .vue-carte a[aria-pressed="true"]:hover { background: var(--or); }
.ico-grille {   /* 3 × 3 cases, à la façon pixel */
    display: inline-block; width: 20px; height: 20px; vertical-align: middle;
    background-image: linear-gradient(90deg, #1a1c2c 2px, transparent 2px), linear-gradient(#1a1c2c 2px, transparent 2px);
    background-size: 6px 6px; box-shadow: inset -2px -2px 0 #1a1c2c;
}

/* --- Mobile -------------------------------------------------------------------------------------------- */
/* Grand écran : ni menu replié, ni tiroir, ni bouton « Réglages ». */
.menu-mobile, .panneau-tete, .bouton-reglages { display: none; }

@media (max-width: 1100px) {
    .logo-nom { display: none; }
}
@media (max-width: 800px) {
    @supports (height: 100dvh) { body { height: 100dvh; } }   /* suit la barre d'adresse du téléphone */

    /* Barre du haut : le logo, et le menu replié derrière un bouton. */
    .topbar { gap: .5rem; height: 58px; padding: 0 10px 0 2px; }
    .logo-mascotte { width: 56px; height: 56px; }
    .topbar .logo-nom { display: block; font-size: .78rem; margin-bottom: 8px; }
    .badge-beta:not(.grand) { position: absolute; left: 28px; bottom: 6px; margin: 0; font-size: .6rem; padding: 2px 4px 1px; }
    .menu-mobile {
        display: grid; place-items: center; position: relative; z-index: 1; flex: none; width: 42px; height: 42px;
        margin: 0 0 8px auto; padding: 0; border: 0; cursor: pointer; background: #fffdf6;
        box-shadow: var(--cadre-px), inset -3px -3px 0 #f5d697, 5px 5px 0 0 rgba(26, 28, 44, .35);
    }
    .menu-mobile:active { transform: translate(3px, 3px); box-shadow: var(--cadre-px); }
    .menu-mobile[aria-expanded="true"] { background: var(--or); box-shadow: var(--cadre-px), inset -3px -3px 0 var(--or-fonce), 5px 5px 0 0 rgba(26, 28, 44, .35); }
    .burger i { display: block; width: 22px; height: 4px; background: #1a1c2c; box-shadow: 0 -7px 0 #1a1c2c, 0 7px 0 #1a1c2c; }
    .menu-mobile .pastille { position: absolute; top: -10px; right: -10px; }
    .topbar nav {
        display: none; position: absolute; top: calc(100% + 8px); right: 10px; z-index: 1;
        flex-direction: column; gap: 12px; min-width: 220px; margin: 0; padding: 14px; overflow: visible;
        background: var(--surface-1); box-shadow: var(--cadre-px), var(--ombre-px);
    }
    .topbar.menu-ouvert nav { display: flex; animation: ouvre .2s steps(3); }
    .topbar nav :is(a, button) { padding: 4px 14px 4px 4px; font-size: 1.2rem; }

    /* Journal : la carte au-dessus, le panneau en dessous. */
    main#Journal { grid-template-columns: 1fr; grid-template-rows: 55vh auto; }
    main#Journal .carte { grid-row: 1; height: 55vh; }
    main#Journal .panneau { grid-row: 2; padding: 18px 20px; border-right: 0; border-top: 3px solid var(--cadre); }
    .chargement { left: 50%; }

    /* Carte : plein écran, les boutons en colonne à droite (comme le live), les réglages dans un tiroir. */
    body:not(.live) main#Carte { display: block; }
    body:not(.live) main#Carte .carte { position: absolute; inset: 0; height: auto; min-height: 0; }
    main#Carte .panneau {
        position: fixed; top: 0; bottom: 0; left: 0; z-index: 1500; width: min(400px, 90vw);
        padding: 0 16px calc(28px + env(safe-area-inset-bottom)); gap: 20px; overscroll-behavior: contain;
        background-color: var(--surface-0);
        background-image: repeating-conic-gradient(var(--surface-0b) 0 25%, transparent 0 50%);
        background-size: 32px 32px;
        transform: translateX(-104%); visibility: hidden; transition: transform .2s steps(4), visibility 0s .2s;
    }
    body.panneau-ouvert main#Carte .panneau { transform: none; visibility: visible; transition: transform .2s steps(4); }
    .panneau-tete {
        display: flex; align-items: center; justify-content: space-between; gap: 12px;
        position: sticky; top: 0; z-index: 2; margin: 0 -16px; padding: max(10px, env(safe-area-inset-top)) 16px 12px;
        background: linear-gradient(var(--ciel-haut) 0 25%, var(--ciel) 25% 60%, var(--ciel-bas) 60%);
        border-bottom: 3px solid var(--cadre);
    }
    .panneau-tete h2 {
        margin: 0; font: 400 1rem/1 var(--police-arcade); color: #fff;
        text-shadow: -2px 0 0 var(--cadre), 2px 0 0 var(--cadre), 0 -2px 0 var(--cadre), 0 2px 0 var(--cadre), 3px 3px 0 var(--cadre);
    }
    .panneau-tete .live-btn { width: 42px; height: 42px; font-size: 1.2rem; }
    .voile-panneau { position: fixed; inset: 0; z-index: 1400; background: rgba(26, 28, 44, .5); }
    body.live .voile-panneau { display: none; }

    /* Colonne de droite : calques, réglages, zoom, ma position, live (l'ordre ne dépend pas de l'ajout). */
    main#Carte .leaflet-top.leaflet-right { display: flex; flex-direction: column; align-items: flex-end; }
    main#Carte .leaflet-right .leaflet-control { margin: 12px 10px 0 0; }
    main#Carte .leaflet-control-layers { order: 1; }
    main#Carte .bouton-reglages { order: 2; }
    main#Carte .leaflet-control-zoom { order: 3; }
    main#Carte .autour-de-moi { order: 4; }
    main#Carte .bouton-live { order: 5; }
    main#Carte .leaflet-control-layers-toggle { width: 46px; height: 46px; }
    main#Carte .leaflet-bar a { width: 46px; height: 46px; line-height: 46px; font-size: 1.4rem; }
    main#Carte .leaflet-control-zoom.leaflet-bar, main#Carte .vue-carte.leaflet-bar { display: flex; flex-direction: column; gap: 12px; box-shadow: none !important; }
    main#Carte .vue-carte a[aria-pressed="true"] { background: var(--or); }
    main#Carte .ico-grille { width: 30px; height: 30px; background-size: 9px 9px; background-image: linear-gradient(90deg, #1a1c2c 3px, transparent 3px), linear-gradient(#1a1c2c 3px, transparent 3px); box-shadow: inset -3px -3px 0 #1a1c2c; }
    main#Carte .leaflet-control-zoom a, main#Carte .vue-carte a {
        border-bottom: 0; background: #fffdf6;
        box-shadow: 0 -3px 0 0 #1a1c2c, 0 3px 0 0 #1a1c2c, -3px 0 0 0 #1a1c2c, 3px 0 0 0 #1a1c2c, inset -3px -3px 0 #f5d697, 6px 6px 0 0 rgba(26, 28, 44, .35);
    }
    .bouton-reglages {
        display: grid; place-items: center; width: 46px; height: 46px; padding: 0; border: 0; cursor: pointer; background: var(--or);
        box-shadow: 0 -3px 0 0 #1a1c2c, 0 3px 0 0 #1a1c2c, -3px 0 0 0 #1a1c2c, 3px 0 0 0 #1a1c2c, inset -3px -3px 0 var(--or-fonce), 6px 6px 0 0 rgba(26, 28, 44, .35);
    }
    .bouton-reglages .px { width: 32px; height: 32px; }
    .bouton-reglages:active, main#Carte .leaflet-control-zoom a:active, main#Carte .vue-carte a:active { transform: translate(3px, 3px); }
    main#Carte .bouton-live { width: 46px; height: 46px; padding: 0; justify-content: center; }
    main#Carte .bouton-live span { display: none; }   /* la manette suffit, le bouton clignote */

    /* Localiser : toute la largeur à gauche de la colonne. */
    main#Carte .leaflet-top.leaflet-left .leaflet-control { margin: 12px 0 0 6px; }
    main#Carte .leaflet-control.localiser { width: calc(100vw - 92px); }
    main#Carte .localiser input { height: 46px; }

    /* Bas de la carte : pastille d'état et frise des 7 jours ; l'échelle et les crédits juste au-dessus. */
    body:not(.live) main#Carte .action-carte { top: auto; bottom: max(10px, env(safe-area-inset-bottom)); left: 10px; right: 10px; transform: none; gap: 10px; }
    main#Carte .leaflet-bottom { bottom: calc(var(--bas-carte, 0px) + 8px); }
    .statut-carte { white-space: normal; max-width: calc(100vw - 32px); text-align: center; font-size: .95rem; padding: .4rem .9rem; }
    .statut-carte .barre-progression { width: min(240px, 70vw); }
    .frise { width: 100%; padding: 4px; }
    .frise-jours { flex: 1; min-width: 0; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 2px; }
    .frise-fleche { width: 22px; }
    .frise-jour { padding: 3px 1px; }
    .fj-barre { width: 18px; height: 26px; }
    .fj-num { font-size: .7rem; }
}
@media (max-width: 360px) {
    .topbar .logo-nom { display: none; }
}

/* =====================================================================================================
   Mode live (live.js) : écran titre, puis la carte inclinée sous un ciel, l'avatar au centre et le
   tableau de bord par-dessus. --bord-sol (posé par live.js) : hauteur à l'écran du bord lointain du sol.
   ===================================================================================================== */

/* Écran titre */
.live-accueil {
    position: fixed; inset: 0; z-index: 2000; display: grid; place-items: center; overflow: auto; padding: 24px 16px 22vh;
    background: linear-gradient(var(--ciel-haut) 0 12%, var(--ciel) 12% 38%, var(--ciel-bas) 38% 62%, var(--ciel-clair) 62%);
    text-align: center; color: #1a1c2c;
}
.live-accueil::after {   /* le sol : herbe puis terre */
    content: ""; position: fixed; left: 0; right: 0; bottom: 0; height: 20vh; pointer-events: none;
    background: url(/images/pixel/herbe.svg) repeat-x left top / 64px 24px, linear-gradient(transparent 24px, #257179 24px 30px, #38b764 30px 46%, #9a5428 46%);
    image-rendering: pixelated;
}
.live-accueil-corps { position: relative; z-index: 1; max-width: 440px; display: flex; flex-direction: column; align-items: center; gap: .9rem; }
.live-accueil .titre-arcade { font-size: clamp(1.1rem, 5.5vw, 1.6rem); margin: 0; }
.live-accueil .titre-arcade b { display: block; margin-top: .5rem; font-size: 1.6em; font-weight: 400; color: var(--or); }
.live-accueil p { margin: 0; padding: .6rem .9rem; font: 500 1.05rem/1.45 var(--police); background: rgba(255, 253, 246, .92); box-shadow: var(--cadre-px2); }
.live-accueil .aide { font-size: .85rem; color: #333c57; }
.live-accueil .lien { color: #fff; text-shadow: 2px 2px 0 #1a1c2c; font-size: 1.05rem; }
.live-jouer { width: auto; font-size: 1.5rem; padding: .7rem 2.2rem; animation: saute 1s steps(2) infinite; }
.mascotte-titre.saute { width: 160px; height: 160px; animation: saute 1.2s steps(2) infinite; }
.nuage { position: fixed; image-rendering: pixelated; opacity: var(--nuage-opacite); animation: derive 60s steps(120) infinite alternate; }
.nuage.n1 { top: 8%; left: 6%; }
.nuage.n2 { top: 20%; right: 10%; animation-duration: 45s; }
.nuage.n3 { top: 34%; left: 18%; animation-duration: 80s; }
@keyframes derive { to { transform: translateX(18vw); } }

/* La scène : la carte inclinée sous le ciel */
body.live { overflow: hidden; }
body.live .topbar, body.live .panneau { display: none; }
body.live main#Carte {
    position: fixed; inset: 0; display: block; overflow: hidden; z-index: 1;
    background: linear-gradient(var(--ciel-haut) 0 6%, var(--ciel) 6% 18%, var(--ciel-bas) 18% calc(var(--bord-sol, 20%) - 56px),
        var(--ciel-clair) calc(var(--bord-sol, 20%) - 56px) calc(var(--bord-sol, 20%) - 20px), var(--brume) calc(var(--bord-sol, 20%) - 20px));
}
body.live #carte { position: absolute; min-height: 0; will-change: transform; }
body.live .leaflet-container { background: #8fd46a; }   /* sol pas encore chargé : de l'herbe */
body.live .leaflet-tile { image-rendering: pixelated; }
body.live .leaflet-control-container { display: none; }
body.live .action-carte { top: calc(118px + env(safe-area-inset-top, 0px)); bottom: auto; left: 50%; right: auto; transform: translateX(-50%); z-index: 1200; }
body.live .frise { display: none !important; }
body.live .statut-carte { font-size: .9rem; max-width: calc(100vw - 140px); white-space: normal; text-align: center; }

.live-hud { position: fixed; inset: 0; z-index: 1150; pointer-events: none; color: #1a1c2c; }
.live-hud button, .live-hud a, .live-fiche, .live-ici { pointer-events: auto; }
/* Brume sur le bord lointain du sol (par bandes, façon pixel). */
.live-brume {
    position: absolute; left: 0; right: 0; top: calc(var(--bord-sol, -300px) - 2px); height: 12vh;
    background: linear-gradient(var(--brume) 0 22%, color-mix(in srgb, var(--brume) 72%, transparent) 22% 44%,
        color-mix(in srgb, var(--brume) 42%, transparent) 44% 66%, color-mix(in srgb, var(--brume) 16%, transparent) 66% 86%, transparent 86%);
}
.live-objets { position: absolute; inset: 0; }

/* Anneau au sol (incliné comme le sol), flèche de la direction du téléphone */
.live-sol {
    position: absolute; left: 50%; top: var(--ay); width: 128px; height: 128px; margin: -64px 0 0 -64px;
    transform: rotateX(var(--inclinaison, 0deg)) rotateZ(var(--cap, 0deg)); opacity: .9;
}
.live-sol img { position: absolute; inset: 0; width: 100%; height: 100%; }
.live-sol .live-sol-fleche { inset: auto; left: 48px; top: -34px; width: 32px; height: 32px; display: none; }
.live-sol.oriente .live-sol-fleche { display: block; }
/* L'avatar : la mascotte, debout, les pieds sur le point de la position */
.live-avatar {
    position: absolute; left: 50%; top: var(--ay); width: 64px; height: 64px; margin: -62px 0 0 -32px; z-index: 100000;
    animation: respire 1.6s steps(2) infinite;
}
.live-objets.marche .live-avatar { animation: marche .32s steps(2) infinite; }
@keyframes respire { 50% { transform: translateY(-2px); } }
@keyframes marche { 50% { transform: translateY(-6px); } }

/* Les meilleurs coins : des champignons plantés dans le décor */
.live-coin {
    position: absolute; left: 0; top: 0; transform-origin: 50% 100%; display: flex; flex-direction: column; align-items: center;
    padding: 0; border: 0; background: none; cursor: pointer; pointer-events: auto;
}
.live-coin img { display: block; width: 48px; height: 48px; animation: respire 1.4s steps(2) infinite; filter: drop-shadow(0 4px 0 rgba(26, 28, 44, .25)); }
.live-coin-num {
    --c: var(--classe-bon);
    margin-bottom: 4px; padding: 3px 4px 2px; font: 400 9px/1 var(--police-arcade); color: #1a1c2c; background: var(--c);
    box-shadow: var(--cadre-px2);
}
.live-coin.classe-tres-bon .live-coin-num { --c: var(--classe-tres-bon); color: #fff; text-shadow: 1px 1px 0 #1a1c2c; }
.live-coin.atteint img { animation: saute .5s steps(2) infinite; }
.live-coin:focus-visible { outline: 3px dashed #fff; outline-offset: 4px; }

/* Tableau de bord */
.live-haut {
    position: absolute; top: max(10px, env(safe-area-inset-top)); left: 10px; right: 10px;
    display: flex; gap: 12px; align-items: flex-start;
}
.live-btn {
    flex: none; width: 46px; height: 46px; display: grid; place-items: center; padding: 0; border: 0; cursor: pointer;
    font: 700 1.4rem/1 var(--police); color: #1a1c2c; background: #fffdf6;
    box-shadow: var(--cadre-px), inset -3px -3px 0 #f5d697, 5px 5px 0 0 rgba(26, 28, 44, .35);
}
.live-btn:active { transform: translate(3px, 3px); box-shadow: var(--cadre-px); }
.live-btn[aria-pressed="true"] { background: var(--or); box-shadow: var(--cadre-px), inset -3px -3px 0 var(--or-fonce), 5px 5px 0 0 rgba(26, 28, 44, .35); }
#live3d { font-size: 1rem; }
.live-outils { display: flex; flex-direction: column; gap: 12px; }
.live-centre { flex: 1; min-width: 0; display: flex; flex-direction: column; align-items: center; gap: 12px; }
.live-especes {
    max-width: 100%; padding: 3px 10px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
    font: 600 .85rem var(--police); color: #fff; background: rgba(26, 28, 44, .78);
}
.live-cible {
    display: flex; align-items: center; gap: .55rem; max-width: 100%; padding: .4rem .8rem .4rem .45rem;
    background: #fffdf6; box-shadow: var(--cadre-px), 5px 5px 0 0 rgba(26, 28, 44, .35);
}
.live-cible-fleche { flex: none; width: 32px; height: 32px; transition: transform .25s steps(3); }
.live-cible-texte { display: flex; flex-direction: column; min-width: 0; font-size: .95rem; line-height: 1.2; }
.live-cible-texte b { display: flex; align-items: center; white-space: nowrap; }
.live-cible-texte .case-classe { width: 12px; height: 12px; margin-right: .35rem; }

.live-bas {
    position: absolute; left: 12px; right: 12px; bottom: max(10px, env(safe-area-inset-bottom));
    max-width: 520px; margin: 0 auto; display: flex; flex-direction: column; gap: 14px;
}
.live-ici {
    --c: var(--classe-nul);
    display: grid; grid-template-columns: auto auto 1fr; align-items: center; gap: .4rem .7rem; padding: .55rem .8rem .7rem;
    background: #fffdf6; box-shadow: var(--cadre-px), 5px 5px 0 0 rgba(26, 28, 44, .35); pointer-events: auto;
}
.live-ici.classe-tres-bon { --c: var(--classe-tres-bon); }
.live-ici.classe-bon { --c: var(--classe-bon); }
.live-ici.classe-normal { --c: var(--classe-normal); }
.live-ici-titre { padding: 3px 6px 2px; font: 400 .7rem/1 var(--police-arcade); text-transform: uppercase; color: #fff; background: #1a1c2c; }
.live-ici-indice { font: 400 1.5rem/1 var(--police-arcade); }
.live-ici-texte { display: flex; flex-direction: column; font-size: 1.05rem; font-weight: 700; line-height: 1.15; }
.live-ici-texte small { font: 400 .75rem var(--police-lecture); color: #5d6b82; }
.live-ici .lien { grid-column: 1 / -1; justify-self: start; font-size: .95rem; color: #1d7a42; }
.live-barre { grid-column: 1 / -1; display: grid; grid-template-columns: repeat(10, 1fr); gap: 4px; padding: 2px; }
.live-barre i { height: 12px; background: #fde8c0; box-shadow: 0 0 0 2px #1a1c2c; }
.live-barre i.plein { background: var(--c); box-shadow: 0 0 0 2px #1a1c2c, inset 0 3px 0 rgba(255, 255, 255, .45); }
.live-actions { display: flex; gap: 14px; }
.live-actions .btn { flex: 1; width: auto; padding: .45rem .6rem; font-size: 1rem; }
.live-actions .btn.secondaire { flex: 0 1 auto; }
.live-credits { margin: -4px 0 0; text-align: center; font: 600 .7rem var(--police-lecture); color: #fff; text-shadow: 1px 1px 0 #1a1c2c; }

.live-fiche {
    position: relative; padding: .7rem .9rem .9rem; background: #fffdf6; color: #1a1c2c;
    box-shadow: var(--cadre-px), 5px 5px 0 0 rgba(26, 28, 44, .35); animation: ouvre .25s steps(3);
}
.live-fiche .fermer { position: absolute; top: 8px; right: 8px; width: 32px; height: 32px; font-size: 1.2rem; }
.live-fiche-tete { display: flex; align-items: center; gap: .8rem; }
.live-fiche-tete b { font: 400 1.5rem/1 var(--police-arcade); }
.live-fiche-tete span { display: inline-flex; align-items: center; font-weight: 700; font-size: 1.1rem; }
.live-fiche-lieu { margin: .5rem 0 0; font: 400 .92rem/1.45 var(--police-lecture); padding-right: 30px; }
.live-fiche-actions { display: flex; gap: 14px; margin-top: .8rem; }
.live-fiche-actions .btn { width: auto; flex: 1; padding: .4rem .7rem; }

.live-toast {
    align-self: center; padding: .55rem .9rem; text-align: center; font: 700 1.05rem var(--police);
    background: var(--or); color: #1a1c2c; box-shadow: var(--cadre-px), 5px 5px 0 0 rgba(26, 28, 44, .35);
    animation: ouvre .25s steps(3);
}


/* « Recherche… » : points qui défilent */
.points::after { content: ""; animation: points 1.2s steps(1) infinite; }
@keyframes points { 0% { content: ""; } 25% { content: "."; } 50% { content: ".."; } 75% { content: "..."; } }

@media (max-width: 480px) {
    .live-cible-texte { font-size: .88rem; }
    .live-ici-indice { font-size: 1.25rem; }
    .live-actions .btn { font-size: .92rem; }
    .live-actions .btn .px { width: 24px; height: 24px; }
}
@media (min-width: 801px) {
}

/* --- Mode live : champignon cherché, caméra libre --------------------------------------------------------- */
body.live #carte { touch-action: none; }
img.pixel, .pixel img, .leaflet-marker-icon.pixel { image-rendering: pixelated; }
.live-especes { display: inline-flex; align-items: center; gap: 6px; border: 0; cursor: pointer; pointer-events: auto; padding: 3px 10px 3px 4px; }
.live-especes img { flex: none; width: 32px; height: 32px; image-rendering: pixelated; }
.live-especes span { overflow: hidden; text-overflow: ellipsis; }
.live-especes b { flex: none; font-size: .8rem; opacity: .8; }
.live-especes:hover { background: #1a1c2c; }
.live-revenir {
    display: inline-flex; align-items: center; gap: .35rem; padding: .35rem .7rem; border: 0; cursor: pointer;
    font: 700 .95rem var(--police); color: #1a1c2c; background: var(--or);
    box-shadow: var(--cadre-px), 5px 5px 0 0 rgba(26, 28, 44, .35); animation: appel-or 1.2s steps(2) infinite;
}
.live-revenir[hidden] { display: none; }
.live-revenir .px { width: 24px; height: 24px; }
@keyframes appel-or { 50% { background: var(--or-clair); } }
#liveCamera { font-size: .95rem; }
.live-avatar { transform-origin: 50% 97%; }
.live-avatar[hidden], .live-sol[hidden] { display: none; }
.live-coin-num { display: inline-flex; align-items: center; gap: 2px; }
.live-coin-num img { width: 12px; height: 12px; image-rendering: pixelated; animation: none; filter: none; }
.live-coin img { image-rendering: pixelated; }

/* Trouvailles plantées au sol, et le « +2 » qui s'envole */
.live-trouvee { position: absolute; left: 0; top: 0; transform-origin: 50% 100%; display: flex; flex-direction: column; align-items: center; pointer-events: none; }
.live-trouvee img { width: 32px; height: 32px; image-rendering: pixelated; filter: drop-shadow(0 3px 0 rgba(26, 28, 44, .25)); }
.live-trouvee b { margin-bottom: 2px; padding: 2px 3px 1px; font: 400 8px/1 var(--police-arcade); color: #1a1c2c; background: #a7f070; box-shadow: 0 0 0 2px #1a1c2c; }
.live-bonus {
    position: fixed; z-index: 1300; display: flex; align-items: center; gap: 4px; transform: translate(-50%, -100%);
    pointer-events: none; animation: envol 1.4s steps(14) forwards;
}
.live-bonus img { width: 32px; height: 32px; image-rendering: pixelated; }
.live-bonus b { font: 400 1.1rem/1 var(--police-arcade); color: var(--or); text-shadow: 2px 2px 0 #1a1c2c, -2px -2px 0 #1a1c2c, 2px -2px 0 #1a1c2c, -2px 2px 0 #1a1c2c; }
@keyframes envol { 0% { opacity: 0; translate: 0 10px; } 15% { opacity: 1; translate: 0 0; } 80% { opacity: 1; } 100% { opacity: 0; translate: 0 -90px; } }

/* Barre de la cueillette en cours */
.live-cueillette {
    display: flex; align-items: center; gap: 12px; padding: 4px 4px 4px 8px; pointer-events: auto; align-self: flex-start;
    background: #fffdf6; box-shadow: var(--cadre-px), 5px 5px 0 0 rgba(26, 28, 44, .35);
}
.live-cueillette[hidden] { display: none; }
.lc-panier { display: inline-flex; align-items: center; gap: 4px; }
.lc-panier img { width: 32px; height: 32px; image-rendering: pixelated; }
.lc-panier b, .lc-chrono b { font: 400 .9rem/1 var(--police-arcade); font-variant-numeric: tabular-nums; }
.lc-panier.gagne { animation: gagne .6s steps(3); }
@keyframes gagne { 33% { transform: scale(1.35); } 66% { transform: scale(.9); } }
.lc-chrono { padding: 4px 6px; background: #1a1c2c; color: #fff; }
.lc-envoi { font: 700 .8rem var(--police); color: #4a3460; }
.lc-envoi[hidden] { display: none; }
.lc-fin {
    border: 0; cursor: pointer; padding: .35rem .7rem; font: 700 1rem var(--police); color: #fff; background: var(--rouge);
    box-shadow: inset -3px -3px 0 #8a1f12, 0 0 0 2px #1a1c2c; text-shadow: 1px 1px 0 #1a1c2c;
}
.lc-fin:active { transform: translate(2px, 2px); }
.live-actions .btn[hidden] { display: none; }

/* Feuille du bas : choix du champignon, panier, fin */
.live-feuille { max-height: 62vh; overflow-y: auto; }
.live-feuille > .diag-titre { min-height: 30px; padding-right: 40px; }
.live-grille { display: grid; grid-template-columns: repeat(auto-fill, minmax(132px, 1fr)); gap: 10px; margin: .7rem 2px 2px; }
.live-choix-espece {
    display: flex; align-items: center; gap: 6px; padding: 4px 6px 4px 4px; border: 0; cursor: pointer; text-align: left;
    font: 600 .95rem/1.1 var(--police); color: #1a1c2c; background: #fffdf6; box-shadow: var(--cadre-px2), 3px 3px 0 0 rgba(26, 28, 44, .25);
}
.live-choix-espece img { flex: none; width: 32px; height: 32px; image-rendering: pixelated; }
.live-choix-espece span { display: flex; flex-direction: column; min-width: 0; }
.live-choix-espece small { font: 400 .72rem/1.2 var(--police-lecture); color: #5d6b82; }
.live-choix-espece.large { grid-column: 1 / -1; }
.live-choix-espece[aria-pressed="true"] { background: var(--or); box-shadow: var(--cadre-px2), inset 0 -4px 0 var(--or-fonce); }
.live-choix-espece:active { transform: translate(2px, 2px); }
.live-nombre { display: flex; align-items: center; justify-content: center; gap: 18px; margin: 1rem 0 .8rem; }
.live-nombre b { min-width: 3ch; text-align: center; font: 400 1.6rem/1 var(--police-arcade); }
.live-ajouter { font-size: 1.15rem; }
.live-ajouter img { width: 32px; height: 32px; image-rendering: pixelated; }
.live-lignes { list-style: none; margin: .8rem 0 0; padding: 0; display: flex; flex-direction: column; gap: .3rem; font-size: .95rem; }
.live-lignes li { display: flex; align-items: center; gap: .45rem; }
.live-lignes time { font: 400 .7rem var(--police-arcade); color: #5d6b82; min-width: 6ch; }
.live-lignes img { image-rendering: pixelated; }
.live-lignes span { flex: 1; min-width: 0; }
.live-lignes .lien { font-size: .85rem; color: #1d7a42; }
.live-fiche-actions .btn img { width: 32px; height: 32px; image-rendering: pixelated; }

/* Bilan de fin de cueillette */
.live-bilan { z-index: 2100; }
.bilan-trophee { width: 96px !important; height: 96px !important; image-rendering: pixelated; }
.bilan-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; width: 100%; }
.bilan-stats div { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: .6rem .3rem; background: #fffdf6; box-shadow: var(--cadre-px2); }
.bilan-stats b { font: 400 clamp(.8rem, 3.6vw, 1.05rem)/1 var(--police-arcade); color: #1a1c2c; }
.bilan-stats span { font: 600 .85rem var(--police); color: #5d6b82; }
.bilan-lignes {
    list-style: none; margin: 0; padding: .6rem .8rem; width: 100%; display: flex; flex-direction: column; gap: .35rem; text-align: left;
    background: rgba(255, 253, 246, .94); box-shadow: var(--cadre-px2); max-height: 34vh; overflow-y: auto;
}
.bilan-lignes li { display: flex; align-items: center; gap: .55rem; font: 600 1.05rem var(--police); }
.bilan-lignes time { font: 400 .72rem var(--police-arcade); color: #5d6b82; min-width: 7ch; }
.bilan-lignes img { width: 32px; height: 32px; image-rendering: pixelated; }
.bilan-lignes li.fin { color: #b13e53; }
.live-bilan .live-jouer { text-decoration: none; animation: none; font-size: 1.25rem; }

/* --- Journal : mes cueillettes ----------------------------------------------------------------------------- */
.ligne-boutons { display: flex; flex-wrap: wrap; gap: .8rem; margin-top: .8rem; padding: 2px; }
.ligne-boutons .btn { width: auto; flex: 1 1 auto; }
.bloc .ligne.trois > label:first-child { grid-column: 1 / -1; }
.facultatif { font: 400 .8rem var(--police-lecture); color: var(--texte-3); }
.lien.danger { color: var(--critique); margin-top: .6rem; }
.champ-groupe { border: 0; margin: 0 0 .9rem; padding: .6rem .7rem .7rem; background: var(--surface-0); box-shadow: var(--cadre-px2); }
.champ-groupe legend { padding: 0 .3rem; font-weight: 700; color: var(--texte-2); background: var(--surface-1); box-shadow: var(--cadre-px2); }
.lignes-trouvailles { list-style: none; margin: .3rem 0 .7rem; padding: 2px; display: flex; flex-direction: column; gap: .55rem; }
.lignes-trouvailles li { display: grid; grid-template-columns: 5.6rem 1fr 4rem auto; gap: .4rem; align-items: center; }
.lignes-trouvailles input, .lignes-trouvailles select { padding: .3rem .4rem; font-size: .95rem; }
.lignes-trouvailles .lien, .cc-lignes .lien { text-decoration: none; font-size: 1.1rem; color: var(--critique); padding: 0 .2rem; }
.sommet { background: #fff; box-shadow: 0 0 0 3px #e8402a, 2px 2px 0 3px rgba(26, 28, 44, .4); cursor: move; }

.en-cours { box-shadow: var(--cadre-px), inset 0 5px 0 var(--or), var(--ombre-px); }
.en-cours-tete { margin: 0 0 .5rem; font-size: 1rem; }
.en-cours-tete b { font-variant-numeric: tabular-nums; }
.ajout-rapide { display: grid; grid-template-columns: auto 1fr; gap: .7rem; margin-top: .7rem; padding: 2px; }
.ajout-rapide select { grid-column: 1 / -1; }
.ajout-rapide .btn { width: auto; }
.stepper { display: flex; align-items: stretch; }
.stepper .btn.secondaire { padding: 0 .7rem; font-size: 1.2rem; box-shadow: var(--cadre-px); }
.stepper input { width: 4.2rem; text-align: center; -moz-appearance: textfield; appearance: textfield; }
.stepper input::-webkit-inner-spin-button, .stepper input::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }

.cueillettes { list-style: none; margin: .4rem 0 0; padding: 2px; display: flex; flex-direction: column; gap: .9rem; }
.cc { background: var(--surface-0); box-shadow: var(--cadre-px2); }
.cc.ouverte { box-shadow: var(--cadre-px2), inset 5px 0 0 var(--or); }
.cc-tete {
    width: 100%; display: flex; flex-direction: column; gap: .3rem; padding: .55rem .7rem .6rem .8rem; border: 0; background: none; cursor: pointer;
    text-align: left; color: var(--texte-1); font: inherit;
}
.cc-tete:hover { background: var(--surface-2); }
.cc-titre { display: flex; flex-wrap: wrap; align-items: center; gap: .4rem; font-size: 1.05rem; }
.cc-titre b::first-letter { text-transform: uppercase; }
.cc-sous { font: 400 .82rem var(--police-lecture); color: var(--texte-3); }
.cc-panier { display: flex; flex-wrap: wrap; align-items: center; gap: .3rem .6rem; }
.cc-puce { display: inline-flex; align-items: center; gap: 1px; }
.cc-puce img { width: 32px; height: 32px; image-rendering: pixelated; }
.cc-puce b { font: 400 .72rem var(--police-arcade); }
.cc-total { font-size: .9rem; color: var(--texte-2); }
.cc-bredouille { font-weight: 700; color: var(--texte-3); }
.badge { padding: 2px 5px 1px; font: 400 .55rem/1.2 var(--police-arcade); text-transform: uppercase; background: var(--surface-3); color: var(--texte-1); }
.badge.en-cours { background: var(--or); color: #1a1c2c; box-shadow: none; }
.badge.live { background: var(--rouge); color: #fff; }
.badge.attente { background: #c9b8e8; color: #1a1c2c; }
.badge.erreur { background: var(--critique); color: #fff; }
.cc-detail { padding: 0 .7rem .7rem .8rem; }
.cc-lignes { list-style: none; margin: .2rem 0 0; padding: 0; display: flex; flex-direction: column; gap: .3rem; font-size: .95rem; }
.cc-lignes li { display: flex; align-items: center; gap: .45rem; }
.cc-lignes time { font: 400 .65rem var(--police-arcade); color: var(--texte-3); min-width: 7ch; }
.cc-lignes img { image-rendering: pixelated; }
.cc-lignes span { flex: 1; min-width: 0; }
.cc-lignes small { color: var(--texte-3); font: 400 .8rem var(--police-lecture); }
.cc-note { margin: .6rem 0 0; font: 400 .88rem/1.45 var(--police-lecture); color: var(--texte-2); }

/* Secteur colorié case par case (journal) */
.outils-pinceau { display: flex; gap: .6rem; margin-top: .6rem; padding: 2px; }
.outils-pinceau .btn { flex: 1; padding: .35rem .5rem; font-size: .95rem; }
.outils-pinceau .btn .px { width: 24px; height: 24px; }
.outils-pinceau .btn[aria-pressed="true"] { background: var(--or); color: #1a1c2c; box-shadow: var(--cadre-px), inset 0 -4px 0 var(--or-fonce); }
.leaflet-container.peinture { cursor: crosshair; touch-action: none; }
.leaflet-container.peinture.gomme { cursor: cell; }

/* --- Mode live sur téléphone : le bas de l'écran reste au sol et à l'avatar ------------------------------ */
.live-cueillette { align-self: center; padding: 2px 2px 2px 6px; gap: 8px; }
.lc-panier img { width: 24px; height: 24px; }
.lc-fin { padding: .2rem .6rem; }
/* Le tableau de bord garde ses couleurs claires, même en thème sombre. */
.live-actions .btn.secondaire { background: #fffdf6; color: #1a1c2c; box-shadow: var(--cadre-px), inset -3px -3px 0 #f5d697, 5px 5px 0 0 rgba(26, 28, 44, .35); }
.live-actions .btn .px { width: 24px; height: 24px; }
/* « Ici » sur une ligne : titre, indice, texte et la barre à droite. */
.live-ici { grid-template-columns: auto auto auto 1fr; padding: .4rem .7rem; gap: .3rem .6rem; }
.live-ici .live-barre { grid-column: auto; gap: 3px; min-width: 0; }
.live-ici .live-barre i { height: 10px; }
.live-ici-indice { font-size: 1.25rem; }
.live-ici-texte { font-size: .98rem; }
@media (max-width: 480px) {
    .live-ici { grid-template-columns: auto auto 1fr; }
    .live-ici .live-barre { grid-column: 1 / -1; }
    .live-ici .live-barre i { height: 7px; }
    .live-actions { gap: 10px; }
    .live-actions .btn { font-size: .98rem; padding: .4rem .5rem; }
    #liveDetail span { display: none; }   /* la loupe suffit */
    #liveDetail { flex: none; padding: .4rem .55rem; }
}
@media (max-height: 760px) {
    .live-bas { gap: 10px; }
    .live-ici-texte small { display: none; }   /* précision GPS : dans la fiche « Ce coin » */
    .live-haut { top: max(6px, env(safe-area-inset-top)); left: 6px; right: 6px; gap: 8px; }
    .live-btn { width: 40px; height: 40px; font-size: 1.2rem; }
    .live-outils { gap: 8px; }
    .live-centre { gap: 8px; }
    .live-cible { padding: .25rem .6rem .25rem .35rem; }
    .live-cible-fleche { width: 24px; height: 24px; }
    .live-cible-texte { font-size: .88rem; }
    .live-credits { font-size: .62rem; }
}

/* Fiches et feuilles du live : par-dessus tout le reste (tableau de bord compris), sans rien pousser.
   L'ombre géante assombrit la scène derrière. Le message (toast) flotte au-dessus de l'avatar. */
.live-fiche, .live-feuille {
    position: fixed; z-index: 1400; left: 8px; right: 8px; bottom: max(8px, env(safe-area-inset-bottom));
    max-width: 560px; margin: 0 auto; max-height: calc(100dvh - 16px - env(safe-area-inset-top)); overflow-y: auto;
    box-shadow: var(--cadre-px), 0 0 0 100vmax rgba(26, 28, 44, .45);
}
.live-feuille { max-height: calc(100dvh - 16px - env(safe-area-inset-top)); }
.live-toast {
    position: fixed; z-index: 1300; left: 16px; right: 16px; width: fit-content; max-width: calc(100vw - 32px); margin: 0 auto;
    top: calc(var(--ay, 60vh) - 150px); pointer-events: none;
}

/* Cueillette en cours, à droite sous les outils : « REC » qui clignote (et le panier), bandeau « Terminer » dessous. */
.live-outils { align-items: flex-end; }
.live-cueillette { display: flex; flex-direction: column; align-items: stretch; gap: 0; padding: 0; margin-top: 4px; background: none; box-shadow: none; align-self: flex-end; }
.live-rec {
    display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 5px 6px 4px; border: 0; cursor: pointer;
    background: #fffdf6; color: #1a1c2c; box-shadow: var(--cadre-px), 5px 5px 0 0 rgba(26, 28, 44, .35);
}
.rec { display: inline-flex; align-items: center; gap: 4px; font: 400 .62rem/1 var(--police-arcade); color: #e8402a; }
.rec i { width: 10px; height: 10px; background: #e8402a; box-shadow: 0 0 0 2px #1a1c2c; animation: rec 1s steps(1) infinite; }
@keyframes rec { 50% { opacity: .15; } }
.live-rec .lc-panier img { width: 24px; height: 24px; }
.live-rec .lc-panier b { font: 400 .8rem/1 var(--police-arcade); }
.live-terminer {
    margin-top: 3px; padding: 3px 4px 2px; border: 0; cursor: pointer; font: 400 .5rem/1.2 var(--police-arcade); text-transform: uppercase;
    color: #fff; background: #e8402a; box-shadow: 0 0 0 3px #1a1c2c, 5px 5px 0 2px rgba(26, 28, 44, .35); text-shadow: 1px 1px 0 #1a1c2c;
}
.live-terminer:active, .live-rec:active { transform: translate(2px, 2px); }
.live-feuille .diag-titre .rec { margin-right: .35rem; vertical-align: 1px; }
.recap-stats { margin: .7rem 0 .4rem; }
.recap-stats div { padding: .45rem .2rem; }
.live-fiche .btn.secondaire { background: #fffdf6; color: #1a1c2c; box-shadow: var(--cadre-px), inset -3px -3px 0 #f5d697, 5px 5px 0 0 rgba(26, 28, 44, .35); }

/* --- Amis (Mon compte) et cueillettes liées (journal, mode live) ------------------------------------------- */
.amis h3 { margin: 1.1rem 0 .5rem; font-size: 1rem; color: var(--texte-2); }
.ami-ajout { display: flex; gap: 10px; margin-top: .8rem; padding: 2px; }
.ami-ajout input { flex: 1; min-width: 0; }
.connexion .ami-ajout .btn { width: auto; }
.liste-amis { list-style: none; margin: 0; padding: 2px; display: flex; flex-direction: column; gap: 10px; }
.liste-amis li {
    display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .4rem .8rem;
    padding: .45rem .7rem; background: var(--surface-2); box-shadow: var(--cadre-px2);
}
.liste-amis b { display: inline-flex; align-items: center; gap: .3rem; font: 400 1.1rem var(--police); }
.liste-amis .compte-actions, .liste-amis .lien.danger { margin: 0; }

.invitations { box-shadow: var(--cadre-px), inset 0 5px 0 var(--bleu-ami), var(--ombre-px); }
.liste-invitations { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 1rem; }
.liste-invitations p { margin: 0; font: 400 .95rem/1.45 var(--police-lecture); }
.badge.groupe { background: var(--bleu-ami); color: #fff; }
.cc-groupe { margin-top: .7rem; padding: .5rem .6rem; background: var(--surface-1); box-shadow: var(--cadre-px2), inset 4px 0 0 var(--bleu-ami); }
.cc-groupe-titre { display: flex; align-items: center; gap: .3rem; margin: 0 0 .3rem; font-weight: 700; }
.cc-groupe .aide { margin: 0; }
.membres { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: .2rem; }
.membres li { display: flex; flex-wrap: wrap; align-items: baseline; gap: .5rem; }
.membres li.invite { opacity: .7; }
.membres span { font: 400 .85rem var(--police-lecture); color: var(--texte-3); }
.leaflet-marker-icon.marqueur-ami {
    filter: drop-shadow(2px 0 0 var(--bleu-ami)) drop-shadow(-2px 0 0 var(--bleu-ami)) drop-shadow(0 2px 0 var(--bleu-ami)) drop-shadow(0 -2px 0 var(--bleu-ami));
}

dialog.dialogue {
    width: min(400px, calc(100vw - 32px)); max-height: calc(100vh - 64px); padding: 18px 20px; border: 0;
    color: var(--texte-1); background: var(--surface-1); box-shadow: var(--cadre-px), var(--ombre-px);
}
dialog.dialogue::backdrop { background: rgba(26, 28, 44, .5); }
.dialogue .aide { margin: 0 0 .6rem; }
.liste-cases-amis { list-style: none; margin: .6rem 0; padding: 2px; display: flex; flex-direction: column; gap: .5rem; max-height: 45vh; overflow-y: auto; }
.liste-cases-amis label {
    display: flex; align-items: center; gap: .5rem; padding: .3rem .5rem; cursor: pointer; font-size: 1.1rem;
    background: var(--surface-0); box-shadow: var(--cadre-px2);
}
.liste-cases-amis label:has(input:checked:not(:disabled)) { background: var(--or-clair); color: #1a1c2c; }
.liste-cases-amis small { color: var(--texte-3); font: 400 .8rem var(--police-lecture); }

/* Mode live : les amis de la cueillette, debout à leur dernière position, et la feuille « Entre amis » */
.live-compagnon {
    position: absolute; left: 0; top: 0; transform-origin: 50% 100%; display: flex; flex-direction: column; align-items: center; gap: 2px;
    padding: 0; border: 0; background: none; cursor: pointer; pointer-events: auto;
}
.live-compagnon img { display: block; width: 48px; height: 48px; image-rendering: pixelated; filter: drop-shadow(0 4px 0 rgba(26, 28, 44, .25)); }
.live-compagnon-nom {
    max-width: 12ch; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; padding: 2px 5px 1px;
    font: 400 .9rem/1 var(--police); color: #fff; background: var(--herbe-fonce); box-shadow: 0 0 0 2px #1a1c2c;
}
.live-groupe-lien {
    display: flex; align-items: center; gap: .5rem; width: 100%; margin-top: .8rem; padding: 4px 8px 4px 4px; border: 0; cursor: pointer;
    text-align: left; font: 600 1rem var(--police); color: #1a1c2c; background: #d9f5e3; box-shadow: var(--cadre-px2);
}
.live-groupe-lien img { flex: none; width: 32px; height: 32px; image-rendering: pixelated; }
.live-groupe-lien:active { transform: translate(2px, 2px); }
.live-membres { list-style: none; margin: .7rem 0 0; padding: 2px; display: flex; flex-direction: column; gap: .5rem; }
.live-membres li { display: flex; align-items: center; gap: .55rem; }
.live-membres li.invite { opacity: .6; }
.live-membres img { flex: none; width: 32px; height: 32px; image-rendering: pixelated; }
.live-membres span { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.live-membres span b { font: 400 1.1rem/1.1 var(--police); }
.live-membres small { font: 400 .78rem var(--police-lecture); color: #5d6b82; }
.live-membre-total { font: 400 .8rem var(--police-arcade); }
.live-sous-titre { margin: 1rem 0 0; font: 700 1rem var(--police); color: #4a3460; }

/* --- Profil (Mon compte) : onglets, score, sessions publiques ou privées, classement entre amis ---------------- */
.connexion.profil { width: min(680px, calc(100vw - 32px)); margin-top: 4vh; }
.profil-nom { display: flex; flex-direction: column; align-items: flex-start; gap: .2rem; }
.profil-rang { font: 400 .62rem/1.3 var(--police-arcade); color: var(--texte-3); text-transform: uppercase; }
.onglets-profil { margin: .2rem 0 .6rem; }
.onglets-profil a {
    font: 600 1rem var(--police); display: inline-flex; align-items: center; gap: .35rem; text-decoration: none;
    background: var(--surface-2); color: var(--texte-2); padding: .3rem .7rem; box-shadow: var(--cadre-px2);
}
.onglets-profil a b { color: var(--texte-1); font-variant-numeric: tabular-nums; }
.onglets-profil a .pastille { width: auto; height: auto; margin: 0; padding: 1px 4px; }
.onglets-profil a[aria-selected="true"] { background: var(--or); color: #1a1c2c; }
.onglets-profil a[aria-selected="true"] b { color: #1a1c2c; }
.onglet-page > section + section, .onglet-page > section + h2 { margin-top: 1.4rem; }

.score-carte {
    display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: .9rem; padding: .8rem 1rem;
    background: color-mix(in srgb, var(--or) 30%, var(--surface-1)); box-shadow: var(--cadre-px2);
}
.score-carte img { width: 64px; height: 64px; image-rendering: pixelated; }
.score-valeur { display: flex; flex-direction: column; gap: .35rem; }
.score-valeur b { font: 400 clamp(1.1rem, 5vw, 1.6rem)/1 var(--police-arcade); color: var(--texte-1); font-variant-numeric: tabular-nums; }
.score-valeur span, .score-rang span { font: 600 .9rem var(--police); color: var(--texte-3); }
.score-rang { display: flex; flex-direction: column; align-items: flex-end; text-align: right; gap: .2rem; }
.score-rang b { font: 400 1.25rem var(--police); color: var(--texte-1); }
.jauge { height: 14px; margin: .9rem 2px 0; background: var(--surface-2); box-shadow: var(--cadre-px2); }
.jauge i { display: block; height: 100%; min-width: 2px; background: repeating-linear-gradient(90deg, var(--herbe) 0 10px, var(--herbe-clair) 10px 12px); }

.profil-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; padding: 2px; }
.profil-stats div { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: .6rem .3rem; text-align: center; background: var(--surface-2); box-shadow: var(--cadre-px2); }
.profil-stats b { font: 400 clamp(.75rem, 3.4vw, 1rem)/1 var(--police-arcade); color: var(--texte-1); }
.profil-stats span { font: 600 .9rem var(--police); color: var(--texte-3); }

.sessions .cc-tete.statique { cursor: default; }
.sessions .cc-tete.statique:hover { background: none; }
.session-pseudo { display: inline-flex; align-items: center; gap: .2rem; color: var(--lien); }
.session-actions { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .6rem; padding: 0 .7rem .6rem .8rem; }
.session-actions .lien { font-size: .95rem; }
.badge.points { background: var(--herbe); color: #fff; }
.badge.prive { background: var(--surface-3); color: var(--texte-2); }
.interrupteur {
    display: inline-flex; align-items: center; gap: .35rem; padding: .2rem .6rem .2rem .3rem; border: 0; cursor: pointer;
    font: 600 1rem var(--police); color: var(--texte-2); background: var(--surface-2); box-shadow: var(--cadre-px2);
}
.interrupteur[aria-checked="true"] { background: color-mix(in srgb, var(--bleu-ami) 30%, var(--surface-1)); color: var(--texte-1); }
.interrupteur:active { transform: translate(2px, 2px); }
.interrupteur:disabled { opacity: .6; cursor: wait; }

.classement { list-style: none; margin: 0; padding: 2px; display: flex; flex-direction: column; gap: 10px; counter-reset: none; }
.classement li { display: flex; align-items: center; gap: .6rem; padding: .4rem .7rem; background: var(--surface-2); box-shadow: var(--cadre-px2); }
.classement li.moi { background: color-mix(in srgb, var(--or) 35%, var(--surface-1)); }
.classement li:first-child .place { color: var(--or-fonce); }
.classement .place { min-width: 2ch; font: 400 .9rem var(--police-arcade); color: var(--texte-3); }
.classement img { width: 32px; height: 32px; image-rendering: pixelated; }
.classement .joueur { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.classement .joueur b { font: 400 1.1rem/1.1 var(--police); }
.classement .joueur small { font: 400 .8rem var(--police-lecture); color: var(--texte-3); }
.classement .score { font: 400 .8rem var(--police-arcade); font-variant-numeric: tabular-nums; }

.case-visibilite { display: flex; align-items: flex-start; gap: .5rem; margin: .8rem 0 0; font: 400 .9rem/1.45 var(--police-lecture); cursor: pointer; }
.case-visibilite input { flex: none; width: 18px; height: 18px; margin: 2px 0 0; accent-color: var(--foret); }
.case-visibilite b { font-family: var(--police); font-size: 1rem; }

/* Mode live : visibilité, points */
.live-visibilite { grid-template-columns: repeat(2, 1fr); }
.live-points { display: flex; align-items: center; gap: .35rem; margin: .7rem 0 0; font: 600 1rem var(--police); color: #1a1c2c; }
.live-points img { image-rendering: pixelated; }
.live-points b { font: 400 .85rem var(--police-arcade); }
.bilan-points { margin: 0; font: 600 1.1rem var(--police); color: #1a1c2c; }
.bilan-points b { font: 400 clamp(1.1rem, 6vw, 1.6rem) var(--police-arcade); color: #257179; text-shadow: 2px 2px 0 #a7f070; }
.bilan-bredouille { margin: 0; font: 400 1rem/1.45 var(--police-lecture); color: #1a1c2c; }
.bilan-bredouille b { font: 400 1.2rem var(--police); color: #b13e53; }

@media (max-width: 520px) {
    .profil-stats { grid-template-columns: repeat(2, 1fr); }
    .score-carte { grid-template-columns: auto 1fr; }
    .score-rang { grid-column: 1 / -1; flex-direction: row; justify-content: space-between; align-items: baseline; text-align: left; }
}
