/* =========================================
   1. 基础容器与 PC 端样式 (保持原样)
   ========================================= */

.optimized-carousel-wrapper {
    position: relative;
    width: 100%;
    max-width: 1500px;
    margin: 40px auto;
    overflow: hidden;
    /* PC端保留两侧给按钮的空间 */
    padding: 0 60px;
    box-sizing: border-box;
    /* 触摸优化 */
    touch-action: pan-y;
    -webkit-tap-highlight-color: transparent;
    user-select: none;
}

.optimized-carousel-track {
    display: flex;
    justify-content: space-between;
    gap: 20px;
    width: 100%;
    height: 100%;
}

/* PC端默认：三等分布局 */
.optimized-slide {
    /* 33.33% 减去间隙 */
    flex: 0 0 calc(33.333% - 14px);
    position: relative;
    /* 默认高度自适应 */
    height: auto;
}

.optimized-image {
    width: 100%;
    height: auto;
    /* PC端保持原有的竖屏比例 */
    aspect-ratio: 1280 / 1707;
    object-fit: cover;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    /* PC端最大高度限制 */
    max-height: 600px;
    display: block;
}

/* 鼠标悬停效果 (仅PC) */
@media (hover: hover) {
    .optimized-image:hover {
        transform: scale(1.02);
        box-shadow: 0 6px 20px rgba(0, 0, 0, 0.2);
    }
}

/* PC端按钮样式 (保持原样大尺寸) */
.optimized-button {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 50px;
    height: 250px; /* 原样的大按钮 */
    background-color: rgba(0, 0, 0, 0.7);
    color: white;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    z-index: 10;
    border-radius: 4px;
    backdrop-filter: blur(10px);
    transition: all 0.3s ease;
}

.optimized-button:hover {
    background-color: rgba(0, 0, 0, 0.9);
    transform: translateY(-50%) scale(1.05);
}

.optimized-button.prev { left: 0; }
.optimized-button.next { right: 0; }

/* 占位符样式 */
.image-placeholder {
    width: 100%;
    height: 100%;
    min-height: 500px; /* PC端占位高度 */
    background: #f0f0f0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: #888;
    border-radius: 8px;
}

/* =========================================
   2. 移动端专门优化 (针对 < 768px 设备)
   ========================================= */

@media (max-width: 768px) {
    /* 容器调整：去掉两侧内边距，让图片全宽 */
    .optimized-carousel-wrapper {
        padding: 0;
        margin: 20px auto;
        max-width: 100%;
    }

    /* 隐藏 PC 端的大按钮 (手机靠滑动) */
    .optimized-button {
        display: none;
    }

    /* 【核心修改】变成单图轮播 */
    /* 隐藏第1和第3张图，只留中间那张 */
    #slide-1, #slide-3 {
        display: none !important;
    }

    /* 让中间那张图占满宽度 */
    #slide-2 {
        flex: 0 0 100%;
        width: 100%;
        padding: 0 15px; /* 稍微留点边距好看，如果想完全贴边就设为 0 */
        box-sizing: border-box;
    }

    /* 【核心修改】增加图片高度 */
    /* 之前大概是 320px，现在设为 480px~500px */
    .optimized-image {
        height: 500px !important; /* 强制高度 */
        max-height: 80vh; /* 防止超过屏幕高度的80% */
        aspect-ratio: unset; /* 取消PC端的比例限制，改用固定高度 */
    }

    /* 调整占位符高度与图片一致 */
    .image-placeholder {
        height: 500px !important;
        min-height: 500px !important;
    }

    /* 移动端加载文字大小调整 */
    .loading-text {
        font-size: 14px;
    }
}

/* =========================================
   3. 极小屏幕适配 (iPhone SE 等 < 375px)
   ========================================= */
@media (max-width: 375px) {
    .optimized-image,
    .image-placeholder {
        /* 小屏手机稍微减一点，不然太长了 */
        height: 420px !important;
    }
}