/* Story Page Specific Styles */

body {
    background-color: var(--bg-dark);
    color: var(--text-main);
    font-family: var(--font-body);
    overflow-x: hidden;
    /* Background is unified in style.css (Preplus) */
    background-image: none;
}

.story-nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 2rem;
    position: sticky;
    top: 0;
    z-index: 100;
    margin-bottom: 2rem;
    border-radius: 0 0 16px 16px;
    border-top: none;
}

.back-link {
    color: var(--primary);
    text-decoration: none;
    font-family: var(--font-heading);
    letter-spacing: 1px;
    transition: color 0.3s;
}

.back-link:hover {
    color: var(--secondary);
    text-shadow: 0 0 10px var(--secondary);
}

.story-header-title {
    font-family: var(--font-heading);
    color: var(--secondary);
    font-size: 1.5rem;
    letter-spacing: 2px;
}

.story-container {
    display: flex;
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 2rem 4rem;
    gap: 2rem;
    min-height: 80vh;
}

/* Sidebar */
.chapter-sidebar {
    width: 300px;
    flex-shrink: 0;
    max-height: calc(100vh - 120px);
    position: sticky;
    top: 100px;
    padding: 1.5rem;
    overflow-y: auto;
}

/* Custom scrollbar for sidebar */
.chapter-sidebar::-webkit-scrollbar {
    width: 6px;
}

.chapter-sidebar::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 3px;
}

.chapter-sidebar::-webkit-scrollbar-thumb {
    background: var(--primary);
    border-radius: 3px;
}

.chapter-sidebar::-webkit-scrollbar-thumb:hover {
    background: var(--secondary);
}

.chapter-sidebar h3 {
    color: var(--primary);
    font-family: var(--font-heading);
    margin-bottom: 1.5rem;
    border-bottom: 1px solid var(--glass-border);
    padding-bottom: 0.5rem;
}

#chapter-list {
    list-style: none;
    padding: 0;
}

#chapter-list li {
    padding: 1rem;
    margin-bottom: 0.5rem;
    cursor: pointer;
    border-radius: 8px;
    transition: all 0.3s;
    font-size: 0.95rem;
    border: 1px solid transparent;
}

#chapter-list li:hover {
    background: rgba(255, 255, 255, 0.05);
    border-color: var(--glass-border);
}

#chapter-list li.active {
    background: rgba(0, 168, 255, 0.1);
    border-color: var(--primary);
    color: var(--primary);
    box-shadow: 0 0 15px rgba(0, 168, 255, 0.2);
}

/* Content Area */
.chapter-content {
    flex-grow: 1;
    padding: 3rem;
    min-height: 50vh;
}

#chapter-title {
    font-family: var(--font-heading);
    color: var(--secondary);
    font-size: 2.5rem;
    margin-bottom: 2rem;
    border-bottom: 2px solid var(--primary);
    padding-bottom: 1rem;
}

.story-text-content {
    font-family: var(--font-jp);
    font-size: 1.1rem;
    line-height: 2.2;
    white-space: pre-wrap;
    /* Preserve formatting */
    color: #e0e0e0;
}

/* Quiz Section */
.quiz-trigger-section {
    margin-top: 4rem;
    padding-top: 2rem;
    border-top: 1px solid var(--glass-border);
    text-align: center;
}

.cyber-btn {
    background: transparent;
    color: var(--primary);
    border: 1px solid var(--primary);
    padding: 1rem 3rem;
    font-family: var(--font-heading);
    font-size: 1.2rem;
    cursor: pointer;
    transition: all 0.3s;
    position: relative;
    overflow: hidden;
    text-transform: uppercase;
    letter-spacing: 2px;
}

.cyber-btn:hover {
    background: var(--primary);
    color: #000;
    box-shadow: 0 0 20px var(--primary-glow);
}

.cyber-btn.small {
    padding: 0.5rem 1.5rem;
    font-size: 1rem;
}

/* Quiz Modal */
.quiz-content {
    max-width: 600px;
    width: 90%;
    padding: 2rem;
    background: #0a0a0f;
    /* Darker background for readability */
    max-height: 90vh;
    overflow-y: auto;
    position: relative;
}

/* Scrollbar styling for quiz modal */
.quiz-content::-webkit-scrollbar {
    width: 8px;
}

.quiz-content::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 4px;
}

.quiz-content::-webkit-scrollbar-thumb {
    background: var(--primary);
    border-radius: 4px;
}

.quiz-content::-webkit-scrollbar-thumb:hover {
    background: var(--secondary);
}

.question-block {
    margin-bottom: 2rem;
    border-bottom: 1px solid var(--glass-border);
    padding-bottom: 1.5rem;
}

.question-text {
    font-size: 1.1rem;
    margin-bottom: 1rem;
    color: var(--text-main);
}

.options-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.option-label {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    padding: 0.8rem;
    border: 1px solid var(--glass-border);
    border-radius: 4px;
    cursor: pointer;
    transition: background 0.2s;
}

.option-label:hover {
    background: rgba(255, 255, 255, 0.05);
}

.option-label input[type="radio"] {
    accent-color: var(--primary);
}

.quiz-footer {
    text-align: center;
    margin-top: 2rem;
}

#quiz-result {
    text-align: center;
    margin-top: 1rem;
    padding: 1rem;
    border-radius: 8px;
}

#quiz-result.success {
    background: rgba(0, 255, 0, 0.1);
    border: 1px solid #00ff00;
}

#quiz-result.failure {
    background: rgba(255, 0, 0, 0.1);
    border: 1px solid #ff0000;
}

.hidden {
    display: none;
}

/* Mobile Responsive */
@media (max-width: 768px) {
    .story-container {
        flex-direction: column;
        padding: 0 1rem 4rem;
    }

    .chapter-sidebar {
        width: 100%;
        position: relative;
        top: 0;
        margin-bottom: 2rem;
    }

    .chapter-content {
        padding: 1.5rem;
    }

    .story-nav {
        flex-direction: column;
        gap: 1rem;
        padding: 1rem;
    }
}

/* Override fade-in-up from style.css for story page */
.fade-in-up {
    opacity: 1 !important;
    transform: translateY(0) !important;
}

/* Fix close button position for scrollable quiz modal */
.quiz-content .close-modal {
    position: sticky;
    top: 1rem;
    right: 1rem;
    float: right;
    margin-bottom: -2rem;
    z-index: 10;
}