#lucky-rain {
  position: fixed;
  inset: 0;
  z-index: 110;
  overflow: hidden;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  background: #0a0512;
  color: #fce7f3;
  transition: opacity 0.65s ease, visibility 0.65s ease;
  /* Ghi đè touch-action: manipulation của body — giữ pinch/drag hiệu ứng */
  touch-action: none;
}

#lucky-rain.is-active {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

.image-text-fly-screen {
  position: relative;
  width: 100%;
  height: 100%;
  height: 100dvh;
  overflow: hidden;
  touch-action: none;
  background: #0a0512;
}

#starfield {
  position: absolute;
  inset: 0;
  z-index: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  display: block;
}

.wishes-layer {
  position: absolute;
  inset: 0;
  z-index: 2;
  transform-style: preserve-3d;
}

.wishes-layer-space {
  width: 100%;
  height: 100%;
  transform-style: preserve-3d;
  transform-origin: center center;
  will-change: transform;
}

.falling-container {
  position: absolute;
  inset: 0;
  z-index: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  transform-style: preserve-3d;
}

#falling-container {
  contain: strict;
}

.falling-item {
  will-change: transform;
  backface-visibility: hidden;
  pointer-events: auto;
  touch-action: none;
  transform-style: preserve-3d;
}

.wish-inner {
  display: inline-block;
  width: fit-content;
  max-width: fit-content;
  transform-style: preserve-3d;
  transform-origin: center center;
  will-change: transform;
}

.wish-text,
img.wish-image,
.photo-frame {
  touch-action: none;
  cursor: grab;
}

.falling-item:active .wish-text,
.falling-item:active img.wish-image,
.falling-item:active .photo-frame {
  cursor: grabbing;
}

.photo-frame {
  display: table;
  width: fit-content;
  max-width: fit-content;
  box-sizing: content-box;
  line-height: 0;
  font-size: 0;
  padding: 0;
  margin: 0;
  border: 2px solid rgba(244, 114, 182, 0.42);
  border-radius: 10px;
  background: #221018;
  box-shadow:
    0 4px 16px rgba(0, 0, 0, 0.32),
    0 0 12px rgba(244, 114, 182, 0.28);
  overflow: hidden;
}

.photo-frame img.wish-image {
  display: block;
  width: auto;
  height: auto;
  max-width: unset;
  max-height: unset;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
}

.blessing-text {
  font-family: "Lora", Georgia, "Times New Roman", serif;
  font-style: italic;
  font-weight: 600;
  letter-spacing: 0.02em;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  text-shadow:
    0 1px 2px rgba(0, 0, 0, 0.65),
    0 0 6px rgba(244, 114, 182, 0.4);
}

.fly-gradient-overlay {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 3;
  background:
    radial-gradient(
      ellipse 90% 70% at 50% 40%,
      transparent 40%,
      rgba(8, 3, 14, 0.35) 100%
    ),
    linear-gradient(
      to top,
      rgba(10, 4, 16, 0.55) 0%,
      transparent 28%,
      transparent 72%,
      rgba(10, 4, 16, 0.4) 100%
    );
  opacity: 0.7;
}

@media (prefers-reduced-motion: reduce) {
  #lucky-rain {
    transition: none;
  }
}
