.twitch-oauth-loading {
    position: fixed;
    inset: 0;
    z-index: 999999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    box-sizing: border-box;
    background: rgba(5, 8, 22, 0.88);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.35s ease, visibility 0.35s ease;
}

.twitch-oauth-loading.is-visible {
    opacity: 1;
    visibility: visible;
}

.twitch-oauth-loading__panel {
    position: relative;
    width: 100%;
    max-width: 420px;
    padding: 40px 30px 32px;
    border-radius: 24px;
    text-align: center;
    font-family: 'Plus Jakarta Sans', system-ui, sans-serif;
    background: linear-gradient(155deg, rgba(30, 27, 46, 0.98) 0%, rgba(15, 18, 35, 0.98) 100%);
    box-shadow:
        0 0 0 1px rgba(145, 71, 255, 0.35),
        0 24px 80px rgba(0, 0, 0, 0.55),
        0 0 60px rgba(145, 71, 255, 0.12);
    overflow: visible;
    isolation: isolate;
}

.twitch-oauth-loading__panel::before {
    content: '';
    position: absolute;
    inset: -2px;
    border-radius: inherit;
    padding: 2px;
    background: linear-gradient(
        120deg,
        rgba(145, 71, 255, 0.9),
        rgba(119, 44, 232, 0.5),
        rgba(34, 211, 238, 0.45),
        rgba(145, 71, 255, 0.85)
    );
    background-size: 300% 300%;
    animation: twitchOAuthBorder 4s ease infinite;
    -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
    mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
    -webkit-mask-composite: xor;
    mask-composite: exclude;
    pointer-events: none;
}

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

.twitch-oauth-loading__logo-wrap {
    display: flex;
    justify-content: center;
    margin: 0 auto 22px;
}

.twitch-oauth-loading__logo {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
    padding: 16px 22px;
    border-radius: 16px;
    background: linear-gradient(135deg, #9147ff, #772ce8);
    color: #fff;
    box-shadow: 0 4px 20px rgba(145, 71, 255, 0.35);
    animation: twitchOAuthLogoGlow 2.2s ease-in-out infinite;
}

.twitch-oauth-loading__logo .twitch-oauth-loading__twitch-svg,
.twitch-oauth-loading__logo svg {
    display: block;
    width: 32px;
    height: 32px;
    flex-shrink: 0;
    overflow: visible;
}

@keyframes twitchOAuthLogoGlow {
    0%, 100% {
        box-shadow: 0 4px 20px rgba(145, 71, 255, 0.35);
    }
    50% {
        box-shadow: 0 8px 28px rgba(145, 71, 255, 0.48);
    }
}

.twitch-oauth-loading__title {
    margin: 0 0 8px;
    font-size: 1.25rem;
    font-weight: 800;
    letter-spacing: -0.03em;
    color: #f8fafc;
    line-height: 1.25;
}

.twitch-oauth-loading__sub {
    margin: 0 0 14px;
    font-size: 0.95rem;
    line-height: 1.48;
    color: #b6c3d9;
    font-weight: 500;
    text-wrap: balance;
}

.twitch-oauth-loading__providers {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    margin: 0 0 14px;
}

.twitch-oauth-loading__provider {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 6px 10px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 700;
    line-height: 1;
    border: 1px solid rgba(148, 163, 184, 0.22);
    background: rgba(15, 23, 42, 0.55);
    color: #e2e8f0;
}

.twitch-oauth-loading__provider i {
    width: 15px;
    height: 15px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: currentColor;
}

.twitch-oauth-loading__provider i svg {
    width: 15px;
    height: 15px;
    display: block;
}

.twitch-oauth-loading__provider em {
    font-style: normal;
}

.twitch-oauth-loading__provider.twitch {
    color: #c4b5fd;
    border-color: rgba(145, 71, 255, 0.34);
}

.twitch-oauth-loading__bar {
    height: 4px;
    border-radius: 4px;
    background: rgba(148, 163, 184, 0.2);
    overflow: hidden;
    margin-bottom: 16px;
}

.twitch-oauth-loading__bar-fill {
    height: 100%;
    width: 40%;
    border-radius: 4px;
    background: linear-gradient(90deg, #9147ff, #22d3ee, #9147ff);
    background-size: 200% 100%;
    animation: twitchOAuthBar 1.2s ease-in-out infinite;
}

@keyframes twitchOAuthBar {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(350%); }
}

.twitch-oauth-loading__hint {
    margin: 0;
    font-size: 0.83rem;
    color: #8aa0c2;
    line-height: 1.52;
    text-wrap: pretty;
}

.twitch-oauth-loading__dots {
    display: inline-flex;
    gap: 6px;
    margin-top: 4px;
}

.twitch-oauth-loading__dots span {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #a78bfa;
    animation: twitchOAuthDot 1.4s ease-in-out infinite;
}

.twitch-oauth-loading__dots span:nth-child(2) { animation-delay: 0.2s; }
.twitch-oauth-loading__dots span:nth-child(3) { animation-delay: 0.4s; }

@keyframes twitchOAuthDot {
    0%, 80%, 100% { opacity: 0.35; transform: scale(0.85); }
    40% { opacity: 1; transform: scale(1); }
}

@media (prefers-reduced-motion: reduce) {
    .twitch-oauth-loading__panel::before,
    .twitch-oauth-loading__logo,
    .twitch-oauth-loading__bar-fill,
    .twitch-oauth-loading__dots span {
        animation: none;
    }
    .twitch-oauth-loading__bar-fill {
        width: 100%;
        opacity: 0.6;
    }
}
