/* ============================================================
   site.css — 第八十一难猴 个人站
   浅色极简为默认，暗色通过 [data-theme] 切换；无外部字体/CDN。
   间距刻度：4 / 8 / 12 / 16 / 24 / 32 / 48 / 64 / 96
   ============================================================ */

:root {
  --bg: #ffffff;
  --surface: #f7f8fa;
  --surface-2: #eef1f5;
  --text: #18191c;
  --muted: #6b7280;
  --faint: #9ca3af;
  --border: #e5e7eb;
  --accent: #2563eb;
  --accent-soft: #eff5ff;
  --footer: #18191c;
  --footer-text: #d1d5db;
  --code-bg: #f2f2f2;
  --code-text: #24292f;
  --tok-comment: #6a737d;
  --tok-string: #0a7b4b;
  --tok-number: #b45309;
  --tok-keyword: #7c3aed;
  --tok-builtin: #1d6fb8;
  --shadow: 0 1px 2px rgba(16, 24, 40, .04);
  --radius: 12px;
  --wrap: 1120px;
}

[data-theme="dark"] {
  --bg: #101319;
  --surface: #171b22;
  --surface-2: #1d222b;
  --text: #e8eaed;
  --muted: #a1a9b6;
  --faint: #7d8694;
  --border: #262c36;
  --accent: #7aa8ff;
  --accent-soft: #1a2740;
  --footer: #0a0c10;
  --footer-text: #a1a9b6;
  --code-bg: #1a1f27;
  --code-text: #d7dbe2;
  --tok-comment: #7d8694;
  --tok-string: #7fd1a4;
  --tok-number: #f0b775;
  --tok-keyword: #c4a7ff;
  --tok-builtin: #8cc4ff;
  --shadow: 0 1px 2px rgba(0, 0, 0, .3);
}

*, *::before, *::after { box-sizing: border-box; }
/* 类选择器的 display 会盖过 [hidden] 的 UA 样式，搜索过滤依赖此规则 */
[hidden] { display: none !important; }

html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB",
               "Noto Sans SC", "Microsoft YaHei", "Segoe UI", sans-serif;
  font-size: 16px;
  line-height: 1.75;
  -webkit-font-smoothing: antialiased;
}

img { max-width: 100%; height: auto; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
button { font: inherit; }

.wrap { width: min(100% - 48px, var(--wrap)); margin-inline: auto; }
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.skip-link {
  position: absolute; left: 16px; top: -60px; z-index: 100;
  background: var(--accent); color: #fff; padding: 8px 16px; border-radius: 6px;
}
.skip-link:focus { top: 12px; }

:where(a, button, input, summary):focus-visible {
  outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 4px;
}

/* ---------- Header ---------- */
.site-header {
  border-bottom: 1px solid var(--border);
  background: var(--bg);
  position: sticky; top: 0; z-index: 40;
}
.site-header__inner {
  min-height: 72px; display: flex; align-items: center; gap: 24px;
}
.brand {
  color: var(--accent); font-size: 20px; font-weight: 700;
  letter-spacing: .02em; white-space: nowrap; text-decoration: none;
}
.brand:hover { text-decoration: none; opacity: .82; }
.nav { display: flex; gap: 4px; margin-left: auto; }
.nav__link {
  color: var(--muted); font-size: 15px; font-weight: 500;
  padding: 8px 14px; border-radius: 8px; white-space: nowrap;
}
.nav__link:hover { color: var(--text); background: var(--surface); text-decoration: none; }
.nav__link[aria-current="page"] { color: var(--text); font-weight: 700; background: var(--surface); }

.theme-toggle {
  display: inline-flex; align-items: center; gap: 6px;
  background: transparent; color: var(--muted);
  border: 1px solid var(--border); border-radius: 8px;
  padding: 6px 10px; cursor: pointer; margin-left: auto;
  transition: color .18s, border-color .18s, background .18s;
}
.theme-toggle:hover { color: var(--text); border-color: var(--accent); background: var(--surface); }
.theme-toggle__label { font-size: 13px; }
[data-theme="dark"] .theme-toggle svg { transform: rotate(180deg); }

/* ---------- Hero ---------- */
.hero { position: relative; overflow: hidden; border-bottom: 1px solid var(--border); }
.hero__bg {
  position: absolute; inset: 0;
  background: url("../images/background.webp") center / cover no-repeat;
  opacity: .15; pointer-events: none;
}
[data-theme="dark"] .hero__bg { opacity: .10; }
.hero__inner { position: relative; padding-block: 96px 104px; }
.eyebrow {
  margin: 0 0 16px; font-size: 13px; font-weight: 600;
  letter-spacing: .12em; color: var(--accent); text-transform: uppercase;
}
.hero__title {
  margin: 0; font-size: clamp(32px, 5.2vw, 52px); line-height: 1.25;
  font-weight: 700; letter-spacing: -.02em;
}
.hero__lead { margin: 20px 0 0; font-size: 18px; color: var(--muted); max-width: 60ch; }
.hero__actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 32px; }

.btn {
  display: inline-flex; align-items: center; justify-content: center;
  padding: 12px 24px; border-radius: 8px; font-size: 15px; font-weight: 600;
  border: 1px solid transparent; cursor: pointer;
  transition: transform .18s, background .18s, border-color .18s, color .18s;
}
.btn:hover { text-decoration: none; transform: translateY(-1px); }
.btn:active { transform: scale(.98); }
.btn--primary { background: var(--accent); color: #fff; }
.btn--primary:hover { filter: brightness(1.08); }
.btn--ghost { background: var(--bg); color: var(--text); border-color: var(--border); }
.btn--ghost:hover { border-color: var(--accent); color: var(--accent); }

/* ---------- Sections ---------- */
.section { padding-block: 64px; }
.section--tint { background: var(--surface); border-block: 1px solid var(--border); }
.section__head {
  display: flex; align-items: flex-end; justify-content: space-between;
  gap: 24px; flex-wrap: wrap; margin-bottom: 16px;
}
.section__head .eyebrow { margin-bottom: 8px; }
.section h2 { margin: 0; font-size: clamp(24px, 3vw, 32px); letter-spacing: -.01em; }
.section__intro { margin: 0 0 32px; color: var(--muted); max-width: 70ch; }
.text-link { font-size: 15px; font-weight: 600; white-space: nowrap; }

.topics {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 16px;
}
.topic {
  position: relative; display: block; padding: 24px;
  background: var(--bg); border: 1px solid var(--border);
  border-radius: var(--radius); color: var(--text);
  transition: transform .18s, border-color .18s, box-shadow .18s;
}
.topic:hover { text-decoration: none; transform: translateY(-2px); border-color: var(--accent); box-shadow: var(--shadow); }
.topic__count { font-size: 13px; font-weight: 700; color: var(--accent); letter-spacing: .08em; }
.topic__title { margin: 12px 0 8px; font-size: 18px; }
.topic__desc { margin: 0; font-size: 14px; color: var(--muted); line-height: 1.7; }
.topic__arrow { position: absolute; right: 20px; top: 22px; color: var(--faint); font-size: 18px; }

.split { display: grid; grid-template-columns: 1.3fr 1fr; gap: 48px; align-items: center; }
.stat-list { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.stat-list li {
  background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 20px 12px; text-align: center;
}
.stat-list strong { display: block; font-size: 28px; color: var(--accent); line-height: 1.2; }
.stat-list span { font-size: 13px; color: var(--muted); }

/* ---------- Page head ---------- */
.page-head { padding-block: 64px 32px; border-bottom: 1px solid var(--border); }
.page-head--compact { padding-block: 48px 28px; }
.page-head h1 { margin: 0; font-size: clamp(30px, 4vw, 40px); letter-spacing: -.02em; }
.page-head__lead { margin: 12px 0 0; font-size: 17px; color: var(--muted); max-width: 70ch; }

/* ---------- Grids / cards ---------- */
.grid { display: grid; gap: 20px; }
.grid--3 { grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); }

.course, .software {
  display: flex; flex-direction: column; padding: 24px;
  background: var(--bg); border: 1px solid var(--border);
  border-radius: var(--radius); color: var(--text);
  transition: transform .18s, border-color .18s, box-shadow .18s;
}
.course:hover, .software:hover { text-decoration: none; transform: translateY(-2px); border-color: var(--accent); box-shadow: var(--shadow); }
.course__top { display: flex; justify-content: space-between; align-items: center; }
.course__no { font-size: 13px; font-weight: 700; color: var(--accent); letter-spacing: .08em; }
.course__num { font-size: 13px; color: var(--faint); }
.course__title { margin: 16px 0 8px; font-size: 19px; }
.course__desc { margin: 0; font-size: 14px; color: var(--muted); line-height: 1.7; flex: 1; }
.course__first { margin: 16px 0 0; font-size: 13px; color: var(--faint); }
.course__cta { margin-top: 16px; font-size: 14px; font-weight: 600; color: var(--accent); }

.software__thumb {
  aspect-ratio: 16 / 9; border-radius: 8px; margin-bottom: 16px;
  background: var(--surface-2); border: 1px dashed var(--border);
  display: grid; place-items: center; color: var(--faint); font-size: 13px;
}
.software__title { margin: 0 0 8px; font-size: 18px; }
.software__desc { margin: 0; font-size: 14px; color: var(--muted); line-height: 1.7; flex: 1; }
.software__link { margin-top: 16px; font-size: 14px; font-weight: 600; color: var(--faint); cursor: default; }

.software { text-decoration: none; width: 100%; max-width: 320px; }
.software__thumb svg { color: var(--faint); }

.callout, .note-box {
  background: var(--accent-soft); border: 1px solid var(--border);
  border-left: 3px solid var(--accent); border-radius: 8px;
  padding: 16px 20px; margin-bottom: 32px; font-size: 14px; color: var(--muted);
}
.callout strong { color: var(--text); }
.note-box { margin: 0; }
.note-box h2 { font-size: 19px; margin: 0 0 8px; }
.note-box p { margin: 0; }
code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
  font-size: .88em; background: var(--code-bg); color: var(--code-text);
  padding: 2px 6px; border-radius: 4px;
}

/* ---------- Search ---------- */
.search {
  display: flex; align-items: center; gap: 12px; margin-top: 28px;
  background: var(--bg); border: 1px solid var(--border); border-radius: 10px;
  padding: 12px 16px; max-width: 640px; color: var(--faint);
}
.search:focus-within { border-color: var(--accent); }
.search input {
  flex: 1; min-width: 0; border: 0; outline: 0; background: transparent;
  color: var(--text); font-size: 15px;
}
.search input::placeholder { color: var(--faint); }
.search__count { font-size: 13px; white-space: nowrap; }
.empty-state { padding: 32px; text-align: center; color: var(--muted); background: var(--surface); border-radius: var(--radius); }

/* ---------- Notes index ---------- */
.note-group { margin-bottom: 48px; scroll-margin-top: 90px; }
.note-group__head { display: flex; align-items: baseline; gap: 12px; border-bottom: 1px solid var(--border); padding-bottom: 12px; }
.note-group__head h2 { margin: 0; font-size: 22px; }
.count { font-size: 13px; color: var(--faint); }
.note-group__desc { margin: 12px 0 20px; font-size: 14px; color: var(--muted); }
.note-rows { display: grid; gap: 8px; }
.note-row {
  display: flex; align-items: center; gap: 16px; padding: 12px 16px;
  border: 1px solid var(--border); border-radius: 10px; background: var(--bg);
  color: var(--text); transition: border-color .18s, background .18s;
}
.note-row:hover { text-decoration: none; border-color: var(--accent); background: var(--surface); }
.note-row__thumb { width: 120px; height: 72px; object-fit: cover; border-radius: 6px; background: var(--surface-2); flex: none; }
.note-row__body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.note-row__body strong { font-size: 15px; font-weight: 600; }
.note-row__summary {
  font-size: 13px; color: var(--muted); overflow: hidden;
  text-overflow: ellipsis; white-space: nowrap;
}
.note-row__go { color: var(--faint); flex: none; }

/* ---------- Note article ---------- */
.note { padding-block: 32px 64px; }
.breadcrumb { display: flex; flex-wrap: wrap; gap: 8px; font-size: 13px; color: var(--faint); margin-bottom: 32px; }
.breadcrumb a { color: var(--muted); }
.note__head { border-bottom: 1px solid var(--border); padding-bottom: 24px; margin-bottom: 32px; }
.note__head h1 { margin: 0; font-size: clamp(28px, 3.6vw, 38px); letter-spacing: -.02em; }
.note__body { max-width: 860px; }

.prose h1, .prose h2, .prose h3, .prose h4, .prose h5, .prose h6 { line-height: 1.4; letter-spacing: -.01em; }
.prose h1 { font-size: 30px; margin: 48px 0 16px; }
.prose h2 { font-size: 24px; margin: 40px 0 16px; padding-top: 8px; border-top: 1px solid var(--border); }
.prose h3 { font-size: 19px; margin: 28px 0 12px; }
.prose h4 { font-size: 16px; margin: 24px 0 8px; }
.prose h5 { font-size: 15px; margin: 20px 0 8px; color: var(--muted); }
.prose h6 { font-size: 14px; margin: 16px 0 8px; color: var(--muted); }
.prose > h2:first-child, .note__body > h1:first-child { margin-top: 0; border-top: 0; }
.prose p, .prose li { font-size: 15.5px; line-height: 1.85; }
.prose p { margin: 0 0 16px; }
.prose ul, .prose ol { padding-left: 24px; margin: 0 0 20px; }
.prose li { margin-bottom: 4px; }
.prose blockquote {
  margin: 20px 0; padding: 8px 20px; border-left: 3px solid var(--accent);
  background: var(--accent-soft); color: var(--muted); border-radius: 0 8px 8px 0;
}
.prose blockquote p:last-child { margin-bottom: 0; }
.prose hr { border: 0; border-top: 1px solid var(--border); margin: 32px 0; }
.prose table { width: 100%; border-collapse: collapse; margin: 20px 0; font-size: 14px; display: block; overflow-x: auto; }
.prose th, .prose td { border: 1px solid var(--border); padding: 8px 12px; text-align: left; }
.prose th { background: var(--surface); font-weight: 600; }
.prose img { display: block; margin: 20px auto; border-radius: 8px; background: var(--surface); }
.prose a { text-decoration: underline; text-underline-offset: 2px; }
.prose pre {
  margin: 20px 0; padding: 16px 20px; overflow-x: auto;
  background: var(--code-bg); border: 1px solid var(--border); border-radius: 8px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
  font-size: 13.5px; line-height: 1.7; color: var(--code-text);
}
.prose pre code { background: none; padding: 0; font-size: inherit; color: inherit; }
.prose .code--output { background: var(--surface); color: var(--muted); }
.tok-comment { color: var(--tok-comment); font-style: italic; }
.tok-string { color: var(--tok-string); }
.tok-number { color: var(--tok-number); }
.tok-keyword { color: var(--tok-keyword); font-weight: 600; }
.tok-builtin { color: var(--tok-builtin); }

.about-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 16px; margin: 24px 0 8px; }
.about-grid > div { padding: 20px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); }
.about-grid h3 { margin: 0 0 8px; font-size: 17px; }
.about-grid p { margin: 0; font-size: 14px; color: var(--muted); }
.about-contact { background: var(--accent-soft); padding: 16px 20px; border-radius: 8px; }

.pager { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 48px; }
.pager__item {
  display: flex; flex-direction: column; gap: 4px; padding: 16px 20px;
  border: 1px solid var(--border); border-radius: 10px; color: var(--text);
}
.pager__item:hover { text-decoration: none; border-color: var(--accent); }
.pager__item span { font-size: 12px; color: var(--faint); }
.pager__item strong { font-size: 15px; font-weight: 600; }
.pager__item--next { text-align: right; }
.pager__item--empty { visibility: hidden; }
.note__back { margin-top: 32px; }

/* ---------- Footer ---------- */
.site-footer { background: var(--footer); color: var(--footer-text); padding-block: 48px; }
.site-footer__inner { display: flex; justify-content: space-between; gap: 24px; flex-wrap: wrap; align-items: center; }
.site-footer__brand { color: #fff; font-size: 18px; font-weight: 700; }
.site-footer__copy { margin: 8px 0 0; font-size: 13px; color: var(--faint); }
.site-footer__links { display: flex; gap: 24px; font-size: 14px; color: var(--footer-text); }
.site-footer__links a { color: var(--footer-text); }
.site-footer__links a:hover { color: #fff; }

/* ---------- Tutorial 三栏布局 ---------- */
.tut {
  display: grid;
  grid-template-columns: 264px minmax(0, 1fr) 248px;
  gap: 32px;
  width: min(100% - 48px, 1360px);
  margin-inline: auto;
  padding-block: 28px 72px;
  align-items: start;
}
.tut__side {
  position: sticky;
  top: 88px;
  align-self: start;
  max-height: calc(100vh - 104px);
  overflow-y: auto;
  scrollbar-width: thin;
}
.tut__main { min-width: 0; }

/* 左：目录树 */
.tree__title {
  margin: 0 0 12px; font-size: 12px; font-weight: 700; letter-spacing: .12em;
  text-transform: uppercase; color: var(--faint);
}
.tree__list { list-style: none; margin: 0; padding: 0; }
.tree__group { border-left: 2px solid var(--border); margin-bottom: 2px; }
.tree__groupbtn {
  display: flex; align-items: center; gap: 8px; width: 100%;
  background: transparent; border: 0; cursor: pointer;
  text-align: left; color: var(--text); font-size: 15px; font-weight: 600;
  padding: 8px 10px; border-radius: 8px;
}
.tree__groupbtn:hover { background: var(--surface); }
.tree__caret {
  width: 0; height: 0; border-left: 5px solid var(--muted); border-top: 4px solid transparent;
  border-bottom: 4px solid transparent; transition: transform .18s; flex: none;
}
.tree__group.is-open > .tree__groupbtn .tree__caret { transform: rotate(90deg); }
.tree__groupbtn[aria-expanded="true"] .tree__caret { transform: rotate(90deg); }
.tree__count { margin-left: auto; font-size: 12px; color: var(--faint); font-weight: 500; }
.tree__chapters {
  list-style: none; margin: 0; padding: 0 0 4px;
  display: none;
}
.tree__group.is-open > .tree__chapters { display: block; }
.tree__link {
  display: block; padding: 6px 10px 6px 26px; border-radius: 7px;
  color: var(--muted); font-size: 14px; line-height: 1.5;
  border-left: 2px solid transparent; margin-left: -2px;
}
.tree__link:hover { background: var(--surface); color: var(--text); text-decoration: none; }
.tree__link.is-active { color: var(--accent); background: var(--accent-soft); font-weight: 600; }

/* 中：正文 */
.tut__article { max-width: 880px; margin-inline: auto; }
.tut__head { border-bottom: 1px solid var(--border); padding-bottom: 20px; margin-bottom: 28px; }
.tut__head h1 { margin: 8px 0 0; font-size: clamp(26px, 3.4vw, 36px); letter-spacing: -.02em; }
.tut__back { margin-top: 32px; }
.tut__hub h1 { margin: 0; font-size: clamp(30px, 4vw, 40px); letter-spacing: -.02em; }
.tut__hubsec { scroll-margin-top: 90px; padding-top: 32px; border-top: 1px solid var(--border); margin-top: 32px; }
.tut__hubsec:first-of-type { border-top: 0; }
.tut__hubsec h2 { margin: 0 0 8px; font-size: 22px; }
.tut__hubsec .count { font-size: 13px; color: var(--faint); font-weight: 500; }
.tut__hubdesc { margin: 0 0 16px; color: var(--muted); font-size: 14.5px; }
.tut__hubchaps { display: flex; flex-wrap: wrap; gap: 8px; }
.tut__hubchap {
  font-size: 13.5px; padding: 6px 12px; border: 1px solid var(--border);
  border-radius: 999px; color: var(--muted); background: var(--bg);
}
.tut__hubchap:hover { border-color: var(--accent); color: var(--accent); text-decoration: none; background: var(--surface); }

/* 右：本章小节 + 位置缩略图 */
.tut__toc { padding-left: 4px; }
.tut__toctitle {
  margin: 0 0 12px; font-size: 12px; font-weight: 700; letter-spacing: .12em;
  text-transform: uppercase; color: var(--faint);
}
.tut__tocempty { font-size: 13px; color: var(--faint); }
.toc { display: flex; flex-direction: column; gap: 2px; }
.toc__link {
  display: block; padding: 6px 10px; border-radius: 7px;
  color: var(--muted); font-size: 13.5px; line-height: 1.5;
  border-left: 2px solid transparent;
}
.toc__link:hover { background: var(--surface); color: var(--text); text-decoration: none; }
.toc__link--sub { padding-left: 22px; font-size: 13px; }
.toc__link.is-active { color: var(--accent); border-left-color: var(--accent); font-weight: 600; }

/* 位置缩略图（minimap） */
.minimap-wrap { margin-top: 22px; }
.minimap__label {
  margin: 0 0 8px; font-size: 11px; font-weight: 700; letter-spacing: .1em;
  text-transform: uppercase; color: var(--faint);
}
.minimap {
  position: relative; height: 220px; border-radius: 8px;
  background: var(--surface); border: 1px solid var(--border);
  padding: 10px 12px;
}
.minimap__track { position: absolute; left: 16px; top: 10px; bottom: 10px; width: 2px; background: var(--border); border-radius: 2px; }
.minimap__view {
  position: absolute; left: 14px; width: 6px; border-radius: 3px; background: var(--accent);
  opacity: .5; top: 10px; height: 0;
}
.minimap__tick {
  position: absolute; left: 12px; width: 10px; height: 10px; border-radius: 50%;
  background: var(--bg); border: 2px solid var(--border); transform: translateY(-50%);
  cursor: pointer; padding: 0; z-index: 1;
}
.minimap__tick:hover { border-color: var(--accent); }
.minimap__tick.is-active { background: var(--accent); border-color: var(--accent); }

/* 移动端抽屉按钮（桌面隐藏） */
.tut__drawer {
  display: none; position: fixed; bottom: 20px; z-index: 55;
  padding: 10px 16px; border-radius: 999px; border: 1px solid var(--border);
  background: var(--bg); color: var(--text); font-weight: 600; font-size: 14px;
  box-shadow: var(--shadow); cursor: pointer;
}
.tut__drawer--left { left: 20px; }
.tut__drawer--right { right: 20px; }
.tut__backdrop {
  display: none; position: fixed; inset: 0; z-index: 58;
  background: rgba(16, 24, 40, .42);
}
.tut__backdrop.is-open { display: block; }

/* ---------- Motion (respect reduced-motion) ---------- */
@media (prefers-reduced-motion: no-preference) {
  .hero__inner > *, .topic, .course, .software { animation: rise .5s cubic-bezier(.16, 1, .3, 1) both; }
  .hero__inner > *:nth-child(2) { animation-delay: .06s; }
  .hero__inner > *:nth-child(3) { animation-delay: .12s; }
  .hero__inner > *:nth-child(4) { animation-delay: .18s; }
}
@keyframes rise { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

/* ---------- Responsive ---------- */
@media (max-width: 1180px) {
  .tut { grid-template-columns: 240px minmax(0, 1fr); }
  .tut__side--right {
    position: fixed; top: 0; bottom: 0; right: 0; width: 82%; max-width: 320px;
    background: var(--bg); z-index: 60; overflow-y: auto; padding: 72px 16px 24px;
    transform: translateX(100%); transition: transform .22s ease; border-left: 1px solid var(--border);
    box-shadow: 0 12px 40px rgba(0,0,0,.18);
  }
  .tut__side--right.is-open { transform: none; }
  .tut__drawer--right { display: inline-flex; }
}
@media (max-width: 1024px) {
  .split { grid-template-columns: 1fr; gap: 32px; }
}
@media (max-width: 860px) {
  .tut { grid-template-columns: minmax(0, 1fr); width: min(100% - 32px, 1360px); }
  .tut__side--left {
    position: fixed; top: 0; bottom: 0; left: 0; width: 82%;
    max-width: 320px; background: var(--bg); z-index: 60; overflow-y: auto;
    transform: translateX(-100%); transition: transform .22s ease; box-shadow: 0 12px 40px rgba(0,0,0,.18);
    padding: 72px 16px 24px; border-right: 1px solid var(--border);
  }
  .tut__side--left.is-open { transform: none; }
  .tut__drawer--left { display: inline-flex; }
}
@media (max-width: 720px) {
  .wrap { width: min(100% - 32px, var(--wrap)); }
  .site-header__inner { min-height: 60px; gap: 8px; flex-wrap: wrap; padding-block: 8px; }
  .brand { font-size: 17px; }
  .theme-toggle { order: 2; padding: 5px 8px; }
  .theme-toggle__label { display: none; }
  .nav {
    order: 3; width: 100%; margin-left: 0; gap: 2px;
    overflow-x: auto; -webkit-overflow-scrolling: touch; scrollbar-width: none;
  }
  .nav::-webkit-scrollbar { display: none; }
  .nav__link { padding: 6px 12px; font-size: 14px; }
  .hero__inner { padding-block: 64px 72px; }
  .section { padding-block: 48px; }
  .page-head { padding-block: 48px 24px; }
  .section__intro { margin-bottom: 24px; }
  .stat-list { grid-template-columns: repeat(3, 1fr); }
  .stat-list strong { font-size: 22px; }
  .note-row { padding: 10px 12px; gap: 10px; }
  .note-row__thumb { width: 72px; height: 54px; }
  .note-row__summary { display: none; }
  .pager { grid-template-columns: 1fr; }
  .pager__item--empty { display: none; }
  .pager__item--next { text-align: left; }
  .prose pre { font-size: 12.5px; padding: 12px 14px; }
  .site-footer__inner { flex-direction: column; align-items: flex-start; }
}
@media (max-width: 360px) {
  .wrap { width: min(100% - 24px, var(--wrap)); }
  .hero__title { font-size: 28px; }
  .stat-list { gap: 6px; }
  .stat-list li { padding: 14px 6px; }
}
