.story-popup-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.75);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    box-sizing: border-box;
}

.story-popup-content {
    background-color: #1a1a1a;
    color: #fff;
    padding: 20px;
    width: 80vw;
    max-width: 1050px;     /* ~50% wider than 700px */
    border-radius: 8px;
    position: relative;
    text-align: left;
    animation: pulse-glow 5s ease-in-out infinite;
    /* fixed visual size so buttons don't move; body scrolls internally */
    display: flex;
    flex-direction: column;
    max-height: 80vh;      /* increase vertical space */
    box-sizing: border-box;
}

.story-popup-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

.story-popup-body {
    display: flex;
    align-items: flex-start;
    gap: 22px;
    margin: 0;
    padding: 14px 8px;
    /* make the body area scroll if content grows */
    overflow: auto;
    flex: 1 1 auto;
    min-height: 180px;     /* larger minimum so visual area increased */
}

.story-popup-logo {
    flex-shrink: 0;
    display: block;
    margin: 0 auto;
    width: min(24vw, 320px); /* increase logo size proportionally */
    height: auto;
}
.story-popup-logo img {
    display: block;
    width: 100%;
    height: auto;
    object-fit: contain;
    border-radius: 8px; /* optional */
}

.story-popup-text {
    text-align: left;
    /* allow text to wrap and enable long content in scrollable area */
    min-width: 0;
}

.story-popup-content h2 {
    margin: 0 0 10px 0;
    color: #90EE90;
}

.story-popup-close {
    position: absolute;
    top: 10px;
    right: 15px;
    font-size: 28px;
    font-weight: bold;
    color: #aaa;
    cursor: pointer;
    z-index: 10;
}

.story-popup-close:hover {
    color: white;
}

.story-popup-nav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-top: 1px solid #333;
    padding-top: 15px;
    flex-shrink: 0;
    background: transparent;
}

.story-popup-nav button {
    padding: 8px 16px;
    background-color: #333;
    color: white;
    border: 1px solid #555;
    border-radius: 4px;
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.story-popup-nav button:hover {
    background-color: #555;
}

/* ensure popup-nav uses the shared button look but slightly smaller / tighter */
.story-popup-nav .menu-button,
.story-nav-button {
    /* make each nav button ~20% of the popup width */
    flex: 0 0 20%;
    max-width: 20%;
    width: 20%;
    min-width: 90px; /* prevent buttons from becoming unusably small on narrow viewports */
    padding: 6px 12px;
    font-size: 13px;
    line-height: 1;
    border-radius: 4px;
    box-sizing: border-box;
}

/* keep paging centered and allow it to grow */
.story-popup-nav #popupPaging {
    margin: 0 12px;
    color: #bbb;
    font-size: 12px;
    flex: 1 1 auto;
    text-align: center;
}

/* responsive: relax percentage on narrow screens */
@media (max-width: 700px) {
    .story-popup-nav .menu-button,
    .story-nav-button {
        flex: 0 0 28%;
        max-width: 28%;
        width: 28%;
        min-width: 72px;
    }
}

#popupMessage {
    color: #EAEAEA;
    line-height: 1.6;
    white-space: pre-wrap; /* preserve paragraphs/newlines */
}