.telegram-widget {
    --telegram-widget-bottom: max(16px, calc(env(safe-area-inset-bottom, 0px) + 10px));
    --telegram-blue: #2aabee;
    position: fixed;
    right: clamp(14px, 2.5vw, 32px);
    bottom: var(--telegram-widget-bottom);
    z-index: 1400;
    width: min(390px, calc(100vw - 28px));
    pointer-events: none;
}

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

.telegram-widget__notice {
    position: relative;
    transition: transform 180ms ease, opacity 180ms ease, visibility 180ms ease;
    animation: telegram-widget-enter 420ms cubic-bezier(0.22, 1, 0.36, 1);
}

.telegram-widget__notice:hover {
    transform: translateY(-2px);
}

.telegram-widget__panel {
    position: relative;
    display: grid;
    grid-template-columns: 34px minmax(0, 1fr) auto;
    align-items: center;
    gap: 11px;
    min-height: 56px;
    padding: 9px 50px 9px 10px;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 15px;
    background: rgba(10, 10, 10, 0.92);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    color: #f3f3f3;
    text-decoration: none;
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    transition: border-color 180ms ease, background-color 180ms ease;
}

.telegram-widget__panel::before {
    content: "";
    position: absolute;
    top: 12px;
    bottom: 12px;
    left: 0;
    width: 2px;
    border-radius: 0 2px 2px 0;
    background: var(--telegram-blue);
}

.telegram-widget__notice:hover .telegram-widget__panel {
    border-color: rgba(255, 255, 255, 0.18);
    background: rgba(15, 15, 15, 0.96);
}

.telegram-widget__icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    border: 1px solid rgba(42, 171, 238, 0.18);
    border-radius: 10px;
    background: rgba(42, 171, 238, 0.08);
}

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

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

.telegram-widget__eyebrow {
    font-family: var(--font-display, sans-serif);
    font-size: 0.55rem;
    line-height: 1.2;
    letter-spacing: 0.13em;
    text-transform: uppercase;
    color: rgba(255, 255, 255, 0.5);
}

.telegram-widget__title {
    overflow: hidden;
    color: #f4f4f4;
    font-size: 0.82rem;
    line-height: 1.25;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.telegram-widget__cta {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    color: rgba(255, 255, 255, 0.62);
    font-family: var(--font-display, sans-serif);
    font-size: 0.56rem;
    line-height: 1;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    transition: color 180ms ease;
}

.telegram-widget__cta svg {
    width: 13px;
    height: 13px;
    transition: transform 180ms ease;
}

.telegram-widget__notice:hover .telegram-widget__cta {
    color: #ffffff;
}

.telegram-widget__notice:hover .telegram-widget__cta svg {
    transform: translateX(2px);
}

.telegram-widget__close {
    position: absolute;
    top: 50%;
    right: 10px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    margin: 0;
    padding: 0;
    border: 0;
    border-radius: 8px;
    background: transparent;
    color: rgba(255, 255, 255, 0.44);
    cursor: pointer;
    transform: translateY(-50%);
    transition: color 180ms ease, background-color 180ms ease;
}

.telegram-widget__close:hover {
    color: #ffffff;
    background: rgba(255, 255, 255, 0.07);
}

.telegram-widget__close svg {
    width: 12px;
    height: 12px;
    display: block;
}

.telegram-widget__bubble {
    position: absolute;
    right: 0;
    bottom: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    width: 76px;
    height: 42px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    background: rgba(10, 10, 10, 0.9);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.26);
    color: rgba(255, 255, 255, 0.68);
    font-family: var(--font-display, sans-serif);
    font-size: 0.52rem;
    line-height: 1;
    letter-spacing: 0.08em;
    text-decoration: none;
    text-transform: uppercase;
    opacity: 0;
    visibility: hidden;
    transform: translateY(8px) scale(0.96);
    transition: opacity 180ms ease, visibility 180ms ease, transform 180ms ease,
        border-color 180ms ease, background-color 180ms ease, color 180ms ease;
}

.telegram-widget__bubble-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    border-radius: 7px;
    background: rgba(42, 171, 238, 0.12);
}

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

.telegram-widget__bubble:hover {
    transform: translateY(-2px);
    border-color: rgba(42, 171, 238, 0.3);
    background: rgba(15, 15, 15, 0.96);
    color: #ffffff;
}

.telegram-widget__panel:focus-visible,
.telegram-widget__bubble:focus-visible,
.telegram-widget__close:focus-visible {
    outline: 2px solid var(--telegram-blue);
    outline-offset: 3px;
}

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

.telegram-widget[data-state="collapsed"] .telegram-widget__notice {
    opacity: 0;
    visibility: hidden;
    transform: translateY(8px) scale(0.98);
}

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

@keyframes telegram-widget-enter {
    from {
        opacity: 0;
        transform: translateY(12px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@media (max-width: 520px) {
    .telegram-widget {
        right: 10px;
        width: calc(100vw - 20px);
        --telegram-widget-bottom: max(10px, calc(env(safe-area-inset-bottom, 0px) + 8px));
    }

    .telegram-widget__panel {
        grid-template-columns: 32px minmax(0, 1fr);
        gap: 9px;
        min-height: 52px;
        padding: 8px 44px 8px 9px;
        border-radius: 13px;
    }

    .telegram-widget__icon {
        width: 32px;
        height: 32px;
        border-radius: 9px;
    }

    .telegram-widget__title {
        font-size: 0.76rem;
    }

    .telegram-widget__cta {
        display: none;
    }

    .telegram-widget__close {
        right: 8px;
    }

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

    .telegram-widget__bubble {
        width: 72px;
        height: 40px;
        border-radius: 11px;
    }
}

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