/* Short landscape uses the original stage and controls. A visible pause
   button identifies a live/paused battle; finished and menu views stay normal.
   Outside this viewport range the existing scroll layout remains available. */
@media (orientation:landscape) and (min-width:640px) and (max-width:1100px) and (min-height:360px) and (max-height:500px){
body.is-playing:not(.is-battle-focus):has(#pause:not([hidden])){--landscape-rail:192px;--landscape-gap:6px;--landscape-hud:84px;--landscape-top:max(8px,env(safe-area-inset-top));--landscape-right:max(8px,env(safe-area-inset-right));--landscape-bottom:max(8px,env(safe-area-inset-bottom));--landscape-left:max(8px,env(safe-area-inset-left));--landscape-stage-width:min(calc(100vw - var(--landscape-left) - var(--landscape-right) - var(--landscape-rail) - var(--landscape-gap)),calc((100svh - var(--landscape-top) - var(--landscape-bottom) - var(--landscape-hud) - var(--landscape-gap)) * 480 / 220));overflow:hidden;}
body.is-playing:not(.is-battle-focus):has(#pause:not([hidden])) .site-header,
body.is-playing:not(.is-battle-focus):has(#pause:not([hidden])) .heading,
body.is-playing:not(.is-battle-focus):has(#pause:not([hidden])) footer,
body.is-playing:not(.is-battle-focus):has(#pause:not([hidden])) .control-strip{display:none;}
body.is-playing:not(.is-battle-focus):has(#pause:not([hidden])) .site-wrap{max-width:none;margin:0;padding:0;}
body.is-playing:not(.is-battle-focus):has(#pause:not([hidden])) main{position:fixed;inset:var(--landscape-top) calc(var(--landscape-right) + var(--landscape-rail) + var(--landscape-gap)) var(--landscape-bottom) var(--landscape-left);display:grid;grid-template-rows:var(--landscape-hud) minmax(0,1fr);gap:var(--landscape-gap);padding:0;min-width:0;overflow:hidden;}
body.is-playing:not(.is-battle-focus):has(#pause:not([hidden])) .game-shell{display:contents;container-type:normal;}
body.is-playing:not(.is-battle-focus):has(#pause:not([hidden])) .match-hud{grid-row:1;grid-column:1;height:var(--landscape-hud);width:100%;padding:6px 10px;gap:10px;border:1px solid #3b474b;border-radius:5px;}
body.is-playing:not(.is-battle-focus):has(#pause:not([hidden])) .fighter{gap:7px;min-width:0;}
body.is-playing:not(.is-battle-focus):has(#pause:not([hidden])) .fighter-avatar{width:30px;height:36px;font-size:23px;flex-shrink:0;}
body.is-playing:not(.is-battle-focus):has(#pause:not([hidden])) .fighter-smoke .fighter-avatar{font-size:28px;}
body.is-playing:not(.is-battle-focus):has(#pause:not([hidden])) .fighter-name{flex-direction:column;align-items:flex-start;gap:1px;margin-bottom:3px;}
body.is-playing:not(.is-battle-focus):has(#pause:not([hidden])) .fighter-smoke .fighter-name{align-items:flex-end;}
body.is-playing:not(.is-battle-focus):has(#pause:not([hidden])) .fighter-name strong{font-size:11px;line-height:13px;}
body.is-playing:not(.is-battle-focus):has(#pause:not([hidden])) .fighter-name span{font-size:7px;line-height:9px;}
body.is-playing:not(.is-battle-focus):has(#pause:not([hidden])) .stress-label{font-size:7px;line-height:9px;margin-top:3px;}
body.is-playing:not(.is-battle-focus):has(#pause:not([hidden])) .fighter-status{height:12px;line-height:12px;font-size:8px;margin-top:2px;}
body.is-playing:not(.is-battle-focus):has(#pause:not([hidden])) .fighter-mark{font-size:7px;line-height:9px;margin-top:2px;}
body.is-playing:not(.is-battle-focus):has(#pause:not([hidden])) .timer-wrap{width:60px;}
body.is-playing:not(.is-battle-focus):has(#pause:not([hidden])) .timer-wrap strong{font-size:22px;}
body.is-playing:not(.is-battle-focus):has(#pause:not([hidden])) .round-label{font-size:7px;letter-spacing:1px;}
body.is-playing:not(.is-battle-focus):has(#pause:not([hidden])) #stage{grid-row:2;grid-column:1;align-self:center;justify-self:center;width:var(--landscape-stage-width);height:calc(var(--landscape-stage-width) * 220 / 480);max-width:100%;aspect-ratio:480/220;}
body.is-playing:not(.is-battle-focus):has(#pause:not([hidden])) #stage canvas{width:100%;height:100%;}
body.is-playing:not(.is-battle-focus):has(#pause:not([hidden])) #pause-overlay{overflow-y:auto;justify-content:flex-start;justify-content:safe center;padding:8px;}
body.is-playing:not(.is-battle-focus):has(#pause:not([hidden])) #pause-overlay>*{flex-shrink:0;}
body.is-playing:not(.is-battle-focus):has(#pause:not([hidden])) #pause-overlay>span{font-size:22px;}
body.is-playing:not(.is-battle-focus):has(#pause:not([hidden])) #pause-overlay p{font-size:10px;margin:6px 0 10px;}
body.is-playing:not(.is-battle-focus):has(#pause:not([hidden])) #pause-overlay .primary-button,
body.is-playing:not(.is-battle-focus):has(#pause:not([hidden])) #pause-overlay .text-button{min-height:44px;}
body.is-playing:not(.is-battle-focus):has(#pause:not([hidden])) #pause-overlay .pause-links{gap:12px;}
body.is-playing:not(.is-battle-focus):has(#pause:not([hidden])) .loadout{position:fixed;top:var(--landscape-top);right:var(--landscape-right);bottom:calc(var(--landscape-bottom) + 98px);width:var(--landscape-rail);max-height:none;min-height:0;display:flex;flex-direction:column;gap:4px;padding:4px;overflow-y:auto;overflow-x:hidden;overscroll-behavior:contain;scroll-padding-top:160px;scrollbar-gutter:stable;border:1px solid #3b474b;border-radius:5px;}
body.is-playing:not(.is-battle-focus):has(#pause:not([hidden])) .loadout-top{position:sticky;top:0;z-index:5;min-height:44px;flex:0 0 44px;margin:0;padding:0;background:#1a252d;}
body.is-playing:not(.is-battle-focus):has(#pause:not([hidden])) .loadout-top>div:first-child{display:none;}
body.is-playing:not(.is-battle-focus):has(#pause:not([hidden])) .loadout-top>.loadout-actions{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));width:100%;min-width:0;gap:4px;flex:none;}
body.is-playing:not(.is-battle-focus):has(#pause:not([hidden])) .loadout-actions>.small-button{width:100%;min-width:0;min-height:44px;padding:4px;font-size:9px;line-height:1.2;white-space:normal;justify-content:center;}
body.is-playing:not(.is-battle-focus):has(#pause:not([hidden])) .loadout-actions kbd{display:none;}
body.is-playing:not(.is-battle-focus):has(#pause:not([hidden])) .battle-controls{position:sticky;top:44px;z-index:4;flex:none;display:flex;flex-direction:column;align-items:stretch;gap:4px;padding:0;background:#1a252d;}
body.is-playing:not(.is-battle-focus):has(#pause:not([hidden])) .rage{flex:none;display:grid;grid-template-columns:32px minmax(0,1fr);height:16px;gap:4px;align-items:center;}
body.is-playing:not(.is-battle-focus):has(#pause:not([hidden])) .rage>div:first-child>span,
body.is-playing:not(.is-battle-focus):has(#pause:not([hidden])) .rage small{display:none;}
body.is-playing:not(.is-battle-focus):has(#pause:not([hidden])) .rage b{font-size:9px;line-height:12px;}
body.is-playing:not(.is-battle-focus):has(#pause:not([hidden])) .rage-track{margin:0;}
body.is-playing:not(.is-battle-focus):has(#pause:not([hidden])) .skill-grid{flex:none;width:100%;display:grid;grid-template-columns:repeat(2,minmax(0,1fr));grid-auto-rows:44px;gap:4px;}
body.is-playing:not(.is-battle-focus):has(#pause:not([hidden])) .skill{height:44px;min-height:44px;min-width:0;padding:4px;display:flex;flex-direction:row;align-items:center;gap:3px;}
body.is-playing:not(.is-battle-focus):has(#pause:not([hidden])) .skill-icon{width:16px;height:16px;flex-shrink:0;}
body.is-playing:not(.is-battle-focus):has(#pause:not([hidden])) .skill-copy{gap:1px;min-width:0;}
body.is-playing:not(.is-battle-focus):has(#pause:not([hidden])) .skill-copy strong{font-size:9px;line-height:1.1;white-space:normal;overflow-wrap:anywhere;}
body.is-playing:not(.is-battle-focus):has(#pause:not([hidden])) .skill-copy small{font-size:8px;line-height:1.15;overflow-wrap:anywhere;}
body.is-playing:not(.is-battle-focus):has(#pause:not([hidden])) .skill kbd{position:static;flex:0 0 8px;min-width:8px;padding:0;font-size:7px;background:transparent;}
body.is-playing:not(.is-battle-focus):has(#pause:not([hidden])) .skill[data-drum-stage]{padding-bottom:8px;}
body.is-playing:not(.is-battle-focus):has(#pause:not([hidden])) .drum-window{left:4px;right:4px;bottom:2px;height:2px;}
body.is-playing:not(.is-battle-focus):has(#pause:not([hidden])) .drum-window-cursor{height:5px;top:-1px;}
body.is-playing:not(.is-battle-focus):has(#pause:not([hidden])) .practice-loadout,
body.is-playing:not(.is-battle-focus):has(#pause:not([hidden])) .defense-tools,
body.is-playing:not(.is-battle-focus):has(#pause:not([hidden])) .practice-tools{flex:none;min-width:0;margin-top:4px;padding-top:6px;}
body.is-playing:not(.is-battle-focus):has(#pause:not([hidden])) .practice-loadout{align-items:stretch;gap:6px;}
body.is-playing:not(.is-battle-focus):has(#pause:not([hidden])) .practice-loadout>label{width:100%;flex-direction:column;align-items:stretch;gap:4px;white-space:normal;font-size:10px;}
body.is-playing:not(.is-battle-focus):has(#pause:not([hidden])) .practice-loadout select{width:100%;min-width:0;min-height:44px;font-size:10px;padding:6px;}
body.is-playing:not(.is-battle-focus):has(#pause:not([hidden])) .practice-actions{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:4px;width:100%;}
body.is-playing:not(.is-battle-focus):has(#pause:not([hidden])) .practice-actions>.small-button{min-height:44px;padding:5px;font-size:9px;justify-content:center;}
body.is-playing:not(.is-battle-focus):has(#pause:not([hidden])) .touch-controls:not([hidden]){position:fixed;right:var(--landscape-right);bottom:var(--landscape-bottom);width:var(--landscape-rail);height:92px;grid-template-columns:repeat(3,minmax(0,1fr));grid-template-rows:44px 44px;gap:4px;padding:0;margin:0;}
body.is-playing:not(.is-battle-focus):has(#pause:not([hidden])) .touch-controls>div{display:contents;}
body.is-playing:not(.is-battle-focus):has(#pause:not([hidden])) .touch-controls button{width:100%;height:44px;min-height:44px;min-width:44px;}
body.is-playing:not(.is-battle-focus):has(#pause:not([hidden])) .touch-controls #touch-attack{grid-column:3;grid-row:2;width:100%;height:44px;font-size:11px;gap:4px;}
body.is-playing[data-touch-controls="always"]:not(.is-battle-focus):has(#pause:not([hidden])) .touch-controls:not([hidden]){display:grid;}
@media(max-width:760px),(hover:none),(pointer:coarse){
body.is-playing:not(.is-battle-focus):has(#pause:not([hidden])) .touch-controls:not([hidden]){display:grid;}
}
/* Finished cards use the viewport; room review drops this selector immediately. */
body.is-playing:not(.is-battle-focus):has(#result:not([hidden])){overflow:hidden;}
body.is-playing:not(.is-battle-focus):has(#result:not([hidden])) .game-shell{container-type:normal;}
body.is-playing:not(.is-battle-focus):has(#result:not([hidden])) #result{position:fixed;inset:max(8px,env(safe-area-inset-top)) max(8px,env(safe-area-inset-right)) max(8px,env(safe-area-inset-bottom)) max(8px,env(safe-area-inset-left));padding:8px;overflow:hidden;align-items:center;justify-content:center;}
body.is-playing:not(.is-battle-focus):has(#result:not([hidden])) .result-card{max-width:100%;max-height:100%;overflow-y:auto;overscroll-behavior:contain;scrollbar-gutter:stable;}
}

/* The current lesson stays above optional defense settings in a short rail. */
@media (orientation:landscape) and (min-width:640px) and (max-width:1100px) and (min-height:360px) and (max-height:500px){
body.is-playing:not(.is-battle-focus) .is-guided #practice-step-list,
body.is-playing:not(.is-battle-focus) .is-guided #practice-target,
body.is-playing:not(.is-battle-focus) .is-guided #practice-rage{display:none}
body.is-playing:not(.is-battle-focus) .is-guided .practice-tools{order:1;margin-top:0;padding-top:0;border-top:0;gap:4px}
body.is-playing:not(.is-battle-focus) .is-guided .defense-tools{order:2}
body.is-playing:not(.is-battle-focus) .is-guided .practice-goal{font-size:10px;line-height:14px}
}
