:root {
    --page-bg: #000;
    --text-main: #f4ede0;
    --text-muted: rgba(244, 237, 224, 0.82);
    --badge-bg: rgba(10, 10, 10, 0.58);
    --badge-border: rgba(244, 237, 224, 0.16);
    --accent: #ff5f36;
}

html,
body {
    min-height: 100%;
    margin: 0;
    background: var(--page-bg);
    color: var(--text-main);
}

body {
    font-family: "Avenir Next", Avenir, "Helvetica Neue", Helvetica, sans-serif;
    overflow: hidden;
    position: relative;
}

#liveVideo {
    position: fixed;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    opacity: 0;
    transition: opacity 320ms ease;
    z-index: 0;
    background: #000;
    pointer-events: none;
}

.scan-overlay {
    position: fixed;
    inset: 0;
    z-index: 1;
    pointer-events: none;
    background:
        linear-gradient(180deg, rgba(255, 95, 54, 0.08), transparent 24rem),
        linear-gradient(180deg, rgba(255, 255, 255, 0.02), rgba(0, 0, 0, 0.28));
}

.page-shell {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    z-index: 2;
}

.fallback-stage {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    padding: 1.5rem;
    box-sizing: border-box;
    transition: opacity 320ms ease;
}

.fallback-column {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1.1rem;
}

.spiral-image {
    max-width: min(36rem, 72vw);
    width: 100%;
    height: auto;
    image-rendering: pixelated;
}

.glyph-row {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.8rem;
}

.glyph-row img {
    width: min(8rem, 18vw);
    height: auto;
    image-rendering: pixelated;
}

.status-badge {
    position: fixed;
    top: 1rem;
    left: 1rem;
    z-index: 3;
    padding: 0.7rem 0.9rem;
    border-radius: 999px;
    border: 1px solid var(--badge-border);
    background: var(--badge-bg);
    backdrop-filter: blur(10px);
    color: var(--text-muted);
    font-size: 0.9rem;
    letter-spacing: 0.04em;
}

.wax-player-dock {
    position: fixed;
    right: 1rem;
    bottom: 1rem;
    z-index: 4;
    width: min(420px, calc(100vw - 2rem));
    max-width: calc(100vw - 2rem);
}

.wax-player-dock > * {
    width: 100%;
    max-width: 100%;
}

.wax-player-dock iframe {
    box-shadow: 0 20px 32px rgba(0, 0, 0, 0.35);
    border-radius: 28px;
}

body.is-live #liveVideo {
    opacity: 1;
}

body.is-live .fallback-stage {
    opacity: 0;
}

body.is-live .status-badge {
    color: var(--text-main);
    border-color: rgba(255, 95, 54, 0.42);
}

body.is-live .status-badge::before {
    content: "";
    display: inline-block;
    width: 0.55rem;
    height: 0.55rem;
    border-radius: 50%;
    margin-right: 0.55rem;
    background: var(--accent);
    box-shadow: 0 0 1rem rgba(255, 95, 54, 0.6);
    vertical-align: middle;
}

@media (max-width: 640px) {
    .glyph-row {
        gap: 0.55rem;
    }

    .status-badge {
        top: 0.75rem;
        left: 0.75rem;
        right: 0.75rem;
        text-align: center;
    }

    .wax-player-dock {
        right: 0.75rem;
        bottom: 0.75rem;
        width: calc(100vw - 1.5rem);
    }
}
