.zibfw-root {
    position: relative;
    z-index: 99995;
}

.zibfw-item {
    position: fixed;
    z-index: var(--zibfw-z, 99995);
    width: max-content;
    max-width: 140px;
    pointer-events: auto;
    transition: opacity 0.25s ease, transform 0.25s ease, bottom 0.25s ease;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.zibfw-item--right {
    right: var(--zibfw-side, 20px);
    left: auto;
}

.zibfw-item--left {
    left: var(--zibfw-side, 20px);
    right: auto;
}

.zibfw-item--align-float.zibfw-item--right {
    right: 20px;
}

.zibfw-item__badge {
    display: inline-block;
    max-width: 120px;
    margin-bottom: 6px;
    padding: 3px 10px;
    border-radius: 999px;
    font-size: 11px;
    line-height: 1.3;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    color: var(--main-color, #4e5358);
    background: var(--main-bg-color, #fff);
    border: 1px solid var(--main-border-color, rgba(50, 50, 50, 0.06));
    box-shadow: 0 4px 14px var(--main-shadow, rgba(116, 116, 116, 0.12));
}

.zibfw-item--popup,
.zibfw-item--popup .zibfw-item__trigger,
.zibfw-item--popup .zibfw-item__ring,
.zibfw-item--popup .zibfw-item__img,
.zibfw-item--popup .zibfw-item__badge {
    pointer-events: auto;
    cursor: pointer;
}

.zibfw-item__trigger {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-decoration: none;
    color: inherit;
    border: 0;
    background: transparent;
    padding: 0;
    margin: 0;
    cursor: pointer;
    width: 100%;
    pointer-events: auto;
    position: relative;
    z-index: 1;
    font: inherit;
    -webkit-appearance: none;
    appearance: none;
}

.zibfw-item__trigger:focus {
    outline: none;
}

.zibfw-item__trigger .zibfw-item__ring,
.zibfw-item__trigger .zibfw-item__badge {
    cursor: pointer;
}

.zibfw-item__ring {
    width: var(--zibfw-size, 52px);
    height: var(--zibfw-size, 52px);
    max-width: var(--zibfw-size, 52px);
    max-height: var(--zibfw-size, 52px);
    border-radius: 50%;
    overflow: hidden;
    flex-shrink: 0;
    box-sizing: border-box;
}

.zibfw-style-zibll .zibfw-item__ring {
    padding: 2px;
    background: linear-gradient(135deg, var(--theme-color, #f04494), rgba(255, 255, 255, 0.95) 55%, var(--theme-color, #f04494));
    box-shadow: 0 4px 12px rgba(240, 68, 148, 0.16);
}

.zibfw-style-zibll .zibfw-item__img,
.zibfw-style-zibll .zibfw-item__link {
    border: 2px solid var(--main-bg-color, #fff);
}

.zibfw-style-simple .zibfw-item__ring,
.zibfw-style-minimal .zibfw-item__ring {
    padding: 0;
}

.zibfw-item__link {
    display: block;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    overflow: hidden;
}

.zibfw-item__img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
    user-select: none;
    -webkit-user-drag: none;
    background: var(--muted-bg-color, #eee);
}

.zibfw-item--border .zibfw-item__img,
.zibfw-item--border .zibfw-item__link {
    box-sizing: border-box;
    border: 2px solid rgba(255, 255, 255, 0.92);
}

.zibfw-item--shadow.zibfw-style-simple .zibfw-item__ring,
.zibfw-item--shadow.zibfw-style-minimal .zibfw-item__ring {
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.16);
}

.zibfw-item--scroll-hide.is-hidden {
    opacity: 0;
    transform: translateY(12px);
    pointer-events: none;
}

.zibfw-anim-bob .zibfw-item__ring {
    animation: zibfw-bob 3s ease-in-out infinite;
}

.zibfw-anim-pulse .zibfw-item__ring {
    animation: zibfw-pulse 2.4s ease-in-out infinite;
}

.zibfw-anim-glow .zibfw-item__ring {
    animation: zibfw-glow 2.8s ease-in-out infinite;
}

.zibfw-anim-glow .zibfw-item__ring,
.zibfw-style-zibll.zibfw-anim-glow .zibfw-item__ring {
    will-change: box-shadow;
}

@keyframes zibfw-bob {
    0%,
    100% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(-5px);
    }
}

@keyframes zibfw-pulse {
    0%,
    100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.05);
    }
}

@keyframes zibfw-glow {
    0%,
    100% {
        box-shadow: 0 4px 12px rgba(240, 68, 148, 0.14);
    }
    50% {
        box-shadow: 0 5px 14px rgba(240, 68, 148, 0.24);
    }
}

body:has(.modal.in) .zibfw-root[data-hide-modal="1"] .zibfw-item,
body.modal-open:has(.modal.in) .zibfw-root[data-hide-modal="1"] .zibfw-item {
    opacity: 0;
    pointer-events: none;
}

.zibfw-native-modal {
    position: fixed;
    inset: 0;
    z-index: 10000050;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s ease, visibility 0.2s ease;
}

.zibfw-native-modal.is-open {
    opacity: 1;
    visibility: visible;
}

.zibfw-native-modal__mask {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
}

.zibfw-native-modal__panel {
    position: relative;
    z-index: 1;
    width: min(92vw, 360px);
    max-height: 80vh;
    overflow: auto;
    background: var(--main-bg-color, #fff);
    color: var(--main-color, #333);
    border-radius: var(--main-radius, 8px);
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.25);
    padding: 16px;
}

.zibfw-native-modal__close {
    position: absolute;
    top: 8px;
    right: 10px;
    border: 0;
    background: transparent;
    font-size: 24px;
    line-height: 1;
    cursor: pointer;
    color: var(--muted-color, #777);
    z-index: 2;
}

.zibfw-native-modal__body {
    line-height: 1.6;
}

.zibfw-native-modal__body img {
    max-width: 100%;
    height: auto;
    display: block;
    margin: 0 auto;
}

body.zibfw-native-open {
    overflow: hidden;
}

.zibfw-source-modal {
    display: none !important;
    visibility: hidden !important;
    pointer-events: none !important;
}

.zibfw-popup-wrap {
    position: relative;
    padding-top: 2px;
}

.zibfw-modal-close {
    position: absolute;
    top: 0;
    right: 0;
    z-index: 5;
    width: 32px;
    height: 32px;
    border: 0;
    border-radius: 50%;
    background: var(--muted-bg-color, rgba(0, 0, 0, 0.05));
    color: var(--muted-color, #777);
    font-size: 22px;
    line-height: 1;
    cursor: pointer;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.zibfw-modal-close:hover {
    color: var(--main-color, #333);
    background: var(--muted-bg-color, #eee);
}

#refresh_modal.zibfw-refresh-modal .modal-body {
    position: relative;
}

.zibfw-modal-body {
    line-height: 1.6;
}

.zibfw-modal-body img {
    max-width: 100%;
    height: auto;
    display: block;
    margin: 0 auto;
}

.zibfw-modal-body a {
    word-break: break-word;
}

@media (max-width: 767px) {
    .zibfw-item {
        touch-action: manipulation;
    }

    .zibfw-item__ring {
        width: min(var(--zibfw-size, 52px), 52px) !important;
        height: min(var(--zibfw-size, 52px), 52px) !important;
        max-width: 52px !important;
        max-height: 52px !important;
    }

    .zibfw-item__badge {
        font-size: 10px;
        max-width: 88px;
        margin-bottom: 4px;
        padding: 2px 8px;
    }
}

.dark-theme .zibfw-item__badge {
    background: var(--main-bg-color, #313135);
    color: var(--main-color, #e5eef7);
}
