/* ZUMİ 8.5.1 — stable touch navigation, responsive phone/tablet menus. */
html{scroll-behavior:auto!important;overflow-x:hidden;}
body:not(.game-playing) .view{
  scroll-behavior:auto!important;overflow-anchor:none;
  overscroll-behavior-y:contain;-webkit-overflow-scrolling:touch;
  scroll-padding-top:0!important;
}
body:not(.game-playing) .view>.screen{min-width:0;max-width:100%;transform:none;animation:none;}
body:not(.game-playing) .view>.screen *{max-width:100%;}
body:not(.game-playing) .view>.screen .v85-lobby,body:not(.game-playing) .view>.screen .v85-game-hub,
body:not(.game-playing) .view>.screen .v85-passport-grid,body:not(.game-playing) .view>.screen .v85-theme-grid{max-width:100%;}
body:not(.game-playing) .topbar{width:100%!important;margin:0 auto!important;}
.topbar{gap:clamp(5px,1.3vw,15px);padding-inline:clamp(9px,2.1vw,23px)!important;}
.topbar .brand{min-width:0;flex:0 1 auto;}
.topbar .brand img{flex-shrink:0;}
.topbar .brand-caption{min-width:0;}
.topbar-right{margin-left:auto;gap:clamp(3px,.8vw,10px)!important;min-width:0;flex-shrink:0;}
.zui-nav-back[hidden]{display:none!important;}
.zui-nav-back{flex:0 0 auto;display:inline-flex;align-items:center;justify-content:center;gap:6px;min-width:46px;height:42px;padding:0 13px;border:2px solid #fff;border-radius:14px;background:linear-gradient(140deg,#fffdf5,#d8f0ff);box-shadow:0 3px 0 #6bacc7;color:#26658c;font:900 13px/1 system-ui,sans-serif;cursor:pointer;touch-action:manipulation;}
.zui-nav-back span{font-size:24px;line-height:1;}
.zui-nav-back:active{transform:translateY(2px);box-shadow:none;}
.zui-nav-back:focus-visible,.zui-game-back:focus-visible{outline:3px solid #f9bb59;outline-offset:2px;}
/* A fixed header means back never disappears when the child menu scrolls. */
body:not(.game-playing) .topbar{position:relative;z-index:45;}
.drawer{width:min(430px,43%,calc(100% - 35px))!important;min-width:min(275px,calc(100% - 35px));max-height:100%!important;overscroll-behavior:contain;overflow-y:auto;scrollbar-width:thin;box-sizing:border-box;}
.drawer-title{position:sticky;top:-18px;z-index:3;background:#2a80ae;padding:6px 2px 12px!important;border-radius:12px;}
.drawer-bottom{position:static!important;margin-top:22px;padding-top:10px;border-top:1px solid #ffffff6a;display:flex;flex-wrap:wrap;}
.drawer>button{font-size:clamp(12px,1.5vw,15px)!important;letter-spacing:0!important;line-height:1.25;gap:8px!important;text-align:left;white-space:normal;overflow-wrap:anywhere;}
/* Legacy screens previously gave titles/buttons fixed widths and crowded columns. */
.screen-heading{min-width:0;gap:10px;flex-wrap:wrap;}
.screen-heading>div{min-width:0;flex:1 1 220px;}
.screen-heading .section-title{overflow-wrap:break-word;line-height:1.04;}
.view .v85-page,.view .v85-section-head,.view .record-layout,.view .profile-layout,.view .shop-tabs{min-width:0;}
.v85-section-head h1{overflow-wrap:break-word;}
.v85-passport-grid,.v85-game-hub,.v85-quest-grid,.v85-theme-grid,.stage-grid,.gear-grid{min-width:0;}
.v85-passport-card,.v85-game-choice,.v85-quest-card,.stage-card,.gear-card{min-width:0;}
/* In the actual game the topbar is hidden. Provide a separate safe exit control. */
body.game-playing .zui-game-back{flex:0 0 42px;display:grid;place-items:center;width:42px;height:42px;min-width:42px;border:2px solid #fff9d9;border-radius:12px;background:linear-gradient(140deg,#f9fcff,#a4e1fc);box-shadow:0 3px 0 #266c9d;color:#255979;font:900 28px/1 system-ui,sans-serif;touch-action:manipulation;}
body.game-playing .zui-game-back:active{transform:translateY(2px);box-shadow:none;}
@media(orientation:landscape) and (max-height:540px), (orientation:portrait) and (pointer:coarse){
 .zui-nav-back{height:38px;min-width:39px;padding:0 7px;border-radius:12px;}
 .zui-nav-back b{display:none;}
 .zui-nav-back span{font-size:23px;}
 .topbar .brand-caption small{display:none;}
 .topbar .brand-caption strong{font-size:clamp(12px,1.45vw,17px);}
 .topbar .brand img{width:38px;height:38px;}
 .topbar .level-pill{display:none;}
 .topbar .z-shop-shortcut span{display:none;}
 .topbar .z-shop-shortcut{min-width:37px;width:37px;height:37px;padding:0!important;justify-content:center;}
 .topbar .coin-pill{height:32px;padding-inline:6px!important;}
 .topbar .resource .icon-coin{font-size:17px;}
 .topbar #menu-button{width:39px;height:38px;}
 .drawer{width:min(370px,47%,calc(100% - 24px))!important;min-width:min(265px,calc(100% - 24px));}
 .view .screen-heading{margin-top:4px!important;}
 .view .v85-section-head{min-height:0;padding:11px 14px;border-radius:18px;}
 .view .v85-section-head h1{font-size:clamp(22px,3.4vw,38px);margin:3px 0;}
 .view .v85-section-head p{font-size:12px;line-height:1.3;}
 .view .v85-back{min-height:32px;margin-bottom:7px;}
 .view .v85-game-hub{gap:10px;margin-top:10px;}
 .view .v85-game-choice{padding:12px;min-height:0;}
 .view .v85-game-picture{font-size:45px;}
 .view .v85-playcard{margin-top:9px;padding:13px;min-height:0;}
 .view .v85-passport-grid{gap:10px;}
 .view .v85-quest-card{gap:10px;padding:9px;}
 .view .v85-quest-card h2{font-size:16px;}
 .view .v85-theme-card img{height:83px;}
 body.game-playing .zui-game-back{flex-basis:37px;width:37px;height:37px;min-width:37px;font-size:22px;}
 body.game-playing .game-top-right{gap:3px!important;}
 body.game-playing .game-top-right .mini-hp{max-width:112px;}
 body.game-playing .game-top-right .v6-team-swap{max-width:82px;}
}
@media (orientation:portrait) and (pointer:coarse), (orientation:portrait) and (max-width:600px){
 /* The landscape app is rotated as one surface on portrait phones/tablets.
    Keep all scrolling inside #view with a predictable height. */
 body:not(.game-playing) .view{overflow-y:auto!important;overflow-x:hidden!important;}
 .view .v85-game-hub{grid-template-columns:repeat(3,minmax(0,1fr));}
 .view .v85-passport-grid{grid-template-columns:repeat(4,minmax(0,1fr));}
 .view .v85-theme-grid{grid-template-columns:repeat(5,minmax(0,1fr));}
 .view .v85-quest-grid{grid-template-columns:1fr;}
 .view .stage-grid{grid-template-columns:repeat(3,minmax(0,1fr));}
 .view .gear-grid{grid-template-columns:repeat(3,minmax(0,1fr));}
 .view .record-layout{grid-template-columns:repeat(2,minmax(0,1fr));}
 .view .v85-theme-card img{height:78px;}
}
@media (max-width:430px) and (orientation:landscape){
 .topbar .brand-caption{display:none;}
 .view .v85-game-hub,.view .v85-passport-grid{grid-template-columns:repeat(2,minmax(0,1fr));}
}
@media (prefers-reduced-motion:reduce){.zui-nav-back,.zui-game-back{transition:none!important}}
