:root {
  --purple: #43165E;
  --purple-light: #7030A0;
  --lavender: #DDD7E7;
  --paper-tint: #F5F2F8;
  --paper: #FFFFFF;
  --ink: #231F20;
  --ink-2: #595959;
  --ink-3: #81798B;
  --line: #D8D0E0;
  --blue: #0055A4;
  --green: #00AE4D;
  --amber: #FAB600;
  --orange: #EE7003;
  --magenta: #BA0051;
  --sans: Arial, "Microsoft YaHei", "PingFang SC", "黑体", sans-serif;
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root {
    --purple: #A98AE8;
    --purple-light: #B99AF2;
    --lavender: #352947;
    --paper-tint: #21192D;
    --paper: #161020;
    --ink: #F1ECF5;
    --ink-2: #C8BED2;
    --ink-3: #A99FBB;
    --line: #3B2F4B;
    --magenta: #E0679B;
    --amber: #E8BD62;
    --green: #62C58B;
  }
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 17px;
  line-height: 1.55;
}
a { color: var(--purple); text-underline-offset: 4px; }
a:focus-visible, button:focus-visible { outline: 3px solid var(--amber); outline-offset: 3px; }
.skip-link {
  position: absolute; left: 16px; top: -80px; z-index: 100;
  background: var(--purple); color: var(--paper); padding: 12px 18px;
}
.skip-link:focus { top: 12px; }
.site-band {
  background: #43165E;
  color: #FFFFFF;
  min-height: 236px;
  padding: 38px max(32px, calc((100vw - 1280px) / 2 + 48px));
  position: relative;
  overflow: hidden;
}
.site-band::after {
  content: ""; position: absolute; inset: auto 0 0; height: 78px;
  background:
    radial-gradient(110% 85px at 10% 110%, transparent 58%, rgba(255,255,255,.15) 59%, transparent 61%),
    radial-gradient(110% 95px at 62% 120%, transparent 58%, rgba(255,255,255,.10) 59%, transparent 61%);
  pointer-events: none;
}
.site-band .eyebrow { font-size: 14px; letter-spacing: .16em; margin: 0 0 12px; opacity: .76; }
.site-band h1 { font-size: clamp(36px, 4vw, 58px); line-height: 1.08; max-width: 1000px; margin: 0; font-weight: 700; }
.site-band .subtitle { font-size: 20px; line-height: 1.5; max-width: 850px; margin: 18px 0 0; }
.site-band .as-of { font-size: 14px; margin-top: 18px; opacity: .76; }
.layout { max-width: 1440px; margin: 0 auto; display: grid; grid-template-columns: 245px minmax(0, 1fr); }
.course-rail {
  align-self: start; position: sticky; top: 0; max-height: 100vh; overflow-y: auto;
  padding: 28px 20px 48px 24px; border-right: 1px solid var(--line); background: var(--paper);
}
.rail-home { display: block; font-weight: 700; font-size: 18px; margin: 0 0 18px; text-decoration: none; }
.rail-progress { margin-bottom: 20px; }
.progress-track { height: 7px; background: var(--lavender); overflow: hidden; }
.progress-fill { height: 100%; width: 0; background: var(--purple); transition: width 180ms ease; }
.progress-label { display: block; font-size: 14px; color: var(--ink-2); margin-top: 7px; }
.course-nav { display: grid; gap: 2px; }
.course-nav a {
  min-height: 44px; display: grid; grid-template-columns: 30px 1fr; align-items: center; gap: 8px;
  padding: 7px 8px; color: var(--ink-2); text-decoration: none; border-left: 3px solid transparent;
}
.course-nav a:hover { background: var(--paper-tint); color: var(--purple); }
.course-nav a[aria-current="page"] { color: var(--purple); border-left-color: var(--purple); font-weight: 700; }
.course-nav a.visited .nav-no { background: var(--purple); color: var(--paper); }
.nav-no {
  width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center;
  background: var(--lavender); color: var(--purple); font-size: 13px; font-variant-numeric: tabular-nums;
}
.main { min-width: 0; padding: 32px clamp(24px, 5vw, 72px) 96px; }
.page-intro { max-width: 1000px; margin: 0 auto 34px; border-bottom: 2px solid var(--ink); padding-bottom: 22px; }
.page-intro .route { color: var(--purple); font-size: 15px; font-weight: 700; letter-spacing: .08em; }
.page-intro p { font-size: 20px; max-width: 800px; margin: 12px 0 0; }
.primer-sheet {
  max-width: 1120px; margin: 0 auto; min-height: 660px; padding: 46px 0 42px;
  border-bottom: 1px solid var(--line); display: flex; flex-direction: column; justify-content: center;
  break-after: page;
}
.sheet-no { color: var(--purple); font-size: 14px; letter-spacing: .14em; font-weight: 700; margin-bottom: 8px; }
.primer-sheet h2 { color: var(--purple); font-size: clamp(32px, 3.1vw, 44px); line-height: 1.13; margin: 0; max-width: 1000px; }
.sheet-lede { font-size: 20px; line-height: 1.5; max-width: 900px; margin: 14px 0 22px; color: var(--ink); }
.viz-block { margin: 0; flex: 1; display: flex; flex-direction: column; justify-content: center; }
.diagram-scroll { max-width: 100%; min-height: 360px; overflow-x: auto; overflow-y: hidden; display: flex; align-items: center; }
.diagram { display: block; width: 100%; min-width: 820px; height: auto; max-height: 470px; }
.viz-block figcaption { color: var(--ink-2); font-size: 15px; margin-top: 12px; max-width: 900px; }
.source-links { display: flex; flex-wrap: wrap; gap: 8px 18px; margin-top: 13px; font-size: 15px; }
.source-links a { min-height: 44px; display: inline-flex; align-items: center; font-weight: 700; }
.mastery {
  max-width: 1120px; margin: 50px auto 0; padding: 34px 0; border-top: 2px solid var(--ink);
}
.mastery h2 { color: var(--purple); font-size: 32px; margin: 0 0 18px; }
.mastery-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; }
.mastery-item { min-height: 90px; display: grid; grid-template-columns: 42px 1fr; align-items: center; gap: 12px; }
.mastery-item svg { width: 36px; height: 36px; }
.mastery-item p { margin: 0; font-size: 17px; }
.page-turn { max-width: 1120px; margin: 30px auto 0; display: flex; gap: 12px; justify-content: space-between; }
.page-turn a {
  min-height: 48px; display: inline-flex; align-items: center; padding: 9px 16px;
  border: 1px solid var(--line); text-decoration: none; font-weight: 700;
}
.page-turn a:hover { background: var(--paper-tint); }
.site-foot { border-top: 1px solid var(--line); padding: 28px max(24px, calc((100vw - 1280px) / 2 + 48px)); display: flex; justify-content: space-between; color: var(--ink-3); font-size: 13px; }
.wordmark { color: var(--purple); font-weight: 700; letter-spacing: .18em; }
.mobile-turn { display: none; }

/* Inline SVG grammar: ink skeleton, purple protagonist. */
.diagram text { font-family: var(--sans); fill: var(--ink); }
.v-label { font-size: 17px; font-weight: 700; }
.v-small { font-size: 15px; fill: var(--ink-2) !important; }
.v-heading { font-size: 22px; font-weight: 700; fill: var(--purple) !important; }
.v-value { font-size: 18px; font-weight: 700; font-variant-numeric: tabular-nums; }
.v-big { font-size: 48px; font-weight: 700; fill: var(--purple) !important; font-variant-numeric: tabular-nums; }
.v-index { font-size: 14px; font-weight: 700; fill: var(--purple) !important; }
.v-vs { font-size: 28px; font-weight: 700; fill: #FFFFFF !important; }
.v-glyph { font-size: 22px; font-weight: 700; fill: #FFFFFF !important; }
.node, .net-node { fill: var(--paper); stroke: var(--ink); stroke-width: 1.2; }
.node-primary, .net-primary { fill: var(--paper-tint); stroke: var(--purple); stroke-width: 2.4; }
.node-alert { fill: var(--paper); stroke: var(--magenta); stroke-width: 2.2; stroke-dasharray: 7 5; }
.connector { fill: none; stroke: var(--purple); stroke-width: 2; }
.arrow-head { fill: var(--purple); }
.hatch-line { stroke: var(--ink-3); stroke-width: 3; opacity: .55; }
.layer { fill: var(--paper-tint); stroke: var(--line); stroke-width: 1; }
.layer-primary { fill: #43165E; stroke: #43165E; }
.layer-primary + text, .layer-primary + text + text { fill: #FFFFFF !important; }
.layer-alert { fill: var(--paper); stroke: var(--magenta); stroke-dasharray: 7 5; }
.layer-watch { fill: var(--lavender); stroke: var(--purple-light); }
.bar-track { fill: var(--paper-tint); }
.bar-fill { fill: var(--purple); }
.bar-muted { fill: var(--purple-light); opacity: .62; }
.bar-watch { fill: var(--amber); }
.bar-alert { fill: var(--magenta); }
.cell { fill: var(--paper-tint); stroke: var(--line); }
.cell-p0, .cell-alert { fill: var(--paper); stroke: var(--magenta); stroke-dasharray: 6 4; }
.cell-p1 { fill: var(--purple); opacity: .28; stroke: var(--purple); }
.cell-p2 { fill: var(--purple); opacity: .62; stroke: var(--purple); }
.cell-p3, .cell-pass { fill: var(--purple); stroke: var(--purple); }
.cell-p3 + text, .cell-pass + text { fill: #FFFFFF !important; }
.cell-empty { fill: var(--paper); stroke: var(--ink-3); stroke-dasharray: 4 4; }
.axis { stroke: var(--ink); stroke-width: 2; }
.tick { stroke: var(--ink-3); stroke-width: 1; }
.timeline-dot { fill: var(--purple); }
.dot-alert { fill: var(--magenta); }
.dot-watch { fill: var(--amber); }
.dot-pass { fill: var(--green); }
.split-left, .split-right { fill: var(--paper-tint); stroke: var(--purple); stroke-width: 1.5; }
.split-alert { fill: var(--paper); stroke: var(--magenta); stroke-dasharray: 8 5; }
.bullet { fill: var(--purple); }
.vs-disc { fill: var(--purple); }
.donut-track { fill: none; stroke: var(--paper-tint); stroke-width: 46; }
.donut-segment { fill: none; stroke-width: 46; transform: rotate(-90deg); transform-origin: 320px 220px; }
.donut-0 { stroke: var(--purple); } .donut-1 { stroke: var(--purple-light); }
.donut-2 { stroke: var(--blue); } .donut-3 { stroke: var(--orange); }
.donut-4 { stroke: var(--lavender); } .donut-5 { stroke: var(--ink-3); }
.donut-cash { stroke: var(--ink-3); }
.legend { fill: var(--purple); } .legend-1 { fill: var(--purple-light); }
.legend-2 { fill: var(--blue); } .legend-3 { fill: var(--orange); }
.legend-4 { fill: var(--lavender); } .legend-5 { fill: var(--ink-3); }
.legend-cash { fill: var(--ink-3); }
.funnel { fill: var(--purple); opacity: .18; stroke: var(--purple); }
.funnel-watch { opacity: .38; }
.funnel-alert { fill: var(--paper); opacity: 1; stroke: var(--magenta); stroke-dasharray: 7 5; }
.net-edge { fill: none; stroke: var(--line); stroke-width: 1.4; }
.radar-grid { fill: none; stroke: var(--line); stroke-width: 1; }
.radar-axis { stroke: var(--ink-3); stroke-width: 1; }
.radar-value { fill: var(--purple); fill-opacity: .22; stroke: var(--purple); stroke-width: 2.5; }
.radar-dot { fill: var(--purple); }
.glyph-cell { fill: var(--paper-tint); stroke: var(--line); }
.glyph-disc { fill: var(--purple); }

@media (max-width: 980px) {
  .layout { display: block; }
  .course-rail { position: static; max-height: none; border-right: 0; border-bottom: 1px solid var(--line); padding: 18px 20px; }
  .course-nav { grid-template-columns: repeat(4, minmax(150px, 1fr)); overflow-x: auto; }
  .rail-progress { max-width: 420px; }
  .main { padding-bottom: 118px; }
  .mobile-turn {
    position: fixed; z-index: 20; left: 0; right: 0; bottom: 0; min-height: 66px;
    display: grid; grid-template-columns: 1fr 1fr 1fr; background: var(--paper); border-top: 1px solid var(--line);
  }
  .mobile-turn a { display: grid; place-items: center; min-height: 66px; padding: 8px; text-align: center; text-decoration: none; font-weight: 700; }
}
@media (max-width: 640px) {
  .site-band { padding: 30px 22px 42px; }
  .site-band h1 { font-size: 36px; }
  .site-band .subtitle { font-size: 18px; }
  .course-nav { grid-template-columns: repeat(13, 172px); }
  .main { padding: 26px 18px 100px; }
  .page-intro p, .sheet-lede { font-size: 18px; }
  .primer-sheet { min-height: 0; padding: 42px 0; }
  .primer-sheet h2 { font-size: 32px; }
  .diagram { min-width: 820px; }
  .mastery-grid { grid-template-columns: 1fr; }
  .site-foot { padding: 24px 18px 90px; gap: 18px; flex-direction: column; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; }
}
@page { size: 1280px 720px; margin: 0; }
@media print {
  :root { color-scheme: light; --paper: #FFFFFF; --ink: #231F20; --ink-2: #595959; --ink-3: #81798B; --paper-tint: #F5F2F8; --lavender: #DDD7E7; --line: #D8D0E0; --purple: #43165E; }
  * { print-color-adjust: exact; -webkit-print-color-adjust: exact; }
  body { background: #FFFFFF; }
  .course-rail, .mobile-turn, .page-turn, .skip-link { display: none !important; }
  .layout { display: block; max-width: none; }
  .site-band { width: 1280px; height: 720px; page-break-after: always; break-after: page; padding: 92px; }
  .main { padding: 0; }
  .page-intro { display: none; }
  .primer-sheet {
    width: 1280px; height: 720px; min-height: 720px; max-height: 720px; overflow: hidden;
    margin: 0; padding: 42px 72px 48px; border: 0; page-break-after: always; break-after: page;
  }
  .primer-sheet h2 { font-size: 42px; }
  .sheet-lede { margin: 7px 0; }
  .diagram-scroll { overflow: hidden; }
  .diagram { min-width: 0; max-height: 430px; }
  .viz-block figcaption { margin-top: 4px; }
  .source-links { margin-top: 4px; }
  .source-links a { min-height: 0; }
  .mastery, .site-foot { display: none; }
}
