// ============================================
// QORE CODEC - Sistema de Codificação de URLs
// ============================================
const QORE_CODEC = {
chars: 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_',
estilos: {
'A': 'Aprendizado',
'P': 'Prazer',
'R': 'Propósito',
'C': 'Acolhimento',
'O': 'Ordem',
'S': 'Segurança',
'T': 'Autoridade',
'E': 'Resultado'
},
estilosInv: {
'Aprendizado': 'A',
'Prazer': 'P',
'Propósito': 'R',
'Acolhimento': 'C',
'Ordem': 'O',
'Segurança': 'S',
'Autoridade': 'T',
'Resultado': 'E'
},
encodeNumbers: function(nums) {
let binary = '';
nums.forEach(n => {
let adjusted;
if (n < 0) {
adjusted = 128 + Math.abs(n);
} else {
adjusted = n;
}
binary += Math.min(adjusted, 255).toString(2).padStart(8, '0');
});
let result = '';
for (let i = 0; i < binary.length; i += 6) {
const chunk = binary.substr(i, 6).padEnd(6, '0');
const num = parseInt(chunk, 2);
result += this.chars[num];
}
return result;
},
encodeName: function(name) {
return btoa(unescape(encodeURIComponent(name)))
.replace(/\+/g, '-')
.replace(/\//g, '_')
.replace(/=/g, '');
},
encodeEstilo: function(estilo) {
return this.estilosInv[estilo] || 'A';
},
encode: function(data) {
const { fecaFinal, fecaSweetpoint, eix, rad, nome, estilo } = data;
const allNumbers = [
...fecaFinal,
...fecaSweetpoint,
...eix,
...rad
];
const numbersEncoded = this.encodeNumbers(allNumbers);
const nameEncoded = this.encodeName(nome);
const estiloEncoded = this.encodeEstilo(estilo);
return `${numbersEncoded}.${nameEncoded}.${estiloEncoded}`;
},
decodeNumbers: function(encoded) {
let binary = '';
for (let i = 0; i < encoded.length; i++) {
const idx = this.chars.indexOf(encoded[i]);
if (idx >= 0) {
binary += idx.toString(2).padStart(6, '0');
}
}
const nums = [];
for (let i = 0; i + 8 <= binary.length; i += 8) {
const num = parseInt(binary.substr(i, 8), 2);
if (num >= 128) {
nums.push(-(num - 128));
} else {
nums.push(num);
}
}
return nums;
},
decodeName: function(encoded) {
try {
let base64 = encoded.replace(/-/g, '+').replace(/_/g, '/');
while (base64.length % 4) base64 += '=';
return decodeURIComponent(escape(atob(base64)));
} catch (e) {
return encoded;
}
},
decodeEstilo: function(code) {
return this.estilos[code] || 'Aprendizado';
},
decode: function(encoded) {
try {
const parts = encoded.split('.');
if (parts.length !== 3) return null;
const [numbersEncoded, nameEncoded, estiloCode] = parts;
const nums = this.decodeNumbers(numbersEncoded);
const fecaFinal = nums.slice(0, 4);
const fecaSweetpoint = nums.slice(4, 8);
const eix = nums.slice(8, 12);
const rad = nums.slice(12, 20);
const cdnd = `pG-${fecaFinal.join(',')}>${fecaSweetpoint.join(',')}`;
return {
fecaFinal,
fecaSweetpoint,
eix,
rad,
cdnd,
nome: this.decodeName(nameEncoded),
estilo: this.decodeEstilo(estiloCode)
};
} catch (e) {
console.error('Erro ao decodificar:', e);
return null;
}
},
generateURL: function(baseURL, data) {
const encoded = this.encode(data);
return `${baseURL}?q=${encoded}`;
},
readFromURL: function() {
const urlParams = new URLSearchParams(window.location.search);
const q = urlParams.get('q');
if (!q) return null;
return this.decode(q);
}
};
// ============================================
// GAME LOGIC
// ============================================
const PAPERFORM_API_KEY = 'eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiJ9.eyJhdWQiOiIzIiwianRpIjoiNWUzMTY4Yjk1YzYwNzYwYTc5YTJjYThhNzE1ZjM5NTAzNGJlYWUwYzIyMzg1NmNiZDYxMzc4NzhiZGVjNmI3YzFkZGM4YTVjMzM0ZjlkMTEiLCJpYXQiOjE3NjMzODc3NTUuMTIwMTQsIm5iZiI6MTc2MzM4Nzc1NS4xMjAxNDMsImV4cCI6NDkxOTA2MTM1NS4xMTM5NjcsInN1YiI6IjEyNTE0OCIsInNjb3BlcyI6W119.wKz3W6f1W_H-MkQT7HXxkZtt0VsMcCTf-E0guXLSh2179u94NAha6FswjmT790GXRrjQiEqtPSvuq41AmeCYSOYX5RkFRKXVojVV6YyMV7d3R3ZpEGlTCe-eZsLkDZtAZGpHZLgnBZGE94wVR_oDwY5IOWIt734nlm193hR4vGlKNS0W6lhsM-99JawvNQylmrNok91ymLe-C9eX_5OU91zzlNxinzVZCK2S0_A2TeKB9N8CtKHDM158AjstkRM8v0MLtQv4uft0bCKYUJIzfNG2Mx-A3cGBp79llSUZRSEHIRV8PJ92tWvqeC5eRSrtnvEkpglPOe2SWcEGE6R-ipxThLN6PjcyInqRnBoQlyntHXNrvEPdja6mDTxFCYiqrCPpn5YcqQrwwuOaGYD5FIMS6Nme3XNi0UaGViHCZthCtiOKr3ipuF7vDuYkkSZ979Yx2KxU7OF73P-CaSnMufD5TQ2OMhav21pRAo3XabycgEumquWv_hfUxkPUYIsQ31RxvTEAMSU3vSkjodm7Q3YyRzc-yEUFixSrCGoalpSqJel7vpMRbM5dE-6JO4_Y5_Tg_CxvzJ6FXSGer56NG2V553wy_m-KnJCLua5PtpcDpPlKh-WZzNDKfVVqCEXkoQ8l1tdyzhaHBKx8z_J-_ZbCJ9G8rxfyoOxynOcmqmA';
const PAPERFORM_FORM_ID = 'mupzzmug';
const urlParams = new URLSearchParams(window.location.search);
const empresaNome = urlParams.get('empresa') || 'Sem empresa';
const empresaEmail = urlParams.get('email') || '';
async function sendToPaperform(gameData) {
try {
const response = await fetch('https://SEU-PROJETO.vercel.app/api/submit-paperform', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify(gameData)
});
if (response.ok) {
console.log('✅ Enviado via Vercel!');
return { success: true };
}
} catch (error) {
console.log('⚠️ Erro:', error);
return { success: false };
}
}
function shouldShowQuestion(questionIndex) {
const question = GAME_QUESTIONS[questionIndex];
if (!question.condition) {
return true;
}
return question.condition(gameState.answers, gameState.scores);
}
function getNextQuestionIndex(currentIndex) {
let nextIndex = currentIndex + 1;
while (nextIndex < GAME_QUESTIONS.length) {
if (shouldShowQuestion(nextIndex)) {
return nextIndex;
}
nextIndex++;
}
return -1;
}
function getPreviousQuestionIndex(currentIndex) {
let prevIndex = currentIndex - 1;
while (prevIndex >= 0) {
if (shouldShowQuestion(prevIndex)) {
return prevIndex;
}
prevIndex--;
}
return -1;
}
let gameState = {
playerName: '',
playerEmail: '',
empresaNome: empresaNome,
empresaEmail: empresaEmail,
firstName: '',
currentQuestion: 0,
sliderValue: 50,
answers: {},
rankingItems: [],
scores: {
flexivel: 0, estavel: 0, independente: 0, interdependente: 0,
aprendizado: 0, prazer: 0, proposito: 0, acolhimento: 0,
ordem: 0, seguranca: 0, autoridade: 0, resultado: 0
}
};
function updateScores(newScores) {
Object.keys(newScores).forEach(key => {
gameState.scores[key] = (gameState.scores[key] || 0) + newScores[key];
});
}
function showScreen(screenId) {
document.querySelectorAll('.screen').forEach(s => s.classList.remove('active'));
document.getElementById(screenId).classList.add('active');
}
function renderProgressDots() {
const dotsContainer = document.getElementById('progress-dots');
dotsContainer.innerHTML = '';
GAME_QUESTIONS.forEach((q, idx) => {
if (idx <= gameState.currentQuestion || shouldShowQuestion(idx)) {
const dot = document.createElement('div');
dot.className = 'progress-dot';
if (idx === gameState.currentQuestion) {
dot.classList.add('current');
} else if (idx < gameState.currentQuestion) {
dot.classList.add('completed');
} else {
dot.classList.add('upcoming');
}
dotsContainer.appendChild(dot);
}
});
}
function renderQuestion() {
const q = GAME_QUESTIONS[gameState.currentQuestion];
document.getElementById('question-image').src = q.image;
document.getElementById('stage-badge').textContent = q.stage;
document.getElementById('question-title').textContent = q.title;
document.getElementById('scenario').textContent = q.scenario;
document.getElementById('question').textContent = q.question;
const backBtn = document.getElementById('back-btn');
backBtn.style.display = gameState.currentQuestion > 0 ? 'flex' : 'none';
const contentContainer = document.getElementById('question-content');
contentContainer.innerHTML = '';
if (q.type === 'multiple') {
renderMultipleChoice(q, contentContainer);
} else if (q.type === 'slider') {
renderSlider(q, contentContainer);
} else if (q.type === 'ranking') {
renderRanking(q, contentContainer);
}
renderProgressDots();
}
function renderMultipleChoice(q, container) {
const optionsDiv = document.createElement('div');
optionsDiv.className = 'options';
q.options.forEach((option, idx) => {
const btn = document.createElement('button');
btn.className = 'option-btn';
btn.textContent = option.text;
const savedAnswer = gameState.answers[gameState.currentQuestion];
if (savedAnswer && savedAnswer.type === 'multiple' && savedAnswer.index === idx) {
btn.classList.add('selected');
btn.textContent = '✔ ' + option.text;
}
btn.onclick = () => handleMultipleChoice(option, idx);
optionsDiv.appendChild(btn);
});
container.appendChild(optionsDiv);
}
function renderSlider(q, container) {
const sliderContainer = document.createElement('div');
sliderContainer.className = 'slider-container';
const savedAnswer = gameState.answers[gameState.currentQuestion];
if (savedAnswer && savedAnswer.type === 'slider') {
gameState.sliderValue = savedAnswer.value;
} else {
gameState.sliderValue = 50;
}
sliderContainer.innerHTML = `
${q.leftLabel}
${q.rightLabel}
`;
container.appendChild(sliderContainer);
const slider = document.getElementById('slider-input');
updateSliderBackground(slider);
slider.addEventListener('input', (e) => {
gameState.sliderValue = parseInt(e.target.value);
updateSliderBackground(slider);
});
const submitBtn = document.createElement('button');
submitBtn.className = 'btn';
submitBtn.innerHTML = `
Confirmar escolha
`;
submitBtn.onclick = handleSliderSubmit;
container.appendChild(submitBtn);
}
function updateSliderBackground(slider) {
const value = slider.value;
slider.style.background = `linear-gradient(to right, rgb(59, 130, 246) 0%, rgb(156, 163, 175) ${value}%, rgb(168, 85, 247) 100%)`;
}
function renderRanking(q, container) {
const savedAnswer = gameState.answers[gameState.currentQuestion];
if (savedAnswer && savedAnswer.type === 'ranking') {
gameState.rankingItems = [...savedAnswer.order];
} else {
gameState.rankingItems = [];
}
const rankingContainer = document.createElement('div');
rankingContainer.className = 'ranking-container';
rankingContainer.innerHTML = `
🎯 Clique nos itens para adicioná-los ao ranking.
Você precisa selecionar ${q.rankCount} itens em ordem de importância.
`;
container.appendChild(rankingContainer);
updateRankingDisplay(q);
const submitBtn = document.createElement('button');
submitBtn.className = 'btn';
submitBtn.id = 'ranking-submit';
submitBtn.disabled = gameState.rankingItems.length < q.rankCount;
submitBtn.innerHTML = `
Confirmar ranking (${gameState.rankingItems.length}/${q.rankCount})
`;
submitBtn.onclick = handleRankingSubmit;
container.appendChild(submitBtn);
}
function updateRankingDisplay(q) {
const selectedContainer = document.getElementById('ranking-selected');
const availableContainer = document.getElementById('ranking-available');
if (gameState.rankingItems.length > 0) {
selectedContainer.innerHTML = `
`;
const itemsContainer = document.getElementById('ranking-items');
gameState.rankingItems.forEach((item, index) => {
const itemDiv = document.createElement('div');
itemDiv.className = 'ranking-item';
if (index < q.rankCount) {
itemDiv.classList.add('ranked');
}
itemDiv.draggable = true;
itemDiv.innerHTML = `
${index + 1}º
${item.text}
`;
itemDiv.addEventListener('dragstart', () => {
itemDiv.classList.add('dragging');
});
itemDiv.addEventListener('dragend', () => {
itemDiv.classList.remove('dragging');
});
itemsContainer.appendChild(itemDiv);
});
itemsContainer.addEventListener('dragover', (e) => {
e.preventDefault();
const afterElement = getDragAfterElement(itemsContainer, e.clientY);
const dragging = document.querySelector('.dragging');
if (afterElement == null) {
itemsContainer.appendChild(dragging);
} else {
itemsContainer.insertBefore(dragging, afterElement);
}
});
itemsContainer.addEventListener('drop', () => {
const newOrder = [];
itemsContainer.querySelectorAll('.ranking-item').forEach(item => {
const text = item.querySelector('span').textContent;
const foundItem = q.items.find(i => i.text === text) || gameState.rankingItems.find(i => i.text === text);
if (foundItem) newOrder.push(foundItem);
});
gameState.rankingItems = newOrder;
updateRankingDisplay(q);
});
} else {
selectedContainer.innerHTML = '';
}
availableContainer.innerHTML = '';
q.items.forEach(item => {
if (!gameState.rankingItems.find(ri => ri.text === item.text)) {
const btn = document.createElement('button');
btn.className = 'available-item';
btn.textContent = item.text;
btn.onclick = () => addToRanking(item, q);
availableContainer.appendChild(btn);
}
});
const submitBtn = document.getElementById('ranking-submit');
if (submitBtn) {
submitBtn.disabled = gameState.rankingItems.length < q.rankCount;
submitBtn.innerHTML = `
Confirmar ranking (${gameState.rankingItems.length}/${q.rankCount})
`;
}
}
function getDragAfterElement(container, y) {
const draggableElements = [...container.querySelectorAll('.ranking-item:not(.dragging)')];
return draggableElements.reduce((closest, child) => {
const box = child.getBoundingClientRect();
const offset = y - box.top - box.height / 2;
if (offset < 0 && offset > closest.offset) {
return { offset: offset, element: child };
} else {
return closest;
}
}, { offset: Number.NEGATIVE_INFINITY }).element;
}
function addToRanking(item, q) {
gameState.rankingItems.push(item);
updateRankingDisplay(q);
}
function removeRankingItem(index) {
const q = GAME_QUESTIONS[gameState.currentQuestion];
gameState.rankingItems.splice(index, 1);
updateRankingDisplay(q);
}
function moveRankingItem(index, direction) {
const q = GAME_QUESTIONS[gameState.currentQuestion];
const newIndex = index + direction;
if (newIndex < 0 || newIndex >= gameState.rankingItems.length) return;
const temp = gameState.rankingItems[index];
gameState.rankingItems[index] = gameState.rankingItems[newIndex];
gameState.rankingItems[newIndex] = temp;
updateRankingDisplay(q);
}
function handleMultipleChoice(option, optionIndex) {
gameState.answers[gameState.currentQuestion] = {
type: 'multiple',
index: optionIndex,
optionId: option.id || null
};
updateScores(option.scores);
moveToNextQuestion();
}
function handleSliderSubmit() {
const q = GAME_QUESTIONS[gameState.currentQuestion];
const normalizedValue = (gameState.sliderValue - 50) / 50;
const calculatedScores = {};
Object.keys(q.leftScores).forEach(key => {
const leftIntensity = Math.max(0, -normalizedValue);
const leftContribution = q.leftScores[key] * leftIntensity;
calculatedScores[key] = (calculatedScores[key] || 0) + leftContribution;
});
Object.keys(q.rightScores).forEach(key => {
const rightIntensity = Math.max(0, normalizedValue);
const rightContribution = q.rightScores[key] * rightIntensity;
calculatedScores[key] = (calculatedScores[key] || 0) + rightContribution;
});
gameState.answers[gameState.currentQuestion] = { type: 'slider', value: gameState.sliderValue };
updateScores(calculatedScores);
moveToNextQuestion();
}
function handleRankingSubmit() {
const q = GAME_QUESTIONS[gameState.currentQuestion];
if (gameState.rankingItems.length < q.rankCount) {
alert(`Por favor, selecione pelo menos ${q.rankCount} itens para rankear.`);
return;
}
const calculatedScores = {};
gameState.rankingItems.forEach((item, index) => {
if (index < q.rankCount) {
const multiplier = q.rankCount - index;
Object.keys(item.scores).forEach(key => {
calculatedScores[key] = (calculatedScores[key] || 0) + (item.scores[key] * multiplier);
});
}
});
gameState.answers[gameState.currentQuestion] = { type: 'ranking', order: [...gameState.rankingItems] };
updateScores(calculatedScores);
gameState.rankingItems = [];
moveToNextQuestion();
}
function moveToNextQuestion() {
setTimeout(() => {
const nextIndex = getNextQuestionIndex(gameState.currentQuestion);
if (nextIndex !== -1) {
gameState.currentQuestion = nextIndex;
renderQuestion();
} else {
showResult();
}
}, 300);
}
function moveToPreviousQuestion() {
const prevIndex = getPreviousQuestionIndex(gameState.currentQuestion);
if (prevIndex !== -1) {
setTimeout(() => {
gameState.currentQuestion = prevIndex;
renderQuestion();
}, 300);
}
}
function calculateResult() {
const scores = gameState.scores;
const flexStable = scores.flexivel - scores.estavel;
const indepInter = scores.independente - scores.interdependente;
let quadrant = '', primaryStyle = '', secondaryStyle = '';
if (flexStable > 0 && indepInter > 0) {
quadrant = 'Superior Esquerdo';
primaryStyle = scores.aprendizado >= scores.prazer ? 'Aprendizado' : 'Prazer';
secondaryStyle = scores.aprendizado >= scores.prazer ? 'Prazer' : 'Aprendizado';
} else if (flexStable > 0 && indepInter <= 0) {
quadrant = 'Superior Direito';
primaryStyle = scores.proposito >= scores.acolhimento ? 'Propósito' : 'Acolhimento';
secondaryStyle = scores.proposito >= scores.acolhimento ? 'Acolhimento' : 'Propósito';
} else if (flexStable <= 0 && indepInter <= 0) {
quadrant = 'Inferior Direito';
primaryStyle = scores.ordem >= scores.seguranca ? 'Ordem' : 'Segurança';
secondaryStyle = scores.ordem >= scores.seguranca ? 'Segurança' : 'Ordem';
} else {
quadrant = 'Inferior Esquerdo';
primaryStyle = scores.autoridade >= scores.resultado ? 'Autoridade' : 'Resultado';
secondaryStyle = scores.autoridade >= scores.resultado ? 'Resultado' : 'Autoridade';
}
const descriptions = {
'Aprendizado': 'Você é movido pela curiosidade e pelo desenvolvimento contínuo.',
'Prazer': 'Você busca leveza e espontaneidade no que faz.',
'Propósito': 'Você é guiado por ideais e pela contribuição para uma causa maior.',
'Acolhimento': 'Você valoriza confiança, apoio mútuo e pertencimento.',
'Ordem': 'Você preza disciplina, tradição e eficiência.',
'Segurança': 'Você é cauteloso e planejador.',
'Autoridade': 'Você valoriza comando claro e decisões assertivas.',
'Resultado': 'Você é orientado por metas e excelência.'
};
const totalFlex = scores.flexivel + scores.estavel;
const totalIndep = scores.independente + scores.interdependente;
const F_orig = totalFlex > 0 ? Math.round((scores.flexivel / totalFlex) * 100) : 50;
const E_orig = 100 - F_orig;
const C_orig = totalIndep > 0 ? Math.round((scores.interdependente / totalIndep) * 100) : 50;
const A_orig = 100 - C_orig;
const sweetpoints = {
'Prazer': { F: 92, E: 8, C: 30, A: 70 },
'Propósito': { F: 92, E: 8, C: 70, A: 30 },
'Aprendizado':{ F: 70, E: 30, C: 8, A: 92 },
'Acolhimento':{ F: 70, E: 30, C: 92, A: 8 },
'Autoridade': { F: 8, E: 92, C: 30, A: 70 },
'Segurança': { F: 8, E: 92, C: 70, A: 30 },
'Resultado': { F: 30, E: 70, C: 8, A: 92 },
'Ordem': { F: 30, E: 70, C: 92, A: 8 }
};
const SP = sweetpoints[primaryStyle];
const e = 0.3;
const F_final = Math.round(((SP.F * e) + F_orig) / (1 + e));
const E_final = 100 - F_final;
const C_final = Math.round(((SP.C * e) + C_orig) / (1 + e));
const A_final = 100 - C_final;
return {
quadrant,
primaryStyle,
secondaryStyle,
description: descriptions[primaryStyle],
feca: {
original: { F: F_orig, E: E_orig, C: C_orig, A: A_orig },
sweetpoint: SP,
final: { F: F_final, E: E_final, C: C_final, A: A_final }
}
};
}
async function showResult() {
const result = calculateResult();
showScreen('loading-screen');
const loadingPhrases = [
'Cruzando dados',
'Qore IA analisando',
'Montando resultado'
];
let phraseIndex = 0;
const loadingTextElement = document.getElementById('loading-text');
const phraseInterval = setInterval(() => {
phraseIndex++;
if (phraseIndex < loadingPhrases.length) {
loadingTextElement.textContent = loadingPhrases[phraseIndex];
loadingTextElement.style.animation = 'none';
setTimeout(() => {
loadingTextElement.style.animation = 'fadeInOut 1s ease-in-out';
}, 10);
}
}, 1000);
const dataToSend = {
playerName: gameState.playerName,
playerEmail: gameState.playerEmail,
empresaNome: gameState.empresaNome,
empresaEmail: gameState.empresaEmail,
quadrant: result.quadrant,
primaryStyle: result.primaryStyle,
secondaryStyle: result.secondaryStyle,
fecaOriginal: `${result.feca.original.F},${result.feca.original.E},${result.feca.original.C},${result.feca.original.A}`,
fecaFinal: `${result.feca.final.F},${result.feca.final.E},${result.feca.final.C},${result.feca.final.A}`,
scores: gameState.scores
};
const GOOGLE_SCRIPT_URL = 'https://script.google.com/macros/s/AKfycbyNn_PVj4j1jqgsotbTSY04CtLKQfDOGJrsJQtO3SNbljFfvj2_-nqDEs2bI-k3TEPR/exec';
if (GOOGLE_SCRIPT_URL !== 'COLE_AQUI_A_URL_DO_SEU_GOOGLE_SCRIPT') {
fetch(GOOGLE_SCRIPT_URL, {
method: 'POST',
mode: 'no-cors',
headers: {
'Content-Type': 'application/json',
},
body: JSON.stringify(dataToSend)
}).catch(error => {
console.log('Erro ao enviar dados:', error);
});
}
await sendToPaperform(dataToSend);
setTimeout(() => {
clearInterval(phraseInterval);
// Calcular percentuais dos 8 estilos para o parâmetro rad
const estilos = [
gameState.scores.proposito,
gameState.scores.acolhimento,
gameState.scores.ordem,
gameState.scores.seguranca,
gameState.scores.autoridade,
gameState.scores.resultado,
gameState.scores.aprendizado,
gameState.scores.prazer
];
const totalEstilos = estilos.reduce((sum, score) => sum + score, 0);
const percentuaisEstilos = estilos.map(score => {
return totalEstilos > 0 ? Math.round((score / totalEstilos) * 100) : 0;
});
// ============================================
// GERAR URL CODIFICADA COM QORE_CODEC
// ============================================
const qoreData = {
fecaFinal: [
result.feca.final.F,
result.feca.final.E,
result.feca.final.C,
result.feca.final.A
],
fecaSweetpoint: [
result.feca.sweetpoint.F,
result.feca.sweetpoint.E,
result.feca.sweetpoint.C,
result.feca.sweetpoint.A
],
eix: [
result.feca.original.F,
result.feca.original.A,
-result.feca.original.E,
-result.feca.original.C
],
rad: percentuaisEstilos,
nome: gameState.playerName,
estilo: result.primaryStyle
};
const reportUrl = QORE_CODEC.generateURL('https://www.qore.me/ind-result', qoreData);
console.log('URL codificada:', reportUrl);
window.location.href = reportUrl;
}, 3000);
}
function resetGame() {
gameState = {
playerName: '',
playerEmail: '',
empresaNome: empresaNome,
empresaEmail: empresaEmail,
firstName: '',
currentQuestion: 0,
sliderValue: 50,
answers: {},
rankingItems: [],
scores: {
flexivel: 0, estavel: 0, independente: 0, interdependente: 0,
aprendizado: 0, prazer: 0, proposito: 0, acolhimento: 0,
ordem: 0, seguranca: 0, autoridade: 0, resultado: 0
}
};
document.getElementById('player-name').value = '';
document.getElementById('player-email').value = '';
showScreen('intro-screen');
}
document.addEventListener('DOMContentLoaded', function() {
document.getElementById('player-name').addEventListener('input', validateStart);
document.getElementById('player-email').addEventListener('input', validateStart);
function validateStart() {
const name = document.getElementById('player-name').value.trim();
const email = document.getElementById('player-email').value.trim();
const startBtn = document.getElementById('start-btn');
const emailValid = email.includes('@') && email.includes('.');
startBtn.disabled = !(name && emailValid);
}
document.getElementById('start-btn').addEventListener('click', () => {
gameState.playerName = document.getElementById('player-name').value;
gameState.playerEmail = document.getElementById('player-email').value;
gameState.firstName = gameState.playerName.trim().split(' ')[0];
document.getElementById('player-name-display').textContent = gameState.playerName;
showScreen('game-screen');
renderQuestion();
});
document.getElementById('back-btn').addEventListener('click', moveToPreviousQuestion);
document.getElementById('restart-btn').addEventListener('click', resetGame);
showScreen('intro-screen');
});