/* Keep the original monster icon and keep its click target still when pressed. */
.location-trial .encounter-preview,
.location-trial .encounter-preview:hover,
.location-trial .encounter-preview:active{transform:translate(-50%,-50%);touch-action:manipulation}

/* Combat preview: keep the portrait in the middle and grow equipped items to Victor's left. */
.battle-focused #combatData{container:combat / inline-size;display:flex;flex-direction:column;gap:4px}
.battle-focused #combatData>div,.battle-focused #combatData>details{flex-shrink:0}
.battle-focused .battle-title h2{margin-bottom:12px}
.battle-focused .battle-opponents{width:100%;max-width:1000px;grid-template-columns:minmax(0,1fr) 116px minmax(0,1fr);gap:20px;align-items:center;margin:0 auto 4px}
.battle-focused .enemy-portrait:not(.mill-group){width:116px;height:116px;align-self:center}
.battle-focused .hero-combatant{display:flex;flex-direction:column;align-items:center;min-width:0}
.battle-focused .hero-status{width:100%}
.battle-focused .battle-gear{position:static;order:initial;display:grid;grid-template-columns:repeat(auto-fit,68px);justify-content:center;gap:12px;width:100%;max-width:228px;margin:10px 0 0}
.battle-focused .gear-slot{width:68px;min-width:0}
.battle-focused .gear-picture{height:66px}
.battle-focused .gear-name{margin:5px 0;font-size:12px}
.battle-focused .gear-values{gap:6px}
.battle-focused .gear-values>strong{font-size:19px}
.battle-focused .gear-absorption{width:23px;height:28px}
.battle-focused .gear-absorption b{font-size:13px}
.battle-focused .gear-durability{margin:6px 2px}
.battle-focused .battle-rolls{width:100%;max-width:620px;margin:2px auto 0}
.battle-focused .roll-side{padding:4px 8px 8px}
.battle-focused .roll-equation b{display:inline-block;font-size:26px;font-weight:600;color:#c7c9b7;line-height:1.15;padding:3px 7px}
.battle-focused .roll-winner .roll-equation b{font-size:38px;font-weight:750;color:#ffe1a0;text-shadow:0 0 20px #dfb57345;background:#dfb57316;border:1px solid #dfb57365;border-radius:6px}
.battle-focused .roll-winner .roll-owner{color:#ffe1a0}
.battle-focused .battle-outcome{margin:auto 0 0;padding:10px 12px;background:#10160e9c}
.battle-focused .battle-outcome strong{font-size:23px}
.battle-focused .battle-outcome span{line-height:1.5}
.battle-focused .damage-table{margin:0 0 8px;border-top:0}
.battle-focused .damage-table summary{min-height:36px}
.battle-focused .actions small{line-height:1.45}
@container combat (min-width:850px){
 .battle-focused .hero-combatant{display:grid;grid-template-columns:minmax(min(215px,55%),1fr) minmax(0,1fr);gap:20px;align-items:center}
 .battle-focused .hero-status{grid-column:2;grid-row:1}
 .battle-focused .battle-gear{grid-column:1;grid-row:1;margin:0;justify-self:start}
}
@container combat (max-width:550px){
 .battle-focused .battle-opponents{grid-template-columns:minmax(0,1fr) 92px minmax(0,1fr);gap:8px;align-items:start}
 .battle-focused .enemy-portrait:not(.mill-group){width:92px;height:92px;margin-top:14px}
 .battle-focused .battle-gear{grid-template-columns:repeat(2,48px);gap:6px;margin-top:8px;max-width:102px}
 .battle-focused .gear-slot{width:48px}
 .battle-focused .gear-picture{height:47px}
 .battle-focused .gear-values{gap:3px}
 .battle-focused .gear-values>strong{font-size:16px}
 .battle-focused .gear-absorption{width:18px;height:23px}
 .battle-focused .gear-absorption b{font-size:11px}
 .battle-focused .gear-name{font-size:11px}
 .battle-focused .battle-rolls{grid-template-columns:minmax(0,1fr) 40px minmax(0,1fr)}
 .battle-focused .roll-winner .roll-equation b{font-size:31px}
 .battle-focused .roll-equation b{font-size:23px}
 .battle-focused .battle-outcome{padding:8px 5px}
 .battle-focused .battle-outcome strong{font-size:21px}
}
/* The current hit stays next to the choices, including on short screens. */
#battleRecap{flex-shrink:0}
#battleRecap[hidden]{display:none}
.battle-focused #battleRecap .battle-outcome{margin:8px 0 0}
@container combat (max-width:550px){
 .battle-focused .battle-title>.eyebrow{display:none}
 .battle-focused .battle-title h2{margin:2px 0 8px}
 .battle-focused .gear-picture{height:42px}
 .battle-focused .gear-name{margin:3px 0}
 .battle-focused .gear-durability{margin:3px 2px}
 .battle-focused .poly-die{width:52px;height:62px}
 .battle-focused .poly-die svg{width:52px;height:52px}
 .battle-focused .roll-side{padding:2px 4px 4px}
 .battle-focused .roll-winner .roll-equation b{font-size:28px}
}
@media(max-width:550px){
 .battle-focused #battleRecap .battle-outcome{padding:6px 4px;margin-top:5px}
 .battle-focused #battleRecap .battle-outcome strong{font-size:19px}
 body.location-trial.battle-focused #battleRecap .battle-outcome span{font-size:12px}
 body.location-trial.battle-focused .actions button{font-size:13px;padding:8px 6px}
 body.location-trial.battle-focused .actions small{font-size:10px}
}

/* Give groups their own central space; every portrait keeps a square frame. */
.battle-focused .battle-opponents:has(>.mill-group){grid-template-columns:minmax(0,1fr) 240px minmax(0,1fr)}
.battle-focused .enemy-portrait.mill-group{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:10px;width:100%;height:auto;justify-items:center}
.battle-focused .enemy-portrait.mill-group:has(.mill-rat:nth-child(3)):not(:has(.mill-rat:nth-child(4))){grid-template-columns:repeat(3,minmax(0,1fr))}
.battle-focused .mill-group .mill-rat{width:100%;min-width:0;padding:0;flex:none}
.battle-focused .mill-group .mill-rat img{width:100%;max-width:76px;height:auto;max-height:none;aspect-ratio:1;object-fit:cover;flex-shrink:0;border-radius:50%}
@container combat (max-width:550px){
 .battle-focused .battle-opponents:has(>.mill-group){grid-template-columns:minmax(0,1fr) 100px minmax(0,1fr)}
 .battle-focused .enemy-portrait.mill-group{grid-template-columns:repeat(2,minmax(0,1fr));gap:6px;align-self:center}
 .battle-focused .enemy-portrait.mill-group:has(.mill-rat:nth-child(3)):not(:has(.mill-rat:nth-child(4))){grid-template-columns:repeat(2,minmax(0,1fr))}
 .battle-focused .mill-group .mill-rat:last-child:nth-child(odd){grid-column:1/-1;width:47px}
 .battle-focused .mill-group .mill-rat img{max-width:47px}
}

/* Critical result stays prominent before choosing energy and after confirmation. */
.battle-focused #battleRecap .critical-outcome{border:1px solid #d9aa55;background:linear-gradient(100deg,#5c421e7a,#1a2015e8 75%);box-shadow:inset 0 0 22px #d9aa5510}
.battle-focused #battleRecap .critical-banner{display:block;color:#ffe0a0;font-family:Georgia,serif;font-size:32px;font-weight:700;line-height:1.1;letter-spacing:.05em;text-transform:uppercase;text-shadow:0 2px 12px #e8ac4955;margin:0 0 5px}
.battle-focused #battleRecap .critical-outcome strong{font-size:19px}
@media(max-width:600px){.battle-focused #battleRecap .critical-banner{font-size:25px}.battle-focused #battleRecap .critical-outcome strong{font-size:17px}}

/* Keep the roll and the combat summary within the initial combat panel. */
.battle-focused .battle-title h2{margin:3px 0 6px}
.battle-focused .battle-gear{
 display:flex;flex-wrap:wrap;justify-content:center;gap:5px;
 max-width:215px;margin:4px 0 0;
}
.battle-focused .gear-slot{width:50px}
.battle-focused .gear-picture{height:50px}
.battle-focused .gear-name,.battle-focused .gear-durability{display:none}
.battle-focused .gear-values{gap:3px}
.battle-focused .gear-values>strong{font-size:14px}
.battle-focused .gear-absorption{width:17px;height:20px}
.battle-focused .gear-absorption b{font-size:10px}
.battle-focused .gear-slot.torch-slot>strong{font-size:12px}
.battle-focused .enemy-portrait:not(.mill-group){width:84px;height:84px}
.battle-focused .poly-die{width:66px;height:76px;margin:2px auto}
.battle-focused .poly-die svg{width:66px;height:66px}
@container combat (min-width:850px){
 .battle-focused .battle-gear{margin:0}
}
@container combat (max-width:550px){
 .battle-focused .gear-slot{width:44px}
 .battle-focused .gear-picture{height:44px}
 .battle-focused .enemy-portrait:not(.mill-group){width:64px;height:64px;margin-top:0}
 .battle-focused .poly-die{width:52px;height:62px}
 .battle-focused .poly-die svg{width:52px;height:52px}
}

@media (min-height: 720px){
 @container combat (min-width: 850px){
  .battle-focused .enemy-portrait:not(.mill-group,.lab-group){width:116px;height:116px}
 }
}

.enemy-dice-pair{display:flex;justify-content:center;gap:4px}
.enemy-dice-pair .poly-die{margin-inline:0}

/* Close-up for the final boss; the encounter preview keeps the full figure. */
.enemy-portrait.chaos-lord-combat-portrait{position:relative;overflow:hidden;padding:0}
.enemy-portrait.chaos-lord-combat-portrait img{position:absolute;width:270%;height:auto;max-width:none;left:50%;top:0;transform:translateX(-50%);border-radius:0}

.battle-focused #battleRecap .special-attack-outcome {
 border:1px solid #ca8069;
 background:linear-gradient(100deg,#62362aab,#211b18f0 78%);
}
.battle-focused #battleRecap .special-attack-banner {
 display:block;
 margin-bottom:4px;
 color:#ffd0bf;
 font:700 clamp(1.125rem,4vw,1.75rem)/1.15 Georgia,serif;
 letter-spacing:.035em;
 text-transform:uppercase;
 overflow-wrap:anywhere;
}
