#popup-layer {
  position: fixed;
  inset: 0;
  display: flex;
  justify-content: center;
  align-items: center;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.3s ease;
}

#popup-layer[data-visible="true"] {
  opacity: 1;
}

.popup-card {
  --scale: 0.8;
  --alpha: 0;
  background: rgba(12, 16, 35, 0.9);
  border: 1px solid rgba(207, 215, 255, 0.65);
  border-radius: 16px;
  padding: 1.4rem 1.6rem;
  width: min(560px, 82vw);
  color: #eef1ff;
  box-shadow: 0 18px 36px rgba(0, 0, 0, 0.45);
  transform: scale(var(--scale));
  opacity: var(--alpha);
  transition: transform 0.24s ease, opacity 0.24s ease;
  pointer-events: auto;
  text-align: left;
  touch-action: none;
}

.popup-card h4 {
  margin: 0 0 0.4rem;
  font-size: 1.05rem;
}

.popup-card p {
  margin: 0;
  opacity: 0.88;
}

.popup-card .popup-media {
  width: 100%;
  aspect-ratio: 1;
  margin: 0 0 0.8rem;
  border-radius: 12px;
  overflow: hidden;
  position: relative;
  background: rgba(12, 16, 35, 0.65);
  display: none;
}

.popup-card[data-popup-index="0"] .popup-media {
  display: block;
}

.popup-card[data-popup-index="0"] #rive-animation {
  width: 100%;
  height: 100%;
  display: block;
  opacity: 0;
  transition: opacity 0.25s ease;
}

.popup-media .rive-spinner {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  pointer-events: none;
}

.popup-media .rive-spinner::before {
  content: "";
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: 3px solid rgba(207, 215, 255, 0.35);
  border-top-color: rgba(207, 215, 255, 0.85);
  animation: rive-spinner 1s linear infinite;
}

.popup-media[data-loaded="true"] .rive-spinner {
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.2s ease;
}

.popup-media[data-loaded="true"] #rive-animation {
  opacity: 1;
}

@keyframes rive-spinner {
  from {
    transform: rotate(0deg);
  }
  to {
    transform: rotate(360deg);
  }
}
