.gallery-viewer {
  margin-top: 20px;
}

.gallery-main {
  position: relative;
  max-width: 900px;
  margin: 0 auto;
}

.gallery-main img {
  width: 100%;
  border-radius: 6px;
  object-fit: contain;
}

.gallery-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 90px;
  height: 90px;
  border-radius: 50%;
  border: 1px solid #ddd;
  background: rgba(255, 255, 255, 0.8);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 65px;
}

.gallery-nav.prev {
  left: 10px;
}
.detail-main{
  border-right:none;
}
.gallery-nav.next {
  right: 10px;
}

.gallery-thumbs {
  display: flex;
  gap: 8px;
  margin-top: 10px;
  overflow-x: auto;
}

.gallery-thumb {
  width: 100px;
  flex-shrink: 0;
  border-radius: 4px;
  overflow: hidden;
  border: 2px solid transparent;
  cursor: pointer;
}

.gallery-thumb.active {
  border-color: #d32f2f;
}

.gallery-thumb img {
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
}

.gallery-actions {
  margin-top: 10px;
  text-align: right;
}

.gallery-actions a {
  font-size: 14px;
  color: #d32f2f;
  text-decoration: none;
}

.gallery-actions a:hover {
  text-decoration: underline;
}

.gallery-mobile-viewer {
  display: none;
}

.gallery-main-mobile img {
  width: 100%;
  border-radius: 6px;
}

.gallery-grid-mobile {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 4px;
  margin-top: 10px;
}

.gallery-grid-mobile img {
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  border-radius: 3px;
  cursor: pointer;
}

.more-gallery {
  margin-top: 30px;
}

.more-gallery-title {
  font-size: 18px;
  margin-bottom: 12px;
}

.more-gallery-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
}

/* Lightbox */
.gallery-lightbox {
  position: fixed;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 9999;
}

.gallery-lightbox.active {
  display: flex;
}

.gl-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  z-index: 0;
}

.gl-content {
  position: relative;
  max-width: 95%;
  max-height: 90%;
  z-index: 1;
  padding-bottom: 40px; /* 为底部下载按钮预留空间，避免压缩图片高度 */
}

.gl-content img {
  max-width: 100%;
  max-height: 100%;
  display: block;
}

.gl-download {
  display: block;
  margin-top: 50px;
  text-align: center;
  font-size: 14px;
  color: #fff;
  text-decoration: none;
}

.gl-download:hover {
  color: #ffcdd2;
  text-decoration: underline;
}

.gl-close {
  position: absolute;
  top: -32px;
  right: 0;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: none;
  background: none;
  cursor: pointer;
  z-index: 2;
  color: #fff;
}

/* 左右按钮与 gl-content 平级，相对 lightbox 定位，避免被裁剪 */
.gallery-lightbox .gl-prev,
.gallery-lightbox .gl-next {
  position: absolute;
  top: 45%;
  transform: translateY(-50%);
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: none;
  background: rgba(255, 255, 255, 0.8);
  cursor: pointer;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  color: #333;
}

.gallery-lightbox .gl-prev {
  left: -50px;
}

.gallery-lightbox .gl-next {
  right: -50px;
}

@media (max-width: 768px) {
  .gallery-viewer {
    display: none;
  }

  .gallery-mobile-viewer {
    display: block;
    margin-top: 15px;
  }

  .more-gallery-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  /* 手机版 Lightbox：左右按钮固定在屏幕左右两侧，始终可见 */
  .gallery-lightbox .gl-content {
    max-width: 85%;
    max-height: 85%;
  }

  .gallery-lightbox .gl-prev {
    left: 12px;
    width: 48px;
    height: 48px;
    font-size: 28px;
    font-weight: bold;
    background: rgba(255, 255, 255, 0.95);
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.35);
  }

  .gallery-lightbox .gl-next {
    right: 12px;
    width: 48px;
    height: 48px;
    font-size: 28px;
    font-weight: bold;
    background: rgba(255, 255, 255, 0.95);
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.35);
  }

  .gallery-lightbox .gl-close {
    top: -22px;
    right: -23px;
    width: 40px;
    height: 40px;
    font-size: 38px;
  }
}

