:root {
    color-scheme: dark;
    --iovanta-bg: #000022;
    --iovanta-accent: #00ffc8;
    --iovanta-accent-soft: rgba(0, 255, 200, 0.22);
    --content-gutter: clamp(1rem, 4vw, 3rem);
    --ui-text-width: min(82vw, 44rem);
    --ui-bar-width: clamp(5.6rem, 19.2vw, 14rem);
    --ui-bar-height: clamp(0.35rem, 0.8vw, 0.75rem);
    --ui-gap: clamp(0.4rem, 1.2vmin, 0.8rem);
    --footer-size: clamp(0.62rem, 1.15vmin, 0.85rem);
}

* {
    box-sizing: border-box;
}

html,
body {
    width: 100%;
    min-width: 280px;
    height: 100%;
    min-height: 100%;
    margin: 0;
    overflow: hidden;
    overscroll-behavior: none;
    background: var(--iovanta-bg);
}

body {
    min-height: 100vh;
    min-height: -webkit-fill-available;
    min-height: 100svh;
    min-height: 100dvh;
    -webkit-text-size-adjust: 100%;
    text-rendering: geometricPrecision;
}

#bg-svg {
    position: fixed !important;
    inset: 0 !important;
    width: 100% !important;
    height: 100% !important;
    min-height: 100svh !important;
    transform: translateZ(0);
    contain: strict;
}

#bg-svg.phone-framing {
    transform: scale(1.7) translateZ(0);
    transform-origin: center center;
}

#ui-anchor-root {
    position: fixed;
    inset: 0;
    width: auto;
    height: 100vh;
    height: 100svh;
    height: 100dvh;
    padding:
        max(var(--content-gutter), env(safe-area-inset-top))
        max(var(--content-gutter), env(safe-area-inset-right))
        max(var(--content-gutter), env(safe-area-inset-bottom))
        max(var(--content-gutter), env(safe-area-inset-left));
    pointer-events: none;
}

#loader-only-wrapper {
    display: contents;
}

#boot-text,
#status-text,
#startup-timer {
    width: var(--ui-text-width);
    max-width: calc(100vw - (2 * var(--content-gutter)));
    margin: 0;
    line-height: 1.2;
    text-wrap: balance;
    text-shadow: 0 0 clamp(0.25rem, 0.8vmin, 0.65rem) rgba(0, 255, 200, 0.78);
    will-change: opacity;
}

#boot-text {
    font-size: clamp(0.95rem, 1.1rem + 0.7vw, 2rem);
}

#status-text {
    font-size: clamp(0.78rem, 0.72rem + 0.55vw, 1.3rem);
    letter-spacing: clamp(0.08rem, 0.24vw, 0.18rem);
}

#startup-timer {
    position: fixed;
    right: auto;
    bottom: max(4.5rem, calc(env(safe-area-inset-bottom) + 3.5rem));
    left: 50%;
    z-index: 10001;
    display: block;
    transform: translateX(-50%);
    font-size: clamp(0.85rem, 0.78rem + 0.65vw, 1.45rem);
    font-variant-numeric: tabular-nums;
    letter-spacing: clamp(0.06rem, 0.2vw, 0.14rem);
    white-space: nowrap;
}

#loading-bar {
    width: var(--ui-bar-width);
    max-width: calc(100vw - (2 * var(--content-gutter)));
    height: var(--ui-bar-height);
    min-height: 0.35rem;
    border: 1px solid rgba(0, 255, 200, 0.58);
    border-radius: 999px;
    background: var(--iovanta-accent-soft);
    box-shadow: 0 0 clamp(0.3rem, 1vmin, 0.8rem) rgba(0, 255, 200, 0.16);
    overflow: hidden;
    contain: layout paint;
}

#loading-fill {
    width: 0;
    height: 100%;
    border-radius: inherit;
    background: linear-gradient(90deg, #00ba92, var(--iovanta-accent), #a6fff0);
    box-shadow: 0 0 clamp(0.3rem, 1vmin, 0.85rem) var(--iovanta-accent);
    transition: width 250ms linear;
    will-change: width;
}

#site-footer {
    right: max(0.75rem, env(safe-area-inset-right));
    bottom: max(0.5rem, env(safe-area-inset-bottom));
    left: max(0.75rem, env(safe-area-inset-left));
    width: auto;
    padding: 0.25rem;
    font-size: var(--footer-size);
    line-height: 1.3;
    letter-spacing: 0.06em;
    opacity: 0.68;
    text-shadow: 0 0 0.4rem rgba(0, 255, 200, 0.55);
}

#site-footer #power {
    margin-top: 0.1rem;
    font-size: 0.72em;
    transform: none;
}

@media (max-width: 480px) {
    :root {
        --content-gutter: clamp(0.75rem, 4vw, 1.1rem);
        --ui-text-width: 88vw;
        --ui-bar-width: clamp(5.4rem, 30.4vw, 7.6rem);
        --ui-bar-height: clamp(0.3rem, 1.5vw, 0.5rem);
    }

    #status-text {
        font-size: clamp(0.72rem, 3vw, 0.92rem);
    }

    #startup-timer {
        font-size: clamp(0.78rem, 3.6vw, 1rem);
    }

    #bg-svg {
        height: 100dvh !important;
    }

}

html.phone-viewport #status-text {
    font-size: clamp(0.72rem, 3vmin, 0.92rem);
}

html.phone-viewport #startup-timer {
    font-size: clamp(0.78rem, 3.6vmin, 1rem);
}

@media (display-mode: standalone), (display-mode: fullscreen) {
    html,
    body,
    #bg-svg,
    #ui-anchor-root {
        height: 100dvh !important;
        min-height: 100dvh !important;
    }
}

@media (min-width: 1600px) {
    :root {
        --ui-text-width: min(58vw, 58rem);
        --ui-bar-width: clamp(12rem, 14.4vw, 18.4rem);
    }
}

@media (orientation: landscape) and (max-height: 520px) {
    :root {
        --content-gutter: 0.65rem;
        --ui-text-width: min(70vw, 36rem);
        --ui-bar-width: clamp(5.6rem, 16vw, 9.6rem);
        --footer-size: 0.58rem;
    }

    #site-footer {
        right: max(0.5rem, env(safe-area-inset-right));
        bottom: max(0.25rem, env(safe-area-inset-bottom));
        left: auto;
        width: auto;
        text-align: right;
        line-height: 1.15;
    }
}

html.phone-viewport #site-footer {
    right: max(0.75rem, env(safe-area-inset-right));
    bottom: max(0.35rem, env(safe-area-inset-bottom));
    left: max(0.75rem, env(safe-area-inset-left));
    width: auto;
    text-align: center;
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        scroll-behavior: auto !important;
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}
