/* ========================================
   Theme Styles
======================================== */

/* Font Size Variations */
.reader-body[data-font-size="small"] .chapter-body {
    font-size: 0.95rem;
}

.reader-body[data-font-size="small"] .chapter-intro {
    font-size: 0.9rem;
}

.reader-body[data-font-size="medium"] .chapter-body {
    font-size: 1.125rem;
}

.reader-body[data-font-size="medium"] .chapter-intro {
    font-size: 1.05rem;
}

.reader-body[data-font-size="large"] .chapter-body {
    font-size: 1.25rem;
}

.reader-body[data-font-size="large"] .chapter-intro {
    font-size: 1.15rem;
}

.reader-body[data-font-size="xlarge"] .chapter-body {
    font-size: 1.5rem;
}

.reader-body[data-font-size="xlarge"] .chapter-intro {
    font-size: 1.35rem;
}

/* Line Height Variations */
.reader-body[data-line-height="narrow"] .chapter-body,
.reader-body[data-line-height="narrow"] .chapter-intro {
    line-height: 1.5;
}

.reader-body[data-line-height="normal"] .chapter-body,
.reader-body[data-line-height="normal"] .chapter-intro {
    line-height: 1.9;
}

.reader-body[data-line-height="wide"] .chapter-body,
.reader-body[data-line-height="wide"] .chapter-intro {
    line-height: 2.2;
}

/* Font Family Variations */
.reader-body[data-font-family="gothic"] .chapter-body,
.reader-body[data-font-family="gothic"] .chapter-intro {
    font-family: 'Noto Sans JP', sans-serif;
}

.reader-body[data-font-family="mincho"] .chapter-body,
.reader-body[data-font-family="mincho"] .chapter-intro {
    font-family: 'Noto Serif JP', serif;
}

/* ========================================
   Dark Theme
======================================== */

.reader-body[data-theme="dark"] {
    background: #1a1a1a;
    color: #e0e0e0;
}

.reader-body[data-theme="dark"]::before {
    background-image: 
        repeating-linear-gradient(
            0deg,
            transparent,
            transparent 2px,
            rgba(255, 255, 255, 0.02) 2px,
            rgba(255, 255, 255, 0.02) 4px
        );
}

.reader-body[data-theme="dark"] .reader-header {
    background: #2C3E50;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.4);
}

.reader-body[data-theme="dark"] .book-title,
.reader-body[data-theme="dark"] .chapter-title {
    color: #e0e0e0;
}

.reader-body[data-theme="dark"] .current-chapter {
    color: #a0a0a0;
}

.reader-body[data-theme="dark"] .menu-toggle span,
.reader-body[data-theme="dark"] .settings-toggle {
    background: #e0e0e0;
    color: #e0e0e0;
}

.reader-body[data-theme="dark"] .back-link {
    color: #E74C3C;
    border-color: #E74C3C;
}

.reader-body[data-theme="dark"] .back-link:hover {
    background: #E74C3C;
    color: white;
}

.reader-body[data-theme="dark"] .progress-bar {
    background: #3a3a3a;
}

.reader-body[data-theme="dark"] .table-of-contents,
.reader-body[data-theme="dark"] .settings-panel {
    background: #2a2a2a;
    border-color: #3a3a3a;
}

.reader-body[data-theme="dark"] .toc-title,
.reader-body[data-theme="dark"] .settings-title {
    border-color: #3a3a3a;
    color: #e0e0e0;
}

.reader-body[data-theme="dark"] .toc-section h3 {
    color: #a0a0a0;
}

.reader-body[data-theme="dark"] .toc-item:hover {
    background: #3a3a3a;
}

.reader-body[data-theme="dark"] .toc-item.active {
    background: #34495E;
    border-color: #34495E;
    box-shadow: 2px 2px 0 rgba(0, 0, 0, 0.3);
}

.reader-body[data-theme="dark"] .toc-item.active::after {
    background: #E74C3C;
}

.reader-body[data-theme="dark"] .toc-text {
    color: #e0e0e0;
}

.reader-body[data-theme="dark"] .toc-pages {
    color: #808080;
}

.reader-body[data-theme="dark"] .chapter-content {
    background: #2a2a2a;
    box-shadow: 0 0 20px rgba(0, 0, 0, 0.3);
    border-color: #3a3a3a;
}

.reader-body[data-theme="dark"] .chapter-body {
    color: #e0e0e0;
}

.reader-body[data-theme="dark"] .access-gate {
    background: #1a1a1a;
}

.reader-body[data-theme="dark"] .gate-content p {
    color: #a0a0a0;
}

.reader-body[data-theme="dark"] .access-method {
    background: #2a2a2a;
    border-color: #3a3a3a;
}

.reader-body[data-theme="dark"] .access-method:hover {
    border-color: #E74C3C;
    box-shadow: 6px 6px 0 rgba(0, 0, 0, 0.3);
}

.reader-body[data-theme="dark"] .access-method:hover::after {
    background: #E74C3C;
}

.reader-body[data-theme="dark"] .method-text {
    color: #e0e0e0;
}

.reader-body[data-theme="dark"] .chapter-footer {
    border-color: #3a3a3a;
}

.reader-body[data-theme="dark"] .font-size-btn,
.reader-body[data-theme="dark"] .line-height-btn,
.reader-body[data-theme="dark"] .theme-btn,
.reader-body[data-theme="dark"] .font-btn {
    background: #1a1a1a;
    border-color: #3a3a3a;
    color: #e0e0e0;
}

.reader-body[data-theme="dark"] .font-size-btn:hover,
.reader-body[data-theme="dark"] .line-height-btn:hover,
.reader-body[data-theme="dark"] .theme-btn:hover,
.reader-body[data-theme="dark"] .font-btn:hover {
    border-color: #6bb6ff;
}

.reader-body[data-theme="dark"] .font-size-btn.active,
.reader-body[data-theme="dark"] .line-height-btn.active,
.reader-body[data-theme="dark"] .theme-btn.active,
.reader-body[data-theme="dark"] .font-btn.active {
    background: #34495E;
    border-color: #34495E;
    box-shadow: 2px 2px 0 rgba(0, 0, 0, 0.3);
}

.reader-body[data-theme="dark"] .modal-content {
    background: #2a2a2a;
    color: #e0e0e0;
    border-color: #E74C3C;
    box-shadow: 5px 5px 0 rgba(0, 0, 0, 0.4);
}

.reader-body[data-theme="dark"] .modal-close {
    color: #a0a0a0;
}

.reader-body[data-theme="dark"] .modal-close:hover {
    background: #3a3a3a;
}

/* ダークテーマでの章末ポイント */
.reader-body[data-theme="dark"] .chapter-points-section {
    background: #2a2a2a;
    border-color: #3a3a3a;
}

.reader-body[data-theme="dark"] .chapter-points {
    color: #a0a0a0 !important;
}

.reader-body[data-theme="dark"] .chapter-points-section ul li {
    color: #d0d0d0;
}

/* ダークテーマでの部タイトル */
.reader-body[data-theme="dark"] .toc-item.part-header {
    background: #2a2a2a;
    border-left-color: #34495E;
    border-top-color: #3a3a3a;
    border-bottom-color: #3a3a3a;
}

.reader-body[data-theme="dark"] .toc-item.part-header:hover {
    background: #3a3a3a;
}

.reader-body[data-theme="dark"] .toc-item.part-header.active {
    background: #34495E;
}

/* ダークテーマでの章の導入文 */
.reader-body[data-theme="dark"] .chapter-intro {
    background: #2a2a2a;
    color: #b0b0b0;
    border-left-color: #E74C3C;
    box-shadow: 3px 3px 0 rgba(0, 0, 0, 0.1);
}

/* ========================================
   Sepia Theme
======================================== */

.reader-body[data-theme="sepia"] {
    background: #F8F4E6;
}

.reader-body[data-theme="sepia"]::before {
    background-image: 
        repeating-linear-gradient(
            0deg,
            transparent,
            transparent 2px,
            rgba(139, 119, 71, 0.03) 2px,
            rgba(139, 119, 71, 0.03) 4px
        );
}

.reader-body[data-theme="sepia"] .reader-header {
    background: #8B7355;
    box-shadow: 0 2px 10px rgba(0,0,0,0.15);
}

.reader-body[data-theme="sepia"] .book-title {
    color: #FFF8DC;
}

.reader-body[data-theme="sepia"] .current-chapter {
    color: rgba(255, 248, 220, 0.8);
}

.reader-body[data-theme="sepia"] .menu-toggle span,
.reader-body[data-theme="sepia"] .settings-toggle {
    background: #FFF8DC;
    color: #FFF8DC;
}

.reader-body[data-theme="sepia"] .chapter-content {
    background: #FFF8DC;
    border-color: #D2B48C;
}

.reader-body[data-theme="sepia"] .chapter-body {
    color: #5D4E37;
}

.reader-body[data-theme="sepia"] .table-of-contents,
.reader-body[data-theme="sepia"] .settings-panel {
    background: #FFF8DC;
    border-color: #D2B48C;
}

.reader-body[data-theme="sepia"] .toc-title {
    background: #F8F4E6;
    border-color: #D2B48C;
}

.reader-body[data-theme="sepia"] .toc-item:hover {
    background: #F8F4E6;
    border-color: #D2B48C;
}

.reader-body[data-theme="sepia"] .toc-item.active {
    background: #8B7355;
    color: #FFF8DC;
    border-color: #8B7355;
}

.reader-body[data-theme="sepia"] .toc-item.active::after {
    background: #CD853F;
}

/* ========================================
   Print Styles
======================================== */

@media print {
    .reader-header,
    .table-of-contents,
    .settings-panel,
    .chapter-nav,
    .access-gate {
        display: none !important;
    }
    
    .reader-container {
        margin-top: 0;
    }
    
    .content-area {
        max-width: 100%;
        padding: 0;
    }
    
    .chapter-content {
        box-shadow: none;
        padding: 0;
    }
    
    .chapter-body {
        font-size: 11pt;
        line-height: 1.6;
    }
}