.telegram-reactions {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

.reaction-btn {
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    cursor: pointer;
    user-select: none;
    position: relative;
    overflow: visible;
}

.reaction-btn:hover {
    transform: translateY(-1px);
}

.reaction-btn:active {
    transform: scale(0.95);
}

.reaction-btn.active {
    animation: reactionSelect 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes reactionSelect {
    0% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.15);
    }
    100% {
        transform: scale(1);
    }
}

/* Компактный дизайн */
.reaction-btn.compact {
    padding: 4px 8px;
    border-radius: 16px;
    border: 1px solid #e5e7eb;
    background: white;
    min-width: auto;
    position: relative;
    z-index: 10;
}

.reaction-btn.compact:hover {
    border-color: #d1d5db;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
}

.reaction-btn.compact.active {
    background: linear-gradient(135deg, #eff6ff, #dbeafe);
    border-color: #3b82f6;
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.25);
}

.reaction-icon {
    font-size: 16px;
    line-height: 1;
    transition: all 0.2s ease;
    display: block;
}

.reaction-count {
    font-size: 11px;
    font-weight: 600;
    min-width: 8px;
    text-align: center;
    transition: all 0.3s ease;
    font-feature-settings: "tnum";
}

/* Контейнер для анимации */
.reaction-animation-container {
    position: absolute;
    top: -30px;
    left: -30px;
    right: -30px;
    bottom: -30px;
    pointer-events: none;
    z-index: 1000;
}

/* Анимация разлетающихся частиц */
.flying-particle {
    position: absolute;
    font-size: 20px;
    animation: flyParticle 1.4s cubic-bezier(0.4, 0, 0.2, 1) forwards;
    opacity: 0;
    z-index: 1000;
    filter: drop-shadow(0 2px 3px rgba(0, 0, 0, 0.2));
}

@keyframes flyParticle {
    0% {
        transform: 
            translate(0, 0) 
            scale(0.8) 
            rotate(0deg);
        opacity: 0;
    }
    15% {
        opacity: 1;
        transform: 
            translate(0, -8px) 
            scale(1.3) 
            rotate(0deg);
    }
    40% {
        opacity: 1;
        transform: 
            translate(var(--tx-1), var(--ty-1)) 
            scale(1.2) 
            rotate(var(--r-1));
    }
    70% {
        opacity: 0.7;
        transform: 
            translate(var(--tx-2), var(--ty-2)) 
            scale(1) 
            rotate(var(--r-2));
    }
    100% {
        opacity: 0;
        transform: 
            translate(var(--tx-3), var(--ty-3)) 
            scale(0.7) 
            rotate(var(--r-3));
    }
}

/* Анимация счетчика */
.count-pop {
    animation: countPop 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes countPop {
    0% {
        transform: scale(1);
    }
    30% {
        transform: scale(1.4);
    }
    60% {
        transform: scale(0.9);
    }
    80% {
        transform: scale(1.1);
    }
    100% {
        transform: scale(1);
    }
}

/* Эффект свечения для активной реакции */
.reaction-btn.compact.active .reaction-icon {
    animation: iconGlow 0.6s ease-out;
}

@keyframes iconGlow {
    0% {
        filter: drop-shadow(0 0 0px rgba(59, 130, 246, 0.6));
    }
    50% {
        filter: drop-shadow(0 0 6px rgba(59, 130, 246, 0.8));
    }
    100% {
        filter: drop-shadow(0 0 0px rgba(59, 130, 246, 0.6));
    }
}

/* Адаптивность */
@media (max-width: 640px) {
    .reactions-grid {
        gap: 4px;
    }
    
    .reaction-btn.compact {
        padding: 3px 6px;
    }
    
    .reaction-icon {
        font-size: 14px;
    }
    
    .reaction-count {
        font-size: 10px;
    }
    
    .flying-particle {
        font-size: 18px;
    }
}

/* Улучшенная анимация для контейнера */
.telegram-reactions {
    position: relative;
}

.reactions-grid {
    position: relative;
    display: inline-flex;
    flex-wrap: wrap;
    gap: 6px;
}