/* Floating menus share a visible viewport; lists scroll inside the game. */
body.game-mode{height:var(--game-visible-height,100dvh)}
body.game-mode .battle-shell{height:100%}
.game-overlay{top:var(--game-visible-top,0px);bottom:auto;height:var(--game-visible-height,100dvh)}
body.game-mode .modal-backdrop{top:var(--game-visible-top,0px);bottom:auto;height:var(--game-visible-height,100dvh);overscroll-behavior:contain}
body.game-mode .modal{max-height:calc(var(--game-visible-height,100dvh) - 50px);scroll-padding:18px}
.game-window__body{scroll-padding:14px}
.game-window__close.icon-button,.game-window__menu{min-width:44px;min-height:44px}
.game-window__close.icon-button{width:44px;height:44px}
.game-window__heading{gap:10px}
.game-window__heading h1{overflow-wrap:anywhere}
.management-links{display:flex;gap:8px;flex-wrap:wrap;margin:0 0 15px}
.management-links .button{font-size:11px;min-height:44px;padding:10px 14px}
.guide-return{display:none}
.guide-owned{display:grid;gap:8px;margin-top:15px}
.guide-owned h3{font:600 23px var(--pixel);color:#e9d298}
.guide-owned .button{justify-content:space-between;gap:10px;min-height:44px;font-size:10px;white-space:normal}
.guide-owned .button small{font-size:9px;opacity:.8}
.guide-empty{padding:20px;border:1px solid #8ca887;color:#e6eacb}
.replacement-incoming{display:flex;align-items:center;gap:14px;padding:12px;border:1px solid #9db48f;background:#294e47;margin-bottom:14px}
.replacement-incoming .sprite{width:64px;height:64px}
.replacement-incoming strong{display:block;font:600 28px var(--pixel)}
.replacement-incoming small{display:block;font-size:11px;margin-top:5px;color:#d2dbb8}
.replacement-grid{display:grid;grid-template-columns:1fr 1fr;gap:9px}
.replacement-grid>button{display:flex;align-items:center;gap:10px;min-height:80px;padding:10px;text-align:left;background:#f3efd6;color:#29453b;border:2px solid #90a780}
.replacement-grid .sprite{width:50px;height:50px;flex:none}
.replacement-grid strong{display:block;font:600 24px/1.1 var(--pixel)}
.replacement-grid small{display:block;font:500 10px/1.5 var(--body);margin-top:4px}
.replacement-grid button:disabled{opacity:.65}
.replacement-grid button:disabled small{color:#743f36}
.replacement-grid button b{display:block;font:700 10px var(--body);margin-top:5px}
.replacement-note{font-size:11px;line-height:1.6;margin:12px 0;color:#d5dfbf}
@media(pointer:coarse){
 body.game-mode input:not([type=range]),body.game-mode select,body.game-mode textarea{font-size:16px;min-height:44px}
 .game-hud button{min-width:44px;min-height:44px}
 .game-quickbar button{min-width:44px;min-height:44px}
 .modal-heading>.icon-button{min-width:44px;min-height:44px}
}
@media(max-width:700px){
 .game-window__heading{padding:11px 13px}
 .game-window__heading h1{font-size:27px}
 .game-window__close.icon-button{flex:0 0 44px}
 .game-collection .game-window__body{padding:12px}
 .game-collection .collection-toolbar{display:grid;grid-template-columns:minmax(0,1fr) 108px;gap:10px;align-items:center}
 .game-collection .collection-toolbar .segmented{grid-column:1/-1;display:flex;width:100%}
 .game-collection .segmented button{flex:1;min-height:44px;padding:8px 5px;font-size:10px}
 .game-collection .search-box{min-width:0;width:100%;height:46px}
 .game-collection .search-box input{font-size:16px;min-width:0;width:100%;height:44px;padding:8px 10px}
 .game-collection .collection-toolbar select{width:100%;height:44px;font-size:13px}
 .game-collection .dex-layout{display:block}
 .game-collection .dex-grid,.game-collection .dex-grid.compact{grid-template-columns:repeat(3,minmax(0,1fr));gap:8px}
 .game-collection .dex-detail{display:none}
 .game-collection .guide--detail .dex-grid{display:none}
 .game-collection .guide--detail .collection-toolbar,.game-collection .guide--detail>.management-links,.game-collection .guide--detail>.page-heading{display:none}
 .game-collection .guide--detail .dex-detail{display:block}
 .game-collection .guide--detail .guide-return{display:flex;min-height:44px;align-items:center;margin-bottom:12px;font-size:11px}
 .game-collection .dex-detail .detail-art{height:150px;min-height:0}
 .game-collection .dex-detail .detail-sprite{height:130px;width:150px}
 .game-collection .detail-content{padding:15px}
 .game-collection .detail-content>p{font-size:12px;line-height:1.6}
 .management-links .button{flex:1;padding:10px;font-size:10px}
 .replacement-grid{grid-template-columns:1fr}
 body.game-mode .modal-backdrop{padding:12px}
 body.game-mode .modal{max-height:calc(var(--game-visible-height,100dvh) - 30px)}
 body.game-mode .modal-heading h2{font-size:26px}
}
@media(max-width:360px){.game-hud__place{max-width:125px}.game-hud__place strong{max-width:88px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.game-hud__tools{gap:4px}.game-hud button{padding:6px;min-width:40px}.game-hud__tools .game-hud__coins{min-width:46px}}
@media(max-height:500px) and (min-width:701px){.game-window__heading{padding:7px 13px}.game-window__heading h1{font-size:25px}.game-window__close.icon-button{height:44px;min-height:44px;width:44px}.game-collection .dex-layout{grid-template-columns:minmax(0,1fr) 270px}.game-collection .dex-grid{grid-template-columns:repeat(4,minmax(0,1fr))}}
html[data-soft-keyboard] .game-hud{display:none}
html[data-soft-keyboard] .game-window{inset:10px max(12px,env(safe-area-inset-right)) 12px max(12px,env(safe-area-inset-left));width:auto;max-height:none}
html[data-soft-keyboard] .game-window__heading{padding:7px 12px}
html[data-soft-keyboard] .game-window__heading h1{font-size:24px}
html[data-soft-keyboard] #toast{display:none}

@media(pointer:coarse) and (max-width:360px){.game-hud button{min-width:44px;min-height:44px}.game-hud__tools .game-hud__coins{min-width:46px}}
@media(pointer:coarse) and (max-width:340px){.game-hud__place{max-width:98px;padding:7px 6px}.game-hud__emblem{display:none}.game-hud__place strong{max-width:82px}.game-hud__place small{font-size:5px;letter-spacing:0}}

body.game-mode .button{min-height:44px}

/* Modal exit controls stay reachable while long supply/menu lists scroll. */
body.game-mode .modal-heading{position:sticky;top:-1px;z-index:5;background:inherit}
body.game-mode .pause-menu>button{min-height:44px}
body.game-mode .title-actions .button.primary,
body.game-mode .title-actions .text-button,
body.game-mode .starter-screen .starter-confirm .button,
body.game-mode .starter-screen__back,
body.game-mode .research-intro .button,
body.game-mode .research-intro .text-button{min-height:44px}

@media(max-width:700px){
 .game-collection .collection-toolbar .search-box{grid-column:1/-1}
 .game-collection .collection-toolbar>label:last-child{grid-column:1/-1}
 .game-collection .collection-toolbar>label:last-child select{font-size:16px}
}

/* Exact capped care outcomes stay readable inside the existing scrolling dialog. */
.care-moves{margin:16px 0 12px;border:1px solid #60765f;padding:10px 12px;border-radius:4px}
.care-moves-heading,.care-move{display:flex;justify-content:space-between;gap:12px;align-items:center;font-size:12px;line-height:1.6}
.care-moves-heading{color:#c3d2b7;margin-bottom:7px;font-size:11px}
.care-move{padding:5px 0;border-top:1px solid #60765f66}
.care-move>strong{min-width:0;overflow-wrap:anywhere;font-weight:500}
.care-move>span{flex-shrink:0;font-variant-numeric:tabular-nums}
.care-move b{color:#f0ce8e;margin-left:4px}
.modal .button.care-action{display:flex;flex-direction:column;align-items:flex-start;text-align:left;gap:4px;padding:12px;min-height:60px;margin-bottom:7px}
.care-action strong{font:500 12px/1.6 var(--body)}
.care-action small{font-size:11px;line-height:1.6}
.care-reason{font-size:11px;line-height:1.6;color:#c3d2b7;margin:0 0 13px}
body.game-mode .game-habitat [data-action=provision]{min-height:44px;min-width:44px}
@media(max-width:360px){.care-moves{padding:9px}.care-move{gap:8px;font-size:11px}.care-moves-heading{font-size:10px}}

/* Keep partial checkpoint condition and preparation ahead of trail commitment. */
.checkpoint-condition{color:#f5efd5;font:12px/1.6 var(--body);margin:0 0 15px}
.checkpoint-condition p{margin:8px 0}
.checkpoint-condition .game-loot-tools button{min-height:44px;font-size:11px}
.game-route-choices>button[data-action=run-route]{padding-right:20px}
.game-route-choices>button[data-action=run-route]>b{position:static;display:block;transform:none;margin-top:9px;font:600 11px/1.6 var(--body);color:#304b3b}
