:root {
  --ink: #14231f;
  --paper: #f3f0e7;
  --cream: #fffdf7;
  --muted: #66706a;
  --line: rgba(20, 35, 31, 0.16);
  --lime: #d7f06a;
  --orange: #f0643a;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  color: var(--ink);
  background: var(--paper);
  font-family: "PingFang SC", "Microsoft YaHei", "Noto Sans CJK SC", system-ui, sans-serif;
}
body.reader-open { overflow: hidden; }
button, input { font: inherit; }
button { color: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }

.loading-shell, .reader-loading, .fatal-error {
  min-height: 100vh;
  display: grid;
  place-items: center;
  font-weight: 700;
}

.site-header {
  width: min(1500px, calc(100% - 56px));
  min-height: 84px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--line);
}
.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  color: inherit;
  text-decoration: none;
}
.brand-mark {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  background: var(--ink);
  color: var(--lime);
  font: 800 18px/1 Georgia, serif;
}
.brand strong, .brand small { display: block; }
.brand strong { font-size: 15px; letter-spacing: .04em; }
.brand small { margin-top: 3px; color: var(--muted); font-size: 9px; letter-spacing: .14em; }
.header-stats { display: flex; gap: 8px; }
.header-stats span, .meta-pills span {
  padding: 7px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255,255,255,.45);
  font-size: 11px;
}

.hero {
  position: relative;
  width: min(1500px, calc(100% - 56px));
  min-height: 680px;
  margin: 0 auto;
  padding: 105px 42% 80px 4%;
  border-bottom: 1px solid var(--line);
  overflow: hidden;
}
.hero::before {
  content: "MFG";
  position: absolute;
  right: -2%;
  bottom: -17%;
  color: rgba(20,35,31,.045);
  font: 900 330px/1 Arial Black, sans-serif;
  letter-spacing: -.12em;
}
.hero-kicker, .section-heading > p, .library-toolbar p, .reader-header span, .map-root > span {
  color: var(--orange);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: .22em;
}
.hero h1 {
  margin: 24px 0 30px;
  font-family: "Songti SC", "STSong", Georgia, serif;
  font-size: clamp(54px, 6vw, 96px);
  font-weight: 500;
  line-height: 1.04;
  letter-spacing: -.055em;
}
.hero h1 em {
  position: relative;
  z-index: 1;
  font-style: normal;
  white-space: nowrap;
}
.hero h1 em::after {
  content: "";
  position: absolute;
  z-index: -1;
  left: -1%;
  right: -1%;
  bottom: 8%;
  height: 24%;
  background: var(--lime);
}
.hero > p {
  max-width: 700px;
  color: var(--muted);
  font-size: 17px;
  line-height: 1.9;
}
.hero-actions { margin-top: 38px; display: flex; align-items: center; gap: 22px; }
.primary-action {
  display: inline-flex;
  align-items: center;
  gap: 22px;
  padding: 14px 18px;
  background: var(--ink);
  color: white;
  text-decoration: none;
  font-size: 13px;
  font-weight: 700;
}
.primary-action span { color: var(--lime); font-size: 18px; }
.progress-copy { color: var(--muted); font-size: 12px; }
.hero-orbit {
  position: absolute;
  top: 84px;
  right: 5%;
  width: min(480px, 34vw);
  aspect-ratio: 1;
  border: 1px solid var(--ink);
  border-radius: 50%;
}
.hero-orbit::before, .hero-orbit::after {
  content: "";
  position: absolute;
  inset: 15%;
  border: 1px dashed rgba(20,35,31,.3);
  border-radius: 50%;
}
.hero-orbit::after { inset: 34%; background: var(--ink); border: 0; }
.hero-orbit > div {
  position: absolute;
  z-index: 2;
  inset: 36%;
  display: grid;
  place-content: center;
  color: white;
  text-align: center;
}
.hero-orbit strong { color: var(--lime); font: 700 clamp(32px,4vw,58px)/1 Georgia, serif; }
.hero-orbit small { margin-top: 5px; font-size: 9px; letter-spacing: .2em; }
.hero-orbit > span {
  position: absolute;
  z-index: 3;
  padding: 7px 11px;
  border: 1px solid var(--ink);
  border-radius: 999px;
  background: var(--paper);
  font-size: 11px;
  font-weight: 700;
}
.hero-orbit > span:nth-child(1) { top: 3%; left: 36%; }
.hero-orbit > span:nth-child(2) { top: 29%; right: -3%; }
.hero-orbit > span:nth-child(3) { right: 5%; bottom: 16%; }
.hero-orbit > span:nth-child(4) { bottom: 2%; left: 27%; }
.hero-orbit > span:nth-child(5) { top: 43%; left: -4%; }

.learning-path, .library {
  width: min(1500px, calc(100% - 56px));
  margin: 0 auto;
  padding: 100px 0;
}
.section-heading { display: grid; grid-template-columns: 180px 1fr minmax(260px, 430px); align-items: end; gap: 24px; margin-bottom: 48px; }
.section-heading p, .library-toolbar p { margin: 0; }
.section-heading h2, .library-toolbar h2 { margin: 0; font: 500 clamp(36px,4.2vw,64px)/1.1 "Songti SC", Georgia, serif; letter-spacing: -.04em; }
.section-heading > span { color: var(--muted); font-size: 13px; line-height: 1.8; }
.path-grid { display: grid; grid-template-columns: repeat(3, 1fr); border-top: 1px solid var(--ink); border-left: 1px solid var(--ink); }
.path-card {
  min-height: 270px;
  padding: 24px;
  display: grid;
  grid-template-columns: 1fr auto;
  align-content: start;
  gap: 20px;
  border: 0;
  border-right: 1px solid var(--ink);
  border-bottom: 1px solid var(--ink);
  background: transparent;
  text-align: left;
  cursor: pointer;
  transition: background .2s, transform .2s;
}
.path-card:hover { background: var(--cream); transform: translateY(-3px); }
.path-number { color: var(--accent); font: 700 30px/1 Georgia, serif; }
.path-count { font-size: 11px; }
.path-card strong { grid-column: 1/-1; margin-top: 14px; font: 500 25px/1.25 "Songti SC", Georgia, serif; }
.path-card small { grid-column: 1/-1; color: var(--muted); font-size: 13px; line-height: 1.7; }
.path-card i { grid-column: 1/-1; align-self: end; color: var(--accent); font-size: 10px; font-style: normal; font-weight: 700; }

.library { border-top: 1px solid var(--line); }
.library-toolbar { display: flex; justify-content: space-between; align-items: end; gap: 30px; }
.library-toolbar p { margin-bottom: 14px; }
.search-box {
  width: min(480px, 42vw);
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 13px 16px;
  border: 1px solid var(--ink);
  background: var(--cream);
}
.search-box span { font-size: 24px; }
.search-box input { width: 100%; border: 0; outline: 0; background: transparent; }
.filters { margin: 38px 0 18px; display: flex; gap: 8px; flex-wrap: wrap; }
.filters button, .reader-controls button, .mode-switch button {
  padding: 8px 12px;
  border: 1px solid var(--line);
  background: transparent;
  border-radius: 999px;
  cursor: pointer;
  font-size: 11px;
}
.filters button.active, .mode-switch button.active { background: var(--ink); color: white; border-color: var(--ink); }
.result-line { margin: 24px 0; color: var(--muted); font-size: 12px; }
.map-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; }
.map-card { position: relative; min-height: 330px; border: 1px solid var(--ink); background: var(--cream); }
.map-card::before { content:""; position:absolute; inset:0 auto 0 0; width:5px; background:var(--accent); }
.card-top { display: flex; justify-content: space-between; align-items: center; padding: 18px 20px 0 26px; color: var(--accent); font-size: 10px; font-weight: 800; letter-spacing: .04em; }
.bookmark { border: 0; background: transparent; cursor: pointer; font-size: 22px; }
.bookmark.active { color: #df9e13; }
.card-open { width: 100%; padding: 12px 26px 24px; border: 0; background: transparent; text-align: left; cursor: pointer; }
.card-open h3 { min-height: 64px; margin: 12px 0 14px; font: 500 23px/1.35 "Songti SC", Georgia, serif; }
.card-open > p { min-height: 64px; color: var(--muted); font-size: 12px; line-height: 1.75; }
.tags { min-height: 30px; display: flex; flex-wrap: wrap; gap: 6px; }
.tags span { padding: 4px 7px; background: var(--paper); font-size: 9px; }
.card-meta { margin-top: 28px; padding-top: 16px; display: flex; gap: 12px; align-items: center; border-top: 1px solid var(--line); font-size: 10px; }
.card-meta strong { margin-left: auto; color: var(--accent); }
.empty-state { grid-column: 1/-1; padding: 70px; border: 1px dashed var(--line); text-align: center; color: var(--muted); }
footer { width: min(1500px, calc(100% - 56px)); margin: 0 auto; padding: 30px 0 52px; display:flex; justify-content:space-between; border-top:1px solid var(--ink); font-size:11px; }
footer span { color: var(--muted); }

.reader { position: fixed; inset: 0; z-index: 20; overflow: auto; background: var(--paper); }
.reader-header { position: sticky; top: 0; z-index: 5; min-height: 100px; padding: 16px 30px; display:grid; grid-template-columns:220px 1fr 160px; align-items:center; gap:20px; border-bottom:1px solid var(--ink); background:rgba(243,240,231,.96); backdrop-filter:blur(12px); }
.reader-header > div { text-align: center; }
.reader-header h1 { margin:5px 0 0; font:500 clamp(20px,2.2vw,34px)/1.2 "Songti SC", Georgia, serif; }
.reader-back, .complete-button { padding:10px 13px; border:1px solid var(--ink); background:transparent; cursor:pointer; }
.complete-button.done { background:var(--ink); color:white; }
.reader-main { width:min(1280px, calc(100% - 48px)); margin:0 auto; padding:28px 0 90px; }
.reader-toolbar { display:flex; justify-content:space-between; align-items:center; gap:20px; }
.meta-pills, .reader-controls, .mode-switch { display:flex; gap:7px; flex-wrap:wrap; }
.reader-controls button { background:var(--cream); }
.mode-switch { padding-right:8px; margin-right:6px; border-right:1px solid var(--line); }
.mode-switch button.active { background:var(--ink); }
.map-panel, .source-panel { margin-top:24px; border:1px solid var(--ink); background:var(--cream); }
.map-root { padding:38px; background:var(--ink); color:white; }
.map-root > span { color:var(--accent); }
.map-root h2 { margin:14px 0 6px; font:500 clamp(28px,3.6vw,52px)/1.2 "Songti SC", Georgia, serif; }
.map-root p { max-width:920px; color:rgba(255,255,255,.7); font-size:12px; line-height:1.8; }
.top-branches { margin:0; padding:0; list-style:none; }
.top-branch { position:relative; padding:30px 30px 30px 96px; border-top:1px solid var(--line); }
.branch-index { position:absolute; left:30px; top:34px; color:var(--accent); font:700 22px/1 Georgia, serif; }
.tree-list { margin:0; padding:0; list-style:none; }
.tree-list .tree-list { margin:7px 0 4px 11px; padding-left:24px; border-left:1px solid var(--line); }
.tree-row { min-height:33px; display:flex; align-items:flex-start; gap:10px; padding:4px 0; font-size:14px; line-height:1.75; }
.level-0 > li > .tree-row > span:last-child { font:500 22px/1.45 "Songti SC", Georgia, serif; }
.node-toggle { flex:0 0 auto; width:24px; height:24px; margin-top:1px; display:grid; place-items:center; border:1px solid var(--line); border-radius:50%; background:var(--paper); cursor:pointer; }
.leaf-dot { flex:0 0 auto; width:6px; height:6px; margin:10px 9px 0; border-radius:50%; background:var(--accent); }
.source-panel { padding:30px; white-space:pre-wrap; overflow-wrap:anywhere; font:13px/1.9 ui-monospace, SFMono-Regular, Menlo, monospace; }

@media (max-width: 1000px) {
  .hero { padding-right: 30%; }
  .hero-orbit { opacity:.35; right:-8%; }
  .path-grid, .map-grid { grid-template-columns:repeat(2,1fr); }
  .section-heading { grid-template-columns:120px 1fr; }
  .section-heading > span { grid-column:2; }
}
@media (max-width: 720px) {
  .site-header, .hero, .learning-path, .library, footer { width:min(100% - 28px, 1500px); }
  .header-stats { display:none; }
  .hero { min-height:610px; padding:86px 0 60px; }
  .hero h1 { font-size:clamp(45px,14vw,68px); }
  .hero h1 em { white-space:normal; }
  .hero-orbit { display:none; }
  .hero > p { font-size:15px; }
  .learning-path, .library { padding:70px 0; }
  .section-heading { display:block; }
  .section-heading h2 { margin:15px 0; }
  .path-grid, .map-grid { grid-template-columns:1fr; }
  .library-toolbar { display:block; }
  .search-box { width:100%; margin-top:24px; }
  footer { display:block; line-height:2; }
  .reader-header { grid-template-columns:1fr auto; padding:12px 14px; }
  .reader-header > div { grid-column:1/-1; grid-row:1; }
  .reader-back { grid-column:1; grid-row:2; }
  .complete-button { grid-column:2; grid-row:2; }
  .reader-main { width:calc(100% - 22px); padding-top:14px; }
  .reader-toolbar { align-items:flex-start; flex-direction:column; }
  .top-branch { padding:24px 14px 24px 52px; }
  .branch-index { left:13px; top:29px; font-size:17px; }
  .tree-list .tree-list { margin-left:5px; padding-left:14px; }
  .tree-row { font-size:13px; }
  .level-0 > li > .tree-row > span:last-child { font-size:18px; }
  .map-root { padding:26px 20px; }
  .source-panel { padding:18px; font-size:11px; }
}
