/* Base styles */
:root {
    --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu, sans-serif;
    --font-mono: "SF Mono", "Fira Code", "Fira Mono", Menlo, Monaco, monospace;
}

/* Light theme */
body {
    --bg: #fafafa;
    --bg-secondary: #f0f0f0;
    --text: #222;
    --text-secondary: #666;
    --border: #ddd;
    --accent: #0066cc;
    --accent-hover: #0052a3;
}

/* Dark theme */
body.dark {
    --bg: #1a1a1a;
    --bg-secondary: #2a2a2a;
    --text: #e0e0e0;
    --text-secondary: #999;
    --border: #444;
    --accent: #4a9eff;
    --accent-hover: #6ab0ff;
}

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

body {
    font-family: var(--font-sans);
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    min-height: 100vh;
}

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

a:hover {
    color: var(--accent-hover);
}

/* Navigation */
.main-nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 1.5rem;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border);
}

.nav-brand {
    font-weight: 600;
    font-size: 1.1rem;
}

.btn-icon {
    background: none;
    border: none;
    font-size: 1.25rem;
    cursor: pointer;
    padding: 0.5rem;
    color: var(--text);
}

/* Theme toggle icons */
body .light-icon { display: none; }
body .dark-icon { display: inline; }
body.dark .light-icon { display: inline; }
body.dark .dark-icon { display: none; }

/* Library */
.library {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem 1.5rem;
}

.library-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    flex-wrap: wrap;
    gap: 1rem;
}

.library-header h1 {
    font-size: 1.75rem;
}

.filters {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
}

.filter-group {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

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

.filter-group select {
    padding: 0.4rem 0.8rem;
    border: 1px solid var(--border);
    border-radius: 4px;
    background: var(--bg-secondary);
    color: var(--text);
    font-size: 0.9rem;
}

/* Novel grid */
.novel-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 1.5rem;
}

.novel-card {
    background: var(--bg-secondary);
    border-radius: 8px;
    overflow: hidden;
    transition: transform 0.2s, box-shadow 0.2s;
    display: block;
    color: var(--text);
}

.novel-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
}

.novel-cover {
    aspect-ratio: 2/3;
    overflow: hidden;
    background: var(--border);
}

.novel-cover img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.no-cover {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 3rem;
    font-weight: bold;
    color: var(--text-secondary);
    background: linear-gradient(135deg, var(--bg-secondary), var(--border));
}

.no-cover.large {
    font-size: 5rem;
}

.novel-info {
    padding: 1rem;
}

.novel-title {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 0.25rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.novel-author {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
}

.novel-meta {
    display: flex;
    gap: 0.5rem;
    align-items: center;
    flex-wrap: wrap;
}

.badge {
    font-size: 0.75rem;
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
    background: var(--border);
    text-transform: capitalize;
}

.badge-must_read { background: #ef4444; color: white; }
.badge-regular { background: #3b82f6; color: white; }
.badge-queue { background: #6b7280; color: white; }
.badge-on_hold { background: #f59e0b; color: white; }
.badge-dropped { background: #dc2626; color: white; }
.badge-finished { background: #10b981; color: white; }
.badge-ongoing { background: #8b5cf6; color: white; }
.badge-completed { background: #10b981; color: white; }
.badge-hiatus { background: #f59e0b; color: white; }
.badge-translation { background: #0d9488; color: white; }

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

.empty-state {
    text-align: center;
    padding: 4rem 2rem;
    color: var(--text-secondary);
}

.empty-state code {
    background: var(--bg-secondary);
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
    font-family: var(--font-mono);
    font-size: 0.9rem;
}

.hint {
    margin-top: 1rem;
}

/* Novel page */
.novel-page {
    max-width: 900px;
    margin: 0 auto;
    padding: 2rem 1.5rem;
}

.novel-header {
    display: flex;
    gap: 2rem;
    margin-bottom: 3rem;
}

.novel-cover-large {
    flex-shrink: 0;
    width: 200px;
}

.novel-cover-large img,
.novel-cover-large .no-cover {
    width: 100%;
    aspect-ratio: 2/3;
    border-radius: 8px;
    object-fit: cover;
}

.novel-details h1 {
    font-size: 1.75rem;
    margin-bottom: 0.5rem;
}

.novel-details .author {
    color: var(--text-secondary);
    margin-bottom: 1rem;
}

.novel-details .meta {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    margin-bottom: 1rem;
}

.novel-details .description {
    color: var(--text-secondary);
    font-size: 0.95rem;
    line-height: 1.7;
}

.status-row {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
}

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

.external-links {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem;
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border);
}

.links-label {
    color: var(--text-secondary);
    font-size: 0.85rem;
}

.external-link {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.3rem 0.6rem;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 4px;
    font-size: 0.8rem;
    color: var(--text);
    transition: background 0.2s, border-color 0.2s;
}

.external-link:hover {
    background: var(--border);
    border-color: var(--accent);
    color: var(--text);
}

.novelupdates-link {
    margin-top: 1rem;
}

.btn-novelupdates {
    background: #5865f2;
    color: white;
    border: none;
}

.btn-novelupdates:hover {
    background: #4752c4;
    color: white;
}

.btn-fanfiction {
    background: #333399;
    color: white;
    border: none;
}

.btn-fanfiction:hover {
    background: #222266;
    color: white;
}

.chapter-list h2 {
    font-size: 1.25rem;
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--border);
}

.chapter-list ul {
    list-style: none;
}

.chapter-list li {
    border-bottom: 1px solid var(--border);
}

.chapter-list li:last-child {
    border-bottom: none;
}

.chapter-list a {
    display: flex;
    gap: 1rem;
    padding: 0.75rem 0.5rem;
    color: var(--text);
    transition: background 0.2s;
}

.chapter-list a:hover {
    background: var(--bg-secondary);
}

.chapter-number {
    color: var(--text-secondary);
    min-width: 3rem;
}

.chapter-list .empty {
    color: var(--text-secondary);
    padding: 2rem;
    text-align: center;
}

/* Reader */
.reader {
    max-width: 65ch;
    margin: 0 auto;
    padding: 0 1.5rem;
}

.reader-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 0;
    border-bottom: 1px solid var(--border);
    margin-bottom: 2rem;
    flex-wrap: wrap;
    gap: 1rem;
}

.back-link {
    font-size: 0.9rem;
}

.chapter-nav-header select {
    padding: 0.4rem 0.8rem;
    border: 1px solid var(--border);
    border-radius: 4px;
    background: var(--bg-secondary);
    color: var(--text);
    font-size: 0.85rem;
    max-width: 250px;
}

.chapter-content {
    padding-bottom: 3rem;
}

.chapter-content .chapter-title {
    font-size: 1.5rem;
    margin-bottom: 2rem;
    text-align: center;
}

.chapter-content .content {
    font-size: var(--reader-font-size, 1.1rem);
    line-height: var(--reader-line-height, 1.8);
}

.chapter-content .content * {
    font-size: inherit !important;
    line-height: inherit !important;
}

.chapter-content .content p {
    margin-bottom: 1.25rem;
}

.chapter-content .content p:last-child {
    margin-bottom: 0;
}

/* Chapter navigation */
.chapter-nav {
    display: flex;
    justify-content: space-between;
    padding: 1.5rem 0;
    border-top: 1px solid var(--border);
    margin-top: 2rem;
    gap: 0.5rem;
}

.nav-btn {
    padding: 0.75rem 1.5rem;
    border-radius: 6px;
    background: var(--bg-secondary);
    color: var(--text);
    font-size: 0.9rem;
    transition: background 0.2s;
}

.nav-btn:hover:not(.disabled) {
    background: var(--border);
}

.nav-btn.disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.nav-btn.toc {
    background: var(--accent);
    color: white;
}

.nav-btn.toc:hover {
    background: var(--accent-hover);
}

/* Responsive */
@media (max-width: 600px) {
    .novel-header {
        flex-direction: column;
        align-items: center;
        text-align: center;
    }

    .novel-cover-large {
        width: 150px;
    }

    .novel-details .meta {
        justify-content: center;
    }

    .chapter-nav {
        flex-wrap: wrap;
    }

    .nav-btn {
        flex: 1;
        text-align: center;
        min-width: 100px;
    }

    .nav-btn.toc {
        order: -1;
        flex-basis: 100%;
    }
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.6rem 1.2rem;
    border: none;
    border-radius: 6px;
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.2s, opacity 0.2s;
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn-primary {
    background: var(--accent);
    color: white;
}

.btn-primary:hover:not(:disabled) {
    background: var(--accent-hover);
}

.btn-secondary {
    background: var(--bg-secondary);
    color: var(--text);
    border: 1px solid var(--border);
}

.btn-secondary:hover:not(:disabled) {
    background: var(--border);
}

.btn-danger {
    background: #dc2626;
    color: white;
}

.btn-danger:hover:not(:disabled) {
    background: #b91c1c;
}

.btn-sm {
    padding: 0.4rem 0.8rem;
    font-size: 0.8rem;
}

/* Forms */
.form-group {
    margin-bottom: 1rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.4rem;
    font-weight: 500;
    font-size: 0.9rem;
}

.form-control {
    width: 100%;
    padding: 0.6rem 0.8rem;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: var(--bg);
    color: var(--text);
    font-size: 0.95rem;
}

.form-control:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 2px rgba(74, 158, 255, 0.2);
}

/* Modal */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s, visibility 0.2s;
}

.modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

.modal {
    background: var(--bg);
    border-radius: 12px;
    padding: 1.5rem;
    width: 90%;
    max-width: 450px;
    max-height: 90vh;
    overflow-y: auto;
    transform: scale(0.95);
    transition: transform 0.2s;
}

.modal-overlay.active .modal {
    transform: scale(1);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

.modal-header h2 {
    font-size: 1.25rem;
    margin: 0;
}

.modal-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--text-secondary);
    padding: 0.25rem;
    line-height: 1;
}

.modal-close:hover {
    color: var(--text);
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
    margin-top: 1.5rem;
}

/* Novel actions */
.novel-actions {
    display: flex;
    gap: 0.75rem;
    margin-top: 1.5rem;
    flex-wrap: wrap;
}

.status-select {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

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

.status-select select {
    padding: 0.5rem 0.8rem;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: var(--bg-secondary);
    color: var(--text);
    font-size: 0.9rem;
}

/* Add novel button in header */
.header-actions {
    display: flex;
    align-items: center;
    gap: 1rem;
}

/* Alert/Toast messages */
.alert {
    padding: 0.75rem 1rem;
    border-radius: 6px;
    margin-bottom: 1rem;
    font-size: 0.9rem;
}

.alert-success {
    background: #059669;
    color: white;
}

.alert-error {
    background: #dc2626;
    color: white;
}

/* Loading spinner */
.loading {
    opacity: 0.6;
    pointer-events: none;
}

.spinner {
    display: inline-block;
    width: 1em;
    height: 1em;
    border: 2px solid currentColor;
    border-right-color: transparent;
    border-radius: 50%;
    animation: spin 0.75s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Large modal for search */
.modal-large {
    max-width: 700px;
}

.modal-body {
    min-height: 300px;
}

/* Search bar */
.search-bar {
    display: flex;
    gap: 0.75rem;
    margin-bottom: 1.5rem;
}

.search-bar .form-control {
    flex: 1;
}

/* Search results */
.search-results {
    max-height: 400px;
    overflow-y: auto;
}

.search-hint, .no-results, .search-results .error {
    color: var(--text-secondary);
    text-align: center;
    padding: 2rem;
}

.search-results .error {
    color: #dc2626;
}

/* Search result item */
.search-result-item {
    display: flex;
    gap: 1rem;
    padding: 0.75rem;
    border: 1px solid var(--border);
    border-radius: 8px;
    margin-bottom: 0.75rem;
    cursor: pointer;
    transition: background 0.2s, border-color 0.2s;
}

.search-result-item:hover {
    background: var(--bg-secondary);
    border-color: var(--accent);
}

.result-cover {
    width: 50px;
    height: 70px;
    flex-shrink: 0;
}

.result-cover img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 4px;
}

.result-cover .no-cover {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-secondary);
    border-radius: 4px;
    font-size: 1.5rem;
    color: var(--text-secondary);
}

.result-info {
    flex: 1;
    min-width: 0;
}

.result-info h4 {
    margin: 0 0 0.25rem 0;
    font-size: 1rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.result-author {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin: 0 0 0.25rem 0;
}

.result-sources {
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin: 0;
}

.source-count {
    background: var(--accent);
    color: white;
    padding: 0.15rem 0.4rem;
    border-radius: 3px;
    font-size: 0.75rem;
    margin-right: 0.5rem;
}

.result-action {
    display: flex;
    align-items: center;
}

/* Novel preview in add modal */
.novel-preview {
    display: flex;
    gap: 1rem;
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border);
}

.preview-cover {
    width: 60px;
    height: 80px;
    object-fit: cover;
    border-radius: 4px;
}

.preview-info h3 {
    margin: 0 0 0.25rem 0;
    font-size: 1.1rem;
}

.preview-info p {
    margin: 0;
    color: var(--text-secondary);
    font-size: 0.9rem;
}

/* Source list */
.source-list {
    list-style: none;
    padding: 0;
    margin: 0.5rem 0 0 0;
    font-size: 0.9rem;
}

.source-list li {
    padding: 0.25rem 0;
    color: var(--text-secondary);
}

.source-list li strong {
    color: var(--text);
}

.form-group small {
    display: block;
    margin-top: 0.25rem;
    color: var(--text-secondary);
    font-size: 0.8rem;
}

/* Reader header right section */
.reader-header-right {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

/* Settings toggle button */
.settings-toggle {
    background: none;
    border: none;
    padding: 0.5rem;
    cursor: pointer;
    color: var(--text-secondary);
    border-radius: 6px;
    transition: background 0.2s, color 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.settings-toggle:hover {
    background: var(--bg-secondary);
    color: var(--text);
}

/* Settings sidebar */
.settings-sidebar {
    position: fixed;
    top: 0;
    right: -320px;
    width: 300px;
    max-width: 90vw;
    height: 100vh;
    background: var(--bg);
    border-left: 1px solid var(--border);
    z-index: 1001;
    transition: right 0.3s ease;
    display: flex;
    flex-direction: column;
}

.settings-sidebar.open {
    right: 0;
}

.settings-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--border);
}

.settings-header h3 {
    margin: 0;
    font-size: 1.1rem;
}

.settings-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--text-secondary);
    padding: 0.25rem;
    line-height: 1;
}

.settings-close:hover {
    color: var(--text);
}

.settings-content {
    flex: 1;
    overflow-y: auto;
    padding: 1.25rem;
}

.setting-group {
    margin-bottom: 1.5rem;
}

.setting-group:last-child {
    margin-bottom: 0;
}

.setting-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.setting-group select {
    width: 100%;
    padding: 0.5rem 0.75rem;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: var(--bg-secondary);
    color: var(--text);
    font-size: 0.9rem;
}

/* Slider settings */
.setting-slider {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.setting-slider input[type="range"] {
    flex: 1;
    height: 4px;
    background: var(--border);
    border-radius: 2px;
    outline: none;
    -webkit-appearance: none;
}

.setting-slider input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 16px;
    height: 16px;
    background: var(--accent);
    border-radius: 50%;
    cursor: pointer;
}

.setting-slider input[type="range"]::-moz-range-thumb {
    width: 16px;
    height: 16px;
    background: var(--accent);
    border-radius: 50%;
    cursor: pointer;
    border: none;
}

.setting-slider span {
    min-width: 45px;
    font-size: 0.85rem;
    color: var(--text-secondary);
    text-align: right;
}

/* Theme buttons */
.theme-buttons {
    display: flex;
    gap: 0.5rem;
}

.theme-btn {
    flex: 1;
    padding: 0.5rem 0.75rem;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: var(--bg-secondary);
    color: var(--text);
    font-size: 0.85rem;
    cursor: pointer;
    transition: border-color 0.2s, background 0.2s;
}

.theme-btn:hover {
    border-color: var(--accent);
}

.theme-btn.active {
    border-color: var(--accent);
    background: var(--accent);
    color: white;
}

/* Settings overlay */
.settings-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s, visibility 0.3s;
}

.settings-overlay.open {
    opacity: 1;
    visibility: visible;
}

/* Theme variants */
body.theme-dark {
    --bg: #1a1a1a;
    --bg-secondary: #2a2a2a;
    --text: #e0e0e0;
    --text-secondary: #999;
    --border: #444;
    --accent: #4a9eff;
    --accent-hover: #6ab0ff;
}

body.theme-light {
    --bg: #ffffff;
    --bg-secondary: #f5f5f5;
    --text: #1a1a1a;
    --text-secondary: #666;
    --border: #e0e0e0;
    --accent: #0066cc;
    --accent-hover: #0052a3;
}

body.theme-sepia {
    --bg: #f4ecd8;
    --bg-secondary: #e8dcc8;
    --text: #5b4636;
    --text-secondary: #8b7355;
    --border: #d4c4a8;
    --accent: #8b5a2b;
    --accent-hover: #6b4423;
}

/* Mobile adjustments for settings */
@media (max-width: 600px) {
    .settings-sidebar {
        width: 100%;
        max-width: none;
        right: -100%;
    }

    .reader-header-right {
        gap: 0.5rem;
    }

    .chapter-nav-header select {
        max-width: 180px;
    }
}

/* Validation warnings */
.validation-warning {
    margin-left: auto;
    font-size: 0.9rem;
    opacity: 0.8;
}

.chapter-list li.has-issues a {
    background: rgba(245, 158, 11, 0.1);
}

.chapter-list li.has-issues a:hover {
    background: rgba(245, 158, 11, 0.2);
}

/* Validation banner on chapter page */
.validation-banner {
    display: flex;
    gap: 0.75rem;
    padding: 1rem;
    margin-bottom: 1.5rem;
    background: rgba(245, 158, 11, 0.15);
    border: 1px solid rgba(245, 158, 11, 0.3);
    border-radius: 8px;
    align-items: flex-start;
}

.validation-icon {
    font-size: 1.25rem;
    flex-shrink: 0;
}

.validation-text strong {
    display: block;
    color: #f59e0b;
    margin-bottom: 0.25rem;
}

.validation-text p {
    margin: 0;
    font-size: 0.9rem;
    color: var(--text-secondary);
    line-height: 1.5;
}

/* Chapter list pagination */
.chapter-list-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--border);
}

.chapter-list-header h2 {
    margin: 0;
    font-size: 1.25rem;
}

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

.chapter-pagination {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 0;
    margin-bottom: 0.5rem;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.chapter-pagination.bottom {
    margin-top: 1rem;
    margin-bottom: 0;
    justify-content: center;
    border-top: 1px solid var(--border);
    padding-top: 1rem;
}

.pagination-info {
    color: var(--text-secondary);
    font-size: 0.85rem;
}

.pagination-controls {
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.pagination-btn {
    padding: 0.4rem 0.75rem;
    border-radius: 4px;
    background: var(--bg-secondary);
    color: var(--text);
    font-size: 0.85rem;
    text-decoration: none;
    transition: background 0.2s;
}

.pagination-btn:hover:not(.disabled) {
    background: var(--border);
    color: var(--text);
}

.pagination-btn.disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.page-select {
    padding: 0.4rem 0.5rem;
    border: 1px solid var(--border);
    border-radius: 4px;
    background: var(--bg-secondary);
    color: var(--text);
    font-size: 0.85rem;
    margin: 0 0.25rem;
}

@media (max-width: 600px) {
    .chapter-pagination {
        flex-direction: column;
        align-items: stretch;
    }

    .pagination-info {
        text-align: center;
    }

    .pagination-controls {
        justify-content: center;
    }
}

/* Reading Progress */
.reading-progress {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin: 1rem 0;
    padding: 0.75rem;
    background: var(--bg-secondary);
    border-radius: 6px;
}

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

.progress-value {
    font-weight: 500;
}

.chapter-progress {
    font-size: 0.85rem;
    color: var(--accent);
}

/* Chapter list read state */
.chapter-list li.read a {
    opacity: 0.6;
}

.chapter-list li.read .chapter-number::before {
    content: "";
    margin-right: 0.25rem;
    color: var(--accent);
}

/* Download status indicator */
.download-status {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.25rem 0.6rem;
    background: var(--bg-secondary);
    border-radius: 4px;
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.download-status.complete {
    color: #10b981;
}

.download-status.downloading {
    color: var(--accent);
}

.spinner-small {
    display: inline-block;
    width: 0.8em;
    height: 0.8em;
    border: 2px solid currentColor;
    border-right-color: transparent;
    border-radius: 50%;
    animation: spin 0.75s linear infinite;
}

/* Not downloaded chapter indicator */
.chapter-list li.not-downloaded a {
    opacity: 0.6;
}

.download-pending {
    display: inline-block;
    width: 8px;
    height: 8px;
    background: var(--text-secondary);
    border-radius: 50%;
    margin-left: auto;
    opacity: 0.5;
}

.chapter-list li.not-downloaded:hover .download-pending {
    background: var(--accent);
    opacity: 1;
}

/* Synopsis Section */
.synopsis-section {
    margin: 2rem 0;
    padding: 1.5rem;
    background: var(--bg-secondary);
    border-radius: 8px;
    border: 1px solid var(--border);
}

.synopsis-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid var(--border);
}

.synopsis-header h2 {
    margin: 0;
    font-size: 1.25rem;
}

.synopsis-actions {
    display: flex;
    gap: 0.5rem;
}

.synopsis-progress {
    margin-bottom: 1rem;
}

.synopsis-progress .progress-bar {
    height: 8px;
    background: var(--bg-tertiary);
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 0.5rem;
}

.synopsis-progress .progress-fill {
    height: 100%;
    background: var(--accent);
    border-radius: 4px;
    transition: width 0.3s ease;
}

.synopsis-progress .progress-text {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin: 0;
}

.synopsis-content {
    line-height: 1.7;
    color: var(--text-primary);
}

.synopsis-content h2 {
    font-size: 1.5rem;
    margin: 2rem 0 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--border);
}

.synopsis-content h3 {
    font-size: 1.2rem;
    margin: 1.5rem 0 0.75rem;
    color: var(--accent);
}

.synopsis-content h4 {
    font-size: 1rem;
    margin: 1rem 0 0.5rem;
}

.synopsis-content p {
    margin: 0.75rem 0;
}

.synopsis-content hr {
    border: none;
    border-top: 1px solid var(--border);
    margin: 2rem 0;
}

.synopsis-content .error {
    color: var(--danger);
    padding: 1rem;
    background: rgba(239, 68, 68, 0.1);
    border-radius: 4px;
}

/* Tab Navigation */
.tab-nav {
    display: flex;
    gap: 0;
    margin: 2rem 0 0;
    border-bottom: 2px solid var(--border);
}

.tab-btn {
    padding: 0.75rem 1.5rem;
    background: transparent;
    border: none;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    cursor: pointer;
    font-size: 1rem;
    color: var(--text-secondary);
    transition: all 0.2s ease;
}

.tab-btn:hover {
    color: var(--text-primary);
    background: var(--bg-secondary);
}

.tab-btn.active {
    color: var(--accent);
    border-bottom-color: var(--accent);
    font-weight: 500;
}

.tab-btn .tab-count {
    font-size: 0.85rem;
    opacity: 0.7;
    margin-left: 0.25rem;
}

.tab-btn .tab-status {
    font-size: 0.8rem;
    opacity: 0.7;
    margin-left: 0.25rem;
}

.tab-content {
    padding: 1.5rem 0;
}

/* Synopsis Tab */
.synopsis-empty {
    text-align: center;
    padding: 3rem 1rem;
    color: var(--text-secondary);
}

.synopsis-empty .hint {
    font-size: 0.9rem;
    opacity: 0.7;
    margin-top: 0.5rem;
}

.synopsis-arcs {
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

.synopsis-arc {
    background: var(--bg-secondary);
    border-radius: 8px;
    padding: 1.5rem;
    border: 1px solid var(--border);
}

.synopsis-arc .arc-header {
    display: flex;
    align-items: baseline;
    gap: 1rem;
    margin: 0 0 1rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid var(--border);
    flex-wrap: wrap;
}

.synopsis-arc .arc-number {
    font-size: 0.85rem;
    color: var(--accent);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.synopsis-arc .arc-title {
    font-size: 1.1rem;
    color: var(--text-primary);
    font-weight: 500;
}

.synopsis-arc .arc-chapters {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-left: auto;
}

.synopsis-arc .arc-summary {
    line-height: 1.7;
    color: var(--text-primary);
}

.synopsis-arc .arc-summary p {
    margin: 0.75rem 0;
}

.synopsis-arc .arc-summary p:first-child {
    margin-top: 0;
}

.synopsis-arc .arc-summary p:last-child {
    margin-bottom: 0;
}
