body {
    background: #fff;
    margin: 0;
    border: none;
    color: #696969;
    font-family: Arial, Helvetica, sans-serif;
    line-height: 180%;
}

a {
    color: black;
    text-decoration: underline;
}


img {
    margin: 0;
    border: none;
}

h1 {
    text-align: center;
    color: #696969;
}

form {
    border: 1px solid #696969;
    padding: 2px 10px 2px 10px;
    display: flex;
    justify-content: space-between;
}

#main {
    max-width: 1024px;
    margin: auto;
    padding: 10px;
    min-width: 360px;
}

.image-block {
    display: flex;
}

.image-block div {
    width: 50%;
    text-align: center;
}

.image-block img {
    max-width: 200px;
}

.upload-image-text {
    text-align: center;
}

.image-results {
    text-align: center;
}

#menu {
    padding: 0.5rem 0;
    border-bottom: 1px solid #dee2e6;
    /* Серая разделительная линия */
    position: relative;
}

.burger {
    display: none;
    cursor: pointer;
    padding: 15px;
    position: absolute;
    right: 15px;
    top: 50%;
    transform: translateY(-50%);
}

.burger span {
    display: block;
    width: 25px;
    height: 3px;
    background: #333;
    margin: 5px 0;
    transition: 0.3s;
}


#menu ul {
    list-style-type: none;
    margin: 0;
    padding: 0;
    display: flex;
    gap: 2rem;
}

#menu li {
    margin: 0;
    padding: 0;
}

#menu a {
    text-decoration: none;
    color: #696969;
    /* Темно-серый цвет */
    font-size: 1.1rem;
    transition: color 0.2s ease;
    position: relative;
}

#menu a:hover {
    color: #212529;
    /* Чёрный при наведении */
}

/* Стиль для активной ссылки */
#menu a.active {
    color: #212529;
    font-weight: 500;
}

#menu a.active::after {
    content: "";
    position: absolute;
    width: 100%;
    height: 2px;
    background-color: #696969;
    /* Чёрная линия для активной ссылки */
    bottom: -4px;
    left: 0;
}

input[type="submit"] {
    padding: 10px;
    color: #fff;
    background-color: #696969;
    cursor: pointer;
}

input[type="submit"]:hover {
    background-color: #212529;
}

input[type="text"]:hover {
    margin: 8px 0;
}

#donate {
    padding: 5px;
    color: rgb(112, 47, 244);
}


.modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    z-index: 1000;
    justify-content: center;
    align-items: center;
    overflow-y: auto;
}


.modal-content {
    /* предыдущие стили остаются */
    padding: 20px 10px;
    position: absolute;
    left: 0;
    width: 100%;
}

.thumbnails-grid {
    display: flex;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    gap: 15px;
    padding: 10px 0;
    -webkit-overflow-scrolling: touch;
    justify-content: space-around;
}

.thumbnails-grid::-webkit-scrollbar {
    height: 6px;
}

.thumbnails-grid::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 3px;
}

.thumbnails-grid::-webkit-scrollbar-thumb {
    background: #888;
    border-radius: 3px;
}

.thumbnails-grid::-webkit-scrollbar-thumb:hover {
    background: #555;
}

.thumbnail {
    scroll-snap-align: center;
    min-width: 150px;
    max-height: 400px;
    object-fit: cover;
    border-radius: 6px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    transition: transform 0.2s;
}

/* Адаптация для мобильных */
@media (max-width: 768px) {

    .modal-content {
        width: initial;
    }
    .thumbnails-grid {
        gap: 10px;
    }

    .thumbnail {
        min-width: 120px;
        max-height: 400px;
    }
}

@media (max-width: 480px) {
    .modal-content {
        width: initial;
    }
    .thumbnail {
        min-width: 100px;
        max-height: 400px;
    }
}

/* Медиа-запрос для мобильных устройств */
@media (max-width: 768px) {
    #menu {
        border-bottom: none;
    }

    #menu ul {
        display: none;
        flex-direction: column;
        width: 100%;
        background: white;
        position: absolute;
        top: 100%;
        left: 0;
        z-index: 1000;
        box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
    }

    #menu ul.active {
        display: flex;
    }

    #menu li {
        margin: 0;
        padding: 15px;
        border-bottom: 1px solid #eee;
    }

    .burger {
        display: block;
    }

    /* Анимация бургера */
    .burger.active span:nth-child(1) {
        transform: rotate(45deg) translate(5px, 5px);
    }

    .burger.active span:nth-child(2) {
        opacity: 0;
    }

    .burger.active span:nth-child(3) {
        transform: rotate(-45deg) translate(7px, -6px);
    }
}

  .gallery {
            display: flex;
            flex-wrap: wrap;
            gap: 10px;
            justify-content: center; /* Центрируем все изображения по горизонтали */
        }
        .gallery-item {
            width: 150px;
            height: 150px; /* фиксированный квадратный размер */
            object-fit: contain; /* сохранение пропорций, без обрезки */
            background-color: #f0f0f0; /* фон для прозрачных областей */
            cursor: pointer;
            border-radius: 5px;
            transition: transform 0.2s;
            box-shadow: 0 2px 6px rgba(0,0,0,0.15);
        }
        .gallery-item:hover {
            transform: scale(1.05);
        }
        .modal {
            display: none;
            position: fixed;
            z-index: 1000;
            padding-top: 60px;
            left: 0; top: 0;
            width: 100%; height: 100%;
            overflow: auto;
            background-color: rgba(0,0,0,0.8);
            text-align: center;
        }
        .modal-content {
            max-width: 90vw;          /* максимум по ширине окна */
            max-height: 90vh;         /* максимум по высоте окна */
            object-fit: contain;      /* сохранение пропорций в модальном окне */
            border-radius: 8px;
            margin: 0 auto;           /* центрирование по горизонтали */
            display: block;
        }
        .close {
            position: absolute;
            top: 30px;
            right: 40px;
            color: white;
            font-size: 40px;
            font-weight: bold;
            cursor: pointer;
        }
        #caption {
            color: white;
            margin-top: 10px;
            font-size: 18px;
        }