/*  ====================================
    百科系统专项样式
*/

/* 1. 声明字体 */
@font-face {
    font-family: 'SongKeBen';
    src: url('/resources/fonts/方正宋刻本秀楷简.TTF') format('truetype');
    font-weight: normal;
    font-style: normal;
}

/* 2. 只有百科超链接使用该字体 */
.wiki-link {
    font-family: 'SongKeBen', serif;
    font-size: 1.1em;

    color: #00a368;
    text-decoration: none;
    border-bottom: 1px dashed #00a368;
    transition: all 0.2s ease;
    font-weight: 500;
}

.wiki-link:hover {
    color: #00a368;
    border-bottom: 1px solid #00a368;
    background-color: rgb(183, 221, 204);
}

.wiki-link::after {
    content: "📕";
    font-size: 0.8em;
    opacity: 0.6;
    font-family: sans-serif;
}

/* ==============================================================================
   macOS 扁平化 Header (通栏变色版)
   ============================================================================== */
.wiki-modal-wrapper {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    /* z-index 由 JS 动态控制 */
}

.wiki-modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(2px);
}

.wiki-modal-content {
    position: relative;
    background: #fdfbf7;
    width: 80%;
    max-width: 800px;
    height: 85vh;
    border-radius: 10px;
    box-shadow: 0 14px 28px rgba(0,0,0,0.25), 0 10px 10px rgba(0,0,0,0.22);
    display: flex;
    flex-direction: column;
    z-index: 1;
    overflow: hidden;
}

.wiki-modal-body {
    padding: 30px 40px;
    overflow-y: auto;
    flex-grow: 1;
    scrollbar-width: none;
    -ms-overflow-style: none;
}

.wiki-modal-body::-webkit-scrollbar {
    display: none;
}

/* 覆盖 Markdown 默认字体 */
.wiki-modal-content .markdown-body,
.wiki-modal-content .markdown-body p,
.wiki-modal-content .markdown-body li,
.wiki-modal-content .markdown-body blockquote,
.wiki-modal-content .markdown-body table,
.wiki-modal-content .markdown-body a {
    font-family: 'SongKeBen', serif !important;
}

.wiki-modal-content .markdown-body {
    font-size: 1.25em;
    line-height: 1.5 !important;
    letter-spacing: 0.02em;
    color: #2c3e50;
}

.wiki-modal-content .markdown-body h1,
.wiki-modal-content .markdown-body h2,
.wiki-modal-content .markdown-body h3,
.wiki-modal-content .markdown-body h4,
.wiki-modal-content .markdown-body h5,
.wiki-modal-content .markdown-body h6 {
    font-family: 'SongKeBen', serif !important;
    font-weight: normal !important;
}


.wiki-modal-content .markdown-body code,
.wiki-modal-content .markdown-body pre,
.wiki-modal-content .markdown-body pre code {
    font-family: "Cascadia Code", "Consolas", monospace !important;
}

/* 浮窗内部图片排版与防霸屏 */
.wiki-modal-content .markdown-body img {
    max-width: 90%;
    max-height: 45vh;
    width: auto;
    height: auto;
    object-fit: contain;
    display: block;
    margin: 1.5rem auto;
    border-radius: 6px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

.wiki-mac-header {
    display: flex;
    justify-content: space-between;
    align-items: center; /* 居中对齐 */
    background-color: #8e8e93; /* 如果没有匹配到分类，显示默认的灰色 */
    padding: 16px 24px; /* 稍微增加一点内边距让通栏更大气 */
    flex-shrink: 0;

    /* PNG 贴图全局控制：你可以让图片靠右，或者铺满 */
    background-repeat: no-repeat;
    background-position: right top;
    background-size: contain;
}

/* 左侧标题区 */
.wiki-mac-header-left {
    display: flex;
    flex-direction: column;
    justify-content: center;
    border-left: none; /* 移除之前的竖线 */
    padding-left: 0;
    position: relative;
    z-index: 2; /* 保证文字在背景图之上 */
}

/* 路径小字：半透明白色 */
.wiki-mac-path {
    font-size: 0.8rem;
    color: rgba(255, 255, 255, 0.75);
    margin-bottom: 4px;
    font-family: -apple-system, sans-serif;
}

/* 标题：纯白 */
.wiki-mac-title {
    font-size: 1.5rem;
    font-weight: 600;
    color: #ffffff;
    line-height: 1.2;
    font-family: 'SongKeBen', serif;
}

/* 右侧按钮区 */
.wiki-mac-header-right {
    display: flex;
    align-items: center;
    gap: 16px;
    position: relative;
    z-index: 2;
}

.wiki-mac-langs {
    display: flex;
    gap: 8px;
}

/* 语言切换圆环：半透明深色处理 */
.wiki-lang-circle {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    /* 核心：使用带透明度的黑色，它在任何鲜艳背景上都能显得稳重 */
    background-color: rgba(0, 0, 0, 0.15);
    border: 1px solid rgba(255, 255, 255, 0.25);
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 0.75rem;
    color: rgba(255, 255, 255, 0.9);
    cursor: pointer;
    font-family: -apple-system, sans-serif;
    transition: all 0.2s ease;
    user-select: none;
}

.wiki-lang-circle:hover {
    background-color: rgba(0, 0, 0, 0.3);
    border-color: rgba(255, 255, 255, 0.5);
}

/* 选中状态的语言：底色加深为半透明白，字色反黑（或保持亮白，看你喜好） */
.wiki-lang-circle.active {
    background-color: rgba(255, 255, 255, 0.3);
    border-color: rgba(255, 255, 255, 0.8);
    color: #ffffff;
    font-weight: bold;
}

/* 关闭按钮：半透明白 */
.wiki-mac-close {
    font-size: 28px;
    font-weight: 300;
    color: rgba(255, 255, 255, 0.75);
    cursor: pointer;
    line-height: 1;
    transition: color 0.2s, transform 0.2s;
    user-select: none;
}

.wiki-mac-close:hover {
    color: #ffffff;
    transform: scale(1.1);
}

/* ==============================================================================
   百科悬浮词条 Markdown 排版专属修正
   ============================================================================== */

/* 1. 重置弹窗内基准正文字号，避免基数过大导致整体膨胀 */
.wiki-modal-content .markdown-body {
    font-size: 1.05rem !important;
    line-height: 1.75 !important;
}

/* 2. 取消一级标题 (H1) 的紫色实底填充色与外边距，改回轻量标题 */
.wiki-modal-content .markdown-body h1 {
    background-color: transparent !important;
    color: #6600ff !important;
    padding: 0 0 8px 0 !important;
    margin-top: 20px !important;
    margin-bottom: 14px !important;
    font-size: 1.8rem !important;  /* 合理的一级字号 */
    font-weight: 700 !important;
    border-bottom: 1px solid #e0dbd1 !important;  /* 换成淡色分割线，更贴合卡片质感 */
}

/* 3. 二级标题 (H2) 尺寸缩减与微调 */
.wiki-modal-content .markdown-body h2 {
    font-size: 1.25rem !important;
    margin-top: 18px !important;
    margin-bottom: 10px !important;
    padding-bottom: 4px !important;
    color: #4a3875 !important;      /* 保持柔和色调，避免纯黑生硬 */
    border-bottom: 1px dashed #e8e3d8 !important;
}

/* 4. 三级及以下标题字号阶梯微调 */
.wiki-modal-content .markdown-body h3 {
    font-size: 1.12rem !important;
    margin-top: 14px !important;
    margin-bottom: 8px !important;
    color: #333 !important;
}

.wiki-modal-content .markdown-body h4,
.wiki-modal-content .markdown-body h5,
.wiki-modal-content .markdown-body h6 {
    font-size: 1.02rem !important;
    margin-top: 12px !important;
    margin-bottom: 6px !important;
}

/* 5. 优化公式块与段落紧凑度 */
.wiki-modal-content .markdown-body p {
    margin-bottom: 12px !important;
}

.wiki-modal-content .markdown-body .math.display {
    margin: 14px 0 !important;
}