/* ALT-SUBGATE (29.11.2026): экран «подпишись на канал и чат».
   ALT-SUBGATE-ART (30.11.2026): вид переделан по макету владельца
   («Неоновые стикеры_ аниме-зайка и UI-иконки»): зайка выглядывает из-за карточки,
   подарок с зайцем-черепом в правом верхнем углу, стеклянные строки с неоновой
   рамкой, розовые «Подписаться», большая капсула «Я подписался — проверить»,
   внизу подпись со щитом. Арт — нарезка листа ICON/*.png в assets/subgate/*.webp.
   z-index выше всех: перекрывает шапку, меню и оверлеи игр. */
#alt-subgate {
  position: fixed;
  inset: 0;
  z-index: 2147483400;   /* выше экрана «открыто как сайт» (build-check, 2147483000) */
  display: none;
}

/* показ — классом: inline-стиль не перебивает display:none из этого же файла */
#alt-subgate.is-on {
  display: block;
}

html.alt-subgate-blocked,
html.alt-subgate-blocked body {
  overflow: hidden !important;
}

.alt-subgate__screen {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: max(14px, env(safe-area-inset-top)) 14px max(14px, env(safe-area-inset-bottom));
  overflow-y: auto;
  background:
    radial-gradient(120% 70% at 50% 0%, rgba(239, 2, 203, .28), transparent 62%),
    radial-gradient(120% 80% at 50% 100%, rgba(117, 2, 127, .34), transparent 62%),
    radial-gradient(90% 60% at 8% 40%, rgba(182, 2, 206, .18), transparent 70%),
    rgba(10, 4, 14, .94);
  font-family: Unbounded, Montserrat, system-ui, sans-serif;
  color: #f6ecfa;
}

.alt-subgate__glow {
  position: absolute;
  width: 340px;
  height: 340px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(239, 2, 203, .32), transparent 68%);
  filter: blur(8px);
  pointer-events: none;
}

/* ── сцена: карточка + стикеры вокруг ─────────────────────────────────────── */
.alt-subgate__stage {
  /* --sg-top — сколько места сверху занимает зайка. От него же считаются
     позиции стикеров, поэтому менять высоту надо только здесь. */
  --sg-top: 152px;
  position: relative;
  width: min(376px, 100%);
  padding-top: var(--sg-top);
  margin: 0 auto;
}

.alt-subgate__art {
  position: absolute;
  pointer-events: none;
  user-select: none;
  -webkit-user-drag: none;
}

/* зайка за верхней кромкой карточки: руки лежат на рамке, как в макете */
.alt-subgate__art--bunny {
  left: 50%;
  bottom: calc(100% - var(--sg-top) + 12px);
  width: 64%;
  max-width: 250px;
  transform: translateX(-50%);
  z-index: 1;
  filter: drop-shadow(0 10px 24px rgba(0, 0, 0, .55));
}

/* подарок с зайцем-черепом — правый верхний угол, поверх карточки */
.alt-subgate__art--gift {
  right: -12px;
  top: 40px;
  width: 30%;
  max-width: 118px;
  z-index: 3;
  transform: rotate(-6deg);
  filter: drop-shadow(0 8px 18px rgba(0, 0, 0, .5));
}

/* заяц-череп с бантом — левый нижний угол, за пределами карточки */
.alt-subgate__art--skull {
  left: -22px;
  bottom: -42px;
  width: 21%;
  max-width: 88px;
  z-index: 3;
  transform: rotate(-10deg);
  filter: drop-shadow(0 8px 18px rgba(0, 0, 0, .5));
}

/* белое облачко с сердцем — левый верхний угол */
.alt-subgate__bubble {
  position: absolute;
  left: 1%;
  top: 84px;
  width: 64px;
  height: 56px;
  z-index: 3;
  border-radius: 50% 50% 50% 16px;
  background: linear-gradient(180deg, #ffffff, #ffe6f6);
  box-shadow: 0 6px 16px rgba(0, 0, 0, .35), inset 0 -3px 6px rgba(239, 2, 203, .18);
  display: flex;
  align-items: center;
  justify-content: center;
  transform: rotate(-6deg);
}
.alt-subgate__bubble-heart {
  width: 32px;
  height: 32px;
  object-fit: contain;
  display: block;
}

/* ── карточка ─────────────────────────────────────────────────────────────── */
.alt-subgate__card {
  position: relative;
  z-index: 2;
  padding: 18px 16px 16px;
  border-radius: 28px;
  text-align: center;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, .07), rgba(255, 255, 255, 0) 34%),
    radial-gradient(120% 90% at 50% 0%, rgba(239, 2, 203, .26), transparent 62%),
    linear-gradient(180deg, rgba(66, 19, 78, .96), rgba(26, 8, 34, .97));
  border: 2px solid transparent;
  background-clip: padding-box;
  box-shadow:
    0 20px 54px rgba(0, 0, 0, .6),
    0 0 0 2px rgba(214, 96, 255, .55),
    0 0 26px rgba(239, 2, 203, .45),
    inset 0 1px 0 rgba(255, 255, 255, .12);
  -webkit-backdrop-filter: blur(18px);
  backdrop-filter: blur(18px);
}

.alt-subgate__title {
  margin: 2px 0 8px;
  font-size: clamp(19px, 5.4vw, 24px);
  line-height: 1.12;
  font-weight: 800;
  letter-spacing: .2px;
  text-wrap: balance;
  background: linear-gradient(96deg, #ffffff 4%, #ffd9f5 30%, #ff8ae2 62%, #d78cff 88%, #ffd9f5);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  /* ВАЖНО: при background-clip:text нельзя text-shadow — он рисуется ПОВЕРХ
     залитой градиентом буквы и заголовок становится тёмным. Тень/свечение даём
     через filter, он применяется уже к готовым буквам. */
  filter: drop-shadow(0 1px 1px rgba(48, 4, 52, .95)) drop-shadow(0 6px 16px rgba(239, 2, 203, .55));
}

.alt-subgate__text {
  margin: 0 auto 14px;
  max-width: 300px;
  font-family: Montserrat, system-ui, sans-serif;
  font-size: 13.5px;
  line-height: 1.4;
  color: #f1dcef;
}

/* ── строки канала и чата ─────────────────────────────────────────────────── */
.alt-subgate__list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 14px;
}

.alt-subgate__row {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 6px 6px 6px 9px;
  border-radius: 999px;
  border: 1.5px solid rgba(255, 138, 226, .48);
  background: linear-gradient(180deg, rgba(74, 24, 88, .92), rgba(38, 12, 48, .94));
  box-shadow:
    0 8px 20px rgba(0, 0, 0, .38),
    inset 0 1px 0 rgba(255, 255, 255, .10),
    0 0 14px rgba(239, 2, 203, .18);
  text-align: left;
}

.alt-subgate__row.is-ok {
  border-color: rgba(255, 255, 255, .22);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .08);
}

.alt-subgate__row-ico {
  flex: 0 0 auto;
  width: 30px;
  height: 30px;
  object-fit: contain;
  display: block;
  filter: drop-shadow(0 2px 6px rgba(0, 0, 0, .45));
}

.alt-subgate__row-emoji {
  flex: 0 0 auto;
  width: 30px;
  text-align: center;
  font-size: 18px;
  line-height: 1;
}

.alt-subgate__row-name {
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 13px;
  font-weight: 800;
  color: #fff;
  text-shadow: 0 1px 8px rgba(239, 2, 203, .35);
}

/* розовая капсула «Подписаться» справа внутри строки */
.alt-subgate__go {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 32px;
  padding: 0 10px;
  border: 1px solid rgba(255, 190, 240, .55);
  border-radius: 999px;
  background: linear-gradient(180deg, #ff66d4, #ef02cb 55%, #ad009a);
  color: #fff;
  font: inherit;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: .1px;
  white-space: nowrap;
  cursor: pointer;
  box-shadow:
    0 6px 16px rgba(239, 2, 203, .40),
    inset 0 1px 0 rgba(255, 255, 255, .45);
  -webkit-tap-highlight-color: transparent;
}
.alt-subgate__go:active { transform: translateY(1px); }
.sg-go__ico { flex: none; display: block; color: #fff; }

.alt-subgate__row-done {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding-right: 6px;
  font-family: Montserrat, system-ui, sans-serif;
  font-size: 12px;
  font-weight: 700;
  color: rgba(249, 181, 204, .95);
}
.alt-subgate__row-done-ico {
  width: 22px;
  height: 22px;
  object-fit: contain;
  display: block;
}

/* ── большая кнопка проверки ──────────────────────────────────────────────── */
.alt-subgate__check {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  width: 100%;
  min-height: 54px;
  padding: 0 16px;
  border: 2px solid rgba(255, 196, 242, .62);
  border-radius: 999px;
  background: linear-gradient(180deg, #ff7ade 0%, #f213ca 46%, #c100a6 78%, #8d0080 100%);
  color: #fff;
  font: inherit;
  font-size: 15px;
  font-weight: 800;
  letter-spacing: .2px;
  cursor: pointer;
  box-shadow:
    0 14px 30px rgba(239, 2, 203, .42),
    0 0 22px rgba(255, 90, 220, .35),
    inset 0 2px 0 rgba(255, 255, 255, .42),
    inset 0 -6px 14px rgba(90, 0, 80, .40);
  -webkit-tap-highlight-color: transparent;
}
.alt-subgate__check:active { transform: translateY(1px) scale(.995); }
.alt-subgate__check-ico { flex: none; display: block; color: #fff; }
.alt-subgate__check-spark {
  position: absolute;
  right: -12px;
  top: -12px;
  width: 22px;
  height: auto;
  pointer-events: none;
  filter: drop-shadow(0 2px 6px rgba(0, 0, 0, .4));
}

/* «проверяю сам…» — мелкая подпись со щитом */
.alt-subgate__hint {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  margin-top: 14px;
  padding: 0 12px;
  font-family: Montserrat, system-ui, sans-serif;
  font-size: 11.5px;
  line-height: 1.3;
  color: rgba(232, 209, 225, .68);
}
.alt-subgate__hint-ico {
  flex: none;
  width: 18px;
  height: 18px;
  object-fit: contain;
  display: block;
}

/* режим производительности гасит backdrop-filter — подложка и так плотная */
body.perf-lite .alt-subgate__card {
  -webkit-backdrop-filter: none;
  backdrop-filter: none;
}

/* низкий экран: ужимаем верхний отступ и арт, чтобы всё влезло без прокрутки */
@media (max-height: 700px) {
  .alt-subgate__stage { --sg-top: 118px; }
  .alt-subgate__art--bunny { width: 56%; }
  .alt-subgate__art--gift { width: 26%; top: 26px; }
  .alt-subgate__art--skull { width: 18%; bottom: -34px; }
  .alt-subgate__bubble { top: 58px; width: 56px; height: 50px; }
}

/* узкие телефоны (360 и меньше): иначе «ALTSTORM • Новости» уходит в многоточие */
@media (max-width: 380px) {
  .alt-subgate__row { gap: 7px; padding: 6px 6px 6px 8px; }
  .alt-subgate__row-ico { width: 26px; height: 26px; }
  .alt-subgate__row-name { font-size: 12px; }
  .alt-subgate__go { height: 30px; padding: 0 8px; font-size: 11px; }
  .alt-subgate__check { font-size: 13.5px; min-height: 50px; }
  .alt-subgate__text { font-size: 12.5px; }
}

/* ПК: карточка по центру, арт крупнее */
@media (min-width: 768px) {
  .alt-subgate__stage { width: 560px; --sg-top: 236px; }
  .alt-subgate__art--bunny { width: 60%; max-width: 360px; }
  .alt-subgate__art--gift { right: -18px; top: 54px; max-width: 186px; width: 32%; }
  .alt-subgate__art--skull { left: -34px; bottom: -58px; width: 23%; max-width: 140px; }
  .alt-subgate__bubble { left: 6%; top: 132px; width: 92px; height: 78px; border-radius: 50% 50% 50% 20px; }
  .alt-subgate__bubble-heart { width: 44px; height: 44px; }

  .alt-subgate__card { padding: 24px 22px 20px; border-radius: 34px; }
  .alt-subgate__title { font-size: 32px; margin-bottom: 12px; }
  .alt-subgate__text { font-size: 15.5px; max-width: 420px; margin-bottom: 18px; }

  .alt-subgate__list { gap: 12px; margin-bottom: 18px; }
  .alt-subgate__row { padding: 8px 8px 8px 12px; gap: 12px; }
  .alt-subgate__row-ico { width: 40px; height: 40px; }
  .alt-subgate__row-name { font-size: 16px; }
  .alt-subgate__go { height: 40px; padding: 0 16px; font-size: 14px; }
  .sg-go__ico { width: 15px; height: 15px; }
  .alt-subgate__row-done-ico { width: 28px; height: 28px; }
  .alt-subgate__row-done { font-size: 13.5px; }

  .alt-subgate__check { min-height: 64px; font-size: 18px; gap: 11px; }
  .alt-subgate__check-ico { width: 22px; height: 22px; }
  .alt-subgate__check-spark { width: 30px; right: -18px; top: -16px; }

  .alt-subgate__hint { font-size: 13px; margin-top: 18px; }
  .alt-subgate__hint-ico { width: 22px; height: 22px; }
}

/* ═══ ALT-SUBGATE-FIRST (01.12.2026) — экран проверки подписки ═══════════════════════
   Владелец: «при входе сначала показывается игра, а потом условия». Теперь панель висит сразу,
   а пока сервер отвечает, на месте строк стоят плейсхолдеры. Это же убирает мигание. */
.alt-subgate__row--load { opacity: .8; }
.alt-subgate__row-ico--ph {
  width: 26px; height: 26px; border-radius: 50%;
  background: rgba(255, 255, 255, .12);
  animation: altSgPulse 1.1s ease-in-out infinite;
}
.alt-subgate__row-name--ph {
  display: block; min-height: 11px; max-width: 58%; border-radius: 6px;
  background: rgba(255, 255, 255, .12);
  animation: altSgPulse 1.1s ease-in-out infinite;
}
@keyframes altSgPulse { 0%, 100% { opacity: .35; } 50% { opacity: .95; } }
.alt-subgate__check[disabled] {
  opacity: .8;
  filter: saturate(.75);
  cursor: default;
  transform: none;
}
html.alt-anim-off .alt-subgate__row-ico--ph,
html.alt-anim-off .alt-subgate__row-name--ph { animation: none; }
