#kpd-mobile-navigation { display: none; }
@media (max-width: 720px), (pointer: coarse) and (orientation: landscape) and (max-width: 960px) and (max-height: 500px) {
    html[data-kpd-pane] { --kpd-nav-height: 44px; }
    html[data-kpd-pane] body:has(.mx_MatrixChat .mx_LeftPanel) #kpd-mobile-navigation {
        display: flex; align-items: stretch; position: fixed; top: env(safe-area-inset-top, 0px);
        inset-inline: 0; height: var(--kpd-nav-height); box-sizing: border-box;
        padding-inline: max(8px, env(safe-area-inset-left, 0px));
        background: var(--cpd-color-bg-canvas-default,white);
        border-bottom: 1px solid var(--cpd-color-border-interactive-secondary,#d2d8df);
    }
    #kpd-mobile-navigation :is(a,button) {
        display: inline-flex; align-items: center; padding: 0 12px; min-height: 44px;
        font: inherit; font-weight: 600; color: var(--cpd-color-text-primary, #172635);
        background: transparent; border: 0; text-decoration: none; cursor: pointer;
    }
    html[data-kpd-pane="list"] #kpd-mobile-navigation a,
    html[data-kpd-pane="content"] #kpd-mobile-navigation button { display: none; }
    html[data-kpd-pane] .mx_MatrixChat:has(.mx_LeftPanel) {
        box-sizing: border-box; padding-top: calc(var(--kpd-nav-height) + env(safe-area-inset-top,0px));
    }
    html[data-kpd-pane] .mx_MatrixChat .mx_Separator,
    html[data-kpd-pane="content"] .mx_MatrixChat :is(.mx_SpacePanel,[data-testid="left-panel"],.mx_LeftPanel_outerWrapper),
    html[data-kpd-pane="list"]:not([data-kpd-spaces]) .mx_MatrixChat .mx_SpacePanel,
    html[data-kpd-pane="list"] .mx_MatrixChat :is([data-panel]:has(.mx_RoomView_wrapper),.mx_RoomView_wrapper) {
        display: none !important;
    }
    html[data-kpd-pane="list"] [data-testid="left-panel"],
    html[data-kpd-pane="list"] .mx_MatrixChat .mx_LeftPanel_outerWrapper,
    html[data-kpd-pane="content"] .mx_MatrixChat [data-panel]:has(.mx_RoomView_wrapper) {
        flex: 1 1 0% !important; min-width: 0 !important; max-width: none !important;
    }
    html[data-kpd-pane="list"] .mx_LeftPanel, html[data-kpd-pane="list"] .mx_LeftPanel_wrapper {
        width: 100% !important; max-width: none !important; min-width: 0;
    }
    html[data-kpd-spaces] .mx_SpacePanel { max-width: min(42vw, 170px); }
    .mx_RoomView_body .mx_RoomHeader {
        order: -1; display: flex; flex-wrap: wrap; flex: 0 0 auto; align-items: center;
        height: auto; padding: 2px 10px; column-gap: 6px; row-gap: 0;
    }
    .mx_RoomView_body .mx_RoomHeader .mx_RoomHeader_infoWrapper { flex: 1 0 calc(100% - 58px); height: 44px; }
    .mx_RoomHeader .mx_RoomHeader_info { padding-inline-end: 0; }
    .mx_RoomHeader .mx_RoomHeader_infoWrapper { gap: 4px; }
    .mx_RoomView .mx_RoomPreviewBar_dialog {
        min-width: 0; width: min(100%, 440px); max-width: 100%; box-sizing: border-box;
        overflow: auto; max-height: 100%;
    }
    .mx_RoomView .mx_RoomPreviewBar_message { min-width: 0; max-width: 100%; box-sizing: border-box; }
    .mx_MainSplit:has(> .mx_RightPanel_ResizeWrapper) > .mx_MainSplit_timeline { display: none; }
    .mx_MainSplit > .mx_RightPanel_ResizeWrapper {
        flex: 1 1 100%; width: 100% !important; max-width: 100% !important; min-width: 0 !important;
    }
    .mx_RightPanel_ResizeWrapper .mx_ResizeHandle--horizontal { display: none; }
    .mx_ToastContainer[role="alert"] {
        top: auto; bottom: max(12px, env(safe-area-inset-bottom,0px)); left: 8px; right: 8px;
        width: auto; max-width: calc(100vw - 16px); pointer-events: none;
    }
    .mx_ToastContainer .mx_Toast_toast { min-width: 0; max-width: 100%; box-sizing: border-box; pointer-events: auto; }
    body:has(.mx_Dialog_wrapper) #kpd-mobile-navigation { visibility: hidden; }
    .mx_Dialog_wrapper .mx_Dialog_fixedWidth { width: min(704px, calc(100vw - 24px)); max-width: 100%; }
    html[data-kpd-pane] .mx_Dialog_wrapper.mx_SpotlightDialog_wrapper .mx_Dialog {
        min-width: min(704px, calc(100vw - 24px)); min-height: min(72%, 600px);
    }
    html[data-kpd-pane] .mx_SpotlightDialog_wrapper .mx_SpotlightDialog { width: 100%; }
    @media (pointer: coarse) {
        #mx_SpotlightDialog_keyboardPrompt { display: none; }
    }
    .mx_RoomView_body > .kpd-announcements-editor {
        flex: 0 1 auto; margin: 0; padding: 4px 10px; border: 0; border-radius: 0;
        max-height: 60%; overflow: auto;
    }
    .kpd-announcements-editor > button:not([hidden]) { width: auto; min-height: 36px; }
}
