 /* Registering a custom property lets us animate the conic-gradient angle */
  @property --angle {
    syntax: "<angle>";
    initial-value: 90deg;
    inherits: false;
  }
 
  @property --shimmer-x {
    syntax: "<percentage>";
    initial-value: -40%;
    inherits: false;
  }
 
  *,
  *::before,
  *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
  }
 
  body {
    display: grid;
    place-items: center;
    min-height: 100vh;
    background: #f0f4f8;
    font-family: system-ui, -apple-system, sans-serif;
  }
 
  /* --------------------------------------------------------
     Base button
  -------------------------------------------------------- */
  .button {
    --angle: 90deg;
    --shimmer-x: -40%;
 
    position: relative;
    cursor: pointer;
    font-size: 1rem;
    font-weight: 500;
    color: #1a1a2e;
    border: 3px solid transparent;
    border-radius: 3rem;
    padding: 0;
    background:
      linear-gradient(#fff, #fff) padding-box,
      conic-gradient(
        from var(--angle) at 50% 50%,
        #3492ef 18deg,
        #f9c741 161deg,
        #ff77c7 201deg,
        rgba(137, 254, 69, 0.75) 340deg,
        #3492ef 1turn
      ) border-box;
    overflow: hidden;
    isolation: isolate;
    outline-offset: 4px;
 
    transition:
      box-shadow 0.35s ease,
      transform 0.2s ease,
      --angle 0.6s ease,
      border-width 0.25s ease;
  }
 
  /* --------------------------------------------------------
     Shimmer sweep – a diagonal highlight that slides across
  -------------------------------------------------------- */
  .button::before {
    content: "";
    position: absolute;
    inset: 0;
    border-radius: inherit;
    background: linear-gradient(
      110deg,
      transparent 20%,
      rgba(255, 255, 255, 0.55) 45%,
      rgba(255, 255, 255, 0.8) 50%,
      rgba(255, 255, 255, 0.55) 55%,
      transparent 80%
    );
    background-size: 250% 100%;
    background-position-x: var(--shimmer-x);
    opacity: 0;
    z-index: 1;
    pointer-events: none;
    transition:
      opacity 0.3s ease,
      --shimmer-x 0.6s ease;
  }
 
  /* --------------------------------------------------------
     Soft glow layer behind the button
  -------------------------------------------------------- */
  .button::after {
    content: "";
    position: absolute;
    inset: -6px;
    border-radius: inherit;
    background: conic-gradient(
      from var(--angle) at 50% 50%,
      #3492ef 18deg,
      #f9c741 161deg,
      #ff77c7 201deg,
      rgba(137, 254, 69, 0.75) 340deg,
      #3492ef 1turn
    );
    filter: blur(14px);
    opacity: 0;
    z-index: -1;
    transition:
      opacity 0.4s ease,
      --angle 0.6s ease;
  }
 
  /* --------------------------------------------------------
     HOVER — rotate gradient + shimmer sweep + glow
  -------------------------------------------------------- */
  .button:hover {
    --angle: 270deg;
    --shimmer-x: 120%;
    box-shadow:
      0 0 18px rgba(52, 146, 239, 0.25),
      0 0 40px rgba(255, 119, 199, 0.15);
    transform: translateY(-1px);
  }
 
  .button:hover::before {
    opacity: 0;
  }
 
  .button:hover::after {
    opacity: 0.5;
  }
 
  /* continuous spin while hovering */
  @keyframes spin {
    to { --angle: 450deg; }
  }
 
  .button:hover {
    animation: spin 2.5s linear infinite;
  }
 
  /* --------------------------------------------------------
     FOCUS-VISIBLE — similar glow, accessible ring
  -------------------------------------------------------- */
  .button:focus-visible {
    --angle: 270deg;
    outline: 2px solid #3492ef;
    box-shadow:
      0 0 18px rgba(52, 146, 239, 0.3),
      0 0 40px rgba(255, 119, 199, 0.2);
    animation: spin 2.5s linear infinite;
  }
 
  .button:focus-visible::after {
    opacity: 0.45;
  }
 
  /* --------------------------------------------------------
     ACTIVE — press-in feel
  -------------------------------------------------------- */
  .button:active {
    transform: translateY(1px) scale(0.97);
    box-shadow:
      0 0 8px rgba(52, 146, 239, 0.35),
      0 0 24px rgba(255, 119, 199, 0.25),
      inset 0 1px 4px rgba(0, 0, 0, 0.1);
    transition-duration: 0.08s;
  }
 
  .button:active::before {
    opacity: 0;
  }
 
  /* --------------------------------------------------------
     Label – sits above the shimmer layer
  -------------------------------------------------------- */
  .button span {
    position: relative;
    z-index: 2;
    display: block;
    background: #fff;
    border-radius: 3rem;
    padding: 0.65rem 1.5rem;
  }