function calculateIngredients() {
    // Get input values
    let totalAmount = document.getElementById("totalAmount").value;
    let portionSize = document.getElementById("portionSize").value;
    let servings = document.getElementById("servings").value;

    // Calculate total required amount
    let totalNeeded = portionSize * servings;

    // Output results based on the total amount and total needed
    let resultMessage = "";
    if (totalNeeded > totalAmount) {
        resultMessage = `You need ${totalNeeded} oz, but you only have ${totalAmount} oz. You need ${totalNeeded - totalAmount} more oz.`;
    } else {
        resultMessage = `You have enough! You need ${totalNeeded} oz, and you have ${totalAmount} oz.`;
    }

    // Display the result
    document.getElementById("resultMessage").textContent = resultMessage;
}
