/* Small landscape actors fit the visible field between health and commands. */
@media(min-width:480px) and (max-width:700px) and (max-height:500px){
 body.game-mode:has(.battle-shell)[data-battle-format=singles]{--arena-side-inset:190px;--arena-compact-landscape:1}
}
/* A small landscape keeps health and command lanes separate. */
@media(min-width:480px) and (max-width:600px) and (max-height:500px){
 body.game-mode:has(.battle-shell)[data-battle-format=singles]{--game-dock-height:136px;--game-dock-bottom:10px;--game-gutter:12px}
 body.game-mode:has(.battle-shell):has(.battle-fight,.capture-area,.tactical-switch,.recovery-bag,.survival-bag)[data-battle-format=singles]{--game-dock-height:160px}
 body.game-mode:has(.battle-shell)[data-battle-format=singles] .health-plate{width:188px;padding:4px 8px}
 body.game-mode:has(.battle-shell)[data-battle-format=singles] .health-plate:is(.enemy,.player){top:55px;bottom:auto}
 body.game-mode:has(.battle-shell)[data-battle-format=singles] .plate-top{gap:4px;margin-bottom:4px}
 body.game-mode:has(.battle-shell)[data-battle-format=singles] .plate-top strong{font-size:20px;line-height:1.1}
 body.game-mode:has(.battle-shell)[data-battle-format=singles] .plate-top .level{font-size:10px;flex:none}
 body.game-mode:has(.battle-shell)[data-battle-format=singles] .plate-top .level b{font-size:12px}
 body.game-mode:has(.battle-shell)[data-battle-format=singles] .plate-types{gap:4px;margin-top:3px}
 body.game-mode:has(.battle-shell)[data-battle-format=singles] .plate-types .type-tag{font-size:9px;padding:2px 3px}
 body.game-mode:has(.battle-shell)[data-battle-format=singles] .health-row{gap:4px}
 body.game-mode:has(.battle-shell)[data-battle-format=singles] .health-row>span{font-size:12px}
 body.game-mode:has(.battle-shell)[data-battle-format=singles] .health-row small{font-size:14px;min-width:50px}
 body.game-mode:has(.battle-shell)[data-battle-format=singles] .health-track{height:8px}
 body.game-mode:has(.battle-shell)[data-battle-format=singles] .health-plate .xp-track{height:3px;margin-top:3px}
 body.game-mode:has(.battle-shell)[data-battle-format=singles] .battle-commands{left:var(--game-gutter);right:var(--game-gutter);width:auto;grid-template-columns:150px minmax(0,1fr);grid-template-rows:minmax(0,1fr);align-items:stretch;gap:8px}
 body.game-mode:has(.battle-shell)[data-battle-format=singles] .battle-command-heading{display:block;align-self:center;visibility:hidden}
 body.game-mode:has(.battle-shell)[data-battle-format=singles] .battle-command-heading strong{display:block;font-size:22px}
 body.game-mode:has(.battle-shell)[data-battle-format=singles] .battle-command-heading>span{display:block;font-size:14px;line-height:1.4;margin-top:6px}
 body.game-mode:has(.battle-shell)[data-battle-format=singles] .battle-command{padding-top:3px;padding-bottom:3px}
 body.game-mode:has(.battle-shell)[data-battle-format=singles] .battle-command strong{font-size:22px}
 body.game-mode:has(.battle-shell)[data-battle-format=singles] .battle-command small{font-size:14px}
 body.game-mode:has(.battle-shell)[data-battle-format=singles] .battle-shell:has(.battle-commands) .battle-message{visibility:visible;left:var(--game-gutter);bottom:var(--game-dock-bottom);width:162px;height:var(--game-dock-height);padding:10px 9px;gap:5px;z-index:15}
 body.game-mode:has(.battle-shell)[data-battle-format=singles] .battle-message p{font:500 14px/1.4 var(--body)}
 body.game-mode:has(.battle-shell)[data-battle-format=singles] .battle-message p.battle-recap{font:500 14px/1.35 var(--body);gap:7px}
 body.game-mode:has(.battle-shell)[data-battle-format=singles] .battle-bottom{visibility:hidden}
 body.game-mode:has(.battle-shell)[data-battle-format=singles] .battle-heading>div:last-child{left:112px;top:10px}
 body.game-mode:has(.battle-shell)[data-battle-format=singles] .battle-heading .turn-chip{min-width:27px;font-size:8px}
 body.game-mode:has(.battle-shell)[data-battle-format=singles] .battle-heading>div:first-child{max-width:96px}
 body.game-mode:has(.battle-shell)[data-battle-format=singles] .battle-heading .run-info-button{max-width:96px}
 body.game-mode:has(.battle-shell)[data-battle-format=singles] .battle-field-strip{left:243px;right:auto;top:10px;bottom:auto;width:clamp(60px,calc(100vw - 441px),125px);max-width:none}
 body.game-mode:has(.battle-shell)[data-battle-format=singles] .battle-field-strip button{font-size:9px}
}

/* Compact doubles keep four health cards clear and share one command scroller. */
@media(min-width:480px) and (max-width:700px) and (max-height:500px){
 body.game-mode[data-screen=battle][data-battle-format=doubles]{--game-dock-height:132px;--game-dock-bottom:8px;--game-gutter:8px}
 body.game-mode[data-screen=battle][data-battle-format=doubles] .double-battle-heading{left:8px;right:248px;top:8px;max-width:none;min-height:44px;height:auto;padding:0 6px;font:700 12px/1.2 var(--body);gap:5px}
 body.game-mode[data-screen=battle][data-battle-format=doubles] .double-battle-heading>span>small{font:500 11px/1.2 var(--body);margin-top:3px}
 body.game-mode[data-screen=battle][data-battle-format=doubles] .double-battle-heading button{min-width:44px;min-height:44px;font-size:14px;flex:none}
 body.game-mode[data-screen=battle][data-battle-format=doubles] .double-health{top:58px;bottom:auto;right:auto;width:calc((100vw - 40px)/4);height:auto;min-height:76px;padding:4px 6px;display:grid;grid-template-columns:auto minmax(0,1fr);gap:2px 4px;border-radius:2px 8px 2px 8px}
 body.game-mode[data-screen=battle][data-battle-format=doubles] .double-health.player.slot-0{left:8px}
 body.game-mode[data-screen=battle][data-battle-format=doubles] .double-health.player.slot-1{left:calc(25% + 6px)}
 body.game-mode[data-screen=battle][data-battle-format=doubles] .double-health.enemy.slot-0{left:calc(50% + 4px)}
 body.game-mode[data-screen=battle][data-battle-format=doubles] .double-health.enemy.slot-1{left:calc(75% + 2px)}
 body.game-mode[data-screen=battle][data-battle-format=doubles] .double-health>div{display:contents}
 body.game-mode[data-screen=battle][data-battle-format=doubles] .double-health strong{grid-column:1/-1;font:600 clamp(18px,3.52vw,20px)/1 var(--pixel);white-space:normal;overflow:visible;text-overflow:clip;overflow-wrap:anywhere}
 body.game-mode[data-screen=battle][data-battle-format=doubles] .double-health>div>small{grid-column:1;font:600 11px/1.2 var(--body)}
 body.game-mode[data-screen=battle][data-battle-format=doubles] .double-health-types{grid-column:2;display:flex;position:static;max-width:none;min-width:0;flex-wrap:wrap;gap:2px;margin:0;align-items:center}
 body.game-mode[data-screen=battle][data-battle-format=doubles] .double-health-types i{display:inline;font:700 10px/1.2 var(--body);padding:0 2px}
 body.game-mode[data-screen=battle][data-battle-format=doubles] .double-health-types b{font:700 11px/1.2 var(--body);padding:0;overflow-wrap:anywhere}
 body.game-mode[data-screen=battle][data-battle-format=doubles] .double-health-track{grid-column:1/-1;height:8px;margin:1px 0 0}
 body.game-mode[data-screen=battle][data-battle-format=doubles] .double-health .double-health-value{grid-column:1/-1;display:block!important;font:600 12px/1.2 var(--body);margin:0}
 body.game-mode[data-screen=battle][data-battle-format=doubles] .double-commands.action-area{left:calc(30% + 8px);right:8px;bottom:8px;top:auto;width:auto;height:132px;max-height:132px;padding:8px;display:grid;grid-template-columns:124px minmax(0,1fr);grid-template-rows:max-content max-content;gap:8px;align-items:start;overflow:auto;scroll-padding:8px}
 body.game-mode[data-screen=battle][data-battle-format=doubles] .double-actor-tabs{grid-column:1;grid-row:1;display:flex;flex-direction:column;gap:6px;min-height:0;min-width:0}
 body.game-mode[data-screen=battle][data-battle-format=doubles] .double-actor-tabs>button{flex:none;min-height:56px;padding:5px 6px;gap:3px}
 body.game-mode[data-screen=battle][data-battle-format=doubles] .double-actor-tabs strong{font:600 20px/1.1 var(--pixel);white-space:normal;overflow:visible;text-overflow:clip;overflow-wrap:anywhere}
 body.game-mode[data-screen=battle][data-battle-format=doubles] .double-actor-tabs small{font:600 12px/1.3 var(--body);max-width:100%;text-align:left;white-space:normal}
 body.game-mode[data-screen=battle][data-battle-format=doubles] .double-commands .double-moves{grid-column:2;grid-row:1;display:grid;grid-template-columns:minmax(0,1fr);grid-template-rows:none;grid-auto-rows:max-content;min-height:0;min-width:0;height:auto;max-height:none;overflow:visible;gap:6px}
 body.game-mode[data-screen=battle][data-battle-format=doubles] .double-moves>button{min-height:58px;padding:6px;min-width:0}
 body.game-mode[data-screen=battle][data-battle-format=doubles] .double-moves strong{font:600 22px/1.1 var(--pixel);white-space:normal;overflow-wrap:anywhere}
 body.game-mode[data-screen=battle][data-battle-format=doubles] .double-moves small{font:600 12px/1.3 var(--body);margin-top:4px;white-space:normal;overflow-wrap:anywhere}
 body.game-mode[data-screen=battle][data-battle-format=doubles] .double-commands .double-targets{grid-column:2;grid-row:1;display:grid;grid-template-columns:minmax(0,1fr);grid-auto-rows:max-content;min-height:0;min-width:0;height:auto;max-height:none;overflow:visible;gap:6px;align-content:start}
 body.game-mode[data-screen=battle][data-battle-format=doubles] .double-targets>span{font:700 12px/1.3 var(--body);white-space:normal;overflow-wrap:anywhere}
 body.game-mode[data-screen=battle][data-battle-format=doubles] .double-targets>button:not(.double-cancel){min-height:58px;min-width:0;gap:6px;padding:6px}
 body.game-mode[data-screen=battle][data-battle-format=doubles] .double-targets .sprite{width:36px;height:36px;flex:none}
 body.game-mode[data-screen=battle][data-battle-format=doubles] .double-targets>button>span{font:600 22px/1.1 var(--pixel);white-space:normal;overflow-wrap:anywhere}
 body.game-mode[data-screen=battle][data-battle-format=doubles] .double-targets>button small{font:600 12px/1.3 var(--body);margin-top:3px;white-space:normal}
 body.game-mode[data-screen=battle][data-battle-format=doubles] .double-targets .double-cancel{min-height:44px;font:700 12px/1.3 var(--body);padding:6px;width:100%}
 body.game-mode[data-screen=battle][data-battle-format=doubles] .double-turn-actions{position:static;bottom:auto;grid-column:1/-1;grid-row:2;display:grid;grid-template-columns:72px minmax(0,1fr) 138px;gap:6px;padding:0;min-height:44px;min-width:0}
 body.game-mode[data-screen=battle][data-battle-format=doubles] .double-turn-actions>button{min-height:44px;padding:6px;font:700 12px/1.3 var(--body);white-space:normal}
 body.game-mode[data-screen=battle][data-battle-format=doubles] .double-turn-actions>span{font:700 12px/1.3 var(--body);max-width:none;white-space:normal}
 body.game-mode[data-screen=battle][data-battle-format=doubles] .battle-message{left:8px;right:auto;top:auto;bottom:8px;width:calc(30% - 16px);height:132px;max-height:132px;padding:8px;gap:5px;overflow:auto}
 body.game-mode[data-screen=battle][data-battle-format=doubles] .battle-message .message-diamond{display:none}
 body.game-mode[data-screen=battle][data-battle-format=doubles] .battle-message>p,body.game-mode[data-screen=battle][data-battle-format=doubles] .double-recap p{font:500 14px/1.35 var(--body);margin:0;white-space:normal;overflow-wrap:anywhere}
 body.game-mode[data-screen=battle][data-battle-format=doubles] .double-recap{max-height:100%;overflow:auto;min-width:0}
 body.game-mode[data-screen=battle][data-battle-format=doubles] .double-recap>small{font:600 12px/1.3 var(--body)}
}

/* Compact camp reserves separate space for guidance, companions and commands. */
@media(min-width:480px) and (max-width:700px) and (max-height:500px){
 body.game-mode:is([data-screen=camp],[data-screen=title]) .game-hud__place{min-height:44px;height:44px;max-width:calc(100vw - 270px);width:max-content;padding:4px 6px;gap:6px}
 body.game-mode:is([data-screen=camp],[data-screen=title]) .game-hud__place strong{font:600 12px/1.2 var(--body)}
 body.game-mode:is([data-screen=camp],[data-screen=title]) .game-hud__place small{font:500 11px/1.2 var(--body);letter-spacing:0;margin-top:2px;white-space:nowrap}
 body.game-mode .camp-screen--clear{display:grid;grid-template-columns:minmax(0,1.15fr) minmax(0,1fr);grid-template-rows:minmax(0,1fr) 100px;gap:8px 10px;padding:58px 10px 10px}
 body.game-mode .camp-screen--clear .camp-sign{display:none}
 body.game-mode .camp-screen--clear .camp-dialogue,body.game-mode .camp-screen--clear .camp-dialogue:has(+.camp-commands .camp-primary){position:relative;inset:auto;grid-column:1;grid-row:1;width:auto;height:auto;min-height:0;max-height:none;padding:8px 10px;gap:4px 6px;align-content:start;overflow:auto}
 body.game-mode .camp-screen--clear .camp-dialogue .dialogue-speaker{font:600 12px/1.2 var(--body)}
 body.game-mode .camp-screen--clear .camp-dialogue p{font:600 22px/1 var(--pixel);margin:0;white-space:normal}
 body.game-mode .camp-screen--clear .camp-dialogue .dialogue-subtext{font:400 14px/1.3 var(--body);white-space:normal}
 body.game-mode .camp-screen--clear .camp-companions{position:relative;inset:auto;grid-column:1;grid-row:2;width:100%;height:100px;min-height:0;transform:none;display:flex;gap:0;align-items:stretch;justify-content:center;pointer-events:auto}
 body.game-mode .camp-screen--clear .camp-companions .camp-companion{flex:1;min-width:0;height:100px;margin:0;padding:0;gap:2px;display:flex;flex-direction:column;justify-content:flex-end;align-items:center}
 body.game-mode .camp-screen--clear .camp-companions .camp-companion .sprite{width:min(100%,76px);height:60px;max-height:60px;min-height:0;margin:0;object-fit:contain;object-position:center bottom}
 body.game-mode .camp-screen--clear .camp-companions .camp-ground{display:none}
 body.game-mode .camp-screen--clear .camp-companion__name{display:block;width:100%;max-width:none;font:600 16px/1.2 var(--pixel);text-align:center;white-space:normal;overflow-wrap:anywhere}
 body.game-mode .camp-screen--clear .camp-companion__name small{display:block;margin:1px 0 0;font:500 14px/1.1 var(--body)}
 body.game-mode .camp-screen--clear .camp-commands,body.game-mode .camp-screen--clear .camp-commands:has(.camp-primary){position:relative;inset:auto;grid-column:2;grid-row:1/3;width:auto;height:auto;min-height:0;display:grid;grid-template-columns:minmax(0,1fr);grid-template-rows:minmax(92px,1fr) 44px 44px 44px;padding:6px;gap:4px;overflow:visible}
 body.game-mode .camp-screen--clear .camp-commands button{min-width:0;min-height:44px;padding:4px 6px;gap:6px;white-space:normal}
 body.game-mode .camp-screen--clear .camp-commands button:not(.camp-primary){font:700 14px/1.3 var(--body)}
 body.game-mode .camp-screen--clear .camp-commands .camp-primary{min-height:92px;grid-column:1}
 body.game-mode .camp-screen--clear .camp-commands .camp-primary>.icon,body.game-mode .camp-screen--clear .camp-commands .camp-primary>b{display:none}
 body.game-mode .camp-screen--clear .camp-commands .camp-primary__text{display:block;min-width:0;flex:1;font:inherit;color:inherit}
 body.game-mode .camp-screen--clear .camp-commands .camp-primary strong{font:600 20px/1.1 var(--pixel);white-space:normal}
 body.game-mode .camp-screen--clear .camp-commands .camp-primary small{font:500 13px/1.3 var(--body);margin-top:3px;white-space:normal}
 body.game-mode .camp-screen--clear .camp-more{grid-column:1;min-width:0;min-height:44px}
 body.game-mode .camp-screen--clear .camp-more>summary{min-height:44px;font:600 14px/1.3 var(--body);white-space:normal}
 body.game-mode .camp-screen--clear .camp-more__options{left:0;right:0;bottom:48px;padding:6px;gap:6px;max-height:calc(100dvh - 128px);overflow:auto}
 body.game-mode .camp-screen--clear .camp-more__options button{min-height:44px}
}

/* Short-landscape opening retains the original cast and both native actions. */
@media(min-width:480px) and (max-width:700px) and (max-height:500px){
 body.game-mode .title-screen{padding:58px 16px 10px;justify-content:center;gap:4px}
 body.game-mode .title-lockup{flex:none}
 body.game-mode .title-kicker{font:600 12px/1.2 var(--body);letter-spacing:1px;margin-bottom:4px}
 body.game-mode .title-logo{font:700 52px/.9 var(--pixel);letter-spacing:2px;margin:0}
 body.game-mode .title-rule{height:12px;margin-top:4px}
 body.game-mode .title-rule .icon{width:12px;height:12px}
 body.game-mode .title-cast{height:76px;min-height:0;flex:none;gap:12px;margin:0}
 body.game-mode .title-cast .sprite{width:80px;height:72px;max-height:100%;margin:0}
 body.game-mode .title-cast .sprite:nth-child(2){width:88px;height:76px;margin:0}
 body.game-mode .title-actions{display:grid;grid-template-columns:minmax(0,1fr) minmax(0,1fr);width:min(440px,100%);min-width:0;flex:none;padding:6px;gap:8px;align-items:stretch}
 body.game-mode .title-actions button{min-height:44px;min-width:0;padding:6px 10px;white-space:normal}
 body.game-mode .title-actions .button.primary{font:600 22px/1.1 var(--pixel);min-height:44px}
 body.game-mode .title-actions .text-button{font:600 14px/1.3 var(--body)}
 body.game-mode .title-actions button:first-child:before{content:none}
 body.game-mode .title-prompt{position:static;inset:auto;font:500 12px/1.2 var(--body);letter-spacing:0;margin:0;text-align:center}
}

/* Short-landscape starter selection begins below the HUD and keeps its facts. */
@media(min-width:480px) and (max-width:1000px) and (max-height:500px){
 body.game-mode[data-screen=intro] .game-hud__place{min-height:44px;height:44px;max-width:calc(100vw - 270px);width:max-content;padding:4px 6px;gap:6px}
 body.game-mode[data-screen=intro] .game-hud__place strong{font:600 12px/1.2 var(--body)}
 body.game-mode[data-screen=intro] .game-hud__place small{font:500 11px/1.2 var(--body);letter-spacing:0;margin-top:2px;white-space:nowrap}
 body.game-mode .starter-screen{display:flex;flex-direction:column;justify-content:flex-start;align-items:stretch;width:100%;padding:58px 12px 12px;gap:6px;overflow:auto;scroll-padding:58px 8px 8px}
 body.game-mode .starter-screen__heading{flex:none;display:flex;flex-direction:column;align-items:center;gap:0;margin:0;text-align:center}
 body.game-mode .starter-screen__heading .eyebrow{font:600 12px/1.2 var(--body);letter-spacing:.5px;margin:0}
 body.game-mode .starter-screen__heading h1{font:600 24px/1.1 var(--pixel);margin:0}
 body.game-mode .starter-screen .starter-grid{flex:none;display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:8px;width:100%;margin:0}
 body.game-mode .starter-screen .starter-card{display:grid;grid-template-rows:54px auto auto auto;align-content:start;justify-items:center;gap:2px;min-height:0;height:auto;padding:6px 4px;text-align:center}
 body.game-mode .starter-screen .starter-art{width:100%;height:54px;min-width:0}
 body.game-mode .starter-screen .starter-art .sprite{width:64px;height:54px;max-width:100%;margin:0;object-fit:contain}
 body.game-mode .starter-screen .starter-name{font:600 22px/1.1 var(--pixel);margin:0;white-space:normal}
 body.game-mode .starter-screen .starter-type{display:flex;justify-content:center;gap:4px;margin:0}
 body.game-mode .starter-screen .starter-type .type-tag{font:700 11px/1.1 var(--body);padding:2px 4px;letter-spacing:0}
 body.game-mode .starter-screen .starter-role{display:block;font:500 12px/1.2 var(--body);min-height:0;margin:0;white-space:normal}
 body.game-mode .starter-screen .starter-confirm{flex:none;display:flex;flex-direction:row;align-items:center;gap:10px;width:100%;margin:0;padding:6px}
 body.game-mode .starter-screen .starter-confirm p{flex:1;min-width:0;min-height:0;max-width:none;margin:0;font:600 20px/1.1 var(--pixel)}
 body.game-mode .starter-screen .starter-confirm p>strong{display:block;font:600 22px/1.1 "Pixelify",monospace}
 body.game-mode .starter-screen .starter-confirm p>span{display:block;max-width:none;font:400 13px/1.3 var(--body);margin-top:3px;white-space:normal}
 body.game-mode .starter-screen .starter-confirm .button{flex:0 0 180px;min-width:0;min-height:48px;width:auto;max-width:none;padding:6px 8px;font:600 16px/1.2 var(--body);white-space:normal}
 body.game-mode .starter-screen__back{flex:none;align-self:center;min-height:44px;min-width:100px;margin:0;padding:6px 12px;font:600 14px/1.3 var(--body)}
}
