.kql {
    --size: 64px;
    --step: 78px;
    --spring: cubic-bezier(.25, 1, .35, 1);
    position: fixed;
    right: 3%;
    bottom: 10%;
    z-index: 9990;
    width: var(--size);
    height: var(--size);
}
.kql *, .kql *::before, .kql *::after { box-sizing: border-box; }
.kql-toggle, .kql-link {
    position: absolute;
    width: var(--size);
    height: var(--size);
    border-radius: 10px;
    padding: 0;
    border: 0;
    margin: 0;
    -webkit-tap-highlight-color: transparent;
}
.kql .kql-toggle {
    inset: 0;
    z-index: 4;
    display: block;
    overflow: visible;
    color: #fff;
    background: transparent;
    box-shadow: 0 3px 8px #10182824, 0 14px 32px #1018282e;
    cursor: pointer;
    translate: calc(var(--pointer-x, 0) * 5px) calc(var(--pointer-y, 0) * 4px);
}
.kql .kql-toggle:focus:not(:focus-visible), .kql .kql-link:focus:not(:focus-visible) {
    outline: none;
}
.kql .kql-toggle:focus-visible, .kql .kql-link:focus-visible {
    outline: 2px solid #ff4533;
    outline-offset: 3px;
}
.kql-base, .kql-cross {
    position: absolute;
    inset: 0;
    display: grid;
    place-items: center;
    border-radius: inherit;
    transition: transform .45s var(--spring), opacity .28s ease;
}
.kql .kql-base img, .kql .kql-link img {
    display: block;
    width: 100%;
    height: 100%;
    border-radius: inherit;
    max-width: none;
    object-fit: contain;
}
.kql-cross {
    border: 1px solid #ffffff30;
    box-shadow: inset 0 1px #ffffff38;
    background: #1e222a47;
    backdrop-filter: blur(12px) saturate(1.4);
    opacity: 0;
    transform: rotate(-100deg) scale(.4);
}
.kql[data-state="open"] .kql-base { opacity: 0; transform: rotate(100deg) scale(.4); }
.kql[data-state="open"] .kql-cross { opacity: 1; transform: none; }
.kql-channels { display: contents; }
.kql-link {
    bottom: calc((var(--rank) + 1) * var(--step));
    right: 0;
    display: block;
    box-shadow: 0 2px 6px #1018281f, 0 10px 24px #10182829;
    text-decoration: none;
    pointer-events: none;
    filter: brightness(calc(1 - var(--rank) * .12));
    transform: translate(var(--fan-x, 0px), calc((var(--rank) + 1) * var(--step))) rotate(var(--fan-angle, 0deg)) scale(var(--fan-scale, .8));
    animation: kql-sway var(--sway-time, 3.6s) ease-in-out var(--sway-delay, 0s) infinite alternate;
    transition: transform .5s cubic-bezier(.4, .08, .25, 1) max(0s, calc((2 - var(--rank)) * .05s)), opacity .3s, filter .45s;
}
.kql-vk { --fan-x: 12px; --fan-angle: 6deg; --fan-scale: .84; --sway-angle: 1.7deg; }
.kql-whatsapp { --fan-x: 20px; --fan-angle: 10deg; --fan-scale: .88; --sway-angle: 2.6deg; --sway-time: 4.1s; --sway-delay: -1.7s; }
.kql-max { --fan-x: -20px; --fan-angle: -10deg; --fan-scale: .88; --sway-angle: 2.2deg; --sway-time: 3.3s; }
.kql[data-state="open"] .kql-link {
    animation: none;
    transform: none;
    pointer-events: auto;
    opacity: 1;
    filter: none;
    transition: transform .6s var(--spring) calc(var(--rank) * .06s), opacity .35s ease calc(var(--rank) * .06s), filter .45s;
}
.kql[data-state="open"] .kql-link:is(:hover, :focus-visible) { transform: scale(1.07); transition-delay: 0s; }
.kql-label {
    position: absolute;
    top: 50%;
    right: calc(100% + 14px);
    transform: translate(10px, -50%);
    opacity: 0;
    background: #17191e;
    border: 1px solid #ffffff14;
    color: #e9ebef;
    font: 500 13px/1.2 system-ui, sans-serif;
    letter-spacing: normal;
    padding: 8px 14px;
    border-radius: 10px;
    white-space: nowrap;
    pointer-events: none;
    transition: opacity .22s ease, transform .22s ease;
}
.kql-link:is(:hover, :focus-visible) .kql-label { opacity: 1; transform: translate(0, -50%); }
.kql-flight {
    position: absolute;
    top: 0;
    left: 0;
    pointer-events: none;
    offset-path: path("M 30.5 32.3 C 44 32.3 74 48 74 32 A 42 42 0 1 0 -10 32 A 42 42 0 1 0 74 32 C 74 12 40 0 22 9 C 6 17 12 32.3 30.5 32.3");
    animation: kql-orbit 7s infinite;
}
.kql .kql-flight img {
    position: absolute;
    width: 36.2px;
    height: 30.2px;
    max-width: none;
    transform: translate(-50%, -50%);
    animation: kql-lift 7s ease-in-out infinite;
}
.kql[data-state] .kql-flight { animation: none; }
.kql[data-state="launch"] .kql-flight img, .kql[data-state="open"] .kql-flight img { animation: kql-launch .42s both; }
.kql[data-state="return"] .kql-flight img { animation: kql-return .6s cubic-bezier(.16, .8, .3, 1) both; }
.kql-wake { position: absolute; inset: 0; pointer-events: none; transform: rotate(-32deg); }
.kql-wake i {
    position: absolute;
    left: 30px;
    height: 2px;
    width: 34px;
    border-radius: 3px;
    opacity: 0;
    background: linear-gradient(90deg, transparent, #2aabeeec 35%, transparent);
}
.kql-wake i:nth-child(1) { top: 21px; }
.kql-wake i:nth-child(2) { top: 31px; width: 54px; height: 3px; left: 26px; }
.kql-wake i:nth-child(3) { top: 41px; width: 30px; }
.kql[data-state="launch"] .kql-wake i, .kql[data-state="open"] .kql-wake i { animation: kql-whoosh .5s both; }
.kql[data-state] .kql-wake i:nth-child(2) { animation-delay: .05s; }
.kql[data-state] .kql-wake i:nth-child(3) { animation-delay: .09s; }
@keyframes kql-sway {
    from { rotate: calc(-1 * var(--sway-angle, 0deg)); translate: 0 1.2px; }
    to { rotate: var(--sway-angle, 0deg); translate: 0 -1.4px; }
}
@keyframes kql-orbit {
    0%, 13% { offset-distance: 0%; animation-timing-function: ease-in-out; }
    60%, 100% { offset-distance: 100%; }
}
@keyframes kql-lift {
    0%, 13%, 60%, 100% { scale: 1; filter: none; }
    20%, 53% { scale: 1.14; filter: drop-shadow(0 4px 6px #143c5a47); }
}
@keyframes kql-launch {
    0% { transform: translate(-50%, -50%); }
    16% { transform: translate(calc(-50% - 5px), calc(-50% + 4px)) scale(.9, .96); }
    38% { transform: translate(calc(-50% + 9px), calc(-50% - 6px)) scale(1.05, .95); }
    78% { opacity: 1; }
    100% { transform: translate(calc(-50% + 150px), calc(-50% - 95px)) scale(1.45, .7); opacity: 0; }
}
@keyframes kql-return {
    0% { transform: translate(calc(-50% - 121px), calc(-50% + 76px)) scale(1.35, .78); opacity: 0; }
    22% { opacity: 1; }
    86% { transform: translate(calc(-50% + 4px), calc(-50% - 3px)); }
    100% { transform: translate(-50%, -50%); }
}
@keyframes kql-whoosh {
    0% { opacity: 0; transform: translateX(-6px) scaleX(.15); }
    22% { opacity: 1; }
    100% { opacity: 0; transform: translateX(120px) scaleX(1); }
}
@keyframes kql-quiver {
    from { rotate: .5deg; translate: .5px -.3px; }
    to { rotate: -1.6deg; translate: -.9px .55px; }
}
@media (hover: hover) {
    .kql:not([data-state]):has(.kql-toggle:is(:hover, :focus-visible)) .kql-link {
        transform: translateY(calc((var(--rank) + 1) * var(--step))) scale(.8);
        animation: none;
    }
    .kql:not([data-state]) .kql-toggle:is(:hover, :focus-visible) .kql-flight { animation: none; }
    .kql:not([data-state]) .kql-toggle:is(:hover, :focus-visible) .kql-flight img {
        transform: translate(calc(-50% - 7.6px), calc(-50% + 4.8px)) rotate(-2deg) scale(.88, 1.05);
        animation: kql-quiver .14s ease-in-out .3s infinite alternate;
    }
}
@media (max-width: 550px) {
    .kql { right: max(20px, env(safe-area-inset-right)); bottom: max(20px, env(safe-area-inset-bottom)); }
    .kql:not([data-state="open"]) .kql-link { opacity: 0; }
}
@media (hover: none) {
    .kql[data-state="open"] .kql-label { opacity: 1; transform: translate(0, -50%); }
}
@media (max-height: 420px) {
    .kql { --size: 48px; --step: 56px; }
}
@media (prefers-reduced-motion: reduce) {
    .kql *, .kql { animation: none !important; transition-duration: .01ms !important; }
    .kql[data-state="open"] .kql-flight { opacity: 0; }
}
