body {
    font-family: 'Open Sans', sans-serif;
    margin: 0;
    background-color: #0A192F;
    color: #E3F2FD;
}

.story-container {
    width: 80vw;
    height: 80vh;
    margin: 4rem auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    background-color: rgba(0, 0, 0, 0.8);
    padding: 20px;
    border-radius: 10px;
    overflow: hidden; /* Prevent overflow */
}

.story-nav {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin-bottom: 20px;
}

.tab-button {
    background: none;
    border: 2px solid #FFD700;
    color: #FFD700;
    padding: 10px;
    margin: 0 5px;
    cursor: pointer;
    transition: background-color 0.3s;
}

.tab-button:hover {
    background-color: #FFD700;
    color: #0A192F;
}

.tab-content {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 20px;
    width: 100%;
    height: 100%;
    overflow: hidden; /* Prevent internal scrolling */
    padding: 10px;
}

.story-preview {
    background-color: #233554;
    padding: 15px;
    width: calc(33.333% - 40px); /* Make it flexible for three items in landscape */
    min-height: 200px;
    max-height: 100%;
    cursor: pointer;
    border-radius: 10px;
    transition: transform 0.3s;
    overflow: hidden; /* Prevent content overflow */
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.story-preview:hover {
    transform: scale(1.05);
}

.modal {
    display: none;
    position: fixed;
    z-index: 100;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: hidden; /* Prevent scrolling in modal */
    background-color: rgba(0, 0, 0, 0.9);
}

.modal-content {
    margin: 10% auto;
    padding: 20px;
    background-color: #233554;
    width: 80%;
    max-width: 600px;
    border-radius: 10px;
    position: relative;
}

.close {
    color: #FFD700;
    position: absolute;
    top: 10px;
    right: 20px;
    font-size: 28px;
    font-weight: bold;
}

.close:hover,
.close:focus {
    color: #fff;
    cursor: pointer;
}

/* Responsive Design */
@media screen and (max-width: 768px) {
    .story-preview {
        width: 100%; /* Stack items in portrait mode */
        max-width: none;
    }

    .tab-content {
        height: auto; /* Allow content to expand naturally in portrait */
    }
}