.modal {
    display: none; 
    position: fixed;
    z-index: 9999;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(5px);
    justify-content: center;
    align-items: center;
}

.modal.active {
    display: flex;
}

.modal-content {
    background-color: #1a1a1a;
    color: #fff;
    padding: 25px;
    border-radius: 12px;
    max-width: 700px;
    width: 90%;
    position: relative;
    box-shadow: 0 10px 30px rgba(0,0,0,0.5);
    border: 1px solid #333;
    animation: fadeIn 0.3s ease-in-out;
}

.close-modal {
    position: absolute;
    right: 20px;
    top: 15px;
    font-size: 2rem;
    cursor: pointer;
    color: #aaa;
    transition: color 0.2s;
}
.close-modal:hover { color: #fff; }

.carousel-container {
    position: relative;
    width: 100%;
    height: 350px;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #000;
    border-radius: 8px;
    overflow: hidden;
}

.carousel-slide img {
    max-width: 100%;
    max-height: 350px;
    object-fit: contain;
}

.carousel-btn {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    color: #ffffff;
    border: 1px solid rgba(255, 255, 255, 0.2);
    
    width: 46px;
    height: 46px;
    border-radius: 50%;
    
    display: flex;
    align-items: center;
    justify-content: center;
    
    font-size: 1.1rem;
    cursor: pointer;
    z-index: 10;
    
    opacity: 0;
    visibility: hidden;
    transition: all 0.25s ease-in-out;
}

.carousel-container:hover .carousel-btn {
    opacity: 1;
    visibility: visible;
}

.carousel-btn:hover {
    background: rgba(255, 255, 255, 0.3);
    border-color: rgba(255, 255, 255, 0.4);
    transform: translateY(-50%) scale(1.05);
}

.prev-btn { left: 15px; }
.next-btn { right: 15px; }

.open-modal-btn {
    background-color: #ff007f;
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 6px;
    cursor: pointer;
    margin-top: 10px;
    font-weight: 500;
    transition: transform 0.2s;
}
.open-modal-btn:hover { transform: scale(1.05); }

.modal-github-btn {
    display: inline-block;
    margin-top: 15px;
    background: #333;
    color: white;
    padding: 10px 20px;
    text-decoration: none;
    border-radius: 6px;
}
.modal-github-btn:hover { background: #444; }

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(-20px); }
    to { opacity: 1; transform: translateY(0); }
}

@media screen and (max-width: 768px) {
    
    .modal {
        align-items: flex-start;
        padding: 60px 10px 20px 10px; 
        overflow-y: auto;
    }

    .modal-content {
        width: 100%;
        padding: 20px 15px;
        margin-top: 0; 
        margin-bottom: 20px;
    }

    .carousel-container {
        margin-top: 5vh;
        height: 230px;
        margin-bottom: 15px;
    }

    .carousel-slide img {
        max-height: 230px;
    }

    .carousel-btn {
        opacity: 1 !important;
        visibility: visible !important;
        
        width: 38px;
        height: 38px;
        font-size: 0.9rem;
        
        background: rgba(0, 0, 0, 0.4);
        backdrop-filter: blur(4px);
        -webkit-backdrop-filter: blur(4px);
        border: 1px solid rgba(255, 255, 255, 0.1);
    }

    .carousel-btn:hover {
        transform: translateY(-50%) scale(1);
        background: rgba(0, 0, 0, 0.5);
    }

    .prev-btn { left: 8px; }
    .next-btn { right: 8px; }

    .close-modal {
        top: 10px;
        right: 15px;
        font-size: 2.2rem;
        padding: 5px;
    }

    .modal-github-btn {
        display: block;
        text-align: center;
        padding: 12px;
        font-size: 1rem;
    }
}