.gallery {
  display: grid;
  grid-template-columns: repeat(1, 1fr);
  gap: 12px;
  overflow-y: scroll;
  height: 100vh;
  padding: 0 20px;
  grid-auto-flow: dense; /* 确保填充空隙 */
}
.gallery {
/* Firefox */
  scrollbar-width: none;
/* IE 10+ */
  -ms-overflow-style: none;
}
/* Chrome、Safari、Edge */
.gallery::-webkit-scrollbar {
  width: 0;
  height: 0;
  background: transparent;
}
.card {
  position: relative;
  width: 100%;
  height: 0;
  padding-top: 150%; /* 2:3 比例 */
  border-radius: 12px;
  box-shadow: 0 4px 8px rgba(0,0,0,0.1);
  transition: transform 0.3s ease, box-shadow 0.3s ease;
  position: relative;
  overflow: hidden; /* 确保圆角下的内容不会溢出 */
}
/* 顶部小蒙版 + 文字 */
.card .card-overlay {
  position: absolute;
  top: 15px; /* 距离卡片上边缘 */
  left: 15px; /* 距离卡片左边缘 */
  right: 15px;
  padding: 4px 8px;
  background: rgba(255,255,255,0.6);
  bottom: calc(64px + 17px);
  color: #000;
  font-size: 1.6rem;
  border-radius: 0px;
  z-index: 10;
  pointer-events: none; /* 不拦截鼠标 */
}
/* 底部简介栏 */
.card .description {
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  box-sizing: border-box;
  padding: 8px 10px;
/* background: rgba(255, 255, 255, 0.85); /* 半透明白色 */
  color: #cfcfcf;
  font-size: 0.9rem;
  font-weight: 700;
  border-bottom-left-radius: 12px;
  border-bottom-right-radius: 12px;
  z-index: 10;
  height: 64px;
  padding: 0 16px;
  text-align: left;
  display: flex;
  align-items: center;
}
.card .card-overlay,
.card .title {
  font-family: 'Noto Serif JP', /* macOS 自带 */ 'Hiragino Mincho ProN', 'Hiragino Mincho Pro', /* Windows */ 'Yu Mincho', 'MS Mincho', serif;
  font-weight: 700; /* 想要更粗一些用 700 */
}
.card::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0,0,0,0.3); /* 半透明黑色蒙层 */
  opacity: 0;
  transition: opacity 0.3s ease;
  z-index: 8; /* 蒙层覆盖图片和信息区域 */
  border-radius: 12px; /* 与卡片相同的圆角 */
}
/* 鼠标悬浮时显示蒙层并放大整个卡片 */
.card:hover {
  transform: scale(1.05); /* 放大整个卡片 */
  box-shadow: 0 3px 6px rgba(0,0,0,0.1); /* 增强阴影 */
  z-index: 15; /* 提升层级，避免被相邻卡片或容器遮挡 */
  transform: scale(1.05);
  box-shadow: 0 8px 16px rgba(0,0,0,0.2);
}
.card:hover::after {
  opacity: 1; /* 显示蒙层 */
}
.card .content {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-size: cover;
  background-position: center;
  border-radius: 12px;
}
/* 媒体查询调整列数 */
@media (min-width: 10px) and (max-width: 749px) {
  .gallery {
    grid-template-columns: repeat(2, 1fr);
  }
  .card:nth-child(2n) {
    transform: translateY(100px);
  }
  .card:nth-child(2n):hover {
    transform: translateY(100px) scale(1.05);
  }
}
@media (min-width: 750px) and (max-width: 999px) {
  .gallery {
    grid-template-columns: repeat(3, 1fr);
  }
  .card:nth-child(3n+2) {
    transform: translateY(100px);
  }
  .card:nth-child(3n+2):hover {
    transform: translateY(100px) scale(1.05);
  }
}
@media (min-width: 1000px) and (max-width: 1249px) {
  .gallery {
    grid-template-columns: repeat(4, 1fr);
  }
  .card:nth-child(4n+2),
  .card:nth-child(4n) {
    transform: translateY(100px);
  }
  .card:nth-child(4n+2):hover,
  .card:nth-child(4n):hover {
    transform: translateY(100px) scale(1.05);
  }
}
@media (min-width: 1250px) and (max-width: 1499px) {
  .gallery {
    grid-template-columns: repeat(5, 1fr);
  }
  .card:nth-child(5n+2),
  .card:nth-child(5n+4) {
    transform: translateY(100px);
  }
  .card:nth-child(5n+2):hover,
  .card:nth-child(5n+4):hover {
    transform: translateY(100px) scale(1.05);
  }
}
@media (min-width: 1500px) {
  .gallery {
    grid-template-columns: repeat(6, 1fr);
  }
  .card:nth-child(6n+2),
  .card:nth-child(6n+4),
  .card:nth-child(6n) {
    transform: translateY(100px);
  }
  .card:nth-child(6n+2):hover,
  .card:nth-child(6n+4):hover,
  .card:nth-child(6n):hover {
    transform: translateY(100px) scale(1.05);
  }
}
@media (min-width: 1750px) {
  .gallery {
    padding-left: calc((100vw - 1750px) / 2 + 10px);
    padding-right: calc((100vw - 1750px) / 2 + 10px);
  }
}
/* —— 黑夜模式适配 —— */
@media (prefers-color-scheme: dark) {
  .gallery {
    background-color: #121212;
    color: #fff;
  }
  .card {
    box-shadow: 0 4px 8px rgba(0,0,0,0.4);
  }
  .card:hover {
    box-shadow: 0 8px 16px rgba(0,0,0,0.6);
  }
  .card .card-overlay {
    background: rgba(0,0,0,0.45);
    color: #fff;
  }
  .card .description {
    background: #1e1e1e !important;
    color: #ddd;
  }
  .card::after {
    background: rgba(255,255,255,0.1);
  }
}
@media (max-aspect-ratio: 10/15) {
  .card {
    padding-top: 180%; /* 2:3 比例 */
  }
  .card .description {
    font-size: 0.7rem;
  }
  .card .card-overlay,
  .card .title {
    font-weight: 500; /* 想要更粗一些用 700 */
    font-size: 1rem;
  }
  .gallery {
    padding: 0 10px;
  }
}
