Skip to content

Commit c6217b2

Browse files
committed
🔍 DEEP DIAGNOSTIC: JavaScript debugging + Force mode card display
🔧 ADDED DEBUG FEATURES: - Console logging in mode select state transition - Check if menu element exists and classes are applied - Log computed styles for game-modes and mode-cards - Force JavaScript styling on large screens (>768px) - 1-second delay debug function to override CSS 🎯 WHAT TO DO: 1. Open browser dev tools (F12) 2. Go to Console tab 3. Navigate to mode selection 4. Look for DEBUG messages starting with �� and 🔧 5. Report what the console logs show This will definitively show if it's a CSS or JavaScript issue!
1 parent 39770bd commit c6217b2

2 files changed

Lines changed: 59 additions & 1 deletion

File tree

script.js

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -829,7 +829,30 @@ function setState(newState) {
829829
soundManager.playBackgroundMusic('menu');
830830
break;
831831
case GameState.MODE_SELECT:
832+
console.log('🎯 DEBUG: Showing mode select menu');
833+
const modeSelectMenu = document.getElementById('modeSelectMenu');
834+
console.log('🎯 DEBUG: Menu element exists:', !!modeSelectMenu);
835+
console.log('🎯 DEBUG: Menu classes before:', modeSelectMenu?.className);
836+
832837
document.getElementById('modeSelectMenu').classList.remove('hidden');
838+
839+
console.log('🎯 DEBUG: Menu classes after:', modeSelectMenu?.className);
840+
console.log('🎯 DEBUG: Window width:', window.innerWidth);
841+
console.log('🎯 DEBUG: Is mobile check:', window.innerWidth <= 768);
842+
843+
// Check if game-modes exist
844+
const gameModes = document.querySelector('.game-modes');
845+
console.log('🎯 DEBUG: Game modes element exists:', !!gameModes);
846+
console.log('🎯 DEBUG: Game modes style display:', gameModes ? window.getComputedStyle(gameModes).display : 'N/A');
847+
848+
// Check mode cards
849+
const modeCards = document.querySelectorAll('.mode-card');
850+
console.log('🎯 DEBUG: Found mode cards:', modeCards.length);
851+
modeCards.forEach((card, i) => {
852+
const computed = window.getComputedStyle(card);
853+
console.log(`🎯 DEBUG: Card ${i} display: ${computed.display}, visibility: ${computed.visibility}, opacity: ${computed.opacity}`);
854+
});
855+
833856
soundManager.playBackgroundMusic('menu');
834857
// Auto-select classic mode if none is selected
835858
if (!currentGameMode) {
@@ -2724,6 +2747,41 @@ function initializeMobileSupport() {
27242747
// Also update viewport when DOM is ready
27252748
document.addEventListener('DOMContentLoaded', () => {
27262749
updateMobileViewport();
2750+
2751+
// DEBUG FUNCTION - Force show mode cards on large screens
2752+
setTimeout(() => {
2753+
console.log('🔧 DEBUG: Force showing mode cards');
2754+
const gameModes = document.querySelector('.game-modes');
2755+
const modeCards = document.querySelectorAll('.mode-card');
2756+
2757+
if (window.innerWidth > 768) {
2758+
console.log('🔧 DEBUG: Large screen detected, forcing grid layout');
2759+
2760+
if (gameModes) {
2761+
gameModes.style.display = 'grid';
2762+
gameModes.style.gridTemplateColumns = 'repeat(auto-fit, minmax(280px, 1fr))';
2763+
gameModes.style.gap = '20px';
2764+
gameModes.style.margin = '30px 0';
2765+
gameModes.style.visibility = 'visible';
2766+
gameModes.style.opacity = '1';
2767+
console.log('🔧 DEBUG: Applied grid styles to .game-modes');
2768+
}
2769+
2770+
modeCards.forEach((card, i) => {
2771+
card.style.display = 'flex';
2772+
card.style.flexDirection = 'column';
2773+
card.style.minHeight = '200px';
2774+
card.style.padding = '25px';
2775+
card.style.background = 'linear-gradient(135deg, rgba(0, 255, 255, 0.1), rgba(0, 128, 255, 0.1))';
2776+
card.style.border = '2px solid #00ffff40';
2777+
card.style.borderRadius = '15px';
2778+
card.style.visibility = 'visible';
2779+
card.style.opacity = '1';
2780+
card.style.pointerEvents = 'auto';
2781+
console.log(`🔧 DEBUG: Applied styles to card ${i}`);
2782+
});
2783+
}
2784+
}, 1000);
27272785
});
27282786

27292787
animate();

sw.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
const CACHE_NAME = 'target-game-v38-emergency-override';
1+
const CACHE_NAME = 'target-game-v39-debug-js';
22
const STATIC_CACHE_URLS = [
33
'/',
44
'/index.html',

0 commit comments

Comments
 (0)