.sword-attack {
  font-size: 2rem;
  width: 40px;
  height: 40px;
}

.heart {
  position: absolute;
  pointer-events: all;
  cursor: pointer;
  width: 35px;
  height: 35px;
  transition: transform 0.2s;
  animation: heartPulse 1s infinite;
  z-index: 8;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: #c19a6b;
  display: flex;
  justify-content: center;
  align-items: center;
  font-family: 'Segoe UI Emoji', 'Apple Color Emoji', 'Noto Color Emoji', sans-serif;
}

#game-container {
  position: relative;
  width: 100%;
  height: 100%;
  min-width: 800px;
  min-height: 450px;
  max-width: 100vw;
  max-height: 100vh;
  background: linear-gradient(135deg, #d4a574 0%, #c19a6b 50%, #b8926a 100%);
  overflow: hidden;
  font-size: 2rem;
}

/* Responsive per iframe */
@media (max-width: 800px) {
  #game-container {
    min-width: 100%;
    font-size: 1.5rem;
  }
}

#player, .tiger, .sword-attack {
  position: absolute;
  transition: none;
  font-size: 2.5rem;
  line-height: 1;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
}

#player::after {
  content: '😨';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 2.5rem;
}

/* Spada sempre visibile nella mano del giocatore */
#player::before {
  content: '🗡️';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-30%, -50%);
  font-size: 2rem;
  z-index: -1;
}

.tiger::after {
  content: '🐅';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 2.5rem;
}

.sword-attack::after {
  content: '⚔️';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 2rem;
  animation: swordSlash 0.3s ease-out;
}

@keyframes swordSlash {
  0% { 
    transform: translate(-50%, -50%) scale(0.5) rotate(0deg);
    opacity: 1;
  }
  100% { 
    transform: translate(-50%, -50%) scale(1.5) rotate(360deg);
    opacity: 0;
  }
}

/* Darkness layer removed - no longer needed */

#player {
  z-index: 10;
}

#sword-attacks, #tigers, #blood-splats {
  position: absolute;
  width: 100%;
  height: 100%;
  top: 0;
  left: 0;
}

/* Menu iniziale */
#menu {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 100;
  background: rgba(139, 69, 19, 0.95);
  padding: 40px;
  border-radius: 20px;
  text-align: center;
  border: 3px solid #8b4513;
  box-shadow: 0 0 30px rgba(139, 69, 19, 0.8);
  font-family: 'Courier New', monospace;
}

#menu h1 {
  color: #ffd700;
  font-size: 2.5rem;
  margin-bottom: 20px;
  text-shadow: 0 0 10px rgba(255, 215, 0, 0.8);
  font-family: 'Courier New', monospace;
}

#menu p {
  color: #fff;
  font-size: 1rem;
  margin-bottom: 20px;
  line-height: 1.6;
  font-family: 'Courier New', monospace;
}

#best-record {
  color: #ffd700;
  font-size: 1.3rem;
  margin-bottom: 20px;
  font-weight: bold;
  text-shadow: 0 0 10px rgba(255, 215, 0, 0.6);
  font-family: 'Courier New', monospace;
}

#play-btn {
  font-size: 2rem;
  padding: 15px 50px;
  background: linear-gradient(135deg, #8b4513, #654321);
  color: #ffd700;
  border: none;
  border-radius: 10px;
  cursor: pointer;
  font-weight: bold;
  transition: transform 0.2s, box-shadow 0.2s;
  font-family: 'Courier New', monospace;
}

#play-btn:hover {
  transform: scale(1.1);
  box-shadow: 0 0 20px rgba(139, 69, 19, 0.8);
}

/* UI in gioco */
#ui {
  position: absolute;
  top: 20px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 20;
  width: 90%;
  max-width: 600px;
  display: none;
}

#health-bar {
  width: 100%;
  height: 25px;
  border: 3px solid #8b4513;
  background: rgba(139, 69, 19, 0.6);
  border-radius: 15px;
  overflow: hidden;
  box-shadow: 0 0 15px rgba(0,0,0,0.8);
  margin-bottom: 10px;
}

#health-fill {
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, #ff4444, #cc0000);
  transition: width 0.3s ease;
  box-shadow: inset 0 0 10px rgba(255,255,255,0.3);
}

#timer {
  position: absolute;
  top: 0;
  right: 0;
  background: rgba(139, 69, 19, 0.9);
  color: #ffd700;
  padding: 8px 20px;
  border-radius: 10px;
  font-size: 1.3rem;
  font-weight: bold;
  border: 2px solid #8b4513;
  box-shadow: 0 0 15px rgba(139, 69, 19, 0.5);
  font-family: 'Courier New', monospace;
}

#pause-btn {
  position: absolute;
  top: 0;
  left: 0;
  background: rgba(139, 69, 19, 0.9);
  color: #ffd700;
  padding: 8px 20px;
  border-radius: 10px;
  font-size: 1.3rem;
  border: 2px solid #8b4513;
  cursor: pointer;
  transition: transform 0.2s;
  font-family: 'Courier New', monospace;
}

#pause-btn:hover {
  transform: scale(1.1);
  background: rgba(139, 69, 19, 1);
}

/* Overlay pausa */
#pause-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(139, 69, 19, 0.95);
  z-index: 50;
  display: none;
  justify-content: center;
  align-items: center;
  flex-direction: column;
}

#pause-overlay h2 {
  color: #ffd700;
  font-size: 3rem;
  margin-bottom: 20px;
  text-shadow: 0 0 20px rgba(255, 215, 0, 0.8);
  font-family: 'Courier New', monospace;
}

#pause-overlay p {
  color: #fff;
  font-size: 1.2rem;
  font-family: 'Courier New', monospace;
}

/* Schermata Game Over */
#gameover-screen {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(139, 69, 19, 0.98);
  z-index: 100;
  display: none;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 30px;
}

#gameover-screen h1 {
  color: #ff0000;
  font-size: 3rem;
  text-shadow: 0 0 20px rgba(255,0,0,0.8);
  animation: pulse 1.5s infinite;
  font-family: 'Courier New', monospace;
}

@keyframes pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.05); }
}

#final-time {
  color: #ffd700;
  font-size: 2rem;
  font-weight: bold;
  text-shadow: 0 0 15px rgba(255, 215, 0, 0.8);
  font-family: 'Courier New', monospace;
}

#record-info {
  color: #ffd700;
  font-size: 1.5rem;
  font-weight: bold;
  text-shadow: 0 0 10px rgba(255, 215, 0, 0.6);
  font-family: 'Courier New', monospace;
}

#gameover-buttons {
  display: flex;
  gap: 20px;
  flex-wrap: wrap;
  justify-content: center;
}

#gameover-buttons button {
  font-size: 1.5rem;
  padding: 15px 30px;
  border: none;
  border-radius: 10px;
  cursor: pointer;
  font-weight: bold;
  transition: transform 0.2s, box-shadow 0.2s;
  font-family: 'Courier New', monospace;
}

#replay-btn {
  background: linear-gradient(135deg, #8b4513, #654321);
  color: #ffd700;
  border: 3px solid #8b4513;
}

#replay-btn:hover {
  transform: scale(1.1);
  box-shadow: 0 0 20px rgba(139, 69, 19, 0.8);
}

#reward-btn {
  background: linear-gradient(135deg, #ff6b6b, #ee5a6f);
  color: #fff;
  border: 3px solid #ff6b6b;
}

#reward-btn:hover {
  transform: scale(1.1);
  box-shadow: 0 0 20px rgba(255,107,107,0.8);
}

#reward-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

#hearts {
  position: absolute;
  width: 100%;
  height: 100%;
  top: 0;
  left: 0;
  pointer-events: none;
}

.heart::after {
  content: '❤️';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 2rem;
}

.heart:hover {
  transform: scale(1.2);
}

@keyframes heartPulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.1); }
}

.skull::after {
  content: '💀';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 2.5rem;
}

.skull {
  opacity: 1;
  transition: opacity 0.5s ease-out;
}

.skull.fading {
  opacity: 0;
}

/* Schizzi di sangue */
.blood-splat::after {
  content: '🩸';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 2rem;
}

.blood-splat {
  position: absolute;
  width: 40px;
  height: 40px;
  opacity: 0.9;
  animation: bloodFade 2.5s ease-out forwards;
  z-index: 3;
  pointer-events: none;
}

@keyframes bloodFade {
  0% {
    opacity: 0.8;
    transform: scale(0.5);
  }
  50% {
    opacity: 1;
    transform: scale(1.2);
  }
  100% {
    opacity: 0;
    transform: scale(1);
  }
}

#mobile-controls {
  position: absolute;
  bottom: 30px;
  left: 30px;
  width: 150px;
  height: 150px;
  z-index: 30;
  display: none; /* Nascosto su desktop */
}

.dpad-btn {
  position: absolute;
  width: 50px;
  height: 50px;
  background: rgba(139, 69, 19, 0.4); /* Marrone bronzo semi-trasparente */
  border: 2px solid #ffd700; /* Bordo oro */
  border-radius: 10px;
  color: #ffd700;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: all;
  font-size: 1.5rem;
  touch-action: manipulation;
}

#btn-up { left: 50px; top: 0; }
#btn-down { left: 50px; bottom: 0; }
#btn-left { left: 0; top: 50px; }
#btn-right { right: 0; top: 50px; }

@media (max-width: 800px) {
  #mobile-controls { display: block; }
}