.astral-username-effect {
  --effect-primary: #e1e1e1;
  --effect-secondary: #e1e1e1;
  --effect-tertiary: #e1e1e1;
  --effect-duration: 4s;
  display: inline-block;
  color: var(--effect-primary) !important;
  font-weight: inherit;
}

.effect-speed-slow { --effect-duration: 8s; }
.effect-speed-normal { --effect-duration: 4s; }

.effect-none {
  color: inherit !important;
  background: none !important;
  -webkit-text-fill-color: currentColor;
}

.effect-glow {
  text-shadow: 0 0 3px var(--effect-primary), 0 0 8px var(--effect-primary);
}

.effect-shimmer,
.effect-frost,
.effect-rainbow {
  color: transparent !important;
  background-clip: text !important;
  -webkit-background-clip: text !important;
  -webkit-text-fill-color: transparent;
  background-size: 240px 100% !important;
  background-repeat: repeat-x !important;
  animation: astral-gradient-loop var(--effect-duration) linear infinite;
  will-change: background-position;
}

.effect-gradient {
  color: transparent !important;
  background: linear-gradient(90deg, var(--effect-primary) 0%, var(--effect-secondary) 50%, var(--effect-tertiary) 100%);
  background-clip: text !important;
  -webkit-background-clip: text !important;
  -webkit-text-fill-color: transparent;
  animation: none !important;
}

.effect-shimmer {
  background: linear-gradient(105deg, var(--effect-primary) 20%, #fff 45%, var(--effect-secondary) 55%, var(--effect-primary) 80%);
}

.effect-frost {
  background: linear-gradient(105deg, var(--effect-primary) 20%, #fff 45%, var(--effect-secondary) 55%, var(--effect-primary) 80%);
  filter: drop-shadow(0 0 2px var(--effect-primary));
}

.effect-holographic {
  --sparkle-duration: 1.8s;
  position: relative;
  color: var(--effect-primary) !important;
  text-shadow: 0 0 3px var(--effect-primary);
}

.effect-holographic.effect-speed-slow { --sparkle-duration: 3.6s; }

.effect-sparkle { display: none; }
.effect-holographic .effect-sparkle {
  --sparkle-color: var(--effect-secondary);
  display: block;
  position: absolute;
  z-index: 1;
  width: .3em;
  height: .3em;
  background: var(--sparkle-color);
  clip-path: polygon(50% 0, 58% 42%, 100% 50%, 58% 58%, 50% 100%, 42% 58%, 0 50%, 42% 42%);
  filter: drop-shadow(0 0 3px var(--sparkle-color));
  pointer-events: none;
  animation: astral-sparkle var(--sparkle-duration) ease-in-out infinite;
}

.effect-holographic .effect-sparkle-1 { left: 6%; top: .03em; animation-delay: 0s; }
.effect-holographic .effect-sparkle-2 { left: 18%; top: .55em; animation-delay: -.225s; --sparkle-color: #fff; }
.effect-holographic .effect-sparkle-3 { left: 31%; top: .22em; animation-delay: -.45s; }
.effect-holographic .effect-sparkle-4 { left: 44%; top: .63em; animation-delay: -.675s; }
.effect-holographic .effect-sparkle-5 { left: 57%; top: .06em; animation-delay: -.9s; --sparkle-color: #fff; }
.effect-holographic .effect-sparkle-6 { left: 70%; top: .47em; animation-delay: -1.125s; }
.effect-holographic .effect-sparkle-7 { left: 82%; top: .18em; animation-delay: -1.35s; --sparkle-color: #fff; }
.effect-holographic .effect-sparkle-8 { left: 91%; top: .61em; animation-delay: -1.575s; }

.effect-holographic.effect-speed-slow .effect-sparkle-2 { animation-delay: -.45s; }
.effect-holographic.effect-speed-slow .effect-sparkle-3 { animation-delay: -.9s; }
.effect-holographic.effect-speed-slow .effect-sparkle-4 { animation-delay: -1.35s; }
.effect-holographic.effect-speed-slow .effect-sparkle-5 { animation-delay: -1.8s; }
.effect-holographic.effect-speed-slow .effect-sparkle-6 { animation-delay: -2.25s; }
.effect-holographic.effect-speed-slow .effect-sparkle-7 { animation-delay: -2.7s; }
.effect-holographic.effect-speed-slow .effect-sparkle-8 { animation-delay: -3.15s; }

.effect-holographic.effect-speed-off .effect-sparkle {
  animation: none !important;
  opacity: .75;
  transform: scale(.9);
}

.effect-rainbow {
  background: linear-gradient(90deg, #ff5b5b, #ffd15b, #69e38c, #e1e1e1, #e1e1e1, #ff69c8, #ff5b5b);
}

.effect-speed-off {
  animation: none !important;
  background-position: 50% 0 !important;
}

@keyframes astral-gradient-loop {
  from { background-position: 0 0; }
  to { background-position: 240px 0; }
}

@keyframes astral-sparkle {
  0%, 100% { opacity: 0; transform: scale(.4) rotate(-12deg); }
  35% { opacity: 1; transform: scale(1.3) rotate(12deg); }
  65% { opacity: .42; transform: scale(.8) rotate(25deg); }
  85% { opacity: 0; transform: scale(.4) rotate(32deg); }
}

.username-effect-preview {
  margin: 10px 0 14px;
  padding: 16px;
  border: 1px solid #444;
  border-radius: 4px;
  background: #191919;
  text-align: center;
  font: inherit;
}

.username-effect-controls {
  display: grid;
  grid-template-columns: repeat(2, minmax(150px, 1fr));
  gap: 10px 16px;
  max-width: 560px;
}

.username-effect-controls label { padding: 0; }
.username-effect-controls [hidden] { display: none !important; }
.username-effect-controls select,
.username-effect-controls input[type="color"] { width: 100%; box-sizing: border-box; }
.username-effect-controls input[type="color"] { height: 34px; padding: 2px; }

@media (prefers-reduced-motion: reduce) {
  .astral-username-effect { animation: none !important; }
  .effect-holographic .effect-sparkle { animation: none !important; opacity: .75; transform: scale(.9); }
}

@media only screen and (max-width: 600px) {
  .username-effect-controls { grid-template-columns: 1fr; }
}
