/* Outils › Éditeur de map (outils/editeur-map.php, js/pages/editeur-map.js), par-dessus outils.css. Interface : couleurs
   par les variables (le mode sombre suit) ; le plateau est dessiné dans le canvas (couleurs identiques dans les deux
   thèmes). Pastilles des bordures, des couleurs et des hachures : teintes passées en variables par le JS. */
.edm-app {
    display: grid;
    gap: 1rem;
    align-items: start;
}

@media (min-width: 992px) {
    .edm-app {
        grid-template-columns: 350px minmax(0, 1fr);
    }

    .edm-panneau {
        position: sticky;
        top: 1rem;
        overflow-y: auto;
    }
}

.edm-panneau {
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
    padding: 0.75rem;
    background: var(--beige-clair);
    border: 1px solid var(--beige-fonce);
    border-radius: var(--radius-card);
}

/* Calques en onglets dépliants : un seul ouvert ; l'actif (ce que pose le plateau) garde son liseré une fois replié */
.edm-calques {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.edm-calque-bloc {
    background: var(--white);
    border: 1px solid var(--beige-fonce);
    border-radius: 0.7rem;
    overflow: hidden;
}

.edm-calque-bloc.is-actif {
    border-color: var(--rouille);
    box-shadow: inset 4px 0 0 var(--rouille);
}

.edm-calque-titre {
    margin: 0;
    font-size: inherit;
}

.edm-calque {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    width: 100%;
    padding: 0.55rem 0.7rem 0.55rem 0.85rem;
    font: inherit;
    color: var(--brun-cuir);
    text-align: left;
    background: transparent;
    border: 0;
    cursor: pointer;
}

.edm-calque:hover {
    background: var(--beige-clair);
}

.edm-calque-bloc.is-ouvert .edm-calque {
    color: var(--or-clair);
    background: var(--brun-cuir);
}

.edm-calque-icone {
    display: inline-flex;
    width: 1.35rem;
    height: 1.35rem;
    flex-shrink: 0;
}

.edm-calque-icone svg,
.edm-calque-chevron {
    width: 100%;
    height: 100%;
}

.edm-calque-texte {
    display: flex;
    flex: 1;
    flex-direction: column;
    min-width: 0;
}

.edm-calque-nom {
    font-size: 0.95rem;
    font-weight: 700;
    line-height: 1.2;
}

.edm-calque-resume {
    overflow: hidden;
    font-size: 0.78rem;
    line-height: 1.3;
    color: var(--brun-cuir-clair);
    white-space: nowrap;
    text-overflow: ellipsis;
}

.edm-calque-bloc.is-ouvert .edm-calque-resume {
    display: none;
}

.edm-calque-chevron {
    width: 1.1rem;
    height: 1.1rem;
    flex-shrink: 0;
    transition: transform 0.2s ease;
}

.edm-calque[aria-expanded='true'] .edm-calque-chevron {
    transform: rotate(180deg);
}

.edm-panneau-contenu {
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
    padding: 0.7rem;
}

.edm-panneau-contenu[hidden] {
    display: none;
}

/* Sous-dépliant (liste des thèmes du sol) */
.edm-sous {
    background: var(--beige-clair);
    border-radius: 0.6rem;
}

.edm-sous summary {
    display: flex;
    align-items: baseline;
    gap: 0.4rem;
    padding: 0.4rem 0.6rem;
    font-size: 0.85rem;
    color: var(--brun-cuir);
    list-style: none;
    cursor: pointer;
}

.edm-sous summary::-webkit-details-marker {
    display: none;
}

.edm-sous summary strong {
    color: var(--encre);
}

.edm-sous summary small {
    color: var(--brun-cuir-clair);
}

.edm-sous summary::after {
    content: '▾';
    margin-left: auto;
    transition: transform 0.2s ease;
}

.edm-sous[open] summary::after {
    transform: rotate(180deg);
}

.edm-sous .edm-themes {
    padding: 0 0.4rem 0.5rem;
}

.edm-sol-options {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 0.4rem 0.6rem;
}

.edm-aide-courte,
.edm-message {
    margin: 0;
    font-size: 0.85rem;
    line-height: 1.45;
    color: var(--brun-cuir);
}

/* Boutons de choix (outils, thèmes, types) */
.edm-outils,
.edm-themes {
    display: flex;
    flex-wrap: wrap;
    gap: 0.3rem;
}

.edm-choix {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    min-height: 2.1rem;
    padding: 0.3rem 0.6rem;
    font: inherit;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--encre);
    text-align: left;
    background: var(--beige);
    border: 2px solid transparent;
    border-radius: 0.6rem;
    cursor: pointer;
}

.edm-choix:hover {
    border-color: var(--beige-fonce);
}

.edm-choix:focus-visible,
.edm-tuile:focus-visible,
.edm-bordure:focus-visible {
    outline: 3px solid var(--or);
    outline-offset: 1px;
}

.edm-calque:focus-visible {
    outline: 3px solid var(--or);
    outline-offset: -3px;
}

.edm-choix.is-actif {
    background: var(--beige-clair);
    border-color: var(--rouille);
    box-shadow: inset 0 0 0 1px var(--rouille);
}

.edm-choix small {
    font-weight: 400;
    color: var(--brun-cuir-clair);
}

.edm-choix-icone {
    display: inline-flex;
    width: 1.2rem;
    height: 1.2rem;
    flex-shrink: 0;
}

.edm-choix-icone svg {
    width: 100%;
    height: 100%;
}

/* Palette des tuiles */
.edm-tuiles {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(56px, 1fr));
    gap: 0.3rem;
    max-height: 340px;
    padding: 0.1rem;
    overflow-y: auto;
}

.edm-tuile {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.1rem;
    aspect-ratio: 1;
    padding: 0;
    overflow: hidden;
    color: var(--brun-cuir);
    background: var(--beige);
    border: 3px solid transparent;
    border-radius: 0.4rem;
    cursor: pointer;
}

.edm-tuile img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.edm-tuile.is-actif {
    border-color: var(--rouille);
}

.edm-tuile--hasard svg {
    width: 1.6rem;
    height: 1.6rem;
}

.edm-tuile--hasard small {
    font-size: 0.68rem;
    font-weight: 700;
    line-height: 1.1;
}

/* Types (cases spéciales, décors, objets) */
.edm-types {
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
}

.edm-type {
    display: flex;
    align-items: stretch;
    gap: 0.3rem;
}

.edm-type .edm-choix {
    flex: 1;
    min-width: 0;
}

.edm-type-texte {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.edm-type-texte small {
    line-height: 1.3;
}

.edm-type-dessin {
    width: 1.9rem;
    height: 1.9rem;
    flex-shrink: 0;
    object-fit: contain;
}

.edm-type-action {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2rem;
    padding: 0;
    color: var(--brun-cuir);
    background: transparent;
    border: 1px solid var(--beige-fonce);
    border-radius: 0.5rem;
    cursor: pointer;
}

.edm-type-action svg {
    width: 1rem;
    height: 1rem;
}

.edm-hachure {
    width: 1.9rem;
    height: 1.9rem;
    flex-shrink: 0;
    background: repeating-linear-gradient(45deg, var(--couleur) 0 3px, transparent 3px 7px), var(--brun-cuir-clair);
    border: 2px solid var(--couleur);
    border-radius: 0.3rem;
}

/* Création d'un type */
.edm-creer {
    padding: 0.5rem 0.6rem;
    background: var(--beige);
    border-radius: 0.6rem;
}

.edm-creer summary {
    font-weight: 700;
    color: var(--rouille);
    cursor: pointer;
}

.edm-creer form {
    display: flex;
    flex-direction: column;
    gap: 0.45rem;
    margin-top: 0.6rem;
}

.edm-champ {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    margin: 0;
    padding: 0;
    border: 0;
}

.edm-champ > span,
.edm-champ > legend {
    float: none;
    width: auto;
    margin: 0;
    padding: 0;
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--brun-cuir);
}

.edm-champ input[type='text'],
.edm-champ textarea {
    width: 100%;
    padding: 0.4rem 0.6rem;
    font: inherit;
    color: var(--encre);
    background: var(--white);
    border: 1px solid var(--beige-fonce);
    border-radius: 0.5rem;
}

.edm-champ textarea {
    resize: vertical;
}

.edm-compteur {
    align-self: flex-end;
    font-size: 0.75rem;
    color: var(--brun-cuir-clair);
}

.edm-option {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    font-size: 0.85rem;
    cursor: pointer;
}

.edm-couleurs,
.edm-dessins,
.edm-bordures,
.edm-grilles {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
}

.edm-couleur,
.edm-dessin {
    position: relative;
    cursor: pointer;
}

.edm-couleur input,
.edm-dessin input {
    position: absolute;
    opacity: 0;
}

.edm-couleur span:not(.visually-hidden) {
    display: block;
    width: 1.8rem;
    height: 1.8rem;
    background: var(--couleur);
    border: 2px solid var(--brun-cuir-clair);
    border-radius: 50%;
}

.edm-dessin img {
    display: block;
    width: 2.4rem;
    height: 2.4rem;
    padding: 0.15rem;
    background: var(--beige-clair);
    border: 2px solid transparent;
    border-radius: 0.5rem;
}

.edm-couleur input:checked + span {
    box-shadow: 0 0 0 3px var(--rouille);
}

.edm-dessin input:checked + img {
    border-color: var(--rouille);
}

.edm-couleur input:focus-visible + span,
.edm-dessin input:focus-visible + img {
    outline: 3px solid var(--or);
    outline-offset: 2px;
}

.edm-bordure {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.3rem 0.6rem 0.3rem 0.35rem;
    font: inherit;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--encre);
    background: var(--beige);
    border: 2px solid transparent;
    border-radius: 999px;
    cursor: pointer;
}

.edm-bordure span {
    width: 1.4rem;
    height: 1.4rem;
    background: var(--fond);
    border: 3px solid var(--lisere);
    border-radius: 50%;
}

.edm-bordure.is-actif {
    border-color: var(--rouille);
}

.edm-grille {
    padding: 0.25rem 0.7rem;
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--brun-cuir);
    border: 2px solid var(--beige-fonce);
    border-radius: 999px;
}

.edm-grille.is-actif {
    border-color: var(--rouille);
}

/* Plateau et actions */
.edm-colonne {
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
    min-width: 0;
}

.edm-barre {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.4rem 0.8rem;
}

.edm-bascule {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--brun-cuir);
    cursor: pointer;
}

.edm-plateau {
    position: relative;
    max-width: min(100%, calc(100vh - 6rem));
    margin: 0 auto;
    width: 100%;
}

.edm-canvas {
    display: block;
    width: 100%;
    height: auto;
    touch-action: none;
    border-radius: 0.4rem;
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.25);
    cursor: crosshair;
}

/* Bulle de message sur le plateau (pose refusée, erreur, enregistrement) : en transparence, ne prend aucun clic,
   s'efface seule ; placée par le JS (top, left) près de la case touchée, dans la partie visible du plateau. Couleurs en dur identiques dans les deux thèmes (posées
   sur le plateau) */
.edm-bulle {
    position: absolute;
    top: 0.6rem;
    left: 50%;
    z-index: 3;
    display: flex;
    align-items: center;
    gap: 0.45rem;
    width: max-content;
    max-width: calc(100% - 1.5rem);
    margin: 0;
    padding: 0.45rem 0.9rem;
    font-size: clamp(0.85rem, 2.2vw, 0.95rem);
    font-weight: 700;
    line-height: 1.3;
    color: #ffffff;
    background: rgba(61, 38, 23, 0.88);
    border: 1px solid rgba(255, 255, 255, 0.25);
    border-radius: 0.6rem;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.3);
    pointer-events: none;
    opacity: 0;
    transform: translate(-50%, -0.4rem);
    transition:
        opacity 0.2s ease,
        transform 0.2s ease;
}

.edm-bulle.is-visible {
    opacity: 1;
    transform: translate(-50%, 0);
}

.edm-bulle::before {
    flex: none;
    display: inline-grid;
    place-items: center;
    width: 1.3em;
    height: 1.3em;
    font-size: 0.85em;
    font-weight: 900;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.22);
    content: 'i';
}

.edm-bulle[data-type='alerte'] {
    color: #2a1c12;
    background: rgba(242, 190, 60, 0.94);
    border-color: rgba(122, 82, 8, 0.5);
}

.edm-bulle[data-type='alerte']::before {
    background: rgba(42, 28, 18, 0.15);
    content: '!';
}

.edm-bulle[data-type='erreur'] {
    background: rgba(160, 35, 28, 0.92);
}

.edm-bulle[data-type='erreur']::before {
    content: '×';
}

.edm-bulle[data-type='succes'] {
    background: rgba(28, 125, 52, 0.92);
}

.edm-bulle[data-type='succes']::before {
    content: '✓';
}

@media (prefers-reduced-motion: reduce) {
    .edm-bulle {
        transition: none;
    }
}
.edm-statut {
    min-height: 1.3em;
    margin: 0;
    font-size: 0.85rem;
    text-align: center;
    color: var(--brun-cuir);
}

.edm-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 0.5rem 1rem;
}

.edm-sauvegarde {
    margin: 0;
    font-size: 0.8rem;
    color: var(--brun-cuir-clair);
}

/* Visiteur : invitation à se connecter (Mes créations, PDF à imprimer) */
.edm-invitation {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 0.6rem 1rem;
    padding: 0.75rem 1rem;
    background: var(--beige-clair);
    border: 1px solid var(--or);
    border-left: 4px solid var(--or);
    border-radius: 0.6rem;
}

.edm-invitation p {
    flex: 1 1 18rem;
    margin: 0;
    font-size: 0.9rem;
    line-height: 1.45;
    color: var(--encre);
}

.edm-invitation strong {
    display: block;
    color: var(--brun-cuir);
}

.edm-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    min-height: 2.2rem;
    padding: 0.35rem 0.9rem;
    font: inherit;
    font-weight: 700;
    line-height: 1.2;
    color: var(--brun-cuir);
    background: var(--beige-clair);
    border: 2px solid var(--beige-fonce);
    border-radius: 999px;
    cursor: pointer;
}

.edm-btn:disabled {
    cursor: not-allowed;
    opacity: 0.45;
}

.edm-btn--primaire {
    min-height: 2.6rem;
    padding: 0.5rem 1.4rem;
    color: var(--brun-nuit);
    background: var(--or);
    border-color: var(--or);
}

.edm-btn--primaire:hover:not(:disabled) {
    background: var(--or-clair);
}

.edm-btn--discret:hover:not(:disabled) {
    border-color: var(--brun-cuir-clair);
}

.edm-btn--icone {
    width: 2.4rem;
    padding: 0;
}

.edm-btn--large {
    width: 100%;
}

/* Récapitulatif sous le plateau */
.edm-recap h2 {
    margin: 0.8rem 0 0.4rem;
    font-size: 1.1rem;
    color: var(--brun-nuit);
}

.edm-legende {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    margin: 0;
    padding: 0;
    list-style: none;
}

.edm-legende li {
    display: flex;
    align-items: flex-start;
    gap: 0.5rem;
    font-size: 0.9rem;
    line-height: 1.4;
}

.edm-alertes {
    margin: 0;
    padding: 0.5rem 0.8rem 0.5rem 1.8rem;
    font-size: 0.85rem;
    color: var(--encre);
    background: var(--beige-clair);
    border-left: 4px solid var(--rouille);
    border-radius: 0.4rem;
}

.edm-regles p {
    margin: 0 0 0.5rem;
    line-height: 1.55;
}

/* Sort des règles (canvas, rendu de map-rendu.js : couleurs de la carte, identiques dans les deux thèmes) */
.edm-regles-sort {
    display: block;
    width: 400px;
    max-width: 100%;
    height: auto;
    margin: 0.2rem 0 0.7rem;
}

/* Sorts des règles : liste et formulaire du panneau Titre et règles */
.edm-sort-ligne {
    display: flex;
    flex: 1;
    align-items: center;
    gap: 0.5rem;
    min-width: 0;
    padding: 0.3rem 0.6rem;
    font-size: 0.85rem;
    background: var(--beige);
    border-radius: 0.6rem;
}

.edm-sort-pastille {
    width: 1.2rem;
    height: 1.2rem;
    flex-shrink: 0;
    background: var(--couleur);
    border: 2px solid var(--beige-fonce);
    border-radius: 0.25rem;
}

/* Fenêtre « Créer un sort » : bloc de sort de l'éditeur de carte d'invocation (styles .edc-* d'editeur-carte.css),
   aperçu du rendu dessous ; le contenu défile entre l'en-tête et les boutons quand la fenêtre manque de hauteur */
/* Double classe : passe devant .edm-dialogue (440 px au plus), déclaré plus bas */
.edm-dialogue.edm-dialogue--sort {
    width: min(820px, calc(100vw - 1rem));
    max-width: none;
    max-height: calc(100dvh - 1rem);
    overflow: hidden;
}

.edm-dialogue--sort[open] {
    display: flex;
}

.edm-dialogue--sort form {
    display: flex;
    flex-direction: column;
    width: 100%;
    min-height: 0;
}

.edm-dialogue-entete {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    padding: 0.8rem 1rem 0.6rem 1.2rem;
    border-bottom: 1px solid var(--beige-fonce);
}

.edm-dialogue--sort .edm-dialogue-entete h2 {
    margin: 0;
    font-size: 1.2rem;
}

.edm-dialogue-entete .edm-type-action {
    height: 2rem;
}

.edm-sort-corps {
    display: flex;
    flex: 1;
    flex-direction: column;
    gap: 0.8rem;
    min-height: 0;
    padding: 0.9rem 1.2rem 0;
    overflow-y: auto;
}

/* Les aides du bloc gardent leur marge (pas celle des paragraphes de .edm-dialogue) */
.edm-dialogue--sort .edc-aide {
    margin: 0;
}

.edm-sort-apercu-bloc {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.35rem;
    margin-bottom: 0.9rem;
    padding: 0.6rem 0.8rem 0.8rem;
    background: var(--beige);
    border: 1px solid var(--beige-fonce);
    border-radius: 0.75rem;
}

.edm-sort-apercu-titre {
    align-self: flex-start;
    color: var(--brun-cuir);
    font-size: 0.8rem;
    font-weight: 700;
}

.edm-sort-apercu {
    display: block;
    width: 100%;
    max-width: 460px;
    height: auto;
}

.edm-dialogue--sort .edm-dialogue-actions {
    padding: 0.7rem 1.2rem;
    border-top: 1px solid var(--beige-fonce);
}

/* Écran assez haut : aperçu collé en bas de la zone qui défile, toujours visible pendant la saisie */
@media (min-height: 760px) {
    .edm-sort-apercu-bloc {
        position: sticky;
        bottom: 0;
        z-index: 1;
        box-shadow: 0 -6px 14px rgba(0, 0, 0, 0.08);
    }
}

/* Téléphone : marges réduites, le bloc prend toute la largeur */
@media (max-width: 575.98px) {
    .edm-dialogue-entete {
        padding: 0.6rem 0.7rem 0.5rem 0.9rem;
    }

    .edm-sort-corps {
        padding: 0.6rem 0.6rem 0;
    }

    .edm-dialogue--sort .edc-sort {
        padding: 0.45rem 0.55rem 0.65rem;
    }

    .edm-dialogue--sort .edm-dialogue-actions {
        padding: 0.6rem 0.7rem;
    }
}

/* Explications (rendu serveur) */
.edm-aide {
    margin-top: 2.5rem;
}

.edm-aide h2 {
    margin: 0 0 1rem;
    font-size: 1.4rem;
    text-align: center;
    color: var(--brun-nuit);
}

.edm-aide-blocs {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 1rem;
}

.edm-aide article {
    padding: 1rem 1.2rem;
    background: var(--beige-clair);
    border: 1px solid var(--beige-fonce);
    border-radius: var(--radius-card);
}

.edm-aide h3 {
    margin: 0 0 0.4rem;
    font-size: 1.05rem;
    color: var(--brun-nuit);
}

.edm-aide p {
    margin: 0;
    line-height: 1.55;
    color: var(--brun-cuir);
}

/* Fenêtre de confirmation */
.edm-dialogue {
    max-width: min(440px, calc(100vw - 2rem));
    padding: 0;
    color: var(--encre);
    background: var(--beige-clair);
    border: 1px solid var(--beige-fonce);
    border-radius: var(--radius-card);
}

.edm-dialogue::backdrop {
    background: rgba(0, 0, 0, 0.5);
}

.edm-dialogue-contenu {
    padding: 1.2rem 1.4rem;
}

.edm-dialogue h2 {
    margin: 0 0 0.5rem;
    font-size: 1.2rem;
}

.edm-dialogue p {
    margin: 0 0 1rem;
    line-height: 1.5;
}

.edm-dialogue-actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 0.5rem;
}

.edm-dialogue-actions .edm-btn[hidden] {
    display: none;
}

/* Sol : case par case ou fond intégral */
.edm-modes {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.3rem;
}

.edm-modes .edm-choix {
    justify-content: center;
}

.edm-fond-apercu {
    display: block;
    width: 100%;
    aspect-ratio: 1;
    object-fit: cover;
    border-radius: 0.5rem;
}

.edm-fichier {
    cursor: pointer;
}

/* Fond intégral : maps officielles, vignettes cadrées sur la grille (--x, --y, --l, --h en % de l'illustration) */
.edm-sous-titre {
    margin: 0.2rem 0 0;
    font-size: 0.8rem;
    font-weight: 800;
    color: var(--brun-cuir);
}

.edm-maps-fond {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(84px, 1fr));
    gap: 0.4rem;
    max-height: 340px;
    padding: 0.1rem;
    overflow-y: auto;
}

.edm-map-fond {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
    padding: 0;
    color: var(--brun-cuir);
    text-align: center;
    background: none;
    border: 0;
    cursor: pointer;
}

.edm-map-fond-image {
    position: relative;
    display: block;
    aspect-ratio: 1;
    overflow: hidden;
    background: var(--beige);
    border: 3px solid transparent;
    border-radius: 0.4rem;
}

.edm-map-fond-image img {
    position: absolute;
    top: calc(-100% * var(--y) / var(--h));
    left: calc(-100% * var(--x) / var(--l));
    width: calc(10000% / var(--l));
    max-width: none;
    height: calc(10000% / var(--h));
}

.edm-map-fond.is-actif .edm-map-fond-image {
    border-color: var(--rouille);
}

.edm-map-fond small {
    font-size: 0.7rem;
    font-weight: 700;
    line-height: 1.15;
}

/* Mes cases : retrait d'une case, ajout d'images */
.edm-tuile-bloc {
    position: relative;
    display: block;
}

.edm-tuile-bloc .edm-tuile {
    width: 100%;
}

.edm-tuile-supprimer {
    position: absolute;
    top: 2px;
    right: 2px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.3rem;
    height: 1.3rem;
    padding: 0;
    color: #fff;
    background: var(--rouille);
    border: 0;
    border-radius: 50%;
    cursor: pointer;
}

.edm-tuile-supprimer svg {
    width: 0.8rem;
    height: 0.8rem;
}

.edm-tuile--ajout,
.edm-dessin--ajout {
    border: 2px dashed var(--beige-fonce);
    cursor: pointer;
}

.edm-tuile--ajout svg {
    width: 1.5rem;
    height: 1.5rem;
}

.edm-tuile--ajout small,
.edm-dessin--ajout small {
    font-size: 0.68rem;
    font-weight: 700;
    line-height: 1.1;
}

.edm-dessin--ajout {
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 2.4rem;
    height: 2.4rem;
    color: var(--brun-cuir);
    border-radius: 0.5rem;
}

.edm-dessin--ajout svg {
    width: 1.1rem;
    height: 1.1rem;
}

.edm-dessin--ajout small {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip-path: inset(50%);
}

.edm-dessin--image img {
    object-fit: contain;
}

.edm-type-action + .edm-type-action {
    margin-left: -0.15rem;
}

.edm-formulaire-actions {
    display: flex;
    justify-content: flex-end;
    gap: 0.4rem;
}

/* Enregistrement dans Mes créations */
.edm-btn--ecraser {
    color: #fff;
    background: var(--rouge-banni);
    border-color: var(--rouge-banni);
}

.edm-btn--nouvelle {
    color: #fff;
    background: var(--rouille);
    border-color: var(--rouille);
}

.edm-compte {
    margin: 0;
    font-size: 0.85rem;
    text-align: center;
    color: var(--brun-cuir);
}

.edm-compte.is-erreur {
    color: var(--rouge-banni);
    font-weight: 700;
}

.edm-sauvegarde {
    text-align: center;
}

.edm-lien {
    padding: 0;
    font: inherit;
    color: var(--rouille);
    text-decoration: underline;
    background: none;
    border: 0;
    cursor: pointer;
}

/* Sous 992 px : le plateau d'abord, les outils juste dessous, puis le téléchargement et le récapitulatif */
@media (max-width: 991.98px) {
    .edm-colonne {
        display: contents;
    }

    .edm-barre {
        order: 1;
    }

    .edm-plateau {
        order: 2;
    }

    .edm-statut {
        order: 3;
    }

    .edm-panneau {
        order: 4;
    }

    .edm-actions,
    .edm-compte,
    .edm-sauvegarde {
        order: 5;
    }

    .edm-recap {
        order: 6;
    }
}
