I'm currently working on this website. Pardon the bugs.
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Verbal Analogies Opus 3</title>
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link href="https://fonts.googleapis.com/css2?family=Parkinsans:wght@300..800&family=Ubuntu:ital,wght@0,300;0,400;0,500;0,700;1,300;1,400;1,500;1,700&display=swap" rel="stylesheet">
<style>
body {
font-family: 'Ubuntu', sans-serif;
display: flex;
justify-content: center;
align-items: flex-start; /* Changed from center to flex-start */
min-height: 100vh; /* Changed from height to min-height */
margin: 0;
background-color: transparent;
padding-top: 0; /* Added to remove any top padding */
}
.container {
width: 80%;
max-width: 600px;
position: relative;
padding-top: 0; /* Added to remove any top padding */
margin-top: 0; /* Added to remove any top margin */
}
.title {
font-family: 'Parkinsans', sans-serif;
font-size: 36px;
color: #59bef7;
text-align: center;
margin-top: 0; /* Changed to remove top margin */
margin-bottom: 20px;
}
/* Rest of the CSS remains unchanged */
.progress-container {
display: flex;
align-items: center;
margin-bottom: 20px;
}
.branch, .lesson {
font-family: 'Parkinsans', sans-serif;
font-size: 18px;
font-weight: 500;
color: #59bef7;
flex: 0 0 auto;
padding: 0 10px;
}
.progress-bar {
flex: 1;
height: 20px;
background: linear-gradient(to right, #d3dfe6, #b1d1e3);
border-radius: 50px;
border: 0px solid #b1d1e3;
}
.progress {
width: 0;
height: 80%;
background: linear-gradient(to bottom, #3da5e1,#59bef7,#3da5e1, #3da5e1, #3383c1);
border-radius: 10px;
transition: width 0.3s ease-in-out;
border: 2px solid #3da5e1;
}
.card {
perspective: 1000px;
height: 400px;
}
.card-inner {
position: relative;
width: 100%;
height: 100%;
transition: transform 0.6s;
transform-style: preserve-3d;
}
.card-front, .card-back {
position: absolute;
width: 100%;
height: 100%;
backface-visibility: hidden;
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
background-color: #faf9f4;
border-radius: 10px;
box-shadow: 0 4px 8px rgba(0,0,0,0.1);
padding: 20px;
box-sizing: border-box;
border: 2px solid #e4dcd3;
border-top-width: 6px;
border-left-width: 5px;
}
.card-back {
transform: rotateY(180deg);
}
.card.flipped .card-inner {
transform: rotateY(180deg);
}
.choices {
display: grid;
grid-template-columns: 1fr 1fr;
gap: 10px;
width: 100%;
}
.choice {
padding: 10px;
border: 2px solid #e4dcd3;
border-bottom-width: 6px;
border-left-width: 5px;
background-color: #faf9f4;
cursor: pointer;
transition: all 0.3s;
font-family: 'Parkinsans', sans-serif;
font-weight: 600;
border-radius: 10px;
box-shadow: 0 2px 4px rgba(0,0,0,0.1);
color: #4f4f4f;
}
.choice:hover {
background-color: #faf9f4;
transform: translateY(-2px);
box-shadow: 0 4px 6px rgba(0,0,0,0.1);
border: 2px solid #e4dcd3;
border-top-width: 6px;
border-left-width: 3px;
}
#nextButton {
margin-top: 20px;
padding: 10px 20px;
background-color: #3da5e1;
color: white;
border: 2px solid #3383c1;
border-bottom-width: 7px;
border-left-width: 4px;
font-weight: 600;
cursor: pointer;
transition: all 0.3s;
font-family: 'Parkinsans', sans-serif;
border-radius: 20px;
box-shadow: 0 2px 4px rgba(0,0,0,0.3);
}
#nextButton:hover {
background-color: #3da5e1;
transform: translateY(-2px);
box-shadow: 0 4px 6px rgba(0,0,0,0.1);
border: 2px solid #3383c1;
border-top-width: 6px;
border-left-width: 3px;
}
#question {
font-family: 'Parkinsans', sans-serif;
font-size: 24px;
text-align: center;
color: #6b6b6b;
}
#result {
font-family: 'Parkinsans', sans-serif;
font-size: 28px;
color: #6b6b6b;
}
#correctAnswer {
font-family: 'Parkinsans', sans-serif;
font-weight: 500;
font-size: 18px;
color: #5a89ad;
}
</style>
</head>
<!-- Rest of the HTML and JavaScript remains unchanged -->
<body>
<div class="container">
<h1 class="title">Verbal Analogies</h1>
<div class="progress-container">
<div class="branch">Branch 1</div>
<div class="progress-bar">
<div class="progress"></div>
</div>
<div class="lesson">Opus 2</div>
</div>
<div class="card">
<div class="card-inner">
<div class="card-front">
<h2 id="question"></h2>
<div class="choices">
<button class="choice" id="choice1"></button>
<button class="choice" id="choice2"></button>
<button class="choice" id="choice3"></button>
<button class="choice" id="choice4"></button>
</div>
</div>
<div class="card-back">
<h2 id="result"></h2>
<p id="correctAnswer"></p>
<button id="nextButton">Next Question</button>
</div>
</div>
</div>
</div>
<script>
const questions = [
{
question: "Cent is to dollar as year is to ___ .",
choices: [
{ text: "decade" },
{ text: "salary" },
{ text: "month" },
{ text: "century" }
],
correctAnswer: 3
},
{
question: "Ice is to water as rock is to ___ .",
choices: [
{ text: "obsidian" },
{ text: "mercury" },
{ text: "Dihydrogen monoxide" },
{ text: "magma" }
],
correctAnswer: 3
},
{
question: "Apples are to trees as grapes are to ___ .",
choices: [
{ text: "terraces" },
{ text: "vines" },
{ text: "bushes" },
{ text: "stalks" }
],
correctAnswer: 1
},
{
question: "House is to human as ___ is to bird.",
choices: [
{ text: "cave" },
{ text: "hive" },
{ text: "nest" },
{ text: "tree" }
],
correctAnswer: 2
},
{
question: "Shepherds are to sheep as ___ are to cattle.",
choices: [
{ text: "ranchers" },
{ text: "dogs" },
{ text: "farmers" },
{ text: "goatherds" }
],
correctAnswer: 0
}
];
let currentQuestion = 0;
let score = 0;
const questionElement = document.getElementById("question");
const choiceElements = document.querySelectorAll(".choice");
const resultElement = document.getElementById("result");
const correctAnswerElement = document.getElementById("correctAnswer");
const nextButton = document.getElementById("nextButton");
const progressBar = document.querySelector(".progress");
function loadQuestion() {
const question = questions[currentQuestion];
questionElement.textContent = question.question;
choiceElements.forEach((element, index) => {
element.textContent = question.choices[index].text;
element.style.display = "block";
});
updateProgressBar();
}
function updateProgressBar() {
const progress = ((currentQuestion + 1) / questions.length) * 100;
progressBar.style.width = `${progress}%`;
}
function checkAnswer(choiceIndex) {
const question = questions[currentQuestion];
const isCorrect = choiceIndex === question.correctAnswer;
if (isCorrect) {
score++;
resultElement.textContent = "Correct!";
} else {
resultElement.textContent = "Incorrect!";
}
correctAnswerElement.textContent = `The correct answer is: ${question.choices[question.correctAnswer].text}`;
document.querySelector(".card").classList.add("flipped");
}
function nextQuestion() {
currentQuestion++;
if (currentQuestion < questions.length) {
document.querySelector(".card").classList.remove("flipped");
loadQuestion();
} else {
showFinalScore();
}
}
function showFinalScore() {
questionElement.textContent = "Quiz Completed!";
choiceElements.forEach(el => el.style.display = "none");
resultElement.textContent = `Your final score is: ${score} out of ${questions.length}`;
correctAnswerElement.textContent = "Thank you!";
nextButton.style.display = "none";
}
choiceElements.forEach((element, index) => {
element.addEventListener("click", () => checkAnswer(index));
});
nextButton.addEventListener("click", nextQuestion);
loadQuestion();
</script>
</body>
</html>