/* The content viewport ends above the navigation, including iPhone safe area. */
@media(max-width:768px){
 :root{--mobile-nav-space:calc(64px + env(safe-area-inset-bottom,0px))}
 #app-screen{box-sizing:border-box;height:100dvh;overflow:hidden;padding-top:env(safe-area-inset-top,0px);align-items:flex-start;justify-content:flex-start}
 #app-screen>.layout.layout-transfer{height:calc(100dvh - env(safe-area-inset-top,0px) - var(--mobile-nav-space));min-height:0;max-height:none;overflow:hidden}
 #mobile-tabbar.mobile-tabbar.refresh-mobile-tabs{grid-template-columns:repeat(6,minmax(0,1fr));grid-template-rows:52px;grid-auto-flow:column;height:var(--mobile-nav-space);min-height:var(--mobile-nav-space);bottom:0}
 #mobile-tabbar.mobile-tabbar .mobile-tab{font-size:11px;min-width:0;gap:4px}
 #app-screen .sidebar{max-height:100%;min-height:0}
 #app-screen .sidebar-footer{padding-bottom:12px;align-items:center}
 #mobile-tabbar .mobile-tab-icon{display:grid;place-items:center;width:24px;height:24px;line-height:1}
 #mobile-tabbar .mobile-tab-icon>svg{width:22px;height:22px;margin:0}
 #app-screen .chat-list{min-height:0;overflow-y:auto;padding-bottom:16px;scroll-padding-bottom:16px}
 #app-screen .chat-panel.active{min-height:0;height:100%;max-height:100%;overflow:hidden}
 #app-screen .chat-panel>.panel-header{flex-shrink:0}
 #app-screen .chat-panel :is(.panel-body,.pay-panel-body,.codes-panel-body,.calculator-panel-body){min-height:0;scroll-padding-bottom:24px;padding-bottom:24px}
 #app-screen #panel-redeem{overflow-y:auto;overscroll-behavior-y:contain;-webkit-overflow-scrolling:touch;scroll-padding-bottom:24px}
 #app-screen #panel-redeem .redeem-feed{flex:none;min-height:0;max-height:none;overflow:visible}
 #app-screen #panel-redeem .redeem-composer{max-height:none;overflow:visible;margin-bottom:24px}
 #app-screen #panel-redeem #redeem-keys-step .redeem-actions{position:relative;bottom:auto;margin-bottom:0}
 #app-screen #panel-avito .inbox-workspace{position:relative;min-height:0;flex:1;height:auto;overflow:hidden}
 #app-screen #panel-avito .inbox-sidebar{height:100%;min-height:0;box-sizing:border-box}
 #app-screen #panel-avito .inbox-conversation{height:100%;max-height:100%;min-height:0;box-sizing:border-box;bottom:0}
 #app-screen #panel-avito .inbox-dialogs{min-height:0;overflow-y:auto;padding-bottom:16px;scroll-padding-bottom:16px}
 #app-screen #panel-avito .inbox-messages{min-height:0;scroll-padding-bottom:16px}
 #app-screen #panel-avito .inbox-compose{position:relative;bottom:auto;flex-shrink:0;padding-bottom:10px}
}

/* Touch controls remain reachable without changing desktop density. */
@media(max-width:768px){
 #app-screen #panel-redeem .redeem-key-region-shortcuts button,#app-screen #panel-redeem #redeem-add-key{min-height:44px}
 #app-screen #panel-schedule .schedule-view-switch button{min-height:44px}
 #app-screen #panel-opt :is(button,select){min-height:44px}
 #app-screen #panel-keybuy .keybuy-header-wallet{display:grid;grid-template-columns:minmax(0,1fr) minmax(0,1fr);margin:0;width:100%;gap:8px;flex:1 1 100%}
 #app-screen #panel-keybuy .keybuy-wallet-brand{display:none}
 #app-screen #panel-keybuy #keybuy-balance{width:100%;max-width:none;min-height:44px;font-size:12px;padding:0 10px}
 #app-screen #panel-keybuy #keybuy-address{width:100%;max-width:none;min-height:44px;font-size:12px;padding:0 10px}
 #app-screen #panel-keybuy #keybuy-refresh-btn{display:none}
 #app-screen #panel-keybuy #keybuy-wallet-note:not([hidden]){order:3;grid-column:1/-1;white-space:normal;font-size:12px;line-height:1.5;color:var(--text2);font-weight:400}
}

@media(max-width:768px){
 #app-screen #panel-keybuy .keybuy-message button{min-height:44px}
 #app-screen #panel-home button{min-height:44px;min-width:44px}
 #app-screen #panel-analytics button{min-height:44px;min-width:44px}
 #app-screen #panel-schedule .schedule-month-nav button{min-height:44px;min-width:44px}
}
