/* Everything is scoped to the mobile navigation. No changes to header/sidebar stylesheets. */
.mbn-shortcode-anchor,
.elementor-widget:has(.mbn-shortcode-anchor) { display: none !important; }
.mbn-bar { display: none !important; }
.mbn-drawer:not([open]) { display: none !important; }

@media (max-width: 767.98px) {
    .mbn-bar, .mbn-bar *, .mbn-drawer, .mbn-drawer * { box-sizing: border-box; }
    .mbn-bar {
        --mbn-active-color: #ff2b8a;
        --mbn-glass-highlight: rgba(255,255,255,.10);
        display: block !important;
        position: fixed !important;
        inset: auto 0 0 0 !important;
        z-index: 2147483000 !important;
        width: 100% !important;
        max-width: none !important;
        height: auto !important;
        margin: 0 !important;
        padding: 4px 8px calc(4px + env(safe-area-inset-bottom, 0px)) !important;
        border: 0 !important;
        border-radius: 0 !important;
        background: rgba(11, 6, 20, .70) !important;
        -webkit-backdrop-filter: blur(16px);
        backdrop-filter: blur(16px);
        box-shadow: 0 -5px 28px rgba(0,0,0,.24);
        color: rgba(255,255,255,.70);
        color-scheme: dark;
        font-family: "Funnel Display",system-ui,-apple-system,BlinkMacSystemFont,"Segoe UI",sans-serif;
        -webkit-font-smoothing: antialiased;
        -webkit-tap-highlight-color: transparent;
    }
    .mbn-bar::before {
        content: "";
        position: absolute;
        inset: 0;
        background: rgba(255,255,255,.10);
        pointer-events: none;
    }
    .mbn-bar__inner {
        position: relative;
        z-index: 1;
        display: grid;
        grid-template-columns: repeat(5,minmax(0,1fr));
        align-items: stretch;
        width: 100%;
        height: 56px;
        margin: 0;
        padding: 0;
    }
    .mbn-bar .mbn-bar__item,
    .mbn-bar .mbn-bar__item:link,
    .mbn-bar .mbn-bar__item:visited {
        appearance: none !important;
        -webkit-appearance: none !important;
        display: flex !important;
        flex-direction: column;
        justify-content: center;
        align-items: center;
        min-width: 0;
        min-height: 48px;
        gap: 3px;
        padding: 4px 2px;
        border: 0 !important;
        border-radius: 12px;
        background: transparent !important;
        box-shadow: none !important;
        color: rgba(255,255,255,.70) !important;
        text-align: center;
        text-decoration: none !important;
        cursor: pointer;
        touch-action: manipulation;
        font-family: inherit !important;
        line-height: normal;
        transition: background-color .15s ease,color .15s ease;
    }
    .mbn-bar__item svg {
        display: block;
        flex: 0 0 24px;
        width: 24px;
        height: 24px;
        color: inherit;
    }
    .mbn-bar__label {
        display: block;
        max-width: 100%;
        overflow: hidden;
        color: inherit;
        font-family: inherit;
        font-size: 10px !important;
        font-weight: 700 !important;
        line-height: 1.25 !important;
        letter-spacing: 0;
        white-space: nowrap;
        text-overflow: ellipsis;
        text-transform: none;
    }
    .mbn-bar .mbn-bar__item:hover,
    .mbn-bar .mbn-bar__item:focus-visible {
        background: rgba(255,255,255,.07) !important;
        color: #fff !important;
    }
    .mbn-bar .mbn-bar__item--active,
    .mbn-bar .mbn-bar__item--active:link,
    .mbn-bar .mbn-bar__item--active:visited,
    .mbn-bar .mbn-bar__item--active:hover,
    .mbn-bar .mbn-bar__item--active:focus-visible {
        background: var(--mbn-glass-highlight) !important;
        color: var(--mbn-active-color) !important;
    }
    .mbn-bar .mbn-bar__item:focus-visible { outline: 2px solid var(--mbn-active-color); outline-offset: -2px; }
    /* A tapped Menu button must not retain an outline after closing the sheet.
       :focus-visible still provides a focus indicator for keyboard users. */
    .mbn-bar .mbn-bar__item[data-mbn-action="menu"]:focus:not(:focus-visible) { outline: none !important; }
    .mbn-bar__item--disabled { opacity: .48; cursor: default; }

    /* Full viewport backdrop, with a sheet growing upward from the screen bottom. */
    dialog.mbn-drawer[open] {
        display: flex !important;
        position: fixed !important;
        inset: 0 !important;
        width: 100% !important;
        max-width: 100% !important;
        height: 100% !important;
        max-height: 100% !important;
        padding: 0 !important;
        margin: 0 !important;
        border: 0 !important;
        border-radius: 0 !important;
        background: transparent !important;
        align-items: flex-end;
        justify-content: center;
        overflow: visible;
        color: #fff;
        color-scheme: dark;
        font-family: "Funnel Display",system-ui,sans-serif;
        -webkit-font-smoothing: antialiased;
        outline: none !important;
        z-index: 2147483500 !important;
    }
    dialog.mbn-drawer::backdrop { background: rgba(0,0,0,.62); }
    .mbn-drawer__sheet {
        --mbn-drawer-bg: #0b0614;
        display: flex;
        flex-direction: column;
        width: 100%;
        max-width: 100%;
        height: auto;
        max-height: min(90dvh,calc(100dvh - 56px));
        min-height: 0;
        margin: 0;
        border-radius: 16px 16px 0 0;
        border: 1px solid rgba(255,255,255,.10);
        border-bottom: 0;
        background: var(--mbn-drawer-bg);
        box-shadow: 0 -20px 60px rgba(0,0,0,.4);
        overflow: hidden;
        animation: mbn-drawer-rise .33s cubic-bezier(.32,.72,0,1);
    }
    @keyframes mbn-drawer-rise { from { transform: translateY(100%); } to { transform: translateY(0); } }
    .mbn-drawer__handle {
        appearance: none !important;
        display: flex !important;
        align-items: flex-start;
        justify-content: center;
        flex: 0 0 36px;
        width: 100%;
        min-height: 36px;
        margin: 0 !important;
        padding: 15px 0 0 !important;
        border: 0 !important;
        border-radius: 0 !important;
        background: transparent !important;
        box-shadow: none !important;
        color: inherit !important;
        cursor: pointer;
        touch-action: none;
        -webkit-user-select: none;
        user-select: none;
    }
    .mbn-drawer__handle span {
        display: block;
        width: 48px;
        height: 6px;
        border-radius: 99px;
        background: rgba(255,255,255,.30);
    }
    /* Only emphasize the grip for keyboard focus, never outline the full-width handle. */
    .mbn-drawer__handle:focus-visible { outline: none !important; }
    .mbn-drawer__handle:focus-visible span { box-shadow: 0 0 0 3px #ff2b8a; }
    .mbn-drawer__content {
        flex: 1 1 auto;
        min-height: 0;
        padding: 4px 16px calc(24px + env(safe-area-inset-bottom,0px));
        width: 100%;
        max-width: 100%;
        overflow-y: auto;
        overflow-x: hidden;
        -webkit-overflow-scrolling: touch;
        overscroll-behavior: contain;
        scrollbar-width: thin;
        scrollbar-color: rgba(255,255,255,.15) transparent;
        touch-action: pan-y;
    }
    .mbn-drawer__content::-webkit-scrollbar { width: 5px; }
    .mbn-drawer__content::-webkit-scrollbar-thumb { background: rgba(255,255,255,.15); border-radius: 99px; }
    /* Adapt the rendered Sidebar shortcode, not its source plugin. */
    .mbn-drawer .cssb-sidebar {
        --cssb-width: 100% !important;
        --cssb-height: auto !important;
        width: 100% !important;
        max-width: 100% !important;
        height: auto !important;
        min-height: 0 !important;
        overflow: visible !important;
        border-radius: 0 !important;
        background: transparent !important;
        backdrop-filter: none !important;
        -webkit-backdrop-filter: none !important;
        isolation: auto !important;
        font-family: "Funnel Display",sans-serif;
    }
    .mbn-drawer .cssb-scroll {
        display: flex;
        height: auto !important;
        min-height: 0 !important;
        overflow: visible !important;
        padding: 0 !important;
        scrollbar-width: none;
    }
    .mbn-drawer .cssb-switcher { background: rgba(255,255,255,.10); }
    .mbn-drawer .cssb-link.cssb-active { background: rgba(255,255,255,.10); }
    /* The Sidebar marks Beta as translatable text. Its generic flex:1 rule
       expands the badge, moving its text toward the label in this drawer. */
    .mbn-drawer .cssb-link[data-cssb-navkey="affiliate"] > .cssb-beta {
        flex: 0 0 auto !important;
        margin-inline-start: auto !important;
        text-align: right;
    }
    .mbn-drawer__missing { color: rgba(255,255,255,.7); padding: 20px 0; font-size: 14px; }
}

@media (min-width: 768px) { dialog.mbn-drawer { display: none !important; } }
@media (prefers-reduced-motion: reduce) {
    .mbn-drawer__sheet { animation: none !important; }
    .mbn-bar__item { transition: none !important; }
}

/* Search/login/deposit layers belong to the original header plugins. */
@media (max-width: 767.98px) {
    body:has(.gch-auth-overlay:not([hidden]),.gch-search-overlay:not([hidden]),.gclh-search-overlay:not([hidden]),.gclh-modal-backdrop:not([hidden])) .mbn-bar {
        visibility: hidden !important;
        pointer-events: none !important;
    }
}

/* Hide the entire bottom navigation while Tidio chat is open. During its
   asynchronous load, the mobile drawer briefly uses mbn-tidio-pending; JS
   clears that class once Tidio opens (or after its 20s failure timeout). */
html.wtcb-tidio-open .mbn-bar,
html.mbn-tidio-pending .mbn-bar {
    display: none !important;
}
