:root {
    --sidebar-padding: 0 25px;
    --sidebar-width: 22rem;
}

/* ===== 夜间模式对比度修复 ===== */
/* 书名链接 */
html.dark .app-name-link {
    color: #e8e8e8 !important;
}

/* 侧边栏当前选中项 */
html.dark .sidebar-nav li.active > a {
    color: #ffffff !important;
    font-weight: bold;
}

/* 侧边栏所有链接 */
html.dark .sidebar-nav a {
    color: #cccccc !important;
}

html.dark .sidebar-nav a:hover {
    color: #ffffff !important;
}

/* 夜间模式：侧边栏链接前的箭头隐藏（与浅色模式视觉一致） */
html.dark .sidebar-nav li::before {
    display: none !important;
}

/* 夜间模式：箭头是通过 background gradient 实现的，覆盖变量使其透明 */
html.dark .sidebar-nav {
    --sidebar-nav-pagelink-background: no-repeat 2px calc(50% - 2.5px) / 6px 5px linear-gradient(45deg, transparent 2.75px, transparent 2.75px 4.25px, transparent 4px), no-repeat 2px calc(50% + 2.5px) / 6px 5px linear-gradient(135deg, transparent 2.75px, transparent 2.75px 4.25px, transparent 4px) !important;
    --sidebar-nav-pagelink-background--loaded: no-repeat 0px center / 5px 6px linear-gradient(225deg, transparent 2.75px, transparent 2.75px 4.25px, transparent 4.25px), no-repeat 5px center / 5px 6px linear-gradient(135deg, transparent 2.75px, transparent 2.75px 4.25px, transparent 4.25px) !important;
}

/* 右上角字数统计 */
html.dark .count_words,
html.dark .docsify-count {
    color: #cccccc !important;
}

/* 代码块：允许横向滚动，不截断也不强制换行 */
.markdown-section pre {
    overflow-x: auto !important;
    max-width: 100% !important;
}

.markdown-section pre > code {
    white-space: pre !important;
    word-break: normal !important;
    overflow-wrap: normal !important;
}

/* 行内代码允许折行，不截断 */
.markdown-section p code,
.markdown-section li code,
.markdown-section td code {
    word-break: break-all !important;
    white-space: pre-wrap !important;
}

/* 防止整个内容区撑破布局 */
.markdown-section {
    overflow-x: hidden !important;
}

.sidebar .search .clear-button {
    margin: 10px !important;
    padding: 0 0px !important;
}



/* 移动端完全隐藏，点击图标显示 - 包含iPad */
@media only screen and (max-width: 1024px) {
  aside.toc-nav {
    position: fixed;
    bottom: 20px;
    top: auto;
    right: 20px;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: var(--sidebar-nav-link-color--active, #42b983);
    box-shadow: 0 2px 10px rgba(0,0,0,0.2);
    cursor: pointer;
    opacity: 1;
    z-index: 1000000;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    transition: all 0.3s ease;
  }
  
  aside.toc-nav::before {
    content: "📑";
    font-size: 24px;
    color: white;
  }
  
  aside.toc-nav .page_toc {
    display: none;
    position: absolute;
    bottom: 60px;
    right: 0;
    width: 300px;
    max-height: 400px;
    background: white;
    border-radius: 8px;
    padding: 15px;
    box-shadow: 0 5px 20px rgba(0,0,0,0.15);
    overflow-y: auto;
  }
  
  aside.toc-nav.active {
    width: 300px;
    height: auto;
    border-radius: 8px;
    bottom: 20px;
    right: 20px;
  }
  
  aside.toc-nav.active::before {
    display: none;
  }
  
  aside.toc-nav.active .page_toc {
    display: block;
    position: static;
    width: 100%;
    max-height: 400px;
    box-shadow: none;
    padding: 0;
  }
}

