* {
    box-sizing: border-box;
}

html,
body {
    width: 100%;
    height: 100%;
    margin: 0;
}

body {
    overflow: hidden;
    background: #101014;
    color: #fff;
    font-family: 'Outfit', sans-serif;
}

.site3d,
#render-canvas {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
}

#render-canvas {
    display: block;
    outline: none;
    touch-action: none;
}

#render-canvas[hidden] {
    display: none;
}

.scene-overlay {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    justify-content: space-between;
    padding: max(1.5rem, env(safe-area-inset-top)) max(1.5rem, env(safe-area-inset-right)) max(1.5rem, env(safe-area-inset-bottom)) max(1.5rem, env(safe-area-inset-left));
    pointer-events: none;
}

.back-link {
    pointer-events: auto;
    display: inline-flex;
    align-items: center;
    min-height: 44px;
    padding: 0.7rem 1.1rem;
    border: 1px solid rgb(255 255 255 / 35%);
    border-radius: 999px;
    background: rgb(15 15 18 / 75%);
    color: #fff;
    font-size: 0.95rem;
    text-decoration: none;
    backdrop-filter: blur(8px);
}

.back-link:hover,
.back-link:focus-visible {
    border-color: #d84748;
    outline: none;
}

.scene-status {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    margin: 0;
    padding: 0.8rem 1rem;
    border-radius: 10px;
    background: rgb(15 15 18 / 82%);
}

.scene-intro {
    padding: 1rem 1.25rem;
    border-radius: 12px;
    background: rgb(15 15 18 / 72%);
    backdrop-filter: blur(8px);
}

.eyebrow {
    margin: 0 0 0.35rem;
    color: #ee7777;
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.14em;
}

.scene-intro h1 {
    margin: 0;
    font-size: clamp(1.4rem, 4vw, 2rem);
}

.scene-intro > p:last-child {
    margin: 0.4rem 0 0;
    color: rgb(255 255 255 / 78%);
    font-size: 0.9rem;
}

.scene-fallback {
    position: absolute;
    inset: 50% auto auto 50%;
    width: min(34rem, calc(100vw - 2rem));
    padding: clamp(1.5rem, 5vw, 3rem);
    border: 1px solid rgb(255 255 255 / 14%);
    border-radius: 20px;
    background: #17171d;
    box-shadow: 0 1rem 3rem rgb(0 0 0 / 32%);
    pointer-events: auto;
    transform: translate(-50%, -50%);
}

.scene-fallback h1 {
    margin: 0 0 0.75rem;
    font-size: clamp(1.7rem, 5vw, 2.5rem);
}

.scene-fallback > p:not(.eyebrow) {
    color: rgb(255 255 255 / 78%);
    line-height: 1.55;
}

.scene-fallback nav {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
}

.scene-fallback nav a {
    display: inline-flex;
    align-items: center;
    min-height: 44px;
    padding: 0.65rem 0.9rem;
    border: 1px solid rgb(255 255 255 / 35%);
    border-radius: 999px;
    color: #fff;
    text-decoration: none;
}

.scene-fallback nav a:hover,
.scene-fallback nav a:focus-visible {
    border-color: #d84748;
    outline: 2px solid #ee7777;
    outline-offset: 2px;
}

.info-panel {
    position: absolute;
    top: max(1.5rem, env(safe-area-inset-top));
    right: max(1.5rem, env(safe-area-inset-right));
    width: min(22rem, calc(100vw - 3rem));
    padding: 1.5rem;
    border: 1px solid rgb(255 255 255 / 16%);
    border-radius: 16px;
    background: rgb(15 15 18 / 88%);
    box-shadow: 0 1rem 3rem rgb(0 0 0 / 28%);
    pointer-events: auto;
    backdrop-filter: blur(12px);
}

.info-panel[hidden] {
    display: none;
}

.info-panel h2 {
    margin: 0 2rem 0.5rem 0;
    font-size: 1.5rem;
}

.info-panel p {
    margin: 0 0 1rem;
    color: rgb(255 255 255 / 78%);
    line-height: 1.5;
}

.close-panel {
    position: absolute;
    top: 0.65rem;
    right: 0.65rem;
    width: 44px;
    height: 44px;
    border: 0;
    border-radius: 50%;
    background: transparent;
    color: #fff;
    font-size: 1.8rem;
    cursor: pointer;
}

.close-panel:focus-visible,
.panel-link:focus-visible {
    outline: 2px solid #ee7777;
    outline-offset: 3px;
}

.panel-link {
    color: #ff9292;
    font-weight: 600;
}

@media (max-width: 600px) {
    .scene-overlay {
        padding: max(1rem, env(safe-area-inset-top)) max(1rem, env(safe-area-inset-right)) max(1rem, env(safe-area-inset-bottom)) max(1rem, env(safe-area-inset-left));
    }

    .info-panel {
        top: max(1rem, env(safe-area-inset-top));
        right: max(1rem, env(safe-area-inset-right));
        width: min(22rem, calc(100vw - 2rem));
    }
}
