/* --- 全局与字体设定：营造书卷气 --- */
body {
    font-family: "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
    line-height: 1.9;
    background-color: #fbfaf7;
    color: #3a3a3a;
    margin: 0;
    padding: 0;
    font-size: 17px;
}

/* --- 核心容器：如同书页的版心 --- */
.container {
    max-width: 800px;
    margin: 3rem auto;
    padding: 3rem 4rem;
    background-color: #ffffff;
    border: 1px solid #eaeaea;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.03);
}

/* --- 标题样式：典雅庄重 --- */
h1, h2, h3 {
    font-family: 'Songti SC', 'STSong', 'SimSun', serif;
    color: #1a1a1a;
    font-weight: 600;
    margin-top: 2.5em;
    margin-bottom: 1.2em;
    padding-bottom: 0.6em;
    border-bottom: 1px solid #eaeaea;
}

h1 {
    font-size: 2.6em;
    text-align: center;
    border-bottom: 2px solid #ccc;
    margin-top: 1em;
}

h1 small {
    font-size: 0.5em;
    font-weight: 400;
    color: #666;
    display: block;
    margin-top: 0.5rem;
    font-family: -apple-system, sans-serif;
}

h2 {
    font-size: 2em;
}

h3 {
    font-size: 1.6em;
    border-bottom: none;
}

/* --- 文本元素：精细打磨 --- */
p {
    margin-bottom: 1.5em;
    text-align: justify;
}

blockquote {
    text-align: center;
    font-size: 1.2em;
    font-family: 'KaiTi', 'STKaiti', serif;
    color: #555;
    border: none;
    padding: 1em 0;
    margin: 2.5em 0;
}

blockquote p {
    margin: 0;
    text-align: center;
}

hr {
    border: 0;
    height: 1px;
    background-image: linear-gradient(to right, rgba(0, 0, 0, 0), rgba(0, 0, 0, 0.1), rgba(0, 0, 0, 0));
    margin: 4em 0;
}

ul {
    padding-left: 25px;
}

li {
    margin-bottom: 0.8em;
}

strong {
    font-weight: 600;
    color: #a74141;
}

/* --- 链接样式 --- */
a {
    color: #0B6A7A;
    text-decoration: none;
    border-bottom: 1px dotted #0B6A7A;
    transition: all 0.3s ease;
}

a:hover {
    color: #a74141;
    border-bottom: 1px solid #a74141;
}

/* --- 讨论区入口 --- */
.discussion-link-section {
    margin-top: 4rem;
    padding-top: 2rem;
    border-top: 1px solid #eaeaea;
    text-align: center;
}

.discussion-link-section p {
    text-align: center;
    font-size: 1.1em;
    color: #444;
}

/* --- 页脚 --- */
.footer {
    text-align: center;
    margin-top: 4em;
    padding-top: 2em;
    font-size: 0.9em;
    color: #888;
    border-top: 1px solid #eee;
}

/* --- 文献阅览室与词典入口卡片样式 --- */
.pdf-link-section,
.link-card-section {
    margin-top: 4em;
    display: flex;
    justify-content: center;
}

.pdf-link-card,
.link-card {
    max-width: 600px;
    background-color: #ffffff;
    border: 1px solid #eaeaea;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.04);
    padding: 2rem 2.5rem;
    text-align: center;
    border-radius: 8px;
    transition: all 0.3s ease-in-out;
}

.pdf-link-card:hover,
.link-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.07);
}

.pdf-link-title,
.link-card-title {
    font-family: 'Songti SC', 'STSong', 'SimSun', serif;
    font-size: 1.6em;
    font-weight: bold;
    color: #0B6A7A;
    margin-bottom: 0.8em;
    border-bottom: 1px solid #eaeaea;
    padding-bottom: 0.4em;
}

.pdf-link-card p,
.link-card p {
    font-size: 1em;
    color: #555;
    margin-bottom: 1.5em;
}

.pdf-link-button,
.link-card-button {
    display: inline-block;
    font-size: 1.1em;
    color: #0B6A7A;
    border: 1px solid #0B6A7A;
    padding: 0.5em 1.5em;
    border-radius: 4px;
    text-decoration: none;
    transition: all 0.3s ease;
}

.pdf-link-button:hover,
.link-card-button:hover {
    color: #fff;
    background-color: #0B6A7A;
    border-color: #0B6A7A;
}

/* --- pdf-viewer.html 页面专属样式 --- */
.pdf-container {
    max-width: 900px;
    margin: 3rem auto;
    padding: 2rem 3rem;
    background: #fff;
    border: 1px solid #eaeaea;
    border-radius: 8px;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.05);
}

.pdf-container h1 {
    font-family: 'Songti SC', 'STSong', serif;
    margin-bottom: 2rem;
}

.pdf-link {
    display: block;
    margin: 1rem 0;
    font-size: 1.1em;
    color: #0B6A7A;
    border: 1px solid #0B6A7A;
    padding: 0.6em 1em;
    border-radius: 4px;
    text-align: center;
    text-decoration: none;
    transition: all 0.3s ease;
}

.pdf-link:hover {
    color: #fff;
    background-color: #0B6A7A;
}

/* --- 返回顶部按钮样式 --- */
#back-to-top {
    position: fixed;
    bottom: 25px;
    right: 25px;
    display: none;
    width: 40px;
    height: 40px;
    line-height: 40px;
    text-align: center;
    font-size: 20px;
    font-family: 'Songti SC', serif;
    color: #fff;
    background-color: rgba(11, 106, 122, 0.7);
    border: none;
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
    text-decoration: none;
    border-bottom: none;
}

#back-to-top:hover {
    background-color: rgb(11, 106, 122);
    transform: translateY(-2px);
    border-bottom: none;
}

/* --- 图腾徽记样式 --- */
.totem-container {
    text-align: center;
    margin-bottom: 2rem;
}

.totem-image {
    max-width: 150px;
    height: auto;
    border-radius: 50%;
    opacity: 0.85;
    transition: opacity 0.3s ease;
}

.totem-image:hover {
    opacity: 1;
}

/* --- 美学微调：正文章节首字下沉 --- */
h2:not(:first-of-type)+p::first-letter {
    font-family: 'Songti SC', 'STSong', serif;
    font-size: 3.8em;
    float: left;
    line-height: 0.8;
    margin-top: 0.05em;
    margin-right: 0.1em;
    color: #a74141;
    font-weight: 600;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.1);
}

/* --- 美学升级：PDF 阅览室加载动画 --- */
.loader-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 2rem 0;
}

.loader {
    width: 32px;
    height: 32px;
    border: 4px solid #eaeaea;
    border-top-color: #0B6A7A;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 1rem;
}

.loading-text {
    text-align: center;
    color: #888;
    font-size: 0.95em;
}

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

/* --- 交互升级：悬浮微型目录 (美学升级版) --- */
html {
    scroll-behavior: smooth;
}

.floating-directory {
    position: fixed;
    top: 50%;
    right: 30px;
    transform: translateY(-50%);
    z-index: 100;
    opacity: 0;
    transition: opacity 0.5s ease;
}

.floating-directory.visible {
    opacity: 1;
}

.floating-directory ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.floating-directory li {
    margin: 20px 0;
}

.floating-directory a {
    display: block;
    width: 8px;
    height: 8px;
    background-color: #ccc;
    border-radius: 50%;
    transition: all 0.3s ease;
    text-decoration: none;
    border-bottom: none;
    font-size: 0;
}

.floating-directory a:hover {
    transform: scale(1.5);
}

.floating-directory a.active {
    background-color: #a74141;
    transform: scale(1.8);
    box-shadow: 0 0 10px rgba(167, 65, 65, 0.5);
}

.floating-directory a::after {
    content: attr(data-title);
    position: absolute;
    top: 50%;
    right: 100%;
    transform: translateY(-50%);
    margin-right: 15px;
    padding: 5px 12px;
    background-color: rgba(58, 58, 58, 0.9);
    color: #fbfaf7;
    font-family: 'Songti SC', 'STSong', serif;
    font-size: 14px;
    white-space: nowrap;
    border-radius: 4px;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.floating-directory a:hover::after {
    opacity: 1;
    visibility: visible;
}

/* --- 移动端目录触发按钮 --- */
#mobile-directory-trigger {
    display: none;
    position: fixed;
    top: 15px;
    right: 15px;
    width: 44px;
    height: 44px;
    background-color: rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border: 1px solid #eaeaea;
    border-radius: 50%;
    color: #3a3a3a;
    font-size: 24px;
    line-height: 44px;
    text-align: center;
    cursor: pointer;
    z-index: 1001;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    transition: transform 0.3s ease;
}

#mobile-directory-trigger:active {
    transform: scale(0.9);
}

/* --- 词典与心得页面样式 --- */
dl {
    margin: 2em 0;
}

dt {
    font-family: 'Songti SC', 'STSong', serif;
    font-size: 1.3em;
    font-weight: 600;
    color: #a74141;
    margin-top: 2em;
}

dd {
    margin-left: 0;
    padding-bottom: 1.5em;
    border-bottom: 1px dotted #ccc;
}

.insight-card {
    margin-bottom: 3em;
}

.insight-title {
    border-bottom: none;
    margin-bottom: 0.5em;
}

.insight-content {
    text-align: justify;
}

/* --- 彩蛋样式 --- */
.secret-key {
    color: #3b3b3a;
    cursor: pointer;
    border-bottom: 1px dotted #555;
}

.secret-key:hover {
    color: #a74141;
    border-bottom-color: #a74141;
}

#secret-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.5s ease, visibility 0.5s ease;
    z-index: 2000;
    cursor: pointer;
}

#secret-overlay.visible {
    opacity: 1;
    visibility: visible;
}

.secret-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.secret-icon {
    width: 64px;
    height: 64px;
    color: rgba(251, 250, 247, 0.8);
    margin-bottom: 2.5rem;
    opacity: 0;
    transform: scale(0.8);
}

.secret-content p {
    font-family: 'KaiTi', 'STKaiti', serif;
    font-size: 1.8em;
    color: #fbfaf7;
    text-align: center;
    line-height: 2;
    opacity: 0;
    transform: translateY(15px);
}

.secret-content small {
    opacity: 0;
    transform: translateY(15px);
}

#secret-overlay.visible .secret-icon {
    animation: fadeInScale 0.8s ease-out forwards;
}

#secret-overlay.visible .secret-line-1 {
    animation: fadeInUp 0.8s 0.5s ease-out forwards;
}

#secret-overlay.visible .secret-line-2 {
    animation: fadeInUp 0.8s 1.2s ease-out forwards;
}

#secret-overlay.visible small {
    animation: fadeInUp 0.8s 2.0s ease-out forwards;
}

@keyframes fadeInScale {
    to {
        opacity: 1;
        transform: scale(1);
    }
}

@keyframes fadeInUp {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* --- 美学微调：统一卡片主副标题样式 --- */
.link-card-title small {
    display: block;
    font-size: 0.6em;
    font-weight: 400;
    color: #666;
    margin-top: 0.5rem;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

/* --- 美学统一：心得札记采用主页正文风格 --- */
.insight-content::first-letter {
    font-family: 'Songti SC', 'STSong', serif;
    font-size: 3.8em;
    float: left;
    line-height: 0.8;
    margin-top: 0.05em;
    margin-right: 0.1em;
    color: #a74141;
    font-weight: 600;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.1);
}

/* --- 阅读模式切换器样式 --- */
#mode-switcher {
    text-align: center;
    margin: -1rem 0 2.5rem 0;
    font-size: 0.9em;
    color: #888;
}

#mode-toggle-button {
    color: #0B6A7A;
    font-weight: 600;
    cursor: pointer;
    border-bottom: 1px dotted #0B6A7A;
    text-decoration: none;
}

#mode-toggle-button:hover {
    color: #a74141;
    border-bottom-color: #a74141;
}

/* --- PDF Viewer 页面专属“窗景”氛围 --- */
.viewer-page {
    position: relative;
    background: #fbfaf7;
}

.viewer-page::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    background-image: url('../IMAGE/glossary-bg.png');
    background-size: cover;
    background-position: center center;
    filter: blur(8px);
    transform: scale(1.05);
}

.viewer-page .pdf-container {
    background-color: rgba(255, 255, 255, 0.75);
    backdrop-filter: blur(4px) saturate(180%);
    -webkit-backdrop-filter: blur(4px) saturate(180%);
    border: 1px solid rgba(255, 255, 255, 0.4);
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.1);
    border-radius: 12px;
}

/* --- 响应式媒体查询 --- */
@media (max-width: 1024px) {
    .floating-directory {
        position: fixed;
        top: 0;
        right: 0;
        width: 280px;
        height: 100%;
        background-color: rgba(251, 250, 247, 0.95);
        backdrop-filter: blur(10px);
        -webkit-backdrop-filter: blur(10px);
        transform: translateX(100%);
        transition: transform 0.4s ease;
        padding: 80px 30px;
        box-shadow: -5px 0 20px rgba(0, 0, 0, 0.1);
        opacity: 1;
        display: block;
    }

    .floating-directory.is-open {
        transform: translateX(0);
    }

    .floating-directory ul {
        text-align: left;
    }

    .floating-directory li {
        margin: 25px 0;
    }

    .floating-directory a {
        width: auto;
        height: auto;
        background: none;
        border-radius: 0;
        font-size: 18px;
        font-weight: bold;
        color: #0B6A7A;
        content: attr(data-title);
    }

    .floating-directory a:hover,
    .floating-directory a.active {
        transform: none;
        box-shadow: none;
        background-color: transparent;
        color: #a74141;
    }

    .floating-directory a::after,
    .floating-directory a::before {
        display: none;
    }

    #mobile-directory-trigger {
        display: block;
    }
}

@media (max-width: 768px) {
    body {
        font-size: 16px;
    }

    .container,
    .pdf-container {
        padding: 2rem 1.5rem;
        margin: 1.5rem auto;
    }

    h1 {
        font-size: 2em;
    }

    h2 {
        font-size: 1.6em;
    }

    .pdf-link-card,
    .link-card {
        padding: 1.5rem;
    }

    .totem-image {
        max-width: 120px;
    }

    h2:not(:first-of-type)+p::first-letter,
    .insight-content::first-letter {
        font-size: 3.5em;
    }
}