.sigil-modal {
  position: fixed;
  inset: 0;
  z-index: 99999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  overflow: hidden;
  background: rgba(0, 0, 0, 0.82);
  opacity: 0;
  pointer-events: none;
  transition: opacity 420ms ease;
  transform: translateZ(0);
  -webkit-transform: translateZ(0);
}

.sigil-modal.active {
  opacity: 1;
  pointer-events: auto;
}

.sigil-modal img {
  display: block;
  width: min(420px, 78vw);
  max-width: 100%;
  height: auto;
  opacity: 0;
  transform: translateZ(0) scale(0.92);
  transform-origin: center center;
  filter: drop-shadow(0 0 22px rgba(115, 215, 255, 0.25)) drop-shadow(0 0 64px rgba(115, 215, 255, 0.14));
  transition: opacity 520ms ease, transform 620ms cubic-bezier(0.19, 1, 0.22, 1);
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
}

.sigil-modal.active img {
  opacity: 1;
  transform: translateZ(0) scale(1);
}

.sigil-modal.sigil-prewarm {
  visibility: hidden !important;
  opacity: 0 !important;
  pointer-events: none !important;
}

@media (hover: hover) and (pointer: fine) {
  .sigil-modal.active img {
    animation: lmSigilFloat 4.4s ease-in-out infinite;
  }
}

@keyframes lmSigilFloat {
  0%, 100% { transform: translateZ(0) scale(1); }
  50% { transform: translateZ(0) scale(1.018); }
}

@media (max-width: 768px) {
  .sigil-modal img { width: min(320px, 84vw); }
}

@supports (-webkit-touch-callout: none) {
  .sigil-modal img {
    filter: drop-shadow(0 0 12px rgba(115, 215, 255, 0.14)) drop-shadow(0 0 28px rgba(115, 215, 255, 0.08));
    transition: opacity 420ms ease, transform 520ms cubic-bezier(0.19, 1, 0.22, 1);
  }

  .sigil-modal.active img {
    animation: none;
    opacity: 1;
    transform: translateZ(0) scale(1);
  }

  .sigil-modal:not(.active) img {
    opacity: 0;
    transform: translateZ(0) scale(0.92);
    filter: drop-shadow(0 0 12px rgba(115, 215, 255, 0.14)) drop-shadow(0 0 28px rgba(115, 215, 255, 0.08));
  }
}

@media (prefers-reduced-motion: reduce) {
  .sigil-modal,
  .sigil-modal img {
    transition: none;
  }

  .sigil-modal.active img { animation: none; }
}
