.telegram-widget {
    --telegram-widget-bottom: max(18px, env(safe-area-inset-bottom, 0px) + 12px);
    position: fixed;
    left: 50%;
    bottom: var(--telegram-widget-bottom);
    z-index: 1400;
    width: min(680px, calc(100vw - 28px));
    transform: translateX(-50%);
    pointer-events: none;
}

.telegram-widget__panel,
.telegram-widget__bubble,
.telegram-widget__close {
    pointer-events: auto;
}

.telegram-widget__panel {
    position: relative;
    display: grid;
    grid-template-columns: auto 1fr auto;
    align-items: center;
    gap: 14px;
    min-height: 68px;
    padding: 14px 72px 14px 16px;
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 999px;
    background:
        linear-gradient(135deg, rgba(255, 255, 255, 0.11), rgba(255, 255, 255, 0.04)),
        rgba(10, 10, 10, 0.88);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.42);
    color: #f4f4f4;
    text-decoration: none;
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    transition:
        transform 0.28s ease,
        border-color 0.28s ease,
        box-shadow 0.28s ease,
        opacity 0.24s ease;
    animation: telegram-widget-rise 0.6s cubic-bezier(0.22, 1, 0.36, 1);
}

.telegram-widget__panel:hover {
    transform: translateY(-2px);
    border-color: rgba(255, 255, 255, 0.2);
    box-shadow: 0 24px 70px rgba(0, 0, 0, 0.5);
}

.telegram-widget__icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 42px;
    height: 42px;
    border-radius: 50%;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.18), rgba(255, 255, 255, 0.05));
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.12);
}

.telegram-widget__icon img,
.telegram-widget__bubble img {
    width: 22px;
    height: 22px;
    object-fit: contain;
    display: block;
}

.telegram-widget__copy {
    display: grid;
    gap: 2px;
    min-width: 0;
}

.telegram-widget__eyebrow {
    font-size: 0.68rem;
    line-height: 1;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: rgba(255, 255, 255, 0.56);
}

.telegram-widget__title {
    font-size: 0.96rem;
    line-height: 1.25;
    color: #ffffff;
}

.telegram-widget__cta {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 102px;
    padding: 10px 16px;
    border-radius: 999px;
    background: linear-gradient(135deg, #f0f0f0, #bababa);
    color: #0b0b0b;
    font-size: 0.8rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.telegram-widget__close {
    position: absolute;
    top: 50%;
    right: 14px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    margin: 0;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.08);
    color: rgba(255, 255, 255, 0.86);
    cursor: pointer;
    transform: translateY(-50%);
    transition: background 0.2s ease, transform 0.2s ease;
}

.telegram-widget__close:hover {
    background: rgba(255, 255, 255, 0.14);
    transform: translateY(-50%) scale(1.05);
}

.telegram-widget__close span {
    font-size: 1.15rem;
    line-height: 1;
}

.telegram-widget__bubble {
    position: absolute;
    right: 0;
    bottom: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 58px;
    height: 58px;
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 50%;
    background:
        linear-gradient(135deg, rgba(255, 255, 255, 0.12), rgba(255, 255, 255, 0.04)),
        rgba(10, 10, 10, 0.92);
    box-shadow: 0 18px 40px rgba(0, 0, 0, 0.42);
    opacity: 0;
    visibility: hidden;
    transform: translateY(14px) scale(0.88);
    transition:
        opacity 0.24s ease,
        transform 0.24s ease,
        visibility 0.24s ease,
        border-color 0.24s ease;
}

.telegram-widget__bubble:hover {
    border-color: rgba(255, 255, 255, 0.22);
    transform: translateY(10px) scale(0.93);
}

.telegram-widget[data-state="collapsed"] {
    left: auto;
    right: 18px;
    width: 58px;
    transform: none;
}

.telegram-widget[data-state="collapsed"] .telegram-widget__panel,
.telegram-widget[data-state="collapsed"] .telegram-widget__close {
    opacity: 0;
    visibility: hidden;
    transform: translateY(18px) scale(0.94);
}

.telegram-widget[data-state="collapsed"] .telegram-widget__bubble {
    opacity: 1;
    visibility: visible;
    transform: translateY(0) scale(1);
}

@keyframes telegram-widget-rise {
    0% {
        opacity: 0;
        transform: translateY(18px);
    }
    100% {
        opacity: 1;
        transform: translateY(0);
    }
}

@media (max-width: 720px) {
    .telegram-widget {
        width: min(560px, calc(100vw - 18px));
        --telegram-widget-bottom: max(14px, env(safe-area-inset-bottom, 0px) + 8px);
    }

    .telegram-widget__panel {
        grid-template-columns: auto 1fr;
        gap: 12px;
        padding: 14px 52px 14px 14px;
    }

    .telegram-widget__cta {
        display: none;
    }

    .telegram-widget__title {
        font-size: 0.88rem;
        max-width: 28ch;
    }

    .telegram-widget__close {
        right: 10px;
        width: 30px;
        height: 30px;
    }
}

@media (max-width: 480px) {
    .telegram-widget {
        width: calc(100vw - 14px);
    }

    .telegram-widget__panel {
        min-height: 62px;
        padding: 12px 46px 12px 12px;
    }

    .telegram-widget__icon {
        width: 38px;
        height: 38px;
    }

    .telegram-widget__icon img {
        width: 20px;
        height: 20px;
    }

    .telegram-widget__eyebrow {
        font-size: 0.62rem;
    }

    .telegram-widget__title {
        font-size: 0.82rem;
        line-height: 1.22;
        max-width: 24ch;
    }

    .telegram-widget[data-state="collapsed"] {
        right: 12px;
    }

    .telegram-widget__bubble {
        width: 54px;
        height: 54px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .telegram-widget__panel,
    .telegram-widget__bubble,
    .telegram-widget__close {
        animation: none;
        transition: none;
    }
}
