.telegram-invite {
  position: fixed;
  right: max(20px, env(safe-area-inset-right));
  bottom: max(82px, calc(env(safe-area-inset-bottom) + 82px));
  z-index: 109;
  width: min(376px, calc(100vw - 40px));
  color: #f8fbfd;
  font-family: var(--font);
  opacity: 0;
  transform: translateY(12px) scale(0.985);
  pointer-events: none;
  transition: opacity 0.34s ease, transform 0.38s cubic-bezier(0.18, 0.78, 0.24, 1);
}

.telegram-invite[hidden] {
  display: none;
}

.telegram-invite.is-visible {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: auto;
}

.telegram-invite.is-suspended {
  opacity: 0;
  transform: translateY(8px) scale(0.985);
  pointer-events: none;
}

.telegram-invite-teaser {
  position: relative;
  min-height: 88px;
  overflow: hidden;
  background:
    radial-gradient(circle at 92% 18%, rgba(42, 171, 238, 0.19), transparent 36%),
    linear-gradient(145deg, rgba(10, 20, 31, 0.985), rgba(15, 31, 45, 0.985));
  border: 1px solid rgba(74, 189, 244, 0.42);
  border-radius: 14px;
  box-shadow: 0 22px 62px rgba(3, 9, 15, 0.34);
}

.telegram-invite-teaser-cta {
  display: none;
}

.telegram-invite-teaser::before {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  width: 3px;
  background: #2aabee;
  border-radius: 14px 0 0 14px;
}

.telegram-invite-expand {
  width: 100%;
  min-height: 88px;
  padding: 13px 54px 13px 14px;
  color: inherit;
  background: transparent;
  border: 0;
  display: grid;
  grid-template-columns: 58px minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  text-align: left;
  cursor: pointer;
}

.telegram-invite-avatar-wrap {
  position: relative;
  width: 56px;
  height: 56px;
}

.telegram-invite-avatar-wrap img,
.telegram-invite-visual img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: 50% 27%;
  border-radius: 50%;
}

.telegram-invite-avatar-wrap img {
  box-shadow: 0 0 0 3px rgba(42, 171, 238, 0.15), 0 10px 22px rgba(0, 0, 0, 0.24);
}

.telegram-invite-mark {
  position: absolute;
  right: -3px;
  bottom: -1px;
  width: 22px;
  height: 22px;
  padding: 5px;
  color: #fff;
  background: #2aabee;
  border: 2px solid #102232;
  border-radius: 50%;
}

.telegram-invite-mark svg,
.telegram-invite-cta svg {
  width: 100%;
  height: 100%;
  fill: currentColor;
  display: block;
}

.telegram-invite-teaser-copy {
  min-width: 0;
  display: grid;
  gap: 3px;
}

.telegram-invite-teaser-copy small,
.telegram-invite-eyebrow {
  color: #8ed7ff;
  font-size: 9px;
  font-weight: 850;
  line-height: 1.2;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.telegram-invite-teaser-copy strong {
  color: #fff;
  font-family: var(--serif);
  font-size: 20px;
  line-height: 1.05;
}

.telegram-invite-teaser-copy > span {
  overflow: hidden;
  color: rgba(255, 255, 255, 0.64);
  font-size: 11px;
  line-height: 1.3;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.telegram-invite-chevron {
  color: #8ed7ff;
  font-size: 15px;
}

.telegram-invite-close {
  position: absolute;
  top: 13px;
  right: 13px;
  z-index: 4;
  width: 36px;
  height: 36px;
  padding: 0;
  color: rgba(255, 255, 255, 0.7);
  background: rgba(255, 255, 255, 0.065);
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 50%;
  display: grid;
  place-items: center;
  font: 400 21px/1 Arial, sans-serif;
  cursor: pointer;
}

.telegram-invite-close:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.12);
}

.telegram-invite-panel {
  display: none;
  overflow: hidden;
  color: #101820;
  background: #f8fbfd;
  border: 1px solid rgba(42, 171, 238, 0.3);
  border-radius: 16px;
  box-shadow: 0 28px 80px rgba(3, 9, 15, 0.34);
}

.telegram-invite.is-expanded .telegram-invite-teaser {
  display: none;
}

.telegram-invite.is-expanded .telegram-invite-panel {
  display: block;
  animation: telegram-invite-panel-in 0.38s cubic-bezier(0.18, 0.78, 0.24, 1) both;
}

.telegram-invite.is-expanded .telegram-invite-close {
  top: 12px;
  right: 12px;
  color: rgba(255, 255, 255, 0.76);
  background: rgba(7, 17, 27, 0.48);
}

.telegram-invite-visual {
  position: relative;
  height: 128px;
  overflow: hidden;
  background:
    linear-gradient(90deg, rgba(42, 171, 238, 0.16) 1px, transparent 1px),
    linear-gradient(rgba(42, 171, 238, 0.12) 1px, transparent 1px),
    linear-gradient(135deg, #0b1e2c, #12364d);
  background-size: 28px 28px, 28px 28px, auto;
}

.telegram-invite-visual img {
  position: absolute;
  z-index: 2;
  left: 20px;
  bottom: -34px;
  width: 98px;
  height: 98px;
  border: 4px solid #f8fbfd;
  box-shadow: 0 0 0 1px rgba(42, 171, 238, 0.3), 0 12px 28px rgba(0, 0, 0, 0.24);
}

.telegram-invite-visual svg {
  position: absolute;
  right: 18px;
  bottom: 24px;
  width: 205px;
  height: 70px;
}

.telegram-invite-visual polyline {
  fill: none;
  stroke: #65c9fb;
  stroke-width: 2;
  vector-effect: non-scaling-stroke;
}

.telegram-invite-visual circle {
  fill: #fff;
  stroke: #2aabee;
  stroke-width: 2;
}

.telegram-invite-visual text {
  fill: rgba(255, 255, 255, 0.66);
  font: 700 8px var(--font);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.telegram-invite-body {
  padding: 48px 20px 20px;
}

.telegram-invite-eyebrow {
  color: #1789c7;
  display: block;
}

.telegram-invite-body h2 {
  margin: 9px 0 8px;
  color: #101820;
  font-family: var(--serif);
  font-size: 25px;
  line-height: 1.04;
}

.telegram-invite-body p {
  margin: 0 0 17px;
  color: #52606c;
  font-size: 13px;
  line-height: 1.5;
}

.telegram-invite-cta {
  width: 100%;
  min-height: 46px;
  padding: 0 17px;
  color: #fff;
  background: linear-gradient(135deg, #2aabee, #1789c7);
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 10px;
  box-shadow: 0 12px 28px rgba(24, 137, 199, 0.25);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  font-size: 13px;
  font-weight: 800;
  line-height: 1;
  text-decoration: none;
}

.telegram-invite-cta:hover {
  color: #fff;
  background: linear-gradient(135deg, #38b8f7, #147fb8);
}

.telegram-invite-cta > span {
  width: 22px;
  height: 22px;
  padding: 5px;
  background: rgba(255, 255, 255, 0.12);
  border-radius: 50%;
}

.telegram-invite-teaser-cta > span {
  width: 22px;
  height: 22px;
  padding: 5px;
  background: rgba(255, 255, 255, 0.13);
  border-radius: 50%;
}

.telegram-invite-teaser-cta svg {
  width: 100%;
  height: 100%;
  fill: currentColor;
  display: block;
}

.telegram-invite-note {
  margin-top: 10px;
  color: #74818c;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  font-size: 10px;
  line-height: 1.35;
}

.telegram-invite-note::before {
  content: "✓";
  color: #1789c7;
  font-weight: 900;
}

.telegram-invite button:focus-visible,
.telegram-invite a:focus-visible {
  outline: 3px solid rgba(42, 171, 238, 0.62);
  outline-offset: 3px;
}

@keyframes telegram-invite-panel-in {
  from { opacity: 0; transform: translateY(8px) scale(0.985); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

@media (min-width: 1024px) {
  .telegram-invite {
    right: auto;
    left: 50%;
    bottom: max(28px, calc(env(safe-area-inset-bottom) + 28px));
    width: clamp(560px, 44vw, 620px);
    transform: translate(-50%, 14px) scale(0.985);
  }

  .telegram-invite.is-visible {
    transform: translate(-50%, 0) scale(1);
  }

  .telegram-invite.is-suspended {
    transform: translate(-50%, 8px) scale(0.985);
  }

  .telegram-invite.is-expanded {
    width: min(420px, calc(100vw - 40px));
  }

  .telegram-invite-teaser {
    min-height: 112px;
    display: grid;
    grid-template-columns: minmax(0, 1fr) 184px;
    align-items: center;
    gap: 12px;
    padding-right: 52px;
    border-radius: 16px;
  }

  .telegram-invite-teaser::before {
    border-radius: 16px 0 0 16px;
  }

  .telegram-invite-expand {
    min-width: 0;
    min-height: 110px;
    padding: 15px 0 15px 18px;
    grid-template-columns: 66px minmax(0, 1fr);
    gap: 15px;
  }

  .telegram-invite-avatar-wrap {
    width: 64px;
    height: 64px;
  }

  .telegram-invite-teaser-copy {
    gap: 4px;
  }

  .telegram-invite-teaser-copy small {
    font-size: 10px;
  }

  .telegram-invite-teaser-copy strong {
    font-size: 23px;
  }

  .telegram-invite-teaser-copy > span {
    font-size: 12px;
  }

  .telegram-invite-chevron {
    display: none;
  }

  .telegram-invite-teaser-cta {
    min-height: 46px;
    padding: 0 14px;
    color: #fff;
    background: linear-gradient(135deg, #2aabee, #1789c7);
    border: 1px solid rgba(255, 255, 255, 0.18);
    border-radius: 10px;
    box-shadow: 0 12px 28px rgba(24, 137, 199, 0.25);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-size: 12px;
    font-weight: 800;
    line-height: 1;
    text-decoration: none;
    white-space: nowrap;
  }

  .telegram-invite-teaser-cta:hover {
    color: #fff;
    background: linear-gradient(135deg, #38b8f7, #147fb8);
  }

  .telegram-invite-close {
    top: 10px;
    right: 10px;
    width: 38px;
    height: 38px;
  }

}

@media (max-width: 600px) {
  .telegram-invite {
    right: max(12px, env(safe-area-inset-right));
    bottom: max(70px, calc(env(safe-area-inset-bottom) + 70px));
    width: calc(100vw - 24px);
  }

  .telegram-invite-expand {
    padding-right: 58px;
  }

  .telegram-invite-close {
    top: 11px;
    right: 11px;
    width: 44px;
    height: 44px;
  }

  .telegram-invite-panel {
    max-height: calc(100dvh - 150px - env(safe-area-inset-bottom));
    overflow-y: auto;
  }

  .telegram-invite-visual {
    height: 120px;
  }

  .telegram-invite-visual svg {
    right: 12px;
    width: 190px;
  }

  .telegram-invite-body {
    padding: 46px 18px 18px;
  }

  .telegram-invite-body h2 {
    font-size: 23px;
  }
}

@media (min-width: 1024px) and (max-width: 1199px) {
  .telegram-invite-teaser {
    grid-template-columns: minmax(0, 1fr) 176px;
  }

  .telegram-invite-teaser-copy strong {
    font-size: 20px;
  }

  .telegram-invite-teaser-cta {
    padding-left: 10px;
    padding-right: 10px;
    font-size: 11px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .telegram-invite,
  .telegram-invite.is-expanded .telegram-invite-panel {
    animation: none;
    transition: none;
  }
}
