/* FullMoon MMO - Global Story Overlay */

#story-overlay-root {
    position: fixed;
    inset: 0;
    z-index: 1100;
    pointer-events: none;
}

.story-overlay {
    position: absolute;
    inset: 0;
    display: grid;
    place-items: center;
    opacity: 0;
    transition: opacity 220ms ease;
    pointer-events: auto;
}

.story-overlay--open {
    opacity: 1;
}

.story-overlay__backdrop {
    position: absolute;
    inset: 0;
    background:
        radial-gradient(80% 65% at 50% 58%, rgba(10, 10, 16, 0.18) 0%, rgba(5, 5, 9, 0.55) 70%, rgba(3, 3, 6, 0.78) 100%);
    backdrop-filter: blur(1.5px);
}

.story-overlay__panel {
    position: relative;
    width: min(920px, 96vw);
    margin: 0 2vw;
    border-radius: 14px;
    background: linear-gradient(180deg, rgba(22, 20, 25, 0.94), rgba(13, 11, 18, 0.9));
    border: 1px solid rgba(212, 175, 55, 0.35);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.55);
    overflow: hidden;
    transform: translateY(10px) scale(0.985);
    animation: story-overlay-panel-in 260ms ease forwards;
}

@keyframes story-overlay-panel-in {
    to {
        transform: translateY(0) scale(1);
    }
}

.story-overlay__header {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    padding: 14px 16px 10px;
    border-bottom: 1px solid rgba(212, 175, 55, 0.2);
    color: #f1e5c8;
}

.story-overlay__header strong {
    font-family: 'Cinzel', serif;
    font-size: 1rem;
}

.story-overlay__header span {
    color: rgba(241, 229, 200, 0.78);
    font-size: 0.85rem;
}

.story-overlay__body {
    padding: 16px 16px 10px;
    display: grid;
    grid-template-columns: 150px 1fr;
    gap: 14px;
    align-items: start;
}

.story-overlay__body p {
    margin: 0;
    color: #f6f0e2;
    font-size: 1.08rem;
    line-height: 1.6;
    text-wrap: pretty;
}

.story-overlay__panel--right .story-overlay__body {
    grid-template-columns: 1fr 150px;
}

.story-overlay__panel--right .story-overlay__portrait {
    order: 2;
}

.story-overlay__panel--right .story-overlay__dialogue {
    order: 1;
}

.story-overlay__portrait {
    display: grid;
    gap: 8px;
    position: relative;
}

.story-overlay__portrait-avatar {
    width: 132px;
    height: 158px;
    border-radius: 12px;
    display: grid;
    place-items: center;
    font-family: 'Cinzel', serif;
    font-weight: 700;
    font-size: 2rem;
    color: #f9edd2;
    background:
        radial-gradient(circle at 20% 22%, hsla(var(--story-portrait-hue), 78%, 72%, 0.5), transparent 55%),
        radial-gradient(circle at 82% 82%, hsla(calc(var(--story-portrait-hue) + 50), 70%, 52%, 0.36), transparent 62%),
        linear-gradient(165deg, rgba(30, 24, 26, 0.95), rgba(12, 10, 14, 0.95));
    border: 1px solid rgba(212, 175, 55, 0.26);
    box-shadow: inset 0 0 24px rgba(0, 0, 0, 0.32);
}

.story-overlay__portrait-img {
    width: 132px;
    height: 158px;
    object-fit: cover;
    border-radius: 12px;
    border: 1px solid rgba(212, 175, 55, 0.28);
    background: rgba(10, 10, 14, 0.55);
}

.story-overlay__nameplate {
    border: 1px solid rgba(212, 175, 55, 0.25);
    border-radius: 8px;
    padding: 6px 8px;
    font-size: 0.82rem;
    color: rgba(247, 237, 215, 0.88);
    background: rgba(20, 15, 16, 0.82);
    text-align: center;
}

.story-overlay__dialogue {
    min-height: 146px;
    padding-top: 4px;
}

.story-overlay__footer {
    display: grid;
    gap: 8px;
    padding: 10px 14px 14px;
}

.story-overlay__hint {
    text-align: center;
    color: rgba(241, 229, 200, 0.76);
    font-size: 0.86rem;
}

.story-overlay__choice {
    appearance: none;
    border: 1px solid rgba(212, 175, 55, 0.38);
    border-radius: 10px;
    background: rgba(33, 27, 24, 0.82);
    color: #f7edd7;
    padding: 10px 12px;
    text-align: left;
    cursor: pointer;
}

.story-overlay__choice span {
    display: block;
    font-weight: 700;
}

.story-overlay__choice small {
    display: block;
    margin-top: 3px;
    color: rgba(247, 237, 215, 0.78);
    font-size: 0.78rem;
}

.story-overlay__choice--end {
    text-align: center;
}

body.story-overlay-open #app {
    user-select: none;
}

@media (max-width: 760px) {
    .story-overlay__body,
    .story-overlay__panel--right .story-overlay__body {
        grid-template-columns: 1fr;
    }

    .story-overlay__portrait,
    .story-overlay__panel--right .story-overlay__portrait {
        order: 1;
        grid-template-columns: 90px 1fr;
        align-items: center;
    }

    .story-overlay__portrait-avatar {
        width: 86px;
        height: 100px;
        font-size: 1.35rem;
    }

    .story-overlay__portrait-img {
        width: 86px;
        height: 100px;
    }

    .story-overlay__dialogue,
    .story-overlay__panel--right .story-overlay__dialogue {
        order: 2;
        min-height: 112px;
    }
}
