/* Раскладка для телефона в горизонтали (Telegram Mini App, iOS/Android). Подключается последней. */
#jump-touch,#reload-touch{display:none}
/* Кошелёк: обычная и редкая валюта рядом с кнопками меню */
#wallet-hud{position:absolute;top:28px;right:198px;display:flex;gap:14px;padding:6px 12px;background:#101515b3;border-left:2px solid #c0aa7a66;color:#e3ded2;font:500 calc(15px * var(--ui-scale,1))/1.2 Condensed,'Arial Narrow',Arial,sans-serif;font-variant-numeric:tabular-nums;text-shadow:0 1px 3px #000;pointer-events:none;white-space:nowrap}
#wallet-hud span::before{content:'';display:inline-block;width:.62em;height:.62em;margin-right:.45em;transform:rotate(45deg);vertical-align:.06em}
#wallet-hud .wallet-coins::before{background:#c0aa7a}
#wallet-hud .wallet-gems::before{background:#7fb6c9;box-shadow:0 0 6px #7fb6c988}
body:is(.field-open,.preview-open,.progression-open,.loadout-open,.equipment-open,.loot-open,.portrait-blocked)>#wallet-hud{display:none}
@media(pointer:coarse){
 :root{
  --sl:max(16px,env(safe-area-inset-left),var(--tg-safe-area-inset-left,0px));
  --sr:max(16px,env(safe-area-inset-right),var(--tg-safe-area-inset-right,0px));
  --sb:max(12px,env(safe-area-inset-bottom),var(--tg-safe-area-inset-bottom,0px));
  --st:max(12px,env(safe-area-inset-top),calc(var(--tg-safe-area-inset-top,0px) + var(--tg-content-safe-area-inset-top,0px)));
 }
 html,body{overscroll-behavior:none;-webkit-touch-callout:none;-webkit-user-select:none;user-select:none;-webkit-tap-highlight-color:transparent}

 /* Верх: карта и задание слева, меню и патроны справа */
 .hud-map{left:var(--sl)!important;top:var(--st)!important}
 #quest-tracker{left:var(--sl)!important;top:calc(var(--st) + 136px)!important;max-width:200px}
 .hud-menu{right:var(--sr)!important;top:var(--st)!important}
 #notice{top:calc(var(--st) + 58px)!important}
 #wallet-hud{top:calc(var(--st) + 10px);right:calc(var(--sr) + 172px);padding:4px 9px;gap:10px;font-size:13px}

 #range-panel{display:flex!important;align-items:baseline;gap:8px;top:calc(var(--st) + 58px)!important;bottom:auto!important;left:auto!important;right:var(--sr)!important;width:auto!important;min-width:0!important;max-width:none!important;padding:5px 10px!important;overflow:visible}
 #range-panel[hidden]{display:none!important}
 #range-panel #range-weapon-name,#range-panel #range-mag-label,#range-panel #range-reserve-label{display:none!important}
 #range-panel #range-ammo{font-size:20px!important;line-height:1.1!important}
 #range-panel #range-reserve{font-size:14px!important;line-height:1.1!important;padding-left:8px!important}
 #range-panel #weapon-status{position:absolute;top:calc(100% + 4px);right:0;margin:0;padding:3px 8px;max-width:none;white-space:nowrap;font-size:11px;background:#101515cc}
 #range-panel #weapon-reload-progress{position:absolute;left:0;right:0;bottom:-3px;width:100%;margin:0}

 /* Низ: джойстики по краям, полосы состояния по центру */
 #player-hud{width:190px!important;bottom:var(--sb)!important}
 #player-hud .vital-bar{height:13px!important;min-height:0!important;margin:0 0 3px!important}
 #player-hud .vital-bar b{font-size:10px!important}
 #player-hud .vital-caption{display:none}

 #joystick{left:calc(var(--sl) + 8px)!important;bottom:calc(var(--sb) + 8px)!important;width:120px!important;height:120px!important}
 #aim-joystick{left:auto!important;top:auto!important;right:calc(var(--sr) + 8px)!important;bottom:calc(var(--sb) + 8px)!important;width:120px!important;height:120px!important}

 #crouch-toggle,#jump-touch,#reload-touch{position:absolute!important;display:grid!important;place-items:center;left:auto!important;top:auto!important;flex:none;width:50px!important;height:50px!important;min-width:0;min-height:0;padding:0!important;border:1px solid #b4b99b5c;border-radius:50%!important;color:#d4c9a4;background:radial-gradient(circle,#30382bd9,#101812e6)!important;touch-action:none}
 #crouch-toggle svg,#jump-touch svg,#reload-touch svg{width:24px;height:24px;fill:none;stroke:currentColor;stroke-width:1.8;stroke-linecap:round;stroke-linejoin:round}
 #jump-touch:active,#reload-touch:active{border-color:#a89b70;color:#e0d1a4}
 #reload-touch{right:calc(var(--sr) + 142px)!important;bottom:calc(var(--sb) + 10px)!important}
 #jump-touch{right:calc(var(--sr) + 134px)!important;bottom:calc(var(--sb) + 70px)!important}
 #crouch-toggle{right:calc(var(--sr) + 84px)!important;bottom:calc(var(--sb) + 136px)!important}

 #interact{left:50%!important;right:auto!important;transform:translateX(-50%);bottom:calc(var(--sb) + 46px)!important;min-height:44px}
 #interact kbd{display:none}

 body:is(.field-open,.preview-open,.progression-open,.loadout-open,.equipment-open,.loot-open,.portrait-blocked) :is(#jump-touch,#reload-touch,#crouch-toggle){display:none!important}
}
/* Сенсор: никакого выделения, лупы и системных меню; экран не «резинит» */
@media(pointer:coarse){*{-webkit-user-select:none;user-select:none;-webkit-touch-callout:none;-webkit-tap-highlight-color:transparent}input,textarea{-webkit-user-select:text;user-select:text}html,body{position:fixed;inset:0;overflow:hidden;touch-action:none}img,svg,canvas{-webkit-user-drag:none}}
@media(pointer:coarse){#notice{max-width:44vw;font-size:13px!important}}
/* Двойное касание не масштабирует: manipulation на всём, у предков body уже none */
@media(pointer:coarse){*{touch-action:manipulation}html,body,#world,#joystick,#aim-joystick,#touch-controls{touch-action:none}}
/* Phone menus: stable side navigation and bounded content, independent of desktop CSS history. */
@media(pointer:coarse){
 .menu-dialog{--menu-header-height:52px}
 .menu-dialog>.menu-header{height:52px!important;min-height:52px;padding:4px var(--sr,12px) 4px var(--sl,12px)!important;gap:10px!important;font-size:20px!important;box-sizing:border-box}
 .menu-dialog>.menu-header button{min-height:44px!important;font-size:14px!important;padding:6px 10px!important}
 .menu-dialog>.menu-frame{display:grid!important;grid-template-columns:112px minmax(0,1fr)!important;grid-template-rows:minmax(0,1fr)!important;gap:10px!important;width:100%!important;max-width:none!important;height:calc(100% - 52px)!important;margin:0!important;padding:8px var(--sr,12px) 8px var(--sl,12px)!important;box-sizing:border-box}
 .menu-dialog>.menu-frame>.menu-nav{display:flex!important;flex-direction:column!important;overflow:auto!important;height:100%!important;min-height:0;gap:2px!important;align-items:stretch!important}
 .menu-dialog .menu-nav button{width:100%!important;flex:0 0 auto;min-height:48px!important;padding:6px 5px!important;font-size:13px!important;text-align:left;display:flex;align-items:center;gap:6px;white-space:normal}
 .menu-dialog .menu-nav button[data-nav-icon]:before{position:static!important;flex:0 0 23px!important;width:23px!important;height:23px!important;margin:0!important}
 .menu-dialog .menu-content{min-height:0!important;height:100%!important}
 #character-preview[data-panel] .menu-content.preview-layout{display:grid!important;grid-template-columns:minmax(230px,43%) minmax(0,1fr)!important;gap:12px!important;min-height:0!important}
 #character-preview .menu-stat-card.preview-info{display:flex!important;flex-direction:column!important;min-height:0!important;height:100%!important;max-height:100%!important;overflow:hidden!important;padding:0!important}
 #character-preview #preview-overview{display:block!important;flex:1 1 0;min-height:0!important;overflow:auto!important;padding-right:8px}
 #character-preview #preview-heading{font-size:23px!important;margin:4px 0 10px!important}
 #character-preview .overview-stats>div{font-size:15px!important;padding:7px 2px!important}
 #character-preview .preview-bottom-actions{flex:0 0 auto!important;padding:7px 0 0!important;gap:8px!important;display:flex!important}
 #character-preview .preview-bottom-actions button{min-height:44px!important;font-size:15px!important;padding:8px!important}
 #character-preview #preview-drag{display:block!important;grid-column:2!important;grid-row:1!important;min-height:0!important;height:100%!important}
 #character-preview[data-panel=weapon-select] .preview-layout,#character-preview[data-panel$=upgrade] .preview-layout{grid-template-columns:minmax(220px,1fr) minmax(220px,1fr)!important}
 #character-preview[data-panel=weapon-select] #preview-drag,#character-preview[data-panel$=upgrade] #preview-drag{display:none!important}
 #character-preview[data-panel=modules] #preview-secondary{position:absolute!important;top:0!important;bottom:0!important;right:0!important;width:230px!important;max-height:none!important;overflow:auto!important;z-index:5}
 #character-preview #preview-secondary{box-sizing:border-box;grid-column:2!important;grid-row:1!important;width:100%!important;max-height:100%!important;overflow:auto!important;padding:12px!important}
 #inventory-screen .inventory-content{display:grid!important;grid-template-columns:minmax(0,1fr) 220px!important;gap:12px!important}
 #inventory-screen .inventory-library{min-height:0!important;overflow:hidden!important;display:flex;flex-direction:column}
 #inventory-screen .inventory-filters{flex-wrap:nowrap!important;overflow:auto!important;flex-shrink:0;margin-bottom:8px!important}
 #inventory-screen .inventory-filters button{flex-shrink:0;min-height:44px!important}
 #inventory-screen .inventory-library-head h2{font-size:22px!important;margin:0!important}
 #inventory-screen .inventory-wallet{margin:0 0 4px!important;font-size:12px!important}
 #inventory-grid{flex:1;min-height:0!important;overflow:auto!important;--item-cell:110px}
 #inventory-screen .inventory-details{height:100%!important;min-height:0!important;overflow:auto!important;padding:12px!important}
 #inventory-screen #inventory-item-art{height:90px!important;min-height:90px!important}
 #inventory-screen .inventory-summary{padding-top:6px!important;font-size:12px!important;flex:none}
 .equipment-detail-overlay{width:calc(100vw - 16px)!important;height:calc(100dvh - 16px)!important;max-height:none!important}
 #equipment-overlay-content{padding:10px!important;overflow:auto!important}
 .gear-picker{height:100%;grid-template-columns:minmax(180px,1fr) minmax(240px,1fr)!important;gap:12px!important}
 .gear-picker-details{padding-left:10px!important}.gear-detail-art{height:100px!important}
 .container-editor{height:100%;grid-template-columns:155px minmax(150px,1fr) minmax(190px,1.2fr)!important;gap:8px!important}
 #passive-tree-screen .passive-layout{grid-template-columns:minmax(0,1fr) 220px!important;gap:8px!important}
}
#inventory-pending-loot{min-height:44px;padding:8px;border:1px solid var(--menu-accent);background:var(--menu-surface);color:var(--menu-text);font:inherit;cursor:pointer}
#inventory-pending-loot[hidden]{display:none}
@media(pointer:coarse){
 #equipment-loadout .radial-loadout{grid-template-columns:minmax(0,1fr) 160px!important;gap:10px!important}
 #equipment-loadout .radial-main{overflow:auto!important;display:block!important;padding:0 3px 12px!important}
 #equipment-loadout .equipment-orbit{width:min(100%,390px)!important;min-width:310px;aspect-ratio:1;margin:16px auto!important}
 #equipment-loadout .radial-gear{width:78px!important;height:66px!important;padding:4px!important;grid-template-rows:14px minmax(0,1fr) 15px;gap:0}
 #equipment-loadout .radial-gear-label{font-size:11px!important}
 #equipment-loadout .radial-gear b{font-size:10px!important;line-height:1}
 #equipment-loadout .radial-gear-art img{max-height:30px!important}
 #equipment-loadout .radial-container{width:116px!important;min-width:0!important;max-width:116px!important;padding:4px!important;gap:4px}
 #equipment-loadout .radial-container-art{height:72px!important}
 #equipment-loadout .radial-container-art img{max-height:72px!important;max-width:72px!important}
 #equipment-loadout .radial-container strong{font-size:13px!important}
 #equipment-loadout .radial-summary{min-height:0!important;overflow:auto!important;padding:9px!important}
 #equipment-loadout .radial-heading h2{font-size:20px!important}
}
