:root {
    /*
     * Light is the universal fallback.
     * This is used when no data-theme attribute or theme toggle exists.
     */
    --wb-overlay-bg:
        radial-gradient(
            circle at 25% 20%,
            rgba(74, 122, 255, 0.13),
            transparent 30%
        ),
        radial-gradient(
            circle at 78% 75%,
            rgba(124, 77, 255, 0.09),
            transparent 32%
        ),
        rgba(247, 249, 255, 0.96);

    --wb-overlay-panel: rgba(255, 255, 255, 0.78);
    --wb-overlay-border: rgba(66, 99, 180, 0.16);
    --wb-overlay-text: #10162a;
    --wb-overlay-muted: #687493;
    --wb-overlay-primary: #4a7aff;
    --wb-overlay-secondary: #7c4dff;
    --wb-overlay-shadow: 0 24px 70px rgba(61, 78, 125, 0.18);
}

html[data-theme="light"] {
    color-scheme: light;
}

html[data-theme="dark"] {
    color-scheme: dark;

    --wb-overlay-bg:
        radial-gradient(
            circle at 25% 20%,
            rgba(74, 122, 255, 0.2),
            transparent 30%
        ),
        radial-gradient(
            circle at 78% 75%,
            rgba(124, 77, 255, 0.16),
            transparent 32%
        ),
        rgba(7, 10, 22, 0.96);

    --wb-overlay-panel: rgba(17, 23, 43, 0.76);
    --wb-overlay-border: rgba(120, 155, 255, 0.18);
    --wb-overlay-text: #f3f6ff;
    --wb-overlay-muted: #8798c4;
    --wb-overlay-primary: #7c9cff;
    --wb-overlay-secondary: #a98cff;
    --wb-overlay-shadow: 0 28px 90px rgba(0, 0, 0, 0.42);
}

/* Overlay */
.wb-overlay {
    position: fixed;
    inset: 0;
    z-index: 99999;

    display: flex;
    align-items: center;
    justify-content: center;

    padding: 1rem;

    color: var(--wb-overlay-text);
    background: var(--wb-overlay-bg);

    opacity: 1;
    visibility: visible;

    backdrop-filter: blur(18px) saturate(150%);
    -webkit-backdrop-filter: blur(18px) saturate(150%);

    transition:
        opacity 0.22s ease,
        visibility 0.22s ease;
}

.wb-overlay.d-none {
    display: none !important;
}

.wb-overlay.wb-overlay-hiding {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

.wb-overlay-content {
    min-width: min(310px, calc(100vw - 2rem));
    padding: 1.35rem 1.5rem;

    border: 1px solid var(--wb-overlay-border);
    border-radius: 1.4rem;

    background: var(--wb-overlay-panel);
    box-shadow: var(--wb-overlay-shadow);

    text-align: center;

    backdrop-filter: blur(20px) saturate(165%);
    -webkit-backdrop-filter: blur(20px) saturate(165%);
}

.wb-overlay-brand {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.16rem;
}

.spinner-letter {
    display: inline-block;

    font-size: clamp(2rem, 7vw, 3.25rem);
    font-weight: 950;
    line-height: 1;
    letter-spacing: -0.08em;

    animation: wb-letter-pulse 1.15s ease-in-out infinite;
    transform-origin: center;
}

.spinner-letter:nth-child(2) {
    animation-delay: 0.12s;
}

.spinner-letter:nth-child(3) {
    animation-delay: 0.24s;
}

.spinner-letter:nth-child(4) {
    animation-delay: 0.36s;
}

.wb-letter-primary {
    color: var(--wb-overlay-primary);
}

.wb-letter-secondary {
    color: var(--wb-overlay-secondary);
}

.wb-overlay-message {
    margin-top: 0.85rem;

    color: var(--wb-overlay-muted);
    font-size: 0.82rem;
    font-weight: 800;
    line-height: 1.5;
}

.wb-overlay-message-inner {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.55rem;
}

.wb-overlay-message-spinner {
    width: 0.9rem;
    height: 0.9rem;

    border: 2px solid color-mix(
        in srgb,
        var(--wb-overlay-primary) 24%,
        transparent
    );

    border-top-color: var(--wb-overlay-primary);
    border-radius: 999px;

    animation: wb-spin 0.75s linear infinite;
}

.wb-overlay-img {
    max-width: min(40%, 320px);
    max-height: 40vh;
    border-radius: 1rem;
}

@keyframes wb-letter-pulse {
    0%,
    100% {
        opacity: 0.48;
        transform: translateY(0) scale(0.96);
    }

    50% {
        opacity: 1;
        transform: translateY(-4px) scale(1.04);
    }
}

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

@media (prefers-reduced-motion: reduce) {
    .spinner-letter,
    .wb-overlay-message-spinner {
        animation: none;
    }

    .wb-overlay {
        transition: none;
    }
}
