:root {
  --bg: #eef1f4;
  --card: #ffffff;
  --text: #333333;
  --text-2: #808080;
  --text-3: #b0b0b0;
  --border: #e8e8e8;
  --accent: #00A651;
  --topbar-h: 56px;
  --feed-w: 640px;
  --radius: 8px;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font: 15px/1.6 -apple-system, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
img { display: block; max-width: 100%; }

/* 顶栏 */
.topbar {
  position: sticky; top: 0; z-index: 50;
  background: var(--card);
  border-bottom: 1px solid var(--border);
  height: var(--topbar-h);
}
.topbar-inner {
  max-width: var(--feed-w); height: 100%; margin: 0 auto; padding: 0 16px;
  display: flex; align-items: center;
}
.logo { display: flex; align-items: center; gap: 8px; font-size: 20px; font-weight: 700; }
.logo-mark {
  width: 32px; height: 32px; border-radius: 8px;
  background: var(--accent); color: #fff;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 18px;
}
.topnav { display: flex; gap: 2px; margin-left: auto; }
.topnav a { padding: 8px 14px; border-radius: 6px; color: var(--text-2); font-size: 15px; }
.topnav a:hover { background: #f5f5f5; color: var(--text); }
.topnav a.on { color: var(--accent); font-weight: 600; }
/* 顶栏搜索框 */
.top-search { flex: 1; max-width: 240px; margin: 0 16px; min-width: 0; }
.top-search input {
  width: 100%; border: 1px solid var(--border); background: #f5f6f7;
  border-radius: 16px; padding: 7px 14px; font-size: 13px; outline: none; color: var(--text);
}
.top-search input:focus { background: #fff; border-color: var(--accent); }
.top-search input::placeholder { color: var(--text-3); }

/* 单列固定宽度信息流 */
.feed { max-width: var(--feed-w); margin: 16px auto 40px; padding: 0 12px; }
.card {
  background: var(--card); border-radius: var(--radius);
  padding: 16px 16px 14px; margin-bottom: 12px;
  border: 1px solid #f0f0f0;
}
.card-head { display: flex; gap: 10px; margin-bottom: 8px; }
.avatar { width: 44px; height: 44px; border-radius: 50%; flex: none; }
.nick { font-weight: 700; font-size: 15px; }
.pin-badge {
  display: inline-block; font-size: 11px; color: var(--accent);
  border: 1px solid var(--accent); border-radius: 3px;
  padding: 0 5px; margin-left: 6px; font-weight: 400; vertical-align: 1px;
}
.meta { color: var(--text-2); font-size: 12px; margin-top: 2px; }
.tlink:hover { color: var(--accent); }
.card-text { font-size: 15px; word-break: break-word; white-space: pre-wrap; }
.topic { color: var(--accent); }
.topic:hover { text-decoration: underline; }
.more-link { color: var(--accent); }
.more-link:hover { text-decoration: underline; }

/* 图片：统一三宫格 1:1 缩略图（单图也只占一格）；超 9 张时第 9 格加遮罩 +N；每张缩略图独立圆角 */
.img-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 5px; margin-top: 10px; }
.img-grid[hidden] { display: none; }
.im { position: relative; border: 0; padding: 0; background: #f5f5f5; overflow: hidden; cursor: zoom-in; aspect-ratio: 1; border-radius: 6px; }
.im img { width: 100%; height: 100%; object-fit: cover; }
.im .more {
  position: absolute; inset: 0;
  background: rgba(0,0,0,.5); color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 30px; font-weight: 600;
}
/* 格内大图：在当前文章卡片内以 640px 宽盛满，原始宽高比 */
.img-large { position: relative; margin-top: 10px; }
.img-large[hidden] { display: none; }
.img-large .il-img { width: 100%; height: auto; border-radius: 6px; cursor: zoom-out; }
.il-prev, .il-next {
  position: absolute; top: 50%; transform: translateY(-50%);
  width: 40px; height: 40px; border-radius: 50%; border: 0;
  background: rgba(0,0,0,.45); color: #fff; font-size: 18px; cursor: pointer;
}
.il-prev:hover, .il-next:hover { background: rgba(0,0,0,.65); }
.il-prev { left: 10px; } .il-next { right: 10px; }
.il-count {
  position: absolute; bottom: 10px; left: 50%; transform: translateX(-50%);
  background: rgba(0,0,0,.55); color: #fff; font-size: 12px;
  padding: 2px 10px; border-radius: 10px;
}

/* 话题页 / 详情页 */
.page-head {
  max-width: var(--feed-w); margin: 16px auto 0; padding: 0 12px;
}
.page-title {
  background: var(--card); border-radius: var(--radius);
  padding: 16px; font-size: 18px; font-weight: 700;
  border: 1px solid #f0f0f0; margin-bottom: 12px;
}
.page-title .topic { font-size: 18px; }
.page-title small { display: block; font-size: 13px; color: var(--text-2); font-weight: 400; margin-top: 4px; }
.back { display: inline-block; margin: 0 0 12px; color: var(--text-2); font-size: 14px; }
.back:hover { color: var(--accent); }
.detail-nav { display: flex; justify-content: space-between; margin-top: 4px; }
.detail-nav a {
  background: var(--card); border-radius: var(--radius); padding: 10px 16px;
  font-size: 14px; color: var(--text-2); border: 1px solid #f0f0f0;
  max-width: 48%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.detail-nav a:hover { color: var(--accent); border-color: var(--accent); }
.foot { text-align: center; color: var(--text-3); font-size: 12px; padding: 0 0 32px; }
/* 搜索页 */
.search-box { padding: 12px; }
.search-box input {
  width: 100%; border: 1px solid var(--border); border-radius: 8px;
  padding: 10px 14px; font-size: 15px; outline: none; color: var(--text);
}
.search-box input:focus { border-color: var(--accent); }
.search-meta { max-width: var(--feed-w); margin: 0 auto 12px; padding: 0 12px; color: var(--text-2); font-size: 13px; }
.search-empty { text-align: center; color: var(--text-3); padding: 40px 0; }
/* 归档页 */
.panel { background: var(--card); border-radius: var(--radius); padding: 16px; border: 1px solid #f0f0f0; }
.archive-panel h3 { font-size: 16px; margin: 4px 0; padding-bottom: 8px; border-bottom: 1px solid var(--border); }
.archive-panel h3:not(:first-child) { margin-top: 20px; }
.arow2 { display: flex; gap: 10px; padding: 9px 2px; font-size: 14px; border-bottom: 1px dashed #f0f0f0; align-items: baseline; }
.arow2:hover .t { color: var(--accent); }
.arow2 .d { color: var(--text-3); font-size: 12px; flex: none; width: 88px; }
.arow2 .t { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.arow2 .p { color: var(--text-3); font-size: 12px; flex: none; }

@media (max-width: 560px) {
  .card { padding: 14px 12px 12px; border-radius: 0; border-left: 0; border-right: 0; }
  .feed { padding: 0; margin-top: 8px; }
  .page-head { padding: 0; margin-top: 8px; }
  .page-title { border-radius: 0; border-left: 0; border-right: 0; }
  .back { margin-left: 12px; }
  .logo-name { display: none; }
  .top-search { margin: 0 8px; }
  .topnav a { padding: 8px 8px; font-size: 14px; }
}
