body {
    font-family: Arial, sans-serif;
    background: linear-gradient(135deg, #1e3c72, #2a5298, #4b367c);
    margin: 0;
    padding: 20px;
    color: #ffffff;
    animation: gradientShift 15s ease infinite;
    background-size: 200% 200%;
}

@keyframes gradientShift {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    background-color: rgba(30, 30, 50, 0.9);
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.3), 0 0 20px rgba(76, 110, 245, 0.2);
    border: 1px solid rgba(76, 110, 245, 0.3);
    color: #e0e0e0;
}

h1 {
    text-align: center;
    color: #d0d0ff;
}

p {
    color: #e0e0e0;
}

.champion-grid {
    margin-bottom: 20px;
}

.champion-grid.role-mode {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.role-group {
    width: 100%;
}

.role-label {
    font-size: 16px;
    font-weight: bold;
    color: #d0d0ff;
    background: linear-gradient(45deg, #2a2a50, #4b367c);
    padding: 5px 10px;
    border-radius: 4px;
    margin-bottom: 10px;
    text-align: left;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
    transition: transform 0.2s ease, box-shadow 0.3s ease;
}

.role-label:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(76, 110, 245, 0.3);
}

.role-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    gap: 10px;
    width: 100%;
}

.champion-grid.default-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    grid-auto-flow: row;
    gap: 10px;
    width: 100%;
}

.champion {
    display: flex;
    flex-direction: row;
    align-items: center;
    font-size: 14px;
    position: relative;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.3s ease, background-color 0.3s ease;
    padding: 5px;
    background-color: #2a2a50;
    border-radius: 4px;
    border: 1px solid #444;
    box-sizing: border-box;
    color: #e0e0e0;
    opacity: 0;
    animation: fadeIn 0.005s ease forwards;
    animation-delay: calc(var(--index) * 0.001s);
}

.champion:hover {
    transform: scale(1.1);
    box-shadow: 0 0 10px rgba(76, 110, 245, 0.5);
    background-color: #3a3a70;
}

.champion.checked {
    box-shadow: 0 0 8px rgba(76, 245, 110, 0.5);
}

.champion:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(76, 110, 245, 0.5);
    background-color: #3a3a70;
}

.champion img {
    width: 32px;
    height: 32px;
    border-radius: 4px;
    position: relative;
    z-index: 1;
}

.champion.checked img {
    opacity: 0.3;
}

.champion label {
    margin-left: 8px;
    text-align: left;
    z-index: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 60px;
}

.champion.checked::before {
    content: "";
    position: absolute;
    top: 50%;
    left: 5px;
    transform: translateY(-50%);
    width: 32px;
    height: 32px;
    background-color: black;
    opacity: 0.7;
    border-radius: 4px;
    z-index: 2;
}

.champion.checked::after {
    content: "?";
    position: absolute;
    top: 50%;
    left: 21px;
    transform: translate(-50%, -50%) scale(0);
    color: #4caf50;
    font-size: 24px;
    font-weight: bold;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.5);
    z-index: 3;
    animation: checkmark-pop 0.3s ease forwards;
}

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

@keyframes checkmark-pop {
    0% { transform: translate(-50%, -50%) scale(0); }
    50% { transform: translate(-50%, -50%) scale(1.2); }
    100% { transform: translate(-50%, -50%) scale(1); }
}

button {
    padding: 10px 20px;
    background: linear-gradient(45deg, #4c6ef5, #a855f7);
    color: white;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
    position: relative;
}

button:hover {
    background: linear-gradient(45deg, #3b82f6, #c084fc);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
    transform: translateY(-2px);
}

button:active {
    transform: scale(0.95);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

button:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(76, 110, 245, 0.5);
}

.sort-buttons {
    text-align: center;
    margin-bottom: 20px;
}

.sort-buttons button {
    margin: 0 10px;
    background: linear-gradient(45deg, #4c6ef5, #a855f7);
}

.sort-buttons button:hover {
    background: linear-gradient(45deg, #3b82f6, #c084fc);
}

.search-bar {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 10px;
    margin-bottom: 20px;
}

#search-input {
    padding: 8px;
    width: 70%;
    max-width: 300px;
    border: 1px solid #555;
    border-radius: 4px;
    font-size: 14px;
    background-color: #2a2a50;
    color: #e0e0e0;
    transition: background-color 0.3s ease, box-shadow 0.3s ease;
    box-sizing: border-box;
}

#search-input::placeholder {
    color: #888;
}

#search-input:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(76, 110, 245, 0.5);
    background-color: #3a3a70;
}

.search-bar button {
    padding: 8px 16px;
    background: linear-gradient(45deg, #4c6ef5, #a855f7);
    color: white;
    flex-shrink: 0;
}

.search-bar button:hover {
    background: linear-gradient(45deg, #3b82f6, #c084fc);
}

.progress-bar {
    width: 300px;
    height: 20px;
    background-color: #333;
    border-radius: 10px;
    margin: 10px auto;
    overflow: hidden;
    position: relative;
    box-shadow: 0 0 5px rgba(76, 110, 245, 0.3);
}

.progress-fill {
    height: 100%;
    background: linear-gradient(45deg, #4c6ef5, #a855f7);
    width: 0%;
    transition: width 0.5s ease-in-out, box-shadow 0.5s ease-in-out;
    position: relative;
    box-shadow: 0 0 10px rgba(76, 110, 245, 0.5);
}

.progress-fill::after {
    content: attr(data-progress) "%";
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: white;
    font-size: 12px;
    text-shadow: 1px 1px 1px rgba(0, 0, 0, 0.5);
    opacity: 0;
    transition: opacity 0.3s ease;
    background-color: rgba(0, 0, 0, 0.5);
    padding: 2px 6px;
    border-radius: 3px;
}

.progress-fill[data-progress]:not([data-progress="0"])::after {
    opacity: 1;
}

@media (max-width: 600px) {
    .container {
        padding: 10px !important; /* Ensure padding is reduced */
    }

    h1 {
        font-size: 1.5em;
    }

    #search-input {
        width: 100% !important; /* Full width on mobile */
        max-width: none !important; /* Remove max-width constraint */
    }

    .search-bar {
        flex-direction: column !important; /* Stack input and button vertically */
        align-items: center !important; /* Center the items */
    }

    .search-bar button {
        margin-left: 0 !important; /* Remove margin-left */
        margin-top: 10px !important; /* Add space between input and button */
        width: 100% !important; /* Make button full width */
        max-width: 200px !important; /* Limit button width for aesthetics */
    }

    .progress-bar {
        width: 100%;
    }

    .sort-buttons {
        display: flex;
        flex-direction: column;
        gap: 10px;
    }

    .sort-buttons button {
        margin: 5px 0;
    }

    .champion {
        font-size: 12px;
    }

    .champion img {
        width: 24px;
        height: 24px;
    }

    .champion.checked::after {
        font-size: 18px;
        left: 17px;
    }

    .role-label {
        font-size: 14px;
    }
}

@media (max-width: 400px) {
    #search-input {
        font-size: 12px; /* Smaller font size for very narrow screens */
    }

    .search-bar button {
        padding: 6px 12px; /* Smaller padding for the button */
    }
}
