/* ==========================================================================
   guide-uestc.css — uestc_ai skin for the AI 研究入门指南 second edition.

   Hand-maintained subset of D:\Project\uestc_ai\app\globals.css. That file
   cannot be linked or @import-ed: it opens with `@import "tailwindcss"`, which
   needs a bundler and this repo has no build tooling beyond `marked`. So the
   values are COPIED, not shared — when globals.css changes, re-check:
     tokens      globals.css:3-18      (palette)
     shell       globals.css:31-107    (.app-shell / sidebar / topbar / band)
     buttons     globals.css:81-93
     markdown    globals.css:288-301   (.markdown-body)
     article     globals.css:503-510   (.article-layout)
     responsive  globals.css:856-929

   This file is linked LAST, after guide.css, fieldnotes.css and
   guide-motion.css, so equal-specificity rules here win by source order. Three
   things that order does NOT solve, handled explicitly below:
     · `html[data-theme=dark]` is (0,1,1) and beats a plain `:root` (0,1,0)
       whatever the order — see the neutralize block.
     · `#nav`, `#toc`, `#opensearch`, `#menu`, `#mobile-search`, `#closesearch`,
       `#searchinput`, `#results`, `#ama-app` are id selectors (1,0,0) in the
       three stylesheets; every one is re-declared here at id specificity.
     · 21 `!important` declarations exist upstream; the two that matter are
       re-issued with `!important` in the same place they fight.

   DELIBERATE DEVIATIONS from uestc_ai, both for long-form reading:
     · article prose is 15px, not globals.css's 12px `.markdown-body p`. A
       5,000-word essay at 12px is unusable; 15px sits between uestc_ai's 14px
       body and the guide's original 16px.
     · uestc_ai is light-only, so the theme toggle is emitted `hidden` (the
       element must still exist — guide.js:3 dereferences it first thing) and
       `--theme`-driven dark mode is neutralized rather than derived.
   ========================================================================== */

/* --- 1. Tokens ----------------------------------------------------------- */
:root {
  /* uestc_ai palette (globals.css:3-18) */
  --paper: #f4f1ea;
  --paper-2: #e8e4db;
  --surface: #fbfaf7;
  --ink: #20211e;
  --ink-2: #454740;
  --muted: #777a72;
  --quiet: #96988f;
  --line: #d5d1c8;
  --line-dark: #bdb9b0;
  --coral: #c85c42;
  --coral-dark: #a94833;
  --sage: #768c73;
  --sand: #d6b371;
  --danger: #a94438;

  /* Guide token names, aliased onto the palette above. Redefining these is
     what re-skins every existing fragment — including the canvas animations,
     which read them via getComputedStyle (guide-motion.js:7-9). */
  --blue: var(--coral);        /* primary accent, 51 uses upstream */
  --orange: var(--sand);       /* secondary accent, 7 uses */
  --card: var(--surface);      /* 13 uses */
  --side: 242px;               /* uestc_ai's .app-shell column */

  /* --soft is color-mix(--ink 18%, transparent) upstream — an 18% wash that
     reads far heavier than uestc_ai's opaque hairlines, so pin it. */
  --soft: var(--line);

  --serif: Georgia, "Times New Roman", "Songti SC", SimSun, serif;
  --sans: "Avenir Next", "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;

  /* Canvas palette. --motion-result is the canvas "success" colour; left
     derived it becomes color-mix(#c85c42 42%, #20211e) ≈ #7a3e2f, a muddy
     brown. Sage is on-brand and legible on --paper-2. */
  --motion-primary: var(--coral);
  --motion-result: var(--sage);
  --motion-signal: var(--coral-dark);
  --motion-line: var(--line);
}

/* Dark mode is unreachable — the shell omits the bootstrap script that sets
   data-theme, and <meta name="color-scheme" content="light"> pins form
   controls. This block exists only to beat guide.css:2 and guide.css:17 on
   specificity if the attribute is ever set anyway (stale cache, extension),
   plus to kill the two !important dark rules upstream. */
html[data-theme=dark] {
  --paper: #f4f1ea;
  --paper-2: #e8e4db;
  --card: #fbfaf7;
  --ink: #20211e;
  --muted: #777a72;
  --line: #d5d1c8;
  --blue: #c85c42;
  --orange: #d6b371;
  --soft: #d5d1c8;
  --serif: Georgia, "Times New Roman", "Songti SC", SimSun, serif;
}
html[data-theme=dark] #ama-app .ama-primary { color: var(--paper) !important; }
html[data-theme=dark] .community-logo { filter: none; }

/* --- 2. Base ------------------------------------------------------------- */
body {
  background: var(--paper);
  background-image: none;                  /* kill guide.css:3's dot texture */
  color: var(--ink);
  font: 15px/1.7 var(--sans);
  -webkit-font-smoothing: antialiased;
}
::selection { background: #e8b5a8; color: var(--ink); }
a:hover { color: var(--coral); }
button { border: 0; }                      /* guide.css:3 borders every button */
button:focus-visible, a:focus-visible, summary:focus-visible, input:focus-visible {
  outline: 2px solid var(--coral);
  outline-offset: 3px;
}
.skip { background: var(--ink); color: var(--paper); }

/* --- 3. Shell geometry --------------------------------------------------- */
.app-shell {
  display: grid;
  grid-template-columns: var(--side) minmax(0, 1fr);
  min-height: 100dvh;
}
.app-main { min-width: 0; }

/* #nav keeps its id (guide.js:5,7 set inert/aria on it) and is re-declared at
   id specificity because guide.css:5 also targets `#nav`. */
#nav.app-sidebar {
  position: sticky;
  inset: auto;
  top: 0;
  width: auto;
  height: 100dvh;
  padding: 25px 16px 17px;
  border-right: 1px solid var(--line);
  background: var(--paper-2);
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  z-index: 20;
}
.brand-lockup { align-items: center; display: flex; gap: 11px; min-width: 0; padding: 0 8px 35px; }
.brand-mark { align-items: center; display: flex; flex: 0 0 40px; height: 40px; justify-content: center; overflow: hidden; width: 40px; }
.brand-mark img { border-radius: 50%; height: 100%; object-fit: contain; width: 100%; }
.brand-copy { min-width: 0; }
.brand-copy strong, .brand-copy small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.brand-copy strong { font-size: 14px; font-weight: 650; letter-spacing: 0; }
.brand-copy small { color: var(--quiet); font-size: 12px; letter-spacing: .12em; margin-top: 2px; }

#opensearch {
  width: 100%;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  padding: 8px 0;
  margin: 0 0 26px;
  background: transparent;
  border: 0;
  border-bottom: 1px solid var(--line-dark);
  color: var(--quiet);
  font-size: 13px;
  text-align: left;
}
#opensearch:hover { color: var(--ink); border-bottom-color: var(--ink); }
#opensearch kbd { font: 11px/1 ui-monospace, SFMono-Regular, Consolas, monospace; color: var(--quiet); }

/* Grouped nav. .navgroup keeps its class — initNavigation() (guide-motion.js:828)
   makes it a toggle and walks its following <a> siblings. */
.navgroup {
  color: #9b9d94;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .14em;
  text-transform: uppercase;
  margin: 22px 9px 9px;
  padding: 0 2px;
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.navgroup:first-of-type { margin-top: 0; }
.navgroup:after { content: '−'; font-size: 15px; color: var(--quiet); }
.navgroup[aria-expanded=false]:after { content: '+'; }

/* The collapsible links. #nav>a.nav-collapsed (guide-motion.css:5) is a child
   selector, so these must stay DIRECT children of #nav. */
#nav > a {
  display: block;
  padding: 9px 11px;
  margin: 2px 0;
  font-size: 13px;
  line-height: 1.5;
  color: #65685f;
  border: 0;
  border-radius: 3px;
  transition: background .18s ease, color .18s ease, transform .18s ease;
}
#nav > a:hover { background: rgba(255, 255, 255, .55); color: var(--ink); transform: translateX(2px); }
#nav > a[aria-current=page] { background: var(--ink); color: var(--paper); font-weight: 600; }
#nav > a[aria-current=page]:hover { transform: none; color: var(--paper); }
#nav > a.nav-collapsed { max-height: 0; opacity: 0; overflow: hidden; padding-top: 0; padding-bottom: 0; margin-top: 0; margin-bottom: 0; pointer-events: none; }
.sidebar-source { margin: auto 8px 0; padding-top: 20px; font: 11px/1.6 ui-monospace, SFMono-Regular, Consolas, monospace; color: var(--quiet); }
.sidebar-source a { color: inherit; }
.sidebar-source a:hover { color: var(--coral); }

.app-topbar {
  align-items: center;
  background: rgba(244, 241, 234, .92);
  border-bottom: 1px solid var(--line);
  display: flex;
  height: 62px;
  justify-content: space-between;
  padding: 0 42px;
  position: sticky;
  top: 0;
  z-index: 12;
  backdrop-filter: blur(14px);
}
.topbar-context { align-items: center; color: var(--quiet); display: flex; font-size: 12px; gap: 8px; min-width: 0; }
.topbar-context i { color: var(--line-dark); font-style: normal; }
.topbar-context strong { color: var(--ink-2); font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.topbar-context a:hover { color: var(--coral); }
.topbar-actions { align-items: center; display: flex; gap: 8px; }
.icon-button { align-items: center; background: transparent; border: 0; display: inline-flex; height: 34px; justify-content: center; padding: 0 10px; font-size: 13px; color: var(--ink-2); }
.icon-button:hover { background: rgba(32, 33, 30, .06); color: var(--ink); }
#language.outline-button { background: transparent; border: 1px solid var(--line-dark); color: var(--ink-2); font-size: 12px; padding: 7px 11px; min-height: 0; }
#language.outline-button:hover { background: var(--surface); border-color: var(--ink); color: var(--ink); }
/* .icon-button sets display:inline-flex, which beats the UA [hidden] rule —
   the theme toggle must be forced out explicitly or it reappears. */
#theme[hidden] { display: none !important; }

.page-title-band { align-items: end; border-bottom: 1px solid var(--line); display: flex; min-height: 156px; padding: 37px 50px 32px; }
.page-title-band > div { margin: 0 auto; max-width: 1260px; width: 100%; }
.page-title-band h1 {
  font-family: var(--serif);
  font-size: 42px;
  font-weight: 400;
  letter-spacing: 0;
  line-height: 1.1;
  margin: 13px 0 0;
  max-width: 900px;
  overflow-wrap: anywhere;
  color: var(--ink);
}
html[lang=zh-CN] .page-title-band h1 { font-size: 40px; }
.eyebrow { align-items: center; color: var(--quiet); display: flex; font-size: 12px; gap: 9px; letter-spacing: .14em; text-transform: uppercase; }
.eyebrow i { background: var(--coral); display: inline-block; height: 1px; width: 23px; }
.home-logo { display: block; width: 52px; height: auto; margin: 0 0 14px; float: none; }

main.app-content { margin: 0 auto; max-width: 1360px; min-height: calc(100dvh - 280px); padding: 43px 50px 80px; }
.app-footer { border-top: 1px solid var(--line); color: var(--quiet); display: flex; font-size: 12px; justify-content: space-between; gap: 20px; margin: 0 42px; padding: 21px 0 24px; }
.app-footer a { margin-left: 18px; }
.app-footer a:first-child { margin-left: 0; }
.app-footer a:hover { color: var(--coral); }

/* Sidebar scrim. The guide's own `.shade` rules (guide.css:9,12) don't match
   because the element carries id #shade and class .sidebar-scrim; the open
   state is body.navopen (guide.js:5,7), not uestc_ai's .is-open. */
#shade { display: none; }

/* guide.css styles #menu and #mobile-search at ID specificity, so the
   .icon-button class alone loses. #mobile-search in particular is pinned there as
   a floating FAB (position:fixed + bottom/right + an ink pill with an offset
   shadow) — in the uestc shell it is a topbar action, and left as-is it floated
   over the bar covering the hamburger entirely (46x28px overlap), which is what
   made the mobile nav look absent. These overrides have to be id-level too. */
#menu, #mobile-search {
  display: none;
  position: static;
  inset: auto;
  z-index: auto;
  background: transparent;
  border: 0;
  box-shadow: none;
  height: 34px;
  padding: 0 9px;
  font-size: 13px;
  color: var(--ink-2);
}
#menu:hover, #mobile-search:hover { background: rgba(32, 33, 30, .06); color: var(--ink); }

/* --- 4. Article ---------------------------------------------------------- */
.article-layout { display: grid; gap: 65px; grid-template-columns: minmax(0, 800px) 190px; justify-content: center; align-items: start; }
.markdown-body { max-width: none; padding: 0; min-width: 0; overflow-wrap: break-word; }
.markdown-body h1 { font-family: var(--serif); font-size: 30px; font-weight: 500; margin: 0 0 21px; color: var(--ink); }
.markdown-body h2 {
  border-bottom: 1px solid var(--line);
  border-top: 0;
  font-family: var(--serif);
  font-size: 25px;
  font-weight: 500;
  letter-spacing: 0;
  line-height: 1.3;
  margin: 40px 0 16px;
  padding: 0 0 9px;
  color: var(--ink);
}
.markdown-body h3 { font-size: 16px; font-weight: 650; line-height: 1.5; margin: 29px 0 10px; color: var(--ink); }
.markdown-body p, .markdown-body li { color: #5e6159; font-size: 15px; line-height: 1.85; }
.markdown-body p { margin: 0 0 22px; }
.markdown-body ul, .markdown-body ol { padding-left: 24px; margin: 15px 0 26px; }
.markdown-body li { margin: 10px 0; }
.markdown-body li::marker { color: var(--quiet); }
.markdown-body a { color: var(--coral-dark); text-decoration: underline; text-underline-offset: 3px; }
.markdown-body a:hover { color: var(--coral); }
.markdown-body strong { font-weight: 650; color: var(--ink-2); }
.markdown-body blockquote { border-left: 3px solid var(--sand); background: transparent; margin: 26px 0; padding: 4px 0 4px 18px; }
.markdown-body blockquote p:last-child { margin-bottom: 0; }
.markdown-body code { background: #ebe7df; color: #8f4937; font: 13px/1.6 ui-monospace, SFMono-Regular, Consolas, monospace; padding: 2px 5px; }
.markdown-body pre { background: var(--ink); color: #e9e6dd; overflow-x: auto; padding: 17px; border: 0; }
.markdown-body pre code { background: transparent; color: inherit; padding: 0; }
.markdown-body img { border: 1px solid var(--line); display: block; height: auto; margin: 19px 0; max-width: 100%; }
.markdown-body hr { border: 0; border-top: 1px solid var(--line); margin: 35px 0; }
.markdown-body table { border-collapse: collapse; width: 100%; font-size: 14px; }
.markdown-body th, .markdown-body td { border: 1px solid var(--line); padding: 9px 11px; text-align: left; }
.markdown-body th { background: var(--surface); font-weight: 600; color: var(--ink-2); }

/* In-page TOC. Re-declared at id specificity to beat guide.css:6 (`#toc`) and
   guide.css:8 (`body.home #toc`). uestc_ai puts the aside on the left; the DOM
   order already matches, so no reordering is needed. */
#toc { position: sticky; top: 86px; align-self: start; max-height: calc(100dvh - 120px); overflow: auto; border-top: 1px solid var(--line-dark); padding-top: 15px; font-size: 12px; }
#toc strong { display: block; font: 700 10px/1.5 ui-monospace, SFMono-Regular, Consolas, monospace; color: var(--quiet); text-transform: uppercase; letter-spacing: .1em; margin-bottom: 16px; }
#toc a { display: block; line-height: 1.6; margin-bottom: 12px; color: var(--muted); border: 0; }
#toc a:hover { color: var(--coral); }
#toc a.is-current { color: var(--coral-dark); font-weight: 600; }
body.home #toc { display: none; }
body.home .article-layout { grid-template-columns: minmax(0, 900px); }

.neighbors { margin-top: 65px; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); display: grid; grid-template-columns: 1fr 1fr; gap: 26px; padding: 20px 0; }
.neighbors a { display: flex; flex-direction: column; font-size: 14px; line-height: 1.6; color: var(--ink-2); }
.neighbors a:hover { color: var(--coral); }
.neighbors a:last-child { text-align: right; }
.neighbors small { color: var(--quiet); font: 11px/1.6 ui-monospace, SFMono-Regular, Consolas, monospace; margin-bottom: 7px; }

/* --- 5. Components uestc_ai has no analog for ---------------------------- */

/* 60 questions (research.html). <details class="qa"> is load-bearing:
   guide.js:11 drives expand-all and search links straight to #q12. */
.qa { border-bottom: 1px solid var(--line); }
.qa summary { padding: 19px 34px 19px 0; font-size: 15px; line-height: 1.7; font-weight: 600; color: var(--ink-2); cursor: pointer; list-style: none; position: relative; }
.qa summary::-webkit-details-marker { display: none; }
.qa summary:after { content: '+'; position: absolute; right: 6px; top: 18px; color: var(--coral); font-weight: 400; font-size: 17px; }
.qa[open] summary:after { content: '−'; }
.qa[open] summary, .qa summary:hover { color: var(--coral); }
.answer { padding: 2px 0 10px; }
.qa-tools { display: flex; justify-content: space-between; align-items: center; gap: 15px; margin: 30px 0 6px; font: 12px/1.6 ui-monospace, SFMono-Regular, Consolas, monospace; color: var(--quiet); }
.qa-tools button { padding: 7px 12px; font-size: 12px; color: var(--ink-2); border: 1px solid var(--line-dark); background: transparent; }
.qa-tools button:hover { background: var(--ink); border-color: var(--ink); color: var(--paper); }

/* Paper cards. fieldnotes.css gives them an ink border, a coral top rule and a
   `3px 3px 0` offset shadow; guide-motion.css:5 adds a competing
   translateY(-4px) hover. Flatten both to a uestc_ai hairline + soft lift. */
.paper-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(215px, 1fr)); gap: 14px; }
.paper-card { background: var(--surface); border: 1px solid var(--line); border-radius: 3px; box-shadow: none; padding: 14px; display: flex; flex-direction: column; gap: 10px; text-align: left; width: 100%; transition: border-color .18s ease, transform .18s ease, box-shadow .18s ease; }
.paper-card:hover { border-color: var(--line-dark); box-shadow: 0 2px 10px rgba(32, 33, 30, .07); transform: translateY(-2px); }
.paper-card strong { font-size: 14px; line-height: 1.45; color: var(--ink); }
.paper-question { color: var(--muted); font-size: 12px; line-height: 1.65; }
.paper-open { margin-top: auto; color: var(--coral-dark); font-size: 12px; }
.paper-stamp b { font-family: var(--serif); font-size: 20px; color: var(--coral); font-weight: 400; }
.paper-stamp span { color: var(--quiet); font-size: 11px; }
.paper-art { background: var(--paper-2); border: 1px solid var(--line); border-radius: 3px; padding: 8px; display: flex; align-items: center; justify-content: center; }
.paper-art img { max-width: 100%; height: auto; }
.paper-library { margin-top: 12px; }
.paper-filters { display: grid; grid-template-columns: 180px minmax(0, 1fr); gap: 20px; margin: 22px 0 10px; align-items: end; }
.paper-filters label { display: grid; gap: 6px; color: var(--quiet); font-size: 12px; }
.paper-filters select, .paper-filters input { background: var(--surface); border: 1px solid var(--line-dark); color: var(--ink); font: inherit; font-size: 13px; min-height: 40px; padding: 8px 10px; width: 100%; }
#paper-count { color: var(--quiet); font: 12px/1.6 ui-monospace, SFMono-Regular, Consolas, monospace; }
.paper-item[hidden] { display: none; }

/* Dialogs. globals.css styles only its `.dialog-layer` div, and <dialog> is a
   top-layer element so that overlay approach can't be ported — these are fresh
   rules using its values. Covers both #searchdialog and the 30 .paper-dialog. */
dialog { background: var(--surface); border: 0; color: var(--ink); width: min(760px, calc(100vw - 32px)); max-height: 82vh; margin: auto; padding: 0; box-shadow: 0 22px 70px rgba(32, 33, 30, .24); }
dialog::backdrop { background: rgba(32, 33, 30, .48); }
.searchhead { display: flex; gap: 12px; align-items: center; padding: 16px 18px; border-bottom: 1px solid var(--line); }
#searchinput { flex: 1; min-width: 0; border: 0; border-bottom: 1px solid var(--line-dark); background: transparent; padding: 8px 2px; font-size: 15px; color: var(--ink); }
#closesearch { padding: 8px 12px; font-size: 12px; color: var(--ink-2); border: 1px solid var(--line-dark); background: transparent; }
#closesearch:hover { background: var(--ink); border-color: var(--ink); color: var(--paper); }
#results { max-height: 62vh; overflow: auto; padding: 8px 18px 18px; font-size: 14px; color: var(--muted); }
.result { display: block; padding: 14px 4px; border-bottom: 1px solid var(--line); }
.result strong { display: block; font-size: 15px; color: var(--ink); line-height: 1.5; }
.result span { display: block; margin-top: 6px; font-size: 13px; line-height: 1.7; color: var(--muted); }
.result:hover { background: var(--paper-2); }
.paper-dialog-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 14px 18px; border-bottom: 1px solid var(--line); color: var(--quiet); font: 12px/1.5 ui-monospace, SFMono-Regular, Consolas, monospace; }
.paper-dialog-head button { background: transparent; border: 0; color: var(--quiet); font-size: 20px; line-height: 1; padding: 2px 6px; }
.paper-dialog-head button:hover { color: var(--coral); }
.paper-dialog-body { padding: 20px 22px 26px; overflow: auto; max-height: calc(82vh - 56px); }
.paper-dialog-body h2 { font-family: var(--serif); font-size: 24px; font-weight: 400; margin: 0 0 12px; border: 0; padding: 0; }
.paper-links { display: flex; flex-wrap: wrap; gap: 14px; margin-bottom: 18px; }
.paper-links a { font-size: 13px; color: var(--coral-dark); }
.paper-dialog-body section { border-top: 1px solid var(--line); padding: 14px 0; }
.paper-dialog-body section h3 { font-size: 12px; letter-spacing: .1em; text-transform: uppercase; color: var(--quiet); margin: 0 0 7px; }
.paper-dialog-body section p { color: var(--muted); font-size: 14px; line-height: 1.8; margin: 0; }
.paper-full-figure { margin: 18px 0; border: 1px solid var(--line); padding: 12px; background: var(--surface); color: var(--muted); }
.paper-full-figure img { max-width: 100%; height: auto; }
.paper-full-figure figcaption { font-size: 12px; color: var(--quiet); margin-top: 10px; line-height: 1.6; }

/* Field pages */
.field-problems { padding: 20px 22px; background: var(--paper-2); border: 1px solid var(--line); margin: 26px 0; }
.field-problems > strong { font-size: 12px; letter-spacing: .1em; text-transform: uppercase; color: var(--quiet); }
.field-problems ul { margin: 12px 0 0; padding-left: 20px; }
.field-problems li { margin: 8px 0; }
.field-stance { border-left: 3px solid var(--sand); padding: 6px 0 6px 20px; }
.field-terms { margin: 22px 0; }
.field-terms > div { border-bottom: 1px solid var(--line); padding: 13px 0; }
.field-terms dt { font-size: 14px; font-weight: 650; color: var(--ink-2); }
.field-terms dd { margin: 6px 0 0; color: var(--muted); font-size: 14px; line-height: 1.75; }
.field-roadmap { list-style: none; margin: 0; padding: 0; counter-reset: none; }
.field-roadmap > li { display: grid; grid-template-columns: 82px minmax(0, 1fr); gap: 20px; border-top: 1px solid var(--line); padding: 20px 0; }
.road-year { font-family: var(--serif); font-size: 20px; color: var(--coral); }
.field-roadmap h3 { margin: 0 0 6px; font-size: 15px; }
.field-roadmap p { margin: 0 0 9px; color: var(--muted); font-size: 14px; line-height: 1.75; }
.road-papers { display: flex; flex-wrap: wrap; gap: 12px; }
.road-papers a { font-size: 12px; color: var(--coral-dark); }
.field-checklist { display: grid; gap: 2px; border-top: 1px solid var(--line); margin-top: 10px; }
.field-checklist label { display: grid; grid-template-columns: 22px minmax(0, 1fr); gap: 10px; align-items: start; border-bottom: 1px solid var(--line); padding: 13px 4px; cursor: pointer; font-size: 14px; color: var(--muted); line-height: 1.7; }
.field-checklist input { margin: 4px 0 0; accent-color: var(--coral); }
.field-followup { margin-top: 22px; font-size: 14px; }

/* Research animations. Geometry rules at guide-motion.css:18-24 are the canvas
   contract (guide-motion.js:806 scales by spec.bounds) — do not touch those. */
.research-motion { margin: 34px 0 42px; padding: 24px 0 0; border-top: 1px solid var(--line-dark); }
.research-motion figcaption { font-family: var(--serif); font-size: 22px; font-weight: 400; color: var(--ink); margin: 0 0 20px; }
.motion-steps li { border-radius: 3px; }
.motion-steps li.active { background: color-mix(in srgb, var(--coral) 11%, transparent); color: var(--ink); }
.motion-stage { background: var(--paper-2); border: 1px solid var(--line); border-radius: 3px; }
.motion-progress i { background: var(--coral); }
.research-timeline { margin: 26px 0; }
.research-timeline a:before { border: 4px solid var(--paper); background: var(--coral); }
.research-lineage > div, .research-lineage a { border-radius: 3px; }
.research-lineage .lineage-root a, .research-lineage .lineage-next a { border-radius: 3px; }
.research-lineage strong, .research-lineage a { color: var(--ink-2); }
.research-lineage a:hover { color: var(--coral); }

/* Directories (company / robotics / reports / community) */
.company-directory, .robotics-directory, .report-directory { margin: 34px 0; }
/* guide-motion.css sets 22px headings, fixed 64x44 logos and 16px/1.8 copy with
   !important, and the article's reading rhythm (15px/1.85, 22px paragraph gaps)
   is far too airy inside a card. The interior is therefore owned outright. */
.company-card, .community-card, .report-family { background: var(--surface); border: 1px solid var(--line); border-radius: 3px; padding: 15px 16px; }
.company-card h4, .community-card h3, .report-family h3 {
  display: flex; align-items: center; gap: 12px;
  font-size: 14px !important; font-weight: 650; line-height: 1.4;
  margin: 0 0 10px !important;    /* upstream sets margin with !important too */
  color: var(--ink);
}
/* (0,1,2) — ties with guide-motion.css's `.community-card h3 img`, so source
   order decides. Natural aspect at a fixed height keeps a square mark and a
   wide wordmark (Lumina, AgentHub) equally legible; the upstream fixed 64x44
   box squeezed the wordmarks into unreadable slivers. */
.company-card h4 > img, .community-card h3 > img, .report-family h3 > img {
  height: 30px; width: auto; max-width: 124px; object-fit: contain; flex: none;
  background: transparent; border: 0; border-radius: 0; padding: 0;
}
/* Prefixed with .markdown-body (0,2,1) because the home page's own
   `.home-section p` / `.home-section strong` (0,1,1) sit LATER in this file and
   would otherwise win — giving card paragraphs 22px gaps and turning card
   <strong> into 17px inline-blocks, while <li> stayed at 4px. */
.markdown-body .company-card p, .markdown-body .company-card li,
.markdown-body .community-card p, .markdown-body .community-card li,
.markdown-body .report-family p { color: var(--muted); font-size: 13px; line-height: 1.7; margin: 0 0 8px; }
.markdown-body .company-card ul, .markdown-body .community-card ul { margin: 2px 0 8px; padding-left: 17px; }
.markdown-body .company-card li, .markdown-body .community-card li { margin: 4px 0; }
.markdown-body .company-card strong, .markdown-body .community-card strong,
.markdown-body .report-family strong { display: inline; font-size: inherit; line-height: inherit; margin: 0; }
.markdown-body .company-card > :last-child, .markdown-body .community-card > :last-child,
.markdown-body .report-family > :last-child { margin-bottom: 0; }
.company-card a, .community-card a, .report-family a { font-size: 13px; color: var(--coral-dark); }
.company-card a:hover, .community-card a:hover, .report-family a:hover { color: var(--coral); }
.company-grid, .community-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 14px; align-items: start; }
.report-family ul { list-style: none; margin: 0; padding: 0; }
.report-family li { border-top: 1px solid var(--line); padding: 10px 0; margin: 0; }
.report-family li:first-child { border-top: 0; }
.report-family li span { color: var(--quiet); font-size: 12px; }
.family-source { margin-top: 10px; }

/* AMA (GitHub Discussions feed, rendered client-side by ama.js) */
#ama-app { margin: 26px 0; }
.ama-toolbar { display: flex; justify-content: space-between; align-items: center; gap: 16px; border-bottom: 1px solid var(--line-dark); padding-bottom: 14px; }
#ama-count { color: var(--quiet); font: 12px/1.6 ui-monospace, SFMono-Regular, Consolas, monospace; }
#ama-app .ama-primary { display: inline-flex; align-items: center; justify-content: center; background: var(--ink); border: 0; border-radius: 0; color: var(--paper); font-size: 13px; padding: 10px 15px; text-decoration: none; }
#ama-app .ama-primary:hover { background: var(--coral); color: var(--paper); }
.ama-filters { display: flex; gap: 12px; align-items: center; margin: 18px 0 6px; }
.ama-filters input { flex: 1; min-width: 0; background: var(--surface); border: 1px solid var(--line-dark); color: var(--ink); font: inherit; font-size: 13px; min-height: 40px; padding: 8px 11px; }
.ama-filters button { background: transparent; border: 1px solid var(--line-dark); color: var(--ink-2); font-size: 13px; padding: 9px 14px; }
.ama-filters button:hover { background: var(--surface); border-color: var(--ink); }
.ama-thread { border-bottom: 1px solid var(--line); }
.ama-thread summary { display: grid; grid-template-columns: 66px minmax(0, 1fr); gap: 14px; align-items: start; padding: 17px 4px; cursor: pointer; list-style: none; }
.ama-thread summary::-webkit-details-marker { display: none; }
.ama-count-badge { font-family: var(--serif); font-size: 19px; color: var(--coral); text-align: center; }
.ama-count-badge small { display: block; font-family: var(--sans); font-size: 11px; color: var(--quiet); }
.ama-thread-heading strong { display: block; font-size: 15px; color: var(--ink); line-height: 1.5; }
.ama-thread-meta { display: flex; flex-wrap: wrap; gap: 7px; color: var(--quiet); font-size: 12px; margin-top: 6px; }
.ama-thread-body { padding: 2px 4px 22px 84px; }
.ama-thread-body > p { color: var(--muted); font-size: 14px; line-height: 1.8; }
.ama-reply { border-left: 2px solid var(--line); padding: 12px 0 12px 16px; margin: 12px 0; }
.ama-reply-meta { display: flex; gap: 10px; align-items: baseline; font-size: 12px; color: var(--quiet); margin-bottom: 6px; }
.ama-reply-meta b { color: var(--ink-2); }
.ama-reply p { margin: 0; color: var(--muted); font-size: 14px; line-height: 1.75; }
.ama-nested-reply { background: var(--paper-2); border-radius: 3px; padding: 10px 12px; margin-top: 10px; font-size: 13px; color: var(--muted); }
.ama-nested-reply b { color: var(--ink-2); margin-right: 6px; }
.ama-thread-actions { display: flex; gap: 16px; margin-top: 14px; }
.ama-thread-actions a { font-size: 13px; color: var(--coral-dark); }
.ama-empty, #ama-notice { color: var(--quiet); font-size: 14px; padding: 24px 0; }
.ama-footer { display: flex; justify-content: space-between; gap: 16px; border-top: 1px solid var(--line-dark); padding-top: 14px; color: var(--quiet); font-size: 12px; }

/* Home */
body.home .markdown-body > p { max-width: 780px; color: var(--muted); }
body.home .markdown-body > p:first-of-type { font-size: 17px; color: var(--ink); }
/* The label column has to fit the longest heading ("做研究时会遇到的问题", 10 CJK
   glyphs) on one line: 10 x 20px = 200px inside 220px. At the previous 190px and
   24px it wrapped mid-word — "经历、生活与眼 / 界". balance covers anything longer. */
.home-section { clear: both; display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: 0 30px; border-top: 1px solid var(--line); margin: 36px 0 0; padding: 24px 0 5px; counter-increment: none; }
.home-section h2 { grid-column: 1; grid-row: 1 / span 12; padding: 0; margin: 0; border: 0; font-size: 20px; line-height: 1.45; text-wrap: balance; }
.home-section h2:before { content: none; }
.home-section p { grid-column: 2; font-size: 14px; color: var(--muted); margin-bottom: 22px; }
.home-section strong { display: inline-block; font-size: 17px; line-height: 1.55; margin-bottom: 7px; }
.home-section strong a { color: var(--ink); text-decoration: none; }
.home-section strong a:hover { color: var(--coral); }

/* The chronicle video hardcodes its own colours upstream (guide.css:21) — no
   tokens at all — so it is re-declared rather than aliased. */
.chronicle-video { background: var(--ink); border: 1px solid var(--line-dark); border-radius: 3px; display: block; width: 100%; height: auto; aspect-ratio: 16/9; object-fit: contain; margin: 22px 0; }
.chronicle-video::cue { background: rgba(32, 33, 30, .88); color: #f4f1ea; }

/* --- 6. Responsive ------------------------------------------------------ */
/* 800px, NOT uestc_ai's 820px: guide.js:4 hardcodes matchMedia('(max-width:800px)')
   for its drawer logic, so the CSS must break at the same point or 801–820px
   is a dead zone where the hamburger shows but the drawer refuses to open. */
@media (max-width: 800px) {
  .app-shell { display: block; }
  #nav.app-sidebar {
    position: fixed;
    inset: 62px auto 0 0;
    width: 282px;
    height: auto;
    transform: translateX(-101%);
    transition: transform .2s ease;
    z-index: 24;
    border-right: 1px solid var(--line);
  }
  body.navopen #nav.app-sidebar { transform: translateX(0); }
  #shade:not([hidden]) { display: block; position: fixed; inset: 62px 0 0; z-index: 23; background: rgba(32, 33, 30, .4); border: 0; width: 100%; }
  #menu { display: inline-flex; }
  #mobile-search { display: inline-flex; }
  .app-topbar { padding: 0 20px; gap: 12px; }
  .topbar-context strong { max-width: 34vw; }
  .page-title-band { min-height: 0; padding: 26px 20px 22px; }
  .page-title-band h1, html[lang=zh-CN] .page-title-band h1 { font-size: 30px; }
  main.app-content { padding: 26px 20px 60px; }
  .app-footer { flex-direction: column; gap: 9px; margin: 0 20px; }
  .app-footer a { margin-left: 0; margin-right: 18px; }
  .article-layout { display: block; }
  #toc { position: static; max-height: none; margin-bottom: 30px; }
  .markdown-body p, .markdown-body li { font-size: 15px; line-height: 1.9; }
  .markdown-body h2 { font-size: 22px; }
  .home-section { display: block; margin-top: 30px; padding-top: 21px; }
  .home-section h2 { font-size: 22px; margin-bottom: 18px; }
  .paper-filters { grid-template-columns: 1fr; gap: 12px; }
  .field-roadmap > li { grid-template-columns: 1fr; gap: 8px; }
  .ama-thread-body { padding-left: 4px; }
  .neighbors { gap: 18px; }
  .neighbors a { font-size: 13px; }
}

@media (max-width: 600px) {
  .home-logo { width: 40px; margin-bottom: 10px; }
  .paper-grid { grid-template-columns: 1fr; }
  .company-grid, .community-grid { grid-template-columns: 1fr; }
}

@media print {
  #nav, .app-topbar, #mobile-search, #toc, .neighbors, .app-footer, .skip { display: none !important; }
  .app-shell { display: block; }
  main.app-content { padding: 0; max-width: none; }
  .qa { break-inside: avoid; }
}
