/* 奉贤中专乐学网 · 教师操作手册 — 共享样式 */
:root {
  --ink: #15202b;
  --ink-soft: #4a5768;
  --ink-mute: #78879a;
  --line: #dfe7f1;
  --line-soft: #eef3f9;
  --bg: #ffffff;
  --bg-soft: #f6f9fd;
  --bg-blue: #eef5ff;
  --blue: #1f6fd0;
  --blue-deep: #14508f;
  --blue-ink: #0f3f75;
  --amber: #b5761b;
  --amber-bg: #fff8ea;
  --green: #1e7a52;
  --green-bg: #eefaf3;
  --red: #b23a3a;
  --red-bg: #fdf0f0;
  --radius: 12px;
  --shadow: 0 1px 2px rgba(18, 44, 74, .05), 0 8px 24px rgba(18, 44, 74, .06);
  --sans: "Microsoft YaHei", "PingFang SC", "Hiragino Sans GB", "Source Han Sans SC", system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "Cascadia Mono", Consolas, "SFMono-Regular", "Courier New", monospace;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: var(--sans);
  font-size: 15.5px;
  line-height: 1.85;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

/* ---------- 顶栏 ---------- */
.topbar {
  position: sticky; top: 0; z-index: 40;
  display: flex; align-items: center; gap: 14px;
  height: 56px; padding: 0 20px;
  background: rgba(255, 255, 255, .92);
  backdrop-filter: saturate(160%) blur(8px);
  border-bottom: 1px solid var(--line);
}
.topbar .brand { display: flex; align-items: baseline; gap: 9px; font-weight: 700; letter-spacing: .3px; }
.topbar .brand b { color: var(--blue-deep); font-size: 15px; }
.topbar .brand span { color: var(--ink-mute); font-size: 12.5px; font-weight: 400; }
.topbar .spacer { flex: 1; }
.topbar a.tb-link {
  color: var(--ink-soft); text-decoration: none; font-size: 13px;
  padding: 5px 9px; border-radius: 7px;
}
.topbar a.tb-link:hover { background: var(--bg-blue); color: var(--blue-deep); }
#navToggle { display: none; }

/* ---------- 布局 ---------- */
.book { display: grid; grid-template-columns: 268px minmax(0, 1fr); align-items: start; }

.sidebar {
  position: sticky; top: 56px;
  height: calc(100vh - 56px);
  overflow-y: auto;
  padding: 22px 14px 60px 20px;
  border-right: 1px solid var(--line);
  background: linear-gradient(180deg, var(--bg-soft), #fff 320px);
  font-size: 13.5px;
}
.sidebar::-webkit-scrollbar { width: 8px; }
.sidebar::-webkit-scrollbar-thumb { background: #dbe4ef; border-radius: 8px; }
.sidebar .part {
  margin: 20px 0 6px; font-size: 11.5px; letter-spacing: 1.4px;
  color: var(--ink-mute); font-weight: 700;
}
.sidebar .part:first-child { margin-top: 0; }
.sidebar ol { list-style: none; margin: 0; padding: 0; }
.sidebar li { margin: 1px 0; }
.sidebar a {
  display: block; padding: 6px 10px; border-radius: 8px;
  color: var(--ink-soft); text-decoration: none; line-height: 1.5;
}
.sidebar a:hover { background: var(--bg-blue); color: var(--blue-deep); }
.sidebar a.active { background: var(--blue); color: #fff; font-weight: 600; box-shadow: 0 4px 12px rgba(31,111,208,.22); }
.sidebar .num { display: inline-block; width: 24px; color: var(--ink-mute); font-variant-numeric: tabular-nums; }
.sidebar a.active .num { color: #dbe9ff; }

main { min-width: 0; padding: 40px 48px 90px; }
.page { max-width: 880px; margin: 0 auto; }

/* ---------- 标题 ---------- */
.ch-eyebrow {
  display: inline-flex; align-items: center; gap: 8px;
  font-size: 12px; letter-spacing: 1.6px; color: var(--blue);
  font-weight: 700; text-transform: uppercase;
}
.ch-eyebrow::before { content: ""; width: 22px; height: 2px; background: var(--blue); border-radius: 2px; }
h1 {
  font-size: 30px; line-height: 1.35; margin: 10px 0 14px;
  letter-spacing: .2px; color: #0d1b2a;
}
.ch-lead { font-size: 16px; color: var(--ink-soft); margin: 0 0 26px; }
h2 {
  font-size: 21px; margin: 44px 0 12px; padding-top: 8px;
  color: #0d1b2a; letter-spacing: .2px;
}
h2 .h2num { color: var(--blue); margin-right: 8px; font-variant-numeric: tabular-nums; }
h3 { font-size: 16.5px; margin: 26px 0 8px; color: #16304a; }
p { margin: 10px 0; }
a { color: var(--blue-deep); }
strong { color: #0d1b2a; }
small { color: var(--ink-mute); }

/* ---------- 组件 ---------- */
.rule { height: 1px; background: var(--line); border: 0; margin: 34px 0; }

.tldr {
  border: 1px solid #d6e6fb; background: linear-gradient(180deg, #f4f9ff, #fbfdff);
  border-radius: var(--radius); padding: 16px 18px; margin: 20px 0 26px;
}
.tldr h4 { margin: 0 0 6px; font-size: 13px; letter-spacing: 1.2px; color: var(--blue); }
.tldr ul { margin: 6px 0 0; padding-left: 18px; }
.tldr li { margin: 3px 0; color: var(--ink-soft); }

.note, .warn, .tip {
  position: relative; border-radius: 10px; padding: 12px 16px 12px 44px;
  margin: 16px 0; font-size: 14.5px; line-height: 1.8;
}
.note::before, .warn::before, .tip::before {
  position: absolute; left: 14px; top: 11px; font-size: 15px;
}
.note { background: var(--bg-blue); border-left: 3px solid var(--blue); }
.note::before { content: "i"; font-weight: 800; color: var(--blue); font-style: italic; font-family: Georgia, serif; }
.warn { background: var(--amber-bg); border-left: 3px solid var(--amber); }
.warn::before { content: "!"; font-weight: 800; color: var(--amber); }
.tip { background: var(--green-bg); border-left: 3px solid var(--green); }
.tip::before { content: "✓"; font-weight: 800; color: var(--green); }

.steps { counter-reset: s; list-style: none; padding: 0; margin: 16px 0; }
.steps > li {
  position: relative; padding: 0 0 14px 42px; margin: 0;
  border-left: 2px solid var(--line); margin-left: 12px;
}
.steps > li:last-child { border-left-color: transparent; padding-bottom: 0; }
.steps > li::before {
  counter-increment: s; content: counter(s);
  position: absolute; left: -13px; top: 0;
  width: 24px; height: 24px; border-radius: 50%;
  background: #fff; border: 2px solid var(--blue); color: var(--blue-deep);
  font-size: 12.5px; font-weight: 700; line-height: 20px; text-align: center;
}
.steps > li b { display: block; margin-bottom: 2px; }

table { width: 100%; border-collapse: collapse; margin: 16px 0; font-size: 14px; }
th, td { border: 1px solid var(--line); padding: 9px 11px; vertical-align: top; text-align: left; }
th { background: var(--bg-soft); font-weight: 700; color: #16304a; }
tbody tr:nth-child(even) td { background: #fcfdff; }
td code, th code { white-space: nowrap; }

code {
  font-family: var(--mono); font-size: 13px;
  background: #f1f5fa; border: 1px solid #e3ebf5; border-radius: 5px;
  padding: 1px 5px; color: #274566;
}
kbd {
  font-family: var(--mono); font-size: 12.5px; background: #fff;
  border: 1px solid #cfd9e6; border-bottom-width: 2px; border-radius: 5px;
  padding: 1px 5px; color: #2b3f58;
}
.ui {
  display: inline-block; padding: 0 6px; border-radius: 5px;
  background: #eef3f9; border: 1px solid #dde7f2; color: #274566;
  font-size: 13.5px; font-weight: 600; white-space: nowrap;
}
.tag {
  display: inline-block; font-size: 11.5px; font-weight: 700; letter-spacing: .6px;
  padding: 1px 8px; border-radius: 999px; vertical-align: 2px;
}
.tag.ai { background: #eaf2ff; color: #1a5fb4; border: 1px solid #cfe1fb; }
.tag.own { background: #f1ecff; color: #5a3fb8; border: 1px solid #ded3fb; }
.tag.moodle { background: #eef4f0; color: #2c6b4f; border: 1px solid #d7e8de; }

figure { margin: 22px 0; }
figure img {
  display: block; width: 100%; height: auto;
  border: 1px solid var(--line); border-radius: 10px;
  box-shadow: var(--shadow); background: #fff;
}
figcaption {
  margin-top: 8px; font-size: 13px; color: var(--ink-mute);
  padding-left: 2px;
}
figcaption b { color: var(--ink-soft); }

.cards { display: grid; gap: 14px; margin: 18px 0 26px; }
.cards.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.cards.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.card {
  border: 1px solid var(--line); border-radius: var(--radius); padding: 15px 16px;
  background: #fff; box-shadow: var(--shadow);
}
.card h4 { margin: 0 0 6px; font-size: 15px; color: #123; }
.card p { margin: 0; font-size: 13.5px; color: var(--ink-soft); line-height: 1.7; }

/* ---------- 分页 ---------- */
.pager {
  display: flex; gap: 14px; justify-content: space-between;
  margin-top: 56px; padding-top: 22px; border-top: 1px solid var(--line);
}
.pager a {
  flex: 1; text-decoration: none; padding: 14px 16px;
  border: 1px solid var(--line); border-radius: 10px; background: #fff;
  transition: .18s ease; box-shadow: var(--shadow);
}
.pager a:hover { border-color: #b9d3f2; transform: translateY(-1px); }
.pager .k { display: block; font-size: 12px; color: var(--ink-mute); letter-spacing: 1px; }
.pager .t { display: block; font-size: 14.5px; color: var(--blue-deep); font-weight: 600; margin-top: 2px; }
.pager a.next { text-align: right; }

/* ---------- 封面 / 目录 ---------- */
.cover { max-width: 980px; margin: 0 auto; padding: 26px 0 10px; }
.cover .kicker { font-size: 12.5px; letter-spacing: 3px; color: var(--blue); font-weight: 700; }
.cover h1 { font-size: 46px; line-height: 1.25; margin: 16px 0 10px; letter-spacing: 1px; }
.cover .sub { font-size: 17px; color: var(--ink-soft); margin: 0 0 6px; }
.cover .meta {
  display: flex; flex-wrap: wrap; gap: 10px 26px; margin: 24px 0 8px;
  padding: 16px 18px; border: 1px solid var(--line); border-radius: var(--radius);
  background: var(--bg-soft); font-size: 13.5px; color: var(--ink-soft);
}
.cover .meta b { color: #123; }
.cover .lead { font-size: 16px; color: var(--ink-soft); margin: 18px 0 6px; max-width: 780px; }

.toc { margin: 34px 0 0; }
.toc .group { margin: 26px 0 6px; }
.toc .group h3 {
  margin: 0 0 10px; font-size: 12.5px; letter-spacing: 2px; color: var(--ink-mute);
  font-weight: 700; text-transform: uppercase;
}
.toc ol { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.toc a {
  display: grid; grid-template-columns: 34px 1fr; gap: 10px;
  text-decoration: none; padding: 13px 15px; border: 1px solid var(--line);
  border-radius: 10px; background: #fff; box-shadow: var(--shadow); transition: .16s ease;
}
.toc a:hover { border-color: #b9d3f2; transform: translateY(-1px); }
.toc .n { font-size: 18px; font-weight: 800; color: #c3d7ee; line-height: 1.2; font-variant-numeric: tabular-nums; }
.toc .t { font-size: 14.8px; font-weight: 700; color: #10263c; }
.toc .d { font-size: 12.5px; color: var(--ink-mute); margin-top: 2px; line-height: 1.6; }

.legend { display: flex; flex-wrap: wrap; gap: 16px; margin: 10px 0 0; font-size: 13px; color: var(--ink-soft); }
.legend span b { font-weight: 700; }

footer.bookfoot {
  max-width: 880px; margin: 40px auto 0; padding-top: 18px;
  border-top: 1px solid var(--line); font-size: 12.5px; color: var(--ink-mute);
}

/* ---------- 响应式 ---------- */
@media (max-width: 1020px) {
  .book { grid-template-columns: 1fr; }
  .sidebar {
    position: fixed; top: 56px; left: 0; width: 280px; z-index: 50;
    transform: translateX(-102%); transition: transform .22s ease;
    box-shadow: 18px 0 40px rgba(16, 40, 70, .12); background: #fff;
  }
  body.nav-open .sidebar { transform: none; }
  #navToggle { display: inline-block; }
  main { padding: 26px 20px 70px; }
  .toc ol { grid-template-columns: 1fr; }
  .cards.two, .cards.three { grid-template-columns: 1fr; }
  .cover h1 { font-size: 34px; }
  h1 { font-size: 25px; }
  /* 窄屏：表格与长代码横向滚动，避免撑破页面 */
  table { display: block; width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; }
  table thead, table tbody { display: table; width: 100%; min-width: 520px; }
  code { word-break: break-word; }
  td code, th code { white-space: normal; }
  pre { overflow-x: auto; max-width: 100%; }
}

@media print {
  .topbar, .sidebar, .pager { display: none !important; }
  .book { grid-template-columns: 1fr; }
  main { padding: 0; }
  figure img { box-shadow: none; }
  h2 { page-break-after: avoid; }
  figure { page-break-inside: avoid; }
}
