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

body {
    background: linear-gradient(135deg, #0f0f23 0%, #1a1a3a 50%, #2d1b69 100%);
    font-family: 'Georgia', 'Times New Roman', serif;
    line-height: 1.8;
    color: #e0e6ed;
    min-height: 100vh;
    padding: 6rem 2rem 2rem;
}

nav {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    background: rgba(15, 15, 35, 0.9);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid rgba(224, 230, 237, 0.1);
    padding: 1rem 2rem;
    z-index: 1000;
}

.nav-content {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    font-size: 1.5rem;
    font-weight: bold;
    color: #9c88ff;
    text-decoration: none;
}

.nav-links {
    display: flex;
    gap: 2rem;
    align-items: center;
}

.nav-links a {
    color: #e0e6ed;
    text-decoration: none;
    font-size: 0.95rem;
    transition: color 0.3s ease;
}

.nav-links a:hover {
    color: #9c88ff;
}

.container {
    max-width: 900px;
    margin: 0 auto;
    background: rgba(255, 255, 255, 0.03);
    border-radius: 20px;
    padding: 3rem;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(156, 136, 255, 0.1);
}

h1 {
    text-align: center;
    color: #9c88ff;
    font-size: 2.5rem;
    margin-bottom: 0.5rem;
    text-shadow: 0 2px 10px rgba(156, 136, 255, 0.3);
}

.subtitle {
    text-align: center;
    color: #b8c5d1;
    font-style: italic;
    font-size: 1.1rem;
    margin-bottom: 3rem;
}

.chapter-nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin: 2rem 0;
    padding: 1rem;
    background: rgba(156, 136, 255, 0.1);
    border-radius: 10px;
    border: 1px solid rgba(156, 136, 255, 0.2);
    flex-direction: row;
}

.chapter-nav a {
    color: #9c88ff;
    text-decoration: none;
    padding: 0.5rem 1rem;
    border-radius: 5px;
    transition: background-color 0.3s ease;
    font-size: 1.2rem;
}

.chapter-nav a:hover {
    background-color: rgba(156, 136, 255, 0.2);
}

.chapter-nav .disabled {
    color: #cccccc;
    cursor: not-allowed;
    font-size: 1.2rem;
    padding: 0.5rem 1rem;
}

.chapter-title {
    font-weight: bold;
    color: #e0e6ed;
    text-align: center;
    flex-grow: 1;
}

.tick {
    font-weight: bold;
    color: #64ffda;
    font-size: 1.3rem;
    margin: 2rem 0 1rem 0;
    text-align: center;
    text-shadow: 0 0 10px rgba(100, 255, 218, 0.5);
}

.voice-box {
    background: linear-gradient(135deg, rgba(255, 193, 7, 0.15), rgba(255, 193, 7, 0.05));
    border-left: 4px solid #ffc107;
    padding: 1.5rem;
    margin: 2.5rem 0;
    border-radius: 0 15px 15px 0;
    font-style: italic;
    line-height: 1.6;
    color: #ffecb3;
    font-size: 1.1rem;
    box-shadow: 0 4px 15px rgba(255, 193, 7, 0.1);
    position: relative;
}


.thought-box {
    background: linear-gradient(135deg, rgba(33, 150, 243, 0.15), rgba(33, 150, 243, 0.05));
    border-left: 4px solid #2196f3;
    padding: 1.5rem;
    margin: 2.5rem 0;
    border-radius: 0 15px 15px 0;
    font-style: italic;
    line-height: 1.6;
    color: #bbdefb;
    font-size: 1.05rem;
    box-shadow: 0 4px 15px rgba(33, 150, 243, 0.1);
    position: relative;
}


.system-box {
    background: linear-gradient(135deg, rgba(0, 0, 0, 0.4), rgba(0, 0, 0, 0.2));
    border: 2px solid #4caf50;
    padding: 1.5rem;
    margin: 2.5rem 0;
    border-radius: 10px;
    font-family: 'Courier New', monospace;
    color: #a5d6a7;
    font-size: 0.95rem;
    box-shadow: 0 4px 15px rgba(76, 175, 80, 0.1);
    position: relative;
}


.memory-box {
    background: linear-gradient(135deg, rgba(100, 255, 218, 0.15), rgba(100, 255, 218, 0.05));
    border-left: 4px solid #64ffda;
    padding: 1.5rem;
    margin: 2.5rem 0;
    border-radius: 0 15px 15px 0;
    font-style: italic;
    line-height: 1.6;
    color: #b2dfdb;
    box-shadow: 0 4px 15px rgba(100, 255, 218, 0.1);
    position: relative;
}


.echo-box {
    background: linear-gradient(135deg, rgba(76, 175, 80, 0.15), rgba(76, 175, 80, 0.05));
    border-left: 4px solid #4caf50;
    padding: 1.5rem;
    margin: 2.5rem 0;
    border-radius: 0 15px 15px 0;
    font-style: italic;
    line-height: 1.6;
    color: #c8e6c9;
    font-weight: bold;
    box-shadow: 0 4px 15px rgba(76, 175, 80, 0.1);
    position: relative;
}


.content-section {
    margin: 3rem 0;
}

ul {
    margin: 1.5rem 0 1.5rem 2rem;
}

li {
    margin-bottom: 0.8rem;
    color: #b8c5d1;
}

p {
    margin-bottom: 1.8rem;
    text-align: justify;
}

strong {
    color: #9c88ff;
    font-weight: bold;
}

em {
    color: #64ffda;
}

.license {
    margin-top: 3rem;
    padding: 1.5rem;
    background: rgba(156, 136, 255, 0.1);
    border-radius: 10px;
    border: 1px solid rgba(156, 136, 255, 0.2);
}

.license-header {
    font-weight: bold;
    color: #9c88ff;
    margin-bottom: 1rem;
    font-size: 1.1rem;
}

.license-content {
    display: flex;
    align-items: flex-start;
    gap: 1rem;
}

.license-content div {
    line-height: 1.6;
    font-size: 0.95rem;
}

.back-link {
    text-align: center;
    margin-top: 2rem;
}

.back-link a {
    color: #9c88ff;
    text-decoration: none;
    font-size: 1.1rem;
    padding: 0.7rem 1.5rem;
    border: 1px solid rgba(156, 136, 255, 0.3);
    border-radius: 25px;
    transition: all 0.3s ease;
    display: inline-block;
}

.back-link a:hover {
    background-color: rgba(156, 136, 255, 0.2);
    border-color: rgba(156, 136, 255, 0.5);
}

hr {
    border: none;
    height: 1px;
    background: linear-gradient(90deg, transparent, #9c88ff, transparent);
    margin: 3rem 0;
}

/* Prolog specific styles */
pre {
    background-color: rgba(0, 0, 0, 0.4);
    padding: 1.5rem;
    border-radius: 10px;
    overflow-x: auto;
    white-space: pre-wrap;
    font-family: 'Courier New', monospace;
    margin: 2rem 0;
    border-left: 4px solid #9c88ff;
    color: #a0e7e5;
}

blockquote {
    font-style: italic;
    color: #b8c5d1;
    border-left: 3px solid #9c88ff;
    padding-left: 1.5rem;
    margin: 2rem 0;
    background: rgba(156, 136, 255, 0.05);
    padding: 1rem 1rem 1rem 1.5rem;
    border-radius: 0 10px 10px 0;
}

/* Mobile responsiveness */
@media (max-width: 768px) {
    body {
        padding: 5rem 1rem 1rem;
        font-size: 0.95rem;
        line-height: 1.7;
    }
    
    .container {
        padding: 2rem 1.5rem;
        border-radius: 15px;
    }
    
    h1 {
        font-size: 2rem;
        margin-bottom: 0.3rem;
    }
    
    .subtitle {
        font-size: 1rem;
        margin-bottom: 2.5rem;
    }
    
    .chapter-nav {
        margin: 1.5rem 0 !important;
        padding: 0.8rem !important;
        display: flex !important;
        flex-direction: row !important;
        justify-content: space-between !important;
        align-items: center !important;
        gap: 0.5rem !important;
    }
    
    .chapter-nav a {
        font-size: 0.9rem;
        padding: 0.6rem 1rem;
        min-height: 44px;
        display: flex;
        align-items: center;
        justify-content: center;
        flex-shrink: 0;
        min-width: 44px;
    }
    
    .chapter-title {
        font-size: 0.8rem;
        text-align: center;
        flex-grow: 1;
        padding: 0 0.5rem;
    }
    
    .voice-box, .thought-box, .system-box, .memory-box, .echo-box {
        padding: 1.2rem;
        margin: 2rem 0;
        font-size: 1rem;
    }
    
    .content-section {
        margin: 2rem 0;
    }
    
    p {
        margin-bottom: 1.5rem;
    }
    
    .back-link a {
        font-size: 1rem;
        padding: 0.6rem 1.2rem;
    }
    
    /* Mobile Navigation */
    nav {
        padding: 0.8rem 1rem !important;
    }
    
    .nav-content {
        flex-direction: column;
        gap: 1rem;
    }
    
    .logo {
        font-size: 1.3rem;
    }
    
    .nav-links {
        display: flex !important;
        flex-wrap: wrap !important;
        justify-content: center !important;
        gap: 0.5rem !important;
    }
    
    .nav-links a {
        margin: 0.2rem 0.3rem !important;
        font-size: 0.8rem !important;
        padding: 0.3rem 0.5rem !important;
        border-radius: 4px !important;
        background: rgba(255,255,255,0.1) !important;
        min-height: 44px !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
    }
    
    .nav-links a:hover,
    .nav-links a:focus {
        background: rgba(255, 255, 255, 0.2) !important;
    }
}

@media (max-width: 480px) {
    body {
        padding: 4.5rem 0.5rem 1rem;
        font-size: 0.9rem;
        line-height: 1.6;
    }
    
    .container {
        padding: 1.5rem 1rem;
        border-radius: 12px;
    }
    
    h1 {
        font-size: 1.8rem;
        margin-bottom: 0.2rem;
    }
    
    .subtitle {
        font-size: 0.95rem;
        margin-bottom: 2rem;
    }
    
    .chapter-nav {
        margin: 1rem 0 !important;
        padding: 0.6rem !important;
        display: flex !important;
        flex-direction: row !important;
        justify-content: space-between !important;
        align-items: center !important;
        gap: 0.5rem !important;
    }
    
    .chapter-nav a {
        font-size: 0.85rem;
        padding: 0.6rem 0.8rem;
        margin: 0;
        display: flex;
        align-items: center;
        justify-content: center;
        min-height: 44px;
        min-width: 44px;
        border-radius: 8px;
        background: rgba(156, 136, 255, 0.15);
        border: 1px solid rgba(156, 136, 255, 0.3);
        flex-shrink: 0;
    }
    
    .chapter-nav a:hover {
        background: rgba(156, 136, 255, 0.25);
    }
    
    .chapter-title {
        font-size: 0.8rem;
        text-align: center;
        flex-grow: 1;
        padding: 0 0.5rem;
        color: #9c88ff;
        font-weight: bold;
        word-break: break-word;
        line-height: 1.2;
    }
    
    .voice-box, .thought-box, .system-box, .memory-box, .echo-box {
        padding: 1rem;
        margin: 1.5rem 0;
        font-size: 0.95rem;
        border-radius: 8px;
    }
    
    .content-section {
        margin: 1.5rem 0;
    }
    
    p {
        margin-bottom: 1.2rem;
    }
    
    .back-link {
        margin-top: 1.5rem;
    }
    
    .back-link a {
        font-size: 0.9rem;
        padding: 0.8rem 1rem;
        min-height: 44px;
        display: flex;
        align-items: center;
        justify-content: center;
    }
    
    /* Mobile Navigation for smallest screens */
    nav {
        padding: 0.5rem !important;
    }
    
    .nav-content {
        gap: 0.8rem;
    }
    
    .logo {
        font-size: 1.2rem;
    }
    
    .nav-links a {
        font-size: 0.75rem !important;
        padding: 0.4rem 0.3rem !important;
        margin: 0.1rem !important;
        flex: 1 1 auto !important;
        max-width: calc(50% - 0.2rem) !important;
    }
}

/* JavaScript for keyboard navigation - embedded in CSS as single <script> */
/*
<script>
document.addEventListener('DOMContentLoaded', function() {
    // Find navigation links in chapter-nav
    const chapterNav = document.querySelector('.chapter-nav');
    if (!chapterNav) return;
    
    const prevLink = chapterNav.querySelector('a[href*="kapitel-"], a[href*="prolog"]');
    const nextLink = chapterNav.querySelector('a[href*="kapitel-"]:last-of-type, a[href*="kapitel-"]:not([href*="prolog"])');
    
    // More robust detection - look for [←] and [→] patterns
    const allNavLinks = chapterNav.querySelectorAll('a');
    let prevUrl = null;
    let nextUrl = null;
    
    allNavLinks.forEach(link => {
        if (link.textContent.includes('←')) {
            prevUrl = link.href;
        } else if (link.textContent.includes('→')) {
            nextUrl = link.href;
        }
    });
    
    document.addEventListener('keydown', function(e) {
        // Only handle if no input fields are focused
        if (document.activeElement.tagName === 'INPUT' || 
            document.activeElement.tagName === 'TEXTAREA') {
            return;
        }
        
        if (e.key === 'ArrowLeft' && prevUrl) {
            window.location.href = prevUrl;
            e.preventDefault();
        } else if (e.key === 'ArrowRight' && nextUrl) {
            window.location.href = nextUrl;
            e.preventDefault();
        }
    });
    
    // Visual feedback - show keyboard shortcuts in chapter navigation
    if (prevUrl) {
        const prevElement = chapterNav.querySelector('a[href*="' + prevUrl.split('/').pop() + '"]');
        if (prevElement) {
            prevElement.title = 'Vorheriges Kapitel (Pfeiltaste links)';
        }
    }
    if (nextUrl) {
        const nextElement = chapterNav.querySelector('a[href*="' + nextUrl.split('/').pop() + '"]');
        if (nextElement) {
            nextElement.title = 'Nächstes Kapitel (Pfeiltaste rechts)';
        }
    }
});
</script>
*/