.image-container {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    /* gap: 16px; */
    /* padding: 0 16px; */
    width: 100%;
}

.image-item {
    position: relative;
    overflow: hidden;
    break-inside: avoid;
    /* margin-bottom: 16px; */
}

.image-item.landscape {
    grid-column: span 2;
}

.image-item.portrait {
    grid-column: span 1;
}

.image-item img[loading="lazy"]:not(.tag-icon) {
    cursor: zoom-in;
    transition: transform 0.3s ease, filter 0.3s ease;
    position: relative;
    width: 100%;
    height: 100%;
    display: block;
    /* border-radius: 8px; */
}

.image-item img[loading="lazy"]:not(.tag-icon):hover {
    transform: scale(1.02);
    filter: brightness(1.1);
}

.image-item {
    position: relative;
    overflow: hidden;
    aspect-ratio: unset;
}

.image-item .action-buttons {
    position: absolute;
    /* bottom: 10px;
    right: 10px; */
    display: flex;
    gap: 4px;
    opacity: 1;
    transition: opacity 0.3s ease;
}

.image-item:hover .action-buttons {
    opacity: 1;
}

.action-buttons a {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    background-color: rgba(0, 0, 0, 0.7);
    border-radius: 50%;
    color: white;
    transition: all 0.3s ease;
}

.action-buttons a:hover {
    background-color: var(--meinv-accent-primary);
    transform: scale(1.1);
}

.action-buttons a svg {
    width: 20px;
    height: 20px;
    fill: currentColor;
}

.image-item img[loading="lazy"]:not(.tag-icon)::after {
    content: '';
    position: absolute;
    right: 10px;
    top: 10px;
    width: 24px;
    height: 24px;
    background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='white'%3E%3Cpath d='M15.5 14h-.79l-.28-.27C15.41 12.59 16 11.11 16 9.5 16 5.91 13.09 3 9.5 3S3 5.91 3 9.5 5.91 16 9.5 16c1.61 0 3.09-.59 4.23-1.57l.27.28v.79l5 4.99L20.49 19l-4.99-5zm-6 0C7.01 14 5 11.99 5 9.5S7.01 5 9.5 5 14 7.01 14 9.5 11.99 14 9.5 14z'/%3E%3C/svg%3E") center/contain no-repeat;
    opacity: 0.7;
    transition: opacity 0.3s ease;
}

.image-item img[loading="lazy"]:not(.tag-icon):hover::after {
    opacity: 1;
}

/* 图片查看器样式优化 */
/* 移除与all.css重复的样式，只保留查看器特有的样式 */
.image-viewer {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 1000;
}

.viewer-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.9);
  animation: fadeIn 0.3s ease;
}

.image-viewer.active {
    display: block;
}

.viewer-container {
    position: relative;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
}

.viewer-close {
    position: absolute;
    top: 20px;
    right: 20px;
    color: white;
    font-size: 32px;
    cursor: pointer;
    z-index: 1001;
    opacity: 0.7;
    transition: opacity 0.3s ease;
}

.viewer-close:hover {
    opacity: 1;
}

.viewer-content {
    position: relative;
    width: 90%;
    height: 80%;
    margin: 20px;
}

.viewer-img {
    max-width: 100%;
    max-height: 80vh;
    object-fit: contain;
    animation: scaleIn 0.3s ease;
}



.viewer-actions .recommend-button {
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: rgb(119 119 119 / 70%);
    color: white;
}

.viewer-actions .recommend-button:hover {
    background-color: var(--meinv-accent-primary);
    transform: scale(1.1);
}

.viewer-actions .recommend-button svg {
    width: 24px;
    height: 24px;
    fill: currentColor;
}

.viewer-prev,
.viewer-next {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    color: white;
    font-size: 48px;
    cursor: pointer;
    padding: 20px;
    opacity: 0.7;
    transition: opacity 0.3s ease;
}

.viewer-prev {
    left: 20px;
}

.viewer-next {
    right: 20px;
}

.viewer-prev:hover,
.viewer-next:hover {
    opacity: 1;
}

.viewer-thumbnails {
    display: flex;
    gap: 10px;
    padding: 10px;
    overflow-x: auto;
    max-width: 100%;
    margin-top: 20px;
}

.viewer-thumbnail {
    width: 60px;
    height: 60px;
    border: 2px solid transparent;
    cursor: pointer;
    transition: all 0.3s ease;
}

.viewer-thumbnail.active {
    border-color: #fff;
}

.viewer-thumbnail img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.viewer-actions {
    position: absolute;
    bottom: 50px;
    transform: translateX(-50%);
    display: grid;
    gap: 5px;
    z-index: 1001;
    left: 50%;
    grid-template-columns: repeat(3, 120px);
    width: 100%;
    max-width: 600px;
    text-align: center;
    justify-content: center;
}



.viewer-actions a:hover {
  background-color: var(--meinv-accent-primary);
  transform: scale(1.1);
}

.viewer-actions a svg {
  width: 24px;
  height: 24px;
  fill: currentColor;
}

.viewer-prev:hover,
.viewer-next:hover {
    opacity: 1;
}

.viewer-thumbnails {
    display: flex;
    gap: 10px;
    padding: 10px;
    overflow-x: auto;
    max-width: 100%;
    margin-top: 20px;
}

.viewer-thumbnail {
    width: 60px;
    height: 60px;
    border: 2px solid transparent;
    cursor: pointer;
    transition: all 0.3s ease;
}

.viewer-thumbnail.active {
    border-color: #fff;
}

.viewer-thumbnail img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes scaleIn {
    from { transform: scale(0.9); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}

.image-viewer {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1000;
  }
  
  .viewer-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
  }
  
  .viewer-container {
    position: relative;
    width: 100%;
    height: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
  }
  
  .viewer-main-image {
    max-width: 90%;
    max-height: 90%;
    object-fit: contain;
    opacity: 0;
    transition: opacity 0.3s ease;
  }
  
  .viewer-loading {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    display: none;
    justify-content: center;
    align-items: center;
  }
  
  .spinner {
    width: 40px;
    height: 40px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: #fff;
    animation: spin 1s ease-in-out infinite;
  }
  
  @keyframes spin {
    to {
      transform: rotate(360deg);
    }
  }
  
  .viewer-page-info {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    color: white;
    font-size: 16px;
    background: rgba(0, 0, 0, 0.5);
    padding: 5px 15px;
    border-radius: 15px;
  }
  
  .viewer-close-btn,
  .viewer-prev-btn,
  .viewer-next-btn {
    position: absolute;
    background: none;
    border: none;
    color: white;
    cursor: pointer;
    padding: 10px;
    transition: opacity 0.3s;
  }
  
  .viewer-close-btn:hover,
  .viewer-prev-btn:hover,
  .viewer-next-btn:hover {
    opacity: 0.8;
  }
  
  .viewer-close-btn {
    top: 20px;
    right: 20px;
  }
  
  .viewer-prev-btn {
    left: 20px;
    top: 50%;
    transform: translateY(-50%);
  }
  
  .viewer-next-btn {
    right: 20px;
    top: 50%;
    transform: translateY(-50%);
  }
  
  .viewer-close-btn svg,
  .viewer-prev-btn svg,
  .viewer-next-btn svg {
    width: 24px;
    height: 24px;
    stroke: currentColor;
    stroke-width: 2;
  }