:root {
  color-scheme: light;
  --bg: #ffffff;
  --panel: #ffffff;
  --panel-2: #f0f2f4;
  --panel-3: #e1e3e5;
  --line: #d1d3d5;
  --line-bright: #b3b5b7;
  --text: #0b1c2c;
  --muted: #5f6870;
  --muted-2: #81878b;
  --cyan: #2d716e;
  --math: #315f83;
  --physics: #9b6934;
  --both: #6e5f84;
  --mentor: #48847f;
  --collaborator: #a2733f;
  --influence: #7a648e;
  --paper: #ffffff;
  --paper-text: #0b1c2c;
  --serif: "Source Han Sans SC", "Noto Sans SC", "Noto Sans CJK SC", "PingFang SC", "Microsoft YaHei", sans-serif;
  --sans: "Source Han Sans SC", "Noto Sans SC", "Noto Sans CJK SC", "PingFang SC", "Microsoft YaHei", sans-serif;
}

html, body { height: 100%; }

body {
  overflow: hidden;
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 14px;
}

button:focus-visible,
input:focus-visible,
a:focus-visible {
  outline: 2px solid #2d716e;
  outline-offset: 3px;
}

.app {
  height: 100dvh;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  background: var(--bg);
}

.main-shell {
  grid-template-rows: 76px 66px minmax(0, 1fr) 88px;
  background: var(--bg);
}

.app[data-view="genealogy"] .main-shell {
  grid-template-rows: 76px minmax(0, 1fr);
}

.topbar {
  z-index: 30;
  justify-content: space-between;
  gap: 32px;
  padding: 0 clamp(28px, 4vw, 66px);
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, .98);
}

.brand { gap: 16px; }

.brand-mark {
  width: 46px;
  height: 46px;
  display: block;
  flex: 0 0 auto;
  border: 0;
  border-radius: 50%;
  background: #fff;
  object-fit: contain;
}

.brand-copy {
  display: flex;
  align-items: center;
  line-height: 1.2;
}

.brand-copy strong {
  padding-right: 20px;
  border-right: 1px solid var(--line);
  color: #0b1826;
  font-family: var(--serif);
  font-size: 24px;
  font-weight: 700;
  letter-spacing: .04em;
}

.brand-copy small {
  margin: 0 0 0 20px;
  color: #787b7d;
  font-size: 12px;
  letter-spacing: .02em;
}

.top-nav {
  display: flex;
  align-items: center;
  gap: 12px;
}

.top-nav-button,
.top-nav-link {
  min-width: 72px;
  min-height: 46px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 18px;
  border: 1px solid transparent;
  border-radius: 3px;
  background: transparent;
  color: #172331;
  cursor: pointer;
  font-family: var(--serif);
  font-size: 17px;
  font-weight: 650;
  text-decoration: none;
  transition: color .16s ease, border-color .16s ease, background-color .16s ease;
}

.top-nav-button:hover,
.top-nav-link:hover {
  border-color: var(--line);
  background: #f3f5f7;
}

.top-nav-button.active {
  border-color: #172839;
  background: #172839;
  color: #fff;
}

.controlbar {
  z-index: 22;
  gap: 18px;
  padding: 10px clamp(22px, 3vw, 50px);
  border-bottom: 1px solid var(--line);
  background: #f0f2f4;
}

.person-view-switcher {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: #ffffff;
}

.person-view-switcher button {
  min-width: 66px;
  min-height: 36px;
  padding: 0 14px;
  border: 0;
  border-radius: 2px;
  background: transparent;
  color: #59626a;
  cursor: pointer;
  font-weight: 650;
}

.person-view-switcher button:hover { background: #e9ebed; color: var(--text); }
.person-view-switcher button.active { background: #17324a; color: #fff; }

.search-wrap { width: auto; }
.people-search { min-width: 220px; max-width: 520px; flex: 1; }

.search-wrap input {
  height: 44px;
  padding: 0 16px;
  border: 1px solid #c2c4c6;
  border-radius: 4px;
  background: rgba(255, 255, 255, .75);
  color: var(--text);
  font-size: 13px;
}

.search-wrap input::placeholder { color: #82878a; }
.search-wrap input:focus { border-color: #2d716e; box-shadow: 0 0 0 3px rgba(45, 113, 110, .1); }

.range-summary {
  gap: 8px;
  padding-left: 18px;
  border-left: 1px solid var(--line);
}

.range-summary strong {
  color: var(--text);
  font-family: var(--serif);
  font-size: 15px;
}

.control-label { color: #777c80; }
.filter-menu { margin-left: 0; }

.filter-toggle {
  min-height: 42px;
  padding: 0 14px;
  border-color: #bdbfc1;
  border-radius: 3px;
  background: #ffffff;
  color: var(--text);
}

.filter-toggle:hover,
.filter-toggle[aria-expanded="true"] { border-color: #49685f; background: #fff; }
.filter-toggle span { background: #dce9e6; color: #2d5f5b; }

.filter-popover {
  top: 49px;
  width: 326px;
  border-color: var(--line);
  border-radius: 5px;
  background: #ffffff;
  box-shadow: 0 18px 40px rgba(27, 38, 42, .16);
  color: var(--text);
}

.filter-section + .filter-section { border-top-color: var(--line); }
.filter-pill { color: var(--muted); }
.filter-pill:hover { background: #f0f2f4; color: var(--text); }
.filter-pill.active { border-color: #8ea29c; background: #e1ebe8; color: #1d4543; }
.text-button, .icon-button { border-color: #c1c3c5; background: #f5f7f9; color: var(--muted); }

.workspace {
  grid-template-columns: minmax(0, 1fr) minmax(300px, 360px);
  background: #e4e6e8;
}

.app[data-view="genealogy"] .workspace { grid-template-columns: minmax(0, 1fr); }

.genealogy-panel {
  grid-column: 1 / -1;
  padding: 0;
  overflow: auto;
  background: #ffffff;
  color: var(--text);
  scrollbar-color: #b1b3b5 transparent;
}

.course-catalog,
.course-detail,
.person-home {
  max-width: none;
  margin: 0;
}

.genealogy-hero {
  max-width: none;
  min-height: 340px;
  display: grid;
  grid-template-columns: minmax(0, .62fr) minmax(360px, .38fr);
  align-items: center;
  gap: clamp(30px, 5vw, 76px);
  margin: 0;
  padding: 42px clamp(30px, 4vw, 66px) 36px;
  border-bottom: 1px solid var(--line);
  background: #ffffff;
}

.hero-copy { min-width: 0; }

.eyebrow {
  color: #60706c;
  font-size: 11px;
  font-weight: 650;
  letter-spacing: .26em;
}

.genealogy-hero h1 {
  max-width: 790px;
  margin: 13px 0 12px;
  color: #0a1b2d;
  font-family: var(--serif);
  font-size: clamp(36px, 2.9vw, 46px);
  font-weight: 700;
  letter-spacing: .015em;
  line-height: 1.2;
}

.hero-copy > p:not(.eyebrow) {
  max-width: 700px;
  margin: 0;
  color: #62696f;
  font-size: 15px;
  line-height: 1.8;
}

.hero-search { display: block; max-width: 760px; margin-top: 22px; }
.hero-search input { height: 52px; padding: 0 18px; background: #fff; font-size: 14px; }

.hero-visual {
  min-width: 0;
  height: 270px;
  margin: 0;
  overflow: hidden;
  border-left: 1px solid var(--line);
  background: #f1f3f5;
}

.hero-visual img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
  object-position: 64% center;
}

.catalog-toolbar,
.course-filters,
.course-cards,
.site-footer {
  margin-left: clamp(30px, 4vw, 66px);
  margin-right: clamp(30px, 4vw, 66px);
}

.catalog-toolbar {
  margin-top: 24px;
  margin-bottom: 12px;
}

.catalog-toolbar strong {
  color: #0c1d2d;
  font-family: var(--serif);
  font-size: 27px;
  font-weight: 700;
}

.catalog-toolbar > div:first-child span { color: #7e8386; font-size: 11px; }

.all-courses-link {
  min-height: 38px;
  padding: 0 14px;
  border: 0;
  background: transparent;
  color: #2c4c62;
  cursor: pointer;
  font-size: 13px;
  font-weight: 650;
}

.all-courses-link:hover { text-decoration: underline; }

.course-filters {
  display: grid;
  gap: 8px;
  margin-bottom: 18px;
  padding: 13px 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.filter-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.filter-row > span {
  width: 48px;
  color: #85898b;
  font-size: 11px;
  font-weight: 650;
}

.filter-row button {
  min-height: 32px;
  padding: 0 15px;
  border: 1px solid transparent;
  border-radius: 3px;
  background: transparent;
  color: #525d65;
  cursor: pointer;
  font-size: 13px;
}

.filter-row button:hover { border-color: #c5c7c9; background: #f4f6f8; }
.filter-row button.active { border-color: #294b62; background: #294b62; color: #fff; }
.secondary-course-filters { padding-left: 0; }

.course-cards {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  padding-bottom: 34px;
}

.course-card {
  position: relative;
  min-height: 232px;
  overflow: hidden;
  padding: 20px;
  border: 1px solid #cbcdcf;
  border-radius: 4px;
  background: #fff;
  color: var(--text);
  box-shadow: none;
  isolation: isolate;
}

.course-card:hover {
  border-color: #6f7f86;
  background: #fff;
  box-shadow: 0 12px 28px rgba(35, 48, 50, .09);
  transform: translateY(-2px);
}

.course-card-body {
  position: relative;
  z-index: 2;
  width: 64%;
  min-height: 190px;
  display: flex;
  flex-direction: column;
}

.course-card-meta { display: flex; align-items: center; gap: 7px; }

.course-card-meta em,
.course-card-meta small {
  padding: 4px 7px;
  border-radius: 2px;
  font-size: 10px;
  font-style: normal;
  line-height: 1.2;
}

.course-card-meta em { background: #e5edf1; color: #244c64; }
.course-card-meta small { background: #f1f3f5; color: #6d7274; }

.course-card-title {
  margin-top: 18px;
  font-family: var(--serif);
  font-size: 24px;
  font-weight: 700;
  line-height: 1.2;
}

.course-card-description {
  margin-top: 8px;
  color: #596169;
  font-size: 12px;
  line-height: 1.62;
}

.course-card-count {
  margin-top: auto;
  padding-top: 14px;
  border-top: 1px solid #d9dbdd;
  color: #1c3950;
  font-size: 11px;
  font-weight: 700;
}

.course-card-art {
  position: absolute;
  z-index: 1;
  top: 0;
  right: 0;
  bottom: 0;
  width: 38%;
  overflow: hidden;
  border-left: 1px solid #dcdee0;
  background: #e6e8ea;
}

.course-card-art img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
  filter: grayscale(.75) sepia(.12) contrast(.78) brightness(1.18);
  opacity: .58;
}

.catalog-result-heading { border-top-color: var(--line); color: var(--text); }
.catalog-result-heading strong { font-family: var(--serif); font-size: 21px; }

.person-result-card {
  border-color: #caccce;
  border-radius: 4px;
  background: #fff;
  color: var(--text);
}
.person-result-card:hover { border-color: #71828a; background: #fff; }
.result-monogram { border-color: #83979c; color: #2d716e; }
.person-result-card small { color: #7b8185; }
.person-result-card em { color: #6f5d7e; }

.site-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 28px;
  padding: 25px 0 30px;
  border-top: 1px solid var(--line);
}

.footer-brand > span { display: flex; align-items: center; gap: 10px; }
.footer-brand img { width: 32px; height: 32px; border-radius: 50%; object-fit: contain; }
.footer-brand strong { font-family: var(--serif); font-size: 20px; }
.footer-brand p { margin: 8px 0 0; color: #6d7276; font-size: 11px; }
.footer-brand small { display: block; margin-top: 5px; color: #929597; font-size: 10px; }
.site-footer nav { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 24px; }
.site-footer a { color: #5e656a; font-size: 11px; text-decoration: none; }
.site-footer a:hover { color: #17374c; text-decoration: underline; }

.course-detail,
.person-home {
  max-width: 1240px;
  margin: 0 auto;
  padding: 40px clamp(24px, 4vw, 58px) 60px;
}

.route-head h2,
.person-identity h1,
.profile-section > header h2,
.course-mini-view > header strong,
.history-path h3 { font-family: var(--serif); color: var(--text); }

.route-head > p:not(.eyebrow),
.route-title-row p { color: var(--muted); }
.route-count strong { color: #2d716e; }

.route-outcome {
  border-left-color: #2d716e;
  background: #edf2ee;
}
.route-outcome span { color: #47716d; }

.back-button,
.profile-map-button,
.open-person-home {
  min-height: 38px;
  padding: 0 14px;
  border: 1px solid #b9bbb6;
  border-radius: 3px;
  background: #ffffff;
  color: #2e4656;
}
.back-button:hover,
.profile-map-button:hover,
.open-person-home:hover { border-color: #365b63; background: #fff; color: #17364a; }
.profile-map-button,
.open-person-home { border-color: #294b62; background: #294b62; color: #fff; cursor: pointer; }

.course-mini-view {
  border-color: #c5c7c9;
  border-radius: 4px;
  background: #fff;
}
.course-mini-view > header { border-bottom-color: var(--line); }
.course-mini-view > header small { color: #747a7e; }
.mini-view-people button { color: var(--text); }
.mini-view-people button:hover { border-color: #c1c3c5; background: #f3f5f7; }
.mini-view-people span { color: #737a80; }

.route-steps::before { background: #a3b2af; }
.step-marker button { border-color: #91a8a5; background: #f4f6f2; color: #2d716e; }
.route-step.active .step-marker button { border-color: #294b62; background: #294b62; color: #fff; }
.route-step.active .step-content { border-color: #66817d; background: #f7f8f5; }

.step-content {
  border-color: #caccce;
  border-radius: 4px;
  background: #fff;
  box-shadow: none;
}
.step-content:hover { border-color: #8b9997; background: #fff; }
.step-content > header > strong { color: #6f5d7e; }
.step-era, .step-method span, .step-meta-label { color: #727b7c; }
.step-content h3 { color: var(--text); }
.step-method { background: #f3f5f7; }
.step-method p { color: #36434b; }
.step-lesson-content {
  margin: 16px 0 2px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
  color: #2e414b;
  font-size: 12px;
  line-height: 1.8;
}
.step-lesson-content p,
.step-lesson-content h4 { margin: 8px 0; }
.step-lesson-content h4 { font-family: var(--serif); font-size: 16px; }
.step-lesson-content ul { margin: 8px 0; padding-left: 20px; }
.step-lesson-content .katex-display { overflow-x: auto; overflow-y: hidden; }
.knowledge-list span { border-color: #ced0d2; background: #ffffff; color: #505b62; }
.route-person { border-color: #c4c6c8; background: #ffffff; color: #253947; }
.route-person:hover { border-color: #7f9295; background: #fff; }
.step-source { color: #2d716e; }
.step-source:hover { color: #173f40; }
.genealogy-empty { border-color: #c0c2c4; background: #ffffff; }
.genealogy-empty p { color: var(--muted); }

.person-identity {
  border-color: #c2c4c6;
  border-radius: 4px;
  background: #fff;
}
.person-identity h1 { color: var(--text); }
.person-identity .person-latin { color: #737b80; }
.person-identity > div > p:last-child { color: #4f5b63; }
.person-large-monogram { background: #ffffff; }

.profile-section {
  border-color: #caccce;
  border-radius: 4px;
  background: #fff;
}
.profile-section > header { border-bottom-color: #d9dbdd; }
.profile-section > header span { color: #7f8788; }
.profile-section dd, .profile-section ol { color: #273944; }
.profile-school strong { color: #5e526d; }
.profile-school p, .profile-contribution p, .profile-links p { color: #59636a; }
.profile-subjects span { border-color: #c8d1d0; background: #edf2f0; color: #385654; }
.profile-contribution > strong { color: #2d716e; }
.profile-links button { border-color: #caccce; background: #ffffff; color: var(--text); }
.profile-links button:hover { border-color: #819493; }

.map-panel,
.network-panel,
.river-panel { grid-column: 1; }
.map-panel { border-right: 1px solid var(--line); }
.map-heading { color: #f4f7f7; }
.zoom-btn { color: #f4f7f7; }
.network-panel { border-right: 1px solid var(--line); }
.river-panel { border-right: 1px solid var(--line); }
.internal-network-switch,
.graph-engine-note { display: none !important; }

.panel-head {
  border-bottom-color: #27313a;
  background: #111923;
}
.panel-head h2 { color: #ffffff; font-family: var(--serif); }
.panel-head p:not(.eyebrow) { color: #aeb9c1; }
.panel-head .eyebrow { color: #8ca5a1; }
.network-legend { border-top-color: #29323b; }

.details {
  grid-column: 2;
  overflow: auto;
  padding: 28px 24px 36px;
  border-left: 0;
  background: #ffffff;
  color: var(--text);
  scrollbar-color: #b5b7b9 transparent;
}
.profile-heading h2 { color: var(--text); font-family: var(--serif); font-size: 28px; }
.profile-heading .latin { color: #6f777c; }
.lifespan { color: #263b49; }
.tag { border-color: #c4cecc; background: #edf2f0; color: #33514f; }
.place-block, .detail-subhead { border-color: #d1d3d5; }
.place-row span, .detail-subhead span { color: #7c8387; }
.profile-summary { color: #3f4d55; }
.focus-label { color: #778083; }
.relation-item { color: var(--text); }
.relation-item:hover { border-color: #caccce; background: #f2f4f6; }
.relation-item small, .relation-item .arrow, .no-relations { color: #747d82; }
.dataset-note { border-color: #d1d3d5; color: #787f82; }
.dataset-note a { color: #2d716e; }
.open-person-home { width: 100%; margin-top: 18px; }

.time-overview {
  grid-template-columns: 46px 190px minmax(250px, 1fr) auto auto;
  gap: 14px;
  padding: 10px clamp(18px, 3vw, 44px);
  border-top-color: var(--line);
  background: #f0f2f4;
  color: var(--text);
}
.play-button { border-color: #496e6a; background: #fff; color: #244c49; }
.play-button:hover { border-color: #294b62; background: #294b62; color: #fff; }
.overview-copy strong { font-family: var(--serif); }
.overview-copy span, .overview-years, .top-stats { color: #757e81; }
.all-years { border-color: #b7b9bb; background: #ffffff; color: #576168; }
.all-years.active { border-color: #6d817c; background: #dfe9e6; color: #285b58; }
.top-stats strong { color: var(--text); }

@media (max-width: 1240px) {
  .brand-copy small { display: none; }
  .brand-copy strong { border-right: 0; padding-right: 0; }
  .course-cards { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .workspace { grid-template-columns: minmax(0, 1fr) 320px; }
}

@media (max-width: 960px) {
  .topbar { padding: 0 22px; }
  .top-nav { gap: 4px; }
  .top-nav-button, .top-nav-link { min-width: 58px; padding: 0 11px; }
  .genealogy-hero { grid-template-columns: 1fr; }
  .hero-visual { height: 230px; }
  .course-cards { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .workspace { grid-template-columns: minmax(0, 1fr); overflow: auto; }
  .map-panel, .network-panel, .river-panel { min-height: 560px; border-right: 0; }
  .details { grid-column: 1; min-height: 420px; border-top: 1px solid var(--line); }
  .controlbar { flex-wrap: wrap; }
  .people-search { min-width: 260px; }
  .time-overview { grid-template-columns: 42px minmax(0, 1fr) auto; }
  .overview-copy, .top-stats { display: none; }
}

@media (max-width: 640px) {
  .app[data-view="genealogy"] .main-shell { grid-template-rows: 122px minmax(0, 1fr); }
  .main-shell { grid-template-rows: 122px auto minmax(0, 1fr) 80px; }
  .topbar { align-items: flex-start; flex-direction: column; justify-content: center; gap: 9px; padding: 12px 18px; }
  .brand-mark { width: 38px; height: 38px; }
  .brand-copy strong { font-size: 20px; }
  .top-nav { width: 100%; }
  .top-nav-button, .top-nav-link { min-width: 0; min-height: 34px; flex: 1; font-size: 14px; }
  .genealogy-hero { min-height: 0; gap: 24px; padding: 32px 18px; }
  .genealogy-hero h1 { font-size: 34px; }
  .hero-visual { height: 185px; }
  .catalog-toolbar, .course-filters, .course-cards, .site-footer { margin-left: 18px; margin-right: 18px; }
  .course-cards { grid-template-columns: 1fr; }
  .course-card { min-height: 220px; }
  .site-footer { align-items: flex-start; flex-direction: column; }
  .site-footer nav { justify-content: flex-start; gap: 16px; }
  .controlbar { gap: 9px; padding: 9px 12px; }
  .person-view-switcher { width: 100%; }
  .person-view-switcher button { min-width: 0; flex: 1; }
  .people-search { width: 100%; max-width: none; flex-basis: 100%; }
  .range-summary { padding-left: 0; border-left: 0; }
  .filter-menu { margin-left: auto; }
  .course-detail, .person-home { padding: 28px 18px 50px; }
  .person-home-head { align-items: stretch; flex-direction: column; }
  .time-overview { grid-template-columns: 40px minmax(0, 1fr); padding: 8px 12px; }
  .all-years { display: none; }
}

/* Light relationship graph */
.canvas-stage,
.obsidian-graph { background: #ffffff; }
.panel-head { border-bottom-color: var(--line); background: #ffffff; }
.panel-head h2 { color: var(--text); }
.panel-head p:not(.eyebrow) { color: var(--muted); }
.panel-head .eyebrow { color: #66817d; }
.network-legend { border-top-color: var(--line); background: #ffffff; }
.graph-tools button { border-color: var(--line); background: rgba(255,255,255,.94); color: var(--text); }
.graph-tools button:hover { border-color: #9aa6ad; background: #f3f5f6; color: var(--text); }
.obsidian-graph-tooltip { border-color: var(--line); background: rgba(255,255,255,.98); color: var(--text); box-shadow: 0 12px 30px rgba(21,34,42,.12); }
.obsidian-graph-tooltip span { color: var(--muted); }
.obsidian-graph-tooltip small { color: var(--muted-2); }


/* 课程分页 */
.catalog-page-head { margin-top: 30px; margin-bottom: 14px; }
.catalog-page-head strong { font-size: 30px; }
.catalog-page-head span { margin-left: 8px; }
.course-filters { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 26px; margin-bottom: 22px; padding: 10px 0 14px; border-top: 0; border-bottom: 1px solid var(--line); }
.filter-group { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; }
.filter-group + .filter-group { padding-left: 26px; border-left: 1px solid var(--line); }
.filter-pill-tab { min-height: 34px; padding: 0 14px; border: 0; border-radius: 17px; background: transparent; color: #3f4d55; cursor: pointer; font-size: 14px; transition: background-color .15s, color .15s; }
.filter-pill-tab:hover { background: #f1f3f5; color: #172839; }
.filter-pill-tab.active { background: #e5edf1; color: #244c64; font-weight: 650; }
@media (max-width: 760px) {
  .course-filters { gap: 8px 0; }
  .filter-group + .filter-group { padding-left: 0; border-left: 0; }
  .filter-pill-tab { min-height: 30px; padding: 0 11px; font-size: 13px; }
}

.hero-copy > .hero-search:first-child { margin-top: 0; }
