/* Phones keep their tab-based layout after rotation. Use the wider viewport
   for the artwork and storage; allow the page to scroll naturally vertically. */
@media (max-width:1100px) and (max-height:600px) and (orientation:landscape){
  .shell{width:100%;max-width:100%;padding:12px max(13px,env(safe-area-inset-right)) 24px max(13px,env(safe-area-inset-left))}
  .shell>main.grid{display:block;min-width:0}
  .shell>main.grid>section,.shell>main.grid>aside,.shell>main.grid>.equipmentColumn{min-width:0;max-width:100%;margin-bottom:14px}
  #characterStatsPanel{display:none}
  #characterStatsPanel.mobileStatsActive{display:block;width:100%}
  #mainNav #statsTab{display:inline-block}

  .top{grid-template-columns:minmax(0,1fr) minmax(320px,1.4fr);gap:8px 12px}
  .top>.brand{grid-column:1/-1;grid-row:1;padding:12px 0;align-self:center}
  .top .brand .gameWordmark{width:320px;max-width:100%}
  .top>#headerSupplies{grid-column:1/-1;grid-row:3;justify-self:center;align-self:center;width:100%;height:auto;max-width:468px;grid-template-columns:repeat(4,minmax(0,1fr))}
  .top>.headerUtility{grid-column:1/-1;grid-row:2;width:100%}
  .top #mainNav{flex-wrap:wrap;justify-content:center;gap:6px;overflow:visible}
  .top #mainNav button{height:auto;min-height:38px;padding:8px 10px;font-size:14px}
  :is(.top,.battleSupplyBelt) .supplyCounter{padding:4px;gap:5px;flex-direction:row;justify-content:center}
  :is(.top,.battleSupplyBelt) .supplySprite{width:28px;height:34px}

  #huntView .battleStoneViewport{width:calc(100% + 26px);margin-inline:-13px}
  #huntView .battleStoneCanvas{--stone-width:100%;width:100%;margin-left:0}
  #skillsView .talentWorkspace{width:100%}
  .campGrid{grid-template-columns:repeat(auto-fit,minmax(min(100%,320px),1fr))}
  .cubeLayout{grid-template-columns:minmax(0,1fr)}
  .gridFrame{width:100%;max-width:100%;padding:24px}
  .gridFrame::before{border-width:24px}
  .inventoryFooter,.stashGoldControls{width:calc(100% - 48px)}
}

/* Each vendor pair keeps its natural width around the same centre line. */
#vendorTabs:has(.vendorTabRow){flex-direction:column;align-items:center;justify-content:center}
#vendorTabs .vendorTabRow{display:flex;justify-content:center;gap:6px;max-width:100%}
#vendorTabs .vendorTabRow>button{min-width:0}

/* Keep content panels within the screen; navigation rows can still be swiped. */
@media(max-width:760px), (max-width:1100px) and (max-height:600px) and (orientation:landscape){
 body:has(.shell>.siteToolbar),body.hasMobileHud:has(.shell>.siteToolbar){padding-top:env(safe-area-inset-top)}
 .shell>.siteToolbar{position:relative;display:grid;grid-template-columns:minmax(0,1fr) auto;align-items:start;gap:8px;height:auto;margin-bottom:12px}
 body.hasMobileHud .shell>.siteToolbar{padding-left:max(80px,calc(50vw - 80px));min-height:84px}
 #mobileHud{max-width:max(88px,calc(50vw - 88px))}
 .shell>.siteToolbar>.topAccountPanel{position:static;transform:none;max-width:100%;justify-self:start}
 .shell>.siteToolbar>.backgroundPicker{position:relative;top:auto;right:auto}
 .shell>.siteToolbar:has(.backgroundPicker.expanded){min-height:142px}
 .shell>main.grid,.shell>main.grid>*{min-width:0;max-width:100%}
 .panel>.sectionHead{flex-wrap:wrap}
 .panel>.sectionHead>button{max-width:100%}
 .top #mainNav{flex-wrap:nowrap;justify-content:flex-start;overflow-x:auto;overflow-y:hidden}
 .top #mainNav button{max-width:100%;white-space:nowrap}
 #battleAreaPicker{min-width:0;max-width:100%;overflow:visible}
}

/* Keep Zones above Areas; each row scrolls naturally with a horizontal swipe. */
@media(max-width:760px){
 #battleAreaPicker #worldZoneSelector,#battleAreaPicker #areas{display:flex;flex-wrap:nowrap;gap:10px;width:100%;max-width:100%;min-width:0;overflow-x:auto;overflow-y:hidden;overscroll-behavior-x:contain;scroll-snap-type:x proximity;scroll-padding-inline:1px;padding:1px 1px 5px;scrollbar-width:thin;scrollbar-color:#665138 transparent;-webkit-overflow-scrolling:touch}
 #battleAreaPicker #worldZoneSelector>button,#battleAreaPicker #areas>.area{flex:0 0 clamp(140px,44vw,180px);width:auto;height:auto;scroll-snap-align:start}
}
@media(max-width:1100px) and (max-height:600px) and (orientation:landscape){
 #battleAreaPicker #worldZoneSelector,#battleAreaPicker #areas{display:flex;flex-wrap:nowrap;gap:10px;width:100%;max-width:100%;min-width:0;overflow-x:auto;overflow-y:hidden;overscroll-behavior-x:contain;scroll-snap-type:x proximity;scroll-padding-inline:1px;padding:1px 1px 5px;scrollbar-width:thin;scrollbar-color:#665138 transparent;-webkit-overflow-scrolling:touch}
 #battleAreaPicker #worldZoneSelector>button,#battleAreaPicker #areas>.area{flex:0 0 180px;width:auto;height:auto;scroll-snap-align:start}
}
