/* ============================================================
   MikuX 主题样式
   配色方案：Indigo (#6366F1)
   ============================================================ */
/* ===== 相关推荐卡片（独立样式，复用 api-card 风格） ===== */

.related-posts {
    margin-top: 40px;
    padding-top: 20px;
    border-top: 1px solid var(--border);
}
.related-posts h2 {
    font-size: 20px;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 16px;
}

.related-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 16px;
}

.related-card {
    background: var(--card);
    border-radius: var(--radius);
    border: 1px solid var(--border);
    box-shadow: var(--shadow);
    transition: 0.2s;
    padding: 20px;
    cursor: pointer;
}
.related-card:hover {
    border-color: var(--primary-400);
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(99, 102, 241, 0.10);
}

.related-header {
    display: flex;
    gap: 14px;
    align-items: flex-start;
}
.related-header img {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    object-fit: cover;
    background: var(--bg);
    flex-shrink: 0;
}
.related-header h4 {
    font-size: 15px;
    font-weight: 600;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.related-meta {
    display: flex;
    gap: 14px;
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 4px;
}

.related-desc {
    font-size: 13px;
    color: var(--text-muted);
    margin-top: 12px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* 响应式适配 */
@media (max-width: 768px) {
    .related-grid {
        grid-template-columns: 1fr 1fr;
        gap: 12px;
    }
}
@media (max-width: 480px) {
    .related-grid {
        grid-template-columns: 1fr;
        gap: 10px;
    }
}

/* ===== 统计模块（一行显示，手机端隐藏） ===== */
.mx-stats {
    background: linear-gradient(135deg, var(--primary), var(--primary-600));
    border-radius: var(--radius);
    padding: 12px 20px;           /* 减小内边距，更紧凑 */
    color: #fff;
    text-align: center;
    display: flex;                /* 改为 flex 行内排列 */
    align-items: center;
    justify-content: center;
    gap: 6px;                    /* 元素间距 */
    flex-wrap: nowrap;            /* 强制一行 */
}

.mx-stats p {
    margin: 0;
    font-size: 14px;
    opacity: 0.9;
}

.mx-stats .number {
    font-size: 18px;             /* 数字适当放大，但不夸张 */
    font-weight: 700;
    line-height: 1.2;
}

/* 手机端隐藏（宽度小于 768px） */
@media (max-width: 768px) {
    .mx-stats {
        display: none;
    }
}

/* WebKit 浏览器（Chrome, Safari, Edge） */
.code-block-body::-webkit-scrollbar,
pre[class*="language-"]::-webkit-scrollbar {
    height: 6px;                         /* 滚动条高度 */
    background: rgba(255, 255, 255, 0.1); /* 轨道背景（半透明白） */
    border-radius: 3px;
}

.code-block-body::-webkit-scrollbar-track,
pre[class*="language-"]::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.06);
    border-radius: 3px;
}

.code-block-body::-webkit-scrollbar-thumb,
pre[class*="language-"]::-webkit-scrollbar-thumb {
    background: #b8a9f0;                 /* 淡紫色（柔和，不鲜艳） */
    border-radius: 3px;
    transition: background 0.2s;
}

.code-block-body::-webkit-scrollbar-thumb:hover,
pre[class*="language-"]::-webkit-scrollbar-thumb:hover {
    background: #9f8ee0;                 /* 悬停时稍微加深 */
}

/* Firefox 浏览器 */
.code-block-body,
pre[class*="language-"] {
    scrollbar-width: thin;
    scrollbar-color: #b8a9f0 rgba(255, 255, 255, 0.06);
}

/* 可选：当代码块内容不超长时隐藏滚动条（保留空间） */
.code-block-body:not(:hover)::-webkit-scrollbar-thumb,
pre[class*="language-"]:not(:hover)::-webkit-scrollbar-thumb {
    /* 如果需要悬停才显示，可取消注释，但建议始终显示以便用户知晓可滚动 */
    /* opacity: 0.6; */
}
/* ===== 浮动工具栏 ===== */
.floating-toolbar {
    position: fixed;
    right: 20px;
    bottom: 120px;
    z-index: 999;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.toolbar-item {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
}

.toolbar-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: #ffffff;
    color: #4F46E5;
    font-size: 20px;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
    transition: background 0.2s, color 0.2s, transform 0.2s, box-shadow 0.2s;
    cursor: pointer;
    text-decoration: none;
    border: 1px solid rgba(99, 102, 241, 0.1);
}

.toolbar-btn:hover {
    background: #4F46E5;
    color: #ffffff;
    transform: scale(1.08);
    box-shadow: 0 4px 20px rgba(99, 102, 241, 0.3);
}

/* 上下箭头 SVG 图标颜色继承 */
.toolbar-btn svg {
    stroke: currentColor;
}

.toolbar-btn:hover svg {
    stroke: #ffffff;
}

/* 二维码弹出框 */
.toolbar-qrcode {
    position: absolute;
    right: 56px;
    top: 50%;
    transform: translateY(-50%) scale(0.9);
    width: 160px;
    padding: 12px 12px 10px;
    background: #ffffff;
    border-radius: 12px;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.12);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.25s ease, transform 0.25s ease, visibility 0.25s;
    pointer-events: none;
    text-align: center;
    border: 1px solid #f1f3f5;
}

.toolbar-qrcode::after {
    content: '';
    position: absolute;
    right: -8px;
    top: 50%;
    transform: translateY(-50%);
    border-top: 8px solid transparent;
    border-bottom: 8px solid transparent;
    border-left: 8px solid #ffffff;
    filter: drop-shadow(2px 0 4px rgba(0,0,0,0.05));
}

.toolbar-item:hover .toolbar-qrcode {
    opacity: 1;
    visibility: visible;
    transform: translateY(-50%) scale(1);
    pointer-events: auto;
}

.toolbar-qrcode img {
    width: 120px;
    height: 120px;
    object-fit: contain;
    border-radius: 6px;
    background: #f8fafc;
    display: block;
    margin: 0 auto;
}

.toolbar-qrcode span {
    display: block;
    margin-top: 8px;
    font-size: 12px;
    color: #6b7280;
    line-height: 1.4;
}

/* 响应式 */
@media (max-width: 768px) {
    .floating-toolbar {
        right: 12px;
        bottom: 100px;
        gap: 8px;
    }
    .toolbar-btn {
        width: 40px;
        height: 40px;
        font-size: 18px;
    }
    .toolbar-qrcode {
        width: 140px;
        right: 50px;
    }
    .toolbar-qrcode img {
        width: 100px;
        height: 100px;
    }
}
/* ===== 返回示例中的图片美化（适配当前结构） ===== */
.api-doc > img,
.api-doc .response-content img {
    display: block;
    max-width: 100%;
    height: auto;
    margin: 12px auto;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    transition: box-shadow 0.3s ease, transform 0.3s ease;
}

.api-doc > img:hover,
.api-doc .response-content img:hover {
    box-shadow: 0 4px 20px rgba(99, 102, 241, 0.35);
    transform: translateY(-2px);
}

/* 超链接样式：缩小 + 主题配色 */
.api-doc a {
    font-size: 0.92em;
    color: #6366F1;
    text-decoration: none;
    border-bottom: 1px solid rgba(99, 102, 241, 0.2);
    transition: color 0.2s, border-color 0.2s;
}

.api-doc a:hover {
    color: #4F46E5;
    border-bottom-color: #4F46E5;
}

/* 缩小分类标题图标与文字间距 */
.mx-toolbar h2 img {
    margin-right: 2px !important;
}
   
.category-section {
    margin-bottom: 40px;
}
#latest {
    margin-bottom: 40px;  /* 与上面一致，保持统一 */
}

/* ===== 文章页二级标题样式 ===== */
.api-doc h2 {
    font-size: 18px;
    font-weight: 600;
    color: #4F46E5;
    margin: 28px 0 12px 0;
    padding-bottom: 6px;
    border-bottom: 2px solid #EEF2FF;
    line-height: 1.4;
    position: relative;
}

.api-doc h2::before {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    width:  100px;
    height: 2px;
    background: linear-gradient(90deg, #6366F1, #4F46E5);
    border-radius: 2px;
}

/* 文章页普通标题也保持统一 */
.post-content h2 {
    font-size: 20px;
    font-weight: 600;
    color: #1E1B2E;
    margin: 24px 0 12px 0;
    padding-bottom: 6px;
    border-bottom: 2px solid #F1F5F9;
}
/* ===== 文档页表格美化 ===== */
.mx-doc table {
    width: 100%;
    font-size: 14px;
    border-collapse: collapse;
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 4px 20px rgba(99, 102, 241, 0.20), 0 1px 3px rgba(0, 0, 0, 0.06); /* 主要阴影带主题色 */
    margin: 0.5em 0 1em;
}

/* 表头 */
.mx-doc thead {
    background: linear-gradient(135deg, #7C6FEB, #5B4FCF);
}

.mx-doc th {
    color: #ffffff;
    font-weight: 700;
    padding: 12px 18px;
    text-align: left;
    border: none;
    font-size: 13px;
    letter-spacing: 0.5px;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}

/* 表体 */
.mx-doc td {
    padding: 10px 18px;
    border-bottom: 1px solid #e8edf5;
    color: #1e1b2e;
    font-size: 13.5px;
}

/* 最后一行去掉底部边框 */
.mx-doc tbody tr:last-child td {
    border-bottom: none;
}

/* 隔行变色 */
.mx-doc tbody tr:nth-child(even) {
    background-color: #f8f9ff;
}

/* 行悬停效果 */
.mx-doc tbody tr:hover {
    background-color: #EEF2FF;
    transition: background 0.2s;
}

/* 响应式滚动容器 */
@media (max-width: 768px) {
    .mx-doc .table-wrap {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        margin: 0.5em 0 1em;
    }
    .mx-doc .table-wrap table {
        min-width: 480px;
    }
}
/* 复制成功提示 */
.copy-toast {
    position: fixed;
    top: 80px;
    right: 24px;
    z-index: 9999;
    display: flex;
    align-items: center;
    gap: 8px;
    background: linear-gradient(135deg, #6366F1, #4F46E5);
    color: #fff;
    padding: 10px 20px;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 500;
    box-shadow: 0 4px 16px rgba(99, 102, 241, 0.4);
    animation: slideInRight 0.3s ease, fadeOut 2s ease 1.7s forwards;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

.copy-toast .toast-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    flex-shrink: 0;
}

.copy-toast .toast-icon svg {
    width: 14px;
    height: 14px;
    fill: none;
    stroke: #fff;
    stroke-width: 2.5;
    stroke-linecap: round;
    stroke-linejoin: round;
}

@keyframes slideInRight {
    0% { opacity: 0; transform: translateX(30px); }
    100% { opacity: 1; transform: translateX(0); }
}

@keyframes fadeOut {
    0% { opacity: 1; }
    100% { opacity: 0; }
}
/* ===== 代码块容器 ===== */
.code-block-wrapper {
    position: relative;
    margin: 1em 0;
    border-radius: 8px;
    overflow: hidden;
    background: linear-gradient(160deg, #652487 0%, #443ac3 35%, #0174b7 68%, #04988e 100%);
}

/* ===== 代码块顶栏 ===== */
.code-block-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 6px 16px;
    background: rgba(0, 0, 0, 0.35);
    backdrop-filter: blur(4px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    min-height: 40px;
    user-select: none;
}

/* 语言标签 */
.code-block-header .lang {
    font-size: 12px;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.8);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

/* 右侧按钮组 */
.code-block-header .actions {
    display: flex;
    align-items: center;
    gap: 4px;
}

/* 顶栏按钮（图标按钮） */
.code-block-header .actions button {
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.6);
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 4px;
    transition: background 0.2s, color 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    line-height: 1;
}

.code-block-header .actions button:hover {
    background: rgba(255, 255, 255, 0.12);
    color: rgba(255, 255, 255, 0.95);
}

.code-block-header .actions button:active {
    background: rgba(255, 255, 255, 0.2);
}

/* 复制成功状态 */
.code-block-header .actions button.copied {
    color: #4ade80;
}

/* ===== 代码内容区域 ===== */
.code-block-body {
    overflow: hidden;
    transition: max-height 0.35s cubic-bezier(0.4, 0, 0.2, 1);
    max-height: 2000px;
}

.code-block-body.collapsed {
    max-height: 0 !important;
}

/* 代码块内部样式 */
.code-block-body pre[class*="language-"] {
    margin: 0 !important;
    border-radius: 0 !important;
    background: transparent !important;
    padding: 1.2em 1.5em;
    color: rgba(255, 255, 255, 0.92);
    font-family: 'JetBrains Mono', 'Consolas', 'Menlo', monospace;
    font-size: 0.9em;
    line-height: 1.6;
    overflow-x: auto;
    white-space: pre-wrap;
    word-break: break-word;
}

.code-block-body pre[class*="language-"] code {
    background: transparent !important;
    color: inherit !important;
    padding: 0 !important;
    font-family: inherit;
}

/* 行内代码样式 */
:not(pre) > code[class*="language-"] {
    background: rgba(0, 0, 0, 0.3);
    padding: 0.15em 0.5em;
    border-radius: 4px;
    font-size: 0.9em;
    color: #fff;
}


/* ---------- 基础 ---------- */
.mx-pagination {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin-top: 24px;
}
.mx-pagination span {
    display: inline-block;
    padding: 6px 12px;
    border-radius: 6px;
    border: 1px solid #e5e7eb;
    background: #fff;
    color: #374151;
    font-size: 14px;
    cursor: pointer;
}
.mx-pagination span.active {
    background: #6366f1;
    color: #fff;
    border-color: #6366f1;
}
.mx-pagination span:hover:not(.active) {
    background: #f3f4f6;
}

:root {
    --primary: #6366F1;
    --primary-400: #818CF8;
    --primary-600: #4F46E5;
    --primary-50: #EEF2FF;
    --bg: #F8FAFC;
    --card: #FFFFFF;
    --text: #1E1B2E;
    --text-muted: #A3A3A3;
    --border: #E5E7EB;
    --radius: 16px;
    --shadow: 0 1px 3px rgba(0,0,0,0.06);
}

* { margin: 0; padding: 0; box-sizing: border-box; }
body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--bg);
    color: var(--text);
}

/* ---------- 容器 ---------- */
.mx-container {
    max-width: 1280px;
    margin: 0 auto;
    padding: 0 20px;
}

/* ---------- Header ---------- */
.mx-header {
    position: fixed;
    top: 0; left: 0; right: 0;
    z-index: 50;
    background: rgba(255,255,255,0.85);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border);
    height: 64px;
    display: flex;
    align-items: center;
}
.mx-header .mx-container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
}
.mx-header-placeholder { height: 64px; }

.mx-logo {
    display: flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
    font-size: 22px;
    font-weight: 700;
    color: var(--text);
}
.mx-logo span { font-size: 22px; }

.mx-search {
    flex: 1;
    max-width: 480px;
    margin: 0 24px;
    position: relative;
}
.mx-search i {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
}
.mx-search input {
    width: 100%;
    padding: 8px 16px 8px 40px;
    border-radius: 9999px;
    border: 1px solid var(--border);
    background: var(--bg);
    font-size: 14px;
    outline: none;
    transition: 0.2s;
}
.mx-search input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(99,102,241,0.15);
}

.mx-nav {
    display: flex;
    gap: 20px;
}
.mx-nav a {
    color: var(--text-muted);
    text-decoration: none;
    font-size: 14px;
    transition: 0.2s;
}
.mx-nav a:hover { color: var(--primary); }

/* ---------- 首页布局 ---------- */
.mx-main { padding: 32px 0; }

.mx-main .mx-container {
    display: flex;
    gap: 32px;
    align-items: flex-start;
}

/* ---------- 侧边栏 ---------- */
.mx-sidebar {
    width: 180px;
    flex-shrink: 0;
    position: sticky;
    top: 96px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}
.category-icon {
    width: 18px;
    height: 18px;
    vertical-align: middle;
    margin-right: 6px;
    display: inline-block;
}
.mx-sidebar .mx-card { padding: 16px; }
.mx-sidebar h2 {
    font-size: 14px;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 8px;
}
.mx-sidebar ul {
    list-style: none;
}
.mx-sidebar ul li a {
    display: flex;
    align-items: center; 
    padding: 6px 12px;
    border-radius: 8px;
    font-size: 14px;
    color: var(--text-muted);
    text-decoration: none;
    transition: 0.15s;
}
.mx-sidebar ul li a img {
    width: 18px;
    height: 18px;
    margin-right: 6px;
    flex-shrink: 0;       /* 防止图片被压缩 */
}
.mx-sidebar ul li a:hover { background: var(--primary-50); }
.mx-sidebar ul li a.active {
    background: var(--primary-50);
    color: var(--primary);
    font-weight: 500;
}

.mx-stats {
    background: linear-gradient(135deg, var(--primary), var(--primary-600));
    border-radius: var(--radius);
    padding: 20px;
    color: #fff;
    text-align: center;
}

.mx-stats p:last-child { font-size: 13px; opacity: 0.8; }

/* ---------- 内容区 ---------- */
.mx-content { flex: 1; min-width: 0; }

.mx-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}
.mx-toolbar h2 { font-size: 20px; font-weight: 600; }
.mx-toolbar span {
    font-size: 13px;
    color: var(--text-muted);
}

/* 分类标题：图标和文字水平居中，在一行显示 */
.category-section .mx-toolbar h2 {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    flex-wrap: nowrap; /* 确保不换行 */
}
.category-section .mx-toolbar h2 img {
    display: inline-block;
    width: 24px;
    height: 24px;
    vertical-align: middle;
}
.category-section .mx-toolbar h2 span {
    display: inline-block;
    white-space: nowrap;
}

.mx-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 16px;
}

/* ---------- 卡片 ---------- */
.mx-card {
    background: var(--card);
    border-radius: var(--radius);
    border: 1px solid var(--border);
    box-shadow: var(--shadow);
    transition: 0.2s;
}
.mx-card:hover {
    border-color: var(--primary-400);
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(99,102,241,0.10);
}

.api-card {
    padding: 20px;
    cursor: pointer;
}
.api-header {
    display: flex;
    gap: 14px;
    align-items: flex-start;
}
.api-header img {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    object-fit: cover;
    background: var(--bg);
    flex-shrink: 0;
}
.api-header h4 {
    font-size: 15px;
    font-weight: 600;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.api-meta {
    display: flex;
    gap: 14px;
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 4px;
}
.api-desc {
    font-size: 13px;
    color: var(--text-muted);
    margin-top: 12px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* ---------- API 详情页 ---------- */
.mx-doc .mx-card { padding: 32px;margin: 0 auto; }

.doc-header {
    display: flex;
    gap: 20px;
    align-items: center;
}
.doc-header img {
    width: 60px;
    height: 60px;
    border-radius: 16px;
    object-fit: cover;
    background: var(--bg);
}
.doc-header h1 { font-size: 24px; font-weight: 700; }
.doc-header p { color: var(--text-muted); margin-top: 4px; }

.doc-info { display: flex; flex-direction: column; gap: 12px; }
.doc-info > div {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}
.doc-info span {
    color: var(--text-muted);
    font-size: 14px;
    min-width: 72px;
}
.doc-info code {
    font-family: 'JetBrains Mono', monospace;
    font-size: 13px;
    background: #EEF2FF;
    padding: 4px 12px;
    border-radius: 6px;
    word-break: break-all;
}
.doc-info .method { color: #059669; background: #ECFDF5; }
.doc-info .format { color: #2563EB; background: #EFF6FF; }
.doc-info button {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 4px;
}
.doc-info button:hover { background: var(--bg); color: var(--primary); }


.code-block {
    background: #1E1B2E;
    color: #E5E7EB;
    padding: 16px 20px;
    border-radius: 10px;
    font-size: 13px;
    overflow-x: auto;
    font-family: 'JetBrains Mono', monospace;
}
.code-wrapper {
    position: relative;
}
.code-wrapper pre {
    background: #1E1B2E;
    color: #E5E7EB;
    padding: 16px 20px;
    border-radius: 10px;
    font-size: 13px;
    overflow-x: auto;
    font-family: 'JetBrains Mono', monospace;
}
.code-wrapper button {
    position: absolute;
    top: 8px;
    right: 12px;
    background: rgba(255,255,255,0.08);
    color: #9CA3AF;
    border: none;
    padding: 4px 12px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 12px;
}
.code-wrapper button:hover { background: rgba(255,255,255,0.15); color: #fff; }

.doc-footer {
    margin-top: 32px;
    padding-top: 16px;
    border-top: 1px solid var(--border);
    text-align: right;
    font-size: 13px;
    color: var(--text-muted);
}
.doc-footer a { color: var(--primary); text-decoration: none; }
.doc-footer a:hover { text-decoration: underline; }

/* ---------- Toast ---------- */
.mx-toast {
    position: fixed;
    top: 80px;
    right: 24px;
    background: #059669;
    color: #fff;
    padding: 10px 20px;
    border-radius: 10px;
    font-size: 14px;
    z-index: 999;
    box-shadow: 0 4px 16px rgba(5,150,105,0.3);
    animation: fadeIn 0.3s ease;
}
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(-12px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ---------- 响应式 ---------- */
@media (max-width: 768px) {
    .mx-search { margin: 0 12px; max-width: 200px; }
    .mx-nav { gap: 12px; }
    .mx-nav a { font-size: 13px; }
    .mx-main .mx-container { flex-direction: column; }
    .mx-sidebar {
        width: 100%;
        position: static;
        flex-direction: row;
        flex-wrap: wrap;
    }
    .mx-sidebar .mx-card { flex: 1; min-width: 160px; }
    .mx-grid { grid-template-columns: 1fr; }
    .mx-doc .mx-card { padding: 20px; }
    .doc-header { flex-direction: column; text-align: center; }
    .doc-info > div { flex-wrap: wrap; }
}

@media (max-width: 480px) {
    .mx-header .mx-container { flex-wrap: wrap; gap: 8px; }
    .mx-search { order: 3; flex: 1 1 100%; max-width: 100%; margin: 0; }
    .mx-nav { gap: 8px; }
}

/* ============================================================
   MikuX 页脚样式
   ============================================================ */

.mx-footer {
    background: #f8fafc;
    border-top: 1px solid #e5e7eb;
    padding: 48px 0 24px;
    margin-top: 48px;
    color: #374151;
}

.mx-footer .mx-container {
    max-width: 1280px;
    margin: 0 auto;
    padding: 0 20px;
}

/* 三列均分，介绍不再过宽 */
.footer-grid {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 32px;
}

.footer-item h4 {
    font-size: 16px;
    font-weight: 600;
    color: #1e1b2e;
    margin-bottom: 16px;
    letter-spacing: 0.5px;
}

.footer-item p {
    font-size: 14px;
    line-height: 1.7;
    color: #6b7280;
    margin-bottom: 10px;
}

.footer-item a {
    color: #6b7280;
    text-decoration: none;
    font-size: 14px;
    display: block;
    padding: 4px 0;
    transition: color 0.2s;
}

.footer-item a:hover {
    color: #6366f1;
}

.footer-item .cloud-info {
    margin-top: 12px;
    font-size: 13px;
}

.footer-item .cloud-info a {
    display: inline;
    color: #6366f1;
    font-weight: 500;
}

/* ----- 赞赏工具（药丸大弧度样式） ----- */
.donate-box {
    margin-top: 12px;
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
}

.donate-label {
    font-size: 13px;
    font-weight: bold;
    color: #6366F1;
    margin-right: 4px;
}

#donateBox {
    list-style: none;
    display: flex;
    gap: 8px;
    padding: 0;
    margin: 0;
    flex-wrap: nowrap;
}

#donateBox li {
    cursor: pointer;
    font-size: 13px;
    padding: 4px 14px;
    border-radius: 20px;          /* 药丸大弧度 */
    transition: all 0.2s;
    color: #374151;
    user-select: none;
    background: #f1f5f9;          /* 浅灰背景 */
    border: none;                 /* 去掉边框 */
    white-space: nowrap;
    flex-shrink: 0;
}

#donateBox li:hover {
    background: #6366f1;          /* 紫色背景 */
    color: #fff;                  /* 白色文字 */
}

/* ----- 二维码弹窗（按钮附近显示） ----- */
#QRBox {
    position: fixed;
    z-index: 99999;
    display: none;
    pointer-events: none;
}

#QRBox.active {
    display: block;
    pointer-events: auto;
}

#MainBox {
    width: 180px;
    height: 180px;
    background: #fff no-repeat center center;
    background-size: 170px;
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.25);
    cursor: pointer;
    opacity: 0;
    transform: scale(0.95) translateY(-6px);
    transition: opacity 0.25s ease, transform 0.25s ease;
    border: 2px solid #fff;
}

#MainBox.showQR {
    opacity: 1;
    transform: scale(1) translateY(0);
}

#MainBox.hideQR {
    opacity: 0;
    transform: scale(0.95) translateY(-6px);
}

/* ----- 分割线 ----- */
.footer-divider {
    border-top: 1px solid #e5e7eb;
    margin: 32px 0 20px;
}

/* ----- 版权 & 备案（居中对齐，紧挨着） ----- */
.footer-bottom {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 8px 12px;
    font-size: 14px;
    color: #9ca3af;
    text-align: center;
}

.footer-bottom a {
    color: #6366f1;
    text-decoration: none;
}

.footer-bottom a:hover {
    text-decoration: underline;
}

/* ===== 响应式 ===== */
@media (max-width: 768px) {
    .footer-grid {
        grid-template-columns: 1fr 1fr;
        gap: 24px;
    }
}

@media (max-width: 480px) {
    .footer-grid {
        grid-template-columns: 1fr;
        gap: 16px;
    }

    .footer-bottom {
        flex-direction: column;
        align-items: center;
        gap: 4px;
    }

    #MainBox {
        width: 150px;
        height: 150px;
        background-size: 140px;
    }
}


/* 默认浅色模式变量 */
:root {
    --primary: #6366F1;
    --primary-400: #818CF8;
    --primary-600: #4F46E5;
    --primary-50: #EEF2FF;
    --bg: #F8FAFC;
    --card: #FFFFFF;
    --text: #1E1B2E;
    --text-muted: #A3A3A3;
    --border: #E5E7EB;
    --radius: 16px;
    --shadow: 0 1px 3px rgba(0,0,0,0.06);
}

/* 深色模式变量 */
.dark-mode {
    --primary: #818CF8;
    --primary-400: #6366F1;
    --primary-600: #4F46E5;
    --primary-50: #2D2A4A;
    --bg: #12101A;
    --card: #1E1B2E;
    --text: #E5E7EB;
    --text-muted: #9CA3AF;
    --border: #2D2A4A;
    --shadow: 0 1px 3px rgba(0,0,0,0.3);
}

/* 应用背景、文字等通用样式 */
body {
    background: var(--bg);
    color: var(--text);
    transition: background 0.3s, color 0.3s;
}
.mx-card,
.mx-header,
.mx-footer,
.toolbar-btn,
.toolbar-qrcode,
.code-block-header {
    transition: background 0.3s, color 0.3s, border-color 0.3s, box-shadow 0.3s;
}

/* ===== 主题切换按钮 ===== */
.mx-nav .theme-toggle {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 4px 8px;
    font-size: 14px;
    transition: color 0.2s;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
}
.theme-toggle:hover {
    background: var(--primary-50);
    border-color: var(--primary);
}
/* 深色模式下的按钮颜色 */
.dark-mode .mx-nav .theme-toggle {
    color: rgba(255, 255, 255, 0.6);
}
.dark-mode .mx-nav .theme-toggle:hover {
    color: var(--primary);
}

/* 调整图标大小 */
.mx-nav .theme-toggle svg {
    width: 18px;
    height: 18px;
    stroke: currentColor;
}
.theme-toggle svg {
    stroke: currentColor;
}
.theme-toggle .sun-icon,
.theme-toggle .moon-icon {
    transition: transform 0.5s ease, opacity 0.3s ease;
}
.dark-mode .theme-toggle .sun-icon {
    transform: rotate(90deg);
}
/* 默认显示太阳，深色模式显示月亮 */
.theme-toggle .moon-icon { display: none; }
.dark-mode .theme-toggle .sun-icon { display: none; }
.dark-mode .theme-toggle .moon-icon { display: block; }

.mx-header {
    background: rgba(255,255,255,0.85); /* 浅色默认 */
    border-bottom: 1px solid var(--border);
    backdrop-filter: blur(12px);
}
.dark-mode .mx-header {
    background: rgba(18, 16, 26, 0.9);  /* 深色模式背景 */
    border-bottom-color: var(--border);
}

.mx-footer {
    background: var(--footer-bg, #f8fafc);
    border-top: 1px solid var(--border);
    color: var(--text-muted);
}
:root {
    --footer-bg: #f8fafc;
}
.dark-mode {
    --footer-bg: #1a1728;
}
.mx-footer a {
    color: var(--text-muted);
}
.mx-footer a:hover {
    color: var(--primary);
}
.doc-info code {
    font-family: 'JetBrains Mono', monospace;
    font-size: 13px;
    background: var(--primary-50);
    padding: 4px 12px;
    border-radius: 6px;
    word-break: break-all;
    color: var(--text);  /* 文字颜色使用变量 */
}

/* 深色模式下代码背景加深 */
.dark-mode .doc-info code {
    background: #2D2A4A;
}

/* 默认样式保持不变，深色模式覆盖 */
.dark-mode .toolbar-btn {
    background: rgba(255, 255, 255, 0.12);  /* 半透明白，柔和 */
    border-color: rgba(255, 255, 255, 0.08);
}
.dark-mode .toolbar-btn:hover {
    background: rgba(255, 255, 255, 0.22);
}

/* ===== 深色模式精确修复 ===== */

/* 搜索框 */
.dark-mode .mx-search input {
    background: rgba(255, 255, 255, 0.08) !important;
    border-color: var(--border) !important;
    color: var(--text) !important;
}
.dark-mode .mx-search input::placeholder {
    color: rgba(255, 255, 255, 0.3);
}

/* 赞赏按钮 */
.dark-mode #donateBox li {
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid var(--border);
    color: var(--text);
}
.dark-mode #donateBox li:hover {
    background: #6366f1;
    color: #fff;
    border-color: #6366f1;
}

/* 表头不变 */
.dark-mode .table-wrap th,
.dark-mode .mx-doc th,
.dark-mode table th {
    background: linear-gradient(135deg, #7C6FEB, #5B4FCF) !important;
    color: #ffffff !important;
}

/* 所有表格行背景 */
.dark-mode .table-wrap tbody tr,
.dark-mode .mx-doc tbody tr,
.dark-mode table tbody tr {
    background-color: #1e1b2e !important;
}
.dark-mode .table-wrap tbody tr:nth-child(even),
.dark-mode .mx-doc tbody tr:nth-child(even),
.dark-mode table tbody tr:nth-child(even) {
    background-color: #2a2740 !important;
}

/* 单元格背景透明，文字颜色亮色 */
.dark-mode .table-wrap td,
.dark-mode .mx-doc td,
.dark-mode table td {
    background-color: transparent !important;
    color: #d1d5db !important;
}

/* 表格边框 */
.dark-mode .table-wrap table,
.dark-mode .mx-doc table,
.dark-mode table {
    border: 1px solid #3d3a5a !important;
}
.dark-mode .table-wrap td,
.dark-mode .mx-doc td,
.dark-mode table td {
    border-bottom: 1px solid #3d3a5a !important;
}

/* 悬停 */
.dark-mode .table-wrap tbody tr:hover,
.dark-mode .mx-doc tbody tr:hover,
.dark-mode table tbody tr:hover {
    background-color: #3a3555 !important;
}
.dark-mode .table-wrap tbody tr:hover td,
.dark-mode .mx-doc tbody tr:hover td,
.dark-mode table tbody tr:hover td {
    background-color: transparent !important;
}


/* ===== 主题切换下拉菜单 ===== */
.theme-dropdown {
    position: relative;
    display: inline-block;
    margin-left: 8px;
}

.theme-toggle {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 4px 10px;
    display: flex;
    align-items: center;
    gap: 6px;
    border-radius: 20px;
    font-size: 14px;
    transition: background 0.2s, color 0.2s;
    font-family: inherit;
}
.theme-toggle:hover {
    background: var(--primary-50);
    color: var(--primary);
}
.theme-toggle svg {
    width: 18px;
    height: 18px;
    stroke: currentColor;
}
.toggle-text {
    font-size: 13px;
}

/* 默认显示太阳，根据模式切换图标 */
.theme-toggle .moon-icon,
.theme-toggle .system-icon {
    display: none;
}
body:not(.dark-mode) .theme-toggle .sun-icon { display: block; }
.dark-mode .theme-toggle .moon-icon { display: block; }
.dark-mode .theme-toggle .sun-icon { display: none; }

/* 取消 system-icon 展示 */
.theme-toggle .system-icon { display: none !important; }

/* 下拉菜单 */
.theme-menu {
    position: absolute;
    top: calc(100% + 6px);
    right: 0;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 10px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.12);
    padding: 6px 0;
    min-width: 110px;
    list-style: none;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-6px);
    transition: opacity 0.25s ease, transform 0.25s ease, visibility 0.25s;
    z-index: 1000;
}

.theme-menu.open {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.theme-menu li {
    text-align: center;
    padding: 8px 16px;
    cursor: pointer;
    font-size: 14px;
    color: var(--text);
    transition: background 0.15s, color 0.15s;
    display: block;      
    align-items: center;
    gap: 8px;
}
.theme-menu li:hover {
    background: var(--primary-50);
    color: var(--primary);
}
.theme-menu li.active {
    background: var(--primary-50);
    color: var(--primary);
    font-weight: 500;
}

/* 深色模式下拉菜单背景 */
.dark-mode .theme-menu {
    background: #1e1b2e;
    border-color: #2d2a4a;
}
.dark-mode .theme-menu li:hover {
    background: #2d2a4a;
}
/* ===== 深色模式：右下角工具栏按钮颜色反转 ===== */
.dark-mode .toolbar-btn {
    color: #ffffff !important;
    background: rgba(255, 255, 255, 0.08) !important;
    border-color: rgba(255, 255, 255, 0.06) !important;
}
.dark-mode .toolbar-btn:hover {
    color: #A78BFA !important;
    background: rgba(255, 255, 255, 0.2) !important;
    border-color: rgba(255, 255, 255, 0.15) !important;
}

/* 移动端顶栏优化 */
@media (max-width: 768px) {
    .mx-header {
        padding: 6px 0;
        min-height: 52px;
        height: auto;
    }
    .mx-header .mx-container {
        flex-wrap: wrap;
        gap: 4px 8px;
        align-items: center;
    }
    .mx-logo {
        font-size: 18px;
        gap: 6px;
    }
    .mx-logo svg {
        width: 28px;
        height: 28px;
    }
    .mx-search {
        order: 3;
        flex: 1 1 100%;
        margin: 2px 0;
        max-width: 100%;
    }
    .mx-search input {
        padding: 6px 12px 6px 32px;
        font-size: 13px;
    }
    .mx-nav {
        display: flex;
        align-items: center;
        gap: 6px;
        font-size: 13px;
    }
    .mx-nav .theme-toggle {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        padding: 2px 6px;
        line-height: 1;
        vertical-align: middle;
    }
    .mx-nav .theme-toggle svg {
        width: 16px;
        height: 16px;
    }
    .toggle-text {
        display: none; /* 移动端隐藏“主题”文字 */
    }
    .mx-nav a {
        font-size: 13px;
        padding: 4px 0;
    }
    /* 移动端侧边栏卡片紧凑 */
    .mx-sidebar .mx-card {
        padding: 6px 12px !important;
    }
    
    /* 分类标题左对齐，箭头靠右 */
   .category-toggle {
        margin-bottom: 0 !important;
        padding: 4px 0;
        font-size: 14px;
        font-weight: 600;
        display: flex;
        align-items: center;
        justify-content: flex-start;
        gap: 6px;
        cursor: pointer;
        user-select: none;
    }
    .category-toggle .toggle-icon {
        margin-left: auto; /* 将箭头推到右侧 */
        font-size: 12px;
        transition: transform 0.3s ease;
    }
    .category-toggle.open .toggle-icon {
        transform: rotate(180deg);
    }
    
    /* 分类列表默认折叠，展开时紧凑 */
    .category-list {
        display: none;
        margin: 0 !important;
        padding: 0 !important;
        padding: 0;
    }
    .category-list.open {
        display: block;
    }
    
    /* 分类列表项紧凑 */
    .category-list li {
        margin-bottom: 0px;
    }
    .category-list a {
        display: block;
        padding: 4px 8px;
        font-size: 13px;
        border-radius: 6px;
        color: var(--text-muted);
        text-decoration: none;
        transition: background 0.15s;
    }
    .category-list a:hover,
    .category-list a.active {
        background: var(--primary-50);
        color: var(--primary);
    }
}

/* 移动端分类折叠 */
@media (max-width: 768px) {
    .category-list {
        display: none; /* 默认折叠 */
    }
    .category-list.open {
        display: block;
    }
    .category-toggle {
        cursor: pointer;
        user-select: none;
        display: flex;
        justify-content: space-between;
        align-items: center;
    }
    .category-toggle .toggle-icon {
        transition: transform 0.3s ease;
    }
    .category-toggle.open .toggle-icon {
        transform: rotate(180deg);
    }

}

/* 桌面端保持展开，隐藏箭头 */
@media (min-width: 769px) {
    .category-list {
        display: block !important;
    }
    .category-toggle .toggle-icon {
        display: none;
    }
}
/* 移动端：强制每行2列 */
@media (max-width: 768px) {
    .mx-grid {
        grid-template-columns: 1fr 1fr !important;
        gap: 12px;
    }
    /* 卡片内边距调小，防止内容溢出 */
    .api-card {
        padding: 16px;
    }
    .api-header img {
        width: 40px;
        height: 40px;
    }
    .api-header h4 {
        font-size: 14px;
        white-space: normal;
        word-break: break-word;
    }
    .api-desc {
        font-size: 12px;
        -webkit-line-clamp: 2;
    }
}

/* 极窄屏（宽度 < 380px）单列 */
@media (max-width: 380px) {
    .mx-grid {
        grid-template-columns: 1fr !important;
        gap: 10px;
    }
    .api-card {
        padding: 14px;
    }
}

/* 移动端文章页头部强制左对齐 + 垂直居中 */
@media (max-width: 768px) {
    .mx-doc .doc-header,
    .doc-header {
        display: flex !important;
        align-items: center !important;
        justify-content: flex-start !important;
        gap: 12px !important;
        text-align: left !important;
        flex-direction: row !important; /* 确保水平排列 */
    }
    .mx-doc .doc-header img,
    .doc-header img {
        flex-shrink: 0 !important;
        width: 48px !important;
        height: 48px !important;
        margin: 0 !important;
    }
    .mx-doc .doc-header > div,
    .doc-header > div {
        flex: 1 !important;
        text-align: left !important;
        min-width: 0 !important;
    }
    .mx-doc .doc-header h1,
    .doc-header h1 {
        font-size: 18px !important;
        word-break: break-word !important;
        text-align: left !important;
        margin: 0 0 2px 0 !important;
    }
    .mx-doc .doc-header p,
    .doc-header p {
        font-size: 14px !important;
        text-align: left !important;
        margin: 0 !important;
    }
}
.related-posts h2 {
    font-size: 18px;
    font-weight: 600;
    color: #4F46E5;
    line-height: 1.4;
    position: relative;
}