.files-popup {
    display: block;
    position: fixed;
    inset: 0;
    z-index: 9999;
    visibility: hidden;
    opacity: 0;
    transition: opacity .3s ease, visibility .3s;
    pointer-events: none;
}
.files-popup.is-open {
    visibility: visible;
    opacity: 1;
    pointer-events: auto;
}

.files-popup__overlay {
    position: absolute;
    inset: 0;
    background: rgba(0,0,0,.6);
}
.files-popup__content {
    position: relative;
    background: #fff;
    max-width: 550px;
    max-height: 80vh;
    overflow-y: auto;
    margin: 8vh auto 0;
    padding: 25px 30px;
    border-radius: 8px;
    box-shadow: 0 10px 40px rgba(0,0,0,.3);
}
.files-popup__close {
    position: absolute;
    top: 8px;
    right: 12px;
    background: none;
    border: none;
    font-size: 28px;
    line-height: 1;
    cursor: pointer;
    color: var(--main-blue);
}

.files-popup__list {
    list-style: none;
    padding: 0;
    margin: 15px 0 0;
}
.files-popup__list li {
    padding: 10px 0;
    border-bottom: 1px solid #eee;
}
.files-popup__list a {
    color: var(--main-blue);
    text-decoration: none;
    font-weight: 500;
}
.files-popup__list a:hover { text-decoration: underline; }

@media (max-width: 768px) {
    .files-popup__content {
        position: absolute;
        left: 0;
        right: 0;
        bottom: 0;
        margin: 0;
        max-width: 100%;
        max-height: 85vh;
        padding: 20px 18px 25px;
        border-radius: 16px 16px 0 0;
        box-shadow: 0 -10px 40px rgba(0,0,0,.3);
    }

    /* Ручка-индикатор сверху (визуально намекает, что можно закрыть) */
    .files-popup__content::before {
        content: "";
        display: block;
        width: 40px;
        height: 4px;
        background: #ccc;
        border-radius: 2px;
        margin: 0 auto 15px;
    }

    .files-popup__close {
        top: 10px;
        right: 14px;
        font-size: 30px;
        /* делаем область клика больше — палец не всегда точно попадёт */
        padding: 5px 10px;
    }

    .files-popup__content h3 {
        font-size: 18px;
        margin: 0 0 10px;
        padding-right: 30px;
    }

    .files-popup__list {
        margin-top: 10px;
    }

    .files-popup__list li {
        padding: 12px 0;
        display: flex;
        flex-wrap: wrap;
        align-items: baseline;
        gap: 4px;
    }

    .files-popup__list a {
        font-size: 15px;
        /* ссылка на всю ширину строки — удобнее тапать */
        flex: 1 1 100%;
        word-break: break-word;
    }

    .files-popup__size {
        font-size: 12px;
        margin-left: 0;
    }
        .files-popup__content {
        transform: translateY(100%);
        transition: transform .3s ease;
    }
    .files-popup.is-open .files-popup__content {
        transform: translateY(0);
    }
}