/* Shared LunCoSim wasm boot styles — see crates/lunco-web/src/lib.rs.
   Customise per app with the two CSS variables below (or override any
   rule from an app-specific stylesheet loaded after this one). */
:root {
    --lc-accent: #4CAF50;     /* progress bar + title colour */
    --lc-backdrop: #1a1a1a;   /* page + canvas backdrop */
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html,
body {
    width: 100%;
    height: 100%;
    overflow: hidden;
}

body {
    background: var(--lc-backdrop);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

/* Match the app backdrop so the gap between wasm init resolving and
   Bevy's first egui frame is invisible — no gray flash. Bevy's clear
   colour paints over this once the render loop starts. */
#bevy {
    width: 100%;
    height: 100%;
    display: block;
    background: var(--lc-backdrop);
    /* Suppress Chrome's blue focus-ring (#a8c7fa, 1-px left edge) when
       Bevy gives the canvas keyboard focus. egui handles per-widget
       focus visibility inside the app. */
    outline: none;
}

#bevy:focus {
    outline: none;
}

/* Centred loader card. Covers ONLY the crucial pre-init steps (wasm
   download → wasm init); hidden once Bevy signals via __lc_app_ready.
   Non-blocking backdrop (pointer-events: none on the root) so the
   canvas underneath is interactable from the first paint. */
#lc-loading {
    position: fixed;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
    transition: opacity 0.3s ease;
    z-index: 1000;
}

#lc-loading.hidden {
    opacity: 0;
    visibility: hidden;
}

#lc-loading .card {
    min-width: 320px;
    max-width: 420px;
    padding: 18px 22px;
    background: rgba(20, 20, 20, 0.94);
    border: 1px solid #3a3a3a;
    border-radius: 10px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.6);
    pointer-events: auto;
}

#lc-loading .title {
    color: var(--lc-accent);
    font-weight: 600;
    font-size: 14px;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

#lc-loading .phase {
    color: #e8e8e8;
    font-size: 16px;
    margin-top: 6px;
}

#lc-loading .detail {
    color: #888;
    font-size: 12px;
    margin-top: 4px;
    font-variant-numeric: tabular-nums;
}

#lc-loading .bar {
    margin-top: 14px;
    height: 6px;
    width: 100%;
    background: #2a2a2a;
    border-radius: 3px;
    overflow: hidden;
}

#lc-loading .bar > .fill {
    height: 100%;
    background: var(--lc-accent);
    width: 0%;
    transition: width 0.15s ease;
}

/* Indeterminate shimmer while no byte total is known yet. */
#lc-loading.indeterminate .bar > .fill {
    width: 35% !important;
    transition: none;
    animation: lc-shimmer 1.1s ease-in-out infinite;
}

@keyframes lc-shimmer {
    0% { margin-left: -35%; }
    100% { margin-left: 100%; }
}

/* Error state — recolour the accent bits red. */
#lc-loading.error .title,
#lc-loading.error .phase {
    color: #e57373;
}

#lc-loading.error .bar > .fill {
    background: #e57373;
    animation: none;
}
