<!DOCTYPE html>
<html lang="fr">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>EVERLIFE</title>
<link rel="stylesheet" href="https://unpkg.com/leaflet@1.9.4/dist/leaflet.css">
<style>
* { box-sizing:border-box; }
body {
margin:0;
font-family:Arial,sans-serif;
color:white;
}
.ecran {
display:none;
min-height:100vh;
width:100%;
padding:25px;
flex-direction:column;
justify-content:center;
align-items:center;
text-align:center;
background:linear-gradient(to bottom,#ffbd91,#ed8c83,#304766);
}
#accueil {display:flex;}
h1 {font-size:60px;letter-spacing:9px;}
h2 {font-size:27px;}
input {
width:90%;
max-width:320px;
padding:15px;
margin:8px;
border:0;
border-radius:12px;
font-size:16px;
}
button {
padding:15px 22px;
margin:8px;
border:2px solid white;
border-radius:30px;
background:white;
color:#304766;
font-weight:bold;
cursor:pointer;
}
.message {min-height:22px;}
#monde {
justify-content:flex-start;
overflow-y:auto;
}
#carte {
width:100%;
max-width:900px;
height:42vh;
min-height:280px;
border-radius:15px;
margin:15px 0;
z-index:1;
}
#zoneVille {
display:none;
width:100%;
max-width:850px;
padding:15px;
background:#ffffff22;
border-radius:18px;
margin:15px 0;
}
#villes {
display:flex;
flex-wrap:wrap;
justify-content:center;
gap:5px;
}
#villes button {
background:#304766;
color:white;
border:1px solid white;
}
#villePersonnalisee {
display:none;
}
#boutonVille {
display:none;
}
/* MATERNITÉ */
#maternite {
display:none;
padding:0;
min-height:100vh;
height:100vh;
width:100%;
overflow:hidden;
position:relative;
background:#dce4e9;
}
#sceneHopital {
position:absolute;
inset:0;
overflow:hidden;
background:
linear-gradient(to bottom,#dce8ee 0%,#e8edf0 55%,#c7d2d9 100%);
}
/* Décor de la chambre */
.fenetre {
position:absolute;
top:7%;
left:7%;
width:25%;
height:25%;
background:linear-gradient(135deg,#b8d8e8,#eaf4f8);
border:9px solid #f9fbfc;
box-shadow:0 4px 15px #53657533;
}
.fenetre:before {
content:"";
position:absolute;
left:50%;
top:0;
width:5px;
height:100%;
background:#f9fbfc;
}
.fenetre:after {
content:"";
position:absolute;
top:50%;
left:0;
width:100%;
height:5px;
background:#f9fbfc;
}
.lumiere {
position:absolute;
top:0;
left:0;
width:100%;
height:15%;
background:#ffffff;
opacity:.45;
}
.mur {
position:absolute;
top:0;
right:0;
width:25%;
height:45%;
background:#d3dfe5;
border-left:4px solid #c0cdd5;
}
.lampe {
position:absolute;
top:5%;
right:8%;
width:55px;
height:9px;
border-radius:10px;
background:#fdf8dc;
box-shadow:0 0 30px #fff3b5;
}
/* Les trois adultes */
.personnage {
position:absolute;
bottom:25%;
display:flex;
flex-direction:column;
align-items:center;
width:27%;
}
.pere {left:5%;}
.medecin {left:36%;}
.infirmiere {right:5%;}
.tete {
width:clamp(75px,15vw,125px);
height:clamp(85px,17vw,140px);
border-radius:48% 48% 43% 43%;
background:#a87960;
position:relative;
box-shadow:0 5px 12px #42515b33;
}
.cheveux {
position:absolute;
top:-8px;
left:0;
width:100%;
height:35%;
border-radius:50% 50% 15% 15%;
background:#29201e;
}
.masque {
position:absolute;
top:48%;
left:13%;
width:74%;
height:30%;
border-radius:12px 12px 18px 18px;
background:#f6f8f8;
border:1px solid #c7d0d4;
}
.masque:before,
.masque:after {
content:"";
position:absolute;
top:30%;
width:17px;
height:25px;
border-top:2px solid #f6f8f8;
}
.masque:before {
left:-15px;
transform:rotate(-25deg);
}
.masque:after {
right:-15px;
transform:rotate(25deg);
}
.corps {
width:100%;
height:clamp(115px,23vh,190px);
border-radius:35px 35px 8px 8px;
margin-top:5px;
box-shadow:0 5px 12px #42515b22;
}
.pere .corps {background:#34495c;}
.medecin .corps {background:#ffffff;}
.infirmiere .corps {background:#77aaa8;}
.pere .tete {background:#79553f;}
.medecin .tete {background:#d5a889;}
.infirmiere .tete {background:#a87960;}
.medecin .masque,
.infirmiere .masque {background:#f7fafb;}
/* Vue depuis le lit */
.lit {
position:absolute;
bottom:-12%;
left:-10%;
width:120%;
height:35%;
background:linear-gradient(to bottom,#f4f1ed,#d9dfe3);
border-radius:50% 50% 0 0;
box-shadow:0 -10px 30px #66778433;
}
.jambes {
position:absolute;
bottom:5%;
left:10%;
width:80%;
height:22%;
display:flex;
justify-content:space-around;
align-items:center;
}
.jambe {
width:35%;
height:100%;
background:linear-gradient(to bottom,#b98268,#d6a58e);
border-radius:50% 50% 30% 30%;
transform:rotate(-4deg);
box-shadow:0 4px 12px #5b403733;
}
.jambe:last-child {
transform:rotate(4deg);
}
/* Chargement */
#chargement {
position:absolute;
bottom:22px;
left:0;
width:100%;
text-align:center;
color:#ffffff;
font-size:18px;
font-weight:bold;
text-shadow:0 2px 5px #263747;
letter-spacing:1px;
transition:opacity 1s;
}
.points span {
display:inline-block;
animation:monter 1s infinite;
}
.points span:nth-child(2) {animation-delay:.2s;}
.points span:nth-child(3) {animation-delay:.4s;}
@keyframes monter {
0%,60%,100% {transform:translateY(0);opacity:.4;}
30% {transform:translateY(-6px);opacity:1;}
}
@media (orientation:landscape) {
.personnage {bottom:23%;width:23%;}
.pere {left:8%;}
.medecin {left:38.5%;}
.infirmiere {right:8%;}
.corps {height:27vh;}
.tete {width:95px;height:105px;}
.lit {height:32%;}
.jambes {height:20%;}
}
</style>
</head>
<body>
<section class="ecran" id="accueil">
<h1>EVERLIFE</h1>
<p>Bienvenue dans un monde de possibilités.</p>
<button onclick="ouvrir('comptes')">COMMENCER À JOUER</button>
</section>
<section class="ecran" id="comptes">
<h2>Bienvenue sur EVERLIFE</h2>
<button onclick="ouvrir('creation')">CRÉER UN COMPTE</button>
<button onclick="ouvrir('connexion')">SE CONNECTER</button>
</section>
<section class="ecran" id="creation">
<h2>Créer un compte</h2>
<input id="nouveauPseudo" placeholder="Ton pseudo">
<input id="nouveauMdp" type="password" placeholder="Ton mot de passe">
<p id="erreurCreation" class="message"></p>
<button onclick="creerCompte()">CRÉER MON COMPTE</button>
<button onclick="ouvrir('comptes')">RETOUR</button>
</section>
<section class="ecran" id="connexion">
<h2>Rebonjour !</h2>
<input id="pseudoConnexion" placeholder="Ton pseudo">
<input id="mdpConnexion" type="password" placeholder="Ton mot de passe">
<p id="erreurConnexion" class="message"></p>
<button onclick="seConnecter()">SE CONNECTER</button>
<button onclick="ouvrir('comptes')">RETOUR</button>
</section>
<section class="ecran" id="parties">
<h2 id="salutation">De retour !</h2>
<p>Que souhaites-tu faire ?</p>
<button onclick="ouvrir('prenom')">CRÉER UNE NOUVELLE PARTIE</button>
<button onclick="reprendrePartie()">REPRENDRE L'ANCIENNE PARTIE</button>
</section>
<section class="ecran" id="prenom">
<h2>Ta nouvelle vie commence !</h2>
<p>Quel sera le prénom de ton personnage ?</p>
<input id="prenomPersonnage" placeholder="Prénom">
<p id="erreurPrenom" class="message"></p>
<button onclick="validerPrenom()">SUIVANT</button>
<button onclick="ouvrir('parties')">RETOUR</button>
</section>
<section class="ecran" id="monde">
<h2 id="titreCarte">Choisis ton pays</h2>
<p id="instruction">Clique sur le pays dans lequel tu souhaites vivre.</p>
<div id="carte"></div>
<p id="messageCarte" class="message"></p>
<div id="zoneVille">
<h2>Choisis ta ville</h2>
<p id="nomPays"></p>
<div id="villes"></div>
<p>Ta ville n'est pas dans la liste ?</p>
<input id="villePersonnalisee" placeholder="Écris le nom de ta ville">
<button id="boutonVille" onclick="choisirVillePersonnalisee()">
CHOISIR CETTE VILLE
</button>
</div>
<button onclick="ouvrir('prenom')">RETOUR</button>
</section>
<section class="ecran" id="confirmation">
<h2>Ta nouvelle vie !</h2>
<p id="resume"></p>
<button onclick="commencerMaternite()">CONTINUER</button>
<button onclick="ouvrir('parties')">RETOUR AU MENU</button>
</section>
<!-- SCÈNE DE MATERNITÉ -->
<section id="maternite">
<div id="sceneHopital">
<div class="lumiere"></div>
<div class="fenetre"></div>
<div class="mur"></div>
<div class="lampe"></div>
<!-- Le père -->
<div class="personnage pere">
<div class="tete">
<div class="cheveux"></div>
<div class="masque"></div>
</div>
<div class="corps"></div>
</div>
<!-- Le médecin -->
<div class="personnage medecin">
<div class="tete">
<div class="cheveux"></div>
<div class="masque"></div>
</div>
<div class="corps"></div>
</div>
<!-- L'infirmière -->
<div class="personnage infirmiere">
<div class="tete">
<div class="cheveux"></div>
<div class="masque"></div>
</div>
<div class="corps"></div>
</div>
<!-- Le lit et les jambes de la mère -->
<div class="lit"></div>
<div class="jambes">
<div class="jambe"></div>
<div class="jambe"></div>
</div>
<!-- Chargement animé -->
<div id="chargement">
Chargement<span class="points"><span>.</span><span>.</span><span>.</span></span>
</div>
</div>
</section>
<script src="https://unpkg.com/leaflet@1.9.4/dist/leaflet.js"></script>
<script>
var comptes = {};
var joueur = "";
var prenom = "";
var pays = "";
var carte = null;
var calquePays = null;
var calqueVilles = null;
var villes = {
"senegal":[
["Dakar",14.7167,-17.4677],
["Thiès",14.791,-16.935],
["Saly",14.444,-17.005],
["Saint-Louis",16.0326,-16.4818],
["Touba",14.8667,-15.8833],
["Ziguinchor",12.568,-16.273],
["Kaolack",14.15,-16.07],
["Mbour",14.4167,-16.9667],
["Rufisque",14.7167,-17.2667]
],
"france":[
["Paris",48.8566,2.3522],
["Marseille",43.2965,5.3698],
["Lyon",45.764,4.8357],
["Bordeaux",44.8378,-0.5792],
["Lille",50.6292,3.0573],
["Toulouse",43.6047,1.4442],
["Nice",43.7102,7.262],
["Nantes",47.2184,-1.5536]
],
"mali":[
["Bamako",12.6392,-8.0029],
["Ségou",13.45,-6.2667],
["Sikasso",11.3167,-5.6667],
["Mopti",14.4843,-4.1829],
["Tombouctou",16.7666,-3.0026]
],
"cote divoire":[
["Abidjan",5.36,-4.0083],
["Yamoussoukro",6.8276,-5.2893],
["Bouaké",7.69,-5.03],
["San-Pédro",4.75,-6.64]
],
"maroc":[
["Casablanca",33.5731,-7.5898],
["Rabat",34.0209,-6.8416],
["Marrakech",31.6295,-7.9811],
["Tanger",35.7595,-5.834]
],
"gambie":[
["Banjul",13.4549,-16.579],
["Serekunda",13.4383,-16.6781],
["Brikama",13.2714,-16.6494]
],
"etats unis":[
["New York",40.7128,-74.006],
["Los Angeles",34.0522,-118.2437],
["Miami",25.7617,-80.1918],
["Chicago",41.8781,-87.6298],
["Washington",38.9072,-77.0369]
],
"royaume uni":[
["Londres",51.5072,-0.1276],
["Manchester",53.4808,-2.2426],
["Liverpool",53.4084,-2.9916],
["Birmingham",52.4862,-1.8904]
],
"canada":[
["Montréal",45.5019,-73.5674],
["Toronto",43.6532,-79.3832],
["Vancouver",49.2827,-123.1207],
["Ottawa",45.4215,-75.6972]
]
};
function normaliser(texte) {
return texte.toLowerCase()
.normalize("NFD")
.replace(/[\u0300-\u036f]/g,"")
.replace(/[^a-z ]/g,"")
.trim();
}
function ouvrir(id) {
document.querySelectorAll(".ecran").forEach(function(e) {
e.style.display="none";
});
document.getElementById("maternite").style.display="none";
document.getElementById(id).style.display="flex";
if(id==="monde") {
setTimeout(function() {
initialiserCarte();
if(carte) carte.invalidateSize();
},300);
}
}
function creerCompte() {
var p=document.getElementById("nouveauPseudo").value.trim();
var m=document.getElementById("nouveauMdp").value;
if(!p || !m) {
document.getElementById("erreurCreation").textContent="Remplis les deux champs !";
return;
}
if(comptes[p.toLowerCase()]) {
document.getElementById("erreurCreation").textContent="Ce pseudo existe déjà !";
return;
}
comptes[p.toLowerCase()]={pseudo:p,mdp:m};
document.getElementById("pseudoConnexion").value=p;
document.getElementById("mdpConnexion").value="";
ouvrir("connexion");
}
function seConnecter() {
var p=document.getElementById("pseudoConnexion").value.trim();
var m=document.getElementById("mdpConnexion").value;
var c=comptes[p.toLowerCase()];
if(!c || c.mdp!==m) {
document.getElementById("erreurConnexion").textContent="Identifiants incorrects !";
return;
}
joueur=c.pseudo;
document.getElementById("salutation").textContent="De retour, "+joueur+" !";
ouvrir("parties");
}
function validerPrenom() {
var p=document.getElementById("prenomPersonnage").value.trim();
if(!p) {
document.getElementById("erreurPrenom").textContent="Écris un prénom !";
return;
}
prenom=p;
pays="";
document.getElementById("zoneVille").style.display="none";
document.getElementById("titreCarte").textContent="Choisis ton pays";
document.getElementById("instruction").textContent="Clique sur le pays dans lequel tu souhaites vivre.";
document.getElementById("messageCarte").textContent="";
ouvrir("monde");
}
function initialiserCarte() {
if(carte) return;
if(typeof L==="undefined") {
document.getElementById("messageCarte").textContent="Carte indisponible. Vérifie ta connexion.";
return;
}
carte=L.map("carte").setView([20,0],2);
L.tileLayer("https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png",{
attribution:"© OpenStreetMap"
}).addTo(carte);
fetch("https://raw.githubusercontent.com/datasets/geo-countries/master/data/countries.geojson")
.then(function(r) {
if(!r.ok) throw new Error();
return r.json();
})
.then(function(data) {
calquePays=L.geoJSON(data,{
style:{
color:"#304766",
weight:1,
fillColor:"#edaaa0",
fillOpacity:0.4
},
onEachFeature:function(f,layer) {
var nom=f.properties.ADMIN || f.properties.name || "Pays";
layer.bindTooltip(nom);
layer.on("click",function() {
choisirPays(nom,layer);
});
}
}).addTo(carte);
document.getElementById("messageCarte").textContent="Choisis un pays sur la carte.";
})
.catch(function() {
document.getElementById("messageCarte").textContent="Impossible de charger la carte. Vérifie internet.";
});
}
function choisirPays(nom,layer) {
pays=nom;
if(calquePays) calquePays.resetStyle();
layer.setStyle({
color:"white",
weight:3,
fillColor:"#304766",
fillOpacity:0.65
});
carte.fitBounds(layer.getBounds(),{
padding:[20,20],
maxZoom:6
});
afficherVilles(nom);
}
function afficherVilles(nom) {
var cle=normaliser(nom);
var liste=villes[cle] || [];
if(cle==="the gambia") liste=villes["gambie"];
if(cle==="united states of america" || cle==="united states") liste=villes["etats unis"];
if(cle==="united kingdom") liste=villes["royaume uni"];
if(cle==="ivory coast") liste=villes["cote divoire"];
if(cle==="cote d ivoire") liste=villes["cote divoire"];
document.getElementById("titreCarte").textContent="Choisis ta ville";
document.getElementById("instruction").textContent="Tu as choisi "+nom+". Voici les villes disponibles.";
document.getElementById("nomPays").textContent="Pays : "+nom;
document.getElementById("zoneVille").style.display="block";
var zone=document.getElementById("villes");
zone.innerHTML="";
if(calqueVilles) carte.removeLayer(calqueVilles);
calqueVilles=L.layerGroup().addTo(carte);
liste.forEach(function(v) {
var marqueur=L.marker([v[1],v[2]]).addTo(calqueVilles);
marqueur.bindTooltip(v[0]);
marqueur.on("click",function() {
choisirVille(v[0]);
});
var bouton=document.createElement("button");
bouton.textContent=v[0];
bouton.onclick=function() {
choisirVille(v[0]);
};
zone.appendChild(bouton);
});
document.getElementById("messageCarte").textContent=
liste.length ? liste.length+" villes disponibles." :
"Les villes de ce pays seront ajoutées prochainement. Tu peux écrire une ville toi-même.";
document.getElementById("villePersonnalisee").value="";
document.getElementById("villePersonnalisee").style.display="block";
document.getElementById("boutonVille").style.display="inline-block";
setTimeout(function() {
document.getElementById("zoneVille").scrollIntoView({
behavior:"smooth",
block:"start"
});
},200);
}
function choisirVille(nom) {
document.getElementById("resume").textContent=
prenom+" commencera sa vie à "+nom+", en "+pays+".";
ouvrir("confirmation");
}
function choisirVillePersonnalisee() {
var ville=document.getElementById("villePersonnalisee").value.trim();
if(!ville) {
document.getElementById("messageCarte").textContent="Écris le nom d'une ville.";
return;
}
choisirVille(ville);
}
/* Entrée dans la maternité */
function commencerMaternite() {
ouvrir("maternite");
var chargement=document.getElementById("chargement");
chargement.style.display="block";
chargement.style.opacity="1";
setTimeout(function() {
chargement.style.opacity="0";
setTimeout(function() {
chargement.style.display="none";
},1000);
},5000);
}
function reprendrePartie() {
alert("Tu n'as pas encore de partie sauvegardée !");
}
</script>
</body>
</html>