#telegram-widget {
    --tg-bottom: 24px;
    --tg-offset: 24px;
    position: fixed;
    right: var(--tg-offset);
    bottom: calc(var(--tg-bottom) + env(safe-area-inset-bottom, 0px));
    z-index: 70;
    display: flex;
    align-items: center;
    width: auto;
    color: #fff;
    font-family: "DM Sans", system-ui, sans-serif;
    opacity: 0;
    visibility: hidden;
    transform: translate3d(0, 22px, 0) scale(.97);
    transition: opacity .42s ease, transform .42s cubic-bezier(.2,.8,.2,1), visibility .42s;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
}

#telegram-widget.ready {
    opacity: 1;
    visibility: visible;
    transform: translate3d(0, 0, 0) scale(1);
}

#telegram-widget[data-position="left"] { left: var(--tg-offset); right: auto; }

#telegram-widget a { color: #fff; text-decoration: none; }

#telegram-widget .tg-icon { color: #fff !important; fill: #fff !important; }

#telegram-widget .tg-fab { position: relative; width: 64px; height: 64px; flex: 0 0 64px; border-radius: 50%; }
#telegram-widget .tg-fab-glow { position: absolute; inset: -5px; border-radius: 50%; background: rgba(42,171,238,.42); animation: tg-widget-pulse 2.4s ease-out infinite; }
#telegram-widget .tg-icon-wrap { position: relative; z-index: 1; width: 100%; height: 100%; display: grid; place-items: center; border: 3px solid #dff5ff; border-radius: 50%; background: linear-gradient(145deg, #2aabee, #229ed9 58%, #168ac5); color: #fff; box-shadow: 0 11px 26px rgba(0,0,0,.32), inset 0 2px 0 rgba(255,255,255,.45), inset 0 -2px 0 rgba(8,104,164,.28); transition: transform .22s ease, box-shadow .22s ease; }
#telegram-widget .tg-fab:hover .tg-icon-wrap,
#telegram-widget .tg-fab:focus-visible .tg-icon-wrap { transform: translateY(-2px) scale(1.03); box-shadow: 0 14px 30px rgba(0,0,0,.36), 0 0 25px rgba(42,171,238,.5), inset 0 2px 0 rgba(255,255,255,.5); }
#telegram-widget .tg-icon { width: 35px; height: 35px; }
#telegram-widget .tg-notification-dot { position: absolute; z-index: 2; top: 0; right: 1px; width: 14px; height: 14px; border: 2px solid #fff; border-radius: 50%; background: #ff2d3d; box-shadow: 0 2px 8px rgba(0,0,0,.24); }
#telegram-widget .tg-fab:focus-visible { outline: 3px solid #fff; outline-offset: 4px; }

@keyframes tg-widget-pulse {
    0% { opacity: .48; transform: scale(.92); }
    70%, 100% { opacity: 0; transform: scale(1.2); }
}

#telegram-widget .tg-support-bubble { display: none; }

@media (max-width: 600px) {
    /* One visual row: 48px navigation pill beside the 64px Telegram button. */
    #telegram-widget { right: 14px; bottom: calc(14px + env(safe-area-inset-bottom, 0px)); left: auto; }
    .cardex-modern-shop .cardex-mobile-bottom-menu {
        left: 8px !important;
        right: 86px !important;
        bottom: calc(22px + env(safe-area-inset-bottom, 0px)) !important;
        padding-left: 4px;
        padding-right: 4px;
    }
    .cardex-modern-shop .cardex-mobile-bottom-menu .v-row {
        margin-left: 0;
        margin-right: 0;
        flex-wrap: nowrap;
    }
    .cardex-modern-shop .cardex-mobile-bottom-menu .v-row > .v-col {
        min-width: 0;
        padding-left: 0;
        padding-right: 0;
    }
    .cardex-modern-shop .cardex-mobile-bottom-menu a,
    .cardex-modern-shop .cardex-mobile-bottom-menu .c-pointer.d-inline-flex {
        min-width: 0;
        width: 100%;
        padding-left: 0;
        padding-right: 0;
    }
    #telegram-widget .tg-fab { width: 64px; height: 64px; flex-basis: 64px; }
    #telegram-widget .tg-icon { width: 35px; height: 35px; }
    .cardex-modern-shop .cardex-mobile-bottom-menu .v-row > .v-col { flex: 1 1 auto; width: auto; }
    .cardex-modern-shop .cardex-mobile-bottom-menu .mobile-live-chat-label { width: auto; overflow: visible; text-align: center; }
    .cardex-modern-shop .cardex-mobile-bottom-menu .mobile-live-chat-label-text {
        width: auto; max-width: none; overflow: visible; border-right: 0; animation: none;
    }
    #telegram-widget .tg-icon-wrap {
        box-shadow: 0 7px 18px rgba(0,0,0,.55), 0 0 16px rgba(42,171,238,.65), inset 0 2px 0 rgba(255,255,255,.45);
    }
    #telegram-widget .tg-fab-glow {
        inset: -3px;
        border: 2px solid #67f7ff;
        background: rgba(0, 210, 255, .24);
        box-shadow: 0 0 8px rgba(0, 220, 255, .9), inset 0 0 5px rgba(103, 247, 255, .65);
        animation: tg-mobile-support-pulse 7s ease-out infinite;
    }
    #telegram-widget .tg-support-bubble {
        display: block; position: absolute; right: 0; bottom: calc(100% + 16px);
        width: 168px; max-width: calc(100vw - 28px); padding: 11px 14px;
        background: #071117; border: 1px solid #2aabee; border-radius: 12px;
        box-shadow: 0 4px 16px rgba(0,0,0,.4), 0 0 12px rgba(42,171,238,.22);
        color: #f1fbff; line-height: 1.35; opacity: 0; visibility: hidden; pointer-events: none;
        transform: translateY(4px);
        transition: opacity .36s, transform .36s cubic-bezier(.2,.8,.2,1), visibility 0s linear .36s;
    }
    /* Follow the existing notification card's actual show/hide state. */
    body:has(.fb-notificationx.is-visible) #telegram-widget .tg-support-bubble {
        opacity: 1;
        visibility: visible;
        transform: translateY(0);
        transition-delay: 0s;
    }
    #telegram-widget .tg-support-bubble::after {
        content: ''; position: absolute; right: 25px; bottom: -6px; width: 10px; height: 10px;
        background: #071117; border-right: 1px solid #2aabee; border-bottom: 1px solid #2aabee; transform: rotate(45deg);
    }
    #telegram-widget .tg-support-bubble strong { display: block; font-size: 14px; font-weight: 700; }
    #telegram-widget .tg-support-bubble small { display: block; color: #a9c6d5; font-size: 12px; margin-top: 2px; }
    #telegram-widget .tg-notification-dot { width: 12px; height: 12px; }
}

@media (prefers-reduced-motion: reduce) {
    #telegram-widget,
    #telegram-widget .tg-fab-glow { animation: none; transition: none; }
}


/* Preserve source box sizing in the host layout. */
#telegram-widget, #telegram-widget * { box-sizing: border-box; }

/* Existing support link: desktop position only. */
@media (min-width: 992px) {
    .bottom-chat-button { left: 50px !important; right: auto !important; }
    .bottom-chat-button.d-lg-block { display: block !important; }
}

@keyframes tg-mobile-support-pulse {
  0% { opacity: .95; transform: scale(.98); }
  12% { opacity: .85; transform: scale(1.05); }
  30% { opacity: 0; transform: scale(1.11); }
  31%, 100% { opacity: 0; transform: scale(.98); }
}
@media (max-width: 600px) and (prefers-reduced-motion: reduce) {
  #telegram-widget .tg-support-bubble { transition: none; transform: none; }
}
