/* One 8-second timeline: flight, MAX spin, return flight. */
.tb-messenger-animated-btn__inner {
    position: relative;
    display: block;
    width: 56px;
    height: 56px;
    border-radius: 18px;
    overflow: hidden;
    isolation: isolate;
    background: #27a7e7;
    /* Keep clipping on a stable composited surface during the crossfade. */
    transform: translateZ(0);
    -webkit-mask-image: -webkit-radial-gradient(white, black);
}
.tb-messenger-animated-btn__icon {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
}
.tb-messenger-animated-btn__icon--telegram {
    background: linear-gradient(155deg, #37bbed, #229ed9);
}
.tb-messenger-animated-btn__icon--max {
    /* MAX brand palette: https://go.max.ru/brandbook */
    background: radial-gradient(ellipse at 0% 100%, #00bfff 0%, transparent 65%),
        linear-gradient(125deg, #471aff 10%, #6e1aff 55%, #9500ff 100%);
    opacity: 0;
    animation: tbMessengerMax 8s ease-in-out infinite;
}
.tb-to-top-messengers-btn .tb-messenger-animated-btn__icon--telegram svg {
    display: block;
    width: 30px;
    height: 30px;
    transform: translateX(1px);
    animation: tbMessengerFlight 8s linear infinite;
    transform-origin: 50% 50%;
}
.tb-to-top-messengers-btn .tb-messenger-animated-btn__icon--max svg {
    display: block;
    width: 44px;
    height: 44px;
    animation: tbMessengerSpin 8s linear infinite;
    transform-origin: 50% 50%;
}
@keyframes tbMessengerMax {
    0%, 33%, 84%, 100% { opacity: 0; }
    42%, 77% { opacity: 1; }
}
@keyframes tbMessengerFlight {
    0%, 23% { opacity: 1; transform: translate(1px, 0) scale(1.16); animation-timing-function: cubic-bezier(.4, 0, .75, .55); }
    38% { opacity: 0; transform: translate(43px, -42px) scale(.82); }
    39%, 81% { opacity: 0; transform: translate(-35px, 36px) scale(.9); animation-timing-function: cubic-bezier(.2, .65, .3, 1); }
    95%, 100% { opacity: 1; transform: translate(1px, 0) scale(1.16); }
}
@keyframes tbMessengerSpin {
    0%, 36% { opacity: 0; transform: rotate(-280deg) scale(.22); animation-timing-function: cubic-bezier(.16, .65, .3, 1); }
    47%, 69% { opacity: 1; transform: rotate(0deg) scale(1); animation-timing-function: cubic-bezier(.55, 0, .8, .45); }
    80%, 100% { opacity: 0; transform: rotate(300deg) scale(.18); }
}
.to-top .to-top__control {
    display: block !important;
    opacity: 1 !important;
    visibility: visible !important;
    pointer-events: auto !important;
}
.tb-to-top-actions {
    display: flex !important;
    flex-direction: row !important;
    align-items: center !important;
    justify-content: flex-end !important;
    gap: 12px !important;
    overflow: visible !important;
}
.tb-to-top-actions .to-top__btn {
    position: relative !important;
    flex: 0 0 56px !important;
    width: 56px !important;
    height: 56px !important;
    margin: 0 !important;
}
.to-top__control:not(.to-top__control--show) .tb-to-top-actions .to-top__btn {
    display: none !important;
}
.to-top__control.to-top__control--show .tb-to-top-actions .to-top__btn {
    display: block !important;
}
.tb-to-top-messengers-btn {
    position: relative;
    z-index: 50;
    flex: 0 0 56px;
    display: block;
    width: 56px;
    height: 56px;
    padding: 0;
    margin: 0;
    border: 0;
    border-radius: 18px;
    background: transparent;
    cursor: pointer;
    box-shadow: 0 3px 12px rgb(63 45 90 / 12%);
    pointer-events: auto;
    appearance: none;
    -webkit-appearance: none;
    transition: box-shadow 200ms ease;
}
.tb-to-top-messengers-btn:hover { box-shadow: 0 5px 18px rgb(63 45 90 / 20%); }
.tb-to-top-messengers-btn:focus-visible { outline: 3px solid #9562e6; outline-offset: 4px; }
.tb-to-top-messengers-btn[data-paused] .tb-messenger-animated-btn__icon--max,
.tb-to-top-messengers-btn[data-paused] .tb-messenger-animated-btn__icon svg { animation-play-state: paused; }
@media (prefers-reduced-motion: reduce) {
    .tb-messenger-animated-btn__icon--max { animation: none; opacity: 1; }
    .tb-to-top-messengers-btn .tb-messenger-animated-btn__icon svg { animation: none; transform: none; }
    .tb-to-top-messengers-btn { transition: none; }
}
