enlever le 3 d

This commit is contained in:
2025-12-01 22:05:16 +01:00
parent 11250de8af
commit 6bd971eb6c
3 changed files with 563 additions and 67 deletions

141
game.js
View File

@ -7,6 +7,13 @@ const statusElement = document.getElementById('status');
const restartBtn = document.getElementById('restartBtn'); const restartBtn = document.getElementById('restartBtn');
const usernameInput = document.getElementById('username'); const usernameInput = document.getElementById('username');
const leaderboardElement = document.getElementById('leaderboard'); const leaderboardElement = document.getElementById('leaderboard');
const gameOverlay = document.getElementById('gameOverlay');
const finalScoreElement = document.getElementById('finalScore');
const finalLevelElement = document.getElementById('finalLevel');
const overlayRestartBtn = document.getElementById('overlayRestartBtn');
const confirmUsernameBtn = document.getElementById('confirmUsernameBtn');
let usernameConfirmed = false;
const CELL_SIZE = 20; const CELL_SIZE = 20;
const COLS = 30; const COLS = 30;
@ -142,7 +149,7 @@ class Pacman {
this.nextDirection = 0; this.nextDirection = 0;
this.mouthAngle = 0; this.mouthAngle = 0;
this.mouthOpen = true; this.mouthOpen = true;
this.baseSpeed = 0.15; this.baseSpeed = 0.25;
this.speed = this.baseSpeed; this.speed = this.baseSpeed;
this.pixelX = this.x * CELL_SIZE + CELL_SIZE / 2; this.pixelX = this.x * CELL_SIZE + CELL_SIZE / 2;
this.pixelY = this.y * CELL_SIZE + CELL_SIZE / 2; this.pixelY = this.y * CELL_SIZE + CELL_SIZE / 2;
@ -253,6 +260,7 @@ class Pacman {
const hue = (this.colorAnimation * 180 / Math.PI) % 360; const hue = (this.colorAnimation * 180 / Math.PI) % 360;
ctx.fillStyle = `hsl(${hue}, 100%, 50%)`; ctx.fillStyle = `hsl(${hue}, 100%, 50%)`;
ctx.beginPath(); ctx.beginPath();
if (this.mouthOpen) { if (this.mouthOpen) {
@ -263,6 +271,7 @@ class Pacman {
ctx.lineTo(0, 0); ctx.lineTo(0, 0);
ctx.fill(); ctx.fill();
ctx.restore(); ctx.restore();
} }
} }
@ -605,7 +614,7 @@ function checkCollisions() {
if (lives <= 0) { if (lives <= 0) {
gameRunning = false; gameRunning = false;
statusElement.textContent = 'Game Over !'; statusElement.textContent = 'Game Over !';
restartBtn.style.display = 'block'; showGameOver();
saveScore(); saveScore();
} else { } else {
restartCurrentLevel(); restartCurrentLevel();
@ -993,6 +1002,8 @@ function placeBonuses() {
} }
function initGame() { function initGame() {
resetUsernameInput(); // Réinitialiser le champ nom
currentMazeIndex = 0; currentMazeIndex = 0;
originalMaze = mazeVariants[0]; originalMaze = mazeVariants[0];
maze = originalMaze.map(row => [...row]); maze = originalMaze.map(row => [...row]);
@ -1008,6 +1019,7 @@ function initGame() {
statusElement.textContent = 'En jeu'; statusElement.textContent = 'En jeu';
statusElement.style.color = '#ffd700'; statusElement.style.color = '#ffd700';
restartBtn.style.display = 'none'; restartBtn.style.display = 'none';
hideGameOver();
pacman = new Pacman(); pacman = new Pacman();
pacman.speed = pacman.baseSpeed * (1 + (level - 1) * 0.05); pacman.speed = pacman.baseSpeed * (1 + (level - 1) * 0.05);
@ -1054,12 +1066,19 @@ function getScores() {
} }
function saveScore() { function saveScore() {
const username = usernameInput.value.trim() || 'Anonyme'; let username;
if (!usernameConfirmed) {
username = 'Anonyme';
} else {
username = usernameInput.value.trim() || 'Anonyme';
}
if (score > 0) { if (score > 0) {
const scores = getScores(); const scores = getScores();
scores.push({ scores.push({
username: username, username: username,
score: score, score: score,
level: level,
date: new Date().toISOString() date: new Date().toISOString()
}); });
scores.sort((a, b) => b.score - a.score); scores.sort((a, b) => b.score - a.score);
@ -1090,12 +1109,17 @@ function updateLeaderboard() {
name.className = 'leaderboard-name'; name.className = 'leaderboard-name';
name.textContent = entry.username; name.textContent = entry.username;
const levelDiv = document.createElement('div');
levelDiv.className = 'leaderboard-level';
levelDiv.textContent = 'Niv. ' + (entry.level || 1);
const scoreDiv = document.createElement('div'); const scoreDiv = document.createElement('div');
scoreDiv.className = 'leaderboard-score'; scoreDiv.className = 'leaderboard-score';
scoreDiv.textContent = entry.score; scoreDiv.textContent = entry.score;
item.appendChild(rank); item.appendChild(rank);
item.appendChild(name); item.appendChild(name);
item.appendChild(levelDiv);
item.appendChild(scoreDiv); item.appendChild(scoreDiv);
leaderboardElement.appendChild(item); leaderboardElement.appendChild(item);
}); });
@ -1105,6 +1129,117 @@ restartBtn.addEventListener('click', () => {
initGame(); initGame();
}); });
// === GESTION DU NOM D'UTILISATEUR ===
function confirmUsername() {
const username = usernameInput.value.trim();
if (username.length === 0) {
alert('Veuillez entrer un nom d\'utilisateur !');
usernameInput.focus();
return;
}
usernameConfirmed = true;
usernameInput.disabled = true;
confirmUsernameBtn.disabled = true;
confirmUsernameBtn.textContent = '✓ Confirmé';
// Supprimer les anciens messages de confirmation s'ils existent
const existingMsg = usernameInput.parentElement.querySelector('.username-confirmed');
if (existingMsg) {
existingMsg.remove();
}
// Afficher un message de confirmation
const confirmationMsg = document.createElement('div');
confirmationMsg.className = 'username-confirmed';
confirmationMsg.textContent = `Bienvenue, ${username} !`;
usernameInput.parentElement.appendChild(confirmationMsg);
// Masquer le message après 3 secondes
setTimeout(() => {
confirmationMsg.style.opacity = '0';
setTimeout(() => confirmationMsg.remove(), 300);
}, 3000);
}
function resetUsernameInput() {
usernameConfirmed = false;
usernameInput.disabled = false;
usernameInput.value = '';
confirmUsernameBtn.disabled = false;
confirmUsernameBtn.textContent = '✓ Confirmer';
// Supprimer les messages de confirmation existants
const existingMsg = usernameInput.parentElement.querySelector('.username-confirmed');
if (existingMsg) {
existingMsg.remove();
}
// Focus sur le champ après un court délai
setTimeout(() => usernameInput.focus(), 100);
}
// Confirmation avec le bouton
confirmUsernameBtn.addEventListener('click', confirmUsername);
// Confirmation avec la touche Entrée
usernameInput.addEventListener('keypress', (e) => {
if (e.key === 'Enter' && !usernameConfirmed) {
confirmUsername();
}
});
// === GAME OVER OVERLAY ===
function showGameOver() {
finalScoreElement.textContent = score;
finalLevelElement.textContent = level;
gameOverlay.classList.add('active');
restartBtn.style.display = 'block';
}
function hideGameOver() {
gameOverlay.classList.remove('active');
}
overlayRestartBtn.addEventListener('click', () => {
initGame();
});
// === CONTROLES TACTILES MOBILE ===
document.querySelectorAll('.ctrl-btn').forEach(btn => {
// Touch events
btn.addEventListener('touchstart', (e) => {
e.preventDefault();
const dir = parseInt(btn.dataset.dir);
if (!isNaN(dir) && gameRunning) {
pacman.nextDirection = dir;
}
});
// Click events (for testing on desktop)
btn.addEventListener('click', () => {
const dir = parseInt(btn.dataset.dir);
if (!isNaN(dir) && gameRunning) {
pacman.nextDirection = dir;
}
});
});
// === ANIMATION DU SCORE ===
let lastScore = 0;
function animateScore() {
if (score !== lastScore) {
const scoreParent = scoreElement.parentElement;
scoreParent.classList.remove('updated');
void scoreParent.offsetWidth; // Force reflow
scoreParent.classList.add('updated');
lastScore = score;
}
requestAnimationFrame(animateScore);
}
animateScore();
updateLeaderboard(); updateLeaderboard();
initGame(); initGame();

View File

@ -13,6 +13,7 @@
<div class="user-input-section"> <div class="user-input-section">
<label for="username">Nom d'utilisateur:</label> <label for="username">Nom d'utilisateur:</label>
<input type="text" id="username" placeholder="Entrez votre nom" maxlength="15"> <input type="text" id="username" placeholder="Entrez votre nom" maxlength="15">
<button id="confirmUsernameBtn" class="confirm-btn">✓ Confirmer</button>
</div> </div>
<div class="game-info"> <div class="game-info">
<div class="score">Score: <span id="score">0</span></div> <div class="score">Score: <span id="score">0</span></div>
@ -21,9 +22,30 @@
<div class="status" id="status">Prêt à jouer</div> <div class="status" id="status">Prêt à jouer</div>
</div> </div>
<canvas id="gameCanvas" width="600" height="600"></canvas> <canvas id="gameCanvas" width="600" height="600"></canvas>
<!-- Contrôles tactiles mobile -->
<div class="mobile-controls" id="mobileControls">
<button class="ctrl-btn" data-dir="0"></button>
<div class="ctrl-row">
<button class="ctrl-btn" data-dir="3"></button>
<button class="ctrl-btn" data-dir="1"></button>
</div>
<button class="ctrl-btn" data-dir="2"></button>
</div>
<div class="instructions"> <div class="instructions">
<p>Utilisez les flèches directionnelles pour déplacer Oulvic</p> <p>Utilisez les flèches directionnelles pour déplacer Oulvic</p>
<button id="restartBtn" style="display: none;">Rejouer</button> <button id="restartBtn" style="display: none;">REJOUER</button>
</div>
<!-- Overlay Game Over -->
<div class="game-overlay" id="gameOverlay">
<div class="overlay-content">
<h2 class="game-over-title">GAME OVER</h2>
<p class="final-score">Score Final: <span id="finalScore">0</span></p>
<p class="final-level">Niveau Atteint: <span id="finalLevel">1</span></p>
<button id="overlayRestartBtn">REJOUER</button>
</div>
</div> </div>
</div> </div>
<div class="leaderboard-container"> <div class="leaderboard-container">
@ -37,4 +59,3 @@
<script src="game.js"></script> <script src="game.js"></script>
</body> </body>
</html> </html>

464
style.css
View File

@ -1,3 +1,6 @@
/* === POLICE ARCADE === */
@import url('https://fonts.googleapis.com/css2?family=Press+Start+2P&display=swap');
* { * {
margin: 0; margin: 0;
padding: 0; padding: 0;
@ -5,7 +8,7 @@
} }
body { body {
font-family: 'Arial', sans-serif; font-family: 'Press Start 2P', cursive;
background: #0a0a0a; background: #0a0a0a;
background-image: background-image:
radial-gradient(circle at 20% 30%, rgba(255, 0, 0, 0.1) 0%, transparent 50%), radial-gradient(circle at 20% 30%, rgba(255, 0, 0, 0.1) 0%, transparent 50%),
@ -52,6 +55,77 @@ body::after {
z-index: 0; z-index: 0;
} }
/* === ANIMATIONS === */
@keyframes neonFlicker {
0%, 19%, 21%, 23%, 25%, 54%, 56%, 100% {
text-shadow:
0 0 5px #ffd700,
0 0 10px #ffd700,
0 0 20px #ff8c00,
0 0 40px #ff8c00,
0 0 80px #ff4500;
}
20%, 24%, 55% {
text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);
}
}
@keyframes rainbow {
0% { color: #ff0000; }
17% { color: #ff8000; }
33% { color: #ffff00; }
50% { color: #00ff00; }
67% { color: #0080ff; }
83% { color: #8000ff; }
100% { color: #ff0000; }
}
@keyframes heartbeat {
0%, 100% { transform: scale(1); }
15% { transform: scale(1.25); }
30% { transform: scale(1); }
45% { transform: scale(1.15); }
}
@keyframes canvasGlow {
from {
box-shadow:
0 0 20px rgba(255, 215, 0, 0.5),
0 0 40px rgba(255, 215, 0, 0.3),
inset 0 0 60px rgba(0, 0, 255, 0.1);
}
to {
box-shadow:
0 0 30px rgba(255, 215, 0, 0.7),
0 0 60px rgba(255, 215, 0, 0.4),
inset 0 0 80px rgba(0, 0, 255, 0.15);
}
}
@keyframes shake {
0%, 100% { transform: translateX(0); }
25% { transform: translateX(-10px); }
75% { transform: translateX(10px); }
}
@keyframes pulse {
0%, 100% { opacity: 1; }
50% { opacity: 0.7; }
}
@keyframes fadeIn {
from { opacity: 0; transform: scale(0.9); }
to { opacity: 1; transform: scale(1); }
}
@keyframes scoreUp {
0% { transform: scale(1); }
50% { transform: scale(1.2); color: #00ff00; }
100% { transform: scale(1); }
}
/* === LAYOUT === */
.main-wrapper { .main-wrapper {
display: flex; display: flex;
justify-content: center; justify-content: center;
@ -65,124 +139,213 @@ body::after {
.container { .container {
text-align: center; text-align: center;
background: rgba(0, 0, 0, 0.7); background: rgba(0, 0, 0, 0.8);
padding: 30px; padding: 30px;
border-radius: 15px; border-radius: 20px;
box-shadow: 0 10px 30px rgba(0, 0, 0, 0.8), 0 0 50px rgba(255, 0, 0, 0.2); box-shadow:
0 10px 30px rgba(0, 0, 0, 0.8),
0 0 50px rgba(255, 0, 0, 0.2),
inset 0 0 30px rgba(255, 215, 0, 0.05);
flex-shrink: 0; flex-shrink: 0;
position: relative; position: relative;
z-index: 1; z-index: 1;
border: 2px solid rgba(255, 0, 0, 0.3); border: 3px solid rgba(255, 215, 0, 0.4);
} }
/* === TITRE ANIME AVEC 3D === */
h1 { h1 {
font-size: 3em; font-size: 2.5em;
margin-bottom: 20px; margin-bottom: 20px;
text-shadow: 3px 3px 6px rgba(0, 0, 0, 0.5); letter-spacing: 5px;
color: #ffd700; animation: neonFlicker 3s infinite, rainbow 8s linear infinite;
} }
/* === BARRE D'INFO AMELIOREE === */
.game-info { .game-info {
display: flex; display: flex;
justify-content: space-between; justify-content: space-between;
align-items: center; align-items: center;
margin-bottom: 20px; margin-bottom: 20px;
padding: 10px 20px; padding: 15px 20px;
background: rgba(0, 0, 0, 0.2); background: linear-gradient(180deg, rgba(0,0,0,0.6) 0%, rgba(0,0,50,0.4) 100%);
border-radius: 10px; border-radius: 15px;
border: 2px solid rgba(255, 215, 0, 0.4);
box-shadow:
inset 0 0 20px rgba(255, 215, 0, 0.1);
gap: 15px; gap: 15px;
flex-wrap: wrap; flex-wrap: wrap;
} }
.score { .score, .level, .lives {
font-size: 1.5em; font-size: 0.9em;
font-weight: bold; font-weight: bold;
background: rgba(0, 0, 0, 0.4);
padding: 10px 15px;
border-radius: 10px;
border: 1px solid rgba(255, 215, 0, 0.3);
transition: all 0.3s;
}
.score.updated {
animation: scoreUp 0.3s ease-out;
} }
.level { .level {
font-size: 1.5em;
font-weight: bold;
color: #ffd700; color: #ffd700;
} }
.lives { /* === COEURS ANIMES === */
font-size: 1.5em;
font-weight: bold;
}
.lives .heart { .lives .heart {
display: inline-block;
color: #ff0000; color: #ff0000;
font-size: 1.2em; font-size: 1.2em;
margin: 0 2px; margin: 0 3px;
transition: opacity 0.3s; transition: opacity 0.3s, transform 0.3s;
animation: heartbeat 1.2s ease-in-out infinite;
filter: drop-shadow(0 0 5px #ff0000);
} }
.lives .heart:nth-child(2) { animation-delay: 0.15s; }
.lives .heart:nth-child(3) { animation-delay: 0.3s; }
#status { #status {
font-size: 1.2em; font-size: 0.8em;
color: #ffd700; color: #ffd700;
text-shadow: 0 0 10px rgba(255, 215, 0, 0.5);
} }
/* === CANVAS AVEC GLOW ET EFFET 3D === */
#gameCanvas { #gameCanvas {
border: 3px solid #ffd700; border: 4px solid #ffd700;
border-radius: 10px; border-radius: 15px;
background: #000; background: #000;
display: block; display: block;
margin: 0 auto; margin: 0 auto;
box-shadow: 0 5px 15px rgba(0, 0, 0, 0.5); box-shadow:
0 0 20px rgba(255, 215, 0, 0.5),
0 0 40px rgba(255, 215, 0, 0.3),
inset 0 0 60px rgba(0, 0, 255, 0.1);
animation: canvasGlow 3s ease-in-out infinite alternate;
} }
/* === INPUT UTILISATEUR === */
.user-input-section { .user-input-section {
margin-bottom: 15px; margin-bottom: 15px;
display: flex; display: flex;
align-items: center; align-items: center;
justify-content: center; justify-content: center;
gap: 10px; gap: 10px;
flex-wrap: wrap;
} }
.user-input-section label { .user-input-section label {
font-size: 1.1em; font-size: 0.7em;
font-weight: bold; font-weight: bold;
} }
#username { #username {
padding: 8px 15px; padding: 10px 15px;
font-size: 1em; font-size: 0.8em;
font-family: 'Press Start 2P', cursive;
border: 2px solid #ffd700; border: 2px solid #ffd700;
border-radius: 8px; border-radius: 10px;
background: rgba(0, 0, 0, 0.3); background: rgba(0, 0, 0, 0.5);
color: #fff; color: #fff;
outline: none; outline: none;
max-width: 200px; max-width: 200px;
transition: all 0.3s;
} }
#username:focus { #username:focus {
border-color: #ffed4e; border-color: #ffed4e;
box-shadow: 0 0 10px rgba(255, 215, 0, 0.5); box-shadow: 0 0 15px rgba(255, 215, 0, 0.6);
background: rgba(0, 0, 0, 0.7);
}
#username:disabled {
background: rgba(0, 255, 0, 0.1);
border-color: #00ff00;
color: #00ff00;
cursor: not-allowed;
}
#username::placeholder {
color: rgba(255, 255, 255, 0.4);
}
/* === BOUTON DE CONFIRMATION === */
.confirm-btn {
padding: 10px 20px;
font-size: 0.7em;
font-family: 'Press Start 2P', cursive;
background: linear-gradient(180deg, #00ff00 0%, #00cc00 100%);
color: #000;
border: 2px solid #00ff00;
border-radius: 10px;
cursor: pointer;
transition: all 0.3s;
box-shadow: 0 4px 10px rgba(0, 255, 0, 0.3);
}
.confirm-btn:hover {
background: linear-gradient(180deg, #00ff88 0%, #00ff00 100%);
transform: translateY(-2px);
box-shadow: 0 6px 15px rgba(0, 255, 0, 0.5);
}
.confirm-btn:active {
transform: translateY(0) scale(0.98);
}
.confirm-btn:disabled {
background: rgba(100, 100, 100, 0.5);
border-color: #666;
cursor: not-allowed;
opacity: 0.5;
}
/* Message de confirmation */
.username-confirmed {
font-size: 0.6em;
color: #00ff00;
margin-top: 5px;
text-shadow: 0 0 10px rgba(0, 255, 0, 0.5);
animation: fadeIn 0.3s ease-out;
width: 100%;
text-align: center;
} }
.instructions { .instructions {
margin-top: 20px; margin-top: 20px;
font-size: 1.1em; font-size: 0.7em;
color: #aaa;
} }
/* === CLASSEMENT AVEC MEDAILLES === */
.leaderboard-container { .leaderboard-container {
background: rgba(0, 0, 0, 0.7); background: rgba(0, 0, 0, 0.8);
padding: 25px; padding: 25px;
border-radius: 15px; border-radius: 20px;
box-shadow: 0 10px 30px rgba(0, 0, 0, 0.8), 0 0 50px rgba(255, 0, 0, 0.2); box-shadow:
min-width: 300px; 0 10px 30px rgba(0, 0, 0, 0.8),
0 0 50px rgba(255, 0, 0, 0.2),
inset 0 0 30px rgba(255, 215, 0, 0.05);
min-width: 320px;
max-height: 700px; max-height: 700px;
position: relative; position: relative;
z-index: 1; z-index: 1;
border: 2px solid rgba(255, 0, 0, 0.3); border: 3px solid rgba(255, 215, 0, 0.4);
} }
.leaderboard-container h2 { .leaderboard-container h2 {
color: #ffd700; color: #ffd700;
text-align: center; text-align: center;
margin-bottom: 20px; margin-bottom: 20px;
font-size: 2em; font-size: 1.2em;
text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5); text-shadow:
0 0 10px rgba(255, 215, 0, 0.5),
2px 2px 4px rgba(0, 0, 0, 0.5);
letter-spacing: 2px;
} }
#leaderboard { #leaderboard {
@ -190,42 +353,94 @@ h1 {
overflow-y: auto; overflow-y: auto;
} }
#leaderboard::-webkit-scrollbar {
width: 8px;
}
#leaderboard::-webkit-scrollbar-track {
background: rgba(0, 0, 0, 0.3);
border-radius: 4px;
}
#leaderboard::-webkit-scrollbar-thumb {
background: #ffd700;
border-radius: 4px;
}
.leaderboard-item { .leaderboard-item {
background: rgba(255, 255, 255, 0.1); background: linear-gradient(90deg, rgba(255,255,255,0.1) 0%, rgba(255,255,255,0.05) 100%);
padding: 12px; padding: 12px 15px;
margin-bottom: 10px; margin-bottom: 10px;
border-radius: 8px; border-radius: 10px;
display: flex; display: flex;
justify-content: space-between; justify-content: space-between;
align-items: center; align-items: center;
border-left: 4px solid #ffd700; border-left: 4px solid #ffd700;
transition: all 0.3s ease;
box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.1);
}
.leaderboard-item:hover {
transform: translateX(5px);
background: rgba(255, 215, 0, 0.15);
box-shadow:
0 0 20px rgba(255, 215, 0, 0.2),
inset 0 1px 0 rgba(255, 255, 255, 0.2);
}
/* Médailles top 3 */
.leaderboard-item:nth-child(1) .leaderboard-rank::before { content: '🥇 '; }
.leaderboard-item:nth-child(2) .leaderboard-rank::before { content: '🥈 '; }
.leaderboard-item:nth-child(3) .leaderboard-rank::before { content: '🥉 '; }
.leaderboard-item:nth-child(1) {
border-left-color: #ffd700;
background: linear-gradient(90deg, rgba(255,215,0,0.2) 0%, rgba(255,215,0,0.05) 100%);
}
.leaderboard-item:nth-child(2) {
border-left-color: #c0c0c0;
background: linear-gradient(90deg, rgba(192,192,192,0.15) 0%, rgba(192,192,192,0.05) 100%);
}
.leaderboard-item:nth-child(3) {
border-left-color: #cd7f32;
background: linear-gradient(90deg, rgba(205,127,50,0.15) 0%, rgba(205,127,50,0.05) 100%);
} }
.leaderboard-item.top { .leaderboard-item.top {
background: rgba(255, 215, 0, 0.2);
border-left-color: #ffed4e;
font-weight: bold; font-weight: bold;
} }
.leaderboard-rank { .leaderboard-rank {
font-size: 1.3em; font-size: 0.9em;
font-weight: bold; font-weight: bold;
color: #ffd700; color: #ffd700;
min-width: 30px; min-width: 60px;
} }
.leaderboard-name { .leaderboard-name {
flex: 1; flex: 1;
text-align: left; text-align: left;
margin-left: 15px; margin-left: 10px;
font-size: 1.1em; font-size: 0.7em;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
.leaderboard-level {
font-size: 0.7em;
font-weight: bold;
color: #00ff00;
min-width: 60px;
text-align: center;
margin-right: 10px;
} }
.leaderboard-score { .leaderboard-score {
font-size: 1.2em; font-size: 0.8em;
font-weight: bold; font-weight: bold;
color: #ffd700; color: #ffd700;
min-width: 80px; min-width: 70px;
text-align: right; text-align: right;
} }
@ -233,40 +448,154 @@ h1 {
text-align: center; text-align: center;
color: #aaa; color: #aaa;
padding: 20px; padding: 20px;
font-style: italic; font-size: 0.7em;
} }
/* === BOUTON REJOUER === */
#restartBtn { #restartBtn {
margin-top: 15px; margin-top: 15px;
padding: 12px 30px; padding: 15px 30px;
font-size: 1.2em; font-size: 0.9em;
background: #ffd700; font-family: 'Press Start 2P', cursive;
background: linear-gradient(180deg, #ffd700 0%, #ff8c00 100%);
color: #000; color: #000;
border: none; border: none;
border-radius: 8px; border-radius: 10px;
cursor: pointer; cursor: pointer;
font-weight: bold; font-weight: bold;
transition: background 0.3s; transition: all 0.3s;
box-shadow: 0 5px 15px rgba(255, 215, 0, 0.4);
} }
#restartBtn:hover { #restartBtn:hover {
background: #ffed4e; background: linear-gradient(180deg, #ffed4e 0%, #ffa500 100%);
transform: translateY(-2px);
box-shadow: 0 8px 20px rgba(255, 215, 0, 0.6);
} }
#restartBtn:active { #restartBtn:active {
transform: scale(0.95); transform: translateY(0) scale(0.98);
} }
/* === OVERLAY GAME OVER === */
.game-overlay {
display: none;
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
background: rgba(0, 0, 0, 0.92);
justify-content: center;
align-items: center;
z-index: 10;
border-radius: 17px;
animation: fadeIn 0.5s ease-out;
}
.game-overlay.active {
display: flex;
}
.overlay-content {
text-align: center;
padding: 30px;
}
.game-over-title {
font-size: 2em;
color: #ff0000;
text-shadow:
0 0 10px #ff0000,
0 0 20px #ff0000,
0 0 40px #ff0000;
animation: shake 0.5s ease-in-out, pulse 1.5s ease-in-out infinite;
margin-bottom: 30px;
}
.final-score, .final-level {
font-size: 0.9em;
margin: 15px 0;
color: #ffd700;
}
.final-score span, .final-level span {
color: #00ff00;
font-size: 1.2em;
}
#overlayRestartBtn {
margin-top: 25px;
padding: 15px 30px;
font-size: 0.9em;
font-family: 'Press Start 2P', cursive;
background: linear-gradient(180deg, #ffd700 0%, #ff8c00 100%);
color: #000;
border: none;
border-radius: 10px;
cursor: pointer;
font-weight: bold;
transition: all 0.3s;
box-shadow: 0 5px 15px rgba(255, 215, 0, 0.4);
}
#overlayRestartBtn:hover {
background: linear-gradient(180deg, #ffed4e 0%, #ffa500 100%);
transform: translateY(-2px);
box-shadow: 0 8px 20px rgba(255, 215, 0, 0.6);
}
#overlayRestartBtn:active {
transform: translateY(0) scale(0.98);
}
/* === CONTROLES TACTILES MOBILE === */
.mobile-controls {
display: none;
flex-direction: column;
align-items: center;
gap: 5px;
margin-top: 20px;
}
.ctrl-row {
display: flex;
gap: 50px;
}
.ctrl-btn {
width: 60px;
height: 60px;
font-size: 1.5em;
background: linear-gradient(145deg, rgba(255,215,0,0.2), rgba(255,215,0,0.1));
border: 3px solid #ffd700;
border-radius: 15px;
color: #ffd700;
cursor: pointer;
transition: all 0.1s;
-webkit-tap-highlight-color: transparent;
}
.ctrl-btn:active {
background: rgba(255, 215, 0, 0.4);
transform: scale(0.9);
box-shadow:
0 0 15px rgba(255, 215, 0, 0.5),
inset 0 0 10px rgba(255, 215, 0, 0.3);
}
/* === FOOTER === */
footer { footer {
text-align: center; text-align: center;
margin-top: 30px; margin-top: 30px;
padding: 20px; padding: 20px;
color: #ffd700; color: #ffd700;
font-size: 1.1em; font-size: 0.7em;
font-weight: bold; font-weight: bold;
text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5); text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);
} }
/* === RESPONSIVE === */
@media (max-width: 1200px) { @media (max-width: 1200px) {
.main-wrapper { .main-wrapper {
flex-direction: column; flex-direction: column;
@ -286,7 +615,7 @@ footer {
} }
h1 { h1 {
font-size: 2em; font-size: 1.5em;
} }
.game-info { .game-info {
@ -298,5 +627,16 @@ footer {
flex-direction: column; flex-direction: column;
gap: 8px; gap: 8px;
} }
}
.mobile-controls {
display: flex;
}
.game-over-title {
font-size: 1.5em;
}
.final-score, .final-level {
font-size: 0.7em;
}
}