.promo-popup {
  position: fixed;
  right: 16px;
  bottom: 16px;
  z-index: 210;
  width: min(320px, calc(100% - 32px));
  border: 1px solid rgba(45, 73, 94, 0.12);
  border-radius: var(--radius-card);
  background: var(--color-white);
  box-shadow: 0 12px 30px rgba(45, 73, 94, 0.14);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  animation: promoPopupIn 0.28s ease-out both;
}

.promo-popup.is-hidden {
  display: none;
}

@keyframes promoPopupIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }

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

.promo-popup__media {
  width: 100%;
  aspect-ratio: 4 / 3;
  flex-shrink: 0;
  overflow: hidden;
  background: #f2efec;
}

.promo-popup__media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.promo-popup__media--placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  font-size: 0.875rem;
  font-weight: 600;
  line-height: 1.2;
  text-align: center;
  color: var(--color-accent);
}

.promo-popup__body {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 14px 16px 16px;
}

.promo-popup__title {
  margin: 0;
  font-size: clamp(1rem, 1.3vw, 1.125rem);
  line-height: 1.25;
  font-weight: 700;
  color: var(--color-text);
}

.promo-popup__text {
  margin: 0;
  font-size: clamp(0.8125rem, 1vw, 0.875rem);
  line-height: 1.4;
  color: rgba(45, 73, 94, 0.75);
}

.promo-popup__button {
  align-self: flex-start;
  margin-top: 4px;
  min-height: 40px;
  padding: 0 20px;
  font-size: 0.875rem;
}

.promo-popup__close {
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 2;
  width: 32px;
  height: 32px;
  border: 1px solid rgba(45, 73, 94, 0.12);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.92);
  color: var(--color-text);
  font: inherit;
  font-size: 20px;
  font-weight: 700;
  line-height: 1;
  padding: 0;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background-color 0.2s ease;
}

.promo-popup__close:hover {
  background: var(--color-white);
}

.promo-popup__menu-wrap {
  position: absolute;
  top: 10px;
  left: 10px;
  z-index: 2;
}

.promo-popup__menu-toggle {
  width: 28px;
  height: 28px;
  border: none;
  border-radius: 0;
  background: transparent;
  padding: 0;
  cursor: pointer;
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  opacity: 0.6;
  transition: opacity 0.2s ease;
}

.promo-popup__menu-toggle:hover {
  opacity: 1;
}

.promo-popup__menu-toggle:focus-visible {
  outline: 2px solid rgba(255, 255, 255, 0.8);
  outline-offset: 2px;
}

.promo-popup__dot {
  display: block;
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: #fff;
}

.promo-popup__menu {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  min-width: 220px;
  padding: 6px;
  border: 1px solid rgba(45, 73, 94, 0.12);
  border-radius: 12px;
  background: var(--color-white);
  box-shadow: 0 8px 24px rgba(45, 73, 94, 0.14);
}

.promo-popup__menu[hidden] {
  display: none;
}

.promo-popup__menu-item {
  display: block;
  width: 100%;
  margin: 0;
  padding: 10px 12px;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: var(--color-text);
  font: inherit;
  font-size: 0.8125rem;
  line-height: 1.35;
  text-align: left;
  cursor: pointer;
  transition: background-color 0.15s ease;
}

.promo-popup__menu-item:hover {
  background: #f2efec;
}

.promo-popup__menu-item:focus-visible {
  outline: 2px solid var(--color-text);
  outline-offset: -2px;
}

@media (max-width: 640px) {
  .promo-popup {
    top: auto;
    right: max(16px, env(safe-area-inset-right, 0px));
    bottom: 0;
    left: max(16px, env(safe-area-inset-left, 0px));
    width: auto;
    max-width: none;
    height: 33.333dvh;
    max-height: 33.333dvh;
    border: 0;
    border-top: 1px solid rgba(45, 73, 94, 0.12);
    border-radius: 16px 16px 0 0;
    box-shadow: 0 -8px 24px rgba(45, 73, 94, 0.12);
    overflow: hidden;
    flex-direction: row;
    animation: promoPopupInMobile 0.28s ease-out both;
  }

  .promo-popup__media {
    flex: 0 0 38%;
    width: 38%;
    height: 100%;
    aspect-ratio: auto;
    min-height: 0;
  }

  .promo-popup__body {
    flex: 1 1 auto;
    min-width: 0;
    justify-content: center;
    gap: 6px;
    padding: 12px 14px calc(12px + env(safe-area-inset-bottom, 0px));
  }

  .promo-popup__title {
    font-size: 0.9375rem;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
  }

  .promo-popup__text {
    font-size: 0.75rem;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
  }

  .promo-popup__button {
    width: auto;
    align-self: flex-start;
    min-height: 36px;
    margin-top: 2px;
    padding: 0 16px;
    font-size: 0.8125rem;
  }

  .promo-popup__close {
    top: 8px;
    right: 8px;
    width: 32px;
    height: 32px;
  }

  .promo-popup__menu-wrap {
    top: 8px;
    left: 8px;
  }
}

@keyframes promoPopupInMobile {
  from {
    opacity: 0;
    transform: translateY(100%);
  }

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