:root {
    --bg-color: #121212;
    --card-bg: #1e1e1e;
    --text-color: #e0e0e0;
    --accent-color: #bb86fc;
    --secondary-text: #a0a0a0;
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background-color: var(--bg-color);
    color: var(--text-color);
    line-height: 1.6;
}

a {
    color: var(--accent-color);
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

.container {
    max-width: 800px;
    margin: 0 auto;
    padding: 20px;
}

/* Header */
header {
    text-align: center;
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 1px solid #333;
}

h1 {
    font-size: 2rem;
    margin-bottom: 10px;
}

.meta {
    color: var(--secondary-text);
    font-size: 0.9rem;
}

/* Chapter List */
.chapter-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 15px;
}

.chapter-item {
    background-color: var(--card-bg);
    padding: 15px;
    border-radius: 8px;
    text-align: center;
    transition: transform 0.2s, background-color 0.2s;
    cursor: pointer;
    display: block;
    color: var(--text-color);
}

.chapter-item:hover {
    transform: translateY(-2px);
    background-color: #2c2c2c;
    text-decoration: none;
}

.chapter-number {
    font-size: 1.2rem;
    font-weight: bold;
    display: block;
    margin-bottom: 5px;
}

.chapter-title {
    font-size: 0.9rem;
    color: var(--secondary-text);
}

/* Reader View */
.reader-container {
    max-width: 1000px; /* Wider for identifying spread pages if needed, but usually vertical scroll */
    margin: 0 auto;
    /* padding removed: UI is now part of the flow */
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;
    min-height: 100vh;
}

.comic-page {
    max-width: 100%;
    height: auto;
    display: block;
    margin: 0 auto;
}

.reader-nav {
    display: flex;
    justify-content: space-between;
    align-items: center; /* Vertically center items */
    padding: 15px 20px;
    background-color: var(--card-bg);
    width: 100%;
    z-index: 100;
    box-shadow: 0 -2px 10px rgba(0,0,0,0.5);
    /* Default: Static (part of flow) */
    position: static; 
}

.reader-nav.top {
    /* Top nav specific styles */
    box-shadow: 0 2px 10px rgba(0,0,0,0.5);
    border-bottom: none;
}

/* Fixed Mode (Overlay) */
.reader-nav.fixed-mode {
    position: fixed;
    left: 0; 
    right: 0;
    margin: 0 auto;
    max-width: 1000px;
    /* No default animation - we apply it conditionally */
}

.reader-nav.top.fixed-mode {
    top: 0;
}

.reader-nav.bottom.fixed-mode {
    bottom: 0;
}

/* Dynamic Slide Animation */
.reader-nav.fixed-mode.animate-dynamic {
    animation: slide-dynamic 0.05s ease-out;
}

@keyframes slide-dynamic {
    from { transform: translateY(var(--translate-start)); }
    to { transform: translateY(0); }
}

/* Placeholder class (will be applied to divs created by JS) */
.nav-placeholder {
    width: 100%;
    flex-shrink: 0; /* Prevent shrinking */
}

/* Previous hidden classes are no longer needed for logic, but we keep button styles */
.nav-btn {
    display: inline-block; /* Ensure proper box model rendering */
    padding: 8px 15px; /* Slightly smaller padding */
    background-color: var(--accent-color);
    white-space: nowrap; /* Prevent text wrapping */
    color: #121212;
    border-radius: 4px;
    font-weight: bold;
    text-decoration: none; /* No underline */
    line-height: 1.5; /* Normalize line height */
    vertical-align: middle; /* Align with text */
    user-select: none; /* Prevent text selection */
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    cursor: pointer;
    border: none;
    outline: none;
    -webkit-tap-highlight-color: transparent; /* Remove blue highlight on touch */
}

.nav-btn:hover, .nav-btn:active, .nav-btn:focus {
    text-decoration: none;
    color: #121212;
    outline: none;
}
.nav-btn.disabled {
    opacity: 0.5;
    pointer-events: none;
    background-color: #555;
    color: #888;
}

.nav-center {
    display: flex;
    align-items: center;
}

/* Mobile Adjustments */
@media (max-width: 600px) {
    .container {
        padding: 10px;
    }
    
    .chapter-list {
        grid-template-columns: 1fr; /* List view on mobile */
    }
    
    .chapter-item {
        display: flex;
        justify-content: space-between;
        align-items: center;
        text-align: left;
    }
    
    .chapter-number {
        margin-bottom: 0;
        margin-right: 10px;
    }

    .comic-page {
        width: 100%; /* Full width on mobile */
    }
}
