/* A viewport-sized battle: narration, status, field and commands. */
.compact-battle-toolbar{flex-wrap:wrap;flex-shrink:0}
.compact-battle-toolbar .toolbar-dialogue{flex:1 1 50%;display:grid;grid-template-columns:44px minmax(0,1fr);align-items:center;gap:8px;min-height:54px;margin:0;padding:5px 8px;border:1px solid #a88b50;border-left:3px solid #ffcf4a;background:#21162c}
.compact-battle-toolbar .toolbar-dialogue .tamer-mugshot,.compact-battle-toolbar .toolbar-dialogue img{width:44px;height:44px;min-width:44px;object-fit:contain}
.compact-battle-toolbar .toolbar-dialogue b{font-size:12px;line-height:1.2}
.compact-battle-toolbar .toolbar-dialogue p{font-size:14px;line-height:1.3;height:auto;max-height:3.9em;overflow:auto;margin:3px 0 0}
.solo-battle-heading>span:first-of-type{display:none}
body.battle-toolbar-active .app:has(:is(#gameShell,#battle):not([hidden])){height:100dvh;min-height:0;padding:6px;overflow:auto}
body.battle-toolbar-active #gameShell,body.battle-toolbar-active #battle{height:100%;min-height:0;gap:6px;overflow:visible;align-items:stretch}
body.battle-toolbar-active #gameShell{grid-template-rows:auto minmax(0,1fr)}
body.battle-toolbar-active :is(#gameShell,#battle) .battle-card{height:100%;min-height:0}
body.battle-toolbar-active :is(#gameShell,#battle) .arena{aspect-ratio:auto;flex:1 1 auto;min-height:100px;height:auto}
body.battle-toolbar-active :is(#gameShell,#battle) .controls{flex:0 1 auto;max-height:38dvh;min-height:0;overflow:auto;padding:8px;gap:6px;overscroll-behavior:contain}
body.battle-toolbar-active :is(#gameShell,#battle) :is(.main-actions,.move-grid,.move-choices){grid-template-columns:repeat(2,minmax(0,1fr));gap:6px;min-width:0}
body.battle-toolbar-active :is(#gameShell,#battle) :is(.sidebar,.feed-card){min-height:0;height:100%;max-height:100%;overflow:auto}
body.battle-toolbar-active #gameShell .main-actions{grid-template-columns:repeat(3,minmax(0,1fr))}
body.battle-toolbar-active #gameShell .action{min-height:44px;padding:6px}
body.battle-toolbar-active #gameShell .side-actions{display:flex;gap:6px;padding:0}
body.battle-toolbar-active #gameShell .side-actions .action{flex:1}
@media(max-width:980px){
 body.battle-toolbar-active #gameShell,body.battle-toolbar-active #battle{grid-template-columns:minmax(0,1fr)}
 body.battle-toolbar-active :is(#gameShell,#battle) :is(.sidebar,.feed-card){display:none}
 .compact-battle-toolbar{padding:5px;gap:4px}
 .compact-battle-toolbar .toolbar-dialogue{flex-basis:100%}
 .battle-toolbar-actions{flex-basis:auto}
 body.battle-toolbar-active :is(#gameShell,#battle) .hud{grid-template-columns:44px minmax(0,1fr);gap:2px 5px;padding:4px}
 body.battle-toolbar-active :is(#gameShell,#battle) .hud .hud-mon-portrait{grid-column:1;grid-row:1/5;width:44px!important;height:52px!important}
 body.battle-toolbar-active :is(#gameShell,#battle) .hud .hud-name-row{grid-column:2;grid-row:1;flex-direction:row;gap:3px;flex-wrap:wrap}
 body.battle-toolbar-active :is(#gameShell,#battle) .hud .hud-tamer{display:none}
 body.battle-toolbar-active :is(#gameShell,#battle) .hud .hud-types{display:none}
 body.battle-toolbar-active :is(#gameShell,#battle) .hud .hp{grid-column:2;grid-row:2;min-height:23px}
 body.battle-toolbar-active :is(#gameShell,#battle) .hud .stamina-meter{grid-column:2;grid-row:3;height:18px;line-height:18px}
 body.battle-toolbar-active :is(#gameShell,#battle) .hud .finisher-meter{grid-column:2;grid-row:4;min-height:18px;padding:0 2px}
 body.battle-toolbar-active :is(#gameShell,#battle) .hud .scrolls{grid-column:1;grid-row:5;min-height:10px}
 body.battle-toolbar-active :is(#gameShell,#battle) .hud .hud-owner{grid-column:2;grid-row:5}
 body.battle-toolbar-active :is(#gameShell,#battle) .hud b{font-size:12px}
 body.battle-toolbar-active :is(#gameShell,#battle) .hud .meter-hp{font-size:12px}
 body.battle-toolbar-active #gameShell .action small{display:none}
 body.battle-toolbar-active #battle .command-menu{grid-template-columns:1fr;min-width:0;padding:5px;gap:5px}
 body.battle-toolbar-active :is(#gameShell,#battle) .controls{max-height:34dvh;padding-bottom:max(6px,env(safe-area-inset-bottom))}
}
@media(max-height:540px){
 body.battle-toolbar-active :is(#gameShell,#battle) .battle-card{min-height:480px}
 body.battle-toolbar-active .app{overflow:auto}
}

/* Desktop has a definite viewport height; status and commands cannot squeeze the field. */
@media(min-width:981px){
 body.battle-toolbar-active .app:has(:is(#gameShell,#battle):not([hidden])){height:max(800px,100dvh);padding:12px;min-height:0}
 body.battle-toolbar-active :is(#gameShell,#battle){height:100%;max-height:none;grid-template-columns:minmax(0,1fr) 260px;gap:10px}
 body.battle-toolbar-active #gameShell{grid-template-rows:auto minmax(0,1fr)}
 body.battle-toolbar-active :is(#gameShell,#battle) .arena{min-height:280px;flex:1 0 280px}
 body.battle-toolbar-active :is(#gameShell,#battle) .controls{flex:0 0 auto;max-height:none;overflow:visible;padding:10px;gap:8px}
 body.battle-toolbar-active #gameShell .main-actions{grid-template-columns:repeat(5,minmax(0,1fr))}
 body.battle-toolbar-active #gameShell .controls.moves-open{max-height:350px;overflow:auto}
 body.battle-toolbar-active :is(#gameShell,#battle) .battle-card{overflow:visible}
 body.battle-toolbar-active :is(#gameShell,#battle) :is(.sidebar,.feed-card){position:static}
 body.battle-toolbar-active .footer-note{display:none}
}

/* Let move descriptions determine card height; scroll only the command tray. */
body.battle-toolbar-active #gameShell .controls>*{flex-shrink:0}
body.battle-toolbar-active #gameShell .move-grid{height:auto;max-height:none;overflow:visible;grid-auto-rows:auto;align-items:stretch;gap:10px}
body.battle-toolbar-active #gameShell .move{display:flex;flex-direction:column;align-items:stretch;justify-content:flex-start;gap:6px;height:auto;max-height:none;min-height:140px;overflow:visible;padding:12px!important;white-space:normal}
body.battle-toolbar-active #gameShell .move :is(b,small,.pp,.type,.move-facts){position:static;inset:auto;height:auto;max-height:none;margin:0;flex:none;white-space:normal;overflow-wrap:anywhere}
body.battle-toolbar-active #gameShell .move small{font-size:14px;line-height:1.45}
body.battle-toolbar-active #gameShell .move .pp{font-size:12px;align-self:flex-start}
@media(max-width:600px){body.battle-toolbar-active #gameShell .move-grid{grid-template-columns:minmax(0,1fr)}}

body.battle-toolbar-active .finish-command.finish-ready{background:linear-gradient(135deg,#fff0a0,#edb72e 55%,#c28312);border:2px solid #ffe99a;color:#291905;box-shadow:0 0 18px #ffd44a66;animation:finishButtonRumble 1.8s infinite}
body.battle-toolbar-active .finish-command.finish-ready :is(b,small){color:#291905}
@keyframes finishButtonRumble{0%,70%,100%{transform:translate(0)}74%,82%,90%{transform:translate(-2px,1px)}78%,86%,94%{transform:translate(2px,-1px)}}
@media(prefers-reduced-motion:reduce){body.battle-toolbar-active .finish-command.finish-ready{animation:none}}
@media(min-width:981px){body.battle-toolbar-active #gameShell .main-actions{grid-template-columns:repeat(3,minmax(0,1fr))}}

/* Compact move selection keeps four attacks visible without a nested scrollbar. */
body.battle-toolbar-active #gameShell .side-actions:empty{display:none}
body.battle-toolbar-active #gameShell .move-grid{gap:6px}
body.battle-toolbar-active #gameShell .move{min-height:0;padding:8px 10px!important;gap:3px;display:grid;grid-template-columns:minmax(0,1fr) auto;grid-template-rows:auto auto auto;align-content:start}
body.battle-toolbar-active #gameShell .move>b{grid-column:1/-1;grid-row:1;font-size:13px;line-height:1.3}
body.battle-toolbar-active #gameShell .move>small{grid-column:1/-1;grid-row:2;line-height:1.35;font-size:14px}
body.battle-toolbar-active #gameShell .move>.type{grid-column:1;grid-row:3;justify-self:start;padding:0;border:0;background:none}
body.battle-toolbar-active #gameShell .move>.pp{grid-column:2;grid-row:3;align-self:center;font-size:12px;text-align:right}
body.battle-toolbar-active #gameShell .move .move-facts{margin-top:3px}
body.battle-toolbar-active #gameShell .controls .back-btn{min-height:32px;padding:6px 9px}
@media(min-width:981px){body.battle-toolbar-active #gameShell .controls.moves-open{max-height:none;overflow:visible}}
/* Main commands share the move-card dimensions in every battle format. */
body.battle-toolbar-active :is(#gameShell,#battle) :is(.main-actions,.command-options){display:grid;grid-template-columns:repeat(2,minmax(0,1fr));grid-template-rows:none;grid-auto-rows:minmax(100px,auto);gap:6px}
body.battle-toolbar-active :is(#gameShell,#battle) :is(.main-actions>.action,.command-action){grid-column:auto;grid-row:auto;min-height:100px;height:auto;padding:10px!important;justify-content:center;align-items:center}
body.battle-toolbar-active #battle .command-menu{display:block;overflow:visible;padding:0;border:0}
body.battle-toolbar-active #battle .command-mon{display:none}
body.battle-toolbar-active :is(#gameShell,#battle) .controls{max-height:none!important;overflow:visible!important;flex-shrink:0}
body.battle-toolbar-active #battle :is(#actionPanel,.action-row,.move-choices){height:auto;max-height:none;overflow:visible;flex-shrink:0}
body.battle-toolbar-active #battle .move-choices{grid-auto-rows:auto;align-items:stretch;gap:6px}
body.battle-toolbar-active #battle .move-choice{height:auto;min-height:100px;display:flex;flex-direction:column;gap:4px;padding:8px 10px!important}
body.battle-toolbar-active #battle .move-choice .move-description{font-size:14px;line-height:1.35}
body.battle-toolbar-active #battle .command-action b{font-size:13px;line-height:1.3}
body.battle-toolbar-active #battle .command-action small{font-size:14px;line-height:1.35}
@media(max-width:980px){body.battle-toolbar-active :is(#gameShell,#battle) .battle-card{height:auto;min-height:100%;overflow:visible}body.battle-toolbar-active :is(#gameShell,#battle) .arena{min-height:160px}body.battle-toolbar-active :is(#gameShell,#battle){height:auto;min-height:100%}}
/* Reserve the same command space regardless of which menu is open. */
body.battle-toolbar-active #gameShell .controls,body.battle-toolbar-active #gameShell .controls.moves-open{min-height:310px;height:310px;max-height:none!important;justify-content:flex-start;box-sizing:border-box}
body.battle-toolbar-active #gameShell :is(.main-actions,.move-grid){grid-auto-rows:110px;align-content:start}
body.battle-toolbar-active #gameShell :is(.main-actions>.action,.move){min-height:110px;height:110px;box-sizing:border-box}
body.battle-toolbar-active #gameShell .back-btn{display:block;visibility:hidden;pointer-events:none;flex:0 0 32px}
body.battle-toolbar-active #gameShell .moves-open .back-btn{visibility:visible;pointer-events:auto}
body.battle-toolbar-active #battle #actionPanel{min-height:310px;height:310px;box-sizing:border-box}
body.battle-toolbar-active #battle :is(.command-options,.move-choices){grid-auto-rows:110px;align-content:start}
body.battle-toolbar-active #battle :is(.command-action,.move-choice){min-height:110px;height:110px;box-sizing:border-box}
body.battle-toolbar-active #battle .action-row{align-content:start;align-items:start}
@media(max-width:600px){
 body.battle-toolbar-active #gameShell .controls,body.battle-toolbar-active #gameShell .controls.moves-open{height:560px;min-height:560px}
 body.battle-toolbar-active #battle #actionPanel{height:560px;min-height:560px}
 body.battle-toolbar-active :is(#gameShell,#battle) :is(.main-actions,.move-grid,.command-options,.move-choices){grid-template-columns:repeat(2,minmax(0,1fr));grid-auto-rows:160px}
 body.battle-toolbar-active :is(#gameShell,#battle) :is(.main-actions>.action,.move,.command-action,.move-choice){height:160px;min-height:160px}
}

@media(min-width:601px){body.battle-toolbar-active :is(#gameShell,#battle) :is(.main-actions,.command-options){grid-template-columns:repeat(3,minmax(0,1fr))}}
/* Phone-only layout. Desktop rules above remain unchanged. */
@media(max-width:600px){
 body.battle-toolbar-active :is(#gameShell,#battle) .weather-stage{height:190px;min-height:190px;flex:0 0 190px}
 body.battle-toolbar-active :is(#gameShell,#battle) .weather-stage>.arena{height:100%!important;min-height:160px!important;flex:1 1 auto}
 body.battle-toolbar-active :is(#gameShell,#battle) .battle-card>.arena{height:190px;min-height:190px;flex:0 0 190px}
 body.battle-toolbar-active #gameShell .controls,body.battle-toolbar-active #gameShell .controls.moves-open{height:auto;min-height:290px;padding:6px;gap:5px}
 body.battle-toolbar-active #battle #actionPanel{height:auto;min-height:260px}
 body.battle-toolbar-active :is(#gameShell,#battle) :is(.main-actions,.command-options){grid-template-columns:repeat(2,minmax(0,1fr));grid-auto-rows:58px;gap:5px}
 body.battle-toolbar-active :is(#gameShell,#battle) :is(.main-actions>.action,.command-action){height:58px;min-height:58px;padding:6px!important}
 body.battle-toolbar-active :is(#gameShell,#battle) :is(.move-grid,.move-choices){grid-template-columns:repeat(2,minmax(0,1fr));grid-auto-rows:minmax(116px,auto);gap:5px}
 body.battle-toolbar-active :is(#gameShell,#battle) :is(.move,.move-choice){height:auto;min-height:116px;padding:7px!important}
 body.battle-toolbar-active #gameShell .back-btn{display:none;flex-basis:auto}
 body.battle-toolbar-active #gameShell .moves-open .back-btn{display:block;min-height:32px}
 body.battle-toolbar-active .compact-battle-toolbar .toolbar-dialogue{min-height:50px;padding:4px 6px;grid-template-columns:38px minmax(0,1fr);gap:6px}
 body.battle-toolbar-active .compact-battle-toolbar .toolbar-dialogue :is(.tamer-mugshot,img){width:38px;height:38px;min-width:38px}
 body.battle-toolbar-active .compact-battle-toolbar .toolbar-dialogue p{min-height:0;font:12px/1.35 Arial,sans-serif;margin:2px 0;max-height:3.9em;overflow:auto}
 body.battle-toolbar-active .compact-battle-toolbar .toolbar-dialogue b{font-size:12px}
 body.battle-toolbar-active .battle-toolbar-actions{width:100%;gap:4px;justify-content:space-between}
 body.battle-toolbar-active .battle-toolbar-actions button{min-height:36px!important;padding:5px!important;font-size:10px!important}
 body.battle-toolbar-active :is(#gameShell,#battle) .controls .prompt{font-size:12px;line-height:1.3;min-height:16px}
 body.battle-toolbar-active :is(#gameShell,#battle) .command-action .command-icon{height:24px;flex-basis:24px;font-size:16px}
}
/* Compact phone attacks and lobby setup; no desktop selectors outside this query. */
@media(max-width:600px){
 body.battle-toolbar-active #gameShell .move{display:flex;flex-direction:column;align-items:stretch;justify-content:flex-start;gap:4px;min-height:0;height:auto;padding:8px!important}
 body.battle-toolbar-active #gameShell .move-grid,body.battle-toolbar-active #battle .move-choices{grid-auto-rows:auto;align-items:stretch}
 body.battle-toolbar-active #gameShell .move :is(b,small,.type,.pp){position:static;inset:auto;width:auto;min-width:0;max-width:100%;grid-column:auto;grid-row:auto;padding:0;text-align:left;align-self:flex-start}
 body.battle-toolbar-active #gameShell .move b,body.battle-toolbar-active #battle .move-choice b{font-size:12px;line-height:1.3}
 body.battle-toolbar-active #gameShell .move small,body.battle-toolbar-active #battle .move-description{font:13px/1.35 Arial,sans-serif}
 body.battle-toolbar-active #gameShell .move .pp{font:12px/1.3 Arial,sans-serif;white-space:normal}
 body.battle-toolbar-active #gameShell .move .type-emblem,body.battle-toolbar-active #battle .move-choice .type-emblem{font-size:11px;padding:2px 4px}
 body.battle-toolbar-active #gameShell .move .type-emblem svg{width:12px;height:12px}
 body.battle-toolbar-active #gameShell .controls .back-btn{font-size:11px;padding:7px;min-height:34px}
 body.battle-toolbar-active #gameShell .back-btn span{display:none}
 body.battle-toolbar-active #gameShell .controls.moves-open{min-height:0}
 body:has(#lobby:not([hidden])) .app{padding:6px}
 body:has(#lobby:not([hidden])) .topbar{min-height:0!important;height:auto!important;padding:6px!important;margin-bottom:6px;gap:4px}
 body:has(#lobby:not([hidden])) .topbar .mojumon-logo{width:150px;height:70px}
 body:has(#lobby:not([hidden])) .topbar .brand small{font-size:12px}
 body:has(#lobby:not([hidden])) .topbar .header-actions button{min-height:36px;font-size:11px;padding:6px 10px}
 #lobby:not([hidden]){gap:6px}
 #lobby:not([hidden]) :is(.lobby-main,.lobby-side,.sidebar){padding:8px;height:auto;max-height:none}
 #lobby:not([hidden]) :is(h1){font-size:20px;line-height:1.2;margin:10px 0 6px}
 #lobby:not([hidden]) :is(h2){font-size:13px;margin:6px 0}
 #lobby:not([hidden]) :is(.lobby-lead,.intro,.small,.match-help){font:13px/1.4 Arial,sans-serif;margin:5px 0}
 #lobby:not([hidden]) :is(.select-head,.section-head){margin:10px 0 5px;gap:6px;flex-wrap:wrap}
 #lobby:not([hidden]) :is(.mode-tabs,.tabs,.lobby-modes){gap:4px;margin:5px 0;flex-wrap:wrap}
 #lobby:not([hidden]) :is(.mode-tabs,.tabs,.lobby-modes)>button{min-height:36px;padding:7px;font-size:11px;flex:1;white-space:normal}
 #lobby:not([hidden]) :is(.tamer-select,.tamers){display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:5px}
 #lobby:not([hidden]) :is(.tamer-card,.tamer){min-height:100px!important;height:auto!important;padding:5px!important;display:flex;flex-direction:column;align-items:center;gap:3px}
 #lobby:not([hidden]) :is(.tamer-card,.tamer) img{width:100%;height:62px!important;object-fit:contain}
 #lobby:not([hidden]) :is(.tamer-card,.tamer) b{font-size:11px;line-height:1.2}
 #lobby:not([hidden]) :is(.tamer-card,.tamer) small{display:none}
 #lobby:not([hidden]) :is(.roster-select,.roster){display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:5px}
 #lobby:not([hidden]) :is(.roster-card,.roster>button){display:flex;flex-direction:column;align-items:center;min-height:130px!important;padding:6px!important;gap:3px}
 #lobby:not([hidden]) :is(.roster-card,.roster>button) img{height:76px!important;width:100%;object-fit:contain}
 #lobby:not([hidden]) :is(.roster-card,.roster>button) b{font-size:12px}
 #lobby:not([hidden]) .mojumon-scroll{max-height:330px;overflow:auto}
 #lobby:not([hidden]) #roster{max-height:330px;overflow:auto}
 #lobby:not([hidden]) :is(.setup-card,.rules-panel){padding:8px;margin-bottom:6px}
 #lobby:not([hidden]) .format-fields{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:6px}
 #lobby:not([hidden]) select,#lobby:not([hidden]) input{max-width:100%;min-width:0;font-size:16px;min-height:38px}
 #lobby:not([hidden]) :is(.party-slot,.preview-slot){grid-template-columns:44px minmax(0,1fr) 32px;gap:6px;padding:6px}
 #lobby:not([hidden]) :is(.party-slot,.preview-slot)>img{width:44px;height:48px}
 #lobby:not([hidden]) :is(.party-slot,.preview-slot) b{font-size:13px}
}
/* Phone move browsing runs sideways, never into a second row. */
@media(max-width:600px){
 body.battle-toolbar-active :is(#gameShell,#battle) :is(.move-grid,.move-choices){display:grid;grid-template-columns:none;grid-template-rows:auto;grid-auto-flow:column;grid-auto-columns:86%;grid-auto-rows:auto;width:100%;min-width:0;max-width:100%;overflow-x:auto!important;overflow-y:hidden!important;scroll-snap-type:x mandatory;scroll-padding-inline:0;overscroll-behavior-x:contain;-webkit-overflow-scrolling:touch;gap:8px;padding-bottom:7px;align-items:stretch}
 body.battle-toolbar-active :is(#gameShell,#battle) :is(.move,.move-choice){grid-column:auto;grid-row:1;scroll-snap-align:start;scroll-snap-stop:always;min-width:0;min-height:170px;height:auto;overflow-wrap:anywhere}
 body.battle-toolbar-active :is(#gameShell,#battle) .controls{overflow:visible!important;min-width:0}
 body.battle-toolbar-active #battle :is(#actionPanel,.action-row){min-width:0;max-width:100%}
 body.battle-toolbar-active #battle #actionPanel{height:auto;min-height:0}
 body.battle-toolbar-active #gameShell .controls,body.battle-toolbar-active #gameShell .controls.moves-open{height:auto;min-height:0}
 body.battle-toolbar-active :is(#gameShell,#battle) :is(.move-grid,.move-choices)::-webkit-scrollbar{height:4px}
 body.battle-toolbar-active :is(#gameShell,#battle) :is(.move-grid,.move-choices)::-webkit-scrollbar-thumb{background:#c4a15a;border-radius:3px}
}
@media(max-width:600px){
 body.battle-toolbar-active :is(#gameShell,#battle) :is(.move,.move-choice){min-height:0!important;height:auto!important;align-self:stretch;padding:8px!important}
 body.battle-toolbar-active :is(#gameShell,#battle) :is(.move-grid,.move-choices){grid-auto-rows:max-content;align-content:start;height:auto;min-height:0;padding-bottom:6px}
 body.battle-toolbar-active :is(#gameShell,#battle) .controls{height:auto!important;min-height:0!important;padding-bottom:max(12px,env(safe-area-inset-bottom))!important}
 body.battle-toolbar-active #battle #actionPanel{height:auto!important;min-height:0!important}
 body.battle-toolbar-active .app:has(:is(#gameShell,#battle):not([hidden])){height:auto;min-height:100dvh;overflow:visible;padding-bottom:max(16px,env(safe-area-inset-bottom))}
 body.battle-toolbar-active :is(#gameShell,#battle){max-height:none;overflow:visible}
 body.battle-toolbar-active :is(#gameShell,#battle) .battle-card{max-height:none;overflow:visible}
}
@media(max-width:600px){
 body>#result{position:fixed;inset:0;z-index:10000;width:100%;height:100dvh;box-sizing:border-box;padding:max(12px,env(safe-area-inset-top)) 12px max(12px,env(safe-area-inset-bottom));overflow-y:auto;overscroll-behavior:contain}
 body>#result.show{display:grid;align-items:center;justify-items:center}
 body>#result .result-box{box-sizing:border-box;width:100%;max-width:430px;max-height:100%;overflow:auto;padding:20px 14px;border-width:2px}
 body>#result .result-box h2{font-size:28px}
 body>#result .result-box p{font:14px/1.45 Arial,sans-serif}
 body>#result .result-actions{display:grid;grid-template-columns:1fr;gap:10px}
 body>#result .result-actions button{min-height:48px;width:100%;font-size:13px;padding:12px;touch-action:manipulation}
}
/* Shared phone command order and touch sizing for doubles and all expeditions. */
@media(max-width:600px){
 body.battle-toolbar-active #battle .command-options>.fight-command{order:0}
 body.battle-toolbar-active #battle .command-options>.rest-command{order:1}
 body.battle-toolbar-active #battle .command-options>.finish-command{order:2}
 body.battle-toolbar-active #battle .command-options>.switch-command{order:3}
 body.battle-toolbar-active #battle .command-options>.summary-command{order:4}
 body.battle-toolbar-active #battle .command-options>.command-action:not(.fight-command,.rest-command,.finish-command,.switch-command,.summary-command){order:5}
 body.battle-toolbar-active #battle .actor-tabs{display:flex;gap:5px;flex-wrap:wrap;margin-bottom:6px}
 body.battle-toolbar-active #battle .actor-tabs button{flex:1;min-width:0;min-height:40px;padding:6px;font-size:12px;white-space:normal}
 body.battle-toolbar-active #battle :is(.switch-reserve,.target-choice){min-height:58px;height:auto;max-width:100%;padding:7px!important;gap:8px;font-size:13px}
 body.battle-toolbar-active #battle :is(.switch-reserve,.target-choice) img{height:48px;width:48px;object-fit:contain}
 body.battle-toolbar-active #battle .control-footer{display:flex;gap:6px;flex-wrap:wrap}
 body.battle-toolbar-active #battle .control-footer button{min-height:44px;min-width:0;flex:1;padding:7px;font-size:12px}
}
/* iPad/touch tablets: readable cards and the same Fight-first command order. */
@media (min-width:601px) and (max-width:1366px) and (any-pointer:coarse){
 body.battle-toolbar-active #battle .command-options>.fight-command{order:0}
 body.battle-toolbar-active #battle .command-options>.rest-command{order:1}
 body.battle-toolbar-active #battle .command-options>.finish-command{order:2}
 body.battle-toolbar-active #battle .command-options>.switch-command{order:3}
 body.battle-toolbar-active #battle .command-options>.summary-command{order:4}
 body.battle-toolbar-active #battle .command-options>.command-action:not(.fight-command,.rest-command,.finish-command,.switch-command,.summary-command){order:5}
 body.battle-toolbar-active #gameShell .controls,body.battle-toolbar-active #gameShell .controls.moves-open,body.battle-toolbar-active #battle #actionPanel{height:auto!important;min-height:340px;max-height:none!important;overflow:visible!important}
 body.battle-toolbar-active :is(#gameShell,#battle) :is(.move-grid,.move-choices){grid-template-columns:repeat(2,minmax(0,1fr));grid-auto-rows:minmax(132px,max-content);align-items:stretch;gap:8px;height:auto;overflow:visible}
 body.battle-toolbar-active :is(#gameShell,#battle) :is(.move,.move-choice){display:flex;flex-direction:column;justify-content:flex-start;align-items:stretch;gap:5px;height:auto!important;min-height:132px;max-height:none;padding:10px!important;min-width:0;white-space:normal;overflow-wrap:anywhere}
 body.battle-toolbar-active :is(#gameShell,#battle) :is(.move,.move-choice)>*{position:static;inset:auto;min-width:0;max-width:100%;flex-shrink:0;grid-column:auto;grid-row:auto;text-align:left}
 body.battle-toolbar-active :is(#gameShell,#battle) :is(.move,.move-choice) b{font-size:14px;line-height:1.35}
 body.battle-toolbar-active :is(#gameShell,#battle) :is(.move small,.move-choice small,.move-description,.move .pp){font:14px/1.35 Arial,sans-serif;white-space:normal}
 body.battle-toolbar-active #gameShell .move .pp{width:auto;align-self:flex-start}
 body.battle-toolbar-active #battle .actor-tabs{flex-wrap:wrap;gap:6px}
 body.battle-toolbar-active #battle .actor-tabs button{white-space:normal;min-height:40px}
}
/* Reserve dialogue and toolbar tracks so changing battle messages never reflow the header. */
@media (max-width:600px), (min-width:601px) and (max-width:1366px) and (any-pointer:coarse){
 body.battle-toolbar-active .compact-battle-toolbar{display:grid;grid-template-columns:minmax(0,1fr) auto auto;grid-template-rows:80px 40px;align-items:center;gap:6px;padding:8px;min-width:0;box-sizing:border-box}
 body.battle-toolbar-active .compact-battle-toolbar .toolbar-dialogue{grid-column:1/-1;grid-row:1;width:100%;height:80px;min-height:80px;max-height:80px;box-sizing:border-box;min-width:0;overflow:hidden;grid-template-columns:44px minmax(0,1fr);padding:6px 8px;margin:0}
 body.battle-toolbar-active .compact-battle-toolbar .toolbar-dialogue>div{min-width:0;overflow:hidden}
 body.battle-toolbar-active .compact-battle-toolbar .toolbar-dialogue b{display:block;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;line-height:16px}
 body.battle-toolbar-active .compact-battle-toolbar .toolbar-dialogue p{height:38px;min-height:38px;max-height:38px;margin:3px 0 0;font:14px/19px Arial,sans-serif;overflow:auto;overflow-wrap:anywhere;overscroll-behavior:contain;scrollbar-gutter:stable}
 body.battle-toolbar-active .compact-battle-toolbar .toolbar-dialogue p b{display:inline;white-space:normal;line-height:inherit}
 body.battle-toolbar-active .compact-battle-toolbar>#roundLabel,body.battle-toolbar-active .compact-battle-toolbar>span:first-of-type{grid-column:1;grid-row:2;min-width:0;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;font-size:12px}
 body.battle-toolbar-active .compact-battle-toolbar>#clock{grid-column:2;grid-row:2;width:44px;font-size:12px;font-variant-numeric:tabular-nums;text-align:center}
 body.battle-toolbar-active .compact-battle-toolbar .battle-toolbar-actions{grid-column:3;grid-row:2;width:auto;flex-wrap:nowrap;gap:5px;margin:0}
 body.battle-toolbar-active .compact-battle-toolbar .battle-toolbar-actions button{min-height:36px!important;padding:6px!important;font-size:11px!important;white-space:nowrap}
}
@media(max-width:600px){
 body.battle-toolbar-active .compact-battle-toolbar{grid-template-columns:minmax(0,1fr) 44px;grid-template-rows:80px 18px 36px;gap:4px;padding:5px}
 body.battle-toolbar-active .compact-battle-toolbar .battle-toolbar-actions{grid-column:1/-1;grid-row:3;width:100%;justify-content:flex-end}
}
