/* PvE battle — full-screen visual treatment based on the PvP presentation. */
#modal-layer:has(.pve-battle-screen){
  padding:0;
  background:#101820 url('assets/bg.png') center/cover fixed no-repeat;
}

.dialog.pve-battle-screen{
  --pve-cyan:#1fe0f2;
  position:relative;
  width:min(100vw, calc(100dvh * .5628));
  height:min(100dvh, calc(100vw * 1.7778));
  max-width:none;
  max-height:none;
  padding:0;
  overflow:hidden;
  border:0;
  border-radius:0;
  color:#07386a;
  background:url('assets/battle/pve-forest-arena-v1.png') center/cover no-repeat;
  box-shadow:0 0 36px rgba(0,0,0,.5);
}

.pve-battle-screen::after{
  content:"";
  pointer-events:none;
  position:absolute;
  inset:0;
  background:linear-gradient(180deg,rgba(0,76,132,.18),transparent 22%,transparent 68%,rgba(0,38,66,.42));
}

.pve-battle-title{
  position:absolute;
  z-index:3;
  top:4.1%;
  left:14%;
  width:72%;
  min-height:5.8%;
  display:flex;
  align-items:center;
  justify-content:center;
  gap:9px;
  box-sizing:border-box;
  padding:5px 12px;
  border:2px solid #bffcff;
  border-radius:999px;
  background:linear-gradient(180deg,rgba(23,194,218,.94),rgba(0,112,171,.94));
  color:#fff;
  font:700 clamp(1.05rem,4.9vw,1.55rem)/1 Rajdhani,Sarabun,sans-serif;
  white-space:nowrap;
  text-shadow:0 2px 1px #075795;
  box-shadow:0 4px 10px rgba(0,64,107,.34),inset 0 1px 8px rgba(255,255,255,.35);
}
.pve-battle-title span{font-size:1.15em}

.pve-huds{
  position:absolute;
  z-index:3;
  top:11.7%;
  left:2.4%;
  right:2.4%;
  display:grid;
  grid-template-columns:1fr 1fr;
  gap:2%;
}
.pve-hud{
  min-width:0;
  height:clamp(82px,13dvh,112px);
  box-sizing:border-box;
  display:grid;
  grid-template-columns:29% 1fr;
  grid-template-rows:auto auto auto auto;
  align-items:center;
  column-gap:7px;
  padding:7px 8px 0;
  border:2px solid rgba(207,255,255,.98);
  border-radius:15px;
  background:linear-gradient(135deg,rgba(238,255,255,.94),rgba(160,238,249,.88));
  box-shadow:0 4px 12px rgba(0,80,125,.3),inset 0 0 10px #fff;
}
.pve-hud-art{grid-column:1;grid-row:1/4;width:100%;max-width:64px;aspect-ratio:1;height:auto;box-sizing:border-box;object-fit:contain;border:2px solid #fff;border-radius:50%;background:linear-gradient(145deg,#caffdd,#7edeca);filter:drop-shadow(0 3px 3px rgba(0,57,91,.25));box-shadow:inset 0 0 8px rgba(255,255,255,.85)}
.pve-hud-monster .pve-hud-art{transform:scaleX(-1)}
.pve-hud-info{display:contents}
.pve-hud-name{grid-column:2;grid-row:1;min-width:0;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;font-size:clamp(.84rem,3.35vw,1.04rem);font-weight:700;color:#082d5d;line-height:1}
.pve-hud-name small{font-size:.8em}
.pve-hp-line{grid-column:2;grid-row:2;margin:1px 0 0;color:#315d78;font-size:clamp(.7rem,2.85vw,.86rem);line-height:1}
.pve-hp-line b{font-weight:700;color:#082d5d}
.pve-hp-meter{grid-column:2;grid-row:3;display:flex;align-items:center;gap:4px}
.pve-hp-meter strong{min-width:27px;color:#082d5d;font-size:clamp(.63rem,2.5vw,.78rem);text-align:right}
.pve-hud .bar{flex:1;height:9px;border:1px solid rgba(255,255,255,.9);border-radius:999px;background:#aabfca;overflow:hidden}
.pve-hud .bar-fill.hp{border-radius:999px;background:linear-gradient(90deg,#0aac51,#15df75)}
.pve-hud-stats{grid-column:1/-1;grid-row:4;align-self:end;justify-self:center;width:100%;height:25px;box-sizing:border-box;display:flex;align-items:center;justify-content:center;gap:6px;margin:3px auto 0;padding:0 10px;border-top:1px solid rgba(30,119,152,.58);white-space:nowrap;text-align:center;font-size:clamp(.58rem,2.25vw,.7rem);font-weight:700;line-height:1}
.pve-hud-stats b{font-weight:700}.pve-hud-stats i{font-style:normal;color:#51738a}.pve-hud-stats .stat-str{color:#e83b42}.pve-hud-stats .stat-spd{color:#137bd4}.pve-hud-stats .stat-def{color:#138b3d}

.pve-stage{position:absolute;z-index:2;inset:27% 0 21%;}
.pve-fighter{
  position:absolute;
  width:47%;
  height:70%;
  top:16%;
  display:flex;
  align-items:flex-end;
  justify-content:center;
  filter:drop-shadow(0 13px 9px rgba(0,33,50,.35));
}
.pve-fighter-player{left:1%}
.pve-fighter-monster{right:1%}
.pve-fighter img{width:100%;height:100%;object-fit:contain;object-position:center bottom}
.pve-fighter-monster img{transform:scaleX(-1)}
.pve-stage .bt-vs{
  position:absolute;
  z-index:4;
  left:50%;
  top:48%;
  transform:translate(-50%,-50%) rotate(-5deg);
  color:#fff;
  font:700 clamp(2rem,11vw,3.35rem)/1 Rajdhani,sans-serif;
  text-shadow:0 3px 0 #087bc0,0 0 12px #36ecff,0 6px 15px rgba(0,0,0,.45);
}

.pve-log{
  position:absolute;
  z-index:4;
  left:3%;
  right:3%;
  bottom:8.5%;
  min-height:7.8%;
  box-sizing:border-box;
  display:flex;
  align-items:center;
  justify-content:center;
  margin:0;
  padding:9px 14px;
  border:2px solid #d6ffff;
  border-radius:15px;
  background:linear-gradient(135deg,rgba(235,255,255,.95),rgba(151,232,247,.93));
  color:#07366b;
  font-size:clamp(.73rem,3.35vw,1rem);
  font-weight:700;
  text-align:center;
  box-shadow:0 4px 12px rgba(0,55,90,.42),inset 0 0 9px #fff;
}
.pve-actions{position:absolute;z-index:5;left:4%;right:4%;bottom:1.7%;margin:0}
.pve-actions .btn-primary{width:100%;min-height:42px;background:linear-gradient(180deg,#ffe96b,#ffad17);color:#4b2a00;border:2px solid #fff5b3}
.pve-heals{position:absolute;z-index:5;left:4%;right:4%;bottom:17.4%;display:flex;gap:4px}
.pve-heals:empty{display:none}
.pve-heals .btn-ghost{margin:0!important;padding:7px 6px!important;background:rgba(235,255,255,.92);font-size:clamp(.62rem,2.7vw,.78rem)}

.pve-fighter.shake{animation:pve-hit .28s ease}
@keyframes pve-hit{
  0%,100%{filter:drop-shadow(0 13px 9px rgba(0,33,50,.35));transform:translateX(0)}
  30%{filter:drop-shadow(0 0 18px #fff) drop-shadow(0 0 18px #ff9b21);transform:translateX(-8px)}
  60%{transform:translateX(6px)}
}

@media (min-width:700px){
  .dialog.pve-battle-screen{border-left:1px solid rgba(255,255,255,.5);border-right:1px solid rgba(255,255,255,.5)}
}

/* End-of-battle scene: swap the arena itself, then promote the compact log into
   a proper result card. This keeps rewards and Continue in the same live dialog. */
.dialog.pve-battle-screen.pve-result{
  background-image:url('assets/battle/pve-forest-arena-v1.png');
}
.pve-result::after{
  background:linear-gradient(180deg,rgba(0,89,142,.12),transparent 24%,transparent 58%,rgba(0,55,72,.26));
}
.pve-result .pve-stage{inset:25% 0 34%}
.pve-result .pve-fighter{height:84%;top:6%}
.pve-victory .pve-fighter-player{animation:pve-winner 1.1s ease-in-out infinite alternate}
.pve-victory .pve-fighter-monster{filter:grayscale(.18) saturate(.7) drop-shadow(0 8px 6px rgba(0,33,50,.25));transform:translateY(12%) rotate(7deg) scale(.8)}
.pve-defeat .pve-fighter-player{filter:grayscale(.25) saturate(.65);transform:translateY(12%) rotate(-7deg) scale(.86)}
.pve-defeat .pve-fighter-monster{animation:pve-winner 1.1s ease-in-out infinite alternate}
.pve-result .pve-stage .bt-vs{opacity:.82;top:41%;font-size:clamp(1.75rem,9vw,2.8rem)}
@keyframes pve-winner{to{transform:translateY(-7px) scale(1.025)}}

.pve-log.pve-result-card{
  bottom:3.4%;
  min-height:29%;
  display:block;
  padding:11% 4% 10%;
  border-color:#baffff;
  border-radius:20px;
  background:
    radial-gradient(circle at 50% 3%,rgba(255,248,137,.88),transparent 29%),
    radial-gradient(ellipse at 50% 100%,rgba(157,242,255,.66),transparent 57%),
    radial-gradient(circle at 9% 17%,#fff694 0 2px,transparent 3px),
    radial-gradient(circle at 89% 20%,#fff694 0 2px,transparent 3px),
    radial-gradient(circle at 13% 82%,#fff694 0 2px,transparent 3px),
    radial-gradient(circle at 87% 84%,#fff694 0 2px,transparent 3px),
    linear-gradient(160deg,rgba(72,198,201,.98),rgba(62,185,222,.97));
  box-shadow:0 0 0 3px rgba(32,225,235,.72),0 0 18px rgba(83,255,239,.65),0 7px 18px rgba(0,55,69,.4),inset 0 0 25px rgba(255,255,255,.95);
}
.pve-victory .pve-result-card::before,.pve-victory .pve-result-card::after{content:'❧';position:absolute;z-index:0;top:2%;color:#d7e979;font-size:clamp(3.4rem,15vw,4.8rem);line-height:1;opacity:.72;text-shadow:0 0 8px #fff7a0}
.pve-victory .pve-result-card::before{left:16%;transform:rotate(-54deg)}
.pve-victory .pve-result-card::after{right:16%;transform:scaleX(-1) rotate(-54deg)}
.pve-defeat .pve-log.pve-result-card{
  background:linear-gradient(145deg,rgba(232,244,255,.97),rgba(151,189,220,.95));
  box-shadow:0 0 0 3px rgba(104,183,228,.65),0 7px 18px rgba(0,40,70,.42),inset 0 0 22px rgba(255,255,255,.9);
}
.pve-result-heading{
  position:absolute;
  z-index:2;
  top:-1%;
  left:4%;
  right:4%;
  display:flex;
  flex-direction:column;
  align-items:center;
  color:#fff;
  text-shadow:0 3px 0 #a85b00,0 0 10px #fff5a3,0 5px 12px rgba(80,45,0,.35);
}
.pve-result-heading span{font-size:clamp(2.2rem,10vw,3rem);line-height:.72;filter:drop-shadow(0 0 7px #fff7a0)}
.pve-result-heading strong{font:700 clamp(2.2rem,10.5vw,3.25rem)/1 Rajdhani,Sarabun,sans-serif;color:#fff7a4;-webkit-text-stroke:1px #b76700}
.pve-defeat .pve-result-heading{filter:saturate(.45);text-shadow:0 3px 0 #405571,0 0 8px #fff}
.pve-defeat .pve-result-heading strong{color:#eef7ff;-webkit-text-stroke:1px #405571}
.pve-result-rewards{
  position:absolute;
  z-index:1;
  top:38%;
  left:3%;
  right:3%;
  height:31%;
  box-sizing:border-box;
  display:flex;
  align-items:center;
  justify-content:space-around;
  padding:3px 5%;
  border:2px solid rgba(255,255,255,.92);
  border-radius:14px;
  background:linear-gradient(135deg,rgba(218,248,246,.96),rgba(174,228,235,.94));
  color:#08396b;
  font-size:clamp(.96rem,4.2vw,1.28rem);
  font-weight:700;
  box-shadow:inset 0 0 12px rgba(255,255,255,.8);
}
.pve-victory .pve-result-rewards::before,.pve-victory .pve-result-rewards::after{content:'❧';position:absolute;bottom:-5%;color:#36a77e;font-size:clamp(2.6rem,11vw,3.6rem);opacity:.2;pointer-events:none}
.pve-victory .pve-result-rewards::before{left:1%;transform:rotate(-24deg)}
.pve-victory .pve-result-rewards::after{right:1%;transform:scaleX(-1) rotate(-24deg)}
.pve-result-rewards>i{width:1px;height:55%;background:rgba(20,87,112,.34)}
.pve-result-reward{display:flex;align-items:center;justify-content:center;gap:6px;min-width:38%}
.pve-result-reward img{width:clamp(32px,9vw,44px);height:clamp(32px,9vw,44px);object-fit:contain;filter:drop-shadow(0 2px 2px rgba(112,65,0,.25))}
.pve-drop-text{min-width:0!important;max-width:48%;flex-direction:column;gap:1px;font-size:clamp(.67rem,2.8vw,.86rem);line-height:1.12}
.pve-drop-text small{color:#218c67;font-size:.78em;letter-spacing:.12em}
.pve-drop-text b{display:-webkit-box;overflow:hidden;-webkit-box-orient:vertical;-webkit-line-clamp:3;white-space:normal}
.pve-defeat-copy{justify-content:center;gap:5px}
.pve-result .pve-actions{left:16%;right:16%;bottom:5.2%}
.pve-result .pve-actions .btn-primary{
  min-height:47px;
  border:3px solid #fff1a3;
  border-radius:999px;
  background:linear-gradient(180deg,#ffce45,#f48605);
  color:#fff;
  font-size:clamp(1rem,4.5vw,1.35rem);
  text-shadow:0 2px 1px #9f4c00;
  box-shadow:0 0 0 3px #ffb20c,0 5px 12px rgba(105,52,0,.35),inset 0 2px 6px rgba(255,255,255,.55);
}
.pve-victory .pve-actions .btn-primary::before,.pve-victory .pve-actions .btn-primary::after{content:'❧';position:absolute;color:#ffd965;font-size:1.2em;opacity:.8}
.pve-victory .pve-actions .btn-primary::before{left:10%;transform:rotate(-30deg)}
.pve-victory .pve-actions .btn-primary::after{right:10%;transform:scaleX(-1) rotate(-30deg)}
/* Element badge (element.js) — inline before a fighter name. Overrides .ow-battle-card img's avatar styling. */
.el-badge,.ow-battle-card img.el-badge{display:inline-block;width:1.15em;height:1.15em;margin:0 .22em -.18em 0;padding:0;border:0;border-radius:0;background:none;object-fit:contain;vertical-align:baseline;grid-row:auto;align-self:auto;filter:drop-shadow(0 1px 1px #0005)}
/* Dino Overlord's Boss Summon Crystal (10% per win) — a third column in the reward row */
.pve-summon-drop{min-width:0!important;max-width:30%;flex-direction:column;gap:1px;color:#5a2390;font-size:clamp(.6rem,2.5vw,.78rem);line-height:1.1;text-align:center}
.pve-summon-drop small{color:#8b47c9;font-size:.85em;letter-spacing:.12em}
.pve-result-reward.pve-summon-drop img{width:clamp(26px,7.5vw,36px);height:clamp(26px,7.5vw,36px)}
.pve-summon-drop.full b{color:#b02a4a}
.pve-result-rewards:has(.pve-summon-drop) .pve-drop-text{max-width:36%}
.pve-result-rewards:has(.pve-summon-drop) .pve-result-reward:first-child{min-width:0}
