:root {
  --blue: #0969c9;
  --blue-light: #d5e5f6;
  --blue-dark: #0577b1;
  --red: #e14a45;
  --text: #333;
  --muted: #888;
  --line: #e8e8e8;
  --bg: #f5f7fa;
  --card: #fff;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", sans-serif;
  color: var(--text);
  background: var(--bg);
  line-height: 1.7;
  -webkit-text-size-adjust: 100%;
  overflow-x: hidden;
}
a { color: inherit; text-decoration: none; }
img { border: 0; display: block; max-width: 100%; }

/* ---------- 首页 ---------- */
.home-wrap { max-width: 920px; margin: 0 auto; padding: 36px 18px 60px; }
.site-header { margin-bottom: 26px; }
.brand { display: flex; align-items: center; gap: 14px; }
.brand-mark {
  width: 52px; height: 52px; border-radius: 14px;
  background: linear-gradient(135deg, #1762bf, #6bbaf2);
  color: #fff; font-size: 28px; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 6px 16px rgba(9, 105, 201, .22);
}
.brand h1 { margin: 0; font-size: 26px; line-height: 1.3; }
.brand p { margin: 2px 0 0; color: var(--muted); font-size: 14px; }
.slogan { margin: 14px 0 0; color: #666; font-size: 15px; }

/* Tab 切换：全部 / 收藏夹 */
.tabs { display: flex; gap: 8px; margin: 0 0 16px; border-bottom: 2px solid var(--line); }
.tab {
  position: relative; padding: 10px 18px 12px; border: 0; background: none;
  font-size: 15px; color: var(--muted); cursor: pointer; font-family: inherit;
}
.tab:hover { color: var(--blue); }
.tab.active { color: var(--blue); font-weight: 700; }
.tab.active::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: -2px;
  height: 2px; background: var(--blue); border-radius: 2px;
}
.tab .tab-count {
  display: inline-block; min-width: 18px; padding: 0 5px; margin-left: 4px;
  background: #eef2f7; color: #8894a5; border-radius: 9px;
  font-size: 12px; line-height: 18px; text-align: center;
}
.tab.active .tab-count { background: var(--blue); color: #fff; }

.search-box { display: flex; gap: 10px; margin-bottom: 12px; }
.search-box input {
  flex: 1; height: 46px; padding: 0 16px;
  border: 1px solid var(--line); border-radius: 10px;
  background: #fff; font-size: 15px; color: var(--text);
  outline: none; transition: border-color .2s, box-shadow .2s;
}
.search-box input:focus { border-color: var(--blue); box-shadow: 0 0 0 3px rgba(9, 105, 201, .1); }
.search-box button {
  height: 46px; padding: 0 18px; border-radius: 10px;
  border: 1px solid var(--line); background: #fff;
  color: #666; font-size: 14px; cursor: pointer;
}
.search-box button:hover { border-color: var(--blue); color: var(--blue); }
.result-bar { color: var(--muted); font-size: 13px; margin: 0 0 14px 2px; }
.result-bar strong { color: var(--blue); }
.page-info { color: var(--muted); }

.pagination { display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: 8px; margin: 26px 0 6px; }
.page-btn {
  min-width: 38px; height: 36px; padding: 0 12px;
  border: 1px solid var(--line); border-radius: 8px;
  background: #fff; color: #555; font-size: 14px; cursor: pointer;
  transition: all .18s;
}
.page-btn:hover:not(:disabled) { border-color: var(--blue); color: var(--blue); }
.page-btn:disabled { opacity: .45; cursor: not-allowed; }
.page-btn.page-active { background: var(--blue); border-color: var(--blue); color: #fff; font-weight: 600; }
.page-current { color: var(--muted); font-size: 14px; }

.article-list { display: grid; gap: 14px; }
.article-card {
  display: flex; gap: 18px; padding: 18px;
  background: var(--card); border: 1px solid var(--line);
  border-radius: 12px; transition: transform .18s, box-shadow .18s, border-color .18s;
}
.article-card:hover { transform: translateY(-2px); box-shadow: 0 10px 24px rgba(0, 0, 0, .06); border-color: #b9d6f2; }
.card-cover { width: 132px; height: 96px; flex: none; border-radius: 8px; overflow: hidden; background: #eef3f8; }
.card-cover img { width: 100%; height: 100%; object-fit: cover; }
.card-body { flex: 1; min-width: 0; }
.card-id { color: var(--blue); font-size: 12px; font-weight: 600; letter-spacing: .3px; }
.card-title { margin: 6px 0 8px; font-size: 18px; line-height: 1.45; }
.card-desc { margin: 0; color: #777; font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.card-meta { display: flex; gap: 14px; margin-top: 10px; color: #999; font-size: 12px; }
.card-meta .more { margin-left: auto; color: var(--blue); font-weight: 600; }
.empty { padding: 48px 20px; text-align: center; color: var(--muted); background: #fff; border-radius: 12px; border: 1px dashed var(--line); }
.home-footer { margin-top: 34px; text-align: center; color: #aaa; font-size: 12px; }

/* ---------- 详情页（仿落地页） ---------- */
.detail-toolbar {
  max-width: 750px; margin: 0 auto; padding: 14px 22px 0;
  display: flex; justify-content: space-between; align-items: center;
  color: #999; font-size: 13px;
}
.detail-toolbar .back { color: var(--blue); font-weight: 600; }
.detail-toolbar .back:hover { text-decoration: underline; }
.fav-btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 14px; border: 1px solid var(--blue); border-radius: 18px;
  background: #fff; color: var(--blue); font-size: 13px; font-family: inherit;
  cursor: pointer; transition: all .18s; white-space: nowrap;
}
.fav-btn:hover { background: #eef5fd; }
.fav-btn .fav-icon { font-size: 17px; line-height: 1; }
.fav-btn.is-faved { background: var(--blue); border-color: var(--blue); color: #fff; }
.fav-btn.is-faved:hover { background: #0758a8; }
.detail-wrap {
  position: relative; max-width: 750px; margin: 0 auto 40px;
  background: #fff; box-shadow: 0 2px 18px rgba(0, 0, 0, .05);
}
.detail-wrap .main { padding: 30px 22px; }
.header .title { font-size: 30px; line-height: 1.4; color: #333; font-weight: 700; }
.header .info { margin-top: 16px; display: flex; align-items: center; gap: 8px; font-size: 15px; }
.header .info .tag { border: 1px solid var(--line); border-radius: 14px; padding: 0 8px; color: #666; }
.header .info .text { color: #999; }
.header .info i { width: 18px; height: 18px; border-radius: 50%; background: #f0f0f0; display: inline-block; }
.header .info-right { justify-content: flex-end; }
.color-b { color: #607fa6; font-weight: 700; }
.header .box { margin-top: 22px; border: 1px solid #eee; border-radius: 10px; overflow: hidden; }
.header .box-title { background: #f8f8f8; padding: 12px 16px; font-size: 16px; color: #555; }
.header .box .name { padding: 16px; display: flex; align-items: center; gap: 8px; font-size: 16px; }
.header .box .name i { width: 18px; height: 18px; border-radius: 50%; background: #e8f2fc; display: inline-block; }
.header .box .name2 { color: var(--blue-dark); font-weight: 700; }
.content { margin-top: 26px; }
.content .templateDate { margin: 0 0 16px; }
.teacher { display: flex; flex-wrap: wrap; gap: 20px; padding-bottom: 14px; border-bottom: 1px solid #eee; color: #555; font-size: 15px; }
.tips { margin: 16px 0; padding: 12px 14px; background: #fff8e6; border-left: 4px solid #f5a623; color: #865b00; font-size: 14px; }
.article-body { font-size: 17px; line-height: 1.8; }
.article-body p { margin: 14px 0; font-size: 17px; }
.article-body p span { font-size: 17px; }
.article-body img { max-width: 100%; height: auto; margin: 18px auto; border-radius: 4px; }
.article-body .section-title {
  background: var(--blue-light); color: var(--blue-dark);
  border-left: 6px dotted #6091c3; border-radius: 225px;
  text-align: center; padding: 10px 20px; margin: 24px 0;
  font-size: 18px; font-weight: 700;
}
.source-line { margin-top: 24px; padding-top: 14px; border-top: 1px solid #eee; color: #999; font-size: 13px; word-break: break-all; }
.source-line a { color: var(--blue); }
.footer { margin-top: 30px; padding-top: 18px; border-top: 1px solid #eee; }
.footer .box { color: #888; font-size: 14px; }
.footer p { margin: 6px 0; }
.fixed {
  position: fixed; right: max(18px, calc((100vw - 800px) / 2)); bottom: 40px;
  width: 72px; padding: 10px 0; background: linear-gradient(180deg, #6bbaf2, #1762bf);
  color: #fff; border-radius: 10px; text-align: center; font-size: 14px; line-height: 1.25;
  box-shadow: 0 6px 18px rgba(23, 98, 191, .3);
}
.fixed .ic-wx { display: flex; justify-content: center; }
.fixed .num { width: 24px; height: 24px; border-radius: 50%; background: #fff; color: var(--blue); font-weight: 700; display: flex; align-items: center; justify-content: center; }
.fixed .text { margin-top: 6px; }

/* ---------- 移动端适配 ---------- */
@media (max-width: 640px) {
  .home-wrap { padding: 18px 13px 44px; }

  /* 首页头部 */
  .brand-mark { width: 44px; height: 44px; font-size: 24px; border-radius: 12px; }
  .brand { gap: 11px; }
  .brand h1 { font-size: 21px; }
  .brand p { font-size: 12px; }
  .slogan { margin-top: 10px; font-size: 13px; }

  /* 搜索：字号 16px 防止 iOS 聚焦时自动放大 */
  .search-box { gap: 8px; }
  .search-box input { height: 44px; padding: 0 12px; font-size: 16px; min-width: 0; }
  .search-box button { height: 44px; padding: 0 14px; font-size: 14px; flex: none; }
  .result-bar { font-size: 12px; line-height: 1.6; }

  /* 分页：按钮收紧、允许换行 */
  .pagination { gap: 6px; margin: 22px 0 4px; }
  .page-btn { min-width: 34px; height: 34px; padding: 0 9px; font-size: 13px; }

  /* 文章卡片竖排 */
  .article-card { flex-direction: column; gap: 12px; padding: 14px; }
  .card-cover { width: 100%; height: 160px; }
  .card-title { font-size: 17px; }
  .card-desc { white-space: normal; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
  .card-meta { flex-wrap: wrap; gap: 6px 14px; }
  .card-meta .more { margin-left: 0; width: 100%; }

  /* Tab */
  .tabs { gap: 4px; margin-bottom: 14px; }
  .tab { padding: 9px 14px 11px; font-size: 14px; }

  /* 详情页 */
  .detail-toolbar { padding: 12px 13px 0; font-size: 12px; flex-wrap: wrap; gap: 8px; }
  .detail-toolbar .fav-btn { padding: 5px 12px; }
  .detail-wrap { margin-bottom: 28px; }
  .detail-wrap .main { padding: 20px 15px; }
  .header .title { font-size: 22px; line-height: 1.4; }
  .header .info { flex-wrap: wrap; gap: 8px; margin-top: 14px; font-size: 13px; }
  .header .info-right { justify-content: flex-start; }
  .header .box { margin-top: 18px; }
  .header .box-title { padding: 10px 13px; font-size: 14px; }
  .header .box .name { padding: 13px; font-size: 14px; flex-wrap: wrap; }
  .content { margin-top: 22px; }
  .content .templateDate { margin-bottom: 12px; }
  .teacher { gap: 8px 18px; font-size: 13px; }
  .tips { font-size: 13px; line-height: 1.7; }
  .article-body, .article-body p, .article-body p span { font-size: 16px; line-height: 1.85; }
  /* 关键：覆盖正文图片的内联固定宽高，避免溢出/压扁变形 */
  .article-body img { width: auto !important; height: auto !important; max-width: 100% !important; margin: 14px auto; }
  .article-body .section-title { font-size: 16px; padding: 9px 12px; margin: 20px 0; border-radius: 10px; }
  .source-line { font-size: 12px; }
  .footer .box { font-size: 12px; }

  /* 悬浮返回按钮缩小，避免遮挡正文 */
  .fixed { right: 10px; bottom: 14px; width: 58px; padding: 8px 0; font-size: 12px; }
  .fixed .num { width: 20px; height: 20px; font-size: 12px; }
}

@media (max-width: 360px) {
  .brand h1 { font-size: 19px; }
  .card-title { font-size: 16px; }
  .header .title { font-size: 20px; }
  .article-body, .article-body p, .article-body p span { font-size: 15px; }
  .page-btn { min-width: 30px; padding: 0 7px; }
}
