.pa {
    --pa-orb-edge: rgba(15, 43, 91, 0.22);
    --pa-orb-shine: radial-gradient(circle at 32% 26%, rgba(255, 255, 255, 0.72), rgba(255, 255, 255, 0) 55%);
    --pa-orb-halo: radial-gradient(closest-side, rgba(0, 180, 216, 0.55), rgba(0, 180, 216, 0));
    --pa-orb-swirl: conic-gradient(rgba(255, 255, 255, 0), rgba(255, 255, 255, 0.65) 25%, rgba(255, 255, 255, 0) 50%, rgba(103, 216, 234, 0.55) 75%, rgba(255, 255, 255, 0));
}

html.dark .pa {
    --pa-orb-edge: rgba(255, 255, 255, 0.16);
    --pa-orb-halo: radial-gradient(closest-side, rgba(34, 211, 238, 0.6), rgba(34, 211, 238, 0));
}

.pa-orb {
    position: relative;
    display: inline-block;
    flex: none;
    width: var(--pa-orb-size, 40px);
    height: var(--pa-orb-size, 40px);
    vertical-align: middle;
    border-radius: 50%;
}

.pa-orb-glow,
.pa-orb-ring,
.pa-orb-core,
.pa-orb-swirl,
.pa-orb-beat {
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    display: block;
    border-radius: 50%;
    transition: opacity 300ms var(--pa-ease);
}

.pa-orb-glow,
.pa-orb-beat {
    top: -28%;
    right: -28%;
    bottom: -28%;
    left: -28%;
    background-image: var(--pa-orb-halo);
}

.pa-orb-glow {
    opacity: 0.55;
}

.pa-orb-ring {
    top: -8%;
    right: -8%;
    bottom: -8%;
    left: -8%;
    border: 2px solid var(--pa-live);
    opacity: 0;
}

.pa-orb-core {
    background-image: var(--pa-orb-shine), var(--pa-gradient);
    box-shadow: inset 0 0 0 1px var(--pa-orb-edge);
}

.pa-orb-swirl,
.pa-orb-beat {
    opacity: 0;
}

.pa-orb-swirl {
    background-image: var(--pa-orb-swirl);
}

.pa-orb--listening .pa-orb-glow,
.pa-orb--speaking .pa-orb-glow {
    opacity: 0.9;
}

.pa-orb--listening .pa-orb-ring {
    opacity: 0.45;
}

.pa-orb--thinking .pa-orb-swirl {
    opacity: 0.8;
}

@keyframes pa-orb-breathe {
    0%,
    100% {
        opacity: 0.45;
        transform: scale(0.92);
    }

    50% {
        opacity: 0.95;
        transform: scale(1.06);
    }
}

@keyframes pa-orb-ripple {
    0% {
        opacity: 0;
        transform: scale(1);
    }

    15% {
        opacity: 0.6;
    }

    100% {
        opacity: 0;
        transform: scale(1.55);
    }
}

@keyframes pa-orb-listen {
    0%,
    100% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.04);
    }
}

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

@keyframes pa-orb-talk {
    from {
        transform: scale(0.98);
    }

    to {
        transform: scale(1.05);
    }
}

@keyframes pa-orb-beat {
    from {
        opacity: 0.75;
        transform: scale(0.9);
    }

    to {
        opacity: 0;
        transform: scale(1.2);
    }
}

@keyframes pa-orb-breathe-soft {
    0%,
    100% {
        opacity: 0.4;
    }

    50% {
        opacity: 0.9;
    }
}

@keyframes pa-orb-ripple-soft {
    0%,
    100% {
        opacity: 0;
    }

    50% {
        opacity: 0.55;
    }
}

@keyframes pa-orb-shimmer-soft {
    0%,
    100% {
        opacity: 0.25;
    }

    50% {
        opacity: 0.85;
    }
}

@keyframes pa-orb-talk-soft {
    from {
        opacity: 0.55;
    }

    to {
        opacity: 1;
    }
}

@keyframes pa-orb-beat-soft {
    from {
        opacity: 0.6;
    }

    to {
        opacity: 0;
    }
}

@media (prefers-reduced-motion: no-preference) {
    .pa-orb--idle .pa-orb-glow {
        animation: pa-orb-breathe 4200ms ease-in-out 3;
    }

    .pa-orb--listening .pa-orb-ring {
        animation: pa-orb-ripple 1600ms ease-out infinite;
    }

    .pa-orb--listening .pa-orb-ring--late {
        animation: pa-orb-ripple 1600ms ease-out 800ms infinite backwards;
    }

    .pa-orb--listening .pa-orb-core {
        animation: pa-orb-listen 1600ms ease-in-out infinite;
    }

    .pa-orb--thinking .pa-orb-swirl {
        animation: pa-orb-spin 1400ms linear infinite;
    }

    .pa-orb--speaking .pa-orb-core {
        animation: pa-orb-talk 700ms ease-in-out infinite alternate;
    }

    .pa-orb--speaking .pa-orb-beat {
        animation: pa-orb-beat 320ms ease-out;
    }
}

@media (prefers-reduced-motion: reduce) {
    .pa-orb--idle .pa-orb-glow {
        animation: pa-orb-breathe-soft 4200ms ease-in-out 3;
    }

    .pa-orb--listening .pa-orb-ring {
        animation: pa-orb-ripple-soft 1600ms ease-in-out infinite;
    }

    .pa-orb--listening .pa-orb-ring--late {
        animation: pa-orb-ripple-soft 1600ms ease-in-out 800ms infinite backwards;
    }

    .pa-orb--thinking .pa-orb-swirl {
        animation: pa-orb-shimmer-soft 1400ms ease-in-out infinite;
    }

    .pa-orb--speaking .pa-orb-glow {
        animation: pa-orb-talk-soft 700ms ease-in-out infinite alternate;
    }

    .pa-orb--speaking .pa-orb-beat {
        animation: pa-orb-beat-soft 320ms ease-out;
    }
}

@media (forced-colors: active) {
    .pa-orb-core {
        border: 1px solid CanvasText;
    }
}
