/**
 * 商品详情页：可拖动快捷菜单（首页 / 回顶 / 个人中心 / 充值）
 * 菜单相对按钮绝对定位；水平/垂直朝向由根节点 class --h-start / --v-below 控制（JS 按视口位置切换）
 */
.acg-item-quick-fab {
    position: fixed;
    z-index: 1040;
    right: max(14px, env(safe-area-inset-right, 0px));
    bottom: auto;
    /* 默认：靠右，主按钮中心约在视口高度 58% 附近；底部多留白，减少被浏览器底栏遮挡 */
    top: max(
        16px,
        min(
            calc(58vh - 24px),
            calc(100vh - env(safe-area-inset-bottom, 0px) - 200px)
        )
    );
    user-select: none;
    -webkit-user-select: none;
}

/* 仅包住主按钮尺寸，便于拖动命中与定位计算；菜单绝对定位脱出 */
.acg-item-quick-fab__anchor {
    position: relative;
    width: 48px;
    height: 48px;
}

.acg-item-quick-fab.is-dragging,
.acg-item-quick-fab.is-dragging * {
    cursor: grabbing;
}

.acg-item-quick-fab__main {
    position: relative;
    z-index: 3;
    width: 48px;
    height: 48px;
    border: 0;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    background: linear-gradient(135deg, rgba(12, 132, 209, 0.95), rgba(0, 158, 247, 0.88));
    box-shadow: 0 6px 20px rgba(12, 132, 209, 0.35);
    cursor: grab;
    touch-action: none;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.acg-item-quick-fab__main:hover {
    transform: scale(1.04);
    box-shadow: 0 8px 26px rgba(12, 132, 209, 0.42);
}

.acg-item-quick-fab__main:active {
    cursor: grabbing;
}

.acg-item-quick-fab__main .fa-duotone {
    font-size: 1.25rem;
    --fa-primary-color: #fff;
    --fa-secondary-color: rgba(255, 255, 255, 0.65);
    --fa-secondary-opacity: 1;
}

.acg-item-quick-fab__main[aria-expanded="true"] {
    background: linear-gradient(135deg, rgba(10, 110, 175, 0.98), rgba(0, 140, 220, 0.92));
}

/* 默认：靠右区域 → 菜单右缘与按钮对齐，向左展开；靠上区域 → 菜单在按钮上方 */
.acg-item-quick-fab__menu {
    position: absolute;
    z-index: 2;
    display: flex;
    flex-direction: column;
    gap: 6px;
    min-width: 148px;
    max-width: min(168px, calc(100vw - 24px));
    padding: 8px;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.96);
    border: 1px solid rgba(12, 132, 209, 0.2);
    box-shadow: 0 10px 32px rgba(12, 132, 209, 0.14);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    right: 0;
    left: auto;
    bottom: calc(100% + 8px);
    top: auto;
}

/* 靠左区域：菜单左缘与按钮对齐，向右展开 */
.acg-item-quick-fab--h-start .acg-item-quick-fab__menu {
    left: 0;
    right: auto;
}

/* 靠上区域：菜单改到按钮下方，避免顶出屏幕 */
.acg-item-quick-fab--v-below .acg-item-quick-fab__menu {
    top: calc(100% + 8px);
    bottom: auto;
}

.acg-item-quick-fab__menu[hidden] {
    display: none !important;
}

.acg-item-quick-fab__link {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 10px;
    border: 0;
    border-radius: 8px;
    width: 100%;
    text-align: left;
    text-decoration: none;
    font-size: 14px;
    line-height: 1.3;
    color: #0b3b66;
    background: transparent;
    cursor: pointer;
    transition: background 0.12s ease;
}

.acg-item-quick-fab__link:hover {
    background: rgba(12, 132, 209, 0.1);
    color: #064a78;
}

.acg-item-quick-fab__link .fa-duotone {
    width: 1.25em;
    flex-shrink: 0;
    font-size: 15px;
    color: #0c84d1;
    --fa-primary-color: #0c84d1;
    --fa-secondary-color: #7eb6e8;
    --fa-secondary-opacity: 1;
}

@media (max-width: 991.98px) {
    .acg-item-quick-fab {
        top: max(
            16px,
            min(
                calc(60vh - 24px),
                calc(100vh - env(safe-area-inset-bottom, 0px) - 220px)
            )
        );
    }
}
