/* css/combat-layout.css — mise en page de l'arene de combat (.combat, .arena, .fighter), main et
   cartes (.hand, .card et ses variantes), jetons de statut, intentions du monstre, ecran de resultat.
   Sous-decoupe de combat.css (pur deplacement de code, V13.14). */

/* css/combat.css — arene de combat (.combat, .arena, .fighter), main et cartes (.hand, .card et ses
   variantes), jetons de statut, intentions du monstre, animations de jeu (degats, soin, esquive, vol de
   carte, victoire...) et l'ecran de resultat de combat.
   Issu du decoupage de l'ancien style.css (reorganisation pure, V13.12). */

.card-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 8px; }

/* ================================================================ Cartes */



















/* Carte en grand (tiroir de détail, récompense) */
/* Fiche de détail : la carte (image, nom, valeurs) puis, dessous, le texte de règle complet (.card-detail-desc) ; la
   description n'est donc pas répétée dans la carte. Même taille sur mobile et sur ordinateur. */


/* Mini carte (liste de deck) — la fiche du combattant (seul appelant de .deck-mini) utilise désormais le
   gabarit de carte 'md' comme le reste du projet (V13.16) ; .deck-list reste utilisée pour la main du bot
   (botDeckList(), js/view-combat.js), qui s'appuie sur .deck-grid (voir plus bas et combat-hand.css). */
.deck-list { display: flex; flex-direction: column; gap: 6px; }
/* ================================================================ Combat */
.combat {
  height: 100%; display: grid; gap: 8px; padding: 8px;
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: minmax(0, 1fr) auto auto;
  grid-template-areas: "arena" "hand" "act";
}
.c-intel, .c-log { display: none; }
.arena {
  grid-area: arena; position: relative; min-height: 0;
  display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 4px;
  padding: 28px 8px 10px; border-radius: 16px; border: 1px solid var(--line);
  background: radial-gradient(ellipse at 50% 92%, color-mix(in srgb, var(--accent) 24%, transparent), transparent 62%), linear-gradient(180deg, #17161d, #0c0b10);
  color: var(--text-on-dark); overflow: hidden;
}
.arena.boss { background: radial-gradient(ellipse at 50% 92%, rgba(163, 35, 51, .4), transparent 62%), linear-gradient(180deg, #1d1216, #0c0b10); }
.arena-tag { position: absolute; top: 8px; left: 50%; transform: translateX(-50%); font-size: var(--fs-xs); color: #a39d92; letter-spacing: .1em; text-transform: uppercase; white-space: nowrap; }
.arena-tag.fury { color: var(--danger); font-weight: 800; }
.arena-log { position: absolute; top: 4px; right: 4px; width: 40px; height: 40px; border-radius: 10px; border: 0; background: rgba(255,255,255,.08); color: var(--text-on-dark); cursor: pointer; z-index: 3; }
/* V13 (retour d'Alexandre) : pause juste après (à gauche de) le journal, groupés au même coin — plus
   besoin de la masquer sur mobile faute de place, elle reste disponible partout. */
.arena-pause { right: 50px; }
/* V13 (retour d'Alexandre) : les personnages semblaient posés trop bas dans l'arène ; petit décalage
   vers le haut (l'arène les centre verticalement via align-items sur la grille .arena). À ajuster si
   ce n'est pas encore assez (ou trop). */
.fighter { position: relative; display: flex; flex-direction: column; align-items: center; gap: 4px; text-align: center; min-width: 0; min-height: 0; margin-top: -12px; }
/* V12.78 (corrige V12.76) : la barre de vie reste en haut, le sprite (agrandi) juste en dessous, le
   nom et son bouton info tout en bas. Les combattants se decalent vers le bord de l'arene (joueur a
   gauche, monstre a droite) ; le sprite peut deborder legerement du cadre de l'arene. */
.fighter.player { align-items: flex-start; }
.fighter.bot { align-items: flex-end; }
.fighter img.sp { width: var(--sprite); height: var(--sprite); order: 3; cursor: pointer; position: relative; z-index: 2; }
/* V12.36 : le Gardien (dessiné en 24x24) paraît 1,5 fois plus grand qu'un monstre ordinaire. */
/* V13 : encore +20 % (retour d'Alexandre, les Gardiens paraissaient trop petits en combat). */
.fighter.boss img.sp { width: calc(var(--sprite) * 2.58); height: calc(var(--sprite) * 2.58); }
.fighter .name { font-family: var(--font-title); font-size: clamp(.82rem, 2dvh, 1.1rem); line-height: 1.1; max-width: 100%; order: 4; }
.fighter .sub { font-size: var(--fs-xs); color: #a39d92; order: 5; }
.fighter .bar { width: min(170px, 100%); order: 0; }
.fighter .bar.low > i { background: linear-gradient(90deg, #a32333, #e0485a) !important; }
.statuses { display: flex; gap: 3px; flex-wrap: wrap; justify-content: center; min-height: 18px; }
.fighter .statuses { order: 1; }
.st { font-size: var(--fs-xs); padding: 1px 5px; border-radius: 6px; background: rgba(255, 255, 255, .12); white-space: nowrap; }
/* V12.72 : badge de garde reportée (rempart, garde tenace), distinct des statuts (teinte bouclier). */
.st.st-guard { background: color-mix(in srgb, var(--accent) 28%, rgba(255, 255, 255, .12)); color: var(--text-on-dark, #fff); font-weight: 700; }
html:not(.dark) .st.st-guard { background: color-mix(in srgb, var(--accent) 22%, rgba(0, 0, 0, .08)); }
/* T732, T735 : affixes du monstre et rage (« +N » par coup), au même endroit que les statuts, teinte de danger. */
.st.st-affix { background: color-mix(in srgb, var(--danger) 26%, rgba(255, 255, 255, .12)); font-weight: 700; }
.st.st-rage { background: color-mix(in srgb, var(--danger) 58%, rgba(255, 255, 255, .1)); color: #fff; font-weight: 800; }
html:not(.dark) .st.st-affix { background: color-mix(in srgb, var(--danger) 20%, rgba(0, 0, 0, .06)); }
html:not(.dark) .st.st-rage { background: color-mix(in srgb, var(--danger) 70%, #fff); }
.fs-affixes { display: grid; gap: 4px; }
.chip { --c: var(--atk); }
.chip.defense { --c: var(--def); }
.chip.status { --c: var(--sta); }
.chip.none { border-left-color: transparent; color: #a39d92; }
.vs { font-family: var(--font-title); font-size: clamp(1rem, 3dvh, 2rem); color: var(--accent-ink); }
.bot-cards { display: flex; gap: 3px; justify-content: center; }
.bot-cards i { width: 11px; height: 15px; border-radius: 3px; background: linear-gradient(135deg, #6a2f3a, #2a1418); border: 1px solid #8a4a54; display: inline-block; }
.bot-cards i.rest { opacity: .3; }
.intent {
  position: absolute; top: -4px; left: 50%; transform: translate(-50%, -100%); z-index: 3;
  background: var(--text-on-dark); color: var(--ink-dark); font-size: var(--fs-xs); font-weight: 400; padding: 3px 8px; border-radius: 10px; white-space: nowrap;
  max-width: min(44vw, 260px); overflow: hidden; text-overflow: ellipsis;
}
@media (max-width: 599px) { .fighter.bot .intent { left: auto; right: 0; transform: translateY(-100%); } .fighter.bot .intent::after { left: 70%; } }
.intent::after { content: ""; position: absolute; left: 50%; bottom: -5px; transform: translateX(-50%); border: 5px solid transparent; border-top-color: var(--text-on-dark); border-bottom: 0; }
.intent.unknown { background: rgba(255,255,255,.15); color: var(--text-on-dark); }
.intent.unknown::after { border-top-color: rgba(255,255,255,.15); }

.rest-strip .chip { background: var(--panel-2); color: var(--muted); }
.act { grid-area: act; align-items: center; gap: 10px; }
.act .preview { flex: 1; min-width: 0; font-size: var(--fs-xs); color: var(--muted); line-height: 1.25; }
.act .preview b { color: var(--text); }
.act .btn { min-width: 150px; }
.result { width: min(420px, 100%); text-align: center; display: flex; flex-direction: column; gap: 12px; align-items: center; padding: 22px 18px; }
.result h2 { font-size: var(--fs-2xl); }
.result.win h2 { color: var(--gold-ink); }
.result.lose h2 { color: var(--danger); }
.result img { width: 96px; height: 96px; }
.card-detail { display: flex; flex-direction: column; align-items: center; gap: 10px; }
.card-detail-desc { color: var(--text); font-size: var(--fs-md); line-height: 1.5; text-align: left; width: 100%; }


















/* ================================================================ Paysage bas (téléphone couché) */
@media (orientation: landscape) and (max-height: 520px) and (max-width: 1023px) {
  :root { --top-h: 44px; --sprite: clamp(48px, 17dvh, 96px); }
  .tabbar button span { display: none; }
  .combat { grid-template-columns: minmax(0, 1fr) minmax(0, 1.25fr); grid-template-rows: minmax(0, 1fr) auto; grid-template-areas: "arena hand" "arena act"; }
  .hand-zone { align-self: end; }
  
  
  .summary-grid { grid-template-columns: repeat(4, 1fr); }
  .result { padding: 12px; gap: 6px; }
  .result img { width: 56px; height: 56px; }
  .result h2 { font-size: var(--fs-xl); }
}
/* ================================================================ V5 : gameplay */
.intent.danger { background: var(--danger); color: #fff; }
.intent.danger::after { border-top-color: var(--danger); }


.arena-log img.pxi { width: 22px; height: 22px; }
.st img.pxi, .chip img.pxi, .intent img.pxi { width: 14px; height: 14px; }
/* ===== V6.3 : cartes stylisées, texte contenu, main centrée ===== */






@media (min-width: 1024px) and (orientation: landscape), (min-width: 1200px) {
  .combat .c-intel { grid-row: 1 / 3; overflow-y: auto; }
  .combat .hand-zone { justify-self: center; width: 100%; }
  .combat .act { grid-area: act; justify-self: center; }
}
/* ===== V6.4 : touche « fait main » (cartes et boutons inclinés), texte des cartes sur mobile, fuite ===== */



/* V12.33 : plus de cadre pointillé sous les boutons */
/* Le texte des cartes est aussi visible sur mobile */

.act .btn.btn-flee { min-height: 44px; padding: .35rem .8rem; font-size: var(--fs-sm); }
@media (max-width: 1023px) { .act { flex-wrap: wrap; } .act .btn-flee, .act .no-flee { order: 3; width: 100%; } .act .no-flee { display: none; } }
/* V6.5 : au survol (souris), la carte se redresse */


/* V6.6 : le cadre en pointillé passe sous le bouton ; son parent isole la pile pour qu'il reste visible */
:has(> .btn-primary:not(.btn-flee), > .btn-danger:not(.btn-flee), > .btn-lg, > .act .btn) { isolation: isolate; }
.act { padding-bottom: var(--safe-b); display: flex; isolation: isolate; }


.played .chip { transition: transform .2s, box-shadow .2s; }
.played .chip.acting { transform: scale(1.18); box-shadow: 0 0 0 2px var(--c), 0 0 16px color-mix(in srgb, var(--c) 70%, transparent); background: color-mix(in srgb, var(--c) 35%, rgba(0,0,0,.4)); z-index: 2; position: relative; }
/* La carte jouée vole du combattant vers sa cible */
.proj {
  --c: var(--atk); position: absolute; left: 0; top: 0; z-index: 7; pointer-events: none; display: flex; align-items: center; gap: 5px;
  padding: 5px 9px 5px 6px; border-radius: 9px; background: var(--text-on-dark); color: var(--ink-dark); font-weight: 800; font-size: var(--fs-xs); white-space: nowrap;
  border-left: 4px solid var(--c); box-shadow: 0 6px 16px rgba(0, 0, 0, .55), 0 0 18px color-mix(in srgb, var(--c) 60%, transparent);
}
.proj.defense { --c: var(--def); }
.proj.status { --c: var(--sta); }
.proj img.pxi { width: 20px; height: 20px; }



.mcard {
  --c: var(--atk); position: relative; width: var(--mc-w); height: auto; aspect-ratio: 5 / 7; flex: 0 1 auto; min-width: 0;
  transform-style: preserve-3d; transition: transform .25s, opacity .3s, filter .3s;
}
.mcard.defense { --c: var(--def); }
.mcard.status { --c: var(--sta); }
.mcard .face {
  position: absolute; inset: 0; border-radius: 6px; backface-visibility: hidden; -webkit-backface-visibility: hidden;
  border: 1.5px solid color-mix(in srgb, var(--c) 80%, #000); box-shadow: 0 3px 8px rgba(0, 0, 0, .5);
}
.mcard .front {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; padding: 2px;
  background: linear-gradient(180deg, color-mix(in srgb, var(--c) 45%, #1b1a22), #15141b);
}
.mcard .front img.pxi { width: 62%; height: auto; aspect-ratio: 1; }
.mcard .front span { font-size: calc(var(--mc-w) * .15); line-height: 1.05; font-weight: 800; text-align: center; color: var(--text-on-dark); max-width: 100%; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; word-break: break-word; }
.mcard .back {
  transform: rotateY(180deg); border-color: color-mix(in srgb, var(--card-back, var(--accent)) 70%, #000);
  background: repeating-linear-gradient(45deg, color-mix(in srgb, var(--card-back, var(--accent)) 55%, var(--ink-dark)) 0 4px, color-mix(in srgb, var(--card-back, var(--accent)) 18%, #16151c) 4px 8px);
}
.mcard.down { transform: rotateY(180deg); }


.mcard.acting { transform: translateY(-8px) scale(1.2); z-index: 3; }
.mcard.acting .front { box-shadow: 0 0 0 2px var(--c), 0 0 16px color-mix(in srgb, var(--c) 75%, transparent); }
.mcard.used { opacity: .35; filter: grayscale(.6); }
.played { min-height: 22px; justify-content: center; flex-wrap: wrap; gap: 3px; display: none; }
/* Légende du round : en haut de l'arène, à la place du numéro de round */
.caption { opacity: 0; pointer-events: none; text-align: center; font-weight: 600; font-size: clamp(.74rem, 1.8dvh, .95rem); color: var(--text-on-dark); border: 1px solid color-mix(in srgb, var(--accent) 45%, transparent); background: rgba(8, 7, 10, .82); border-radius: 10px; padding: 6px 12px; width: max-content; z-index: 6; transform: translateX(-50%); left: 50%; position: absolute; top: 6px; bottom: auto; max-width: min(74%, 560px); }

.arena:has(.caption.on) .arena-tag { opacity: 0; }
@media (max-width: 1023px) { .caption { font-size: var(--fs-xs); padding: 5px 9px; } }
.arena:has(.caption.on) .intent { opacity: 0; transition: opacity .2s; }
.board, .board * { pointer-events: none; }
/* ===== V7 : mise en page des cartes, main ajustée, pastilles du joueur ===== */
