/* One academy composition on large and compact screens. */
body.in-menu #lobby.home-menu{padding:0!important;box-sizing:border-box}
body.in-menu #lobby.home-menu .home-layout{position:absolute!important;top:var(--home-center-y,50%)!important;left:var(--home-center-x,50%)!important;bottom:auto!important;right:auto!important;height:var(--home-design-height,680px)!important;display:flex!important;flex-direction:column;transform:translate(-50%,-50%) scale(var(--home-scale,1))!important;transform-origin:center!important;padding:12px!important}
body #lobby.home-menu .play-panel>.rename-scroll{position:absolute;left:50%;bottom:136px;transform:translateX(-50%);width:235px;height:64px;margin:0;z-index:3}
body.hex-desktop-screens #lobby.home-menu .play-panel>.center-wizard-stage{bottom:225px}
@media(max-height:500px){
 body #lobby #play-setup{padding:10px 18px}
 #play-setup>header{margin-bottom:6px}
 body #lobby #play-setup .battle-type-picker button{height:clamp(85px,calc(100dvh - 250px),170px);min-height:0}
 #play-setup .setup-content{gap:10px}
 body #lobby #play-setup .queue-gems .queue-gem{height:52px;min-height:52px}
 #play-setup .queue-wizard-seal{height:42px;top:5px}
 #play-setup .setup-selection{margin:4px auto;padding:2px 18px}
 #play-setup>footer{margin-top:8px}
 body #lobby #play-setup .setup-start{min-height:44px;padding-block:7px}
}
body.hex-desktop-screens #lobby.home-menu .play-panel>.center-wizard-stage{bottom:225px!important}
body #lobby.home-menu .play-panel>.rename-scroll{bottom:156px}
/* Shared breathing room above Play at every screen size. */
body #lobby.home-menu .play-panel>.rename-scroll{bottom:183px}

/* Mobile browsers must not inflate text or reuse a desktop-sized clipping box. */
body.in-menu #lobby.home-menu{--home-safe-left:env(safe-area-inset-left,0px);--home-safe-right:env(safe-area-inset-right,0px);--home-safe-top:env(safe-area-inset-top,0px);--home-safe-bottom:env(safe-area-inset-bottom,0px);-webkit-text-size-adjust:100%;text-size-adjust:100%;max-width:none!important;max-height:none!important;min-width:0!important;min-height:0!important}
body.in-menu #lobby.home-menu .home-layout{max-width:none!important;min-width:0!important;box-sizing:border-box!important}

/* Keep the scaled name field at a readable 16px while editing to avoid iOS focus zoom. */
@media(pointer:coarse){body #lobby.home-menu #lobby-name-input:focus{font-size:var(--home-edit-font-size,16px)!important}}

/* Unlike hidden, clip cannot scroll the oversized, transformed design canvas on focus. */
@supports(overflow:clip){body.in-menu #lobby.home-menu{overflow:clip!important}}

/* Short landscape screens: less empty framing, more room for the same academy controls. */
body.in-menu #lobby.home-phone-fit .home-layout{gap:10px;padding:8px!important}
body.hex-desktop-screens #lobby.home-phone-fit .home-rank-rail>#rank-road-open{min-height:270px;padding:12px 14px;gap:5px}
body:not(.hex-fixed-home) #lobby.home-phone-fit .pc-chat-preview{min-height:140px;padding:10px!important;gap:4px}
body.hex-desktop-screens #lobby.home-phone-fit .lobby-tools{gap:8px}
body.hex-desktop-screens #lobby.home-phone-fit .lobby-tools>.home-rewards{grid-template-rows:16px 76px 48px;gap:6px;padding:8px}
body.hex-desktop-screens #lobby.home-phone-fit .home-rewards #chest-action{min-height:0}
body.hex-desktop-screens #lobby.home-phone-fit .play-panel{padding-top:270px}
body.hex-desktop-screens #lobby.home-phone-fit .play-panel>.center-wizard-stage{bottom:205px!important}
body #lobby.home-phone-fit .play-panel>.rename-scroll{bottom:160px}
body #lobby.home-phone-fit .home-header #account-open,body #lobby.home-phone-fit .home-header #settings-button{min-height:56px}
body #lobby.home-phone-fit .home-header #settings-button{min-width:56px}
body #lobby.home-phone-fit .pc-battle-utilities{gap:8px}
body #lobby.home-phone-fit .play-panel>.rename-scroll{bottom:190px}
body.hex-desktop-screens #lobby.home-phone-fit .play-panel>.center-wizard-stage{bottom:240px!important}
body.hex-desktop-screens #lobby.home-phone-fit #wizard-menu-links>.desktop-stats,body.hex-desktop-screens #lobby.home-phone-fit #wizard-menu-links>.desktop-research{height:66px!important;min-height:66px!important}

/* Consolidated phone rewards free room for full-size academy books. */
#phone-rewards-open{display:none}
body.hex-desktop-screens #lobby.home-phone-fit .home-body{grid-template-columns:225px minmax(300px,1fr) 300px!important;gap:12px}
body.hex-desktop-screens #lobby.home-phone-fit .lobby-tools>.home-rewards{display:block;padding:0;border:0;background:none;box-shadow:none}
body #lobby.home-phone-fit .home-rewards>:not(#phone-rewards-open){display:none!important}
body #lobby.home-phone-fit #phone-rewards-open{display:grid;grid-template-columns:48px 1fr;align-items:center;width:100%;height:78px;padding:8px 14px;gap:2px 8px;text-align:left}
#phone-rewards-open>span{grid-row:1/3;font-size:36px;color:#ffe3a0}
#phone-rewards-open strong{font:700 22px Georgia,serif}
#phone-rewards-open small{font:13px Georgia,serif;color:#d9c8e5}
body.hex-desktop-screens #lobby.home-phone-fit #wizard-menu-links>button:not([data-home-duplicate]){height:100px!important;min-height:100px!important}
body.hex-desktop-screens #lobby.home-phone-fit .home-rank-rail>#rank-road-open{min-height:245px;padding:8px 12px}
body.hex-desktop-screens #lobby.home-phone-fit .play-panel{padding-top:225px}
body #lobby.home-phone-fit .play-panel>.rename-scroll{bottom:170px}
body.hex-desktop-screens #lobby.home-phone-fit .play-panel>.center-wizard-stage{bottom:220px!important}
#phone-rewards-menu,body #lobby #phone-rewards-open,#phone-rewards-menu button{border:1px solid #b49a68;border-bottom:4px solid #665039;border-radius:18px;background:linear-gradient(#30253cbb,#211a32ee),url('art/academy-honors.svg') center/100% 100%;box-shadow:inset 0 0 0 3px #d1b98622,0 7px 18px #100a2255;color:#f0d8a4}
#phone-rewards-menu{width:min(620px,calc(100vw - 32px));max-height:calc(100dvh - 24px);box-sizing:border-box;padding:20px}
#phone-rewards-menu::backdrop{background:#100b22ba}
#phone-rewards-menu header{display:flex;align-items:center;justify-content:space-between;gap:14px;margin-bottom:16px}
#phone-rewards-menu h2{font:700 24px Georgia,serif;margin:0}
#phone-rewards-menu [data-close]{min-height:44px;padding:8px 18px;font:700 15px Georgia,serif}
.phone-reward-choices{display:grid;grid-template-columns:1fr 1fr;gap:16px}
#phone-rewards-menu [data-destination]{display:flex;flex-direction:column;align-items:center;justify-content:center;gap:9px;min-height:150px;padding:16px;cursor:pointer}
#phone-rewards-menu [data-destination]>img,#phone-rewards-menu [data-destination]>span{width:64px;height:54px;object-fit:contain;font-size:48px;line-height:54px}
#phone-rewards-menu strong{font:700 23px Georgia,serif}
#phone-rewards-menu small{font:13px Georgia,serif;color:#d9c8e5}
#phone-rewards-menu button:hover,#phone-rewards-open:hover{filter:brightness(1.16)}
#phone-rewards-menu button:focus-visible,#phone-rewards-open:focus-visible{outline:2px solid #ffe3a0;outline-offset:3px}
/* Preserve each illustration's original proportions inside the generous phone hit targets. */
body #lobby.home-phone-fit #wizard-menu-links button .home-tome,
body #lobby.home-phone-fit #wizard-menu-links button .home-wardrobe{inset:0;margin:auto;width:min(100%,115.3846px);height:auto;aspect-ratio:120/104;max-height:100%}
body #lobby.home-phone-fit #wizard-menu-links button.stats-tome .home-tome,
body #lobby.home-phone-fit #wizard-menu-links button.research-tome .home-tome{width:100%;height:auto;aspect-ratio:120/46}

#phone-rewards-menu #phone-chest-shop{display:flex;align-items:center;justify-content:space-between;width:100%;min-height:44px;margin-top:12px;padding:10px 18px;font:700 19px Georgia,serif;cursor:pointer}

@media(max-height:400px){#phone-rewards-menu{padding:12px}#phone-rewards-menu header{margin-bottom:10px}#phone-rewards-menu [data-destination]{min-height:126px;padding:10px;gap:5px}#phone-rewards-menu #phone-chest-shop{margin-top:10px}}
/* Align phone artwork and hit targets to the same two-column menu grid. */
body.hex-desktop-screens #lobby.home-phone-fit .lobby-tools{align-items:stretch!important;gap:10px!important}
body.hex-desktop-screens #lobby.home-phone-fit #wizard-menu-links{display:grid!important;grid-template-columns:repeat(2,minmax(0,1fr))!important;grid-template-rows:126px 64px!important;gap:10px!important;width:100%!important;margin:0!important;padding:0!important}
body.hex-desktop-screens #lobby.home-phone-fit #wizard-menu-links>button:not([data-home-duplicate]){box-sizing:border-box;min-width:0!important;width:100%!important;height:126px!important;min-height:126px!important;margin:0!important;align-self:center!important}
body.hex-desktop-screens #lobby.home-phone-fit #wizard-menu-links>button.stats-tome,body.hex-desktop-screens #lobby.home-phone-fit #wizard-menu-links>button.research-tome{height:64px!important;min-height:64px!important}
body #lobby.home-phone-fit #wizard-menu-links button .home-tome,body #lobby.home-phone-fit #wizard-menu-links button .home-wardrobe{width:100%;height:auto;max-height:100%;aspect-ratio:120/104;inset:0;margin:auto}
body #lobby.home-phone-fit #wizard-menu-links button.stats-tome .home-tome,body #lobby.home-phone-fit #wizard-menu-links button.research-tome .home-tome{aspect-ratio:120/46}
body #lobby.home-phone-fit .wizard-showcase>.xp-reservoir{left:calc((100% - 10px)/4 - 56px)!important;right:auto!important}
body #lobby.home-phone-fit .wizard-showcase>.academy-friends-tile{right:calc((100% - 10px)/4 - 56px)!important;left:auto!important}
body #lobby.home-phone-fit .lobby-tools>.home-rewards{width:100%!important;margin:0!important;box-sizing:border-box}
body #lobby.home-phone-fit #phone-rewards-open{box-sizing:border-box;width:100%!important;margin:0!important}
/* Keep the document itself from scrolling under the fixed menu on phones; a scrolled page after rotation shifts iOS tap targets. */
html:where([data-home-menu]):not(#_m):not(._m):not(._n):not(x-m),body.in-menu:where([data-home-menu]):not(#_m):not(._m){overflow:hidden;height:100%;overscroll-behavior:none}
