/* Баннер «Лайм × Сбер 185 — выгода 1,85 %» на тест-странице /lime-skidka/.
   Появляется после прокрутки трети страницы, один раз за сессию; после закрытия —
   плашка-напоминание слева снизу. Динамика — как у «Торгуйся с ИИ»: наклон карточки
   за курсором и стеклянные кубики на своей глубине. */

.sb-overlay {
  --mx: 0;
  --my: 0;
  --sb-green: #21a038;
  --sb-green-2: #7cc242;
  --sb-lime: #a8e82e;
  --sb-ink: #17210a;
  position: fixed;
  inset: 0;
  z-index: 1050;
  display: grid;
  /* minmax(0, 1fr): иначе колонка растягивается по содержимому и карточка вылезает за экран */
  grid-template-columns: minmax(0, 1fr);
  place-items: center;
  padding: 40px 20px;
  overflow-y: auto;
  background: rgba(10, 13, 8, 0.62);
  backdrop-filter: blur(10px) saturate(1.1);
  -webkit-backdrop-filter: blur(10px) saturate(1.1);
  perspective: 1600px;
  font-family: 'Manrope', -apple-system, 'Segoe UI', sans-serif;
  animation: sb-fade 0.35s ease-out both;
}

.sb-overlay.sb-closing {
  animation: sb-fade-out 0.28s ease-in forwards;
}

.sb-stage {
  position: relative;
  width: min(1040px, 100%);
  transform-style: preserve-3d;
  transform: rotateX(calc(var(--my) * -3deg)) rotateY(calc(var(--mx) * 4deg));
  transition: transform 0.25s ease-out;
}

.sb-card {
  position: relative;
  overflow: hidden;
  border-radius: 28px;
  background: #f3f8ec;
  box-shadow:
    0 50px 100px -40px rgba(0, 0, 0, 0.7),
    0 0 0 1px rgba(255, 255, 255, 0.5);
  animation: sb-card-in 0.6s cubic-bezier(0.2, 0.9, 0.25, 1.15) both;
}

.sb-closing .sb-card {
  animation: sb-card-out 0.28s ease-in forwards;
}

.sb-pic {
  display: block;
  width: 100%;
  aspect-ratio: 16 / 9;
  background: #eef5e4;
}

.sb-pic img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* Блик по картинке — раз при появлении */
.sb-card::after {
  content: '';
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: linear-gradient(105deg, transparent 35%, rgba(255, 255, 255, 0.55) 50%, transparent 65%);
  transform: translateX(-120%);
  animation: sb-shine 1.4s 0.6s ease-out both;
}

.sb-close {
  position: absolute;
  top: 14px;
  right: 14px;
  z-index: 3;
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border: 1px solid rgba(23, 33, 10, 0.12);
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(6px);
  color: var(--sb-ink);
  cursor: pointer;
  transition: transform 0.2s, background 0.2s;
}

.sb-close:hover {
  background: #fff;
  transform: rotate(90deg);
}

.sb-bottom {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px 20px;
  padding: 18px 24px 22px;
  background: #fff;
  border-top: 1px solid rgba(23, 33, 10, 0.08);
}

.sb-note {
  color: rgba(23, 33, 10, 0.62);
  font-size: 14px;
  line-height: 1.45;
}

.sb-rules {
  color: var(--sb-green);
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 3px;
  white-space: nowrap;
}

.sb-note b {
  color: var(--sb-ink);
}

.sb-cta,
.sb-submit {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 54px;
  padding: 0 30px;
  border: 0;
  border-radius: 999px;
  background: linear-gradient(120deg, var(--sb-green), var(--sb-green-2));
  color: #fff;
  font-family: inherit;
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 14px 34px -14px rgba(33, 160, 56, 0.7);
  transition: transform 0.3s cubic-bezier(0.22, 1, 0.36, 1), box-shadow 0.3s;
}

.sb-cta:hover,
.sb-submit:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 20px 44px -14px rgba(33, 160, 56, 0.8);
}

.sb-submit:disabled {
  opacity: 0.6;
  cursor: default;
}

/* Форма заявки — раскрывается вместо нижней строки */
.sb-form {
  display: grid;
  grid-template-columns: 1fr 1fr auto;
  gap: 10px;
  align-items: start;
  padding: 18px 24px 20px;
  background: #fff;
  border-top: 1px solid rgba(23, 33, 10, 0.08);
  animation: sb-rise 0.35s ease-out both;
}

.sb-form[hidden],
.sb-bottom[hidden],
.sb-done[hidden] {
  display: none;
}

.sb-form input[type='text'],
.sb-form input[type='tel'] {
  height: 54px;
  padding: 0 18px;
  border: 1px solid rgba(23, 33, 10, 0.16);
  border-radius: 14px;
  background: #f7faf2;
  color: var(--sb-ink);
  font-family: inherit;
  font-size: 16px;
}

.sb-phone {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.sb-phone input {
  width: 100%;
}

/* Подсказка маски телефона с сайта (er-contact.js) */
.sb-form .er-field-error {
  color: #b3261e;
  font-size: 12.5px;
}

.sb-form .er-invalid {
  border-color: #b3261e;
}

.sb-form input:focus {
  outline: none;
  border-color: var(--sb-green);
}

.sb-consent {
  grid-column: 1 / -1;
  display: flex;
  gap: 10px;
  align-items: flex-start;
  color: rgba(23, 33, 10, 0.62);
  font-size: 12.5px;
  line-height: 1.5;
  cursor: pointer;
}

.sb-consent input {
  margin-top: 2px;
  accent-color: var(--sb-green);
}

.sb-consent a {
  color: var(--sb-green);
}

.sb-error {
  grid-column: 1 / -1;
  padding: 9px 13px;
  border-radius: 12px;
  background: #fdecea;
  color: #b3261e;
  font-size: 13px;
}

.sb-error[hidden] {
  display: none;
}

.sb-hp {
  position: absolute;
  left: -9999px;
  width: 0;
  height: 0;
  opacity: 0;
}

.sb-done {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 20px 24px 22px;
  background: #fff;
  border-top: 1px solid rgba(23, 33, 10, 0.08);
  color: var(--sb-ink);
  font-size: 15px;
  line-height: 1.5;
  animation: sb-rise 0.35s ease-out both;
}

.sb-done-icon {
  display: grid;
  flex-shrink: 0;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: linear-gradient(120deg, var(--sb-green), var(--sb-green-2));
  color: #fff;
}

/* ─── Стеклянные кубики (как в «Торгуйся с ИИ») ─── */
.sb-cube-wrap {
  --s: 64px;
  --depth: 30px;
  position: absolute;
  z-index: 4;
  width: var(--s);
  height: var(--s);
  pointer-events: none;
  transform-style: preserve-3d;
  transform: translate3d(
    calc(var(--mx) * var(--depth) * -1),
    calc(var(--my) * var(--depth) * -1),
    90px
  );
  transition: transform 0.25s ease-out;
  animation: sb-cube-in 0.8s cubic-bezier(0.2, 0.9, 0.3, 1.4) both;
}

.sb-cube-a {
  --s: 84px;
  --depth: 38px;
  left: -38px;
  bottom: 54px;
  animation-delay: 0.45s;
}

.sb-cube-b {
  --s: 54px;
  --depth: 22px;
  left: 46%;
  top: -30px;
  animation-delay: 0.6s;
}

.sb-cube-c {
  --s: 66px;
  --depth: 46px;
  right: -32px;
  top: 34%;
  animation-delay: 0.75s;
}

.sb-cube {
  position: relative;
  width: 100%;
  height: 100%;
  transform-style: preserve-3d;
  animation: sb-spin 14s linear infinite;
}

.sb-cube-b .sb-cube {
  animation-duration: 18s;
  animation-direction: reverse;
}

.sb-cube-c .sb-cube {
  animation-duration: 11s;
}

.sb-face {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, 0.7);
  border-radius: 13px;
  background: linear-gradient(
    135deg,
    color-mix(in srgb, var(--tone) 80%, transparent) 0%,
    color-mix(in srgb, var(--tone) 42%, transparent) 100%
  );
  box-shadow:
    inset 0 0 18px rgba(255, 255, 255, 0.45),
    inset 0 1px 0 rgba(255, 255, 255, 0.9);
  color: #fff;
  font-weight: 800;
  backface-visibility: visible;
}

.sb-front {
  transform: translateZ(calc(var(--s) / 2));
}
.sb-back {
  transform: rotateY(180deg) translateZ(calc(var(--s) / 2));
}
.sb-right {
  transform: rotateY(90deg) translateZ(calc(var(--s) / 2));
}
.sb-left {
  transform: rotateY(-90deg) translateZ(calc(var(--s) / 2));
}
.sb-top {
  transform: rotateX(90deg) translateZ(calc(var(--s) / 2));
}
.sb-bottom-face {
  transform: rotateX(-90deg) translateZ(calc(var(--s) / 2));
}

.sb-tone-green {
  --tone: #21a038;
}
.sb-tone-lime {
  --tone: #8fd12a;
}
.sb-tone-clear {
  --tone: #cfe9b6;
}

/* ─── Плашка-напоминание после закрытия ─── */
.sb-chip {
  position: fixed;
  left: 20px;
  bottom: 20px;
  z-index: 890;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 10px 18px 10px 10px;
  border: 0;
  border-radius: 999px;
  background: #fff;
  color: #17210a;
  font-family: 'Manrope', -apple-system, 'Segoe UI', sans-serif;
  font-size: 14px;
  font-weight: 700;
  box-shadow: 0 18px 40px -18px rgba(0, 0, 0, 0.55);
  cursor: pointer;
  animation: sb-rise 0.5s ease-out both;
  transition: transform 0.2s;
}

.sb-chip:hover {
  transform: translateY(-2px);
}

.sb-chip-badge {
  display: grid;
  place-items: center;
  height: 34px;
  padding: 0 12px;
  border-radius: 999px;
  background: linear-gradient(120deg, #21a038, #7cc242);
  color: #fff;
  font-size: 15px;
}

@keyframes sb-fade {
  from {
    opacity: 0;
  }
}
@keyframes sb-fade-out {
  to {
    opacity: 0;
  }
}
@keyframes sb-card-in {
  from {
    opacity: 0;
    transform: translateY(40px) scale(0.94) rotateX(8deg);
  }
}
@keyframes sb-card-out {
  to {
    opacity: 0;
    transform: translateY(24px) scale(0.97);
  }
}
@keyframes sb-shine {
  to {
    transform: translateX(120%);
  }
}
@keyframes sb-rise {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
}
@keyframes sb-cube-in {
  from {
    opacity: 0;
    scale: 0.2;
  }
}
@keyframes sb-spin {
  from {
    transform: rotateX(-24deg) rotateY(0deg);
  }
  50% {
    transform: rotateX(-12deg) rotateY(180deg) translateY(-8px);
  }
  to {
    transform: rotateX(-24deg) rotateY(360deg);
  }
}

/* Телефон: вертикальная версия баннера, один кубик, форма в столбик */
@media (max-width: 700px) {
  .sb-overlay {
    padding: 16px 12px;
    align-items: start;
  }

  .sb-card {
    border-radius: 22px;
  }

  .sb-pic {
    aspect-ratio: 1060 / 1500;
  }

  .sb-bottom {
    padding: 14px 16px 18px;
  }

  .sb-cta {
    width: 100%;
  }

  .sb-form {
    grid-template-columns: 1fr;
    padding: 14px 16px 18px;
  }

  .sb-submit {
    width: 100%;
  }

  .sb-cube-wrap {
    transform: translate3d(0, 0, 60px);
  }

  .sb-cube-a,
  .sb-cube-c {
    display: none;
  }

  .sb-cube-b {
    --s: 40px;
    left: 18px;
    top: 18px;
  }

  .sb-chip {
    left: 10px;
    bottom: 96px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .sb-overlay,
  .sb-card,
  .sb-card::after,
  .sb-cube-wrap,
  .sb-cube,
  .sb-form,
  .sb-done,
  .sb-chip {
    animation: none;
  }

  .sb-stage {
    transform: none;
  }
}
