/* Compact mobile navigation inspired by the five-item dock used in the mobile layout. */
.mobile-bottom-nav {
    display: none;
}

/* Keep all forty Keno cells in complete rows on mobile. */
@media only screen and (max-width: 760px) {
    .keno__mines,
    .theme--dark .keno__mines {
        min-height: 0 !important;
        height: auto !important;
    }

    .keno__bet-field,
    .theme--dark .keno__bet-field {
        flex-direction: row !important;
        align-items: center !important;
        justify-content: space-between !important;
        gap: 6px !important;
    }

    .keno__bet-field .keno__bet-input,
    .theme--dark .keno__bet-field .keno__bet-input {
        flex: 1 1 auto;
        width: auto !important;
        min-width: 0;
    }

    .keno__bet-coins {
        flex: 0 0 20px;
        width: 20px !important;
        height: 20px !important;
        color: #f2b233;
    }

    .keno__canvas,
    .keno__canvas.d-flex {
        grid-template-columns: repeat(8, minmax(0, 1fr)) !important;
    }
}

/* Mobile support chat: give the conversation more vertical space and keep the
   message placeholder on one readable line. */
@media only screen and (max-width: 675px) {
    /* Make the mobile cashier titles readable at a glance. */
    .popup--wallet.wallet--deposit-view .wallet-deposit-heading,
    .popup--wallet.wallet--withdraw-picker-view .wallet-withdraw-heading {
        font-size: 29px !important;
        font-weight: 700 !important;
        line-height: 1.05 !important;
    }

    .popup--support.support-panel-floating,
    .popup--support.support-panel-floating.active {
        height: min(640px, calc(100dvh - 20px)) !important;
    }

    .popup--support.support-panel-floating .support-chat__composer {
        grid-template-columns: 44px minmax(0, 1fr) 44px !important;
        gap: 6px !important;
    }

    .popup--support.support-panel-floating .support-chat__file,
    .popup--support.support-panel-floating .support-chat__composer button {
        width: 44px !important;
        min-width: 44px !important;
        height: 44px !important;
        min-height: 44px !important;
    }

    .popup--support.support-panel-floating .support-chat__composer textarea {
        height: 44px !important;
        min-height: 44px !important;
        padding: 10px 10px !important;
        font-size: 13px !important;
        line-height: 20px !important;
        white-space: nowrap !important;
        overflow: hidden !important;
        text-overflow: clip;
    }
}

/* On mobile the language list opens above its trigger, with the pointer aimed
   down at the language button. */
@media only screen and (max-width: 760px) {
    .gx-language-modal__dialog {
        width: min(330px, calc(100vw - 24px)) !important;
        overflow: visible !important;
    }

    .gx-language-modal__pointer {
        display: none !important;
    }

    .gx-language-modal__dialog::after {
        position: absolute;
        left: var(--gx-language-arrow-left, 50%);
        bottom: -10px;
        width: 0;
        height: 0;
        border-right: 10px solid transparent;
        border-left: 10px solid transparent;
        border-top: 10px solid #fff;
        content: "";
        transform: translateX(-50%);
    }
}

/* Keep the account balance centered between the screen edges on phones. */
@media only screen and (max-width: 520px) {
    #gxAppHeader .header__right .header__user-balance {
        position: absolute !important;
        top: 50%;
        left: 50%;
        z-index: 2;
        transform: translate(-50%, -50%) !important;
    }

    #gxAppHeader .header-balance-toggle::after {
        width: 8px;
        height: 8px;
        margin-left: 8px;
        border: solid #a8c3ea;
        border-width: 0 2px 2px 0;
        border-radius: 1px;
        filter: none;
        transform: translateY(-2px) rotate(45deg);
    }

    #gxAppHeader .header__user-balance.is-open .header-balance-toggle::after {
        transform: translateY(2px) rotate(-135deg);
    }
}

/* Keep mobile information-page titles on the same line as the back control. */
@media only screen and (max-width: 760px) {
    .gx-info-page__header,
    .bonus-page__head {
        display: flex !important;
        flex-direction: row !important;
        flex-wrap: wrap;
        align-items: center !important;
        gap: 14px !important;
    }

    .gx-info-page__header h1,
    .bonus-page__title {
        margin: 0 !important;
    }

    .gx-info-page__header .gx-info-page__label {
        flex: 0 0 100%;
    }

    .gx-info-page__back {
        min-height: 0 !important;
        padding: 0 !important;
        border: 0 !important;
        border-radius: 0 !important;
        color: #edf4ff !important;
        background: transparent !important;
        box-shadow: none !important;
    }

    .gx-info-page__back:hover,
    .gx-info-page__back:focus,
    .gx-info-page__back:active {
        border: 0 !important;
        color: #fff !important;
        background: transparent !important;
        transform: none !important;
    }
}

/* Keep the mobile rules list compact instead of leaving a large gap between cards. */
@media only screen and (max-width: 760px) {
    .gx-rules-page > .gx-rules-accordion {
        margin-bottom: 12px !important;
    }

    .gx-rules-page > .gx-rules-accordion:last-of-type {
        margin-bottom: 0 !important;
    }
}

/* Keep the notifications drawer fully inside the mobile viewport. */
@media only screen and (max-width: 760px) {
    .header-notifications__menu {
        position: fixed !important;
        top: calc(env(safe-area-inset-top) + 72px) !important;
        right: 10px !important;
        left: 10px !important;
        z-index: 120 !important;
        width: auto !important;
        max-width: none !important;
    }
}

@media only screen and (max-width: 760px) {
    body {
        padding-bottom: 80px !important;
    }

    .header__menu-toggle {
        display: none !important;
    }

    /* The chat shortcut now lives in the bottom dock. */
    .floating-support-button {
        display: none !important;
    }

    .mobile-bottom-nav {
        position: fixed;
        z-index: 30;
        right: 24px;
        bottom: max(8px, env(safe-area-inset-bottom));
        left: 24px;
        display: block;
        overflow: visible;
        padding-bottom: 0;
        border: 1px solid rgba(83, 143, 225, .28);
        border-radius: 20px;
        background: #0d1834;
        box-shadow: 0 10px 24px rgba(0, 0, 0, .34);
    }

    .mobile-bottom-nav__links,
    .mobile-bottom-nav__labels {
        display: grid;
        grid-template-columns: repeat(5, minmax(0, 1fr));
        align-items: center;
    }

    .mobile-bottom-nav__links {
        height: 56px;
        padding: 0 6px;
        border-radius: 18px;
        background: #172d5b;
    }

    .mobile-bottom-nav__item {
        position: relative;
        display: flex;
        width: 100%;
        height: 56px;
        align-items: center;
        justify-content: center;
        padding: 0;
        border: 0;
        color: #9db6d7;
        background: transparent;
        text-decoration: none;
        cursor: pointer;
        -webkit-appearance: none;
        appearance: none;
    }

    .mobile-bottom-nav__item:active,
    .mobile-bottom-nav__item:focus-visible,
    .mobile-bottom-nav__item.active {
        color: #d9f3ff;
        outline: none;
    }

    .mobile-bottom-nav__item.is-active {
        color: #5ab9ff;
    }

    .mobile-bottom-nav__icon {
        display: inline-flex;
        width: 28px;
        height: 28px;
        align-items: center;
        justify-content: center;
        color: currentColor;
    }

    .mobile-bottom-nav__masked-icon {
        display: block;
        width: 26px;
        height: 26px;
        background: currentColor;
        -webkit-mask-position: center;
        mask-position: center;
        -webkit-mask-repeat: no-repeat;
        mask-repeat: no-repeat;
        -webkit-mask-size: contain;
        mask-size: contain;
    }

    .mobile-bottom-nav__menu-icon {
        -webkit-mask-image: url('https://optimize.v3.bundlecdn.com/unsafe/quality/plain/https://v3.bundlecdn.com/3bb50f/plain/route/burger.svg');
        mask-image: url('https://optimize.v3.bundlecdn.com/unsafe/quality/plain/https://v3.bundlecdn.com/3bb50f/plain/route/burger.svg');
    }

    .mobile-bottom-nav__casino-icon {
        -webkit-mask-image: url('https://optimize.v3.bundlecdn.com/unsafe/quality/plain/https://v3.bundlecdn.com/3bb50f/plain/route/casino.svg');
        mask-image: url('https://optimize.v3.bundlecdn.com/unsafe/quality/plain/https://v3.bundlecdn.com/3bb50f/plain/route/casino.svg');
    }

    .mobile-bottom-nav__wallet-icon {
        -webkit-mask-image: url('https://optimize.v3.bundlecdn.com/unsafe/quality/plain/https://v3.bundlecdn.com/3bb50f/plain/route/wallet.svg');
        mask-image: url('https://optimize.v3.bundlecdn.com/unsafe/quality/plain/https://v3.bundlecdn.com/3bb50f/plain/route/wallet.svg');
    }

    .mobile-bottom-nav__gift-icon {
        -webkit-mask-image: url('https://optimize.v3.bundlecdn.com/unsafe/quality/plain/https://v3.bundlecdn.com/3bb50f/plain/route/gift.svg');
        mask-image: url('https://optimize.v3.bundlecdn.com/unsafe/quality/plain/https://v3.bundlecdn.com/3bb50f/plain/route/gift.svg');
    }

    .mobile-bottom-nav__close-icon {
        display: none;
        width: 26px;
        height: 26px;
        background: currentColor;
        -webkit-mask-image: url('/resources/v1/plain/route/close.svg');
        mask-image: url('/resources/v1/plain/route/close.svg');
        -webkit-mask-position: center;
        mask-position: center;
        -webkit-mask-repeat: no-repeat;
        mask-repeat: no-repeat;
        -webkit-mask-size: contain;
        mask-size: contain;
    }

    .mobile-bottom-nav__menu.active .mobile-bottom-nav__menu-icon {
        display: none;
    }

    .mobile-bottom-nav__menu.active .mobile-bottom-nav__close-icon {
        display: inline-flex;
    }

    .mobile-bottom-nav__deposit {
        z-index: 1;
    }

    .mobile-bottom-nav__deposit-circle {
        width: 60px;
        height: 60px;
        margin-top: -22px;
        border-radius: 50%;
        color: #08233d;
        background: #48d5f5;
        box-shadow: 0 4px 12px rgba(72, 213, 245, .3);
    }

    .mobile-bottom-nav__deposit-circle .mobile-bottom-nav__masked-icon {
        width: 30px;
        height: 30px;
        background: #08233d;
    }

    .mobile-bottom-nav__support .icon {
        width: 27px;
        height: 27px;
    }

    .mobile-bottom-nav__labels {
        display: none;
    }

    @media (max-width: 360px) {
        .mobile-bottom-nav {
            right: 14px;
            left: 14px;
        }

    }
}

/* Reuse the desktop sidebar as the mobile menu drawer. */
@media only screen and (max-width: 760px) {
    body.more--opened {
        overflow: hidden !important;
    }

    .mobile-navbar {
        display: none !important;
    }

    .sidebar {
        position: fixed !important;
        inset: 0 !important;
        display: none !important;
        width: 100% !important;
        height: 100% !important;
        padding: 0 !important;
        z-index: 80 !important;
        pointer-events: none;
    }

    .more--opened .sidebar {
        display: block !important;
        pointer-events: auto;
    }

    .sidebar::before {
        content: '';
        position: absolute;
        inset: 0;
        background: rgba(4, 10, 24, .72);
    }

    .sidebar__inner {
        position: relative !important;
        z-index: 1;
        display: flex !important;
        width: min(65vw, 392px) !important;
        max-width: calc(100vw - 16px) !important;
        height: calc(100vh - 160px) !important;
        min-height: 0 !important;
        margin: 64px 0 0 8px !important;
        padding: 12px 12px 14px !important;
        box-sizing: border-box;
        overflow: hidden !important;
        border: 1px solid rgba(99, 151, 229, .3) !important;
        border-radius: 28px !important;
        background: #13233d !important;
        box-shadow: 0 18px 55px rgba(4, 12, 26, .58), inset 0 1px 0 rgba(190, 220, 255, .06);
    }

    .sidebar__top {
        display: flex !important;
        flex-direction: column !important;
        min-height: 0 !important;
        height: 100% !important;
        overflow-x: hidden !important;
        overflow-y: auto !important;
        scrollbar-width: thin;
        scrollbar-color: rgba(105, 158, 235, .4) transparent;
        overscroll-behavior: contain;
        touch-action: pan-y;
    }

    .sidebar__top > .sidebar__logotype {
        display: none !important;
    }

    .gx-sidebar-online {
        display: flex !important;
        align-items: center !important;
        justify-content: space-between !important;
        min-height: 42px !important;
        margin: 0 -12px 10px !important;
        padding: 0 16px !important;
        border-bottom: 1px solid rgba(120, 163, 222, .2) !important;
        color: #aabbd5 !important;
        font-size: 13px !important;
        font-weight: 600 !important;
    }

    .gx-sidebar-online strong,
    .gx-sidebar-online strong b {
        display: inline-flex;
        align-items: center;
        gap: 8px;
        color: #edf4ff !important;
        font-size: 14px !important;
        letter-spacing: 0 !important;
    }

    .gx-sidebar-online i {
        width: 9px !important;
        height: 9px !important;
        flex: 0 0 9px !important;
        border-radius: 50%;
        background: #30e69b;
        box-shadow: 0 0 0 5px rgba(48, 230, 155, .16), 0 0 16px rgba(48, 230, 155, .55);
    }

    .gx-sidebar-account {
        margin: 0 4px 12px !important;
    }

    .gx-sidebar-account__link {
        display: flex !important;
        align-items: center !important;
        gap: 12px !important;
        min-height: 62px !important;
        padding: 8px 10px !important;
        border-radius: 18px !important;
        color: #e8f0ff !important;
        background: rgba(39, 64, 105, .82) !important;
        text-decoration: none;
    }

    .gx-sidebar-account__icon {
        display: inline-flex !important;
        align-items: center;
        justify-content: center;
        width: 44px !important;
        height: 44px !important;
        flex: 0 0 44px !important;
        border-radius: 50%;
        color: #9cc6ff !important;
        background: rgba(104, 161, 237, .2) !important;
    }

    .gx-sidebar-account__user-icon,
    .gx-sidebar-account__icon .icon {
        width: 24px !important;
        height: 24px !important;
    }

    .gx-sidebar-account__copy {
        display: flex !important;
        flex: 1 1 auto;
        flex-direction: column;
        min-width: 0;
        gap: 3px;
    }

    .gx-sidebar-account__copy b {
        color: #f0f6ff !important;
        font-size: 16px !important;
        font-weight: 700 !important;
    }

    .gx-sidebar-account__copy small {
        overflow: hidden;
        color: #aabbd5 !important;
        font-size: 11px !important;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .gx-sidebar-account__arrow {
        width: 22px !important;
        height: 22px !important;
        flex: 0 0 22px !important;
        color: #a8c2e7 !important;
    }

    .gx-sidebar-feature {
        position: relative;
        display: flex !important;
        align-items: center;
        min-height: 72px !important;
        margin: 0 4px 14px !important;
        padding: 0 14px !important;
        overflow: hidden;
        border: 1px solid rgba(116, 165, 231, .24) !important;
        border-radius: 18px !important;
        color: #edf4ff !important;
        background: rgba(31, 55, 94, .92) !important;
        text-decoration: none;
    }

    .gx-sidebar-feature__copy {
        position: relative;
        z-index: 1;
        display: flex;
        flex-direction: column;
        gap: 5px;
    }

    .gx-sidebar-feature__copy b {
        font-size: 15px !important;
        font-weight: 700 !important;
    }

    .gx-sidebar-feature__art {
        position: absolute;
        right: -10px;
        bottom: -38px;
        width: 128px;
        height: 128px;
        border-radius: 50%;
        background: url('/img/bonus-wheel-banner-cutout.webp') center / cover no-repeat;
        box-shadow: 0 0 0 5px rgba(105, 164, 242, .12), 0 0 24px rgba(65, 132, 227, .3);
        transform: rotate(-8deg);
    }

    .gx-sidebar-navigation {
        display: flex !important;
        flex-direction: column !important;
        gap: 2px !important;
        margin: 0 4px !important;
    }

    .gx-sidebar-navigation a,
    .gx-sidebar-support {
        min-height: 44px !important;
        padding: 0 12px !important;
        border-radius: 13px !important;
        font-size: 14px !important;
        text-transform: none !important;
    }

    .gx-sidebar-bottom {
        gap: 8px !important;
        margin: auto 4px 0 !important;
    }

    .gx-sidebar-quick-actions {
        gap: 8px !important;
    }

    .gx-sidebar-support {
        flex: 0 0 auto;
    }

    .gx-sidebar-navigation a,
    .gx-sidebar-support {
        display: flex !important;
        align-items: center !important;
        gap: 13px !important;
        color: #c6d5eb !important;
        background: transparent !important;
        text-decoration: none;
    }

    .gx-sidebar-navigation a.is-active,
    .gx-sidebar-navigation a:active,
    .gx-sidebar-navigation a:hover {
        color: #f5f9ff !important;
        background: rgba(57, 91, 145, .25) !important;
    }

    .gx-sidebar-menu-icon {
        display: block !important;
        width: 22px !important;
        height: 22px !important;
        flex: 0 0 22px !important;
        color: #a8c0df;
        background: currentColor;
        -webkit-mask-position: center;
        mask-position: center;
        -webkit-mask-repeat: no-repeat;
        mask-repeat: no-repeat;
        -webkit-mask-size: contain;
        mask-size: contain;
    }

    .gx-sidebar-menu-icon--games {
        -webkit-mask-image: url('https://optimize.v3.bundlecdn.com/unsafe/quality/plain/https://v3.bundlecdn.com/3bb50f/plain/route/casino.svg');
        mask-image: url('https://optimize.v3.bundlecdn.com/unsafe/quality/plain/https://v3.bundlecdn.com/3bb50f/plain/route/casino.svg');
    }

    .gx-sidebar-menu-icon--bonus {
        -webkit-mask-image: url('https://optimize.v3.bundlecdn.com/unsafe/quality/plain/https://v3.bundlecdn.com/3bb50f/plain/route/sidebar/gift.svg');
        mask-image: url('https://optimize.v3.bundlecdn.com/unsafe/quality/plain/https://v3.bundlecdn.com/3bb50f/plain/route/sidebar/gift.svg');
    }

    .gx-sidebar-menu-icon--faq {
        -webkit-mask-image: url('/img/icons/faq.svg');
        mask-image: url('/img/icons/faq.svg');
    }

    .gx-sidebar-menu-icon--terms {
        -webkit-mask-image: url('https://optimize.v3.bundlecdn.com/unsafe/quality/plain/https://v3.bundlecdn.com/3bb50f/plain/route/sidebar/document-text.svg');
        mask-image: url('https://optimize.v3.bundlecdn.com/unsafe/quality/plain/https://v3.bundlecdn.com/3bb50f/plain/route/sidebar/document-text.svg');
    }

    .gx-sidebar-navigation a.is-active .gx-sidebar-menu-icon,
    .gx-sidebar-navigation a:hover .gx-sidebar-menu-icon {
        color: #83b8ff;
    }

    .gx-sidebar-telegram,
    .gx-sidebar-language {
        display: inline-flex !important;
        align-items: center;
        min-height: 46px !important;
        border: 1px solid rgba(99, 151, 229, .22) !important;
        border-radius: 14px !important;
        box-sizing: border-box;
    }

    .gx-sidebar-telegram {
        justify-content: center;
        width: 48px !important;
        flex: 0 0 48px !important;
        color: #fff !important;
        background: #168dc5 !important;
    }

    .gx-sidebar-telegram .icon {
        width: 23px !important;
        height: 23px !important;
        fill: currentColor;
    }

    .gx-sidebar-language {
        position: relative;
        justify-content: flex-start;
        gap: 8px;
        flex: 1 1 auto;
        padding: 0 12px !important;
        overflow: hidden;
        color: #edf4ff !important;
        background: rgba(32, 56, 94, .86) !important;
    }

    .gx-sidebar-language__flag {
        width: 20px !important;
        height: 20px !important;
        flex: 0 0 20px !important;
    }

    .gx-sidebar-language__value {
        height: 44px !important;
        color: #edf4ff !important;
        font-size: 13px !important;
    }

    .gx-sidebar-language__chevron {
        right: 12px !important;
        color: #aec8eb !important;
    }

    .gx-sidebar-support {
        color: #e5efff !important;
        background: rgba(35, 59, 98, .76) !important;
    }

    .gx-sidebar-support .icon {
        width: 22px !important;
        height: 22px !important;
        color: #a8c0df !important;
    }

    .gx-sidebar-support b {
        display: inline-flex !important;
        align-items: center;
        justify-content: center;
        min-width: 42px;
        height: 28px;
        margin-left: auto;
        padding: 0 !important;
        border-radius: 999px;
        color: #fff !important;
        background: linear-gradient(145deg, #4d8df8, #2f6fda) !important;
        font-size: 10px !important;
        line-height: 1;
    }

    .mobile-bottom-nav {
        z-index: 90;
    }

    @media (max-width: 360px) {
        .sidebar__inner {
            width: min(65vw, calc(100vw - 12px)) !important;
            margin-left: 6px !important;
            padding-left: 10px !important;
            padding-right: 10px !important;
        }
    }
}
