/* ===== 导航栏 ===== */
.nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 24px;
  background: #3355ff;
  color: #fff;
  position: sticky;
  top: 0;
  z-index: 100;
}

.nav-home {
  font-size: 1.1em;
  font-weight: 700;
  color: #fff;
  text-decoration: none;
}

.nav-home:hover {
  text-decoration: none;
  color: #fff;
}

.nav-links {
  display: flex;
  gap: 20px;
}

.nav-links a {
  color: rgba(255,255,255,0.85);
  text-decoration: none;
  font-size: 0.95em;
}

.nav-links a:hover,
.nav-links a.active {
  color: #fff;
}

/* ===== 公选课情报站 · hugo-book 风格 ===== */

:root {
  --body-font: -apple-system, BlinkMacSystemFont, "Segoe UI", "Helvetica Neue", Arial, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  --mono-font: "SFMono-Regular", Menlo, Consolas, "Liberation Mono", monospace;
  --bg: #fff;
  --fg: #333;
  --fg-muted: #777;
  --border: #eee;
  --link: #00b8d4;
  --link-dark: #0097a7;
  --mark: #ff0;
  --hint-border: #00b8d4;
  --good: #2e7d32;
  --bad: #c62828;
  --warn: #e65100;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  font-family: var(--body-font);
  font-size: 16px;
  line-height: 1.65;
  color: var(--fg);
  background: var(--bg);
}

img { max-width: 100%; }

.hidden { display: none !important; }
.flex { display: flex; }
.align-center { align-items: center; }
.justify-center { justify-content: center; }
.justify-between { justify-content: space-between; }

a { color: var(--link); text-decoration: none; }
a:hover { text-decoration: underline; color: var(--link-dark); }

.container { max-width: 1400px; margin: 0 auto; }

/* ===== 左侧菜单 ===== */

.book-menu {
  flex: 0 0 300px;
  font-size: 15px;
}

.book-menu-content {
  position: fixed;
  top: 0;
  left: 0;
  width: 300px;
  height: 100vh;
  overflow-y: auto;
  padding: 16px 0 24px;
  border-right: 1px solid var(--border);
  background: #fff;
}

.back-to-home {
  margin: 0 16px 14px;
  font-size: 15px;
}
.back-to-home a { color: var(--fg); }
.back-to-home a:hover { color: var(--link-dark); text-decoration: none; }

.menu-home-title {
  display: block;
  font-size: 16px;
  font-weight: 700;
  text-align: center;
}

.book-search {
  margin: 0 16px 12px;
}

.book-search input {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid #ddd;
  border-radius: 4px;
  font-size: 15px;
  font-family: var(--body-font);
  outline: none;
}
.book-search input:focus { border-color: var(--link); }

.menu-contribute {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 4px 16px 10px;
  font-size: 14px;
}
.menu-contribute a { font-weight: 500; }
.menu-contribute span { color: var(--fg-muted); }

.same-province-title {
  margin: 4px 16px 8px;
  font-size: 15px;
  font-weight: 600;
}

/* ===== 可折叠树形菜单 ===== */

.same-province-menu details > summary {
  cursor: pointer;
  user-select: none;
  list-style: none;
  padding: 6px 16px;
  font-weight: 600;
  border-left: 3px solid transparent;
}
.same-province-menu details > summary::-webkit-details-marker { display: none; }
.same-province-menu details > summary::before {
  content: "▸";
  display: inline-block;
  margin-right: 4px;
  color: var(--fg-muted);
  font-size: 0.8em;
  transition: transform 0.15s;
}
.same-province-menu details[open] > summary::before { transform: rotate(90deg); }
.same-province-menu details > summary:hover { color: var(--link-dark); }

.same-province-menu details.campus-group { font-size: 15px; }
.same-province-menu details.attr-group { font-size: 14px; }
.same-province-menu details.attr-group > summary {
  padding-left: 26px;
  padding-top: 4px;
  padding-bottom: 4px;
  font-weight: 500;
  color: var(--fg-muted);
}

.same-province-menu ul {
  list-style: none;
  margin: 0;
  padding: 0;
}

.same-province-menu li a {
  display: block;
  padding: 5px 16px 5px 42px;
  color: var(--fg);
  border-left: 3px solid transparent;
  word-break: break-word;
}
.same-province-menu li a:hover { background: #fafafa; text-decoration: none; color: var(--link-dark); }
.same-province-menu li a.active {
  background: #f0f8fa;
  border-left-color: var(--link);
  color: var(--link-dark);
}

/* ===== 中间内容 ===== */

.book-page {
  flex: 1;
  min-width: 0;
  padding: 0 16px;
}

.book-header { margin: 16px 0 8px; }
.book-header label { cursor: pointer; color: var(--link); font-size: 15px; }
.book-icon-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 6px;
  border-radius: 4px;
  font-size: 14px;
  user-select: none;
}
.book-icon-btn:hover { background: #f0f8fa; }
.book-icon-btn svg { display: block; }
.book-header h3 { margin: 0; font-size: 16px; font-weight: 600; }
.book-header aside { border: 1px solid var(--border); border-radius: 4px; margin-top: 8px; padding: 8px; font-size: 14px; }
.book-header aside ul { list-style: none; margin: 0; padding: 0; }
.book-header aside li { padding: 3px 0; }

.markdown.book-article {
  max-width: 780px;
  margin: 0 auto;
  padding: 24px 8px 40px;
}
.book-article.wide {
  max-width: none;
  text-align: center;
}
.book-article.wide .timeline { text-align: left; }

.markdown h1 {
  font-size: 2em;
  margin: 0 0 16px;
  line-height: 1.25;
  border-bottom: 1px solid var(--border);
  padding-bottom: 0.5rem;
}

.page-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 90px 0;
  color: var(--fg-muted);
  font-size: 15px;
}
.spinner {
  width: 18px;
  height: 18px;
  border: 2px solid #cfedf2;
  border-top-color: var(--link);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.markdown h2 {
  font-size: 1.5em;
  margin: 1.5em 0 0.5em;
  line-height: 1.3;
  scroll-margin-top: 16px;
}

.markdown h2 .anchor {
  font-size: 0.75em;
  color: #ccc;
  margin-left: 6px;
  font-weight: 400;
  opacity: 0;
  transition: opacity 0.15s;
}
.markdown h2:hover .anchor { opacity: 1; }
.markdown h2 .anchor:hover { color: var(--link); text-decoration: none; }

.markdown blockquote { margin: 1em 0; }
.markdown blockquote.book-hint {
  border-left: 4px solid var(--hint-border);
  padding: 0.5em 1em;
  background: #f7fbfc;
  color: var(--fg);
  font-size: 0.95em;
  margin-left: 0;
  margin-right: 0;
}
.markdown blockquote.book-hint p { margin: 0.25em 0; }

.markdown details {
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 0.5em 1em;
  margin: 1em 0;
  font-size: 0.95em;
  background: #fcfcfc;
}
.markdown details summary { cursor: pointer; user-select: none; }
.markdown-inner { margin-top: 0.5em; }
.markdown-inner ul { margin: 0.25em 0; padding-left: 1.5em; }

/* ===== 首页 / 课程页 ===== */

.back-to-home { margin: 0 0 12px; font-size: 0.92em; }

.course-sticky.scrolled {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  padding: 8px 2px;
}
.course-sticky.scrolled .back-to-home { margin: 0; flex: 0 0 auto; white-space: nowrap; }
.course-sticky.scrolled h1 {
  flex: 1;
  min-width: 0;
  margin: 0;
  padding: 0;
  border: none;
  font-size: 1.2em;
  line-height: 1.3;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.hero-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  background: linear-gradient(135deg, #00b8d4 0%, #26c6da 55%, #4dd0e1 100%);
  border-radius: 10px;
  padding: 18px 22px;
  color: #fff;
  margin-bottom: 1em;
}
.hero-title { margin: 0; font-size: 1.15em; font-weight: 600; }
.hero-sub { margin: 2px 0 0; font-size: 0.88em; opacity: 0.92; }
.survey-btn {
  display: inline-block;
  background: #fff;
  color: var(--link-dark);
  font-weight: 600;
  font-size: 0.95em;
  padding: 8px 22px;
  border-radius: 20px;
  white-space: nowrap;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.18);
}
.survey-btn:hover { background: #eafcff; color: var(--link-dark); text-decoration: none; }
.table-banner {
  background: linear-gradient(135deg, #5c6bc0 0%, #7986cb 55%, #9575cd 100%);
}
.notice-banner {
  background: linear-gradient(135deg, #ef6c00 0%, #f57c00 55%, #fb8c00 100%);
}
.faq-banner {
  background: linear-gradient(135deg, #2e7d32 0%, #43a047 55%, #66bb6a 100%);
}
.pe-banner {
  background: linear-gradient(135deg, #c62828 0%, #e53935 55%, #ef5350 100%);
}
.jwc-banner {
  background: linear-gradient(135deg, #00695c 0%, #00897b 55%, #26a69a 100%);
}
.zhsz-banner {
  background: linear-gradient(135deg, #4527a0 0%, #5e35b1 55%, #7e57c2 100%);
}

.pe-table-wrap {
  overflow-x: auto;
  margin: 1em 0;
}
.pe-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.95em;
  text-align: center;
}
.pe-table th,
.pe-table td {
  border: 1px solid var(--border);
  padding: 8px 12px;
}
.pe-table th {
  background: var(--bg-secondary);
  font-weight: 600;
  white-space: nowrap;
}
.pe-table td:first-child {
  font-weight: 500;
  text-align: center;
  background: var(--bg-secondary);
  white-space: nowrap;
}
.pe-table tbody tr:hover {
  background: rgba(0, 184, 212, 0.04);
}

.timeline {
  position: relative;
  padding: 20px 0;
  margin: 2em 0;
}
.timeline::before {
  content: "";
  position: absolute;
  left: 50%;
  top: 0;
  bottom: 0;
  width: 3px;
  background: linear-gradient(to bottom, var(--link), #80deea, var(--link));
  transform: translateX(-50%);
  border-radius: 2px;
}
.tl-item {
  position: relative;
  width: 50%;
  padding: 0 10px 44px;
}
.tl-left {
  left: 0;
  padding-right: 20px;
  display: flex;
  justify-content: flex-end;
}
.tl-right {
  left: 50%;
  padding-left: 20px;
  display: flex;
  justify-content: flex-start;
}
.tl-dot {
  position: absolute;
  top: 14px;
  width: 16px;
  height: 16px;
  background: var(--link);
  border: 3px solid #fff;
  border-radius: 50%;
  box-shadow: 0 0 0 3px var(--link), 0 0 12px rgba(0, 184, 212, 0.3);
  z-index: 1;
  transition: transform 0.2s, box-shadow 0.2s;
}
.tl-left .tl-dot { right: -8px; }
.tl-right .tl-dot { left: -8px; }
.tl-item:hover .tl-dot {
  transform: scale(1.25);
  box-shadow: 0 0 0 3px var(--link), 0 0 20px rgba(0, 184, 212, 0.5);
}
.tl-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 16px 24px;
  transition: transform 0.2s, box-shadow 0.2s;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
  width: fit-content;
  max-width: 100%;
}
.tl-item:hover .tl-card {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.1);
}
.tl-date {
  font-size: 1em;
  color: var(--link);
  font-weight: 600;
  margin-bottom: 6px;
  word-break: keep-all;
}
.tl-title {
  font-size: 0.92em;
  font-weight: 400;
  color: var(--fg);
  word-break: keep-all;
}
.tl-links {
  margin-top: 10px;
  display: flex;
  gap: 10px;
  font-size: 0.85em;
  flex-wrap: wrap;
}
.tl-links a {
  color: #fff;
  background: var(--link);
  padding: 4px 12px;
  border-radius: 16px;
  text-decoration: none;
  font-weight: 500;
  transition: background 0.2s;
  white-space: nowrap;
}
.tl-links a:hover { background: var(--link-dark); text-decoration: none; }

@media (max-width: 768px) {
  .timeline::before { left: 16px; }
  .tl-item { width: 100%; left: 0; padding: 0 16px 36px 40px; }
  .tl-left, .tl-right { display: block; justify-content: unset; }
  .tl-left .tl-dot, .tl-right .tl-dot { left: 9px; right: auto; }
  .tl-card { width: 100%; box-sizing: border-box; }
}

.site-info {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 8px 28px;
  background: #f8fafc;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 16px;
  margin-bottom: 1.4em;
  font-size: 0.9em;
  color: var(--fg-muted);
}
.si-strong { color: var(--link-dark); font-weight: 700; }

.course-meta {
  font-size: 0.92em;
  color: var(--fg-muted);
  margin-bottom: 1em;
}

#qa-blocks h3 {
  font-size: 1.15em;
  margin: 1.6em 0 0.4em;
  scroll-margin-top: 68px;
  line-height: 1.4;
  padding-bottom: 0.25em;
  border-bottom: 1px solid #f0f0f0;
}
#qa-blocks h3 .anchor {
  font-size: 0.8em;
  color: #ccc;
  margin-right: 6px;
  font-weight: 400;
  opacity: 0;
  transition: opacity 0.15s;
}
#qa-blocks h3:hover .anchor { opacity: 1; }
#qa-blocks h3 .anchor:hover { color: var(--link); text-decoration: none; }

.qa-answer {
  margin: 0 0 1.2em;
  font-size: 0.98em;
  white-space: pre-wrap;
  word-break: break-word;
}
.qa-answer.none { color: var(--fg-muted); font-style: italic; }
.ans-tag {
  display: inline-block;
  margin-right: 8px;
  padding: 0 8px;
  border-radius: 10px;
  background: #f0f8fa;
  border: 1px solid #cfedf2;
  color: var(--link-dark);
  font-size: 0.8em;
  font-weight: 600;
  vertical-align: 1px;
}

/* ===== 首页课程卡片 ===== */

.campus-group { margin-top: 1.6em; }
.campus-group.collapsed .course-cards { display: none; }
.campus-title { display: flex; align-items: baseline; gap: 8px; }
.campus-toggle {
  margin-left: auto;
  border: 1px solid var(--border);
  background: #fff;
  color: var(--fg-muted);
  font-size: 0.72em;
  padding: 1px 10px;
  border-radius: 10px;
  cursor: pointer;
  font-family: var(--body-font);
}
.campus-toggle:hover { border-color: var(--link); color: var(--link-dark); }
.campus-count {
  font-size: 0.62em;
  font-weight: 500;
  color: var(--link-dark);
  background: #f0f8fa;
  border: 1px solid #cfedf2;
  border-radius: 10px;
  padding: 0 8px;
}

.course-cards {
  list-style: none;
  margin: 0.5em 0 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 10px;
}
.course-card a {
  display: flex;
  flex-direction: column;
  gap: 3px;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px 14px;
  color: var(--fg);
  transition: border-color 0.15s, box-shadow 0.15s, transform 0.15s;
}
.course-card a:hover {
  border-color: var(--link);
  box-shadow: 0 4px 12px rgba(0, 184, 212, 0.18);
  transform: translateY(-1px);
  text-decoration: none;
}
.cc-name { font-weight: 600; }
.cc-meta { font-size: 0.85em; color: var(--fg-muted); }
.cc-cat {
  align-self: flex-start;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 0.75em;
  color: var(--fg-muted);
  background: #f5f7fa;
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 1px 8px;
  margin-top: 2px;
}

.empty-tip { text-align: center; color: var(--fg-muted); padding: 2em 0; }

/* ===== 关于我们 ===== */

.about-section { margin-top: 2.5em; padding-top: 1.25em; border-top: 1px solid var(--border); }
.about-section h2 { font-size: 1.25em; margin: 0 0 0.5em; }
.about-section a[href="https://qm.qq.com/q/nQizUmmDlu"]:hover { text-decoration: none; }

/* ===== 右侧目录 ===== */

.book-toc {
  flex: 0 0 240px;
  font-size: 14px;
}

.book-toc-content {
  position: fixed;
  top: 0;
  right: 0;
  width: 240px;
  height: 100vh;
  overflow-y: auto;
  padding: 16px 8px 24px 16px;
  border-left: 1px solid var(--border);
  background: #fff;
}

.book-toc nav ul { list-style: none; margin: 0; padding: 0; }
.book-toc nav li { margin: 2px 0; }
.book-toc nav li a {
  display: block;
  padding: 3px 8px;
  color: var(--fg-muted);
  border-left: 2px solid transparent;
  word-break: break-word;
}
.book-toc nav li a:hover { color: var(--link-dark); text-decoration: none; background: #fafafa; }
.book-toc nav li a.active { color: var(--link-dark); border-left-color: var(--link); }

.book-toc.toc-empty { display: none; }

/* ===== 页脚 ===== */

.book-footer { padding: 8px 16px 24px; }
.book-footer .book-copyright {
  font-size: 14px;
  color: var(--fg-muted);
}
.book-footer a { color: var(--link); }
.book-footer a:hover { color: var(--link-dark); text-decoration: none; }

/* ===== 移动端 ===== */

@media (max-width: 960px) {

  body { font-size: 15px; }

  .book-menu,
  .book-toc {
    display: block;
    position: fixed;
    top: 0;
    bottom: 0;
    z-index: 60;
    background: #fff;
    box-shadow: 0 0 20px rgba(0, 0, 0, 0.15);
    transition: transform 0.2s ease;
    flex: none;
  }
  .book-menu { left: 0; width: 300px; transform: translateX(-100%); border-right: none; }
  .book-toc {
    display: block;
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    width: 300px;
    transform: translateX(100%);
    border-left: 1px solid var(--border);
    box-shadow: 0 0 20px rgba(0, 0, 0, 0.15);
    z-index: 60;
    background: #fff;
    transition: transform 0.2s ease;
    flex: none;
  }
.book-toc.toc-empty { display: none; }
.toc-drawer-title { display: none; }

  .book-menu-content, .book-toc-content {
    height: 100%;
    border: none;
  }

  #menu-control:checked ~ .container .book-menu { transform: translateX(0); }
  #toc-control:checked ~ .container .book-toc { transform: translateX(0); }

  .toc-drawer-title { display: block; font-size: 15px; font-weight: 600; padding: 0 8px 10px; color: var(--fg); }

  .book-menu-overlay, .book-toc-overlay {
    display: block;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.35);
    z-index: 50;
    visibility: hidden;
    opacity: 0;
    transition: opacity 0.2s;
  }
  #menu-control:checked ~ .book-menu-overlay { visibility: visible; opacity: 1; }
  #toc-control:checked ~ .book-toc-overlay { visibility: visible; opacity: 1; }

  .book-header.hidden { display: flex !important; }
  .book-page { padding: 0 12px; }
  .markdown.book-article { padding: 12px 4px 32px; }
  .markdown h1 { font-size: 1.6em; }
  .markdown h2 { font-size: 1.3em; }
}
