v2 — catégories (imagier), espace parents protégé, perso prénom enfant, mode guidé

This commit is contained in:
Poulpe
2026-06-17 16:04:22 +00:00
parent 379aaac74d
commit 17d64c3561
4 changed files with 537 additions and 358 deletions

767
game.js

File diff suppressed because it is too large Load Diff

View File

@@ -18,17 +18,26 @@
<div id="start" class="screen">
<div class="start-card">
<h1 class="title">✨ Lettres&nbsp;Magiques ✨</h1>
<p class="subtitle">Écris les prénoms de la famille&nbsp;!</p>
<p class="subtitle" id="start-sub">Apprends à écrire en t'amusant&nbsp;!</p>
<button id="btn-play" class="big-btn">🎮 Jouer</button>
<p class="hint-line">🔊 Le son aide les petits — laisse-le activé.</p>
<button id="btn-parents" class="text-btn">⚙️ Espace parents</button>
</div>
</div>
<!-- Menu de catégories -->
<div id="menu" class="screen hidden">
<div class="menu-card">
<h2 class="menu-title">Choisis un jeu&nbsp;!</h2>
<div id="cat-grid" class="cat-grid"></div>
<button id="btn-parents-menu" class="text-btn">⚙️ Espace parents</button>
</div>
</div>
<!-- Interface de jeu -->
<div id="hud" class="hud hidden">
<div class="hud-left">
<button id="btn-home" class="icon-btn" title="Menu">🏠</button>
<div class="badge"><span id="score">0</span></div>
<div class="badge">🚀 Niv. <span id="level">1</span></div>
<div class="badge">🏅 <span id="stickers-count">0</span>/15</div>
</div>
<div class="hud-right">
@@ -37,10 +46,13 @@
</div>
</div>
<!-- Indice imagier (grande image du mot à écrire) -->
<div id="clue" class="clue hidden"></div>
<!-- Mot en cours -->
<div id="word-zone" class="word-zone hidden"></div>
<!-- Liste des mots à trouver (aide permanente) -->
<!-- Liste des mots à trouver -->
<div id="word-list" class="word-list hidden"></div>
<!-- Clavier tactile -->
@@ -66,10 +78,15 @@
<div class="drawer-card">
<h2>🏅 Mes autocollants</h2>
<div id="sticker-grid" class="sticker-grid"></div>
<button id="btn-close-stickers" class="big-btn small">Fermer</button>
<button class="big-btn small" data-close-drawer>Fermer</button>
</div>
</div>
<!-- Espace parents (protégé) -->
<div id="parent" class="drawer hidden">
<div class="drawer-card parent-card" id="parent-body"></div>
</div>
<script src="game.js"></script>
</body>
</html>

View File

@@ -119,7 +119,7 @@ html, body {
/* ---------- Mot en cours ---------- */
.word-zone {
position: fixed;
top: 16vh;
top: 22vh;
left: 0; right: 0;
z-index: 10;
display: flex;
@@ -302,3 +302,100 @@ html, body {
.key { max-width: 56px; }
.speech { font-size: 16px; }
}
/* ---------- Bouton texte (accueil) ---------- */
.text-btn {
display: block;
margin: 18px auto 0;
background: none;
border: none;
color: #6a5cff;
font: inherit;
font-weight: 700;
font-size: 15px;
cursor: pointer;
opacity: .8;
}
.text-btn:active { transform: scale(.96); }
/* ---------- Menu de catégories ---------- */
.menu-card {
background: rgba(255,255,255,0.94);
border-radius: var(--radius);
padding: 26px 22px;
max-width: 540px;
width: 100%;
box-shadow: 0 18px 60px rgba(0,0,0,0.35);
animation: pop .4s ease;
}
.menu-title { text-align: center; margin: 0 0 18px; font-size: clamp(22px, 6vw, 30px); color: var(--ink); }
.cat-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 14px; }
.cat-card {
border: none;
border-radius: 18px;
padding: 20px 12px;
cursor: pointer;
font: inherit;
color: #fff;
display: flex; flex-direction: column; align-items: center; gap: 8px;
background: linear-gradient(135deg, var(--purple), var(--pink));
box-shadow: 0 8px 0 rgba(0,0,0,0.15), 0 12px 22px rgba(106,92,255,0.35);
transition: transform .08s ease, box-shadow .08s ease;
}
.cat-card:nth-child(4n+2) { background: linear-gradient(135deg, #2ee6e6, #6a5cff); }
.cat-card:nth-child(4n+3) { background: linear-gradient(135deg, #3ddc84, #2ee6e6); }
.cat-card:nth-child(4n+4) { background: linear-gradient(135deg, #ff8c42, #ff6bcb); }
.cat-card:active { transform: translateY(5px); box-shadow: 0 3px 0 rgba(0,0,0,0.15); }
.cat-emoji { font-size: clamp(40px, 12vw, 60px); line-height: 1; }
.cat-label { font-weight: 800; font-size: clamp(15px, 4vw, 19px); }
/* ---------- Indice imagier (grande image) ---------- */
.clue {
position: fixed;
top: 6vh; left: 0; right: 0;
z-index: 9;
text-align: center;
font-size: clamp(52px, 17vw, 120px);
line-height: 1;
pointer-events: none;
filter: drop-shadow(0 8px 14px rgba(0,0,0,0.3));
animation: bounceIn .4s ease;
}
/* ---------- Lettre guidée ---------- */
.key.guide {
animation: guidePulse .8s ease infinite;
outline: 4px solid #fff;
outline-offset: -2px;
z-index: 1;
}
@keyframes guidePulse { 0%,100% { transform: scale(1); filter: brightness(1); } 50% { transform: scale(1.12); filter: brightness(1.35); } }
/* ---------- Espace parents ---------- */
.parent-card { max-width: 560px; width: 100%; max-height: 88vh; overflow-y: auto; text-align: left; }
.parent-card h2 { margin: 0 0 14px; text-align: center; }
.gate-q { font-size: 18px; text-align: center; margin: 10px 0; }
.field {
width: 100%;
border: 2px solid #ded7ff;
border-radius: 12px;
padding: 10px 12px;
font: inherit;
font-size: 16px;
margin-bottom: 10px;
background: #fbfaff;
}
.field:focus { outline: none; border-color: var(--purple); }
.field-label { display: block; font-weight: 700; margin: 6px 0 4px; font-size: 14px; }
.check { display: flex; align-items: center; gap: 8px; font-size: 14px; margin: 8px 0 14px; cursor: pointer; }
.check input { width: 20px; height: 20px; }
.cat-edit { border: 1px solid #eee; border-radius: 14px; padding: 12px; margin-bottom: 12px; background: #faf9ff; }
.cat-edit-head { margin-bottom: 8px; }
.word-row { display: flex; gap: 6px; margin-bottom: 6px; align-items: center; }
.word-row .w-name { flex: 0 0 32%; margin: 0; text-transform: uppercase; }
.word-row .w-clue { flex: 1; margin: 0; }
.word-row .del { border: none; background: #ffe1e8; border-radius: 10px; width: 38px; height: 38px; cursor: pointer; font-size: 16px; flex: 0 0 auto; }
.add-word { border: none; background: #e9e4ff; color: var(--purple); font: inherit; font-weight: 700; border-radius: 10px; padding: 8px 12px; cursor: pointer; }
.row-btns { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; margin-top: 14px; }
.sticky-save { position: sticky; bottom: -22px; background: linear-gradient(180deg, rgba(255,255,255,0), #fff 30%); padding-top: 12px; padding-bottom: 4px; }
.big-btn.ghost { background: #efeefb; color: var(--ink); box-shadow: 0 6px 0 rgba(0,0,0,0.08); }

2
sw.js
View File

@@ -1,5 +1,5 @@
/* Service worker — network-first (frais en ligne, cache en secours hors-ligne) */
const CACHE = "lettres-magiques-v2";
const CACHE = "lettres-magiques-v3";
const ASSETS = [
".",
"index.html",