/* ============================================================
   乔木 arXiv — 学术期刊 × 开发者工具
   暖纸色 + Fraunces 衬线标题 + IBM Plex Mono 元数据 + arXiv 红
   ============================================================ */

:root {
  --paper: #f6f3ea;
  --surface: #fcfbf6;
  --surface-sunken: #f1ede1;
  --ink: #1c1813;
  --ink-2: #5c5647;
  --ink-3: #8d8775;
  --accent: #b3372c;
  --accent-deep: #93291f;
  --accent-tint: #f4e4dd;
  --border: #e8e2d2;
  --border-strong: #d9d2bd;
  --ring: #c9c1ab;
  --ok: #3f7a4e;

  --font-serif: "Fraunces", "Georgia", "Songti SC", serif;
  --font-sans: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans SC", sans-serif;
  --font-mono: "IBM Plex Mono", ui-monospace, "SF Mono", Menlo, monospace;

  --ease-out: cubic-bezier(0.23, 1, 0.32, 1);
  --radius-card: 12px;
  --radius-btn: 8px;

  --shadow-ring: 0 0 0 1px var(--border);
  --shadow-lift: 0 1px 2px rgba(28, 24, 19, 0.05), 0 8px 24px rgba(28, 24, 19, 0.06);

  --maxw: 1180px;
  --header-h: 64px;
}

* { box-sizing: border-box; }

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

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: 15px;
  line-height: 1.65;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  color-scheme: light;
}

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

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

a { color: inherit; text-decoration: none; }

a.text-link {
  color: var(--accent);
  text-decoration: underline;
  text-underline-offset: 3px;
  text-decoration-thickness: 1px;
}

button {
  font: inherit;
  color: inherit;
  cursor: pointer;
  border: none;
  background: none;
}

button:disabled { cursor: not-allowed; opacity: 0.5; }

h1, h2, h3, h4 { text-wrap: balance; }
p { text-wrap: pretty; }

.mono { font-family: var(--font-mono); font-variant-numeric: tabular-nums; }

/* ---------- 头部 ---------- */

.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: var(--paper);
  transition: box-shadow 200ms var(--ease-out);
}

.site-header.scrolled {
  box-shadow: 0 1px 0 var(--border);
}

.header-inner {
  max-width: var(--maxw);
  margin: 0 auto;
  min-height: var(--header-h);
  padding: 0 24px;
  display: flex;
  align-items: center;
  gap: 28px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 9px;
  color: var(--ink);
  flex-shrink: 0;
}

.brand-mark { color: var(--accent); }

.brand-name {
  font-family: var(--font-serif);
  font-size: 19px;
  font-weight: 600;
  letter-spacing: 0.01em;
}

.brand-name em {
  font-style: normal;
  font-weight: 400;
  color: var(--ink-2);
}

.main-nav {
  display: flex;
  gap: 4px;
  margin-right: auto;
}

.main-nav a {
  padding: 6px 12px;
  border-radius: var(--radius-btn);
  font-size: 14px;
  color: var(--ink-2);
  transition: color 140ms var(--ease-out), background-color 140ms var(--ease-out);
}

@media (hover: hover) and (pointer: fine) {
  .main-nav a:hover { color: var(--ink); background: var(--surface-sunken); }
}

.main-nav a.active {
  color: var(--ink);
  background: var(--surface-sunken);
  font-weight: 500;
}

.header-search {
  display: flex;
  align-items: center;
  gap: 6px;
  width: 260px;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-btn);
  padding: 7px 10px;
  transition: border-color 140ms var(--ease-out), box-shadow 140ms var(--ease-out);
}

.header-search:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-tint);
}

.header-search .search-icon { color: var(--ink-3); flex-shrink: 0; }

.header-search input {
  flex: 1;
  border: none;
  background: none;
  outline: none;
  font: inherit;
  font-size: 14px;
  color: var(--ink);
  min-width: 0;
}

.header-search input::placeholder { color: var(--ink-3); }

.search-submit {
  color: var(--ink-3);
  font-family: var(--font-mono);
  font-size: 13px;
  padding: 0 2px;
}

/* ---------- 页面容器 ---------- */

#app {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 40px 24px 72px;
  min-height: calc(100dvh - var(--header-h) - 120px);
  outline: none;
}

.page-loading {
  display: flex;
  gap: 6px;
  padding: 48px 0;
}

.page-loading span {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--ring);
  animation: dotPulse 1.1s var(--ease-out) infinite;
}

.page-loading span:nth-child(2) { animation-delay: 0.15s; }
.page-loading span:nth-child(3) { animation-delay: 0.3s; }

@keyframes dotPulse {
  0%, 100% { opacity: 0.3; transform: translateY(0); }
  40% { opacity: 1; transform: translateY(-3px); }
}

/* ---------- 首页 Hero ---------- */

.home-hero {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr);
  gap: 48px;
  align-items: end;
  padding-bottom: 36px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 40px;
}

.hero-title {
  font-family: var(--font-serif);
  font-weight: 500;
  font-size: clamp(34px, 4.6vw, 56px);
  line-height: 1.08;
  margin: 0 0 16px;
  letter-spacing: -0.012em;
}

.hero-title .accent { color: var(--accent); }

.hero-sub {
  margin: 0;
  color: var(--ink-2);
  font-size: 16px;
  max-width: 46ch;
}

.hero-meta {
  text-align: right;
  color: var(--ink-3);
  font-size: 13px;
  line-height: 1.8;
}

.hero-meta .date {
  font-family: var(--font-mono);
  font-size: 15px;
  color: var(--ink);
}

/* ---------- 区块标题 ---------- */

.section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  margin: 0 0 20px;
  padding-top: 8px;
}

.section-head h2 {
  font-family: var(--font-serif);
  font-weight: 500;
  font-size: 26px;
  line-height: 1.2;
  margin: 0;
}

.section-head .note {
  color: var(--ink-3);
  font-size: 13px;
  text-align: right;
}

.section { margin-bottom: 56px; }

/* ---------- AI 每日精选 ---------- */

.featured-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr);
  grid-auto-flow: dense;
  gap: 16px;
}

.featured-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  padding: 22px 24px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  transition: transform 180ms var(--ease-out), box-shadow 180ms var(--ease-out), border-color 180ms var(--ease-out);
}

@media (hover: hover) and (pointer: fine) {
  .featured-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lift);
    border-color: var(--border-strong);
  }
}

.featured-card.lead {
  grid-row: span 2;
  background: var(--ink);
  color: rgba(252, 251, 246, 0.88);
  border-color: var(--ink);
  padding: 28px 30px;
  position: relative;
  overflow: hidden;
}

.featured-card.lead::after {
  content: "01";
  position: absolute;
  right: 18px;
  bottom: 44px;
  font-family: var(--font-serif);
  font-weight: 600;
  font-size: 150px;
  line-height: 1;
  color: rgba(252, 251, 246, 0.07);
  pointer-events: none;
}

.featured-card .pick-headline {
  font-family: var(--font-serif);
  font-weight: 600;
  font-size: 15px;
  color: var(--accent);
  margin: 0;
}

.featured-card.lead .pick-headline { color: #e8a89c; font-size: 17px; }

.featured-card .paper-title {
  font-family: var(--font-serif);
  font-weight: 500;
  font-size: 18px;
  line-height: 1.35;
  margin: 0;
  color: var(--ink);
}

.featured-card.lead .paper-title { color: var(--surface); font-size: 23px; }

@media (hover: hover) and (pointer: fine) {
  .featured-card a.paper-title-link:hover .paper-title { color: var(--accent); }
  .featured-card.lead a.paper-title-link:hover .paper-title { color: #fff; }
}

.featured-card .pick-reason {
  margin: 0;
  font-size: 14px;
  color: var(--ink-2);
  line-height: 1.7;
}

.featured-card.lead .pick-reason { color: rgba(252, 251, 246, 0.72); font-size: 15px; }

.featured-card .pick-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-top: auto;
  padding-top: 4px;
}

.lead-fallback-tag {
  display: inline-block;
  font-size: 12px;
  color: var(--ink-3);
  background: var(--surface-sunken);
  border-radius: 999px;
  padding: 2px 10px;
}

/* ---------- arXiv ID 芯片 ---------- */

.id-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--ink-2);
  background: var(--surface-sunken);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 2px 8px;
  white-space: nowrap;
  transition: border-color 140ms var(--ease-out), color 140ms var(--ease-out);
}

.lead .id-chip {
  background: rgba(252, 251, 246, 0.1);
  border-color: rgba(252, 251, 246, 0.2);
  color: rgba(252, 251, 246, 0.75);
}

@media (hover: hover) and (pointer: fine) {
  button.id-chip:hover { border-color: var(--accent); color: var(--accent); }
}

.cat-tag {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 11.5px;
  color: var(--ink-3);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 1px 9px;
  white-space: nowrap;
}

.lead .cat-tag { border-color: rgba(252, 251, 246, 0.25); color: rgba(252, 251, 246, 0.6); }

.date-text {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--ink-3);
}

.lead .date-text { color: rgba(252, 251, 246, 0.55); }

/* ---------- 主题网格 ---------- */

.topic-grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  grid-auto-flow: dense;
  gap: 14px;
}

.topic-card {
  grid-column: span 2;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  padding: 20px 22px;
  transition: transform 180ms var(--ease-out), box-shadow 180ms var(--ease-out), border-color 180ms var(--ease-out);
}

.topic-card:nth-child(4n + 1) { grid-column: span 3; }
.topic-card:nth-child(4n + 2) { grid-column: span 3; }

@media (hover: hover) and (pointer: fine) {
  .topic-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lift);
    border-color: var(--border-strong);
  }
}

.topic-card h3 {
  font-family: var(--font-serif);
  font-weight: 500;
  font-size: 19px;
  margin: 0 0 6px;
}

.topic-card p {
  margin: 0;
  font-size: 13.5px;
  color: var(--ink-2);
  line-height: 1.6;
}

.topic-card .arrow {
  display: inline-block;
  margin-top: 12px;
  font-size: 13px;
  color: var(--accent);
  transition: transform 140ms var(--ease-out);
}

@media (hover: hover) and (pointer: fine) {
  .topic-card:hover .arrow { transform: translateX(4px); }
}

/* ---------- 论文列表（索引卡式行） ---------- */

.paper-list {
  border-top: 1px solid var(--border-strong);
}

.paper-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 16px 24px;
  padding: 20px 4px;
  border-bottom: 1px solid var(--border);
  align-items: start;
}

.paper-row .paper-title {
  font-family: var(--font-serif);
  font-weight: 500;
  font-size: 18.5px;
  line-height: 1.4;
  margin: 0 0 6px;
}

@media (hover: hover) and (pointer: fine) {
  .paper-row a:hover .paper-title { color: var(--accent); }
}

.paper-row .authors {
  font-size: 13px;
  color: var(--ink-2);
  margin: 0 0 8px;
}

.paper-row .summary {
  font-size: 13.5px;
  color: var(--ink-2);
  margin: 0;
  line-height: 1.65;
  max-width: 75ch;
}

.paper-row .row-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  margin-top: 10px;
}

.paper-row .row-actions {
  display: flex;
  gap: 6px;
  flex-shrink: 0;
}

.paper-row .comment {
  font-size: 12.5px;
  color: var(--ink-3);
  margin: 6px 0 0;
}

/* 入场动画 */
@keyframes rowIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

.paper-row, .featured-card, .topic-card {
  animation: rowIn 320ms var(--ease-out) both;
}

/* ---------- 按钮 ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  border-radius: var(--radius-btn);
  font-size: 13.5px;
  font-weight: 500;
  border: 1px solid var(--border-strong);
  background: var(--surface);
  color: var(--ink);
  transition: transform 100ms var(--ease-out), background-color 140ms var(--ease-out), border-color 140ms var(--ease-out), color 140ms var(--ease-out);
}

.btn:active { transform: scale(0.97); }

@media (hover: hover) and (pointer: fine) {
  .btn:hover { background: var(--surface-sunken); }
}

.btn-primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #fdf8f4;
}

@media (hover: hover) and (pointer: fine) {
  .btn-primary:hover { background: var(--accent-deep); border-color: var(--accent-deep); }
}

.btn-ghost { border-color: transparent; background: transparent; color: var(--ink-2); }

@media (hover: hover) and (pointer: fine) {
  .btn-ghost:hover { background: var(--surface-sunken); color: var(--ink); }
}

.btn-sm { padding: 5px 10px; font-size: 12.5px; }

/* ---------- 加载更多 ---------- */

.load-more-wrap { display: flex; justify-content: center; padding: 28px 0 8px; }

/* ---------- 搜索页 ---------- */

.search-page-head { margin-bottom: 24px; }

.search-form-big {
  display: flex;
  gap: 10px;
  margin-bottom: 16px;
}

.search-form-big input {
  flex: 1;
  font: inherit;
  font-size: 17px;
  padding: 12px 16px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-btn);
  background: var(--surface);
  color: var(--ink);
  outline: none;
  transition: border-color 140ms var(--ease-out), box-shadow 140ms var(--ease-out);
  min-width: 0;
}

.search-form-big input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-tint);
}

.search-form-big .btn-primary { padding: 12px 22px; font-size: 15px; }

.filter-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.chip {
  font-size: 13px;
  padding: 5px 12px;
  border-radius: 999px;
  border: 1px solid var(--border-strong);
  color: var(--ink-2);
  background: var(--surface);
  transition: background-color 140ms var(--ease-out), color 140ms var(--ease-out), border-color 140ms var(--ease-out);
}

@media (hover: hover) and (pointer: fine) {
  .chip:hover { border-color: var(--accent); color: var(--accent); }
}

.chip.active {
  background: var(--ink);
  border-color: var(--ink);
  color: var(--surface);
}

.chip-divider { flex: 1; min-width: 12px; }

.sort-group { display: flex; gap: 8px; align-items: center; }

.result-count {
  font-size: 13px;
  color: var(--ink-3);
  margin: 0 0 4px;
}

.result-count strong { color: var(--ink-2); font-weight: 500; }

/* ---------- 论文详情 ---------- */

.paper-head { margin-bottom: 28px; }

.paper-head h1 {
  font-family: var(--font-serif);
  font-weight: 500;
  font-size: clamp(24px, 3.2vw, 34px);
  line-height: 1.25;
  margin: 14px 0 14px;
  letter-spacing: -0.008em;
}

.paper-head .authors {
  font-size: 14.5px;
  color: var(--ink-2);
  margin: 0 0 16px;
  max-width: 80ch;
}

.paper-meta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  margin-bottom: 20px;
}

.paper-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.paper-body {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 368px;
  gap: 40px;
  align-items: start;
}

.abstract-block h2,
.ai-panel h2 {
  font-family: var(--font-serif);
  font-weight: 500;
  font-size: 20px;
  margin: 0 0 12px;
}

.abstract-text {
  font-size: 15.5px;
  line-height: 1.75;
  color: var(--ink);
  max-width: 75ch;
}

.abstract-block .extra {
  margin-top: 14px;
  font-size: 13.5px;
  color: var(--ink-2);
}

.abstract-block .extra dt {
  font-weight: 500;
  color: var(--ink);
  display: inline;
}

.abstract-block .extra dd { display: inline; margin: 0; }

/* AI 解读面板 */
.ai-panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  padding: 22px 24px;
  position: sticky;
  top: calc(var(--header-h) + 16px);
}

.ai-panel-head {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
}

.ai-panel-head .spark {
  color: var(--accent);
  font-size: 16px;
}

.ai-panel-head h2 { margin: 0; font-size: 18px; }

.ai-panel .hint {
  font-size: 12.5px;
  color: var(--ink-3);
  margin: 0 0 14px;
}

.ai-content {
  font-size: 14px;
  line-height: 1.75;
  color: var(--ink);
}

.ai-content:empty { display: none; }

.ai-content h3 {
  font-size: 14.5px;
  font-weight: 600;
  margin: 16px 0 6px;
}

.ai-content h3:first-child { margin-top: 0; }

.ai-content p { margin: 0 0 10px; }

.ai-content ul, .ai-content ol { margin: 0 0 10px; padding-left: 20px; }

.ai-content li { margin-bottom: 4px; }

.ai-content strong { font-weight: 600; }

.ai-content code {
  font-family: var(--font-mono);
  font-size: 12.5px;
  background: var(--surface-sunken);
  padding: 1px 5px;
  border-radius: 4px;
}

.ai-caret::after {
  content: "▍";
  color: var(--accent);
  animation: caretBlink 1s steps(1) infinite;
}

@keyframes caretBlink { 50% { opacity: 0; } }

/* 追问对话 */
.chat-block { margin-top: 20px; border-top: 1px solid var(--border); padding-top: 16px; }

.chat-messages { display: flex; flex-direction: column; gap: 10px; margin-bottom: 12px; }

.chat-messages:empty { display: none; }

.chat-msg {
  font-size: 13.5px;
  line-height: 1.7;
  padding: 10px 12px;
  border-radius: 10px;
  max-width: 100%;
}

.chat-msg.user {
  background: var(--ink);
  color: rgba(252, 251, 246, 0.9);
  align-self: flex-end;
  max-width: 88%;
}

.chat-msg.assistant { background: var(--surface-sunken); }

.chat-form { display: flex; gap: 6px; }

.chat-form input {
  flex: 1;
  font: inherit;
  font-size: 13px;
  padding: 9px 12px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-btn);
  background: var(--paper);
  color: var(--ink);
  outline: none;
  min-width: 0;
  transition: border-color 140ms var(--ease-out), box-shadow 140ms var(--ease-out);
}

.chat-form input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-tint);
}

.chat-form button { flex-shrink: 0; }

/* ---------- 收藏 ---------- */

.fav-btn.active {
  color: var(--accent);
  border-color: var(--accent);
  background: var(--accent-tint);
}

.empty-state {
  text-align: center;
  padding: 64px 24px;
  color: var(--ink-2);
}

.empty-state .big {
  font-family: var(--font-serif);
  font-size: 22px;
  color: var(--ink);
  margin: 0 0 8px;
}

.empty-state p { margin: 0 auto 18px; max-width: 40ch; font-size: 14px; }

.error-state {
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-card);
  padding: 24px;
  color: var(--ink-2);
  font-size: 14px;
}

.error-state .big { color: var(--accent-deep); font-weight: 500; margin: 0 0 6px; }

/* ---------- 骨架屏 ---------- */

.skeleton {
  background: linear-gradient(90deg, var(--surface-sunken) 25%, var(--border) 37%, var(--surface-sunken) 63%);
  background-size: 400% 100%;
  animation: shimmer 1.4s ease infinite;
  border-radius: 6px;
  height: 14px;
}

@keyframes shimmer {
  from { background-position: 100% 0; }
  to { background-position: -100% 0; }
}

.sk-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  padding: 22px 24px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* ---------- Toast ---------- */

.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(8px);
  background: var(--ink);
  color: var(--surface);
  font-size: 13.5px;
  padding: 10px 18px;
  border-radius: 999px;
  opacity: 0;
  transition: opacity 180ms var(--ease-out), transform 180ms var(--ease-out);
  z-index: 100;
  pointer-events: none;
}

.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ---------- 页脚 ---------- */

.site-footer {
  border-top: 1px solid var(--border);
  background: var(--paper);
}

.footer-inner {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 20px 24px;
  display: flex;
  flex-wrap: wrap;
  gap: 12px 28px;
  font-size: 12.5px;
  color: var(--ink-3);
}

.footer-inner a { color: var(--ink-2); }

@media (hover: hover) and (pointer: fine) {
  .footer-inner a:hover { color: var(--accent); }
}

.footer-inner > :last-child { margin-left: auto; }

/* ---------- 主题页头 ---------- */

.topic-head {
  margin-bottom: 28px;
}

.topic-head h1 {
  font-family: var(--font-serif);
  font-weight: 500;
  font-size: clamp(28px, 3.6vw, 40px);
  margin: 0 0 8px;
  letter-spacing: -0.01em;
}

.topic-head p { margin: 0; color: var(--ink-2); font-size: 15px; }

.back-link {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 13px;
  color: var(--ink-3);
  margin-bottom: 14px;
}

@media (hover: hover) and (pointer: fine) {
  .back-link:hover { color: var(--accent); }
}

/* ---------- 响应式 ---------- */

@media (max-width: 900px) {
  .paper-body { grid-template-columns: 1fr; }
  .ai-panel { position: static; }
  .home-hero { grid-template-columns: 1fr; gap: 20px; }
  .hero-meta { text-align: left; }
  .featured-grid { grid-template-columns: 1fr; }
  .featured-card.lead { grid-row: auto; }
  .topic-card,
  .topic-card:nth-child(4n + 1),
  .topic-card:nth-child(4n + 2) { grid-column: span 3; }
}

@media (max-width: 720px) {
  .header-inner { flex-wrap: wrap; gap: 10px 18px; padding: 12px 16px; }
  .header-search { width: 100%; order: 3; }
  #app { padding: 24px 16px 56px; }
  .paper-row { grid-template-columns: 1fr; }
  .paper-row .row-actions { justify-content: flex-start; }
  .section-head { flex-direction: column; align-items: flex-start; gap: 4px; }
  .section-head .note { text-align: left; }
  .footer-inner > :last-child { margin-left: 0; }
}

@media (max-width: 480px) {
  .topic-card,
  .topic-card:nth-child(4n + 1),
  .topic-card:nth-child(4n + 2) { grid-column: span 6; }
  .main-nav { gap: 0; }
  .main-nav a { padding: 6px 9px; }
}

/* ---------- 减少动效 ---------- */

@media (prefers-reduced-motion: reduce) {
  *, *::after, *::before {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
