div.card-container {
    font-family: sans-serif;
    background-color: #f0f2f5;
    display: flex;
    justify-content: center;
    padding: 50px 20px; /* Added side padding for mobile safety */
}

div.card-container > ul {
    list-style: none;
    padding: 0;
    width: 100%;
    
    /* CHANGED: Increased width so it can spread out on desktop */
    max-width: 800px; 

    /* NEW: Grid Layout System */
    display: grid;
    
    /* THE MAGIC LINE: 
        Creates as many columns as fit. 
        Cards won't get smaller than 250px. 
        If screen is narrow, it wraps to 1 column (stack). 
    */
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    
    gap: 20px; /* Space between cards (both rows and cols) */
}

/* LI no longer needs margin because 'gap' handles it */
div.card-container > ul > li {
    margin: 0;
}

div.card-container > ul > li > a {
    display: block;
    background-color: white;
    padding: 30px; /* Increased padding for better look on big screens */
    border-radius: 10px;
    text-decoration: none;
    color: #333;
    font-weight: bold;
    font-size: 1.2rem;
    text-align: center; /* Center text looks better in grid tiles */
    
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    transition: transform 0.2s, box-shadow 0.2s;
}

a:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 15px rgba(0, 0, 0, 0.15);
    color: #007bff;
}