/* ============================================
   NovelShelf — Public Theme
   Clean, readable, book-focused design
   ============================================ */

/* --- Reset & Base --- */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    font-size: 16px;
    -webkit-text-size-adjust: 100%;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    color: #1a1a2e;
    background: #fafafa;
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

a {
    color: #4f46e5;
    text-decoration: none;
}
a:hover {
    text-decoration: underline;
}

img {
    max-width: 100%;
    height: auto;
}

.container {
    max-width: 1100px;
    margin: 0 auto;
    padding: 0 20px;
    width: 100%;
}

.text-muted {
    color: #6b7280;
}

.meta-sep {
    margin: 0 6px;
    color: #9ca3af;
}

/* --- Header --- */
.site-header {
    background: #fff;
    border-bottom: 1px solid #e5e7eb;
    padding: 14px 0;
    position: sticky;
    top: 0;
    z-index: 50;
}
.site-header .container {
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.logo {
    font-size: 1.25rem;
    font-weight: 700;
    color: #1a1a2e;
}
.logo:hover {
    text-decoration: none;
    color: #4f46e5;
}
.site-nav {
    display: flex;
    gap: 20px;
    align-items: center;
    font-size: .9rem;
}
.site-nav a {
    color: #4b5563;
}
.site-nav a:hover {
    color: #1a1a2e;
}
.nav-admin {
    color: #9ca3af !important;
    font-size: .8rem;
}

/* --- Novel Grid (Homepage) --- */
.novel-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 24px;
    padding: 32px 0 48px;
}

.novel-card {
    background: #fff;
    border-radius: 10px;
    overflow: hidden;
    border: 1px solid #e5e7eb;
    display: flex;
    flex-direction: column;
    transition: box-shadow .2s, transform .2s;
    text-decoration: none;
    color: inherit;
}
.novel-card:hover {
    box-shadow: 0 4px 16px rgba(0,0,0,.08);
    transform: translateY(-2px);
    text-decoration: none;
}

.novel-cover {
    width: 100%;
    height: 200px;
    overflow: hidden;
    background: #f3f4f6;
}
.novel-cover img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.cover-placeholder {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #4f46e5 0%, #7c3aed 100%);
    color: #fff;
    font-size: 3rem;
    font-weight: 700;
}

.novel-info {
    padding: 16px;
    flex: 1;
    display: flex;
    flex-direction: column;
}
.novel-info h3 {
    font-size: 1.05rem;
    margin-bottom: 4px;
    color: #111827;
}
.novel-author {
    font-size: .85rem;
    color: #6b7280;
    margin-bottom: 8px;
}
.novel-desc {
    font-size: .85rem;
    color: #6b7280;
    line-height: 1.5;
    flex: 1;
    margin-bottom: 12px;
}
.novel-meta {
    font-size: .78rem;
    color: #9ca3af;
    border-top: 1px solid #f3f4f6;
    padding-top: 10px;
}

/* --- Novel Detail Page --- */
.novel-detail {
    padding: 32px 0 48px;
    max-width: 800px;
    margin: 0 auto;
}

.novel-detail-header {
    display: flex;
    gap: 24px;
    margin-bottom: 32px;
    align-items: flex-start;
}

.novel-detail-cover {
    width: 160px;
    height: 220px;
    object-fit: cover;
    border-radius: 8px;
    flex-shrink: 0;
    box-shadow: 0 2px 8px rgba(0,0,0,.1);
}
.cover-placeholder-lg {
    width: 160px;
    height: 220px;
    border-radius: 8px;
    flex-shrink: 0;
    font-size: 4rem;
}

.novel-detail-info h1 {
    font-size: 1.6rem;
    margin-bottom: 4px;
}
.detail-author {
    font-size: .95rem;
    color: #6b7280;
    margin-bottom: 8px;
}
.detail-meta {
    font-size: .85rem;
    color: #9ca3af;
}

.novel-description {
    margin-bottom: 32px;
    padding-bottom: 24px;
    border-bottom: 1px solid #e5e7eb;
}
.novel-description h2 {
    font-size: 1.15rem;
    margin-bottom: 10px;
}
.novel-description p {
    color: #374151;
    line-height: 1.7;
}

/* --- Chapter List --- */
.chapter-list-section h2 {
    font-size: 1.15rem;
    margin-bottom: 16px;
}

.chapter-list {
    list-style: none;
    counter-reset: chapter;
}
.chapter-list li {
    counter-increment: chapter;
    border-bottom: 1px solid #f3f4f6;
}
.chapter-list a {
    display: flex;
    align-items: baseline;
    gap: 12px;
    padding: 12px 4px;
    color: #374151;
    text-decoration: none;
    transition: color .15s;
}
.chapter-list a:hover {
    color: #4f46e5;
}
.ch-num {
    font-size: .78rem;
    color: #9ca3af;
    white-space: nowrap;
    min-width: 90px;
}
.ch-title {
    flex: 1;
    font-size: .95rem;
}
.ch-date {
    font-size: .78rem;
    color: #c0c4cc;
    white-space: nowrap;
}

/* --- Chapter Reader --- */
.chapter-reader {
    flex: 1;
    max-width: 720px;
    margin: 0 auto;
    padding: 0 20px;
    width: 100%;
}

.chapter-breadcrumb {
    padding: 16px 0;
    font-size: .82rem;
    color: #9ca3af;
}
.chapter-breadcrumb a {
    color: #6b7280;
}
.chapter-breadcrumb a:hover {
    color: #4f46e5;
}

.chapter-content {
    background: #fff;
    border-radius: 12px;
    padding: 40px 36px;
    box-shadow: 0 1px 4px rgba(0,0,0,.04);
    margin-bottom: 24px;
}

.chapter-header {
    text-align: center;
    margin-bottom: 32px;
    padding-bottom: 24px;
    border-bottom: 1px solid #f3f4f6;
}
.chapter-header h1 {
    font-size: 1.5rem;
    margin-bottom: 6px;
}
.chapter-meta {
    font-size: .85rem;
    color: #9ca3af;
}

.chapter-body {
    font-family: Georgia, 'Times New Roman', 'Noto Serif', serif;
    font-size: 1.1rem;
    line-height: 1.9;
    color: #1f2937;
}
.chapter-body p {
    margin-bottom: 1.2em;
    text-indent: 1.5em;
}
.chapter-body p:first-child {
    text-indent: 0;
}
.chapter-body hr {
    border: none;
    border-top: 1px solid #e5e7eb;
    margin: 2em auto;
    width: 50%;
}

/* --- Chapter Navigation --- */
.chapter-nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    padding: 16px 0 48px;
}
.chapter-nav-btn {
    display: inline-block;
    padding: 10px 18px;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    font-size: .88rem;
    color: #4f46e5;
    background: #fff;
    transition: all .15s;
    text-align: center;
    flex: 1;
}
.chapter-nav-btn:hover {
    background: #f5f3ff;
    border-color: #c7d2fe;
    text-decoration: none;
}
.chapter-nav-btn.disabled {
    color: #d1d5db;
    pointer-events: none;
}
.chapter-nav-btn.toc {
    flex: 0 0 auto;
    max-width: 160px;
}

/* --- Font Size Controls --- */
.font-controls {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;
    margin-bottom: 12px;
}
.fc-btn {
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 6px;
    padding: 4px 12px;
    cursor: pointer;
    font-size: .85rem;
    color: #4b5563;
    transition: all .15s;
}
.fc-btn:hover {
    background: #f3f4f6;
    border-color: #c7d2fe;
}
.fc-label {
    font-size: .78rem;
    color: #9ca3af;
    min-width: 32px;
    text-align: center;
}

/* --- Empty State --- */
.empty-public {
    text-align: center;
    padding: 80px 20px;
    color: #9ca3af;
}
.empty-public h2 {
    font-size: 1.3rem;
    color: #6b7280;
    margin-bottom: 8px;
}
.empty-public p {
    font-size: .95rem;
}

/* --- Footer --- */
.site-footer {
    background: #fff;
    border-top: 1px solid #e5e7eb;
    padding: 20px 0;
    text-align: center;
    font-size: .82rem;
    color: #9ca3af;
    margin-top: auto;
}

/* --- Responsive --- */
@media (max-width: 640px) {
    .novel-detail-header {
        flex-direction: column;
        align-items: center;
        text-align: center;
    }
    .novel-detail-cover,
    .cover-placeholder-lg {
        width: 140px;
        height: 190px;
    }
    .chapter-content {
        padding: 28px 20px;
    }
    .chapter-body {
        font-size: 1.05rem;
    }
    .chapter-nav {
        flex-wrap: wrap;
    }
    .chapter-nav-btn {
        font-size: .82rem;
        padding: 8px 12px;
    }
    .chapter-nav-btn.toc {
        order: -1;
        flex: 1 1 100%;
        max-width: none;
    }
    .chapter-list a {
        flex-wrap: wrap;
        gap: 4px 12px;
    }
    .ch-date {
        display: none;
    }
}