/* Mobile layout is intentionally last: desktop scenes stay unchanged. */
@media (max-width:900px){
 :root{--menu-height:64px;--mobile-gap:12px}
 html{height:auto!important;min-height:100%;overflow-x:clip;overflow-y:auto!important;scroll-padding-top:76px}
 body,body.ui37,body.fx-world-panel{height:auto!important;min-height:100dvh;max-height:none!important;overflow-x:clip!important;overflow-y:auto!important;touch-action:pan-y pinch-zoom}
 body.ui37{padding:calc(var(--menu-height) + env(safe-area-inset-top,0px)) 0 env(safe-area-inset-bottom,0px)!important;margin:0!important}
 body.ui37 #app{height:auto!important;min-height:0;overflow:visible!important;width:100%;max-width:100%}
 body.ui37 #principal,body.ui37.fx-world-panel #principal,body.ui37.atelier-open #principal,body.ui37.fx-world-panel[data-rekt-screen] #principal{position:relative!important;inset:auto!important;top:auto!important;width:100%!important;max-width:100%!important;height:auto!important;max-height:none!important;min-height:calc(100dvh - var(--menu-height));margin:0!important;padding:0!important;overflow:visible!important;transform:none!important;animation:none!important;border-width:0!important;box-sizing:border-box}
 body.ui37 #ui37-chrome{height:calc(var(--menu-height) + env(safe-area-inset-top,0px))!important;padding:env(safe-area-inset-top,0px) 6px 0!important;gap:6px!important;inset:0 0 auto!important;width:100%;border-width:1px!important}
 #ui37-chrome .ui37-logo{width:72px!important;height:58px!important;background-size:960px 59.5px!important;flex-shrink:0}
 #ui37-chrome .ui37-mainnav,#ui37-chrome .ui37-settings{display:none!important}
 #ui37-chrome .ui37-resources{flex:1;min-width:0;justify-content:flex-end;gap:6px!important;font:11px/1.2 var(--cuerpo,Arial)!important}
 #ui37-chrome .ui37-gas{padding:3px!important;min-width:50px;min-height:44px!important;gap:2px!important}
 #ui37-chrome .ui37-gas img{width:18px!important;height:26px!important;object-fit:contain}
 #ui37-chrome .ui37-gas span{font-size:10px!important;gap:0!important}
 #ui37-chrome .ui37-gas b{font-size:14px!important}
 #ui37-chrome .ui37-smash{font-size:0!important;gap:3px!important;min-width:0}
 #ui37-chrome .ui37-smash b{font:700 12px var(--titulo,Arial)!important;white-space:nowrap}
 #ui37-chrome .ui37-smash img,#ui37-chrome .ui37-smash canvas,#ui37-chrome .ui37-smash .fx-smash-icon{width:20px!important;height:20px!important;flex-shrink:0}
 #ui37-chrome .ui37-more{display:block!important;flex:none;width:44px;min-height:44px!important;padding:5px!important;font-size:20px!important}
 body.ui37 .ui37-drawer{right:6px;top:100%;width:min(360px,calc(100vw - 12px));max-height:calc(100dvh - var(--menu-height) - 16px);overflow-y:auto;overscroll-behavior:contain}
 body.ui37 .ui37-drawer button{min-height:48px!important;white-space:normal!important}
 body.ui37 :is(button,input,select,summary){min-height:44px;box-sizing:border-box}
 body.ui37 :is(input,select,textarea){font-size:16px!important;max-width:100%}
 body.ui37 :is(button,p,h1,h2,h3,label){overflow-wrap:anywhere}
 body.ui37 :is(.inv-scene,.rekt-market-scene,.atelier-world,.forge44-world,.fx-arena-select,.combate,.fx-mission-world,.fx-steam-hub){position:relative!important;inset:auto!important;top:auto!important;width:100%!important;height:auto!important;max-height:none!important;min-height:0!important;margin:0!important;overflow:visible!important;box-sizing:border-box}
 body.ui37 .fx-steam-hub{padding-top:0!important}
 /* Battle first; playback and log are normal flow, never over the fighters. */
 body.ui37 .combate{display:flex!important;flex-direction:column!important;gap:10px;padding:8px 0 20px!important;background-size:cover!important}
 body.ui37 .combate::before{display:none!important}
 body.ui37 .combate>.tactics-combat-summary{position:relative!important;inset:auto!important;order:0;width:calc(100% - 16px)!important;min-height:0!important;max-height:none!important;margin:0 8px!important;padding:8px!important;display:grid!important;grid-template-columns:1fr 1fr;gap:8px;border-width:8px!important;font-size:12px!important;box-sizing:border-box}
 body.ui37 .tactics-combat-summary>span{min-width:0;display:flex;align-items:center;gap:5px;flex-wrap:wrap;font-size:12px;line-height:1.4}
 body.ui37 .tactics-combat-summary img{width:30px!important;height:30px!important;object-fit:contain}
 body.ui37 .combate>.escena{position:relative!important;inset:auto!important;order:1;display:flex!important;flex-direction:column;gap:12px;width:100%!important;height:auto!important;max-width:100%!important;margin:0!important}
 body.ui37 .combate .lienzo-caja{position:relative!important;inset:auto!important;width:100%!important;height:auto!important;max-width:100%!important;min-height:0!important;display:block!important;overflow:visible!important}
 body.ui37 .combate #lienzo{position:relative!important;display:block!important;inset:auto!important;width:100%!important;height:auto!important;max-width:100%!important;max-height:none!important;aspect-ratio:800/440;object-fit:contain;touch-action:pan-y pinch-zoom}
 body.ui37 .combate #resultado{position:relative!important;inset:auto!important;max-height:none!important;overflow:visible!important;width:100%!important;box-sizing:border-box}
 body.ui37 .combate #resultado:not(.visible){display:none!important}
 body.ui37 .combate .controles{position:relative!important;inset:auto!important;order:2;width:calc(100% - 16px)!important;margin:0 8px!important;display:flex!important;flex-wrap:wrap;justify-content:center;gap:8px!important;min-height:0!important;padding:8px!important;border-width:8px!important;box-sizing:border-box}
 body.ui37 .combate .controles button{min-width:44px!important;min-height:44px!important;font-size:15px!important;flex:1 0 auto!important}
 body.ui37 .combate .controles .semilla{order:5;flex:1 0 100%;margin:0!important;max-width:100%;overflow-wrap:anywhere;white-space:normal;font-size:11px!important}
 body.ui37 .combate>.registro{position:relative!important;inset:auto!important;order:3;width:calc(100% - 16px)!important;height:auto!important;min-height:220px!important;max-height:none!important;margin:0 8px!important;padding:24px!important;border:12px solid transparent!important;border-image:var(--menu-rim) 58 60 fill/12px stretch!important;background:#071522!important;display:block!important;filter:none;box-sizing:border-box;overflow:visible!important}
 body.ui37 .combate>.registro h3{font-size:16px!important}
 body.ui37 .combate #log{max-height:300px!important;overflow-y:auto!important;min-height:140px;touch-action:pan-y;overscroll-behavior-y:auto;font-size:14px;line-height:1.5}
 /* Arena selection keeps its ring, followed by the complete opponent panel. */
 body.ui37 .fx-arena-select{display:flex!important;flex-direction:column;gap:12px;padding:12px!important;background-size:cover!important}
 body.ui37 .fx-arena-heading,body.ui37 .fx-ring-stage,body.ui37 .fx-ring-preview,body.ui37 .fx-arena-management{position:relative!important;inset:auto!important;width:100%!important;max-width:100%!important;height:auto!important;max-height:none!important;margin:0!important;box-sizing:border-box}
 body.ui37 .fx-arena-heading{padding:14px!important;gap:10px;min-height:0!important;flex-wrap:wrap}
 body.ui37 .fx-arena-heading h1{font-size:23px!important}
 body.ui37 .fx-ring-stage{order:1;aspect-ratio:1.18;min-height:300px!important;overflow:hidden}
 body.ui37 .fx-ring-preview{order:2;padding:24px!important;display:flex!important;flex-direction:column!important;gap:12px}
 body.ui37 .fx-ring-preview>div{width:100%!important;overflow:visible!important}
 body.ui37 .fx-arena-management{order:3;padding:16px!important}
 body.ui37 .fx-arena-leaderboard{font-size:10px!important}
 /* Team sheet turns into a scrollable roster, podium, equipment and actions. */
 body.ui37 .fx-team-shade{position:relative!important;inset:auto!important;top:auto!important;height:auto!important;max-height:none!important;padding:0!important;display:block!important;overflow:visible!important}
 body.ui37 .fx-team-console{height:auto!important;min-height:100dvh;max-height:none!important;overflow:visible!important;display:flex!important;flex-direction:column;padding:12px!important;gap:12px;box-sizing:border-box}
 body.ui37 .fx-team-console>header,body.ui37 .fx-team-layout,body.ui37 .fx-team-footer{position:relative!important;inset:auto!important;width:100%!important;height:auto!important;max-height:none!important;margin:0!important;box-sizing:border-box}
 body.ui37 .fx-team-console>header{min-height:60px;gap:10px;padding:8px!important;flex-wrap:wrap}
 body.ui37 .fx-team-console>header h1{font-size:25px!important}
 body.ui37 .fx-team-layout{display:flex!important;flex-direction:column;gap:18px}
 body.ui37 .fx-team-roster{padding:16px!important;max-height:none!important;display:grid!important;grid-template-columns:1fr 1fr;gap:8px;overflow:visible!important}
 body.ui37 .fx-team-roster::before{display:none!important}
 body.ui37 .fx-team-roster button{min-height:76px!important;padding:8px!important}
 body.ui37 .fx-team-roster b{font-size:13px!important;white-space:normal}
 body.ui37 .fx-team-roster small{font-size:11px!important}
 body.ui37 .fx-team-hero{padding:12px!important;min-height:420px;overflow:visible!important}
 body.ui37 .fx-team-podium{height:220px!important;width:100%!important}
 body.ui37 .fx-team-podium canvas{height:210px!important;width:auto!important;max-width:100%}
 body.ui37 .fx-team-hero h2{font-size:24px!important}
 body.ui37 .fx-team-hero p,body.ui37 .fx-team-hero>small{font-size:14px!important}
 body.ui37 .fx-team-vitals,body.ui37 .fx-team-stats{width:100%!important;max-width:400px;position:relative!important;inset:auto!important}
 body.ui37 .fx-team-vitals span,body.ui37 .fx-team-stats span{font-size:12px!important;min-height:64px;padding:8px}
 body.ui37 .fx-team-loadout{padding:28px!important;overflow:visible!important;gap:20px}
 body.ui37 .fx-team-loadout section,body.ui37 .fx-team-skills,body.ui37 .fx-team-inventory{height:auto!important;max-height:none!important;overflow:visible!important;flex:none!important}
 body.ui37 .fx-team-footer{padding:18px!important;display:flex!important;flex-wrap:wrap;gap:10px;min-height:0!important}
 body.ui37 .fx-team-footer>p{width:100%;font-size:14px}
 body.ui37 .fx-team-footer button{min-height:48px!important;flex:1 1 130px;max-width:100%;font-size:14px!important;padding:10px!important}
 /* Keep illustrated inventory/market scenes, make their windows scroll. */
 body.ui37 :is(.inv-stage,.rekt-market-stage){position:relative!important;width:100%!important;height:calc(100vw * .8)!important;min-height:350px!important;max-height:none!important;background-size:cover!important}
 body.ui37 .inv-stage h1{font-size:25px!important}
 body.ui37 .inv-stage .inv-station{min-height:70px!important}
 body.ui37 .inv-stage .inv-station strong{font-size:14px!important;line-height:1.3;white-space:normal!important}
 body.ui37 :is(.inv-shade,.market-window-shade,.atelier-shade,.rival-details-shade,.forge44-modal){position:fixed!important;inset:var(--menu-height) 0 0!important;padding:8px!important;overflow-y:auto!important;display:block!important;box-sizing:border-box;z-index:10010!important}
 body.ui37 :is(.inv-window,.market-window,.atelier-dialog,.rival-details-window,.forge44-dialog){width:100%!important;height:auto!important;max-height:none!important;min-height:0!important;margin:0!important;padding:16px!important;border-width:10px!important;border-image-width:10px!important;overflow:visible!important;box-sizing:border-box}
 body.ui37 .inv-layout,body.ui37 .rival-details-body{grid-template-columns:minmax(0,1fr)!important;gap:16px!important}
 body.ui37 .inv-grid{grid-template-columns:repeat(2,minmax(0,1fr))!important}
 body.ui37 .inv-detail{position:relative!important;inset:auto!important;max-height:none!important;overflow:visible!important}
 body.ui37 .inv-tabs{display:flex;overflow-x:auto;gap:8px;flex-wrap:nowrap;max-width:100%}
 body.ui37 .inv-toolbar{display:flex;flex-wrap:wrap;gap:8px}
 body.ui37 .inv-toolbar>*{width:100%!important;max-width:100%!important}
 body.ui37 .market-window>header{position:relative!important;inset:auto!important;padding:0!important;gap:10px;flex-wrap:wrap}
 body.ui37 .market-window{padding-top:16px!important}
 body.ui37 .rival-details-window>footer{position:relative!important;display:flex!important;flex-direction:column!important;gap:12px}
 /* Forge already has a mobile layout; release the fixed outer viewport. */
 body.ui37 .forge44-scene{height:auto!important;max-height:none!important;min-height:0!important;overflow:visible!important}
 body.ui37 .forge44-world{overflow:visible!important}
 body.ui37 .forge44-recipe select{max-width:100%!important;min-width:0!important}
 body.ui37 .forge44-recipe .forge44-material-grid{flex-wrap:wrap;gap:8px}
 /* All secondary forms, tables and strategy choices remain reachable. */
 body.ui37 :is(.p-ranking,.p-ajustes,.p-referidos,.p-crear,.p-tienda,.p-arsenal){padding:12px!important;height:auto!important;max-height:none!important;overflow:visible!important;box-sizing:border-box}
 body.ui37 .dos,body.ui37 .tactics-layout,body.ui37 .tactics-options{display:grid!important;grid-template-columns:minmax(0,1fr)!important;gap:12px!important}
 body.ui37 .tactics-screen{height:auto!important;max-height:none!important;overflow:visible!important;margin:0!important;padding:14px!important;width:100%!important;box-sizing:border-box}
 body.ui37 .tactics-footer{position:relative!important;inset:auto!important;flex-wrap:wrap}
 body.ui37 .tactics-option{width:100%!important;min-width:0!important}
 body.ui37 .tabla-scroll{max-width:100%;overflow-x:auto!important;touch-action:pan-x pan-y}
 body.ui37 .tabla-rk{min-width:560px}
 body.ui37 .cab-pantalla h1{font-size:24px!important}
 body.ui37 .panel{min-width:0;box-sizing:border-box}
 #demo-auth,.demo-name-shade{overflow-y:auto!important;align-items:start!important;box-sizing:border-box;padding:20px 12px!important}
 #demo-auth form,.demo-name-window{max-width:100%!important;margin:auto;max-height:none!important;box-sizing:border-box;padding:20px!important}
 .demo-marker{position:relative!important;display:block;text-align:center;inset:auto!important;z-index:0!important;pointer-events:none;padding:8px;font-size:10px}
}
@media(max-width:380px){body.ui37 .fx-team-roster{grid-template-columns:1fr}#ui37-chrome .ui37-logo{width:60px!important}#ui37-chrome .ui37-smash b{font-size:10px!important}}
@media(max-width:900px){
 #ui37-chrome .ui37-logo{background-size:800px 49.6px!important;background-position:left center!important}
 body.ui37 .inv-tabs{display:grid!important;grid-template-columns:1fr 1fr!important;overflow:visible!important}
 body.ui37 .inv-tabs button{min-width:0!important;white-space:normal!important;font-size:13px!important;padding:8px!important}
 body.ui37 .inv-window-scroll,body.ui37 .market-window-body,body.ui37 .rival-details-body{height:auto!important;max-height:none!important;overflow:visible!important;min-height:0!important}
 body.ui37 .tabla-scroll::before{content:'↔ Desliza la tabla para ver puntos y estadísticas';display:block;padding:8px;color:#9bdce9;font:12px/1.4 var(--cuerpo,Arial)}
 body.ui37 .forge44-plans b{font-size:12px!important}
 body.ui37 .fx-mission-map :is(.fx-map-node,.fx-map-start,.fx-map-goal){min-width:44px!important;min-height:44px!important}
 body.ui37 .combate .controles [data-a="copiar-semilla"]{display:inline-flex!important;justify-content:center}
 body.ui37 .combate .controles .semilla{display:block!important}
 body.ui37 .fx-mission-shortcuts{display:flex!important;gap:8px!important}
 body.ui37 .fx-mission-shortcuts button{min-height:48px!important;min-width:0!important;flex:1;white-space:normal}
}
@media(max-width:900px){
 body.ui37 .tactics-screen-v2 .tactics-option{grid-template-columns:52px minmax(0,1fr)!important;gap:8px 12px!important;padding:12px!important}
 body.ui37 .tactics-screen-v2 .tactics-icon{width:48px!important;height:68px!important}
 body.ui37 .tactics-screen-v2 .tactics-option>b{font-size:17px!important;line-height:1.2;overflow-wrap:normal!important;word-break:normal!important}
 body.ui37 .tactics-screen-v2 .tactics-option>span:not(.tactics-icon),body.ui37 .tactics-screen-v2 .tactics-option>strong{font-size:13px!important;line-height:1.5;overflow-wrap:normal!important}
 body.ui37 .tactics-screen-v2 .tactics-footer>div{display:grid!important;grid-template-columns:1fr!important;gap:10px!important;width:100%!important}
 body.ui37 .tactics-screen-v2 .tactics-footer button{display:flex!important;align-items:center;justify-content:center;width:100%!important;min-height:48px!important;padding:12px!important;font-size:16px!important;line-height:1.4;white-space:normal!important;word-break:normal!important;overflow-wrap:normal!important}
 body.ui37 .tactics-screen-v2 .tactics-footer button svg{flex:none;width:24px;height:24px}
 body.ui37 :is(.fx-modal,.capa-modal){position:fixed!important;inset:var(--menu-height) 0 0!important;padding:10px!important;overflow-y:auto!important;display:block!important;z-index:10020!important;box-sizing:border-box}
 body.ui37 :is(.fx-drawer,.caja-modal){width:100%!important;max-width:100%!important;height:auto!important;max-height:none!important;overflow:visible!important;margin:0!important;box-sizing:border-box;padding:18px!important}
 body.ui37 :is(.progression-console,.gas-workshop){width:100%!important;height:auto!important;max-height:none!important;overflow:visible!important;box-sizing:border-box;padding:14px!important}
 body.ui37 .progression-layout{grid-template-columns:1fr!important;gap:16px!important}
 body.ui37 .progression-console>header,body.ui37 .progression-console>footer{flex-wrap:wrap!important;gap:12px!important}
 body.ui37 .progression-console>footer button{width:100%;min-height:48px}
 body.ui37 .progression-attribute{flex-wrap:wrap;gap:8px}
 body.ui37 .progression-attribute button{min-width:44px!important;min-height:44px!important}
}
@media(max-width:900px){
 body.ui37 .forge44-scene{display:flex!important;flex-direction:column!important;gap:12px;padding:16px!important;box-sizing:border-box;background-size:cover!important}
 body.ui37 .forge44-scene>:is(h1,.forge44-label,section,.forge44-anvil,.forge44-name,.forge44-recipe,.forge44-craft,.forge44-details,.forge44-pages,.forge44-notice){position:relative!important;inset:auto!important;width:100%!important;height:auto!important;max-height:none!important;box-sizing:border-box}
 body.ui37 .forge44-scene>h1{font-size:28px!important}
 body.ui37 .forge44-scene>.forge44-label{font-size:18px!important;padding:10px!important;background:#071625ed}
 body.ui37 .forge44-scene>section{padding:12px!important;background:#071625ed}
 body.ui37 .forge44-plans button{min-height:130px!important;font-size:14px!important}
 body.ui37 .forge44-plans .plan-sprite{width:64px!important;height:64px!important}
 body.ui37 .forge44-plans small,body.ui37 .forge44-plans span:not(.plan-sprite){font-size:12px!important}
 body.ui37 .forge44-anvil{min-height:160px!important;display:grid;place-items:center}
 body.ui37 .forge44-anvil .plan-sprite,body.ui37 .forge44-anvil .arma-ico{width:140px!important;height:140px!important}
 body.ui37 .forge44-name{font-size:20px!important}
 body.ui37 .forge44-recipe{font-size:14px!important;padding:14px!important;background:#071625ed}
 body.ui37 .forge44-recipe label{height:auto!important;flex-wrap:wrap;font-size:14px!important;gap:8px}
 body.ui37 .forge44-recipe select{height:auto!important;min-height:44px!important;width:100%!important}
 body.ui37 .forge44-recipe>small{font-size:13px!important;height:auto!important;line-height:1.5!important}
 body.ui37 .forge44-material img{width:34px!important;height:34px!important}
 body.ui37 .forge44-material b,body.ui37 .forge44-material small{font-size:12px!important}
 body.ui37 .forge44-recipe>.forge44-material-grid{height:auto!important;max-height:none!important;min-height:52px}
 body.ui37 .forge44-recipe .forge44-material{height:auto!important;min-height:44px!important}
 body.ui37 .forge44-recipe .forge44-material img{width:30px!important;height:30px!important}
 body.ui37 .forge44-recipe .forge44-material b{font-size:12px!important}
 body.ui37 .forge44-craft button,body.ui37 .forge44-details button,body.ui37 .forge44-upgrade button{font-size:16px!important;min-height:48px!important}
 body.ui37 .forge44-upgrade{font-size:14px!important}
 body.ui37 .fx-mission-world>.fx-mission-zone.fx-raid-journal{height:auto!important;max-height:none!important;overflow:visible!important;min-height:0!important}
 body.ui37 .fx-raid-log{flex:none!important;max-height:none!important;overflow:visible!important;overscroll-behavior:auto}
}
