/* Product detail gallery: preserve proportions and adapt the frame to the image. */
.pin-box #DB_gallery .DB_imgSet {
    box-sizing: border-box;
    width: 100%;
    height: auto;
    padding: 16px 20px;
}

.pin-box #DB_gallery .DB_imgSet .DB_imgWin {
    box-sizing: border-box;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: auto;
    padding: 0;
}

.pin-box #DB_gallery .DB_imgSet .DB_imgWin > img {
    display: block;
    width: auto;
    height: auto;
    max-width: 100%;
    max-height: none;
    margin: 0 auto;
    object-fit: contain;
    object-position: center;
}

/* Keep the thumbnail strip close to the main image. */
.pin-box #DB_gallery .DB_thumSet {
    margin-top: 10px;
}

/* Related products stay visible and fit both desktop and phone screens. */
.pin-box .history-view {
    display: block;
    width: 1200px;
    max-width: 92%;
}

.pin-box .history-view .picScroll-left .bd ul {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 30px;
}

.pin-box .history-view .picScroll-left .bd ul::before,
.pin-box .history-view .picScroll-left .bd ul::after {
    display: none;
}

.pin-box .history-view .picScroll-left .bd ul li {
    box-sizing: border-box;
    float: none;
    width: auto;
    min-width: 0;
    margin: 0;
    padding: 20px;
}

.pin-box .history-view .picScroll-left .bd ul li .pic img {
    box-sizing: border-box;
    width: 100%;
    max-width: 100%;
    height: 140px;
    padding: 8px;
    background: #fff;
    object-fit: contain;
}

.pin-box .history-view .picScroll-left .bd ul li .title p {
    min-height: 38px;
}

.pin-box .history-view .picScroll-left .title .tt-btn {
    box-sizing: border-box;
    width: 150px;
    max-width: 100%;
}

@media (max-width: 1024px) {
    .pin-box .history-view .picScroll-left .bd ul {
        grid-template-columns: repeat(3, minmax(0, 1fr));
        gap: 16px;
    }
}

@media (max-width: 600px) {
    .pin-box .history-view .picScroll-left .bd ul {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .pin-box .history-view .picScroll-left .bd ul li {
        padding: 12px;
    }

    .pin-box .history-view .picScroll-left .bd ul li .pic img {
        height: 120px;
    }
}
