/* styles.css */
body {
    font-family: 'Open Sans', sans-serif;
    margin: 20px;
    line-height: 1.6;
    background-color: #f9f9f9;
}

header {
    text-align: center;
    margin-bottom: 20px;
}

h1, h2 {
    color: #34495E;
}

.quests, .leaderboard {
    margin: 20px 0;
}

ul {
    list-style-type: none;
    padding: 0;
}

li {
    margin: 10px 0;
    padding: 10px;
    background-color: #E27D60;
    color: #fff;
    border-radius: 8px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

button {
    padding: 5px 10px;
    background-color: #FFC857;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    color: #000;
    font-weight: bold;
}

button:disabled {
    background-color: #d3d3d3;
    cursor: not-allowed;
}

.completed {
    background-color: #58B3C2 !important;
    text-decoration: line-through;
}
// Add a completed class with a smooth transition
function completeQuest(id) {
    const quest = userData.quests.find((q) => q.id === id);
    if (quest && !quest.completed) {
        quest.completed = true;
        userData.totalPoints += quest.points;

        // Save to local storage
        localStorage.setItem("userData", JSON.stringify(userData));

        // Add a small animation effect
        const questElement = document.querySelector(`button[data-id="${id}"]`).parentElement;
        questElement.style.transition = "transform 0.3s, opacity 0.3s";
        questElement.style.transform = "scale(1.1)";
        questElement.style.opacity = "0.8";

        // Re-render quests and leaderboard after a short delay
        setTimeout(() => {
            renderQuests();
            updateLeaderboard();
        }, 300);
    }
}
