Rebus Classici
const rebusData = { chiave_inglese: { images: ["https://www.trendynet.it/wp-content/uploads/2025/03/chiave.jpg", "https://www.trendynet.it/wp-content/uploads/2025/03/inghilterra.png"], answer: "strumento britannico" }, doppio_senso: { images: ["https://www.trendynet.it/wp-content/uploads/2025/03/due.jpg", "https://www.trendynet.it/wp-content/uploads/2025/03/strada.png"], answer: "ambiguità stradale" }, punto_esclamativo: { images: ["https://www.trendynet.it/wp-content/uploads/2025/03/punto.jpg", "https://www.trendynet.it/wp-content/uploads/2025/03/esclamazione.png"], answer: "interiezione scritta" }, luce_ombra: { images: ["https://www.trendynet.it/wp-content/uploads/2025/03/luce.jpg", "https://www.trendynet.it/wp-content/uploads/2025/03/ombra.webp"], answer: "contrasto visivo" }, alto_basso: { images: ["https://www.trendynet.it/wp-content/uploads/2025/03/alto.png", "https://www.trendynet.it/wp-content/uploads/2025/03/basso.png"], answer: "opposti spaziali" }, dentro_fuori: { images: ["https://www.trendynet.it/wp-content/uploads/2025/03/dentro.jpg", "https://www.trendynet.it/wp-content/uploads/2025/03/fuori.jpg"], answer: "limiti fisici" }, prima_dopo: { images: ["https://www.trendynet.it/wp-content/uploads/2025/03/prima.png", "https://www.trendynet.it/wp-content/uploads/2025/03/dopo.png"], answer: "successione eventi" }, domanda_risposta: { images: ["https://www.trendynet.it/wp-content/uploads/2025/03/domanda.png", "https://www.trendynet.it/wp-content/uploads/2025/03/risposta.png"], answer: "interazione verbale" }, aperto_chiuso: { images: ["https://www.trendynet.it/wp-content/uploads/2025/03/aperto.png", "https://www.trendynet.it/wp-content/uploads/2025/03/chiuso.png"], answer: "stato porta" }, vero_falso: { images: ["https://www.trendynet.it/wp-content/uploads/2025/03/vero-falso.jpg", "https://www.trendynet.it/wp-content/uploads/2025/03/vero-falso.jpg"], answer: "verità logica" } };
function showRebus(category) { const rebus = rebusData[category]; let container = document.getElementById("rebus-container"); container.innerHTML = `
Rebus: ${category}
La risposta corretta è: "${rebus.answer}"
`; container.style.display = "block"; }
let attempts = 0; function checkAnswer(category) { const userAnswer = document.getElementById("answer").value.trim().toLowerCase(); const message = document.getElementById("message"); const solution = document.getElementById("solution");
if (userAnswer === rebusData[category].answer.toLowerCase()) { message.textContent = "Bravo! Hai indovinato!"; message.style.color = "green"; } else { attempts++; message.textContent = `Sbagliato! Tentativi rimanenti: ${3 - attempts}`; message.style.color = "red"; }
if (attempts >= 3) {
solution.style.display = "block";
setTimeout(() => {
location.reload();
}, 2000);
}
}