.last_added_holder {
    display: flex;
    flex-wrap: wrap;
    width: 100%;
    gap: 1em; /* Combined row and column gap */
    justify-content: center; /* Center cards on smaller screens */
}

.last_added_card {
    display: flex;
    flex-direction: column;
    position: relative;
    width: 100%; /* Changed from fixed vw */
    max-width: 160px; /* Maximum size */
    aspect-ratio: 12/18;
    overflow: hidden;
    border-radius: 0.5em;
    background-color: rgba(var(--bg-color),1);
    min-width: 120px; /* Minimum size */
}

.last_added_card img {
    flex: 1;
    object-fit: cover;
    transition: all 0.4s ease;
    width: 100%;
}

.last_added_card label {
    position: absolute;
    top: 5%;
    right: -12%;
    transform: rotate(45deg);
    background-color: rgba(var(--secondary-color),0.8);
    padding: 0.2em 0.8em; /* Reduced padding for mobile */
    font-size: 0.7em; /* Smaller font for mobile */
    min-width: 5rem;
    text-align: center;
    transition: all 0.4s ease;
    overflow: hidden;
    z-index: 2; /* Ensure it stays above other elements */
}
.last_added_card .label_watched{
    background-color: rgb(47, 155, 47);
}

.last_added_card h3 {
    position: absolute;
    bottom: -100%;
    left: 0;
    width: 100%;
    text-align: center;
    font-size: 0.9em; /* Smaller font for mobile */
    transition: all 0.3s ease;
    background: linear-gradient(to top, rgba(var(--bg-color),8), rgba(var(--bg-color),0.1));
    padding: 0.5em;
    box-sizing: border-box;
    z-index: 1;
}

/* Hover effects - only apply on devices that support hover */
@media (hover: hover) {
    .last_added_card:hover h3 {
        bottom: 0em;
    }
    .last_added_card:hover img {
        opacity: 0.5;
        transform: scale(1.1);
    }
    .last_added_card:hover label {
        right: 0em;
        top: 0.5em;
        border-radius: 0.5em;
        transform: scale(1.1);
    }
}

/* Mobile alternative - show title always on touch devices */
@media (hover: none) {
    .last_added_card h3 {
        bottom: 0;
        font-size: 0.8em;
        background: linear-gradient(to top, rgba(var(--bg-color),9), transparent);
    }
    .last_added_card img {
        opacity: 0.7;
    }
}

@keyframes chapter_chine {
    0% {transform: translateX(0%);}
    30% {transform: translateX(1100%);}
    100% {transform: translateX(1110%);}
}

.last_added_card label::after {
    content: '';
    position: absolute;
    height: 110%;
    width: 20%;
    background-color: rgba(var(--text-color),0.3);
    left: -10%;
    top: -5%;
    filter: blur(1px);
    animation: chapter_chine 3s normal infinite;
}

/* Responsive adjustments */
@media (max-width: 1200px) {
    .last_added_card {
        max-width: 140px;
    }
}

@media (max-width: 992px) {
    .last_added_card {
        max-width: 120px;
        min-width: 100px;
    }
    .last_added_card h3 {
        font-size: 0.8em;
    }
}

@media (max-width: 768px) {
    .last_added_holder {
        gap: 0.8em;
    }
    .last_added_card {
        max-width: 100px;
        min-width: 80px;
    }
    .last_added_card label {
        font-size: 0.6em;
        padding: 0.2em 0.6em;
    }
}

@media (max-width: 576px) {
    .last_added_holder {
        gap: 0.5em;
    }
    .last_added_card {
        max-width: calc(33.333% - 0.5em);
        min-width: auto;
        aspect-ratio: 12/16;
    }
    .last_added_card h3 {
        font-size: 0.7em;
        padding: 0.3em;
    }
}

@media (max-width: 400px) {
    .last_added_card {
        max-width: calc(33.333% - 0.5em);
    }
}