/* Mobile-only overrides, after legacy HUD sheets. Ordinary skill controls keep their size. */
@media(max-width:900px),(pointer:coarse) and (max-width:1200px),(max-height:600px) and (max-width:1200px){
 /* Keep the chat launcher within thumb reach, without a transformed fixed-position ancestor. */
 body #game #socialDock{top:auto!important;bottom:calc(var(--combat-bottom,58px) + 112px)!important;left:var(--safe-side,8px)!important;right:auto!important;width:68px!important;transform:none!important}
 body.left-handed #game #socialDock{left:auto!important;right:var(--safe-side,8px)!important}
 body #game #chatToggle{position:static!important;width:68px!important;min-width:68px!important;height:40px!important;min-height:40px!important}
 body.chat-open #game #chatToggle{visibility:hidden}
 body:not(.groups-open) #game #chatPanel{
  --mobile-chat-height:min(380px,calc(var(--af-viewport-height,100dvh) - 16px));
  margin:0!important;position:fixed!important;left:50%!important;right:auto!important;bottom:auto!important;
  top:calc(var(--af-viewport-top,0px) + var(--af-viewport-height,100dvh) - var(--mobile-chat-height) - max(8px,env(safe-area-inset-bottom)))!important;
  transform:translateX(-50%)!important;width:min(540px,calc(100vw - 16px))!important;
  height:var(--mobile-chat-height)!important;max-height:var(--mobile-chat-height)!important;
  background:#081b2af2!important;border-color:#5d8c9c;border-radius:12px 12px 7px 7px;box-shadow:0 -8px 25px #0006;
 }
 body:not(.groups-open) #game #socialDock.expanded #chatPanel{--mobile-chat-height:calc(var(--af-viewport-height,100dvh) - 16px)}
 body:not(.groups-open) #game #chatHistory{padding:4px 10px;min-height:40px!important;overscroll-behavior:contain}
 body:not(.groups-open) #game #chatHistory .chat-line{font-size:14px!important;line-height:1.5;margin:7px 0}
 body:not(.groups-open) #game #chatScope{display:none!important}
 body:not(.groups-open) #game #chatPanel>header strong{font-size:12px}
 body:not(.groups-open) #game #chatForm{padding:6px 8px;background:#102938}
 body:not(.groups-open) #game #chatForm input{font-size:16px!important;min-height:40px;box-sizing:border-box}
 body:not(.groups-open) #game #chatForm button{min-height:40px!important}
 body:not(.groups-open) #game #chatPanel nav{display:flex;overflow-x:auto;flex-wrap:nowrap;gap:3px;padding:4px}
 body:not(.groups-open) #game #chatPanel nav button{font-size:11px;flex:none;min-height:36px!important}
 #game #rebirthSkillDock.rebirth-tray{
  display:flex!important;grid-template-columns:none!important;gap:4px!important;padding:2px!important;
  left:auto!important;right:var(--safe-side,8px)!important;transform:none!important;
  bottom:calc(var(--combat-bottom,58px) + 246px)!important;width:max-content!important;max-width:calc(100% - 16px)!important;
  border-radius:6px;background:#081a2799;box-shadow:none;
 }
 #game #rebirthSkillDock.rebirth-tray[hidden]{display:none!important}
 #game #rebirthSkillDock.rebirth-tray button{width:28px!important;min-width:28px!important;height:28px!important;min-height:28px!important;padding:1px!important;border-radius:4px}
 #game #rebirthSkillDock.rebirth-tray .rebirth-mini-icon,#game #rebirthSkillDock.rebirth-tray .rebirth-mini-icon img{width:24px!important;height:24px!important;margin:0}
 #game #rebirthSkillDock.rebirth-tray :is(small,.rebirth-key){display:none!important}
 #game #rebirthSkillDock.rebirth-tray .rebirth-cd{font-size:13px!important;font-weight:700}
 body.left-handed #game #rebirthSkillDock.rebirth-tray{left:var(--safe-side,8px)!important;right:auto!important}
}
@media(orientation:landscape) and (max-height:600px) and (max-width:1200px){
 #game #rebirthSkillDock.rebirth-tray,body.left-handed #game #rebirthSkillDock.rebirth-tray{left:50%!important;right:auto!important;transform:translateX(-50%)!important;bottom:calc(var(--hud-bottom,8px) + 50px)!important}
}
@media(max-height:400px){body:not(.groups-open) #game #chatPanel>header strong{display:none}body:not(.groups-open) #game #chatPanel>header{justify-content:flex-end}}

@media(orientation:landscape) and (max-height:600px) and (max-width:1200px) and (max-width:650px){
 #game #rebirthSkillDock.rebirth-tray{display:grid!important;grid-template-columns:repeat(4,28px)!important;left:calc(50% - 70px)!important;bottom:calc(var(--hud-bottom,8px) + 12px)!important}
 body.left-handed #game #rebirthSkillDock.rebirth-tray{left:calc(50% + 70px)!important}
}
