:root {
  --ink: #07060d;
  --purple: #c084fc;
  --cyan: #22d3ee;
}

body {
  margin: 0;
  color-scheme: dark;
  background: var(--ink);
  overflow-x: hidden;
}

::selection {
  background: rgba(34, 211, 238, 0.28);
  color: #fff;
}

.ambient {
  position: fixed;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  pointer-events: none;
}

.ambient .grid {
  position: absolute;
  inset: -25%;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.045) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.045) 1px, transparent 1px);
  background-size: 68px 68px;
  mask-image: radial-gradient(circle at center, #000 20%, transparent 70%);
  animation: grid-drift 32s linear infinite;
}

.orb {
  position: absolute;
  border-radius: 999px;
  filter: blur(46px);
}

.orb-purple {
  top: -8rem;
  left: -8rem;
  width: 28rem;
  height: 28rem;
  background: rgba(168, 85, 247, 0.42);
  animation: drift-a 18s ease-in-out infinite;
}

.orb-cyan {
  right: -8rem;
  bottom: -7rem;
  width: 26rem;
  height: 26rem;
  background: rgba(34, 211, 238, 0.28);
  animation: drift-b 20s ease-in-out infinite;
}

.orb-fuchsia {
  bottom: 18%;
  left: 42%;
  width: 16rem;
  height: 16rem;
  background: rgba(232, 121, 249, 0.18);
  animation: drift-c 15s ease-in-out infinite;
}

.spark {
  position: absolute;
  width: 5px;
  height: 5px;
  border-radius: 999px;
  background: #fff;
  box-shadow: 0 0 14px var(--cyan);
  animation: twinkle 3.8s ease-in-out infinite;
}

.stage {
  position: relative;
  z-index: 1;
}

.card-frame {
  border-radius: 1.8rem;
  padding: 1px;
  background: linear-gradient(
    130deg,
    rgba(192, 132, 252, 0.95),
    rgba(255, 255, 255, 0.12) 35%,
    rgba(34, 211, 238, 0.9) 68%,
    rgba(192, 132, 252, 0.55)
  );
  background-size: 240% 240%;
  animation: border-flow 9s ease infinite, rise 0.8s cubic-bezier(0.16, 1, 0.3, 1) both;
  box-shadow:
    0 24px 80px rgba(0, 0, 0, 0.5),
    0 0 90px rgba(168, 85, 247, 0.18);
}

.card-inner {
  border-radius: calc(1.8rem - 1px);
  background:
    radial-gradient(circle at 0% 0%, rgba(168, 85, 247, 0.16), transparent 42%),
    rgba(9, 7, 16, 0.82);
  backdrop-filter: blur(22px);
}

.logo-mark {
  display: block;
  filter: drop-shadow(0 0 16px rgba(168, 85, 247, 0.55));
  animation: logo-float 5.5s ease-in-out infinite;
}

.logo-ring {
  transform-origin: 32px 32px;
  transform-box: view-box;
  animation: spin 16s linear infinite;
}

.logo-link {
  stroke-dasharray: 100;
  stroke-dashoffset: 100;
  animation: draw 1.15s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.logo-link-b {
  animation-delay: 0.16s;
}

.logo-hole {
  opacity: 0;
  animation: fade-in 0.25s 0.72s forwards;
}

.logo-spark {
  transform-box: fill-box;
  transform-origin: center;
  animation:
    spark-in 0.55s 0.78s cubic-bezier(0.16, 1, 0.3, 1) both,
    spark-pulse 2.6s 1.45s ease-in-out infinite;
}

.guru-shimmer {
  background-image: linear-gradient(100deg, #c084fc 0%, #f5d0fe 22%, #67e8f9 48%, #c084fc 74%, #67e8f9 100%);
  background-size: 220% auto;
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  animation: shimmer 5.5s linear infinite;
}

#shorten-button {
  position: relative;
  overflow: hidden;
  isolation: isolate;
}

#shorten-button::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(110deg, transparent 18%, rgba(255, 255, 255, 0.55) 48%, transparent 78%);
  transform: translateX(-130%);
  pointer-events: none;
}

#shorten-button:hover::after,
#shorten-button:focus-visible::after {
  animation: shine 0.85s ease;
}

#shorten-button.is-loading {
  animation: btn-pulse 1.15s ease-in-out infinite;
}

#original-url {
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

#original-url:focus {
  box-shadow:
    0 0 0 3px rgba(34, 211, 238, 0.16),
    0 0 28px rgba(168, 85, 247, 0.28);
}

#error-message.shake {
  animation: shake 0.42s ease;
}

#result.result-in {
  animation: result-in 0.48s cubic-bezier(0.16, 1, 0.3, 1);
}

#copy-button.is-copied {
  border-color: rgba(34, 211, 238, 0.75);
  color: #a5f3fc;
  animation: pop 0.35s ease;
}

.pill {
  animation: rise 0.75s cubic-bezier(0.16, 1, 0.3, 1) both;
}

.pill:nth-child(1) { animation-delay: 0.18s; }
.pill:nth-child(2) { animation-delay: 0.3s; }
.pill:nth-child(3) { animation-delay: 0.42s; }

@keyframes rise {
  from { opacity: 0; transform: translateY(18px); }
  to { opacity: 1; transform: none; }
}

@keyframes draw {
  to { stroke-dashoffset: 0; }
}

@keyframes fade-in {
  to { opacity: 1; }
}

@keyframes spark-in {
  from { opacity: 0; transform: scale(0.2) rotate(-25deg); }
  to { opacity: 1; transform: scale(1) rotate(0deg); }
}

@keyframes spark-pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.14) rotate(8deg); }
}

@keyframes logo-float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-5px); }
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

@keyframes shimmer {
  to { background-position: 220% center; }
}

@keyframes border-flow {
  0%, 100% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
}

@keyframes drift-a {
  0%, 100% { transform: translate(0, 0) scale(1); }
  50% { transform: translate(40px, 30px) scale(1.08); }
}

@keyframes drift-b {
  0%, 100% { transform: translate(0, 0) scale(1); }
  50% { transform: translate(-36px, -28px) scale(1.1); }
}

@keyframes drift-c {
  0%, 100% { transform: translate(0, 0); }
  50% { transform: translate(-24px, 22px); }
}

@keyframes grid-drift {
  to { transform: translate3d(-68px, -68px, 0); }
}

@keyframes twinkle {
  0%, 100% { opacity: 0.15; transform: scale(0.7); }
  50% { opacity: 0.95; transform: scale(1.3); }
}

@keyframes shine {
  from { transform: translateX(-130%); }
  to { transform: translateX(130%); }
}

@keyframes btn-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(34, 211, 238, 0.0); }
  50% { box-shadow: 0 0 28px rgba(34, 211, 238, 0.35); }
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-6px); }
  75% { transform: translateX(6px); }
}

@keyframes result-in {
  from { opacity: 0; transform: translateY(10px) scale(0.98); }
  to { opacity: 1; transform: none; }
}

@keyframes pop {
  0% { transform: scale(0.96); }
  50% { transform: scale(1.05); }
  100% { transform: scale(1); }
}

.animation-delay-2000 { animation-delay: 2s; }
.animation-delay-4000 { animation-delay: 4s; }

.toast {
  opacity: 0;
  transform: translateY(1rem);
  transition: opacity 0.3s ease, transform 0.3s ease;
}

.toast.is-visible {
  opacity: 1;
  transform: none;
}

.toast[data-tone="ok"] {
  border-color: rgba(52, 211, 153, 0.5);
  background: rgba(16, 185, 129, 0.2);
  color: rgb(110, 231, 183);
}

.toast[data-tone="error"] {
  border-color: rgba(251, 113, 133, 0.5);
  background: rgba(244, 63, 94, 0.2);
  color: rgb(254, 205, 211);
}

.row-fresh {
  background: rgba(168, 85, 247, 0.12);
}

::-webkit-scrollbar { width: 8px; }
::-webkit-scrollbar-track { background: #07060d; }
::-webkit-scrollbar-thumb { background: #334155; border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: #475569; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation: none !important;
    transition: none !important;
  }

  .logo-link { stroke-dashoffset: 0; }
  .logo-spark, .logo-hole { opacity: 1; }
}
