/* UI4_2: visual layout review. Keep live labels separate from existing illustrated skins. */
.app>.bar{justify-content:center!important;gap:6px!important;padding:3px 10px!important;min-height:42px;flex-wrap:nowrap;background:linear-gradient(90deg,#12383c,#205457,#12383c)}
.app>.bar .logo{margin:0 6px 0 0!important}.app>.bar #record{margin:0 clamp(8px,2vw,22px) 0 0!important;flex:0 1 auto;color:#ffe9af}.app>.bar .secondary{background:var(--reg-secondary) center/100% 100% no-repeat;color:#fff6db;text-shadow:0 1px 2px #102e30;padding:5px 13px;min-height:34px;font-size:12px;line-height:1.15;min-width:82px}
/* Logo and actions use disjoint rows rather than overlapping absolute positions. */
#entry:not([hidden]){display:grid;grid-template-rows:minmax(0,1fr) auto;align-content:center;justify-items:center;padding:clamp(6px,2dvh,24px) 8px clamp(8px,3dvh,35px);gap:4px}
#entry .entry-scene,#entry.intro .entry-scene{position:absolute;inset:0;overflow:hidden;z-index:-1}
#entry .entry-brand,#entry.intro .entry-brand{top:2dvh;height:calc(100dvh - 255px);max-height:54dvh;width:min(70vw,650px);object-fit:contain}
#entry .entry-controls{position:relative;grid-row:2;bottom:auto;left:auto;transform:none;width:min(94%,440px);max-height:none;align-self:end;gap:4px}
#entry .entry-actions{width:min(100%,350px)}
@media(max-height:600px){#entry .entry-brand{top:1dvh;height:calc(100dvh - 125px);max-height:60dvh;width:min(66vw,100dvh)}#entry .entry-controls{bottom:auto;gap:3px}#entry .entry-btn{min-height:48px;font-size:16px}#entry .entry-tools button{min-height:31px}}
/* Compact screen headers keep the actual label inside the decorated center. */
#stageSelect .stage-head,#scout .scout-head{width:min(100%,1120px);margin-inline:auto;justify-content:center;gap:8px}
#stageSelect .stage-head h1,#scout .scout-head h1{flex:0 1 auto;min-width:0;max-width:100%;padding:8px 30px;text-align:center;line-height:1.2;white-space:nowrap;font-size:clamp(14px,2.1vw,23px)}
#stageSelect .stage-head #stageCount{white-space:nowrap;flex:0 1 auto}#stageSelect .stage-head button,#scout .scout-head button{flex:none;padding-inline:12px}
#heroDetails .detail-header h2,#missionDialog .mission-header h2,#bookDialog .book-head h2,#wachaDialog .wacha-head h2{background:var(--reg-heading) center/100% 100% no-repeat;display:inline-block;line-height:1.2;padding:8px 28px;margin:0;font-size:clamp(15px,2.2vw,23px);white-space:nowrap;color:#fff4d3}
/* Battle: a bounded stage plus contiguous command dock. Canvas scales to both available axes. */
#battle:not([hidden]){display:grid;grid-template-columns:minmax(0,1fr) clamp(236px,23vw,320px);grid-template-rows:auto minmax(0,1fr);min-height:0;overflow:hidden!important;background:#1a3a40}
#battle .battlebar{grid-column:1/-1;grid-row:1;justify-content:center;gap:4px!important;flex-wrap:wrap;padding:4px 7px!important;background:linear-gradient(#285355,#173b3e);border-bottom:1px solid #bfa36b}
#battle .battlebar .push{display:none}#battle .battlebar .stat{padding:4px 6px;font-size:12px;max-width:none!important;overflow:visible;line-height:1.2}#battle .battlebar button{min-height:33px;padding:4px 11px;line-height:1.2;color:#fff5d9;background:var(--reg-secondary) center/100% 100% no-repeat;text-shadow:0 1px 2px #123333}
#battle .fieldwrap{grid-column:1;grid-row:2;min-width:0;min-height:0;container-type:size;display:grid;place-items:center;overflow:hidden;background:#1b3d40}
#battle #field{width:min(100cqw,calc(100cqh * 1200 / 610))!important;height:auto!important;aspect-ratio:1200/610;max-width:100%!important;max-height:100%;margin:0;border:0;padding:0;display:block}
#battle .bottombar{grid-column:2;grid-row:2;display:flex;flex-direction:column;gap:5px;min-width:0;min-height:0;overflow:auto;padding:8px;border:0;border-left:1px solid #c5a56c;background:linear-gradient(#285254,#16373c);scrollbar-width:thin}
#battle .controls{position:static;display:grid;grid-template-columns:repeat(2,minmax(0,1fr));flex:none;gap:4px;margin:0;padding:0;background:none!important}
#battle .controls #battleHint{grid-column:1/-1;color:#fff1d0;line-height:1.3;font-size:12px;min-width:0;min-height:0;overflow-wrap:anywhere}
#battle .controls button{white-space:normal;min-width:0;min-height:38px;padding:5px 12px;color:#fff7dc;background:var(--reg-secondary) center/100% 100% no-repeat;text-shadow:0 1px 2px #143432;font-size:12px;line-height:1.2}
#battle .controls #start,#battle .controls #special{grid-column:1/-1;background:var(--reg-primary) center/100% 100% no-repeat;color:#fff6d4;text-shadow:0 1px 2px #48290e;padding:5px 25px;min-height:44px}
#battle .role-filter-bar{flex:none;color:#fff3d1;flex-wrap:wrap;gap:3px;font-size:11px;min-width:0}
#battle .battle-roster{grid-template-columns:repeat(2,minmax(0,1fr))!important;grid-auto-rows:auto;flex:none;overflow:visible;gap:5px;padding:0;min-height:0}
#battle .battle-roster button{display:grid;grid-template-columns:clamp(24px,3.2vw,46px) minmax(0,1fr);grid-template-rows:auto auto auto auto;align-items:center;column-gap:3px;min-height:0!important;min-width:0;padding:9px 8px 10px;overflow:visible;line-height:1.15}
#battle .battle-roster button>img{grid-column:1;grid-row:1/5;width:100%;height:100%;max-height:58px;object-fit:contain}
#battle .battle-roster button>b,#battle .battle-roster button>small{grid-column:2;white-space:normal;overflow:visible;text-overflow:clip;overflow-wrap:anywhere;max-width:100%;text-align:left;font-size:11px;line-height:1.18}
#battle .battle-roster button>small{font-size:10px;color:#fff0c3}#battle .battle-roster .mini{grid-column:2;width:100%;max-width:none;margin:0}#battle .battle-roster .mini.sp{margin:0}
#battle .battle-roster .roster-role-tags{grid-column:1/-1;flex-wrap:wrap;justify-content:center;line-height:1.1}
@media(max-height:600px){#battle:not([hidden]){grid-template-columns:minmax(0,1fr) clamp(184px,29vw,260px)}#battle .battlebar .stat{font-size:10px;padding:3px 4px}#battle .battlebar button{min-height:30px;font-size:10px;padding:4px 8px}#battle .bottombar{padding:4px;gap:3px}#battle .controls #battleHint{font-size:10px}#battle .controls button{min-height:30px;font-size:10px;padding:3px 7px}#battle .controls #start,#battle .controls #special{min-height:35px;padding:4px 18px}#battle .battle-roster button{grid-template-columns:22px minmax(0,1fr);padding:5px 5px 7px;gap:2px;min-height:0!important}#battle .battle-roster button>b,#battle .battle-roster button>small{font-size:10px;line-height:1.12}#battle .battle-roster .roster-role-tags{display:none}#battle .battle-roster .mini{max-height:7px}}
@media(max-height:360px){.app>.bar{min-height:34px;padding:1px 6px!important;gap:4px!important}.app>.bar .secondary{min-width:65px;min-height:29px;font-size:10px;padding:4px 9px}.app>.bar .logo img{height:27px}#battle .battlebar{padding:2px 4px!important;gap:2px!important}#battle .battlebar .stat{font-size:9px;padding:2px 3px}#battle .battlebar button{font-size:9px;padding:3px 6px;min-height:26px}#battle .battle-roster button{grid-template-columns:19px minmax(0,1fr);padding:4px 4px 5px}#battle .battle-roster button>b,#battle .battle-roster button>small{font-size:9px}#battle .controls #battleHint{font-size:10px;line-height:1.15}}
/* Summon and archive: no flexible empty spacer between item and next action. */
#scout:not([hidden]){grid-template-columns:minmax(0,1fr) minmax(0,1fr);max-width:none;padding-inline:max(8px,calc((100vw - 1120px)/2));background:var(--review-backdrop) center/cover no-repeat}
#scout .scout-controls,#scout .scout-results{align-self:center;max-height:100%;width:100%;max-width:540px;justify-self:center}
#scout .scout-results:not([hidden]){gap:8px;justify-content:center}#scout .result-cards{flex:0 1 auto;grid-template-columns:repeat(auto-fit,minmax(82px,110px));justify-content:center;margin:0;max-height:55dvh}#scout #resultDone{align-self:center;width:min(100%,240px);min-height:44px}
#bookDialog .book-head,#bookDialog .book-mode,#bookDialog .book-scroll{width:min(100%,1120px);align-self:center}#bookDialog .book-mode{display:flex;justify-content:center;gap:6px}#bookDialog .book-mode button{flex:0 1 210px;min-width:0;padding-inline:10px}
#bookDialog #bookAllyList{grid-template-columns:repeat(auto-fill,minmax(125px,160px));justify-content:center;gap:10px}#bookDialog .book-ally-card{padding:15px 12px 20px;justify-content:flex-start}#bookDialog .book-ally-card p,#bookDialog .book-ally-card h3{overflow-wrap:anywhere;line-height:1.3}
/* Character data: larger portrait, bounded content and actual training action near its status. */
#heroDetails .detail-header,#heroDetails .detail-body{width:min(100%,1120px);align-self:center}#heroDetails .detail-layout{grid-template-columns:minmax(0,.85fr) minmax(0,1.15fr)}#heroDetails .detail-header .eyebrow{display:none}#heroDetails .detail-tab b,#heroDetails .detail-tab small{white-space:normal;overflow-wrap:anywhere;line-height:1.1}#heroDetails .detail-sections button{white-space:normal;line-height:1.15;min-width:0;padding:5px 10px;color:#fff4d5;background-image:var(--reg-secondary)}#heroDetails .detail-sections button[aria-pressed=true]{background-image:var(--reg-tab);color:#38230b}#heroDetails .detail-pane-scroll{padding:3px 4px 6px}#heroDetails #shardBuy{min-height:38px}
@media(max-height:450px){#heroDetails .detail-header{padding:3px 6px}#heroDetails .detail-header h2{padding:5px 22px;font-size:15px}#heroDetails .detail-role-tags{margin:0}#heroDetails .detail-body{gap:3px;padding:3px 6px}#heroDetails .detail-tab{height:43px;flex-basis:68px;padding:3px 6px}#heroDetails .detail-portrait{padding:6px}#heroDetails .detail-name{padding:4px 7px}#heroDetails .detail-data{gap:3px}#heroDetails .detail-sections button{min-height:29px;font-size:10px;padding:4px 6px}#heroDetails [data-detail-page=train] .growth-card,#heroDetails [data-detail-page=train] .strength-card{margin:2px 0 4px;padding:5px 7px}#heroDetails [data-detail-page=train] p{font-size:10px;line-height:1.2;margin:3px 0}#heroDetails .growth-head,#heroDetails .strength-head{font-size:11px;gap:4px}#heroDetails #shardBuy{min-height:32px;padding:4px 18px;font-size:11px}}
/* Mission notes remain available inside the list instead of taking a fixed HUD row. */
#missionDialog #missionList{flex:0 1 auto;min-height:0;max-height:100%;border-radius:0 0 8px 8px}#missionDialog #missionNote{line-height:1.25}#missionDialog .mission-row button{white-space:normal;line-height:1.15;padding:5px 12px}#missionDialog .mission-text strong,#missionDialog .mission-text small{white-space:normal;overflow:visible;text-overflow:clip;overflow-wrap:anywhere}#missionDialog .mission-row{align-items:center}
#missionDialog.daily-mode #missionList{flex:0 1 auto}
/* Results: keep banner, data, and next actions in one vertical group; scroll only when data truly needs it. */
#modal .paper.battle-result{display:flex;flex-direction:column;justify-content:center;align-items:center;overflow:hidden}#modal .battle-result .br-header{flex:none;width:100%;max-width:1100px}#modal .battle-result .br-body{flex:0 1 auto;min-height:0;width:min(100%,1060px);align-content:start!important;padding:4px 10px;overflow:auto;gap:8px}#modal .battle-result .br-actions{flex:none;width:min(100%,1060px);justify-content:center;background:transparent;border:0;padding:7px 8px}#modal .battle-result .br-actions button{min-height:38px;padding:5px 13px;white-space:normal;line-height:1.15}#modal .battle-result .br-actions button.primary{padding-inline:22px}#modal .battle-result .br-actions #resultNext{min-width:0}
@media(max-height:450px){#modal .battle-result .br-banner{height:62px}#modal .battle-result .br-header{padding:0 4px 2px}#modal .battle-result .br-stage-caption{gap:3px}#modal .battle-result .br-body{padding:2px 6px;gap:5px}#modal .battle-result .br-actions{padding:3px 4px;gap:3px}#modal .battle-result .br-actions button{font-size:10px;min-height:32px;padding:4px 9px}#modal .battle-result .br-actions button.primary{padding-inline:15px}#modal .battle-result .br-overview{padding:4px}#modal .battle-result .br-sprite{height:38px}#modal .battle-result .br-lineup{min-height:0}#modal .battle-result .br-metrics{min-height:0;padding:9px 10% 8px}#modal .battle-result .br-metrics>div{padding:1px 3px}#modal .battle-result .br-metrics strong{font-size:12px!important}#modal .battle-result .br-rewards{border-width:7px;padding:3px 5px}#modal .battle-result .br-gem{min-height:32px;padding:4px 12px}#modal .battle-result .br-reward-slot{width:27px;height:27px}#modal .battle-result .br-gem-number{font-size:18px}#modal .battle-result .br-divider{height:5px}#modal .battle-result .br-growth-card{padding:3px 4px}}
/* Preserve legible labels, even for the longer class names. */
#partySelect .party-card b,#partySelect .party-card small,#partySelect .party-slot span{white-space:normal;overflow-wrap:anywhere;text-overflow:clip;overflow:visible;line-height:1.15}#partySelect #partyGrid .party-card{grid-template-rows:minmax(0,1fr) auto auto;min-height:0}#partySelect .party-level{top:9%;left:10%}#partySelect .party-mark{top:8%;right:8%}
@media(max-height:350px){#partySelect .party-main{grid-template-columns:minmax(0,.78fr) minmax(0,1.22fr)}#partySelect #partyGrid{gap:3px}#partySelect .party-main{--card-w:62px}#partySelect .party-card b,#partySelect .party-card small{font-size:9px}#stageSelect .stage-head h1,#scout .scout-head h1{padding:5px 24px;font-size:14px}#missionDialog .mission-header h2{font-size:15px;padding:5px 24px}#missionDialog .mission-row button{padding:4px 7px;font-size:11px}}
/* Second review: explicitly remove legacy title columns; results replace, not cover, controls. */
#entry:not([hidden]){grid-template-columns:minmax(0,1fr)}
#entry .entry-controls{grid-column:1;justify-self:center;margin-inline:auto}
#scout:has(#scoutResults:not([hidden])) .scout-controls{display:none!important}
#scout .summon-stage{background:#16373ce0;justify-content:center}
#scout .summon-caption{flex:none}
#scout .result-cards{background:transparent;border:0;box-shadow:none;padding:4px}
#scout .scout-card{min-height:0}
/* A short preparation view may scroll the roster, not the field or the active controls. */
@media(max-height:360px){#battle .controls #battleHint{font-size:10px;line-height:1.1}#battle .controls button{min-height:26px;padding:3px 7px}#battle .controls #start,#battle .controls #special{min-height:30px}#battle .role-filter-bar{padding:0;font-size:10px;line-height:1.1}#battle .role-filter-bar select{min-height:22px;padding:0 3px}#battle .battle-roster button{padding:5px 4px 6px;grid-template-columns:20px minmax(0,1fr)}#battle .battle-roster button>b,#battle .battle-roster button>small{font-size:9px;line-height:1.05}#battle .battle-roster button>img{max-height:34px}}
/* Prepare cards need only their placement status; the fight HUD retains both gauges. */
#battle:has(#start:not([hidden])) .battle-roster button .mini{display:none}
#battle:has(#start:not([hidden])) .battle-roster button{grid-template-rows:auto auto;min-height:38px!important}
#battle:has(#start:not([hidden])) .battle-roster button>img{grid-row:1/3}
#battle .controls{flex-shrink:0}
/* Explicit row assignment keeps images and labels apart even with role badges. */
#battle .battle-roster button>b{grid-row:1}#battle .battle-roster button>small{grid-row:2}
#battle .battle-roster button>.mini:not(.sp){grid-row:3}#battle .battle-roster button>.mini.sp{grid-row:4}
#battle:has(#start:not([hidden])) .battle-roster .roster-role-tags{grid-row:3}
#battle:has(#start:not([hidden])) .battle-roster{grid-auto-rows:auto}
#battle .role-filter-bar span{color:#e4d9b8}
@media(max-height:600px){#battle:has(#start:not([hidden])) .battle-roster .roster-role-tags{display:none!important}}
@media(max-height:360px){#battle .battle-roster{gap:3px}#battle:has(#start:not([hidden])) .battle-roster button{min-height:32px!important;padding:4px 4px 5px}#battle .battle-roster button>img{max-height:25px}#battle .role-filter-bar span{font-size:9px}}
/* Short landscape, five-party + boss: both live gauges share a row so the entire command dock fits. */
@media(max-height:360px){
 #battle .battle-roster button{grid-template-columns:20px minmax(0,1fr) minmax(0,1fr);grid-template-rows:auto auto 5px;row-gap:1px;column-gap:2px;padding:4px 4px 5px}
 #battle .battle-roster button>b,#battle .battle-roster button>small{grid-column:2/4;line-height:1.05}
 #battle .battle-roster button>img{grid-row:1/4;max-height:25px}
 #battle .battle-roster button>.mini:not(.sp){grid-column:2;grid-row:3;width:100%;height:5px}
 #battle .battle-roster button>.mini.sp{grid-column:3;grid-row:3;width:100%;height:5px}
 #battle:has(#start:not([hidden])) .battle-roster button{grid-template-rows:auto auto;min-height:30px!important;padding:3px 4px 4px}
 #battle:has(#start:not([hidden])) .battle-roster button>img{grid-row:1/3}
 #battle .controls{gap:3px}
 #battle .controls #special{min-height:28px}
 #battle .controls #battleHint{font-size:9px;line-height:1.1}
}
