/* First-paint boot — light + dark (html[data-vk-scheme]), orb+status вместе с первого кадра.
 * Шрифт: Inter Variable (см. /fonts/inter-variable.css, preload в index.html). */

.vk-boot {
  position: fixed;
  inset: 0;
  z-index: 100000;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0;
  padding: max(24px, var(--app-safe-top, 0px)) 24px max(24px, var(--app-safe-bottom, 0px));
  text-align: center;
  background: linear-gradient(165deg, #f2f2f7 0%, #e8e8ed 55%, #f0f0f5 100%);
  color: #1a1d26;
  font-family: "Inter Variable", sans-serif;
  transition: opacity 0.2s ease, background 0.15s ease, color 0.15s ease;
}

.vk-boot::before {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at 50% 42%, rgba(0, 122, 255, 0.08), transparent 58%);
  pointer-events: none;
}

html[data-vk-scheme="dark"] .vk-boot {
  background: linear-gradient(165deg, #0e0f12 0%, #14161c 55%, #101218 100%);
  color: #f3f5f9;
}

html[data-vk-scheme="dark"] .vk-boot::before {
  background: radial-gradient(circle at 50% 42%, rgba(10, 132, 255, 0.18), transparent 58%);
}

.vk-boot--in-app {
  position: relative;
  z-index: auto;
  inset: auto;
  flex: 1;
  min-height: 100%;
  width: 100%;
}

.vk-boot--hiding {
  opacity: 0;
  pointer-events: none;
}

.vk-boot__stage {
  position: relative;
  width: 88px;
  height: 88px;
  display: grid;
  place-items: center;
  isolation: isolate;
  flex-shrink: 0;
  /* glow inset -42% + orb shadow выходят ниже бокса — отступ до текста */
  margin-bottom: 44px;
}

.vk-boot__glow {
  position: absolute;
  inset: -42%;
  border-radius: 50%;
  background: conic-gradient(
    from 0deg,
    rgba(0, 122, 255, 0.38),
    rgba(175, 82, 222, 0.32),
    rgba(255, 105, 180, 0.28),
    rgba(0, 122, 255, 0.38)
  );
  animation: vk-boot-glow-spin 2.4s linear infinite;
  opacity: 0.6;
  will-change: transform;
}

html[data-vk-scheme="dark"] .vk-boot__glow {
  background: conic-gradient(
    from 0deg,
    rgba(10, 132, 255, 0.5),
    rgba(191, 90, 242, 0.42),
    rgba(255, 105, 180, 0.36),
    rgba(10, 132, 255, 0.5)
  );
  opacity: 0.72;
}

.vk-boot__noise {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background:
    radial-gradient(circle at 30% 22%, rgba(255, 255, 255, 0.72), transparent 55%),
    radial-gradient(circle at 72% 78%, rgba(255, 255, 255, 0.5), transparent 50%);
  animation: vk-boot-noise-pulse 1.2s ease-in-out infinite;
  z-index: 1;
}

html[data-vk-scheme="dark"] .vk-boot__noise {
  background:
    radial-gradient(circle at 30% 22%, rgba(255, 255, 255, 0.22), transparent 55%),
    radial-gradient(circle at 72% 78%, rgba(255, 255, 255, 0.12), transparent 50%);
}

.vk-boot__orb {
  position: relative;
  z-index: 2;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  overflow: hidden;
  background: linear-gradient(145deg, rgba(255, 255, 255, 0.35), rgba(255, 255, 255, 0.08));
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, 0.55),
    0 10px 28px rgba(0, 122, 255, 0.28);
}

html[data-vk-scheme="dark"] .vk-boot__orb {
  background: linear-gradient(145deg, rgba(255, 255, 255, 0.16), rgba(255, 255, 255, 0.04));
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, 0.22),
    0 10px 28px rgba(10, 132, 255, 0.35);
}

.vk-boot__fill {
  position: absolute;
  inset: 0;
  transform-origin: bottom center;
  /* Не scaleY(0) на первом кадре — иначе orb выглядит «пустым» до старта анимации */
  transform: scaleY(0.42);
  background: linear-gradient(180deg, #af52de 0%, #007aff 55%, #5ac8fa 100%);
  animation: vk-boot-orb-fill 1s steps(24) infinite alternate;
  will-change: transform;
}

.vk-boot__status {
  position: relative;
  z-index: 1;
  margin: 0;
  min-height: 2.8em;
  max-width: 18em;
  font-family: "Inter Variable", sans-serif;
  font-size: 1rem;
  font-weight: 500;
  line-height: 1.4;
  letter-spacing: 0.01em;
  color: rgba(26, 29, 38, 0.72);
  animation: vk-boot-status-in 0.35s ease;
}

html[data-vk-scheme="dark"] .vk-boot__status {
  color: rgba(243, 245, 249, 0.72);
}

.vk-boot__status--pending {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  animation: none;
}

.vk-boot__status.vk-boot__status--swap {
  animation: vk-boot-status-in 0.35s ease;
}

.vk-boot--error .vk-boot__status {
  color: #d92d20;
  font-weight: 600;
  animation: none;
}

html[data-vk-scheme="dark"] .vk-boot--error .vk-boot__status {
  color: #ff8a80;
}

.vk-boot--error .vk-boot__glow,
.vk-boot--error .vk-boot__fill {
  animation-play-state: paused;
}

@keyframes vk-boot-glow-spin {
  to {
    transform: rotate(360deg);
  }
}

@keyframes vk-boot-noise-pulse {
  0%,
  100% {
    opacity: 0.72;
  }
  50% {
    opacity: 1;
  }
}

@keyframes vk-boot-orb-fill {
  from {
    transform: scaleY(0.35);
  }
  to {
    transform: scaleY(1);
  }
}

@keyframes vk-boot-status-in {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (prefers-reduced-motion: reduce) {
  .vk-boot__glow {
    animation: none;
  }

  .vk-boot__noise {
    animation: none;
    opacity: 0.85;
  }

  .vk-boot__fill {
    animation: none;
    transform: scaleY(0.55);
  }

  .vk-boot__status {
    animation: none;
  }
}
