/* Fixed behind the page shell: this layer is visual only and never receives input. */
.privacy-flow {
  --privacy-flow-mark-size: 108px;
  --privacy-flow-softness: 1px;
  position: fixed;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  overflow: clip;
  pointer-events: none;
  user-select: none;
  contain: layout paint style;
}

.privacy-flow__token {
  position: absolute;
  top: 0;
  left: 0;
  display: block;
  width: var(--privacy-flow-mark-size);
  height: var(--privacy-flow-mark-size);
  max-width: none;
  max-height: none;
  opacity: 0;
  isolation: isolate;
  pointer-events: none;
  transform: translate3d(-240px, -240px, 0);
  will-change: transform, opacity;
}

.privacy-flow__pixels {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  max-width: none;
  max-height: none;
  pointer-events: none;
  image-rendering: crisp-edges;
  image-rendering: pixelated;
  mix-blend-mode: screen;
  filter: drop-shadow(
    0 0 calc(var(--privacy-flow-softness) + 0.6px) rgb(143 255 237 / 0.34)
  );
}

/* The existing ::before remains the card's slim top bezel. */
#swapForm {
  --flow-pulse: 0;
  --flow-angle: 156deg;
  --flow-tremor-x: 0px;
  --flow-tremor-y: 0px;
  --flow-tremor-rotate: 0deg;
  --flow-zcash-yellow: 244 183 40;
  --flow-near-blue: 75 131 255;
  --flow-cypherpunk-purple: 181 98 255;
  --flow-rim-opacity: var(--flow-pulse);
  position: relative;
  isolation: isolate;
  transform: translate3d(var(--flow-tremor-x), var(--flow-tremor-y), 0)
    rotate(var(--flow-tremor-rotate));
  transform-origin: center;
  will-change: transform;
  box-shadow:
    0 22px 52px rgb(0 0 0 / 0.29),
    inset 0 1px 0 rgb(255 255 255 / 0.025);
}

.privacy-flow__halo {
  position: absolute;
  z-index: -1;
  inset: 0;
  border-radius: inherit;
  background: transparent;
  box-shadow:
    -22px 0 46px rgba(244, 183, 40, 0.55),
    22px 0 48px rgba(75, 131, 255, 0.54),
    -16px 20px 52px rgba(158, 73, 255, 0.42),
    17px 20px 54px rgba(201, 109, 255, 0.46),
    0 24px 62px rgba(196, 111, 255, 0.34);
  opacity: 0;
  pointer-events: none;
  will-change: opacity, filter;
}

#swapForm::after {
  position: absolute;
  z-index: 2;
  inset: -1px;
  border: 1px solid rgb(var(--flow-zcash-yellow) / 0.96);
  border-radius: inherit;
  content: "";
  opacity: var(--flow-rim-opacity);
  pointer-events: none;
}

@supports ((-webkit-mask-composite: xor) or (mask-composite: exclude)) {
  #swapForm::after {
    padding: 1px;
    border: 0;
    background: conic-gradient(
      from var(--flow-angle),
      rgb(255 239 145) 0deg,
      rgb(var(--flow-zcash-yellow)) 48deg,
      rgb(255 225 122) 82deg,
      rgb(var(--flow-cypherpunk-purple)) 132deg,
      rgb(238 212 255) 174deg,
      rgb(101 157 255) 216deg,
      rgb(var(--flow-near-blue)) 262deg,
      rgb(151 94 255) 310deg,
      rgb(255 244 200) 344deg,
      rgb(255 239 145) 360deg
    );
    -webkit-mask:
      linear-gradient(#000 0 0) content-box,
      linear-gradient(#000 0 0);
    -webkit-mask-composite: xor;
    mask:
      linear-gradient(#000 0 0) content-box,
      linear-gradient(#000 0 0);
    mask-composite: exclude;
  }

  /* These rings live behind the opaque card: only their feathered outer edge
     escapes the silhouette, so the swap fields stay sharp throughout a pulse. */
  .privacy-flow__halo::before,
  .privacy-flow__halo::after {
    position: absolute;
    border-radius: inherit;
    content: "";
    pointer-events: none;
    -webkit-mask:
      linear-gradient(#000 0 0) content-box,
      linear-gradient(#000 0 0);
    -webkit-mask-composite: xor;
    mask:
      linear-gradient(#000 0 0) content-box,
      linear-gradient(#000 0 0);
    mask-composite: exclude;
  }

  .privacy-flow__halo::before {
    inset: -3px;
    padding: 2px;
    background: conic-gradient(
      from var(--flow-angle),
      rgba(255, 237, 132, 0.76) 0deg,
      rgba(244, 183, 40, 0.9) 54deg,
      rgba(187, 99, 255, 0.84) 136deg,
      rgba(239, 215, 255, 0.9) 178deg,
      rgba(75, 131, 255, 0.86) 252deg,
      rgba(157, 91, 255, 0.84) 310deg,
      rgba(255, 237, 132, 0.76) 360deg
    );
    filter: blur(5px);
    opacity: 0.82;
  }

  .privacy-flow__halo::after {
    inset: -8px;
    padding: 3px;
    background: conic-gradient(
      from var(--flow-angle),
      rgba(244, 183, 40, 0.48) 6deg,
      rgba(194, 103, 255, 0.72) 142deg,
      rgba(224, 190, 255, 0.7) 188deg,
      rgba(75, 131, 255, 0.56) 258deg,
      rgba(177, 91, 255, 0.68) 318deg,
      rgba(244, 183, 40, 0.48) 366deg
    );
    filter: blur(12px);
    opacity: 0.44;
  }
}

@media (max-width: 639px) {
  .privacy-flow__halo {
    box-shadow:
      -11px 0 28px rgba(244, 183, 40, 0.45),
      11px 0 29px rgba(75, 131, 255, 0.44),
      -8px 12px 31px rgba(158, 73, 255, 0.33),
      8px 12px 33px rgba(201, 109, 255, 0.36),
      0 15px 36px rgba(196, 111, 255, 0.26);
  }

  #swapForm::after {
    inset: 0;
  }

  .privacy-flow__halo::before {
    inset: -2px;
    padding: 1px;
    filter: blur(4px);
  }

  .privacy-flow__halo::after {
    inset: -5px;
    padding: 2px;
    filter: blur(8px);
  }
}
