:root {
    color-scheme: light dark;
}

html,
body {
    height: 100%;
    margin: 0;
    overflow: hidden;
}

#blazor-error-ui {
    color-scheme: light only;
    background: lightyellow;
    bottom: 0;
    box-shadow: 0 -1px 2px rgba(0, 0, 0, 0.2);
    box-sizing: border-box;
    display: none;
    left: 0;
    padding: 0.6rem 1.25rem 0.7rem 1.25rem;
    position: fixed;
    width: 100%;
    z-index: 1000;
}

#blazor-error-ui .dismiss {
    cursor: pointer;
    position: absolute;
    right: 0.75rem;
    top: 0.5rem;
}

.blazor-error-boundary {
    background: url(data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iNTYiIGhlaWdodD0iNDkiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiIG92ZXJmbG93PSJoaWRkZW4iPjxkZWZzPjxjbGlwUGF0aCBpZD0iY2xpcDAiPjxyZWN0IHg9IjIzNSIgeT0iNTEiIHdpZHRoPSI1NiIgaGVpZ2h0PSI0OSIvPjwvY2xpcFBhdGg+PC9kZWZzPjxnIGNsaXAtcGF0aD0idXJsKCNjbGlwMCkiIHRyYW5zZm9ybT0idHJhbnNsYXRlKC0yMzUgLTUxKSI+PHBhdGggZD0iTTI2My41MDYgNTFDMjY0LjcxNyA1MSAyNjUuODEzIDUxLjQ4MzcgMjY2LjYwNiA1Mi4yNjU4TDI2Ny4wNTIgNTIuNzk4NyAyNjcuNTM5IDUzLjYyODMgMjkwLjE4NSA5Mi4xODMxIDI5MC41NDUgOTIuNzk1IDI5MC42NTYgOTIuOTk2QzI5MC44NzcgOTMuNTEzIDI5MSA5NC4wODE1IDI5MSA5NC42NzgyIDI5MSA5Ny4wNjUxIDI4OS4wMzggOTkgMjg2LjYxNyA5OUwyNDAuMzgzIDk5QzIzNy45NjMgOTkgMjM2IDk3LjA2NTEgMjM2IDk0LjY3ODIgMjM2IDk0LjM3OTkgMjM2LjAzMSA5NC4wODg2IDIzNi4wODkgOTMuODA3MkwyMzYuMzM4IDkzLjAxNjIgMjM2Ljg1OCA5Mi4xMzE0IDI1OS40NzMgNTMuNjI5NCAyNTkuOTYxIDUyLjc5ODUgMjYwLjQwNyA1Mi4yNjU4QzI2MS4yIDUxLjQ4MzcgMjYyLjI5NiA1MSAyNjMuNTA2IDUxWk0yNjMuNTg2IDY2LjAxODNDMjYwLjczNyA2Ni4wMTgzIDI1OS4zMTMgNjcuMTI0NSAyNTkuMzEzIDY5LjMzNyAyNTkuMzEzIDY5LjYxMDIgMjU5LjMzMiA2OS44NjA4IDI1OS4zNzEgNzAuMDg4N0wyNjEuNzk1IDg0LjAxNjEgMjY1LjM4IDg0LjAxNjEgMjY3LjgyMSA2OS43NDc1QzI2Ny44NiA2OS43MzA5IDI2Ny44NzkgNjkuNTg3NyAyNjcuODc5IDY5LjMxNzkgMjY3Ljg3OSA2Ny4xMTgyIDI2Ni40NDggNjYuMDE4MyAyNjMuNTg2IDY2LjAxODNaTTI2My41NzYgODYuMDU0N0MyNjEuMDQ5IDg2LjA1NDcgMjU5Ljc4NiA4Ny4zMDA1IDI1OS43ODYgODkuNzkyMSAyNTkuNzg2IDkyLjI4MzcgMjYxLjA0OSA5My41Mjk1IDI2My41NzYgOTMuNTI5NSAyNjYuMTE2IDkzLjUyOTUgMjY3LjM4NyA5Mi4yODM3IDI2Ny4zODcgODkuNzkyMSAyNjcuMzg3IDg3LjMwMDUgMjY2LjExNiA4Ni4wNTQ3IDI2My41NzYgODYuMDU0N1oiIGZpbGw9IiNGRkU1MDAiIGZpbGwtcnVsZT0iZXZlbm9kZCIvPjwvZz48L3N2Zz4=) no-repeat 1rem/1.8rem, #b32121;
    padding: 1rem 1rem 1rem 3.7rem;
    color: white;
}

.blazor-error-boundary::after {
    content: "An error has occurred."
}

:root {
    --splash-logo-h: 104px;
    --splash-ring-size: calc(var(--splash-logo-h) * 75 / 112);
    --splash-ring-stroke: 12;
    --splash-mono: "DM Mono", ui-monospace, monospace;

    /* Light is the written default; the dark block below and the explicit attribute both override it.
       Ordered this way so an unstyled first paint errs toward the lighter, less startling screen. */
    --splash-bg: url("../images/bg-nodwise-light.svg");
    --splash-track: rgba(0, 31, 61, .10);
    --splash-accent: #0770D9;
    --splash-ink: #000810;
    --splash-ink-soft: rgba(0, 8, 16, .62);
    --splash-ink-faint: rgba(0, 8, 16, .42);
}

/* Until the stored preference is known, follow the OS. splash.js replaces this with the real
   preference as soon as it can read localStorage — which is before the first frame. */
@media (prefers-color-scheme: dark) {
    :root {
        --splash-bg: url("../images/bg-nodwise-dark.svg");
        --splash-track: rgba(255, 255, 255, .10);
        --splash-accent: #D4FF00;
        --splash-ink: #F4F9FE;
        --splash-ink-soft: rgba(244, 249, 254, .68);
        --splash-ink-faint: rgba(255, 255, 255, .40);
    }
}

/* The user's own choice, read from the same nw-theme key ThemeScope uses. It wins over the OS —
   matching Background.razor, which deliberately follows the app preference and not the OS. */
:root[data-splash-theme="light"] {
    --splash-bg: url("../images/bg-nodwise-light.svg");
    --splash-track: rgba(0, 31, 61, .10);
    --splash-accent: #0770D9;
    --splash-ink: #000810;
    --splash-ink-soft: rgba(0, 8, 16, .62);
    --splash-ink-faint: rgba(0, 8, 16, .42);
}

:root[data-splash-theme="dark"] {
    --splash-bg: url("../images/bg-nodwise-dark.svg");
    --splash-track: rgba(255, 255, 255, .10);
    --splash-accent: #D4FF00;
    --splash-ink: #F4F9FE;
    --splash-ink-soft: rgba(244, 249, 254, .68);
    --splash-ink-faint: rgba(255, 255, 255, .40);
}

#splash {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: grid;
    place-items: center;
}

#splash::before {
    content: "";
    position: absolute;
    inset: 0;
    background-image: var(--splash-bg);
    background-size: cover;
    background-position: center top;
    background-repeat: no-repeat;
    /* Still meaningful: the artwork is an SVG with transparent regions, so the app booting behind the
       splash shows through them and is blurred rather than legible. */
    backdrop-filter: blur(2px);
    transition: opacity .4s ease .14s;
}

.splash-stack {
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 18px;
 
}
@media (max-width: 640px), (min-height: 480px) {
    .splash-stack {
        transform: translateY(-64px);
    }
}
.splash-ringwrap {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 14px;
    transition: opacity .22s ease;
}

.splash-ring {
    position: relative;
    display: grid;
    place-items: center;
    width: var(--splash-ring-size);
    height: var(--splash-ring-size);
    transition: opacity .22s ease, transform .22s ease;
}

.splash-ring > svg {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    /* The arc must start at twelve o'clock; SVG angles start at three. */
    transform: rotate(-90deg);
    overflow: visible;
}

.splash-ring circle {
    fill: none;
    stroke-width: var(--splash-ring-stroke);
    stroke-linecap: round;
    transform-box: fill-box;
    transform-origin: center;
}

.splash-track {
    stroke: var(--splash-track);
}

.splash-prog {
    stroke: url(#splashRingSheen);
    /* The halo stays in BOTH themes — the one element that keeps it. Against a stroke this thin it
       reads as a metallic sheen on the mark, not as the coloured smear a larger lit surface makes. */
    filter: drop-shadow(0 0 4.5px rgba(212, 255, 0, .60));
    /* 2 * pi * 31.5 — the full circumference, so dashoffset maps 1:1 onto remaining progress. */
    stroke-dasharray: 197.92;
    stroke-dashoffset: 197.92;
}

#splashRingSheen .s0 { stop-color: #849E00; }
#splashRingSheen .s1 { stop-color: #D4FF00; }
#splashRingSheen .s2 { stop-color: #FDF8E1; }
#splashRingSheen .s3 { stop-color: #D4FF00; }

.splash-ring[data-mode="determinate"] .splash-prog {
    transition: stroke-dashoffset .12s linear;
}

/* Indeterminate: a short arc chasing its own tail. It exists to cover the latency before the first
   honest number — opening at 0% and sitting there reads as frozen. */
.splash-ring[data-mode="indeterminate"] .splash-prog {
    stroke-dasharray: 50 148;
    stroke-dashoffset: 0;
    animation: splash-spin 1.05s cubic-bezier(.5, .1, .5, .9) infinite;
}

@keyframes splash-spin {
    to { transform: rotate(360deg); }
}

.splash-pct {
    font-family: var(--splash-mono);
    font-size: 14px;
    letter-spacing: .04em;
    color: var(--splash-ink);
    /* Tabular figures so the number does not jitter horizontally as digits change. */
    font-variant-numeric: tabular-nums;
}

.splash-pctlbl {
    font-family: var(--splash-mono);
    font-size: 9.5px;
    color: var(--splash-ink-faint);
    letter-spacing: .14em;
    text-transform: uppercase;
}

#splash-logo {
    height: var(--splash-logo-h);
    display: flex;
    margin-top: 10px;
    transition: opacity .18s ease;
}
@media (max-width: 640px) {
    #splash-logo {
        max-width: 50%;
    }

}
#splash-logo .logo-img {
    height: 100%;
    width: auto;
    display: block;
    transform: translateY(-16.666%);
}

/* Exit: ring and percentage leave first, so the logo is alone when it starts moving. */
#splash[data-exiting="true"] .splash-ring,
#splash[data-exiting="true"] .splash-pct {
    opacity: 0;
    transform: scale(.86);
}

#splash.splash-gone::before {
    opacity: 0;
}

#splash.splash-reduced::before {
    transition: opacity .12s ease;
}

.splash-fail {
    display: none;
    flex-direction: column;
    align-items: center;
    gap: 14px;
    max-width: 340px;
    text-align: center;
}

#splash[data-fail] .splash-ringwrap {
    display: none;
}

#splash[data-fail] .splash-fail {
    display: flex;
}

.splash-fail i {
    font-size: 26px;
    color: var(--splash-accent);
}

.splash-fail p {
    margin: 0;
    font-size: 13.5px;
    line-height: 1.55;
    color: var(--splash-ink-soft);
}

.splash-retry {
    font: inherit;
    font-size: 13px;
    font-weight: 600;
    /* Without this the label wraps to two lines in the longer translations. */
    white-space: nowrap;
    padding: 10px 20px;
    border-radius: 22px;
    border: 1px solid color-mix(in srgb, var(--splash-accent) 45%, transparent);
    background: color-mix(in srgb, var(--splash-accent) 16%, transparent);
    color: var(--splash-ink);
    cursor: pointer;
}

#splash-sweep {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
    z-index: 1001;
    overflow: hidden;
    opacity: 0;
    transition: opacity .25s ease;
    pointer-events: none;
}

#splash-sweep[data-on="true"] {
    opacity: 1;
}

#splash-sweep::after {
    content: "";
    position: absolute;
    inset: 0;
    width: 38%;
    background: linear-gradient(90deg, transparent, var(--splash-accent), transparent);
    animation: splash-sweep 1.05s ease-in-out infinite;
}

@keyframes splash-sweep {
    0%   { transform: translateX(-100%); }
    100% { transform: translateX(363%); }
}

@media (prefers-reduced-motion: reduce) {
    .splash-ring[data-mode="indeterminate"] .splash-prog { animation: none; }
    #splash-sweep::after { animation: none; width: 100%; }
}

