/* 404 Jungle Adventure Game Styles */
:root {
  --primary: #228B22;
  --primary-dark: #006400;
  --primary-light: #32CD32;
  --accent: #f59e0b;
  --accent-light: #fbbf24;
  --bg: #0f2f0f;
  --bg-secondary: #1a3a1a;
  --bg-tertiary: #2d5f2d;
  --text: #ffffff;
  --text-secondary: #e5e7eb;
  --text-muted: #9ca3af;
  --danger: #ef4444;
  --warning: #f59e0b;
  --success: #10b981;
  --shadow: 0 8px 32px rgba(34, 139, 34, 0.3);
  --shadow-lg: 0 20px 60px rgba(34, 139, 34, 0.4);
  --border: rgba(34, 139, 34, 0.2);
  --glass: rgba(255, 255, 255, 0.1);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  background: linear-gradient(135deg, 
    #2d5a2d 0%,    /* Lighter forest green */
    #1e4a1e 25%,   /* Medium jungle green */
    #0f3f0f 50%,   /* Deep forest */
    #1a4d1a 75%,   /* Forest green */
    #2d5a2d 100%   /* Back to lighter forest green */
  );
  background-image: 
    radial-gradient(circle at 20% 20%, rgba(34, 139, 34, 0.1) 0%, transparent 50%),
    radial-gradient(circle at 80% 80%, rgba(46, 125, 50, 0.1) 0%, transparent 50%),
    radial-gradient(circle at 40% 60%, rgba(76, 175, 80, 0.05) 0%, transparent 30%);
  background-attachment: fixed;
  min-height: 100vh;
  color: white;
  color: var(--text);
  position: relative;
  min-height: 100vh;
  
  /* Mobile performance optimizations */
  -webkit-transform: translateZ(0);
  transform: translateZ(0);
  -webkit-backface-visibility: hidden;
  backface-visibility: hidden;
  -webkit-perspective: 1000;
  perspective: 1000;
  will-change: transform;
}

/* Prevent scrolling during loading */
body.loading {
  overflow: hidden;
  height: 100vh;
}

/* Jungle background decorations */
body::before {
  content: "🌳🌲🌿🍃🌱🦋🐛🌳🌲🌿🍃🌱🦋🐛🌳🌲🌿🍃🌱🦋🐛🌳🌲🌿🍃🌱🦋🐛";
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  font-size: 24px;
  opacity: 0.1;
  z-index: -1;
  pointer-events: none;
  word-wrap: break-word;
  line-height: 2;
  animation: jungle-sway 20s ease-in-out infinite;
}

@keyframes jungle-sway {
  0%, 100% { transform: translateX(0); }
  50% { transform: translateX(10px); }
}

body {
  font-family: 'Poppins', system-ui, -apple-system, sans-serif;
  line-height: 1.6;
  min-height: 100vh;
  overflow-x: hidden;
}

/* Animated background stars */
body::before {
  content: '';
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-image: 
    radial-gradient(2px 2px at 20px 30px, white, transparent),
    radial-gradient(2px 2px at 40px 70px, white, transparent),
    radial-gradient(1px 1px at 90px 40px, white, transparent),
    radial-gradient(1px 1px at 130px 80px, white, transparent),
    radial-gradient(2px 2px at 160px 30px, white, transparent);
  background-repeat: repeat;
  background-size: 200px 100px;
  animation: twinkle 4s infinite;
  z-index: -1;
  opacity: 0.5;
}

@keyframes twinkle {
  0%, 100% { opacity: 0.5; }
  50% { opacity: 1; }
}

/* Loading Screen */
.loading-screen {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  width: 100vw;
  height: 100vh;
  background: linear-gradient(135deg, var(--bg), var(--bg-secondary));
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  transition: opacity 0.5s ease;
  overflow: hidden;
}

.loading-content {
  text-align: center;
  max-width: 400px;
}

.spinning-mascot {
  width: 120px;
  height: 120px;
  border-radius: 50%;
  animation: spin 2s linear infinite;
  box-shadow: 0 0 30px rgba(34, 197, 94, 0.5);
  margin-bottom: 2rem;
}

@keyframes spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

.loading-bar {
  width: 300px;
  height: 8px;
  background: var(--bg-tertiary);
  border-radius: 10px;
  overflow: hidden;
  margin: 2rem auto;
}

.loading-progress {
  width: 0%;
  height: 100%;
  background: linear-gradient(90deg, var(--primary), var(--accent));
  border-radius: 10px;
  animation: loadProgress 3s ease-in-out forwards;
}

@keyframes loadProgress {
  to { width: 100%; }
}

/* Game Container */
.game-container {
  position: relative; /* Add relative positioning for absolute children */
  max-width: 900px;
  margin: 0 auto;
  padding: 1rem;
  text-align: center;
  background: linear-gradient(135deg, 
    rgba(13, 61, 13, 0.8) 0%, 
    rgba(10, 45, 10, 0.7) 25%,
    rgba(5, 26, 5, 0.8) 50%,
    rgba(8, 35, 8, 0.7) 75%,
    rgba(15, 55, 15, 0.8) 100%
  );
  border-radius: 15px;
  backdrop-filter: blur(5px);
  border: 2px solid rgba(34, 139, 34, 0.3);
  box-shadow: 
    0 0 20px rgba(34, 139, 34, 0.2),
    inset 0 0 20px rgba(0, 0, 0, 0.1);
}

/* Add subtle jungle decorations around the container */
.game-container::before {
  content: "    🌱";
  position: absolute;
  top: -15px;
  left: -10px;
  right: -10px;
  height: 10px;
  font-size: 12px;
  opacity: 0.3;
  z-index: -1;
  animation: gentleFloat 8s ease-in-out infinite;
  overflow: hidden;
  text-align: center;
}

.game-container::after {
  content: "🌿  🍃  🌱";
  position: absolute;
  bottom: -15px;
  left: -10px;
  right: -10px;
  height: 10px;
  font-size: 12px;
  opacity: 0.3;
  z-index: -1;
  animation: gentleFloat 8s ease-in-out infinite reverse;
  text-align: center;
  overflow: hidden;
}

/* Game Header */
.game-header {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: rgba(0, 0, 0, 0.3);
  padding: 0.5rem 1rem;
  z-index: 10;
  color: white;
  font-family: 'Press Start 2P', monospace;
  font-size: 0.8rem;
  border-top-left-radius: 20px;
  border-top-right-radius: 20px;
}

.score-display, .difficulty-display, .lives-display, .high-score-display {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

#currentScore, #livesCount, #highScore, #difficultyLevel {
  color: var(--primary-light);
  text-shadow: 0 0 5px rgba(34, 197, 94, 0.5);
}

/* Game Canvas */
.canvas-wrapper {
  position: relative;
  width: 100%;
  max-width: 800px; /* Match canvas width */
  margin: 0 auto;
  border: 3px solid rgba(34, 139, 34, 0.8);
  border-radius: 20px;
  overflow: hidden; /* Keep elements inside the rounded corners */
  /* Ensure proper stacking context for overlays */
  isolation: isolate;
}

/* Fullscreen Container */
.canvas-wrapper:fullscreen {
  background-color: #0a1f0a; /* Match game background */
  max-width: none;
  width: 100vw;
  height: 100vh;
  border: none;
  border-radius: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.canvas-wrapper:fullscreen #gameCanvas {
  width: 100vw;
  height: 100vh;
  max-width: none;
  max-height: none;
  border: none;
  border-radius: 0;
  object-fit: contain;
}

/* Mobile-specific fullscreen adjustments */
@media (max-width: 768px) {
  .canvas-wrapper:fullscreen #gameCanvas {
    width: 100vw;
    height: 100vh;
    object-fit: cover; /* Fill the entire screen on mobile */
  }
}

/* Ensure controls are visible in fullscreen */
.canvas-wrapper:fullscreen .touch-controls {
  display: flex !important;
}

.canvas-wrapper:fullscreen .game-header {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  border-radius: 0;
  z-index: 10000;
}

/* In-Game Sound Toggle Button */
.sound-toggle-btn {
  position: absolute;
  top: 60px; /* Adjusted to avoid overlap */
  right: 15px;
  width: 50px;
  height: 50px;
  background: rgba(25, 25, 25, 0.8);
  border: 2px solid rgba(34, 197, 94, 0.6);
  border-radius: 50%;
  color: var(--primary-light);
  font-size: 20px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s ease;
  backdrop-filter: blur(10px);
  z-index: 1000;
}

.sound-toggle-btn:hover {
  background: rgba(34, 197, 94, 0.2);
  border-color: var(--primary);
  transform: scale(1.1);
}

.sound-toggle-btn:active {
  transform: scale(0.95);
}

/* Fullscreen compatibility for sound toggle */
.canvas-wrapper:fullscreen .sound-toggle-btn {
  position: fixed;
  top: 60px; /* Adjusted to avoid overlap */
  right: 15px;
  z-index: 10000;
}

/* Mobile Touch Controls */
.touch-controls {
  display: none; /* Hidden by default, enabled in media query */
  position: fixed; /* Changed to fixed for fullscreen compatibility */
  bottom: 25px;
  left: 0;
  width: 100%;
  padding: 0 25px;
  z-index: 999; /* Higher z-index to ensure visibility in fullscreen */
  justify-content: space-between;
  align-items: flex-end; /* Align to the bottom */
  pointer-events: none; /* Pass clicks through container */
}

.touch-controls-left, .touch-controls-right {
  display: flex;
  gap: 20px;
  pointer-events: auto; /* Enable events on controls */
}

.touch-btn {
  width: 65px;
  height: 65px;
  background: rgba(25, 25, 25, 0.75); /* More opaque for better visibility */
  border: 2px solid rgba(255, 255, 255, 0.4);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  transition: all 0.2s ease;
  user-select: none;
  touch-action: manipulation;
  backdrop-filter: blur(8px);
  box-shadow: 0 5px 20px rgba(0,0,0,0.5);
  cursor: pointer;
}

.touch-btn svg {
  width: 35px;
  height: 35px;
  fill: currentColor;
  opacity: 0.9;
}

.touch-btn:active, .touch-btn:hover {
  background: rgba(255, 255, 255, 0.4);
  transform: scale(0.92);
  box-shadow: 0 3px 12px rgba(0,0,0,0.4);
}

#touchBoost {
  width: 85px;
  height: 85px;
  background: rgba(245, 158, 11, 0.75);
  border-color: rgba(251, 191, 36, 0.8);
}

#touchBoost svg {
    width: 45px;
    height: 45px;
}

#touchBoost:active, #touchBoost:hover {
  background: rgba(251, 191, 36, 0.9);
}

@media (max-width: 768px) {
  /* Touch controls remain hidden on mobile - using invisible touch zones instead */
  .touch-controls {
    display: none !important; /* Keep hidden - invisible touch zones handle mobile input */
  }
  
  /* Make touch controls larger on mobile */
  .touch-btn {
    width: 75px;
    height: 75px;
  }
  
  .touch-btn svg {
    width: 40px;
    height: 40px;
  }
  
  /* Adjust game container for mobile */
  .game-container {
    padding: 0.5rem;
    margin: 0;
  }
  
  /* Make canvas fill more of the screen on mobile */
  #gameCanvas {
    width: 100%;
    height: 50vh;
    min-height: 300px;
    max-height: 70vh;
  }
}

/* Mobile landscape mode - DISABLED (Portrait-only mode active) */
/* To re-enable landscape mode, uncomment the CSS block below */
/*
@media (max-width: 768px) and (orientation: landscape) {
  #gameCanvas {
    width: 100%;
    height: 80vh;
    min-height: 400px;
  }
  
  .game-header {
    font-size: 0.7rem;
    padding: 0.3rem 0.5rem;
  }
  
  .touch-controls {
    bottom: 15px;
  }
}
*/

/* Portrait-only mode styles */
@media (max-width: 768px) and (orientation: landscape) {
  /* Hide main game content in landscape */
  .game-container {
    display: none;
  }
  
  /* Show rotation prompt */
  body::before {
    content: "🔄 Please rotate your device to portrait mode for the best gaming experience! 📱";
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #1e3a2f, #2d5a3f);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    font-size: 1.2rem;
    font-weight: 600;
    padding: 2rem;
    box-sizing: border-box;
    z-index: 9999;
    line-height: 1.5;
  }
}

/* Very small screens */
@media (max-width: 480px) {
  .game-container {
    padding: 0.2rem;
  }
  
  .touch-btn {
    width: 65px;
    height: 65px;
  }
  
  .touch-btn svg {
    width: 35px;
    height: 35px;
  }
  
  .game-header {
    font-size: 0.6rem;
    gap: 0.5rem;
  }
}

/* Hide touch controls on desktop unless in fullscreen */
@media (min-width: 769px) {
  .touch-controls {
    display: none !important;
  }
}

/* Ensure controls are visible in fullscreen mode */
.canvas-wrapper:fullscreen .touch-controls,
.canvas-wrapper:fullscreen .touch-controls {
  display: flex !important;
  position: fixed;
  bottom: 25px;
  left: 0;
  width: 100vw;
  z-index: 10000;
}

#gameCanvas {
  border: 3px solid rgba(34, 139, 34, 0.8);
  border-radius: 20px;
  background: 
    /* Simple, clean jungle gradient */
    linear-gradient(145deg, 
      rgba(45, 90, 45, 0.3) 0%, 
      rgba(30, 74, 30, 0.5) 30%,
      rgba(15, 63, 15, 0.7) 70%,
      rgba(10, 45, 10, 0.9) 100%
    );
  box-shadow: 
    0 10px 30px rgba(0, 0, 0, 0.5),
    inset 0 0 20px rgba(34, 139, 34, 0.1);
  width: 100%;
  max-width: 800px;
  height: auto;
  display: block; /* Remove extra space below canvas */
  
  /* Performance optimizations */
  will-change: transform;
  -webkit-transform: translateZ(0);
  transform: translateZ(0);
  -webkit-backface-visibility: hidden;
  backface-visibility: hidden;
}

/* Mobile responsive canvas */
@media (max-width: 768px) {
  #gameCanvas {
    width: 100%;
    height: auto;
    min-height: 400px;
    max-height: 80vh;
    border: 2px solid rgba(34, 139, 34, 0.6);
    border-radius: 10px;
    margin: 0 auto;
    display: block;
    /* Enhanced mobile performance */
    image-rendering: -webkit-optimize-contrast;
    image-rendering: pixelated;
  }
}

/* Canvas in fullscreen */
.canvas-wrapper:fullscreen #gameCanvas {
  border: none;
  border-radius: 0;
  box-shadow: none;
  width: 100vw;
  height: 100vh;
  max-width: none;
  max-height: none;
}

#gameCanvas::before {
  content: "🌳🌲🌿🍃🌱🦋🐛🌳🌲🌿";
  position: absolute;
  top: -30px;
  left: 0;
  width: 100%;
  height: 20px;
  font-size: 20px;
  opacity: 0.4;
  z-index: -1;
  animation: jungle-decoration 25s linear infinite;
}

@keyframes gentleFloat {
  0%, 100% { transform: translateY(0px); opacity: 0.3; }
  50% { transform: translateY(-5px); opacity: 0.5; }
}

/* Start Game Screen */
.start-game-screen {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  width: 100%;
  height: 100%;
  background: rgba(5, 26, 5, 0.85);
  display: flex; /* Use flex to center content */
  align-items: center;
  justify-content: center;
  z-index: 20;
  border-radius: 20px; /* Match canvas border-radius */
  backdrop-filter: blur(4px);
}

/* Fullscreen start screen */
.canvas-wrapper:fullscreen .start-game-screen {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  border-radius: 0;
  z-index: 10000;
}

.start-content {
  text-align: center;
  color: var(--text);
  /* Text rendering optimizations for mobile */
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  /* Ensure text is never too small on mobile */
  -webkit-text-size-adjust: none;
  text-size-adjust: none;
}

.start-content h2 {
  font-size: 2rem;
  margin-bottom: 1rem;
  color: var(--primary-light);
}

.start-content p {
  font-size: 1.2rem;
  margin-bottom: 2rem;
  color: var(--text-secondary);
}

.start-game-btn {
  background: linear-gradient(135deg, var(--primary), var(--primary-light));
  color: white;
  border: none;
  padding: 1rem 2rem;
  font-size: 1.5rem;
  border-radius: 50px;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: var(--shadow);
  font-weight: bold;
}

.start-game-btn:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
  background: linear-gradient(135deg, var(--primary-light), var(--primary));
}

.fullscreen-toggle, .sound-toggle {
  margin-top: 1.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  color: var(--text-secondary);
}

.sound-toggle {
  margin-top: 1rem; /* Less margin for the second toggle */
}

#fullscreenCheckbox, #soundCheckbox {
  width: 18px;
  height: 18px;
  accent-color: var(--primary);
}

/* Controls Info */
.controls-info {
  margin: 1rem 0;
  padding: 1rem;
  background: linear-gradient(135deg, 
    rgba(13, 61, 13, 0.6) 0%, 
    rgba(10, 45, 10, 0.5) 50%,
    rgba(5, 26, 5, 0.6) 100%
  );
  backdrop-filter: blur(10px);
  border: 2px solid rgba(34, 139, 34, 0.4);
  border-radius: 15px;
  font-size: 0.9rem;
  position: relative;
}

.controls-info::before {
  content: "🌿";
  position: absolute;
  top: 5px;
  left: 10px;
  font-size: 20px;
  opacity: 0.3;
}

.controls-info kbd {
  background: var(--bg-tertiary);
  color: var(--text);
  padding: 0.2rem 0.5rem;
  border-radius: 5px;
  font-family: 'Press Start 2P', monospace;
  font-size: 0.7rem;
  margin: 0 0.2rem;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

/* Guides Container */
.guides-container {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
}

/* Individual Guide Styles */
.enemy-guide, .power-up-guide {
  padding: 1rem;
  border-radius: 10px;
  background: rgba(0,0,0,0.1);
}

.enemy-guide {
  border-left: 3px solid var(--danger);
}

.power-up-guide {
  border-left: 3px solid var(--success);
}

.enemy-guide h4, .power-up-guide h4 {
  margin-bottom: 0.75rem;
  font-size: 1rem;
}

/* Collapsible Header Styles */
.collapsible-header {
  cursor: pointer;
  user-select: none;
  display: flex;
  justify-content: space-between;
  align-items: center;
  transition: color 0.3s ease;
  position: relative;
}

.collapsible-header:hover {
  opacity: 0.8;
}

.collapse-icon {
  font-size: 0.8rem;
  transition: transform 0.3s ease;
  margin-left: 0.5rem;
}

.collapsible-header.collapsed .collapse-icon {
  transform: rotate(-90deg);
}

/* Collapsible Content */
.collapsible-content {
  max-height: 1000px;
  overflow: hidden;
  transition: max-height 0.4s ease, opacity 0.3s ease;
  opacity: 1;
}

.collapsible-content.collapsed {
  max-height: 0;
  opacity: 0;
  margin-top: 0;
  padding-top: 0;
}

.enemy-guide h4 {
  color: var(--danger);
}

.power-up-guide h4 {
  color: var(--success);
}

.enemy-list, .power-up-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.enemy-item, .power-up-item {
  font-size: 0.8rem;
  padding: 0.3rem;
  border-radius: 5px;
}

.enemy-item {
  background: rgba(239, 68, 68, 0.1);
}

.power-up-item {
  background: rgba(16, 185, 129, 0.1);
}

/* Responsive adjustments for guides */
@media (max-width: 600px) {
  .guides-container {
    grid-template-columns: 1fr;
  }
  
  /* Mobile-friendly collapsible headers */
  .collapsible-header {
    font-size: 0.9rem;
    padding: 0.5rem 0;
  }
  
  .collapse-icon {
    font-size: 0.9rem;
  }
  
  .enemy-item, .power-up-item {
    font-size: 0.75rem;
    padding: 0.4rem;
  }
}

/* Enemy Guide Styles */
.enemy-guide {
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
}

.enemy-guide h4 {
  margin: 0 0 0.5rem 0;
  color: var(--primary-light);
  font-size: 1rem;
}

.enemy-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 0.5rem;
  margin-bottom: 0.75rem;
}

.enemy-item {
  background: linear-gradient(135deg, 
    rgba(139, 69, 19, 0.2) 0%, 
    rgba(101, 67, 33, 0.3) 50%,
    rgba(85, 107, 47, 0.2) 100%
  );
  border: 1px solid rgba(34, 139, 34, 0.4);
  border-radius: 8px;
  padding: 0.4rem 0.6rem;
  font-size: 0.8rem;
  text-align: center;
  transition: all 0.3s ease;
}

.enemy-item:hover {
  background: linear-gradient(135deg, 
    rgba(139, 69, 19, 0.3) 0%, 
    rgba(101, 67, 33, 0.4) 50%,
    rgba(85, 107, 47, 0.3) 100%
  );
  transform: translateY(-2px);
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

.power-info {
  font-style: italic;
  color: var(--accent-light);
  margin: 0;
  font-size: 0.85rem;
}

/* Game Over Screen */
.game-over-screen {
  position: absolute;
  top: 30%; /* Changed from 50% to 30% to position higher */
  left: 50%;
  transform: translate(-50%, -50%);
  background: var(--glass);
  backdrop-filter: blur(20px);
  border: 2px solid var(--border);
  border-radius: 25px;
  padding: 3rem;
  text-align: center;
  box-shadow: var(--shadow-lg);
  max-width: 500px;
  width: 90%;
  z-index: 100;
}

/* Fullscreen game over screen */
.canvas-wrapper:fullscreen .game-over-screen {
  position: fixed;
  top: 50%;
  left: 50%;
  z-index: 10000;
  max-width: 600px;
}

.game-over-title {
  font-family: 'Press Start 2P', monospace;
  font-size: 1.5rem;
  color: var(--primary-light);
  margin-bottom: 2rem;
  text-shadow: 0 0 20px rgba(34, 197, 94, 0.8);
}

.final-score {
  margin-bottom: 2rem;
}

.final-score p {
  font-size: 1.2rem;
  margin-bottom: 0.5rem;
}

#finalScore {
  font-family: 'Press Start 2P', monospace;
  color: var(--accent-light);
  font-size: 1.5rem;
  text-shadow: 0 0 15px rgba(245, 158, 11, 0.8);
}

.score-submission {
  margin-bottom: 2rem;
}

#playerName, #playerEmail {
  width: 100%;
  padding: 1rem;
  border: 2px solid var(--border);
  border-radius: 15px;
  background: var(--glass);
  color: var(--text);
  font-size: 1rem;
  text-align: center;
  margin-bottom: 1rem;
  backdrop-filter: blur(10px);
}

#playerName::placeholder, #playerEmail::placeholder {
  color: var(--text-muted);
}

.submit-btn, .play-again-btn, .leaderboard-btn {
  padding: 1rem 2rem;
  border: none;
  border-radius: 50px;
  font-weight: 600;
  font-size: 1rem;
  cursor: pointer;
  transition: all 0.3s ease;
  margin: 0.5rem;
  text-decoration: none;
  display: inline-block;
}

.submit-btn {
  background: linear-gradient(135deg, var(--success), var(--primary));
  color: white;
  box-shadow: 0 4px 15px rgba(16, 185, 129, 0.4);
}

.submit-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(16, 185, 129, 0.6);
}

.play-again-btn {
  background: linear-gradient(135deg, var(--primary), var(--primary-light));
  color: white;
  box-shadow: 0 4px 15px rgba(34, 197, 94, 0.4);
}

.play-again-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(34, 197, 94, 0.6);
}

.leaderboard-btn {
  background: linear-gradient(135deg, var(--accent), var(--accent-light));
  color: white;
  box-shadow: 0 4px 15px rgba(245, 158, 11, 0.4);
}

.leaderboard-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(245, 158, 11, 0.6);
}

/* Modal */
.modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.8);
  backdrop-filter: blur(5px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 200;
}

.modal-content {
  background: var(--glass);
  backdrop-filter: blur(20px);
  border: 2px solid var(--border);
  border-radius: 25px;
  padding: 2rem;
  max-width: 600px;
  width: 90%;
  max-height: 80vh;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 2rem;
}

.modal-header h3 {
  font-family: 'Press Start 2P', monospace;
  color: var(--accent-light);
  font-size: 1.2rem;
}

.close-btn {
  background: none;
  border: none;
  color: var(--text);
  font-size: 2rem;
  cursor: pointer;
  transition: color 0.3s ease;
}

.close-btn:hover {
  color: var(--danger);
}

.leaderboard-list {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.demo-notice {
  text-align: center;
  background: rgba(34, 139, 34, 0.2);
  border: 2px solid var(--primary);
  border-radius: 15px;
  padding: 15px;
  margin-bottom: 20px;
  color: var(--primary-light);
  font-weight: bold;
  animation: pulse 2s infinite;
}

.real-data-notice {
  text-align: center;
  background: rgba(255, 140, 0, 0.3);
  border: 2px solid #ff8c00;
  border-radius: 15px;
  padding: 15px;
  margin-bottom: 20px;
  color: #ff8c00;
  font-weight: bold;
  animation: glow 1.5s ease-in-out infinite alternate;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.7; }
}

@keyframes glow {
  from { box-shadow: 0 0 5px rgba(255, 140, 0, 0.5); }
  to { box-shadow: 0 0 20px rgba(255, 140, 0, 0.8); }
}

.demo-entry {
  opacity: 0.95;
  border: 1px dashed rgba(255, 255, 255, 0.3);
}

.real-entry {
  background: rgba(255, 140, 0, 0.1);
  border: 1px solid rgba(255, 140, 0, 0.3);
}

.leaderboard-entry {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem;
  background: var(--glass);
  border: 1px solid var(--border);
  border-radius: 15px;
  backdrop-filter: blur(10px);
}

.leaderboard-entry.top-3 {
  background: linear-gradient(135deg, var(--accent), var(--accent-light));
  color: var(--bg);
  font-weight: bold;
}

.leaderboard-rank {
  font-family: 'Press Start 2P', monospace;
  font-size: 1.2rem;
  min-width: 60px;
}

.leaderboard-info {
  flex-grow: 1;
  text-align: left;
  margin-left: 1rem;
}

.leaderboard-name {
  font-weight: 600;
  margin-bottom: 0.25rem;
}

.leaderboard-score {
  font-family: 'Press Start 2P', monospace;
  font-size: 1rem;
  color: var(--accent-light);
}

.leaderboard-score {
  font-family: 'Press Start 2P', monospace;
  color: var(--primary-light);
}

/* Navigation Section */
.navigation-section {
  position: relative;
  z-index: 10; /* Ensure it's above most elements but below modals */
  margin-top: 3rem;
  padding: 2rem;
  background: var(--glass);
  backdrop-filter: blur(10px);
  border: 1px solid var(--border);
  border-radius: 25px;
  box-shadow: var(--shadow);
}

.navigation-section h3 {
  color: var(--primary-light);
  margin-bottom: 1rem;
  font-size: 1.5rem;
}

.navigation-links {
  display: flex;
  gap: 1rem;
  justify-content: center;
  flex-wrap: wrap;
  margin: 2rem 0;
}

.nav-link {
  color: white;
  text-decoration: none;
  padding: 1rem 2rem;
  background: linear-gradient(135deg, var(--primary), var(--primary-light));
  border-radius: 50px;
  transition: all 0.3s ease;
  font-weight: 600;
  box-shadow: var(--shadow);
}

.nav-link:hover {
  transform: translateY(-3px);
  box-shadow: 0 10px 30px rgba(34, 197, 94, 0.4);
}

.nav-link.secondary {
  background: transparent;
  color: var(--primary-light);
  border: 2px solid var(--primary);
}

.nav-link.secondary:hover {
  background: var(--primary);
  color: white;
}

.mission-message {
  margin-top: 2rem;
  padding: 1.5rem;
  background: var(--bg-tertiary);
  border-radius: 15px;
  border-left: 4px solid var(--primary);
}

/* Utility Classes */
.hidden {
  display: none !important;
}

/* Responsive Design */
@media (max-width: 768px) {
  .game-header {
    flex-direction: column;
    gap: 1rem;
    padding: 1rem;
  }
  
  .score-display, .lives-display, .high-score-display {
    flex-direction: row;
    gap: 1rem;
  }
  
  #gameCanvas {
    width: 100%;
    height: auto;
  }
  
  .game-over-screen {
    padding: 2rem 1rem;
  }
  
  .navigation-links {
    flex-direction: column;
    align-items: center;
  }
  
  .controls-info {
    font-size: 0.8rem;
  }
  
  .controls-info kbd {
    font-size: 0.6rem;
  }
  
  /* Mobile-specific start screen text fixes */
  .start-content h2 {
    font-size: 1.5rem; /* Smaller for mobile */
    line-height: 1.3;
    margin-bottom: 0.8rem;
  }
  
  .start-content p {
    font-size: 1rem; /* Smaller for mobile */
    line-height: 1.4;
    margin-bottom: 1.5rem;
  }
  
  .start-game-btn {
    font-size: 1.2rem; /* Smaller for mobile */
    padding: 0.8rem 1.5rem;
    margin-bottom: 1rem;
  }
  
  /* Mobile checkbox and label styles */
  .fullscreen-toggle, .sound-toggle {
    font-size: 1rem;
    margin: 0.5rem 0;
  }
  
  .fullscreen-toggle label, .sound-toggle label {
    font-size: 1rem;
    line-height: 1.3;
    margin-left: 0.5rem;
  }
  
  #fullscreenCheckbox, #soundCheckbox {
    width: 16px;
    height: 16px;
  }
}

@media (max-width: 480px) {
  .game-container {
    padding: 0.5rem;
  }
  
  .start-game-screen {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    height: 100%;
    border-radius: 10px; /* Slightly smaller radius for mobile */
  }
  
  .game-over-title {
    font-size: 1.2rem;
  }
  
  .modal-content {
    padding: 1rem;
  }
  
  /* Even smaller text for very small screens */
  .start-content h2 {
    font-size: 1.2rem; /* Even smaller for tiny screens */
    line-height: 1.2;
    margin-bottom: 0.6rem;
  }
  
  .start-content p {
    font-size: 0.9rem; /* Even smaller for tiny screens */
    line-height: 1.3;
    margin-bottom: 1.2rem;
  }
  
  .start-game-btn {
    font-size: 1rem; /* Even smaller for tiny screens */
    padding: 0.7rem 1.2rem;
    margin-bottom: 0.8rem;
  }
  
  /* Smaller checkbox and label styles for tiny screens */
  .fullscreen-toggle, .sound-toggle {
    font-size: 0.9rem;
    margin: 0.4rem 0;
  }
  
  .fullscreen-toggle label, .sound-toggle label {
    font-size: 0.9rem;
    line-height: 1.2;
    margin-left: 0.4rem;
  }
  
  #fullscreenCheckbox, #soundCheckbox {
    width: 14px;
    height: 14px;
  }
}

/* Game specific animations */
@keyframes heartPulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.2); }
}

@keyframes coinSpin {
  from { transform: rotateY(0deg); }
  to { transform: rotateY(360deg); }
}

@keyframes explosionEffect {
  0% { 
    transform: scale(0);
    opacity: 1;
  }
  100% { 
    transform: scale(2);
    opacity: 0;
  }
}

/* Power-up effects */
/* Subtle, less distracting notification style */
.power-up-notification {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: rgba(255,255,180,0.85);
  color: #4a7c59;
  padding: 0.5rem 1.2rem;
  border-radius: 30px;
  font-family: 'Poppins', Arial, sans-serif;
  font-size: 0.95rem;
  z-index: 150;
  box-shadow: 0 2px 12px rgba(34,139,34,0.10);
  opacity: 0.85;
  pointer-events: none;
  animation: powerUpNotification 1.2s ease-in-out forwards;
}

@keyframes powerUpNotification {
  0% {
    opacity: 0;
    transform: translate(-50%, -50%) scale(0.5);
  }
  20% {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1.1);
  }
  80% {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
  }
  100% {
    opacity: 0;
    transform: translate(-50%, -50%) scale(0.8);
  }
}

/* Jungle decoration animation */
@keyframes jungle-decoration {
  0% {
    transform: translateX(-100%);
  }
  100% {
    transform: translateX(100%);
  }
}

/* Enhanced jungle atmosphere */
.game-header {
  background: linear-gradient(135deg, 
    rgba(13, 61, 13, 0.7) 0%, 
    rgba(10, 45, 10, 0.6) 50%,
    rgba(5, 26, 5, 0.7) 100%
  );
  border: 2px solid rgba(34, 139, 34, 0.4);
}
