/* ---------- RESET BASE ---------- */
html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  background: #1e272e;
  color: #f5f6fa;
  font-family: 'Press Start 2P', cursive;
  overflow: hidden;                 /* BLOCCA SCROLL BROWSER */
  touch-action: none;              /* DISATTIVA GESTI TOUCH NATIVI (pinch, scroll) */
  display: flex;
  flex-direction: column;
  align-items: center;
}

/* ---------- TESTI ---------- */
h1 {
  font-size: 4rem;
  text-shadow: 2px 2px 6px #ffa502;
  margin: 0.3em 0 0.2em 0;
}

h2,h3 {
  font-size: 2rem;
  margin: 0 0 1em 0;
  text-shadow: 1px 1px 4px #ff7f50;
}

h6{
 margin: 0 0 1em 0;
  text-shadow: 1px 1px 4px #ff7f50;

}

/* ---------- PULSANTE PLAY ---------- */
#playBtn {
  font-size: 2.5rem;
  padding: 20px 50px;
  background: linear-gradient(135deg, #ff6f00, #ff8f00);
  border: none;
  border-radius: 25px;
  color: white;
  font-weight: bold;
  box-shadow: 0 6px 10px rgba(255, 143, 0, 0.7);
  cursor: pointer;
  transition: background 0.3s ease, box-shadow 0.3s ease;
  user-select: none;
  margin-top: 30px;
}

#playBtn:hover {
  background: linear-gradient(135deg, #ff8f00, #ffaa00);
  box-shadow: 0 8px 14px rgba(255, 170, 0, 0.9);
}

/* ---------- CANVAS / CAMPO DI GIOCO ---------- */

canvas {
  display: block;
  margin: 20px auto;
  max-width: 100%;
  max-height: 100%;
  background: #16222a;
  border: 4px solid #ffa502;
  border-radius: 12px;
  box-sizing: border-box;
}

/* ---------- SCHERMATE FULLSCREEN (START / WIN) ---------- */
#startScreen,
#winScreen {
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  background: #0f1c2e;
  display: flex;
  justify-content: center;
  align-items: center;
  flex-direction: column;
  z-index: 10;
  font-family: 'Press Start 2P', cursive;
}

/* ---------- SCHERMATA GAME OVER ---------- */
#gameOverScreen {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0,0,0,0.85);
  display: flex;
  justify-content: center;
  align-items: center;
  flex-direction: column;
  color: #fff;
 font-family: 'Press Start 2P', cursive;
  z-index: 999;
}

#gameOverScreen.hidden {
  display: none;
}

.game-over-content {
  text-align: center;
}

#gameOverScreen button {
  margin-top: 20px;
  padding: 12px 24px;
  background: linear-gradient(to bottom, #ff9933, #cc6600);
  color: #fff;
   font-family: 'Press Start 2P', cursive;
  font-size: 14px;
  border: 3px solid #663300;
  border-radius: 8px;
  box-shadow: 0 0 10px rgba(255, 255, 255, 0.2), inset 0 0 5px #fff;
  cursor: pointer;
  transition: transform 0.2s, box-shadow 0.2s;
}

#gameOverScreen button:hover {
  transform: scale(1.05);
  box-shadow: 0 0 15px #ffcc66, inset 0 0 5px #fff;
}

/* ---------- EFFETTO DANNO FLASH ---------- */
#damageFlash {
  pointer-events: none;
  position: fixed;
  top: 0; left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(255, 0, 0, 0.5);
  opacity: 0;
  z-index: 2000;
  transition: opacity 0.1s ease;
}

#damageFlash.active {
  opacity: 1;
}

@keyframes flashRed {
  0% {opacity: 0.7;}
  100% {opacity: 0;}
}

/* ---------- JOYSTICK ANALOGICO ---------- */
#joystick-container {
  position: fixed;
  bottom: 20px;
  right: 20px;
  width: 120px;
  height: 120px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 50%;
  z-index: 999;
  touch-action: none;
}

#joystick {
  width: 60px;
  height: 60px;
  background: radial-gradient(circle at 30% 30%, #ff8f00, #cc6600);
  border-radius: 50%;
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  touch-action: none;
}

/* ---------- PULSANTI TOUCH (se riattivi frecce) ---------- */
.touch-btn {
  font-size: 2rem;
  padding: 12px 18px;
  border-radius: 12px;
  background: #ff6f00cc;
  border: none;
  color: white;
  box-shadow: 0 4px 8px #ff8f0033;
  user-select: none;
  cursor: pointer;
  transition: background 0.2s ease;
}

.touch-btn:active {
  background: #ffa500cc;
}

#playerName {
  padding: 10px;
  font-size: 16px;
  border-radius: 8px;
  border: 2px solid #ffa502;
  width: 60%;
  max-width: 300px;
  margin-top: 10px;
}

#toggleSoundBtn {
  margin-top: 20px;
  font-size: 1.5rem;
  padding: 10px 30px;
  background: #57606f;
  border: none;
  border-radius: 18px;
  color: white;
  font-weight: bold;
  cursor: pointer;
  transition: background 0.3s ease;
}

#toggleSoundBtn:hover {
  background: #747d8c;
}

.modal {
  display: none;
  position: fixed;
  z-index: 9999;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.8);
}

.modal-content {
  background-color: #333;
  margin: 10% auto;
  padding: 20px;
  border: 2px solid #ffcc00;
  border-radius: 10px;
  width: 90%;
  max-width: 400px;
  color: #fff;
}

.close {
  color: #ffcc00;
  float: right;
  font-size: 28px;
  font-weight: bold;
  cursor: pointer;
}

 #apriClassificaBtn {
      position: fixed;
      top: 20px;
      right: 20px;
      padding: 10px 20px;
      font-size: 1rem;
      background: linear-gradient(135deg, #ff6f00, #ff8f00);
      border: none;
      border-radius: 12px;
      color: white;
      
      cursor: pointer;
      
      z-index: 1000;
      box-shadow: 0 4px 8px rgba(0,0,0,0.2);
    }
    #apriClassificaBtn:hover {
      background: linear-gradient(135deg, #ff8f00, #ffaa00);
    }

    #classificaContainer {
      position: fixed;
      top: 60px;
      left: 50%;
      transform: translateX(-50%);
      background: #0f1c2e;
      border: 3px solid #ffa502;
      border-radius: 16px;
      padding: 20px;
      z-index: 9999;
      width: 90%;
      max-width: 400px;
      box-shadow: 0 4px 16px rgba(0, 0, 0, 0.6);
      max-height: 60vh;          /* << LIMITA ALTEZZA VISIBILE */
     overflow-y: auto;          /* << ATTIVA SCROLL VERTICALE */
      color: #fff;
      font-family: 'Press Start 2P', cursive;
      display: none;
      text-align: center;
    }

    #classificaContainer h3 {
      font-size: 1.8rem;
      color: #ffa502;
      margin-bottom: 10px;
      text-shadow: 1px 1px 4px #ff7f50;
    }

    #classificaContainer ol {
      padding-left: 0;
      list-style: none;
      text-align: left;
    }

    #classificaContainer li {
      background: #1e272e;
      margin: 5px 0;
      padding: 10px;
      border-radius: 8px;
      border: 1px solid #57606f;
      box-shadow: inset 0 0 4px #2f3640;
    }

    #classificaContainer button {
      margin-top: 15px;
      padding: 8px 20px;
      background: #ff6f00;
      border: none;
      border-radius: 10px;
      color: white;

      cursor: pointer;
      font-size: 1rem;
      box-shadow: 0 4px 8px rgba(255, 143, 0, 0.4);
    }

    #classificaContainer button:hover {
      background: #ffa502;
    }

/* ---------- ANIMAZIONE INIZIALE ---------- */
@keyframes fadeZoomIn {
  from {
    opacity: 0;
    transform: scale(0.8);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

.start-content {
  animation: fadeZoomIn 1s ease-out;
}

.start-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  animation: fadeZoomIn 1s ease-out;
  text-align: center;
}

#hitAlert {
  position: fixed;
  top: 20%;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(255, 0, 0, 0.85);
  color: white;
  padding: 20px 30px;
  font-size: 1.6rem;
  font-weight: bold;
  border-radius: 12px;
  z-index: 1001;
  text-align: center;
  box-shadow: 0 0 20px #ff6b6b;
  animation: alertFade 1.2s ease-in-out;
}

@keyframes alertFade {
  0% { opacity: 0; transform: translate(-50%, -20%); }
  30% { opacity: 1; }
  70% { opacity: 1; }
  100% { opacity: 0; transform: translate(-50%, -50%); }
}

.hidden {
  display: none;
}

.modal {
  display: none;
  position: fixed;
  z-index: 9999;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.8);
}


.modal-content {
  background-color: #333;
  margin: 10% auto;
  padding: 16px;
  border: 2px solid #ffcc00;
  border-radius: 10px;
  width: 95%;
  max-width: 340px;
  max-height: 75vh; /* limite altezza */
  overflow-y: auto;  /* scroll se necessario */
  color: #fff;
  font-family: 'Press Start 2P', cursive;
  font-size: 10px; /* più piccolo per schermi piccoli */
  line-height: 1.4;
  text-align: left;
}

.close {
  color: #ffcc00;
  float: right;
  font-size: 28px;

  cursor: pointer;
}

#apriRegoleBtn {
  position: fixed;
  top: 20px;
  right: 200px; /* Sposta a sinistra rispetto a Classifica */
  padding: 10px 20px;
  font-size: 0.5rem;
  background: linear-gradient(135deg, #ff6f00, #ff8f00);
  border: none;
  border-radius: 12px;
  color: white;

  cursor: pointer;
  z-index: 1000;
  box-shadow: 0 4px 8px rgba(0,0,0,0.2);
}

#apriRegoleBtn:hover {
  background: linear-gradient(135deg, #ff6f00, #ff8f00);
}

#topButtons {
  position: fixed;
  top: 20px;
  right: 20px;
  display: flex;
  gap: 12px; /* distanza tra i pulsanti */
  z-index: 1000;
}

#topButtons button {
  padding: 10px 16px;
  font-size: 0.7rem;
  background: linear-gradient(135deg, #ff6f00, #ff8f00);
  border: none;
  border-radius: 12px;
  color: white;

  cursor: pointer;
  box-shadow: 0 4px 8px rgba(0,0,0,0.2);
  transition: background 0.2s ease;
}

#topButtons button:hover {
  background: linear-gradient(135deg, #ffaa00, #ff8f00);
}

#apriRegoleBtn {
 background: linear-gradient(135deg, #ff6f00, #ff8f00);
}
#apriRegoleBtn:hover {
background: linear-gradient(135deg, #ff6f00, #ff8f00);
}


#startScreen {
  background-image: url('asset/image/camping_pixel.jpg');
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  color: white;
}

body, html {
  font-family: 'Press Start 2P', cursive;
  
}

#startScreen {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100vh;
  text-align: center;
  background-color: rgba(0, 0, 0, 0.6);
}

.titoloGioco {
  font-size: 40px;
  color: #ff8f00;
  text-shadow: 5px 5px 0 #000;
  margin-bottom: 20px;
 
}

 
.slogan {
  font-size: 10px;
  font-style: italic;
  color: #ccc;
  margin-bottom: 20px;
}

.emojiSet {
  font-size: 20px;
  margin-bottom: 20px;
}

#playerName {
  font-size: 30;
  padding: 5px;
  margin-top: 10px;
  margin-bottom: 20px;
  font-family: 'Press Start 2P', cursive;
}

#playBtn {
  font-family: 'Press Start 2P', cursive;
  padding: 10px 20px;
  font-size: 20px;
  background-color: #ffcc00;
  color: black;
  border: 2px solid #000;
  border-radius: 6px;
  cursor: pointer;
  box-shadow: 0 0 10px #ffa502;
  transition: transform 0.2s, background-color 0.3s;
}

#playBtn:hover {
  transform: scale(1.05);
  background-color: #ffdf33;
}

body {
  font-family: 'Press Start 2P', cursive; /* Sostituisci con il tuo font */
}

.pixel-font {
  font-family: 'Press Start 2P', cursive;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 1px;
}

button{


  font-family: 'Press Start 2P';

 
  letter-spacing: 1px;


 padding: 10px 16px;
  font-size: 1rem;
  background: linear-gradient(135deg, #ff6f00, #ff8f00);
  border: none;
  border-radius: 12px;
  color: white;
 
  cursor: pointer;
  box-shadow: 0 4px 8px rgba(0,0,0,0.2);
  transition: background 0.2s ease;
}

.credits {
  font-size: 0.5rem;
  color: #ccc;
  margin-top: 20px;
  text-shadow: 1px 1px 2px #000;
}