/* ============================================================
   前台移动端 UI 样式（手机优先）
   ============================================================ */
:root {
  --primary: #2f6fed;
  --primary-d: #1e56cf;
  --primary-bg: #eaf1ff;
  --bg: #f4f6fa;
  --card: #ffffff;
  --text: #1d2129;
  --text2: #6b7280;
  --text3: #9aa1ad;
  --line: #eceef2;
  --danger: #e5484d;
  --radius: 12px;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
    "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  color: var(--text);
  background: var(--bg);
  -webkit-text-size-adjust: 100%;
  font-size: 14px;
  line-height: 1.5;
}
a { color: inherit; text-decoration: none; }
img { max-width: 100%; }
button { font-family: inherit; cursor: pointer; }

/* ---------- 顶部应用栏 ---------- */
.app-bar {
  position: sticky;
  top: 0;
  z-index: 20;
  background: rgba(255,255,255,.94);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.app-bar-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 52px;
  padding: 0 14px;
}
.brand { display: flex; align-items: center; gap: 8px; min-width: 0; flex: none; }
.brand-dot {
  width: 24px; height: 24px; flex: none;
  border-radius: 7px;
  background: linear-gradient(135deg, #4f8cff, #2f6fed);
  display: inline-flex; align-items: center; justify-content: center;
  color: #fff;
}
.brand-dot svg { width: 15px; height: 15px; }
.brand-name {
  font-size: 16.5px; font-weight: 700;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.app-bar-actions { display: flex; align-items: center; gap: 2px; flex: none; }
.icon-btn {
  width: 38px; height: 38px;
  border-radius: 10px;
  border: none; background: transparent;
  display: inline-flex; align-items: center; justify-content: center;
  color: var(--text);
}
.icon-btn:active { background: #eef1f6; }
.icon-btn svg { width: 22px; height: 22px; }

/* ---------- 顶部搜索框 ---------- */
.app-search {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  height: 36px;
  margin: 0 10px;
  padding: 0 12px;
  background: #f0f2f7;
  border-radius: 18px;
  gap: 6px;
  transition: background .15s, box-shadow .15s;
}
.app-search:focus-within {
  background: #fff;
  box-shadow: 0 0 0 1.5px var(--primary);
}
.app-search svg {
  width: 16px;
  height: 16px;
  color: var(--text3);
  flex: none;
}
.app-search input {
  flex: 1;
  min-width: 0;
  border: none;
  background: transparent;
  outline: none;
  font-size: 13px;
  color: var(--text);
  font-family: inherit;
}
.app-search input::placeholder { color: var(--text3); }
.app-search input[type="search"]::-webkit-search-cancel-button { -webkit-appearance: none; }

/* ---------- 分类横滑栏 ---------- */
.cat-bar {
  display: flex; gap: 8px;
  overflow-x: auto;
  padding: 10px 14px;
  background: var(--card);
  border-bottom: 1px solid var(--line);
  scrollbar-width: none;
  cursor: grab;
  -webkit-user-select: none;
  user-select: none;
}
.cat-bar::-webkit-scrollbar { display: none; }
.cat-bar.dragging { cursor: grabbing; }
.cat-bar.dragging * { pointer-events: none; }
.cat-chip {
  flex: none;
  padding: 7px 15px;
  border-radius: 20px;
  font-size: 13px;
  color: var(--text2);
  background: #f0f2f7;
  transition: background .15s, color .15s;
}
.cat-chip.active { background: var(--primary); color: #fff; font-weight: 600; }
.cat-chip:active { opacity: .8; }

/* ---------- 文章列表 ---------- */
.list-main { padding: 12px 14px 96px; display: flex; flex-direction: column; gap: 12px; }

.article-card {
  display: flex;
  background: var(--card);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: 0 1px 3px rgba(16,24,40,.05);
}
.article-card:active { opacity: .92; }
.ac-cover {
  width: 106px; flex: none;
  min-height: 94px;
  background: #e6ebf2 center/cover no-repeat;
}
.ac-body { padding: 12px 14px; flex: 1; min-width: 0; }
.ac-meta { display: flex; align-items: center; gap: 8px; font-size: 11px; color: var(--text3); }
.tag { color: var(--primary); background: var(--primary-bg); padding: 2px 8px; border-radius: 6px; font-weight: 600; }
.ac-time { display: inline-flex; align-items: center; gap: 3px; }
.ac-views { display: inline-flex; align-items: center; gap: 3px; }
.ac-views svg, .ac-time svg { width: 13px; height: 13px; }
.ac-title {
  font-size: 15px; font-weight: 600; line-height: 1.45;
  margin: 6px 0 4px;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.ac-desc {
  font-size: 12px; color: var(--text2); line-height: 1.5; margin: 0;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}

/* ---------- 空状态 ---------- */
.empty {
  text-align: center; color: var(--text3);
  padding: 60px 20px;
}
.empty svg { width: 56px; height: 56px; opacity: .35; margin-bottom: 10px; }
.empty p { margin: 0; font-size: 14px; }

/* ---------- 文章详情 ---------- */
.post-page { background: var(--card); padding: 18px 18px 30px; }
.post-title { font-size: 21px; font-weight: 700; line-height: 1.4; margin: 6px 0 10px; }
.post-meta {
  display: flex; align-items: center; flex-wrap: wrap; gap: 10px;
  font-size: 12px; color: var(--text3);
  padding-bottom: 14px; border-bottom: 1px solid var(--line); margin-bottom: 14px;
}
.post-meta .meta-item { display: inline-flex; align-items: center; gap: 4px; }
.post-meta svg { width: 14px; height: 14px; }
.post-cover { border-radius: 10px; overflow: hidden; margin-bottom: 16px; }
.post-cover img { display: block; width: 100%; }

.post-content { font-size: 15.5px; line-height: 1.75; color: #2b2f36; word-break: break-word; }
.post-content p { margin: 0 0 14px; }
.post-content h1, .post-content h2, .post-content h3, .post-content h4 {
  margin: 22px 0 10px; line-height: 1.4; font-weight: 700;
}
.post-content h1 { font-size: 20px; }
.post-content h2 { font-size: 19px; }
.post-content h3 { font-size: 17.5px; }
.post-content h4 { font-size: 16px; }
.post-content img { border-radius: 8px; display: block; margin: 10px auto; }
.post-content blockquote {
  margin: 14px 0; padding: 10px 14px;
  border-left: 4px solid var(--primary);
  background: #f6f8fc; color: #4b5563;
  border-radius: 0 8px 8px 0;
}
.post-content ul, .post-content ol { margin: 0 0 14px; padding-left: 22px; }
.post-content li { margin-bottom: 5px; }
.post-content a { color: var(--primary); text-decoration: underline; }
.post-content pre {
  background: #1d2129; color: #e8eaf0;
  padding: 12px 14px; border-radius: 8px;
  overflow-x: auto; font-size: 13px; line-height: 1.6;
  margin: 0 0 14px;
}
.post-content code { background: #f0f2f7; border-radius: 4px; padding: 1px 5px; font-size: 13px; }
.post-content pre code { background: none; padding: 0; color: inherit; }

.post-footer { padding: 14px 18px 30px; }
.post-nav { display: flex; gap: 10px; }

/* ---------- 搜索页 ---------- */
.search-bar {
  display: flex; gap: 8px; padding: 12px 14px; background: var(--card);
  border-bottom: 1px solid var(--line);
}
.search-input {
  flex: 1; height: 42px;
  border: 1px solid var(--line); border-radius: 10px;
  padding: 0 14px; font-size: 14px; background: #f6f8fb; outline: none;
}
.search-input:focus { border-color: var(--primary); background: #fff; }

/* ---------- 通用按钮 ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  gap: 6px;
  height: 46px; padding: 0 20px;
  border-radius: 12px; border: none;
  font-size: 15px; font-weight: 600;
  color: #fff; background: var(--primary);
}
.btn:active { opacity: .88; }
.btn-block { display: flex; width: 100%; }
.btn-outline { background: var(--card); color: var(--primary); border: 1px solid var(--primary); }
.btn-ghost { background: #f0f2f7; color: var(--text2); }
.btn-sm { height: 36px; padding: 0 14px; font-size: 13px; border-radius: 9px; }
.btn-danger { background: var(--danger); }

/* ---------- 悬浮发布按钮（登录后显示） ---------- */
.fab {
  position: fixed;
  right: 18px; bottom: 22px;
  width: 54px; height: 54px;
  border-radius: 50%;
  background: var(--primary);
  color: #fff;
  box-shadow: 0 8px 22px rgba(47,111,237,.4);
  display: flex; align-items: center; justify-content: center;
  z-index: 25;
  transition: transform .15s;
}
.fab:active { transform: scale(.92); }
.fab svg { width: 26px; height: 26px; }

/* ---------- 页脚 ---------- */
.site-footer {
  padding: 18px 16px 34px;
  text-align: center;
  font-size: 12px; color: var(--text3);
}
.site-footer .footer-login { color: var(--primary); }

/* ---------- 站点统计（页面底部） ---------- */
.site-stats {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin: auto 14px 4px;
  padding: 12px 14px;
  background: var(--card);
  border-radius: var(--radius);
  font-size: 12px;
  color: var(--text2);
  box-shadow: 0 1px 3px rgba(16,24,40,.05);
  flex-shrink: 0;
}
.site-stats span { display: inline-flex; align-items: center; }
.site-stats b { color: var(--primary); font-weight: 700; margin: 0 2px; }

/* ---------- 备案号（页面底部） ---------- */
.site-icp {
  margin: 0 14px 14px;
  padding: 0 14px;
  text-align: center;
  font-size: 11px;
  color: var(--text3);
}
.site-icp a {
  color: var(--text3);
  text-decoration: none;
}
.site-icp a:hover { color: var(--primary); }
