* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: #1a1a1a;
    color: #fff;
    height: 100vh;
    display: flex;
    flex-direction: column;
}

.gallery-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.main-image-wrapper {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #000;
    position: relative;
    overflow: hidden;
}

.main-image {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    animation: fadeIn 0.6s ease-in-out;
}

.image-nav-overlay {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 52px;
    height: 72px;
    padding: 0;
    border-radius: 10px;
    font-size: 26px;
    color: #fff;
    background: rgba(20, 20, 20, 0.45);
    backdrop-filter: blur(2px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s ease, background 0.2s ease;
}

.image-nav-overlay.visible {
    opacity: 1;
    pointer-events: auto;
}

.image-nav-overlay.left {
    left: 16px;
}

.image-nav-overlay.right {
    right: 16px;
}

.image-nav-overlay:hover {
    background: rgba(0, 102, 0, 0.8);
}

.play-overlay {
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    width: 84px;
    height: 84px;
    border-radius: 50%;
    padding: 0;
    font-size: 30px;
    line-height: 1;
    background: rgba(20, 20, 20, 0.55);
    backdrop-filter: blur(3px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 3;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s ease, background 0.2s ease, transform 0.2s ease;
}

.play-overlay.visible {
    opacity: 1;
    pointer-events: auto;
}

.play-overlay:hover {
    background: rgba(0, 102, 0, 0.82);
    transform: translate(-50%, -50%) scale(1.05);
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: scale(0.95);
    }

    to {
        opacity: 1;
        transform: scale(1);
    }
}

button {
    padding: 10px 20px;
    font-size: 14px;
    border: none;
    border-radius: 5px;
    background: #006600;
    color: white;
    cursor: pointer;
    transition: background 0.3s, transform 0.1s;
}

button:hover {
    background: #004d00;
}

button:active {
    transform: scale(0.98);
}

button:disabled {
    background: #666;
    cursor: not-allowed;
    opacity: 0.5;
}

.thumbnail-container {
    background: #111;
    padding: 6px 4px;
    overflow: visible;
    max-height: 124px;
    position: relative;
}

.thumbnails {
    display: flex;
    justify-content: flex-start;
    gap: 4px;
    overflow-x: auto;
    overflow-y: visible;
    scroll-behavior: smooth;
    padding: 2px 0;
    scrollbar-width: none;
    -ms-overflow-style: none;
}

.thumbnails.centered {
    justify-content: center;
}

.thumbnails::-webkit-scrollbar {
    display: none;
}

.thumbnail-scroll-overlay {
    position: absolute;
    top: 0;
    bottom: 0;
    width: 42px;
    border: none;
    border-radius: 0;
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    background: transparent;
    z-index: 2;
    transition: opacity 0.2s ease;
}

.thumbnail-scroll-overlay.left {
    left: 0;
    background: linear-gradient(to right, rgba(17, 17, 17, 0.95), rgba(17, 17, 17, 0));
}

.thumbnail-scroll-overlay.right {
    right: 0;
    background: linear-gradient(to left, rgba(17, 17, 17, 0.95), rgba(17, 17, 17, 0));
}

.thumbnail-scroll-overlay:hover {
    background-color: transparent;
    opacity: 0.9;
}

.thumbnail-scroll-overlay:disabled {
    opacity: 0;
    pointer-events: none;
    background-color: transparent;
}

.thumbnail {
    flex-shrink: 0;
    width: 80px;
    height: 80px;
    padding: 0;
    background: transparent;
    cursor: pointer;
    border: 4px solid transparent;
    border-radius: 5px;
    overflow: visible;
    transition: transform 0.2s ease, opacity 0.2s ease, border-color 0.2s ease;
    opacity: 0.5;
    transform: scale(1);
    transform-origin: center center;
    will-change: transform;
}

.thumbnail img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.thumbnail:hover {
    opacity: 0.9;
}

.thumbnail.active {
    transform: scale(1.5);
    opacity: 1;
    z-index: 1;
}

.image-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px;
    background: #006600;
    font-size: 16px;
    color: #CC6600;
    font-weight: bold;
}

.image-info.hidden-narrow .gallery-title,
.image-info.hidden-narrow .photos-by {
    display: none;
}

.gallery-title {
    flex: 0 0 auto;
}

.photos-by {
    flex: 0 0 auto;
}

#imageCounter {
    flex: 1;
    text-align: center;
    white-space: nowrap;
    padding-left: 10px;
    padding-right: 10px;
}

@media (max-width: 768px) {
    button {
        padding: 8px 15px;
        font-size: 12px;
    }

    .thumbnail {
        width: 56px;
        height: 56px;
    }

    .thumbnail-container {
        padding: 4px 2px;
        max-height: 84px;
    }

    .thumbnails {
        gap: 3px;
        padding: 1px 0;
    }

    .thumbnail-scroll-overlay {
        width: 34px;
        font-size: 16px;
    }

    .image-nav-overlay {
        width: 44px;
        height: 62px;
        font-size: 22px;
    }

    .image-nav-overlay.left {
        left: 10px;
    }

    .image-nav-overlay.right {
        right: 10px;
    }

    .play-overlay {
        width: 72px;
        height: 72px;
        font-size: 26px;
    }
}

@media (max-width: 480px),
(max-height: 500px) and (orientation: landscape) {
    button {
        padding: 6px 12px;
        font-size: 11px;
    }

    .thumbnail {
        width: 42px;
        height: 42px;
    }

    .thumbnail-container {
        padding: 2px 1px;
        max-height: 64px;
    }

    .thumbnails {
        gap: 2px;
        padding: 0;
    }

    .thumbnail-scroll-overlay {
        width: 26px;
        font-size: 14px;
    }

    .image-nav-overlay {
        width: 38px;
        height: 56px;
        font-size: 19px;
    }

    .play-overlay {
        width: 64px;
        height: 64px;
        font-size: 22px;
    }
}

@media (max-height: 500px) and (orientation: landscape) {
    .image-info {
        display: none;
    }
}