.magic-link-motion-root .magic-motion-stage,
#magic-link-motion-demo .magic-motion-stage {
  background: #2d2e2d;
  border-radius: 20px;
  min-height: 200px;
  display: grid;
  place-items: center;
  overflow: visible;
  margin-bottom: 8px;
}

.magic-link-motion-root .magic-link-motion-pair,
#magic-link-motion-demo .magic-link-motion-pair {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  margin-top: 24px;
}

.magic-link-motion-root .magic-link-motion-controls,
#magic-link-motion-demo .magic-link-motion-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-bottom: 4px;
}

.magic-link-motion-root .magic-link-motion-label,
#magic-link-motion-demo .magic-link-motion-label {
  font-size: 0.85em;
  color: rgba(255, 255, 255, 0.55);
}

.magic-link-motion-root .magic-link-motion-replay,
#magic-link-motion-demo .magic-link-motion-replay {
  background: none;
  border: 1px solid rgba(223, 255, 147, 0.45);
  color: #dfff93;
  padding: 4px 12px;
  margin: 0;
  font: inherit;
  font-size: 0.85em;
  cursor: pointer;
  border-radius: 4px;
}

.magic-link-motion-root .magic-link-motion-replay:hover,
#magic-link-motion-demo .magic-link-motion-replay:hover {
  background: rgba(223, 255, 147, 0.12);
}

.magic-link-motion-root .magic-mail,
#magic-link-motion-demo .magic-mail {
  position: relative;
  width: 118px;
  height: 118px;
  border-radius: 50%;
  background: #555655;
  isolation: isolate;
}

.magic-link-motion-root .magic-mail::before,
#magic-link-motion-demo .magic-mail::before {
  content: "";
  position: absolute;
  inset: 7px;
  border-radius: 50%;
  background: #232323;
  z-index: 1;
}

.magic-link-motion-root .magic-mail-ring,
#magic-link-motion-demo .magic-mail-ring {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: transparent;
  opacity: 0;
  pointer-events: none;
}

.magic-link-motion-root .magic-envelope,
#magic-link-motion-demo .magic-envelope {
  position: absolute;
  width: 70px;
  height: 44px;
  left: 24px;
  top: 44px;
  border-radius: 6px;
  background: transparent;
  z-index: 2;
  box-shadow: 0 3px 8px #00000022;
  overflow: visible;
}

.magic-link-motion-root .magic-envelope-back,
#magic-link-motion-demo .magic-envelope-back {
  position: absolute;
  width: 70px;
  height: 72px;
  left: 0;
  top: -28px;
  border-radius: 0 0 6px 6px;
  background: linear-gradient(180deg, #f6f7f9, #dce1e6);
  clip-path: polygon(0 28px, 50% 28px, 100% 28px, 100% 100%, 0 100%);
  z-index: 1;
}

.magic-link-motion-root .magic-letter,
#magic-link-motion-demo .magic-letter {
  position: absolute;
  width: 50px;
  height: 40px;
  z-index: 2;
  left: 10px;
  top: 2px;
  background: #dfff93;
  border-radius: 5px;
  display: grid;
  place-items: center;
  box-shadow: 0 1px 3px #00000018;
  opacity: 0;
  will-change: transform, opacity;
}

.magic-link-motion-root .magic-tick,
#magic-link-motion-demo .magic-tick {
  position: relative;
  z-index: 1;
  width: 16px;
  height: 8px;
  border-left: 2.5px solid #232323;
  border-bottom: 2.5px solid #232323;
  border-radius: 1px;
  transform: rotate(-45deg);
  margin-top: 2px;
  opacity: 0;
}

.magic-link-motion-root .magic-envelope-front,
#magic-link-motion-demo .magic-envelope-front {
  position: absolute;
  inset: 0;
  border-radius: 6px;
  background: linear-gradient(160deg, #fafbfc 0%, #eef0f2 55%, #d9dde1 100%);
  clip-path: path(
    "M 0 2 L 31 24 Q 35 27 39 24 L 70 2 L 70 38 Q 70 44 64 44 L 6 44 Q 0 44 0 38 Z"
  );
  z-index: 3;
  box-shadow: inset 0 -1px 0 #a6adb444;
}

.magic-link-motion-root .magic-envelope-seam,
#magic-link-motion-demo .magic-envelope-seam {
  position: absolute;
  inset: 0;
  border-radius: 6px;
  background: #818a9433;
  clip-path: polygon(
    3% 99%,
    32% 54%,
    33.5% 55.5%,
    5% 100%,
    95% 100%,
    66.5% 55.5%,
    68% 54%,
    97% 99%,
    97% 100%,
    3% 100%
  );
  z-index: 4;
}

.magic-link-motion-root .magic-envelope-flap,
#magic-link-motion-demo .magic-envelope-flap {
  position: absolute;
  width: 70px;
  height: 28px;
  top: 0;
  left: 0;
  background: linear-gradient(180deg, #ffffff, #e9ecef);
  clip-path: path("M 0 0 L 70 0 L 39 24 Q 35 27 31 24 Z");
  transform-origin: 50% 0;
  z-index: 5;
  backface-visibility: visible;
}

.magic-link-motion-root .magic-envelope-flap::after,
#magic-link-motion-demo .magic-envelope-flap::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, #ffffff66, transparent 40%, #b5bdc51a);
}

.magic-link-motion-root .magic-wand-scene,
#magic-link-motion-demo .magic-wand-scene {
  position: relative;
  width: 230px;
  height: 160px;
}

.magic-link-motion-root .magic-wand,
#magic-link-motion-demo .magic-wand {
  position: absolute;
  left: 40px;
  top: 77px;
  width: 156px;
  height: 11px;
  background: #3e3e3e;
  border-radius: 6px;
  transform: rotate(9deg);
  transform-origin: 90% 50%;
}

.magic-link-motion-root .magic-wand-tip,
#magic-link-motion-demo .magic-wand-tip {
  position: absolute;
  left: 0;
  top: 0;
  width: 22px;
  height: 11px;
  border-radius: 5px 2px 2px 5px;
  background: #fff;
}

.magic-link-motion-root .magic-wand-tip::after,
#magic-link-motion-demo .magic-wand-tip::after {
  content: "";
  position: absolute;
  left: 5px;
  right: 4px;
  bottom: 2px;
  height: 2px;
  background: #e5e5e4;
  border-radius: 2px;
}

.magic-link-motion-root .magic-dust,
#magic-link-motion-demo .magic-dust {
  position: absolute;
  width: var(--size);
  height: var(--size);
  left: var(--x);
  top: var(--y);
  background: #fff;
  clip-path: polygon(
    50% 0,
    60% 38%,
    100% 50%,
    60% 62%,
    50% 100%,
    40% 62%,
    0 50%,
    40% 38%
  );
  opacity: 0;
  transform: translate(0, 0) scale(1);
}

.magic-link-motion-root .magic-dust-dot,
#magic-link-motion-demo .magic-dust-dot {
  border-radius: 50%;
  clip-path: none;
  opacity: 0;
}

@media (max-width: 560px) {
  .magic-link-motion-root .magic-link-motion-pair,
  #magic-link-motion-demo .magic-link-motion-pair {
    grid-template-columns: 1fr;
  }
}
