:root {
  --blue: #217aff;
  --blue-light: #eaf2ff;
  --grey: #f5f7fa;
  --radius: 8px;
  --anim: .25s;
}

body {
  margin: 0;
  padding: 0 1rem 3rem; /* 移除顶部的 5rem 内边距 */
  background: var(--grey);
  font-family: "JetBrainsMono Nerd Font", "Noto Sans SC", sans-serif;
  color: #222;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

.site-title {
  text-align: center;
  color: var(--blue);
  margin: 5rem 0 1.5rem; /* 增加 margin-top 为固定的头部留出空间 */
  font-size: 1.8rem;
}

#toc {
  max-width: 760px;
  margin: auto;
}

#toc details {
  background: #fff;
  border-radius: var(--radius);
  margin: 0.75rem 0;
  padding: 0.4rem 0.9rem;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.06);
  transition: background var(--anim);
}

#toc summary {
  cursor: pointer;
  font-weight: 600;
  color: var(--blue);
  user-select: none;
  list-style: none;
  position: relative;
  padding-left: 1.2rem;
  padding-top: 0.5rem;
  padding-bottom: 0.5rem;
}

#toc summary::-webkit-details-marker {
  display: none;
}

#toc summary::before {
  content: "▸";
  position: absolute;
  left: 0;
  transition: transform var(--anim);
}
#toc details[open] > summary::before {
  transform: rotate(90deg);
}

.unit-list {
  list-style: none;
  margin: 0.1rem 0 0.4rem 1.3rem;
  padding-left: 0;
}
.unit-list li {
  margin: 0.3rem 0;
}

.unit-list a {
  text-decoration: none;
  color: #333;
  padding: 0.2rem 0.4rem;
  border-radius: var(--radius);
  transition: background var(--anim), color var(--anim);
  display: inline-block;
}
.unit-list a:hover {
  background: var(--blue-light);
  color: var(--blue);
}

.back-link {
  position: absolute;
  left: 1rem;
  top: 50%; /* 垂直居中 */
  transform: translateY(-50%); /* 精确垂直居中 */
  display: inline-block;
  margin: 0;    /* 绝对定位不需要外边距 */
  padding: 0.5rem 1rem;
  background: #fff;
  color: var(--blue);
  font-weight: 500;
  text-decoration: none;
  border-radius: var(--radius);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.07);
  transition: all var(--anim);
}
.back-link:hover {
  background: var(--blue-light);
  box-shadow: 0 3px 6px rgba(0, 0, 0, 0.1);
  /* transform: translateY(-2px); */ /* 移除或调整，因为父元素已有transform */
}
.back-link:active {
  transform: translateY(-50%); /* 保持垂直居中 */
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

h2 {
  font-size: 1.6rem;
  font-weight: 600;
  color: #333;
  border-bottom: 2px solid var(--blue-light);
  padding-bottom: 0.5rem;
  margin-bottom: 1.2rem;
}

.page-header {
  position: fixed; /* 改为 fixed 定位，使其始终在屏幕顶部 */
  top: 0;
  left: 0; /* 确保从左边开始 */
  right: 0; /* 确保撑满整个宽度 */
  z-index: 10;
  background: var(--grey);
  padding: 0 1rem; /* 调整内边距以对齐内容 */
  max-width: 100%;
  margin: 0;
  box-shadow: 0 2px 5px rgba(0,0,0,0.05);
  height: 3rem; /* 固定高度 */
}