/*
 * Splash shown while the WASM runtime and assemblies download. Avalonia does not manage this
 * element (there is no splash handling in avalonia.js), so main.js removes it once the runtime is
 * created. It is absolutely positioned so it never contributes layout height - as a static block it
 * sits after the Avalonia canvas and adds a second full viewport of scroll height.
 */
/* Mobile: no pull-to-refresh/scroll bounce; browser pan/pinch must not eat Avalonia gestures. */
html,
body {
    overscroll-behavior: none;
    /* Android Chrome may otherwise auto-inflate text it deems too small. */
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
}

/* The whole app is a canvas: no tap flash, no long-press text selection/callout.
   touch-action on #out (not just the canvas) also covers taps during the splash. */
#out {
    touch-action: none;
    -webkit-tap-highlight-color: transparent;
    -webkit-user-select: none;
    user-select: none;
    /* viewport-fit=cover extends under notches/home indicator; keep the UI out of them.
       border-box so the 100% height from index.html still fits the viewport. */
    box-sizing: border-box;
    padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
}

#out canvas {
    touch-action: none;
}

/* The safe-area padding exposes the body behind the insets; match the app theme
   so the notch/home-indicator strips don't flash white in dark mode. */
@media (prefers-color-scheme: light) {
    body {
        background: #ffffff;
    }
}

@media (prefers-color-scheme: dark) {
    body {
        background: #1b2a4e;
    }
}

.app-splash {
    position: absolute;
    top: 0;
    left: 0;
    height: 100%;
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    font-family: system-ui, sans-serif;
    pointer-events: none;
    animation: app-splash-in 400ms ease-out;
}

.app-splash-logo {
    width: 84px;
    height: 84px;
    margin-bottom: 1.1rem;
    filter: drop-shadow(0 6px 18px rgba(20, 169, 248, 0.35));
}

/* The centre rectangle breathes while the runtime downloads - same idea as the in-app LogoAnimated. */
.app-splash-center {
    transform-origin: 250px 250px;
    animation: app-splash-pulse 1.6s ease-in-out infinite;
}

.app-splash h2 {
    font-weight: 600;
    font-size: 1.35rem;
    letter-spacing: 0.02em;
    margin: 0;
}

.app-splash p {
    margin: 0;
    font-size: 0.85rem;
    opacity: 0.65;
}

/* Indeterminate shimmer bar - honest (no fake percentages) but alive. */
.app-splash-bar {
    width: 148px;
    height: 3px;
    margin-top: 1.2rem;
    border-radius: 2px;
    overflow: hidden;
    background: rgba(128, 148, 178, 0.25);
}

.app-splash-bar-fill {
    width: 40%;
    height: 100%;
    border-radius: 2px;
    background: #14A9F8;
    animation: app-splash-slide 1.2s ease-in-out infinite;
}

@keyframes app-splash-pulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.45; transform: scale(0.82); }
}

@keyframes app-splash-slide {
    0% { transform: translateX(-120%); }
    100% { transform: translateX(400%); }
}

@keyframes app-splash-in {
    from { opacity: 0; }
    to { opacity: 1; }
}

@media (prefers-color-scheme: light) {
    .app-splash {
        background: #ffffff;
        color: #4b5563;
    }

    .app-splash-center {
        fill: #4a4f57;
    }
}

@media (prefers-color-scheme: dark) {
    .app-splash {
        background: #1b2a4e;
        color: #e5e7eb;
    }

    .app-splash-center {
        fill: #ffffff;
    }
}
