/* RESET */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

/* BACKGROUND */
body {
  background: url("bg-main.png") center / cover no-repeat fixed;
  overflow: hidden;
  position: relative;
  min-height: 100vh;
}

/* ========= ФИОЛЕТОВЫЙ КОНТУР ========= */

.border-glow {
  position: fixed;
  z-index: 999;
  pointer-events: none;
}

/* Верх */
.border-glow-top {
  top: 0;
  left: 0;
  width: 100%;
  height: 32px;
  background: linear-gradient(
    to bottom,
    rgba(180, 90, 255, 0.85),
    rgba(0, 0, 0, 0)
  );
  filter: blur(18px);
}

/* Низ */
.border-glow-bottom {
  bottom: 0;
  left: 0;
  width: 100%;
  height: 32px;
  background: linear-gradient(
    to top,
    rgba(180, 90, 255, 0.85),
    rgba(0, 0, 0, 0)
  );
  filter: blur(18px);
}

/* Лево */
.border-glow-left {
  top: 0;
  left: 0;
  width: 32px;
  height: 100%;
  background: linear-gradient(
    to right,
    rgba(180, 90, 255, 0.85),
    rgba(0, 0, 0, 0)
  );
  filter: blur(18px);
}

/* Право */
.border-glow-right {
  top: 0;
  right: 0;
  width: 32px;
  height: 100%;
  background: linear-gradient(
    to left,
    rgba(180, 90, 255, 0.85),
    rgba(0, 0, 0, 0)
  );
  filter: blur(18px);
}

/* ========= ОСНОВА САЙТА ========= */

.page-wrapper {
  position: relative;
  min-height: 100vh;
  padding: 16px 20px;
  overflow: hidden;
  z-index: 1;
}

/* Верхняя панель */
.top-bar {
  position: relative;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: flex-start;
}

.brand {
  display: flex;
  align-items: center;
  gap: 6px;
}

.brand-text {
  font-family: "Pixelify Sans", sans-serif;
  font-size: 28px;
}

.brand-avatar {
  width: 28px;
  height: 28px;
  object-fit: contain;
}

/* Вращение логотипа */
.rotating-logo {
  animation: spinPause 3.2s ease-in-out infinite;
}

@keyframes spinPause {
  0%   { transform: rotate(0deg); }
  60%  { transform: rotate(360deg); }
  100% { transform: rotate(360deg); }
}

/* ========= КНОПКА X ========= */

.twitter-button {
  position: absolute;
  top: 0;
  right: 0;
  width: 50px;   /* твой размер */
  height: 50px;  /* твой размер */
  border: none;
  background: transparent;
  padding: 0;
  cursor: pointer;
  z-index: 3;
}

.twitter-button:hover {
  animation: xShake 0.16s linear 1;
}

@keyframes xShake {
  0%   { transform: translateX(0) scale(1); }
  25%  { transform: translateX(1px) scale(1.03); }
  50%  { transform: translateX(-1px) scale(1.03); }
  100% { transform: translateX(0) scale(1); }
}

.x-img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

/* ========= ЦЕНТРАЛЬНОЕ ИЗОБРАЖЕНИЕ ========= */

/* Жёсткое центрирование по экрану, независимо от топ-бара и границ */
.center-content {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;  /* чтобы не мешать кликам по падающим объектам, при необходимости убери */
  z-index: 1;
}

/* breathing-анимация */
.coming-img {
  width: 70%;
  max-width: 600px;
  image-rendering: pixelated;
  animation: breathe 3.4s ease-in-out infinite;
}

@keyframes breathe {
  0%   { transform: translateY(0) rotate(0deg); }
  50%  { transform: translateY(-3px) rotate(-1deg); }
  100% { transform: translateY(0) rotate(0deg); }
}

/* ========= НИЖНИЕ ГОЛОВЫ ========= */

.face {
  position: absolute;
  width: 120px;
  bottom: 5%;
  image-rendering: pixelated;
  z-index: 1;
}

.face-left {
  left: 6%;
  animation: floatLeft 4.4s ease-in-out infinite;
}

.face-right {
  right: 6%;
  transform: scaleX(-1);
  animation: floatRight 4.4s ease-in-out infinite;
  animation-delay: 0.4s;
}

@keyframes floatLeft {
  0% { transform: translateY(0) rotate(-8deg); }
  50% { transform: translateY(-16px) rotate(-4deg); }
  100% { transform: translateY(0) rotate(-8deg); }
}

@keyframes floatRight {
  0% { transform: scaleX(-1) translateY(0) rotate(8deg); }
  50% { transform: scaleX(-1) translateY(-16px) rotate(4deg); }
  100% { transform: scaleX(-1) translateY(0) rotate(8deg); }
}

/* ========= ПАДАЮЩИЕ ПЕРСОНАЖИ ========= */

.falling-container {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 2;
}

.falling-face {
  position: absolute;
  top: -160px;
  width: 140px;
  image-rendering: pixelated;
  filter: drop-shadow(0 6px 10px rgba(0, 0, 0, 0.35));
  animation: fallDown linear forwards;
}

/* Pixel trail */
.falling-face::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 60%;
  transform: translateX(-50%);
  width: 6px;
  height: 22px;
  background: rgba(255, 255, 255, 0.75);
  filter: blur(1px);
  opacity: 0;
  animation: trailBlink 0.25s infinite;
}

@keyframes trailBlink {
  0% { opacity: 0; }
  50% { opacity: 0.9; }
  100% { opacity: 0; }
}

/* падение с дрейфом и вращением */
@keyframes fallDown {
  0% {
    transform: translateY(0) translateX(0) rotate(var(--rot, 0deg));
    opacity: 1;
  }
  100% {
    transform: translateY(115vh) translateX(var(--drift, 0px))
               rotate(calc(var(--rot, 0deg) + 14deg));
    opacity: 0;
  }
}

/* ========= FLOATING GHOST ========= */

.floating-ghost {
  position: absolute;
  width: 220px;
  opacity: 0;
  image-rendering: pixelated;
  filter: drop-shadow(0 6px 12px rgba(0,0,0,0.4));
  animation: ghostFade 5s ease-in-out forwards;
  z-index: 1;
}

@keyframes ghostFade {
  0%   { opacity: 0; transform: scale(0.9) rotate(-2deg); }
  20%  { opacity: 0.95; transform: scale(1) rotate(0deg); }
  70%  { opacity: 0.95; transform: scale(1.02) rotate(1deg); }
  100% { opacity: 0; transform: scale(1.05) rotate(2deg); }
}

/* ========= НИЖНИЙ GLOW ========= */

.bottom-glow {
  position: absolute;
  left: 50%;
  bottom: -80px;
  width: 600px;
  height: 260px;
  transform: translateX(-50%);
  background: radial-gradient(
    ellipse at top,
    rgba(180, 90, 255, 0.55),
    rgba(60, 0, 120, 0)
  );
  filter: blur(32px);
  opacity: 0.95;
  z-index: 0;
}

/* ========= МОБИЛЬНАЯ АДАПТАЦИЯ ========= */

@media (max-width: 600px) {
  .brand-text {
    font-size: 22px;
  }

  .brand-avatar {
    width: 24px;
    height: 24px;
  }

  .coming-img {
    width: 80%;
  }

  .face {
    width: 90px;
  }

  .falling-face {
    width: 110px;
  }

  .floating-ghost {
    width: 180px;
  }

  .bottom-glow {
    width: 420px;
    height: 220px;
    bottom: -70px;
  }
}
