working single page html

This commit is contained in:
2026-05-25 06:49:06 +02:00
commit 6007a88efb
9 changed files with 2067 additions and 0 deletions
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.

After

Width:  |  Height:  |  Size: 66 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 198 KiB

+186
View File
@@ -0,0 +1,186 @@
{
"rounds": [
{
"name": "Ronde 1: Kroatië Herinneringen",
"theme": "croatia-theme",
"questions": [
{
"question": "Hoe vroeg vertrok het vliegtuig naar Kroatië? (06:38 is de foto van Bas verstuurd)",
"image": "images/kasteel.jpeg",
"audio": "audio/The Chemical Brothers - Another World.mp3",
"options": ["Dubrovnik", "Hvar", "Split", "Zadar"],
"correctOption": 1
},
{
"question": "In welke Kroatische stad kwamen we voor het eerst samen?",
"image": "images/kasteel.jpeg",
"options": ["Rijeka", "Zadar", "Osijek", "Pula"],
"correctOption": 1
},
{
"question": "Wie zijn allemaal van de waterval afgesprongen (niet doorvertellen)?",
"audio": "audio/Redlight - Me & You (feat. ASTR).mp3",
"options": ["Dubrovnik", "Hvar", "Split", "Zadar"],
"correctOption": 4
},
{
"question": "Welk drankje dronken we boven op de berg Raki ",
"audio": "audio/Redlight - Me & You (feat. ASTR).mp3",
"options": ["Dubrovnik", "Hvar", "Split", "Zadar"],
"correctOption": 4
}
]
},
{
"name": "Ronde 2: Reisavonturen",
"theme": "croatia-theme",
"questions": [
{
"question": "Hoe heette het hostel waar we in Dubrovnik verbleven?",
"image": null,
"options": ["Beach Hostel", "Old Town Hostel", "Mountain Hostel", "City Hostel"],
"correctOption": 1
},
{
"question": "Welk Kroatische wijnsoort dronken we tijdens de wijnproevering?",
"image": null,
"options": ["Malvazija", "Plavac Mali", "Pošip", "Grk"],
"correctOption": 1
},
{
"question": "Wat noemden we onze vriendengroep die we in Kroatië begonnen?",
"image": null,
"options": ["Adriatic Friends", "Croatia Crew", "Dalmatian Squad", "Istra Group"],
"correctOption": 1
}
]
},
{
"name": "Ronde 3: Muziek ronde",
"theme": "croatia-theme",
"questions": [
{
"question": "meezingers (numnmer afkappen en gorpeje moet aanvullen)",
"image": null,
"options": ["Ja", "Nee", "godverdomme nee!"],
"correctOption": 1
},
{
"question": "Vitas - 7th element wat is de originele titel",
"image": null,
"options": ["Ja", "Nee", "godverdomme nee!"],
"correctOption": 1
}
]
},
{
"name": "Ronde 4: Nederlandse reunies",
"theme": "dutch-theme",
"questions": [
{
"question": "Met welke activiteit begonnen we onze eerste reunie?",
"image": "images/kasteel.jpeg",
"audio": "audio/The Playboyz - Sunset At Brecht.flac",
"options": ["paintball", "Utrecht", "Groningen", "Leiden"],
"correctOption": 0
},
{
"question": "Wie heeft deze georganiseerd?",
"image": null,
"options": ["Rijksmuseum", "Van Gogh Museum", "Anne Frank Huis", "Stedelijk Museum"],
"correctOption": 1
},
{
"question": "In welke plaats was het paintball terrein?",
"image": null,
"options": ["Maastricht", "Delft", "Zwolle", "Arnhem"],
"correctOption": 1
},
{
"question": "Welk Nederlands dier hebben we gezien in dierentuin Efteling?",
"image": null,
"options": ["Olifant", "Pinguïn", "Nee, geen dieren", "Kangoeroe"],
"correctOption": 2
},
{
"question": "Hoe heet het beroemde Nederlandse gerecht met worst en friet?",
"image": null,
"options": ["Stamppot", "Bitterballen", "Hutspot", "Alle bovenstaande"],
"correctOption": 3
},
{
"question": "Hoeveel euro hebben we in totaal uitgegeven aan eten/drinken in restaurants?",
"image": null,
"options": ["Pašticada", "Burek", "Peka", "Risotto"],
"correctOption": 1
}
]
},
{
"name": "Ronde 5: Cultuur & Tradities uit Kroatië",
"theme": "culture-theme",
"questions": [
{
"question": "Welk Kroatisch woord betekent 'dank je wel'?",
"image": null,
"options": ["Hvala", "Zdravo", "Dobar dan", "Ljubav"],
"correctOption": 0
}
]
},
{
"name": "Ronde 6: baby foto's",
"theme": "friends-theme",
"questions": [
{
"question": "baby foto's?",
"image": null,
"options": ["1 week", "2 weken", "3 weken", "4 weken"],
"correctOption": 1
},
{
"question": "feitjes van mensen?",
"image": null,
"options": ["1 week", "2 weken", "3 weken", "4 weken"],
"correctOption": 1
}
]
},
{
"name": "Ronde 6: opdrachten/spelletjes",
"theme": "friends-theme",
"questions": [
{
"question": "Raad de smaak",
"image": null,
"options": ["1 week", "2 weken", "3 weken", "4 weken"],
"correctOption": 1
},
{
"question": "voel wat het is",
"image": null,
"options": ["komkommer voor Luuk", "2 weken", "3 weken", "4 weken"],
"correctOption": 1
}
]
}
],
"config": {
"title": "Kroatië vriendengroep Pub Quiz",
"group_name": "🇭🇷 Kroatië vriendengroep Pub Quiz",
"start_page_title": "Pub Quiz Night",
"start_page_subtitle": "Voor onze geweldige vriendengroep!",
"start_page_welcome": "Welkom bij de quiz! After each round, we'll take a short break to check answers. At the end, we'll see all the answers together.",
"round_break_title": "Round Break",
"round_break_message": "Take a moment to check the answers and have a drink!",
"review_page_title": "Review Round",
"review_page_message": "Discuss your answers above. When you're ready, click the button to continue.",
"final_page_title": "Quiz Complete!",
"final_page_subtitle": "Here are all the answers for our Croatia friends!",
"play_again_button": "Play Again",
"next_round_button": "Next Round",
"continue_button": "Continue to Next Round"
}
}
+890
View File
@@ -0,0 +1,890 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Croatia Friends Pub Quiz</title>
<link rel="stylesheet" href="style.css">
</head>
<body>
<div class="container">
<div class="group-name" id="group-name"></div>
<!-- Start Page -->
<div id="start-page" class="page active">
<h1 id="start-page-title"></h1>
<p class="subtitle" id="start-page-subtitle"></p>
<p id="start-page-welcome"></p>
<button class="btn" onclick="startQuiz()">Start Quiz</button>
</div>
<!-- Question Page -->
<div id="question-page" class="page">
<div class="progress" id="progress"></div>
<div class="question-container">
<div class="question-number" id="question-number"></div>
<div class="question-text" id="question-text"></div>
<img id="question-image" class="question-image" alt="Question image">
<div id="audio-container" style="display: none; padding: 10px 0;">
<div id="audio-progress-wrapper" style="flex: 1; height: 6px; background: #ddd; border-radius: 3px; position: relative; cursor: pointer;">
<div id="audio-progress-bar" class="audio-progress-bar" style="width: 0%; height: 100%; border-radius: 3px; transition: width 0.1s;"></div>
</div>
<div style="display: flex; align-items: center; justify-content: space-between; gap: 15px; margin-top: 10px;">
<div id="audio-start-time" style="font-size: 14px; min-width: 45px; text-align: left;">0:00</div>
<div style="display: flex; align-items: center; gap: 8px;">
<button id="audio-play-btn" class="btn btn-small" style="padding: 6px 12px; font-size: 14px;"></button>
<button id="audio-mute-btn" class="btn btn-small audio-mute-btn" style="padding: 6px 12px; font-size: 14px; display: flex; align-items: center; gap: 5px;" onclick="toggleMute()">
<span id="mute-icon">🔊</span>
</button>
<input type="range" id="audio-volume" min="0" max="1" step="0.01" value="1" style="width: 50px; cursor: pointer;">
</div>
<div id="audio-end-time" style="font-size: 14px; min-width: 45px; text-align: right;">0:00</div>
</div>
<audio id="question-audio" style="display: none;"></audio>
</div>
</div>
<div id="answers-container" style="display: none;">
<h3 style="color: #1a5276; margin-bottom: 15px;">Vote for your answer:</h3>
<div class="answers-grid" id="answers-list"></div>
</div>
<div id="next-buttons">
<button class="btn" onclick="prevQuestion()" id="prev-btn" style="display: none;">Previous</button>
<button class="btn" onclick="nextQuestion()" id="next-btn">Next Question</button>
</div>
</div>
<!-- Recap Page -->
<div id="recap-page" class="page">
<h1>📝 Quiz Recap</h1>
<p class="subtitle">All questions with answers</p>
<div id="recap-answers"></div>
<button class="btn btn-secondary" onclick="restartQuiz()">Play Again</button>
</div>
<!-- Final Page -->
<div id="final-page" class="page">
<h1 id="final-page-title"></h1>
<p class="subtitle" id="final-page-subtitle"></p>
<div class="answers-grid" id="final-answers"></div>
<button class="btn btn-secondary" onclick="restartQuiz()" id="play-again-btn"></button>
</div>
<!-- Round Review Page - Shows previous round answers -->
<div id="review-page" class="page">
<h1 id="review-page-title"></h1>
<div id="review-answers"></div>
<p id="review-page-message"></p>
<button class="btn" onclick="nextRound(event)" id="continue-btn"></button>
<button class="btn btn-secondary" onclick="restartQuiz()" id="play-again-btn-review"></button>
</div>
<!-- Break Page -->
<div id="break-page" class="page">
<h1 id="break-page-title"></h1>
<div id="round-ranges" style="margin: 20px 0; padding: 15px; background: #f8f9fa; border-radius: 10px; font-size: 0.95rem;"></div>
<p id="break-page-message"></p>
<button class="btn" onclick="nextRound(event)" id="next-round-btn"></button>
<button class="btn btn-secondary" onclick="restartQuiz()" id="play-again-btn-break"></button>
</div>
</div>
<script>
let questions = [];
let answers = [];
let currentQuestion = 0;
let currentRound = 1;
let reviewPageProcessing = false;
let config = {};
// Rounds loaded from JSON file
let rounds = [];
let roundQuestions = []; // Flat array of questions with round info
let currentVolume = 1; // Persistent volume setting
// Set progress bar color based on current theme
function setProgressColor(progressBar) {
const body = document.body;
if (!progressBar) return;
if (body.classList.contains('croatia-theme')) {
progressBar.style.background = 'linear-gradient(90deg, #0077b6, #00b4d8)';
} else if (body.classList.contains('dutch-theme')) {
progressBar.style.background = 'linear-gradient(90deg, #ff9900, #ff6600)';
} else if (body.classList.contains('culture-theme')) {
progressBar.style.background = 'linear-gradient(90deg, #d2691e, #cd853f)';
} else if (body.classList.contains('friends-theme')) {
progressBar.style.background = 'linear-gradient(90deg, #4CAF50, #2196F3)';
} else {
progressBar.style.background = 'linear-gradient(90deg, #3498db, #2980b9)';
}
}
// Global mute toggle function
let isMuted = false;
let savedVolume = 1;
function toggleMute() {
const audio = document.getElementById('question-audio');
const muteIcon = document.getElementById('mute-icon');
isMuted = !isMuted;
muteIcon.textContent = isMuted ? '🔇' : '🔊';
if (isMuted) {
audio.muted = true;
const volumeSlider = document.getElementById('audio-volume');
if (volumeSlider) volumeSlider.value = 0;
// Save current volume for later
savedVolume = audio.volume;
} else {
audio.muted = false;
// Restore saved volume
audio.volume = savedVolume;
const volumeSlider = document.getElementById('audio-volume');
if (volumeSlider) volumeSlider.value = savedVolume;
}
}
function startQuiz() {
showPage('question-page');
currentQuestion = 0;
loadQuestion();
}
function showPage(pageId) {
document.querySelectorAll('.page').forEach(page => {
page.classList.remove('active');
});
document.getElementById(pageId).classList.add('active');
// Clear answer content when showing start or question pages
if (pageId === 'start-page' || pageId === 'question-page') {
document.getElementById('final-answers').innerHTML = '';
document.getElementById('recap-answers').innerHTML = '';
}
// Clear recap answers when showing final page
if (pageId === 'final-page') {
document.getElementById('recap-answers').innerHTML = '';
}
}
function loadQuestion() {
const q = questions[currentQuestion];
const progress = document.getElementById('progress');
const qNumber = document.getElementById('question-number');
const qText = document.getElementById('question-text');
const questionImage = document.getElementById('question-image');
const answersContainer = document.getElementById('answers-container');
const answersList = document.getElementById('answers-list');
const nextButtons = document.getElementById('next-buttons');
// Set progress bar color based on current theme and reset progress to 0
const audioContainer = document.getElementById('audio-container');
const progressBar = document.getElementById('audio-progress-bar');
const timeDisplay = document.getElementById('audio-time');
const audio = document.getElementById('question-audio');
const playBtn = document.getElementById('audio-play-btn');
if (audioContainer) {
audioContainer.style.display = q.audio ? 'block' : 'none';
if (progressBar) {
// Reset progress bar to 0%
progressBar.style.width = '0%';
// Reset time display to 0:00
if (timeDisplay) {
timeDisplay.textContent = '0:00';
}
// Reset audio to beginning
if (audio && q.audio) {
audio.currentTime = 0;
}
// Reset play button to play icon
if (playBtn) {
playBtn.textContent = '▶';
}
setProgressColor(progressBar);
}
}
// Update progress dots - only show current round
progress.innerHTML = '';
const roundIndex = getRoundIndex(currentQuestion);
const round = rounds[roundIndex] || { name: `Round ${roundIndex + 1}` };
// Add round counter
const roundCounter = document.createElement('div');
roundCounter.style.cssText = 'display: flex; align-items: center; gap: 10px; margin-bottom: 10px;';
roundCounter.innerHTML = `<span style="font-weight: bold; color: #1a5276;">${round.name || `Round ${roundIndex + 1}`}</span> `;
progress.appendChild(roundCounter);
// Show dots only for current round
const questionsInRound = [];
for (let i = 0; i < questions.length; i++) {
if (questions[i].roundIndex === roundIndex) {
questionsInRound.push(i);
}
}
questionsInRound.forEach(qIndex => {
const dot = document.createElement('div');
dot.className = 'progress-dot';
if (qIndex < currentQuestion) dot.classList.add('completed');
if (qIndex === currentQuestion) dot.classList.add('active');
progress.appendChild(dot);
});
qNumber.textContent = `Question ${currentQuestion + 1} of ${questions.length}`;
qText.textContent = q.question;
// Show/hide question image
if (q.image) {
questionImage.src = q.image;
questionImage.classList.add('show');
} else {
questionImage.classList.remove('show');
}
// Show/hide and configure audio
const container = document.getElementById('audio-container');
const progressWrapper = document.getElementById('audio-progress-wrapper');
const startTimeDisplay = document.getElementById('audio-start-time');
const endTimeDisplay = document.getElementById('audio-end-time');
const volumeSlider = document.getElementById('audio-volume');
// playBtn, audio, and progressBar are already defined above
// Reset mute state for new question
isMuted = false;
savedVolume = 1;
// Format time helper
function formatTime(seconds) {
if (!seconds || isNaN(seconds)) return '0:00';
const mins = Math.floor(seconds / 60);
const secs = Math.floor(seconds % 60);
return `${mins}:${secs.toString().padStart(2, '0')}`;
}
if (q.audio) {
const audio = document.getElementById('question-audio');
container.style.display = 'block';
audio.src = q.audio;
audio.loop = q.loop || false;
audio.volume = currentVolume;
// Reset audio time to 0 for new question
audio.currentTime = 0;
// Reset time display to 0:00
const startTimeDisplay = document.getElementById('audio-start-time');
if (startTimeDisplay) {
startTimeDisplay.textContent = '0:00';
}
// Update volume slider to match current volume
// Set initial color
setProgressColor(progressBar);
// Play/Pause button - remove and re-add listener to fix issue
playBtn.textContent = '▶';
playBtn.onclick = () => {
if (audio.paused) {
audio.play();
playBtn.textContent = '⏸';
} else {
audio.pause();
playBtn.textContent = '▶';
}
};
// Volume slider - remove and re-add listener to fix issue
volumeSlider.value = currentVolume;
volumeSlider.oninput = () => {
audio.volume = volumeSlider.value;
currentVolume = volumeSlider.value;
// Unmute when adjusting volume
if (audio.muted) {
audio.muted = false;
muteIcon.textContent = '🔊';
volumeSlider.value = 1;
}
};
// Set volume immediately (before metadata loads)
audio.volume = currentVolume;
// Make progress bar seekable by clicking - remove and re-add listener
progressWrapper.onclick = (e) => {
if (!audio || !audio.duration || isNaN(audio.duration)) return;
const rect = progressWrapper.getBoundingClientRect();
const clickX = Math.max(0, Math.min(e.clientX - rect.left, rect.width));
const width = rect.width;
const duration = audio.duration;
const seekTime = Math.max(0, Math.min(duration, (clickX / width) * duration));
audio.currentTime = seekTime;
};
// Show duration when metadata loaded
if (!audio._audio_loadedmetadata) {
audio._audio_loadedmetadata = true;
audio.addEventListener('loadedmetadata', () => {
if (endTimeDisplay && !isNaN(audio.duration)) {
endTimeDisplay.textContent = formatTime(audio.duration);
}
// Start listening to timeupdate after metadata is loaded
audio._audio_timeupdate = () => {
if (progressBar && endTimeDisplay && !isNaN(audio.duration)) {
const pct = (audio.currentTime / audio.duration) * 100;
progressBar.style.width = pct + '%';
startTimeDisplay.textContent = formatTime(audio.currentTime);
endTimeDisplay.textContent = formatTime(audio.duration);
// Update progress bar color based on current theme
setProgressColor(progressBar);
}
};
audio.addEventListener('timeupdate', audio._audio_timeupdate);
// Add ended listener
audio._audio_ended = () => {
if (progressBar) progressBar.style.width = '100%';
playBtn.textContent = '▶';
if (timeDisplay) timeDisplay.textContent = formatTime(audio.duration);
};
audio.addEventListener('ended', audio._audio_ended);
});
}
} else {
container.style.display = 'none';
const audio = document.getElementById('question-audio');
if (audio) {
audio.src = '';
// Clear all our custom listeners
if (audio._audio_timeupdate) {
audio.removeEventListener('timeupdate', audio._audio_timeupdate);
delete audio._audio_timeupdate;
}
if (audio._audio_ended) {
audio.removeEventListener('ended', audio._audio_ended);
delete audio._audio_ended;
}
// Reset volume
audio.volume = 1;
}
// Clear progressWrapper onclick
if (progressWrapper) {
progressWrapper.onclick = null;
}
// Reset play button to play icon
if (playBtn) {
playBtn.textContent = '▶';
}
// Reset volume slider and audio volume
if (volumeSlider) {
volumeSlider.value = 1;
}
if (audio) {
audio.volume = 1;
}
// Reset time displays
if (endTimeDisplay) {
endTimeDisplay.textContent = '0:00';
}
// Reset mute state
isMuted = false;
savedVolume = 1;
}
// Show all answer options on question page
answersContainer.style.display = 'block';
answersList.innerHTML = '';
// Remove all theme classes before applying new one
['croatia-theme', 'dutch-theme', 'culture-theme', 'friends-theme'].forEach(cls => document.body.classList.remove(cls));
// Apply round theme if exists
if (q.roundTheme) {
document.body.classList.add(q.roundTheme);
}
// Show previous button if not on first question
const prevBtn = document.getElementById('prev-btn');
if (currentQuestion > 0) {
prevBtn.style.display = 'inline-block';
} else {
prevBtn.style.display = 'none';
}
// Create answer options only if they exist
if (q.options && q.options.length > 0) {
const numOptions = q.options.length;
answersList.className = 'answers-grid';
// Add dynamic class based on number of options
if (numOptions === 1) {
answersList.classList.add('one-column');
} else if (numOptions === 2) {
answersList.classList.add('two-columns');
} else if (numOptions === 3) {
answersList.classList.add('three-columns');
} else if (numOptions === 4) {
answersList.classList.add('four-columns');
} else {
answersList.classList.add('five-plus-columns');
}
for (let i = 0; i < numOptions; i++) {
const option = ['A', 'B', 'C', 'D', 'E', 'F', 'G'][i];
const item = document.createElement('div');
item.className = 'answer-item';
item.innerHTML = `<div class="answer-label">${option}. ${q.options[i]}</div>`;
item.onclick = () => {
answers[currentQuestion] = i;
item.classList.add('selected');
};
answersList.appendChild(item);
}
}
nextButtons.style.display = 'block';
}
function nextQuestion() {
const prevQuestionIndex = currentQuestion;
currentQuestion++;
console.log('nextQuestion called, currentQuestion:', currentQuestion, 'prevQuestionIndex:', prevQuestionIndex);
// Check if we need to show review page (after completing a round)
const prevQuestion = questions[prevQuestionIndex];
const prevRoundIndex = prevQuestion ? prevQuestion.roundIndex : -1;
if (prevRoundIndex >= 0 && prevRoundIndex < rounds.length) {
const prevRound = rounds[prevRoundIndex];
console.log('prevRound:', prevRound);
// Check if we just finished the last question of this round
const questionsInRound = [];
for (let i = 0; i < questions.length; i++) {
if (questions[i].roundIndex === prevRoundIndex) {
questionsInRound.push(i);
}
}
const lastQuestionInRound = questionsInRound[questionsInRound.length - 1];
if (prevQuestionIndex === lastQuestionInRound) {
console.log('Showing review page for round', prevRoundIndex + 1);
showReviewPage();
return;
}
}
if (currentQuestion < questions.length) {
loadQuestion();
} else {
showFinalPage();
}
}
function prevQuestion() {
if (currentQuestion > 0) {
currentQuestion--;
loadQuestion();
}
}
function toggleAudio() {
const audio = document.getElementById('question-audio');
if (audio) {
if (audio.paused) {
audio.play();
} else {
audio.pause();
}
}
}
function showReviewPage() {
console.log('showReviewPage called');
// Get the round that just completed
const currentRoundIndex = getRoundIndex(currentQuestion - 1);
const currentRound = rounds[currentRoundIndex];
const totalRounds = rounds.length;
// currentQuestion is already pointing to next question from nextQuestion() call
// No need to reset - nextRound() will load the next question
console.log('currentQuestion already at:', currentQuestion, '(next question)');
// Collect all answers from this round (questions belong to their round)
const roundAnswers = [];
for (let i = 0; i < questions.length; i++) {
if (questions[i].roundIndex === currentRoundIndex) {
roundAnswers.push({
question: questions[i],
selectedOption: answers[i]
});
}
}
const questionsInRound = roundAnswers.length;
// Display review page
const reviewAnswersDiv = document.getElementById('review-answers');
const reviewMessage = document.getElementById('review-page-message');
const roundName = currentRound.name || `Round ${currentRoundIndex + 1}`;
reviewMessage.innerHTML = `
<strong>${roundName}</strong><br>
Round ${currentRoundIndex + 1} of ${totalRounds}<br>
Reviewing ${roundAnswers.length} questions
`;
// Build HTML for each answer showing all options
let answersHTML = '';
roundAnswers.forEach((item, idx) => {
const q = item.question;
const selected = item.selectedOption;
const options = q.options;
const correct = q.correctOption;
// Create grid for all options
const numOptions = options.length;
let optionsHTML = '';
for (let i = 0; i < numOptions; i++) {
const optionLabel = ['A', 'B', 'C', 'D', 'E', 'F', 'G'][i];
const isCorrectOption = i === correct;
const isSelectedOption = selected === i;
const isBoth = isCorrectOption && isSelectedOption;
optionsHTML += `
<div style="padding: 8px 12px; margin: 4px 0; border-radius: 6px; background: ${isCorrectOption ? '#e8f5e9' : (isSelectedOption && !isCorrectOption ? '#fff3e0' : 'white')}; border-left: 3px solid ${isCorrectOption ? '#4caf50' : (isSelectedOption ? '#ff9800' : '#ddd')};">
<span style="color: #2c3e50; font-weight: ${isCorrectOption ? 'bold' : 'normal'};">${optionLabel}.</span> ${options[i]}
</div>
`;
}
answersHTML += `
<div style="margin-bottom: 20px; padding: 15px; border-radius: 10px; background: #f8f9fa;">
<p style="font-weight: 600; margin-bottom: 10px; color: #2c3e50;">${idx + 1}. ${q.question}</p>
<div style="padding: 10px; background: white; border-radius: 8px;">
${optionsHTML}
</div>
</div>
`;
});
reviewAnswersDiv.innerHTML = answersHTML;
showPage('review-page');
}
function showBreakPage() {
const breakPage = document.getElementById('break-page');
const breakMessage = document.getElementById('break-message');
const roundRanges = document.getElementById('round-ranges');
const currentRoundIndex = getRoundIndex(currentQuestion);
const currentRound = rounds[currentRoundIndex];
const totalRounds = rounds.length;
breakMessage.innerHTML = `
<strong>${currentRound.name || `Round ${currentRoundIndex + 1}`}</strong><br>
Round ${currentRoundIndex + 1} of ${totalRounds}<br>
Completed question ${currentQuestion} of ${questions.length}
`;
// Show all round names
let rangesHTML = '';
rounds.forEach((round, i) => {
const isCurrent = i === currentRoundIndex;
const roundName = round.name || `Round ${i + 1}`;
rangesHTML += `<div style="padding: 8px; margin: 5px 0; border-radius: 5px; ${isCurrent ? 'background: #e3f2fd; font-weight: bold;' : ''}">
${roundName} ${isCurrent ? '(Current)' : ''}
</div>`;
});
roundRanges.innerHTML = rangesHTML;
showPage('break-page');
}
function nextRound(event) {
console.log('nextRound called, reviewPageProcessing:', reviewPageProcessing);
// Prevent double-click
if (reviewPageProcessing) {
console.log('Already processing, returning');
return;
}
reviewPageProcessing = true;
console.log('nextRound called! currentQuestion:', currentQuestion);
// Prevent default and stop propagation
if (event) {
event.preventDefault();
event.stopPropagation();
}
// currentQuestion is already pointing to next question (set in nextQuestion()), just load it
console.log('Loading next question (currentQuestion already incremented)');
if (currentQuestion < questions.length) {
console.log('Loading next question');
showPage('question-page');
loadQuestion();
console.log('loadQuestion done, checking page state');
} else {
console.log('Showing final page');
showFinalPage();
}
console.log('Setting reviewPageProcessing to false');
reviewPageProcessing = false;
}
function getRoundIndex(questionIndex) {
// Returns the round index for a given question (0-based)
if (!rounds || rounds.length === 0) {
// Fallback: each question is its own round
return questionIndex;
}
// With new structure, questions have roundIndex property
if (questions[questionIndex] && questions[questionIndex].roundIndex !== undefined) {
return questions[questionIndex].roundIndex;
}
// Fallback: use question index as round index
return questionIndex;
}
function showRecapPage() {
// Clear final page content before showing recap
document.getElementById('final-answers').innerHTML = '';
showPage('recap-page');
const recapContainer = document.getElementById('recap-answers');
questions.forEach((q, index) => {
const item = document.createElement('div');
item.className = 'recap-item';
const questionDiv = document.createElement('div');
questionDiv.className = 'recap-question';
questionDiv.textContent = `${index + 1}. ${q.question}`;
const answersDiv = document.createElement('div');
answersDiv.className = 'recap-answers';
const optionsToShow = q.options ? q.options.length : 0;
const maxOptions = Math.min(optionsToShow, 6);
// Add audio element if question has audio
if (q.audio) {
const audioContainer = document.createElement('div');
audioContainer.id = `recap-audio-${index}`;
audioContainer.style.cssText = 'margin-bottom: 10px; text-align: center;';
audioContainer.innerHTML = '<audio id="recap-audio-' + index + '" style="display: none;" src="' + q.audio + '" loop="' + (q.loop || 'false') + '"></audio>';
answersDiv.appendChild(audioContainer);
}
for (let i = 0; i < maxOptions; i++) {
const answerItem = document.createElement('div');
answerItem.className = 'recap-answer-item';
const selected = answers[index];
// Check if this option is the correct one
if (i === q.correctOption) {
answerItem.classList.add('correct');
} else if (selected === i && i !== q.correctOption) {
answerItem.classList.add('incorrect');
}
const labelDiv = document.createElement('div');
labelDiv.className = 'recap-answer-label';
labelDiv.textContent = `${['A', 'B', 'C', 'D', 'E', 'F'][i]}. ${q.options[i]}`;
const textDiv = document.createElement('div');
textDiv.className = 'recap-answer-text';
textDiv.textContent = q.options[i];
answerItem.appendChild(labelDiv);
answerItem.appendChild(textDiv);
answersDiv.appendChild(answerItem);
}
answersDiv.appendChild(questionDiv);
item.appendChild(questionDiv);
item.appendChild(answersDiv);
recapContainer.appendChild(item);
});
showPage('recap-page');
}
function showFinalPage() {
// Clear recap page content before showing final page
document.getElementById('recap-answers').innerHTML = '';
showPage('final-page');
const answersContainer = document.getElementById('final-answers');
questions.forEach((q, index) => {
const item = document.createElement('div');
item.className = 'answer-item';
const label = document.createElement('div');
label.className = 'answer-label';
label.textContent = `${index + 1}. ${q.question}`;
const text = document.createElement('div');
text.className = 'answer-text';
text.style.fontWeight = 'bold';
text.style.color = '#27ae60';
text.textContent = `${q.options[q.correctOption]}`;
// Add image if question has one
if (q.image) {
const img = document.createElement('img');
img.className = 'question-image';
img.style.marginTop = '10px';
img.src = q.image;
img.alt = q.options[q.correctOption];
item.appendChild(img);
}
// Add audio button if question has audio
if (q.audio) {
const audioBtn = document.createElement('button');
audioBtn.className = 'btn-audio';
audioBtn.innerHTML = '<svg width="24" height="24" viewBox="0 0 24 24" fill="currentColor"><path d="M3 9v6h4l5 5V4L7 9H3zm13.5 3c0-1.77-1.02-3.29-2.5-4.03v8.05c1.48-.73 2.5-2.25 2.5-4.02zM14 3.23v2.06c2.89.86 5 3.54 5 6.71s-2.11 5.85-5 6.71v2.06c4.01-.91 7-4.49 7-8.77s-2.99-7.86-7-8.77z"/></svg>';
audioBtn.title = 'Play/Pause audio';
audioBtn.onclick = () => toggleAudio(index);
// Add audio element
const audioContainer = document.createElement('div');
audioContainer.id = `question-audio-${index}`;
audioContainer.style.cssText = 'margin-top: 10px; text-align: center;';
audioContainer.innerHTML = '<audio id="question-audio-' + index + '" style="display: none;"></audio>';
const audio = document.getElementById('question-audio-' + index);
if (audio) {
audio.src = q.audio;
audio.loop = q.loop || false;
}
item.appendChild(audioContainer);
item.appendChild(audioBtn);
}
item.appendChild(label);
item.appendChild(text);
// Add answers grid with dynamic columns
const answersGrid = document.createElement('div');
answersGrid.className = 'answers-grid';
const numOptions = q.options ? q.options.length : 0;
if (numOptions === 1) {
answersGrid.classList.add('one-column');
} else if (numOptions === 2) {
answersGrid.classList.add('two-columns');
} else if (numOptions === 3) {
answersGrid.classList.add('three-columns');
} else if (numOptions === 4) {
answersGrid.classList.add('four-columns');
} else {
answersGrid.classList.add('five-plus-columns');
}
// Show all options
const maxOptions = Math.min(q.options ? q.options.length : 0, 6);
for (let i = 0; i < maxOptions; i++) {
const option = ['A', 'B', 'C', 'D', 'E', 'F'][i];
const optionItem = document.createElement('div');
optionItem.className = 'answer-item';
const optionLabel = document.createElement('div');
optionLabel.className = 'answer-label';
optionLabel.textContent = `${option}. ${q.options[i]}`;
optionItem.appendChild(optionLabel);
answersGrid.appendChild(optionItem);
}
item.appendChild(answersGrid);
answersContainer.appendChild(item);
});
}
function restartQuiz() {
currentQuestion = 0;
currentRound = 1;
// Clear all answer content
document.getElementById('final-answers').innerHTML = '';
showPage('start-page');
}
// Load questions from JSON file
// Show start page immediately
showPage('start-page');
fetch('questions.json')
.then(response => {
console.log('Response status:', response.status);
if (!response.ok) {
throw new Error(`Network response was not ok: ${response.status}`);
}
return response.json();
})
.then(data => {
console.log('JSON data received:', data);
config = data.config || {};
rounds = data.rounds || [];
// Flatten rounds into a single questions array with round info
roundQuestions = [];
rounds.forEach((round, roundIndex) => {
if (round.questions && Array.isArray(round.questions)) {
round.questions.forEach((q, qIndex) => {
q.roundIndex = roundIndex;
q.roundName = round.name || `Round ${roundIndex + 1}`;
q.roundTheme = round.theme || '';
roundQuestions.push(q);
});
}
});
questions = roundQuestions;
console.log('Rounds loaded:', rounds);
console.log('Questions loaded:', questions.length);
console.log('Config loaded:', config);
// Validate config
if (!questions.length) {
alert('No questions found in JSON file!');
return;
}
// Populate start page
document.getElementById('group-name').textContent = config.group_name || 'Pub Quiz';
document.getElementById('start-page-title').textContent = config.start_page_title || 'Pub Quiz Night';
document.getElementById('start-page-subtitle').textContent = config.start_page_subtitle || '';
document.getElementById('start-page-welcome').textContent = config.start_page_welcome || '';
// Populate break page
document.getElementById('break-page-title').textContent = config.round_break_title || 'Round Break';
document.getElementById('break-page-message').textContent = config.round_break_message || '';
// Populate review page
document.getElementById('review-page-title').textContent = config.review_page_title || 'Review Round';
document.getElementById('review-page-message').textContent = config.review_page_message || '';
// Populate final page
document.getElementById('final-page-title').textContent = config.final_page_title || 'Quiz Complete!';
document.getElementById('final-page-subtitle').textContent = config.final_page_subtitle || '';
document.getElementById('play-again-btn').textContent = config.play_again_button || 'Play Again';
document.getElementById('play-again-btn-review').textContent = config.play_again_button || 'Play Again';
document.getElementById('play-again-btn-break').textContent = config.play_again_button || 'Play Again';
document.getElementById('continue-btn').textContent = config.continue_button || 'Continue';
document.getElementById('next-round-btn').textContent = config.next_round_button || 'Next Round';
startQuiz();
})
.catch(error => {
console.error('Failed to load questions:', error);
console.error('Error details:', error.message);
alert('Failed to load questions from JSON file. Please make sure you are running a local web server (python3 -m http.server 8000).');
});
</script>
</body>
</html>
+600
View File
@@ -0,0 +1,600 @@
/* ========================================
SECTION 1: RESET & VARIABLES
======================================== */
/* Reset */
* {
margin: 0;
padding: 0;
box-sizing: border-box;
}
/* CSS Custom Properties */
:root {
/* ========== Primary Colors ========== */
--color-primary: #1a5276;
--color-primary-gradient: linear-gradient(135deg, #1a5276 0%, #2c3e50 100%);
/* ========== Secondary Colors ========== */
--color-secondary: #3498db;
--color-secondary-gradient: linear-gradient(135deg, #3498db 0%, #2980b9 100%);
/* ========== Accent/Action Colors ========== */
--color-accent: #e74c3c;
--color-accent-gradient: linear-gradient(135deg, #e74c3c 0%, #c0392b 100%);
/* ========== Theme-Specific Colors ========== */
/* Croatia Theme - Ocean Blues with Golden Yellow */
--color-croatia-bg: linear-gradient(135deg, #0077b6 0%, #00b4d8 50%, #90e0ef 100%);
--color-croatia-btn: linear-gradient(135deg, #f1c40f 0%, #f39c12 100%);
--color-croatia-border: #f1c40f;
/* Dutch Theme - Dutch Flag Colors with Orange Accent */
--color-dutch-bg: linear-gradient(135deg, #ff4040 0%, #ffd1ad 50%, #0071ff 100%);
--color-dutch-btn: linear-gradient(135deg, #ff9900 0%, #ff6600 100%);
--color-dutch-border: #ff6600;
--color-dutch-text: #21468b;
/* Culture Theme - Warm Earth Tones */
--color-culture-bg: linear-gradient(135deg, #8b4513 0%, #d2691e 50%, #cd853f 100%);
--color-culture-btn: linear-gradient(135deg, #ffd700 0%, #ffa500 100%);
--color-culture-border: #ffd700;
/* Friends Theme - Friendly Blue and Green */
--color-friends-bg: linear-gradient(135deg, #4CAF50 0%, #2196F3 100%);
--color-friends-btn: linear-gradient(135deg, #ff6b6b 0%, #feca57 100%);
--color-friends-border: #4CAF50;
/* ========== Neutral Colors ========== */
--color-white: #ffffff;
/* ========== Progress Bar Colors ========== */
--color-progress-default: linear-gradient(90deg, #3498db, #2980b9);
--color-progress-croatia: linear-gradient(90deg, #0077b6, #00b4d8);
--color-progress-dutch: linear-gradient(90deg, #ff9900, #ff6600);
--color-progress-culture: linear-gradient(90deg, #d2691e, #cd853f);
--color-progress-friends: linear-gradient(90deg, #4CAF50, #2196F3);
--color-white-variant: #f8f9fa;
--color-gray-light: #f5f5f5;
--color-gray-medium: #7f8c8d;
--color-gray-dark: #2c3e50;
--color-gray-border: #bdc3c7;
--color-gray-subtle: #e0e0e0;
/* ========== Status Colors ========== */
--color-success: #27ae60;
--color-success-bg: #e8f5e9;
--color-success-gradient: linear-gradient(135deg, #d4edda 0%, #c3e6cb 100%);
--color-success-border: #4caf50;
--color-error: #e74c3c;
--color-error-bg: #fff5f5;
--color-error-border: #e74c3c;
/* ========== Shadow & Border Colors ========== */
--shadow-sm: 0 2px 8px rgba(76, 175, 80, 0.3);
--shadow-md: 0 5px 15px rgba(0, 0, 0, 0.15);
--shadow-lg: 0 10px 30px rgba(0, 0, 0, 0.2);
--shadow-xl: 0 20px 60px rgba(0, 0, 0, 0.3);
/* ========== Spacing Variables ========== */
--spacing-xs: 5px;
--spacing-sm: 10px;
--spacing-md: 15px;
--spacing-lg: 20px;
--spacing-xl: 30px;
--spacing-xxl: 40px;
/* ========== Typography Variables ========== */
--font-size-sm: 0.95rem;
--font-size-base: 1rem;
--font-size-md: 1.2rem;
--font-size-lg: 1.3rem;
--font-size-xl: 1.5rem;
--font-size-xxl: 2.5rem;
--font-weight-bold: bold;
--font-weight-semibold: 600;
--font-weight-medium: 500;
}
/* ========================================
SECTION 2: BASE LAYOUT
======================================== */
body {
font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
background: var(--color-primary-gradient);
min-height: 100vh;
display: flex;
justify-content: center;
align-items: center;
padding: var(--spacing-lg);
}
.container {
background: var(--color-white);
border-radius: 20px;
padding: var(--spacing-xxl);
max-width: 800px;
width: 100%;
box-shadow: var(--shadow-xl);
text-align: center;
}
/* ========================================
SECTION 3: TYPOGRAPHY
======================================== */
h1 {
color: var(--color-primary);
margin-bottom: var(--spacing-sm);
font-size: var(--font-size-xxl);
}
.subtitle {
color: var(--color-gray-medium);
font-size: var(--font-size-md);
margin-bottom: var(--spacing-xl);
}
.question-number {
color: var(--color-primary);
font-weight: var(--font-weight-bold);
font-size: var(--font-size-base);
margin-bottom: var(--spacing-md);
}
.question-text {
font-size: var(--font-size-xl);
color: var(--color-gray-dark);
margin-bottom: var(--spacing-xl);
line-height: 1.6;
}
.group-name {
font-size: var(--font-size-lg);
color: var(--color-accent);
margin-bottom: var(--spacing-sm);
font-weight: var(--font-weight-bold);
}
/* ========================================
SECTION 4: LAYOUT COMPONENTS
======================================== */
.page {
display: none;
}
.page.active {
display: block;
}
.progress {
display: flex;
justify-content: center;
gap: var(--spacing-sm);
margin-bottom: var(--spacing-xl);
flex-wrap: wrap;
}
.progress-dot {
width: 15px;
height: 15px;
border-radius: 50%;
background: var(--color-gray-border);
border: 2px solid var(--color-white);
}
.progress-dot.active {
background: var(--color-accent);
}
.progress-dot.completed {
background: var(--color-success);
}
.question-container {
text-align: left;
margin-bottom: var(--spacing-lg);
}
.question-image {
max-width: 100%;
max-height: 400px;
margin: var(--spacing-lg) auto;
border-radius: 15px;
box-shadow: var(--shadow-lg);
display: none;
}
.question-image.show {
display: block;
}
.answers-container {
background: var(--color-white-variant);
border-radius: 15px;
padding: var(--spacing-lg);
margin: var(--spacing-lg) 0;
text-align: left;
}
.answers-grid {
display: grid;
gap: var(--spacing-md);
margin-top: var(--spacing-lg);
}
.answers-grid.two-columns {
grid-template-columns: repeat(2, 1fr);
}
.answers-grid.three-columns {
grid-template-columns: repeat(3, 1fr);
}
.answers-grid.four-columns {
grid-template-columns: repeat(4, 1fr);
}
.answers-grid.one-column {
grid-template-columns: 1fr;
justify-items: center;
}
.answers-grid.five-plus-columns {
grid-template-columns: repeat(5, 1fr);
}
/* ========================================
SECTION 5: INTERACTIVE ELEMENTS
======================================== */
.btn {
background: var(--color-accent-gradient);
color: var(--color-white);
border: none;
padding: var(--spacing-lg) 40px;
font-size: var(--font-size-md);
border-radius: 50px;
cursor: pointer;
margin: var(--spacing-sm);
transition: transform 0.2s, box-shadow 0.2s;
font-weight: var(--font-weight-bold);
}
.btn:hover {
transform: translateY(-2px);
box-shadow: 0 10px 20px rgba(231, 76, 60, 0.3);
}
.btn-secondary {
background: var(--color-secondary-gradient);
}
.btn-secondary:hover {
box-shadow: var(--shadow-md);
}
.btn-small {
background: var(--color-accent-gradient);
color: var(--color-white);
border: none;
padding: 6px 12px;
font-size: 14px;
border-radius: 50px;
cursor: pointer;
margin: 0;
transition: transform 0.2s, box-shadow 0.2s;
font-weight: var(--font-weight-bold);
}
.btn-small:hover {
transform: scale(1.05);
box-shadow: 0 4px 8px rgba(231, 76, 60, 0.3);
}
.audio-mute-btn {
background: var(--color-accent-gradient);
color: var(--color-white);
border: none;
padding: 6px 12px;
font-size: 14px;
border-radius: 50px;
cursor: pointer;
margin: 0;
transition: transform 0.2s, box-shadow 0.2s;
font-weight: var(--font-weight-bold);
display: flex;
align-items: center;
gap: 5px;
}
.audio-mute-btn:hover {
transform: scale(1.05);
box-shadow: 0 4px 8px rgba(231, 76, 60, 0.3);
}
.answer-item {
margin: var(--spacing-md) 0;
padding: var(--spacing-lg);
background: var(--color-white);
border-radius: 10px;
border-left: 4px solid var(--color-accent);
}
.answer-label {
font-weight: var(--font-weight-bold);
color: var(--color-gray-dark);
margin-bottom: var(--spacing-sm);
}
.answer-item.selected {
background: var(--color-success-bg);
border-left-color: var(--color-success-border);
box-shadow: var(--shadow-sm);
}
.answer-item:hover {
background: var(--color-gray-light);
}
.answer-text {
color: var(--color-gray-medium);
}
/* ========================================
SECTION 9: AUDIO PLAYER
======================================== */
#audio-player {
background: var(--color-white-variant);
border-radius: 12px;
padding: var(--spacing-md) var(--spacing-lg);
margin: var(--spacing-lg) 0;
display: flex;
align-items: center;
gap: var(--spacing-md);
box-shadow: inset 0 2px 8px rgba(0, 0, 0, 0.05);
}
.answer-image {
max-width: 100%;
max-height: 200px;
margin-top: var(--spacing-sm);
border-radius: 10px;
box-shadow: var(--shadow-md);
}
/* ========================================
SECTION 6: RECAP SECTION
======================================== */
.recap-item {
margin: var(--spacing-xl) 0;
padding: var(--spacing-xl);
background: var(--color-white-variant);
border-radius: 15px;
text-align: left;
}
.recap-question {
font-size: var(--font-size-md);
color: var(--color-gray-dark);
margin-bottom: var(--spacing-md);
font-weight: var(--font-weight-medium);
}
.recap-answers {
display: flex;
flex-direction: column;
gap: var(--spacing-sm);
}
.recap-answer-item {
padding: var(--spacing-md) var(--spacing-lg);
border-radius: 8px;
}
.recap-answer-item.correct {
background: var(--color-success-gradient);
border-left: 4px solid var(--color-success-border);
color: #155724;
}
.recap-answer-item.incorrect {
background: var(--color-error-bg);
border-left: 4px solid var(--color-error);
color: var(--color-error);
}
.recap-answer-label {
font-size: var(--font-size-sm);
font-weight: var(--font-weight-semibold);
margin-bottom: var(--spacing-xs);
}
.recap-answer-text {
font-size: var(--font-size-sm);
}
.recap-image {
max-width: 100%;
max-height: 150px;
margin-top: var(--spacing-sm);
border-radius: 8px;
box-shadow: 0 3px 10px rgba(0, 0, 0, 0.1);
}
/* ========================================
SECTION 7: THEME CLASSES
======================================== */
/* --- Croatia Theme - Ocean Blues with Golden Yellow --- */
.croatia-theme {
background: var(--color-croatia-bg);
}
.croatia-theme h1 {
color: var(--color-white);
text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
}
.croatia-theme .btn {
background: var(--color-croatia-btn);
}
.croatia-theme .btn:hover {
box-shadow: 0 10px 20px rgba(241, 196, 15, 0.4);
}
.croatia-theme .question-text {
color: var(--color-primary);
}
.croatia-theme .answer-item {
border-left-color: var(--color-croatia-border);
}
/* --- Dutch Theme - Dutch Flag Colors with Orange Accent --- */
.dutch-theme {
background: var(--color-dutch-bg);
}
.dutch-theme h1 {
color: var(--color-dutch-text);
text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.2);
}
.dutch-theme .btn {
background: var(--color-dutch-btn);
}
.dutch-theme .btn:hover {
box-shadow: 0 10px 20px rgba(255, 153, 0, 0.4);
}
.dutch-theme .question-text {
color: #1a365d;
}
.dutch-theme .answer-item {
border-left-color: var(--color-dutch-border);
}
/* --- Culture Theme - Warm Earth Tones --- */
.culture-theme {
background: var(--color-culture-bg);
}
.culture-theme h1 {
color: var(--color-white);
text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
}
.culture-theme .btn {
background: var(--color-culture-btn);
}
.culture-theme .btn:hover {
box-shadow: 0 10px 20px rgba(255, 215, 0, 0.4);
}
.culture-theme .question-text {
color: #2c1810;
}
.culture-theme .answer-item {
border-left-color: var(--color-culture-border);
}
/* --- Friends Theme - Friendly Blue and Green --- */
.friends-theme {
background: var(--color-friends-bg);
}
.friends-theme h1 {
color: var(--color-white);
text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
}
.friends-theme .btn {
background: var(--color-friends-btn);
}
.friends-theme .btn:hover {
box-shadow: 0 10px 20px rgba(255, 107, 107, 0.4);
}
.friends-theme .question-text {
color: #1a2a3a;
}
.friends-theme .answer-item {
border-left-color: var(--color-friends-border);
}
/* ========================================
SECTION 7: PROGRESS BAR THEME COLORS
======================================== */
/* Croatia Theme Progress Bar */
.croatia-theme .audio-progress-bar {
background: linear-gradient(90deg, #0077b6, #00b4d8);
}
/* Dutch Theme Progress Bar */
.dutch-theme .audio-progress-bar {
background: linear-gradient(90deg, #ff9900, #ff6600);
}
/* Culture Theme Progress Bar */
.culture-theme .audio-progress-bar {
background: linear-gradient(90deg, #d2691e, #cd853f);
}
/* Friends Theme Progress Bar */
.friends-theme .audio-progress-bar {
background: linear-gradient(90deg, #4CAF50, #2196F3);
}
/* ========================================
SECTION 8: RESPONSIVE DESIGN
======================================== */
/* Mobile-first approach: Base styles work on small screens
Media queries extend for larger screens or specific adjustments */
/* Small screens (max-width: 600px) - Stack grid columns */
@media (max-width: 600px) {
.answers-grid.two-columns,
.answers-grid.three-columns,
.answers-grid.four-columns {
grid-template-columns: 1fr;
justify-items: center;
}
/* Container adjustments */
.container {
padding: var(--spacing-lg);
}
/* Typography adjustments */
h1 {
font-size: var(--font-size-lg);
}
.question-text {
font-size: var(--font-size-md);
}
/* Button adjustments */
.btn {
padding: var(--spacing-md) 30px;
font-size: var(--font-size-base);
}
}
+391
View File
@@ -0,0 +1,391 @@
* {
margin: 0;
padding: 0;
box-sizing: border-box;
}
body {
font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
background: linear-gradient(135deg, #1a5276 0%, #2c3e50 100%);
min-height: 100vh;
display: flex;
justify-content: center;
align-items: center;
padding: 20px;
}
.container {
background: white;
border-radius: 20px;
padding: 40px;
max-width: 800px;
width: 100%;
box-shadow: 0 20px 60px rgba(0,0,0,0.3);
text-align: center;
}
h1 {
color: #1a5276;
margin-bottom: 10px;
font-size: 2.5rem;
}
.subtitle {
color: #7f8c8d;
font-size: 1.2rem;
margin-bottom: 30px;
}
.page {
display: none;
}
.page.active {
display: block;
}
.progress {
display: flex;
justify-content: center;
gap: 10px;
margin-bottom: 30px;
flex-wrap: wrap;
}
.progress-dot {
width: 15px;
height: 15px;
border-radius: 50%;
background: #bdc3c7;
border: 2px solid white;
}
.progress-dot.active {
background: #e74c3c;
}
.progress-dot.completed {
background: #27ae60;
}
.question-container {
text-align: left;
margin-bottom: 20px;
}
.question-number {
color: #1a5276;
font-weight: bold;
font-size: 1rem;
margin-bottom: 15px;
}
.question-text {
font-size: 1.5rem;
color: #2c3e50;
margin-bottom: 20px;
line-height: 1.6;
}
.question-image {
max-width: 100%;
max-height: 400px;
margin: 20px auto;
border-radius: 15px;
box-shadow: 0 10px 30px rgba(0,0,0,0.2);
display: none;
}
.question-image.show {
display: block;
}
.answers-container {
background: #f8f9fa;
border-radius: 15px;
padding: 20px;
margin: 20px 0;
text-align: left;
}
.answer-item {
margin: 15px 0;
padding: 15px;
background: white;
border-radius: 10px;
border-left: 4px solid #e74c3c;
}
.answer-label {
font-weight: bold;
color: #2c3e50;
margin-bottom: 10px;
}
.answer-item.selected {
background: #e8f5e9;
border-left-color: #4caf50;
box-shadow: 0 2px 8px rgba(76, 175, 80, 0.3);
}
.answer-item:hover {
background: #f5f5f5;
}
.answer-text {
color: #7f8c8d;
}
.answer-image {
max-width: 100%;
max-height: 200px;
margin-top: 10px;
border-radius: 10px;
box-shadow: 0 5px 15px rgba(0,0,0,0.15);
}
.btn {
background: linear-gradient(135deg, #e74c3c 0%, #c0392b 100%);
color: white;
border: none;
padding: 15px 40px;
font-size: 1.2rem;
border-radius: 50px;
cursor: pointer;
margin: 10px;
transition: transform 0.2s, box-shadow 0.2s;
font-weight: bold;
}
.btn-secondary {
background: linear-gradient(135deg, #3498db 0%, #2980b9 100%);
}
.btn-secondary:hover {
box-shadow: 0 10px 20px rgba(52, 152, 219, 0.3);
}
.answers-grid {
display: grid;
gap: 15px;
margin-top: 20px;
}
.answers-grid.two-columns {
grid-template-columns: repeat(2, 1fr);
}
.answers-grid.three-columns {
grid-template-columns: repeat(3, 1fr);
}
.answers-grid.four-columns {
grid-template-columns: repeat(4, 1fr);
}
.answers-grid.one-column {
grid-template-columns: 1fr;
justify-items: center;
}
.answers-grid.five-plus-columns {
grid-template-columns: repeat(5, 1fr);
}
@media (max-width: 600px) {
.answers-grid.two-columns,
.answers-grid.three-columns,
.answers-grid.four-columns {
grid-template-columns: 1fr;
justify-items: center;
}
}
/* Theme Classes */
.croatia-theme {
background: linear-gradient(135deg, #0077b6 0%, #00b4d8 50%, #90e0ef 100%);
}
.croatia-theme h1 {
color: white;
text-shadow: 2px 2px 4px rgba(0,0,0,0.3);
}
.croatia-theme .btn {
background: linear-gradient(135deg, #f1c40f 0%, #f39c12 100%);
}
.croatia-theme .btn:hover {
box-shadow: 0 10px 20px rgba(241, 196, 15, 0.4);
}
.croatia-theme .question-text {
color: #1a5276;
}
.croatia-theme .answer-item {
border-left-color: #f1c40f;
}
/* Dutch Theme - Dutch Flag Colors with Orange Accent */
.dutch-theme {
background: linear-gradient(135deg, #ff4040 0%, #ffd1ad 50%, #0071ff 100%)
}
.dutch-theme h1 {
color: #21468b;
text-shadow: 2px 2px 4px rgba(0,0,0,0.2);
}
.dutch-theme .btn {
background: linear-gradient(135deg, #ff9900 0%, #ff6600 100%);
}
.dutch-theme .btn:hover {
box-shadow: 0 10px 20px rgba(255, 153, 0, 0.4);
}
.dutch-theme .question-text {
color: #1a365d;
}
.dutch-theme .answer-item {
border-left-color: #ff6600;
}
/* Culture Theme - Warm Earth Tones */
.culture-theme {
background: linear-gradient(135deg, #8b4513 0%, #d2691e 50%, #cd853f 100%);
}
.culture-theme h1 {
color: white;
text-shadow: 2px 2px 4px rgba(0,0,0,0.3);
}
.culture-theme .btn {
background: linear-gradient(135deg, #ffd700 0%, #ffa500 100%);
}
.culture-theme .btn:hover {
box-shadow: 0 10px 20px rgba(255, 215, 0, 0.4);
}
.culture-theme .question-text {
color: #2c1810;
}
.culture-theme .answer-item {
border-left-color: #ffd700;
}
/* Friends Theme - Friendly Blue and Green */
.friends-theme {
background: linear-gradient(135deg, #4CAF50 0%, #2196F3 100%);
}
.friends-theme h1 {
color: white;
text-shadow: 2px 2px 4px rgba(0,0,0,0.3);
}
.friends-theme .btn {
background: linear-gradient(135deg, #ff6b6b 0%, #feca57 100%);
}
.friends-theme .btn:hover {
box-shadow: 0 10px 20px rgba(255, 107, 107, 0.4);
}
.friends-theme .question-text {
color: #1a2a3a;
}
.friends-theme .answer-item {
border-left-color: #4CAF50;
}
/* Other Styles */
.group-name {
font-size: 1.3rem;
color: #e74c3c;
margin-bottom: 10px;
font-weight: bold;
}
.recap-item {
margin: 20px 0;
padding: 20px;
background: #f8f9fa;
border-radius: 15px;
text-align: left;
}
.recap-question {
font-size: 1.2rem;
color: #2c3e50;
margin-bottom: 15px;
font-weight: 500;
}
.recap-answers {
display: flex;
flex-direction: column;
gap: 10px;
}
.recap-answer-item {
padding: 12px 15px;
border-radius: 8px;
}
.recap-answer-item.correct {
background: linear-gradient(135deg, #d4edda 0%, #c3e6cb 100%);
border-left: 4px solid #28a745;
color: #155724;
}
.recap-answer-item.incorrect {
background: #fff5f5;
border-left: 4px solid #e74c3c;
color: #e74c3c;
}
.recap-answer-label {
font-size: 0.9rem;
font-weight: 600;
margin-bottom: 5px;
}
.recap-answer-text {
font-size: 0.95rem;
}
.recap-image {
max-width: 100%;
max-height: 150px;
margin-top: 10px;
border-radius: 8px;
box-shadow: 0 3px 10px rgba(0,0,0,0.1);
}
@media (max-width: 600px) {
.container {
padding: 25px;
}
h1 {
font-size: 1.8rem;
}
.question-text {
font-size: 1.2rem;
}
.btn {
padding: 12px 30px;
font-size: 1rem;
}
}