/* Mobile-only experiment. Desktop is untouched. Remove this file's link from
   index.html to restore the previous behavior. */
@media (max-width:760px){
 html{min-width:0;overflow-x:hidden;-webkit-text-size-adjust:100%}
 body{min-width:0!important;overflow-x:hidden;padding-bottom:calc(223px + env(safe-area-inset-bottom))!important}
 body.chat-minimized{padding-bottom:calc(43px + env(safe-area-inset-bottom))!important}
 .shell{width:100%!important;max-width:none!important;margin:0!important;border-inline:0!important;overflow:visible!important}
 .game-header{margin:0!important;border-radius:0!important}
 .game-header-title{min-width:0;min-height:42px!important;padding:7px 76px 7px 40px!important;justify-content:flex-start!important}
 .game-header-title>span:first-of-type{max-width:100%;overflow:hidden;text-overflow:ellipsis;white-space:nowrap!important;font-size:clamp(15px,4.6vw,21px)!important;line-height:1.1}
 .game-header-title #players-online-button{right:8px!important;z-index:2;max-width:68px;font-size:0!important;white-space:nowrap;line-height:1.2!important;text-align:right}
 .game-header-title #players-online-button::before{content:'Online: ';font-size:10px}
 .game-header-title #players-online-button b{font-size:10px!important}
 #mobile-header-toggle{display:block!important;position:absolute;left:7px;top:50%;z-index:3;width:27px;height:27px;min-height:0!important;padding:0!important;transform:translateY(-50%);border:1px solid var(--line);background:var(--panel);color:var(--green);font-size:10px!important;line-height:25px!important;text-align:center}
 body.mobile-header-collapsed .game-header-grid{display:none!important}
 .game-header-grid{display:grid!important;grid-template-columns:repeat(2,minmax(0,1fr))!important;min-height:0!important}
 .game-header-grid>section{min-width:0;min-height:0!important;padding:8px 9px!important}
 .game-header-grid>section h2{margin-bottom:5px!important;font-size:12px!important}
 .game-header-grid>section dt,.game-header-grid>section dd,.game-header-grid>section a,.game-header-grid>section button{font-size:11px!important;line-height:1.35!important}
 .game-header-links{grid-column:1/-1!important;display:flex!important;flex-wrap:wrap;align-items:center;justify-content:center;gap:5px 8px!important;padding:8px 10px!important;text-align:center}
 .game-header-links>*{margin:0!important}
 .game-header-links h2{width:100%}

 #main-nav{position:sticky;top:0;z-index:40;display:flex!important;grid-template-columns:none!important;width:100%;gap:0!important;padding:0!important;overflow-x:auto;overflow-y:hidden;overscroll-behavior-x:contain;scroll-snap-type:x proximity;scrollbar-width:none;-webkit-overflow-scrolling:touch}
 #main-nav::-webkit-scrollbar,.chat-tabs::-webkit-scrollbar{display:none}
 #main-nav button{flex:0 0 108px!important;width:auto!important;min-width:108px;min-height:44px!important;padding:8px 10px!important;border-radius:0!important;font-size:11px!important;line-height:1.2!important;scroll-snap-align:start;white-space:nowrap}
 .level-meter{margin:6px 7px!important;z-index:1!important}
 .level-meter .level-tooltip{z-index:2!important}

 .game-grid,body[data-ui-style] .game-grid{display:flex!important;flex-direction:column;grid-template-columns:none!important;gap:8px!important;padding:0 7px 8px!important}
 .battlefield{order:1;grid-column:auto!important;grid-row:auto!important;width:100%;min-width:0}
 .left-column{order:2}.right-column{order:3}
 .left-column,.right-column,body[data-ui-style] .left-column,body[data-ui-style] .right-column{display:flex!important;width:100%!important;min-width:0;flex-direction:column;gap:8px!important;grid-column:auto!important;grid-row:auto!important}
 .left-column>*,.right-column>*{width:100%;min-width:0}
 .character-note{display:none!important}
 .panel,.center-panel,body[data-ui-style] .panel,body[data-ui-style] .center-panel{min-width:0;border-radius:5px!important}
 .center-panel,body[data-ui-style] .center-panel{padding:14px 12px!important}
 .center-heading,.battle-toolbar,.world-boss-heading,.charm-market-heading,.moderation-section-heading{align-items:flex-start!important;gap:8px;flex-wrap:wrap}

 .zone-heading{display:flex!important;grid-template-columns:none!important;align-items:center!important;justify-content:center;gap:7px!important;flex-wrap:wrap}
 .zone-heading>strong{width:100%;text-align:center}
 .monster-choice-controls{display:grid!important;grid-template-columns:minmax(0,1fr) auto!important;width:100%!important;max-width:430px;gap:7px}
 .monster-choice-controls select,.monster-choice-controls button{min-width:0}
 .combatants{gap:6px!important}.combatant{min-width:0}.combatant-label{gap:5px;flex-wrap:wrap}.enemy-name-controls{flex-wrap:nowrap}
 .monster-step{min-width:34px!important;min-height:34px!important}
 .arena,.battle-report{margin-inline:0!important}
 .inline-action-timer{gap:6px 14px!important;flex-wrap:wrap}
 .battle-actions,.world-boss-controls,.moderation-emergency-buttons,.dialog-actions,.clan-member-actions{display:flex!important;justify-content:center;gap:8px!important;flex-wrap:wrap}
 .battle-actions button,.world-boss-controls button,.moderation-emergency-buttons button,.dialog-actions button,.clan-member-actions button{min-height:42px}
 .tracker-grid,.dungeon-record-rewards{grid-template-columns:repeat(2,minmax(0,1fr))!important}
 .tracker-grid>div{min-width:0;padding:8px 5px!important}

 .trade-grid,.profile-grid,.public-profile-grid,.settings-grid,.market-books,.dungeon-layout,.rules-grid,.wiki-layout,.clan-public-bonuses,.theme-gallery,.hideout-buildings,.moderation-player-summary{grid-template-columns:1fr!important}
 .rankings-layout,.logs-layout,.achievements-panel .rankings-layout{display:block!important}
 .rankings-categories,.logs-categories,.achievement-categories{display:flex!important;width:100%;max-width:none!important;margin-bottom:10px;padding-bottom:5px;gap:4px;overflow-x:auto;scrollbar-width:none}
 .rankings-categories button,.logs-categories button,.achievement-categories button{flex:0 0 auto;min-height:38px;white-space:nowrap}

 .market-order-form,.clan-create,.crafting-controls{grid-template-columns:1fr!important}
 .crafting-controls{display:grid!important;gap:9px!important}
 .crafting-controls>label,.crafting-controls>button{width:100%}.crafting-queue-label{white-space:normal!important}
 #crafting-deposit-rows>div,.funds-row{grid-template-columns:minmax(85px,1fr) minmax(90px,1fr) auto!important}
 .market-toolbar,.market-menu,.clan-menu,.premium-menu,.settings-menu,.moderation-pages{gap:7px!important;flex-wrap:wrap}
 .market-toolbar>*,.market-toolbar label{min-width:0;width:100%}.market-toolbar p{justify-content:space-between}

 .market-table-wrap,.market-wide-table,.rankings-table,.achievement-list,.moderation-table,.dungeon-record-wrap,.clan-public-members{display:block;width:100%;max-width:100%;overflow-x:auto!important;overscroll-behavior-x:contain;-webkit-overflow-scrolling:touch}
 .market-table-wrap table,.rankings-table table,.achievement-list table,.moderation-table table,.dungeon-record-table{width:max-content!important;min-width:100%!important}
 #market-charms table,#market-my-listings table,#clan-members table,#clan-donations table,.moderation-table table{min-width:720px!important}
 .market-table-wrap th,.market-table-wrap td{white-space:nowrap}
 .dungeon-grid{max-width:min(100%,440px);margin-inline:auto}
 .dungeon-run-heading,.dungeon-vitals,.world-boss-personal,.clan-summary,.moderation-summary,.moderation-control-facts{gap:7px 12px!important;flex-wrap:wrap}
 .world-boss-body{max-width:100%!important}
 .theme-choices{grid-template-columns:repeat(2,minmax(0,1fr))!important}.theme-choices button{min-width:0}

 input,select,textarea{max-width:100%;font-size:16px!important}
 button,[role=button]{touch-action:manipulation}
 dialog,dialog.upgrade-dialog,dialog.players-online-dialog,dialog.charm-send-dialog{width:calc(100vw - 16px)!important;max-width:none!important;max-height:calc(100dvh - 20px)!important;margin:auto!important;padding:18px 14px!important;overflow:auto}
 dialog::backdrop{backdrop-filter:blur(2px)}

 body .chat-dock:not(.minimized){bottom:env(safe-area-inset-bottom)!important;display:grid!important;grid-template-columns:1fr!important;grid-template-rows:40px minmax(0,1fr)!important;width:100%!important;height:205px!important}
 .chat-dock:not(.minimized) .chat-tabs{display:flex!important;flex-direction:row!important;align-items:stretch;width:100%;min-width:0;overflow-x:auto;overflow-y:hidden;border-right:0!important;border-bottom:1px solid var(--border)!important;scrollbar-width:none;-webkit-overflow-scrolling:touch}
 .chat-dock:not(.minimized) .chat-tabs button{flex:0 0 auto!important;width:auto!important;min-width:72px;min-height:40px;padding:7px 10px!important;text-align:center!important}
 .chat-dock:not(.minimized) .chat-content{min-width:0;padding:5px 7px 4px!important}
 .chat-dock.minimized{bottom:env(safe-area-inset-bottom)!important}
 #chat-input{min-height:38px;font-size:16px!important}
 .toast{right:8px!important;bottom:calc(218px + env(safe-area-inset-bottom))!important;left:8px!important;width:auto!important;max-width:none!important}
 body.chat-minimized .toast{bottom:calc(50px + env(safe-area-inset-bottom))!important}
 .world-footer{padding-inline:9px!important;text-align:center}
}

@media (max-width:430px){
 .game-header-links{grid-column:1/-1!important}
 .monster-choice-controls{grid-template-columns:1fr!important}
 .combatants{align-items:stretch!important}.versus{padding-inline:2px!important;font-size:10px!important}
 .tracker-grid,.dungeon-record-rewards,.theme-choices{grid-template-columns:1fr!important}
 #crafting-deposit-rows>div,.funds-row{grid-template-columns:1fr auto!important}
 #crafting-deposit-rows>div>:first-child,.funds-row>:first-child{grid-column:1/-1}
}
