:root {
    color: #eef2ff;
    background: #050712;
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
    box-sizing: border-box;
}

html,
body,
#app-shell,
#canvas {
    width: 100%;
    height: 100%;
    margin: 0;
    overflow: hidden;
}

body {
    min-height: 100vh;
    min-height: 100dvh;
}

#app-shell {
    position: relative;
    isolation: isolate;
    background:
        radial-gradient(circle at 50% 15%, rgba(80, 96, 160, 0.18), transparent 42%),
        #050712;
}

.loading-screen {
    position: absolute;
    z-index: 3;
    inset: 0;
    display: grid;
    align-items: end;
    overflow: hidden;
    background:
        linear-gradient(180deg, rgba(3, 5, 18, 0.04) 0%, rgba(3, 5, 18, 0.06) 48%, rgba(2, 4, 14, 0.82) 100%),
        url("mu-invasion-loading-hq.jpg") center center / cover no-repeat,
        #050712;
}

.loading-screen::before {
    content: "";
    position: absolute;
    inset: 0;
    background:
        radial-gradient(circle at 52% 38%, transparent 0%, rgba(1, 3, 12, 0.08) 48%, rgba(1, 2, 9, 0.42) 100%);
    pointer-events: none;
}

.loading-screen[hidden] {
    display: none;
}

.loading-copy {
    position: relative;
    z-index: 1;
    width: min(52rem, calc(100% - 2rem));
    margin: 0 auto;
    padding: 0 0 clamp(2.25rem, 7vh, 5.5rem);
    color: #eef2ff;
    text-align: center;
    text-shadow: 0 0.15rem 0.6rem rgba(0, 0, 0, 0.9);
}

.loading-copy .eyebrow {
    margin-bottom: 0.7rem;
    color: rgba(224, 197, 129, 0.78);
    letter-spacing: 0.48em;
}

.loading-copy h1 {
    color: #f0d789;
    font-family: Georgia, "Times New Roman", serif;
    font-size: clamp(0.9rem, 1.25vw, 1.15rem);
    font-weight: 600;
    letter-spacing: 0.5em;
    text-transform: uppercase;
}

.loading-copy #status {
    min-height: 1.4em;
    margin: 0.75rem 0 1rem;
    color: rgba(226, 231, 248, 0.86);
    font-size: clamp(0.76rem, 0.9vw, 0.88rem);
}

.loading-meta {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    margin-top: 0.65rem;
    color: rgba(190, 200, 228, 0.78);
    font: 600 0.69rem/1.2 ui-monospace, SFMono-Regular, Consolas, monospace;
    letter-spacing: 0.025em;
}

.loading-meta strong {
    color: #ead08a;
    font-weight: 700;
}

#canvas {
    position: absolute;
    inset: 0;
    display: block;
    border: 0;
    outline: none;
}

.panel {
    position: absolute;
    z-index: 2;
    top: 50%;
    left: 50%;
    width: min(90vw, 34rem);
    padding: 2rem;
    transform: translate(-50%, -50%);
    border: 1px solid rgba(183, 199, 255, 0.2);
    border-radius: 1.25rem;
    background: rgba(8, 11, 25, 0.88);
    box-shadow: 0 1.5rem 5rem rgba(0, 0, 0, 0.55);
    text-align: center;
    backdrop-filter: blur(18px);
}

.panel[hidden] {
    display: none;
}

.sigil {
    width: 4rem;
    height: 4rem;
    margin: 0 auto 1.25rem;
    border: 1px solid rgba(224, 189, 112, 0.7);
    border-radius: 50%;
    color: #e9c77b;
    font-family: Georgia, serif;
    font-size: 2.35rem;
    line-height: 3.85rem;
    box-shadow: inset 0 0 1.2rem rgba(224, 189, 112, 0.12), 0 0 2.5rem rgba(224, 189, 112, 0.08);
}

.eyebrow {
    margin: 0 0 0.45rem;
    color: #d9bd7c;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.22em;
    text-transform: uppercase;
}

h1 {
    margin: 0;
    font-family: Georgia, "Times New Roman", serif;
    font-size: clamp(1.55rem, 4vw, 2.15rem);
    font-weight: 500;
}

#status,
.fatal p {
    margin: 1rem 0;
    color: #aeb7d0;
    line-height: 1.55;
}

.progress {
    height: 0.32rem;
    margin-top: 0;
    overflow: hidden;
    border-radius: 999px;
    border: 1px solid rgba(223, 196, 123, 0.18);
    background: rgba(2, 5, 17, 0.72);
    box-shadow: inset 0 0 0.8rem rgba(0, 0, 0, 0.75), 0 0 1.5rem rgba(85, 111, 255, 0.12);
}

.progress span {
    display: block;
    width: 0;
    height: 100%;
    border-radius: inherit;
    background: linear-gradient(90deg, #755bcb 0%, #9e78ff 35%, #ebd28c 100%);
    box-shadow: 0 0 1rem rgba(181, 145, 255, 0.75);
    transition: width 160ms ease-out;
}

.progress.is-indeterminate span {
    width: 18%;
    animation: loading 1.4s ease-in-out infinite alternate;
}

#telemetry {
    position: absolute;
    z-index: 1;
    right: max(1rem, env(safe-area-inset-right));
    bottom: max(1rem, env(safe-area-inset-bottom));
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 0.5rem;
    max-width: calc(100% - 2rem);
    color: #abb4cd;
    font: 600 0.7rem/1.2 ui-monospace, SFMono-Regular, Consolas, monospace;
    pointer-events: none;
    transition: opacity 220ms ease;
}

#loading:not([hidden]) ~ #telemetry {
    opacity: 0;
}

#telemetry span {
    padding: 0.45rem 0.65rem;
    border: 1px solid rgba(255, 255, 255, 0.09);
    border-radius: 999px;
    background: rgba(5, 7, 18, 0.68);
    backdrop-filter: blur(10px);
}

#runtime-state.ready {
    color: #91e6b4;
}

#runtime-state.error {
    color: #ff9e9e;
}

.fatal {
    border-color: rgba(255, 112, 112, 0.35);
}

.fatal pre {
    max-height: 12rem;
    overflow: auto;
    padding: 0.85rem;
    border-radius: 0.65rem;
    color: #ffd0d0;
    background: rgba(0, 0, 0, 0.3);
    font: 0.78rem/1.45 ui-monospace, SFMono-Regular, Consolas, monospace;
    text-align: left;
    white-space: pre-wrap;
}

@keyframes loading {
    from { transform: translateX(-15%); }
    to { transform: translateX(470%); }
}

@media (max-width: 42rem) {
    .panel {
        padding: 1.4rem;
    }

    #telemetry {
        left: 0.75rem;
        right: 0.75rem;
        justify-content: center;
    }

    .loading-copy {
        width: calc(100% - 1.5rem);
        padding-bottom: 1.5rem;
    }

    .loading-copy h1 {
        letter-spacing: 0.3em;
    }

    .loading-meta {
        font-size: 0.62rem;
    }
}

@media (prefers-reduced-motion: reduce) {
    .progress.is-indeterminate span {
        width: 100%;
        animation: none;
    }

    .progress span {
        transition: none;
    }
}

/* [MOBILE 16/09/2026] ---------------------------------------------------- */
/* Sem isto o navegador do celular rola a pagina, da zoom no toque duplo e
   engole o arrasto antes de o canvas receber o evento. */
html.mu-celular,
html.mu-celular body {
    overscroll-behavior: none;
    touch-action: none;
    -webkit-user-select: none;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
}

#canvas {
    touch-action: none;
}

/* No celular o canvas tem tamanho proprio (ver MuMobile no shell). */
html.mu-celular #canvas {
    width: auto;
    height: auto;
    position: absolute;
    top: 0;
    left: 0;
}

.girar {
    position: absolute;
    z-index: 5;
    inset: 0;
    display: grid;
    align-content: center;
    justify-items: center;
    gap: 0.75rem;
    padding: 1rem;
    text-align: center;
    background: #050712;
}

.girar[hidden] {
    display: none;
}

.girar h1 {
    margin: 0;
    font-size: clamp(1.25rem, 6vw, 2rem);
}

.girar p {
    margin: 0;
    max-width: 22rem;
    color: #c3cbe8;
}

.girar button {
    margin-top: 0.5rem;
    padding: 0.7rem 1.4rem;
    font: inherit;
    color: #0b1020;
    background: #9fb4ff;
    border: 0;
    border-radius: 0.5rem;
}
