.mobile-menu-toggle {
    display: none; /* 默认隐藏 */
    position: fixed;
    top: 12px;
    left: 15px;
    z-index: 1001;
    padding: 8px;
    background: rgba(30, 30, 30, 0.9);
    border: 1px solid #404040;
    border-radius: 4px;
    cursor: pointer;
    color: #d4d4d4;
    font-size: 16px;
    width: 36px;
    height: 36px;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.mobile-menu-toggle:hover {
    background: rgba(45, 45, 45, 0.9);
    color: #569cd6;
}

/* 桌面端确保菜单按钮隐藏，header布局正常 */
@media screen and (min-width: 769px) {
    .mobile-menu-toggle {
        display: none !important;
    }

    .vs-nav {
        padding: 0 20px; /* 桌面端正常padding */
        display: flex;
        align-items: center;
        justify-content: space-between; /* 桌面端左右分布 */
        height: 48px;
    }

    .nav-left {
        display: flex;
        align-items: center;
        width: auto; /* 桌面端自动宽度 */
    }

    .nav-brand {
        font-size: 1.2em;
        padding: 0 15px;
        display: flex;
        align-items: center;
        gap: 8px;
    }

    .nav-right {
        display: flex; /* 桌面端显示导航菜单 */
        gap: 5px;
    }
}

@media screen and (max-width: 768px) {
    /* 只在移动端显示菜单按钮 */
    .mobile-menu-toggle {
        display: flex !important;
    }

    /* 调整移动端header布局 */
    .vs-nav {
        padding: 0 60px 0 20px; /* 左侧留给菜单按钮，右侧平衡 */
        display: flex;
        align-items: center;
        justify-content: center; /* 标题居中 */
        height: 48px;
    }

    .nav-left {
        display: flex;
        align-items: center;
        justify-content: center;
        width: 100%;
    }

    .nav-brand {
        font-size: 1.1em;
        padding: 0;
        display: flex;
        align-items: center;
        justify-content: center;
        gap: 8px;
    }

    .nav-right {
        display: none; /* 在移动端隐藏导航菜单 */
    }

    .sidebar-explorer {
        position: fixed;
        left: -100%;
        top: 48px; /* 与头部导航栏对齐 */
        height: calc(100vh - 48px);
        width: 80%;
        max-width: 300px;
        z-index: 999;
        transition: left 0.3s ease;
        background: #252526;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
    }

    .sidebar-explorer.show {
        left: 0;
        box-shadow: 2px 0 8px rgba(0, 0, 0, 0.3);
    }

    .wrapper {
        padding-top: 50px;
    }
    
    /* 优化移动端文章内容 */
    .post-content {
        padding: 1rem;
        overflow-x: hidden;
        width: 100%;
    }
    
    /* 确保链接不会溢出容器 */
    a {
        word-break: break-word;
        overflow-wrap: break-word;
    }
    
    /* 优化代码块在移动端的显示 */
    pre {
        position: relative;
        width: 100%;
        box-sizing: border-box;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        margin: 1rem 0;
        border-radius: 4px;
        font-size: 0.9em;
        padding: 2.5em 0.5em 0.5em;
    }
    
    code {
        word-break: break-all;
        word-wrap: break-word;
        white-space: pre-wrap;
    }
    
    /* 优化表格在移动端的显示 */
    table {
        display: block;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        max-width: 100%;
    }
    
    /* 页脚样式优化 */
    .footer {
        position: relative;  /* 改为相对定位，避免遮挡内容 */
        margin-top: 2rem;
        padding: 0.5rem 0;
    }
    
    .status-bar {
        flex-wrap: wrap;  /* 允许项目换行 */
        justify-content: center;  /* 居中对齐 */
        padding: 8px 5px;
        gap: 10px;  /* 项目之间的间距 */
    }
    
    .status-item {
        margin-right: 0;  /* 移除右边距 */
        font-size: 11px;  /* 稍微减小字体 */
    }
    
    .status-item.github {
        margin-left: 0;  /* 移除左边距 */
    }
    
    /* 确保所有状态项目样式一致 */
    .status-item, .status-item.github {
        display: flex;
        align-items: center;
        justify-content: center;
    }
    
    /* 代码内容自适应 */
    pre code, .hljs {
        width: 100%;
        max-width: 100%;
        font-size: 0.9em;
        line-height: 1.5;
        white-space: pre-wrap;
        word-break: break-word;
    }
    
    /* 长链接处理 */
    a {
        word-break: break-word;
        overflow-wrap: break-word;
        hyphens: auto;
    }
}

@media (max-width: 768px) {
  .copy-button {
    opacity: 1;  /* 在移动端始终显示复制按钮 */
    top: 0.3em;
    right: 0.3em;
  }
  
  pre {
    padding: 2em 0.8em 0.8em;  /* 调整移动端padding */
  }
  
  /* 优化移动端图片显示 */
  img {
    max-width: 100%;
    height: auto;
  }
  
  /* 优化移动端文章标题 */
  .post-title h1, .post-title h2 {
    font-size: 1.5rem;
    word-break: break-word;
  }
  
  /* 优化移动端文章元数据 */
  .post-meta {
    flex-wrap: wrap;
    gap: 0.5rem;
  }
  
  /* 优化移动端内容区域 */
  .content-area {
    padding: 10px;
  }
  
  /* 优化移动端代码高亮 */
  .highlight {
    margin: 0 -10px;
  }
  
  .highlight pre {
    border-radius: 0;
  }
  
  /* 优化移动端TOC */
  .toc-container {
    max-height: 200px;
    overflow-y: auto;
  }
}

/* 小屏幕设备额外优化 */
@media (max-width: 480px) {
  .wrapper {
    padding: 10px;
  }
  
  .post-content {
    padding: 0.8rem;
  }
  
  pre {
    padding: 2em 0.4em 0.4em;
    font-size: 0.8em;
  }
  
  .post-title h1, .post-title h2 {
    font-size: 1.3rem;
  }
  
  /* 页脚在小屏幕上的额外优化 */
  .status-bar {
    flex-direction: column;  /* 垂直排列 */
    align-items: center;
    padding: 5px;
  }
  
  .status-item {
    margin: 3px 0;
    font-size: 10px;
  }
  
  /* 小屏幕代码块进一步优化 */
  pre code, .hljs {
    font-size: 0.8em;
    line-height: 1.4;
  }
      /* 优化移动端TOC */
  .toc-container {
    position: relative;
    top: 0;
    padding: 10px;
    margin: 10px 0;
  }

  .toc-content {
    max-height: 50vh; /* 使用视口高度的50%，更灵活地适应不同设备 */
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }
}
