/* 教育理论知识体系 — 移动优先阅读样式 */

:root {
  --bg: #faf8f4;
  --bg-soft: #f2eee6;
  --bg-card: #fffdfa;
  --ink: #23262b;
  --ink-2: #4a4f57;
  --ink-3: #767c86;
  --line: #e2ddd2;
  --line-2: #d3ccbd;
  --accent: #1f5f78;
  --accent-soft: #e7f0f4;
  --mark: #fdf0c8;
  --shadow: 0 1px 2px rgba(40, 35, 25, .05), 0 8px 24px rgba(40, 35, 25, .06);
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB",
          "Noto Sans CJK SC", "Source Han Sans SC", "Microsoft YaHei", sans-serif;
  --serif: Georgia, "Songti SC", "Noto Serif CJK SC", "Source Han Serif SC", "SimSun", serif;
  --fs: 16.5px;
  --side-w: 288px;
}

html[data-fs="s"] { --fs: 15.5px; }
html[data-fs="l"] { --fs: 18.5px; }

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #14161a; --bg-soft: #1b1e24; --bg-card: #191c21;
    --ink: #dfe1e5; --ink-2: #b0b5bd; --ink-3: #838a94;
    --line: #2a2e35; --line-2: #3a3f47;
    --accent: #67b6d4; --accent-soft: #1c2b33; --mark: #4a3f1c;
    --shadow: 0 1px 2px rgba(0,0,0,.3), 0 8px 24px rgba(0,0,0,.35);
  }
}
html[data-theme="dark"] {
  --bg: #14161a; --bg-soft: #1b1e24; --bg-card: #191c21;
  --ink: #dfe1e5; --ink-2: #b0b5bd; --ink-3: #838a94;
  --line: #2a2e35; --line-2: #3a3f47;
  --accent: #67b6d4; --accent-soft: #1c2b33; --mark: #4a3f1c;
  --shadow: 0 1px 2px rgba(0,0,0,.3), 0 8px 24px rgba(0,0,0,.35);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; scroll-padding-top: 64px; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: var(--fs)/1.85 var(--sans);
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  overflow-wrap: break-word;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; }

/* ---------------- 顶栏 ---------------- */
.progress {
  position: fixed; top: 0; left: 0; height: 2px; width: 0;
  background: var(--accent); z-index: 60; transition: width .1s linear;
}
.top {
  position: sticky; top: 0; z-index: 50; display: flex; align-items: center; gap: 4px;
  height: 52px; padding: 0 8px 0 6px;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: saturate(1.6) blur(12px);
  border-bottom: 1px solid var(--line);
  padding-top: env(safe-area-inset-top);
  height: calc(52px + env(safe-area-inset-top));
}
.brand {
  font: 600 16px/1 var(--serif); color: var(--ink); letter-spacing: .01em;
  padding: 6px 4px; white-space: nowrap;
}
.brand:hover { text-decoration: none; color: var(--accent); }
.sp { flex: 1; }
.ic {
  display: grid; place-items: center; width: 38px; height: 38px; flex: 0 0 38px;
  border: 0; border-radius: 9px; background: none; color: var(--ink-2);
  cursor: pointer; font: 600 15px var(--sans); -webkit-tap-highlight-color: transparent;
}
.ic:hover { background: var(--bg-soft); color: var(--ink); }
.ic:active { transform: scale(.94); }
.ic svg { width: 19px; height: 19px; fill: none; stroke: currentColor; stroke-width: 1.7;
  stroke-linecap: round; stroke-linejoin: round; }
.i-moon { display: none; }
html[data-theme="dark"] .i-sun { display: none; }
html[data-theme="dark"] .i-moon { display: block; }
@media (prefers-color-scheme: dark) {
  html:not([data-theme="light"]) .i-sun { display: none; }
  html:not([data-theme="light"]) .i-moon { display: block; }
}
#menu { display: grid; }

/* ---------------- 侧栏 ---------------- */
.side {
  position: fixed; z-index: 55; top: 0; left: 0; bottom: 0; width: var(--side-w);
  background: var(--bg-card); border-right: 1px solid var(--line);
  transform: translateX(-102%); transition: transform .24s cubic-bezier(.4, 0, .2, 1);
  overflow-y: auto; overscroll-behavior: contain;
  padding: calc(14px + env(safe-area-inset-top)) 14px 28px;
  -webkit-overflow-scrolling: touch;
}
.side.open { transform: none; }
.scrim {
  position: fixed; inset: 0; z-index: 54; background: rgba(15, 15, 18, .45);
  opacity: 0; pointer-events: none; transition: opacity .24s;
}
.scrim.on { opacity: 1; pointer-events: auto; }

.nav-home {
  display: flex; align-items: center; gap: 8px; padding: 9px 10px; margin-bottom: 6px;
  border-radius: 9px; font-weight: 600; color: var(--ink); font-size: .95em;
}
.nav-home .nh-i { color: var(--accent); }
.nav-home:hover { background: var(--bg-soft); text-decoration: none; }
.nav-home.on { background: var(--accent-soft); color: var(--accent); }

.nav details { border-top: 1px solid var(--line); }
.nav details:last-of-type { border-bottom: 1px solid var(--line); }
.nav summary {
  display: flex; align-items: center; gap: 8px; padding: 11px 10px; cursor: pointer;
  list-style: none; font-size: .95em; color: var(--ink);
}
.nav summary::-webkit-details-marker { display: none; }
.nav summary::after {
  content: "›"; margin-left: auto; color: var(--ink-3); font-size: 17px;
  transition: transform .2s; transform: rotate(90deg);
}
.nav details[open] summary::after { transform: rotate(-90deg); }
.nav summary:hover { background: var(--bg-soft); }
.nav .cnt {
  font: 500 11px/1 var(--sans); color: var(--ink-3); background: var(--bg-soft);
  padding: 3px 6px; border-radius: 20px;
}
.nav .blurb { margin: -2px 10px 8px; font-size: 12px; color: var(--ink-3); line-height: 1.5; }
.nav ul { list-style: none; margin: 0 0 10px; padding: 0; }
.nav ul a {
  display: block; padding: 7px 10px 7px 18px; border-left: 2px solid var(--line);
  margin-left: 10px; color: var(--ink-2); font-size: .9em; line-height: 1.5;
}
.nav ul a:hover { color: var(--ink); border-left-color: var(--line-2); background: var(--bg-soft);
  text-decoration: none; }
.nav ul a.on { color: var(--accent); border-left-color: var(--accent); font-weight: 600;
  background: var(--accent-soft); }
.side-foot { margin: 18px 10px 0; font-size: 12px; color: var(--ink-3); }

/* ---------------- 版心 ---------------- */
.wrap { display: block; padding: 0 18px; }
.doc { max-width: 44rem; margin: 0 auto; padding: 22px 0 8px; }
.toc { display: none; }

.doc h1 {
  font: 700 1.72em/1.35 var(--serif); margin: .1em 0 .5em; letter-spacing: -.01em;
  color: var(--ink);
}
.doc h2 {
  font: 600 1.24em/1.5 var(--serif); margin: 2.4em 0 .7em;
  padding-bottom: .35em; border-bottom: 1px solid var(--line);
}
.doc h3 { font: 600 1.06em/1.6 var(--sans); margin: 1.9em 0 .5em; color: var(--ink); }
.doc h4 { font: 600 1em/1.6 var(--sans); margin: 1.5em 0 .4em; color: var(--ink-2); }
.doc p { margin: 0 0 1.05em; }
.doc > p:first-of-type { margin-top: 0; }
.doc ul, .doc ol { margin: 0 0 1.15em; padding-left: 1.4em; }
.doc li { margin: .3em 0; }
.doc li > ul, .doc li > ol { margin: .3em 0 .1em; }
.doc strong { font-weight: 650; color: var(--ink); }
.doc em { font-style: normal; color: var(--ink-2); font-family: var(--serif); }
.doc hr { border: 0; border-top: 1px solid var(--line); margin: 2.2em 0 1.4em; }

/* 一句话定位 */
.doc blockquote {
  margin: 0 0 1.6em; padding: 14px 16px; background: var(--bg-soft);
  border-left: 3px solid var(--accent); border-radius: 0 10px 10px 0;
  color: var(--ink-2); font-size: .97em;
}
.doc blockquote p:last-child { margin-bottom: 0; }

.doc code {
  font: .87em/1.5 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  background: var(--bg-soft); padding: .12em .38em; border-radius: 5px; color: var(--ink-2);
}
.doc pre {
  background: var(--bg-soft); padding: 14px; border-radius: 10px; overflow-x: auto;
  border: 1px solid var(--line);
}
.doc pre code { background: none; padding: 0; }

.tags { margin: -.5em 0 1.6em; display: flex; flex-wrap: wrap; gap: 6px; }
.tags span {
  font-size: 12px; color: var(--ink-3); background: var(--bg-soft);
  border: 1px solid var(--line); padding: 2px 9px; border-radius: 20px;
}

.wl-missing { color: var(--ink-3); border-bottom: 1px dotted var(--ink-3); }

/* 表格 */
.tw { overflow-x: auto; margin: 0 0 1.4em; -webkit-overflow-scrolling: touch;
  border: 1px solid var(--line); border-radius: 10px; }
.doc table { border-collapse: collapse; width: 100%; font-size: .9em; line-height: 1.7; }
.doc th, .doc td {
  padding: 9px 12px; text-align: left; vertical-align: top;
  border-bottom: 1px solid var(--line);
}
.doc th { background: var(--bg-soft); font-weight: 650; white-space: nowrap; color: var(--ink); }
.doc tbody tr:last-child td { border-bottom: 0; }
.doc tbody tr:hover td { background: var(--bg-soft); }
.doc td:first-child { min-width: 8em; }

/* 任务清单 */
.doc ul.tasks { list-style: none; padding-left: 0; }
.doc li.task { display: flex; gap: 10px; align-items: flex-start; padding: 5px 0;
  border-bottom: 1px dashed var(--line); }
.doc li.task:last-child { border-bottom: 0; }
.doc .ck {
  appearance: none; -webkit-appearance: none; flex: 0 0 19px; width: 19px; height: 19px;
  margin: 6px 0 0; border: 1.6px solid var(--line-2); border-radius: 5px;
  background: var(--bg-card); cursor: pointer; position: relative; transition: .15s;
}
.doc .ck:checked { background: var(--accent); border-color: var(--accent); }
.doc .ck:checked::after {
  content: ""; position: absolute; left: 5.6px; top: 2px; width: 4px; height: 9px;
  border: solid #fff; border-width: 0 2px 2px 0; transform: rotate(43deg);
}
.doc .ck:checked + span { color: var(--ink-3); text-decoration: line-through;
  text-decoration-color: var(--line-2); }

/* 结构图 */
.diagram { margin: 0 0 1.6em; padding: 6px 0; text-align: center; }
.diagram svg { max-width: 100%; height: auto; }
.dg-box { fill: var(--bg-card); stroke: var(--line-2); }
.dg-box-a { fill: var(--accent-soft); stroke: var(--accent); }
.dg-t { fill: var(--ink); font: 600 14px var(--sans); }
.dg-s { fill: var(--ink-3); font: 11.5px var(--sans); }
.dg-e { stroke: var(--line-2); fill: none; stroke-width: 1.6; }
.dg-h { fill: var(--line-2); }

/* 时间线 */
.timeline { margin: 0 0 1.7em; }
.timeline-title { font: 600 1.02em var(--serif); margin: 0 0 .9em; color: var(--ink); }
.timeline > ol { list-style: none; margin: 0; padding: 0 0 0 20px; border-left: 2px solid var(--line); }
.timeline > ol > li { position: relative; padding: 0 0 1.25em 4px; }
.timeline > ol > li::before {
  content: ""; position: absolute; left: -27px; top: 8px; width: 11px; height: 11px;
  border-radius: 50%; background: var(--bg); border: 2.4px solid var(--accent);
}
.tl-period { display: block; font: 600 .84em/1.5 var(--sans); color: var(--accent);
  letter-spacing: .03em; }
.tl-head { display: block; font-weight: 650; margin: 1px 0 3px; }
.tl-detail { list-style: none; margin: 0; padding: 0; }
.tl-detail li { font-size: .89em; color: var(--ink-2); line-height: 1.7; margin: 0; }
.tl-detail li::before { content: "· "; color: var(--ink-3); }

/* 反向链接 / 上下篇 */
.backlinks { margin: 3em 0 0; padding: 18px 0 0; border-top: 1px solid var(--line); }
.backlinks h2 { font: 600 .95em var(--sans); margin: 0 0 .8em; padding: 0; border: 0;
  color: var(--ink-3); display: flex; align-items: center; gap: 8px; }
.backlinks .cnt { font: 500 11px/1 var(--sans); background: var(--bg-soft);
  padding: 3px 7px; border-radius: 20px; }
.backlinks ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px;
  grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); }
.backlinks li { margin: 0; }
.backlinks li a {
  display: flex; flex-direction: column; gap: 1px; padding: 8px 11px;
  background: var(--bg-soft); border-radius: 9px; font-size: .9em; line-height: 1.4;
  border: 1px solid transparent;
}
.backlinks li a:hover { text-decoration: none; border-color: var(--line-2); }
.backlinks em { font-style: normal; font-size: 11px; color: var(--ink-3); }

.pn { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 2em 0 1em; }
.pn a {
  display: flex; flex-direction: column; gap: 3px; padding: 12px 14px;
  border: 1px solid var(--line); border-radius: 11px; background: var(--bg-card);
  font-size: .93em; line-height: 1.45; color: var(--ink);
}
.pn a:hover { border-color: var(--accent); text-decoration: none; }
.pn span { font-size: 11.5px; color: var(--ink-3); }
.pn b { font-weight: 600; }
.pn-next { text-align: right; }

.foot { padding: 26px 18px calc(30px + env(safe-area-inset-bottom));
  text-align: center; color: var(--ink-3); font-size: 12.5px;
  border-top: 1px solid var(--line); margin-top: 30px; }
.foot p { margin: 0; }

/* ---------------- 搜索 ---------------- */
.modal {
  position: fixed; inset: 0; z-index: 70; display: none;
  background: rgba(15, 15, 18, .5); backdrop-filter: blur(3px);
  padding: 8vh 14px 14px;
}
.modal.on { display: block; }
.mbox {
  max-width: 640px; margin: 0 auto; background: var(--bg-card); border-radius: 15px;
  box-shadow: var(--shadow); overflow: hidden; display: flex; flex-direction: column;
  max-height: 82vh; border: 1px solid var(--line);
}
.mhead { display: flex; align-items: center; gap: 8px; padding: 9px 10px;
  border-bottom: 1px solid var(--line); }
.mi { width: 18px; height: 18px; flex: 0 0 18px; fill: none; stroke: var(--ink-3);
  stroke-width: 1.7; stroke-linecap: round; margin-left: 6px; }
#sq {
  flex: 1; border: 0; outline: 0; background: none; color: var(--ink);
  font: 16px var(--sans); padding: 8px 2px; min-width: 0;
}
#sq::-webkit-search-cancel-button { display: none; }
.mres { overflow-y: auto; padding: 6px; -webkit-overflow-scrolling: touch; }
.hint, .nores { color: var(--ink-3); font-size: .9em; padding: 20px 12px; text-align: center;
  margin: 0; }
.rs { display: block; padding: 10px 12px; border-radius: 10px; color: var(--ink); }
.rs:hover, .rs.sel { background: var(--accent-soft); text-decoration: none; }
.rs-t { font-weight: 650; font-size: .96em; display: flex; align-items: baseline; gap: 8px; }
.rs-c { font-size: 11px; color: var(--ink-3); font-weight: 400; flex: 0 0 auto; }
.rs-x { font-size: .85em; color: var(--ink-2); line-height: 1.65; margin: 2px 0 0;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.rs mark { background: var(--mark); color: inherit; border-radius: 3px; padding: 0 1px; }

/* ---------------- 宽屏 ---------------- */
@media (min-width: 1080px) {
  #menu { display: none; }
  .side { transform: none; box-shadow: none; }
  .scrim { display: none; }
  .top { padding-left: calc(var(--side-w) + 18px); }
  .wrap { padding-left: calc(var(--side-w) + 34px); padding-right: 34px; }
  .doc { padding-top: 30px; }
  .foot { padding-left: calc(var(--side-w) + 18px); }
}
@media (min-width: 1440px) {
  .wrap { display: grid; grid-template-columns: minmax(0, 44rem) 210px; gap: 40px;
    justify-content: center; }
  .toc {
    display: block; position: sticky; top: 84px; align-self: start; max-height: 78vh;
    overflow-y: auto; padding: 30px 0 20px; font-size: 13px; line-height: 1.6;
  }
  .toc-t { margin: 0 0 8px; font-weight: 650; color: var(--ink-3); font-size: 11.5px;
    letter-spacing: .06em; }
  .toc ul { list-style: none; margin: 0; padding: 0; border-left: 1.5px solid var(--line); }
  .toc li a { display: block; padding: 4px 0 4px 12px; color: var(--ink-3);
    margin-left: -1.5px; border-left: 1.5px solid transparent; }
  .toc li a:hover { color: var(--ink); text-decoration: none; }
  .toc li a.on { color: var(--accent); border-left-color: var(--accent); }
  .toc .l3 a { padding-left: 24px; font-size: 12.3px; }
}

@media (max-width: 480px) {
  .wrap { padding: 0 15px; }
  .doc h1 { font-size: 1.52em; }
  .pn { grid-template-columns: 1fr; }
  .backlinks ul { grid-template-columns: 1fr; }
  .modal { padding: 0; }
  .mbox { max-height: 100vh; height: 100%; border-radius: 0; border: 0; }
}

@media print {
  .top, .side, .toc, .pn, .foot, .scrim, .modal, .progress, .backlinks { display: none !important; }
  .wrap { padding: 0; } .doc { max-width: none; }
}
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; scroll-behavior: auto !important; }
}
