﻿/* ============================================================
   AHPAL 小說站 — 深色系樣式 v1.0
   最後更新：2026-10-04
   ============================================================ */

:root {
    --bg-base:       #0D1117;
    --bg-card:       #161B22;
    --bg-hover:      #1C2128;
    --border:        #2D303A;
    --text-main:     #E6EDF3;
    --text-sub:      #8B949E;
    --text-muted:    #6E7681;
    --gold:          #D4AF37;
    --gold-soft:     #ecc94b;
    --cyan:          #58A6FF;
    --green:         #3FB950;
    --red:           #F85149;
    --radius-sm:     8px;
    --radius-md:     12px;
    --radius-lg:     16px;
    --shadow-card:   0 4px 20px rgba(0,0,0,0.4);
    --shadow-hover:  0 8px 28px rgba(0,0,0,0.55);
    --transition:    0.25s ease;
    --max-width:     1100px;
}

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

html { scroll-behavior: smooth; }

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Microsoft JhengHei", "Noto Sans TC", sans-serif;
    background: var(--bg-base);
    color: var(--text-main);
    line-height: 1.9;
    font-size: 16px;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.site-header {
    background: rgba(13, 17, 23, 0.95);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 100;
    backdrop-filter: blur(10px);
}

.header-inner {
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 16px 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
}

.logo {
    font-size: 22px;
    font-weight: 800;
    color: var(--gold);
    text-decoration: none;
    letter-spacing: 0.5px;
    transition: var(--transition);
}

.logo:hover { color: var(--gold-soft); }

.nav-links {
    display: flex;
    gap: 24px;
    align-items: center;
    flex-wrap: wrap;
}

.nav-links a {
    color: var(--text-sub);
    text-decoration: none;
    font-size: 15px;
    font-weight: 500;
    transition: var(--transition);
    padding: 4px 0;
    border-bottom: 2px solid transparent;
}

.nav-links a:hover {
    color: var(--cyan);
    border-bottom-color: var(--cyan);
}

.main-wrapper {
    flex: 1;
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 32px 24px;
    width: 100%;
}

.main-content { width: 100%; }

.content-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 40px 44px;
    box-shadow: var(--shadow-card);
    margin-bottom: 24px;
}

h1, h2, h3, h4 {
    color: var(--text-main);
    line-height: 1.4;
    font-weight: 700;
}

h1 { font-size: 2em; margin: 0 0 16px 0; color: var(--gold); }
h2 {
    font-size: 1.5em;
    margin: 32px 0 16px 0;
    color: var(--gold);
    padding-bottom: 10px;
    border-bottom: 2px solid var(--border);
}
h3 { font-size: 1.2em; margin: 24px 0 12px 0; color: var(--cyan); }

p { margin-bottom: 16px; color: var(--text-sub); }

a { color: var(--cyan); text-decoration: none; transition: var(--transition); }
a:hover { color: var(--gold); text-decoration: underline; }

.hero-title {
    font-size: 2.2em;
    color: var(--gold);
    text-align: center;
    margin-bottom: 12px;
}

.hero-desc {
    text-align: center;
    font-size: 16px;
    color: var(--text-sub);
    margin-bottom: 32px;
}

.section-title {
    font-size: 1.5em;
    color: var(--gold);
    margin: 40px 0 20px 0;
    padding-bottom: 10px;
    border-bottom: 2px solid var(--border);
}

.novel-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 16px;
    margin: 20px 0;
}

.novel-card {
    display: block;
    background: var(--bg-base);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 20px 18px;
    text-decoration: none;
    transition: var(--transition);
    cursor: pointer;
}

.novel-card:hover {
    transform: translateY(-4px);
    border-color: var(--gold);
    box-shadow: var(--shadow-hover);
    text-decoration: none;
}

.novel-card-title {
    font-size: 16px;
    font-weight: 700;
    color: var(--text-main);
    margin-bottom: 6px;
}

.novel-card-desc {
    font-size: 13px;
    color: var(--text-sub);
}

.site-footer {
    background: #010409;
    border-top: 1px solid var(--border);
    padding: 40px 24px 32px 24px;
    margin-top: 40px;
}

.footer-inner {
    max-width: var(--max-width);
    margin: 0 auto;
    text-align: center;
}

.footer-brand {
    font-size: 18px;
    font-weight: 700;
    color: var(--gold);
    margin-bottom: 8px;
}

.footer-desc {
    font-size: 14px;
    color: var(--text-sub);
    margin-bottom: 16px;
}

.footer-copy {
    font-size: 13px;
    color: var(--text-muted);
    margin-bottom: 12px;
}

.footer-links {
    display: flex;
    justify-content: center;
    gap: 20px;
    flex-wrap: wrap;
}

.footer-links a {
    color: var(--text-sub);
    font-size: 13px;
    text-decoration: none;
}

.footer-links a:hover {
    color: var(--cyan);
    text-decoration: underline;
}

#back-to-top {
    position: fixed;
    bottom: 28px;
    right: 28px;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: var(--gold);
    color: var(--bg-base);
    border: none;
    font-size: 20px;
    font-weight: 700;
    cursor: pointer;
    box-shadow: var(--shadow-card);
    opacity: 0;
    visibility: hidden;
    transition: var(--transition);
    z-index: 200;
}

#back-to-top.visible { opacity: 1; visibility: visible; }

#back-to-top:hover {
    background: var(--gold-soft);
    transform: translateY(-3px);
}

@media (max-width: 768px) {
    .header-inner {
        padding: 12px 16px;
        flex-direction: column;
        gap: 8px;
    }
    .logo { font-size: 18px; }
    .nav-links { gap: 14px; }
    .nav-links a { font-size: 14px; }

    .main-wrapper { padding: 20px 14px; }
    .content-card { padding: 24px 20px; border-radius: var(--radius-md); }

    h1 { font-size: 1.5em; }
    h2 { font-size: 1.25em; }
    .hero-title { font-size: 1.6em; }

    .novel-grid {
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
        gap: 10px;
    }
    .novel-card { padding: 14px 12px; }
    .novel-card-title { font-size: 14px; }

    .site-footer { padding: 28px 16px 24px 16px; }
    #back-to-top { bottom: 16px; right: 16px; width: 40px; height: 40px; }
}

@media (max-width: 480px) {
    .main-wrapper { padding: 16px 10px; }
    .content-card { padding: 20px 16px; }
    h1 { font-size: 1.35em; }
    .hero-title { font-size: 1.4em; }
    .novel-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 8px;
    }
}
/* ============================================================
   閱讀器樣式 v1.0（階段 2 追加）
   ============================================================ */

/* ----- 閱讀主題變數 ----- */
:root {
    --reader-font-size: 16px;
    --reader-line-height: 1.9;
}

html[data-theme="dark"] {
    --bg-base: #0D1117;
    --bg-card: #161B22;
    --border: #2D303A;
    --text-main: #E6EDF3;
    --text-sub: #8B949E;
    --chapter-bg: #161B22;
    --chapter-text: #D0D7DE;
}

html[data-theme="warm"] {
    --bg-base: #F5F0E6;
    --bg-card: #FFFBF0;
    --border: #E6DED1;
    --text-main: #3A3A3A;
    --text-sub: #6B6B6B;
    --chapter-bg: #FFFBF0;
    --chapter-text: #3A3A3A;
    --gold: #B89047;
    --cyan: #2B6CB0;
}

html[data-theme="light"] {
    --bg-base: #FFFFFF;
    --bg-card: #F8F9FA;
    --border: #E2E8F0;
    --text-main: #1A202C;
    --text-sub: #4A5568;
    --chapter-bg: #FFFFFF;
    --chapter-text: #1A202C;
    --gold: #B7791F;
    --cyan: #2B6CB0;
}

/* ----- 閱讀進度條 ----- */
.reading-progress {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: transparent;
    z-index: 200;
    pointer-events: none;
}

.reading-progress-bar {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, var(--gold), var(--cyan));
    transition: width 0.1s linear;
}

/* ----- 閱讀工具列 ----- */
.reader-toolbar {
    position: sticky;
    top: 60px;
    z-index: 90;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 8px 12px;
    margin-bottom: 20px;
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    justify-content: flex-end;
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}

.rt-btn {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text-main);
    padding: 6px 12px;
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-family: inherit;
    cursor: pointer;
    transition: var(--transition);
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.rt-btn:hover {
    background: var(--bg-hover);
    border-color: var(--gold);
    color: var(--gold);
}

.rt-btn .rt-icon {
    font-weight: 700;
    font-size: 15px;
}

.rt-btn .rt-label {
    font-size: 13px;
}

/* ----- 章節文章 ----- */
.chapter-article {
    background: var(--chapter-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 48px 56px;
    box-shadow: var(--shadow-card);
    color: var(--chapter-text);
}

.chapter-header {
    text-align: center;
    margin-bottom: 40px;
    padding-bottom: 24px;
    border-bottom: 1px solid var(--border);
}

.chapter-novel {
    font-size: 14px;
    margin-bottom: 12px;
}

.chapter-novel a {
    color: var(--cyan);
    text-decoration: none;
}

.chapter-novel a:hover {
    color: var(--gold);
    text-decoration: underline;
}

.chapter-title {
    font-size: 1.8em;
    color: var(--gold);
    margin: 0 0 16px 0;
    line-height: 1.4;
}

.chapter-meta {
    display: flex;
    justify-content: center;
    gap: 20px;
    flex-wrap: wrap;
    font-size: 13px;
    color: var(--text-sub);
}

.chapter-meta span {
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

/* ----- 章節內容 ----- */
.chapter-content {
    font-size: var(--reader-font-size);
    line-height: var(--reader-line-height);
    color: var(--chapter-text);
    letter-spacing: 0.02em;
}

.chapter-content p {
    color: var(--chapter-text);
    margin-bottom: 1.2em;
    text-indent: 2em;
}

.chapter-content h2 {
    color: var(--gold);
    margin: 2em 0 1em 0;
    font-size: 1.3em;
    border: none;
    padding: 0;
    text-indent: 0;
}

.chapter-content h3 {
    color: var(--cyan);
    margin: 1.6em 0 0.8em 0;
    text-indent: 0;
}

/* ----- 章節導覽 ----- */
.chapter-footer {
    margin-top: 48px;
    padding-top: 24px;
    border-top: 1px solid var(--border);
}

.chapter-nav-inner {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
}

.nav-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 12px 20px;
    background: var(--bg-base);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    color: var(--text-main);
    text-decoration: none;
    font-size: 14px;
    font-weight: 600;
    transition: var(--transition);
    flex: 1;
    max-width: 200px;
}

.nav-btn:hover {
    background: var(--bg-hover);
    border-color: var(--gold);
    color: var(--gold);
    transform: translateY(-2px);
    text-decoration: none;
}

.nav-btn.toc {
    background: var(--gold);
    color: var(--bg-base);
    border-color: var(--gold);
    max-width: 140px;
    flex: 0 0 auto;
}

.nav-btn.toc:hover {
    background: var(--gold-soft);
    color: var(--bg-base);
}

.nav-btn.disabled {
    opacity: 0.3;
    cursor: not-allowed;
    pointer-events: none;
}

/* ----- Toast ----- */
.reader-toast {
    position: fixed;
    bottom: 100px;
    left: 50%;
    transform: translateX(-50%) translateY(20px);
    background: var(--gold);
    color: var(--bg-base);
    padding: 10px 20px;
    border-radius: 24px;
    font-size: 14px;
    font-weight: 600;
    box-shadow: var(--shadow-card);
    opacity: 0;
    pointer-events: none;
    transition: all 0.3s ease;
    z-index: 300;
}

.reader-toast.visible {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

/* ----- 暖色/淺色主題下的金色替代 ----- */
html[data-theme="warm"] .chapter-title,
html[data-theme="light"] .chapter-title {
    color: #8A1C14;
}

html[data-theme="warm"] .nav-btn.toc,
html[data-theme="light"] .nav-btn.toc {
    background: #8A1C14;
    color: white;
    border-color: #8A1C14;
}

/* ----- 響應式 ----- */
@media (max-width: 768px) {
    .chapter-article {
        padding: 24px 20px;
        border-radius: var(--radius-md);
    }

    .chapter-title {
        font-size: 1.4em;
    }

    .reader-toolbar {
        top: 50px;
        padding: 6px 8px;
        gap: 4px;
    }

    .rt-btn {
        padding: 6px 10px;
        font-size: 13px;
    }

    .rt-btn .rt-label {
        display: none;
    }

    .chapter-meta {
        gap: 12px;
        font-size: 12px;
    }

    .chapter-nav-inner {
        gap: 8px;
    }

    .nav-btn {
        padding: 10px 14px;
        font-size: 13px;
        max-width: none;
    }

    .nav-btn.toc {
        flex: 0 0 auto;
        min-width: 80px;
    }

    .chapter-content {
        text-indent: 2em;
    }
}

@media (max-width: 480px) {
    .chapter-article {
        padding: 20px 14px;
    }

    .chapter-title {
        font-size: 1.25em;
    }

    .nav-btn {
        padding: 8px 10px;
        font-size: 12px;
    }
}

/* ----- 首頁閱讀進度框（階段 3 用） ----- */
#reading-progress-box {
    display: none;
    background: linear-gradient(135deg, var(--gold), var(--gold-soft));
    border-radius: var(--radius-lg);
    padding: 24px 28px;
    margin-bottom: 24px;
    box-shadow: var(--shadow-card);
}

.progress-label {
    font-size: 14px;
    color: var(--bg-base);
    font-weight: 600;
    margin-bottom: 8px;
    opacity: 0.85;
}

.progress-link {
    display: block;
    text-decoration: none;
    color: var(--bg-base);
}

.progress-link:hover { text-decoration: none; }

.progress-novel {
    display: block;
    font-size: 18px;
    font-weight: 700;
    margin-bottom: 4px;
}

.progress-chapter {
    display: block;
    font-size: 15px;
    opacity: 0.85;
}