* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}
body {
  background: #f5f7fa;
  padding-top: 25px;
  font-family: "Microsoft YaHei", sans-serif;
}

/* ========== 首页专用 ========== */
.left-category {
  position: fixed;
  top: 65px;
  left: 0;
  width: 160px;
  height: calc(100vh - 65px);
  background: #fff;
  box-shadow: 1px 0 4px rgba(0,0,0,0.05);
  padding: 25px 0;
  z-index: 90;
  overflow-y: auto;
}
.left-category h5 {
  text-align: center;
  margin-bottom: 15px;
  font-size: 16px;
}
.left-category .item {
  display: block;
  padding: 9px 18px;
  margin: 2px 10px;
  border-radius: 6px;
  font-size: 14px;
  color: #333;
  text-decoration: none;
  transition: 0.2s;
}
.left-category .item:hover {
  background: #165BC2;
  color: #fff;
}

body.index-page .main-content {
  margin-left: 160px;
  padding: 0 25px 30px 25px;
}
body.index-page .cate-block {
  margin-bottom: 35px;
}
body.index-page .cate-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 15px;
}
body.index-page .cate-title {
  font-size: 17px;
  font-weight: 600;
  padding-left: 10px;
  border-left: 4px solid #165BC2;
}
body.index-page .more-btn {
  font-size: 13px;
  color: #165BC2;
  text-decoration: none;
  padding: 4px 10px;
  border: 1px solid #165BC2;
  border-radius: 4px;
  transition: 0.2s;
}
body.index-page .more-btn:hover {
  background: #165BC2;
  color: #fff;
}

body.index-page .site-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}
body.index-page .site-card {
  width: calc(12.5% - 10px);
  background: #fff;
  border-radius: 10px;
  padding: 12px;
  border: 1px solid #eee;
  text-decoration: none;
  color: #333;
  transition: 0.2s;
  box-shadow: 0 1px 3px rgba(0,0,0,0.02);
}
body.index-page .site-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 10px rgba(0,0,0,0.06);
}
body.index-page .site-card img {
  width: 24px;
  height: 24px;
  margin-right: 8px;
  vertical-align: middle;
  object-fit: contain;
}
body.index-page .site-title {
  font-size: 14px;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
body.index-page .site-desc {
  font-size: 12px;
  color: #888;
  margin-top: 6px;
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ========== 列表页专用 ========== */
body.list-page .list-main {
  max-width: 1200px;
  margin: 0 auto;
  padding: 20px;
}
body.list-page .list-title {
  font-size: 22px;
  font-weight: 600;
  padding-left: 12px;
  border-left: 4px solid #165BC2;
  margin: 20px 0 25px;
}
body.list-page .list-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 15px;
}
body.list-page .list-card {
  width: calc(25% - 15px);
  background: #fff;
  border-radius: 12px;
  padding: 16px;
  border: 1px solid #eee;
  text-decoration: none;
  color: #333;
  transition: 0.2s;
  box-shadow: 0 2px 4px rgba(0,0,0,0.03);
}
body.list-page .list-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 6px 15px rgba(0,0,0,0.08);
}
body.list-page .list-card img {
  width: 32px;
  height: 32px;
  margin-right: 10px;
  vertical-align: middle;
  object-fit: contain;
}
body.list-page .list-name {
  font-size: 15px;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
body.list-page .list-desc {
  font-size: 13px;
  color: #888;
  margin-top: 8px;
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  text-overflow: ellipsis;
}
/* ========== 导航栏通用样式 ========== */
/* 固定顶部导航栏 */
.top-nav {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 65px;
  background: #fff;
  box-shadow: 0 2px 8px rgba(0,0,0,0.06);
  z-index: 999;
  display: flex;
  align-items: center;
  justify-content: space-between;
  /* 关键修复：增加左右内边距，防止菜单贴边 */
  padding: 0 30px;
}
.top-nav .logo-img {
  height: 60px;
  margin-right: 10px;
}
.top-nav .logo-text {
  font-size: 21px;
  font-weight: 700;
  color: #165BC2;
  text-decoration: none;
}
/* 关键修复：菜单区域增加自动换行和滚动 */
.top-nav .menu {
  display: flex;
  flex-wrap: wrap;
  gap: 15px;
  /* 防止内容被截断 */
  max-width: 60%;
  justify-content: flex-end;
}
.top-nav .menu a {
  color: #333;
  text-decoration: none;
  font-size: 15px;
  white-space: nowrap;
}
.top-nav .menu a:hover {
  color: #165BC2;
}
/* ========== 列表页对联广告样式 ========== */
body.list-page .list-ad-container {
  position: relative;
}
body.list-page .left-ad,
body.list-page .right-ad {
  position: fixed;
  top: 50%;
  transform: translateY(-50%);
  width: 120px;
  height: 300px;
  background: #fff;
  border-radius: 8px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.08);
  z-index: 998;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}
body.list-page .left-ad {
  left: 20px;
}
body.list-page .right-ad {
  right: 20px;
}
/* 当广告位无内容时自动隐藏 */
body.list-page .left-ad:empty,
body.list-page .right-ad:empty {
  display: none;
}

/* 适配小屏幕：广告位自动隐藏 */
@media (max-width: 1400px) {
  body.list-page .left-ad,
  body.list-page .right-ad {
    display: none;
  }
}
/* 格子广告容器 */
.ad-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 10px;
    margin: 20px 0;
}
/* 单个广告格子 */
.ad-grid-item {
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}
.ad-grid-item img {
    width: 100%;
    height: 90px;
    object-fit: cover;
    display: block;
}
/* 广告位右下角标识 */
.ad-item {
    position: relative !important;
    display: inline-block !important;
    max-width: 100%;
}
.ad-item::after {
    content: "广告";
    position: absolute;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.6);
    color: #fff;
    font-size: 12px;
    padding: 2px 6px;
    border-top-left-radius: 4px;
    z-index: 999;
    pointer-events: none; /* 不影响广告点击 */
}
/* ========== 通用适配 ========== */
@media (max-width: 767px) {
  .left-category { display: none; }
  body.index-page .main-content { margin-left: 0; padding: 0 15px 20px 15px; }
  body.index-page .site-card { width: calc(50% - 5px); }

  body.list-page .list-card { width: calc(50% - 8px); }
  body.list-page .list-main { padding: 15px; }
}