/* 轻美图 · 移动端图库样式（纯 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: 10px;
    overflow: hidden;
    background: var(--ph);
    position: relative;
    box-shadow: 0 1px 3px rgba(0,0,0,.07);
}
.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 {
    position: relative;
    display: block;
    overflow: hidden;
    width: 100%;
    box-sizing: border-box;
    padding: 9px 11px 10px 13px;
    font-size: 13px;
    line-height: 1.5;
    font-weight: 600;
    letter-spacing: .01em;
    color: var(--text);
    background: var(--card);
    border-top: 1px solid var(--border);
    word-break: break-word;
    max-height: calc(19px + 3em); /* 上下内边距 + 恰好两行，第三行整行裁掉 */
}
.ctitle::before {
    content: "";
    position: absolute;
    left: 0;
    top: 9px;          /* 与首行文字对齐，而不是吊在整条中间 */
    width: 3px;
    height: 17px;
    border-radius: 2px;
    background: var(--accent);
}

/* 搜索分页 */
.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;
}

/* =========================================================
   电脑端自适应（以上样式保持移动端不变，以下只在宽屏生效）
   ≥900px：取消手机窄框，铺满宽屏；图片流按容器宽度自动增列
   ========================================================= */
@media (min-width: 900px) {
  body { background: var(--bg); }

  /* 容器：不再限制 540px 手机宽度 */
  .app {
    max-width: none;
    margin: 0 auto;
    padding-top: 56px;   /* 为顶部导航留位 */
    padding-bottom: 0;   /* 电脑端没有底部导航 */
    box-shadow: none;
  }

  /* 底部导航 → 顶部横向导航 */
  .tabbar {
    top: 0;
    bottom: auto;
    left: 0;
    transform: none;
    max-width: none;
    height: 56px;
    border-top: 0;
    border-bottom: 1px solid var(--border);
    justify-content: center;
    gap: 34px;
  }
  .tab {
    flex: 0 0 auto;
    flex-direction: row;
    gap: 7px;
    font-size: 14px;
    padding: 0 6px;
  }
  .tab .ico { font-size: 17px; }

  /* 搜索栏：居中、限宽，粘在导航下方 */
  .topbar {
    top: 56px;
    justify-content: center;
    gap: 14px;
    padding: 10px 24px;
  }
  .searchbar { flex: 0 1 620px; padding: 9px 16px; }
  .searchbar input { font-size: 15px; }
  .fav-link { font-size: 22px; }

  /* 内容区：宽屏居中，左右留白 */
  .content {
    max-width: 1320px;
    margin: 0 auto;
    padding: 22px 24px 40px;
  }

  /* 图片流：2 列 → 按宽度自动决定列数（每列约 260px） */
  .feed {
    column-count: auto;
    column-width: 260px;
    column-gap: 14px;
  }
  .card {
    margin-bottom: 14px;
    border-radius: 10px;
    z-index: 0;
    transition: box-shadow .25s ease;
  }
  .card img { transition: transform .35s ease; }
  .card:hover { box-shadow: 0 10px 26px rgba(0,0,0,.14); z-index: 2; }
  .card:hover img { transform: scale(1.04); }
  .badge, .vbadge { font-size: 12px; padding: 4px 8px; border-radius: 10px; }
  .ctitle { font-size: 14px; padding: 10px 13px 12px 15px; max-height: calc(22px + 3em); }

  /* 分类列表：固定 2 列 → 自动列数 */
  .cat-list {
    grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
    gap: 16px;
  }
  .cat-cover { height: 150px; }
  .cat-item { transition: transform .25s ease, box-shadow .25s ease; }
  .cat-item:hover { transform: translateY(-3px); box-shadow: 0 10px 24px rgba(0,0,0,.12); }
  .cat-meta { font-size: 14px; }

  /* 交互元素：加大尺寸 + 悬停反馈（电脑端没有 :active 触感） */
  .tagchip { font-size: 14px; padding: 7px 14px; }
  .tagchip:hover { border-color: var(--accent); color: var(--accent); }
  .pager a:hover { border-color: var(--accent); color: var(--accent); }
  .ftab:hover { border-color: var(--accent); }
  .newpill { max-width: 1320px; margin: 2px auto 16px; }

  /* 大图查看：四周留白，不顶满整屏 */
  .lightbox { padding: 24px; }
  .lightbox img { max-width: 92vw; max-height: 90vh; border-radius: 6px; }
  .lb-prev { left: 24px; font-size: 46px; }
  .lb-next { right: 24px; font-size: 46px; }
  .lb-close { top: 20px; right: 26px; }
  .lb-relcard { width: 104px; }
  .lb-relcard img { width: 104px; height: 74px; }

  /* 返回顶部：没有底部导航，贴右下角 */
  .backtop { right: 26px; bottom: 26px; width: 44px; height: 44px; }
}

/* 超大屏（≥1600px）：继续加宽，列数自然增多 */
@media (min-width: 1600px) {
  .content { max-width: 1560px; }
  .feed { column-width: 280px; }
  .cat-list { grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); }
}
