/**
 * reader.css — Article reader page (/article/{slug}): liquid-glass reading
 * panel, KaTeX math, code blocks, TOC sidebar, reading progress bar.
 */
/* Extracted from style.css */

/* ==================== 悬浮按钮 ==================== */
.back-fab {
    position: fixed;
    bottom: 30px;
    left: 30px;
    width: 48px;
    height: 48px;
    background: var(--bg-card);
    border: 1px solid var(--border-accent);
    border-radius: 50%;
    color: var(--accent-primary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition-normal);
    z-index: 1000;
    box-shadow: var(--shadow-card);
}

.back-fab:hover {
    background: var(--accent-primary);
    color: var(--bg-primary);
    transform: scale(1.1);
}

.toc-fab {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 48px;
    height: 48px;
    background: var(--bg-card);
    border: 1px solid var(--border-accent);
    border-radius: 50%;
    color: var(--accent-secondary);
    cursor: pointer;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition-normal);
    z-index: 1000;
    box-shadow: var(--shadow-card);
    pointer-events: auto;
}

.toc-fab:hover {
    background: var(--accent-secondary);
    color: var(--bg-primary);
    transform: scale(1.1);
}

.theme-fab {
    position: fixed;
    top: 80px;
    right: 30px;
    width: 44px;
    height: 44px;
    background: var(--bg-card);
    border: 1px solid var(--border-accent);
    border-radius: 50%;
    color: var(--accent-warning);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition-normal);
    z-index: 1001;
    box-shadow: var(--shadow-card);
}

.theme-fab:hover {
    background: var(--accent-warning);
    color: var(--bg-primary);
    transform: scale(1.1);
}

.theme-fab svg { width: 18px; height: 18px; }

:root .theme-fab .icon-sun { display: none; }
:root .theme-fab .icon-moon { display: block; }
:root[data-theme="light"] .theme-fab .icon-moon { display: none; }
:root[data-theme="light"] .theme-fab .icon-sun { display: block; }
/* ==================== 目录面板 ==================== */
.toc-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 998;
}

.toc-panel {
    position: fixed;
    top: 0;
    right: 0;
    width: 300px;
    max-width: 80vw;
    height: 100vh;
    background: var(--bg-secondary);
    border-left: 1px solid var(--border-subtle);
    z-index: 999;
    transform: translateX(100%);
    transition: transform var(--transition-normal);
    overflow-y: auto;
}

/* active = 滑入显示 */
.toc-panel.active {
    transform: translateX(0);
}

.toc-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px;
    border-bottom: 1px solid var(--border-subtle);
}

.toc-title {
    font-size: 14px;
    font-weight: 500;
    color: var(--text-primary);
}

.toc-close {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color var(--transition-fast);
}

.toc-close:hover {
    color: var(--text-primary);
}

.toc-list {
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-height: calc(100vh - 80px);
    overflow-y: auto;
}

.toc-item {
    display: block;
    padding: 10px 12px;
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 14px;
    border-radius: 6px;
    transition: all var(--transition-fast);
    cursor: pointer;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
}

.toc-item:hover {
    background: var(--bg-hover);
    color: var(--accent-primary);
}

.toc-h2 { padding-left: 0; }
.toc-h3 { padding-left: 16px; }
.toc-h4 { padding-left: 32px; font-size: 13px; }
/* ==================== 文章阅读器 ==================== */
.article-reader {
    position: relative;
    z-index: 10;
    max-width: 820px;
    margin: 0 auto;
    padding: 100px 48px 80px;
    animation: fade-in 0.5s ease;
    isolation: isolate;
}

/* 液态玻璃背景层 —— 独立于文字，mask 不影响文本 */
.article-reader::before {
    content: '';
    position: absolute;
    inset: 0;
    z-index: -1;

    /* 液态玻璃核心 */
    background:
        radial-gradient(ellipse 80% 60% at 50% 30%, rgba(var(--accent-primary-rgb), 0.04), transparent 70%),
        radial-gradient(ellipse 60% 50% at 50% 70%, rgba(var(--accent-secondary-rgb), 0.03), transparent 70%),
        linear-gradient(135deg, rgba(var(--bg-primary-rgb), 0.55), rgba(var(--bg-primary-rgb), 0.45));
    backdrop-filter: blur(60px) saturate(120%);
    -webkit-backdrop-filter: blur(60px) saturate(120%);

    /* 柔和边框 */
    border: 1px solid rgba(var(--accent-primary-rgb), 0.06);
    border-radius: 20px;

    /* 边缘渐变过渡 —— 上下两端缓慢融入页面背景（仅作用于背景层） */
    mask-image:
        linear-gradient(
            to bottom,
            transparent 0%,
            rgba(0, 0, 0, 0.12) 6%,
            rgba(0, 0, 0, 0.35) 12%,
            rgba(0, 0, 0, 1) 18%,
            rgba(0, 0, 0, 1) 82%,
            rgba(0, 0, 0, 0.35) 88%,
            rgba(0, 0, 0, 0.12) 94%,
            transparent 100%
        );
    -webkit-mask-image:
        linear-gradient(
            to bottom,
            transparent 0%,
            rgba(0, 0, 0, 0.12) 6%,
            rgba(0, 0, 0, 0.35) 12%,
            rgba(0, 0, 0, 1) 18%,
            rgba(0, 0, 0, 1) 82%,
            rgba(0, 0, 0, 0.35) 88%,
            rgba(0, 0, 0, 0.12) 94%,
            transparent 100%
        );
}

.article-content {
    font-family: var(--font-serif);
    font-size: 17px;
    line-height: 1.95;
    color: var(--text-primary);
    letter-spacing: 0.01em;
    word-break: break-word;
    font-variant-numeric: lining-nums tabular-nums;

    --heading-scale: 1.25;
    --font-size-base: 17px;

    --space-unit: 0.5rem;
    --space-xs: calc(var(--space-unit) * 0.5);
    --space-sm: var(--space-unit);
    --space-md: calc(var(--space-unit) * 2);
    --space-lg: calc(var(--space-unit) * 3);
    --space-xl: calc(var(--space-unit) * 4);
    --space-2xl: calc(var(--space-unit) * 6);

    text-rendering: optimizeLegibility;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    overflow-wrap: break-word;
    hyphens: auto;
}

/* 覆盖 github-markdown-css 的背景，交给液态玻璃容器统一处理 */
.article-content.markdown-body {
    background: transparent !important;
}

/* ---------- 标题 ---------- */
.article-content h1 {
    font-size: calc(var(--font-size-base) * var(--heading-scale) * var(--heading-scale));
    font-weight: 700;
    color: var(--text-primary);
    margin: 2.5rem 0 1rem;
    line-height: 1.25;
    letter-spacing: -0.02em;
    scroll-margin-top: 24px;
}

.article-content h2 {
    font-size: calc(var(--font-size-base) * var(--heading-scale));
    font-weight: 600;
    color: var(--text-primary);
    margin: 2rem 0 0.75rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--border-subtle);
    scroll-margin-top: 24px;
    position: relative;
}

.article-content h2::before {
    content: '#';
    color: var(--accent-primary);
    opacity: 0.35;
    margin-right: 12px;
    font-family: var(--font-mono);
    font-weight: 400;
}

.article-content h3 {
    font-size: calc(var(--font-size-base) * 1.1);
    font-weight: 600;
    color: var(--text-primary);
    margin: 1.75rem 0 0.5rem;
    scroll-margin-top: 24px;
    position: relative;
    padding-left: 16px;
}

.article-content h3::before {
    content: '';
    position: absolute;
    left: 0;
    top: 4px;
    bottom: 4px;
    width: 3px;
    background: var(--accent-primary);
    border-radius: 2px;
    opacity: 0.5;
}

.article-content h4 {
    font-size: var(--font-size-base);
    font-weight: 600;
    color: var(--text-secondary);
    margin: 1.5rem 0 0.5rem;
    scroll-margin-top: 24px;
    position: relative;
}

.article-content h5 {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    margin: 1.25rem 0 0.5rem;
    scroll-margin-top: 24px;
}

.article-content h6 {
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-muted);
    margin: 1rem 0 0.5rem;
    scroll-margin-top: 24px;
}

/* ---------- 段落 ---------- */
.article-content p {
    margin-bottom: var(--space-lg);
    line-height: 1.8;
}

.article-content > p:first-child {
    margin-top: 0;
}

.article-content > p:last-child {
    margin-bottom: 0;
}

/* ---------- 强调 ---------- */
.article-content strong,
.article-content b {
    font-weight: 600;
    color: var(--accent-primary);
}

:root[data-theme="light"] .article-content strong,
:root[data-theme="light"] .article-content b {
    color: var(--accent-primary);
}

.article-content em,
.article-content i {
    font-style: italic;
    color: var(--text-secondary);
}

.article-content del,
.article-content s {
    opacity: 0.6;
    text-decoration: line-through;
    text-decoration-color: var(--text-muted);
}

.article-content mark {
    background: linear-gradient(
        120deg,
        rgba(var(--accent-warning-rgb), 0.2) 0%,
        rgba(var(--accent-warning-rgb), 0.35) 100%
    );
    color: inherit;
    padding: 0.1em 0.3em;
    border-radius: 3px;
}

.article-content sub {
    font-size: 0.75em;
    vertical-align: sub;
    line-height: 1;
}

.article-content sup {
    font-size: 0.75em;
    vertical-align: super;
    line-height: 1;
}

/* ---------- 链接 ---------- */
.article-content a {
    color: var(--accent-secondary);
    text-decoration: none;
    border-bottom: 1px solid rgba(var(--accent-secondary-rgb), 0.4);
    transition: all var(--transition-fast);
    position: relative;
    text-underline-offset: 0.2em;
}

.article-content a:hover {
    color: var(--accent-primary);
    border-bottom-color: var(--accent-primary);
}

.article-content a::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    width: 0;
    height: 1px;
    background: var(--accent-primary);
    transition: width var(--transition-normal);
}

.article-content a:hover::after {
    width: 100%;
}

.article-content a[href^="http"]::after,
.article-content a[href^="https"]::after {
    display: none;
}

.article-content a[href^="#"]::after,
.article-content a[href^="/"]::after {
    display: none;
}

/* ---------- 行内代码 ---------- */
.article-content code {
    font-family: var(--font-mono);
    font-size: 0.85em;
    padding: 0.15em 0.4em;
    background: var(--bg-tertiary);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 4px;
    color: var(--accent-tertiary);
}

/* ---------- 代码块 ---------- */
.article-content pre {
    background: var(--bg-tertiary);
    border: 1px solid var(--border-subtle);
    border-radius: 8px;
    padding: 16px;
    margin: var(--space-lg) 0;
    overflow-x: auto;
    position: relative;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.article-content pre code {
    background: none;
    padding: 0;
    font-size: 13px;
    line-height: 1.6;
    color: var(--text-primary);
    border: none;
    white-space: pre;
    word-spacing: normal;
    word-break: normal;
    tab-size: 4;
    hyphens: none;
}

/* ---------- 代码块包装器 ---------- */
.article-content .code-block-wrapper {
    position: relative;
    margin: var(--space-lg) 0;
}

.article-content .code-block-wrapper pre {
    margin: 0;
}

/* ---------- 代码块头部（语言标签 + 复制按钮） ---------- */
.article-content .code-block-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 16px;
    background: rgba(0, 0, 0, 0.2);
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

/* ---------- 语言标签 ---------- */
.article-content .code-language {
    font-family: var(--font-mono);
    font-size: 11px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* ---------- 复制按钮 ---------- */
.article-content .code-copy-btn {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 4px 8px;
    background: transparent;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 4px;
    color: var(--text-muted);
    font-family: var(--font-mono);
    font-size: 11px;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.article-content .code-copy-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-primary);
    border-color: rgba(255, 255, 255, 0.2);
}

.article-content .code-copy-btn.copied {
    color: var(--accent-primary);
    border-color: var(--accent-primary);
}

.article-content .code-copy-btn svg {
    width: 14px;
    height: 14px;
}

/* ---------- 代码内容区 ---------- */
.article-content .code-block-content {
    padding: 16px;
    overflow-x: auto;
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, 0.2) transparent;
}

.article-content .code-block-content::-webkit-scrollbar {
    height: 6px;
}

.article-content .code-block-content::-webkit-scrollbar-track {
    background: transparent;
}

.article-content .code-block-content::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.15);
    border-radius: 3px;
}

.article-content .code-block-content::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.25);
}

/* ---------- 引用块 ---------- */
.article-content blockquote {
    position: relative;
    margin: var(--space-lg) 0;
    padding: var(--space-md) var(--space-lg);
    color: var(--text-secondary);
    background: linear-gradient(
        135deg,
        rgba(var(--accent-secondary-rgb), 0.08) 0%,
        rgba(var(--accent-secondary-rgb), 0.03) 100%
    );
    border-left: 4px solid var(--accent-secondary);
    border-radius: 0 8px 8px 0;
    font-style: normal;
}

.article-content blockquote::before {
    content: '"';
    position: absolute;
    top: 8px;
    left: 12px;
    font-family: 'Times New Roman', serif;
    font-size: 48px;
    line-height: 1;
    color: var(--accent-secondary);
    opacity: 0.3;
}

.article-content blockquote p {
    margin-bottom: var(--space-sm);
    font-size: 0.95em;
    line-height: 1.7;
}

.article-content blockquote p:last-child {
    margin-bottom: 0;
}

.article-content blockquote blockquote {
    margin: var(--space-md) 0;
    padding: var(--space-sm) var(--space-md);
    background: rgba(0, 0, 0, 0.1);
    border-left-color: var(--accent-tertiary);
    font-size: 0.9em;
}

.article-content blockquote blockquote::before {
    font-size: 32px;
    color: var(--accent-tertiary);
}

/* ---------- 列表 ---------- */
.article-content ul,
.article-content ol {
    margin: var(--space-md) 0;
    padding-left: var(--space-lg);
}

.article-content ul {
    list-style: none;
}

.article-content ul li {
    position: relative;
    padding-left: var(--space-md);
    margin-bottom: var(--space-xs);
    line-height: 1.7;
}

.article-content ul li::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0.6em;
    width: 6px;
    height: 6px;
    background: var(--accent-primary);
    border-radius: 50%;
    opacity: 0.7;
}

.article-content ul ul {
    margin: var(--space-xs) 0;
}

.article-content ul ul li::before {
    width: 4px;
    height: 4px;
    background: var(--accent-secondary);
    opacity: 0.5;
}

.article-content ul ul ul li::before {
    width: 3px;
    height: 3px;
    background: var(--text-muted);
    opacity: 0.4;
}

.article-content ol {
    list-style: none;
    counter-reset: ol-counter;
}

.article-content ol li {
    position: relative;
    padding-left: var(--space-lg);
    margin-bottom: var(--space-xs);
    line-height: 1.7;
    counter-increment: ol-counter;
}

.article-content ol li::before {
    content: counter(ol-counter) ".";
    position: absolute;
    left: 0;
    top: 0;
    font-family: var(--font-mono);
    font-size: 0.85em;
    line-height: 1.7;
    color: var(--accent-primary);
    font-weight: 500;
}

.article-content ol ol {
    counter-reset: ol-sub-counter;
}

.article-content ol ol li::before {
    counter-increment: ol-sub-counter;
    content: counter(ol-counter) "." counter(ol-sub-counter);
    color: var(--text-muted);
    font-size: 0.8em;
}

.article-content li p {
    margin: var(--space-xs) 0;
}

.article-content .task-list {
    list-style: none;
    padding-left: 0;
}

.article-content .task-list li {
    padding-left: 0;
    display: flex;
    align-items: flex-start;
    gap: var(--space-sm);
}

.article-content .task-list li::before {
    display: none;
}

.article-content .task-checkbox {
    flex-shrink: 0;
    width: 18px;
    height: 18px;
    margin-top: 3px;
    accent-color: var(--accent-primary);
    cursor: pointer;
}

.article-content .task-list li.task-done {
    text-decoration: line-through;
    color: var(--text-muted);
}

/* ---------- 分割线 ---------- */
.article-content hr {
    position: relative;
    border: none;
    height: 1px;
    margin: var(--space-xl) 0;
    background: transparent;
}

.article-content hr::before {
    content: '· · ·';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    padding: 0 var(--space-md);
    background: var(--bg-primary);
    font-family: var(--font-mono);
    font-size: 14px;
    color: var(--text-muted);
    letter-spacing: 0.5em;
}

:root[data-theme="light"] .article-content hr::before {
    background: var(--bg-primary);
}

/* ---------- 图片 ---------- */
.article-content img {
    display: block;
    max-width: 100%;
    height: auto;
    margin: 0 auto;
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.25);
    transition: transform var(--transition-normal), box-shadow var(--transition-normal);
    cursor: zoom-in;
}

.article-content img:hover {
    transform: scale(1.01);
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.35);
}

/* ---------- 图片灯箱 ---------- */
.lightbox-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.92);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
    cursor: zoom-out;
}

.lightbox-overlay.active {
    opacity: 1;
    visibility: visible;
}

.lightbox-overlay img {
    max-width: 90vw;
    max-height: 90vh;
    object-fit: contain;
    border-radius: 4px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
    cursor: default;
    transform: scale(0.95);
    transition: transform 0.3s ease;
}

.lightbox-overlay.active img {
    transform: scale(1);
}

.lightbox-close {
    position: absolute;
    top: 20px;
    right: 20px;
    width: 40px;
    height: 40px;
    background: rgba(255, 255, 255, 0.1);
    border: none;
    border-radius: 50%;
    color: #fff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}

.lightbox-close:hover {
    background: rgba(255, 255, 255, 0.2);
}

.lightbox-close svg {
    width: 20px;
    height: 20px;
}

/* ---------- 标题锚点 ---------- */
.article-content .heading-anchor {
    position: absolute;
    left: -1.3em;
    top: 50%;
    transform: translateY(-50%);
    color: var(--accent-primary);
    opacity: 0;
    text-decoration: none;
    border-bottom: none !important;
    font-family: var(--font-mono);
    font-size: 0.9em;
    font-weight: 400;
    transition: opacity var(--transition-fast);
}

.article-content h2:hover .heading-anchor,
.article-content h3:hover .heading-anchor,
.article-content h4:hover .heading-anchor {
    opacity: 0.5;
}

.article-content .heading-anchor:hover {
    opacity: 1 !important;
}

/* ---------- 表格 ---------- */
.article-content table {
    width: 100%;
    border-collapse: collapse;
    margin: 28px 0;
    font-size: 15px;
}

.article-content th,
.article-content td {
    padding: 12px 16px;
    border: 1px solid var(--border-subtle);
    text-align: left;
}

.article-content th {
    background: var(--bg-tertiary);
    font-weight: 600;
    font-size: 14px;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.article-content tr:nth-child(even) td {
    background: rgba(var(--accent-primary-rgb), 0.02);
}

/* ---------- 表格滚动包装器 ---------- */
.article-content .table-wrapper {
    overflow-x: auto;
    max-width: 100%;
    margin: 28px 0;
    -webkit-overflow-scrolling: touch;
}

.article-content .table-wrapper table {
    margin: 0;
}

/* ---------- 键盘 ---------- */
.article-content kbd {
    font-family: var(--font-mono);
    font-size: 12.5px;
    padding: 2px 7px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-accent);
    border-radius: 4px;
    color: var(--text-secondary);
    box-shadow: 0 1px 0 rgba(var(--accent-primary-rgb), 0.1);
}

/* ---------- details/summary ---------- */
.article-content details {
    margin: var(--space-md) 0;
    border: 1px solid var(--border-subtle);
    border-radius: 8px;
    overflow: hidden;
}

.article-content summary {
    padding: var(--space-sm) var(--space-md);
    background: var(--bg-tertiary);
    cursor: pointer;
    font-weight: 500;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    transition: background var(--transition-fast);
}

.article-content summary:hover {
    background: var(--bg-hover);
}

.article-content summary::before {
    content: '';
    width: 0;
    height: 0;
    border-left: 5px solid var(--accent-primary);
    border-top: 4px solid transparent;
    border-bottom: 4px solid transparent;
    transition: transform var(--transition-fast);
}

.article-content details[open] summary::before {
    transform: rotate(90deg);
}

.article-content details[open] summary {
    border-bottom: 1px solid var(--border-subtle);
}

.article-content details > *:not(summary) {
    padding: var(--space-md);
}

/* ---------- abbr ---------- */
.article-content abbr[title] {
    border-bottom: none;
    text-decoration: underline dotted var(--text-muted);
    text-underline-offset: 2px;
    cursor: help;
}

.article-content abbr[title]:hover {
    text-decoration-color: var(--accent-primary);
}

/* ---------- 脚注 ---------- */
.article-content .footnotes {
    margin-top: var(--space-2xl);
    padding-top: var(--space-lg);
    border-top: 1px solid var(--border-subtle);
    font-size: 14px;
}

.article-content .footnotes::before {
    content: '脚注';
    display: block;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: var(--space-md);
    font-family: var(--font-mono);
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.article-content .footnotes ol {
    padding-left: var(--space-lg);
    list-style: decimal;
}

.article-content .footnotes li {
    margin-bottom: var(--space-sm);
    color: var(--text-secondary);
}

.article-content .footnotes li::before {
    display: none;
}

.article-content sup a[data-footnote-ref] {
    font-family: var(--font-mono);
    font-size: 0.75em;
    color: var(--accent-secondary);
    text-decoration: none;
    padding: 0 3px;
    border-radius: 2px;
    transition: all var(--transition-fast);
}

.article-content sup a[data-footnote-ref]:hover {
    background: rgba(var(--accent-secondary-rgb), 0.15);
    color: var(--accent-primary);
}

/* ---------- 脚注链接 ---------- */
.article-content sup a {
    font-family: var(--font-mono);
    font-size: 0.8em;
    border-bottom: none;
}

/* ---------- GitHub Alert Callouts ---------- */
.article-content .markdown-alert {
    padding: var(--space-md) var(--space-lg);
    margin: var(--space-lg) 0;
    border-left: 4px solid;
    border-radius: 0 10px 10px 0;
    font-size: 0.95em;
    line-height: 1.75;
}

.article-content .markdown-alert .markdown-alert-title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 700;
    margin-bottom: 6px;
    font-size: 1em;
    font-family: var(--font-mono);
    letter-spacing: 0.03em;
    text-transform: uppercase;
}

.article-content .markdown-alert .markdown-alert-title svg {
    flex-shrink: 0;
}

.article-content .markdown-alert .markdown-alert-title + p {
    margin-top: 4px;
}

.article-content .markdown-alert p {
    margin-bottom: var(--space-xs);
}

.article-content .markdown-alert-note {
    border-color: #539BF5;
    background: rgba(83, 155, 245, 0.12);
}
.article-content .markdown-alert-note .markdown-alert-title { color: #539BF5; }

.article-content .markdown-alert-tip {
    border-color: #57AB5A;
    background: rgba(87, 171, 90, 0.12);
}
.article-content .markdown-alert-tip .markdown-alert-title { color: #57AB5A; }

.article-content .markdown-alert-important {
    border-color: #986EE2;
    background: rgba(152, 110, 226, 0.12);
}
.article-content .markdown-alert-important .markdown-alert-title { color: #986EE2; }

.article-content .markdown-alert-warning {
    border-color: #C69026;
    background: rgba(198, 144, 38, 0.12);
}
.article-content .markdown-alert-warning .markdown-alert-title { color: #C69026; }

.article-content .markdown-alert-caution {
    border-color: #E5534B;
    background: rgba(229, 83, 75, 0.12);
}
.article-content .markdown-alert-caution .markdown-alert-title { color: #E5534B; }

/* ---------- 下划线 ---------- */
.article-content u {
    text-decoration: underline;
    text-decoration-color: var(--accent-secondary);
    text-underline-offset: 3px;
    text-decoration-thickness: 1px;
}

.article-content ins {
    text-decoration: none;
    background: linear-gradient(180deg, transparent 60%, rgba(var(--accent-primary-rgb), 0.25) 60%);
    padding: 0 2px;
}

/* ---------- 文本对齐 ---------- */
.article-content p[align="left"] { text-align: left; }
.article-content p[align="center"] { text-align: center; }
.article-content p[align="right"] { text-align: right; }
.article-content p[align="justify"] { text-align: justify; }
.article-content div[align="left"] { text-align: left; }
.article-content div[align="center"] { text-align: center; }
.article-content div[align="right"] { text-align: right; }
.article-content div[align="justify"] { text-align: justify; }
.article-content center { text-align: center; }
.article-content center > * { display: inline-block; text-align: initial; }

/* ---------- font 标签 ---------- */
.article-content font[color] { color: var(--text-primary); }
.article-content font[size="1"] { font-size: 0.65em; }
.article-content font[size="2"] { font-size: 0.8em; }
.article-content font[size="3"] { font-size: 1em; }
.article-content font[size="4"] { font-size: 1.2em; }
.article-content font[size="5"] { font-size: 1.5em; }
.article-content font[size="6"] { font-size: 1.8em; }
.article-content font[size="7"] { font-size: 2.2em; }

/* ---------- mark 自定义背景 ---------- */
.article-content mark[style] {
    padding: 0.1em 0.3em;
    border-radius: 3px;
    color: inherit;
}

/* ---------- 小字 ---------- */
.article-content small {
    font-size: 0.8em;
    color: var(--text-muted);
}

/* ---------- 定义列表 ---------- */
.article-content dl {
    margin: var(--space-md) 0;
    padding: var(--space-md);
    background: rgba(var(--accent-secondary-rgb), 0.03);
    border-radius: 8px;
    border: 1px solid var(--border-subtle);
}

.article-content dt {
    font-weight: 600;
    color: var(--accent-primary);
    margin-bottom: 2px;
    font-family: var(--font-mono);
    font-size: 0.9em;
}

.article-content dd {
    margin-left: var(--space-lg);
    margin-bottom: var(--space-sm);
    color: var(--text-secondary);
    line-height: 1.7;
}

.article-content dd:last-child {
    margin-bottom: 0;
}

/* ---------- 脚注悬浮提示 ---------- */
.footnote-tooltip {
    position: fixed;
    z-index: 10000;
    max-width: 320px;
    min-width: 180px;
    padding: 10px 14px;
    background: var(--bg-card);
    border: 1px solid var(--border-accent);
    border-radius: 8px;
    color: var(--text-primary);
    font-family: var(--font-serif);
    font-size: 13px;
    line-height: 1.65;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4), 0 0 0 1px rgba(var(--accent-primary-rgb), 0.1);
    pointer-events: auto;
    animation: footnote-tip-in 0.15s ease;
}

:root[data-theme="light"] .footnote-tooltip {
    box-shadow: 0 8px 28px rgba(0, 0, 0, 0.12), 0 0 0 1px rgba(var(--accent-primary-rgb), 0.1);
}

@keyframes footnote-tip-in {
    from { opacity: 0; transform: translateY(4px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* ---------- KaTeX 块级公式包装器 ---------- */
.article-content .katex-block-wrapper {
    margin: var(--space-lg) 0;
    padding: var(--space-md);
    background: rgba(var(--accent-secondary-rgb), 0.03);
    border-radius: 8px;
    border: 1px solid rgba(var(--accent-secondary-rgb), 0.08);
    text-align: center;
    overflow-x: auto;
    overflow-y: hidden;
    transition: background var(--transition-fast), border-color var(--transition-fast);
}

.article-content .katex-block-wrapper:hover {
    background: rgba(var(--accent-secondary-rgb), 0.05);
    border-color: rgba(var(--accent-secondary-rgb), 0.15);
}

:root[data-theme="light"] .article-content .katex-block-wrapper {
    background: rgba(0, 0, 0, 0.02);
    border-color: rgba(0, 0, 0, 0.06);
}

:root[data-theme="light"] .article-content .katex-block-wrapper:hover {
    background: rgba(0, 0, 0, 0.04);
}
.article-content input[type="checkbox"] {
    accent-color: var(--accent-primary);
    margin-right: 6px;
}

/* ---------- sr-only（屏幕阅读器专用，视觉隐藏） ---------- */
.article-content .sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* ==================== KaTeX 公式美化 ==================== */
.article-content .katex-display {
    margin: var(--space-lg) 0;
    padding: var(--space-md);
    background: rgba(var(--accent-secondary-rgb), 0.03);
    border-radius: 8px;
    border: 1px solid rgba(var(--accent-secondary-rgb), 0.08);
    overflow-x: auto;
    overflow-y: hidden;
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, 0.1) transparent;
}

.article-content .katex-display > .katex {
    text-align: center;
}

.article-content .katex {
    font-size: 1.05em;
    color: var(--text-primary);
}

.article-content .katex-display:hover {
    background: rgba(var(--accent-secondary-rgb), 0.05);
    border-color: rgba(var(--accent-secondary-rgb), 0.15);
}

.article-content .katex .mord,
.article-content .katex .mbin,
.article-content .katex .mrel {
    color: var(--text-primary);
}

.article-content .katex .mop {
    color: var(--accent-secondary);
}

.article-content .katex .mord.mit {
    color: var(--accent-tertiary);
}

.article-content .katex .mtable .vertical-separator {
    border-left-color: var(--border-accent);
}

.article-content .katex-display::-webkit-scrollbar {
    height: 4px;
}

.article-content .katex-display::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 2px;
}

:root[data-theme="light"] .article-content .katex-display {
    background: rgba(0, 0, 0, 0.02);
    border-color: rgba(0, 0, 0, 0.06);
}

:root[data-theme="light"] .article-content .katex-display:hover {
    background: rgba(0, 0, 0, 0.04);
}
/* ==================== 阅读进度条 ==================== */
.reading-progress {
    position: fixed;
    top: 0;
    left: 0;
    width: var(--reading-progress, 0%);
    height: 3px;
    background: linear-gradient(
        90deg,
        var(--accent-primary) 0%,
        var(--accent-secondary) 50%,
        var(--accent-tertiary) 100%
    );
    z-index: 9999;
    transition: width 0.1s linear;
    box-shadow: 0 0 10px rgba(var(--accent-primary-rgb), 0.5);
}

@media (max-width: 768px) {
    .reading-progress {
        height: 2px;
    }
}
