/* 只设计插件自己的结构，不接管待付款悬浮按钮或其他弹窗按钮。 */
.float-right.aft-toolbar {
    --aft-dw: 68px;
    --aft-mw: 44px;
    --aft-dr: 24px;
    --aft-mr: 0px;
    --aft-db: 110px;
    --aft-mb: 170px;
    --aft-di: 48px;
    --aft-mi: 32px;
    --aft-width: var(--aft-dw);
    --aft-right: var(--aft-dr);
    --aft-bottom: var(--aft-db);
    --aft-image: var(--aft-di);
    --aft-panel: var(--main-bg-color, #fff);
    --aft-line: var(--main-border-color, rgba(30, 40, 60, .08));
    --aft-hover: var(--muted-bg-color, #f3f4f7);
    --aft-accent: var(--theme-color, #f04494);
    --aft-elevation: 0 8px 30px rgba(25, 35, 55, .1);
    --aft-padding: 6px;
    --aft-gap: 3px;
    --aft-radius: 23px;
    --aft-height: 54px;
    --aft-hide-x: calc(100% + max(var(--aft-right), env(safe-area-inset-right, 0px)) + 48px);
    position: fixed;
    z-index: 1030;
    inset: auto max(var(--aft-right), env(safe-area-inset-right, 0px)) calc(var(--aft-effective-bottom, var(--aft-bottom)) + env(safe-area-inset-bottom, 0px)) auto;
    width: var(--aft-width);
    box-sizing: border-box;
    padding: var(--aft-padding);
    border: 1px solid var(--aft-line);
    border-radius: var(--aft-radius);
    background: var(--aft-panel);
    box-shadow: var(--aft-elevation);
    text-align: center;
    isolation: isolate;
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
    overflow: visible;
    opacity: 1;
    visibility: visible;
    transition: transform .18s ease, opacity .14s ease, visibility 0s linear;
    -webkit-backdrop-filter: none;
    backdrop-filter: none;
}

.dark-theme .float-right.aft-toolbar {
    --aft-elevation: 0 8px 30px rgba(0, 0, 0, .23);
}

.float-right.aft-toolbar[data-shadow="0"] {
    --aft-elevation: none;
}

.aft-toolbar::before,
.aft-toolbar::after {
    content: none;
}

.aft-toolbar .aft-actions {
    display: flex;
    flex-direction: column;
    gap: var(--aft-gap);
    width: 100%;
    overflow: visible;
}

.float-right.aft-toolbar .aft-actions > .float-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    position: relative;
    flex: 0 0 auto;
    width: 100%;
    min-height: var(--aft-height);
    margin: 0;
    padding: 8px 2px;
    box-sizing: border-box;
    border: 0;
    border-radius: 15px;
    background: transparent;
    font-size: 21px;
    line-height: 1.2;
    text-decoration: none;
    overflow: visible;
    -webkit-backdrop-filter: none;
    backdrop-filter: none;
    transition: background-color .15s ease;
}

.float-right.aft-toolbar .aft-actions > .float-btn:hover,
.float-right.aft-toolbar .aft-actions > .float-btn:focus-visible,
.float-right.aft-toolbar .aft-actions > .float-btn.aft-open {
    background: var(--aft-hover);
}

.float-right.aft-toolbar .aft-actions > .float-btn:focus-visible {
    outline: 2px solid var(--aft-accent) !important;
    outline-offset: 2px;
}

.float-right.aft-toolbar .aft-actions > .float-btn.ontop:not(.show) {
    display: none !important;
}

.aft-toolbar .aft-label,
.aft-toolbar .aft-actions > .float-btn > text {
    display: block;
    margin: 5px 0 0;
    width: 100%;
    color: inherit;
    font-size: 11px;
    font-weight: 500;
    line-height: 1.3;
    overflow-wrap: anywhere;
    white-space: normal;
    pointer-events: none;
}

/* 主题的日/月图标是绝对定位伪元素，必须有独立的定位容器。
   只裁剪图标自身，不能裁剪整颗按钮，否则会丢失角标或弹出菜单。 */
.float-right.aft-toolbar .aft-actions > .float-btn > .fa-toggle-theme {
    display: block;
    position: relative;
    flex: 0 0 1.15em;
    width: 1.15em;
    height: 1.15em;
    line-height: 1.15;
    overflow: hidden;
}

.float-right.aft-toolbar .aft-actions > .float-btn > .fa-toggle-theme::before,
.float-right.aft-toolbar .aft-actions > .float-btn > .fa-toggle-theme::after {
    inset: 0;
    width: 100%;
    height: 100%;
    margin: 0;
    line-height: 1.15;
    text-align: center;
}

.aft-toolbar .aft-actions > .float-btn > svg,
.aft-toolbar .aft-actions > .float-btn > .fa {
    flex-shrink: 0;
}

.aft-toolbar .aft-label,
.aft-toolbar .aft-actions > .float-btn > text {
    max-height: 2.6em;
    overflow: hidden;
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
}

.aft-toolbar[data-active-labels="0"] .aft-label,
.aft-toolbar[data-active-labels="0"] .aft-actions > .float-btn > text {
    display: none;
}

.aft-toolbar .aft-mascot {
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 2px auto 7px;
    width: min(var(--aft-image), 100%);
    height: min(var(--aft-image), calc(var(--aft-width) - 12px));
    pointer-events: none;
}

.aft-toolbar .aft-mascot-image {
    display: block;
    width: 100%;
    height: 100%;
    max-width: 100%;
    object-fit: contain;
    border-radius: 0;
    visibility: hidden;
}

.aft-toolbar .aft-mascot-image[data-aft-ready="1"] { visibility: visible; }

.aft-toolbar .aft-mascot[hidden] { display: none; }

/* 弹出菜单保持在栏外，不裁切角标；鼠标可跨越菜单间距。 */
.float-right.aft-toolbar .aft-actions > .float-btn > .hover-show-con {
    right: 100%;
    left: auto;
    top: var(--aft-popup-top, 0px);
    margin: 0 14px 0 0;
    max-width: max(120px, calc(100vw - var(--aft-width) - var(--aft-right) - 32px));
    max-height: calc(100vh - 32px);
    max-height: calc(100dvh - 32px);
    overflow-y: auto;
    overscroll-behavior: contain;
    text-align: left;
}

.aft-toolbar .aft-actions > .hover-show > .hover-show-con {
    cursor: auto;
}

.aft-toolbar .aft-actions > .hover-show::before {
    content: '';
    position: absolute;
    right: 100%;
    top: 0;
    width: 16px;
    height: 100%;
    background: transparent;
    pointer-events: none;
}

.aft-toolbar .aft-actions > .hover-show:hover::before,
.aft-toolbar .aft-actions > .hover-show:focus-within::before,
.aft-toolbar .aft-actions > .hover-show.aft-open::before {
    pointer-events: auto;
}

.aft-toolbar .aft-actions > .float-btn > .dropdown-menu::before {
    top: 14px;
    right: -5px;
    left: auto;
}

.aft-toolbar .aft-actions > .hover-show:focus-within > .hover-show-con,
.aft-toolbar .aft-actions > .hover-show.aft-open > .hover-show-con {
    visibility: visible;
    opacity: 1;
    transform: translateY(0);
}

/* 现有私信角标保留在按钮内侧，避免顶到屏幕边缘。 */
.float-right.aft-toolbar .aft-actions > .float-btn.more-btn[data-aikiv-private-count]::after {
    top: 5px;
    right: 3px;
}

.aft-toolbar[data-active-style="glass"] {
    background: var(--blur-bg, var(--main-bg-color));
    -webkit-backdrop-filter: saturate(1.2) blur(14px);
    backdrop-filter: saturate(1.2) blur(14px);
    border-color: var(--main-border-color);
    --aft-radius: 18px;
}

.aft-toolbar[data-active-style="tiles"] {
    background: transparent;
    border-color: transparent;
    padding: 0;
    box-shadow: none;
    --aft-gap: 9px;
}

.float-right.aft-toolbar[data-active-style="tiles"] .aft-actions > .float-btn {
    border: 1px solid var(--aft-line);
    background: var(--aft-panel);
    box-shadow: var(--aft-elevation);
    border-radius: 16px;
}

.float-right.aft-toolbar[data-active-style="tiles"] .aft-actions > .float-btn:hover {
    background: var(--aft-hover);
}

.float-right.aft-toolbar[data-active-style="minimal"] {
    --aft-radius: 12px;
    --aft-elevation: none;
    --aft-gap: 0px;
    --aft-padding: 4px;
}

.float-right.aft-toolbar[data-active-style="minimal"] .aft-actions > .float-btn + .float-btn {
    border-top: 1px solid var(--aft-line);
    border-radius: 0;
}

.aft-toolbar[data-active-style="tint"] {
    --aft-radius: 22px;
    border-top: 3px solid var(--aft-accent);
    background: var(--aft-panel);
    background: color-mix(in srgb, var(--aft-accent) 7%, var(--aft-panel));
}

.aft-toolbar[data-active-style="tint"] .aft-mascot {
    margin-bottom: 10px;
}

.aft-toolbar[data-active-style="tint"] .aft-actions {
    position: relative;
}

.aft-toolbar[data-position="center"] {
    top: 50%;
    bottom: auto;
    transform: translateY(-50%);
}

/* 保留主题原有滚动/弹窗隐藏行为。 */
body:has(.modal.in) .float-right.aft-toolbar,
.modal-open .float-right.aft-toolbar,
.imgbox-show .float-right.aft-toolbar,
.scroll-down .scroll-down-hide.float-right.aft-toolbar,
.scroll-ing .scrolling-hide.float-right.aft-toolbar {
    transform: translateX(var(--aft-hide-x));
    opacity: 0;
    visibility: hidden;
    transition-delay: 0s, 0s, .18s;
    pointer-events: none;
}

body:has(.modal.in) .aft-toolbar[data-position="center"],
.modal-open .aft-toolbar[data-position="center"],
.imgbox-show .aft-toolbar[data-position="center"],
.scroll-down .scroll-down-hide.aft-toolbar[data-position="center"],
.scroll-ing .scrolling-hide.aft-toolbar[data-position="center"] {
    transform: translate(var(--aft-hide-x), -50%);
}

.aft-toolbar.aft-compact {
    --aft-gap: 1px;
    --aft-padding: 3px;
    --aft-height: 38px;
}

.float-right.aft-toolbar.aft-compact .aft-actions > .float-btn {
    padding-top: 5px;
    padding-bottom: 5px;
    font-size: 18px;
}

.aft-toolbar.aft-compact .aft-label {
    margin-top: 2px;
    font-size: 10px;
}

.aft-toolbar.aft-compact .aft-mascot {
    width: min(30px, 100%);
    height: 30px;
    margin-bottom: 3px;
}

@media (min-width: 768px) {
    .aft-toolbar[data-desktop-enabled="0"] { display: none; }
    .aft-toolbar[data-desktop-labels="0"] .aft-label { display: none; }
}

@media (max-width: 767px) {
    .float-right.aft-toolbar {
        --aft-width: var(--aft-mw);
        --aft-right: var(--aft-mr);
        --aft-bottom: var(--aft-mb);
        --aft-image: var(--aft-mi);
        --aft-height: 42px;
        --aft-padding: 3px;
        --aft-radius: 22px;
        --aft-gap: 2px;
    }
    .float-right.aft-toolbar .aft-actions > .float-btn {
        min-height: var(--aft-height);
        padding: 8px 1px;
        border-radius: 13px;
        font-size: 21px;
    }
    .aft-toolbar[data-mobile-enabled="0"],
    .aft-toolbar[data-mobile-image="0"] .aft-mascot,
    .aft-toolbar[data-mobile-labels="0"] .aft-label {
        display: none;
    }
    .float-right.aft-toolbar[data-mobile-labels="1"] {
        --aft-width: max(var(--aft-mw), 56px);
        --aft-height: 54px;
    }
    .aft-toolbar[data-edge="1"] {
        border-right: 0;
        border-top-right-radius: 0;
        border-bottom-right-radius: 0;
    }
    .aft-toolbar[data-edge="1"] .aft-actions > .float-btn {
        border-top-right-radius: 0;
        border-bottom-right-radius: 0;
    }
    .aft-toolbar .aft-label,
    .aft-toolbar .aft-actions > .float-btn > text { font-size: 10px; }
    .aft-toolbar .aft-mascot { margin-bottom: 5px; }
    .float-right.aft-toolbar.aft-compact { --aft-height: 38px; --aft-gap: 1px; }
}

@media (hover: none) {
    .aft-toolbar .aft-actions > .hover-show:not(.aft-open) > .hover-show-con {
        visibility: hidden;
        opacity: 0;
        pointer-events: none;
    }
}

@media (prefers-reduced-motion: reduce) {
    .float-right.aft-toolbar,
    .float-right.aft-toolbar .aft-actions > .float-btn {
        transition: none !important;
    }
}
