/* ---- Marginalia · 页边批注 ---- */
/* Type-driven editorial style. Warm off-white paper, deep ink, brick-red accent. */

:root {
  --bg: #fbf8f1;
  --bg-tint: #f4ecd9;
  --paper-edge: #efe6cf;
  --ink: #1f1d1b;
  --ink-soft: #4a443e;
  --muted: #8a7f73;
  --rule: #e3d9c2;
  --rule-soft: #ece4d1;
  --accent: #8b2e2a;
  --accent-soft: #b8615c;
  --code-bg: #f0e8d3;

  --serif: 'Iowan Old Style', 'Apple Garamond', 'Source Serif 4', 'Source Serif Pro', ui-serif,
           Georgia, Cambria, 'Songti SC', 'Source Han Serif SC', 'Noto Serif CJK SC', 'STSong',
           'Times New Roman', serif;
  --sans:  -apple-system, BlinkMacSystemFont, 'Inter', 'Segoe UI', system-ui,
           'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', 'Helvetica Neue', Helvetica, sans-serif;
  --mono:  ui-monospace, 'SF Mono', SFMono-Regular, 'JetBrains Mono', Menlo, Consolas,
           'Liberation Mono', monospace;

  --measure: 720px;   /* reading column — articles & prose pages */
  --wide:   1080px;   /* header + listing/landing pages (cards, grids, catalogs) */

  --header-bg: rgba(251, 248, 241, 0.85);
  --shadow-pop: 0 18px 50px rgba(31, 29, 27, 0.18);

  /* per-type badge hues (索引 / 搜索共用) */
  --c-note:  #8b2e2a;
  --c-hot:   #a05a1e;
  --c-video: #2e5e8b;
  --c-game:  #44763a;
  --c-show:  #6b5435;
  --c-app:   #2e7a72;
}

/* ---- 夜读 · dark theme ---- */
[data-theme="dark"] {
  --bg: #16120d;
  --bg-tint: #1e1812;
  --paper-edge: #2a2118;
  --ink: #ede3cf;
  --ink-soft: #c9baa1;
  --muted: #8e8170;
  --rule: #352b1f;
  --rule-soft: #271f16;
  --accent: #d07a64;
  --accent-soft: #a85a48;
  --code-bg: #241d14;

  --header-bg: rgba(22, 18, 13, 0.82);
  --shadow-pop: 0 18px 50px rgba(0, 0, 0, 0.55);

  --c-note:  #d98a7e;
  --c-hot:   #d99a55;
  --c-video: #82aed4;
  --c-game:  #8fbd80;
  --c-show:  #c4a878;
  --c-app:   #82c2b9;
}
body, .site-header, .site-footer { transition: background-color .25s ease, color .25s ease, border-color .25s ease; }

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--serif);
  font-size: 18px;
  line-height: 1.72;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  font-feature-settings: "kern", "liga", "onum";
}

::selection { background: var(--accent); color: var(--bg); }

/* paper-edge subtle texture via a pseudo line at the very top */
body::before {
  content: "";
  position: fixed;
  inset: 0 0 auto 0;
  height: 4px;
  background: linear-gradient(90deg, var(--accent) 0, var(--accent) 28%, var(--paper-edge) 28%);
  z-index: 20;
}

/* ---- Layout wrappers ---- */
.wrap {
  max-width: var(--measure);
  margin: 0 auto;
  padding: 0 1.5rem;
}
/* listing/landing pages (home, ai-hot, apps, videos, showcases) breathe wider */
.wrap--wide { max-width: var(--wide); }
.site-main { padding: 3.5rem 0 4rem; }

/* ---- Header ---- */
.site-header {
  border-bottom: 1px solid var(--rule);
  background: var(--header-bg);
  backdrop-filter: saturate(140%) blur(8px);
  -webkit-backdrop-filter: saturate(140%) blur(8px);
  position: sticky;
  top: 0;
  z-index: 15;
}
.header-wrap {
  max-width: var(--wide);
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 2rem;
  padding-top: 1.4rem;
  padding-bottom: 1.4rem;
}
.brand {
  display: flex;
  align-items: baseline;
  gap: .55rem;
  border-bottom: none;
  color: var(--ink);
  text-decoration: none;
}
.brand-mark {
  font-family: var(--serif);
  font-size: 1.85rem;
  line-height: 1;
  color: var(--accent);
  font-weight: 700;
  transform: translateY(2px);
}
.brand-text {
  font-family: var(--serif);
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: .005em;
}
.brand-tag {
  font-family: var(--sans);
  font-size: .82rem;
  color: var(--muted);
  letter-spacing: .03em;
  margin-left: .4rem;
}
.site-nav {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: .55rem 1.1rem;
  font-family: var(--sans);
  font-size: .9rem;
}
.site-nav a {
  color: var(--ink-soft);
  border-bottom: none;
  position: relative;
}
.site-nav a:hover { color: var(--accent); }
.site-nav a:hover::after {
  content: "";
  position: absolute;
  left: 0; right: 0; bottom: -.25em;
  height: 1px; background: var(--accent);
}

/* ---- Typography ---- */
h1, h2, h3, h4, h5 {
  font-family: var(--serif);
  font-weight: 700;
  line-height: 1.25;
  color: var(--ink);
  letter-spacing: -0.005em;
  margin: 0 0 .5em;
}
h1 { font-size: 2.6rem; }
h2 {
  font-size: 1.55rem;
  margin: 2.4em 0 .8em;
  padding-bottom: .3em;
  border-bottom: 1px solid var(--rule);
}
h3 { font-size: 1.22rem; margin: 2em 0 .5em; }
h4 { font-size: 1.05rem; margin: 1.6em 0 .4em; color: var(--ink-soft); }

p, ul, ol, blockquote, pre, table, figure { margin: 0 0 1.15em; }

a {
  color: var(--accent);
  text-decoration: none;
  border-bottom: 1px solid rgba(139, 46, 42, 0.28);
  transition: border-color .15s, background .15s;
}
a:hover { border-bottom-color: var(--accent); background: rgba(139, 46, 42, 0.06); }

strong, b { font-weight: 700; color: var(--ink); }
em, i { font-style: italic; }

blockquote {
  border-left: 3px solid var(--accent);
  background: var(--rule-soft);
  padding: .6em 1.1em;
  color: var(--ink-soft);
  margin-left: 0;
  margin-right: 0;
  font-style: italic;
  border-radius: 0 4px 4px 0;
}
blockquote p:last-child { margin-bottom: 0; }

hr {
  border: none;
  border-top: 1px solid var(--rule);
  margin: 2.8em 0;
  position: relative;
}
hr::after {
  content: "❦";
  position: absolute;
  left: 50%; top: 50%;
  transform: translate(-50%, -50%);
  background: var(--bg);
  padding: 0 .6em;
  color: var(--muted);
  font-size: .9em;
}

code {
  font-family: var(--mono);
  font-size: .9em;
  background: var(--code-bg);
  padding: .14em .4em;
  border-radius: 3px;
  color: var(--ink);
}
pre {
  background: var(--code-bg);
  padding: 1em 1.15em;
  border-radius: 4px;
  overflow-x: auto;
  font-size: .87em;
  line-height: 1.6;
  border-left: 3px solid var(--rule);
}
pre code { background: transparent; padding: 0; font-size: inherit; color: var(--ink); }

table {
  border-collapse: collapse;
  width: 100%;
  font-family: var(--sans);
  font-size: .94rem;
  border-top: 1px solid var(--rule);
  border-bottom: 1px solid var(--rule);
}
th, td { padding: .6em .9em; border-bottom: 1px solid var(--rule); text-align: left; vertical-align: top; }
th { font-weight: 600; color: var(--ink-soft); background: var(--rule-soft); }
tr:last-child td { border-bottom: none; }

img, video { max-width: 100%; height: auto; }
figure { margin: 1.5em 0; }
figcaption { font-family: var(--sans); font-size: .85rem; color: var(--muted); text-align: center; margin-top: .4em; }

ul, ol { padding-left: 1.4em; }
li { margin-bottom: .35em; }
li > ul, li > ol { margin-top: .35em; margin-bottom: .35em; }

/* ---- Home: intro + post list ---- */
.intro {
  font-size: 1.15rem;
  line-height: 1.7;
  color: var(--ink-soft);
  border-bottom: 1px solid var(--rule);
  padding-bottom: 2.2rem;
  margin-bottom: 2.6rem;
  max-width: var(--measure);   /* keep the lede readable even inside a wide wrap */
}
.intro p { margin-bottom: 1em; }
.intro p:last-child { margin-bottom: 0; }
.intro strong { color: var(--ink); }
.intro a { font-weight: 600; }

.section-title {
  font-family: var(--sans);
  font-size: .78rem;
  font-weight: 700;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--muted);
  border: none;
  padding: 0;
  margin: 0 0 1.5rem;
}

.empty-state {
  font-family: var(--sans);
  font-size: .95rem;
  color: var(--muted);
  background: var(--rule-soft);
  padding: 1.2em 1.4em;
  border-radius: 4px;
  border-left: 3px solid var(--accent);
}

.posts { list-style: none; padding: 0; margin: 0; }
.post-item {
  padding: 1.7em 0;
  border-bottom: 1px solid var(--rule);
  display: grid;
  grid-template-columns: 7.5em 1fr;
  gap: 2.2rem;
  align-items: start;
}
.post-item:last-child { border-bottom: none; }

.margin-note {
  font-family: var(--sans);
  font-size: .82rem;
  color: var(--muted);
  text-align: right;
  padding-top: .55em;
  position: relative;
}
.margin-note::after {
  content: "";
  position: absolute;
  right: -1.1rem; top: .8em;
  width: 1px; height: 1.6em;
  background: var(--rule);
}
.margin-note time { display: block; font-variant-numeric: tabular-nums; line-height: 1.3; }
.margin-note .m-y { display: block; font-weight: 600; color: var(--ink-soft); letter-spacing: .04em; }
.margin-note .m-md { display: block; letter-spacing: .06em; }
.margin-note .tags {
  list-style: none; padding: 0; margin: .8em 0 0;
  display: flex; flex-direction: column; gap: .25em;
}
.margin-note .tags li { font-size: .72rem; letter-spacing: .03em; }

.post-summary h3 {
  margin: 0 0 .4em;
  font-size: 1.35rem;
  line-height: 1.3;
  letter-spacing: 0;
}
.post-summary h3 a {
  color: var(--ink);
  border-bottom: none;
  background: none;
}
.post-summary h3 a:hover { color: var(--accent); background: none; }

.excerpt {
  color: var(--ink-soft);
  margin: 0;
  font-size: 1rem;
  line-height: 1.65;
}

.post-summary.has-cover {
  display: flex;
  gap: 1.7rem;
  align-items: flex-start;
}
.post-summary-text { flex: 1 1 auto; min-width: 0; }
.post-thumb {
  flex: 0 0 12.5em;
  border-bottom: none;
  background: none;
  margin-top: .35em;
}
.post-thumb img {
  display: block;
  width: 100%;
  aspect-ratio: 16 / 10;
  object-fit: cover;
  border-radius: 3px;
  border: 1px solid var(--rule);
  filter: saturate(.94);
  transition: filter .25s ease, transform .25s ease;
}
.post-item:hover .post-thumb img {
  filter: saturate(1.05);
  transform: translateY(-2px);
}

/* ---- Post page ---- */
.post { padding-bottom: 2rem; }
.post-header {
  margin-bottom: 2.5rem;
  padding-bottom: 1.4rem;
  border-bottom: 1px solid var(--rule);
}
.kicker {
  font-family: var(--sans);
  font-size: .76rem;
  font-weight: 600;
  letter-spacing: .18em;
  text-transform: uppercase;
  color: var(--accent);
  margin: 0 0 .9em;
}
.post-header h1 {
  font-size: 2.7rem;
  margin: 0 0 .55rem;
  line-height: 1.2;
}
.post-meta {
  font-family: var(--sans);
  font-size: .9rem;
  color: var(--muted);
  margin: 0;
  display: flex;
  flex-wrap: wrap;
  gap: .35rem;
  align-items: baseline;
}
.post-meta .dot { color: var(--rule); }
.tags-inline span { color: var(--muted); }

.post-body > h2:first-child,
.post-body > h3:first-child {
  margin-top: 0;
}

.post-footer {
  margin-top: 3rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--rule);
}

/* ---- Post page · Table of Contents ----
 * Default (mobile / narrow): TOC is a collapsed <details> above the article.
 * Wide screens (≥1100px): TOC becomes a sticky sidebar to the LEFT of the
 * article. Article keeps its 720px reading measure; .post-wrap widens to
 * accommodate the sidebar without re-flowing the body. */
.post-wrap {
  max-width: var(--measure);
  margin: 0 auto;
  padding: 0 1.5rem;
}
.post-toc {
  font-family: var(--sans);
  font-size: .86rem;
  line-height: 1.55;
  margin: 0 0 2rem;
  border-left: 2px solid var(--rule);
  padding-left: 1rem;
}
.post-toc[hidden] { display: none; }
.toc-details > .toc-title {
  cursor: pointer;
  font-weight: 600;
  letter-spacing: .12em;
  text-transform: uppercase;
  font-size: .72rem;
  color: var(--accent);
  list-style: none;
  user-select: none;
}
.toc-details > .toc-title::-webkit-details-marker { display: none; }
.toc-details > .toc-title::before {
  content: "▸";
  display: inline-block;
  width: 1em;
  margin-right: .15em;
  transition: transform .15s ease;
  color: var(--muted);
}
.toc-details[open] > .toc-title::before { transform: rotate(90deg); }
.toc-details[open] > .toc-title { margin-bottom: .9rem; }

#toc .toc-list,
#toc .toc-sub {
  list-style: none;
  padding: 0;
  margin: 0;
}
#toc .toc-sub {
  margin: .15rem 0 .35rem .9rem;
  padding-left: .6rem;
  border-left: 1px solid var(--rule-soft);
}
#toc li {
  margin: .25rem 0;
  position: relative;
  padding-left: 1.05rem;
}
#toc a {
  display: block;
  color: var(--ink-soft);
  text-decoration: none;
  padding: .12rem .35rem;
  border-radius: 2px;
  border-bottom: none;
  background: none;
  transition: color .12s, background-color .12s;
  word-break: break-word;
}
#toc .toc-h3 a { font-size: .84rem; color: var(--ink-soft); }
#toc a:hover {
  color: var(--accent);
  background: var(--rule-soft);
}
#toc a.active {
  color: var(--accent);
  font-weight: 600;
  background: linear-gradient(90deg, var(--rule-soft) 0%, transparent 90%);
}
#toc a.active::before {
  content: "";
  display: inline-block;
  width: .35em;
  height: .35em;
  border-radius: 50%;
  background: var(--accent);
  margin-right: .55em;
  vertical-align: middle;
}

/* Collapse / expand toggle on parent list items. */
#toc .toc-toggle {
  position: absolute;
  left: 0;
  top: .15rem;
  width: 1rem;
  height: 1rem;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: .75rem;
  line-height: 1;
  cursor: pointer;
  transition: transform .15s ease, color .12s;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
#toc .toc-toggle:hover { color: var(--accent); }
#toc li.expanded > .toc-toggle { transform: rotate(90deg); }
#toc li.has-children > .toc-sub { display: none; }
#toc li.has-children.expanded > .toc-sub { display: block; }

@media (min-width: 1100px) {
  .post-wrap {
    max-width: 1080px;
    display: grid;
    grid-template-columns: 240px minmax(0, 720px);
    gap: 3rem;
    align-items: start;
  }
  .post-toc {
    position: sticky;
    top: 5rem;
    margin: 0;
    max-height: calc(100vh - 7rem);
    overflow-y: auto;
    overscroll-behavior: contain;
    /* hide scrollbar by default; show on hover for power users */
    scrollbar-width: thin;
    scrollbar-color: var(--rule) transparent;
  }
  .post-toc::-webkit-scrollbar { width: 6px; }
  .post-toc::-webkit-scrollbar-thumb {
    background: var(--rule);
    border-radius: 3px;
  }
  .toc-details > .toc-title { cursor: default; }
  /* On wide screens always show; the disclosure triangle is decoration only. */
}
.back {
  font-family: var(--sans);
  font-size: .92rem;
  color: var(--ink-soft);
  border-bottom: none;
}
.back:hover { color: var(--accent); background: none; }

/* ---- Static page ---- */
.page-header {
  margin-bottom: 2rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--rule);
}
.page-header h1 { font-size: 2.3rem; margin: 0; }

/* ---- Footer ---- */
.site-footer {
  border-top: 1px solid var(--rule);
  padding: 2.6rem 0 3rem;
  margin-top: 4rem;
  font-family: var(--sans);
  font-size: .85rem;
  color: var(--muted);
  text-align: center;
  background: var(--rule-soft);
}
.site-footer p { margin: 0; line-height: 1.7; }
.site-footer a { color: var(--ink-soft); border-bottom: 1px solid var(--rule); }
.site-footer a:hover { color: var(--accent); border-bottom-color: var(--accent); background: none; }
.site-footer .muted { color: var(--muted); font-style: italic; }

/* ---- Accessibility ---- */
.skip {
  position: absolute;
  left: -9999px;
  top: auto;
  width: 1px; height: 1px;
  overflow: hidden;
}
.skip:focus {
  position: fixed;
  top: 1em; left: 1em;
  width: auto; height: auto;
  background: var(--ink);
  color: var(--bg);
  padding: .55em 1em;
  z-index: 100;
  border-radius: 3px;
}

:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 2px; }

/* ---- AI Hot featured card (home page) ---- */
.ai-hot-feature {
  margin: 2rem 0 3rem;
  padding: 1.6rem 1.6rem 1.4rem;
  background: linear-gradient(180deg, var(--bg-tint) 0%, var(--bg) 100%);
  border: 1px solid var(--rule);
  border-left: 4px solid var(--accent);
  border-radius: 4px;
  position: relative;
}
.ai-hot-feature::before {
  content: "";
  position: absolute;
  top: -1px; right: -1px;
  width: 40px; height: 40px;
  background: linear-gradient(135deg, transparent 50%, var(--accent-soft) 50%);
  opacity: 0.25;
  border-radius: 0 4px 0 0;
}
.ai-hot-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  margin-bottom: .9rem;
  flex-wrap: wrap;
}
.ai-hot-pill {
  font-family: var(--sans);
  font-size: .78rem;
  letter-spacing: .04em;
  color: var(--accent);
  font-weight: 600;
  text-transform: uppercase;
}
.ai-hot-time {
  font-family: var(--mono);
  font-size: .82rem;
  color: var(--muted);
}
.ai-hot-title {
  font-family: var(--serif);
  font-size: 1.7rem;
  line-height: 1.3;
  margin: .2rem 0 .7rem;
  color: var(--ink);
  font-weight: 700;
}
.ai-hot-title a {
  color: inherit;
  border-bottom: none;
  text-decoration: none;
}
.ai-hot-title a:hover { color: var(--accent); }
.ai-hot-excerpt {
  margin: 0 0 1rem;
  color: var(--ink-soft);
  font-size: 1rem;
  line-height: 1.65;
}
.ai-hot-cta {
  display: inline-block;
  font-family: var(--sans);
  font-size: .9rem;
  color: var(--accent);
  border-bottom: 1px solid var(--accent);
  padding-bottom: 1px;
}
.ai-hot-cta:hover {
  color: var(--ink);
  border-color: var(--ink);
}

/* AI 晨报正文：图片美化 + 板块分隔 */
.post-content img,
.ai-hot-body img {
  max-width: 100%;
  height: auto;
  border-radius: 3px;
  margin: 1.2rem auto;
  display: block;
  box-shadow: 0 1px 3px rgba(31, 29, 27, 0.08);
}

/* AI Hot 文章页：双栏布局（左侧粘性 TOC + 右侧正文） */
.ai-hot-wrap {
  max-width: 1180px;
  margin: 0 auto;
  padding: 0 1.5rem;
  display: grid;
  grid-template-columns: 240px minmax(0, 1fr);
  gap: 3rem;
  /* 不设 align-items: start — 让 grid item 默认 stretch，
     这样 .ai-hot-toc 占满整列高度，内部 .toc-inner 才有滚动余地能 sticky */
}
.ai-hot-post {
  grid-column: 2;
  min-width: 0;
}
.ai-hot-post .post-header {
  margin-top: 0;
}
.ai-hot-toc {
  grid-column: 1;
  grid-row: 1;
  /* 默认 stretch — 关键：必须撑满文章高度，sticky 才有滚动空间 */
}
.ai-hot-toc .toc-inner {
  position: sticky;
  top: 6rem;
  padding: 1.2rem 1rem 1rem;
  border-right: 2px solid var(--rule);
  font-family: var(--sans);
  max-height: calc(100vh - 7rem);
  overflow-y: auto;
}
.ai-hot-toc .toc-title {
  font-size: .78rem;
  font-weight: 600;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 0 0 .9rem;
}
.ai-hot-toc ul {
  list-style: none;
  padding: 0;
  margin: 0 0 1rem;
}
.ai-hot-toc li {
  margin: 0;
}
.ai-hot-toc a {
  display: flex;
  align-items: center;
  gap: .55rem;
  padding: .45rem .55rem;
  color: var(--ink-soft);
  font-size: .92rem;
  border-bottom: none;
  border-radius: 3px;
  transition: background .15s, color .15s;
}
.ai-hot-toc a:hover {
  background: var(--bg-tint);
  color: var(--ink);
}
.ai-hot-toc a.active {
  color: var(--accent);
  background: var(--bg-tint);
  font-weight: 600;
}
.ai-hot-toc .toc-emoji {
  font-size: 1rem;
  line-height: 1;
  flex-shrink: 0;
}
.ai-hot-toc .toc-name {
  flex: 1;
}
.ai-hot-toc .toc-count {
  font-family: var(--mono);
  font-size: .72rem;
  color: var(--muted);
  flex-shrink: 0;
}
.ai-hot-toc .toc-top {
  display: inline-block;
  font-size: .78rem;
  color: var(--muted);
  border-bottom: none;
  padding-left: .55rem;
}
.ai-hot-toc .toc-top:hover { color: var(--accent); }

/* 移动端：折叠 TOC */
.ai-hot-toc-mobile {
  display: none;
  margin: 1.2rem 0 1.5rem;
  padding: .6rem .9rem;
  background: var(--bg-tint);
  border-left: 3px solid var(--accent);
  border-radius: 3px;
  font-family: var(--sans);
  font-size: .94rem;
}
.ai-hot-toc-mobile summary {
  cursor: pointer;
  color: var(--ink-soft);
  font-weight: 500;
}
.ai-hot-toc-mobile ul {
  list-style: none;
  padding: .8rem 0 .2rem;
  margin: 0;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: .4rem .9rem;
}
.ai-hot-toc-mobile a {
  color: var(--ink-soft);
  border-bottom: none;
  font-size: .88rem;
}

/* 板块锚点偏移：sticky header 高度补偿 */
.ai-hot-body [id] {
  scroll-margin-top: 5rem;
}

/* 板块分隔条：emoji + 名字，比 H2 弱一档 */
.ai-section-divider {
  text-align: center;
  margin: 3rem 0 1.6rem;
  padding: 0;
  color: var(--accent);
  font-family: var(--sans);
  letter-spacing: .12em;
  font-size: .9rem;
  font-weight: 600;
  border-bottom: none;
  position: relative;
}
.ai-section-divider::before,
.ai-section-divider::after {
  content: "";
  display: inline-block;
  width: 36px;
  height: 1px;
  background: var(--rule);
  vertical-align: middle;
  margin: 0 .8rem;
}

/* —— 桌面→平板过渡：收紧导航间距，让 8 链接 + 消息按钮在一行内放下 —— */
@media (max-width: 1120px) {
  .site-nav { gap: .5rem .8rem; font-size: .86rem; }
}

/* ---- Mobile ---- */
@media (max-width: 960px) {
  .ai-hot-wrap {
    grid-template-columns: 1fr;
    gap: 0;
    padding: 0 1.5rem;
    max-width: var(--measure);
  }
  .ai-hot-post { grid-column: 1; }
  .ai-hot-toc { display: none; }
  .ai-hot-toc-mobile { display: block; }
  .site-nav { gap: .5rem .8rem; font-size: .86rem; }
  .brand-tag { display: none; }
}
@media (max-width: 720px) {
  body { font-size: 17px; }
  .ai-hot-feature { padding: 1.2rem 1.1rem 1rem; }
  .ai-hot-title { font-size: 1.35rem; }
  .ai-hot-toc-mobile ul { grid-template-columns: 1fr; }
  .site-main { padding: 2.5rem 0 3rem; }
  .header-wrap { flex-direction: column; align-items: flex-start; gap: .8rem; padding: 1.1rem 1.5rem; }
  .site-nav {
    gap: .45rem 1.1rem;
    font-size: .88rem;
    width: 100%;
  }
  .brand-tag { display: none; }
  h1 { font-size: 2.1rem; }
  .post-header h1 { font-size: 2.05rem; }
  .post-item {
    grid-template-columns: 1fr;
    gap: .5rem;
    padding: 1.4em 0;
  }
  .margin-note { text-align: left; padding-top: 0; display: flex; align-items: center; gap: .9em; flex-wrap: wrap; }
  .margin-note::after { display: none; }
  .margin-note time { display: inline; }
  .margin-note .m-y, .margin-note .m-md { display: inline; }
  .margin-note .m-y::after { content: " · "; color: var(--rule); }
  .margin-note .tags { flex-direction: row; flex-wrap: wrap; margin: 0; gap: .7em; }
  .margin-note .tags li { font-size: .76rem; }
  .post-summary.has-cover { flex-direction: column-reverse; gap: .9rem; }
  .post-thumb { flex: none; width: 100%; margin-top: .1em; }
}

/* ---- Print ---- */
@media print {
  body { background: white; color: black; font-size: 12pt; }
  .site-header, .site-footer, .post-footer, .site-nav, body::before { display: none; }
  a { color: black; border-bottom: none; }
  pre, code { background: #f3f3f3; }
}

/* ============================================================
   2026-06 大改版新增：hero / 栏目卡片 / 搜索 modal / 索引页 /
   阅读进度 / 夜读伴奏 / 入场动画 / header 按钮
   ============================================================ */

/* ---- header 按钮（搜索 / 主题）---- */
.nav-btn {
  display: inline-flex;
  align-items: center;
  gap: .4em;
  font-family: var(--sans);
  font-size: .85rem;
  color: var(--ink-soft);
  background: transparent;
  border: 1px solid var(--rule);
  border-radius: 999px;
  padding: .3em .8em;
  cursor: pointer;
  transition: color .15s, border-color .15s, background .15s;
}
.nav-btn:hover { color: var(--accent); border-color: var(--accent-soft); background: var(--rule-soft); }
.nav-search kbd {
  font-family: var(--mono);
  font-size: .68rem;
  color: var(--muted);
  border: 1px solid var(--rule);
  border-radius: 3px;
  padding: 0 .35em;
  background: var(--bg);
}
.nav-theme { padding: .3em .6em; font-size: .95rem; line-height: 1; }
.theme-icon--dark { display: none; }
[data-theme="dark"] .theme-icon--light { display: none; }
[data-theme="dark"] .theme-icon--dark { display: inline; }

/* ---- 入场动画 ---- */
.reveal {
  opacity: 0;
  transform: translateY(16px);
  transition: opacity .65s ease, transform .65s cubic-bezier(.2, .7, .3, 1);
  transition-delay: calc(var(--d, 0) * 90ms);
}
.reveal.in { opacity: 1; transform: none; }
@media (prefers-reduced-motion: reduce) {
  .reveal { opacity: 1; transform: none; transition: none; }
}

/* ---- 首页 hero ---- */
.site-main--flush { padding-top: 0; }
.hero {
  position: relative;
  height: clamp(520px, 78vh, 740px);
  overflow: hidden;
  /* hero 文字永远落在画中的米色书页上，用固定墨色，不随主题翻转 */
  color: #2a241d;
}
.hero-media {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: 62% center;
}
[data-theme="dark"] .hero-media { filter: brightness(.88) sepia(.05); }
.hero-vignette {
  position: absolute;
  inset: 0;
  /* 顶端一条米纸光晕：悬浮 header 永远落在"亮纸"上，墨色导航字在灰墨山体上也可读 */
  background:
    linear-gradient(180deg, rgba(249, 244, 232, 0.92) 0%, rgba(249, 244, 232, 0.55) 64px, transparent 160px),
    linear-gradient(180deg, transparent 72%, var(--bg) 100%);
  pointer-events: none;
}
[data-theme="dark"] .hero-vignette {
  background:
    linear-gradient(180deg, rgba(242, 235, 219, 0.85) 0%, rgba(242, 235, 219, 0.45) 64px, transparent 160px),
    radial-gradient(120% 90% at 50% 30%, transparent 55%, rgba(0,0,0,.38) 100%),
    linear-gradient(180deg, transparent 68%, var(--bg) 100%);
}
.hero-ink {
  /* 墨滴粒子层：DOM 上在 vignette 之后、hero-inner(z:1) 之前 → 墨落在画面上、文字之下 */
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}
.hero-inner {
  position: relative;
  z-index: 1;
  height: 100%;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding-top: 1rem;
}
.hero-kicker {
  font-family: var(--sans);
  font-size: .78rem;
  font-weight: 700;
  letter-spacing: .42em;
  color: #8b2e2a;
  margin: 0 0 1.1rem;
}
.hero-title {
  font-size: clamp(3rem, 6.5vw, 5rem);
  line-height: 1.06;
  letter-spacing: .02em;
  margin: 0 0 1.2rem;
  color: inherit;
}
.hero-mark {
  color: #8b2e2a;
  margin-left: .12em;
  display: inline-block;
  transform: translateY(.04em);
}
.hero-sub {
  font-size: 1.06rem;
  line-height: 1.8;
  color: #57503f;
  max-width: 30rem;
  margin: 0 0 1.8rem;
}
.hero-actions { display: flex; gap: .8rem; flex-wrap: wrap; margin: 0 0 2.2rem; }
.hero-btn {
  display: inline-flex;
  align-items: center;
  gap: .5em;
  font-family: var(--sans);
  font-size: .92rem;
  font-weight: 600;
  color: #2a241d;
  background: rgba(251, 248, 241, 0.6);
  border: 1px solid #b5a98e;
  border-radius: 3px;
  padding: .55em 1.1em;
  cursor: pointer;
  text-decoration: none;
  transition: transform .15s, box-shadow .15s, background .15s, color .15s, border-color .15s;
}
.hero-btn:hover {
  transform: translateY(-1px);
  border-color: #8b2e2a;
  color: #8b2e2a;
  background: rgba(251, 248, 241, 0.85);
  box-shadow: 0 6px 18px rgba(31, 29, 27, 0.12);
}
.hero-btn--primary {
  background: #8b2e2a;
  border-color: #8b2e2a;
  color: #fbf8f1;
}
.hero-btn--primary:hover { background: #6f211e; color: #fbf8f1; }
.hero-btn kbd {
  font-family: var(--mono);
  font-size: .72rem;
  border: 1px solid rgba(251, 248, 241, 0.45);
  border-radius: 3px;
  padding: 0 .4em;
  font-weight: 400;
}
.hero-stats {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: .4rem 1.6rem;
  padding: 0;
  margin: 0;
  font-family: var(--sans);
  font-size: .85rem;
  color: #6d6452;
}
.hero-stats b {
  font-family: var(--serif);
  font-size: 1.25em;
  color: #8b2e2a;
  font-variant-numeric: tabular-nums;
  margin-right: .15em;
}

/* ---- 首页栏目卡片 ---- */
.stream-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 1.1rem;
  margin: -3.2rem 0 3rem;
  position: relative;
  z-index: 2;
}
.stream-card {
  display: flex;
  gap: 1rem;
  align-items: center;
  background: var(--bg-tint);
  border: 1px solid var(--rule);
  border-radius: 6px;
  padding: 1rem 1.1rem;
  text-decoration: none;
  color: var(--ink);
  transition: transform .18s cubic-bezier(.2,.7,.3,1), box-shadow .18s, border-color .18s;
}
.stream-card:hover {
  transform: translateY(-3px);
  border-color: var(--accent-soft);
  box-shadow: var(--shadow-pop);
  background: var(--bg-tint);
}
.stream-card img {
  width: 86px;
  height: 86px;
  flex-shrink: 0;
  border-radius: 4px;
  border: 1px solid var(--rule);
  object-fit: cover;
  mix-blend-mode: multiply;
  transition: transform .25s ease;
}
[data-theme="dark"] .stream-card img {
  mix-blend-mode: normal;
  filter: brightness(.92) saturate(.95);
}
.stream-card:hover img { transform: scale(1.05) rotate(-.5deg); }
.stream-body h3 {
  font-size: 1.08rem;
  margin: 0 0 .25em;
  display: flex;
  align-items: baseline;
  gap: .5em;
}
.stream-count {
  font-family: var(--sans);
  font-size: .72rem;
  font-weight: 700;
  color: var(--accent);
  background: color-mix(in srgb, var(--accent) 10%, transparent);
  border-radius: 999px;
  padding: .1em .55em;
}
.stream-body p {
  font-family: var(--sans);
  font-size: .85rem;
  line-height: 1.55;
  color: var(--muted);
  margin: 0;
}
.home-coda {
  font-family: var(--sans);
  font-size: .9rem;
  color: var(--muted);
  border-top: 1px solid var(--rule);
  margin-top: 3rem;
  padding-top: 1.6rem;
}
.home-coda p { max-width: var(--measure); }

/* ---- 类型徽标（搜索 + 索引共用）---- */
.ms-badge {
  font-family: var(--sans);
  font-size: .68rem;
  font-weight: 700;
  letter-spacing: .04em;
  border-radius: 3px;
  padding: .18em .5em;
  white-space: nowrap;
  align-self: center;
}
.ms-badge--note  { color: var(--c-note);  background: color-mix(in srgb, var(--c-note) 12%, transparent); }
.ms-badge--hot   { color: var(--c-hot);   background: color-mix(in srgb, var(--c-hot) 12%, transparent); }
.ms-badge--video { color: var(--c-video); background: color-mix(in srgb, var(--c-video) 12%, transparent); }
.ms-badge--game  { color: var(--c-game);  background: color-mix(in srgb, var(--c-game) 12%, transparent); }
.ms-badge--show  { color: var(--c-show);  background: color-mix(in srgb, var(--c-show) 12%, transparent); }
.ms-badge--app   { color: var(--c-app);   background: color-mix(in srgb, var(--c-app) 12%, transparent); }

/* ---- 搜索 modal ---- */
body.ms-lock { overflow: hidden; }
.ms-overlay {
  position: fixed;
  inset: 0;
  z-index: 60;
  background: rgba(20, 16, 11, 0.45);
  backdrop-filter: blur(5px);
  -webkit-backdrop-filter: blur(5px);
  opacity: 0;
  transition: opacity .16s ease;
  overflow-y: auto;
  padding: 9vh 1rem 2rem;
}
.ms-overlay.in { opacity: 1; }
.ms-modal {
  max-width: 660px;
  margin: 0 auto;
  background: var(--bg);
  border: 1px solid var(--rule);
  border-top: 3px solid var(--accent);
  border-radius: 8px;
  box-shadow: var(--shadow-pop);
  transform: translateY(-10px);
  transition: transform .16s ease;
}
.ms-overlay.in .ms-modal { transform: none; }
.ms-head {
  display: flex;
  align-items: center;
  gap: .7rem;
  padding: .9rem 1.1rem;
  border-bottom: 1px solid var(--rule);
}
.ms-glyph {
  font-family: var(--serif);
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--accent);
  line-height: 1;
}
.ms-input {
  flex: 1;
  font-family: var(--serif);
  font-size: 1.12rem;
  color: var(--ink);
  background: transparent;
  border: none;
  outline: none;
  padding: .15em 0;
}
.ms-input::placeholder { color: var(--muted); }
.ms-input::-webkit-search-cancel-button { -webkit-appearance: none; }
.ms-close {
  font-family: var(--mono);
  font-size: .7rem;
  color: var(--muted);
  border: 1px solid var(--rule);
  background: var(--rule-soft);
  border-radius: 4px;
  padding: .25em .55em;
  cursor: pointer;
}
.ms-close:hover { color: var(--accent); border-color: var(--accent-soft); }
.ms-filters {
  display: flex;
  flex-wrap: wrap;
  gap: .45rem;
  padding: .7rem 1.1rem;
  border-bottom: 1px solid var(--rule);
}
.ms-chip {
  font-family: var(--sans);
  font-size: .78rem;
  color: var(--ink-soft);
  background: transparent;
  border: 1px solid var(--rule);
  border-radius: 999px;
  padding: .22em .8em;
  cursor: pointer;
  transition: all .14s;
}
.ms-chip span { color: var(--muted); font-size: .9em; margin-left: .15em; }
.ms-chip:hover { border-color: var(--accent-soft); color: var(--accent); }
.ms-chip.active {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--bg);
}
.ms-chip.active span { color: color-mix(in srgb, var(--bg) 75%, transparent); }
.ms-results {
  max-height: 50vh;
  overflow-y: auto;
  padding: .5rem .6rem;
  overscroll-behavior: contain;
}
.ms-group-label {
  font-family: var(--sans);
  font-size: .7rem;
  font-weight: 700;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--muted);
  padding: .7rem .5rem .35rem;
}
.ms-group-label span { color: var(--rule); margin-left: .3em; }
.ms-item {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: .7rem;
  align-items: start;
  padding: .55rem .55rem;
  border-radius: 5px;
  border-bottom: none;
  text-decoration: none;
  color: var(--ink);
  background: none;
}
.ms-item:hover, .ms-item.active {
  background: var(--rule-soft);
  box-shadow: inset 2px 0 0 var(--accent);
}
.ms-item-main { min-width: 0; }
.ms-item-title {
  display: block;
  font-family: var(--serif);
  font-size: .98rem;
  font-weight: 700;
  line-height: 1.35;
}
.ms-item-desc {
  display: block;
  font-family: var(--sans);
  font-size: .8rem;
  color: var(--muted);
  line-height: 1.5;
  margin-top: .15em;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.ms-item-date {
  font-family: var(--mono);
  font-size: .72rem;
  color: var(--muted);
  padding-top: .25em;
}
.ms-item mark {
  background: color-mix(in srgb, var(--accent) 22%, transparent);
  color: inherit;
  border-radius: 2px;
  padding: 0 .05em;
}
.ms-empty {
  font-family: var(--sans);
  font-size: .9rem;
  color: var(--muted);
  text-align: center;
  padding: 2rem 1rem;
}
.ms-hint {
  font-family: var(--sans);
  font-size: .74rem;
  color: var(--muted);
  text-align: center;
  padding: .6rem 1rem .8rem;
  margin: 0;
  border-top: 1px solid var(--rule-soft);
}
.ms-hint kbd {
  font-family: var(--mono);
  font-size: .85em;
  border: 1px solid var(--rule);
  border-radius: 3px;
  padding: 0 .3em;
  background: var(--rule-soft);
  margin: 0 .1em;
}

/* ---- 索引页 ---- */
.archive-header h1 { display: flex; align-items: baseline; gap: .6em; }
.archive-en {
  font-size: .45em;
  font-style: italic;
  font-weight: 400;
  color: var(--muted);
  letter-spacing: .1em;
}
.archive-lede {
  font-family: var(--sans);
  font-size: .92rem;
  color: var(--muted);
  margin: .5em 0 0;
}
.archive-lede kbd {
  font-family: var(--mono);
  font-size: .85em;
  border: 1px solid var(--rule);
  border-radius: 3px;
  padding: 0 .3em;
  background: var(--rule-soft);
}
.cloud-section {
  margin: 1.8rem 0 1.6rem;
  border: 1px solid var(--rule);
  border-radius: 6px;
  background:
    radial-gradient(90% 120% at 80% 0%, color-mix(in srgb, var(--accent) 4%, transparent) 0%, transparent 60%),
    var(--bg-tint);
  padding: .4rem;
}
.cloud-section canvas { display: block; width: 100%; }
.archive-controls { margin: 0 0 2rem; }
.archive-chips { display: flex; flex-wrap: wrap; gap: .45rem; }
.archive-active {
  margin-top: .8rem;
  font-family: var(--sans);
  font-size: .85rem;
  color: var(--muted);
}
.archive-tagpill {
  font-family: var(--sans);
  font-size: .82rem;
  color: var(--accent);
  background: color-mix(in srgb, var(--accent) 10%, transparent);
  border: 1px solid var(--accent-soft);
  border-radius: 999px;
  padding: .2em .8em;
  cursor: pointer;
  margin-left: .4em;
}
.archive-tagpill span { margin-left: .3em; font-weight: 700; }
.archive-tagpill:hover { background: var(--accent); color: var(--bg); }
.archive-year {
  font-size: 1.9rem;
  border-bottom: 1px solid var(--rule);
  margin: 2.2rem 0 .4rem;
  padding-bottom: .25em;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}
.archive-rows { list-style: none; padding: 0; margin: 0; }
.archive-row {
  display: grid;
  grid-template-columns: 3.6em auto 1fr;
  gap: .9rem;
  align-items: start;
  padding: .7rem .2rem;
  border-bottom: 1px solid var(--rule-soft);
  margin: 0;
}
.archive-row:last-child { border-bottom: none; }
.archive-date {
  font-family: var(--mono);
  font-size: .8rem;
  color: var(--muted);
  padding-top: .25em;
  font-variant-numeric: tabular-nums;
}
.archive-main { min-width: 0; }
.archive-title {
  font-family: var(--serif);
  font-size: 1.02rem;
  font-weight: 700;
  color: var(--ink);
  border-bottom: none;
  background: none;
}
.archive-title:hover { color: var(--accent); background: none; }
.archive-desc {
  display: block;
  font-family: var(--sans);
  font-size: .82rem;
  color: var(--muted);
  line-height: 1.55;
  margin-top: .15em;
  display: -webkit-box;
  -webkit-line-clamp: 1;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.archive-tags { display: inline-flex; flex-wrap: wrap; gap: .15em .6em; margin-left: .6em; }
.archive-tags button {
  font-family: var(--sans);
  font-size: .74rem;
  color: var(--muted);
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
}
.archive-tags button:hover { color: var(--accent); text-decoration: underline; }

/* ---- 阅读进度条 ---- */
.read-progress {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: 3px;
  z-index: 40;
  display: none;
  pointer-events: none;
}
.read-progress.on { display: block; }
.read-progress span {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, var(--accent), var(--accent-soft));
  transform: scaleX(0);
  transform-origin: 0 50%;
}

/* ---- 夜读伴奏按钮 ---- */
.ambient-btn {
  font-family: var(--sans);
  font-size: .85rem;
  color: var(--ink-soft);
  background: none;
  border: none;
  border-bottom: 1px solid var(--rule);
  padding: 0 0 1px;
  cursor: pointer;
}
.ambient-btn:hover { color: var(--accent); border-bottom-color: var(--accent); }
.ambient-btn .ambient-glyph { display: inline-block; }
.ambient-btn.playing { color: var(--accent); border-bottom-color: var(--accent); }
.ambient-btn.playing .ambient-glyph { animation: mg-sway 1.6s ease-in-out infinite; }
@keyframes mg-sway {
  0%, 100% { transform: translateY(0) rotate(0); }
  50% { transform: translateY(-2px) rotate(8deg); }
}

/* ---- 首页 / 索引移动端 ---- */
@media (max-width: 720px) {
  .hero { height: auto; min-height: 78vh; }
  .hero-media { object-position: 74% center; }
  /* 移动端 header 叠为多行且 fixed 悬浮在 hero 上，留足顶部空间避免压住眉头/标题 */
  .hero-inner { padding-top: 11rem; padding-bottom: 4rem; }
  .hero-vignette {
    background:
      linear-gradient(180deg, rgba(249, 244, 232, 0.92) 0%, rgba(249, 244, 232, 0.55) 150px, transparent 250px),
      linear-gradient(180deg, transparent 72%, var(--bg) 100%);
  }
  [data-theme="dark"] .hero-vignette {
    background:
      linear-gradient(180deg, rgba(242, 235, 219, 0.85) 0%, rgba(242, 235, 219, 0.45) 150px, transparent 250px),
      radial-gradient(120% 90% at 50% 30%, transparent 55%, rgba(0,0,0,.38) 100%),
      linear-gradient(180deg, transparent 68%, var(--bg) 100%);
  }
  .hero-inner::before {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(90deg, rgba(247, 242, 230, 0.72) 0%, rgba(247, 242, 230, 0.25) 70%, transparent 100%);
    z-index: -1;
  }
  .hero-title { font-size: 2.7rem; }
  .stream-grid { margin-top: -2.4rem; grid-template-columns: 1fr; }
  .nav-search-label { display: none; }
  .nav-search kbd { display: none; }
  .archive-row { grid-template-columns: 3.2em 1fr; }
  .archive-row .ms-badge { grid-column: 2; justify-self: start; order: 2; }
  .archive-main { grid-column: 2; }
  .ms-overlay { padding-top: 4vh; }
}

/* ---- 首页：header 悬浮在 hero 上，滚动后才落回纸面底 ---- */
body.has-hero .site-header {
  position: fixed;
  top: 0; left: 0; right: 0;
  background: transparent;
  border-bottom-color: transparent;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  transition: background-color .35s ease, border-color .35s ease;
}
body.has-hero .site-header.scrolled {
  background: var(--header-bg);
  border-bottom-color: var(--rule);
  backdrop-filter: saturate(140%) blur(8px);
  -webkit-backdrop-filter: saturate(140%) blur(8px);
}
/* 未滚动时 header 字色固定为墨色（落在 hero 米纸画面上，不随主题翻转） */
body.has-hero .site-header:not(.scrolled) .brand-text { color: #2a241d; }
body.has-hero .site-header:not(.scrolled) .brand-tag { color: #6d6452; }
body.has-hero .site-header:not(.scrolled) .site-nav a { color: #4a4234; }
body.has-hero .site-header:not(.scrolled) .site-nav a:hover { color: #8b2e2a; }
body.has-hero .site-header:not(.scrolled) .nav-btn {
  color: #4a4234;
  border-color: rgba(42, 36, 29, 0.28);
}
body.has-hero .site-header:not(.scrolled) .nav-btn:hover { color: #8b2e2a; border-color: #8b2e2a; background: rgba(251,248,241,.5); }
body.has-hero .site-header:not(.scrolled) .nav-search kbd {
  background: transparent;
  border-color: rgba(42, 36, 29, 0.28);
  color: #6d6452;
}

/* ---- AI Hot 日历 + 板块 pills ---- */
.hot-calendar { margin: 2rem 0 2.6rem; }
.hot-cal-scroll {
  display: flex;
  gap: 1.1rem;
  overflow-x: auto;
  padding: .9rem .9rem 1rem;
  border: 1px solid var(--rule);
  border-radius: 6px;
  background: var(--bg-tint);
  scrollbar-width: thin;
  scrollbar-color: var(--rule) transparent;
}
.hot-month { flex: 0 0 auto; }
.hot-month-name {
  font-family: var(--sans);
  font-size: .78rem;
  font-weight: 700;
  color: var(--ink-soft);
  margin-bottom: .45rem;
  letter-spacing: .04em;
}
.hot-grid {
  display: grid;
  grid-template-columns: repeat(7, 1.75em);
  gap: 3px;
  font-family: var(--mono);
  font-size: .72rem;
}
.hot-wd {
  font-family: var(--sans);
  color: var(--muted);
  text-align: center;
  font-size: .68rem;
  padding-bottom: .15em;
}
.hot-cell {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 1.75em;
  border-radius: 3px;
  color: var(--muted);
  background: var(--rule-soft);
  font-variant-numeric: tabular-nums;
}
.hot-cell--pad { background: transparent; }
.hot-cell--on {
  color: #fbf8f1;
  border-bottom: none;
  font-weight: 700;
  transition: transform .12s, box-shadow .12s;
}
.hot-cell--on.heat-1 { background: color-mix(in srgb, var(--accent) 55%, var(--bg-tint)); }
.hot-cell--on.heat-2 { background: color-mix(in srgb, var(--accent) 78%, var(--bg-tint)); }
.hot-cell--on.heat-3 { background: var(--accent); }
.hot-cell--on:hover { transform: scale(1.12); box-shadow: 0 2px 8px rgba(31,29,27,.25); background: var(--accent); }
.hot-cal-legend {
  font-family: var(--sans);
  font-size: .78rem;
  color: var(--muted);
  margin: .6rem 0 0;
}
.hot-cal-legend b { color: var(--accent); }
.hot-sections { margin: .6em 0 0; display: flex; flex-wrap: wrap; gap: .4em; }
.hot-pill {
  display: inline-flex;
  align-items: center;
  gap: .3em;
  font-family: var(--sans);
  font-size: .76rem;
  color: var(--ink-soft);
  background: var(--rule-soft);
  border: 1px solid var(--rule);
  border-bottom: 1px solid var(--rule);
  border-radius: 999px;
  padding: .14em .7em;
  transition: all .14s;
}
.hot-pill b {
  font-family: var(--mono);
  font-weight: 400;
  font-size: .92em;
  color: var(--muted);
}
.hot-pill:hover {
  color: var(--accent);
  border-color: var(--accent-soft);
  background: color-mix(in srgb, var(--accent) 7%, transparent);
}
.hot-pill:hover b { color: var(--accent); }

/* ---- 相关批注（post 页脚）---- */
.related {
  margin-top: 2.6rem;
  padding-top: 1.6rem;
  border-top: 1px solid var(--rule);
}
.related-title {
  font-family: var(--sans);
  font-size: .76rem;
  font-weight: 700;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 0 0 1rem;
}
.related-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: .8rem;
  list-style: none;
  padding: 0;
  margin: 0;
}
.related-grid a {
  display: block;
  border: 1px solid var(--rule);
  border-radius: 5px;
  background: var(--bg-tint);
  padding: .8rem .95rem;
  color: var(--ink);
  transition: transform .15s, border-color .15s, box-shadow .15s;
}
.related-grid a:hover {
  transform: translateY(-2px);
  border-color: var(--accent-soft);
  box-shadow: 0 8px 22px rgba(31, 29, 27, 0.12);
  background: var(--bg-tint);
}
.related-grid .r-title {
  display: block;
  font-family: var(--serif);
  font-size: .95rem;
  font-weight: 700;
  line-height: 1.4;
  margin-bottom: .3em;
}
.related-grid .r-date {
  font-family: var(--mono);
  font-size: .72rem;
  color: var(--muted);
}

/* ---- 自托管标题字：思源宋体 Bold 子集（GB2312 一级 + 站内字符，~770KB）---- */
@font-face {
  font-family: 'Marginalia Serif';
  src: url('../fonts/MarginaliaSerif-Bold.woff2') format('woff2');
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}
:root {
  --serif-display: 'Marginalia Serif', 'Iowan Old Style', 'Apple Garamond', ui-serif,
                   Georgia, 'Songti SC', 'Source Han Serif SC', 'Noto Serif CJK SC', serif;
}
h1, h2, h3, h4, h5,
.brand-text,
.hero-title,
.ai-hot-title,
.archive-title,
.ms-item-title,
.related-grid .r-title {
  font-family: var(--serif-display);
}

/* ---- header 伴奏按钮 ---- */
.nav-music { padding: .3em .62em; font-size: .95rem; line-height: 1; }
.nav-music.playing {
  color: var(--accent);
  border-color: var(--accent-soft);
  background: color-mix(in srgb, var(--accent) 8%, transparent);
}
.nav-music.playing .ambient-glyph { animation: mg-sway 1.6s ease-in-out infinite; display: inline-block; }
body.has-hero .site-header:not(.scrolled) .nav-music.playing { color: #8b2e2a; border-color: #8b2e2a; }

/* ---- AI Hot 话题热度榜 ---- */
.hot-topics {
  margin: 0 0 2.8rem;
  border: 1px solid var(--rule);
  border-radius: 6px;
  background:
    radial-gradient(80% 100% at 100% 0%, color-mix(in srgb, var(--accent) 5%, transparent) 0%, transparent 55%),
    var(--bg-tint);
  padding: 1.2rem 1.4rem 1.1rem;
}
.hot-topics-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 1rem;
  flex-wrap: wrap;
  margin-bottom: 1rem;
}
.hot-topics-title {
  font-size: 1.15rem;
  margin: 0;
  border: none;
  padding: 0;
}
.ht-sub {
  font-family: var(--sans);
  font-size: .76rem;
  font-weight: 400;
  color: var(--muted);
  margin-left: .6em;
}
.ht-stamp {
  font-family: var(--mono);
  font-size: .72rem;
  color: var(--muted);
}
.ht-board {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(290px, 1fr));
  gap: .35rem 2.2rem;
}
.ht-row {
  display: flex;
  gap: .8rem;
  align-items: flex-start;
  padding: .5rem 0;
  margin: 0;
  border-bottom: 1px solid var(--rule-soft);
}
.ht-rank {
  font-family: var(--serif);
  font-size: 1.05rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--muted);
  min-width: 1.5em;
  text-align: center;
  padding-top: .05em;
}
.ht-rank--top { color: var(--accent); font-size: 1.2rem; }
.ht-main { flex: 1; min-width: 0; }
.ht-line { display: flex; justify-content: space-between; align-items: baseline; gap: .8rem; }
.ht-name {
  font-family: var(--serif-display);
  font-size: 1rem;
  font-weight: 700;
  color: var(--ink);
  border-bottom: none;
  background: none;
}
.ht-name:hover { color: var(--accent); background: none; }
.ht-meta {
  font-family: var(--sans);
  font-size: .72rem;
  color: var(--muted);
  white-space: nowrap;
}
.ht-bar {
  height: 5px;
  border-radius: 3px;
  background: var(--rule-soft);
  margin: .3rem 0 .3rem;
  overflow: hidden;
}
.ht-bar span {
  display: block;
  height: 100%;
  border-radius: 3px;
  background: linear-gradient(90deg, var(--accent), var(--accent-soft));
  min-width: 4%;
}
.ht-dates { display: flex; flex-wrap: wrap; gap: .15em .7em; }
.ht-dates a {
  font-family: var(--mono);
  font-size: .7rem;
  color: var(--muted);
  border-bottom: none;
  background: none;
}
.ht-dates a:hover { color: var(--accent); text-decoration: underline; background: none; }
@media (max-width: 720px) {
  .hot-topics { padding: 1rem 1rem .8rem; }
  .ht-board { grid-template-columns: 1fr; }
}

/* ---- Showcases / Apps：实际截图配图行 ---- */
.cover-list { list-style: none; padding: 0; margin: 2.2rem 0 0; }
.cover-row {
  display: grid;
  grid-template-columns: minmax(260px, 380px) 1fr;
  gap: 1.6rem 2rem;
  padding: 2rem 0;
  border-bottom: 1px solid var(--rule);
  margin: 0;
  align-items: start;
}
.cover-row:last-child { border-bottom: none; }
.cover-media {
  display: block;
  position: relative;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  border: 1px solid var(--rule);
  border-radius: 4px;
  background: var(--bg-tint);
  box-shadow: 0 2px 10px rgba(31, 29, 27, 0.08);
  transition: transform .18s cubic-bezier(.2,.7,.3,1), box-shadow .18s, border-color .18s;
}
.cover-media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: top center;
  display: block;
  transition: transform .3s ease;
}
.cover-media:hover {
  transform: translateY(-3px);
  border-color: var(--accent-soft);
  box-shadow: var(--shadow-pop);
  background: var(--bg-tint);
}
.cover-media:hover img { transform: scale(1.025); }
.cover-body { min-width: 0; }
.cover-body h2 {
  margin-top: 0;
  font-size: 1.35rem;
  border-bottom: none;
  padding-bottom: 0;
}
.cover-body p { font-size: .98rem; }
.cover-body > p:last-child em,
.cover-body em { color: var(--muted); }
@media (max-width: 860px) {
  .cover-row { grid-template-columns: 1fr; gap: 1rem; padding: 1.6rem 0; }
  .cover-media { max-width: 540px; }
}

/* ==========================================================================
   互动层：点赞 / 评论 / 抽屉 / 消息盒子 / 分类筛选（reactions.js + filter.js）
   ========================================================================== */

/* —— header 消息按钮 + 未读红点 —— */
.nav-msg { position: relative; }
.msg-glyph { font-size: 1rem; line-height: 1; }
.mg-msg-badge {
  position: absolute; top: -5px; right: -5px;
  min-width: 16px; height: 16px; padding: 0 4px;
  display: inline-flex; align-items: center; justify-content: center;
  font-family: var(--sans); font-size: 10px; font-weight: 700; line-height: 1;
  color: #fff; background: var(--accent);
  border-radius: 999px; box-shadow: 0 0 0 2px var(--header-bg);
}

/* —— full reaction widget (post / video) —— */
.mg-reactions { margin: 2.4rem 0 0; padding-top: 1.6rem; border-top: 1px solid var(--rule); }
.mg-noscript { color: var(--muted); font-size: .9rem; font-family: var(--sans); }
.mg-bar { display: flex; align-items: center; gap: .9rem; flex-wrap: wrap; margin-bottom: 1.6rem; }
.mg-bar-label { font-family: var(--sans); font-size: .88rem; color: var(--muted); }

.mg-like, .mg-cbtn {
  display: inline-flex; align-items: center; gap: .45rem;
  font-family: var(--sans); font-size: .95rem; font-variant-numeric: tabular-nums;
  color: var(--ink-soft); background: var(--bg-tint);
  border: 1px solid var(--rule); border-radius: 999px;
  padding: .4em .95em; cursor: pointer; transition: all .16s ease;
}
.mg-like:hover, .mg-cbtn:hover { border-color: var(--accent-soft); color: var(--accent); }
.mg-like:disabled, .mg-cbtn:disabled { opacity: .55; cursor: default; }
.mg-like .mg-heart { color: var(--muted); transition: transform .2s ease, color .2s ease; }
.mg-like.liked { color: var(--accent); border-color: var(--accent-soft); background: color-mix(in srgb, var(--accent) 10%, transparent); }
.mg-like.liked .mg-heart { color: var(--accent); }
.mg-like.pulse .mg-heart { animation: mg-pop .42s cubic-bezier(.2,.9,.3,1.4); }
@keyframes mg-pop { 0%{transform:scale(1)} 35%{transform:scale(1.5)} 100%{transform:scale(1)} }

.mg-mini { padding: .28em .7em; font-size: .82rem; background: transparent; }

/* —— comment thread —— */
.mg-thread-head { margin: 0 0 .9rem; }
.mg-thread-count { font-family: var(--sans); font-size: .8rem; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); }
.mg-thread-empty { font-family: var(--sans); font-size: .92rem; color: var(--muted); font-style: italic; margin: .6rem 0 1rem; }
.mg-comment-list { list-style: none; margin: 1.2rem 0 0; padding: 0; }
.mg-comment { padding: .9rem 0; border-top: 1px dashed var(--rule-soft); }
.mg-comment:first-child { border-top: none; }
.mg-c-head { display: flex; align-items: baseline; gap: .6rem; margin-bottom: .25rem; }
.mg-c-name { font-family: var(--sans); font-weight: 600; font-size: .9rem; color: var(--ink); }
.mg-c-time { font-family: var(--sans); font-size: .76rem; color: var(--muted); }
.mg-c-body { font-size: .98rem; line-height: 1.65; color: var(--ink-soft); white-space: normal; word-break: break-word; }

/* —— comment form —— */
.mg-form { display: flex; flex-direction: column; gap: .6rem; margin: 0 0 .4rem; }
.mg-f-name, .mg-f-body {
  font-family: var(--sans); font-size: .94rem; color: var(--ink);
  background: var(--bg); border: 1px solid var(--rule); border-radius: 4px; padding: .55em .75em;
  width: 100%; resize: vertical;
}
.mg-f-name { max-width: 260px; }
.mg-f-name:focus, .mg-f-body:focus { outline: none; border-color: var(--accent-soft); box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent) 14%, transparent); }
.mg-hp { position: absolute; left: -9999px; width: 1px; height: 1px; opacity: 0; }
.mg-f-row { display: flex; align-items: center; justify-content: space-between; gap: .8rem; }
.mg-f-msg { font-family: var(--sans); font-size: .82rem; color: var(--muted); }
.mg-f-msg.ok { color: var(--c-game); }
.mg-f-msg.err { color: var(--accent); }
.mg-f-submit {
  font-family: var(--sans); font-size: .88rem; color: var(--bg); background: var(--accent);
  border: 1px solid var(--accent); border-radius: 999px; padding: .42em 1.2em; cursor: pointer; transition: opacity .16s;
}
.mg-f-submit:hover { opacity: .9; }
.mg-f-submit:disabled { opacity: .5; cursor: default; }

/* —— compact card reaction bar —— */
.mg-card-react { display: inline-flex; gap: .5rem; align-items: center; }
.cover-body .mg-card-react { margin-top: .8rem; }
.post-summary-text .mg-card-react { margin-top: .7rem; }
.videos-list .mg-card-react { margin-top: .7rem; }

/* —— shared slide-over overlay (drawer + msgbox) —— */
.mg-backdrop { position: fixed; inset: 0; z-index: 80; background: rgba(20, 16, 10, 0); transition: background .28s ease; }
.mg-backdrop.on { background: rgba(20, 16, 10, .42); }
.mg-drawer, .mg-msgbox {
  position: fixed; top: 0; right: 0; z-index: 90;
  width: min(420px, 92vw); height: 100%;
  background: var(--bg); border-left: 1px solid var(--rule);
  box-shadow: var(--shadow-pop);
  display: flex; flex-direction: column;
  transform: translateX(102%); transition: transform .3s cubic-bezier(.3,.8,.3,1);
}
.mg-drawer.open, .mg-msgbox.open { transform: translateX(0); }
.mg-drawer-head {
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  padding: 1.1rem 1.3rem; border-bottom: 1px solid var(--rule); flex: 0 0 auto;
}
.mg-drawer-title { font-family: var(--serif); font-size: 1.15rem; margin: 0; color: var(--ink); line-height: 1.3; }
.mg-x { font-size: 1rem; color: var(--muted); background: transparent; border: 0; cursor: pointer; padding: .3em; line-height: 1; }
.mg-x:hover { color: var(--accent); }
.mg-drawer-body, .mg-msg-body { padding: 1.2rem 1.3rem 2rem; overflow-y: auto; overscroll-behavior: contain; flex: 1 1 auto; }

/* —— message box list —— */
.mg-msg-list { list-style: none; margin: 0; padding: 0; }
.mg-msg-item { border-bottom: 1px dashed var(--rule-soft); }
.mg-msg-item:last-child { border-bottom: none; }
.mg-msg-item a { display: block; padding: .85rem .5rem; text-decoration: none; color: inherit; border-radius: 4px; transition: background .15s; }
.mg-msg-item a:hover { background: var(--bg-tint); }
.mg-msg-item.unread a { box-shadow: inset 3px 0 0 var(--accent); }
.mg-msg-top { display: flex; align-items: baseline; justify-content: space-between; gap: .6rem; margin-bottom: .2rem; }
.mg-msg-text { font-size: .94rem; line-height: 1.55; color: var(--ink-soft); }
.mg-msg-src { font-family: var(--sans); font-size: .76rem; color: var(--muted); margin-top: .25rem; }

/* —— 分类筛选条（复用 .ms-chip，作用于 DOM 列表，见 filter.js）—— */
.mg-filter-bar {
  display: flex; flex-wrap: wrap; gap: .45rem;
  margin: 1.6rem 0 0; padding-bottom: .2rem;
}
.mg-filter-empty { margin: 2rem 0; color: var(--muted); font-style: italic; font-family: var(--sans); }
[data-filter-hidden] { display: none !important; }
.note-cat {
  font-family: var(--sans); font-size: .68rem; letter-spacing: .08em;
  color: var(--accent); margin: .3rem 0 .1rem; font-weight: 600;
}

/* dark-mode games page has its own light filter chips already inheriting vars; keep contrast */
@media (max-width: 720px) {
  .mg-bar { gap: .6rem; }
  .mg-drawer, .mg-msgbox { width: 100vw; }
}
