/* Terrain d'entraînement (21/11/2026) : bouton de la fiche, HUD du terrain (barre, compteur de dégâts), pause, annonces.
   Style : cadres de Donjon Mystère du jeu (.box, .btn), pixels nets, petites animations en escalier (steps). */

/* ---------- Le mannequin en icône (première ligne de assets/pkmn/9001/idle.png, 4 images de 40 × 48) ---------- */
.entr-ico { display: inline-block; flex: none; width: 20px; height: 24px; background: url('assets/pkmn/9001/idle.png') 0 0 / 80px 24px no-repeat; image-rendering: pixelated; animation: entrIco 1.3s steps(4) infinite; }
.entr-ico.grand { width: 40px; height: 48px; background-size: 160px 48px; animation-name: entrIcoG; vertical-align: -10px; margin-right: 8px; }
@keyframes entrIco { to { background-position-x: -80px; } }
@keyframes entrIcoG { to { background-position-x: -160px; } }

/* ---------- Bouton de la fiche : en haut à droite, juste à gauche de la croix, toujours visible ---------- */
#detail .fi-entr { position: absolute; top: 6px; right: 84px; z-index: 3; min-height: 40px; padding: 2px 10px 2px 8px; gap: 6px; font-size: 18px; color: #ffe9a8;
  border-image-source: url('assets/ui/cadres/cadre1_yellow_fin.png'); }
#detail .fi-entr .tx { white-space: nowrap; }
#detail .fi-entr:hover .entr-ico, #detail .fi-entr.focus .entr-ico, #detail .fi-entr:focus-visible .entr-ico { animation: entrSecoue .3s steps(3) 2; }
#detail .fi-entr:hover, #detail .fi-entr.focus { filter: brightness(1.15); }
@keyframes entrSecoue { 0% { transform: translateX(0); } 33% { transform: translateX(-2px) rotate(-8deg); } 66% { transform: translateX(2px) rotate(6deg); } 100% { transform: none; } }
/* le titre de la fiche laisse la place au bouton */
#detail.avec-entr .fi-haut { padding-right: 150px; }
#detail .fi-entr.dans-ligne { position: relative; top: auto; right: auto !important; min-height: 0; align-self: stretch; }
body.is-touch #detail.avec-entr .fi-haut { padding-right: 0; }
@media (max-width: 700px) { #detail.avec-entr .fi-haut { padding-right: 0; } }

/* ---------- Ouverture : un rideau de pixels ---------- */
.entr-voile { position: fixed; inset: 0; z-index: 60; pointer-events: none; background: #070d24;
  opacity: 1; transition: opacity .5s steps(5); }
.entr-voile.fin { opacity: 0; }

/* ---------- HUD du terrain ---------- */
body.entr-on .mm-box, body.entr-on #h-minimap, body.entr-on .h-jobs, body.entr-on #h-jobs, body.entr-on #h-floor { display: none !important; } /* ni mini-carte, ni quêtes, ni « Étage 0 / 1 » */
.entr-hud { position: fixed; inset: 0; z-index: 12; pointer-events: none; font-size: 18px; text-shadow: 0 2px 0 #000; }
.entr-hud .btn { pointer-events: auto; }
.entr-hud kbd, .entr-k { display: inline-block; min-width: 22px; padding: 0 4px; margin-left: 4px; font: inherit; font-size: 14px; line-height: 18px; color: #cfe0ff; text-align: center;
  background: #0a1430; border: 2px solid #31508f; box-shadow: 0 2px 0 #030716; }

/* barre du haut, au milieu : planche de bois avec le titre, Niveau +, les mannequins, Quitter */
.entr-barre { position: absolute; top: 8px; left: 50%; transform: translateX(-50%); display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: 6px; padding: 5px 8px; width: max-content; max-width: min(740px, calc(100vw - 16px)); pointer-events: auto;
  background: linear-gradient(#8a5a2e, #6b4220 55%, #5a361a); border: 3px solid #2a170c; box-shadow: inset 0 2px 0 #c58d4f, inset 0 -3px 0 #3d2410, 0 4px 0 rgba(0,0,0,.45);
  image-rendering: pixelated; animation: entrTombe .45s steps(6) both; }
.entr-barre::before, .entr-barre::after { content: ''; position: absolute; top: -12px; width: 4px; height: 12px; background: #2a170c; box-shadow: 1px 0 0 #6b4220; }
.entr-barre::before { left: 18px; } .entr-barre::after { right: 18px; }
@keyframes entrTombe { from { transform: translate(-50%, -80px); } 70% { transform: translate(-50%, 4px); } to { transform: translate(-50%, 0); } }
.entr-titre { display: flex; align-items: center; gap: 6px; color: #ffe9a8; white-space: nowrap; }
.entr-titre b { font-size: 20px; }
.entr-niv { padding: 0 6px; color: #fff; background: rgba(0,0,0,.28); border: 2px solid #3d2410; }
.entr-niv { color: var(--gold); }
.entr-barre .btn { font-size: 16px; padding: 0 8px 0 14px; min-height: 32px; white-space: nowrap; }
.entr-niveau { border-image-source: url('assets/ui/cadres/cadre1_yellow_fin.png'); color: #ffe27a; }
.entr-niveau .entr-plus { display: inline-block; width: 18px; height: 18px; line-height: 16px; color: #3a2400; background: var(--gold); border: 2px solid #8a5a00; text-align: center; font-size: 18px; }
.entr-niveau.pop { animation: entrPop .35s steps(4); }
@keyframes entrPop { 40% { transform: scale(1.15); filter: brightness(1.6); } 100% { transform: none; } }
.entr-modes { display: flex; align-items: center; gap: 4px; }
.entr-modes .btn { padding: 0 8px 0 6px; gap: 4px; font-size: 15px; min-height: 30px; }
.entr-mico { display: inline-block; width: 22px; height: 16px; background: url('assets/pkmn/9001/idle.png') 0 0 / 53px 16px no-repeat; image-rendering: pixelated; position: relative; }
.entr-mico.m-seul { width: 14px; background-size: 53px 16px; }
.entr-mico.m-arc { background: none; }
.entr-mico.m-arc::before, .entr-mico.m-arc::after { content: ''; position: absolute; top: 0; width: 12px; height: 14px; background: url('assets/pkmn/9001/idle.png') 0 0 / 48px 14px no-repeat; image-rendering: pixelated; }
.entr-mico.m-arc::before { left: -2px; } .entr-mico.m-arc::after { left: 10px; top: 2px; }
.entr-mico.m-allie { width: 14px; background-image: url('assets/pkmn/9002/idle.png'); }
/* (3/12, Kiko) corps à corps : trois mannequins serrés ; « en place » : une flèche qui revient */
.entr-mico.m-cac { width: 26px; background: none; }
.entr-mico.m-cac::before, .entr-mico.m-cac::after { content: ''; position: absolute; top: 1px; width: 11px; height: 14px; background: url('assets/pkmn/9001/idle.png') 0 0 / 44px 14px no-repeat; image-rendering: pixelated; }
.entr-mico.m-cac::before { left: 0; } .entr-mico.m-cac::after { left: 14px; }
.entr-mico.m-place { width: 16px; background: none; }
.entr-mico.m-place::before { content: '↺'; position: absolute; left: 0; top: -3px; font-size: 18px; line-height: 18px; color: #ffe27a; }
.entr-place { border-image-source: url('assets/ui/cadres/cadre1_yellow_fin.png'); }
/* type du mannequin (21/11) : pastille de couleur, la même que celle dessinée sur le mannequin */
.entr-types { display: flex; align-items: center; gap: 4px; padding-left: 6px; border-left: 2px solid #3d2410; }
.entr-types .btn { padding: 0 8px 0 6px; gap: 4px; font-size: 15px; min-height: 30px; }
.entr-pastille { display: inline-block; flex: none; width: 12px; height: 12px; background: #e9e4d6; border: 2px solid #2a170c; box-shadow: inset -2px -2px 0 rgba(0,0,0,.25), inset 2px 2px 0 rgba(255,255,255,.4); }
.t-super .entr-pastille, [data-type="super"] .entr-pastille { background: #e8402e; }
.t-faible .entr-pastille, [data-type="faible"] .entr-pastille { background: #3a78d8; }
.entr-types .btn.t-super.on { color: #ffb08a; } .entr-types .btn.t-faible.on { color: #a9cbff; }
.entr-k:empty { display: none !important; }
.entr-type-actif { display: flex; align-items: center; gap: 6px; margin: 2px 0 4px; padding: 1px 6px; font-size: 14px; color: #eef3ff; background: rgba(255,255,255,.06); border: 2px solid #4a5a7a; }
.entr-type-actif[data-type="super"] { color: #ffd2b8; border-color: #e8402e; background: rgba(232,64,46,.16); }
.entr-type-actif[data-type="faible"] { color: #cfe0ff; border-color: #3a78d8; background: rgba(58,120,216,.16); }
.entr-type-actif.pop { animation: entrPop .35s steps(4); }
.entr-types-p .btn.t-super { border-image-source: url('assets/ui/cadres/cadre1_pink_fin.png'); }
.entr-quitter { border-image-source: url('assets/ui/cadres/cadre1_pink_fin.png'); color: #ffb0c8; }

/* compteur de dégâts, en haut à droite */
.entr-dps { position: absolute; top: 8px; right: 8px; width: 210px; padding: 8px 12px 10px; pointer-events: auto;
  border: 16px solid transparent; border-image: url('assets/ui/cadres/cadre1_blue_translucide.png') 8 fill / 16px stretch; image-rendering: pixelated;
  filter: drop-shadow(0 6px 10px rgba(0,0,0,.5)); animation: entrGlisse .4s steps(5) both .1s; }
@keyframes entrGlisse { from { transform: translateX(260px); } to { transform: none; } }
.entr-dps-tete { color: #8fd0ff; font-size: 15px; letter-spacing: .5px; }
.entr-dps-val { display: flex; align-items: baseline; gap: 6px; margin: -2px 0 2px; }
.entr-dps-val b { font-size: 40px; line-height: 1; color: #ffd35c; display: inline-block; transform-origin: left bottom; }
.entr-dps-val b.monte { transform: scale(1.12); color: #fff2b0; }
.entr-dps-val small { color: var(--dim); font-size: 16px; }
.entr-graphe { display: block; width: 100%; height: 30px; margin: 2px 0 4px; image-rendering: pixelated; background: rgba(3,7,22,.45); border: 2px solid #1d3466; }
.entr-ligne { display: flex; justify-content: space-between; gap: 8px; font-size: 16px; line-height: 1.3; }
.entr-ligne span { color: var(--dim); }
.entr-ligne b { color: #fff; }
.entr-ligne.soin b { color: #7dffa0; }
.entr-soins { display: none; margin-top: 4px; padding-top: 4px; border-top: 2px dotted #31508f; }
.entr-hud.avec-soins .entr-soins { display: block; }
.entr-zero { width: 100%; margin-top: 8px; font-size: 15px !important; }

/* annonce au milieu de l'écran (entrée, changement de mannequins) */
.entr-annonce { position: fixed; left: 50%; top: 128px; z-index: 30; transform: translateX(-50%); display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 8px 22px; pointer-events: none;
  border: 16px solid transparent; border-image: url('assets/ui/cadres/cadre1_yellow_translucide.png') 8 fill / 16px stretch; image-rendering: pixelated; text-shadow: 0 2px 0 #000; text-align: center;
  animation: entrAnnonce .35s steps(4) both; max-width: calc(100vw - 24px); }
.entr-annonce b { color: var(--gold); font-size: 28px; }
.entr-annonce span { font-size: 18px; color: #eef3ff; }
.entr-annonce.fin { opacity: 0; transition: opacity .5s steps(4); }
.entr-annonce.erreur { border-image-source: url('assets/ui/cadres/cadre1_pink_fin.png'); top: 40%; }
@keyframes entrAnnonce { from { transform: translate(-50%, -14px) scale(.9); opacity: 0; } to { transform: translateX(-50%); opacity: 1; } }

/* pause du terrain */
.entr-pause .entr-boite { width: min(460px, 92vw); }
.entr-pause h2 { display: flex; align-items: center; }
.entr-pause .col { display: flex; flex-direction: column; gap: 6px; }
.entr-modes-p { display: flex; flex-wrap: wrap; gap: 4px; }
.entr-modes-p .btn { flex: 1 1 120px; font-size: 18px; }
.entr-aide { font-size: 15px; margin: 8px 0 0; text-align: center; }

/* ---------- Téléphone (couché) : la barre en colonne à gauche, sous les PV ; compteur réduit en haut à droite ---------- */
@media (max-width: 760px), (max-height: 520px) {
  /* (3/12) 8 boutons (4 mannequins + en place + 3 types) sur une seule ligne, sinon la barre descend sur les boutons d'attaque */
  .entr-barre { left: 6px; top: 78px; transform: none; flex-direction: row; flex-wrap: wrap; align-items: stretch; gap: 4px; padding: 4px; animation: none; width: 236px; max-width: none; }
  .entr-niveau, .entr-quitter { flex: 1 1 100%; }
  .entr-modes, .entr-types { flex: 0 0 auto; gap: 2px; }
  .entr-modes .btn, .entr-types .btn { flex: none !important; width: 26px; min-width: 0 !important; min-height: 24px !important; padding: 0 !important; border-width: 8px !important; }
  .entr-niveau, .entr-quitter { min-height: 26px !important; }
  .entr-barre { gap: 3px; }
  .entr-modes .entr-mico.m-arc { width: 16px; }
  .entr-modes .entr-mico.m-cac { width: 20px; } .entr-modes .entr-mico.m-cac::after { left: 9px; }
  .entr-modes .entr-mico.m-place { width: 13px; } .entr-modes .entr-mico.m-place::before { font-size: 15px; top: -2px; }
  .entr-barre::before, .entr-barre::after { display: none; }
  .entr-barre { transition: opacity .2s steps(3); }
  /* (21/11, Kiko) cartes à l'écran : seul « Niveau + » reste, pour enchaîner les niveaux puis les cartes */
  .entr-hud.cartes .entr-barre { background: none; box-shadow: none; border-color: transparent; }
  .entr-hud.cartes .entr-barre > :not(.entr-niveau) { opacity: 0; pointer-events: none; }
  .entr-titre, .entr-modes .tx, .entr-types .tx, .entr-hud kbd, .entr-k { display: none !important; }
  .entr-types { border-left: 0; padding-left: 0; } .entr-types .btn { flex: 1; min-width: 30px; padding: 0 2px; justify-content: center; }
  .entr-type-actif { font-size: 10px; margin: 0 0 2px; padding: 0 4px; white-space: nowrap; overflow: hidden; }
  .entr-type-actif .entr-pastille { width: 8px; height: 8px; }
  .entr-barre .btn { min-height: 28px; font-size: 13px; padding: 0 6px 0 10px; border-width: 10px; }
  .entr-modes .btn { padding: 0 2px; min-width: 30px; flex: 1; }
  .entr-dps { width: 132px; padding: 2px 6px 6px; border-width: 12px; top: 6px; right: 6px; }
  .entr-dps-tete { font-size: 12px; }
  .entr-dps-val b { font-size: 26px; }
  .entr-ligne { font-size: 12px; }
  .entr-graphe { height: 18px; }
  .entr-zero { font-size: 12px !important; margin-top: 4px; }
  .entr-annonce { top: 30%; } .entr-annonce b { font-size: 22px; } .entr-annonce span { font-size: 15px; }
}
/* téléphone tenu debout : le jeu demande de le tourner (touch.js) ; le HUD du terrain attend derrière */
@media (orientation: portrait) { body.is-touch .entr-hud { display: none; } }
/* (21/11) téléphone : la ligne d'actions passe à la ligne plutôt que de pousser le bouton hors de la fiche */
#detail .fi-act:has(.fi-entr.dans-ligne) { flex-wrap: wrap !important; row-gap: 4px; } /* !important : telephone.css force nowrap */
#detail .fi-entr.dans-ligne { max-width: 100%; }
