.skeleton {
  position: relative;
  overflow: hidden;
  background-color: #e2e5e7;
}

.skeleton::after {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  background-image: linear-gradient(
    90deg,
    rgba(255, 255, 255, 0) 0,
    rgba(255, 255, 255, 0.2) 20%,
    rgba(255, 255, 255, 0.5) 60%,
    rgba(255, 255, 255, 0)
  );
  background-size: 200% 100%;
  animation: shimmer 2s infinite;
  content: '';
}

@keyframes shimmer {
  0% {
    background-position: 200% 0;
  }
  100% {
    background-position: -200% 0;
  }
}

/* 文本加载骨架屏 */
.skeleton-line {
    height: 16px;
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: skeleton-loading 1.5s infinite;
    border-radius: 4px;
    width: 140px;
}

@keyframes skeleton-loading {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

.app_app.skeleton {
  /* width: 84px;
  height: 84px; */
  border-radius: 4px;
}

.app_app img.loaded {
  opacity: 1;
  transition: opacity 0.3s ease-in;
}

/* 详情页头图加载后保持尺寸不变，防止CLS - 使用最高优先级 */
.detail-header__thumb.loaded {
  width: 100px !important;
  height: 100px !important;
  min-width: 100px !important;
  min-height: 100px !important;
}

.detail-header__thumb.loaded img {
  width: 100% !important;
  height: 100% !important;
  object-fit: cover !important;
  opacity: 1 !important;
  transition: opacity 0.3s ease-in;
}

.alllist_img.skeleton {
  width: 70px;
  height: 70px;
  border-radius: 4px;
}

.alllist_img img.loaded {
  opacity: 1;
  transition: opacity 0.3s ease-in;
}

/* 文章内容图片的骨架屏 */
.apk_left_title .alllist_img.skeleton,
.article-content__body .skeleton {
    width: 90%;
    max-width: 800px;
    min-height: 300px;
    height: 400px;
    border-radius: 4px;
    margin: var(--space-md) auto;
    display: block;
    transition: height 0.3s ease;
}

/* 文章内容图片容器样式 */
.apk_left_title .alllist_img {
    width: 100%;
    height: auto;
    max-width: 800px;
    min-height: 300px;
    position: relative;
    left: 50%;
    transform: translateX(-50%);
    margin: 20px 0;
    transition: height 0.3s ease;
}

.apk_left_title .alllist_img img {
    max-width: 100%;
    height: auto;
    display: block;
    margin: 0 auto;
    transition: opacity 0.3s ease;
}

/* 确保loaded状态下的图片也保持正确尺寸 */
.apk_left_title .alllist_img img.loaded {
    opacity: 1;
    width: 100% !important;
    height: auto !important;
    min-height: 300px;
    object-fit: contain;
}

/* 置顶应用骨架屏 - 响应式尺寸 */
.featured-app__thumb.skeleton {
    width: 80px;
    height: 80px;
    border-radius: var(--radius-sm, 4px);
}

.featured-app__thumb img.loaded {
    opacity: 1;
    transition: opacity 0.3s ease-in;
}

/* 响应式调整 */
@media (max-width: 991px) {
    .featured-app__thumb.skeleton {
        width: 70px;
        height: 70px;
    }
}

@media (max-width: 767px) {
    .featured-app__thumb.skeleton {
        width: 60px;
        height: 60px;
    }
}

@media (max-width: 480px) {
    .featured-app__thumb.skeleton {
        width: 50px;
        height: 50px;
    }
}

/* 热门软件骨架屏 */
.popular-item__thumb.skeleton {
    width: 40px;
    height: 40px;
    border-radius: var(--radius-sm, 4px);
}

.popular-item__thumb img.loaded {
    opacity: 1;
    transition: opacity 0.3s ease-in;
}

/* 近期更新骨架屏 */
.recent-item__thumb.skeleton {
    width: 40px;
    height: 40px;
    border-radius: var(--radius-sm, 4px);
}

.recent-item__thumb img.loaded {
    opacity: 1;
    transition: opacity 0.3s ease-in;
}

/* 分类列表应用骨架屏 */
.app-item__thumb.skeleton {
    width: 70px;
    height: 70px;
    border-radius: var(--radius-sm, 4px);
}

.app-item__thumb img.loaded {
    opacity: 1;
    transition: opacity 0.3s ease-in;
}

/* 分类列表应用骨架屏响应式 */
@media (max-width: 768px) {
    .app-item__thumb.skeleton {
        width: 60px;
        height: 60px;
    }
}

@media (max-width: 480px) {
    .app-item__thumb.skeleton {
        width: 50px;
        height: 50px;
    }
}

@media (max-width: 320px) {
    .app-item__thumb.skeleton {
        width: 40px;
        height: 40px;
    }
}

/* 详情页头图骨架屏 - 确保正方形 */
.detail-header__thumb.skeleton {
    width: 100px;
    height: 100px;
    border-radius: var(--radius-lg, 12px);
    flex-shrink: 0;
    aspect-ratio: 1 / 1;
}

.detail-header__thumb img.loaded {
    opacity: 1;
    transition: opacity 0.3s ease-in;
}

/* 详情页头图响应式 */
@media (max-width: 480px) {
    .detail-header__thumb.skeleton {
        width: 80px;
        height: 80px;
    }
}

/* 确保加载后的图片尺寸正确 */
.detail-header__thumb img.loaded {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* 详情页头图加载失败状态 - 显示占位图 */
.detail-header__thumb.error {
    background: linear-gradient(135deg, #f0f0f0 0%, #e0e0e0 50%, #f0f0f0 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    aspect-ratio: 1 / 1;
}

.detail-header__thumb.error > img {
    display: none !important;
}

.detail-header__thumb.error::after {
    content: '';
    width: 60%;
    height: 60%;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%23999'%3E%3Cpath d='M21 19V5c0-1.1-.9-2-2-2H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2zM8.5 13.5l2.5 3.01L14.5 12l4.5 6H5l3.5-4.5z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: center;
    background-size: contain;
}

/* 响应式调整 */
@media (max-width: 480px) {
    .detail-header__thumb.error {
        width: 80px;
        height: 80px;
    }
}

/* 软件介绍模块图片骨架屏样式 */
.software-intro-img-wrapper.skeleton {
    width: 100%;
    aspect-ratio: 4 / 3;
    border-radius: var(--radius-md, 8px);
    background: linear-gradient(
        135deg,
        #e2e5e7 0%,
        #f0f0f0 50%,
        #e2e5e7 100%
    );
    background-size: 200% 200%;
    animation: skeleton-gradient 1.5s ease-in-out infinite;
}

.software-intro-img-wrapper img.loaded {
    opacity: 1;
    transition: opacity 0.4s ease-in-out;
}

@keyframes skeleton-gradient {
    0% {
        background-position: 200% 0;
    }
    50% {
        background-position: -200% 0;
    }
    100% {
        background-position: 200% 0;
    }
}

/* 图片加载占位图 - 保持容器尺寸防止布局偏移 */
.software-intro-img-wrapper {
    position: relative;
    overflow: hidden;
    width: 100%;
}

.software-intro-img-wrapper img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

/* 图片加载失败状态 */
.software-intro-img-wrapper.error {
    background: linear-gradient(
        135deg,
        #f8f9fa 0%,
        #e9ecef 50%,
        #f8f9fa 100%
    );
    display: flex;
    align-items: center;
    justify-content: center;
    aspect-ratio: 4 / 3;
    border-radius: var(--radius-md, 8px);
}

.software-intro-img-wrapper.error > img {
    display: none !important;
}

.software-intro-img-wrapper.error::after {
    content: '图片加载失败';
    color: #6c757d;
    font-size: 13px;
    font-weight: 500;
    text-align: center;
    padding: 16px 24px;
    margin: 0;
}

/* 响应式调整 - 移动端 */
@media (max-width: 768px) {
    .software-intro-img-wrapper.skeleton {
        aspect-ratio: 4 / 3;
        max-width: 100%;
    }
}

/* 网络慢时的渐进式加载提示 */
@media (prefers-reduced-data: reduce) {
    .software-intro-img-wrapper.skeleton::before {
        content: '⏳';
        position: absolute;
        top: 50%;
        left: 50%;
        transform: translate(-50%, -50%);
        font-size: 24px;
    }
}
