/*
 * Scène de combat unifiée — « La Dragonnerie »
 * Rendu partagé (replay / combat direct / raid) : portraits face à face, barres de PV/ressource,
 * pastilles de statut, couche FX (nombres flottants, tremblé, halo), journal synchronisé.
 * Extrait de rejouage-cine.css (incrément 1b) — préfixes .rjc- CONSERVÉS pour ne rien casser.
 * Aucune dépendance : polices système, emojis, dégradés (pas d'image bitmap).
 */

/* ---------- Scène ---------- */
.rjc-stage {
  position: relative; height: 210px; overflow: hidden;
  background: radial-gradient(120% 130% at 50% 8%, #3a2c14 0%, #241809 60%, #140c05 100%);
  display: flex; align-items: center; justify-content: space-between; padding: 0 34px;
}
.rjc-stage-veil { position: absolute; left: 0; right: 0; bottom: 0; height: 70px; background: linear-gradient(180deg, rgba(0,0,0,0), rgba(0,0,0,.5)); }

.rjc-side { display: flex; align-items: center; gap: 14px; z-index: 4; width: 340px; }
.rjc-side.right { flex-direction: row-reverse; }
.rjc-info { flex: 1; }
.rjc-info.right { text-align: right; }

.rjc-portrait {
  width: 84px; height: 84px; border-radius: 16px; flex: none;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 6px 16px rgba(0, 0, 0, .5); overflow: hidden;
}
.rjc-portrait .ini { font-size: 38px; text-shadow: 0 0 7px rgba(255, 236, 190, .55), 0 0 2px rgba(255, 236, 190, .9); } /* halo : glyphes de créature lisibles */
.rjc-portrait img { width: 100%; height: 100%; object-fit: cover; }
.rjc-portrait.l { background: radial-gradient(circle at 35% 30%, #7a2b24, #2a0f0c); border: 2px solid #c05a4f; }
.rjc-portrait.l .ini { color: #f0c9a0; }
.rjc-portrait.r { background: radial-gradient(circle at 35% 30%, #6a5a2c, #241a08); border: 2px solid #e3b768; }
.rjc-portrait.r .ini { color: #f0dca0; }

.rjc-portrait-wrap { position: relative; flex: none; }
.rjc-token {
  position: absolute; bottom: -9px; right: -12px; width: 36px; height: 36px; border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #4a4038, #15120c); border: 2px solid #8a7d63;
  display: flex; align-items: center; justify-content: center; font-size: 12px; color: #d8cdb0; z-index: 2;
}

.rjc-name { font-size: 18px; }
.rjc-name.l { color: #f0c9a0; }
.rjc-name.r { color: #f0dca0; }
.rjc-role { font-size: 11px; }
.rjc-role.l { color: #b98f6a; }
.rjc-role.r { color: #b8a06a; }
.rjc-role .sub { color: #8a7d63; }

/* Badge d'aggro (raid) : « qui tient l'aggro » sur un ennemi. Discret, doré, aligné comme le rôle. */
.rjc-aggro { font-size: .72rem; color: var(--or-fonce, #8a6d2f); font-weight: 600; margin-top: 2px; }
.rjc-aggro.r { text-align: right; }

.rjc-hp-row { display: flex; justify-content: space-between; font-size: 10.5px; color: #c8b483; margin: 7px 0 3px; }

.rjc-bar { height: 13px; border-radius: 7px; background: #20160a; border: 1px solid #4a3418; overflow: hidden; box-shadow: inset 0 1px 3px rgba(0,0,0,.6); }
.rjc-bar .fill { height: 100%; transition: width .5s ease; }
.rjc-bar.hp.l .fill { background: linear-gradient(90deg, #e0776a, #b83a2e); box-shadow: 0 0 10px rgba(224,119,106,.5); }
.rjc-bar.hp.r .fill { background: linear-gradient(90deg, #5ca86a, #2e7c3e); box-shadow: 0 0 10px rgba(92,168,106,.4); margin-left: auto; }

.rjc-gauge { height: 5px; border-radius: 4px; background: #20160a; margin-top: 4px; overflow: hidden; }
.rjc-gauge .fill { height: 100%; transition: width .5s ease; }
.rjc-gauge.l .fill { background: linear-gradient(90deg, #6fa8d0, #3f6f9e); }
.rjc-gauge.r .fill { background: linear-gradient(90deg, #c9a24a, #8a6d2f); margin-left: auto; }

.rjc-pills { display: flex; gap: 5px; margin-top: 8px; min-height: 19px; }
.rjc-pills.right { justify-content: flex-end; }
.rjc-pill { font-size: 10px; padding: 2px 7px; border-radius: 10px; white-space: nowrap; }
.rjc-pill.stun { background: rgba(125,182,224,.15); border: 1px solid #3f6f9e; color: #9cc3e6; }
.rjc-pill.cage { background: rgba(233,138,192,.12); border: 1px solid #96486f; color: #d98ac0; }
.rjc-pill.rem  { background: rgba(201,162,74,.14); border: 1px solid #8a6d2f; color: #e3b768; }
.rjc-pill.gen  { background: rgba(201,162,74,.10); border: 1px solid #6b4c22; color: #cdb98a; }

.rjc-clash { font-size: 24px; opacity: .5; z-index: 4; }

/* ---------- Couche FX (nombres flottants) ---------- */
.rjc-fx { position: absolute; inset: 0; pointer-events: none; z-index: 8; }
.rjc-float { position: absolute; top: 34%; transform: translateX(-50%); text-align: center; pointer-events: none; }
.rjc-float .crit-tag { font-size: 13px; font-weight: 700; color: #ffcf6a; letter-spacing: 1.5px; text-shadow: 0 2px 6px rgba(0,0,0,.8); animation: rjc-floatUp 1.15s ease forwards;
  font-family: "Palatino Linotype", "Book Antiqua", Palatino, Georgia, serif; }
.rjc-float .devie-tag { font-size: 11px; font-weight: 700; color: #b9ac86; letter-spacing: .8px; text-shadow: 0 2px 6px rgba(0,0,0,.8); animation: rjc-floatUp 1.15s ease forwards;
  font-family: "Palatino Linotype", "Book Antiqua", Palatino, Georgia, serif; font-style: italic; }
.rjc-float .amount { font-size: 40px; font-weight: 700; text-shadow: 0 3px 12px rgba(0,0,0,.85); animation: rjc-floatUp 1.15s ease forwards;
  font-family: "Palatino Linotype", "Book Antiqua", Palatino, Georgia, serif; }
.rjc-float.crit .amount { font-size: 52px; }
.rjc-float.devie .amount { font-size: 34px; opacity: .82; }

/* Marqueur textuel crit / coup dévié dans le journal cinématique (à côté du titre d'action). */
.rjc-issue { margin-left: 6px; font-size: 10.5px; font-weight: 800; letter-spacing: .6px; text-transform: uppercase; white-space: nowrap; }
.rjc-issue.crit { color: #ffcf6a; }
.rjc-issue.crit::before { content: "✦ "; }
.rjc-issue.devie { color: #a99a72; font-weight: 700; letter-spacing: .3px; text-transform: none; font-style: italic; }

/* ---------- Journal synchronisé ---------- */
/* position:relative = INDISPENSABLE : sans lui, `row.offsetTop` (auto-scroll) est mesuré depuis le
   haut de la page (offsetParent=body) et non depuis le journal → le défilement saute à un mauvais tour. */
.rjc-journal { position: relative; height: 440px; overflow-y: auto; padding: 16px 22px 34px; background: linear-gradient(180deg, #1c1408, #160f07); }
.rjc-turn-sep { font-size: 11px; letter-spacing: 1.5px; text-transform: uppercase; color: #8a6d2f; margin: 16px 0 9px; display: flex; align-items: center; gap: 9px; }
.rjc-turn-sep:first-child { margin-top: 0; }
.rjc-turn-sep .rule { flex: 1; height: 1px; background: linear-gradient(90deg, #4a3418, transparent); }

.rjc-row {
  display: flex; gap: 12px; padding: 11px 14px; border-radius: 10px;
  border: 1px solid transparent; border-left: 3px solid transparent; background: transparent;
  opacity: .32; margin-bottom: 7px;
  transition: opacity .25s ease, background .25s ease, border-color .25s ease;
}
.rjc-row.past { opacity: .5; }
.rjc-row.cur {
  opacity: 1; padding-left: 11px; border: 1px solid #e3b768; border-left: 3px solid #e3b768;
  background: rgba(227, 183, 104, .10);
}
.rjc-row .ic { font-size: 18px; line-height: 1.2; }
.rjc-row .body { flex: 1; }
.rjc-row .ttl { font-size: 15px; font-weight: 700; color: #cdbb90; }
.rjc-row.cur .ttl { color: #f4e6bf; }
.rjc-row .notes { font-size: 12px; color: #9c8552; margin-top: 3px; }
.rjc-row .human { font-size: 11px; color: #6f5a30; align-self: flex-start; }

/* teinte de titre par catégorie (lignes futures/passées) */
.rjc-row.k-buff .ttl { color: #8fd0a0; }
.rjc-row.k-cast .ttl { color: #e8a24a; }
.rjc-row.k-atk  .ttl { color: #e0776a; }
.rjc-row.k-heal .ttl { color: #7ee08a; }
.rjc-row.k-stun .ttl { color: #8fb8e0; }
.rjc-row.k-ko   .ttl { color: #e3b768; }
.rjc-row.cur .ttl { color: #f4e6bf; }

/* ---------- Animations de scène ---------- */
@keyframes rjc-floatUp {
  0%   { transform: translate(-50%, 6px) scale(.6); opacity: 0; }
  15%  { opacity: 1; transform: translate(-50%, -4px) scale(1.12); }
  45%  { transform: translate(-50%, -22px) scale(1); }
  100% { transform: translate(-50%, -60px) scale(.92); opacity: 0; }
}
@keyframes rjc-shakeX {
  0%, 100% { transform: translateX(0); }
  18% { transform: translateX(-7px); }
  36% { transform: translateX(7px); }
  54% { transform: translateX(-5px); }
  72% { transform: translateX(5px); }
  88% { transform: translateX(-2px); }
}
.rjc-shake { animation: rjc-shakeX .42s ease; }
@keyframes rjc-shakeCrit {
  0%, 100% { transform: translate(0, 0); }
  12% { transform: translate(-11px, 3px); }
  26% { transform: translate(11px, -3px); }
  40% { transform: translate(-9px, 2px); }
  54% { transform: translate(9px, -2px); }
  70% { transform: translate(-5px, 1px); }
  86% { transform: translate(4px, 0); }
}
.rjc-shake-crit { animation: rjc-shakeCrit .5s cubic-bezier(.36,.07,.19,.97); }
@keyframes rjc-glowDmg {
  0%   { box-shadow: 0 6px 18px rgba(0,0,0,.5); }
  40%  { box-shadow: 0 0 0 3px rgba(224,90,74,.85), 0 0 26px rgba(224,90,74,.7); }
  100% { box-shadow: 0 6px 18px rgba(0,0,0,.5); }
}
@keyframes rjc-glowHeal {
  0%   { box-shadow: 0 6px 18px rgba(0,0,0,.5); }
  40%  { box-shadow: 0 0 0 3px rgba(126,224,138,.85), 0 0 26px rgba(126,224,138,.6); }
  100% { box-shadow: 0 6px 18px rgba(0,0,0,.5); }
}
.rjc-glow-dmg { animation: rjc-glowDmg .55s ease; }
.rjc-glow-heal { animation: rjc-glowHeal .55s ease; }

@media (prefers-reduced-motion: reduce) {
  .rjc-shake, .rjc-shake-crit, .rjc-glow-dmg, .rjc-glow-heal, .rjc-float .amount, .rjc-float .crit-tag { animation: none !important; }
  .rjc-bar .fill, .rjc-gauge .fill { transition: none; }
}

/* ---------- Mode combat direct / raid : camps en COLONNES de N cartes ---------- */
/* N'affecte QUE .rjc-stage.multi (combat/raid) ; le replay (.rjc-stage sans .multi) est intact. */
.rjc-stage.multi { height: auto; align-items: stretch; padding: 18px 30px; }
.rjc-camp { display: flex; flex-direction: column; gap: 12px; width: 340px; z-index: 4; }
.rjc-camp.right { align-items: flex-end; }
.rjc-camp .rjc-side { width: 100%; }
.rjc-portrait.petit { width: 44px; height: 44px; border-radius: 12px; }
.rjc-portrait.petit .ini { font-size: 19px; }
/* tag « toi / ennemi » près du nom */
.rjc-tag { font-size: 9px; letter-spacing: .12em; text-transform: uppercase; color: #8c7c5e;
  border: 1px solid #5a4527; border-radius: 7px; padding: 1px 6px; margin-left: 7px; vertical-align: middle; }
/* combattant tombé */
.rjc-side.vaincu, .rjc-tile.vaincu { opacity: .4; filter: grayscale(.7); }
/* cible cliquable (ciblage au clic) */
.rjc-side.ciblable, .rjc-tile.ciblable { cursor: pointer; }
.rjc-side.ciblable .rjc-portrait,
.rjc-tile.ciblable .rjc-portrait { box-shadow: 0 0 0 3px rgba(227,183,104,.9), 0 6px 16px rgba(0,0,0,.5); }

/* ---------- Invocations : grille de tuiles compactes (mode multi) ---------- */
/* Une horde (squelettes du Nécromancien, bêtes…) occupait N grandes cartes empilées → scène illisible.
   Ici : tuiles enroulées (portrait + nom réduit + fin liseré de PV) ; l'état détaillé reste au journal. */
.rjc-summons { display: flex; flex-wrap: wrap; gap: 9px 10px; width: 100%; margin-top: 6px; }
.rjc-summons.right { justify-content: flex-end; }
.rjc-tile { display: flex; flex-direction: column; align-items: center; gap: 4px; width: 62px; }
.rjc-tile .rjc-portrait-wrap { flex: none; }
.rjc-tile-corps { display: flex; flex-direction: column; align-items: center; gap: 3px; width: 100%; }
.rjc-tile-nom { font-size: 11px; line-height: 1.15; color: #cdb98a; text-align: center; max-width: 62px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rjc-bar.hp.mini { height: 6px; width: 54px; border-radius: 4px; }
.rjc-tile .rjc-pills { min-height: 0; margin-top: 0; justify-content: center; flex-wrap: wrap; gap: 3px; }
.rjc-tile .rjc-pill { font-size: 9px; padding: 1px 5px; }
/* Repli « meute » : au-delà du plafond de tuiles, un jeton d'agrégat « +N de plus ». */
.rjc-tile.meute { justify-content: center; gap: 2px; align-self: center; min-height: 44px;
  border: 1px dashed #6b4c22; border-radius: 12px; padding: 4px 8px; }
.rjc-meute-n { font-size: 17px; font-weight: 700; color: #e3b768; }
.rjc-meute-lbl { font-size: 9px; letter-spacing: .1em; text-transform: uppercase; color: #8c7c5e; }

/* ---------- Responsive : scène en pile ---------- */
@media (max-width: 720px) {
  .rjc-stage { height: auto; flex-direction: column; gap: 14px; padding: 20px 16px; }
  /* Les camps du combat direct/raid (.rjc-camp, 340px fixes) DOIVENT repasser pleine largeur ici,
     sinon ils débordent l'écran (~340px > viewport étroit) → sur iOS Safari, ce débordement
     dilate le viewport et casse TOUS les points de rupture (nav non repliée, page en demi-largeur). */
  .rjc-camp { width: 100%; min-width: 0; }
  .rjc-side { width: 100%; }
  .rjc-side.right { flex-direction: row; }
  .rjc-info.right { text-align: left; }
  .rjc-bar.hp.r .fill, .rjc-gauge.r .fill { margin-left: 0; }
  .rjc-pills.right { justify-content: flex-start; }
  .rjc-clash { display: none; }
  .rjc-float { top: 10%; }
  .rjc-journal { height: 60vh; }
}
