/* L'écran de combat (js/combat.js), à la manière des jeux Pokémon, dans la direction artistique de l'abri.
   --teinte : la couleur du type de l'arène (ou du légendaire), qui colore le terrain et les socles. */

html .arene-combat h2 { margin: 0 0 10px; }

/* La scène : un ciel clair, un terrain teinté, deux socles ovales. */
html .scene-combat {
  position: relative;
  width: min(100%, calc(56vh * 1.6));
  aspect-ratio: 16 / 10;
  margin: 0 auto;
  overflow: hidden;
  border: 4px solid var(--da-encre);
  border-radius: 18px;
  box-shadow: 0 6px 0 var(--da-encre);
  /* Le fond peint du type de l'arène ; en dessous, un ciel et un terrain teintés au cas où l'image manque. */
  background:
    var(--fond) center 45% / cover no-repeat,
    linear-gradient(180deg, #9fd6fb 0%, #dcf1ff 42%, color-mix(in srgb, var(--teinte) 22%, #d6eeb0) 42%, color-mix(in srgb, var(--teinte) 34%, #9ccc6a) 100%);
}
/* Les socles : des dalles claires posées sur le sol peint, au bord légèrement teinté et ombré. */
html .socle {
  position: absolute;
  border-radius: 50%;
  background: radial-gradient(closest-side, rgba(255, 252, 240, 0.78) 0 52%, color-mix(in srgb, var(--teinte) 30%, rgba(225, 214, 186, 0.85)) 78%, rgba(40, 30, 20, 0.35) 96%, transparent 100%);
  filter: drop-shadow(0 4px 3px rgba(0, 0, 0, 0.25));
}
html .socle-lui { left: 54%; top: 37%; width: 40%; height: 14%; }
html .socle-moi { left: -6%; bottom: 2%; width: 60%; height: 19%; }

/* Chaque combattant est un point posé au centre de son socle ; son sprite s'y tient debout. */
html .combattant { position: absolute; width: 0; height: 0; }
html .combattant.lui { left: 74%; top: 45%; }
html .combattant.moi { left: 24%; top: 89%; }
/* La position (left, top) et l'origine du zoom du sprite sont réglées par js/combat.js sur les pieds du Pokémon. */
html .combattant .sprite { position: absolute; background-repeat: no-repeat; image-rendering: pixelated; }
html .combattant .sprite.portrait-seul .portrait { display: block; border: 4px solid var(--da-encre); border-radius: 50%; }

/* Les animations : l'entrée en scène, l'élan de l'attaque, le coup encaissé, le K.O. */
html .combattant.arrive { animation: entree-combat 0.55s cubic-bezier(.3, 1.4, .5, 1); }
@keyframes entree-combat { 0% { transform: scale(0); filter: brightness(4); } 70% { filter: brightness(1.6); } 100% { transform: scale(1); filter: none; } }
html .combattant.moi.elan { animation: elan-moi 0.45s ease-out; }
html .combattant.lui.elan { animation: elan-lui 0.45s ease-out; }
@keyframes elan-moi { 40% { transform: translate(34px, -22px); } }
@keyframes elan-lui { 40% { transform: translate(-30px, 18px); } }
html .combattant.touche .sprite { animation: clignote 0.5s steps(1); }
html .combattant.touche { animation: secousse 0.4s; }
@keyframes clignote { 0%, 40%, 80% { opacity: 0.15; } 20%, 60%, 100% { opacity: 1; } }
@keyframes secousse { 25% { transform: translateX(-6px); } 50% { transform: translateX(6px); } 75% { transform: translateX(-3px); } }
html .combattant.ko { animation: tombe 0.7s ease-in forwards; }
@keyframes tombe { to { transform: translateY(40px); opacity: 0; } }

/* Les dégâts s'envolent au-dessus de la cible. */
html .degats {
  position: absolute;
  left: 0;
  bottom: 70px;  /* remplacé par js/combat.js : juste au-dessus du corps */
  transform: translateX(-50%);
  color: #fff;
  font: 700 26px var(--da-titres);
  -webkit-text-stroke: 5px var(--da-encre);
  paint-order: stroke fill;
  white-space: nowrap;
  pointer-events: none;
  animation: envol 1.1s ease-out forwards;
  z-index: 3;
}
html .degats.super { color: var(--da-jaune); font-size: 32px; }
html .degats.faible { color: #c9cdd6; font-size: 20px; }
@keyframes envol { 0% { opacity: 0; transform: translate(-50%, 10px) scale(0.6); } 20% { opacity: 1; transform: translate(-50%, 0) scale(1.15); } 100% { opacity: 0; transform: translate(-50%, -34px) scale(1); } }

/* Les fiches : l'adversaire en haut à gauche, la nôtre en bas à droite, avec leur barre de PV. */
html .fiche {
  position: absolute;
  z-index: 2;
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: baseline;
  gap: 3px 12px;
  min-width: 36%;
  padding: 8px 14px 10px;
  background: var(--da-creme);
  border: 3px solid var(--da-encre);
  border-radius: 14px;
  box-shadow: 0 5px 0 var(--da-encre);
}
html .fiche[hidden] { display: none; }
html .fiche-lui { left: 4%; top: 6%; }
html .fiche-moi { right: 4%; bottom: 7%; }
html .fiche .nom { font: 700 clamp(14px, 2.1vw, 20px) var(--da-titres); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
html .fiche .niveau { font: 400 13px var(--da-chiffres); }
html .fiche .pv { grid-column: 1 / -1; display: flex; align-items: center; gap: 6px; }
html .fiche .pv span { padding: 0 5px; background: var(--da-jaune); border: 2px solid var(--da-encre); border-radius: 6px; font: 400 10px var(--da-chiffres); }
html .fiche .pv div { flex: 1; height: 11px; background: #3a3a4a; border: 2px solid var(--da-encre); border-radius: 6px; overflow: hidden; }
html .fiche .pv i { display: block; height: 100%; transition: width 0.6s ease, background-color 0.3s; }
html .fiche .pv i.bon { background: #3BC65A; }
html .fiche .pv i.moyen { background: #F2B200; }
html .fiche .pv i.faible { background: #E3350D; }
html .fiche .chiffres { grid-column: 1 / -1; text-align: right; font: 400 13px var(--da-chiffres); }

/* Les Poké Balls de chaque équipe : grises une fois le Pokémon K.O. */
html .balles { position: absolute; z-index: 2; display: flex; gap: 4px; }
html .balles-lui { left: 5%; top: 30%; }
html .balles-moi { right: 5%; bottom: 33%; }
html .balles i {
  width: 14px;
  height: 14px;
  border: 2px solid var(--da-encre);
  border-radius: 50%;
  background: linear-gradient(180deg, var(--da-accent) 0 44%, var(--da-encre) 44% 56%, #fff 56%);
}
html .balles i.ko { filter: grayscale(1); opacity: 0.45; }

/* La boîte de texte du combat. */
html .boite-texte {
  width: min(100%, calc(56vh * 1.6));
  min-height: 70px;
  margin: 12px auto 0;
  padding: 10px 16px;
  background: #fff;
  border: 4px solid var(--da-encre);
  border-radius: 14px;
  box-shadow: inset 0 0 0 3px #dfe3ea, 0 5px 0 var(--da-encre);
  font: 500 16px / 1.35 var(--da-texte);
}
html .boite-texte p { margin: 2px 0; }
html .boite-texte .titre { color: var(--da-accent-fonce); font-family: var(--da-titres); font-weight: 700; }
html .boite-texte .effet { font-weight: 700; }
html .boite-texte .moi { color: #2E7D32; }
html .boite-texte .lui { color: var(--da-accent-fonce); }
html .boite-texte.bilan { max-height: 30vh; overflow-y: auto; }
html .arene-combat .actions { justify-content: center; }

@media (max-width: 600px) {
  html .scene-combat { aspect-ratio: 1 / 1; }
  html .fiche { min-width: 44%; padding: 4px 8px 6px; gap: 2px 8px; border-radius: 12px; }
  html .fiche .nom { font-size: 13px; }
  html .fiche .pv div { height: 9px; }
  html .fiche .niveau, html .fiche .chiffres { font-size: 11px; }
  html .socle-lui { top: 36%; }
  html .boite-texte { font-size: 14px; }
}
