/* 轻美图 · 移动端图库样式（纯 CSS，无框架；支持深色模式） */
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; padding: 0; }

/* 主题变量（跟随系统深色模式） */
:root {
    --page: #d9dadf;        /* 页面外背景（手机框外） */
    --bg: #f4f5f7;          /* 应用背景 */
    --card: #ffffff;        /* 卡片/导航背景 */
    --text: #222222;        /* 主文字 */
    --muted: #999999;       /* 次要文字 */
    --border: #eeeeee;      /* 分隔线 */
    --chip: #f0f1f3;        /* 搜索框底色 */
    --ph: #e9eaec;          /* 图片占位底色 */
    --accent: #ff4d6d;      /* 主题色 */
}
@media (prefers-color-scheme: dark) {
    :root {
        --page: #0b0c0f;
        --bg: #111318;
        --card: #1b1e24;
        --text: #e8eaf0;
        --muted: #8b90a0;
        --border: #2a2e36;
        --chip: #242830;
        --ph: #23262d;
    }
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Helvetica Neue", "PingFang SC", "Microsoft YaHei", sans-serif;
    background: var(--page);
    color: var(--text);
    -webkit-font-smoothing: antialiased;
}
/* 居中手机宽度容器：桌面端显示为手机框，移动端自适应铺满 */
.app {
    max-width: 540px;
    margin: 0 auto;
    min-height: 100vh;
    background: var(--bg);
    position: relative;
    padding-bottom: 56px; /* 为底部导航留位 */
    box-shadow: 0 0 0 1px rgba(0,0,0,.04);
}

/* 顶部搜索栏 */
.topbar {
    position: sticky;
    top: 0;
    z-index: 20;
    background: var(--card);
    padding: 8px 12px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    gap: 10px;
}
.searchbar {
    display: flex;
    align-items: center;
    background: var(--chip);
    border-radius: 20px;
    padding: 6px 12px;
    flex: 1;
    min-width: 0;
}
.searchbar .search-ico { font-size: 14px; opacity: .5; margin-right: 6px; }
.searchbar input {
    border: 0;
    outline: 0;
    background: transparent;
    flex: 1;
    font-size: 14px;
    color: var(--text);
}
.fav-link {
    text-decoration: none;
    font-size: 20px;
    line-height: 1;
    padding: 4px;
}

/* 内容区 */
.content { padding: 10px; }

/* 图片流：双列瀑布 */
.feed {
    column-count: 2;
    column-gap: 8px;
}
.card {
    display: block;
    margin: 0 0 8px;
    break-inside: avoid;
    border-radius: 8px;
    overflow: hidden;
    background: var(--ph);
    position: relative;
}
.card img {
    width: 100%;
    height: auto; /* 配合 width/height 属性保持宽高比，加载前预留空间 */
    display: block;
    object-fit: cover;
}
/* 角标：一组多少张 */
.badge {
    position: absolute;
    top: 6px;
    right: 6px;
    z-index: 2;
    background: rgba(255, 77, 109, .92);
    color: #fff;
    font-size: 11px;
    line-height: 1;
    padding: 3px 6px;
    border-radius: 9px;
    pointer-events: none;
}
/* 角标：浏览量（推荐页热度） */
.vbadge {
    position: absolute;
    top: 6px;
    left: 6px;
    z-index: 2;
    background: rgba(0, 0, 0, .55);
    color: #fff;
    font-size: 11px;
    line-height: 1;
    padding: 3px 6px;
    border-radius: 9px;
    pointer-events: none;
}
/* 返回顶部 */
.backtop {
    position: fixed;
    right: 14px;
    bottom: 70px;
    z-index: 25;
    width: 40px;
    height: 40px;
    border: 0;
    border-radius: 50%;
    background: var(--card);
    color: var(--text);
    font-size: 17px;
    box-shadow: 0 2px 10px rgba(0,0,0,.18);
    cursor: pointer;
}
.backtop[hidden] { display: none; }
/* 卡片标题（组标题，可选） */
.ctitle {
    display: block;
    padding: 6px 8px;
    font-size: 13px;
    color: var(--text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* 搜索分页 */
.pager {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 16px;
    padding: 14px 0 4px;
    font-size: 14px;
}
.pager a {
    color: var(--accent);
    text-decoration: none;
    padding: 6px 12px;
    border: 1px solid var(--border);
    border-radius: 18px;
    background: var(--card);
}
.pnow { color: var(--muted); }

.loadmore, .empty {
    text-align: center;
    color: var(--muted);
    font-size: 13px;
    padding: 16px 0;
}

/* 收藏/历史页 */
.favhead {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 12px;
}
.ftab {
    border: 1px solid var(--border);
    background: var(--card);
    color: var(--text);
    border-radius: 18px;
    padding: 7px 16px;
    font-size: 13px;
    cursor: pointer;
}
.ftab.on { background: var(--accent); border-color: var(--accent); color: #fff; }
.fclear {
    margin-left: auto;
    color: var(--muted);
    font-size: 13px;
    cursor: pointer;
}
.favitem { position: relative; break-inside: avoid; margin-bottom: 8px; }
.fdel {
    position: absolute;
    top: 6px;
    left: 6px;
    z-index: 3;
    border: 0;
    background: rgba(0,0,0,.55);
    color: #fff;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    font-size: 12px;
    line-height: 1;
    cursor: pointer;
}

/* 分类列表 */
.tagbar {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 14px;
}
.tagchip {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: var(--card);
    color: var(--text);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 6px 12px;
    font-size: 13px;
    text-decoration: none;
}
.tagchip span {
    color: var(--accent);
    font-size: 11px;
}
.tagchip:active { border-color: var(--accent); }

.cat-list {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
}
.cat-item {
    display: block;
    background: var(--card);
    border-radius: 10px;
    overflow: hidden;
    text-decoration: none;
    color: var(--text);
    box-shadow: 0 1px 3px rgba(0,0,0,.06);
}
.cat-cover {
    width: 100%;
    height: 120px;
    object-fit: cover;
    display: block;
}
.cat-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 10px;
    font-size: 13px;
}
.cat-count { color: var(--muted); }

/* 信息流引导卡片（进群转化） */
.promo {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 6px;
    margin: 0 0 8px;
    break-inside: avoid;
    border-radius: 8px;
    background: var(--card);
    border: 1px dashed var(--accent);
    padding: 14px 10px;
    text-decoration: none;
}
.promo img {
    width: 100%;
    border-radius: 6px;
    display: block;
}
.promo-text {
    color: var(--accent);
    font-size: 13px;
    font-weight: 600;
    text-align: center;
}

/* 底部导航 */
.tabbar {
    position: fixed;
    left: 50%;
    transform: translateX(-50%);
    bottom: 0;
    width: 100%;
    max-width: 540px;
    height: 56px;
    background: var(--card);
    border-top: 1px solid var(--border);
    display: flex;
    z-index: 30;
}
.tab {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    color: var(--muted);
    font-size: 11px;
    gap: 2px;
}
.tab .ico { font-size: 18px; line-height: 1; }
.tab.on { color: var(--accent); }

/* 大图查看层 */
.lightbox {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.92);
    z-index: 50;
    display: flex;
    align-items: center;
    justify-content: center;
}
.lightbox[hidden] { display: none; }
.lightbox img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}
.lb-close, .lb-prev, .lb-next, .lb-fav, .lb-share, .lb-title {
    position: absolute;
    color: #fff;
    user-select: none;
    cursor: pointer;
}
.lb-close { top: 14px; right: 16px; font-size: 26px; }
.lb-share { top: 16px; left: 16px; font-size: 22px; }
.lb-title {
    top: 16px;
    left: 50%;
    transform: translateX(-50%);
    max-width: 64%;
    font-size: 14px;
    font-weight: 600;
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    background: rgba(0,0,0,.45);
    padding: 5px 12px;
    border-radius: 14px;
    cursor: default;
}
.lb-fav { bottom: 14px; right: 16px; font-size: 28px; } /* 右下角：手机单手易点 */
.lb-prev { left: 10px; top: 50%; transform: translateY(-50%); font-size: 40px; }
.lb-next { right: 10px; top: 50%; transform: translateY(-50%); font-size: 40px; }
.lb-count {
    position: absolute;
    bottom: 16px;
    left: 50%;
    transform: translateX(-50%);
    color: #fff;
    font-size: 13px;
    background: rgba(0,0,0,.5);
    padding: 4px 12px;
    border-radius: 12px;
    user-select: none;
}

/* ---------- 今日新增胶囊 ---------- */
.newpill {
  margin: 2px 0 12px;
  text-align: center;
  font-size: 12.5px;
  color: #7a5a00;
  background: linear-gradient(90deg, #fff4d6, #ffe9ec, #fff4d6);
  border: 1px solid #ffe3a9;
  border-radius: 99px;
  padding: 7px 14px;
}
.newpill b { color: #e0355e; font-size: 14px; margin: 0 2px; }

/* ---------- 灯箱沉浸流底栏（下一套 + 相关推荐） ---------- */
.lb-nextbar {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  z-index: 5;
  padding: 10px 12px calc(12px + env(safe-area-inset-bottom));
  background: linear-gradient(180deg, rgba(0,0,0,0), rgba(0,0,0,.72) 40%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  pointer-events: none; /* 底栏区域不拦截点击：收藏/箭头等下方元素仍可点 */
}
.lb-nextbtn {
  border: 0;
  border-radius: 99px;
  padding: 10px 26px;
  font-size: 14.5px;
  font-weight: 700;
  color: #fff;
  background: linear-gradient(135deg, #ff4d6d, #ff8a3d);
  box-shadow: 0 4px 14px rgba(255, 77, 109, .45);
  cursor: pointer;
  pointer-events: auto;
}
.lb-nextbtn:active { transform: scale(.96); }
.lb-rel {
  display: flex;
  gap: 8px;
  max-width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  padding: 2px;
  pointer-events: auto; /* 相关推荐卡可点 */
}
.lb-rel:empty { display: none; }
.lb-relcard {
  flex: none;
  width: 86px;
  text-decoration: none;
  color: #fff;
}
.lb-relcard img {
  width: 86px;
  height: 64px;
  object-fit: cover;
  border-radius: 8px;
  display: block;
  background: rgba(255,255,255,.12);
}
.lb-relcard span {
  display: block;
  font-size: 10.5px;
  line-height: 1.4;
  margin-top: 3px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  opacity: .9;
}
