        /* Reset page margins so the top has no unexpected spacer */
        html, body { margin: 0; padding: 0; overscroll-behavior-y: none; scrollbar-gutter: stable; }
        /* Emergency Safari restore: allow native pull-to-refresh gesture. */
        html.safari-emergency-mode,
        html.safari-emergency-mode body {
            overscroll-behavior-y: auto !important;
        }
        
        /* 🍎 SAFARI COMPATIBILITY: Keep controls responsive without blocking text inputs. */
        * { -webkit-user-drag: none; }
        button, input, textarea, select, [role="button"], [onclick], .cursiveBtn {
            -webkit-user-select: none !important;
            user-select: none !important;
            -webkit-appearance: none !important;
            appearance: none !important;
            -webkit-touch-callout: none !important;
            pointer-events: auto !important;
            -webkit-tap-highlight-color: transparent !important;
            touch-action: manipulation !important;
            -webkit-user-drag: none !important;
        }
        input, textarea, [contenteditable="true"] {
            -webkit-user-select: text !important;
            user-select: text !important;
            -webkit-touch-callout: default !important;
        }
        
        /* Ensure Modals don't block button clicks in Safari */
        #changeGridModalBackdrop, #viewModal, .modal {
            -webkit-user-select: none !important;
            user-select: none !important;
            -webkit-touch-callout: none !important;
        }

        /* Safari fail-safe: hidden/inactive full-screen layers must never intercept taps. */
        #changeGridModalBackdrop[aria-hidden="true"],
        #viewModal:not(.active),
        #contactModal:not(.active),
        #uploadModal:not(.active),
        #locationChangeLoading.lcl-hiding {
            pointer-events: none !important;
            visibility: hidden !important;
        }
        #changeGridModalBackdrop[aria-hidden="false"],
        #viewModal.active,
        #contactModal.active,
        #uploadModal.active {
            pointer-events: auto !important;
            visibility: visible !important;
        }
        
        /* Ensure the pill and action buttons stay clickable */
        #changeGridLocationPill, #addContentCTA, #uploadBtn, #changeLocationBtn, #comeHomeBtn {
            pointer-events: auto !important;
            -webkit-appearance: none !important;
            appearance: none !important;
            -webkit-tap-highlight-color: transparent !important;
            touch-action: manipulation !important;
        }
        
        /* Ensure the dynamic absolute overlay cannot visually override the in-place globe */
        #brandGlobeAbsoluteOverlay { display: none !important; pointer-events: none !important; }
        /* When posting modal is active, disable floating pills to prevent clicks */
        .disabled-while-posting { pointer-events: none !important; opacity: 0.55 !important; filter: grayscale(0.6) !important; }
        /* Safety net: whenever the posting modal is NOT open, force the floating pills
           to be clickable again. This guarantees the "Change location" pill can never
           get stuck in a non-interactive state (e.g. a leftover disabled class or a
           close path that skipped cleanup) — the #1 cause of it being un-tappable on mobile. */
        body:not(:has(#uploadModal.active)) #changeGridLocationPill,
        body:not(:has(#uploadModal.active)) #accountPill { pointer-events: auto !important; opacity: 1 !important; filter: none !important; }
        html.no-has-selector body:not(.upload-modal-active) #changeGridLocationPill,
        html.no-has-selector body:not(.upload-modal-active) #accountPill { pointer-events: auto !important; opacity: 1 !important; filter: none !important; }
          /* When the posting composer is open, keep the floating composer/location
              controls out of view so they cannot bleed through the posting page. */
            body.posting-page-open #addContentCTA,
            body.posting-page-open #changeGridLocationPill,
            body.posting-page-open #signInBtn,
            body:has(#uploadModal.active) #addContentCTA,
            body:has(#uploadModal.active) #changeGridLocationPill,
            body:has(#uploadModal.active) #signInBtn {
                display: none !important;
                pointer-events: none !important;
                opacity: 0 !important;
                visibility: hidden !important;
          }
            html.no-has-selector body.upload-modal-active #addContentCTA,
            html.no-has-selector body.upload-modal-active #changeGridLocationPill,
            html.no-has-selector body.upload-modal-active #signInBtn {
                display: none !important;
                pointer-events: none !important;
                opacity: 0 !important;
                visibility: hidden !important;
          }
        body:has(#changeGridModal.open) #signInBtn,
        body:has(#changeGridModalBackdrop[style*="display: flex"]) #signInBtn {
            display: none !important;
            pointer-events: none !important;
            opacity: 0 !important;
            visibility: hidden !important;
        }
        html.no-has-selector body.change-grid-modal-open #signInBtn,
        html.no-has-selector body.change-grid-backdrop-open #signInBtn {
            display: none !important;
            pointer-events: none !important;
            opacity: 0 !important;
            visibility: hidden !important;
        }
        /* Hard lock while "Finding posts" overlay is active: hide top controls even if
           runtime scripts try to force them visible with inline styles. */
        body.location-change-loading-ui-lock #addContentCTA,
        body.location-change-loading-ui-lock #changeGridLocationPill,
        body.location-change-loading-ui-lock #signInBtn,
        body.location-change-loading-ui-lock #accountPill,
        body.location-change-loading-ui-lock #accountArea {
            pointer-events: auto !important;
            opacity: 1 !important;
        }
          /* Removed DOM-presence-only location overlay lock. It could keep controls
              hidden after overlay teardown race conditions on Safari. */
