/* 主题：暗色背景 + 卡片式网格 + 移动端友好 */

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei",
               "Helvetica Neue", Helvetica, Arial, sans-serif;
  color: #f1f1f1;
  background: #1a1a1a;
  line-height: 1.4;
  -webkit-font-smoothing: antialiased;
  user-select: none;
  -webkit-user-select: none;
}

/* ---------- 整体布局：左导航 + 右内容 ---------- */
.layout {
  display: flex;
  align-items: flex-start;
  min-height: 100vh;
}

.sidebar {
  flex: 0 0 216px;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  padding: 18px 14px 20px;
  background: #171717;
  border-right: 1px solid #2c2c2c;
  display: flex;
  flex-direction: column;
}
.sidebar::-webkit-scrollbar { width: 6px; }
.sidebar::-webkit-scrollbar-thumb { background: #333; border-radius: 3px; }

.content {
  flex: 1 1 auto;
  min-width: 0;          /* 允许网格在 flex 中收缩 */
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 20px;
}
.brand img {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  object-fit: cover;
  background: #2a2a2a;
  flex: 0 0 44px;
}
.brand-text { min-width: 0; }
.brand-text h1 {
  font-size: 16px;
  font-weight: 600;
  margin: 0;
  letter-spacing: 0.5px;
  white-space: nowrap;
}
.brand-text .sub {
  font-size: 11px;
  margin: 3px 0 0;
  color: #999;
  line-height: 1.35;
}

.side-foot {
  margin: auto 0 0;
  padding-top: 18px;
  font-size: 11px;
  line-height: 1.7;
  color: #666;
}
.side-foot span { color: #aaa; }

.tabs {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.tab {
  width: 100%;
  min-width: 0;
  padding: 10px 12px;
  font-size: 14px;
  border: 1px solid #3a3a3a;
  border-radius: 10px;
  background: #262626;
  color: #ddd;
  cursor: pointer;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  justify-content: flex-start;
  gap: 8px;
  transition: background .15s, color .15s, border-color .15s;
}
.tab .dot {
  width: 10px; height: 10px;
  border-radius: 50%;
  display: inline-block;
  flex: 0 0 10px;
}
.tab .count {
  margin-left: auto;
  font-size: 12px;
  color: #999;
  font-variant-numeric: tabular-nums;
}
.tab.active {
  background: #f1f1f1;
  color: #1a1a1a;
  border-color: #f1f1f1;
  font-weight: 600;
}
.tab.active .count { color: #666; }

/* ---------- 当前显示计数 ---------- */
.shown {
  padding: 12px 16px 0;
  font-size: 13px;
  color: #999;
}
.shown b { color: #f1f1f1; font-size: 15px; }

/* 卡片标题里的色点 */
.cdot {
  display: inline-block;
  width: 8px; height: 8px;
  border-radius: 50%;
  margin-right: 6px;
  vertical-align: middle;
}

/* ---------- 网格 ---------- */
.grid {
  display: grid;
  gap: 14px;
  padding: 14px 16px 80px;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
}
.card {
  background: #2a2a2a;
  border-radius: 10px;
  overflow: hidden;
  cursor: pointer;
  transition: transform .15s ease, box-shadow .15s ease;
  position: relative;
}
.card:hover { transform: translateY(-2px); box-shadow: 0 6px 18px rgba(0,0,0,.4); }
.card:active { transform: translateY(0); }
.thumb-wrap {
  width: 100%;
  aspect-ratio: 707 / 500;   /* A4 横版 1753:1240 ≈ 1.414 */
  background: #222;
  display: flex;
  align-items: center;
  justify-content: center;
}
.thumb-wrap img {
  width: 100%; height: 100%;
  object-fit: contain;       /* A4 填满，16:9 自动上下留边不裁切 */
  display: block;
  pointer-events: none;       /* 让点击事件落到 .card */
}
.card-title {
  font-size: 13px;
  padding: 8px 12px;
  color: #ddd;
  border-top: 1px solid #333;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.card-title .seq { color: #888; font-variant-numeric: tabular-nums; }

/* ---------- 页脚 ---------- */
.foot {
  padding: 22px 16px 32px;
  text-align: center;
  color: #888;
  font-size: 12px;
}
.foot p { margin: 4px 0; }
.foot .hint { color: #666; }

/* ---------- Lightbox ---------- */
.lightbox {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.94);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 100;
  touch-action: pinch-zoom;
}
.lightbox.open { display: flex; }
.lightbox figure {
  margin: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  max-width: 96vw;
  max-height: 96vh;
}
.lightbox img {
  max-width: 96vw;
  max-height: 86vh;
  object-fit: contain;
  user-select: auto;
  -webkit-user-select: auto;
  -webkit-touch-callout: default; /* 允许长按菜单 */
}
.lightbox figcaption {
  color: #ccc;
  font-size: 14px;
  margin-top: 12px;
}
.lightbox .close,
.lightbox .nav {
  position: absolute;
  background: rgba(255,255,255,.12);
  color: #fff;
  border: none;
  cursor: pointer;
  font-size: 28px;
  line-height: 1;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}
.lightbox .close { top: 16px; right: 16px; }
.lightbox .nav { top: 50%; transform: translateY(-50%); }
.lightbox .nav-prev { left: 16px; }
.lightbox .nav-next { right: 16px; }
.lightbox .close:hover,
.lightbox .nav:hover { background: rgba(255,255,255,.22); }

/* ---------- 移动端：左侧栏变为顶部横向筛选条 ---------- */
@media (max-width: 820px) {
  .layout { flex-direction: column; min-height: 0; }

  .sidebar {
    flex: none;
    width: 100%;
    height: auto;
    position: sticky;
    top: 0;
    z-index: 20;
    padding: 10px 12px 8px;
    border-right: none;
    border-bottom: 1px solid #2c2c2c;
    background: rgba(23, 23, 23, 0.95);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
  }
  .brand { margin-bottom: 8px; gap: 8px; }
  .brand img { width: 34px; height: 34px; flex: 0 0 34px; }
  .brand-text h1 { font-size: 15px; }
  .brand-text .sub { font-size: 10px; }
  .side-foot { display: none; }

  .tabs {
    flex-direction: row;
    overflow-x: auto;
    gap: 6px;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
  }
  .tabs::-webkit-scrollbar { display: none; }
  .tab {
    width: auto;
    flex: 0 0 auto;
    padding: 7px 12px;
    font-size: 13px;
    border-radius: 999px;
  }
  .tab .count { margin-left: 4px; }

  .grid { padding: 10px 12px 60px; }
}

@media (max-width: 480px) {
  .grid { gap: 10px; padding: 10px 10px 60px;
          grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); }
  .lightbox .close { width: 38px; height: 38px; font-size: 22px; }
  .lightbox .nav { width: 38px; height: 38px; font-size: 22px; }
}