Custom Code Experiment •
French: Les Animaux
Source Code View HTML / CSS / JavaScript
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Les Animaux — Flashcard Game</title>
<link href="https://fonts.googleapis.com/css2?family=Playfair+Display:ital,wght@0,400;0,700;1,400&family=DM+Sans:wght@300;400;500&display=swap" rel="stylesheet">
<style>
:root {
--cream: #f5f0e8;
--dark: #000000;
--gold: #c9a84c;
--gold-light: #e8d49a;
--red: #e05545;
--blue: #5b9fd4;
--green: #3dba72;
--card-shadow: 0 20px 60px rgba(0,0,0,0.5);
--text-primary: #f0ece4;
--text-muted: rgba(240,236,228,0.5);
}
* { margin: 0; padding: 0; box-sizing: border-box; }
body {
background: #000000;
font-family: 'DM Sans', sans-serif;
min-height: 100vh;
display: flex;
flex-direction: column;
align-items: center;
overflow-x: hidden;
}
body::before {
content: '';
position: fixed;
inset: 0;
background:
radial-gradient(ellipse 60% 40% at 10% 20%, rgba(61,186,114,0.07) 0%, transparent 70%),
radial-gradient(ellipse 50% 60% at 90% 80%, rgba(91,159,212,0.07) 0%, transparent 70%);
pointer-events: none;
z-index: 0;
}
body::after {
content: '';
position: fixed;
inset: 0;
background-image: radial-gradient(circle, rgba(255,255,255,0.04) 1px, transparent 1px);
background-size: 28px 28px;
pointer-events: none;
z-index: 0;
}
header {
position: relative;
z-index: 1;
text-align: center;
padding: 40px 20px 20px;
width: 100%;
}
header .label {
font-family: 'DM Sans', sans-serif;
font-weight: 300;
font-size: 11px;
letter-spacing: 5px;
text-transform: uppercase;
color: var(--gold);
margin-bottom: 10px;
}
header h1 {
font-family: 'Playfair Display', serif;
font-size: clamp(2rem, 5vw, 3.2rem);
color: var(--text-primary);
line-height: 1.1;
}
header h1 em {
font-style: italic;
color: var(--green);
}
header .divider {
width: 60px;
height: 2px;
background: linear-gradient(90deg, transparent, var(--gold), transparent);
margin: 16px auto 0;
}
.progress-wrap {
position: relative;
z-index: 1;
width: min(500px, 90vw);
margin: 24px auto 0;
}
.progress-info {
display: flex;
justify-content: space-between;
align-items: center;
margin-bottom: 8px;
}
.progress-info span {
font-size: 12px;
color: var(--text-primary);
opacity: 0.6;
letter-spacing: 1px;
}
.progress-info .score {
font-weight: 500;
opacity: 1;
color: var(--green);
}
.progress-bar-bg {
height: 4px;
background: rgba(255,255,255,0.1);
border-radius: 2px;
overflow: hidden;
}
.progress-bar-fill {
height: 100%;
background: linear-gradient(90deg, var(--gold), var(--green));
border-radius: 2px;
transition: width 0.4s ease;
}
.mode-tabs {
position: relative;
z-index: 1;
display: flex;
gap: 8px;
margin: 28px auto 0;
background: rgba(255,255,255,0.07);
border-radius: 40px;
padding: 5px;
width: fit-content;
}
.mode-tab {
padding: 8px 22px;
border: none;
background: transparent;
font-family: 'DM Sans', sans-serif;
font-size: 13px;
letter-spacing: 1px;
color: var(--text-primary);
opacity: 0.5;
cursor: pointer;
border-radius: 40px;
transition: all 0.25s;
}
.mode-tab.active {
background: var(--gold);
color: #000;
opacity: 1;
}
.card-stage {
position: relative;
z-index: 1;
width: min(540px, 92vw);
margin: 36px auto 0;
perspective: 1200px;
}
.card-wrapper {
position: relative;
width: 100%;
height: 300px;
transform-style: preserve-3d;
transition: transform 0.6s cubic-bezier(0.4, 0, 0.2, 1);
cursor: pointer;
}
.card-wrapper.flipped {
transform: rotateY(180deg);
}
.card-face {
position: absolute;
inset: 0;
border-radius: 20px;
backface-visibility: hidden;
-webkit-backface-visibility: hidden;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
padding: 40px;
box-shadow: var(--card-shadow);
}
.card-front {
background: #111111;
color: var(--cream);
border: 1px solid rgba(201,168,76,0.3);
}
.card-front::before {
content: '';
position: absolute;
top: 0; left: 0; right: 0;
height: 3px;
background: linear-gradient(90deg, var(--gold), var(--green));
border-radius: 20px 20px 0 0;
}
.card-back {
background: #1a1a1a;
color: var(--text-primary);
transform: rotateY(180deg);
border: 1px solid rgba(255,255,255,0.08);
}
.card-tag {
font-size: 10px;
letter-spacing: 3px;
text-transform: uppercase;
margin-bottom: 16px;
opacity: 0.4;
}
.card-front .card-tag { color: var(--gold-light); }
.card-main-text {
font-family: 'Playfair Display', serif;
font-size: clamp(1.4rem, 4vw, 2rem);
text-align: center;
line-height: 1.3;
}
.card-front .card-main-text {
color: var(--cream);
}
.card-sub-text {
font-size: 13px;
margin-top: 12px;
opacity: 0.5;
text-align: center;
font-style: italic;
}
.card-front .card-sub-text { color: var(--gold-light); }
.card-flip-hint {
position: absolute;
bottom: 18px;
font-size: 11px;
letter-spacing: 2px;
text-transform: uppercase;
opacity: 0.3;
display: flex;
align-items: center;
gap: 6px;
}
.translation-big {
font-family: 'Playfair Display', serif;
font-size: clamp(1.2rem, 3.5vw, 1.7rem);
color: var(--blue);
text-align: center;
line-height: 1.35;
}
.noun-highlight {
display: inline-block;
background: rgba(61,186,114,0.15);
border-bottom: 2px solid var(--green);
padding: 0 4px;
border-radius: 2px;
}
.example-label {
font-size: 10px;
letter-spacing: 3px;
text-transform: uppercase;
color: var(--gold);
margin-bottom: 10px;
}
.controls {
position: relative;
z-index: 1;
display: flex;
gap: 14px;
margin: 28px auto 0;
width: min(540px, 92vw);
justify-content: center;
flex-wrap: wrap;
}
.btn {
font-family: 'DM Sans', sans-serif;
font-size: 13px;
letter-spacing: 1.5px;
text-transform: uppercase;
border: none;
cursor: pointer;
border-radius: 50px;
padding: 14px 28px;
transition: all 0.2s;
display: flex;
align-items: center;
gap: 8px;
}
.btn-wrong {
background: rgba(192,57,43,0.1);
color: var(--red);
border: 1.5px solid rgba(192,57,43,0.25);
}
.btn-wrong:hover { background: rgba(192,57,43,0.18); transform: translateY(-2px); }
.btn-correct {
background: rgba(42,122,75,0.1);
color: var(--green);
border: 1.5px solid rgba(42,122,75,0.25);
}
.btn-correct:hover { background: rgba(42,122,75,0.18); transform: translateY(-2px); }
.btn-flip {
background: var(--gold);
color: #000;
flex: 1;
max-width: 200px;
justify-content: center;
font-weight: 500;
}
.btn-flip:hover { background: #d4b05a; transform: translateY(-2px); box-shadow: 0 8px 24px rgba(201,168,76,0.3); }
.btn-shuffle {
background: transparent;
color: var(--text-primary);
border: 1.5px solid rgba(255,255,255,0.15);
opacity: 0.7;
}
.btn-shuffle:hover { opacity: 1; transform: translateY(-2px); }
.answer-controls {
display: none;
gap: 14px;
width: 100%;
justify-content: center;
}
.answer-controls.visible { display: flex; }
.flip-control {
display: flex;
gap: 14px;
width: 100%;
justify-content: center;
}
.quiz-area {
position: relative;
z-index: 1;
width: min(580px, 92vw);
margin: 30px auto 0;
display: none;
}
.quiz-area.active { display: block; }
.quiz-question-card {
background: #111111;
border-radius: 20px;
padding: 40px;
border: 1px solid rgba(201,168,76,0.2);
box-shadow: var(--card-shadow);
text-align: center;
position: relative;
overflow: hidden;
}
.quiz-question-card::before {
content: '';
position: absolute;
top: 0; left: 0; right: 0;
height: 3px;
background: linear-gradient(90deg, var(--gold), var(--green));
}
.quiz-q-label {
font-size: 10px;
letter-spacing: 3px;
text-transform: uppercase;
color: var(--gold);
margin-bottom: 16px;
opacity: 0.7;
}
.quiz-q-text {
font-family: 'Playfair Display', serif;
font-size: clamp(1.3rem, 4vw, 1.9rem);
color: var(--cream);
line-height: 1.3;
}
.quiz-options {
display: grid;
grid-template-columns: 1fr 1fr;
gap: 12px;
margin-top: 24px;
}
.quiz-option {
background: #111111;
border: 2px solid rgba(255,255,255,0.08);
border-radius: 14px;
padding: 18px 16px;
font-family: 'DM Sans', sans-serif;
font-size: 14px;
color: var(--text-primary);
cursor: pointer;
transition: all 0.2s;
text-align: center;
line-height: 1.3;
}
.quiz-option:hover:not(:disabled) {
border-color: var(--gold);
background: rgba(201,168,76,0.08);
transform: translateY(-2px);
box-shadow: 0 6px 20px rgba(0,0,0,0.3);
}
.quiz-option.correct {
background: rgba(42,122,75,0.1);
border-color: var(--green);
color: var(--green);
}
.quiz-option.wrong {
background: rgba(192,57,43,0.08);
border-color: var(--red);
color: var(--red);
}
.quiz-option:disabled { cursor: default; }
.quiz-feedback {
text-align: center;
margin-top: 18px;
font-size: 14px;
min-height: 24px;
font-weight: 500;
}
.quiz-feedback.correct { color: var(--green); }
.quiz-feedback.wrong { color: var(--red); }
.btn-next {
background: var(--gold);
color: #000;
font-weight: 500;
margin: 20px auto 0;
display: none;
}
.btn-next.visible { display: flex; margin: 20px auto 0; }
.btn-next:hover { background: #d4b05a; transform: translateY(-2px); }
.stats-row {
position: relative;
z-index: 1;
display: flex;
gap: 24px;
margin: 24px auto 0;
width: min(540px, 92vw);
justify-content: center;
}
.stat-pill {
display: flex;
align-items: center;
gap: 8px;
background: #111111;
border: 1px solid rgba(255,255,255,0.08);
border-radius: 50px;
padding: 8px 20px;
font-size: 13px;
color: var(--text-primary);
box-shadow: 0 2px 12px rgba(0,0,0,0.3);
}
.stat-dot {
width: 8px; height: 8px;
border-radius: 50%;
}
.dot-correct { background: var(--green); }
.dot-wrong { background: var(--red); }
.dot-remaining { background: var(--gold); }
.completion {
position: relative;
z-index: 1;
display: none;
flex-direction: column;
align-items: center;
text-align: center;
padding: 60px 20px;
}
.completion.visible { display: flex; }
.completion-icon {
font-size: 64px;
margin-bottom: 20px;
animation: bounce 0.6s ease;
}
@keyframes bounce {
0% { transform: scale(0); }
60% { transform: scale(1.2); }
100% { transform: scale(1); }
}
.completion h2 {
font-family: 'Playfair Display', serif;
font-size: 2.4rem;
color: var(--text-primary);
margin-bottom: 10px;
}
.completion p {
font-size: 15px;
color: var(--text-primary);
opacity: 0.6;
margin-bottom: 30px;
}
.completion-score {
font-family: 'Playfair Display', serif;
font-size: 4rem;
color: var(--blue);
font-weight: 700;
margin-bottom: 8px;
}
.btn-restart {
background: var(--gold);
color: #000;
font-weight: 500;
margin-top: 10px;
}
.btn-restart:hover { background: #d4b05a; transform: translateY(-2px); }
footer {
position: relative;
z-index: 1;
text-align: center;
padding: 40px 20px;
font-size: 11px;
letter-spacing: 2px;
text-transform: uppercase;
color: var(--dark);
opacity: 0.25;
}
@keyframes slideUp {
from { opacity: 0; transform: translateY(30px); }
to { opacity: 1; transform: translateY(0); }
}
.card-stage, .quiz-area, .controls, .stats-row, .progress-wrap {
animation: slideUp 0.5s ease forwards;
}
.card-nav {
position: relative;
z-index: 1;
display: flex;
align-items: center;
justify-content: center;
gap: 20px;
margin-top: 20px;
}
.nav-btn {
width: 44px; height: 44px;
border-radius: 50%;
border: 1.5px solid rgba(255,255,255,0.15);
background: #111111;
cursor: pointer;
font-size: 18px;
display: flex;
align-items: center;
justify-content: center;
transition: all 0.2s;
color: var(--text-primary);
box-shadow: 0 2px 10px rgba(0,0,0,0.3);
}
.nav-btn:hover { border-color: var(--gold); transform: scale(1.1); }
.card-counter {
font-family: 'Playfair Display', serif;
font-size: 1.1rem;
color: var(--text-primary);
min-width: 80px;
text-align: center;
}
.card-counter span { color: var(--gold); }
@media (max-width: 480px) {
.quiz-options { grid-template-columns: 1fr; }
.controls { gap: 10px; }
.btn { padding: 12px 20px; font-size: 12px; }
}
.info-btn {
margin-top: 18px;
display: inline-flex;
align-items: center;
gap: 8px;
background: transparent;
border: 1.5px solid rgba(201,168,76,0.35);
border-radius: 50px;
color: var(--gold);
font-family: 'DM Sans', sans-serif;
font-size: 12px;
letter-spacing: 1.5px;
text-transform: uppercase;
padding: 9px 20px;
cursor: pointer;
transition: all 0.25s;
}
.info-btn:hover {
background: rgba(201,168,76,0.1);
border-color: var(--gold);
transform: translateY(-1px);
}
.info-icon {
width: 18px; height: 18px;
border-radius: 50%;
background: var(--gold);
color: #000;
font-size: 11px;
font-weight: 700;
display: inline-flex;
align-items: center;
justify-content: center;
flex-shrink: 0;
}
.modal-overlay {
position: fixed;
inset: 0;
background: rgba(0,0,0,0.82);
backdrop-filter: blur(6px);
-webkit-backdrop-filter: blur(6px);
z-index: 1000;
display: flex;
align-items: center;
justify-content: center;
padding: 20px;
opacity: 0;
pointer-events: none;
transition: opacity 0.3s ease;
}
.modal-overlay.open {
opacity: 1;
pointer-events: all;
}
.modal {
background: #0e0e0e;
border: 1px solid rgba(201,168,76,0.2);
border-radius: 24px;
width: min(640px, 100%);
max-height: 88vh;
overflow-y: auto;
position: relative;
box-shadow: 0 40px 100px rgba(0,0,0,0.7), 0 0 0 1px rgba(201,168,76,0.08);
transform: translateY(24px) scale(0.97);
transition: transform 0.35s cubic-bezier(0.34,1.56,0.64,1), opacity 0.3s ease;
scrollbar-width: thin;
scrollbar-color: rgba(201,168,76,0.2) transparent;
}
.modal-overlay.open .modal {
transform: translateY(0) scale(1);
}
.modal::-webkit-scrollbar { width: 4px; }
.modal::-webkit-scrollbar-track { background: transparent; }
.modal::-webkit-scrollbar-thumb { background: rgba(201,168,76,0.2); border-radius: 2px; }
.modal-close {
position: sticky;
top: 16px;
float: right;
margin: 16px 16px 0 0;
width: 32px; height: 32px;
border-radius: 50%;
border: 1px solid rgba(255,255,255,0.1);
background: rgba(255,255,255,0.06);
color: var(--text-primary);
font-size: 13px;
cursor: pointer;
display: flex;
align-items: center;
justify-content: center;
transition: all 0.2s;
z-index: 10;
}
.modal-close:hover { background: rgba(255,255,255,0.12); border-color: rgba(255,255,255,0.25); }
.modal-header {
padding: 36px 40px 28px;
border-bottom: 1px solid rgba(255,255,255,0.06);
clear: both;
}
.modal-eyebrow {
font-size: 10px;
letter-spacing: 4px;
text-transform: uppercase;
color: var(--gold);
margin-bottom: 10px;
}
.modal-title {
font-family: 'Playfair Display', serif;
font-size: 2rem;
color: var(--text-primary);
line-height: 1.1;
margin-bottom: 6px;
}
.modal-title em { color: var(--green); font-style: italic; }
.modal-subtitle {
font-size: 13px;
color: var(--text-primary);
opacity: 0.4;
letter-spacing: 1px;
}
.modal-body {
padding: 32px 40px;
display: flex;
flex-direction: column;
gap: 32px;
}
.modal-section h3 {
font-family: 'Playfair Display', serif;
font-size: 1rem;
color: var(--gold);
margin-bottom: 12px;
letter-spacing: 0.5px;
}
.modal-section p {
font-size: 14px;
color: var(--text-primary);
opacity: 0.8;
line-height: 1.7;
margin-bottom: 10px;
}
.modal-section p:last-child { margin-bottom: 0; }
.modal-section strong { color: var(--text-primary); opacity: 1; font-weight: 500; }
.modal-section em { color: var(--gold-light); font-style: italic; }
/* Gender table */
.gender-table {
margin-top: 14px;
border-radius: 12px;
overflow: hidden;
border: 1px solid rgba(255,255,255,0.06);
}
.gt-header, .gt-row {
display: grid;
grid-template-columns: 1.2fr 1.2fr 1fr 1.4fr;
padding: 10px 16px;
font-size: 13px;
gap: 8px;
align-items: center;
}
.gt-header {
background: rgba(201,168,76,0.1);
color: var(--gold);
font-size: 10px;
letter-spacing: 2px;
text-transform: uppercase;
font-weight: 500;
}
.gt-row {
color: var(--text-primary);
opacity: 0.85;
border-top: 1px solid rgba(255,255,255,0.04);
}
.gt-row:nth-child(even) { background: rgba(255,255,255,0.02); }
.masc { color: var(--blue); font-style: italic; font-family: 'Playfair Display', serif; }
.fem { color: #e38eb3; font-style: italic; font-family: 'Playfair Display', serif; }
.gt-row mark {
background: rgba(61,186,114,0.2);
color: #3dba72;
border-radius: 3px;
padding: 0 3px;
}
/* Category cards */
.type-cards {
display: flex;
flex-direction: column;
gap: 10px;
margin-top: 14px;
}
.type-card {
background: rgba(255,255,255,0.03);
border: 1px solid rgba(255,255,255,0.07);
border-radius: 12px;
padding: 16px 20px;
}
.type-label {
font-size: 11px;
letter-spacing: 2px;
text-transform: uppercase;
color: var(--gold);
margin-bottom: 6px;
}
.type-card p {
font-size: 13px;
margin-bottom: 8px !important;
opacity: 0.6;
}
.type-example {
font-family: 'Playfair Display', serif;
font-size: 15px;
color: var(--text-primary);
}
.type-example em { color: var(--gold-light); font-style: italic; }
.type-example span {
font-size: 12px;
opacity: 0.5;
font-family: 'DM Sans', sans-serif;
margin-left: 6px;
}
.tips-list {
list-style: none;
display: flex;
flex-direction: column;
gap: 10px;
margin-top: 10px;
}
.tips-list li {
font-size: 14px;
color: var(--text-primary);
opacity: 0.8;
line-height: 1.6;
padding-left: 20px;
position: relative;
}
.tips-list li::before {
content: '›';
position: absolute;
left: 0;
color: var(--gold);
font-size: 18px;
line-height: 1.3;
}
.tips-list li strong { color: var(--gold-light); font-weight: 500; }
.tips-list li em { color: var(--blue); font-style: italic; }
.modal-footer {
padding: 0 40px 32px;
}
@media (max-width: 500px) {
.modal-header, .modal-body, .modal-footer { padding-left: 24px; padding-right: 24px; }
.gt-header, .gt-row { font-size: 11px; padding: 9px 12px; }
}
</style>
</head>
<body>
<header>
<div class="label">Language Learning</div>
<h1>Les <em>Animaux</em></h1>
<div class="divider"></div>
<button class="info-btn" onclick="openModal()" aria-label="Guide to French animal nouns">
<span class="info-icon">?</span> Guide to French animal nouns
</button>
</header>
<!-- INFO MODAL -->
<div class="modal-overlay" id="modalOverlay" onclick="closeModalOutside(event)">
<div class="modal" id="modal" role="dialog" aria-modal="true" aria-labelledby="modalTitle">
<button class="modal-close" onclick="closeModal()" aria-label="Close">✕</button>
<div class="modal-header">
<div class="modal-eyebrow">Grammar Guide</div>
<h2 class="modal-title" id="modalTitle">Les <em>Animaux</em></h2>
<p class="modal-subtitle">Animal Nouns in French</p>
</div>
<div class="modal-body">
<div class="modal-section">
<h3>Gender matters</h3>
<p>Every French noun has a grammatical gender — <strong>masculine</strong> or <strong>feminine</strong>. Animal nouns are no different. The article (<em>le, la, un, une</em>) changes to match, and so do any adjectives that describe the animal.</p>
<p>Some animals have separate masculine and feminine forms depending on the sex of the animal. Others use the same word for both.</p>
<div class="gender-table">
<div class="gt-header"><span>Animal</span><span>Masculine</span><span>Feminine</span><span>English</span></div>
<div class="gt-row"><span>dog</span><span class="masc">le chien</span><span class="fem">la chienne</span><span>dog / female dog</span></div>
<div class="gt-row"><span>cat</span><span class="masc">le chat</span><span class="fem">la chatte</span><span>cat / female cat</span></div>
<div class="gt-row"><span>horse</span><span class="masc">le cheval</span><span class="fem">la jument</span><span>horse / mare</span></div>
<div class="gt-row"><span>lion</span><span class="masc">le lion</span><span class="fem">la lionne</span><span>lion / lioness</span></div>
<div class="gt-row"><span>duck</span><span class="masc">le canard</span><span class="fem">la cane</span><span>duck / female duck</span></div>
</div>
</div>
<div class="modal-section">
<h3>Key article rules</h3>
<div class="type-cards">
<div class="type-card">
<div class="type-label">① Definite articles (the)</div>
<p>Use <strong>le</strong> for masculine, <strong>la</strong> for feminine, <strong>l'</strong> before a vowel, <strong>les</strong> for plural.</p>
<div class="type-example"><em>le chien, la vache, l'aigle, les chevaux</em><span>— the dog, the cow, the eagle, the horses</span></div>
</div>
<div class="type-card">
<div class="type-label">② Indefinite articles (a / some)</div>
<p>Use <strong>un</strong> for masculine, <strong>une</strong> for feminine, <strong>des</strong> for plural.</p>
<div class="type-example"><em>un chat, une souris, des oiseaux</em><span>— a cat, a mouse, some birds</span></div>
</div>
<div class="type-card">
<div class="type-label">③ Irregular plurals</div>
<p>Watch out for nouns ending in <strong>-al</strong> — their plural is <strong>-aux</strong>, not -als.</p>
<div class="type-example"><em>un cheval → des chevaux</em><span>— a horse → horses</span></div>
</div>
</div>
</div>
<div class="modal-section">
<h3>Useful tips</h3>
<ul class="tips-list">
<li>Always learn an animal noun <strong>with its article</strong> — say <em>le chien</em>, not just <em>chien</em>. The article tells you the gender.</li>
<li>The word <strong>animal</strong> itself is masculine: <em>un animal, des animaux</em>.</li>
<li>Animal sounds (onomatopoeia) differ in French: dogs say <em>ouaf ouaf</em>, cats say <em>miaou</em>, cows say <em>meuh</em>.</li>
<li>Many animal names double as insults or terms of endearment in French — context is everything!</li>
<li>The verb <strong>avoir</strong> is commonly used: <em>Elle a un chien.</em> The verb <strong>être</strong> is used to describe: <em>Il est grand comme un éléphant.</em></li>
</ul>
</div>
</div>
<div class="modal-footer">
<button class="btn btn-flip" onclick="closeModal()" style="max-width:100%;width:100%;justify-content:center;">Got it — start learning!</button>
</div>
</div>
</div>
<div class="progress-wrap">
<div class="progress-info">
<span id="progressText">Card 1 of 50</span>
<span class="score" id="scoreText">✓ 0 ✗ 0</span>
</div>
<div class="progress-bar-bg">
<div class="progress-bar-fill" id="progressFill" style="width:2%"></div>
</div>
</div>
<div class="mode-tabs">
<button class="mode-tab active" onclick="setMode('flashcard')">Flashcards</button>
<button class="mode-tab" onclick="setMode('quiz')">Quiz</button>
</div>
<div class="stats-row">
<div class="stat-pill"><div class="stat-dot dot-correct"></div><span id="correctCount">0 correct</span></div>
<div class="stat-pill"><div class="stat-dot dot-wrong"></div><span id="wrongCount">0 incorrect</span></div>
<div class="stat-pill"><div class="stat-dot dot-remaining"></div><span id="remainingCount">50 left</span></div>
</div>
<!-- FLASHCARD MODE -->
<div class="card-stage" id="flashcardMode">
<div class="card-wrapper" id="cardWrapper" onclick="flipCard()">
<div class="card-face card-front">
<div class="card-tag">French — Tap to reveal</div>
<div class="card-main-text" id="frenchText"></div>
<div class="card-sub-text" id="verbHint"></div>
<div class="card-flip-hint">↺ flip</div>
</div>
<div class="card-face card-back">
<div class="example-label">Translation</div>
<div class="translation-big" id="englishText"></div>
<div class="card-sub-text" id="notesText"></div>
</div>
</div>
</div>
<div class="card-nav" id="cardNav">
<button class="nav-btn" onclick="prevCard()">←</button>
<div class="card-counter"><span id="cardNum">1</span> / 50</div>
<button class="nav-btn" onclick="nextCard()">→</button>
</div>
<div class="controls" id="flashControls">
<div class="flip-control" id="flipControl">
<button class="btn btn-flip" onclick="flipCard()">Flip Card</button>
<button class="btn btn-shuffle" onclick="shuffleCards()">⇌ Shuffle</button>
</div>
<div class="answer-controls" id="answerControls">
<button class="btn btn-wrong" onclick="markAnswer(false)">✗ Didn't know</button>
<button class="btn btn-correct" onclick="markAnswer(true)">✓ Got it!</button>
</div>
</div>
<!-- QUIZ MODE -->
<div class="quiz-area" id="quizMode">
<div class="quiz-question-card">
<div class="quiz-q-label">Translate to English</div>
<div class="quiz-q-text" id="quizQuestion"></div>
</div>
<div class="quiz-options" id="quizOptions"></div>
<div class="quiz-feedback" id="quizFeedback"></div>
<button class="btn btn-next" id="nextBtn" onclick="nextQuiz()">Next Question →</button>
</div>
<!-- COMPLETION -->
<div class="completion" id="completion">
<div class="completion-icon">🐾</div>
<h2>Très bien !</h2>
<p>You've completed all 50 cards</p>
<div class="completion-score" id="finalScore"></div>
<p id="finalMsg"></p>
<button class="btn btn-restart" onclick="restart()">↺ Start Over</button>
</div>
<footer>50 animal noun sentences · French Learning</footer>
<script>
const cards = [
{ fr: "Le chien court dans le jardin.", en: "The dog runs in the garden.", noun: "le chien", notes: "pets / farm" },
{ fr: "La chatte dort sur le canapé.", en: "The female cat sleeps on the sofa.", noun: "la chatte", notes: "pets" },
{ fr: "Il y a un cheval dans le champ.", en: "There is a horse in the field.", noun: "un cheval", notes: "farm animals" },
{ fr: "Les oiseaux chantent le matin.", en: "The birds sing in the morning.", noun: "les oiseaux", notes: "wildlife" },
{ fr: "La vache mange de l'herbe.", en: "The cow eats grass.", noun: "la vache", notes: "farm animals" },
{ fr: "Un lapin saute dans le pré.", en: "A rabbit jumps in the meadow.", noun: "un lapin", notes: "wildlife / pets" },
{ fr: "Le lion rugit dans la savane.", en: "The lion roars in the savannah.", noun: "le lion", notes: "wild animals" },
{ fr: "Les poissons nagent dans la rivière.", en: "The fish swim in the river.", noun: "les poissons", notes: "aquatic" },
{ fr: "L'éléphant est le plus grand animal de la savane.", en: "The elephant is the largest animal in the savannah.", noun: "l'éléphant", notes: "wild animals" },
{ fr: "Un serpent glisse entre les rochers.", en: "A snake slides between the rocks.", noun: "un serpent", notes: "reptiles" },
{ fr: "La grenouille saute dans l'étang.", en: "The frog jumps into the pond.", noun: "la grenouille", notes: "amphibians" },
{ fr: "Le cochon se roule dans la boue.", en: "The pig rolls in the mud.", noun: "le cochon", notes: "farm animals" },
{ fr: "Les moutons broutent dans le pré.", en: "The sheep graze in the meadow.", noun: "les moutons", notes: "farm animals" },
{ fr: "L'aigle vole haut dans le ciel.", en: "The eagle flies high in the sky.", noun: "l'aigle", notes: "birds of prey" },
{ fr: "La souris se cache dans le mur.", en: "The mouse hides in the wall.", noun: "la souris", notes: "small animals" },
{ fr: "Un ours cherche de la nourriture en forêt.", en: "A bear looks for food in the forest.", noun: "un ours", notes: "wild animals" },
{ fr: "Le renard est un animal rusé.", en: "The fox is a cunning animal.", noun: "le renard", notes: "wildlife" },
{ fr: "La baleine est le plus grand mammifère marin.", en: "The whale is the largest marine mammal.", noun: "la baleine", notes: "aquatic mammals" },
{ fr: "Le singe grimpe aux arbres.", en: "The monkey climbs trees.", noun: "le singe", notes: "primates" },
{ fr: "Un dauphin saute hors de l'eau.", en: "A dolphin jumps out of the water.", noun: "un dauphin", notes: "aquatic mammals" },
{ fr: "La poule pond un œuf chaque matin.", en: "The hen lays an egg every morning.", noun: "la poule", notes: "farm animals" },
{ fr: "Le canard nage sur le lac.", en: "The duck swims on the lake.", noun: "le canard", notes: "birds" },
{ fr: "Les abeilles font du miel.", en: "The bees make honey.", noun: "les abeilles", notes: "insects" },
{ fr: "Un papillon se pose sur la fleur.", en: "A butterfly lands on the flower.", noun: "un papillon", notes: "insects" },
{ fr: "Le loup hurle à la lune.", en: "The wolf howls at the moon.", noun: "le loup", notes: "wildlife" },
{ fr: "La girafe mange les feuilles des grands arbres.", en: "The giraffe eats the leaves of tall trees.", noun: "la girafe", notes: "wild animals" },
{ fr: "Un crocodile se repose au bord de la rivière.", en: "A crocodile rests at the edge of the river.", noun: "un crocodile", notes: "reptiles" },
{ fr: "Le zèbre a des rayures noires et blanches.", en: "The zebra has black and white stripes.", noun: "le zèbre", notes: "wild animals" },
{ fr: "La tortue marche lentement sur le sable.", en: "The tortoise walks slowly on the sand.", noun: "la tortue", notes: "reptiles" },
{ fr: "Les fourmis travaillent sans arrêt.", en: "The ants work non-stop.", noun: "les fourmis", notes: "insects" },
{ fr: "Le perroquet répète tout ce qu'on lui dit.", en: "The parrot repeats everything it is told.", noun: "le perroquet", notes: "birds / pets" },
{ fr: "Une araignée tisse sa toile dans le coin.", en: "A spider weaves its web in the corner.", noun: "une araignée", notes: "arachnids" },
{ fr: "Le tigre chasse la nuit.", en: "The tiger hunts at night.", noun: "le tigre", notes: "wild animals" },
{ fr: "La panthère noire est très rapide.", en: "The black panther is very fast.", noun: "la panthère", notes: "wild animals" },
{ fr: "Un rhinocéros charge à toute vitesse.", en: "A rhinoceros charges at full speed.", noun: "un rhinocéros", notes: "wild animals" },
{ fr: "La cigogne fait son nid sur les toits.", en: "The stork builds its nest on the rooftops.", noun: "la cigogne", notes: "birds" },
{ fr: "Le hibou chasse les souris la nuit.", en: "The owl hunts mice at night.", noun: "le hibou", notes: "birds / nocturnal" },
{ fr: "Un écureuil ramasse des glands en automne.", en: "A squirrel collects acorns in autumn.", noun: "un écureuil", notes: "wildlife" },
{ fr: "La chèvre grimpe sur les rochers.", en: "The goat climbs on the rocks.", noun: "la chèvre", notes: "farm animals" },
{ fr: "Le chameau traverse le désert.", en: "The camel crosses the desert.", noun: "le chameau", notes: "desert animals" },
{ fr: "Un pingouin glisse sur la glace.", en: "A penguin slides on the ice.", noun: "un pingouin", notes: "polar animals" },
{ fr: "La loutre joue dans l'eau.", en: "The otter plays in the water.", noun: "la loutre", notes: "aquatic mammals" },
{ fr: "Le hérisson se roule en boule.", en: "The hedgehog curls into a ball.", noun: "le hérisson", notes: "small animals" },
{ fr: "Une chauve-souris sort à la tombée de la nuit.", en: "A bat comes out at nightfall.", noun: "une chauve-souris", notes: "nocturnal" },
{ fr: "Le paon fait la roue pour séduire.", en: "The peacock fans its tail to attract a mate.", noun: "le paon", notes: "birds" },
{ fr: "La baleine bleue peut mesurer trente mètres.", en: "The blue whale can measure thirty metres.", noun: "la baleine bleue", notes: "aquatic mammals" },
{ fr: "Un poulpe change de couleur pour se camoufler.", en: "An octopus changes colour to camouflage itself.", noun: "un poulpe", notes: "aquatic / molluscs" },
{ fr: "Le corbeau est un oiseau très intelligent.", en: "The crow is a very intelligent bird.", noun: "le corbeau", notes: "birds" },
{ fr: "La pieuvre attrape ses proies avec ses tentacules.", en: "The octopus catches its prey with its tentacles.", noun: "la pieuvre", notes: "aquatic" },
{ fr: "Un cerf traverse la forêt au crépuscule.", en: "A deer crosses the forest at dusk.", noun: "un cerf", notes: "wildlife" }
];
let currentIndex = 0;
let isFlipped = false;
let correctCount = 0;
let wrongCount = 0;
let mode = 'flashcard';
let shuffled = [...cards];
let quizIndex = 0;
let quizAnswered = false;
function setMode(m) {
mode = m;
document.querySelectorAll('.mode-tab').forEach((t,i) => {
t.classList.toggle('active', (i===0 && m==='flashcard') || (i===1 && m==='quiz'));
});
document.getElementById('flashcardMode').style.display = m==='flashcard' ? 'block' : 'none';
document.getElementById('cardNav').style.display = m==='flashcard' ? 'flex' : 'none';
document.getElementById('flashControls').style.display = m==='flashcard' ? 'flex' : 'none';
document.getElementById('quizMode').classList.toggle('active', m==='quiz');
if (m==='quiz') { quizIndex = 0; loadQuiz(); }
else { loadCard(); }
}
function loadCard() {
if (currentIndex >= shuffled.length) { showCompletion(); return; }
const card = shuffled[currentIndex];
document.getElementById('frenchText').textContent = card.fr;
document.getElementById('verbHint').textContent = `Noun: ${card.noun}`;
// Highlight the animal noun in the English translation
const nounWord = card.noun.replace(/^(le |la |l'|les |un |une |des )/, '').split(' ')[0];
document.getElementById('englishText').innerHTML = card.en.replace(
new RegExp(nounWord, 'i'),
m => `<span class="noun-highlight">${m}</span>`
);
document.getElementById('notesText').textContent = card.notes;
document.getElementById('cardNum').textContent = currentIndex + 1;
updateProgress();
isFlipped = false;
document.getElementById('cardWrapper').classList.remove('flipped');
document.getElementById('answerControls').classList.remove('visible');
document.getElementById('flipControl').style.display = 'flex';
}
function flipCard() {
isFlipped = !isFlipped;
document.getElementById('cardWrapper').classList.toggle('flipped', isFlipped);
if (isFlipped) {
document.getElementById('answerControls').classList.add('visible');
document.getElementById('flipControl').style.display = 'none';
} else {
document.getElementById('answerControls').classList.remove('visible');
document.getElementById('flipControl').style.display = 'flex';
}
}
function markAnswer(correct) {
if (correct) correctCount++; else wrongCount++;
updateStats();
currentIndex++;
loadCard();
}
function nextCard() {
if (currentIndex < shuffled.length - 1) { currentIndex++; isFlipped = false; loadCard(); }
}
function prevCard() {
if (currentIndex > 0) { currentIndex--; isFlipped = false; loadCard(); }
}
function shuffleCards() {
shuffled = [...cards].sort(() => Math.random() - 0.5);
currentIndex = 0; correctCount = 0; wrongCount = 0;
updateStats(); loadCard();
}
function updateProgress() {
const pct = Math.max(2, ((currentIndex) / shuffled.length) * 100);
document.getElementById('progressFill').style.width = pct + '%';
document.getElementById('progressText').textContent = `Card ${Math.min(currentIndex+1, shuffled.length)} of ${shuffled.length}`;
}
function updateStats() {
document.getElementById('correctCount').textContent = `${correctCount} correct`;
document.getElementById('wrongCount').textContent = `${wrongCount} incorrect`;
document.getElementById('remainingCount').textContent = `${Math.max(0, shuffled.length - currentIndex)} left`;
document.getElementById('scoreText').textContent = `✓ ${correctCount} ✗ ${wrongCount}`;
}
let quizDeck = [];
function loadQuiz() {
quizDeck = [...cards].sort(() => Math.random() - 0.5);
quizIndex = 0; correctCount = 0; wrongCount = 0;
showQuizQuestion();
}
function showQuizQuestion() {
if (quizIndex >= quizDeck.length) { showCompletion(); return; }
const card = quizDeck[quizIndex];
document.getElementById('quizQuestion').textContent = card.fr;
document.getElementById('quizFeedback').textContent = '';
document.getElementById('quizFeedback').className = 'quiz-feedback';
document.getElementById('nextBtn').classList.remove('visible');
let wrongOptions = cards.filter(c => c.en !== card.en).sort(() => Math.random() - 0.5).slice(0,3).map(c=>c.en);
let options = [...wrongOptions, card.en].sort(() => Math.random() - 0.5);
const container = document.getElementById('quizOptions');
container.innerHTML = '';
options.forEach(opt => {
const btn = document.createElement('button');
btn.className = 'quiz-option';
btn.textContent = opt;
btn.onclick = () => selectQuizAnswer(btn, opt, card.en);
container.appendChild(btn);
});
document.getElementById('cardNum').textContent = quizIndex + 1;
document.getElementById('progressText').textContent = `Question ${quizIndex+1} of ${quizDeck.length}`;
document.getElementById('progressFill').style.width = Math.max(2, (quizIndex/quizDeck.length)*100) + '%';
}
function selectQuizAnswer(btn, chosen, correct) {
if (quizAnswered) return;
quizAnswered = true;
document.querySelectorAll('.quiz-option').forEach(b => {
b.disabled = true;
if (b.textContent === correct) b.classList.add('correct');
});
const fb = document.getElementById('quizFeedback');
if (chosen === correct) {
btn.classList.add('correct');
fb.textContent = '✓ Correct — très bien !';
fb.className = 'quiz-feedback correct';
correctCount++;
} else {
btn.classList.add('wrong');
fb.textContent = '✗ Not quite — the correct answer is highlighted.';
fb.className = 'quiz-feedback wrong';
wrongCount++;
}
updateStats();
document.getElementById('nextBtn').classList.add('visible');
quizAnswered = false;
}
function nextQuiz() {
quizIndex++;
showQuizQuestion();
}
function showCompletion() {
document.getElementById('flashcardMode').style.display = 'none';
document.getElementById('cardNav').style.display = 'none';
document.getElementById('flashControls').style.display = 'none';
document.getElementById('quizMode').classList.remove('active');
const comp = document.getElementById('completion');
comp.classList.add('visible');
const total = correctCount + wrongCount;
const pct = total > 0 ? Math.round((correctCount/total)*100) : 0;
document.getElementById('finalScore').textContent = pct + '%';
const msg = pct >= 90 ? 'Excellent ! You know your animals !' :
pct >= 70 ? 'Bien ! Keep practising the trickier ones.' :
pct >= 50 ? 'Pas mal. A bit more revision will help.' : 'Keep going — practice makes perfect!';
document.getElementById('finalMsg').textContent = msg;
}
function restart() {
currentIndex = 0; quizIndex = 0; correctCount = 0; wrongCount = 0;
shuffled = [...cards]; quizAnswered = false;
document.getElementById('completion').classList.remove('visible');
updateStats();
if (mode === 'flashcard') {
document.getElementById('flashcardMode').style.display = 'block';
document.getElementById('cardNav').style.display = 'flex';
document.getElementById('flashControls').style.display = 'flex';
loadCard();
} else {
document.getElementById('quizMode').classList.add('active');
loadQuiz();
}
}
document.addEventListener('keydown', e => {
if (e.key === 'Escape') { closeModal(); return; }
if (mode !== 'flashcard') return;
if (e.key === 'ArrowRight' || e.key === ' ') { e.preventDefault(); isFlipped ? markAnswer(true) : flipCard(); }
if (e.key === 'ArrowLeft') { e.preventDefault(); isFlipped ? markAnswer(false) : prevCard(); }
if (e.key === 'ArrowUp') flipCard();
});
function openModal() {
document.getElementById('modalOverlay').classList.add('open');
document.body.style.overflow = 'hidden';
}
function closeModal() {
document.getElementById('modalOverlay').classList.remove('open');
document.body.style.overflow = '';
}
function closeModalOutside(e) {
if (e.target === document.getElementById('modalOverlay')) closeModal();
}
loadCard();
updateStats();
</script>
</body>
</html>