:root {
    --bg: #030611;
    --panel: rgba(5, 9, 22, 0.64);
    --panel-strong: rgba(5, 9, 22, 0.86);
    --text: #f8fbff;
    --muted: #9aa8bf;
    --cyan: #8eeeff;
    --gold: #ffd56b;
    --pink: #ff75b8;
    --shadow: 0 24px 80px rgba(0, 0, 0, 0.48);
    --font-main: "Inter", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    --font-mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
}

* {
    box-sizing: border-box;
}

html,
body {
    width: 100%;
    min-height: 100%;
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font-family: var(--font-main);
    overflow: hidden;
}

button {
    font: inherit;
}

#canvas-container {
    position: fixed;
    inset: 0;
    background: radial-gradient(circle at 70% 20%, #101b3a 0%, #050712 42%, #010208 100%);
}

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

.broadcast-tag {
    position: fixed;
    top: max(24px, env(safe-area-inset-top));
    left: max(28px, env(safe-area-inset-left));
    z-index: 18;
    color: rgba(255, 255, 255, 0.66);
    font-weight: 700;
    letter-spacing: 0.02em;
    text-shadow: 0 2px 18px rgba(0, 0, 0, 0.9);
    pointer-events: none;
}

.nyx-live-badge {
    position: fixed;
    right: max(26px, env(safe-area-inset-right));
    bottom: max(26px, env(safe-area-inset-bottom));
    z-index: 18;
    display: flex;
    align-items: center;
    gap: 12px;
    color: rgba(255, 255, 255, 0.82);
    font-family: var(--font-mono);
    font-size: 26px;
    font-weight: 700;
    letter-spacing: 0.14em;
    text-shadow: 0 2px 18px rgba(0, 0, 0, 0.9);
    pointer-events: none;
}

.nyx-live-badge .live-text {
    color: rgba(255, 255, 255, 0.58);
    font-size: 20px;
    letter-spacing: 0.18em;
}

.nyx-brand {
    color: rgba(255, 255, 255, 0.82);
}

.nyx-brand .bracket {
    color: #3b82f6;
}

.orientation-gate {
    position: fixed;
    inset: 0;
    z-index: 90;
    display: none;
    place-items: center;
    padding: 28px;
    text-align: center;
    background:
        radial-gradient(circle at 50% 32%, rgba(142, 238, 255, 0.18), transparent 34%),
        linear-gradient(180deg, rgba(1, 2, 8, 0.96), rgba(3, 6, 17, 0.98));
    pointer-events: auto;
}

.orientation-gate::before {
    content: "";
    position: absolute;
    inset: 16px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 30px;
    pointer-events: none;
}

.orientation-gate h2 {
    margin: 22px 0 10px;
    font-size: clamp(30px, 9vw, 52px);
    line-height: 0.98;
    letter-spacing: -0.06em;
}

.orientation-gate p {
    width: min(360px, 86vw);
    margin: 0 auto;
    color: var(--muted);
    font-size: 16px;
    line-height: 1.6;
}

.rotate-device-icon {
    position: relative;
    width: 84px;
    height: 84px;
    margin: 0 auto;
    border-radius: 999px;
    border: 1px solid rgba(142, 238, 255, 0.32);
    box-shadow: 0 0 46px rgba(142, 238, 255, 0.18);
}

.rotate-device-icon::before {
    content: "";
    position: absolute;
    inset: 18px 27px;
    border: 3px solid var(--cyan);
    border-radius: 9px;
    transform: rotate(90deg);
    animation: rotateHint 2.4s ease-in-out infinite;
}

.rotate-device-icon span {
    position: absolute;
    right: 13px;
    bottom: 15px;
    width: 18px;
    height: 18px;
    border-right: 3px solid var(--gold);
    border-bottom: 3px solid var(--gold);
    transform: rotate(-45deg);
}

@keyframes rotateHint {
    0%, 18% { transform: rotate(0deg); }
    48%, 100% { transform: rotate(90deg); }
}

.show-ui {
    position: fixed;
    inset: 0;
    z-index: 20;
    pointer-events: none;
}

.intro-screen,
.loading-screen {
    position: fixed;
    inset: 0;
    display: grid;
    place-items: center;
    padding: 24px;
    background:
        radial-gradient(circle at 50% 35%, rgba(31, 82, 128, 0.18), transparent 32%),
        linear-gradient(180deg, rgba(1, 2, 8, 0.88), rgba(1, 2, 8, 0.54) 48%, rgba(1, 2, 8, 0.9));
    transition: opacity 800ms ease, visibility 800ms ease;
    pointer-events: auto;
}

.intro-screen.hidden,
.loading-screen.hidden {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

.intro-card {
    width: min(760px, 100%);
    padding: clamp(28px, 6vw, 64px);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 34px;
    background: linear-gradient(145deg, rgba(6, 12, 30, 0.78), rgba(4, 6, 16, 0.56));
    box-shadow: var(--shadow), inset 0 1px 0 rgba(255, 255, 255, 0.08);
    text-align: center;
    backdrop-filter: blur(18px);
}

.eyebrow,
.runtime,
.caption-kicker,
.loading-mark {
    color: var(--cyan);
    font-family: var(--font-mono);
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.16em;
    text-transform: uppercase;
}

.intro-card h1 {
    margin: 14px 0 18px;
    font-size: clamp(42px, 9vw, 92px);
    line-height: 0.95;
    letter-spacing: -0.07em;
}

.intro-copy {
    width: min(560px, 100%);
    margin: 0 auto 30px;
    color: var(--muted);
    font-size: clamp(16px, 2vw, 19px);
    line-height: 1.7;
}

#start-show,
.controls button {
    border: 0;
    border-radius: 999px;
    color: #04101d;
    background: linear-gradient(90deg, var(--cyan), var(--gold), var(--pink));
    box-shadow: 0 18px 52px rgba(142, 238, 255, 0.22);
    cursor: pointer;
    font-weight: 800;
}

#start-show {
    padding: 16px 28px;
    font-size: 16px;
}

.runtime {
    margin: 22px 0 0;
    color: rgba(255, 255, 255, 0.55);
}

.loading-screen {
    background: rgba(1, 2, 8, 0.86);
}

.loading-screen:not(.visible) {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

.loading-bar {
    width: min(320px, 72vw);
    height: 3px;
    margin: 18px 0;
    overflow: hidden;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.13);
}

.loading-bar span {
    display: block;
    width: 42%;
    height: 100%;
    border-radius: inherit;
    background: linear-gradient(90deg, transparent, var(--cyan), var(--gold), transparent);
    animation: loadSweep 1.35s ease-in-out infinite;
}

@keyframes loadSweep {
    0% { transform: translateX(-120%); }
    100% { transform: translateX(260%); }
}

.end-actions {
    position: fixed;
    right: max(120px, calc(env(safe-area-inset-right) + 120px));
    bottom: max(42px, env(safe-area-inset-bottom));
    z-index: 32;
    display: grid;
    gap: 12px;
    justify-items: end;
    opacity: 0;
    visibility: hidden;
    transform: translateY(12px);
    transition: opacity 600ms ease, transform 600ms ease, visibility 600ms ease;
    pointer-events: auto;
}

.end-actions.visible {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.end-actions button {
    padding: 11px 18px;
    border: 1px solid rgba(255, 255, 255, 0.18);
    border-radius: 999px;
    font-size: 13px;
    font-weight: 800;
    color: var(--text);
    background: rgba(5, 9, 22, 0.72);
    box-shadow: none;
    cursor: pointer;
    backdrop-filter: blur(12px);
}

.progress {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    height: 3px;
    background: rgba(255, 255, 255, 0.08);
}

.progress span {
    display: block;
    width: 0;
    height: 100%;
    background: linear-gradient(90deg, var(--cyan), var(--gold), var(--pink));
    box-shadow: 0 0 18px rgba(142, 238, 255, 0.7);
}

.noscript {
    position: fixed;
    inset: 0;
    z-index: 99;
    display: grid;
    place-items: center;
    padding: 24px;
    background: var(--bg);
    color: var(--text);
}

@media (max-width: 760px) {
    .intro-screen {
        align-items: start;
        overflow-y: auto;
        padding: max(54px, env(safe-area-inset-top)) 14px max(18px, env(safe-area-inset-bottom));
    }

    .intro-card {
        width: min(620px, 100%);
        max-height: calc(100dvh - 72px);
        padding: 18px 20px;
        overflow-y: auto;
        border-radius: 24px;
    }

    .intro-card h1 {
        margin: 8px 0 10px;
        font-size: clamp(34px, 10vw, 56px);
        line-height: 0.92;
    }

    .eyebrow {
        margin: 0;
        font-size: 10px;
        letter-spacing: 0.14em;
    }

    .intro-copy {
        margin-bottom: 14px;
        font-size: 14px;
        line-height: 1.35;
    }

    #start-show {
        padding: 12px 18px;
        font-size: 14px;
    }

    .runtime {
        margin-top: 12px;
        font-size: 10px;
    }

    .nyx-live-badge {
        right: 16px;
        bottom: 22px;
        gap: 8px;
        font-size: 22px;
    }

    .nyx-live-badge .live-text {
        font-size: 18px;
    }

    .end-actions {
        left: 16px;
        right: auto;
        bottom: 30px;
        justify-items: start;
    }

    .broadcast-tag {
        left: 18px;
        top: 18px;
        font-size: 14px;
    }
}

@media (max-width: 1200px) and (max-height: 560px) {
    .intro-screen {
        place-items: start center;
        padding: max(28px, env(safe-area-inset-top)) 10px 10px;
    }

    .intro-card {
        width: min(520px, 100%);
        max-height: calc(100dvh - 38px);
        padding: 10px 14px;
        border-radius: 18px;
        backdrop-filter: blur(10px);
    }

    .intro-card h1 {
        margin: 4px 0 6px;
        font-size: clamp(26px, 7vw, 38px);
        line-height: 0.9;
        letter-spacing: -0.055em;
    }

    .eyebrow {
        font-size: 8px;
        letter-spacing: 0.12em;
    }

    .intro-copy {
        margin-bottom: 8px;
        font-size: 11px;
        line-height: 1.18;
    }

    #start-show {
        padding: 9px 15px;
        font-size: 12px;
    }

    .runtime {
        display: none;
    }

    .nyx-live-badge {
        right: 10px;
        bottom: 8px;
        font-size: 14px;
        gap: 5px;
    }

    .nyx-live-badge .live-text {
        font-size: 12px;
    }
}

@media (hover: none) and (pointer: coarse) and (max-width: 900px) and (orientation: portrait) {
    .orientation-gate {
        display: grid;
    }
}
