:root {
    --abyss: #0a0a0f;
    --shadow: #151520;
    --mist: #8a8a9f;
    --blood: #a01a1a;
    --ethereal: #4a5a7f;
    --text-primary: #c5c5d4;
    --text-secondary: #9a9aaf;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Crimson Pro', serif;
    background: var(--abyss);
    color: var(--text-primary);
    overflow-x: hidden;
    position: relative;
    line-height: 1.8;
}

/* Atmospheric background */
body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0.03;
    z-index: 0;
    background-image: 
        radial-gradient(circle at 20% 50%, rgba(74, 90, 127, 0.2) 0%, transparent 50%),
        radial-gradient(circle at 80% 80%, rgba(160, 26, 26, 0.1) 0%, transparent 50%);
    animation: shimmer 20s ease-in-out infinite;
    pointer-events: none;
}

@keyframes shimmer {
    0%, 100% {
        opacity: 0.03;
    }
    50% {
        opacity: 0.06;
    }
}

.chapter-container {
    max-width: 1100px;
    margin: 0 auto;
    padding: 2rem 1.5rem;
    position: relative;
    z-index: 1;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Navigation Styles */
.chapter-nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1.5rem;
    padding: 1.5rem 0;
    border-top: 1px solid rgba(74, 90, 127, 0.2);
    border-bottom: 1px solid rgba(74, 90, 127, 0.2);
    margin-bottom: 3rem;
}

.chapter-nav.bottom-nav {
    margin-bottom: 0;
    margin-top: 4rem;
}

.nav-btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    background: rgba(21, 21, 32, 0.5);
    border: 1px solid var(--ethereal);
    color: var(--mist);
    font-family: 'Cinzel', serif;
    font-size: 0.85rem;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
    box-shadow: 0 0 15px rgba(74, 90, 127, 0.2);
}

.nav-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(74, 90, 127, 0.3), transparent);
    transition: left 0.5s ease;
}

.nav-btn:hover:not(:disabled)::before {
    left: 100%;
}

.nav-btn:hover:not(:disabled) {
    border-color: var(--blood);
    color: #ffffff;
    box-shadow: 
        0 0 20px rgba(160, 26, 26, 0.4),
        0 0 30px rgba(74, 90, 127, 0.3);
    transform: translateY(-2px);
}

.nav-btn:disabled {
    opacity: 0.3;
    cursor: not-allowed;
    border-color: rgba(74, 90, 127, 0.3);
}

.nav-btn .arrow {
    font-size: 1.2rem;
    transition: transform 0.3s ease;
}

.nav-btn.prev-btn:hover:not(:disabled) .arrow {
    transform: translateX(-3px);
}

.nav-btn.next-btn:hover:not(:disabled) .arrow {
    transform: translateX(3px);
}

.chapter-select {
    flex: 1;
    max-width: 200px;
    padding: 0.75rem 1rem;
    background: rgba(21, 21, 32, 0.7);
    border: 1px solid var(--ethereal);
    color: var(--mist);
    font-family: 'Cinzel', serif;
    font-size: 0.9rem;
    letter-spacing: 0.05em;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 0 15px rgba(74, 90, 127, 0.2);
    text-align: center;
}

.chapter-select:hover {
    border-color: var(--blood);
    box-shadow: 
        0 0 20px rgba(160, 26, 26, 0.4),
        0 0 30px rgba(74, 90, 127, 0.3);
}

.chapter-select:focus {
    outline: none;
    border-color: var(--blood);
}

.chapter-select option {
    background: var(--shadow);
    color: var(--text-primary);
    padding: 0.5rem;
}

/* Story Content */
.story-content {
    flex: 1;
    animation: fadeIn 1s ease-out;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.chapter-title {
    font-family: 'Cinzel', serif;
    font-size: clamp(2.5rem, 6vw, 4rem);
    font-weight: 600;
    text-align: center;
    margin-bottom: 3rem;
    letter-spacing: 0.1em;
    background: linear-gradient(180deg, #ffffff 0%, var(--mist) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    filter: drop-shadow(0 0 20px rgba(74, 90, 127, 0.5));
    position: relative;
}

.chapter-title::after {
    content: '';
    position: absolute;
    bottom: -1rem;
    left: 50%;
    transform: translateX(-50%);
    width: 80px;
    height: 2px;
    background: linear-gradient(90deg, transparent, var(--blood), transparent);
    box-shadow: 0 0 10px rgba(160, 26, 26, 0.6);
}

.story-text {
    font-size: 1.1rem;
    line-height: 2.2;
    color: var(--text-primary);
    text-align: justify;
    hyphens: auto;
    background: rgba(21, 21, 32, 0.6);
    border: 2px solid rgba(74, 90, 127, 0.4);
    padding: 4rem;
    border-radius: 8px;
    box-shadow: 
        0 0 40px rgba(74, 90, 127, 0.3),
        inset 0 0 60px rgba(0, 0, 0, 0.4);
}

.story-text p {
    margin-bottom: 2.5rem;
    text-indent: 2rem;
    transition: color 0.3s ease;
}

.story-text p:first-child {
    text-indent: 0;
}

.story-text p:first-child::first-letter {
    font-size: 3.5rem;
    font-family: 'Cinzel', serif;
    float: left;
    line-height: 0.9;
    margin-right: 0.5rem;
    margin-top: 0.2rem;
    color: var(--blood);
    text-shadow: 0 0 15px rgba(160, 26, 26, 0.8);
}

/* Hover effect on paragraphs */
.story-text p:hover {
    color: #ffffff;
}

.line-break {
    height: 2rem;
    position: relative;
    margin: 2rem 0;
}

.line-break::before {
    content: '◆';
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    color: var(--blood);
    font-size: 1rem;
    opacity: 0.5;
    text-shadow: 0 0 10px rgba(160, 26, 26, 0.6);
}

/* Scrollbar Styling */
::-webkit-scrollbar {
    width: 10px;
}

::-webkit-scrollbar-track {
    background: var(--shadow);
    border-left: 1px solid rgba(74, 90, 127, 0.2);
}

::-webkit-scrollbar-thumb {
    background: linear-gradient(180deg, var(--ethereal), var(--blood));
    border-radius: 10px;
    box-shadow: 0 0 10px rgba(74, 90, 127, 0.5);
}

::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(180deg, var(--blood), var(--ethereal));
}

/* Responsive Design */
@media (max-width: 768px) {
    .chapter-container {
        padding: 1.5rem 1rem;
    }
    
    .chapter-nav {
        gap: 1rem;
        padding: 1rem 0;
        margin-bottom: 2rem;
    }
    
    .chapter-nav.bottom-nav {
        margin-top: 3rem;
    }
    
    .nav-btn {
        padding: 0.6rem 1rem;
        font-size: 0.75rem;
    }
    
    .nav-btn .nav-text {
        display: none;
    }
    
    .nav-btn .arrow {
        font-size: 1.5rem;
    }
    
    .chapter-select {
        max-width: 150px;
        padding: 0.6rem 0.75rem;
        font-size: 0.8rem;
    }
    
    .chapter-title {
        margin-bottom: 2rem;
    }
    
    .story-text {
        font-size: 1.25rem;
        line-height: 2;
        text-align: left;
        padding: 2.5rem 2rem;
    }
    
    .story-text p {
        text-indent: 1.5rem;
        margin-bottom: 2rem;
    }
    
    .story-text p:first-child::first-letter {
        font-size: 2.5rem;
    }
}

@media (max-width: 480px) {
    .chapter-select {
        font-size: 0.75rem;
        padding: 0.5rem;
    }
    
    .nav-btn {
        padding: 0.5rem 0.75rem;
    }
    
    .story-text {
        font-size: 1.15rem;
        padding: 2rem 1.5rem;
    }
    
    .story-text p {
        margin-bottom: 1.75rem;
    }
}

/* Selection styling */
::selection {
    background: rgba(160, 26, 26, 0.3);
    color: #ffffff;
}

::-moz-selection {
    background: rgba(160, 26, 26, 0.3);
    color: #ffffff;
}
