/* Reader CSS */
:root {
    --reader-font-size: 18px;
    --reader-line-height: 1.85;
    --reader-max-width: 760px;
    --reader-bg: #fdfbf7;
    --reader-text: #2c2925;
    --reader-accent: #991b1b;
    --reader-border: #e7e2d8;
    --reader-sidebar-bg: #f4efe6;
    --reader-font-family: "Gentium Book Plus", Georgia, serif;
}

/* Themes */
body.theme-light {
    --reader-bg: #ffffff;
    --reader-text: #1a1a1a;
    --reader-sidebar-bg: #f8f9fa;
    --reader-border: #e9ecef;
}

body.theme-sepia {
    --reader-bg: #f7f1e5;
    --reader-text: #3c3226;
    --reader-sidebar-bg: #ede4d3;
    --reader-border: #ded2be;
}

body.theme-dark {
    --reader-bg: #141416;
    --reader-text: #d6d3cd;
    --reader-sidebar-bg: #1e1e22;
    --reader-border: #2a2a30;
    --reader-accent: #e05252;
}

body {
    background-color: var(--reader-bg);
    color: var(--reader-text);
    font-family: var(--reader-font-family);
    transition: background-color 0.2s ease, color 0.2s ease;
    margin: 0;
    padding: 0;
}

/* Reader Typography & Layout */
.reader-container {
    max-width: var(--reader-max-width);
    margin: 0 auto;
    padding: 2.5rem 1.5rem 6rem 1.5rem;
    font-size: var(--reader-font-size);
    line-height: var(--reader-line-height);
}

.chapter-section {
    margin-bottom: 5rem;
    padding-bottom: 3rem;
    border-bottom: 1px solid var(--reader-border);
}

.chapter-section h1 {
    font-size: 2.2em;
    font-weight: 700;
    margin-top: 2rem;
    margin-bottom: 2.5rem;
    color: var(--reader-accent);
    text-align: center;
}

.chapter-section h2 {
    font-size: 1.6em;
    margin-top: 2rem;
    margin-bottom: 1.5rem;
}

.chapter-section p {
    margin-bottom: 1.4em;
    position: relative;
    transition: background-color 0.15s ease;
}

.chapter-section p:hover {
    background-color: rgba(180, 80, 80, 0.04);
}

.chapter-section p.dialog {
    font-weight: 500;
}

.chapter-section p.thought {
    font-style: italic;
    color: inherit;
    opacity: 0.95;
}

.chapter-section hr.scene-break {
    border: 0;
    height: 1px;
    background: linear-gradient(to right, transparent, var(--reader-border), transparent);
    margin: 3.5rem auto;
}

/* Scene Breaks (Asterisks & Character Icons) */
.chapter-section .scene-break,
.scene-break {
    display: flex;
    justify-content: center;
    align-items: center;
    margin: 3rem auto;
    text-align: center;
    user-select: none;
    clear: both;
}

.scene-break-asterisks {
    color: var(--reader-border, #786f68);
    letter-spacing: 0.8em;
    font-size: 1.15rem;
    font-weight: bold;
    padding-left: 0.8em;
    opacity: 0.75;
}

.scene-break-image {
    padding: 0.5rem 0;
}

.scene-break-img {
    height: 38px;
    width: auto;
    max-height: 48px;
    object-fit: contain;
    opacity: 0.85;
    transition: opacity 0.2s ease, transform 0.2s ease;
    display: inline-block;
}

.scene-break-img:hover {
    opacity: 1;
    transform: scale(1.06);
}

/* Draft chapter header */
.draft-banner {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.35rem 0.85rem;
    border-radius: 9999px;
    background-color: #fef3c7;
    color: #92400e;
    border: 1px solid #fcd34d;
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 1rem;
}

/* Sticky Table of Contents */
.toc-sidebar {
    background-color: var(--reader-sidebar-bg);
    border-right: 1px solid var(--reader-border);
}

.toc-item {
    padding: 0.6rem 0.85rem;
    border-radius: 0.5rem;
    transition: all 0.15s ease;
    cursor: pointer;
    font-size: 0.92rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.toc-item:hover {
    background-color: rgba(0, 0, 0, 0.05);
}

body.theme-dark .toc-item:hover {
    background-color: rgba(255, 255, 255, 0.06);
}

.toc-item.active {
    background-color: var(--reader-accent);
    color: #ffffff !important;
    font-weight: 600;
}

/* Resume indicator */
.resume-toast {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    background: #1e1e24;
    color: #fff;
    padding: 0.75rem 1.25rem;
    border-radius: 0.75rem;
    box-shadow: 0 10px 25px rgba(0,0,0,0.3);
    z-index: 100;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 0.9rem;
    animation: fadeIn 0.3s ease;
}

/* Comment Indicators & Highlighting for Reviewers/Admin */
.has-comment-highlight {
    background-color: rgba(245, 158, 11, 0.15) !important;
    border-left: 3px solid #d97706;
    padding-left: 0.75rem;
    border-radius: 0.25rem;
    cursor: pointer;
    transition: background-color 0.2s ease, border-color 0.2s ease;
}

.has-comment-highlight:hover {
    background-color: rgba(245, 158, 11, 0.28) !important;
}

body.theme-dark .has-comment-highlight {
    background-color: rgba(245, 158, 11, 0.22) !important;
    border-left-color: #fbbf24;
}

.comment-gutter-card {
    transition: all 0.2s ease;
}

.comment-gutter-card.active-card {
    border-color: #d97706 !important;
    box-shadow: 0 4px 12px rgba(217, 119, 6, 0.2) !important;
    transform: translateX(-3px);
}

.comment-trigger {
    position: absolute;
    right: -2rem;
    top: 0;
    opacity: 0;
    cursor: pointer;
    transition: opacity 0.15s ease;
    color: var(--reader-accent);
}

.chapter-section p:hover .comment-trigger {
    opacity: 0.7;
}

.comment-trigger:hover {
    opacity: 1 !important;
}

.comment-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.4rem;
    height: 1.4rem;
    border-radius: 9999px;
    background: #d97706;
    color: #fff;
    font-size: 0.7rem;
    font-weight: 700;
}

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