/* ============================================================ 主题变量 */
:root {
  --bg: #f4f2ec;
  --surface: #ffffff;
  --surface-2: #eeebe3;
  --text: #1d1d1b;
  --muted: #6f6e68;
  --border: #e0ddd3;
  --accent: #534ab7;
  --accent-soft: #eeedfe;
  --on-accent: #ffffff;
  --ok: #3b6d11; --ok-soft: #eaf3de;
  --warn: #854f0b; --warn-soft: #faeeda;
  --bad: #a32d2d; --bad-soft: #fcebeb;
  --code-bg: #1f1f1d;
  --code-text: #e8e6df;
  --cream: #f3efe6;
  --ink: #1d1d1b;
  --c-base: #888780;
  --c-assume: #1d9e75;
  --c-param: #534ab7;
  --c-nonparam: #d85a30;
  --c-posthoc: #ba7517;
  --c-categorical: #d4537e;
  --c-relation: #378add;
  --c-plan: #c9c7bf;
  /* 侧栏在两种主题下都是深色 */
  --side-bg: #121211;
  --side-2: #1d1d1b;
  --side-text: #ecebe6;
  --side-muted: #8b8a84;
  --side-border: #2a2a27;
  --radius: 10px;
  --sans: -apple-system, "PingFang SC", "Microsoft YaHei", "Segoe UI", sans-serif;
  --mono: "JetBrains Mono", "Cascadia Code", Consolas, monospace;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0e0e0d; --surface: #181817; --surface-2: #232321; --text: #ecebe6; --muted: #9c9a93; --border: #2c2c29;
    --accent: #8f87ee; --accent-soft: #24213f; --on-accent: #12102a;
    --ok: #97c459; --ok-soft: #1f2d12; --warn: #efa027; --warn-soft: #33250e; --bad: #f09595; --bad-soft: #381818;
    --code-bg: #0a0a09; --c-plan: #55544f; color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0e0e0d; --surface: #181817; --surface-2: #232321; --text: #ecebe6; --muted: #9c9a93; --border: #2c2c29;
  --accent: #8f87ee; --accent-soft: #24213f; --on-accent: #12102a;
  --ok: #97c459; --ok-soft: #1f2d12; --warn: #efa027; --warn-soft: #33250e; --bad: #f09595; --bad-soft: #381818;
  --code-bg: #0a0a09; --c-plan: #55544f; color-scheme: dark;
}

/* ============================================================ 基础 */
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { font-family: var(--sans); background: var(--bg); color: var(--text); font-size: 15px; line-height: 1.6; }
code { font-family: var(--mono); font-size: .9em; background: var(--surface-2); padding: 1px 5px; border-radius: 4px; }
a { color: var(--accent); }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.mono { font-family: var(--mono); font-size: 11px; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
[hidden] { display: none !important; }
svg { stroke-linecap: round; stroke-linejoin: round; }

.btn {
  border: 1px solid var(--border); background: var(--surface); color: var(--text);
  padding: 6px 14px; border-radius: 8px; font: inherit; font-size: 14px; cursor: pointer;
  display: inline-flex; align-items: center; gap: 6px;
}
.btn:hover { border-color: var(--muted); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.small-btn { font-size: 13px; padding: 4px 10px; }
.btn-xl {
  display: inline-flex; align-items: center; gap: 14px; padding: 13px 26px; border-radius: 999px; font: inherit;
  font-size: 15px; font-weight: 600; cursor: pointer; border: 1.5px solid var(--ink); text-decoration: none;
}
.btn-xl.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-xl.primary:hover { filter: brightness(1.08); }
.btn-xl.ghost { background: transparent; color: var(--ink); }
.btn-xl.ghost:hover { background: rgba(0, 0, 0, .05); }

/* ============================================================ 框架 */
.app { display: grid; grid-template-columns: 252px minmax(0, 1fr); height: 100vh; }
.main { display: flex; flex-direction: column; min-width: 0; min-height: 0; }
.view { display: none; flex: 1; min-height: 0; }
.view.active { display: grid; }
.scrim { display: none; }

/* 侧栏 */
.sidebar {
  background: var(--side-bg); color: var(--side-text); display: flex; flex-direction: column; gap: 6px;
  padding: 18px 14px 14px; overflow: hidden; border-right: 1px solid var(--side-border);
}
/* 中间可滚，底部会员卡和小红书固定 */
.side-scroll { flex: 1; min-height: 0; overflow-y: auto; margin: 0 -6px; padding: 0 6px; scrollbar-width: thin; scrollbar-color: #3a3a36 transparent; }
.logo { display: flex; align-items: center; gap: 12px; padding: 0 4px 14px; border-bottom: 1px solid var(--side-border); }
.logo .mark {
  width: 40px; height: 40px; border-radius: 10px; background: var(--cream); color: var(--ink); display: grid;
  place-items: center; font-weight: 900; font-size: 22px; position: relative; flex: none;
}
.logo .mark::after { content: ""; position: absolute; right: -3px; bottom: -3px; width: 12px; height: 12px; border-radius: 3px; background: #534ab7; }
.logo b { display: block; font-size: 16px; }
.logo small { font-family: var(--mono); font-size: 10px; letter-spacing: .2em; color: var(--side-muted); }
.search { position: relative; margin: 10px 0 6px; }
.search svg { position: absolute; left: 11px; top: 10px; width: 16px; height: 16px; fill: none; stroke: var(--side-muted); stroke-width: 2; }
.search input {
  width: 100%; background: var(--side-2); border: 1px solid var(--side-border); color: var(--side-text); border-radius: 10px;
  padding: 8px 60px 8px 34px; font: inherit; font-size: 13px; outline: 0;
}
.search input:focus { border-color: #534ab7; }
.search kbd {
  position: absolute; right: 8px; top: 7px; font-family: var(--mono); font-size: 10px; color: var(--side-muted);
  border: 1px solid var(--side-border); border-radius: 5px; padding: 1px 5px;
}
.search-results {
  position: absolute; z-index: 20; left: 0; right: 0; top: 42px; background: var(--side-2); border: 1px solid var(--side-border);
  border-radius: 10px; padding: 6px; max-height: 320px; overflow: auto; box-shadow: 0 12px 30px rgba(0, 0, 0, .4);
}
.search-results a { display: block; padding: 7px 9px; border-radius: 7px; color: var(--side-text); text-decoration: none; font-size: 13px; cursor: pointer; }
.search-results a:hover { background: #2b2b28; }
.search-results .ep { font-family: var(--mono); font-size: 10px; color: var(--side-muted); margin-right: 8px; }
.search-results .empty { padding: 8px; color: var(--side-muted); font-size: 13px; }
.side-nav { display: flex; flex-direction: column; gap: 1px; }
.side-nav a, .side-tools a {
  display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 8px; color: var(--side-text);
  text-decoration: none; font-size: 14px; cursor: pointer;
}
.side-nav svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 1.8; opacity: .8; }
.side-nav a:hover, .side-tools a:hover { background: var(--side-2); }
.side-nav a.active { background: var(--side-2); box-shadow: inset 2px 0 0 #8f87ee; }
.side-nav .tag { margin-left: auto; font-family: var(--mono); font-size: 10px; color: #8f87ee; }
.side-group { margin-top: 10px; }
.side-label { font-family: var(--mono); font-size: 10px; letter-spacing: .14em; color: var(--side-muted); padding: 6px 10px; }
.side-label span { margin-left: 6px; opacity: .6; }
.side-lessons a { display: flex; align-items: center; gap: 10px; padding: 7px 10px; border-radius: 8px; cursor: pointer; font-size: 14px; color: var(--side-text); text-decoration: none; }
.side-lessons a:hover { background: var(--side-2); }
.side-lessons .track { font-weight: 700; }
.side-lessons .track .n, .side-lessons .part .n { margin-left: auto; font-family: var(--mono); font-size: 11px; color: var(--side-muted); }
.side-lessons .track:not(.soon)::after, .side-lessons .part::after { content: "\203A"; width: 10px; text-align: center; color: var(--side-muted); transition: transform .15s; }
.side-lessons .track.open::after, .side-lessons .part.open::after { transform: rotate(90deg); }
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--c, var(--muted)); flex: none; }
.side-lessons .dot { width: 6px; height: 6px; }
.side-lessons .soon-tag { margin-left: auto; }
.track-parts { display: none; margin: 0 0 4px 13px; padding-left: 4px; }
.track-parts.open { display: block; }
.track-parts .part { font-size: 13.5px; padding: 6px 10px; }
.part-lessons { display: none; margin: 2px 0 6px 13px; padding-left: 8px; border-left: 1px solid var(--side-border); }
.part-lessons.open { display: block; }
.part-lessons a { font-size: 13px; padding: 5px 8px; color: var(--side-muted); }
.part-lessons a .t { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.part-lessons a .ep { font-family: var(--mono); font-size: 10.5px; opacity: .8; }
.part-lessons a.active { background: var(--side-2); color: #fff; }
.part-lessons a.active .ep { color: #8f87ee; opacity: 1; }
.side-tools a { font-size: 13.5px; padding-left: 12px; }
.side-tools a::before { content: ""; width: 5px; height: 5px; border-radius: 50%; background: var(--side-muted); }
.side-cta {
  flex: none; margin-top: 8px; display: flex; flex-direction: column; gap: 4px; padding: 14px; border-radius: 12px; text-decoration: none;
  background: var(--cream); color: var(--ink); position: relative; overflow: hidden; cursor: pointer;
}
.side-cta::before { content: ""; position: absolute; right: -30px; top: -30px; width: 100px; height: 100px; border-radius: 50%; background: #cecbf6; opacity: .7; }
.side-cta b { position: relative; font-size: 15px; }
.side-cta span { position: relative; font-size: 12px; color: #5f5e5a; line-height: 1.5; }
.side-cta em { position: relative; font-style: normal; margin-top: 8px; background: #534ab7; color: #fff; font-size: 12.5px; font-weight: 600; padding: 7px 14px; border-radius: 999px; text-align: center; }
.side-cta:hover em { filter: brightness(1.1); }
.side-xhs {
  flex: none; display: flex; justify-content: space-between; align-items: center; padding: 10px 12px; border-radius: 10px;
  border: 1px solid #f3efe6; color: var(--side-text); text-decoration: none; font-size: 13px; font-weight: 600;
}
.side-xhs i { font-style: normal; font-family: var(--mono); font-size: 10px; letter-spacing: .14em; color: #8f87ee; }
.side-xhs:hover { background: var(--side-2); }

/* 顶栏 */
.topbar { display: flex; align-items: center; gap: 14px; padding: 10px 22px; border-bottom: 1px solid var(--border); background: var(--bg); }
.icon-btn {
  width: 34px; height: 34px; border-radius: 9px; border: 1px solid var(--border); background: var(--surface); color: var(--text);
  display: inline-grid; place-items: center; cursor: pointer; font: inherit; font-size: 13px; font-weight: 600;
}
.icon-btn svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; }
#menu { display: none; }
.crumb { font-family: var(--mono); font-size: 12px; letter-spacing: .1em; color: var(--muted); }
.crumb b { font-family: var(--sans); letter-spacing: 0; color: var(--text); font-size: 14px; }
.top-right { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.pill { font-size: 12px; padding: 4px 10px; border-radius: 999px; }
.pill.loading { background: var(--warn-soft); color: var(--warn); }
.pill.ready { background: var(--ok-soft); color: var(--ok); }
.pill.error { background: var(--bad-soft); color: var(--bad); }

/* ============================================================ 首页 */
.view.home.active { display: block; overflow-y: auto; padding: 24px 28px 40px; }
.home > * { max-width: 1180px; margin-left: auto; margin-right: auto; }
.kicker { font-family: var(--mono); font-size: 11px; letter-spacing: .14em; color: var(--muted); text-transform: uppercase; }
.hero {
  display: grid; grid-template-columns: 1.05fr 1fr; align-items: center; gap: 20px; background: var(--cream); color: var(--ink);
  border-radius: 22px; padding: 46px 48px; min-height: 400px; position: relative; overflow: hidden;
}
.hero .kicker { color: #6f6e68; }
.hero h1 { font-size: clamp(42px, 6vw, 76px); line-height: 1.02; margin: 14px 0 18px; font-weight: 900; letter-spacing: -.02em; }
.hero-sub { font-size: 18px; font-weight: 700; margin: 0 0 18px; }
.hero-sub i { font-style: normal; color: #534ab7; margin: 0 6px; }
.hero-sub mark { background: var(--ink); color: var(--cream); padding: 1px 8px; border-radius: 4px; }
.hero-stats { font-size: 14px; color: #5f5e5a; margin-bottom: 26px; }
.hero-stats b { color: #534ab7; font-size: 16px; }
.hero-stats span { margin: 0 8px; opacity: .5; }
.hero-cta { display: flex; gap: 12px; flex-wrap: wrap; }
.hero-art { display: flex; justify-content: center; }
.art { width: 100%; max-width: 440px; }
.art text { font-family: var(--mono); font-size: 13px; fill: #f3efe6; }
.art text.dark { fill: #1d1d1b; }
@media (prefers-reduced-motion: no-preference) {
  .art .bar { transform-box: fill-box; transform-origin: bottom; animation: grow .7s cubic-bezier(.2, .8, .2, 1) both; }
  .art .chip-a { animation: float 4s ease-in-out infinite; }
  .art .chip-b { animation: float 4s ease-in-out 1.5s infinite; }
  .marquee-track { animation: marquee 40s linear infinite; }
}
@keyframes grow { from { transform: scaleY(0); } }
@keyframes float { 50% { transform: translateY(-6px); } }
@keyframes marquee { to { transform: translateX(-50%); } }

.marquee { max-width: none !important; margin: 26px -28px 10px !important; border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); overflow: hidden; }
.marquee-track { display: flex; width: max-content; padding: 12px 0; font-family: var(--mono); font-size: 13px; font-weight: 600; letter-spacing: .12em; }
.marquee-track span { padding: 0 16px; }
.marquee-track i { font-style: normal; color: var(--accent); }

.sec { margin-top: 46px; }
.sec-head { display: grid; grid-template-columns: 1fr auto 1fr; align-items: end; gap: 16px; border-bottom: 2px solid var(--text); padding-bottom: 12px; margin-bottom: 18px; }
.sec-no, .sec-meta { font-family: var(--mono); font-size: 11px; letter-spacing: .12em; color: var(--muted); }
.sec-meta { text-align: right; }
.sec-head h2 { margin: 0; font-size: 34px; font-weight: 900; letter-spacing: -.01em; }
.sec-head h2 em { font-style: normal; color: var(--accent); }

/* 封面：深色底 + 光晕 + 细网格，字号跟着封面宽度走（cqw） */
.cover {
  container-type: inline-size; position: relative; aspect-ratio: 16 / 9; overflow: hidden; color: #fff; border-radius: inherit;
  background:
    radial-gradient(120% 90% at 95% 0%, color-mix(in srgb, var(--hi) 38%, transparent), transparent 60%),
    linear-gradient(rgba(255,255,255,.045) 1px, transparent 1px) 0 0 / 100% 12.5%,
    linear-gradient(90deg, rgba(255,255,255,.045) 1px, transparent 1px) 0 0 / 8.33% 100%,
    #141413;
}
.cv-top { position: absolute; left: 6cqw; top: 6cqw; display: flex; gap: 2cqw; align-items: center; }
.cv-badge { background: #3b5bff; color: #fff; font-size: 3.4cqw; font-weight: 700; padding: .5cqw 2cqw; border-radius: 1.2cqw; }
.cv-tag { border: .3cqw solid rgba(255,255,255,.7); font-size: 3.2cqw; font-weight: 600; padding: .3cqw 1.8cqw; border-radius: 1.2cqw; }
.cv-title { position: absolute; left: 6cqw; top: 19cqw; display: flex; flex-direction: column; line-height: 1.08; letter-spacing: -.02em; }
.cv-title b { font-size: 11.5cqw; font-weight: 900; white-space: nowrap; }
.cv-title b.hi { color: var(--hi); }
.cv-art { position: absolute; right: 5cqw; bottom: 7cqw; width: 40%; fill: none; stroke: var(--hi); stroke-width: 3; opacity: .95; }
.cv-art .f { fill: var(--hi); fill-opacity: .22; stroke-width: 2; }
.cv-art .f2 { fill: var(--hi); fill-opacity: .55; stroke-width: 2; }
.cv-art .b { stroke: #fff; stroke-width: 3.5; }
.cv-art .d { fill: var(--hi); stroke: none; }
.cv-art .d2 { fill: #fff; stroke: none; }
.cv-art text { fill: #fff; stroke: none; font-family: var(--mono); font-size: 9px; text-anchor: middle; }
.cv-ep { position: absolute; left: 6cqw; bottom: 5cqw; font-family: var(--mono); font-size: 3.4cqw; letter-spacing: .12em; color: rgba(255,255,255,.6); }
.cv-mark { position: absolute; right: 5cqw; top: 5cqw; width: 6.5cqw; height: 6.5cqw; border-radius: 1.6cqw; background: var(--cream); color: var(--ink); display: grid; place-items: center; font-weight: 900; font-size: 3.8cqw; }

.headline {
  display: grid; grid-template-columns: 1.15fr 1fr; border-radius: 18px; overflow: hidden; cursor: pointer;
  border: 1px solid var(--border); background: var(--cream); color: var(--ink); transition: transform .15s, box-shadow .15s;
}
.headline:hover { transform: translateY(-2px); box-shadow: 0 16px 40px rgba(0,0,0,.18); }
.headline-cover .cover { height: 100%; aspect-ratio: auto; min-height: 300px; border-radius: 0; }
.headline-cover .cv-title b { font-size: 9.5cqw; }
.headline-cover .cv-art { width: 25%; bottom: 7cqw; }
.headline-body { padding: 32px 34px; display: flex; flex-direction: column; gap: 12px; }
.headline-body .mono { color: #534ab7; }
.headline-body h3 { margin: 0; font-size: 30px; line-height: 1.25; font-weight: 900; }
.headline-body p { margin: 0; color: #5f5e5a; font-size: 14.5px; line-height: 1.75; }
.headline .read { margin-top: auto; align-self: flex-start; background: #3b5bff; color: #fff; padding: 10px 22px; border-radius: 999px; font-weight: 700; font-size: 14px; }
.headline-meta { font-size: 12.5px; color: #6f6e68; border-top: 1px solid #e0ddd3; padding-top: 12px; }
.sub-head { display: flex; justify-content: space-between; margin: 30px 0 12px; }

.card-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px; }
.card {
  display: flex; flex-direction: column; border-radius: 16px; overflow: hidden; background: var(--surface); border: 1px solid var(--border);
  text-decoration: none; color: var(--text); cursor: pointer; transition: transform .15s, border-color .15s, box-shadow .15s;
}
.card:hover { transform: translateY(-3px); border-color: var(--accent); box-shadow: 0 14px 34px rgba(0,0,0,.14); }
.card-cover .cover { border-radius: 0; }
.card-body { padding: 14px 16px; display: flex; flex-direction: column; gap: 6px; flex: 1; }
.card-meta { font-family: var(--mono); font-size: 11px; color: var(--muted); display: flex; align-items: center; gap: 6px; }
.card-meta i { font-style: normal; opacity: .5; }
.card h3 { margin: 0; font-size: 17px; line-height: 1.4; }
.card p { margin: 0; font-size: 13px; color: var(--muted); line-height: 1.6; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.card-foot { margin-top: auto; padding-top: 10px; border-top: 1px solid var(--border); display: flex; justify-content: space-between; font-size: 12px; color: var(--muted); }
.topic:hover { border-color: var(--accent); }
.go { font-size: 18px; color: var(--muted); }

/* 三大板块 */
.soon-tag { font-family: var(--mono); font-size: 10px; letter-spacing: .06em; padding: 1px 7px; border-radius: 999px; border: 1px dashed currentColor; color: var(--muted); white-space: nowrap; }
.sidebar .soon-tag { color: var(--side-muted); }
.part-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 4px; }
.part-chips span { font-size: 12px; padding: 2px 9px; border-radius: 999px; background: var(--surface-2); color: var(--text); }
.part-chips span.soon { background: none; border: 1px dashed var(--border); color: var(--muted); }
.track-card p { -webkit-line-clamp: 3; }

.courses .sub-head .mono { display: flex; align-items: center; gap: 8px; }
.track-tabs { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 18px; }
.track-tabs button {
  font: inherit; font-size: 14px; font-weight: 700; display: inline-flex; align-items: center; gap: 8px; padding: 9px 16px; cursor: pointer;
  border-radius: 999px; border: 1px solid var(--border); background: var(--surface); color: var(--text);
}
.track-tabs button small { font-family: var(--mono); font-size: 11px; font-weight: 400; color: var(--muted); }
.track-tabs button.on { background: var(--text); color: var(--bg); border-color: var(--text); }
.track-tabs button.on small { color: inherit; opacity: .7; }
.track-intro { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr); border-radius: 18px; overflow: hidden; border: 1px solid var(--border); background: var(--surface); margin-bottom: 8px; }
.track-intro-cover .cover { height: 100%; border-radius: 0; }
.track-intro-body { padding: 28px 30px; display: flex; flex-direction: column; gap: 10px; align-items: flex-start; }
.track-intro-body h3 { margin: 0; font-size: 30px; font-weight: 900; }
.track-intro-body p { margin: 0; color: var(--muted); line-height: 1.75; }
.track-stats { font-size: 14px; color: var(--muted); margin-bottom: 8px; }
.track-stats b { color: var(--text); font-size: 18px; }
.track-stats span { margin: 0 8px; opacity: .5; }
.track-intro .btn-xl.ghost { color: var(--text); border-color: var(--text); }
.plan-list { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.plan-list li { display: flex; align-items: center; gap: 12px; padding: 14px 16px; border-radius: 12px; border: 1px dashed var(--border); color: var(--muted); font-size: 14px; }
.plan-list .ep { font-family: var(--mono); font-size: 11px; opacity: .7; }

.filters { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 12px; }
.filters button { font: inherit; font-size: 13px; padding: 4px 14px; border-radius: 999px; border: 1px solid var(--border); background: var(--surface); color: var(--text); cursor: pointer; }
.filters button.on { background: var(--text); color: var(--bg); border-color: var(--text); }
.topic-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 12px; }
.topic {
  display: flex; flex-direction: column; gap: 2px; padding: 18px; min-height: 150px; cursor: pointer; text-decoration: none; color: var(--text);
  background: var(--surface); border: 1px solid var(--border); border-radius: 14px; position: relative; overflow: hidden;
}
.topic::after { content: ""; position: absolute; right: -24px; bottom: -24px; width: 84px; height: 84px; border-radius: 50%; background: var(--c); opacity: .18; }
.topic h3 { margin: 18px 0 0; font-size: 20px; }
.topic .en { font-family: var(--mono); font-size: 10px; letter-spacing: .14em; color: var(--c); }
.topic .count { margin-top: auto; font-size: 12.5px; color: var(--muted); }

.join { margin-top: 50px; text-align: center; padding: 50px 24px; border-radius: 22px; background: var(--cream); color: var(--ink); }
.join .kicker { color: #6f6e68; }
.join h2 { font-size: clamp(30px, 4vw, 46px); font-weight: 900; margin: 8px 0 10px; }
.join p { max-width: 560px; margin: 0 auto 24px; color: #5f5e5a; }
.join .hero-cta { justify-content: center; }
.foot { margin-top: 30px; text-align: center; font-size: 12px; color: var(--muted); }

/* ============================================================ 学习中心 */
#view-learn { grid-template-columns: minmax(0, 1fr) 0; position: relative; transition: grid-template-columns .2s; }
#view-learn.term-open { grid-template-columns: minmax(0, 1fr) 440px; }
.lesson-main { overflow: auto; padding: 28px 30px 60px; }
.article { max-width: 760px; margin: 0 auto; }
.article-crumb { margin-bottom: 18px; }
.lesson-cover { border-radius: 16px; overflow: hidden; border: 1px solid var(--border); }
.lesson-cover .cover { border-radius: 0; }
.tagrow { display: flex; gap: 10px; align-items: center; }
.article .tagrow { margin-top: 22px; flex-wrap: wrap; }
.badge-solid { background: #3b5bff; color: #fff; font-size: 12px; font-weight: 700; padding: 2px 10px; border-radius: 6px; }
.badge-line { border: 1px solid var(--text); font-size: 12px; font-weight: 600; padding: 1px 9px; border-radius: 6px; }
.article h1 { font-size: clamp(30px, 4vw, 44px); line-height: 1.2; font-weight: 900; letter-spacing: -.01em; margin: 14px 0 12px; }
.lede { font-size: 16px; color: var(--muted); line-height: 1.8; margin: 0 0 22px; }
.chapters { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 10px; padding: 14px 16px; background: var(--surface); border: 1px solid var(--border); border-radius: 12px; }
.chapters::before { content: "本讲目录"; width: 100%; font-family: var(--mono); font-size: 11px; letter-spacing: .12em; color: var(--muted); }
.chapters:empty { display: none; }
.chip { border: 1px solid var(--border); background: var(--surface); border-radius: 999px; padding: 3px 11px; font-size: 13px; cursor: pointer; color: var(--text); }
.chip:hover { border-color: var(--accent); color: var(--accent); }
.chip .t { color: var(--muted); font-family: var(--mono); font-size: 12px; margin-right: 4px; }
.pager { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 48px; padding-top: 22px; border-top: 1px solid var(--border); }
.pager button {
  display: flex; flex-direction: column; gap: 6px; text-align: left; padding: 16px 18px; border-radius: 14px; cursor: pointer; font: inherit;
  background: var(--surface); border: 1px solid var(--border); color: var(--text);
}
.pager button:hover { border-color: var(--accent); }
.pager #next-lesson { text-align: right; align-items: flex-end; }
.pager button:disabled { visibility: hidden; }
.pager b { font-size: 15px; }
.lecture { max-width: none; }
.lecture h1 { display: none; }
.lecture h2 { font-size: 24px; font-weight: 900; margin: 44px 0 14px; padding: 2px 0 2px 14px; border-left: 4px solid #3b5bff; line-height: 1.35; }
.lecture h3 { font-size: 18px; margin: 28px 0 8px; }
.lecture h2.flash { animation: flash 1.6s ease; }
@keyframes flash { 0%, 40% { background: var(--accent-soft); } 100% { background: transparent; } }
/* 讲义里的表格同样是三线表 */
.lecture table { border-collapse: collapse; margin: 12px 0; font-size: 14px; border-top: 1.5px solid var(--text); border-bottom: 1.5px solid var(--text); }
.lecture th, .lecture td { padding: 5px 12px; text-align: center; }
.lecture th:first-child, .lecture td:first-child { text-align: left; }
.lecture th { font-weight: 600; border-bottom: 1px solid var(--text); }
.lecture { font-size: 16px; line-height: 1.9; }
.lecture p { margin: 12px 0; }
.lecture blockquote {
  margin: 16px 0; padding: 12px 18px; border-left: 4px solid var(--accent); border-radius: 0 12px 12px 0;
  background: var(--accent-soft); color: var(--text);
}
.lecture blockquote p { margin: 4px 0; }
.lecture blockquote strong:first-child { color: var(--accent); }
.lecture pre { position: relative; background: var(--code-bg); color: var(--code-text); padding: 14px 16px; border-radius: var(--radius); overflow: auto; font-size: 13px; line-height: 1.55; }
.lecture pre code { background: none; padding: 0; color: inherit; }
.lecture pre .try { position: absolute; top: 8px; right: 8px; font-size: 12px; padding: 3px 10px; background: #534ab7; color: #fff; border: 0; border-radius: 6px; cursor: pointer; }

.terminal { border-left: 1px solid var(--border); display: flex; flex-direction: column; min-height: 0; min-width: 0; overflow: hidden; background: var(--surface); }
#view-learn:not(.term-open) .terminal { visibility: hidden; }
.term-head .icon-btn { width: 28px; height: 28px; font-size: 12px; margin-left: 8px; }
.term-head .muted { margin-left: auto; }
.term-fab {
  position: absolute; right: 24px; bottom: 24px; z-index: 5; display: inline-flex; align-items: center; gap: 10px; cursor: pointer; font: inherit;
  font-size: 14px; font-weight: 700; padding: 11px 20px; border-radius: 999px; border: 0; background: var(--text); color: var(--bg);
  box-shadow: 0 10px 30px rgba(0,0,0,.25);
}
.term-fab span { font-family: var(--mono); color: #8f87ee; }
#view-learn.term-open .term-fab { display: none; }
.term-head { display: flex; align-items: center; padding: 10px 14px; border-bottom: 1px solid var(--border); font-weight: 600; }
#code {
  flex: 0 0 42%; resize: vertical; border: 0; outline: 0; padding: 12px 14px; font-family: var(--mono); font-size: 13px;
  background: var(--code-bg); color: var(--code-text); line-height: 1.55; tab-size: 4;
}
.term-actions { display: flex; gap: 8px; padding: 8px 14px; border-bottom: 1px solid var(--border); }
.output { flex: 1; overflow: auto; padding: 10px 14px; font-family: var(--mono); font-size: 13px; white-space: pre-wrap; }
.output .err { color: var(--bad); }
.output .sys { color: var(--muted); }
.output img { max-width: 100%; background: #fff; border-radius: 6px; margin: 6px 0; display: block; }
.output .run-sep { border-top: 1px dashed var(--border); margin: 8px 0; }

/* 讲义：思维导图 */
.mindmap-wrap { overflow-x: auto; margin: 14px 0; padding: 16px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); }
.mindmap { display: block; }
.mindmap .mm-link { fill: none; stroke: var(--border); stroke-width: 1.6; }
.mindmap .mm-node rect { fill: var(--bg); stroke: var(--border); stroke-width: 1.2; }
.mindmap .mm-node text { font-size: 14px; fill: var(--text); }
.mindmap .mm-node.root rect { fill: var(--accent); stroke: var(--accent); }
.mindmap .mm-node.root text { fill: var(--on-accent); font-weight: 600; }
.mindmap .mm-node.leaf rect { fill: var(--surface-2); }
.mindmap .mm-node.linked { cursor: pointer; }
.mindmap .mm-node.linked rect { stroke-width: 2; }
.mindmap .mm-node.linked:hover rect { fill: var(--accent-soft); }

/* 讲义：互动组件 */
.widget { margin: 16px 0; padding: 16px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); }
.w-head { display: flex; gap: 10px; align-items: baseline; flex-wrap: wrap; margin-bottom: 10px; }
.w-controls { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.w-controls select { font: inherit; border-radius: 6px; border: 1px solid var(--border); background: var(--surface); color: var(--text); }
.seg { display: inline-flex; flex-wrap: wrap; border: 1px solid var(--border); border-radius: 8px; overflow: hidden; }
.seg button { border: 0; border-right: 1px solid var(--border); background: var(--surface); color: var(--text); padding: 5px 12px; font: inherit; font-size: 14px; cursor: pointer; }
.seg button:last-child { border-right: 0; }
.seg button:hover { background: var(--surface-2); }
.seg button.on { background: var(--accent); color: var(--on-accent); }
.w-plots { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 10px; }
.w-plots > div { height: 290px; }
.w-stats { display: flex; flex-wrap: wrap; gap: 6px 18px; font-size: 14px; margin: 6px 0; }
.w-explain h4 { margin: 12px 0 4px; }
.w-explain p, .w-quiz p { margin: 6px 0; }
.w-quiz { margin-top: 10px; }

/* ============================================================ 分析助手 */
#view-analyze { grid-template-columns: minmax(0, 1fr) 280px; }
.chat { display: flex; flex-direction: column; min-height: 0; }
.messages { flex: 1; overflow: auto; padding: 22px 30px; display: flex; flex-direction: column; gap: 14px; }
.msg { max-width: 880px; }
.msg.user { align-self: flex-end; background: var(--accent); color: var(--on-accent); padding: 9px 14px; border-radius: 14px 14px 4px 14px; }
.msg.bot { align-self: flex-start; background: var(--surface); border: 1px solid var(--border); padding: 12px 16px; border-radius: 4px 14px 14px 14px; width: 100%; }
.msg.bot p { margin: 4px 0 8px; }
.msg.bot h4 { margin: 10px 0 6px; font-size: 14px; }
.msg.bot ul { margin: 4px 0 8px; padding-left: 20px; }
.msg .actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
.msg details.process > summary { cursor: pointer; display: flex; gap: 10px; align-items: baseline; flex-wrap: wrap; }
.msg .process-body { margin-top: 10px; display: flex; flex-direction: column; gap: 10px; }
.msg .process-body > .msg.bot { max-width: none; }
.msg .report-head { display: flex; gap: 10px; align-items: baseline; flex-wrap: wrap; margin-bottom: 8px; }
.msg .report-frame { width: 100%; height: 640px; border: 1px solid var(--border); border-radius: 8px; background: #fff; display: block; }
/* 对话里的表格也用三线表：顶线、底线粗，表头下一条细线，中间不画线 */
.msg table { border-collapse: collapse; font-size: 13px; margin: 6px 0; width: 100%; border-top: 1.5px solid var(--text); border-bottom: 1.5px solid var(--text); }
.msg th, .msg td { padding: 5px 8px; text-align: center; white-space: nowrap; }
.msg td { white-space: normal; min-width: 3.5em; }
.msg thead th { border-bottom: 1px solid var(--text); }
.msg .issue-table th, .msg .issue-table td { white-space: normal; text-align: left; }
.msg .issue-table td:nth-child(2) { white-space: nowrap; }
.msg th:first-child, .msg td:first-child { text-align: left; }
.msg th { color: var(--muted); font-weight: 500; }
.table-scroll { overflow-x: auto; }
.msg .plot { width: 100%; height: 340px; }
.plots { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 8px; }
.badge { display: inline-block; font-size: 12px; padding: 1px 8px; border-radius: 999px; }
.badge.ok { background: var(--ok-soft); color: var(--ok); }
.badge.bad { background: var(--bad-soft); color: var(--bad); }
.callout { padding: 8px 12px; border-radius: 8px; margin: 8px 0; font-size: 14px; }
.callout.warn { background: var(--warn-soft); color: var(--warn); }
.callout.ok { background: var(--ok-soft); color: var(--ok); }
.callout.info { background: var(--accent-soft); color: var(--accent); }
.decision { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin: 8px 0; }
.decision .step { padding: 3px 10px; border-radius: 6px; background: var(--surface-2); font-size: 13px; }
.decision .step.final { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.decision .arrow { color: var(--muted); }
.kn { cursor: pointer; border-bottom: 1px dashed var(--accent); color: var(--accent); }
.form-row { display: flex; gap: 12px; flex-wrap: wrap; align-items: center; margin: 8px 0; }
.form-row select, .form-row input { font: inherit; padding: 4px 8px; border-radius: 6px; border: 1px solid var(--border); background: var(--surface); color: var(--text); }
.form-row input { width: 90px; }
.form-row select:disabled { opacity: .7; }
.typing { color: var(--muted); font-size: 14px; }
.composer { display: flex; gap: 8px; padding: 12px 30px 18px; border-top: 1px solid var(--border); background: var(--bg); }
.composer input { flex: 1; font: inherit; padding: 10px 16px; border-radius: 999px; border: 1px solid var(--border); background: var(--surface); color: var(--text); outline: 0; }
.composer input:focus { border-color: var(--accent); }
.composer .btn { border-radius: 999px; padding: 6px 20px; }
.flow { border-left: 1px solid var(--border); padding: 4px 18px 20px; overflow: auto; background: var(--surface); }
.side-title { font-family: var(--mono); font-size: 11px; letter-spacing: .12em; color: var(--muted); margin: 16px 0 8px; }
.steps { list-style: none; padding: 0; margin: 0; }
.steps li { padding: 6px 0 6px 26px; position: relative; color: var(--muted); font-size: 14px; }
.steps li::before { content: ""; position: absolute; left: 4px; top: 12px; width: 10px; height: 10px; border-radius: 50%; border: 2px solid var(--border); background: var(--surface); }
.steps li.done { color: var(--text); }
.steps li.done::before { background: var(--ok); border-color: var(--ok); }
.steps li.current { color: var(--accent); font-weight: 600; }
.steps li.current::before { border-color: var(--accent); background: var(--accent-soft); }
.related { display: flex; flex-direction: column; gap: 6px; }
.related .rel { border: 1px solid var(--border); border-radius: 8px; padding: 7px 10px; font-size: 13px; cursor: pointer; background: var(--bg); }
.related .rel:hover { border-color: var(--accent); }
.related .rel b { display: block; font-size: 14px; }
.member { font-size: 13.5px; }
.member .member-status { margin-bottom: 6px; line-height: 1.6; }
.member details summary { cursor: pointer; color: var(--accent); font-size: 13px; margin: 4px 0; }
.member .form-row { margin: 6px 0; }
.member .form-row .redeem-code { width: 100%; }
.form-row .redeem-code { font-family: var(--mono); letter-spacing: .04em; text-transform: uppercase; padding: 6px 10px; width: 16ch; border-radius: 8px; border: 1px solid var(--border); background: var(--surface); color: var(--text); }
.ok-text { color: var(--ok); }
.bad-text { color: var(--bad); }
.setting { display: flex; justify-content: space-between; align-items: center; font-size: 14px; margin-bottom: 10px; }
.setting select { font: inherit; border-radius: 6px; border: 1px solid var(--border); background: var(--surface); color: var(--text); }

/* ============================================================ 知识图谱 */
#view-graph { grid-template-columns: minmax(0, 1fr) 320px; }
.graph-wrap { position: relative; min-height: 0; }
#graph { width: 100%; height: 100%; display: block; }
#graph .link { stroke: var(--border); stroke-width: 1.4; }
#graph .link.alt { stroke-dasharray: 4 4; }
#graph .link.hl { stroke: var(--accent); stroke-width: 2.6; }
#graph .col-title { font-family: var(--mono); font-size: 12px; fill: var(--muted); letter-spacing: .08em; }
#graph .node circle { stroke: var(--bg); stroke-width: 2; cursor: pointer; }
#graph .node text { font-size: 13px; fill: var(--text); pointer-events: none; paint-order: stroke; stroke: var(--bg); stroke-width: 4px; }
#graph .node.dim { opacity: .3; }
#graph .node.hl circle { stroke: var(--accent); stroke-width: 3.5; }
#graph .node.sel circle { stroke: var(--text); stroke-width: 3; }
.legend { position: absolute; left: 16px; bottom: 14px; display: flex; flex-wrap: wrap; gap: 12px; font-size: 12px; color: var(--muted); background: var(--surface); padding: 6px 12px; border-radius: 8px; border: 1px solid var(--border); }
.legend span::before { content: ""; display: inline-block; width: 10px; height: 10px; border-radius: 50%; background: var(--c); margin-right: 5px; vertical-align: -1px; }
.node-card { border-left: 1px solid var(--border); padding: 20px; overflow: auto; background: var(--surface); }
.node-card h3 { margin: 0 0 4px; font-size: 20px; }
.node-card .cat { font-family: var(--mono); font-size: 11px; color: var(--muted); }
.node-card .links { display: flex; flex-direction: column; gap: 8px; margin-top: 16px; }
.node-card .rels { margin-top: 18px; font-size: 13px; }
.node-card .rels div { margin: 4px 0; }


/* ============================================================ 窄屏 */
@media (max-width: 1100px) {
  /* 窄屏终端改成盖在讲义上的抽屉 */
  #view-learn, #view-learn.term-open { grid-template-columns: minmax(0, 1fr); overflow: hidden; }
  .terminal { position: absolute; right: 0; top: 0; bottom: 0; width: min(440px, 100%); z-index: 6; transform: translateX(100%); transition: transform .2s; box-shadow: -20px 0 40px rgba(0,0,0,.25); }
  #view-learn.term-open .terminal { transform: none; }
  .card-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .headline, .track-intro { grid-template-columns: 1fr; }
  .plan-list { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .headline-cover .cover { min-height: 0; aspect-ratio: 16 / 9; }
}
@media (max-width: 960px) {
  .app { grid-template-columns: 1fr; }
  .sidebar { position: fixed; z-index: 30; left: 0; top: 0; bottom: 0; width: 272px; transform: translateX(-100%); transition: transform .2s; }
  .sidebar.open { transform: none; }
  .scrim.open { display: block; position: fixed; inset: 0; z-index: 25; background: rgba(0, 0, 0, .45); }
  #menu { display: inline-grid; }
  .hero { grid-template-columns: 1fr; padding: 32px 26px; }
  .hero-art { order: -1; }
  .art { max-width: 320px; }
  #view-analyze { grid-template-columns: 1fr; }
  .flow { display: none; }
  #view-graph { grid-template-columns: 1fr; grid-template-rows: 62vh auto; overflow: auto; }
  .node-card { border-left: 0; border-top: 1px solid var(--border); }
}
@media (max-width: 640px) {
  .view.home.active { padding: 16px 16px 30px; }
  .marquee { margin: 20px -16px 6px !important; }
  .sec-head { grid-template-columns: 1fr; gap: 4px; }
  .sec-meta { text-align: left; }
  .sec-head h2 { font-size: 28px; }
  .card-grid, .plan-list { grid-template-columns: 1fr; }
  .track-intro-body { padding: 22px 20px; }
  .headline-body { padding: 22px 20px; }
  .headline-body h3 { font-size: 24px; }
  .pager { grid-template-columns: 1fr; }
  .term-fab { right: 16px; bottom: 16px; }
  .lesson-main, .messages { padding: 14px 16px; }
  .composer { padding: 10px 16px; }
  .topbar { padding: 10px 16px; }
  .crumb #crumb-brand { display: none; }
  .w-plots { grid-template-columns: 1fr; }
  .hero h1 { font-size: 44px; }
}
