/* style.css */

/* --- Estilos Globales y Fuente --- */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: "Press Start 2P", cursive;
}

body {
  background: linear-gradient(to bottom, #9be15d, #00e3ae);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  height: 100vh;
  color: #fff;
  overflow: hidden;
  text-shadow: 2px 2px 0px rgba(0,0,0,0.5);
  transition: background 1s ease;
}

h1 {
  margin: 20px 0;
  font-size: 2.5em;
  text-shadow: 4px 4px 0px #2a572a;
  z-index: 5;
  color: #fff;
}

/* --- Controles del Juego --- */
#game-controls {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 10px;
  width: 900px;
  margin-top: 10px;
}

#game-controls button {
  padding: 10px 15px;
  background: #ffc107;
  color: #333;
  border: none;
  border-radius: 5px;
  cursor: pointer;
  box-shadow: 2px 2px 0px rgba(0,0,0,0.5);
  font-size: 0.8em;
}
#game-controls button:hover { background: #e0a800; }
#btn-salir-juego { background: #dc3545; color: #fff; }
#btn-salir-juego:hover { background: #c82333; }

/* --- Audio UI --- */
.audio-controls {
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(0,0,0,0.3);
  padding: 8px 12px;
  border-radius: 8px;
  border: 2px solid rgba(255,255,255,0.2);
}

#btn-mute {
  background: #17a2b8 !important;
  color: #fff !important;
  min-width: 45px;
  display: flex;
  justify-content: center;
}
#btn-mute:hover { background: #138496 !important; }

#volumen-slider {
  cursor: pointer;
  width: 100px;
  height: 8px;
  border-radius: 5px;
  background: #d3d3d3;
  outline: none;
  -webkit-appearance: none;
}
#volumen-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 15px;
  height: 15px;
  border-radius: 50%;
  background: #28a745;
  cursor: pointer;
}

/* --- Juego --- */
#hud {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 800px;
  font-size: 1.1em; 
  margin-top: 10px;
  text-shadow: 2px 2px 0px rgba(0,0,0,0.5);
  padding: 5px 10px;
  background-color: rgba(0, 0, 0, 0.3);
  border-radius: 5px;
}

#game {
  position: relative;
  width: 800px;
  height: 500px;
  border: 4px solid #fff;
  border-radius: 15px;
  overflow: hidden;
  box-shadow: 0 0 20px rgba(0,0,0,0.4);
  margin-top: 10px;
  background-color: rgba(255, 255, 255, 0.15); 
  backdrop-filter: blur(3px); 
}

#player {
  position: absolute;
  width: 50px;
  height: 50px;
  background: url('https://www.opengameart.org/sites/default/files/player_0.png') center/cover;
  image-rendering: pixelated;
  bottom: 20px;
  left: 20px;
  transition: transform 0.1s;
  z-index: 10;
}

.apple, .power-up {
  position: absolute;
  font-size: 30px;
  animation: float 2s ease-in-out infinite;
  z-index: 9;
  text-shadow: none;
  transition: transform 0.3s ease-out, opacity 0.3s ease-out;
}
.apple.collected, .power-up.collected {
  animation: none;
  transform: scale(1.5);
  opacity: 0;
}

.enemy {
  position: absolute;
  font-size: 35px;
  z-index: 9;
  text-shadow: none;
  transition: transform 0.2s, opacity 0.3s;
}
.enemy.slowed {
  opacity: 0.5; 
  filter: hue-rotate(180deg); 
}

@keyframes float {
  0% { transform: translateY(0px); }
  50% { transform: translateY(-10px); }
  100% { transform: translateY(0px); }
}

/* --- Árbol --- */
#tree {
  position: absolute;
  width: 100px;
  height: 120px;
  right: 50px;
  bottom: 20px;
  background: url('https://www.opengameart.org/sites/default/files/tree_0.png') center/cover;
  image-rendering: pixelated;
  z-index: 8;
  transition: transform 0.5s, filter 0.5s; 
  transform-origin: bottom center; 
}

#tree.tree-ready {
  filter: drop-shadow(0 0 15px #ffd700) brightness(1.3); /* Brillo dorado */
  animation: treePulse 0.8s infinite alternate;
}

@keyframes treePulse {
  0% { transform: scale(1); } 
  100% { transform: scale(1.1); } 
}

/* --- Mensajes y Menús --- */
#message {
  position: absolute;
  width: 100%;
  height: 100%;
  background: rgba(0,0,0,0.85);
  top: 0;
  left: 0;
  display: none;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  text-align: center;
  color: #fff;
  z-index: 20;
  padding: 20px;
}
#message h2 {
  font-size: 2.5em;
  margin-bottom: 20px;
  color: #a7f0ba;
  text-shadow: 3px 3px 0px #2a572a;
}
#message h2.game-over-title {
  color: #ff6b6b;
  text-shadow: 3px 3px 0px #5e0000;
}
#message p { font-size: 1.2em; margin-bottom: 30px; line-height: 1.5; }
#message button {
  padding: 12px 25px;
  border: none;
  border-radius: 8px;
  background: #28a745;
  color: #fff;
  cursor: pointer;
  font-size: 1.1em;
  transition: background 0.3s;
  margin: 10px;
  min-width: 200px;
}
#message button:hover { background: #218838; }
#restart-level-btn { background: #ffc107; color: #333; }
#restart-level-btn:hover { background: #e0a800; }

.hidden { display: none !important; }

.overlay {
  position: fixed;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.9);
  top: 0;
  left: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  z-index: 100;
}
.overlay-simple {
  position: absolute;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.7);
  top: 0;
  left: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 50;
  color: #fff;
}
.overlay-simple h2 { font-size: 3em; text-shadow: 4px 4px 0px rgba(0,0,0,0.5); }

#main-menu h1 {
  font-size: 4em;
  margin: 0;
  margin-bottom: 60px;
  color: #a7f0ba;
  text-shadow: 5px 5px 0px #2a572a;
}
.menu-buttons button {
  padding: 18px 35px;
  border: none;
  border-radius: 10px;
  background: #28a745;
  color: #fff;
  cursor: pointer;
  font-size: 1.5em;
  font-weight: bold;
  transition: background 0.3s, transform 0.2s;
  margin: 15px;
  min-width: 250px;
  box-shadow: 3px 3px 0px rgba(0,0,0,0.5);
}
.menu-buttons button:hover { background: #218838; transform: scale(1.08); }

.menu-card {
  background: #fff;
  color: #333;
  padding: 40px 50px;
  border-radius: 15px;
  box-shadow: 0 5px 25px rgba(0,0,0,0.5);
  text-align: center;
}
.menu-card h2 { font-size: 3em; margin-bottom: 25px; color: #2a572a; }
.menu-card p { font-size: 1.3em; margin-bottom: 30px; line-height: 1.6; }
.menu-card button {
  padding: 15px 30px;
  border: none;
  border-radius: 8px;
  background: #28a745;
  color: #fff;
  cursor: pointer;
  font-size: 1.1em;
  transition: background 0.3s;
}
.menu-card button:hover { background: #218838; }

.blinking { animation: parpadeo 0.2s linear 10; }
@keyframes parpadeo {
  0% { opacity: 1; }
  50% { opacity: 0.1; }
  100% { opacity: 1; }
}