.ymx-kefu {
    position: fixed;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    user-select: none;
}

.ymx-kefu.right_bottom {
    right: 20px;
    bottom: 20px;
}

.ymx-kefu.right_middle {
    right: 20px;
    top: 50%;
    transform: translateY(-50%);
}

.ymx-kefu .kefu-item {
    position: relative;
    margin-bottom: 3px;
}

.ymx-kefu .kefu-item.qq,
.ymx-kefu .kefu-item.phone,
.ymx-kefu .kefu-item.weixin,
.ymx-kefu .kefu-item.whatsapp,
.ymx-kefu .kefu-item.telegram,
.ymx-kefu .kefu-item.custom,
.ymx-kefu .kefu-item.back-top {
    display: flex;
    align-items: center;
    justify-content: flex-end;
}

.ymx-kefu .kefu-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 68px;
    height: 65px;
    background: #fff;
    border: 1px solid #eee;
    border-radius: 6px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
    cursor: pointer;
    transition: box-shadow 0.2s, border-color 0.2s, transform 0.2s;
    position: relative;
}

.ymx-kefu .kefu-btn:hover {
    border-color: #ddd;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
}

.ymx-kefu .kefu-icon,
.ymx-kefu .kefu-text {
    display: block;
    margin: 0;
}

.ymx-kefu .kefu-icon {
    width: 22px;
    height: 22px;
    display: inline-block;
    vertical-align: middle;
}

.ymx-kefu .kefu-text {
    margin-top: 6px;
    font-size: 12px;
    color: #333;
    white-space: nowrap;
    text-align: center;
}

.ymx-kefu .iconfont {
    display: inline-block;
    line-height: 1;
    vertical-align: middle;
    width: auto;
    height: auto;
    font-size: inherit;
}

.ymx-kefu .kefu-item.back-top .kefu-icon {
    color: #666666;
}

.ymx-kefu .kefu-item.qq .kefu-icon {
    color: #12b7f5;
}

.ymx-kefu .kefu-item.phone .kefu-icon {
    color: #2f9bff;
}

.ymx-kefu .kefu-item.weixin .kefu-icon {
    color: #00c300;
}

.ymx-kefu .kefu-item.custom .kefu-icon {
    color: #ff8a00;
}

.ymx-kefu .kefu-item.whatsapp .kefu-icon {
    color: #25d366;
}

.ymx-kefu .kefu-item.telegram .kefu-icon {
    color: #229ed9;
}

.ymx-kefu .qq-tooltip,
.ymx-kefu .phone-tooltip,
.ymx-kefu .whatsapp-tooltip,
.ymx-kefu .telegram-tooltip {
    position: absolute;
    right: calc(100% + 20px);
    top: 0;
    bottom: 0;
    margin: auto 0;
    transform: scale(0.9);
    opacity: 0;
    pointer-events: none;
    background: #fff;
    border: 1px solid #eee;
    border-radius: 8px;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.14);
    min-width: 116px;
    max-width: 200px;
    height: 46px;
    padding: 0 17px;
    display: flex;
    align-items: center;
    font-size: 15px;
    color: #333;
    transition: opacity 0.22s cubic-bezier(0.4, 0, 0.2, 1), transform 0.22s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 10;
    white-space: nowrap;
}

.ymx-kefu .weixin-tooltip {
    position: absolute;
    right: calc(100% + 20px);
    top: 0;
    bottom: 0;
    margin: auto 0;
    transform: scale(0.9);
    opacity: 0;
    pointer-events: none;
    background: #fff;
    border: 1px solid #eee;
    border-radius: 8px;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.14);
    width: 150px;
    height: 170px;
    padding: 10px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    font-size: 14px;
    color: #333;
    transition: opacity 0.22s cubic-bezier(0.4, 0, 0.2, 1), transform 0.22s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 10;
    box-sizing: border-box;
}

.ymx-kefu .kefu-item.qq:hover .qq-tooltip,
.ymx-kefu .kefu-item.qq:focus-within .qq-tooltip,
.ymx-kefu .kefu-item.phone:hover .phone-tooltip,
.ymx-kefu .kefu-item.phone:focus-within .phone-tooltip,
.ymx-kefu .kefu-item.weixin:hover .weixin-tooltip,
.ymx-kefu .kefu-item.weixin:focus-within .weixin-tooltip,
.ymx-kefu .kefu-item.whatsapp:hover .whatsapp-tooltip,
.ymx-kefu .kefu-item.whatsapp:focus-within .whatsapp-tooltip,
.ymx-kefu .kefu-item.telegram:hover .telegram-tooltip,
.ymx-kefu .kefu-item.telegram:focus-within .telegram-tooltip {
    opacity: 1;
    transform: scale(1);
    pointer-events: auto;
}

.ymx-kefu .qq-tooltip::after,
.ymx-kefu .phone-tooltip::after,
.ymx-kefu .weixin-tooltip::after,
.ymx-kefu .whatsapp-tooltip::after,
.ymx-kefu .telegram-tooltip::after {
    content: "";
    position: absolute;
    right: -10px;
    top: 50%;
    transform: translateY(-50%);
    width: 0;
    height: 0;
    border-left: 10px solid #fff;
    border-top: 8px solid transparent;
    border-bottom: 8px solid transparent;
    filter: drop-shadow(-1px 0 0 #eee);
}

.ymx-kefu .qq-tooltip::before {
    content: none;
}

.ymx-kefu .weixin-tooltip .weixin-number {
    font-size: 14px;
    color: #333;
    height: 20px;
    line-height: 20px;
    margin: 0;
    padding: 0;
    font-weight: 500;
    text-align: center;
    width: 100%;
    flex-shrink: 0;
}

.ymx-kefu .weixin-tooltip .weixin-qrcode {
    width: 130px;
    height: 130px;
    object-fit: contain;
    border-radius: 4px;
    display: block;
    margin: 0;
    padding: 0;
    flex-shrink: 0;
}

@media (max-width: 768px) {
    .ymx-kefu.right_middle {
        top: auto;
        bottom: 20px;
        transform: none;
    }

    .ymx-kefu.ymx-kefu-mobile {
        position: fixed;
        left: 0;
        right: 0;
        bottom: 0;
        top: auto;
        display: flex;
        flex-direction: row;
        align-items: center;
        justify-content: space-around;
        padding: 8px;
        background: #fff;
        border-top: 1px solid #eee;
        box-shadow: 0 -2px 8px rgba(0, 0, 0, 0.06);
        z-index: 9999;
    }

    .ymx-kefu.ymx-kefu-mobile .kefu-item {
        flex: 1;
        margin: 0 4px;
        margin-bottom: 0;
        display: flex;
        justify-content: center;
    }

    .ymx-kefu.ymx-kefu-mobile .kefu-btn {
        width: 100%;
        max-width: 80px;
        height: 60px;
        border: none;
        box-shadow: none;
    }

    .ymx-kefu.ymx-kefu-mobile .qq-tooltip,
    .ymx-kefu.ymx-kefu-mobile .phone-tooltip,
    .ymx-kefu.ymx-kefu-mobile .whatsapp-tooltip,
    .ymx-kefu.ymx-kefu-mobile .telegram-tooltip,
    .ymx-kefu.ymx-kefu-mobile .weixin-tooltip {
        right: auto;
        left: 50%;
        top: auto;
        bottom: calc(100% + 10px);
        margin: 0;
    }

    .ymx-kefu.ymx-kefu-mobile .qq-tooltip,
    .ymx-kefu.ymx-kefu-mobile .phone-tooltip,
    .ymx-kefu.ymx-kefu-mobile .whatsapp-tooltip,
    .ymx-kefu.ymx-kefu-mobile .telegram-tooltip {
        transform: translateX(-50%) scale(0.9);
    }

    .ymx-kefu.ymx-kefu-mobile .weixin-tooltip {
        transform: translateX(-50%) scale(0.9);
    }

    .ymx-kefu.ymx-kefu-mobile .kefu-item.qq:hover .qq-tooltip,
    .ymx-kefu.ymx-kefu-mobile .kefu-item.qq:focus-within .qq-tooltip,
    .ymx-kefu.ymx-kefu-mobile .kefu-item.phone:hover .phone-tooltip,
    .ymx-kefu.ymx-kefu-mobile .kefu-item.phone:focus-within .phone-tooltip,
    .ymx-kefu.ymx-kefu-mobile .kefu-item.whatsapp:hover .whatsapp-tooltip,
    .ymx-kefu.ymx-kefu-mobile .kefu-item.whatsapp:focus-within .whatsapp-tooltip,
    .ymx-kefu.ymx-kefu-mobile .kefu-item.telegram:hover .telegram-tooltip,
    .ymx-kefu.ymx-kefu-mobile .kefu-item.telegram:focus-within .telegram-tooltip,
    .ymx-kefu.ymx-kefu-mobile .kefu-item.weixin:hover .weixin-tooltip,
    .ymx-kefu.ymx-kefu-mobile .kefu-item.weixin:focus-within .weixin-tooltip {
        transform: translateX(-50%) scale(1);
    }

    .ymx-kefu.ymx-kefu-mobile .qq-tooltip::after,
    .ymx-kefu.ymx-kefu-mobile .phone-tooltip::after,
    .ymx-kefu.ymx-kefu-mobile .whatsapp-tooltip::after,
    .ymx-kefu.ymx-kefu-mobile .telegram-tooltip::after,
    .ymx-kefu.ymx-kefu-mobile .weixin-tooltip::after {
        right: auto;
        left: 50%;
        top: auto;
        bottom: -10px;
        transform: translateX(-50%);
        border-left: 8px solid transparent;
        border-right: 8px solid transparent;
        border-top: 10px solid #fff;
        border-bottom: none;
        filter: drop-shadow(0 1px 0 #eee);
    }

    .ymx-kefu.ymx-kefu-mobile .kefu-item.back-top {
        display: none;
    }
}
