
    /* 0. Remove custom cursor on mobile */
    * {
        cursor: auto !important;
    }
    button, a, [role="button"], .grid-btn, .tab-btn {
        cursor: pointer !important;
    }
    #editor {
        cursor: text !important;
    }

    /* 1. Hide Desktop Action Bar and Status Bar */
    .action-bar-wrapper {
        display: none !important;
    }
    
    .status-bar, #btn-layout-toggle {
        display: none !important;
    }
    
    /* 2. Hide Fake Caret & Custom I-Beam Cursor logic since mobile keyboards don't need it */
    #fake-caret-overlay, .fake-caret-inline, #custom-cursor {
        display: none !important;
    }

    /* 3. Layout Overrides for Mobile */
    #editor-wrapper {
        padding-bottom: 0 !important;
        height: calc(100% - 40px) !important; /* Leave space for mobile footer */
    }

    .editor-container {
        padding: 0 !important;
        max-width: 100% !important;
    }

    #editor {
        padding: 15px 15px 0px 15px !important;
        font-size: 1.15rem !important;
    }

    /* Split View Override for Mobile */
    #editor-wrapper.split-active {
        flex-direction: column-reverse !important;
    }
    
    #editor-wrapper.split-active #editor,
    #editor-wrapper.split-active #markdown-preview {
        width: 100% !important;
    }
    
    #editor-wrapper.split-active #md-resizer {
        position: relative !important;
        width: 100% !important;
        height: 16px !important;
        cursor: row-resize !important;
        background: transparent !important;
        border: none !important;
        display: flex !important;
        justify-content: center !important;
        align-items: center !important;
        z-index: 100 !important;
        opacity: 1 !important;
    }
    
    #editor-wrapper.split-active #md-resizer::after {
        content: '' !important;
        display: block !important;
        width: 40px !important;
        height: 6px !important;
        background: var(--text-color) !important;
        opacity: 0.4 !important;
        border-radius: 3px !important;
    }

    #bottom-bg-block, #btn-exit-focus {
        display: none !important;
    }

    /* 4. Mobile FAB Styles */
    #mobile-fab {
        position: fixed !important;
        bottom: max(24px, env(safe-area-inset-bottom));
        right: 8px;
        width: 56px;
        height: 56px;
        border-radius: 50%;
        background: var(--ui-bg);
        box-shadow: 0 4px 16px rgba(0,0,0,0.25);
        border: 1px solid var(--ui-border);
        z-index: 1000;
        display: flex;
        justify-content: center;
        align-items: center;
        transition: transform 0.2s cubic-bezier(0.2, 0.8, 0.2, 1), background 0.2s;
        pointer-events: auto;
        padding: 0;
        cursor: pointer;
        transform: translateY(calc(-1 * var(--kb-offset, 0px))) rotate(var(--fab-rotate, 0deg));
    }
    
    [data-theme="dark"] #mobile-fab { background: rgba(48, 49, 52, 1); }
    [data-theme="warm"] #mobile-fab { background: rgba(245, 230, 149, 1); }

    #mobile-fab img {
        width: 32px;
        height: 32px;
        object-fit: contain;
        transition: transform 0.3s;
    }
    
    .fab-open #mobile-fab {
        --fab-rotate: 45deg;
        background: rgba(128,128,128,0.2);
    }
    
    /* 5. Mobile FAB Menus */
    #mobile-fab-menu {
        position: fixed;
        bottom: 0; right: 0; left: 0; top: 0;
        max-width: none;
        pointer-events: none;
        z-index: 900;
        background: transparent;
    }
    
    .action-group-horizontal {
        position: absolute;
        bottom: calc(max(24px, env(safe-area-inset-bottom)) + 4px);
        right: 64px;
        display: flex;
        flex-direction: row-reverse;
        background: var(--ui-bg);
        border: 1px solid var(--ui-border);
        box-shadow: 0 4px 12px rgba(0,0,0,0.15);
        border-radius: 24px;
        padding: 4px;
        pointer-events: none;
        opacity: 0;
        transform: translateY(calc(-1 * var(--kb-offset, 0px))) translateX(20px) scale(0.9);
        transform-origin: right center;
        transition: opacity 0.3s ease, transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    }
    
    .action-group-vertical {
        position: absolute;
        bottom: calc(max(24px, env(safe-area-inset-bottom)) + 70px);
        right: 14px;
        display: flex;
        flex-direction: column-reverse;
        align-items: center;
        background: var(--ui-bg);
        border: 1px solid var(--ui-border);
        box-shadow: 0 4px 12px rgba(0,0,0,0.15);
        border-radius: 24px;
        padding: 4px;
        pointer-events: none;
        opacity: 0;
        transform: translateY(calc(20px - var(--kb-offset, 0px))) scale(0.9);
        transform-origin: bottom center;
        transition: opacity 0.3s ease, transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    }
    
    .fab-open .action-group-horizontal {
        opacity: 1;
        pointer-events: auto;
        transform: translateY(calc(-1 * var(--kb-offset, 0px))) translateX(0) scale(1);
    }
    
    .fab-open .action-group-vertical {
        opacity: 1;
        pointer-events: auto;
        transform: translateY(calc(-1 * var(--kb-offset, 0px))) scale(1);
    }
    
    .action-group-horizontal > *, .action-group-vertical > * {
        background: transparent;
        border: none;
        width: 44px; height: 44px;
        display: flex; justify-content: center; align-items: center;
        padding: 0;
        cursor: pointer;
        border-radius: 50%;
        transition: background 0.2s;
    }

    .action-group-horizontal > button, .action-group-vertical > button {
        font-size: 1.2rem;
        color: var(--text-color);
    }

    .action-group-horizontal .dropdown > button, .action-group-vertical .dropdown > button {
        width: 100%; height: 100%;
        display: flex; justify-content: center; align-items: center;
        background: transparent; border: none; padding: 0; margin: 0;
        font-size: 1.2rem; border-radius: 50%;
        color: var(--text-color);
    }

    .action-group-horizontal > *:active, .action-group-vertical > *:active,
    .action-group-horizontal .dropdown > button:active, .action-group-vertical .dropdown > button:active {
        background: rgba(128, 128, 128, 0.15);
    }
    
    .fab-open .action-group-horizontal, .fab-open .action-group-vertical {
        opacity: 1;
        transform: translate(0, 0) scale(1);
        pointer-events: auto;
    }

    /* 1. Hide the explicit hide-mobile spans on the main buttons (File, Insert, Tools, Info) */
    #mobile-fab-menu .hide-mobile {
        display: none !important;
    }

    /* 3. Dropdown Menu Positioning Fixes */
    /* Horizontal group (File, Insert, Tools) should drop UP */
    #mobile-fab-menu .action-group-horizontal .dropdown-content {
        top: auto !important;
        bottom: calc(100% + 12px) !important;
        right: -12px !important;
        left: auto !important;
    }

    /* Vertical group (Font, Align) should drop LEFT */
    #mobile-fab-menu .action-group-vertical .dropdown-content {
        top: 50% !important;
        bottom: auto !important;
        right: calc(100% + 12px) !important;
        left: auto !important;
        transform: translateY(-50%) !important;
    }
    
    /* 6. Mobile Footer */
    #mobile-footer {
        position: fixed !important;
        bottom: 0; left: 0; right: 0;
        height: 24px;
        background: var(--ui-bg);
        border-top: 1px solid var(--ui-border);
        display: flex;
        align-items: center;
        justify-content: space-between;
        padding: 0 16px;
        font-family: inherit;
        font-size: 0.75rem;
        color: var(--text-color);
        z-index: 1000;
    }

    /* 7. Focus Mode on Mobile */
    body.mobile-focus-mode #mobile-fab {
        left: 0; right: auto; bottom: 0;
        border-radius: 0 100% 0 0;
        width: 48px; height: 48px;
        border-left: none; border-bottom: none;
    }

    /* 8. Landscape Mode Swap */
    @media (orientation: landscape) {
        .action-group-horizontal {
            bottom: calc(max(24px, env(safe-area-inset-bottom)) + 70px);
            right: 14px;
            flex-direction: column-reverse;
            transform: translateY(calc(20px - var(--kb-offset, 0px))) scale(0.9);
            transform-origin: bottom center;
        }
        
        .action-group-vertical {
            bottom: calc(max(24px, env(safe-area-inset-bottom)) + 4px);
            right: 64px;
            flex-direction: row-reverse;
            transform: translateY(calc(-1 * var(--kb-offset, 0px))) translateX(20px) scale(0.9);
            transform-origin: right center;
        }
        
        .fab-open .action-group-horizontal {
            transform: translateY(calc(-1 * var(--kb-offset, 0px))) scale(1);
        }
        
        .fab-open .action-group-vertical {
            transform: translateY(calc(-1 * var(--kb-offset, 0px))) translateX(0) scale(1);
        }
    }
