:root {
    color-scheme: light;
    --app-shell-bg: #f8fafc;
    --app-shell-surface: rgba(255, 255, 255, 0.88);
    --app-shell-border: rgba(148, 163, 184, 0.26);
    --app-shell-text: #0f172a;
    --app-shell-muted: #64748b;
    --app-shell-primary: #2563eb;
    --app-shell-primary-strong: #1d4ed8;
    --app-shell-shadow: 0 32px 80px -42px rgba(15, 23, 42, 0.45);
}

@media (prefers-color-scheme: dark) {
    :root {
        color-scheme: dark;
        --app-shell-bg: #020617;
        --app-shell-surface: rgba(15, 23, 42, 0.84);
        --app-shell-border: rgba(51, 65, 85, 0.8);
        --app-shell-text: #e2e8f0;
        --app-shell-muted: #94a3b8;
        --app-shell-primary: #60a5fa;
        --app-shell-primary-strong: #3b82f6;
        --app-shell-shadow: 0 38px 110px -48px rgba(15, 23, 42, 0.9);
    }
}

.app-shell-body {
    position: relative;
    margin: 0;
    background:
        radial-gradient(circle at top left, rgba(96, 165, 250, 0.18), transparent 26rem),
        radial-gradient(circle at right 12%, rgba(34, 211, 238, 0.14), transparent 22rem),
        linear-gradient(180deg, #f8fafc 0%, #eef4ff 100%);
    color: var(--app-shell-text);
}

@media (prefers-color-scheme: dark) {
    .app-shell-body {
        background:
            radial-gradient(circle at top left, rgba(37, 99, 235, 0.2), transparent 24rem),
            radial-gradient(circle at right 15%, rgba(14, 165, 233, 0.18), transparent 20rem),
            linear-gradient(180deg, #020617 0%, #0f172a 100%);
    }
}

.app-loader {
    position: relative;
    min-height: 100dvh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    overflow: hidden;
}

.app-loader__glow {
    position: absolute;
    border-radius: 999px;
    filter: blur(70px);
    opacity: 0.9;
}

.app-loader__glow--left {
    width: 18rem;
    height: 18rem;
    left: -5rem;
    top: 15%;
    background: rgba(59, 130, 246, 0.22);
}

.app-loader__glow--right {
    width: 20rem;
    height: 20rem;
    right: -5rem;
    bottom: 8%;
    background: rgba(14, 165, 233, 0.18);
}

.app-loader__card {
    position: relative;
    width: min(100%, 30rem);
    padding: 2rem;
    border-radius: 2rem;
    border: 1px solid var(--app-shell-border);
    background: var(--app-shell-surface);
    box-shadow: var(--app-shell-shadow);
    backdrop-filter: blur(24px);
}

.app-loader__brand {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.app-loader__logo-shell {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 4rem;
    height: 4rem;
    border-radius: 1.5rem;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.95), rgba(240, 247, 255, 0.92));
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.9), 0 18px 32px -22px rgba(37, 99, 235, 0.45);
}

.app-loader__logo-mark {
    width: 3rem;
    height: 3rem;
    object-fit: cover;
    border-radius: 1rem;
}

.app-loader__wordmark {
    width: min(13rem, 60vw);
    height: auto;
    object-fit: contain;
}

.app-loader__eyebrow {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.4rem 0.8rem;
    border-radius: 999px;
    border: 1px solid rgba(96, 165, 250, 0.22);
    background: rgba(239, 246, 255, 0.92);
    color: var(--app-shell-primary-strong);
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.16em;
    text-transform: uppercase;
}

.app-loader__title {
    margin: 1rem 0 0.6rem;
    font-size: clamp(1.6rem, 4vw, 2.1rem);
    line-height: 1.1;
    letter-spacing: -0.03em;
}

.app-loader__description {
    margin: 0 0 1.5rem;
    color: var(--app-shell-muted);
    font-size: 0.98rem;
    line-height: 1.65;
}

.app-loader__progress {
    position: relative;
    overflow: hidden;
    height: 0.9rem;
    border-radius: 999px;
    background: rgba(148, 163, 184, 0.14);
    border: 1px solid rgba(148, 163, 184, 0.18);
}

.app-loader__progress-bar {
    display: block;
    position: absolute;
    inset: 0 auto 0 0;
    width: var(--blazor-load-percentage, 0%);
    min-width: 0;
    max-width: 100%;
    border-radius: inherit;
    background:
        linear-gradient(90deg, rgba(37, 99, 235, 0.85), rgba(14, 165, 233, 0.95)),
        linear-gradient(90deg, rgba(255, 255, 255, 0.28), transparent);
    box-shadow: 0 10px 20px -12px rgba(37, 99, 235, 0.9);
    transition: width 0.25s ease;
}

.app-loader__progress-bar::after {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(120deg, transparent 0%, rgba(255, 255, 255, 0.35) 45%, transparent 100%);
    animation: app-loader-shimmer 1.8s linear infinite;
}

.app-loader__meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin-top: 0.95rem;
    color: var(--app-shell-muted);
    font-size: 0.82rem;
    font-weight: 600;
}

.loading-progress-text::after {
    content: var(--blazor-load-percentage-text, "0%");
    color: var(--app-shell-primary-strong);
}

.app-loader .loading-progress-text {
    position: static;
    inset: auto;
    display: inline-flex;
    min-width: 3rem;
    justify-content: flex-end;
    text-align: right;
    font-weight: 800;
    letter-spacing: -0.02em;
}

.pwa-install-banner {
    position: fixed;
    left: 1rem;
    right: 1rem;
    bottom: max(1rem, env(safe-area-inset-bottom, 0rem) + 0.4rem);
    z-index: 1200;
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 1rem;
    padding: 1rem;
    border-radius: 1.5rem;
    border: 1px solid var(--app-shell-border);
    background: rgba(15, 23, 42, 0.92);
    box-shadow: 0 28px 70px -34px rgba(15, 23, 42, 0.92);
    backdrop-filter: blur(20px);
    color: #e2e8f0;
}

.pwa-install-banner[hidden] {
    display: none;
}

.pwa-install-banner__logo-wrap {
    display: flex;
    align-items: flex-start;
}

.pwa-install-banner__logo {
    width: 3.4rem;
    height: 3.4rem;
    border-radius: 1.15rem;
    object-fit: cover;
    box-shadow: 0 18px 32px -20px rgba(37, 99, 235, 0.75);
}

.pwa-install-banner__content {
    min-width: 0;
}

.pwa-install-banner__eyebrow {
    margin: 0 0 0.25rem;
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: #93c5fd;
}

.pwa-install-banner__title {
    margin: 0;
    font-size: 1rem;
    font-weight: 700;
    letter-spacing: -0.02em;
}

.pwa-install-banner__text {
    margin: 0.35rem 0 0;
    font-size: 0.88rem;
    line-height: 1.55;
    color: rgba(226, 232, 240, 0.86);
}

.pwa-install-banner__actions {
    grid-column: 1 / -1;
    display: flex;
    gap: 0.75rem;
}

.pwa-install-banner__button {
    appearance: none;
    border: 0;
    border-radius: 999px;
    padding: 0.85rem 1rem;
    font: inherit;
    font-weight: 700;
    cursor: pointer;
    transition: transform 0.18s ease, opacity 0.18s ease, background-color 0.18s ease;
}

.pwa-install-banner__button:hover {
    transform: translateY(-1px);
}

.pwa-install-banner__button--ghost {
    flex: 1;
    background: rgba(148, 163, 184, 0.12);
    color: #e2e8f0;
}

.pwa-install-banner__button--primary {
    flex: 1.2;
    background: linear-gradient(90deg, #2563eb, #0ea5e9);
    color: white;
}

#blazor-error-ui {
    left: 1rem;
    right: 1rem;
    bottom: max(1rem, env(safe-area-inset-bottom, 0rem));
    width: auto;
    border-radius: 1rem;
    border: 1px solid rgba(248, 113, 113, 0.35);
    background: rgba(127, 29, 29, 0.94);
    color: #fee2e2;
    box-shadow: 0 24px 56px -36px rgba(127, 29, 29, 0.95);
}

#blazor-error-ui .reload,
#blazor-error-ui .dismiss {
    color: white;
}

@media (prefers-color-scheme: dark) {
    .app-loader__logo-shell {
        background: linear-gradient(180deg, rgba(255, 255, 255, 0.14), rgba(30, 41, 59, 0.7));
    }

    .app-loader__eyebrow {
        border-color: rgba(96, 165, 250, 0.18);
        background: rgba(30, 41, 59, 0.72);
    }
}

@media (max-width: 640px) {
    .app-loader {
        padding: 1rem;
    }

    .app-loader__card {
        padding: 1.35rem;
        border-radius: 1.5rem;
    }

    .app-loader__brand {
        flex-direction: column;
        align-items: flex-start;
    }

    .app-loader__meta {
        flex-direction: column;
        align-items: flex-start;
    }

    .pwa-install-banner {
        grid-template-columns: 1fr;
        gap: 0.85rem;
    }

    .pwa-install-banner__logo-wrap {
        display: none;
    }
}

@keyframes app-loader-shimmer {
    from {
        transform: translateX(-100%);
    }

    to {
        transform: translateX(200%);
    }
}
