/* Visible companions retain portrait silhouettes. Explicit pages preserve target size. */
body[data-progression="xp"] #game>.formation{display:grid;grid-template-columns:repeat(3,minmax(0,1fr))!important;grid-template-rows:22px minmax(0,1fr);gap:4px 8px}
body[data-progression="xp"] #game[data-visible-party="2"]>.formation{grid-template-columns:repeat(2,minmax(0,1fr))!important}
body[data-progression="xp"] #game>.formation>.section-line{grid-row:1;grid-column:1/-1}
body[data-progression="xp"] #game>.formation .formation-row,body[data-progression="xp"] #game>.formation .hero-row{display:contents!important}
body[data-progression="xp"] #game>.formation .row-label,body[data-progression="xp"] #game>.formation .empty{display:none!important}
body[data-progression="xp"] #game>.formation .hero-row>.hero{grid-row:2!important;grid-column:auto!important;justify-self:center;width:100%;max-width:245px;height:100%;max-height:none;min-height:0}
body[data-progression="xp"] #game[data-visible-party="1"]>.formation .hero-row>.hero{grid-column:1/-1!important;width:min(100%,245px)}
body[data-progression="xp"] #game>.formation .hero-row>.hero>img{inset:21px 3px 67px!important;width:calc(100% - 6px)!important;height:calc(100% - 88px)!important;object-fit:contain}
body[data-progression="xp"] #game>.formation .hero-row>.hero:has(.xp-ribbon)>.hero-body{padding:21px 4px 25px!important;grid-template-rows:minmax(0,1fr) 20px 22px!important}
body[data-progression="xp"] #game>.formation .hero-row>.hero h3{padding:0!important;font-size:18px!important;line-height:20px!important}
body[data-progression="xp"] #game>.formation .hero-row>.hero .hp{font-size:18px!important;line-height:20px!important}
body[data-progression="xp"] #game>.formation .hero-row>.hero .short-position{display:block;position:absolute;top:2px;left:22px;right:22px;font:12px/16px system-ui;text-align:center;z-index:3;background:#14271f}
body[data-progression="xp"] #game>.formation .hero-row>.hero .activation-badge{display:none}
body[data-progression="xp"] #game>.formation .hero-row>.hero>.role-seal{width:17px;height:17px;top:2px;left:3px}
body[data-progression="xp"] #game>.formation .hero-row>.hero .rank-badge{position:absolute;top:2px;right:3px;left:auto;height:17px;line-height:15px;font-size:12px}
body[data-progression="xp"] .response-mark{max-width:calc(100% - 6px);bottom:66px;left:3px;right:3px}
@media(max-width:700px) and (min-height:501px){body[data-progression="xp"] #game>.formation .hero-row>.hero{max-width:100%}body[data-progression="xp"] #game>.formation .hero-row>.hero h3{font-size:16px!important;line-height:19px!important}}
@media(max-height:500px){
 body[data-progression="xp"] #game>.formation{gap:3px 5px;grid-template-rows:20px minmax(0,1fr)}
 body[data-progression="xp"] #game>.formation .hero-row>.hero>img{inset:18px auto 19px 3px!important;width:32%!important;height:calc(100% - 37px)!important}
 body[data-progression="xp"] #game>.formation .hero-row>.hero:has(.xp-ribbon)>.hero-body{padding:17px 3px 18px calc(32% + 4px)!important;grid-template-rows:minmax(0,1fr) 16px 16px!important}
 body[data-progression="xp"] #game>.formation .hero-row>.hero h3{font-size:14px!important;line-height:16px!important}
 body[data-progression="xp"] #game>.formation .hero-row>.hero .hp{font-size:16px!important;line-height:16px!important}
 body[data-progression="xp"] .response-mark{display:none}
}

@media(max-height:500px){body[data-progression="xp"] .last-attack{display:none}}
