.quark-story-live {
    --accent-a: #7ce7ff;
    --accent-b: #ffd27a;
    --caption-bg: rgba(5, 9, 18, 0.46);
    --caption-border: rgba(255, 255, 255, 0.12);
    --caption-text: rgba(239, 244, 255, 0.82);
    position: relative;
    min-height: 100vh;
    overflow: hidden;
    background:
        radial-gradient(circle at 18% 22%, rgba(88, 156, 255, 0.18), transparent 28%),
        radial-gradient(circle at 78% 18%, rgba(255, 185, 88, 0.16), transparent 24%),
        radial-gradient(circle at 50% 52%, rgba(28, 58, 112, 0.22), transparent 34%),
        linear-gradient(180deg, #010309 0%, #040814 46%, #080d18 100%);
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
    transition:
        background 0.8s ease,
        --accent-a 0.8s ease,
        --accent-b 0.8s ease;
}

.quark-story-live[data-scene="universe"] {
    --accent-a: #8eb8ff;
    --accent-b: #d8a4ff;
}

.quark-story-live[data-scene="network"] {
    --accent-a: #62f0ff;
    --accent-b: #5cffc5;
}

.quark-story-live[data-scene="signal"] {
    --accent-a: #ffd27a;
    --accent-b: #7ce7ff;
}

.preview-stage {
    position: relative;
    width: 100%;
    height: 100vh;
    overflow: hidden;
}

.preview-stage::before {
    content: "";
    position: absolute;
    inset: 0;
    z-index: 2;
    pointer-events: none;
    background:
        radial-gradient(circle at 50% 50%, rgba(7, 16, 34, 0.05), transparent 24%),
        radial-gradient(circle at 50% 50%, rgba(124, 231, 255, 0.08), transparent 56%),
        linear-gradient(90deg, rgba(2, 5, 10, 0.52) 0%, rgba(2, 5, 10, 0.1) 30%, rgba(2, 5, 10, 0.1) 70%, rgba(2, 5, 10, 0.52) 100%);
}

#webglCanvas {
    position: absolute;
    inset: 0;
    display: block;
    width: 100%;
    height: 100%;
    z-index: 1;
    cursor: grab;
}

#webglCanvas:active {
    cursor: grabbing;
}

#loading {
    position: absolute;
    inset: 0;
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: center;
    background:
        radial-gradient(circle at center, rgba(34, 54, 102, 0.18), transparent 32%),
        #02040a;
    transition: opacity 0.8s ease-out;
}

#loading::before {
    content: "";
    width: 14px;
    height: 14px;
    margin-right: 18px;
    border-radius: 999px;
    background: linear-gradient(135deg, var(--accent-a), var(--accent-b));
    box-shadow: 0 0 22px rgba(124, 231, 255, 0.52);
}

#progress-container {
    width: min(46vw, 260px);
    height: 8px;
    border-radius: 999px;
    overflow: hidden;
    background: rgba(255, 255, 255, 0.12);
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.06);
}

#progress {
    width: 0%;
    height: 100%;
    border-radius: 999px;
    background: linear-gradient(90deg, var(--accent-a) 0%, var(--accent-b) 100%);
    box-shadow: 0 0 18px rgba(124, 231, 255, 0.44);
    transition: width 0.35s ease;
}

.scene-caption {
    position: absolute;
    left: 32px;
    bottom: 28px;
    z-index: 4;
    width: min(420px, calc(100vw - 32px));
    padding: 16px 18px 17px;
    border-radius: 20px;
    background: var(--caption-bg);
    border: 1px solid var(--caption-border);
    backdrop-filter: blur(18px);
    box-shadow:
        0 20px 60px rgba(0, 0, 0, 0.2),
        inset 0 0 0 1px rgba(255, 255, 255, 0.02);
}

.scene-caption::before {
    content: "";
    display: block;
    width: 58px;
    height: 3px;
    margin-bottom: 14px;
    border-radius: 999px;
    background: linear-gradient(90deg, var(--accent-a), var(--accent-b));
    box-shadow: 0 0 18px rgba(124, 231, 255, 0.38);
}

.scene-caption__title {
    padding-right: 92px;
    font-size: 11px;
    letter-spacing: 0.22em;
    text-transform: uppercase;
    color: rgba(255, 255, 255, 0.94);
}

.scene-caption__text {
    margin: 10px 0 0;
    max-width: 34ch;
    font-size: 15px;
    line-height: 1.6;
    color: var(--caption-text);
}

.scene-caption__controls {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-top: 18px;
}

.scene-caption__steps {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.scene-caption__lang {
    position: absolute;
    top: 14px;
    right: 16px;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.scene-caption__control {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 38px;
    padding: 0 14px;
    border: 1px solid rgba(255, 255, 255, 0.14);
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.04);
    color: rgba(255, 255, 255, 0.88);
    font: inherit;
    font-size: 11px;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    cursor: pointer;
    transition: background 0.22s ease, border-color 0.22s ease, transform 0.22s ease, color 0.22s ease;
}

.scene-caption__control:hover {
    transform: translateY(-1px);
    border-color: rgba(255, 255, 255, 0.28);
}

.scene-caption__control.is-active {
    background: linear-gradient(135deg, var(--accent-a), var(--accent-b));
    border-color: transparent;
    color: #061018;
}

.scene-caption__control--exit {
    background: rgba(255, 255, 255, 0.08);
}

.scene-caption__control--lang {
    min-height: 28px;
    padding: 0 10px;
    font-size: 10px;
    letter-spacing: 0.12em;
}

.scene-caption__control--step {
    min-width: 34px;
    min-height: 34px;
    padding: 0;
    font-size: 12px;
    letter-spacing: 0.08em;
}

.hero-outro {
    position: absolute;
    inset: 0;
    z-index: 4;
    display: flex;
    align-items: center;
    padding: 80px 32px;
    box-sizing: border-box;
    opacity: 0;
    pointer-events: none;
}

.hero-outro::before {
    content: "";
    position: absolute;
    inset: 0;
    background:
        linear-gradient(90deg, rgba(3, 6, 12, 0.82) 0%, rgba(3, 6, 12, 0.58) 36%, rgba(3, 6, 12, 0.08) 72%, rgba(3, 6, 12, 0.08) 100%);
    pointer-events: none;
}

.hero-outro__inner {
    position: relative;
    z-index: 1;
    max-width: 760px;
}

.hero-outro__title {
    margin: 0;
    max-width: 10ch;
    font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    font-size: clamp(40px, 6vw, 76px);
    line-height: 0.96;
    letter-spacing: -0.05em;
    text-transform: uppercase;
    color: #ffffff;
}

.hero-outro__text {
    margin: 26px 0 0;
    max-width: 54ch;
    font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    font-size: clamp(16px, 1.8vw, 20px);
    line-height: 1.65;
    color: rgba(244, 247, 255, 0.86);
}

.hero-outro__actions {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    margin-top: 34px;
}

.hero-outro__button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 180px;
    padding: 15px 24px;
    border-radius: 999px;
    text-decoration: none;
    font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    font-size: 14px;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    transition: transform 0.25s ease, border-color 0.25s ease, background 0.25s ease;
    pointer-events: auto;
}

.hero-outro__button:hover {
    transform: translateY(-2px);
}

.hero-outro__button--primary {
    color: #05070d;
    background: linear-gradient(135deg, var(--accent-a), var(--accent-b));
    box-shadow: 0 14px 34px rgba(124, 231, 255, 0.18);
}

.hero-outro__button--ghost {
    color: #ffffff;
    border: 1px solid rgba(255, 255, 255, 0.18);
    background: rgba(12, 16, 28, 0.28);
}

@media (max-width: 767px) {
    .preview-stage::before {
        background:
            radial-gradient(circle at 50% 50%, rgba(7, 16, 34, 0.1), transparent 30%),
            linear-gradient(180deg, rgba(2, 5, 10, 0.22), rgba(2, 5, 10, 0.54));
    }

    #progress-container {
        width: min(70vw, 240px);
    }

    .scene-caption {
        left: 16px;
        right: 16px;
        bottom: 16px;
        width: auto;
        padding: 14px 16px 15px;
    }

    .scene-caption__text {
        max-width: none;
        font-size: 14px;
    }

    .scene-caption__controls {
        flex-wrap: wrap;
        align-items: stretch;
    }

    .scene-caption__steps {
        flex: 0 0 auto;
    }

    .scene-caption__title {
        padding-right: 84px;
    }

    .scene-caption__lang {
        top: 12px;
        right: 14px;
        width: auto;
    }

    .scene-caption__control--exit {
        flex: 0 0 auto;
    }

    .scene-caption__control--lang {
        flex: 0 0 auto;
        min-height: 26px;
        padding: 0 9px;
    }

    .scene-caption__control--step {
        min-width: 30px;
        min-height: 30px;
        font-size: 11px;
    }

    .hero-outro {
        align-items: flex-end;
        padding: 18px 16px calc(42px + env(safe-area-inset-bottom, 0px));
    }

    .hero-outro::before {
        background:
            linear-gradient(180deg, rgba(3, 6, 12, 0.18) 0%, rgba(3, 6, 12, 0.36) 34%, rgba(3, 6, 12, 0.84) 100%);
    }

    .hero-outro__inner {
        width: min(100%, 360px);
        max-width: 100%;
    }

    .hero-outro__title {
        max-width: 9.5ch;
        font-size: clamp(28px, 8.2vw, 40px);
        line-height: 0.96;
    }

    .hero-outro__text {
        margin-top: 16px;
        max-width: 32ch;
        font-size: 13px;
        line-height: 1.5;
    }

    .hero-outro__text br {
        display: none;
    }

    .hero-outro__actions {
        width: 100%;
        gap: 10px;
        margin-top: 18px;
    }

    .hero-outro__button {
        width: 100%;
        min-width: 0;
        box-sizing: border-box;
        padding: 13px 18px;
        font-size: 13px;
    }
}
