/* P402 mobile and tablet. Only touch-sized viewports; desktop untouched. */
#zkMobileUI[hidden],#zkMobileMenuPanel[hidden],#zkMobileBackdrop[hidden]{display:none!important}
body[data-zk-device="phone"],body[data-zk-device="tablet"]{--zk-top:82px;--zk-dock:142px;}
body[data-zk-device="tablet"]{--zk-top:94px;--zk-dock:140px}
body[data-zk-device="phone"][data-zk-orientation="landscape"]{--zk-top:69px;--zk-dock:66px}
body[data-zk-device="phone"] .hunter-topbar,
body[data-zk-device="tablet"] .hunter-topbar{display:none!important}
body[data-zk-device="phone"] .main,
body[data-zk-device="tablet"] .main{
  top:var(--zk-top)!important;bottom:0!important;left:0!important;right:0!important;inset:var(--zk-top) 0 0 0!important;
}
body[data-zk-device="phone"] .world-wrap,
body[data-zk-device="tablet"] .world-wrap{inset:0!important}
body[data-zk-device="phone"] .hunter-status,
body[data-zk-device="tablet"] .hunter-status{display:none!important}
body[data-zk-device="phone"] .hunter-right,
body[data-zk-device="tablet"] .hunter-right{width:0!important;pointer-events:none!important}
body[data-zk-device="phone"] #zkMobileUI,
body[data-zk-device="tablet"] #zkMobileUI{display:block!important;position:fixed;inset:0;pointer-events:none;z-index:151}
#zkMobileUI{font-family:Arial,Helvetica,sans-serif;color:#dce6f4;user-select:none}
#zkMobileUI button{cursor:pointer;-webkit-tap-highlight-color:transparent;touch-action:manipulation}
#zkMobileUI .zk-m-header{
  position:absolute;inset:0 0 auto 0;
  height:calc(var(--zk-top) - 31px);
  padding:env(safe-area-inset-top,0px) max(5px,env(safe-area-inset-right,0px)) 3px max(5px,env(safe-area-inset-left,0px));
  display:flex;align-items:center;gap:4px;pointer-events:auto;
  background:linear-gradient(#112c40,#071321);border-bottom:1px solid #426787;box-shadow:0 2px 8px #000a;
}
#zkMobileUI .zk-m-header button{
  background:linear-gradient(#183751,#081725);border:1px solid #436381;border-radius:6px;
  color:#e6ce8c;height:40px;padding:0 7px;min-width:40px;font-size:12px;font-weight:800;
}
#zkMobileChar{display:flex;gap:4px;align-items:center;min-width:0;flex:1;max-width:230px;overflow:hidden}
#zkMobileChar img{width:31px;height:31px;object-fit:contain;image-rendering:pixelated;flex-shrink:0}
#zkMobileName{display:block;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-size:12px}
#zkMobileMoney{font-size:11px;white-space:nowrap;color:#eac666;max-width:76px;overflow:hidden;text-overflow:ellipsis}
#zkMobileUI .zk-m-vitals{
  position:absolute;top:calc(var(--zk-top) - 31px);height:31px;left:0;right:0;
  display:flex;align-items:center;gap:5px;padding:3px max(6px,env(safe-area-inset-left,0px));
  border-bottom:1px solid #385975;background:rgba(5,15,26,.96);pointer-events:auto;
}
#zkMobileUI .zk-m-meter{height:23px;position:relative;flex:1;min-width:0;border:1px solid #3d5973;border-radius:4px;background:#08131b;display:flex;align-items:center;justify-content:space-between;padding:0 6px;font-size:10px;isolation:isolate}
#zkMobileUI .zk-m-meter i{position:absolute;inset:0 auto 0 0;display:block;z-index:-1;width:0;opacity:.85}
#zkMobileUI .zk-m-life i{background:linear-gradient(90deg,#842b2e,#ef635a)}
#zkMobileUI .zk-m-ki i{background:linear-gradient(90deg,#0b658b,#44c9ec)}
#zkMobileUI .zk-m-level{color:#e8cf93;font-weight:900;white-space:nowrap;font-size:11px}
#zkMobileUI .zk-m-menu-backdrop{position:fixed;inset:var(--zk-top) 0 0 0;background:#030911a6;pointer-events:auto}
#zkMobileUI .zk-m-menu{
  position:fixed;right:max(6px,env(safe-area-inset-right,0px));top:calc(var(--zk-top) + 5px);
  width:min(365px,calc(100vw - 12px));max-height:calc(var(--zk-mobile-vh,100dvh) - var(--zk-top) - 14px);
  overflow-y:auto;overscroll-behavior:contain;display:grid;grid-template-columns:repeat(2,minmax(0,1fr));
  gap:7px;padding:9px;background:#071321;border:1px solid #42698a;border-radius:8px;
  box-shadow:0 8px 32px #000d;pointer-events:auto;
}
#zkMobileUI .zk-m-menu button{min-height:46px;padding:7px;border:1px solid #3c5d79;border-radius:6px;
 background:linear-gradient(#142e46,#0b1928);color:#d9e9f4;font-size:13px;font-weight:700}
#zkMobileUI .zk-m-menu button[hidden]{display:none!important}
body[data-zk-device="phone"] .hunter-footer,
body[data-zk-device="tablet"] .hunter-footer{
  display:block!important;position:fixed!important;left:max(5px,env(safe-area-inset-left,0px))!important;
  right:max(5px,env(safe-area-inset-right,0px))!important;bottom:max(5px,env(safe-area-inset-bottom,0px))!important;
  top:auto!important;transform:none!important;width:auto!important;max-width:unset!important;
  height:var(--zk-dock)!important;z-index:80!important;pointer-events:none!important;
}
body[data-zk-device="phone"] .hunter-centerbar,
body[data-zk-device="tablet"] .hunter-centerbar{
  position:absolute!important;inset:0!important;width:100%!important;height:100%!important;
  max-width:unset!important;display:grid!important;grid-template-columns:minmax(0,1fr)!important;
  grid-template-rows:34px minmax(0,1fr)!important;
  overflow:hidden!important;clip-path:none!important;border-radius:8px!important;pointer-events:auto!important;
}
body[data-zk-device="phone"] .hunter-quick,
body[data-zk-device="tablet"] .hunter-quick{
  grid-column:1!important;grid-row:1!important;height:34px!important;width:100%!important;
  display:flex!important;overflow-x:auto!important;overflow-y:hidden!important;
  justify-content:start!important;gap:4px!important;touch-action:pan-x;
  scrollbar-width:thin;padding:2px 4px!important;
}
body[data-zk-device="phone"] .hunter-quick button,
body[data-zk-device="tablet"] .hunter-quick button{
  width:auto!important;flex:0 0 auto!important;min-width:90px!important;
  height:29px!important;padding:0 8px!important;font-size:11px!important;
}
body[data-zk-device="phone"] .hunter-centerbar .hotbar,
body[data-zk-device="tablet"] .hunter-centerbar .hotbar{
  grid-column:1!important;grid-row:2!important;min-width:0!important;width:100%!important;
  height:100%!important;display:grid!important;grid-template-columns:repeat(10,46px)!important;
  grid-template-rows:repeat(2,46px)!important;grid-auto-flow:row!important;
  gap:4px!important;padding:4px 6px!important;justify-content:start!important;
  align-content:center!important;overflow-x:auto!important;overflow-y:hidden!important;
  scroll-snap-type:x proximity;scrollbar-width:thin;touch-action:pan-x;
}
body[data-zk-device="phone"] .hunter-centerbar .action-slot,
body[data-zk-device="tablet"] .hunter-centerbar .action-slot{
  width:46px!important;height:46px!important;min-width:46px!important;touch-action:manipulation;
}
body[data-zk-device="phone"] .hunter-centerbar .action-slot img,
body[data-zk-device="tablet"] .hunter-centerbar .action-slot img{max-width:40px!important;max-height:40px!important}
body[data-zk-device="phone"] .hunter-centerbar .combat-settings,
body[data-zk-device="tablet"] .hunter-centerbar .combat-settings{display:none!important}
body[data-zk-device="phone"] #chatWindow,
body[data-zk-device="tablet"] #chatWindow{display:none!important}
body[data-zk-device="phone"][data-zk-mobile-chat="open"] #chatWindow,
body[data-zk-device="tablet"][data-zk-mobile-chat="open"] #chatWindow{
 display:grid!important;position:fixed!important;left:6px!important;right:6px!important;top:auto!important;
 bottom:calc(var(--zk-dock) + max(12px,env(safe-area-inset-bottom,0px)))!important;
 width:auto!important;height:min(360px,calc(var(--zk-mobile-vh,100dvh) - var(--zk-top) - var(--zk-dock) - 20px))!important;
 min-height:110px!important;max-height:calc(var(--zk-mobile-vh,100dvh) - var(--zk-top) - var(--zk-dock) - 20px)!important;
 z-index:180!important;transform:none!important;resize:none!important;overflow:hidden!important;
}
body[data-zk-device="phone"] #chatWindow .chat-input input,
body[data-zk-device="tablet"] #chatWindow .chat-input input{font-size:16px!important}
body[data-zk-device="phone"] .modal,
body[data-zk-device="tablet"] .modal{
 max-width:calc(100vw - 12px)!important;max-height:calc(var(--zk-mobile-vh,100dvh) - 12px)!important;
 overflow:auto;overscroll-behavior:contain;
}
body[data-zk-device="phone"] #extraLootPanel,
body[data-zk-device="tablet"] #extraLootPanel,
body[data-zk-device="phone"] #huntAnalyzer,
body[data-zk-device="tablet"] #huntAnalyzer{
 max-width:calc(100vw - 12px)!important;
 max-height:calc(var(--zk-mobile-vh,100dvh) - var(--zk-top) - var(--zk-dock) - 16px)!important;
}
@media (max-height:520px){
 body[data-zk-device="phone"] #zkMobileUI .zk-m-header{height:45px}
 body[data-zk-device="phone"] #zkMobileUI .zk-m-vitals{top:45px;height:24px}
 body[data-zk-device="phone"] #zkMobileUI .zk-m-meter{height:20px}
 body[data-zk-device="phone"] .hunter-centerbar{grid-template-rows:0 minmax(0,1fr)!important}
 body[data-zk-device="phone"] .hunter-quick{display:none!important}
 body[data-zk-device="phone"] .hunter-centerbar .hotbar{
   grid-row:2!important;grid-template-columns:repeat(20,46px)!important;
   grid-template-rows:46px!important;grid-auto-flow:row!important
 }
}
@media (max-width:390px){
 #zkMobileUI .zk-m-header{gap:3px}
 #zkMobileHunt{display:none}
 #zkMobileMoney{max-width:58px}
 #zkMobileUI .zk-m-header button{min-width:38px;padding:0 4px}
}

/* Override late P75/R7 runtime stylesheet specificity; retain desktop unchanged. */
html body[data-zk-device="phone"][data-ui-profile] .game-shell .hunter-footer,
html body[data-zk-device="tablet"][data-ui-profile] .game-shell .hunter-footer{
 left:6px!important;right:6px!important;top:auto!important;bottom:max(6px,env(safe-area-inset-bottom))!important;
 transform:none!important;width:calc(100vw - 12px)!important;height:var(--zk-dock)!important;
 max-width:none!important;position:fixed!important;display:block!important;
}
html body[data-zk-device="phone"][data-ui-profile] .game-shell .hunter-footer .hunter-centerbar,
html body[data-zk-device="tablet"][data-ui-profile] .game-shell .hunter-footer .hunter-centerbar{
 inset:0!important;left:0!important;top:0!important;right:0!important;bottom:0!important;
 display:grid!important;grid-template-columns:minmax(0,1fr)!important;
 grid-template-rows:34px minmax(0,1fr)!important;
 width:100%!important;height:100%!important;max-width:none!important;
 overflow:hidden!important;clip-path:none!important;
}
html body[data-zk-device="phone"][data-ui-profile] .game-shell .hunter-footer .hunter-quick,
html body[data-zk-device="tablet"][data-ui-profile] .game-shell .hunter-footer .hunter-quick{
 display:flex!important;grid-row:1!important;grid-column:1!important;overflow-x:auto!important;
 justify-content:flex-start!important;width:100%!important;max-width:none!important;height:34px!important;
}
html body[data-zk-device="phone"][data-ui-profile] .game-shell .hunter-footer #hotbar,
html body[data-zk-device="tablet"][data-ui-profile] .game-shell .hunter-footer #hotbar{
 display:grid!important;grid-row:2!important;grid-column:1!important;width:100%!important;
 height:100%!important;min-width:0!important;max-width:none!important;
 grid-template-columns:repeat(10,46px)!important;grid-template-rows:repeat(2,46px)!important;
 gap:4px!important;overflow-x:auto!important;overflow-y:hidden!important;
 justify-content:start!important;align-content:center!important;padding:4px 6px!important;
}
html body[data-zk-device="phone"][data-ui-profile] .game-shell .hunter-footer #hotbar .action-slot,
html body[data-zk-device="tablet"][data-ui-profile] .game-shell .hunter-footer #hotbar .action-slot{
 width:46px!important;height:46px!important;min-width:46px!important;min-height:46px!important;
}
html body[data-zk-device="phone"][data-ui-profile] .game-shell .hunter-footer .combat-settings,
html body[data-zk-device="tablet"][data-ui-profile] .game-shell .hunter-footer .combat-settings{
 display:none!important;
}
@media (max-height:520px){
 html body[data-zk-device="phone"][data-ui-profile] .game-shell .hunter-footer .hunter-centerbar{
   grid-template-rows:0 minmax(0,1fr)!important
 }
 html body[data-zk-device="phone"][data-ui-profile] .game-shell .hunter-footer .hunter-quick{
   display:none!important
 }
 html body[data-zk-device="phone"][data-ui-profile] .game-shell .hunter-footer #hotbar{
   grid-template-columns:repeat(20,46px)!important;grid-template-rows:46px!important;
 }
}

/* Late game skin absolutely positioned the two grid children with top:27px.
   Restore actual grid flow so touch slots stay INSIDE the visible dock. */
html body[data-zk-device="phone"][data-ui-profile] .game-shell .hunter-footer .hunter-quick,
html body[data-zk-device="tablet"][data-ui-profile] .game-shell .hunter-footer .hunter-quick,
html body[data-zk-device="phone"][data-ui-profile] .game-shell .hunter-footer #hotbar,
html body[data-zk-device="tablet"][data-ui-profile] .game-shell .hunter-footer #hotbar{
 position:relative!important;inset:auto!important;
 top:auto!important;right:auto!important;bottom:auto!important;left:auto!important;
 margin:0!important;transform:none!important;align-self:stretch!important;
}
/* Mobile combat controls proxy the existing target/range/stance handlers. */
#zkMobileUI .zk-m-combat{display:none;pointer-events:auto}
body[data-zk-device="phone"][data-zk-mobile-combat="open"] #zkMobileUI .zk-m-combat,
body[data-zk-device="tablet"][data-zk-mobile-combat="open"] #zkMobileUI .zk-m-combat{
 display:flex;position:fixed;left:6px;right:6px;bottom:calc(var(--zk-dock) + 14px);
 max-width:440px;max-height:calc(var(--zk-mobile-vh,100dvh) - var(--zk-top) - var(--zk-dock) - 18px);
 overflow-y:auto;flex-direction:column;gap:9px;padding:12px;border-radius:9px;
 border:1px solid #54758b;background:rgba(7,19,31,.98);box-shadow:0 6px 25px #000c;
}
#zkMobileUI .zk-m-combat-title{display:flex;justify-content:space-between;align-items:center;color:#efc96f;font-weight:800}
#zkMobileUI .zk-m-combat label{display:grid;gap:4px;font-size:12px}
#zkMobileUI .zk-m-combat select{min-height:44px;color:#dfebfa;background:#0c2235;border:1px solid #43637a;border-radius:5px;padding:6px;font-size:16px}
#zkMobileUI .zk-m-combat-row{display:flex;align-items:center;gap:6px;justify-content:space-between}
#zkMobileUI .zk-m-combat-row button,#zkMobileCombatClose,#zkMobileCombatButton{
 min-height:43px;border-radius:5px;border:1px solid #40617d;background:#102c43;color:#e2ebf7;
 padding:6px;flex:1;font-size:12px;font-weight:800
}
@media(max-height:520px){
 body[data-zk-device="phone"][data-zk-mobile-combat="open"] #zkMobileUI .zk-m-combat{
  right:6px;left:auto;max-width:360px;padding:7px;gap:4px;
 }
 #zkMobileUI .zk-m-combat-row button,#zkMobileCombatClose{min-height:34px}
}

/* Existing timed-events launcher used z-index:96000 and intercepted touches
   on the new menu. Keep it accessible, smaller and below mobile overlays. */
html body[data-zk-device="phone"] #r260TimedLauncher,
html body[data-zk-device="tablet"] #r260TimedLauncher{
 z-index:86!important;position:fixed!important;right:7px!important;
 top:calc(var(--zk-top) + 6px)!important;width:50px!important;height:50px!important;
 transform:none!important;
}
html body[data-zk-device="phone"] #r260TimedLauncher .r260-launcher-label,
html body[data-zk-device="tablet"] #r260TimedLauncher .r260-launcher-label{font-size:8px!important}
@media(max-height:520px){
 html body[data-zk-device="phone"] #r260TimedLauncher{width:36px!important;height:36px!important}
}
