/* ==========================================================================
   回到顶部 / Back to top
   作用域：.mm-top  （mm = marxmake，避免与 Bootstrap / Tailwind 冲突）
   位置：贴在右下角咨询气泡的正上方，垂直居中对齐
   ========================================================================== */

/* 旧 scrollUp 插件如果还有残留元素，直接隐藏 */
#scrollUp {
    display: none !important;
}

.mm-top,
.mm-top * {
    box-sizing: border-box;
}

.mm-top {
    position: fixed;
    right: 102px;
    bottom: 37px;
    z-index: 9985;
    width: 46px;
    height: 46px;
    margin: 0;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: transparent;
    cursor: pointer;
    font-family: inherit;
    -webkit-tap-highlight-color: transparent;
    -webkit-appearance: none;
    appearance: none;
    opacity: 0;
    visibility: hidden;
    transform: translateY(10px) scale(0.94);
    transition:
        opacity 0.26s ease,
        transform 0.28s cubic-bezier(0.22, 1, 0.36, 1),
        visibility 0.26s;
}

.mm-top.is-visible {
    opacity: 1;
    visibility: visible;
    transform: translateY(0) scale(1);
}

/* ---------- 外圈：滚动进度环 ---------- */
.mm-top-ring {
    position: absolute;
    inset: 0;
    border-radius: 50%;
    background: conic-gradient(
        from -90deg,
        #1a7aff calc(var(--mm-top-p, 0) * 1%),
        #dfe8f6 0
    );
}

/* ---------- 内圈：白色按钮 + 箭头 ---------- */
.mm-top-core {
    position: absolute;
    inset: 3px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: #fff;
    color: #1a7aff;
    box-shadow:
        0 8px 20px -6px rgba(13, 55, 120, 0.24),
        0 2px 6px rgba(13, 55, 120, 0.08);
    transition:
        background-color 0.24s ease,
        color 0.24s ease,
        box-shadow 0.24s ease;
}

.mm-top-core svg {
    display: block;
    width: 19px;
    height: 19px;
    transition: transform 0.26s cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* ---------- 交互 ---------- */
.mm-top:hover,
.mm-top:focus-visible {
    transform: translateY(-2px) scale(1);
}

.mm-top:hover .mm-top-core,
.mm-top:focus-visible .mm-top-core {
    background: linear-gradient(140deg, #41a0ff 0%, #1a7aff 55%, #0b56d6 100%);
    color: #fff;
    box-shadow:
        0 14px 26px -8px rgba(11, 86, 214, 0.5),
        0 4px 10px rgba(11, 86, 214, 0.22);
}

.mm-top:hover .mm-top-core svg,
.mm-top:focus-visible .mm-top-core svg {
    transform: translateY(-2px);
}

.mm-top:active {
    transform: translateY(0) scale(0.94);
}

.mm-top:focus-visible {
    outline: 2px solid #1a7aff;
    outline-offset: 3px;
}

/* ---------- 左侧提示气泡 ---------- */
.mm-top-tip {
    position: absolute;
    top: 50%;
    right: calc(100% + 12px);
    padding: 6px 10px;
    border-radius: 8px;
    background: rgba(15, 23, 42, 0.92);
    color: #fff;
    font-size: 12px;
    line-height: 1.2;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transform: translateY(-50%) translateX(4px);
    transition: opacity 0.2s ease, transform 0.2s ease;
}

.mm-top-tip::after {
    content: "";
    position: absolute;
    top: 50%;
    left: 100%;
    width: 6px;
    height: 6px;
    border-radius: 1px;
    background: rgba(15, 23, 42, 0.92);
    transform: translate(-3px, -50%) rotate(45deg);
}

@media (hover: hover) and (pointer: fine) {
    .mm-top:hover .mm-top-tip,
    .mm-top:focus-visible .mm-top-tip {
        opacity: 1;
        transform: translateY(-50%) translateX(0);
    }
}

/* 触屏没有 hover，提示气泡不显示 */
@media (hover: none), (pointer: coarse) {
    .mm-top-tip {
        display: none;
    }
}

/* ---------- 手机：放在气泡左侧，垂直居中对齐 ---------- */
@media (max-width: 767px) {
    .mm-top {
        right: 82px;
        bottom: calc(82px + env(safe-area-inset-bottom, 0px));
        width: 44px;
        height: 44px;
    }

    .mm-top-core svg {
        width: 18px;
        height: 18px;
    }
}

/* ---------- 无障碍 / 打印 ---------- */
@media (prefers-reduced-motion: reduce) {
    .mm-top,
    .mm-top-core,
    .mm-top-core svg {
        transition: none !important;
    }
}

@media print {
    .mm-top {
        display: none !important;
    }
}
