/* Stable card heights and one independent scroll area for the roster. */
.roster-browser{--roster-cols:3;display:flex;flex-direction:column;min-width:0;min-height:0;gap:8px}
.roster-browser[data-size="large"]{--roster-cols:2}.roster-browser[data-size="small"]{--roster-cols:5}
.roster-size{display:flex;align-items:center;flex-wrap:wrap;gap:6px;flex:none;padding:4px 0;color:#d9edf6;font-size:12px}
.roster-size>button{min-width:44px;min-height:44px;border:2px solid #51778c;border-radius:9px;background:#15374e;color:white;font:inherit;font-weight:800;touch-action:manipulation}
.roster-size>button[aria-pressed="true"]{color:#112837;background:#ffd15a;border-color:#ffe99d}
#ui .roster-browser>.grid,#ui .roster-browser>.expedition-roster{display:grid;grid-template-columns:repeat(var(--roster-cols),minmax(0,1fr));grid-auto-rows:max-content;align-content:start;align-items:start;gap:8px;min-width:0;height:auto;min-height:0;flex:1 1 auto;overflow:auto;padding:4px;overscroll-behavior:contain}
#ui .roster-browser .slot{height:auto;min-height:0;display:flex;flex-direction:column;flex-shrink:0;align-self:start;border-radius:10px}
#ui .roster-browser .slot>.roster-face,#ui .roster-browser .fighter-card>.roster-face{display:block;width:100%;height:auto;aspect-ratio:1/1;flex:0 0 auto;box-sizing:border-box}
#ui .roster-browser .slot>.fighter-name{flex:none;min-height:38px;height:auto;white-space:normal;overflow:visible}
#ui .roster-browser[data-size="small"] .roster-name,#ui .roster-browser[data-size="small"] .slot>.fighter-name{font-size:10px;line-height:1.4;padding:5px 2px;min-height:36px}
#ui .roster-browser[data-size="small"] .roster-sub{display:none}
#ui .roster-browser[data-size="small"] .roster-element{width:16px;height:16px;top:3px;left:3px;font-size:9px}
#ui .roster-browser[data-size="small"] .roster-stars{font-size:8px;gap:0;bottom:3px}
#ui .select>.body>.roster-browser{height:100%;overflow:hidden}
#ui.scr-expedition{display:block;overflow:auto;align-items:start}
#ui.scr-expedition>.expedition{margin:0 auto;max-height:none;min-height:100%;overflow:visible}
#ui.scr-expedition .topbar{top:0}
@media(max-width:760px) and (min-height:521px),(max-width:599px){
 #ui .select>.body{display:flex;flex-direction:column;overflow:hidden;min-height:0}
 #ui .select>.body>.roster-browser{flex:0 0 52%;width:100%;height:auto;min-height:130px}
 #ui .select .side{flex:1 1 auto;min-height:0;overflow:auto;display:block}
 #ui .select .side .big{display:block;width:100%;max-width:190px;height:auto;max-height:215px;object-fit:contain;margin:0 auto}
 #ui .select .side .info{width:100%}
}

#ui .roster-browser .slot>.fighter-name{display:block!important;text-align:center;box-sizing:border-box;max-width:100%}#ui .roster-browser .fighter-name .name-piece{max-width:100%;white-space:normal;overflow-wrap:anywhere}#ui .roster-browser .roster-name{display:block;text-align:center}#ui .roster-browser .roster-name .fighter-name{display:block}


#ui .roster-browser>.expedition-roster{grid-template-columns:repeat(var(--roster-cols),minmax(0,1fr))!important;gap:8px!important}#ui .roster-browser .fighter-name .name-piece{white-space:normal!important;overflow-wrap:anywhere!important;display:inline!important}#ui .roster-browser[data-size=small] .roster-face{border-width:3px!important}#ui .roster-browser[data-size=small] .fighter-card{border-width:3px!important}


#ui .expedition-team-tags .roster-face{width:min(100%,96px);height:auto!important;aspect-ratio:1/1;margin:auto;box-sizing:border-box}#ui .expedition-team-tags>span{display:flex;flex-direction:column;align-items:center;padding:5px!important}


/* Full-body previews retain their ratio and fit short phone viewports. */
#ui .select .side .big{display:block;width:auto;max-width:100%;height:clamp(80px,22svh,200px);max-height:none;aspect-ratio:300/340;object-fit:contain;margin:0 auto;flex:none}


@supports (container-type:size){#ui .select .side{container-type:size}#ui .select .side .big{height:min(200px,22svh,calc(100cqh - 24px))}}


/* Menu gestures must reach the actual scroll container on iOS. Combat remains locked. */
body:not([data-screen="fight"]){touch-action:pan-y pinch-zoom}
#ui#ui.scr-expedition{display:block;overflow-x:hidden;overflow-y:auto!important;pointer-events:auto;touch-action:pan-y pinch-zoom;-webkit-overflow-scrolling:touch;overscroll-behavior-y:contain}
#ui#ui.scr-expedition>.expedition{height:auto;min-height:100%;max-height:none;overflow:visible}
#ui.scr-expedition .roster-browser,#ui.scr-expedition .roster-browser>.expedition-roster{height:auto;flex:none;overflow:visible;overscroll-behavior:auto}
.collection-help{margin:10px 0;padding:10px 12px;border:1px solid #507e92;border-radius:10px;color:#c5dce8}.collection-help summary{cursor:pointer;font-weight:800;min-height:28px}
.collection-actions{display:grid!important;grid-template-columns:repeat(2,minmax(0,1fr));gap:8px!important}.collection-actions>.btn:first-child{grid-column:1/-1}
@media(max-width:760px) and (min-height:521px),(max-width:599px){
 #ui .select{padding:10px;height:100%;gap:0}
 #ui .select>.topbar{margin-bottom:3px;min-height:40px;gap:6px}
 #ui .select>.topbar h2{font-size:18px;line-height:1.35}
 #ui .select>.topbar .mode{font-size:10px}
 #ui .select>.pick-hint{font-size:11px;margin:3px 0;line-height:1.4}
 #ui .select>.body{gap:6px;padding:2px;min-height:0}
 #ui .select>.body>.roster-browser{flex:0 0 66%;min-height:150px;height:auto;overflow:hidden}
 #ui .select .roster-size{padding:0;gap:5px}.select .roster-size>button{min-height:36px;min-width:38px}
 #ui .select .side{flex:1 1 auto;container-type:normal;padding:6px;overflow:auto;min-height:0}
 #ui .select .side .big{float:left;width:78px;height:90px;max-width:28%;max-height:none;margin:0 8px 4px 0;object-fit:contain}
 #ui .select .side .info{width:auto}.select .side .nm{font-size:13px}
 #ui .select-actions{margin-top:4px;padding:5px 0 2px;gap:5px}
 #ui .select-actions .cpu-choice{font-size:11px;margin:0;gap:5px}
 #ui .select-actions .cpu-choice select{padding:3px 5px;min-height:32px;font-size:12px}
 #ui .select-actions .confirm-fighter{min-height:44px;padding:6px 12px;font-size:15px}
 #ui .expedition .topbar{margin-bottom:8px}#ui .expedition-wallet{margin:8px 0}
 #ui .collection-actions .btn{font-size:13px;padding:8px;min-height:44px}
}
