/**************************************************
知乎风格博客皮肤 - 样式文件 v5
修复：profile-banner 与 #main 左右对齐、#mainContent flex:1 自适应、
     移动端侧边栏隐藏、响应式布局
**************************************************/

/* ========== 全局重置 ========== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Helvetica Neue", "PingFang SC", "Microsoft YaHei", sans-serif;
    font-size: 14px;
    color: #1a1a1a;
    background-color: #f6f6f6;
    line-height: 1.6;
    overflow-x: hidden;
}

a {
    text-decoration: none;
    color: inherit;
}

a:hover {
    color: #175199;
}

ul, ol {
    list-style: none;
}

img {
    max-width: 100%;
}

/* ========== 知乎色板 ========== */
:root {
    --zhihu-blue: #0066ff;
    --zhihu-blue-hover: #0052cc;
    --zhihu-bg: #f6f6f6;
    --zhihu-card-bg: #ffffff;
    --zhihu-border: #ebebeb;
    --zhihu-text: #121212;
    --zhihu-text-secondary: #8590a6;
    --zhihu-text-light: #999aaa;
    --nav-height: 52px;
    --content-max-width: 1156px;
    --sidebar-width: 296px;
    --gap: 16px;
}

/* ========== 全宽固定顶部导航栏 ========== */
#header {
    position: fixed !important;
    top: 0;
    left: 0;
    right: 0;
    width: 100% !important;
    max-width: none !important;
    background: #fff !important;
    height: var(--nav-height);
    z-index: 1000;
    border-bottom: 1px solid var(--zhihu-border) !important;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
    padding: 0 !important;
    margin: 0 !important;
}

#blogTitle {
    display: none !important;
}

#navigator {
    display: flex !important;
    align-items: center;
    justify-content: space-between;
    height: 100%;
    max-width: var(--content-max-width);
    margin: 0 auto;
    padding: 0 20px !important;
    background: transparent !important;
    border: none !important;
    float: none !important;
    width: auto !important;
}

/* 左侧：Logo + 菜单 */
.nav-left {
    display: flex;
    align-items: center;
    gap: 28px;
    height: 100%;
    flex-shrink: 0;
}

.blog-logo {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 18px;
    font-weight: 600;
    color: var(--zhihu-blue);
    text-decoration: none !important;
    white-space: nowrap;
}

.blog-logo:hover {
    color: var(--zhihu-blue) !important;
    text-decoration: none !important;
}

.blog-logo img,
.blog-logo svg {
    height: 30px;
    width: auto;
}

/* 导航菜单 */
#navList {
    display: flex !important;
    align-items: center;
    gap: 4px;
    float: none !important;
    width: auto !important;
    min-height: auto !important;
    margin: 0 !important;
    padding: 0 !important;
}

#navList li {
    float: none !important;
    display: block;
}

#navList a.menu {
    display: block;
    padding: 8px 14px;
    height: auto !important;
    line-height: 1.4 !important;
    width: auto !important;
    float: none !important;
    border-right: none !important;
    font-size: 15px;
    color: var(--zhihu-text) !important;
    border-radius: 4px;
    transition: all 0.15s ease;
    white-space: nowrap;
    text-decoration: none !important;
}

#navList a.menu:hover {
    color: var(--zhihu-blue) !important;
    background: rgba(0, 102, 255, 0.08) !important;
    text-decoration: none !important;
}

/* ========== 导航中间：搜索栏 ========== */
.nav-search {
    display: flex;
    align-items: center;
    background: #f6f6f6;
    border-radius: 4px;
    padding: 0 12px;
    flex: 1;
    max-width: 400px;
    margin: 0 20px;
    height: 34px;
    transition: background 0.2s;
    min-width: 0;
}

.nav-search:hover,
.nav-search:focus-within {
    background: #ebebeb;
}

.nav-search .search-icon {
    color: #8590a6;
    margin-right: 8px;
    font-size: 14px;
    flex-shrink: 0;
}

.nav-search input {
    flex: 1;
    border: none;
    background: transparent;
    outline: none;
    font-size: 14px;
    color: var(--zhihu-text);
    font-family: inherit;
    min-width: 0;
}

.nav-search input::placeholder {
    color: #999;
}

/* 右侧：只保留按钮，删除头像和用户名 */
.nav-right {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
}

/* 导航栏头像（v4 删除，不再需要） */
.nav-avatar {
    display: none !important;
}

/* 导航栏用户名（v4 删除，不再需要） */
.nav-username {
    display: none !important;
}

.write-btn {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    background: var(--zhihu-blue) !important;
    color: #fff !important;
    border: none;
    padding: 7px 16px;
    border-radius: 4px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.2s;
    text-decoration: none !important;
    white-space: nowrap;
}

.write-btn:hover {
    background: var(--zhihu-blue-hover) !important;
    color: #fff !important;
}

.msg-btn {
    display: inline-flex;
    align-items: center;
    padding: 7px 10px;
    color: var(--zhihu-text-secondary) !important;
    font-size: 14px;
    border-radius: 4px;
    transition: background 0.15s;
    text-decoration: none !important;
    white-space: nowrap;
}

.msg-btn:hover {
    background: rgba(0,0,0,0.05) !important;
    color: var(--zhihu-text) !important;
}

/* iconfont 图标按钮 */
.nav-icon-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 4px;
    color: #8590a6;
    transition: background 0.15s, color 0.15s;
    flex-shrink: 0;
    text-decoration: none !important;
}
.nav-icon-btn:hover {
    background: rgba(0,0,0,0.05);
    color: var(--zhihu-text);
}
.nav-icon-btn i {
    font-size: 18px;
}

.blogStats {
    display: none !important;
}

/* ========== 页面主体容器 ========== */
#home {
    max-width: var(--content-max-width) !important;
    margin: calc(var(--nav-height) + 20px) auto 40px !important;
    width: 95% !important;
    min-width: auto !important;
    padding: 0 !important;
    display: block !important;
    gap: 0 !important;
    position: relative;
}

/* ========== 全宽背景图横幅区域 ========== */
.profile-banner {
    width: 100%;
    margin-bottom: var(--gap);
    border-radius: 4px;
    overflow: hidden;
    background: #fff;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}

.profile-cover {
    width: 100%;
    height: 240px;
    background-image: url(https://pic1.zhimg.com/v2-1766402f0dd8966f31a0f81d72c049f5_1440w.jpg?source=32738c0c);
    background-size: cover;
    background-position: center;
    position: relative;
}

.profile-cover .edit-cover-btn {
    display: none;
}

.profile-cover .ip-location {
    display: none;
}

/* profile-banner 内部容器，与 #main 左右对齐 */
.profile-banner-inner {
    display: flex;
    gap: var(--gap);
    align-items: stretch;
}
.profile-banner-left {
    flex: 1;
    min-width: 0;
}
.profile-banner-right {
    flex: 0 0 var(--sidebar-width);
    min-width: 0;
}

/* ========== 个人信息卡片 ========== */
.profile-header {
    display: flex;
    align-items: flex-end;
    padding: 16px 24px 20px;
    gap: 16px;
    background: #fff;
    position: relative;
}

.profile-avatar-wrapper {
    flex-shrink: 0;
    margin-top: -50px;
    z-index: 2;
}

.profile-avatar {
    width: 96px;
    height: 96px;
    border-radius: 8px;
    border: 4px solid #fff;
    overflow: hidden;
    background: #e8e8e8;
    box-shadow: 0 2px 8px rgba(0,0,0,0.12);
}

.profile-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.profile-user-info {
    flex: 1;
    padding-bottom: 4px;
}

/* 用户名可点击，指向个人主页 */
.profile-name {
    font-size: 26px;
    font-weight: 600;
    color: var(--zhihu-text);
    line-height: 1.3;
    margin-bottom: 6px;
}

.profile-name a {
    color: var(--zhihu-text) !important;
    text-decoration: none !important;
    transition: color 0.15s;
}

.profile-name a:hover {
    color: var(--zhihu-blue) !important;
    text-decoration: none !important;
}

.profile-bio {
    font-size: 14px;
    color: var(--zhihu-text-secondary);
    line-height: 1.5;
}

.profile-tabs {
    display: none;
}

/* ========== 主内容区域布局（左右分栏） ========== */
/* 多层选择器兜底，防止博客园 CSS 覆盖 */
#main,
#home #main,
body #home #main,
#mainWrapper #main {
    display: flex !important;
    flex-direction: row !important;
    gap: var(--gap) !important;
    align-items: flex-start !important;
    width: 100% !important;
    float: none !important;
    margin: 0 !important;
    padding: 0 !important;
    min-width: 0 !important;
}

#mainContent,
#home #mainContent,
body #home #mainContent,
#mainWrapper #mainContent {
    flex: 1 !important;
    min-width: 0 !important;
    float: none !important;
    width: auto !important;
    max-width: none !important;
    margin: 0 !important;
    padding: 0 !important;
    min-height: auto !important;
}

#mainContent .forFlow,
#home #mainContent .forFlow {
    width: 100% !important;
    margin: 0 !important;
    float: none !important;
}

#sideBar,
#home #sideBar,
body #home #sideBar,
#mainWrapper #sideBar {
    flex: 0 0 var(--sidebar-width) !important;
    max-width: var(--sidebar-width) !important;
    width: var(--sidebar-width) !important;
    float: none !important;
    margin: 0 !important;
    padding: 0 !important;
    min-width: 0 !important;
    overflow: visible !important;
}

#sideBarMain {
    width: 100%;
    position: sticky;
    top: calc(var(--nav-height) + 16px);
    margin-left: 15px;
}

/* ========== 文章列表样式 ========== */

.dayTitle {
    display: none !important;
}

/* 每篇文章独立卡片 */
.day,
.post-block {
    background: var(--zhihu-card-bg) !important;
    border-radius: 4px !important;
    padding: 20px 24px !important;
    margin-bottom: 12px !important;
    box-shadow: 0 1px 3px rgba(0,0,0,0.06) !important;
    border: none !important;
    min-height: auto !important;
    _height: auto !important;
    float: none !important;
    width: 100% !important;
}

.postTitle {
    float: none !important;
    width: 100% !important;
    border-bottom: none !important;
    margin-bottom: 10px !important;
    padding-bottom: 0 !important;
    font-size: 18px !important;
    font-weight: 600 !important;
    line-height: 1.5 !important;
}
/* 支持 .postTitle2 悬停变色（兼容旧模板） */
.postTitle2:hover {
    color: var(--zhihu-blue-hover) !important;
}
.postTitle a:link,
.postTitle a:visited,
.postTitle a:active {
    color: var(--zhihu-text) !important;
}
/* hover 必须放在 :link/:visited/:active 之后才能生效 */
.postTitle a:hover {
    color: var(--zhihu-blue) !important;
}

.postCon {
    float: none !important;
    width: 100% !important;
    color: var(--zhihu-text-secondary) !important;
    font-size: 14px !important;
    line-height: 1.8 !important;
    padding: 4px 0 12px !important;
    margin: 0 !important;
}

.postCon p {
    text-indent: 0 !important;
    margin: 0 0 8px 0 !important;
    text-align: left !important;
}

.postCon p:last-child {
    margin-bottom: 0 !important;
}

/* 文章底部操作栏 */
.postDesc {
    float: none !important;
    width: 100% !important;
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
    gap: 12px !important;
    padding: 12px 0 0 !important;
    margin-top: 8px !important;
    border-top: 1px solid var(--zhihu-border) !important;
    color: var(--zhihu-text-secondary) !important;
    font-size: 13px !important;
    text-align: left !important;
    background: transparent !important;
    min-height: auto !important;
}

.postDesc a:link,
.postDesc a:visited,
.postDesc a:active {
    color: var(--zhihu-text-secondary) !important;
}

.post-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

/* 编辑按钮（白底蓝框） */
.edit-btn {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 5px 14px;
    border-radius: 4px;
    font-size: 13px;
    cursor: pointer;
    border: 1px solid var(--zhihu-border);
    background: #fff;
    color: var(--zhihu-text-secondary);
    transition: all 0.2s;
    white-space: nowrap;
    text-decoration: none !important;
}

.edit-btn:hover {
    border-color: var(--zhihu-blue);
    color: var(--zhihu-blue) !important;
    text-decoration: none !important;
}

/* 阅读按钮（蓝底白字，相反配色） */
.read-btn {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 5px 14px;
    border-radius: 4px;
    font-size: 13px;
    cursor: pointer;
    background: var(--zhihu-blue);
    color: #fff !important;
    border: 1px solid var(--zhihu-blue);
    transition: all 0.2s;
    white-space: nowrap;
    text-decoration: none !important;
}

.read-btn:hover {
    background: var(--zhihu-blue-hover) !important;
    border-color: var(--zhihu-blue-hover) !important;
    color: #fff !important;
    text-decoration: none !important;
}

.post-time {
    color: var(--zhihu-text-light);
    font-size: 13px;
    white-space: nowrap;
}

.postSeparator {
    display: none !important;
}

.topicListFooter {
    text-align: center;
    padding: 20px 0;
    color: var(--zhihu-text-secondary);
}

.topicListFooter a {
    color: var(--zhihu-blue);
    margin: 0 8px;
}

/* ========== 侧边栏卡片 ========== */

#sideBarMain > div,
.sidebar-card {
    background: var(--zhihu-card-bg) !important;
    border-radius: 4px !important;
    padding: 16px 20px !important;
    margin-bottom: 12px !important;
    box-shadow: 0 1px 3px rgba(0,0,0,0.06) !important;
    border: none !important;
}

.catListTitle {
    font-size: 15px !important;
    font-weight: 600 !important;
    color: var(--zhihu-text) !important;
    margin-top: 0 !important;
    margin-bottom: 12px !important;
    padding-bottom: 10px !important;
    border-bottom: 1px solid var(--zhihu-border) !important;
    text-align: left !important;
    line-height: 1.4 !important;
}

.catListPostCategory ul li,
.catListPostArchive ul li,
.catListView ul li,
.catListEssay ul li,
.catListLink ul li,
.catListTag ul li {
    padding: 7px 0 !important;
    border-bottom: 1px solid #f6f6f6 !important;
    font-size: 14px;
    line-height: 1.5;
}

.catListPostCategory ul li:last-child,
.catListPostArchive ul li:last-child,
.catListView ul li:last-child,
.catListEssay ul li:last-child,
.catListLink ul li:last-child,
.catListTag ul li:last-child {
    border-bottom: none !important;
}

.catListPostCategory ul li a,
.catListPostArchive ul li a,
.catListView ul li a,
.catListEssay ul li a,
.catListLink ul li a,
.catListTag ul li a {
    color: var(--zhihu-text) !important;
    font-size: 14px !important;
    transition: color 0.15s;
    display: block;
}

.catListPostCategory ul li a:hover,
.catListPostArchive ul li a:hover,
.catListView ul li a:hover,
.catListEssay ul li a:hover,
.catListLink ul li a:hover,
.catListTag ul li a:hover {
    color: var(--zhihu-blue) !important;
}

/* ========== 日历模块 ========== */
#calendar {
    width: 100% !important;
    padding: 16px 20px !important;
}

.Cal {
    border: none !important;
    font-size: 13px;
    width: 100% !important;
    border-collapse: collapse;
}

.CalTitle {
    width: 100% !important;
    background: transparent !important;
    color: var(--zhihu-text) !important;
    border: none !important;
    border-bottom: 1px solid var(--zhihu-border) !important;
    padding-bottom: 8px !important;
    margin-bottom: 4px !important;
}

.CalDayHeader {
    border: none !important;
    border-bottom: 1px solid #f0f0f0 !important;
    font-weight: 500 !important;
    padding: 6px 0 !important;
    color: var(--zhihu-text-secondary) !important;
    font-size: 13px !important;
}

.CalOtherMonthDay,
.CalWeekendDay,
#calendar td[align="center"] {
    border: none !important;
    padding: 6px 0 !important;
    color: var(--zhihu-text-light) !important;
    font-size: 13px;
    text-align: center !important;
}

/* 日历中有文章的日期链接：知乎蓝、加粗、无下划线 */
#calendar td a {
    text-decoration: none !important;
    color: var(--zhihu-blue) !important;
    font-weight: 700 !important;
    padding: 2px 6px;
    border-radius: 50%;
    display: inline-block;
    width: 28px;
    height: 28px;
    line-height: 24px;
    text-align: center;
    box-sizing: border-box;
}

#calendar td a:hover {
    color: var(--zhihu-blue-hover) !important;
    background: rgba(0, 102, 255, 0.08);
}

/* 日历中"今天" */
.CalTodayDay {
    color: var(--zhihu-blue) !important;
    font-weight: 700 !important;
    text-align: center !important;
    position: relative;
}

.CalTodayDay::after {
    content: '';
    display: block;
    width: 28px;
    height: 28px;
    background: rgba(0, 102, 255, 0.1);
    border-radius: 50%;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 0;
    pointer-events: none;
}

.CalNextPrev {
    cursor: pointer;
    color: var(--zhihu-text-secondary);
    font-size: 13px;
}

.CalNextPrev:hover {
    color: var(--zhihu-blue);
}

/* ========== 公告模块 ========== */
.newsItem {
    padding: 0 !important;
    margin: 0 !important;
}

.newsItem p {
    color: var(--zhihu-text-secondary);
    font-size: 14px;
    line-height: 1.7;
}

/* ========== 搜索模块（隐藏，已移至导航栏） ========== */
.mySearch {
    display: none !important;
}

/* ========== 页脚 ========== */
#footer {
    text-align: center;
    padding: 30px 20px !important;
    color: var(--zhihu-text-secondary) !important;
    font-size: 13px !important;
    border-top: 1px solid var(--zhihu-border) !important;
    margin-top: 40px !important;
    background: #fff !important;
    clear: both;
}

/* ========== 清除浮动 ========== */
.clear {
    clear: both;
    height: 0;
    overflow: hidden;
}

/* ========== 响应式适配 ========== */
@media (max-width: 1024px) {
    :root {
        --sidebar-width: 280px;
    }

    #home {
        width: 96% !important;
        padding: 0 8px !important;
    }
}

@media (max-width: 768px) {
    #main {
        flex-direction: column !important;
    }

    #mainContent {
        flex: 1 !important;
        width: 100% !important;
        max-width: 100% !important;
        min-width: 0 !important;
    }

    #sideBar {
        display: none !important;
    }

    .profile-banner-right {
        display: none !important;
    }

    .profile-banner-left {
        flex: 1 !important;
    }

    #sideBarMain {
        position: static;
    }

    .profile-cover {
        height: 180px;
    }

    .profile-avatar {
        width: 72px;
        height: 72px;
    }

    .nav-left {
        gap: 16px;
    }

    #navList a.menu {
        padding: 8px 10px;
        font-size: 14px;
    }

    .write-btn {
        padding: 6px 12px;
        font-size: 13px;
    }

    /* 小屏隐藏搜索栏 */
    .nav-search {
        display: none;
    }
}

/* ========== 隐藏不需要的原始元素 ========== */
#top_nav,
.cnblogs-nav,
#navBar,
#cnblogs_navbar,
#blog_nav_my,
.navbar,
#blog_nav_rss,
#blog_nav_admin,
#blog_nav_sitehome {
    display: none !important;
}

.postDesc a[style*="display:none"],
.postDesc .hidden-action {
    display: none !important;
}
/* 阅读 */
/**
 * 知乎风格 - 文章阅读页样式
 * 左侧目录导航栏：模仿知乎文章页左侧 TOC 导航蓝样式
 * 由 read.js 检测页面后通过 .article-reading 类触发，与 style.css 独立
 */

/* ====== 阅读页全局调整 ====== */
.article-reading .profile-banner {
    display: none !important;
}

.article-reading #home {
    margin-top: calc(var(--nav-height) + 16px) !important;
}

/* ====== 左侧目录导航栏 ====== */
.toc-sidebar {
    flex: 0 0 200px;
    max-width: 200px;
    min-width: 0;
    align-self: flex-start;
    position: sticky;
    top: calc(var(--nav-height) + 20px);
    max-height: calc(100vh - var(--nav-height) - 40px);
    overflow-y: auto;
    padding-right: 12px;
    scrollbar-width: thin;
    scrollbar-color: #d9d9d9 transparent;
    background: transparent;
}

/* 自定义滚动条（Webkit） */
.toc-sidebar::-webkit-scrollbar {
    width: 4px;
}

.toc-sidebar::-webkit-scrollbar-track {
    background: transparent;
}

.toc-sidebar::-webkit-scrollbar-thumb {
    background: #d9d9d9;
    border-radius: 2px;
}

.toc-sidebar::-webkit-scrollbar-thumb:hover {
    background: #bfbfbf;
}

/* 目录标题（"目录"二字） */
.toc-sidebar-title {
    margin-top: 23px;
    font-size: 14px;
    font-weight: 600;
    color: #1a1a1a;
    margin-bottom: 12px;
    padding-bottom: 10px;
    padding-left: 12px;
    border-bottom: 1px solid #ebebeb;
    user-select: none;
}

/* ====== TOC 链接列表 ====== */

/* 重置克隆的 cnblogs-toc 原始样式 */
.toc-sidebar .cnblogs-toc {
    padding: 0 !important;
    margin: 0 !important;
    border: none !important;
    background: transparent !important;
    display: block !important;
}

/* 隐藏 <br> 标签，链接已通过 CSS 变为块级元素 */
.toc-sidebar .cnblogs-toc br {
    display: none;
}

/* 每个 TOC 链接 - 模仿知乎左侧导航蓝样式 */
.toc-sidebar .cnblogs-toc a,
.toc-sidebar .cnblogs-toc .toc-item {
    display: block;
    padding: 8px 12px;
    margin: 1px 0;
    color: #646464;
    font-size: 14px;
    line-height: 1.5;
    text-decoration: none !important;
    border-radius: 4px;
    border-left: 2px solid transparent;
    transition: color 0.2s, background 0.2s, border-color 0.2s;
    cursor: pointer;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* hover：文字变深，浅灰背景 */
.toc-sidebar .cnblogs-toc a:hover,
.toc-sidebar .cnblogs-toc .toc-item:hover {
    color: #1a1a1a !important;
    background: rgba(0, 0, 0, 0.04) !important;
}

/* 当前激活项 - 知乎蓝 + 左侧蓝色竖线 + 浅蓝背景 */
.toc-sidebar .cnblogs-toc a.toc-active,
.toc-sidebar .cnblogs-toc .toc-active {
    color: #0066ff !important;
    font-weight: 500;
    border-left-color: #0066ff !important;
    background: rgba(0, 102, 255, 0.04) !important;
}

/* 二级标题缩进（如 "1.1 小节"） */
.toc-sidebar .cnblogs-toc a.toc-level-2 {
    padding-left: 28px;
    font-size: 13px;
}

/* 三级标题更深缩进（如 "1.1.1 细目"） */
.toc-sidebar .cnblogs-toc a.toc-level-3 {
    padding-left: 44px;
    font-size: 13px;
}

/* ====== 响应式适配 ====== */
@media (max-width: 1024px) {
    .toc-sidebar {
        flex: 0 0 160px;
        max-width: 160px;
    }
}

@media (max-width: 768px) {
    /* 移动端隐藏目录导航 */
    .toc-sidebar {
        display: none !important;
    }

    .article-reading #main {
        flex-direction: column !important;
    }
}
/* 8848 */
/**
 * 知乎风格 - 文章阅读页样式（v6）
 * 修复：overflow 分离（链接层 visible，文字 span 截断）圆点可见
 */

.article-reading .profile-banner { display: none !important; }
.article-reading #home { margin-top: calc(var(--nav-height) + 16px) !important; }

/* ── 容器 ── */
.toc-sidebar {
    flex: 0 0 200px; max-width: 200px; min-width: 0;
    align-self: flex-start;
    position: sticky; top: calc(var(--nav-height) + 20px);
    max-height: calc(100vh - var(--nav-height) - 40px);
    overflow-y: auto; overflow-x: visible;
    padding-right: 12px;
    scrollbar-width: thin; scrollbar-color: #d9d9d9 transparent;
    background: transparent;
}
.toc-sidebar::-webkit-scrollbar { width: 4px; }
.toc-sidebar::-webkit-scrollbar-track { background: transparent; }
.toc-sidebar::-webkit-scrollbar-thumb { background: #d9d9d9; border-radius: 2px; }

/* ── 标题栏（flex 对齐） ── */
.toc-sidebar-header {
    display: flex; align-items: center; justify-content: space-between;
    padding: 0 0 10px 6px;
    margin-bottom: 10px;
    border-bottom: 1px solid #ebebeb;
}
.toc-sidebar-title {
    display: inline-flex; align-items: center;
    height: 20px;
    font-size: 14px; font-weight: 600; color: #1a1a1a;
    line-height: 20px;
    user-select: none;
}
/* ── 折叠箭头 ── */
.toc-toggle-btn {
    display: inline-flex; align-items: center; justify-content: center;
    width: 20px; height: 20px; padding: 0; margin: 0;
    cursor: pointer; user-select: none;
    color: #8590a6; font-size: 11px; line-height: 20px; text-align: center;
    border-radius: 4px;
    flex-shrink: 0;
    transition: color 0.15s, background 0.15s, transform 0.3s;
}
.toc-toggle-btn:hover { color: #121212; background: rgba(0,0,0,.06); }
.toc-sidebar.collapsed .toc-toggle-btn { transform: rotate(-90deg); }

/* ── 链接列表 + 链线 ── */
.toc-nav {
    position: relative;
    margin-left: 12px; padding-left: 16px;
    border-left: 3px solid #e8e8e8;
}
.toc-sidebar.collapsed .toc-nav { display: none; }

/* ── 链接（overflow visible，圆点自由溢出） ── */
.toc-link {
    position: relative; display: block;
    padding: 9px 12px 9px 8px; margin: 1px 0;
    color: #646464; font-size: 14px; line-height: 1.5;
    text-decoration: none !important;
    border-radius: 4px;
    cursor: pointer;
    overflow: visible;   /* ⬅ 不裁剪 ::before 圆点 */
}

/* 文字截断在内部 span 完成 */
.toc-link-text {
    display: block;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
    transition: color 0.2s;
}

/* ── 圆点（::before 实心） ── */
.toc-link::before {
    content: '';
    position: absolute; 
    left: -20px; 
    top: 50%;
    transform: translateY(-50%);
    width: 6px; 
    height: 6px;
    border-radius: 50%;
    background: #c5c5c5 !important;   /* 未激活：灰 ● */
    z-index: 2;
    transition: background 0.2s;
}

/* hover */
.toc-link:hover { color: #1a1a1a; background: rgba(0,0,0,.04); }
.toc-link:hover::before { background: #8c8c8c !important; }

/* 激活 */
.toc-link.toc-active { color: #0066ff !important; font-weight: 500; background: transparent !important; }
.toc-link.toc-active .toc-link-text { color: #0066ff !important; }
.toc-link.toc-active::before { background: #0066ff !important; }

/* ── 跳转偏移 ── */
.article-reading #cnblogs_post_body h1[id],
.article-reading #cnblogs_post_body h2[id],
.article-reading #cnblogs_post_body h3[id],
.article-reading #cnblogs_post_body h4[id],
.article-reading #cnblogs_post_body h5[id],
.article-reading #cnblogs_post_body h6[id] { scroll-margin-top: 80px; }

/* ── 响应式 ── */
@media (max-width: 1024px) {
    .toc-sidebar { flex: 0 0 160px; max-width: 160px; }
}
@media (max-width: 768px) {
    .toc-sidebar { display: none !important; }
    .article-reading #main { flex-direction: column !important; }
}
