:root {
    --sb-size: 56px;
    --sb-icon-size: 30px;
    --sb-bg-default: var(--color-bg-fixedbtn, #e7d9f5);
    --sb-fg-default: var(--color-fixedbtn, #a86fc9);
    --sb-gap: 12px;
    --sb-bottom: 80px;
    --sb-right: 16px;
}

.social-bubble {
    position: fixed;
    right: var(--sb-right);
    bottom: var(--sb-bottom);
    z-index: 998;
    display: flex;
    flex-direction: column;
    align-items: center;
    pointer-events: none;
}

.social-bubble__list {
    list-style: none;
    margin: 0 0 var(--sb-gap) 0;
    padding: 0;
    display: flex;
    flex-direction: column-reverse;
    gap: var(--sb-gap);
    pointer-events: none;
}

.social-bubble__item {
    opacity: 0;
    transform: translateY(20px) scale(0.5);
    transition: opacity 0.3s ease, transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    transition-delay: calc(var(--sb-delay, 0) * 60ms);
    pointer-events: none;
}

.social-bubble.is-open .social-bubble__item {
    opacity: 1;
    transform: translateY(0) scale(1);
    pointer-events: auto;
    transition-delay: calc(var(--sb-delay, 0) * 80ms);
}

.social-bubble__link,
.social-bubble__trigger {
    width: var(--sb-size);
    height: var(--sb-size);
    border-radius: 50%;
    background: var(--sb-bg, var(--sb-bg-default));
    color: var(--sb-fg-default);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    border: none;
    cursor: pointer;
    padding: 0;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.social-bubble__link:hover,
.social-bubble__trigger:hover {
    transform: scale(1.08);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.22);
}

.social-bubble__link img {
    width: var(--sb-icon-size);
    height: var(--sb-icon-size);
    object-fit: contain;
    display: block;
}

.social-bubble__trigger {
    pointer-events: auto;
    position: relative;
    animation: sb-idle-rotate 4s ease-in-out infinite, sb-idle-pulse 2s ease-in-out infinite;
}

.social-bubble.is-open .social-bubble__trigger {
    animation: none;
}

.social-bubble__icon {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: opacity 0.2s ease, transform 0.3s ease;
}

.social-bubble__icon svg,
.social-bubble__icon img {
    width: 28px;
    height: 28px;
    object-fit: contain;
}

.social-bubble__icon--close {
    opacity: 0;
    transform: rotate(-90deg) scale(0.5);
}

.social-bubble.is-open .social-bubble__icon--open {
    opacity: 0;
    transform: rotate(90deg) scale(0.5);
}

.social-bubble.is-open .social-bubble__icon--close {
    opacity: 1;
    transform: rotate(0) scale(1);
}

@keyframes sb-idle-rotate {
    0%, 100% { transform: rotate(0deg); }
    25% { transform: rotate(-8deg); }
    75% { transform: rotate(8deg); }
}

@keyframes sb-idle-pulse {
    0%, 100% {
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15),
                    0 0 0 0 rgba(168, 111, 201, 0.45);
    }
    50% {
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15),
                    0 0 0 14px rgba(168, 111, 201, 0);
    }
}

@media (max-width: 767px) {
    :root {
        --sb-size: 48px;
        --sb-icon-size: 25px;
    }
    .social-bubble {
        --sb-bottom: 80px;
    }
    .social-bubble__icon svg {
        width: 24px;
        height: 24px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .social-bubble__trigger { animation: none; }
    .social-bubble__item { transition: opacity 0.2s linear; }
}
