/* Gallery styles */
.gallery {
  display: flex;
  flex-wrap: wrap;
  gap: 0.8em; /* Increase gap to prevent overlap */
  width: 80%;
  max-width: 1200px;
  margin: 150px auto 20px; /* Adjust for header and tag filter */
  padding: 10px;
  flex-grow: 1; /* Ensure gallery takes up available space */
  align-items: flex-start; /* Align items to the top */
  opacity: 0; /* Start hidden */
  transition: opacity 1s; /* Fade-in effect */
}

/* Keyframes for image fly-in effect */
@keyframes flyIn {
  0% {
    transform: translateY(30px); /* 减少初始位移距离，从100px减到30px */
    opacity: 0;
  }
  100% {
    transform: translateY(0);
    opacity: 1;
  }
}

/* Loading spinner animations */
@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

/* Loading spinner styles */
.loading-spinner {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 20px;
  color: #fff;
}

.spinner {
  width: 40px;
  height: 40px;
  border: 4px solid rgba(255, 255, 255, 0.3);
  border-top: 4px solid #fff;
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin-bottom: 10px;
}

.loading-paused {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 20px;
  color: #fff;
}

.spinner-paused {
  width: 40px;
  height: 40px;
  border: 4px solid rgba(255, 255, 255, 0.3);
  border-top: 4px solid #fff;
  border-radius: 50%;
  animation: pulse 2s ease-in-out infinite;
  margin-bottom: 10px;
}

/* EXIF info styles */
.exif-info {
  background: rgba(0, 0, 0, 0.7);
  border-radius: 8px;
  padding: 15px;
  margin: 10px 0;
  text-align: left;
  max-width: 400px;
  margin-left: auto;
  margin-right: auto;
}

.exif-info p {
  margin: 5px 0;
  color: #fff;
  font-size: 14px;
  line-height: 1.4;
}

.exif-info strong {
  color: #4CAF50;
  font-weight: 600;
}

/* Dark theme for EXIF info */
body.dark .exif-info {
  background: rgba(255, 255, 255, 0.1);
}

body.dark .exif-info strong {
  color: #81C784;
}

.gallery .column {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 0.8em;
  position: relative; /* 确保子元素的z-index正常工作 */
}

/* Modal styles */
.modal {
  display: none;
  position: fixed;
  z-index: 1000;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  overflow: auto;
  background-color: rgba(0, 0, 0, 0.9);
  opacity: 1;
  transition: opacity 0.3s ease; /* 添加平滑过渡 */
}

.modal-content {
  margin: auto;
  margin-top: 100px; /* Top margin */
  display: block;
  max-width: 90%;
  max-height: 80%; /* Adjust to accommodate caption and exif-info */
  width: auto;
  height: auto;
}

.close {
  position: absolute;
  top: 15px;
  right: 35px;
  color: #fff;
  font-size: 40px;
  font-weight: bold;
  transition: 0.3s;
}

.close:hover,
.close:focus {
  color: #bbb;
  text-decoration: none;
  cursor: pointer;
}

#caption,
#exif-info {
  margin: auto;
  display: block;
  width: 90%;
  max-width: 700px;
  text-align: center;
  color: #ccc;
  padding: 10px 0;
}

/* Disable scrolling */
.no-scroll {
  overflow: hidden;
}

/* Dark theme styles */
body.dark .gallery img {
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.6); /* Darker shadow for dark mode */
}

body.dark .gallery img.loaded:hover {
  box-shadow: 0 8px 16px rgba(0, 0, 0, 0.8); /* Darker shadow for hover in dark mode */
}

body.dark .close {
  color: #e0e0e0;
}

body.dark #caption,
body.dark #exif-info {
  color: #e0e0e0;
}

#loading {
  /* ... existing code ... */
  background: rgba(255, 255, 255, 0.8); /* 添加半透明背景 */
  padding: 20px;
  border-radius: 10px;
}

/* 标签筛选样式 */
.tag-filter {
    position: fixed;
    top: 90px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    flex-wrap: nowrap; /* 防止换行，使标签始终在同一行 */
    gap: 10px;
    padding: 10px;
    /* width: 90%;          设置较窄的宽度 */
    /* max-width: 600px;     最大宽度限制 */
    max-width: 90%;     
    background: rgba(250, 250, 250, 0.9);
    border-radius: 20px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
    z-index: 100;
    overflow-x: auto;     /* 启用横向滚动 */
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch; /* 平滑滚动 */
    
    /* 隐藏滚动条 */
    scrollbar-width: none; /* Firefox */
    -ms-overflow-style: none; /* IE 10+ */
}
.tag-filter::-webkit-scrollbar {
    display: none; /* Chrome/Safari/Webkit */
}

.tag {
    padding: 5px 15px;
    border: none;
    border-radius: 15px;
    background-color: #e1e1e1; 
    color: #333;
    cursor: pointer;
    transition: background-color 0.15s ease;
}

@media (hover: hover) and (pointer: fine) {
  .tag:not([aria-pressed="true"]):hover {
    background: #d0d0d0;
  }
  body.dark .tag:not([aria-pressed="true"]):hover {
    background: #444;
  }
}

body.dark .tag-filter {
    background: rgba(0, 0, 0, 0.9);
}

body.dark .tag {
    background: #333;
    color: #fff;
}

.tag-filter-vertical {
    position: fixed;
    bottom: 20px;
    left: 20px;
    display: flex;
    flex-direction: column;
    max-height: 150px;
    overflow-y: auto;
    gap: 10px;
    padding: 10px;
    background: rgba(250, 250, 250, 0.9);
    border-radius: 10px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
    z-index: 100;
    scrollbar-width: none;
    -ms-overflow-style: none;
}
.tag-filter-vertical::-webkit-scrollbar {
    display: none; /* Chrome/Safari/Webkit */
}
.tag-filter-vertical::-webkit-scrollbar-thumb {
    background-color: #ccc;
    border-radius: 10px;
}

/* 基础图片样式 */
.gallery img {
  width: 100%;
  object-fit: cover;
  border-radius: 10px;
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
  cursor: pointer;
  opacity: 0;
  transform: translateY(30px); /* 修改为与flyIn动画一致的值 */
  position: relative;
  z-index: 1;
}

/* 已加载图片的基本样式 */
.gallery img.loaded {
  animation: flyIn 0.5s ease-out forwards; /* 将动画时间从0.8s减少到0.5s使动画更快 */
  transition: transform 0.3s cubic-bezier(0.19, 1, 0.22, 1), 
              box-shadow 0.3s cubic-bezier(0.19, 1, 0.22, 1),
              z-index 0.1s;
  will-change: transform, box-shadow;
  opacity: 1; /* 确保图片可见，不依赖动画 */
}

/* 悬停样式 - 使用更长的动画时间 */
.gallery img.loaded:hover,
.gallery img.loaded.hover-active {
  transform: translate(1px, -2px) !important;
  box-shadow: -5px 12px 20px rgba(0, 0, 0, 0.5) !important;
  z-index: 10 !important;
}

/* 深色模式下的效果 */
body.dark .gallery img.loaded:hover,
body.dark .gallery img.loaded.hover-active {
  box-shadow: -5px 12px 20px rgba(0, 0, 0, 0.8) !important;
}

/* 添加悬停区域占位元素样式 */
.hover-guard {
  position: absolute;
  z-index: 9;
  pointer-events: none;
}

/* 当模态窗口打开时禁用悬停效果 */
body.modal-open .gallery img:hover,
body.modal-open .gallery img.hover-active {
  transform: none !important;
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2) !important;
  z-index: 1 !important;
  transition: none !important;
}

/* 改进悬停效果在模态关闭后的恢复 */
body:not(.modal-open) .gallery img.loaded:hover,
body:not(.modal-open) .gallery img.loaded.hover-active {
  transition: transform 2s cubic-bezier(0.19, 1, 0.22, 1), 
              box-shadow 2s cubic-bezier(0.19, 1, 0.22, 1) !important;
}

/* 置底按钮样式 */
.scroll-to-bottom {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 50px;
    height: 50px;
    background: rgba(250, 250, 250, 0.9);
    border: none;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
    z-index: 100;
    transition: all 0.3s ease;
    opacity: 0;
    transform: translateY(100px);
}

.scroll-to-bottom.visible {
    opacity: 1;
    transform: translateY(0);
}

.scroll-to-bottom:hover {
    background: rgba(240, 240, 240, 0.95);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
}

.scroll-to-bottom:active {
    transform: scale(0.95);
}

.scroll-to-bottom svg {
    width: 24px;
    height: 24px;
    fill: #666;
    transition: fill 0.3s ease;
}

.scroll-to-bottom:hover svg {
    fill: #333;
}

/* 深色模式样式 */
body.dark .scroll-to-bottom {
    background: rgba(50, 50, 50, 0.9);
}

body.dark .scroll-to-bottom:hover {
    background: rgba(60, 60, 60, 0.95);
}

body.dark .scroll-to-bottom svg {
    fill: #ccc;
}

body.dark .scroll-to-bottom:hover svg {
    fill: #fff;
}

/* 自动滚动指示器 */
.auto-scroll-indicator {
    position: fixed;
    bottom: 80px;
    right: 20px;
    padding: 8px 12px;
    background: rgba(250, 250, 250, 0.9);
    border-radius: 15px;
    font-size: 12px;
    color: #666;
    opacity: 0;
    transform: translateX(100px);
    transition: all 0.3s ease;
    z-index: 100;
    pointer-events: none;
}

.auto-scroll-indicator.visible {
    opacity: 1;
    transform: translateX(0);
}

body.dark .auto-scroll-indicator {
    background: rgba(50, 50, 50, 0.9);
    color: #ccc;
}

/* 图片占位避免并发加载时布局不断跳动。 */
.gallery-card { width: 100%; border-radius: 10px; background: rgba(127, 127, 127, .12); }
.gallery-card img { display: block; height: auto; }
.preview-error { width: 100%; height: 100%; min-height: 100px; padding: 12px; border: 0; border-radius: 10px; background: transparent; color: var(--text-color); cursor: pointer; }
.modal { z-index: 2000; }
.close { background: transparent; border: 0; }
.modal-actions { position: fixed; left: 0; right: 0; bottom: 0; padding: 14px 12px calc(14px + env(safe-area-inset-bottom)); display: flex; flex-wrap: wrap; justify-content: center; gap: 12px; background: rgba(0, 0, 0, .85); z-index: 1; }
.modal-actions button, .modal-actions a { position: static; transform: none; margin: 0; padding: 10px 16px; border-radius: 8px; border: 0; background: #4caf50; color: white; font: inherit; text-decoration: none; cursor: pointer; }
.modal-actions [hidden] { display: none; }
.modal-actions button:disabled { opacity: .65; cursor: wait; }
.modal.original-size .modal-content { max-width: none; max-height: none; height: auto; margin: 80px 20px 110px; }
#all-loaded-message { text-align: center; padding: 20px; }
header { box-sizing: border-box; height: auto; min-height: 60px; }
@media (max-width: 600px) { header h1 { font-size: 1.1em; } .gallery { width: 94%; padding: 6px; gap: 8px; } .gallery .column { gap: 8px; } .modal-content { margin-top: 70px; max-height: 70vh; } }
@media (prefers-reduced-motion: reduce) { .gallery img.loaded { animation: none; transform: none; } }

/* Shared controls reset avoids Safari's native oversized button appearance. */
button, .modal-actions a { -webkit-appearance: none; appearance: none; box-sizing: border-box; font-family: inherit; }
:root { --bg-color: #f7f4ef; --shadow-color: rgba(27, 25, 22, .16); --primary-color-dark: #0f0e0c; }
header { padding: 10px max(12px, env(safe-area-inset-right)) 10px max(12px, env(safe-area-inset-left)); padding-top: max(10px, env(safe-area-inset-top)); gap: 8px; }
header h1 { min-width: 0; font-size: clamp(17px, 3vw, 24px); }
header h1 a { display: block; margin: 0; font-size: inherit; }
.header-buttons { align-items: center; gap: 4px; flex-shrink: 0; }
.header-buttons a, header #theme-toggle { display: flex; align-items: center; justify-content: center; width: 44px; height: 44px; margin: 0; padding: 0; }
.gallery { box-sizing: border-box; }
.gallery .column { min-width: 0; }
.tag { flex-shrink: 0; font-size: 14px; min-height: 36px; }
.tag[aria-pressed="true"], body.dark .tag[aria-pressed="true"] { background: var(--primary-color); color: #fff; }
body.dark .tag[aria-pressed="true"] { background: #e8e2d8; color: #1c1a17; }
.scroll-to-bottom:not(.visible) { visibility: hidden; pointer-events: none; }
.auto-scroll-indicator:not(.visible) { visibility: hidden; }
body.modal-open .scroll-to-bottom, body.modal-open .auto-scroll-indicator { visibility: hidden; }

/* The photo scrolls inside its stage; toolbar and actions stay within the viewport. */
#myModal { box-sizing: border-box; height: 100vh; height: 100dvh; overflow: hidden; background: rgba(0, 0, 0, .96); padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left); grid-template-rows: auto minmax(0, 1fr) auto; overscroll-behavior: contain; touch-action: auto; }
.modal-toolbar { display: flex; justify-content: flex-end; padding: 6px 10px; }
#myModal .close { position: static; display: flex; align-items: center; justify-content: center; flex: 0 0 44px; width: 44px; height: 44px; min-width: 44px; min-height: 44px; margin: 0; padding: 0; border: 0; border-radius: 50%; background: #252525; color: #fff; font: 32px/1 Arial, sans-serif; cursor: pointer; }
.modal-stage { min-height: 0; min-width: 0; display: flex; align-items: center; justify-content: center; overflow: auto; padding: 0 12px; -webkit-overflow-scrolling: touch; }
#myModal .modal-content { display: block; width: auto; height: auto; max-width: 100%; max-height: 100%; margin: 0; object-fit: contain; flex-shrink: 0; background: transparent; }
.modal-footer { min-width: 0; padding: 8px 12px 12px; background: #111; color: #fff; }
#myModal #exif-info { width: auto; max-width: none; margin: 0; padding: 0 0 8px; color: #eee; font-size: 13px; overflow-wrap: anywhere; }
#myModal #exif-info:empty { display: none; }
#myModal .modal-actions { position: static; display: flex; flex-wrap: wrap; gap: 8px; padding: 0; background: transparent; }
#myModal .modal-actions button, #myModal .modal-actions a { position: static; display: flex; align-items: center; justify-content: center; min-height: 44px; padding: 10px 14px; font: 14px/1.3 Arial, sans-serif; white-space: nowrap; margin: 0; box-shadow: none; transform: none; background: #388e3c; color: #fff; }
#myModal .modal-actions [hidden] { display: none; }
#myModal #original-link { background: #333; }
#myModal.original-size .modal-stage { display: block; }
#myModal.original-size .modal-content { max-width: none; max-height: none; margin: 0; }
@media (max-width: 600px) {
  .gallery { width: 100%; padding: 0 10px; }
  .tag-filter-vertical { box-sizing: border-box; flex-direction: row; top: var(--header-height, 64px); bottom: auto; left: 0; width: 100%; max-height: none; overflow-x: auto; overflow-y: hidden; gap: 6px; padding: 8px 10px; border-radius: 0; }
  .tag-filter-vertical .tag { min-height: 44px; padding: 8px 14px; }
  .modal-stage { padding: 0 8px; }
  #myModal .modal-actions > * { flex: 1 1 auto; }
  .scroll-to-bottom { right: max(12px, env(safe-area-inset-right)); bottom: max(12px, env(safe-area-inset-bottom)); }
}
@media (max-height: 450px) {
  .modal-toolbar { padding: 2px 8px; }
  .modal-footer { padding: 4px 8px; }
  #myModal #exif-info { padding-bottom: 4px; }
}
:focus-visible { outline: 3px solid #90caf9; outline-offset: 3px; }
#loading.failed { display: flex; flex-direction: column; gap: 12px; width: min(80vw, 360px); color: #333; background: #fff; text-align: center; }
#loading.failed::after { display: none; }
#loading.failed button { min-height: 44px; border: 0; border-radius: 8px; padding: 10px 16px; background: #388e3c; color: white; cursor: pointer; }

/* ==========================================================================
   PURELIGHT 版式：左侧分类栏 + 内容区 + 预渲染静态网格 + 广告位统一尺寸
   （本文件最后加载，这里的规则覆盖前面的临时样式）
   ========================================================================== */

/* 站名（原来是 header h1，为了每页只有一个 h1 改成 .brand） */
header .brand {
  margin: 0;
  font-size: clamp(17px, 3vw, 24px);
  font-weight: 600;
  letter-spacing: 0.18em;
  min-width: 0;
}
header .brand a {
  display: block;
  color: inherit;
  text-decoration: none;
  font: inherit;
  letter-spacing: inherit;
}

/* ---------- 页面骨架：左侧栏 + 内容区 ---------- */
.shell {
  display: flex;
  align-items: flex-start;
  gap: clamp(18px, 3.2vw, 48px);
  width: 100%;
  max-width: 1380px;
  margin: 0 auto;
  padding: calc(var(--header-height, 64px) + 30px) clamp(14px, 3vw, 34px) 0;
  box-sizing: border-box;
}

.stage { flex: 1 1 auto; min-width: 0; }

.shell .gallery {
  width: 100%;
  max-width: none;
  margin: 0;
  padding: 0;
}

/* ---------- 左侧分类导航 ---------- */
.rail {
  position: sticky;
  top: calc(var(--header-height, 64px) + 30px);
  flex: 0 0 156px;
  align-self: flex-start;
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 0;
  background: transparent;
  box-shadow: none;
  z-index: 40;
  max-height: calc(100vh - var(--header-height, 64px) - 60px);
  overflow-y: auto;
  scrollbar-width: none;
}
.rail::-webkit-scrollbar { display: none; }

.rail .tag {
  display: block;
  width: 100%;
  box-sizing: border-box;
  padding: 9px 12px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: inherit;
  font: inherit;
  font-size: 11px;
  line-height: 1.4;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  text-align: left;
  text-decoration: none;
  opacity: 0.55;
  transition: opacity 0.18s ease, background-color 0.18s ease;
}
.rail .tag:hover { opacity: 1; background: rgba(127, 127, 127, 0.1); }
.rail .tag[aria-pressed="true"],
.rail .tag[aria-current="page"] {
  opacity: 1;
  background: #1c1a17;
  color: #f7f4ef;
}
body.dark .rail .tag[aria-pressed="true"],
body.dark .rail .tag[aria-current="page"] {
  background: #e8e2d8;
  color: #1c1a17;
}

/* ---------- 页头文案 ---------- */
.page-head { max-width: 44em; margin: 26px 0 30px; }
.page-kicker {
  margin: 0 0 12px;
  font-size: 10px;
  letter-spacing: 0.32em;
  text-transform: uppercase;
  opacity: 0.45;
}
.page-head h1 {
  margin: 0 0 14px;
  font-size: clamp(25px, 3.6vw, 40px);
  font-weight: 500;
  line-height: 1.14;
  letter-spacing: -0.01em;
}
.page-lede {
  margin: 0 0 18px;
  font-size: clamp(15px, 1.5vw, 17px);
  line-height: 1.6;
  opacity: 0.82;
}
.page-copy p {
  margin: 0 0 12px;
  font-size: 14px;
  line-height: 1.75;
  opacity: 0.68;
}
.page-stats {
  margin: 20px 0 0;
  font-size: 10px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  opacity: 0.38;
}

/* ---------- 预渲染静态网格（无 JS 也能看图，爬虫直接读到 img） ---------- */
.static-grid {
  columns: 4;
  column-gap: 0.8em;
  margin: 0 0 6px;
}
.static-item {
  margin: 0 0 0.8em;
  break-inside: avoid;
  -webkit-column-break-inside: avoid;
  page-break-inside: avoid;
}
.static-link { display: block; }
.static-item img {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 10px;
  box-shadow: 0 4px 8px var(--shadow-color);
  background: rgba(127, 127, 127, 0.1);
}
.static-item figcaption {
  margin-top: 6px;
  font-size: 9.5px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  opacity: 0.4;
}
/* JS 画廊接管后隐藏静态网格，避免同一批图出现两份 */
body.gallery-live #static-gallery { display: none; }

/* ---------- 广告位：和图片卡片严格同宽同高 ---------- */
.ad-card .ad-slot {
  width: 100%;
  height: 100%;
  min-height: 0;
  box-sizing: border-box;
  display: grid;
  place-items: center;
  border: 1px dashed rgba(127, 127, 127, 0.4);
  border-radius: 10px;
  color: #9a948a;
  font-size: 10px;
  letter-spacing: 0.26em;
  text-transform: uppercase;
}

.ad-slot.ad-bottom {
  width: 100%;
  margin: 10px 0 26px;
  min-height: 96px;
  box-sizing: border-box;
}

/* ---------- 图集之间的内链 ---------- */
.collection-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin: 6px 0 44px;
  padding-top: 18px;
  border-top: 1px solid rgba(127, 127, 127, 0.22);
  font-size: 12.5px;
}
.collection-nav a {
  color: inherit;
  text-decoration: none;
  opacity: 0.72;
  max-width: 32%;
}
.collection-nav a:hover { opacity: 1; }
.collection-nav span {
  display: block;
  margin-bottom: 4px;
  font-size: 9px;
  letter-spacing: 0.24em;
  text-transform: uppercase;
  opacity: 0.5;
}
.collection-next { text-align: right; }
.collection-all {
  font-size: 9.5px !important;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  white-space: nowrap;
}

.collection-index {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 4px 0 44px;
  padding-top: 18px;
  border-top: 1px solid rgba(127, 127, 127, 0.22);
}
.collection-index-title {
  width: 100%;
  margin: 0 0 4px;
  font-size: 9.5px;
  letter-spacing: 0.26em;
  text-transform: uppercase;
  opacity: 0.45;
}
.collection-index a {
  padding: 7px 14px;
  border: 1px solid rgba(127, 127, 127, 0.28);
  border-radius: 999px;
  color: inherit;
  text-decoration: none;
  font-size: 12px;
  opacity: 0.78;
}
.collection-index a:hover { opacity: 1; border-color: rgba(127, 127, 127, 0.55); }
.collection-index a span {
  margin-right: 8px;
  font-size: 9px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  opacity: 0.5;
}

/* ---------- 小屏：侧栏变成顶栏下面的横向滚动条 ---------- */
@media (max-width: 1100px) {
  .static-grid { columns: 3; }
}

@media (max-width: 820px) {
  .shell {
    flex-direction: column;
    gap: 0;
    padding-top: calc(var(--header-height, 64px) + 6px);
    padding-left: 0;
    padding-right: 0;
  }
  .stage { padding: 0 14px; width: 100%; box-sizing: border-box; }
  .rail {
    position: sticky;
    top: var(--header-height, 64px);
    flex: 0 0 auto;
    flex-direction: row;
    align-items: center;
    gap: 6px;
    width: 100%;
    max-height: none;
    padding: 10px 14px;
    overflow-x: auto;
    overflow-y: hidden;
    background: var(--bg-color);
    box-sizing: border-box;
  }
  .rail .tag {
    width: auto;
    flex: 0 0 auto;
    min-height: 38px;
    padding: 9px 14px;
    border-radius: 999px;
    background: rgba(127, 127, 127, 0.1);
    white-space: nowrap;
  }
  .static-grid { columns: 2; }
  .page-head { margin: 18px 0 22px; }
  .collection-nav a { max-width: 40%; }
}

@media (max-width: 520px) {
  .page-head h1 { font-size: 23px; }
  .static-grid { columns: 2; column-gap: 8px; }
  .static-item { margin-bottom: 8px; }
}

/* 无内容时不占位（预渲染页面里 #loading 通常是空的） */
#loading:empty { display: none; }
