:root {
  --bg: #0c0b0e;
  --text: #eceaec;
  --muted: #8e8a96;
  --accent: #ff3b3b;
  --line: rgba(255, 255, 255, 0.12);
  --discord-red: #da373c;
  --discord-red-hover: #a12828;
  --font-sans: "Manrope", system-ui, sans-serif;
  --font-display: "Montserrat", system-ui, sans-serif;
  --font-mono: "JetBrains Mono", monospace;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
}

button,
a {
  font-family: inherit;
}

/* Мягкий градиентный фон с пятнами */
.ambient-bg {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  overflow: hidden;
  background: #0c0b0e;
}

.blob {
  position: absolute;
  border-radius: 50%;
  filter: blur(110px);
  opacity: 0.42;
  transition: transform 1.2s cubic-bezier(0.16, 1, 0.3, 1);
  will-change: transform;
}

.blob-1 {
  width: 58vw;
  height: 58vw;
  top: -18vw;
  left: -12vw;
  background: radial-gradient(circle, rgba(255, 59, 59, 0.38), transparent 70%);
}

.blob-2 {
  width: 50vw;
  height: 50vw;
  bottom: -15vw;
  right: -10vw;
  background: radial-gradient(circle, rgba(165, 34, 48, 0.34), transparent 70%);
}

.blob-3 {
  width: 42vw;
  height: 42vw;
  top: 30vh;
  left: 35vw;
  background: radial-gradient(circle, rgba(255, 255, 255, 0.08), transparent 70%);
}

body[data-active-frame="1"] .blob-1 {
  transform: translate(38vw, 18vh) scale(1.08);
}
body[data-active-frame="1"] .blob-2 {
  transform: translate(-32vw, -12vh) scale(0.95);
}
body[data-active-frame="1"] .blob-3 {
  transform: translate(-18vw, 10vh) scale(1.15);
}

body[data-active-frame="2"] .blob-1 {
  transform: translate(18vw, 42vh) scale(1.15);
}
body[data-active-frame="2"] .blob-2 {
  transform: translate(-15vw, -38vh) scale(1.1);
}
body[data-active-frame="2"] .blob-3 {
  transform: translate(12vw, -15vh) scale(0.9);
}

/* Мягкие фоновые частички и салют */
#particles-canvas,
#spark-canvas {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

#particles-canvas {
  z-index: 1;
}

#spark-canvas {
  z-index: 90;
}

/* Слой растворяющихся комментариев (виден только на последнем кадре) */
.taunt-layer {
  position: fixed;
  inset: 0;
  z-index: 62;
  pointer-events: none;
  overflow: hidden;
  opacity: 0;
  transition: opacity 0.35s ease;
}

body[data-active-frame="2"] .taunt-layer {
  opacity: 1;
}

.floating-taunt {
  position: absolute;
  transform: translate(-50%, -50%);
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 500;
  color: #ff9494;
  white-space: nowrap;
  text-shadow: 0 4px 16px rgba(0, 0, 0, 0.9);
  animation: taunt-dissolve 3.2s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes taunt-dissolve {
  0% {
    opacity: 0;
    transform: translate(-50%, -30%) scale(0.92);
  }
  12% {
    opacity: 1;
    transform: translate(-50%, -55%) scale(1);
  }
  65% {
    opacity: 0.92;
    transform: translate(-50%, -95%) scale(1);
  }
  100% {
    opacity: 0;
    transform: translate(-50%, -145%) scale(1.02);
  }
}

/* Летающая по экрану кнопка удаления сервера (только на последнем кадре) */
.discord-delete-btn {
  position: fixed;
  left: 50%;
  top: 76%;
  transform: translate(-50%, -50%);
  z-index: 65;
  padding: 11px 20px;
  border-radius: 4px;
  border: none;
  background: var(--discord-red);
  color: #ffffff;
  font-size: 14px;
  font-weight: 600;
  white-space: nowrap;
  cursor: pointer;
  box-shadow: 0 8px 28px rgba(218, 55, 60, 0.45);
  opacity: 0;
  pointer-events: none;
  transition: left 0.24s cubic-bezier(0.16, 1, 0.3, 1),
    top 0.24s cubic-bezier(0.16, 1, 0.3, 1),
    opacity 0.45s ease,
    transform 0.45s cubic-bezier(0.16, 1, 0.3, 1),
    background 0.15s ease;
}

body[data-active-frame="2"] .discord-delete-btn:not(.is-hidden) {
  opacity: 1;
  pointer-events: auto;
}

.discord-delete-btn:hover {
  background: var(--discord-red-hover);
}

.discord-delete-btn.is-hidden {
  opacity: 0 !important;
  pointer-events: none !important;
  transform: translate(-50%, -20%) scale(0.85);
}

/* Боковой HUD */
.frame-hud {
  position: fixed;
  right: 26px;
  top: 50%;
  transform: translateY(-50%);
  z-index: 40;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.hud-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.22);
  transition: transform 0.25s ease, background 0.25s ease, box-shadow 0.25s ease;
}

.hud-dot.is-active,
.hud-dot:hover {
  background: var(--accent);
  transform: scale(1.45);
  box-shadow: 0 0 12px rgba(255, 59, 59, 0.7);
}

/* Контейнер кадров */
.frames-container {
  position: relative;
  z-index: 2;
  height: 100vh;
  overflow-y: auto;
  scroll-snap-type: y mandatory;
  scrollbar-width: none;
}

.frames-container::-webkit-scrollbar {
  display: none;
}

.frame {
  position: relative;
  min-height: 100vh;
  height: 100vh;
  scroll-snap-align: start;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px 64px;
  overflow: hidden;
}

/* Дорогие анимации разлёта элементов без дёргающегося blur */
.anim-item {
  opacity: 0;
  transition: opacity 0.9s cubic-bezier(0.16, 1, 0.3, 1),
    transform 0.95s cubic-bezier(0.16, 1, 0.3, 1);
  will-change: transform, opacity;
}

/* Кадр 1: листок улетает влево-вверх, конверт вправо-вниз */
.frame-intro .wish-sheet.anim-item {
  transform: translate3d(-90px, -40px, 0) rotate(-4deg) scale(0.94);
}
.frame-intro .artifact-stage.anim-item {
  transform: translate3d(90px, 40px, 0) rotate(4deg) scale(0.94);
}

/* Кадр 2: строки разлетаются по сторонам */
.frame-lore .chapter-header.anim-item {
  transform: translate3d(0, -36px, 0);
}
.frame-lore .lore-row:nth-child(odd) {
  transform: translate3d(-110px, 0, 0);
}
.frame-lore .lore-row:nth-child(even) {
  transform: translate3d(110px, 0, 0);
}

/* Кадр 3: финал всплывает из глубины */
.frame-finale .wish-trigger-block.anim-item {
  transform: translate3d(0, 50px, 0) scale(0.9);
}

/* Когда кадр активен — всё плавно собирается на свои места */
.frame.is-active .anim-item {
  opacity: 1;
  transform: translate3d(0, 0, 0) rotate(0deg) scale(1);
}

.frame.is-active .wish-sheet.anim-item {
  transform: translate3d(0, 0, 0) rotate(-0.8deg) scale(1);
}

.frame.is-active .wish-sheet.anim-item:hover {
  transform: translate3d(0, 0, 0) rotate(0deg) scale(1);
}

.frame.is-active .anim-delay-1 {
  transition-delay: 0.08s;
}
.frame.is-active .anim-delay-2 {
  transition-delay: 0.16s;
}
.frame.is-active .anim-delay-3 {
  transition-delay: 0.24s;
}

.frame-inner {
  width: 100%;
  max-width: 1080px;
}

.mono-label {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--muted);
}

.mono-red {
  color: #ff5e5e;
}

.hairline {
  flex: 1;
  height: 1px;
  background: linear-gradient(90deg, var(--line), transparent);
}

/* КАДР 1: ТРИ ГАЛОЧКИ СЛЕВА + ЛИСТОК ПОЗДРАВЛЕНИЯ + ФОТО */
.scroll-chevrons {
  position: absolute;
  left: 34px;
  bottom: 42px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  color: rgba(255, 255, 255, 0.55);
  text-decoration: none;
  padding: 8px;
}

.scroll-chevrons svg {
  width: 22px;
  height: 13px;
  animation: chevron-pulse 1.8s infinite ease-in-out;
}

.scroll-chevrons svg:nth-child(2) {
  animation-delay: 0.2s;
}

.scroll-chevrons svg:nth-child(3) {
  animation-delay: 0.4s;
  color: var(--accent);
}

@keyframes chevron-pulse {
  0%, 100% {
    opacity: 0.25;
    transform: translateY(0);
  }
  50% {
    opacity: 1;
    transform: translateY(4px);
  }
}

.hero-grid {
  display: grid;
  grid-template-columns: 1.18fr 0.82fr;
  align-items: center;
  gap: 56px;
}

.wish-sheet {
  position: relative;
  padding: 42px 44px;
  background: linear-gradient(155deg, rgba(255, 255, 255, 0.055), rgba(20, 19, 24, 0.84));
  border: 1px solid rgba(255, 255, 255, 0.14);
  backdrop-filter: blur(22px);
  -webkit-backdrop-filter: blur(22px);
  box-shadow: 0 32px 80px rgba(0, 0, 0, 0.45), inset 0 1px 0 rgba(255, 255, 255, 0.12);
}

.sheet-top {
  display: flex;
  justify-content: space-between;
  margin-bottom: 24px;
}

.sheet-title {
  margin: 0 0 22px;
  font-family: var(--font-display);
  font-weight: 900;
  font-style: italic;
  font-size: clamp(38px, 5vw, 64px);
  line-height: 0.96;
  letter-spacing: -0.03em;
  color: #f4f2f4;
}

.sheet-title span {
  background: linear-gradient(120deg, #ffffff 30%, #ff5252 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.sheet-body {
  margin: 0 0 28px;
  font-size: 16.5px;
  line-height: 1.72;
  color: #ccc8d2;
}

.sheet-sign {
  display: flex;
  align-items: center;
  gap: 16px;
}

/* Интерактивный конверт (полностью непрозрачный до нажатия) */
.artifact-stage {
  perspective: 1200px;
  display: flex;
  justify-content: center;
}

.artifact-envelope {
  position: relative;
  width: 300px;
  height: 380px;
  transform-style: preserve-3d;
  transition: transform 0.2s ease-out;
  cursor: pointer;
  outline: none;
}

.artifact-photo {
  position: absolute;
  inset: 14px;
  background: #eceaeb;
  padding: 10px;
  transform: translateZ(10px) translateY(16px) scale(0.94);
  opacity: 0;
  pointer-events: none;
  transition: transform 0.65s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.35s ease;
  box-shadow: 0 30px 70px rgba(0, 0, 0, 0.7);
}

.artifact-photo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.artifact-stamp {
  position: absolute;
  bottom: 20px;
  right: 18px;
  padding: 4px 8px;
  border: 1.5px solid var(--accent);
  color: var(--accent);
  background: rgba(12, 11, 14, 0.88);
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.12em;
  transform: rotate(-6deg);
}

.artifact-envelope.is-open .artifact-photo {
  transform: translateZ(40px) translateY(-30px) rotate(-2deg) scale(1);
  opacity: 1;
  pointer-events: auto;
  z-index: 4;
}

.artifact-cover {
  position: relative;
  width: 100%;
  height: 100%;
  padding: 22px;
  border: 1px solid rgba(255, 255, 255, 0.22);
  background: linear-gradient(155deg, #25232b 0%, #151419 100%);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.12), 0 26px 60px rgba(0, 0, 0, 0.6);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  z-index: 3;
  transition: transform 0.65s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.4s ease;
}

.artifact-envelope.is-open .artifact-cover {
  transform: translateY(125px) scale(0.92);
  opacity: 0.65;
}

.cover-top,
.cover-bot {
  display: flex;
  justify-content: space-between;
  font-family: var(--font-mono);
  font-size: 10.5px;
  color: var(--muted);
}

.cover-mid {
  text-align: center;
}

.cover-title {
  display: block;
  font-family: var(--font-display);
  font-weight: 800;
  font-style: italic;
  font-size: 21px;
  line-height: 1.2;
  margin-bottom: 12px;
}

.cover-cta {
  font-family: var(--font-mono);
  font-size: 11px;
  color: #ff6b6b;
}

/* КАДР 2: ФЕНОМЕН */
.chapter-header {
  display: flex;
  align-items: center;
  gap: 20px;
  margin-bottom: 42px;
}

.lore-list {
  display: flex;
  flex-direction: column;
}

.lore-row {
  display: grid;
  grid-template-columns: 1.25fr auto;
  align-items: center;
  gap: 28px;
  padding: 32px 0;
  border-top: 1px solid var(--line);
}

.lore-row:last-child {
  border-bottom: 1px solid var(--line);
}

.lore-row:hover {
  border-top-color: rgba(255, 59, 59, 0.55);
}

.lore-title {
  margin: 0 0 8px;
  font-family: var(--font-display);
  font-weight: 800;
  font-style: italic;
  font-size: clamp(22px, 2.8vw, 32px);
  letter-spacing: -0.02em;
}

.lore-desc {
  margin: 0;
  max-width: 560px;
  font-size: 15px;
  line-height: 1.6;
  color: #b1adb8;
}

.hud-trigger {
  display: inline-block;
  text-decoration: none;
  background: transparent;
  border: none;
  padding: 10px 4px;
  font-family: var(--font-mono);
  font-size: 12.5px;
  letter-spacing: 0.08em;
  color: #eceaec;
  cursor: pointer;
  position: relative;
  transition: color 0.25s ease;
}

.hud-trigger::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 4px;
  height: 1px;
  background: rgba(255, 255, 255, 0.28);
  transform: scaleX(0.45);
  transform-origin: left;
  transition: transform 0.3s ease, background 0.3s ease;
}

.hud-trigger:hover {
  color: #ffffff;
}

.hud-trigger:hover::after {
  transform: scaleX(1);
  background: var(--accent);
}

.hud-trigger--accent {
  color: #ff6b6b;
}

/* КАДР 3: ЖЕЛАНИЕ */
.finale-stack {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.wish-trigger-block {
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
}

.finale-title {
  margin: 4px 0 0;
  font-family: var(--font-display);
  font-weight: 900;
  font-style: italic;
  font-size: clamp(32px, 4.6vw, 54px);
  letter-spacing: -0.03em;
}

.finale-sub {
  margin: 0 0 10px;
  color: #b1adb8;
  font-size: 15.5px;
}

.big-wish-btn {
  padding: 18px 42px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.22);
  background: linear-gradient(135deg, #ff3b3b, #c92020);
  color: #ffffff;
  font-family: var(--font-display);
  font-weight: 800;
  font-style: italic;
  font-size: 18px;
  letter-spacing: 0.02em;
  cursor: pointer;
  box-shadow: 0 14px 40px rgba(255, 59, 59, 0.35);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.big-wish-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 20px 50px rgba(255, 59, 59, 0.5);
}

/* Модалка билета на бан */
.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 80;
  background: rgba(8, 7, 10, 0.84);
  backdrop-filter: blur(14px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
}

.modal-backdrop.is-open {
  opacity: 1;
  pointer-events: auto;
}

.ban-ticket {
  width: 100%;
  max-width: 440px;
  padding: 30px;
  background: #141317;
  border: 1px solid rgba(255, 59, 59, 0.5);
  box-shadow: 0 30px 90px rgba(0, 0, 0, 0.8), 0 0 50px rgba(255, 59, 59, 0.16);
}

.ticket-top {
  display: flex;
  justify-content: space-between;
  margin-bottom: 18px;
}

.ticket-title {
  margin: 0 0 12px;
  font-family: var(--font-display);
  font-weight: 900;
  font-style: italic;
  font-size: 26px;
  line-height: 1.15;
}

.ticket-desc {
  margin: 0 0 20px;
  color: #b8b4be;
  font-size: 14px;
  line-height: 1.55;
}

.ticket-meta {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  padding: 14px 0;
  border-top: 1px dashed rgba(255, 255, 255, 0.18);
  border-bottom: 1px dashed rgba(255, 255, 255, 0.18);
  margin-bottom: 18px;
}

.ticket-val {
  display: block;
  margin-top: 4px;
  font-size: 12.5px;
  font-weight: 600;
}

.ticket-barcode {
  height: 34px;
  margin-bottom: 20px;
  opacity: 0.55;
  background: repeating-linear-gradient(
    90deg,
    #fff 0px,
    #fff 2px,
    transparent 2px,
    transparent 5px,
    #fff 5px,
    #fff 6px,
    transparent 6px,
    transparent 10px
  );
}

.ticket-close {
  width: 100%;
  text-align: center;
}

/* Тост */
.toast {
  position: fixed;
  bottom: 26px;
  left: 50%;
  transform: translateX(-50%) translateY(16px);
  z-index: 95;
  padding: 10px 18px;
  background: rgba(16, 15, 19, 0.94);
  border: 1px solid rgba(255, 59, 59, 0.45);
  font-family: var(--font-mono);
  font-size: 12px;
  color: #ffffff;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease, transform 0.25s ease;
}

.toast.is-visible {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* Адаптив */
@media (max-width: 900px) {
  .frame {
    height: auto;
    min-height: 100vh;
    padding: 48px 20px;
  }

  .frame-hud,
  .scroll-chevrons {
    display: none;
  }

  .hero-grid {
    grid-template-columns: 1fr;
    gap: 28px;
  }

  .wish-sheet {
    padding: 28px 24px;
  }

  .lore-row {
    grid-template-columns: 1fr;
    gap: 12px;
  }
}
