/* All overrides are opt-in: an ordinary browser keeps the current layout. */
html[data-telegram]{--rifma-safe-top:max(env(safe-area-inset-top,0px),var(--rifma-tg-top,0px));--rifma-safe-bottom:max(env(safe-area-inset-bottom,0px),var(--rifma-tg-bottom,0px));--rifma-safe-left:max(env(safe-area-inset-left,0px),var(--rifma-tg-left,0px));--rifma-safe-right:max(env(safe-area-inset-right,0px),var(--rifma-tg-right,0px));scroll-padding-top:calc(var(--rifma-safe-top) + 12px);scroll-padding-bottom:calc(var(--rifma-safe-bottom) + 16px)}
html[data-telegram] body{min-height:var(--rifma-webview-height,100dvh);padding-top:var(--rifma-safe-top);padding-left:var(--rifma-safe-left);padding-right:var(--rifma-safe-right);padding-bottom:var(--rifma-safe-bottom);-webkit-text-size-adjust:100%;overflow-wrap:break-word}
html[data-telegram] dialog{top:var(--rifma-safe-top);bottom:var(--rifma-safe-bottom);max-height:calc(var(--rifma-webview-height,100dvh) - var(--rifma-safe-top) - var(--rifma-safe-bottom) - 24px);max-width:calc(100vw - var(--rifma-safe-left) - var(--rifma-safe-right) - 24px);margin-top:auto;margin-bottom:auto;overscroll-behavior:contain}
html[data-telegram] .people-list{max-height:calc(var(--rifma-webview-height,100dvh)*.45)}
@media(max-width:730px){
 html[data-telegram] header .workspace-tabs{min-width:0;max-width:100%;overflow-x:auto;white-space:nowrap;scrollbar-width:none;-webkit-overflow-scrolling:touch}
 html[data-telegram] .workspace-tabs .tab{flex-shrink:0;min-height:44px}
 html[data-telegram] .header-actions{flex-wrap:wrap;row-gap:10px}
 html[data-telegram] .author-avatars{margin-left:auto}
 html[data-telegram] input:not([type=range]):not([type=checkbox]):not([type=file]),html[data-telegram] textarea,html[data-telegram] select,html[data-telegram] .account-dialog .account-field input{font-size:16px}
 html[data-telegram] .chat-conversation{min-height:0}
 html[data-telegram] .message-log{height:clamp(140px,calc(var(--rifma-webview-height,100dvh) - 285px),380px)}
 html[data-telegram] .message-form textarea{min-height:54px;max-height:110px}
 html[data-telegram] .chat-empty{min-height:200px}
 html[data-telegram] .notification-popover{max-height:calc(var(--rifma-webview-height,100dvh) - var(--rifma-safe-top) - var(--rifma-safe-bottom) - 80px);overflow-y:auto}
}
