* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif;
    line-height: 1.6;
    color: #333;
    background-color: #f5f5f5;
}

/* 顶部导航栏 */
.header {
    background: #fff;
    border-bottom: 1px solid #e0e0e0;
    padding: 0;
    position: sticky;
    top: 0;
    z-index: 1000;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.header-content {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    padding: 0 20px;
    height: 60px;
}

.logo {
    font-size: 24px;
    font-weight: bold;
    color: #333;
    text-decoration: none;
    margin-right: 40px;
}

.menu-toggle {
    display: none;
    font-size: 18px;
    cursor: pointer;
    padding: 10px;
    margin-right: 15px;
}

.nav-menu {
    display: flex;
    list-style: none;
    gap: 30px;
}

.nav-menu li {
    position: relative;
}

.nav-menu a {
    color: #333;
    text-decoration: none;
    padding: 20px 0;
    display: block;
    transition: color 0.3s;
}

.nav-menu a:hover {
    color: #007bff;
}

.search-container {
    display: flex;
    align-items: center;
    margin-left: auto;
}

.search-box {
    display: flex;
    border: 1px solid #ddd;
    border-radius: 4px;
    overflow: hidden;
    background: #fff;
}

.search-box input {
    border: none;
    padding: 8px 12px;
    outline: none;
    width: 200px;
    font-size: 14px;
}

.search-box button {
    background: #007bff;
    border: none;
    padding: 8px 16px;
    color: white;
    cursor: pointer;
    font-size: 14px;
    transition: background-color 0.3s;
}

.search-box button:hover {
    background: #0056b3;
}

/* 隐藏移动端搜索框 */
.mobile-search-item {
    display: none;
}

/* 主要内容区域 */
.main-content {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

.section {
    margin-bottom: 40px;
    background: #fff;
    border-radius: 8px;
    padding: 20px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 1px solid #e0e0e0;
}

.section-title {
    font-size: 18px;
    font-weight: bold;
    color: #333;
}

.more-link {
    color: #007bff;
    text-decoration: none;
    font-size: 14px;
}

.more-link:hover {
    text-decoration: underline;
}

/* manga 栅格（方案一：CSS Grid） */
.manga-grid {
    display: grid;
    /* 强制分成 6 列，每列宽度相等 */
    grid-template-columns: repeat(6, 1fr);
    gap: 20px;               /* 控制项目之间的间距，可按需调整 */
    align-items: start;      /* 如果项目高度不一，用于顶部对齐 */
}

.manga-item {
    width: 100%;
    text-align: center;
    cursor: pointer;
    transition: transform 0.3s ease;
    
    /* 使用 flex 布局确保内容垂直排列 */
    display: flex;
    flex-direction: column;
}

.manga-item:hover {
    transform: translateY(-2px);
}

.manga-item a {
    text-decoration: none;
    display: flex;
    flex-direction: column;
    height: 100%;
}

.manga-cover {
    width: 100%;
    aspect-ratio: 3/4;
    border-radius: 6px;
    margin-bottom: 8px;
    overflow: hidden;
    position: relative;
    border: 1px solid #e0e0e0;
    background-color: #f8f9fa;
    
    /* 确保封面图片不会因为标题长度而变形 */
    flex-shrink: 0;
}

.manga-cover img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
    display: block;
    transition: transform 0.3s ease;
}

.manga-cover:hover img {
    transform: scale(1.05);
}

.manga-title {
    font-size: 14px;
    color: #333;
    margin-bottom: 4px;
    
    /* 设置固定高度，确保所有项目标题区域一致 */
    height: 36px; /* 可容纳最多2行文本 */
    line-height: 18px;
    
    /* 使用 flex 布局居中对齐 */
    display: flex;
    align-items: center;
    justify-content: center;
    
    /* 允许文本换行，限制最多显示2行 */
    overflow: hidden;
    text-align: center;
    
    /* 多行文本截断 */
    display: -webkit-box;
    -webkit-line-clamp: 1;
    -webkit-box-orient: vertical;
    word-wrap: break-word;
    word-break: break-word;
}

.manga-title p {
    margin: 0;
    width: 100%;
    text-align: center;
    
    /* 继承父元素的文本截断属性 */
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 1;
    -webkit-box-orient: vertical;
    word-wrap: break-word;
    word-break: break-word;
}

/* 如果你希望标题区域更小，可以调整为单行显示 */
.manga-title.single-line {
    height: 18px;
    line-height: 18px;
    -webkit-line-clamp: 1;
}

.manga-title.single-line p {
    -webkit-line-clamp: 1;
    white-space: nowrap;
    text-overflow: ellipsis;
}

.manga-chapter {
    font-size: 12px;
    color: #666;
}

/* 页脚 */
.footer {
    background: #fff;
    border-top: 1px solid #e0e0e0;
    padding: 30px 0;
    margin-top: 40px;
}

.footer-content {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
    text-align: center;
}

.footer-links {
    margin-bottom: 20px;
}

.footer-links a {
    color: #007bff;
    text-decoration: none;
    margin: 0 10px;
    font-size: 14px;
}

.footer-links a:hover {
    text-decoration: underline;
}

.footer-info {
    color: #666;
    font-size: 12px;
    line-height: 1.6;
}

/* 响应式设计 */
@media (max-width: 768px) {
    .menu-toggle {
        display: block;
    }

    .nav-menu {
        display: none;
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        background: #fff;
        flex-direction: column;
        gap: 0;
        box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
        z-index: 1000;
    }

    .nav-menu.active {
        display: flex;
    }

    .nav-menu a {
        padding: 15px 20px;
        border-bottom: 1px solid #e0e0e0;
    }

    /* 隐藏桌面端搜索框 */
    .desktop-search {
        display: none;
    }

    /* 显示移动端搜索框 */
    .mobile-search-item {
        display: block;
    }

    .mobile-search {
        margin-left: 0;
        padding: 15px 20px;
        border-bottom: 1px solid #e0e0e0;
    }

    .mobile-search .search-box {
        width: 100%;
    }

    .mobile-search .search-box input {
        width: 100%;
        flex: 1;
    }

    /* 移动端 grid 改为 3 列 */
    .manga-grid {
        grid-template-columns: repeat(3, 1fr);
    }

    .main-content {
        padding: 15px;
    }

    .section {
        padding: 15px;
    }
    
    /* 移动端标题高度可以稍微调整 */
    .manga-title {
        height: 32px;
        font-size: 13px;
    }
}

@media (max-width: 1024px) and (min-width: 769px) {
    /* 平板及小屏幕 grid 改为 4 列 */
    .manga-grid {
        grid-template-columns: repeat(4, 1fr);
    }
}

/* 支持 aspect-ratio 的浏览器备选方案 */
@supports not (aspect-ratio: 3/4) {
    .manga-cover {
        height: 0;
        padding-bottom: 133.33%;
    }
}
/* 分页容器 */
.pagination-wrapper {
    text-align: center;
    margin: 30px 0;
  }
  
  /* 内部分页条 */
  .pagination {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    background: #fff;
    padding: 8px 12px;
    border: 1px solid #e0e0e0;
    border-radius: 6px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
  }
  
  /* 上一页/下一页 按钮 */
  .pagination-btn {
    display: inline-block;
    padding: 6px 14px;
    font-size: 14px;
    color: #007bff;
    text-decoration: none;
    border: 1px solid transparent;
    border-radius: 4px;
    transition: all 0.2s;
  }
  .pagination-btn:hover:not(.disable) {
    background: #007bff;
    color: #fff;
  }
  .pagination-btn.disable {
    color: #aaa;
    cursor: not-allowed;
    opacity: 0.6;
    pointer-events: none;
  }
  
  /* 当前页文字 */
  .page-number {
    font-size: 14px;
    color: #555;
  }
  
  /* 响应式：手机小屏时，分页按钮内边距稍微减小 */
  @media (max-width: 480px) {
    .pagination {
      gap: 8px;
      padding: 6px 8px;
    }
    .pagination-btn {
      padding: 4px 10px;
      font-size: 13px;
    }
    .page-number {
      font-size: 13px;
    }
  }