.figure-story {
    --story-plum: #8a5479;
    --story-plum-soft: #f6f0f4;
    --story-ink: #26232a;
    --story-muted: #6d6770;
    width: 100%;
    max-width: 52.5em;
    margin: 2rem auto 0;
    padding: 0;
    color: var(--story-ink);
    text-align: left;
}

.figure-story *,
.figure-story *::before,
.figure-story *::after {
    box-sizing: border-box;
}

.story-tabs {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 0.18rem;
    margin-bottom: 0.4rem;
}

.story-tab {
    min-width: 0;
    min-height: 2.25rem;
    padding: 0.16rem 0.2rem;
    border: 1px solid #ded8dc;
    border-radius: 0.38rem 0.38rem 0 0;
    background: #faf9fa;
    color: #655f67;
    font-family: inherit;
    font-size: 1rem;
    font-weight: 600;
    line-height: 0.98;
    cursor: pointer;
    transition: color 160ms ease, background 160ms ease, border-color 160ms ease;
}

#story-tab-1,
#story-tab-2,
#story-tab-3,
#story-tab-4 {
    white-space: nowrap;
}

.story-tab:hover,
.story-tab:focus-visible {
    color: var(--story-plum);
    border-color: #c9b6c2;
    outline: none;
}

.story-tab.is-active {
    color: #fff;
    background: var(--story-plum);
    border-color: var(--story-plum);
}

.story-frame {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    align-items: stretch;
    height: 27rem;
    border: 1px solid #ded8dc;
    border-radius: 0.2rem 0.2rem 0.75rem 0.75rem;
    overflow: hidden;
    background: #fff;
    box-shadow: 0 0.65rem 1.8rem rgba(46, 34, 44, 0.07);
}

.story-panels {
    display: grid;
    min-width: 0;
}

.story-panel {
    min-width: 0;
    min-height: 0;
    height: 100%;
}

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

.overview-panel {
    display: grid;
    place-items: center;
    padding: 0.25rem 0;
}

.overview-panel img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.figure-story[data-active-tab="0"] .story-frame {
    height: auto;
    aspect-ratio: auto;
    overflow: visible;
}

.figure-story[data-active-tab="0"] .story-panels {
    display: block;
    height: auto;
}

.figure-story[data-active-tab="0"] .story-panel {
    height: auto;
}

.figure-story[data-active-tab="3"] .story-frame,
.figure-story[data-active-tab="4"] .story-frame {
    height: auto;
    aspect-ratio: auto;
    overflow: visible;
}

.story-arrow {
    width: 100%;
    padding: 0;
    border: 0;
    background: #fbfafb;
    color: #8e858c;
    cursor: pointer;
    transition: color 160ms ease, background 160ms ease;
}

.story-arrow:hover,
.story-arrow:focus-visible {
    color: var(--story-plum);
    background: var(--story-plum-soft);
    outline: none;
}

.explorer-panel {
    display: grid;
    height: 100%;
    grid-template-columns: minmax(10.5rem, 0.34fr) minmax(0, 0.66fr);
}

.choice-column {
    padding: 0.45rem 0.72rem;
    border-right: 1px solid #e8e3e6;
    background: #fff;
    overflow-y: auto;
}

.choice-list {
    display: flex;
    flex-direction: column;
    gap: 0;
}

.choice-button {
    width: 100%;
    padding: 0.32rem 0.2rem;
    border: 0;
    border-bottom: 1px solid #eee9ec;
    border-radius: 0;
    background: transparent;
    color: var(--story-ink);
    font-family: "Source Code Pro", "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
    font-size: 0.67rem;
    font-weight: 400;
    font-style: italic;
    line-height: 1.25;
    text-align: left;
    opacity: 0.42;
    cursor: pointer;
    transition: color 150ms ease, opacity 150ms ease;
}

.choice-button:last-child {
    border-bottom: 0;
}

.choice-button:hover,
.choice-button:focus-visible {
    color: #69425f;
    opacity: 0.75;
    outline: none;
}

.choice-button.is-active {
    color: #4f2f47;
    font-weight: 700;
    opacity: 1;
}

.result-column {
    position: relative;
    display: flex;
    min-width: 0;
    min-height: 0;
    height: 100%;
    flex-direction: column;
    align-items: stretch;
    justify-content: flex-start;
    padding: 0.72rem;
    overflow-x: hidden;
    overflow-y: auto;
}

.trajectory-media {
    position: relative;
    display: grid;
    min-height: 0;
    flex: 1;
    place-items: center;
    overflow: hidden;
}

.trajectory-media video,
.trajectory-media img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: contain;
    transform-origin: center;
}

[data-result="monomer"][data-choice="0"] video { transform: translateX(10%); }

[data-result="interface"][data-choice="0"] :is(video, img),
[data-result="interface"][data-choice="1"] :is(video, img),
[data-result="interface"][data-choice="2"] :is(video, img) {
    transform: translateY(-6%) scale(1.40);
}

[data-result="interface"][data-choice="3"] :is(video, img),
[data-result="interface"][data-choice="4"] :is(video, img),
[data-result="interface"][data-choice="5"] :is(video, img),
[data-result="interface"][data-choice="6"] :is(video, img) {
    transform: translateY(-4%) scale(1.18);
}

.target-label {
    position: absolute;
    top: 0.78rem;
    left: 0.9rem;
    z-index: 1;
    color: #777078;
    font-family: "Source Code Pro", "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
    font-size: 0.76rem;
    font-style: italic;
    font-weight: 400;
    line-height: 1.35;
    pointer-events: none;
}

.target-label span {
    display: block;
}

.target-label sub {
    position: relative;
    bottom: -0.12em;
    font-size: 0.72em;
    line-height: 0;
}

.static-figure-panel,
.static-figure-panel a,
.static-figure-panel img {
    display: block;
    width: 100%;
    height: auto;
}

.story-caption {
    margin-top: 0.5rem;
    padding: 0.62rem 0.78rem;
    border: 1px solid #e1dce0;
    border-radius: 0.55rem;
    background: #faf9fa;
}

.story-caption p {
    width: auto;
    margin: 0;
    font-size: 1rem;
    line-height: 1.4;
    text-align: left;
}

.story-pagination {
    display: flex;
    justify-content: center;
    gap: 0.35rem;
    margin-top: 0.55rem;
}

.story-pagination span {
    width: 0.38rem;
    height: 0.38rem;
    border-radius: 50%;
    background: #d6cfd3;
}

.story-pagination span.is-active {
    width: 1.1rem;
    border-radius: 999px;
    background: var(--story-plum);
}

@media (max-width: 760px) {
    .figure-story {
        width: calc(100% + 1rem);
        margin-left: -0.5rem;
    }

    .story-tabs {
        display: flex;
        padding-bottom: 0.15rem;
        overflow-x: auto;
        scroll-snap-type: x mandatory;
        scrollbar-width: none;
    }

    .story-tabs::-webkit-scrollbar {
        display: none;
    }

    .story-tab {
        min-width: 8rem;
        flex: 1 0 8rem;
        scroll-snap-align: start;
    }

    .story-frame {
        grid-template-columns: minmax(0, 1fr);
        height: 31rem;
    }

    .figure-story[data-active-tab="0"] .story-frame {
        height: auto;
        aspect-ratio: auto;
    }

    .figure-story[data-active-tab="3"] .story-frame,
    .figure-story[data-active-tab="4"] .story-frame {
        height: auto;
        aspect-ratio: auto;
    }

    .explorer-panel {
        grid-template-columns: minmax(0, 1fr);
        grid-template-rows: auto minmax(0, 1fr);
    }

    .choice-column {
        padding: 0.72rem;
        border-right: 0;
        border-bottom: 1px solid #e8e3e6;
        overflow: hidden;
    }

    .choice-list {
        flex-direction: row;
        padding-bottom: 0.2rem;
        overflow-x: auto;
        scroll-snap-type: x proximity;
    }

    .choice-button {
        width: 13rem;
        min-width: 13rem;
        padding: 0.5rem 0.25rem;
        font-size: 0.7rem;
        scroll-snap-align: start;
    }

    .result-column {
        min-height: 0;
        padding: 0.55rem;
    }

    .trajectory-media {
        min-height: 17rem;
    }

}

@media (max-width: 480px) {
    .story-frame {
        grid-template-columns: minmax(0, 1fr);
    }

    .story-arrow {
        font-size: 0.75rem;
    }

}

@media (prefers-reduced-motion: reduce) {
    .story-tab,
    .story-arrow {
        transition: none;
    }
}
