.svx-cast {
    --cast-line: color-mix(in srgb, var(--text) 26%, transparent);
    --cast-ring: color-mix(in srgb, var(--text) 12%, transparent);
    --cast-card-w: 27%;
    position: relative;
    width: 100%;
    max-width: 560px;
    aspect-ratio: 1 / 1.08;
    margin-inline: auto;
}

.svx-cast-lines {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    overflow: visible;
}

.svx-cast-path {
    fill: none;
    stroke: var(--cast-line);
    stroke-width: 1.5;
    stroke-dasharray: 5 6;
    stroke-linecap: round;
    opacity: 0;
}

.svx-cast-spark {
    fill: var(--accent);
    opacity: 0;
}

.svx-cast.is-in .svx-cast-path,
.svx-cast.is-in .svx-cast-spark {
    animation: svx-cast-line-in 0.6s ease 0.15s both;
}

.svx-cast-hub {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 30%;
    aspect-ratio: 1;
    translate: -50% -50%;
    pointer-events: none;
}

.svx-cast-hub i {
    position: absolute;
    inset: 0;
    border: 1px solid var(--cast-ring);
    border-radius: 50%;
}

.svx-cast-hub i + i {
    inset: 28%;
    border-color: color-mix(in srgb, var(--text) 18%, transparent);
}

.svx-cast-hub b {
    position: absolute;
    inset: 41%;
    border-radius: 50%;
    background: var(--accent);
    box-shadow: 0 0 0 6px color-mix(in srgb, var(--accent) 12%, transparent);
}

.svx-cast.is-in .svx-cast-hub i:first-child {
    animation: svx-cast-pulse 3.2s ease-out infinite;
}

.svx-cast-card {
    position: absolute;
    z-index: 1;
    width: var(--cast-card-w);
    aspect-ratio: 4 / 5;
    overflow: hidden;
    border: 4px solid var(--bg);
    border-radius: 18px;
    background: var(--surface-2);
    box-shadow: var(--shadow-lg);
    opacity: 0;
    translate: -50% -50%;
    scale: 0.86;
}

.svx-cast-card img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center top;
    transition: opacity 0.45s ease;
}

.svx-cast-card.is-swap img,
.svx-cast-card.is-swap .svx-cast-name {
    opacity: 0;
}

.svx-cast-name {
    position: absolute;
    left: 8px;
    bottom: 8px;
    padding: 4px 9px;
    border-radius: 999px;
    background: color-mix(in srgb, var(--bg) 86%, transparent);
    color: var(--text);
    font: 600 12px/1.2 var(--font);
    transition: opacity 0.45s ease;
}

.svx-cast-card.is-1 { left: 23%; top: 18%; --float: -7px; --float-time: 5.2s; }
.svx-cast-card.is-2 { left: 73%; top: 14%; --float: 6px; --float-time: 6.1s; }
.svx-cast-card.is-3 { left: 16%; top: 57%; --float: 5px; --float-time: 5.6s; }
.svx-cast-card.is-4 { left: 83%; top: 52%; --float: -6px; --float-time: 6.6s; }
.svx-cast-card.is-5 { left: 50%; top: 85%; --float: -5px; --float-time: 5.9s; }

.svx-cast.is-in .svx-cast-card {
    animation: svx-cast-card-in 0.7s cubic-bezier(0.2, 0.8, 0.2, 1) both, svx-cast-float var(--float-time) ease-in-out 0.9s infinite alternate;
}

.svx-cast.is-in .svx-cast-card.is-2 { animation-delay: 0.08s, 0.98s; }
.svx-cast.is-in .svx-cast-card.is-3 { animation-delay: 0.16s, 1.06s; }
.svx-cast.is-in .svx-cast-card.is-4 { animation-delay: 0.24s, 1.14s; }
.svx-cast.is-in .svx-cast-card.is-5 { animation-delay: 0.32s, 1.22s; }

@keyframes svx-cast-card-in {
    from {
        opacity: 0;
        scale: 0.86;
    }

    to {
        opacity: 1;
        scale: 1;
    }
}

@keyframes svx-cast-float {
    from {
        opacity: 1;
        scale: 1;
        transform: translateY(0);
    }

    to {
        opacity: 1;
        scale: 1;
        transform: translateY(var(--float));
    }
}

@keyframes svx-cast-line-in {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

@keyframes svx-cast-pulse {
    0% {
        scale: 0.55;
        opacity: 0.9;
    }

    100% {
        scale: 1.25;
        opacity: 0;
    }
}

@media (max-width: 640px) {
    .svx-cast {
        --cast-card-w: 29%;
    }

    .svx-cast-card {
        border-width: 3px;
        border-radius: 14px;
    }

    .svx-cast-name {
        left: 6px;
        bottom: 6px;
        font-size: 11px;
    }
}
