/* intent: base HTML reset, splash screen, and global layout styles for the app shell */
/* === base === */

html, body {
    margin: 0;
    padding: 0;
    font-family: 'Roboto', 'Helvetica Neue', Helvetica, Arial, sans-serif;
    /* Matches the darkest splash color — prevents white flash while Blazor renders its first frame */
    background: #1c0a24;
    /* Blocks iOS/iPadOS 16+ pull-to-refresh (accidental reload loses in-progress work); normal scrolling is unaffected */
    overscroll-behavior-y: none;
}


/* === splash screen (shown while WASM loads, before Blazor takes over #app) === */

/* Overlay sits outside #app at fixed z-index so Blazor replacing #app doesn't remove it */
#emr-splash-overlay {
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    z-index: 9999;
}

.emr-splash {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100vh;
    width: 100vw;
    background: radial-gradient(ellipse at 65% 35%, #5a32a3 0%, #3b1a7a 35%, #1c0a24 100%);
    position: relative;
    overflow: hidden;
    font-family: 'Roboto', sans-serif;
}

/* ambient depth orbs */
.emr-splash-orb {
    position: absolute;
    border-radius: 50%;
    filter: blur(80px);
    opacity: 0.18;
    animation: emr-orb-drift 8s ease-in-out infinite alternate;
}
.emr-splash-orb-1 { width: 480px; height: 480px; background: #9c6af0; top: -120px; right: -80px; animation-delay: 0s; }
.emr-splash-orb-2 { width: 320px; height: 320px; background: #4fc3f7; bottom: -80px; left: -60px; animation-delay: -3s; }
.emr-splash-orb-3 { width: 200px; height: 200px; background: #ce93d8; bottom: 10%; right: 15%; animation-delay: -5s; }
@keyframes emr-orb-drift {
    from { transform: translate(0, 0) scale(1); }
    to   { transform: translate(20px, -20px) scale(1.08); }
}

/* corner frame accents */
.emr-splash-corner {
    position: absolute;
    width: 44px;
    height: 44px;
    border-color: rgba(255, 255, 255, 0.1);
    border-style: solid;
}
.emr-splash-corner-tl { top: 24px; left: 24px; border-width: 1px 0 0 1px; }
.emr-splash-corner-br { bottom: 24px; right: 24px; border-width: 0 1px 1px 0; }

/* center stack */
.emr-splash-content {
    display: flex;
    flex-direction: column;
    align-items: center;
}

/* logo — 3-D stand-up on enter */
.emr-splash-logo-stage {
    perspective: 520px;
    perspective-origin: 50% 100%;
    margin-bottom: 52px;
}
.emr-splash-logo {
    width: 220px;
    transform-origin: center bottom;
    animation: emr-splash-stand-up 1.0s cubic-bezier(0.22, 1, 0.36, 1) 0.1s both;
}
.emr-splash-logo svg {
    width: 100%;
    height: auto;
    display: block;
}
@keyframes emr-splash-stand-up {
    0%   { transform: rotateX(88deg); opacity: 0.15; }
    60%  { transform: rotateX(-6deg); opacity: 1; }
    80%  { transform: rotateX(3deg);  opacity: 1; }
    100% { transform: rotateX(0deg);  opacity: 1; }
}

/* status + bar — fade up after logo is upright */
.emr-splash-below {
    display: flex;
    flex-direction: column;
    align-items: center;
    animation: emr-splash-fade-up 0.3s ease-out 0.1s both;
}
@keyframes emr-splash-fade-up {
    from { opacity: 0; transform: translateY(16px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* environment label — same subdued treatment as .vitas-login-sub on the login page,
   so the two boot surfaces read as one family */
.emr-splash-env {
    color: rgba(255, 255, 255, 0.45);
    font-size: 0.72rem;
    font-weight: 300;
    letter-spacing: 0.16rem;
    text-transform: uppercase;
    min-height: 1.2em;
    margin-bottom: 10px;
}

.emr-splash-message {
    color: rgba(255, 255, 255, 0.38);
    font-size: 0.73rem;
    font-weight: 300;
    letter-spacing: 0.13rem;
    min-height: 1.2em;
    margin-bottom: 28px;
    transition: opacity 0.35s ease;
}

/* Boot failure, shown in place of the progress bar by window.emrBootFailed (index.html).
   Brighter and larger than the normal status line — this is the one thing on screen and it has
   to be readable, unlike the deliberately faint "Initializing…" text it replaces. */
.emr-splash-error {
    color: rgba(255, 255, 255, 0.92);
    font-size: 0.95rem;
    font-weight: 400;
    letter-spacing: 0.04rem;
    margin-bottom: 12px;
}

.emr-splash-detail {
    color: rgba(255, 255, 255, 0.55);
    font-size: 0.78rem;
    font-weight: 300;
    line-height: 1.5;
    max-width: 34rem;
    margin: 0 auto 24px;
    /* Exception text can be long and arbitrary; wrap it rather than widening the splash. */
    overflow-wrap: anywhere;
}

.emr-splash-retry {
    color: #fff;
    background: rgba(255, 255, 255, 0.12);
    border: 1px solid rgba(255, 255, 255, 0.35);
    border-radius: 4px;
    padding: 8px 28px;
    font: inherit;
    font-size: 0.82rem;
    letter-spacing: 0.08rem;
    cursor: pointer;
    transition: background 0.2s ease;
}

.emr-splash-retry:hover {
    background: rgba(255, 255, 255, 0.22);
}

.emr-splash-progress-wrap {
    width: 240px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
}

.emr-splash-progress-track {
    width: 100%;
    height: 3px;
    background: rgba(255, 255, 255, 0.12);
    border-radius: 2px;
    overflow: hidden;
}

.emr-splash-progress-fill {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, #b39ddb, #e040fb);
    border-radius: 2px;
    transition: width 0.4s cubic-bezier(0.25, 1, 0.5, 1);
    position: relative;
}
.emr-splash-progress-fill::after {
    content: '';
    position: absolute;
    top: 0; right: 0;
    width: 40px; height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.55));
    border-radius: 2px;
}

.emr-splash-percent {
    color: rgba(255, 255, 255, 0.35);
    font-size: 1.1rem;
    font-weight: 300;
    letter-spacing: 0.08rem;
    font-variant-numeric: tabular-nums;
}

.emr-splash-footer {
    position: absolute;
    bottom: 18px;
    width: 100%;
    text-align: center;
    color: rgba(255, 255, 255, 0.14);
    font-size: 0.66rem;
    letter-spacing: 0.07rem;
}

/* === blazor error ui (kept from scaffold) === */

#blazor-error-ui {
    color-scheme: light only;
    background: var(--mud-palette-warning);
    bottom: 0;
    box-shadow: 0 -1px 2px color-mix(in srgb, var(--mud-palette-text-primary) 20%, transparent);
    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;
    }
