.zh-lightbox {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.95);
    z-index: 9999;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    box-sizing: border-box;
}

.zh-lightbox-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    color: #fff;
    font-family: sans-serif;
}

#zh-lightbox-counter {
    font-size: 14px;
    opacity: 0.8;
}

.zh-lightbox-close {
    background: none;
    border: none;
    color: #fff;
    font-size: 36px;
    cursor: pointer;
    line-height: 1;
}

.zh-lightbox-body {
    display: flex;
    align-items: center;
    justify-content: center;
    flex: 1;
    position: relative;
    padding: 0 50px;
    pointer-events: none; /* Gibt den Touch-Bereich für Wischgesten frei */
}

.zh-lightbox-content-wrap {
    text-align: center;
    max-height: 70vh;
    pointer-events: auto; /* Macht den Inhalt wieder klick-/wischbar */
}

#zh-lightbox-img {
    max-width: 100%;
    max-height: 65vh;
    object-fit: contain;
    box-shadow: 0 5px 25px rgba(0,0,0,0.5);
    touch-action: pan-y;
    -webkit-user-drag: none;
    user-select: none;
    
    /* NEU: Zwingt den Browser zu sauberem Hardware-Rendering ohne Artefakte */
    will-change: opacity;
    transform: translateZ(0); 

    /* Hier bleibt deine Transition */
    transition: opacity 0.25s ease-in-out;
    opacity: 1;
}

/* Zustand während des Bildwechsels */
#zh-lightbox-img.fade-out {
    opacity: 0;
    /* NEU: Nimmt den Schatten während des Fades sofort weg, damit er nicht nachzieht */
    box-shadow: none; 
}

.zh-lightbox-caption {
    color: #fff;
    margin-top: 10px;
    font-size: 14px;
    font-family: sans-serif;
}

.zh-lightbox-nav {
    background: none;
    border: none;
    color: #fff;
    font-size: 32px;
    cursor: pointer;
    padding: 20px;
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    z-index: 10;
    opacity: 0.7;
    transition: opacity 0.2s;
    pointer-events: auto; /* Pfeile bleiben anklickbar */
}

.zh-lightbox-nav:hover {
    opacity: 1;
}

.zh-lightbox-nav.prev {
    left: 20px;
}

.zh-lightbox-nav.next {
    right: 20px;
}

.zh-lightbox-thumbs {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    padding: 15px;
    background: rgba(0,0,0,0.5);
    justify-content: flex-start;
    flex-wrap: nowrap;
    pointer-events: auto; /* Vorschauleiste bleibt bedienbar */
}

.zh-lightbox-thumbs img {
    flex-shrink: 0;
    height: 50px;
    width: 50px;
    object-fit: cover;
    cursor: pointer;
    opacity: 0.8;
    transition: opacity 0.2s, border-color 0.2s;
    border: 2px solid transparent;
}

.zh-lightbox-thumbs img.active,
.zh-lightbox-thumbs img:hover {
    opacity: 1;
    border-color: #fff;
}

/* --- Mobile Anpassungen (Media Query) --- */

@media (max-width: 768px) {
    .zh-lightbox-body {
        padding: 0 10px;
    }

    /* Pfeile in der mobilen Ansicht ausblenden, da jetzt per Touch gewischt wird */
    .zh-lightbox-nav {
        display: none;
    }

    #zh-lightbox-img {
        max-height: 55vh;
        transition: opacity 0.25s ease-in-out;
        opacity: 1;
        
        /* NEU für Mobile: Verhindert Schatten-Artefakte und Ruckeln beim Wischen */
        will-change: opacity;
        transform: translateZ(0);
    }

    /* NEU für Mobile: Nimmt den Schatten während des Wischens/Fades sofort weg */
    #zh-lightbox-img.fade-out {
        opacity: 0;
        box-shadow: none; 
    }

    .zh-lightbox-thumbs {
        padding: 10px;
        gap: 6px;
    }

    .zh-lightbox-thumbs img {
        height: 40px;
        width: 40px;
    }

    .zh-lightbox-header {
        padding: 15px;
    }
}