/* モーダルウィンドウ */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.modal.active {
    opacity: 1;
    visibility: visible;
}

.modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    cursor: pointer;
}

.modal-wrap {
    position: relative;
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    max-width: 90vw;
    max-height: 90vh;
    transition: transform 0.3s ease;
    transform: scale(0.9);
}

.modal.active .modal-wrap {
    transform: scale(1);
}

.modal-content {
    position: relative;
    max-width: 90vw;
    max-height: 90vh;
    background: white;
    padding: 20px;
    border-radius: 4px;
    z-index: 10000;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    overflow: auto;
}

.modal-content img {
    max-width: 100%;
    max-height: 100%;
    height: auto;
    display: block;
}

.modal-close {
    position: absolute;
    top: -10px;
    right: -10px;
    width: 40px;
    height: 40px;
    background-color: #fff;
    border: 2px solid #333;
    border-radius: 50%;
    font-size: 28px;
    color: #333;
    line-height: 1;
    cursor: pointer;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10001;
    transition: background-color 0.3s ease;
}

.modal-close::before {
    content: "";
    width: 20px;
    height: 2px;
    background-color: #333;
    position: absolute;
    transform: rotate(45deg);
    transition: background-color 0.3s ease;
}

.modal-close:hover::before {
    background-color: white;
}

.modal-close::after {
    content: "";
    width: 20px;
    height: 2px;
    background-color: #333;
    position: absolute;
    transform: rotate(-45deg);
    transition: background-color 0.3s ease;
}

.modal-close:hover::after {
    background-color: white;
}

.modal-close:hover {
    background-color: #e50012;
    color: white;
    border-color: #e50012;
}

@media screen and (max-width: 767px) {
    .modal-content {
        padding: 10px;
    }

    .modal-close {
        width: 35px;
        height: 35px;
        font-size: 24px;
    }
}