/* css/explore.css — ecran d'exploration du donjon : grille de cases (.explore, .map-area, .map-frame,
   .tile), halo de torche, legende, bulles de dialogue PNJ sur la carte, cases de sortie/danger et les
   pages/passages narratifs rencontres en explorant.
   Issu du decoupage de l'ancien style.css (reorganisation pure, V13.12). */

/* HUD de descente : une seule ligne */
.hud { display: grid; grid-template-columns: auto minmax(0, 1fr) auto auto auto; gap: 10px; align-items: center; }
.hud-place { display: flex; flex-direction: column; min-width: 0; line-height: 1.15; }
.hud-place strong { font-family: var(--font-title); color: var(--accent-ink); font-size: var(--fs-md); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 32vw; }
.hud-place small { color: var(--muted); font-size: var(--fs-xs); display: flex; gap: 5px; align-items: center; white-space: nowrap; }
.hud-hp { display: flex; align-items: center; gap: 6px; min-width: 0; }
.hud-hp .bar { flex: 1; }
@media (max-width: 599px) {
  .hud { gap: 8px; }
  .hud-place strong { display: none; }
  .hud-place small { font-size: var(--fs-xs); font-weight: 700; flex-direction: column; align-items: flex-start; gap: 3px; }
  .hud-hp .bar { height: 20px; }
  .hud-hp .bar > span { line-height: 20px; font-size: var(--fs-xs); }
}
/* ================================================================ Exploration */
.explore { height: 100%; display: grid; grid-template-columns: minmax(0, 1fr); }
.map-area { min-height: 0; min-width: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; padding: 8px; }
.map-frame {
  position: relative; padding: 6px; border-radius: 14px; background: #0b0a0e; border: 1px solid var(--line);
  box-shadow: inset 0 0 40px rgba(0, 0, 0, .8), 0 0 0 1px color-mix(in srgb, var(--accent) 25%, transparent), var(--shadow);
}
.tile { position: relative; background-size: cover; image-rendering: pixelated; image-rendering: crisp-edges; background-color: var(--ink-dark); }
/* V13 (retour d'Alexandre) : halo de torche — un seul dégradé radial par-dessus toute la grille (calque
   .torch-overlay, ajouté après les cases dans viewExplore) plutôt qu'un assombrissement case par case :
   la transition n'est plus alignée sur les bords des cases (effet « carré »), elle suit un cercle centré
   sur le joueur. --px/--py (posées en style inline sur .torch-overlay) sont enregistrées via @property
   pour que leurs changements (à chaque pas) transitionnent en douceur au lieu de sauter d'une case à
   l'autre — c'est ce qui permet au halo de suivre le joueur pendant la marche animée. */
@property --px { syntax: '<number>'; inherits: true; initial-value: 0; }
@property --py { syntax: '<number>'; inherits: true; initial-value: 0; }
.torch-overlay {
  position: absolute; inset: 0; pointer-events: none; z-index: 4; border-radius: inherit;
  transition: --px .45s ease-out, --py .45s ease-out;
  background: radial-gradient(circle at calc((var(--px, 0) + .5) * var(--tile)) calc((var(--py, 0) + .5) * var(--tile)),
    transparent 0, transparent calc(var(--tile) * 1.1),
    rgba(6, 5, 10, .78) calc(var(--tile) * 2.2),
    rgba(6, 5, 10, .96) calc(var(--tile) * 3.4));
}
/* V13 (retour d'Alexandre) : « exactement le même rendu que pour le joueur » pour les torches, sans
   teinte jaune — pas un halo de couleur posé par-dessus (ancien .torch-light, retiré), mais un second
   trou dans le MÊME assombrissement, avec exactement la même forme (mêmes paliers 1.1/2.2/3.4 tuiles).
   Une torche ne change pas .torch-overlay : elle ajoute un calque de masque (mask-image, posé en style
   inline dans viewExplore, une radial-gradient identique centrée sur la torche) ; mask-composite:
   intersect combine plusieurs torches (et la position du joueur) en un seul trou fusionné, sans jamais
   assombrir plus qu'avant. Sans torche, aucun masque n'est posé : rendu inchangé. */
.tile .ent { position: absolute; left: 6%; top: 6%; width: 88%; height: 88%; image-rendering: pixelated; pointer-events: none; }
.tile.player .ent { filter: drop-shadow(0 0 5px color-mix(in srgb, var(--accent) 85%, transparent)); }
@keyframes bob { 50% { transform: translateY(-6%); } }
.tile.reach { cursor: pointer; }
/* V13 (retour d'Alexandre) : surbrillance un peu réduite (20%→14%, etc.) */
.tile.reach::after { content: ""; position: absolute; inset: 0; background: color-mix(in srgb, var(--accent) 14%, transparent); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--accent) 55%, transparent); }
.tile.reach:hover::after { background: color-mix(in srgb, var(--accent) 32%, transparent); }
.tile.reach.danger::after { background: rgba(224, 72, 90, .16); box-shadow: inset 0 0 0 2px rgba(224, 72, 90, .75); }
.tile.reach.danger:hover::after { background: rgba(224, 72, 90, .32); }
.tile.exit { box-shadow: inset -3px 0 0 var(--accent); }
.exit-ico { right: 2px; top: 50%; font-size: clamp(12px, calc(var(--tile) * .42), 34px); }
.tile.exit.reach .exit-ico, .tile.exit.player .exit-ico { animation: exitPulse 1.2s infinite; }
@keyframes exitPulse { 50% { transform: translate(3px, -50%) scale(1.12); } }
.spec { position: absolute; inset: 0; display: grid; place-items: center; font-size: clamp(14px, calc(var(--tile) * .6), 56px); filter: drop-shadow(0 0 6px rgba(255, 200, 80, .6)); animation: bob 1.8s ease-in-out infinite; pointer-events: none; }
.legend { display: flex; flex-wrap: wrap; gap: 6px 12px; font-size: var(--fs-xs); color: var(--muted); }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend img { width: 22px; height: 22px; image-rendering: pixelated; border-radius: 4px; }
.legend span.feat-mine, .legend span.feat-trap { color: var(--danger-ink, var(--danger)); }
.spec img.pxi { width: 46%; height: 46%; }
/* T736, T739 : mine repérée (mur), piège et cachettes : l'icône prend la teinte de son danger ou de sa promesse. */
.tile.feat-mine .spec, .tile.feat-trap .spec { filter: drop-shadow(0 0 6px rgba(224, 72, 90, .85)); animation: none; }
.tile.feat-cache_heal .spec { filter: drop-shadow(0 0 6px rgba(88, 200, 120, .8)); }
.tile.feat-cache_gold .spec, .tile.feat-cache_chest .spec { filter: drop-shadow(0 0 6px rgba(255, 200, 80, .9)); }
.num.nq { color: var(--muted); opacity: .75; }
.fuse-badge { position: absolute; left: 8px; bottom: 8px; z-index: 6; display: inline-flex; align-items: center; gap: 6px; padding: 3px 8px; border-radius: 10px; font-size: var(--fs-xs); background: rgba(20, 16, 12, .72); color: #f1e8d4; pointer-events: none; }
.fuse-badge img.pxi { width: 16px; height: 16px; }
.fuse-badge .fuse-dots { display: inline-flex; gap: 3px; }
.fuse-badge .fuse-dots i { width: 6px; height: 6px; border-radius: 50%; background: rgba(255, 255, 255, .22); }
.fuse-badge .fuse-dots i.on { background: var(--gold); }
.fuse-badge.low { background: color-mix(in srgb, var(--danger) 70%, #14100c); animation: fuseWarn .9s ease-in-out infinite; }
.fuse-badge.low .fuse-dots i.on { background: #fff; }
@keyframes fuseWarn { 50% { transform: scale(1.06); } }
/* T757 : animations des cases découvertes (mine, souffle de mèche, piège, soin, or, coffre, veine d'or). Un éclat coloré qui
   s'élargit, l'icône qui jaillit, le texte qui monte ; la carte tremble pour ce qui fait mal. Voir view-explore.js, mapFxNodes. */
.mapfx { position: absolute; inset: 0; z-index: 7; display: grid; place-items: center; pointer-events: none; --fx: rgba(255, 200, 80, .9); }
.mapfx-mine, .mapfx-blast { --fx: rgba(255, 120, 40, .95); }
.mapfx-trap { --fx: rgba(224, 72, 90, .9); }
.mapfx-heal { --fx: rgba(88, 200, 120, .9); }
.mapfx::before { content: ''; position: absolute; inset: -30%; border-radius: 50%; background: radial-gradient(circle, var(--fx) 0 30%, transparent 68%); animation: fxBurst .7s ease-out both; animation-delay: var(--age); }
.mapfx-gold::after, .mapfx-vein::after, .mapfx-chest::after, .mapfx-heal::after { content: ''; position: absolute; width: 10%; aspect-ratio: 1; border-radius: 50%; background: var(--fx);
  box-shadow: 0 -260% 0 var(--fx), 230% -130% 0 var(--fx), 230% 130% 0 var(--fx), 0 260% 0 var(--fx), -230% 130% 0 var(--fx), -230% -130% 0 var(--fx); animation: fxSparkle .9s ease-out both; animation-delay: var(--age); }
.mapfx .fx-ico { position: absolute; inset: 18%; display: grid; place-items: center; animation: fxPop 1s cubic-bezier(.2, .9, .3, 1) both; animation-delay: var(--age); }
.mapfx .fx-ico img.pxi { width: 100%; height: 100%; filter: drop-shadow(0 0 6px var(--fx)); }
.mapfx .fx-txt { position: absolute; top: 8%; font: 800 clamp(11px, calc(var(--tile) * .34), 22px) var(--font-ui); color: #fff; text-shadow: 0 0 4px var(--fx), 1px 1px 0 rgba(0, 0, 0, .8); white-space: nowrap; animation: fxFloat 1.3s ease-out both; animation-delay: var(--age); }
.map-frame.fx-shake { animation: fxShake .4s ease-in-out both; animation-delay: var(--age); }
/* T757 : ouverture d'un coffre. Chronologie : secousse 0-0,5 s, éclat et couvercle 0,5 s, rayons 0,5-1,8 s, objet 0,55-1,8 s, texte 0,7-2,3 s.
   --fx : couleur de la rareté ; --big : taille de l'éclat (grandit avec la rareté). */
.mapfx-loot { --fx: rgba(255, 214, 120, .95); --big: 1.8; }
.mapfx-loot.r-uncommon { --fx: rgba(120, 220, 140, .95); --big: 2.1; }
.mapfx-loot.r-rare { --fx: rgba(110, 170, 255, .95); --big: 2.5; }
.mapfx-loot.r-epic { --fx: rgba(190, 120, 255, .95); --big: 3; }
.mapfx-loot.r-legendary { --fx: rgba(255, 150, 50, 1); --big: 3.6; }
.mapfx-loot::before { animation: fxLootBurst .8s ease-out both; animation-delay: calc(var(--age) + 500ms); opacity: 0; }
.mapfx-loot .fx-rays { position: absolute; inset: -60%; border-radius: 50%; opacity: 0; background: repeating-conic-gradient(from 0deg, var(--fx) 0 8deg, transparent 8deg 24deg);
  -webkit-mask-image: radial-gradient(circle, #000 0 22%, transparent 62%); mask-image: radial-gradient(circle, #000 0 22%, transparent 62%); animation: fxRays 1.3s ease-out both; animation-delay: calc(var(--age) + 500ms); }
.mapfx-loot .fx-chest { position: absolute; inset: 6%; width: 88%; height: 88%; image-rendering: pixelated; animation: fxChest .6s ease-in-out both; animation-delay: var(--age); }
.mapfx-loot .fx-ico { inset: 12%; opacity: 0; animation: fxLootItem 1.3s cubic-bezier(.2, .9, .3, 1) both; animation-delay: calc(var(--age) + 550ms); }
.mapfx-loot .fx-txt { top: 4%; font-size: clamp(12px, calc(var(--tile) * .38), 24px); opacity: 0; animation: fxFloat 1.7s ease-out both; animation-delay: calc(var(--age) + 700ms); }
@keyframes fxChest { 0% { transform: rotate(0); } 15% { transform: rotate(-9deg) scale(1.04); } 35% { transform: rotate(9deg) scale(1.06); } 55% { transform: rotate(-6deg) scale(1.1); } 75% { transform: rotate(0) scale(1.18); opacity: 1; } 100% { transform: scale(1.5) translateY(-30%); opacity: 0; } }
@keyframes fxLootBurst { from { transform: scale(.2); opacity: 1; } to { transform: scale(var(--big)); opacity: 0; } }
@keyframes fxRays { 0% { transform: rotate(0) scale(.4); opacity: 0; } 25% { opacity: .9; } 100% { transform: rotate(80deg) scale(1.3); opacity: 0; } }
@keyframes fxLootItem { 0% { transform: translateY(40%) scale(.2); opacity: 0; } 30% { transform: translateY(-20%) scale(1.5); opacity: 1; } 55% { transform: translateY(-8%) scale(1.1); opacity: 1; } 100% { transform: translateY(-70%) scale(.9); opacity: 0; } }
@keyframes fxBurst { from { transform: scale(.2); opacity: 1; } to { transform: scale(1.8); opacity: 0; } }
@keyframes fxSparkle { from { transform: scale(.3); opacity: 1; } to { transform: scale(1.7); opacity: 0; } }
@keyframes fxPop { 0% { transform: scale(.3); opacity: 0; } 30% { transform: scale(1.35); opacity: 1; } 60% { transform: scale(1); opacity: 1; } 100% { transform: translateY(-30%) scale(.9); opacity: 0; } }
@keyframes fxFloat { 0% { transform: translateY(0); opacity: 0; } 15% { opacity: 1; } 100% { transform: translateY(-150%); opacity: 0; } }
@keyframes fxShake { 0%, 100% { transform: none; } 20% { transform: translate(-3px, 1px); } 40% { transform: translate(3px, -2px); } 60% { transform: translate(-2px, 2px); } 80% { transform: translate(2px, -1px); } }
@media (prefers-reduced-motion: reduce) {
  .mapfx::before, .mapfx::after, .map-frame.fx-shake { animation: none; }
  .mapfx::before, .mapfx::after { opacity: 0; }
  .mapfx .fx-ico, .mapfx .fx-txt { animation: fxFade 1.2s ease-out both; animation-delay: var(--age); }
  .mapfx-loot .fx-rays, .mapfx-loot .fx-chest { display: none; }
  .mapfx-loot .fx-ico, .mapfx-loot .fx-txt { opacity: 1; animation: fxFade 1.8s ease-out both; animation-delay: var(--age); }
  @keyframes fxFade { 0% { opacity: 0; } 20% { opacity: 1; } 100% { opacity: 0; } }
}
@media (prefers-reduced-motion: reduce) { .fuse-badge.low { animation: none; } }
/* V12.13 : à l'échelle du personnage */
.exit-ico img.pxi { width: 100%; height: 100%; vertical-align: top; }
.exit-ico { filter: drop-shadow(0 0 3px #000) drop-shadow(0 0 1px #000); z-index: 2; transform: translateY(-50%); position: absolute; width: clamp(12px, calc(var(--tile) * .42), 30px); height: clamp(12px, calc(var(--tile) * .42), 30px); line-height: 0; }
/* V13 (retour d'Alexandre) : la roche non cassée (fog) suit désormais le même dégradé de torche que le
   reste (règle .tile:not(.player) plus haut) — l'ancien filter: none l'en exemptait, ce qui l'empêchait
   de s'assombrir hors du halo de lumière. */
.tile.fog.reach { box-shadow: inset 0 0 0 2px rgba(255, 214, 120, .75); cursor: pointer; }
.tile.fog.reach:hover { filter: brightness(1.15); }
.tile.player .exit-ico { font-size: clamp(10px, calc(var(--tile) * .3), 24px); top: 14%; right: -2px; width: clamp(10px, calc(var(--tile) * .3), 24px); height: clamp(10px, calc(var(--tile) * .3), 24px); }
.hud img.pxi { width: 18px; height: 18px; }
.legend img.pxi { width: 16px; height: 16px; }
/* V6.1 : bulle du chiffre au-dessus du joueur */
/* V13 (retour d'Alexandre) : la bulle passait sous les cases voisines — son z-index (3) était plus bas
   que les calques de torche ajoutés depuis (.torch-overlay: 4, .torch-light: 5), qui couvrent toute la
   grille. Remonté au-dessus des deux pour que la bulle reste visible en toutes circonstances. */
.tile.player { z-index: 6; overflow: visible; }
.bubble {
  position: absolute; left: 50%; bottom: 88%; transform: translateX(-50%); z-index: 5; pointer-events: none;
  min-width: clamp(18px, calc(var(--tile) * .5), 34px); padding: 1px 6px; border-radius: 8px;
  background: #f4efe2; border: 2px solid var(--ink-dark); box-shadow: 0 2px 0 rgba(0, 0, 0, .5);
  font-family: var(--font-title); font-variant-numeric: tabular-nums; font-weight: 800; text-align: center; line-height: 1.2;
  font-size: clamp(10px, calc(var(--tile) * .34), 22px); color: var(--ink-dark); animation: bubbleIn .25s ease-out;
}
.bubble::after {
  content: ""; position: absolute; left: 50%; top: 100%; transform: translateX(-50%);
  border: 6px solid transparent; border-top-color: var(--ink-dark);
}
.bubble.below { bottom: auto; top: 88%; }
.bubble.below::after { top: auto; bottom: 100%; border-top-color: transparent; border-bottom-color: var(--ink-dark); }
.bubble.n1 { color: #1d6fd1; }
.bubble.n2 { color: #2c8a2a; }
.bubble.n3 { color: #c62828; }
.bubble.n4 { color: #7b3fc4; }
.bubble.n0 { color: #6b6b6b; }
@keyframes bubbleIn { from { transform: translate(-50%, 4px); opacity: 0; } }
/* V6.3 : bulle de message tapée */
.bubble.msg {
  min-width: 0; width: max-content; max-width: min(240px, 70vw); white-space: normal; text-align: left;
  font-family: var(--font-ui); font-weight: 700; font-size: clamp(11px, 1.6vh, 14px); line-height: 1.3; color: var(--ink-dark); padding: 5px 9px;
}
.bubble.msg::before { content: ""; }
.bubble.msg:empty { display: none; }
.bubble.left { left: 0; transform: none; }
.bubble.left::after { left: calc(var(--tile, 40px) / 2); }
.bubble.right { left: auto; right: 0; transform: none; }
.bubble.right::after { left: auto; right: calc(var(--tile, 40px) / 2 - 6px); transform: none; }
.bubble.left, .bubble.right { animation: none; }
#grid { position: relative; border-radius: 8px; grid-auto-rows: var(--tile, 40px); grid-template-columns: repeat(var(--n, 8), var(--tile, 40px)); display: grid; overflow: visible; }
@media (min-width: 1024px) and (orientation: landscape), (min-width: 1200px) {
  /* La marge globale remplace les marges internes des écrans */
.explore, .combat { padding: 0; }
  .explore .map-area { justify-content: flex-start; height: 100%; }
  .v-exploring .actbar { min-height: calc(46px + 28px + var(--safe-b)); }
}
html:not(.dark) .map-frame { background: #d8cfbd; }
.dnode { background: none; cursor: pointer; }
.dnode-art { width: clamp(44px, 12vw, 72px); border-radius: 14px; display: grid; place-items: center; background: radial-gradient(circle, color-mix(in srgb, var(--tc) 35%, transparent), transparent 70%), var(--panel-2); }
.dnode-art > img { width: 78%; height: auto; image-rendering: pixelated; }
.dnode-key { position: absolute; right: -8px; bottom: -6px; width: 55% !important; filter: grayscale(.2) drop-shadow(0 2px 2px rgba(0, 0, 0, .4)); }
.dnode-name { font-size: var(--fs-xs); color: var(--muted); }
.dnode.cur .dnode-art { box-shadow: 0 0 0 2px var(--tc), 0 6px 16px color-mix(in srgb, var(--tc) 40%, transparent); }
.dnode.cur .dnode-name { color: var(--tc); }
.dnode:not(.locked):not(.cur):hover .dnode-art { transform: translateY(-3px); box-shadow: 0 0 0 2px var(--tc); }
.dnode.locked { cursor: not-allowed; }
.dnode.locked .dnode-art > img:first-child { filter: brightness(0); opacity: .35; }
.dnode.done .dnode-art::after { content: ""; position: absolute; top: -6px; right: -6px; width: 18px; height: 18px; border-radius: 50%; background: var(--gold) url(../data/icons/check.png) center / 12px no-repeat; color: var(--ink-dark); font-size: var(--fs-xs); font-weight: 800; display: grid; place-items: center; }
.dnode:disabled { opacity: 1; }
@media (max-width: 599px) { .dnode-name { display: none; }  .dnode { position: relative; } .dnode.cur .dnode-name { position: absolute; display: block; top: 100%; width: 110px; left: 50%; transform: translateX(-50%); margin-top: 3px; } .dpath-row { padding-bottom: 20px; } }
@media (min-width: 1024px) and (orientation: landscape), (min-width: 1200px) {
  
  .play-grid > .stack:last-child { top: 0; position: static; }
  
  
  .hero-head p { font-size: var(--fs-md); }
  .hero-body { flex: 1; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: calc(var(--gap) * 2); }
  .hero-card.v2 .hero-portrait { background: radial-gradient(ellipse at 50% 90%, color-mix(in srgb, var(--tc) 30%, transparent), transparent 70%); }
  
  .dnode-name { font-size: var(--fs-xs); }
}
.tile.keytile { animation: keyPulse 1.6s ease-in-out infinite; }
.bubble.zero { display: none; }
.dnode-rec { font-size: var(--fs-xs); font-weight: 800; color: var(--gold-ink); letter-spacing: .04em; }
/* --- Souffles (sous la barre de PV) --- */
.hud-hp-col { flex: 1; display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.souffles { display: flex; align-items: center; gap: 4px; }
.souffles i { width: 9px; height: 9px; border-radius: 50%; border: 1.5px solid color-mix(in srgb, #9fd8ef 70%, var(--muted)); background: transparent; }
.souffles i.on { background: radial-gradient(circle at 35% 35%, #fff, #9fd8ef 55%, #4a8fb0); border-color: #4a8fb0; box-shadow: 0 0 6px rgba(159, 216, 239, .6); }
.souffles small { font-size: var(--fs-xs); font-weight: 800; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); margin-left: 2px; }
@media (max-width: 599px) { .souffles small { display: none; } }
/* --- Divers audit --- */
@media (min-width: 1024px) and (orientation: landscape), (min-width: 1200px) {
  .hud-place strong { font-size: clamp(.8rem, 1.1vw, 1.05rem); max-width: 17vw; }
}
.td-card:nth-child(2n) > img, .dnode:nth-of-type(2n) .dnode-art > img:first-child, .beast:nth-child(2n) > img { animation-duration: 7.1s; animation-delay: -3s; }
/* ===== V12.1 : la respiration passe par des images (JS, haut du corps seulement) ; ici la vibration
   occasionnelle seule, désynchronisée par sprite. ===== */
.hero-portrait > img, .fighter img.sp, .td-card:not(.locked) > img, .dnode:not(.locked) .dnode-art > img:first-child,
.beast > img, .summary-head > img, .sum-cause-row > img, .av-img, .hero-mini > img { transform-origin: 50% 90%; animation: idleShiver var(--shd, 6.2s) ease-in-out var(--shdel, 0s) infinite; }
.tile.player .ent { animation: none; }
@media (prefers-reduced-motion: reduce) {
  .hero-portrait > img, .fighter img.sp, .td-card > img, .dnode-art > img, .beast > img, .summary-head > img, .sum-cause-row > img, .av-img, .hero-mini > img { animation: none; }
}
/* V12.1 : HUD de descente sans bouton menu (il passe dans la barre d'onglets, « Sac ») */
@media (min-width: 1024px) and (orientation: landscape), (min-width: 1200px) {
  .hud { justify-content: start; grid-template-columns: auto minmax(110px, 14vw) auto auto auto; gap: calc(var(--gap) * 1.2); }
  :root:has(.topbar-run) .tabbar.in-run, .tabbar.in-run { right: var(--edge); padding-right: 0; }
}
.tile.player .ent, .tile.player .ent.ent { left: 19%; top: 16%; width: 62%; height: 62%;
  filter: drop-shadow(0 2px 0 rgba(0, 0, 0, .55)) drop-shadow(0 0 3px color-mix(in srgb, var(--accent) 35%, transparent)); }
html:not(.dark) .tile.player .ent { filter: drop-shadow(0 2px 0 rgba(60, 40, 10, .45)); }
.tile.player .ent.jump { animation: jumpUp .6s cubic-bezier(.3, .7, .4, 1) both; }
/* (retour d'Alexandre, 01/10 — correction) : c'est le JOUEUR qui saute trois fois pour saluer toute
   découverte non-combat (PNJ, événement, feu de camp, marchand, trésor) — pas l'icône/le personnage de la
   découverte (.tile-greet/.tent-npc-greet retirés plus bas, désormais inutilisés : voir trackGreet()/
   playerGreetHere dans js/view-explore.js, durée GREET_MS à garder synchronisée). Déclarée après .jump
   ci-dessus, même spécificité (4 classes de part et d'autre) : en cas de conflit (un pas qui enchaînerait
   sur une découverte dans les 300 ms, cf. ui.jumpAt dans js/main.js), c'est cette règle qui gagne — le
   salut prime sur l'animation de pas. */
.tile.player .ent.greet-hop { animation: jumpUp .5s cubic-bezier(.3, .7, .4, 1) 3; }
@media (prefers-reduced-motion: reduce) { .tile.player .ent.greet-hop { animation: none; } }
/* (retour d'Alexandre, 30/09) : un PNJ sur la carte (en rencontre ou déjà croisé, « npc_done ») respire un
   peu — pas juste une image figée : de temps en temps il se décale de quelques pas à gauche ou à droite,
   puis revient, sans jamais quitter sa case (translateX seulement, la case elle-même ne bouge pas). Décalé
   par case via --npc-idle-delay (posé en ligne depuis view-explore.js, sur un hachage stable de sa
   position) pour que plusieurs PNJ visibles à la fois ne se balancent pas en même temps. */
@keyframes npcIdleSway {
  0%, 38% { transform: translateX(0); }
  44%, 54% { transform: translateX(-9%); }
  60% { transform: translateX(0); }
  68%, 80% { transform: translateX(7%); }
  86%, 100% { transform: translateX(0); }
}
.tile .tent-npc { animation: npcIdleSway 6.4s ease-in-out infinite; animation-delay: var(--npc-idle-delay, 0s); }
@media (prefers-reduced-motion: reduce) { .tile .tent-npc { animation: none; } }
/* (retour d'Alexandre, 01/10) : le monstre respire un peu lui aussi (échange de frames JS, comme le PNJ —
   voir .tent-npc plus haut et BREATH_SEL dans js/animations.js, qui inclut désormais .tent-monster) — sans
   perdre sa case au sol, juste le haut du sprite qui monte d'un pixel. */
.tile .tent-monster { animation: none; } /* respiration gérée en JS (échange de frames), pas en CSS ici */
/* (retour d'Alexandre, 01/10) : le monstre tout juste rencontré saute deux fois pour saluer, avant que
   combat_select ne remplace la carte par l'arène (durée totale : MONSTER_GREET_MS dans
   js/view-explore.js, à garder synchronisée — deux itérations de .5s au lieu de trois pour le joueur
   ci-dessus, cf. retour d'Alexandre : « le monstre doit sauter DEUX fois »). */
.tile .tent-monster-greet { animation: jumpUp .5s cubic-bezier(.3, .7, .4, 1) 2; }
@media (prefers-reduced-motion: reduce) { .tile .tent-monster-greet { animation: none; } }
/* En-tête du combat sur ordinateur : barre de PV plus courte, plus de place à droite */
/* ===== V12.6 : en-tête de descente repensé (flex, pastilles homogènes) ===== */
.hud.hud7 { display: flex !important; align-items: center; gap: 12px; min-width: 0; }
.hud7 .hud-place { flex: 0 1 auto; min-width: 0; }
.hud7 .hud-hp { flex: 1 1 220px; min-width: 90px; max-width: 360px; }
.hud7 .hud-stats { flex: 0 0 auto; display: flex; align-items: center; gap: 8px; margin-left: auto; }
.hs-pill { position: relative; display: inline-flex; align-items: center; gap: 6px; padding: 5px 10px 7px; border-radius: 12px; background: var(--panel-2); border: 1px solid var(--line); line-height: 1; white-space: nowrap; }
.hs-pill img.pxi { width: 16px !important; height: 16px !important; }
@media (min-width: 1024px) and (orientation: landscape), (min-width: 1200px) {
  .hud7 { gap: 20px; }
  .hud7 .hud-place strong { max-width: 18vw; }
  .topbar.topbar-run { padding-right: calc(var(--edge) + 380px); }
  :root:not(:has(.tabbar)) .topbar.topbar-run { padding-right: var(--edge); }
  :root:not(:has(.tabbar)) .hud7 .hud-hp { max-width: 420px; }
}
@media (max-width: 599px) {
  .hud7 { gap: 8px; }
  .hud7 .hud-place strong { display: none; }
  .hud7 .hud-hp { flex: 1 1 auto; }
  .hud7 .hud-stats { gap: 4px; }
  .hs-pill { padding: 4px 6px 6px; gap: 4px; border-radius: 10px; }
  .hs-pill img.pxi { width: 14px !important; height: 14px !important; }
  .hs-val { font-size: var(--fs-sm); }
  .hs-lbl { display: none; }
  .hs-bar { left: 6px; right: 6px; }
}
/* V12.10 : en thème clair, les noms teintés par la couleur du donjon ou de sa clé sont foncés
   pour rester lisibles (contraste AA). */
html:not(.dark) .theme-card strong, html:not(.dark) .td-card strong, html:not(.dark) .hero-head h3,
html:not(.dark) .dnode.cur .dnode-name { color: color-mix(in srgb, var(--tc) 50%, var(--ink-dark)); }
/* V12.10 : téléphone en portrait, la carte se cale en haut. */
@media (max-width: 1023px) and (orientation: portrait) {
  .explore .map-area { justify-content: flex-start; padding-top: 12px; }
}
@media (min-width: 1024px) and (max-width: 1279px) {
  .hud7 .hud-place strong { white-space: normal; max-width: 15vw; font-size: var(--fs-sm); line-height: 1.1;
    display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
}
.log-mini:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.tile.player .ent.dance, .fighter img.sp.dance { animation: danceHop .8s ease-in-out 2 both !important; transform-origin: 50% 90%; }
/* V12.26 : silhouette translucide sur la case d'arrivée, le personnage la rejoint en glissant */
/* V12.28 : marche. Rebond calé sur les pas (JS), ombre au sol, poussière, tassement à l'arrivée */
.tile.player .ent.gliding { animation: none; }
.tile.player .ent-shadow { position: absolute; left: 28%; width: 44%; top: 72%; height: 10%; border-radius: 50%; background: radial-gradient(closest-side, rgba(0, 0, 0, .45), rgba(0, 0, 0, 0)); pointer-events: none; z-index: 0; }
.tile.player .ent.ent-land { animation: landSquash .24s ease-out; transform-origin: 50% 100%; }
@media (prefers-reduced-motion: reduce) { .tile.player .ent.ent-land, .ent-dust { animation: none; } }
/* V12.29 : tempo des animations du personnage réglé par sa Vitesse (--ptempo, 1 à Vitesse 5) */
.tile.player .ent.jump { animation-duration: calc(.6s / var(--ptempo, 1)); }
.tile.player .ent.dance, .fighter img.sp.dance { animation-duration: calc(.8s / var(--ptempo, 1)) !important; }
.tile.player .ent.gliding { z-index: 1; transition: transform 60ms ease-out; }
/* V12.31 : donjon et Défi réservés au pack de soutien */
.dnode-pack { position: absolute; right: -2px; bottom: -2px; font-size: var(--fs-sm); color: #ffe08a; text-shadow: 0 1px 0 rgba(0, 0, 0, .7); }
.dnode-name { max-width: 100%; line-height: 1.15; font-family: var(--font-title); text-align: center; }
/* Chemin des donjons : pointillés entre les donjons d'une même rangée */
.dnode { color: var(--text); font: inherit; border: 0; padding: 0; gap: 4px; align-items: center; flex-direction: column; display: flex; flex: 0 0 auto; max-width: 96px; width: 100%; position: relative; }
.dnode:not(.row-start)::before { content: ""; position: absolute; z-index: 0; top: calc(clamp(44px, 12vw, 72px) / 2); right: calc(50% + clamp(44px, 12vw, 72px) / 2 - 2px); width: calc(100% - clamp(44px, 12vw, 72px) + 8px); border-top: 2px dashed var(--line); pointer-events: none; }
.dnode:not(.locked):not(.row-start)::before { border-top-color: color-mix(in srgb, var(--accent) 60%, var(--line)); }
.dnode-art { transition: transform .15s, box-shadow .15s; border: 1px solid var(--line); aspect-ratio: 1; position: relative; z-index: 1; }
/* ===== V12.37 : retours du jury ===== */
/* Chiffres toujours en Inter tabulaire (la police pixel confond 5/S et 7/ɿ en petit) */
.num, .hsb-top b, .bubble, .board-score, .asc-val, .lvl-chip b, .hs-val, .card-weight, .deck-mini .w, .card-fx .fx, .fx { font-family: var(--font-ui); font-variant-numeric: tabular-nums; }
/* Souffles : pleins et lisibles aussi en thème clair */
html:not(.dark) .souffles i { border-color: color-mix(in srgb, #4a8fb0 60%, var(--line)); background: color-mix(in srgb, #4a8fb0 18%, transparent); }
html:not(.dark) .souffles i.on { background: radial-gradient(circle at 35% 35%, #fff, #7cc4e6 55%, #2f6f93); border-color: #2f6f93; box-shadow: none; }
/* HUD : les indicateurs se touchent sur mobile pour afficher leur nom */
@media (max-width: 1023px) { .hud .hs-pill, .hud .souffles, .hud .dots, .hud-hp { cursor: pointer; -webkit-tap-highlight-color: transparent; } }
/* V12.43 : Pixelify jamais sous 16 px (Inter en dessous) et sans ligatures (le « fi » de « Défi » cassait la police). */
:where(h1, h2, h3, .btn-lg, .btn-primary, .fighter .name, .hud-place strong, .float, [class*="title"]) { font-variant-ligatures: none; }
.card-name, .dnode-name, .hero-lvl, .hero-name { font-family: var(--font-ui); }
/* V12.43 : message long de la carte (épigraphe du palier...) en bandeau sous la grille, sur plusieurs lignes. */
.map-caption { position: absolute; left: 50%; top: calc(100% + 8px); transform: translateX(-50%); z-index: var(--z-float, 5); pointer-events: none;
  width: max-content; max-width: min(320px, 80vw); display: grid; padding: 7px 12px; border-radius: 10px;
  background: #f4efe2; border: 2px solid var(--ink-dark); box-shadow: 0 2px 0 rgba(0, 0, 0, .5);
  font-family: var(--font-ui); font-weight: 700; font-size: var(--fs-sm); line-height: 1.35; color: var(--ink-dark); white-space: normal; text-align: left; animation: bubbleIn .25s ease-out; }
.map-caption > span { grid-area: 1 / 1; }
.map-caption-full { visibility: hidden; }
.map-caption::after { content: ""; position: absolute; left: 50%; bottom: 100%; transform: translateX(-50%); border: 6px solid transparent; border-bottom-color: var(--ink-dark); }
@media (min-width: 1024px) and (orientation: landscape), (min-width: 1200px) {
  /* sur ordinateur, la place sous la grille est courte : le bandeau se pose sur la barre d'action, au centre */
/* V12.57 (P3) : sur ordinateur, bandeau en haut de la carte, jamais sur la barre d'indication du bas */
.map-caption { position: absolute; top: 14px; max-width: min(560px, 86%); text-align: center; box-shadow: 0 4px 16px rgba(0, 0, 0, .35); }
  .map-caption::after { display: none; }
}
/* V12.57 (P3) : l'épigraphe du palier se lit comme une inscription, pas comme une notification */
.map-caption.epi { background: rgba(11, 10, 14, .84); border: 1px solid color-mix(in srgb, var(--accent) 55%, transparent); color: #efe7d4;
  font-style: italic; font-weight: 500; font-size: var(--fs-md, 1rem); padding: 10px 18px; text-align: center; backdrop-filter: blur(2px); }
.map-caption.epi::after { border-bottom-color: color-mix(in srgb, var(--accent) 55%, transparent); }
/* V12.43 : HUD de descente sur ordinateur. Onglets à libellé complet, nom du palier entier jusqu'à 22 caractères. */
@media (min-width: 1024px) and (orientation: landscape), (min-width: 1200px) {
  .tabbar.in-run button { flex: 0 0 auto; padding: 0 12px; }
  .tabbar.in-run button span { max-width: none; overflow: visible; text-overflow: clip; }
  .topbar.topbar-run { padding-right: calc(var(--edge) + 330px); }
  .hud7 { gap: 14px; }
  .hud7 .hud-hp { flex: 1 1 140px; min-width: 110px; }
}
@media (min-width: 1280px) {
  .hud7 .hud-place { flex: 0 0 auto; }
  .hud7 .hud-place strong { display: block; font-size: 16px; max-width: 22ch; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
}
@keyframes dotUnder { from { transform: translate(-50%, -4px); opacity: 0; } 20% { transform: translate(-50%, 0); opacity: 1; } 75% { opacity: 1; } to { transform: translate(-50%, 6px); opacity: 0; } }
@media (min-width: 1024px) and (orientation: landscape), (min-width: 1200px) {
  html[data-text="large"] .topbar.topbar-run { padding-right: calc(var(--edge) + 372px); }
  html[data-text="large"] .hud7 .hud-hp { min-width: 130px; }
  html[data-text="large"] .hud7 .hs-lbl { display: none; }
}
/* V12.53 : visibilité. Portée de vue sous les caractéristiques ; fondu du voile sur les cases dévoilées à distance. */
.sight-line { display: flex; align-items: center; gap: 6px; font-size: var(--fs-sm); color: var(--muted); }
.sight-line .pxi { width: 16px; height: 16px; }
.sight-line b { font-family: var(--font-title); font-size: var(--fs-md); color: var(--text); }
.hero-stats .sight-line b { font-size: var(--fs-md); }
.tile.unveil { animation: unveilFade .3s ease-out both; }
@keyframes unveilFade { from { filter: brightness(.2) saturate(.4); } to { filter: none; } }
@media (prefers-reduced-motion: reduce) { .tile.unveil { animation: none; } }
/* V12.56 : passage de palier */
.passage-pop .passage-panel { width: min(460px, 100%); max-width: 460px; gap: 10px; padding: 24px 22px 20px; text-align: center;
  border-top: 2px solid color-mix(in srgb, var(--pc, var(--accent)) 70%, transparent); animation: passageIn .45s ease-out both; animation-delay: var(--pt, 0s); }
.passage-pop { animation-delay: var(--pt, 0s); animation-fill-mode: both; }
.passage-kicker { font-size: var(--fs-xs); letter-spacing: .08em; text-transform: uppercase; color: color-mix(in srgb, var(--pc, var(--accent)) 50%, var(--muted)); }
.passage-pop h2 { margin: 0; color: var(--text); text-wrap: balance; }
.passage-text { margin: 0; font-size: var(--fs-md); line-height: 1.6; color: var(--text); text-wrap: pretty; max-width: 36em; }
.passage-q { margin: 2px 0 6px; padding-top: 12px; border-top: 1px dashed color-mix(in srgb, var(--pc, var(--accent)) 40%, var(--line));
  font-style: italic; font-size: var(--fs-md); line-height: 1.5; color: color-mix(in srgb, var(--pc, var(--accent)) 80%, var(--text)); text-wrap: balance; }
html:not(.dark) .passage-q { color: color-mix(in srgb, var(--pc, var(--accent)) 50%, #1b1712); }
html:not(.dark) .passage-kicker { color: color-mix(in srgb, var(--pc, var(--accent)) 40%, var(--muted)); }
@keyframes passageIn { from { opacity: 0; transform: translateY(10px); } }
@media (max-width: 479px) { .passage-pop .passage-panel { padding: 18px 16px 16px; } .passage-text, .passage-q { font-size: var(--fs-sm); } }
@media (prefers-reduced-motion: reduce) { .passage-pop, .passage-pop .passage-panel { animation: none; } }
/* D11 : pop-in de passage, sprite du Gardien vaincu (24 px d'art ×4) à gauche du titre, sur un socle à
   l'accent de son palier ; il s'éteint doucement pendant la lecture. */
.passage-head { display: flex; align-items: center; justify-content: center; gap: 14px; text-align: left; }
.passage-head h2 { text-align: left; }
.passage-boss { flex: none; display: grid; place-items: center; width: 108px; height: 108px; border-radius: 6px; overflow: hidden;
  background: color-mix(in srgb, var(--gc, var(--accent)) 20%, transparent); box-shadow: inset 0 0 0 2px color-mix(in srgb, var(--gc, var(--accent)) 65%, transparent), 0 3px 0 rgba(0, 0, 0, .35); }
.passage-boss img { width: 96px; height: 96px; image-rendering: pixelated; transform: scale(1.3) translateY(-6%); filter: drop-shadow(0 3px 0 color-mix(in srgb, var(--gc, var(--accent)) 55%, #000));
  animation: passageBossOut .6s ease-out .5s both; animation-delay: calc(var(--pt, 0s) + .5s); }
@keyframes passageBossOut { to { filter: drop-shadow(0 3px 0 color-mix(in srgb, var(--gc, var(--accent)) 35%, #000)) grayscale(.45) brightness(.82); } }
@media (max-width: 479px) { .passage-boss { width: 80px; height: 80px; } .passage-boss img { width: 72px; height: 72px; } .passage-head { gap: 10px; } }
@media (prefers-reduced-motion: reduce) { .passage-boss img { animation: none; } }
.offering-gauge { display: inline-flex; gap: 3px; padding: 2px 0; }
.offering-gauge i { width: 10px; height: 10px; border-radius: 1px; background: color-mix(in srgb, var(--muted) 25%, transparent); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--muted) 45%, transparent); }
.offering-gauge i.on { background: #ffcf5a; box-shadow: inset 0 -2px 0 #c98a1e, 0 0 6px rgba(255, 207, 90, .45); }
.tile.far-shake { animation: shake .3s ease-in-out; }
@media (prefers-reduced-motion: reduce) { .pose-flash, .tile.far-shake { animation: none; } }
.coach-body strong, .passage-kicker, .t-kicker.dungeon-intro-name { letter-spacing: .02em; }
/* T8 : cases de la carte à 44 px sur mobile (8 × 44 = 352 px) : la carte récupère les marges latérales. */
@media (max-width: 1023px) and (pointer: coarse), (max-width: 599px) {
  .explore .map-area { margin-inline: -12px; padding-inline: 0; }
  .explore .map-frame { padding: 3px; }
}
/* V12.58 : carte. Surbrillance des cases accessibles plus discrète (fond 10 %, liseré 40 %, survol 25 %),
   danger un cran en dessous de l'ancien réglage ; fondu de sortie des chiffres qui ne sont plus en frontière.
   V13 (retour d'Alexandre) : encore réduite (7 %, etc.). */
.tile.reach::after { background: color-mix(in srgb, var(--accent) 7%, transparent); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--accent) 30%, transparent); }
.tile.reach:hover::after { background: color-mix(in srgb, var(--accent) 18%, transparent); }
.tile.reach.danger::after { background: rgba(224, 72, 90, .08); box-shadow: inset 0 0 0 1px rgba(224, 72, 90, .5); }
.tile.reach.danger:hover::after { background: rgba(224, 72, 90, .2); }
.tile.fog.reach { box-shadow: inset 0 0 0 1px rgba(255, 214, 120, .4); }
.tile.fog.reach:hover { filter: brightness(1.08); }
/* V12.60 : DA */
/* Échelles entières hors combat : chaque image pixel tombe sur un multiple de sa grille d'art
   (16 px pour les héros, monstres, tuiles et clés ; 24 px pour les Gardiens 1 à 6, img[data-art="24"]). */
/* Carte du donjon : cases au multiple de 16 px (fitMap), héros à 3/4 de case au multiple de 16 px (--ent). */
.map-frame.map-tight { padding: 0; }
.tile.player .ent.ent { width: var(--ent, 62%); height: var(--ent, 62%); left: calc((var(--tile) - var(--ent)) / 2); top: max(0px, calc((var(--tile) - var(--ent)) / 2 - round(down, var(--tile) / 16, 1px))); }
/* Chemin des donjons : sprite au multiple de 16 px dans sa pastille, clé ×2 ou ×1. */
.dnode-art > img:first-child { width: max(16px, round(down, 78%, 16px)); }
.dnode-art > img.dnode-key { width: max(16px, round(down, 55%, 16px)) !important; }
/* Surtitre de la pop-in de passage en clair : au moins 4,5 : 1. */
html:not(.dark) .passage-kicker { color: color-mix(in srgb, var(--pc, var(--accent)) 30%, #3a3228); }
/* Éléments de la carte (monstres, trésor, clé, Gardien, torche) : 16 px d'art posés comme le héros. */
.tile .tent { position: absolute; width: var(--ent, 62%); height: var(--ent, 62%); left: calc((var(--tile) - var(--ent)) / 2); top: max(0px, calc((var(--tile) - var(--ent)) / 2 - round(down, var(--tile) / 16, 1px))); image-rendering: pixelated; pointer-events: none; z-index: 0; }
.tile .tent-obstacle { top: calc((var(--tile) - var(--ent)) / 2); }
/* N5 : sur mobile, l'épigraphe se pose en surimpression sur le bas de la carte, jamais sur le journal. */
@media (max-width: 1023px) { .map-caption.epi { top: auto; bottom: 8px; max-width: min(340px, 92%); } .map-caption.epi::after { display: none; } }

/* ===== T578 : plan du donjon (salle précédente + salles noires), purement visuel — voir planRooms() ===== */
/* Même cadre que la carte principale (.map-frame) : fond, liseré, anneau d'accent, ombre ; l'intérieur est noir. */
.plan-room { position: absolute; pointer-events: none; overflow: hidden; border-radius: 14px; background: #0b0a0e; border: 1px solid var(--line);
  box-shadow: inset 0 0 40px rgba(0, 0, 0, .8), 0 0 0 1px color-mix(in srgb, var(--accent) 25%, transparent), var(--shadow); }
html:not(.dark) .plan-room { background: #d8cfbd; }
.plan-room:not(.plan-snap)::after { content: ""; position: absolute; inset: 6px; border-radius: 8px; background: #060509; box-shadow: inset 0 0 28px rgba(0, 0, 0, .95); }
.plan-right { left: calc(100% + 8px); top: 0; width: var(--peek-x, 12px); height: 100%; }
.plan-below { top: calc(100% + 8px); left: 0; width: 100%; height: var(--peek-y, 18px); }
.plan-below-right { top: calc(100% + 8px); left: calc(100% + 8px); width: var(--peek-x, 12px); height: var(--peek-y, 18px); }
.plan-below-left { top: calc(100% + 8px); right: calc(100% + 8px); width: var(--peek-x, 12px); height: var(--peek-y, 18px); }
.plan-snap { background: var(--ink-dark); }
.plan-snap > #grid, .plan-snap > div { position: absolute; margin: 0; filter: brightness(.45) saturate(.6); }
.plan-left { right: calc(100% + 8px); top: 0; width: var(--peek-x, 12px); height: 100%; }
.plan-left > div { right: 6px; top: 6px; }
.plan-top { bottom: calc(100% + 8px); left: 0; width: 100%; height: var(--peek-y, 18px); }
.plan-top > div { left: 6px; bottom: 6px; }
@media (prefers-reduced-motion: reduce) { .plan-room { transition: none; } }
