:root {
  --paper: #f3f5f4;
  --surface: #ffffff;
  --surface-soft: #f7f9f8;
  --ink: #17211f;
  --muted: #62706c;
  --faint: #8a9692;
  --line: #dce3df;
  --line-strong: #b9c6c0;
  --pine: #176b5b;
  --pine-dark: #0f4f43;
  --blue: #245f9d;
  --vermilion: #bb4836;
  --ochre: #a86619;
  --chalk: #f4f1df;
  --board: #173f36;
  --board-line: rgba(244, 241, 223, 0.2);
  --shadow: 0 18px 48px rgba(24, 42, 37, 0.09), 0 1px 2px rgba(24, 42, 37, 0.05);
  --sans: "Avenir Next", "Noto Sans SC", "PingFang SC", "Microsoft YaHei", sans-serif;
  --serif: "STSong", "Songti SC", "Noto Serif CJK SC", "Source Han Serif SC", serif;
}

@media (prefers-color-scheme: dark) {
  :root {
    --paper: #111715;
    --surface: #18211e;
    --surface-soft: #131c19;
    --ink: #f2f5f3;
    --muted: #a7b2ae;
    --faint: #788681;
    --line: #2c3b36;
    --line-strong: #465852;
    --pine: #58c7aa;
    --pine-dark: #7bd7bd;
    --blue: #76aee8;
    --vermilion: #f28a76;
    --ochre: #e0a44e;
    --shadow: 0 20px 58px rgba(0, 0, 0, 0.34);
  }
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100dvh;
  color: var(--ink);
  background:
    repeating-linear-gradient(0deg, transparent 0, transparent 31px, color-mix(in srgb, var(--line) 36%, transparent) 32px),
    var(--paper);
  font-family: var(--sans);
  line-height: 1.68;
  -webkit-font-smoothing: antialiased;
}

button,
input,
select {
  font: inherit;
}

a {
  color: inherit;
}

.skip-link {
  position: fixed;
  top: 10px;
  left: 10px;
  z-index: 100;
  padding: 8px 12px;
  transform: translateY(-160%);
  border-radius: 6px;
  background: var(--ink);
  color: var(--surface);
}

.skip-link:focus {
  transform: none;
}

.page-header {
  position: relative;
  z-index: 30;
  border-bottom: 1px solid var(--line);
  background: color-mix(in srgb, var(--surface) 94%, transparent);
  backdrop-filter: blur(14px);
}

.header-inner {
  width: min(1440px, calc(100% - 32px));
  min-height: 84px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}

.brand-line {
  display: flex;
  align-items: center;
  gap: 13px;
  min-width: 0;
}

.brand-seal {
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  width: 44px;
  height: 44px;
  border: 1px solid color-mix(in srgb, var(--vermilion) 55%, var(--line));
  border-radius: 7px;
  color: #fff;
  background: var(--vermilion);
  font-family: var(--serif);
  font-size: 1.35rem;
  font-weight: 900;
}

.brand-kicker,
.brand-title,
.topic-kicker,
.topic-title,
.section-title,
.case-title {
  letter-spacing: 0;
}

.brand-kicker {
  margin: 0 0 2px;
  color: var(--pine);
  font-size: 0.72rem;
  font-weight: 900;
  text-transform: uppercase;
}

.brand-title {
  margin: 0;
  font-family: var(--serif);
  font-size: 1.34rem;
  line-height: 1.2;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.updated-label,
.home-link {
  min-height: 38px;
  display: inline-flex;
  align-items: center;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--surface);
  color: var(--muted);
  font-size: 0.82rem;
  text-decoration: none;
}

.home-link {
  color: var(--pine);
  font-weight: 900;
  transition: border-color 0.14s, transform 0.14s;
}

.home-link:hover {
  transform: translateY(-1px);
  border-color: var(--pine);
}

.research-shell {
  width: min(1440px, calc(100% - 32px));
  margin: 18px auto 54px;
  display: grid;
  grid-template-columns: 272px minmax(0, 1fr);
  gap: 18px;
  align-items: start;
}

.topic-rail {
  position: sticky;
  top: 18px;
  max-height: calc(100dvh - 36px);
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: color-mix(in srgb, var(--surface) 95%, transparent);
  box-shadow: var(--shadow);
}

.rail-intro {
  padding: 18px 16px 15px;
  border-bottom: 1px solid var(--line);
}

.rail-intro strong {
  display: block;
  font-family: var(--serif);
  font-size: 1rem;
}

.rail-intro p {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 0.78rem;
  line-height: 1.55;
}

.topic-nav {
  display: grid;
  gap: 4px;
  padding: 8px;
}

.topic-link {
  display: grid;
  grid-template-columns: 1.8rem minmax(0, 1fr);
  gap: 8px;
  align-items: start;
  min-height: 56px;
  padding: 9px 10px;
  border: 1px solid transparent;
  border-radius: 7px;
  color: var(--muted);
  text-decoration: none;
  transition: background 0.14s, border-color 0.14s, color 0.14s;
}

.topic-link:hover {
  color: var(--ink);
  border-color: var(--line);
  background: var(--surface-soft);
}

.topic-link[aria-current="page"] {
  color: var(--ink);
  border-color: color-mix(in srgb, var(--pine) 42%, var(--line));
  background: color-mix(in srgb, var(--pine) 8%, var(--surface));
}

.topic-number {
  color: var(--vermilion);
  font-family: var(--serif);
  font-weight: 900;
}

.topic-link strong,
.topic-link small {
  display: block;
  letter-spacing: 0;
}

.topic-link strong {
  font-size: 0.86rem;
}

.topic-link small {
  margin-top: 1px;
  color: var(--faint);
  font-size: 0.71rem;
}

.rail-legend {
  padding: 13px 16px 16px;
  border-top: 1px solid var(--line);
}

.rail-legend p {
  margin: 0 0 8px;
  color: var(--faint);
  font-size: 0.72rem;
  font-weight: 900;
}

.legend-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.content-stage {
  min-width: 0;
  scroll-margin-top: 18px;
}

.topic-panel {
  scroll-margin-top: 18px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
  animation: panel-in 0.28s ease-out both;
}

.topic-panel[hidden] {
  display: none;
}

@keyframes panel-in {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}

.topic-head {
  padding: 30px 34px 26px;
  border-bottom: 1px solid var(--line);
  background:
    linear-gradient(90deg, color-mix(in srgb, var(--pine) 8%, transparent), transparent 42%),
    var(--surface-soft);
}

.topic-kicker {
  margin: 0 0 7px;
  color: var(--pine);
  font-size: 0.75rem;
  font-weight: 900;
}

.topic-title {
  max-width: 15em;
  margin: 0;
  font-family: var(--serif);
  font-size: 2.45rem;
  line-height: 1.14;
}

.topic-deck {
  max-width: 52rem;
  margin: 13px 0 0;
  color: var(--muted);
  font-size: 1rem;
}

.metric-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 1px;
  margin-top: 22px;
  border: 1px solid var(--line);
  border-radius: 7px;
  overflow: hidden;
  background: var(--line);
}

.metric {
  min-width: 130px;
  flex: 1 1 150px;
  padding: 11px 13px;
  background: var(--surface);
}

.metric strong,
.metric span {
  display: block;
}

.metric strong {
  color: var(--vermilion);
  font-family: var(--serif);
  font-size: 1.1rem;
}

.metric span {
  color: var(--muted);
  font-size: 0.74rem;
}

.topic-body {
  padding: 0 34px 42px;
}

.scope-note {
  margin: 0 -34px 30px;
  padding: 16px 34px;
  border-bottom: 1px solid var(--line);
  color: var(--muted);
  background: color-mix(in srgb, var(--ochre) 7%, var(--surface));
  font-size: 0.88rem;
}

.scope-note strong {
  color: var(--ink);
}

.section-block {
  margin-top: 38px;
}

.section-block:first-of-type {
  margin-top: 0;
}

.section-title {
  margin: 0 0 8px;
  font-family: var(--serif);
  font-size: 1.55rem;
  line-height: 1.25;
}

.section-lead {
  max-width: 54rem;
  margin: 0 0 18px;
  color: var(--muted);
}

.evidence {
  display: inline-flex;
  align-items: center;
  min-height: 1.55rem;
  padding: 0 8px;
  border: 1px solid currentColor;
  border-radius: 999px;
  font-size: 0.69rem;
  font-weight: 900;
  line-height: 1;
  white-space: nowrap;
}

.evidence.official { color: var(--blue); }
.evidence.sample { color: var(--vermilion); }
.evidence.editorial { color: var(--pine); }

.filter-bar {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) 165px auto;
  gap: 8px;
  align-items: center;
  margin: 20px 0;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-soft);
}

.search-field,
.filter-select {
  width: 100%;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface);
  color: var(--ink);
  outline: none;
}

.search-field {
  padding: 0 12px;
}

.filter-select {
  padding: 0 10px;
}

.search-field:focus,
.filter-select:focus {
  border-color: var(--pine);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--pine) 14%, transparent);
}

.filter-count {
  min-width: 94px;
  color: var(--muted);
  font-size: 0.78rem;
  text-align: right;
}

.board-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.board-case {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.case-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 15px 12px;
}

.case-title {
  margin: 0;
  font-family: var(--serif);
  font-size: 1.08rem;
  line-height: 1.35;
}

.case-subtitle {
  margin: 3px 0 0;
  color: var(--muted);
  font-size: 0.75rem;
}

.grade-tag {
  flex: 0 0 auto;
  min-width: 3rem;
  padding: 3px 7px;
  border-radius: 999px;
  color: var(--blue);
  background: color-mix(in srgb, var(--blue) 9%, var(--surface));
  font-size: 0.7rem;
  font-weight: 900;
  text-align: center;
}

.chalkboard {
  position: relative;
  min-height: 232px;
  margin: 0;
  padding: 18px 20px 30px;
  overflow: hidden;
  color: var(--chalk);
  background:
    linear-gradient(var(--board-line) 1px, transparent 1px),
    linear-gradient(90deg, var(--board-line) 1px, transparent 1px),
    var(--board);
  background-size: 22px 22px;
  box-shadow: inset 0 0 40px rgba(0, 0, 0, 0.22);
  font-family: "Kaiti SC", "STKaiti", "KaiTi", serif;
}

.chalkboard::after {
  content: "";
  position: absolute;
  right: 18px;
  bottom: 12px;
  width: 58px;
  height: 3px;
  background: color-mix(in srgb, var(--chalk) 70%, transparent);
  box-shadow: 0 6px 0 color-mix(in srgb, #eaa36b 70%, transparent);
}

.board-main {
  position: relative;
  z-index: 1;
  display: grid;
  gap: 10px;
  min-height: 178px;
  align-content: center;
  text-align: center;
}

.board-topic {
  color: #ffd78a;
  font-size: 1.2rem;
  font-weight: 900;
}

.board-flow {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: 7px;
}

.board-node {
  padding: 3px 7px;
  border-bottom: 1px solid color-mix(in srgb, var(--chalk) 68%, transparent);
  font-size: 0.88rem;
}

.board-arrow {
  color: #8edcc6;
  font-family: var(--sans);
  font-weight: 900;
}

.board-center {
  width: fit-content;
  margin: 0 auto;
  padding: 5px 12px;
  border: 1px solid #8edcc6;
  border-radius: 50%;
  color: #8edcc6;
  font-weight: 900;
}

.board-columns {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 13px;
  text-align: left;
}

.board-columns > span {
  padding: 8px;
  border-top: 1px solid color-mix(in srgb, var(--chalk) 55%, transparent);
}

.board-emphasis {
  color: #f5a78f;
}

.chalkboard figcaption {
  position: absolute;
  left: 12px;
  bottom: 8px;
  color: rgba(244, 241, 223, 0.64);
  font-family: var(--sans);
  font-size: 0.64rem;
}

.case-analysis {
  padding: 13px 15px 15px;
  border-top: 1px solid var(--line);
}

.case-analysis p {
  margin: 0;
  color: var(--muted);
  font-size: 0.82rem;
}

.case-analysis p + p {
  margin-top: 8px;
}

.source-link {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  color: var(--pine);
  font-size: 0.76rem;
  font-weight: 900;
  text-decoration: none;
}

.source-link:hover {
  text-decoration: underline;
}

.insight-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.insight-item {
  padding: 16px;
  border-top: 3px solid var(--pine);
  background: var(--surface-soft);
}

.insight-item:nth-child(2n) { border-color: var(--blue); }
.insight-item:nth-child(3n) { border-color: var(--vermilion); }

.insight-item strong {
  display: block;
  margin-bottom: 5px;
  font-family: var(--serif);
}

.insight-item p {
  margin: 0;
  color: var(--muted);
  font-size: 0.83rem;
}

.time-plan {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 1px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--line);
}

.time-step {
  min-height: 112px;
  padding: 12px 10px;
  background: var(--surface);
}

.time-step strong,
.time-step span {
  display: block;
}

.time-step strong {
  color: var(--vermilion);
  font-family: var(--serif);
}

.time-step span {
  margin-top: 6px;
  color: var(--muted);
  font-size: 0.77rem;
}

.data-table-wrap {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.data-table {
  width: 100%;
  min-width: 720px;
  border-collapse: collapse;
  background: var(--surface);
  font-size: 0.82rem;
}

.data-table th,
.data-table td {
  padding: 11px 12px;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
  text-align: left;
}

.data-table th {
  color: var(--muted);
  background: var(--surface-soft);
  font-size: 0.74rem;
  font-weight: 900;
  white-space: nowrap;
}

.data-table tr:last-child td {
  border-bottom: 0;
}

.data-table td:first-child {
  color: var(--ink);
  font-weight: 850;
}

.data-table a {
  color: var(--pine);
  font-weight: 800;
  text-decoration: none;
}

.data-table a:hover {
  text-decoration: underline;
}

.book-grid {
  display: grid;
  gap: 14px;
}

.textbook-book {
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
}

.book-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 13px 15px;
  border-bottom: 1px solid var(--line);
  background: var(--surface-soft);
}

.book-head h3 {
  margin: 0;
  font-family: var(--serif);
  font-size: 1.05rem;
  letter-spacing: 0;
}

.book-version {
  color: var(--muted);
  font-size: 0.72rem;
}

.book-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.8rem;
}

.book-table th,
.book-table td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}

.book-table th {
  color: var(--muted);
  background: color-mix(in srgb, var(--surface-soft) 72%, var(--surface));
  font-size: 0.72rem;
}

.book-table tr:last-child td {
  border-bottom: 0;
}

.book-table td:first-child {
  width: 5rem;
  color: var(--vermilion);
  font-weight: 900;
  white-space: nowrap;
}

.book-table td:nth-child(2) {
  width: 22%;
  font-weight: 850;
}

.process-line {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  counter-reset: process;
}

.process-step {
  position: relative;
  min-height: 120px;
  padding: 12px 14px 12px 32px;
  border-top: 1px solid var(--line-strong);
  counter-increment: process;
}

.process-step::before {
  content: counter(process);
  position: absolute;
  top: -13px;
  left: 0;
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  color: #fff;
  background: var(--pine);
  font-size: 0.72rem;
  font-weight: 900;
}

.process-step strong {
  display: block;
  margin-bottom: 4px;
  font-family: var(--serif);
}

.process-step p {
  margin: 0;
  color: var(--muted);
  font-size: 0.78rem;
}

.source-list {
  margin: 0;
  padding: 0;
  list-style: none;
  border-top: 1px solid var(--line);
}

.source-list li {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 10px;
  align-items: start;
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
}

.source-list p {
  margin: 0;
  font-size: 0.82rem;
}

.source-list small {
  display: block;
  margin-top: 2px;
  color: var(--faint);
}

.empty-result {
  margin: 18px 0 0;
  padding: 28px 16px;
  border: 1px dashed var(--line-strong);
  border-radius: 8px;
  color: var(--muted);
  text-align: center;
}

.empty-result[hidden] {
  display: none;
}

.page-footer {
  padding: 22px 16px 36px;
  color: var(--muted);
  font-size: 0.76rem;
  text-align: center;
}

@media (max-width: 1100px) {
  .research-shell {
    grid-template-columns: 238px minmax(0, 1fr);
  }

  .topic-head,
  .topic-body {
    padding-left: 24px;
    padding-right: 24px;
  }

  .scope-note {
    margin-left: -24px;
    margin-right: -24px;
    padding-left: 24px;
    padding-right: 24px;
  }

  .board-grid,
  .insight-grid {
    grid-template-columns: 1fr 1fr;
  }

  .time-plan,
  .process-line {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 760px) {
  .header-inner,
  .research-shell {
    width: min(100% - 20px, 680px);
  }

  .header-inner {
    min-height: 74px;
  }

  .brand-seal {
    width: 38px;
    height: 38px;
  }

  .brand-kicker,
  .updated-label {
    display: none;
  }

  .brand-title {
    font-size: 1rem;
  }

  .home-link {
    min-height: 36px;
    padding: 0 10px;
    font-size: 0.76rem;
  }

  .research-shell {
    display: block;
    margin-top: 10px;
  }

  .topic-rail {
    position: sticky;
    top: 0;
    z-index: 20;
    max-height: none;
    margin: 0 -10px 10px;
    overflow: hidden;
    border-radius: 0;
    border-left: 0;
    border-right: 0;
    box-shadow: 0 8px 22px rgba(24, 42, 37, 0.1);
  }

  .rail-intro,
  .rail-legend {
    display: none;
  }

  .topic-nav {
    display: flex;
    gap: 6px;
    overflow-x: auto;
    padding: 8px 10px;
    scrollbar-width: none;
  }

  .topic-nav::-webkit-scrollbar {
    display: none;
  }

  .topic-link {
    flex: 0 0 146px;
    min-height: 48px;
    padding: 7px 8px;
    grid-template-columns: 1.45rem minmax(0, 1fr);
  }

  .topic-link small {
    display: none;
  }

  .topic-panel {
    scroll-margin-top: 72px;
    border-radius: 7px;
  }

  .content-stage {
    scroll-margin-top: 72px;
  }

  .topic-head {
    padding: 22px 17px 20px;
  }

  .topic-title {
    font-size: 1.82rem;
  }

  .topic-deck {
    font-size: 0.9rem;
  }

  .topic-body {
    padding: 0 16px 32px;
  }

  .scope-note {
    margin: 0 -16px 24px;
    padding: 13px 16px;
    font-size: 0.8rem;
  }

  .section-block {
    margin-top: 30px;
  }

  .section-title {
    font-size: 1.3rem;
  }

  .filter-bar {
    grid-template-columns: minmax(0, 1fr) 112px;
  }

  .filter-count {
    grid-column: 1 / -1;
    text-align: left;
  }

  .board-grid,
  .insight-grid,
  .time-plan,
  .process-line {
    grid-template-columns: 1fr;
  }

  .chalkboard {
    min-height: 218px;
  }

  .time-step {
    min-height: 0;
  }

  .process-step {
    min-height: 0;
    margin-left: 12px;
  }

  .source-list li {
    grid-template-columns: auto minmax(0, 1fr);
  }

  .source-list .source-link {
    grid-column: 2;
  }
}

@media print {
  body { background: #fff; }
  .page-header, .topic-rail, .filter-bar, .page-footer { display: none; }
  .research-shell { display: block; width: 100%; margin: 0; }
  .topic-panel { display: block !important; border: 0; box-shadow: none; page-break-after: always; }
  .board-grid { grid-template-columns: 1fr 1fr; }
  .source-link { text-decoration: underline; }
}
