/* =====================================================================
   Vanicraft : habillage de la carte façon Minecraft
   ===================================================================== */

/* Fond sombre du site (26/11) : on ne le voit qu'au chargement des tuiles, la carte remplit toujours l'écran */
html, body, #map, .leaflet-container {
    background: #14110f !important;
}

/* La police du jeu (installée par vanicraft-police.js) partout sur la carte */
.vani-police-mc body,
.vani-police-mc .leaflet-container,
.vani-police-mc .leaflet-control,
.vani-police-mc .leaflet-popup-content,
.vani-police-mc .leaflet-tooltip {
    font-family: 'Minecraft VA', monospace !important;
    -webkit-font-smoothing: none;
    font-smooth: never;
}

/* ---------- Coordonnées (en bas à gauche), couleurs du scoreboard de Vanicraft ---------- */
/* l'ancien bouton « lien » (carré blanc) est remplacé par la boussole du scoreboard */
.leaflet-control-layers.link { display: none !important; }
/* bouton des calques de Leaflet (afficher ou masquer les joueurs) retiré : hors de la charte de la carte */
.leaflet-control-layers:not(.coordinates):not(.link) { display: none !important; }
.leaflet-control-layers.coordinates {
    display: flex !important;
    align-items: center;
    gap: 8px;
    margin-left: 10px !important;
    margin-bottom: 10px !important;
    /* même marge à gauche (avant la boussole) qu'à droite (après « Z -10000 », ombre comprise) ;
       taille fixe : voir .vani-cx / .vani-cz */
    padding: 7px 8px 9px 10px !important;
    width: max-content;
    /* même look que les boutons + / − : gris du jeu en relief, contour noir */
    background: #6f6f6f !important;
    border: 2px solid #000 !important;
    border-radius: 0 !important;
    box-shadow: inset 2px 2px 0 #a8a8a8, inset -2px -3px 0 #4a4a4a !important;
    color: #ffffff !important;
    font-family: 'Minecraft VA', monospace !important;
    font-size: 16px !important;
    line-height: 18px !important;
    white-space: nowrap;
    -webkit-font-smoothing: none;
}
.leaflet-control-layers.coordinates::before {
    content: '';
    width: 32px;               /* boussole 16x16 du pack, agrandie x2 */
    height: 32px;
    flex: none;
    margin-top: -2px;
    background: url('mc/textures/hud/coordonnees.png') center / 32px 32px no-repeat;
    image-rendering: pixelated;
    image-rendering: crisp-edges;
    filter: drop-shadow(2px 2px 0 rgba(0, 0, 0, 0.5));
}
.vani-coord { display: inline-flex; gap: 12px; }
.vani-cx, .vani-cz {
    display: inline-block;
    /* largeur fixe = « X -10000 » / « Z -10000 » (92 px dans la police du jeu) :
       le bouton garde toujours la même taille, calée sur les coordonnées maximales */
    width: 92px;
    white-space: nowrap;
    text-shadow: 2px 2px 0 #3f3f3f;
}
.vani-cx { color: #FF6B6B; }   /* X du scoreboard */
.vani-cz { color: #6BA8FF; }   /* Z du scoreboard */

/* ---------- Boutons zoom + / − façon boutons des menus Minecraft ---------- */
.leaflet-control-zoom.leaflet-bar {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 0;
    margin-left: 10px !important;
    margin-top: 10px !important;
    background: none !important;
    border: none !important;
    border-radius: 0 !important;
    box-shadow: none !important;
}
.leaflet-control-zoom.leaflet-bar a,
.leaflet-control-zoom.leaflet-bar a:first-child,
.leaflet-control-zoom.leaflet-bar a:last-child {
    width: 36px !important;
    height: 36px !important;
    box-sizing: border-box;
    /* symbole parfaitement centré dans le bouton */
    display: flex !important;
    align-items: center;
    justify-content: center;
    padding: 0 !important;
    line-height: 1 !important;
    border-radius: 0 !important;
    border: 2px solid #000 !important;
    /* bouton du jeu : gris, reflet clair en haut à gauche, ombre en bas à droite */
    background: #6f6f6f !important;
    box-shadow: inset 2px 2px 0 #a8a8a8, inset -2px -3px 0 #4a4a4a !important;
    color: #ffffff !important;
    font-family: 'Minecraft VA', monospace !important;
    font-size: 24px !important;
    font-weight: normal !important;
    text-indent: 0 !important;
    text-shadow: 2px 2px 0 #3f3f3f;
    -webkit-font-smoothing: none;
    user-select: none;
    transition: none;
}
.leaflet-control-zoom.leaflet-bar a:hover {
    /* survol : contour blanc et texte jaune, comme dans les menus */
    border-color: #ffffff !important;
    background: #7b7b7b !important;
    color: #ffffa0 !important;
}
/* « + » et « - » dessinés en pixels, comme les glyphes de la police du jeu (barres de 3 px, x3),
   avec l'ombre portée derrière : centrage exact dans le bouton, quelle que soit la police. */
.leaflet-control-zoom.leaflet-bar a { position: relative !important; --vani-ombre: #3f3f3f; }
.leaflet-control-zoom.leaflet-bar a span { display: none; }
.leaflet-control-zoom.leaflet-bar a::before,
.leaflet-control-zoom.leaflet-bar a::after {
    content: '';
    position: absolute;
    left: 8px;                 /* symbole 15x15 (+ ombre 2px) centré dans le bouton */
    top: 8px;
    width: 15px;
    height: 15px;
    background-repeat: no-repeat;
}
.leaflet-control-zoom.leaflet-bar a::before { left: 10px; top: 10px; }  /* ombre, 2px en bas à droite */
/* « + » : une barre horizontale et une verticale */
.leaflet-control-zoom.leaflet-bar a.leaflet-control-zoom-in::after {
    background-image: linear-gradient(currentColor, currentColor), linear-gradient(currentColor, currentColor);
    background-size: 15px 3px, 3px 15px;
    background-position: 0 6px, 6px 0;
}
.leaflet-control-zoom.leaflet-bar a.leaflet-control-zoom-in::before {
    background-image: linear-gradient(var(--vani-ombre), var(--vani-ombre)), linear-gradient(var(--vani-ombre), var(--vani-ombre));
    background-size: 15px 3px, 3px 15px;
    background-position: 0 6px, 6px 0;
}
/* « - » : la barre horizontale seule */
.leaflet-control-zoom.leaflet-bar a.leaflet-control-zoom-out::after {
    background-image: linear-gradient(currentColor, currentColor);
    background-size: 15px 3px;
    background-position: 0 6px;
}
.leaflet-control-zoom.leaflet-bar a.leaflet-control-zoom-out::before {
    background-image: linear-gradient(var(--vani-ombre), var(--vani-ombre));
    background-size: 15px 3px;
    background-position: 0 6px;
}
.leaflet-control-zoom.leaflet-bar a:hover { --vani-ombre: #3f3f28; }
.leaflet-control-zoom.leaflet-bar a:active {
    /* appui : le bouton « s'enfonce » */
    box-shadow: inset 2px 3px 0 #4a4a4a, inset -2px -2px 0 #8a8a8a !important;
}
.leaflet-control-zoom.leaflet-bar a:active::after { top: 9px; }
.leaflet-control-zoom.leaflet-bar a:active::before { top: 11px; }
.leaflet-control-zoom.leaflet-bar a.leaflet-disabled,
.leaflet-control-zoom.leaflet-bar a.leaflet-disabled:hover {
    /* bouton grisé (zoom ou dézoom maximum atteint) */
    background: #2c2c2c !important;
    border-color: #000 !important;
    box-shadow: none !important;
    color: #a0a0a0 !important;
    --vani-ombre: #282828;
    cursor: default;
}

/* ---------- Bannière + nom au-dessus de chaque ville ---------- */
/* --vani-echelle suit le zoom (vanicraft.js) */
.vani-marqueur { background: none !important; border: none !important; }
.vani-pin {
    position: absolute;
    left: 0;
    bottom: 6px;
    display: flex;
    flex-direction: column;
    align-items: center;
    transform: translate(var(--vani-dx, 0px), var(--vani-dy, 0px)) translateX(-50%) scale(var(--vani-echelle, 1));
    transform-origin: 50% 100%;
    transition: transform 0.15s ease-out;
    cursor: pointer;
}
/* Étiquette de nom comme au-dessus des joueurs en jeu : fond noir translucide, texte blanc + ombre */
.vani-nom {
    font-family: 'Minecraft VA', monospace;
    font-size: 16px;
    line-height: 18px;
    color: #ffffff;
    white-space: nowrap;
    margin-bottom: 4px;
    padding: 2px 4px 0;
    background: rgba(0, 0, 0, 0.35);
    text-shadow: 2px 2px 0 #3f3f3f;
    -webkit-font-smoothing: none;
}
.vani-pin:hover .vani-nom { color: #ffff55; text-shadow: 2px 2px 0 #3f3f15; }
/* Anti-chevauchement : les repères qui se touchent se poussent (--vani-dx / --vani-dy, vanicraft.js).
   Pendant l'animation de zoom, ils sont masqués un instant pour ne jamais se croiser. */
.vani-zoom-en-cours .vani-marqueur { opacity: 0; }
.vani-marqueur { transition: opacity 0.12s ease-out; }
/* Petit point sur la vraie position d'une ville dont le repère a été décalé */
.vani-ancre {
    display: none;
    position: absolute;
    left: -3px;
    top: -3px;
    width: 6px;
    height: 6px;
    background: #ffffff;
    box-shadow: 0 0 0 1px #000, 1px 1px 0 1px rgba(0, 0, 0, 0.5);
}
.vani-decale .vani-ancre { display: block; }
/* Barre de bois de la bannière (chêne noir) */
.vani-hampe {
    width: 34px;
    height: 4px;
    background: #4a3420;
    box-shadow: inset 0 -2px 0 #2e1f12, 0 1px 0 rgba(0, 0, 0, 0.4);
}
.vani-ban {
    width: 30px;
    height: 60px;
    image-rendering: pixelated;
    image-rendering: crisp-edges;
    filter: drop-shadow(2px 2px 0 rgba(0, 0, 0, 0.35));
}
.vani-ban-vide { border: 2px solid rgba(0, 0, 0, 0.35); box-sizing: border-box; }
.vani-proche { display: flex; flex-direction: column; align-items: center; }

/* ---------- Nations : contour de leurs terres (vanicraft-plus.js) ; leur nom seulement de loin, jamais avec ceux des villes ---------- */
.vani-marqueur-nation { display: none; }
.vani-zoom-nations .vani-marqueur-nation { display: block; }
.vani-zoom-nations .vani-marqueur:not(.vani-marqueur-nation) { display: none; }
.vani-pin.vani-pin-nation {
    top: auto;
    bottom: 3px;
    transform: translate(var(--vani-dx, 0px), var(--vani-dy, 0px)) translateX(-50%);
}
.vani-nation-repere { display: flex; align-items: center; gap: 4px; white-space: nowrap; }
.vani-nation-repere img {
    width: 16px;              /* balise 8x8 du jeu, agrandie x2 */
    height: 16px;
    image-rendering: pixelated;
    image-rendering: crisp-edges;
    filter: drop-shadow(1px 1px 0 rgba(0, 0, 0, 0.6));
}
.vani-nation {
    font-family: 'Minecraft VA', monospace;
    font-size: 16px;          /* multiple de 8 : seule taille nette de la police du jeu */
    line-height: 18px;
    white-space: nowrap;
    padding: 2px 0 0;
    /* contour noir d'un pixel : lisible sur tous les fonds, sans prendre de place */
    text-shadow: -1px 0 0 #000, 1px 0 0 #000, 0 -1px 0 #000, 0 1px 0 #000, 2px 2px 0 #000;
    -webkit-font-smoothing: none;
}
/* beaucoup de nations : de très loin, seulement leurs balises */
.vani-nations-nombreuses.vani-zoom-nations .vani-nation { display: none; }
.vani-pin-nation:hover .vani-nation { filter: brightness(1.25); }

/* ---------- Infobulles façon objets Minecraft ---------- */
.leaflet-tooltip.vani-fiche-tip {
    background: rgba(16, 0, 16, 0.94);
    color: #ffffff;
    border-radius: 0;
    border: 2px solid #2a0a5c;
    box-shadow: inset 0 0 0 2px #5000ff66, 0 0 0 2px rgba(16, 0, 16, 0.94);
    padding: 8px 10px;
    white-space: normal;
}
.leaflet-tooltip.vani-fiche-tip::before { display: none; }
/* bulle unique qui suit la souris (vanicraft.js, lierBulle) : posée par transform, aucune transition */
.vani-bulle-libre { position: fixed !important; left: 0; top: 0; z-index: 2000; pointer-events: none; margin: 0; transition: none !important; will-change: transform; }
.vani-sous { color: #aaaaaa; text-shadow: 2px 2px 0 #2a2a2a; padding-left: 4px; }

/* Fiche de ville détaillée */
.vani-fiche.vani-fiche-ville { display: block; min-width: 210px; }
.vani-fiche-tete { display: flex; align-items: flex-start; gap: 10px; }
.vani-section {
    margin-top: 8px;
    padding-top: 6px;
    border-top: 2px solid rgba(80, 0, 255, 0.35);
    color: #ffff55;
    text-shadow: 2px 2px 0 #3f3f15;
}
.vani-bat::before { content: '▪ '; color: #55ff55; text-shadow: 2px 2px 0 #153f15; }
.vani-hab {
    display: flex;
    align-items: center;
    gap: 6px;
    white-space: nowrap;
    line-height: 20px;
}
.vani-tete {
    width: 16px;
    height: 16px;
    image-rendering: pixelated;
    image-rendering: crisp-edges;
    box-shadow: 1px 1px 0 rgba(0, 0, 0, 0.6);
    flex: none;
}
.vani-hab-nom { flex: 1; }
.vani-hab-role { margin-left: 10px; }

.vani-fiche {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    font-family: 'Minecraft VA', monospace;
    font-size: 16px;
    line-height: 20px;
    color: #ffffff;
    text-shadow: 2px 2px 0 #3f3f3f;
    min-width: 170px;
    -webkit-font-smoothing: none;
}
.vani-fiche-img {
    display: block;
    width: 30px;
    height: 60px;
    image-rendering: pixelated;
    image-rendering: crisp-edges;
}
.vani-fiche-nom { font-size: 16px; margin-bottom: 4px; white-space: nowrap; }
.vani-l { white-space: nowrap; }
.vani-g { color: #aaaaaa; text-shadow: 2px 2px 0 #2a2a2a; }
.vani-or { color: #ffaa00; text-shadow: 2px 2px 0 #3f2a00; }
