html,
body {
    margin: 0;
    width: 100%;
    height: 100%;
    min-height: 100svh;
    min-height: 100dvh;
    overflow: hidden;
}

body {
    background-color: #040608;
    background-image: url("/assets/background-blackhole.png");
    background-position: center center;
    background-size: 100% 100%;
    background-repeat: no-repeat;
    font-family: "Segoe UI", sans-serif;
}

body.viewer-open {
    overflow: hidden;
}

#scene-root {
    position: fixed;
    inset: 0;
    width: 100vw;
    height: 100svh;
    height: 100dvh;
}

.site-brand {
    position: fixed;
    top: calc(env(safe-area-inset-top, 0px) + 18px);
    left: calc(env(safe-area-inset-left, 0px) + 20px);
    z-index: 6;
    width: min(32vw, 420px);
    pointer-events: none;
}

.site-brand-image {
    display: block;
    width: 100%;
    height: auto;
    filter:
        drop-shadow(0 10px 26px rgba(0, 0, 0, 0.45))
        drop-shadow(0 0 16px rgba(255, 244, 228, 0.2));
}

#scene-root canvas {
    display: block;
    width: 100%;
    height: 100%;
}

.viewer-modal {
    position: fixed;
    inset: 0;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 24px;
    background: rgba(3, 6, 10, 0.7);
    backdrop-filter: blur(8px);
    z-index: 20;
}

.viewer-modal.active {
    display: flex;
}

.viewer-modal-card {
    position: relative;
    width: min(1080px, 94vw);
    height: min(82vh, 820px);
    padding-top: 52px;
    border-radius: 18px;
    overflow: hidden;
    background: rgba(8, 11, 18, 0.94);
    border: 1px solid rgba(255, 255, 255, 0.08);
    box-shadow: 0 24px 70px rgba(0, 0, 0, 0.45);
}

.viewer-close {
    position: absolute;
    top: 14px;
    right: 14px;
    min-height: 34px;
    padding: 0 14px;
    border: 0;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
    cursor: pointer;
}

.viewer-title {
    position: absolute;
    top: 16px;
    left: 18px;
    margin: 0;
    color: #f7f4ea;
    font-size: 1rem;
    font-weight: 500;
}

#frame {
    width: 100%;
    height: 100%;
    border: 0;
    background: #0d1217;
}

.fallback-face {
    min-height: 100vh;
    display: grid;
    grid-template-columns: minmax(280px, 420px) minmax(0, 1fr);
    gap: 32px;
    align-items: center;
    padding: 40px;
    color: #f2f0eb;
    background: radial-gradient(circle at top left, rgba(255, 208, 122, 0.16), transparent 28%), #081016;
}

.fallback-image {
    width: 100%;
    border-radius: 18px;
    box-shadow: 0 18px 48px rgba(0, 0, 0, 0.42);
}

.fallback-copy h1 {
    margin: 0 0 14px;
    font-size: clamp(2rem, 5vw, 3.5rem);
}

.fallback-copy p {
    margin: 0 0 12px;
    line-height: 1.6;
    color: rgba(255, 255, 255, 0.82);
}

.fallback-copy code {
    padding: 0.12em 0.4em;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.08);
}

@media (max-width: 700px) {
    .site-brand {
        top: calc(env(safe-area-inset-top, 0px) + 12px);
        left: calc(env(safe-area-inset-left, 0px) + 12px);
        width: min(58vw, 300px);
    }

    .viewer-modal {
        padding: 12px;
    }

    .fallback-face {
        grid-template-columns: 1fr;
        padding: 24px;
    }
}

@media (orientation: landscape) and (max-height: 560px) {
    .site-brand {
        top: calc(env(safe-area-inset-top, 0px) + 10px);
        left: calc(env(safe-area-inset-left, 0px) + 12px);
        width: min(30vw, 250px);
    }
}
