.gallery-block {
    position: relative;
    width: 100%;
    height: 212px;
    border-radius: 18px;
    box-shadow: 0 0 15px rgba(0, 10, 255, 0.6), 0 0 15px rgba(0, 10, 255, 0.4), 0px 8px 15px rgba(0, 10, 255, 0.76);
    overflow: hidden;
    background: #081137;
    display: flex;
    flex-direction: column;
}

.gallery-block.no-screenshots {
    display: block;
}

.gallery-block.no-screenshots .gallery-main-cover {
    position: absolute;
    inset: 0;
    padding: 0;
    bottom: 0;
}

.gallery-block.no-screenshots .gallery-thumbs {
    display: none;
}

.gallery-block .preorder_block {
    z-index: 10;
    pointer-events: none;
}

.gallery-block * {
    box-sizing: border-box;
}

.gallery-blur-bg {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    filter: blur(3px) brightness(0.9);
    z-index: 1;
    opacity: 0;
    transition: opacity 0.6s ease;
}

.gallery-blur-bg.visible {
    opacity: 1;
}

#desktop-gallery-container .gallery-block.no-screenshots {
    background: #070c26;
    position: relative;
    overflow: hidden;
}

#desktop-gallery-container .gallery-blur-bg-wrapper {
    position: absolute;
    inset: 0;
    z-index: 1;
    overflow: hidden;
}

#desktop-gallery-container .gallery-blur-bg-img {
    position: absolute;
    width: 100%;
    height: 100%;
    object-fit: cover;
    filter: blur(3px) brightness(0.9);
    z-index: 1;
}

.gallery-main-cover {
    position: absolute;
    inset: 0;
    bottom: 56px;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2;
}

.gallery-main-cover a {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
}

.gallery-main-cover img {
    max-width: 85%;
    max-height: 85%;
    border-radius: 18px;
    box-shadow: 0 0 15px rgba(17, 17, 17, 0.6), 0 0 15px rgba(17, 17, 17, 0.4), 0px 8px 15px rgba(17, 17, 17, 0.76);
    object-fit: contain;
    transition: transform 0.4s ease;
    border: 3px solid #0e216d;
}

.gallery-main-cover img:hover {
    transform: scale(1.04);
}

.gallery-thumbs {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    height: 56px;
    display: flex;
    align-items: center;
    padding: 4px 12px;
    gap: 8px;
    z-index: 2;
    background: rgba(0,0,0,0.15);
    overflow-x: auto;
    scrollbar-width: thin;
    scrollbar-color: rgba(0, 10, 255, 0.6) rgba(0, 0, 0, 0.2);
    justify-content: space-around;
    -webkit-overflow-scrolling: touch;
}

.gallery-thumbs a, .gallery-thumbs .gallery-thumb-wrapper {
    flex: 1 1 0;
    height: 48px;
    min-width: 0;
    position: relative;
}

.gallery-thumbs .gallery-thumb-wrapper:only-child {
    flex: 1 1 100%;
    max-width: 100%;
}

.gallery-thumb {
    width: 100%;
    height: 100%;
    border-radius: 8px;
    box-shadow:
        0 0 15px rgba(17, 17, 17, 0.6),
        0 0 15px rgba(17, 17, 17, 0.4),
        0px 8px 15px rgba(17, 17, 17, 0.76);
    object-fit: cover;
    cursor: pointer;
    opacity: 0;
    transform: translateY(10px);
    transition: opacity 0.4s ease, transform 0.4s ease, box-shadow 0.2s ease;
    border: 2px solid #0e216d;
}

.gallery-thumb.visible {
    opacity: 0.8;
    transform: translateY(0);
}

.gallery-thumb:hover {
    opacity: 1;
    transform: translateY(-3px) scale(1.05);
    box-shadow:
        0 4px 10px rgba(0, 0, 0, 0.6),
        0 0 10px rgba(0, 10, 255, 0.3);
    z-index: 3;
}

.gallery-thumb-wrapper {
    position: relative;
    height: 48px;
    width: 100%;
}

.gallery-thumb-video {
    position: relative;
    display: block;
}

.gallery-thumb-video .gallery-thumb {
    filter: saturate(1.2) contrast(1.1);
}

.gallery-thumb-video:after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 8px;
    z-index: 1;
    transition: background 0.3s ease;
}

.gallery-thumb-video:hover:after {
    background: rgba(0, 0, 0, 0.1);
}

.gallery-thumb-video:before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 24px;
    height: 24px;
    margin-top: -12px;
    margin-left: -12px;
    background: url(/assets/img/svg/play-button.svg) center center no-repeat;
    background-size: 24px 24px;
    z-index: 2;
    opacity: 0.9;
}

.gallery-favorite {
    position: absolute;
    top: 12px;
    right: 12px;
    z-index: 20;
    background-color: rgba(255, 255, 255, 0.8);
    border-radius: 9px;
    border: none;
    transform: scale(1);
    transition: transform 0.2s ease;
    filter: drop-shadow(0 0 3px rgba(0, 0, 0, 0.5));
    cursor: pointer;
    pointer-events: all;
}

.gallery-favorite:hover {
    transform: scale(1.1);
}

.gallery-fullscreen {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.9);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.gallery-fullscreen.active {
    opacity: 1;
    visibility: visible;
}

.gallery-fullscreen-image {
    max-width: 100%;
    max-height: 90vh;
    box-shadow: 0 5px 25px rgba(0, 0, 0, 0.5);
    border-radius: 4px;
    transform: scale(0.9);
    transition: transform 0.3s ease;
}

.gallery-fullscreen.active .gallery-fullscreen-image {
    transform: scale(1);
}

.gallery-fullscreen-close {
    position: absolute;
    top: 20px;
    right: 20px;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.1);
    cursor: pointer;
    transition: background 0.3s ease;
}

.gallery-fullscreen-close:hover {
    background: rgba(255, 255, 255, 0.2);
}

.gallery-fullscreen-close:before,
.gallery-fullscreen-close:after {
    content: '';
    position: absolute;
    width: 20px;
    height: 2px;
    background: white;
    transform: rotate(45deg);
}

.gallery-fullscreen-close:after {
    transform: rotate(-45deg);
}

.gallery-fullscreen-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 50px;
    height: 50px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.3s ease;
}

.gallery-fullscreen-nav:hover {
    background: rgba(255, 255, 255, 0.2);
}

.gallery-fullscreen-prev {
    left: 20px;
}

.gallery-fullscreen-next {
    right: 20px;
}

.gallery-fullscreen-prev:before,
.gallery-fullscreen-next:before {
    content: '';
    border: solid white;
    border-width: 0 2px 2px 0;
    display: inline-block;
    padding: 5px;
}

.gallery-fullscreen-prev:before {
    transform: rotate(135deg);
    margin-left: 5px;
}

.gallery-fullscreen-next:before {
    transform: rotate(-45deg);
    margin-right: 5px;
}

@media (max-width: 992px) {
    #desktop-gallery-container {
        display: none;
    }

    .gallery-block {
        height: 212px;
    }
}

@media (max-width: 768px) {
    .gallery-main-cover {
        bottom: 46px;
    }
    .gallery-thumbs {
        height: 46px;
        padding: 3px 10px;
    }
    .gallery-thumb-wrapper {
        flex: 1 1 0;
        min-width: 0;
        height: 40px;
    }
    .gallery-thumb {
        width: 100%;
        height: 100%;
        min-width: 0;
    }
    .gallery-thumb-video:before {
        width: 20px;
        height: 20px;
        margin-top: -10px;
        margin-left: -10px;
        background-size: 20px 20px;
    }
}

@media (max-width: 576px) {
    .gallery-main-cover {
        bottom: 40px;
    }
    .gallery-thumbs {
        height: 40px;
    }
    .gallery-thumb-wrapper {
        flex: 1 1 0;
        min-width: 0;
        height: 34px;
    }
    .gallery-thumb {
        width: 100%;
        height: 100%;
        min-width: 0;
    }
    .gallery-thumb-video:before {
        width: 16px;
        height: 16px;
        margin-top: -8px;
        margin-left: -8px;
        background-size: 16px 16px;
    }
}

@media (max-width: 400px) {
    .gallery-thumbs {
        justify-content: flex-start;
    }
}
