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

body {
  font-family: Arial, Helvetica, sans-serif;
  background: #f4f4f4;
  color: #333;
  line-height: 1.7;
  padding-top: 80px; /* 给固定页头留空间 */
}

img {
  max-width: 100%;
  height: auto;
  display: block;
  border-radius: 0;
}

h1, h2, h3, h4 {
  margin-bottom: 10px;
  color: #333;
}

p, li {
  color: #666;
  margin: 6px 0;
}

a {
  color: #0077cc;
  text-decoration: none;
  transition: 0.2s;
}

a:hover {
  text-decoration: underline;
}

/* ======================= */
/* ===== 页头（固定浮动） ===== */
/* ======================= */
.header {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 70px;
  background: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  border-bottom: 1px solid #e6e6e6;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
  z-index: 9999;
}

.header h1 {
  font-size: 24px;
  font-weight: 600;
}

/* ======================= */
/* ===== 页面布局 ===== */
/* ======================= */
.container {
  display: flex;
  width: 92%;
  max-width: 1200px;
  margin: 25px auto;
  gap: 20px;
  align-items: flex-start;
  flex-wrap: wrap;
}

/* ======================= */
/* ===== 侧边栏 ===== */
/* ======================= */
.sidebar {
  flex: 0 0 220px;
  background: #fff;
  padding: 20px;
  border-radius: 8px;
  position: sticky;
  top: 90px;
  box-shadow: 0 0 6px rgba(0, 0, 0, 0.05);
  height: fit-content;
  z-index: 10;
}

.sidebar h3 {
  margin-bottom: 10px;
}

.sidebar ul {
  list-style: none;
  padding: 0;
  margin: 0;
}

.sidebar li {
  margin: 6px 0;
}

.sidebar a {
  display: block;
  padding: 8px 10px;
  border-radius: 6px;
  font-weight: 500;
  color: #333;
}

.sidebar a:hover,
.sidebar a.active {
  background: #f3f3f3;
  color: #0077cc;
  font-weight: bold;
}

/* ======================= */
/* ===== 侧边栏广告 ===== */
/* ======================= */
.sidebar .ad-box {
  margin-top: 20px;        /* 紧跟导航 */
  padding: 12px;
  background-color: #fdfdfd;
  border: 1px solid #ddd;
  border-radius: 8px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.05);
}

.sidebar .ad-box .ad-line {
  margin-bottom: 8px;
  font-size: 14px;
  color: #555;
}

.sidebar .ad-box .ad-line:last-child {
  margin-bottom: 0;
}

.sidebar .ad-box .ad-email {
  color: #0077cc;
  text-decoration: none;
  font-weight: 500;
}

.sidebar .ad-box .ad-email:hover {
  text-decoration: underline;
}

/* ======================= */
/* ===== 内容区 ===== */
/* ======================= */
.content {
  flex: 1;
  background: #fff;
  padding: 28px;
  border-radius: 8px;
  box-shadow: 0 0 6px rgba(0, 0, 0, 0.05);
}

/* ======================= */
/* ===== 个人简介 ===== */
/* ======================= */
#intro .intro-container {
  display: flex;
  flex-wrap: wrap;
  gap: 20px;
  margin-bottom: 20px;
}

#intro .intro-text {
  flex: 1 1 320px;
}

#intro .intro-text p {
  margin: 6px 0;
}

#intro .intro-image,
.intro-profile {
  flex: 0 0 auto;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  margin-top: 10px;
  gap: 10px;
}

#intro .intro-image img,
.intro-profile img {
  width: 60%;
  max-width: 260px;
  height: auto;
  border-radius: 15px;
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.2);
  cursor: pointer;
  transition: transform 0.3s, box-shadow 0.3s;
}

#intro .intro-image img:hover,
.intro-profile img:hover {
  transform: scale(1.05);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.3);
}

.intro-name {
  font-size: 22px;
  font-weight: 600;
  color: #333;
  margin: 0;
  text-align: center;
}

.intro-desc {
  font-size: 16px;
  color: #666;
  margin: 4px 0 0 0;
  text-align: center;
}

/* ======================= */
/* ===== 内容图片 ===== */
/* ======================= */
.center-img {
  display: block;
  margin: 20px auto;
  max-width: 40%;
  cursor: pointer;
  border-radius: 15px;
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.2);
  transition: transform 0.3s;
}

.center-img:hover {
  transform: scale(1.05);
}

/* ======================= */
/* ===== 返回顶部按钮 ===== */
/* ======================= */
#topBtn {
  position: fixed;
  bottom: 40px;
  right: 40px;
  z-index: 9999;
  font-size: 24px;
  background: #333;
  color: #fff;
  border: none;
  border-radius: 50%;
  width: 50px;
  height: 50px;
  line-height: 50px;
  text-align: center;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(0,0,0,0.3);
  transition: transform 0.3s, opacity 0.3s;
  opacity: 0.8;
}

#topBtn:hover {
  transform: scale(1.1);
  opacity: 1;
}

/* ======================= */
/* ===== 页尾 ===== */
/* ======================= */
.footer {
  background: #fff;
  text-align: center;
  padding: 25px 10px;
  margin-top: 40px;
  font-size: 14px;
  color: #666;
  border-top: 1px solid #eee;
  width: 100%;
  overflow: hidden;
  word-wrap: break-word;
}

.footer p {
  margin: 6px 0;
  word-break: break-word;
}

.footer a {
  color: #0077cc;
  text-decoration: none;
}

.footer a:hover {
  text-decoration: underline;
}

/* ======================= */
/* ===== 手机端优化 ===== */
/* ======================= */
@media screen and (max-width: 768px) {
  body {
    padding-top: 70px;
  }

  .container {
    display: block;
    width: 95%;
    margin: 10px auto;
  }

  .header {
    height: 60px;
  }

  .header h1 {
    font-size: 18px;
  }

  .sidebar {
    width: 100%;
    position: relative;
    top: 0;
    margin-bottom: 15px;
  }

  .sidebar ul {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
  }

  .sidebar li {
    background: #f5f5f5;
    border-radius: 6px;
    text-align: center;
  }

  .sidebar a {
    padding: 10px 6px;
  }

  .sidebar .ad-box {
    margin-top: 12px;
    padding: 10px;
  }

  .sidebar .ad-box .ad-line {
    font-size: 13px;
  }

  .content {
    padding: 18px;
  }

  #intro .intro-container {
    flex-direction: column;
    align-items: center;
  }

  #intro .intro-image {
    width: 70%;
  }

  .center-img {
    max-width: 80%;
  }

  #topBtn {
    bottom: 20px;
    right: 20px;
    width: 45px;
    height: 45px;
    line-height: 45px;
    font-size: 20px;
  }

  .footer {
    padding: 18px 10px;
    font-size: 13px;
  }
}

/* ======================= */
/* ===== 滚动与选择效果 ===== */
/* ======================= */
section {
  scroll-margin-top: 90px;
}

::selection {
  background: #0077cc;
  color: #fff;
}

html {
  scroll-behavior: smooth;
}

.sidebar ul li a.active {
  font-weight: bold;
  color: #0077cc;
}