/* Реферальная плашка: показывается один раз после перехода по ссылке друга.
   Живёт над контентом, но не перекрывает действия — прижата к низу и уходит
   в поток на узких экранах. Вынесена из styles.css, потому что нужна и на
   /create, где подключён только creator.css. */
.referral-notice {
  position: fixed;
  z-index: 60;
  right: clamp(12px, 3vw, 24px);
  bottom: calc(clamp(12px, 3vw, 24px) + env(safe-area-inset-bottom, 0px));
  left: clamp(12px, 3vw, 24px);
  display: grid;
  max-width: 560px;
  align-items: center;
  gap: 4px 14px;
  grid-template-columns: auto minmax(0, 1fr) auto auto;
  border: 1px solid var(--line-strong);
  border-radius: 16px;
  padding: 14px 16px;
  color: var(--ink);
  background: var(--panel-strong);
  box-shadow: 0 18px 44px rgba(0, 0, 0, 0.34);
  opacity: 0;
  transform: translateY(14px);
  transition: opacity 260ms cubic-bezier(0.16, 1, 0.3, 1),
    transform 260ms cubic-bezier(0.16, 1, 0.3, 1);
}

@media (min-width: 620px) {
  .referral-notice {
    left: auto;
  }
}

.referral-notice.is-visible {
  opacity: 1;
  transform: translateY(0);
}

/* На тарифах кнопки нет — колонку под неё тоже убираем, иначе справа
   остаётся пустой отступ шириной в gap. */
.referral-notice.is-compact {
  grid-template-columns: auto minmax(0, 1fr) auto;
}

.referral-notice-mark {
  display: grid;
  width: 38px;
  height: 38px;
  place-items: center;
  border-radius: 12px;
  color: #d8ebff;
  background: rgba(24, 116, 217, 0.22);
}

.referral-notice-mark svg {
  width: 21px;
  height: 21px;
}

html[data-theme="light"] .referral-notice-mark {
  color: var(--blue-strong);
  background: rgba(24, 116, 217, 0.12);
}

.referral-notice-body strong {
  display: block;
  color: var(--ink);
  font-size: 14px;
  font-weight: 800;
  line-height: 1.3;
}

.referral-notice-body p {
  margin: 3px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.referral-notice-action {
  display: inline-flex;
  min-height: 40px;
  align-items: center;
  border: 0;
  border-radius: 12px;
  padding: 0 14px;
  color: #fff;
  background: linear-gradient(180deg, #2688ed, #1268c7);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.22),
    0 8px 20px rgba(24, 116, 217, 0.28);
  cursor: pointer;
  font-family: inherit;
  font-size: 13px;
  font-weight: 800;
  text-decoration: none;
  white-space: nowrap;
  transition: filter 160ms ease, transform 160ms ease;
}

.referral-notice-action:hover {
  filter: brightness(1.08);
  transform: translateY(-1px);
}

.referral-notice-close {
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border: 1px solid transparent;
  border-radius: 10px;
  color: var(--soft);
  background: transparent;
  cursor: pointer;
  transition: color 140ms ease, border-color 140ms ease, background 140ms ease;
}

.referral-notice-close:hover {
  border-color: var(--line);
  color: var(--ink);
  background: rgba(120, 160, 220, 0.12);
}

.referral-notice-close svg {
  width: 16px;
  height: 16px;
}

.referral-notice-action:focus-visible,
.referral-notice-close:focus-visible {
  outline: 2px solid var(--cyan);
  outline-offset: 2px;
}

@media (max-width: 560px) {
  .referral-notice {
    grid-template-columns: auto minmax(0, 1fr) auto;
    gap: 12px;
  }

  /* Порядок в разметке — метка, текст, действие, закрытие; на узком экране
     закрытие остаётся в первой строке, а кнопка занимает всю ширину. */
  .referral-notice-mark {
    align-self: start;
    grid-area: 1 / 1 / 2 / 2;
  }

  .referral-notice-body {
    grid-area: 1 / 2 / 2 / 3;
  }

  .referral-notice-close {
    grid-area: 1 / 3 / 2 / 4;
    align-self: start;
  }

  .referral-notice-action {
    justify-content: center;
    grid-area: 2 / 1 / 3 / 4;
  }
}

@media (prefers-reduced-motion: reduce) {
  .referral-notice {
    transition-duration: 1ms;
  }

  .referral-notice-action:hover {
    transform: none;
  }
}
