/* ============================================================
   Boot splash + blazor-error-ui.
   Loaded first; uses raw colors so it works before the Mud theme
   is initialized (tokens.css custom properties are fine to use
   from here).
   ============================================================ */

/* --- WOW boot splash: cosmos + animated mark + shimmer progress ------- */

.video-boot {
    --yg-boot-progress: var(--blazor-load-percentage, 0%);
    position: fixed;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    z-index: 2147483647;
    font-family: "Inter", "Roboto Flex", "Segoe UI", system-ui, sans-serif;
    color: #f1f5f9;
    background: radial-gradient(ellipse 120% 90% at 50% 0%, #2b1d6b 0%, #120a35 45%, #070417 100%);
    isolation: isolate;
    opacity: 1;
    transition: opacity 600ms cubic-bezier(0.2, 0, 0, 1);
    user-select: none;
    -webkit-user-select: none;
    cursor: default;
}

.video-boot--leaving {
    opacity: 0;
    pointer-events: none;
}

/* Floating blurred orbs in the background. */
.video-boot::before,
.video-boot::after,
.video-boot-orb {
    content: "";
    position: absolute;
    pointer-events: none;
    border-radius: 50%;
    filter: blur(60px);
    mix-blend-mode: screen;
    opacity: 0.75;
    z-index: -1;
}

.video-boot::before {
    top: -10%;
    left: -10%;
    width: 52vmin;
    height: 52vmin;
    background: radial-gradient(circle at 30% 30%, #8b5cf6, transparent 60%);
    animation: yg-boot-orb 14s ease-in-out infinite alternate;
}

.video-boot::after {
    bottom: -15%;
    right: -12%;
    width: 60vmin;
    height: 60vmin;
    background: radial-gradient(circle at 70% 70%, #ec4899, transparent 60%);
    animation: yg-boot-orb 18s ease-in-out infinite alternate-reverse;
}

.video-boot-orb {
    top: 48%;
    left: 46%;
    width: 38vmin;
    height: 38vmin;
    background: radial-gradient(circle at 50% 50%, #60a5fa, transparent 60%);
    animation: yg-boot-orb 22s ease-in-out infinite alternate;
    transform: translate(-50%, -50%);
}

@keyframes yg-boot-orb {
    0% { transform: translate3d(-6%, 4%, 0) scale(0.95); }
    50% { transform: translate3d(8%, -3%, 0) scale(1.08); }
    100% { transform: translate3d(-4%, 6%, 0) scale(1); }
}

.video-boot-inner {
    position: relative;
    width: min(24rem, 100%);
    padding: 2rem;
    text-align: center;
    display: grid;
    gap: 1.25rem;
    justify-items: center;
}

/* Star field — tiny twinkling particles drifting behind the mark. */
.video-boot-stars {
    position: absolute;
    inset: 0;
    pointer-events: none;
    z-index: -1;
}

.video-boot-stars > span {
    position: absolute;
    width: 3px;
    height: 3px;
    border-radius: 50%;
    background: radial-gradient(circle, #f8fafc 0%, rgba(248, 250, 252, 0.2) 60%, transparent 100%);
    box-shadow: 0 0 8px rgba(248, 250, 252, 0.4);
    opacity: 0;
    animation: yg-boot-star 5s ease-in-out infinite;
}

.video-boot-stars > span:nth-child(1)  { top: 14%; left: 22%; animation-delay: 0.00s; width: 2px; height: 2px; }
.video-boot-stars > span:nth-child(2)  { top: 18%; left: 78%; animation-delay: 0.45s; }
.video-boot-stars > span:nth-child(3)  { top: 36%; left: 12%; animation-delay: 1.20s; }
.video-boot-stars > span:nth-child(4)  { top: 68%; left: 84%; animation-delay: 1.80s; width: 2px; height: 2px; }
.video-boot-stars > span:nth-child(5)  { top: 82%; left: 18%; animation-delay: 0.90s; }
.video-boot-stars > span:nth-child(6)  { top: 88%; left: 72%; animation-delay: 2.10s; width: 4px; height: 4px; }
.video-boot-stars > span:nth-child(7)  { top: 24%; left: 48%; animation-delay: 2.60s; }
.video-boot-stars > span:nth-child(8)  { top: 54%; left: 6%;  animation-delay: 3.20s; width: 2px; height: 2px; }
.video-boot-stars > span:nth-child(9)  { top: 44%; left: 94%; animation-delay: 1.50s; }
.video-boot-stars > span:nth-child(10) { top: 8%;  left: 56%; animation-delay: 3.60s; }
.video-boot-stars > span:nth-child(11) { top: 72%; left: 38%; animation-delay: 0.30s; }
.video-boot-stars > span:nth-child(12) { top: 28%; left: 30%; animation-delay: 4.10s; width: 2px; height: 2px; }
.video-boot-stars > span:nth-child(13) { top: 62%; left: 64%; animation-delay: 2.80s; }
.video-boot-stars > span:nth-child(14) { top: 92%; left: 42%; animation-delay: 1.00s; }
.video-boot-stars > span:nth-child(15) { top: 4%;  left: 88%; animation-delay: 3.40s; width: 4px; height: 4px; }
.video-boot-stars > span:nth-child(16) { top: 50%; left: 52%; animation-delay: 0.70s; width: 2px; height: 2px; }
.video-boot-stars > span:nth-child(17) { top: 34%; left: 70%; animation-delay: 2.30s; }
.video-boot-stars > span:nth-child(18) { top: 76%; left: 28%; animation-delay: 4.50s; }
.video-boot-stars > span:nth-child(19) { top: 12%; left: 40%; animation-delay: 3.00s; width: 2px; height: 2px; }
.video-boot-stars > span:nth-child(20) { top: 64%; left: 80%; animation-delay: 0.15s; }

@keyframes yg-boot-star {
    0%, 100% { opacity: 0; transform: scale(0.6); }
    50%      { opacity: 0.95; transform: scale(1.1); }
}

/* Circular progress ring around YG mark. */
.video-boot-brand {
    position: relative;
    width: 9rem;
    height: 9rem;
    display: grid;
    place-items: center;
}

.video-boot-ring {
    position: absolute;
    inset: 0;
    border-radius: 50%;
    background: conic-gradient(from 220deg, #a78bfa, #f472b6, #60a5fa, #a78bfa);
    padding: 2px;
    -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
    -webkit-mask-composite: xor;
            mask-composite: exclude;
    opacity: 0.4;
    filter: blur(1px);
    animation: yg-boot-rotate 9s linear infinite;
}

.video-boot-ring--outer {
    inset: -1.25rem;
    padding: 1px;
    opacity: 0.2;
    filter: blur(2px);
    animation: yg-boot-rotate 22s linear infinite reverse;
    background: conic-gradient(from 40deg, transparent 0deg, #8b5cf6 60deg, transparent 140deg, #ec4899 200deg, transparent 280deg, #60a5fa 340deg, transparent 360deg);
}

.video-boot-brand::after {
    content: "";
    position: absolute;
    inset: 6%;
    border-radius: 50%;
    background: radial-gradient(circle at 50% 50%, rgba(167, 139, 250, 0.28), transparent 70%);
    animation: yg-boot-pulse 2.2s ease-in-out infinite;
}

.video-boot-mark {
    position: relative;
    display: inline-grid;
    place-items: center;
    width: 5rem;
    height: 5rem;
    border-radius: 50%;
    background: linear-gradient(135deg, #a78bfa 0%, #7c3aed 60%, #6d28d9 100%);
    color: #f8fafc;
    font-family: "Inter", "Roboto Flex", "Segoe UI", system-ui, sans-serif;
    font-weight: 700;
    font-size: 1.9rem;
    letter-spacing: -0.03em;
    box-shadow:
        0 20px 60px -10px rgba(139, 92, 246, 0.55),
        0 0 0 1px rgba(255, 255, 255, 0.08) inset;
    animation: yg-boot-mark-in 600ms cubic-bezier(0.34, 1.56, 0.64, 1) both,
               yg-boot-float 4s ease-in-out 600ms infinite alternate;
}

.video-boot-name {
    display: flex;
    gap: 0.08em;
    justify-content: center;
    font-family: "Inter", "Roboto Flex", "Segoe UI", system-ui, sans-serif;
    font-weight: 600;
    font-size: 1.35rem;
    letter-spacing: 0.22em;
    text-transform: uppercase;
    color: rgba(248, 250, 252, 0.92);
}

.video-boot-name > span {
    display: inline-block;
    transform: translateY(6px);
    opacity: 0;
    animation: yg-boot-letter 520ms cubic-bezier(0.2, 0, 0, 1) forwards;
}

.video-boot-name > span:nth-child(1) { animation-delay: 0.15s; }
.video-boot-name > span:nth-child(2) { animation-delay: 0.25s; }
.video-boot-name > span:nth-child(3) { animation-delay: 0.35s; }
.video-boot-name > span:nth-child(4) { animation-delay: 0.45s; }
.video-boot-name > span:nth-child(5) { animation-delay: 0.55s; }
.video-boot-name > span:nth-child(6) { animation-delay: 0.65s; }
.video-boot-name > span:nth-child(7) { animation-delay: 0.75s; }

.video-boot-lead {
    margin: 0;
    font-size: 0.9375rem;
    font-weight: 500;
    color: rgba(226, 232, 240, 0.72);
    letter-spacing: 0.02em;
    opacity: 0;
    animation: yg-boot-fade-in 700ms ease-out 0.85s forwards;
}

.video-boot-bar {
    position: relative;
    width: min(16rem, 100%);
    height: 6px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.08);
    overflow: hidden;
    box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.04) inset;
    opacity: 0;
    animation: yg-boot-fade-in 700ms ease-out 1s forwards;
}

.video-boot-bar-fill {
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: var(--blazor-load-percentage, 0%);
    max-width: 100%;
    border-radius: inherit;
    background: linear-gradient(90deg, #8b5cf6 0%, #ec4899 50%, #60a5fa 100%);
    background-size: 200% 100%;
    box-shadow: 0 0 24px rgba(167, 139, 250, 0.6);
    animation: yg-boot-bar-shimmer 2.4s linear infinite;
    transition: width 160ms cubic-bezier(0.2, 0, 0, 1);
}

.video-boot-bar-fill::after {
    content: "";
    position: absolute;
    top: 0;
    right: -10%;
    width: 20%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.6), transparent);
    animation: yg-boot-bar-sheen 1.6s linear infinite;
}

/* When Blazor hasn't reported progress yet, show an indeterminate sweep. */
.video-boot:not([data-blazor-progress]) .video-boot-bar-fill,
.video-boot-bar-fill:not([style*="--blazor"]) {
    /* no-op placeholder */
}

.video-boot-hint.loading-progress-text {
    min-height: 1.25rem;
    margin: 0;
    font-size: 0.8125rem;
    font-weight: 500;
    font-family: "JetBrains Mono", "IBM Plex Mono", "SFMono-Regular", Consolas, monospace;
    color: rgba(148, 163, 184, 0.78);
    letter-spacing: 0.04em;
    opacity: 0;
    animation: yg-boot-fade-in 700ms ease-out 1.15s forwards;
}

.video-boot-hint.loading-progress-text::before {
    content: var(--blazor-load-percentage-text, "Loading runtime");
    text-transform: uppercase;
}

@keyframes yg-boot-mark-in {
    0%   { opacity: 0; transform: scale(0.4) rotate(-8deg); }
    60%  { opacity: 1; transform: scale(1.08) rotate(2deg); }
    100% { opacity: 1; transform: scale(1) rotate(0); }
}

@keyframes yg-boot-float {
    0%   { transform: translateY(0); }
    100% { transform: translateY(-6px); }
}

@keyframes yg-boot-pulse {
    0%, 100% { opacity: 0.35; transform: scale(0.96); }
    50%      { opacity: 0.75; transform: scale(1.05); }
}

@keyframes yg-boot-rotate {
    to { transform: rotate(360deg); }
}

@keyframes yg-boot-letter {
    to { opacity: 1; transform: translateY(0); }
}

@keyframes yg-boot-fade-in {
    to { opacity: 1; }
}

@keyframes yg-boot-bar-shimmer {
    from { background-position: 0% 0%; }
    to   { background-position: 200% 0%; }
}

@keyframes yg-boot-bar-sheen {
    from { transform: translateX(-150%); }
    to   { transform: translateX(650%); }
}

@media (prefers-reduced-motion: reduce) {
    .video-boot::before,
    .video-boot::after,
    .video-boot-orb,
    .video-boot-stars > span,
    .video-boot-ring,
    .video-boot-mark,
    .video-boot-brand::after,
    .video-boot-name > span,
    .video-boot-bar-fill,
    .video-boot-bar-fill::after,
    .video-boot-lead,
    .video-boot-bar,
    .video-boot-hint.loading-progress-text {
        animation: none !important;
    }
    .video-boot-name > span,
    .video-boot-lead,
    .video-boot-bar,
    .video-boot-hint.loading-progress-text {
        opacity: 1;
        transform: none;
    }
}

/* ---- Blazor error UI ---- */

#blazor-error-ui {
    background: #fffbeb;
    color: #78350f;
    bottom: 0;
    box-shadow: 0 -1px 0 rgb(15 23 42 / 0.06);
    display: none;
    left: 0;
    padding: 0.65rem 1.25rem;
    position: fixed;
    width: 100%;
    z-index: 1000;
    font-size: 0.875rem;
}

#blazor-error-ui .reload {
    color: #7c3aed;
    font-weight: 600;
    margin-left: 0.35rem;
}

#blazor-error-ui .dismiss {
    cursor: pointer;
    position: absolute;
    right: 0.75rem;
    top: 0.55rem;
    opacity: 0.6;
}

/* Embed layout: fullscreen, no chrome, scrollbar-less. */
.yg-embed-shell {
    position: fixed;
    inset: 0;
    display: flex;
    background: #000;
    overflow: hidden;
}

.yg-embed-stage {
    flex: 1;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
}

.yg-embed-stage > .yg-player {
    width: 100%;
    height: 100%;
    border-radius: 0;
    aspect-ratio: auto;
}

.yg-embed-message {
    display: grid;
    gap: 0.75rem;
    justify-items: center;
    color: rgba(255, 255, 255, 0.82);
    font-family: var(--font-heading, "Segoe UI", sans-serif);
    font-size: 1rem;
}
