#tagz-backendPanel {
    --panel-width: min(85vw, 960px);

    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    z-index: 9999;
    transform: translateX(-100%);
    transition: transform 0.15s ease;

    .backend-panel {
        top: 0;
        left: 0;
        height: 100vh;
        width: var(--panel-width);
        position: fixed;
        background: #fff;
        transform: translateX(-100%);
        transition: transform 0.35s ease;
        box-shadow: 4px 0 16px rgba(0, 0, 0, 0.2);
    }

    &.open {
        transform: translateX(0);
    }

    &.open .backend-panel {
        transform: translateX(0);
    }

    /* iframe */
    .backend-panel-frame {
        width: 100%;
        height: 100%;
        border: 0;
    }

    /* 关闭按钮 */
    .backend-panel-close {
        position: absolute;
        top: 12px;
        left: calc(var(--panel-width) + 6px);
        z-index: 2;

        width: 36px;
        height: 36px;
        border-radius: 50%;
        border: none;

        font-size: 22px;
        line-height: 1;
        cursor: pointer;

        background: #f3f3f3;

        &:hover {
            background: #e0e0e0;
        }
    }

    /* 遮罩 */
    /* .backend-panel-mask {
        position: fixed;
        inset: 0;
        background: rgba(0, 0, 0, 0.35);
        z-index: 9998;
    } */

}

#tagz-edit-panel-overlay button,
#tagz-edit-Target-overlay button,
.tagz-edit-btn {
    display: inline-flex;
    justify-content: center;
    align-items: center;
    background-color: #666;
    color: #fff;
    border: none;
    padding: 4px 12px;
    font-size: 12px;
    cursor: pointer;
    border-radius: 4px;
}


#tagz-edit-Target-overlay {
    position: absolute;
    top: 0;
    left: 0;
    inset: 0;
    pointer-events: none;
    z-index: 99999;


    & .tagz-edit-overlay-highlight {
        position: absolute;
        border: 2px solid #4da3ff;
        background: rgba(77, 163, 255, 0.06);
        display: none;
        pointer-events: none;
        box-sizing: border-box;

    }


    & .tagz-edit-overlay-toolbar {
        position: absolute;
        display: none;
        background-color: transparent;
        border-radius: 6px;
        padding: 4px 4px 8px 4px;
        gap: 4px;
        pointer-events: auto;
        flex-direction: row;
        justify-content: flex-end;


    }


}

#tagz-edit-panel-overlay {
    position: fixed;
    z-index: 2000;
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 6px;

    background: rgba(0, 0, 0, 0.8);
    padding: 6px 12px;
    border-radius: 6px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.5);

    width: auto;
    /* 固定最小宽度，避免缩放怪异 */
    min-width: 200px;
    max-width: 90%;
    cursor: default;




    &.direction-right,
    &.direction-left {
        flex-direction: column;
        width: 56px;
        min-width: unset;
        max-width: unset;
        gap: 10px;

        top: 50%;
        left: unset;
        right: 10px;
    }

    &.direction-left {
        right: unset;
        left: 10px;
    }


    /* 拖动手柄 */
    & .drag-handle {
        cursor: grab;
        padding: 0 6px;
        font-size: 16px;
        display: flex;
        align-items: center;
        user-select: none;

        touch-action: none;
        /* 关键：防止移动端触发滚动 */

        color: #fff9;
        flex-shrink: 0;
    }

    & button {
        padding: 5px 14px;
        font-size: 12px;
        flex-shrink: 0;
        /* 避免按钮随容器缩小 */
    }

    &.direction-right button {
        width: 42px;

    }

}


/*--分页容器--*/
[data-tagz-pagination] {
    --pager-text : var(--text, #333);
    --pager-bg: hsl(from var(--pager-text) h s l / 0.03);
    --pager-bg-hover: #fff;

    --pager-border: hsl(from var(--pager-text) h s l / 0.4);




               

    @media (prefers-color-scheme: dark){
        --pager-bg-hover: black;
    }


    text-align: center;
    margin: 3rem auto 2rem auto;

    & .tagz-pager {

        width: 100%;
        display: flex;
        flex-direction: row;
        justify-content: center;
        align-items: center;
        gap: 1rem;
        margin-top: 1rem;
        display: none;

        &.show {
            display: flex;
        }

        &.hide {
            display: none;
        }

        & a {
            text-decoration: none;
            display: inline-block;
            padding: 0.2rem 0.5rem;
            border-radius: 4px;
            cursor: default;
            user-select: none;
        }

        & a:not([href]) {
            color: hsl(from var(--pager-text) h s l / 70%);
            background-color: hsl(from var(--pager-bg) h s l / 10%);
            border: 1px solid hsl(from var(--pager-border) h s l / 70%);

        }

        & a[href] {
            color: var(--pager-text);
            background-color: var(--pager-bg);
            border: 1px solid var(--pager-border);
            cursor: pointer;

        }
        & a[href]:hover {
            background-color: var(--pager-bg-hover);
        }
    }

    & .load-more {
        width: 100%;
        display: flex;
        flex-direction: row;
        justify-content: center;
        align-items: center;

        & button[data-load-more] {
        
            width: 160px;
            padding: 8px 20px;
            border-radius: 999px;
            border:1px solid var(--pager-border);
            background-color: var(--pager-bg);
            cursor: pointer;
            transition: all 0.2s ease;
            color: var(--pager-text);
            display: inline-block;
        }

        & button[data-load-more]:hover {
            background-color: var(--pager-bg-hover);
        }


    }





}





.img-popup {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
    z-index: 5555;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;

    &.open {
        opacity: 1;
        visibility: visible;
        transition:
            opacity 0.3s ease,
            visibility 0s;
    }

    img {
        max-width: 90%;
        max-height: 90vh;
        transform: scale(0.8);
        transition: transform 0.3s ease;
    }

    &.open img {
        transform: scale(1);
    }
}