
/* RESET & FOND */
body {
  margin: 0;
  padding: 0;
  font-family: 'Pirata One', cursive;
  background: url("Assets/Images/background-entrance-tavern.png") no-repeat center center fixed;
  background-size: cover;
  overflow-x: auto;
}

/* --- WELCOME SCREEN --- */
#welcome-screen {
  position: relative;
  text-align: center;
  color: #f4e2b8;
  text-shadow: 2px 2px 5px black;
  z-index: 1;
  padding-top: 50px;
}


.welcome-text {
  position: fixed;
  z-index: 20; /* Plus haut que le tavernier */
  text-align: center;
  color: rgb(241, 218, 140);
  font-family: 'Pirata One', cursive;
  font-size: 3.5rem;
  margin-top: 1rem;
  top: 60%;
  left: 50%;
  transform: translateX(-50%);
}

/* Tavernier fixe en bas, centré */
#tavernier {
  position: fixed;
  bottom: 0;
  left: 50%;
  transform: translateX(-63%);
  z-index: 5;
  height: 1300px;
  pointer-events: none;
}

/* --- ENTER BUTTON --- */
#enter-button {
  position: fixed;
  top: 55%;
  left: 50%;
  transform: translate(-50%, -50%);
  padding: 18px 36px;
  font-size: 1.6rem;
  font-family: 'Pirata One', cursive;
  color: #fff5cc;
  background: linear-gradient(145deg, #a45a24, #7c3a11);
  border: 3px solid #5a2d0c;
  border-radius: 12px;
  box-shadow:
    inset 0 0 5px #00000055,
    0 6px 12px rgba(0, 0, 0, 0.5);
  cursor: pointer;
  z-index: 1000;
  transition: all 0.3s ease-in-out;
}

#enter-button:hover {
  transform: translate(-50%, -50%) scale(1.05);
  background: linear-gradient(145deg, #b56a30, #8a4a1c);
  box-shadow:
    inset 0 0 8px #00000066,
    0 10px 20px rgba(0, 0, 0, 0.6);
  border-color: #e69c60;
}

#enter-button:active {
  transform: translate(-50%, -50%) scale(0.98);
  box-shadow:
    inset 0 2px 6px #00000088,
    0 2px 6px rgba(0, 0, 0, 0.3);
}

#enter-button:hover {
  transform: translate(-50%, -50%) scale(1.2);
}

/* --- GAME CONTAINER --- */
#game-container {
  position: fixed;
  width: 100%;
  padding: 30px 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  background: url("Assets/Images/background-entrance-tavern.png") no-repeat center center fixed;
  background-size: cover;
}

/* --- SCÈNE DE JEU FIXÉE EN 16:9 --- */
.scene-wrapper {
  top: 150px;
  width: 100%;
  max-width: 1600px;
  aspect-ratio: 16 / 9;
  position: fixed;
  overflow: hidden;
  background: black;
}


#scene-image {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  z-index: 0;
}

/* --- BANNIÈRE DANS LA ZONE 16:9 --- */
.player-banner {
  position: absolute;
  top: -7%;
  left: -2%;
  width: 18%;
  z-index: 5;
  pointer-events: none;
}

.player-banner img {
  width: 100%;
  height: auto;
  display: block;
  animation: wave-flag 3.5s ease-in-out infinite;
  transform-origin: left center;
}

#player2-banner {
  position: absolute;
  top: -12%;
  left: 10%;
  width: 18%;
  z-index: 10;
  pointer-events: none;
}

#player3-banner {
  position: absolute;
  top: -12%;
  left: 73%;
  width: 18%;
  z-index: 10;
  pointer-events: none;
}

#player4-banner {
  position: absolute;
  top: -7%;
  left: 85%;
  width: 18%;
  z-index: 10;
  pointer-events: none;
}

.hp-counter {
  position: absolute;
  top: 45%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 120px;
  color: white;
  text-shadow: 1px 1px 2px black;
}

/* --- ACTION PANEL --- */
#action-panel {
  position: fixed;
  top: calc(150px + 900px + 30px); /* ✅ +30px pour l’espace */
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  justify-content: center;
  gap: 60px; /* ✅ Un peu plus d’espace entre les groupes */
  z-index: 20;
}

.player-controls {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
}

.player-btn {
  padding: 14px 48px;
  font-size: 2.5rem;
  font-family: 'Pirata One', cursive;
  color: #fdf3e7;
  background-color: #1a1a1a;
  border: 4px solid transparent;
  border-radius: 6px;
  box-shadow:
    inset 0 0 0 rgba(255, 255, 255, 0),
    0 10px 0 #000000,
    0 14px 20px rgba(0, 0, 0, 0.6);
  cursor: pointer;
  transition: all 0.15s ease-in-out;
  letter-spacing: 1px;
  position: relative;
  z-index: 1;
  text-shadow: 1px 1px 2px black;
}

.player-btn:hover {
  transform: scale(1.1);
  background-color: #8b0000;
}

/* --- UTILS --- */
.hidden {
  display: none !important;
}

#video-container {
  display: none; /* ✅ Masqué par défaut */
  position: absolute;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background-color: rgba(0, 0, 0, 0.4);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  z-index: 9999;
  justify-content: center;
  align-items: center;
}

/* Position du logo à l'écran d'accueil */
#welcome-logo {
  position: fixed;
  top: 80px;
  left: 50%;
  transform: translateX(-50%);
  width: 600px;
  z-index: 5;
}

/* Position du logo pendant le jeu */
#welcome-logo.logo-in-game {
  position: fixed;
  top: 20px;
  right: 40px; /* ✅ toujours visible quel que soit l'écran */
  width: 300px;
  height: auto;
  z-index: 9999;
}

.hp-controls {
  display: flex;
  justify-content: center;
  margin-top: 5px;
  gap: 5px;
}

.hp-controls button {
  background: linear-gradient(to bottom, #5a2d0c, #3a1c06);
  color: #fff8e1;
  border: 2px solid #c59b6d;
  padding: 6px 14px;
  font-weight: bold;
  font-size: 1.2rem;
  border-radius: 8px;
  cursor: pointer;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.4);
  transition: all 0.2s ease;
}

.hp-controls button:hover {
  background: linear-gradient(to bottom, #7e3e13, #502506);
  transform: scale(1.1);
  box-shadow: 0 0 10px #ffc27c;
}

#global-counter {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) scale(1);
  font-size: 180px;
  font-weight: bold;
  font-family: 'Pirata One', cursive;
  opacity: 0;
  pointer-events: none;
  z-index: 1000;
  transition: opacity 0.3s ease, transform 0.3s ease;
  text-shadow:
    0 0 10px rgba(255, 255, 255, 0.8),
    0 0 20px rgba(255, 255, 255, 0.5),
    0 0 40px rgba(255, 255, 255, 0.2);
}

/* Apparition animée */
#global-counter.show {
  opacity: 1;
  transform: translate(-50%, -50%) scale(1.2);
}

/* Couleurs douces avec glow */
#global-counter.positive {
  color: #a8ffb4; /* vert clair doux */
  text-shadow:
    0 0 10px #6eff89,
    0 0 20px #4dff75,
    0 0 40px #1eff5d;
}

#global-counter.negative {
  color: #ffb4b4; /* rouge clair doux */
  text-shadow:
    0 0 10px #ff6e6e,
    0 0 20px #ff4d4d,
    0 0 40px #ff1e1e;
}

.victory-overlay {
  position: fixed;
  top: 0;
  left: 0;
  z-index: 9999;
  width: 100vw;
  height: 100vh;
  background-color: rgba(0, 0, 0, 0.4);  /* fond semi-transparent */
  backdrop-filter: blur(10px);           /* effet de flou */
  -webkit-backdrop-filter: blur(10px);   /* compatibilité Safari */
  display: flex;
  justify-content: center;
  align-items: center;
  transition: backdrop-filter 0.5s ease, background-color 0.5s ease;
}



.victory-overlay video {
  max-width: 90%;
  max-height: 90%;
  box-shadow: 0 0 40px rgba(255, 255, 255, 0.5);
  pointer-events: none; /* ← pour que la vidéo ne bloque plus les clics */
  z-index: 1;
}

#choice-buttons {
  position: absolute;
  bottom: 400px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  z-index: 10000;
  pointer-events: auto; /* ← ACTIVE les clics sur les boutons */
}

.choice-question {
  color: white;
  font-size: 3rem;
  text-shadow: 1px 1px 2px black;
  margin: 0;
}

.choice-options {
  display: flex;
  gap: 20px;
}

.choice-icon {
  width: 200px;
  height: auto;
  cursor: pointer;
  transition: transform 0.3s ease, filter 0.3s ease;
}

.choice-icon:hover {
  transform: scale(1.2);
  filter: drop-shadow(0 0 10px #ffc27c);
}


.victory-overlay video {
  max-width: 90%;
  max-height: 90%;
  box-shadow: 0 0 40px rgba(255, 255, 255, 0.5);
  pointer-events: none; /* ← pour que la vidéo ne bloque plus les clics */
  z-index: 1;
}


#choice-buttons,
#choice-buttons button {
  pointer-events: auto; /* ← ACTIVE les clics sur les boutons */
  z-index: 10001;
}

#dragon-video-container {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background-color: rgba(0, 0, 0, 0.4); /* ← semi-transparent */
  backdrop-filter: blur(10px);          /* ← flou */
  -webkit-backdrop-filter: blur(10px);  /* ← pour Safari */
  z-index: 9999;
  display: flex;
  justify-content: center;
  align-items: center;
}

#dragon-video {
  max-width: 90%;
  max-height: 90%;
  object-fit: contain;
  box-shadow: 0 0 40px rgba(255, 255, 255, 0.5);
  pointer-events: none;
  z-index: 1;
}

#dragon-container {
  position: fixed;
  top: 20px;
  right: 680px; /* ✅ toujours visible quel que soit l'écran */
  width: 300px;
  height: auto;
  z-index: 9999;
}

#btn-dragon {
  padding: 8px 60px;               /* Plus aplati */
  height: auto !important;         /* Ne pas hériter d'une hauteur fixe */
  min-height: unset !important;    /* Empêche toute hauteur minimale forcée */
  line-height: 1.2;                /* Pour garder le texte lisible */
  align-self: center;              /* Centre verticalement dans le panneau */
  margin: 10px 0;                  /* Optionnel : espace au-dessus et en dessous */
  box-sizing: border-box;
  font-family: 'Pirata One', cursive;
  font-size: 2.2rem;
  background-color: #3a1c06;
  color: #f5deb3;
  border: 2px solid #d4a65c;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s ease-in-out;
}


#btn-dragon:hover {
  background-color: #5a2d0c;
  transform: scale(1.05);
}

.dragon-icon {
  position: absolute;
  top: 20%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 60px;
  z-index: 5;
  animation: dragon-summon 0.6s ease-out;
  transition: all 0.5s ease-in-out;
  pointer-events: none;
}

#btn-j1 {
  background-color: #cf1424;
  border-color: #8a0d17;
  box-shadow:
    0 0 10px rgba(255, 50, 50, 0.4),
    inset 0 0 6px rgba(255, 255, 255, 0.2);
}

#btn-j1:hover {
  background-color: #ff1f2d;
  transform: scale(1.1);
  box-shadow:
    0 0 25px rgba(255, 50, 50, 0.7),
    inset 0 0 10px rgba(255, 255, 255, 0.4);
}

#btn-j2 {
  background-color: #3b9729;
  border-color: #25661a;
  box-shadow:
    0 0 10px rgba(91, 255, 109, 0.4),
    inset 0 0 6px rgba(255, 255, 255, 0.2);
}

#btn-j2:hover {
  background-color: #4cff57;
  transform: scale(1.1);
  box-shadow:
    0 0 25px rgba(91, 255, 109, 0.7),
    inset 0 0 10px rgba(255, 255, 255, 0.4);
}

#btn-j3 {
  background-color: #e9ba1e;
  border-color: #b8860b;
  box-shadow:
    0 0 10px rgba(255, 230, 100, 0.4),
    inset 0 0 6px rgba(255, 255, 255, 0.2);
}

#btn-j3:hover {
  background-color: #ffdd33;
  transform: scale(1.1);
  box-shadow:
    0 0 25px rgba(255, 230, 100, 0.7),
    inset 0 0 10px rgba(255, 255, 255, 0.4);
}

#btn-j4 {
  background-color: #285dad;
  border-color: #1e3f74;
  box-shadow:
    0 0 10px rgba(100, 180, 255, 0.4),
    inset 0 0 6px rgba(255, 255, 255, 0.2);
}

#btn-j4:hover {
  background-color: #4a8eff;
  transform: scale(1.1);
  box-shadow:
    0 0 25px rgba(100, 180, 255, 0.7),
    inset 0 0 10px rgba(255, 255, 255, 0.4);
}


#roll-d20 {
  padding: 8px 60px;               /* Plus aplati */
  height: auto !important;         /* Ne pas hériter d'une hauteur fixe */
  min-height: unset !important;    /* Empêche toute hauteur minimale forcée */
  line-height: 1.2;                /* Pour garder le texte lisible */
  align-self: center;              /* Centre verticalement dans le panneau */
  margin: 10px 0;                  /* Optionnel : espace au-dessus et en dessous */
  box-sizing: border-box;
  font-family: 'Pirata One', cursive;
  font-size: 2.2rem;
  background-color: #3a1c06;
  color: #f5deb3;
  border: 2px solid #d4a65c;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s ease-in-out;
}


#roll-d20:hover {
  background-color: #5a2d0c;
  transform: scale(1.05);
}

.dice-display {
  width: 400px;
  height: auto;
  display: block;
  position: FIXED;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 9999;
  pointer-events: none;
}

.dice-img {
  width: 100%;
  height: auto;
  display: block;
  animation: dice-pop 0.5s ease-out, dice-shake 0.6s ease-in-out;
  transition: transform 0.3s ease;
  filter: drop-shadow(0 0 8px rgba(255, 255, 255, 0.4));
  transform-origin: center;
}

.dice-number {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 64px;
  font-weight: bold;
  color: rgb(236, 218, 112);
  text-shadow: 1px 1px 2px black;
  pointer-events: none;
  z-index: 10000; /* <- à vérifier / ajouter */
}

#scene-image {
  transition: opacity 0.5s ease-in-out;
  opacity: 1;
}

.dice-btn:hover {
  transform: scale(1.1);
  box-shadow: 0 0 10px #ffc27c;
}

.adjust-btn {
  background: linear-gradient(to bottom, #824f1b, #5a2d0c);
  color: #fff8e1;
  border: 2px solid #c59b6d;
  padding: 6px 14px;
  font-weight: bold;
  font-size: 1.3rem;
  font-family: 'Pirata One', cursive;
  border-radius: 6px;
  cursor: pointer;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.4);
  transition: all 0.2s ease;
}

.adjust-btn:hover {
  background: linear-gradient(to bottom, #a7601b, #7e3e13);
  transform: scale(1.1);
  box-shadow: 0 0 10px #ffc27c;
}

/* Tooltip container */
.tooltip {
  position: relative;
  display: inline-block;
  z-index: 10; /* Suffisant pour passer devant la scène */
}

/* Tooltip text (caché par défaut) */
.tooltip .tooltiptext {
  visibility: hidden;
  height: 140px;
  width: 280px;
  background-color: rgba(20, 20, 20, 0.95);
  color: #f5f5f5;
  text-align: center;
  padding: 10px;
  border-radius: 6px;
  position: fixed;
  z-index: 20;
  top: 900px; /* ou 100%, selon si tu veux au-dessus ou en dessous */
  left: -600PX;     /* ou ajuste à la main genre left: 10px */
  transform: none;
  opacity: 0;
  transition: opacity 0.3s ease;
  font-size: 1.20rem;
  line-height: 1.3;
  pointer-events: none;
  white-space: normal;
}

/* Affichage au survol */
.tooltip:hover .tooltiptext {
  visibility: visible;
  opacity: 1;
}

.skip-button {
  position: relative;
  bottom: 600px;
  right: 1000px;
  padding: 10px 20px;
  font-size: 16px;
  background-color: rgba(0,0,0,0.6);
  color: white;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  z-index: 10;
  transition: background-color 0.3s ease;
}

.skip-button:hover {
  background-color: rgba(255,255,255,0.2);
}

#music-controls {
  position: fixed;
  top: 20px;
  right: 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  z-index: 9999;
}

#music-controls button {
  padding: 10px 20px;
  font-family: 'Pirata One', cursive;
  font-size: 1.2rem;
  background-color: #3a1c06;
  color: #f5deb3;
  border: 2px solid #d4a65c;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s ease-in-out;
}

#music-controls button:hover {
  background-color: #5a2d0c;
  transform: scale(1.05);
}

@keyframes dice-pop {
  0% {
    transform: scale(0.3) rotate(0deg);
    opacity: 0;
    filter: brightness(2);
  }
  60% {
    transform: scale(1.2) rotate(10deg);
    opacity: 1;
    filter: brightness(1.3);
  }
  100% {
    transform: scale(1) rotate(0deg);
    filter: brightness(1);
  }
}

@keyframes dice-shake {
  0% { transform: translate(0, 0) rotate(0deg); }
  20% { transform: translate(-4px, 2px) rotate(-4deg); }
  40% { transform: translate(4px, -3px) rotate(3deg); }
  60% { transform: translate(-2px, 2px) rotate(-2deg); }
  80% { transform: translate(2px, -1px) rotate(1deg); }
  100% { transform: translate(0, 0) rotate(0deg); }
}

@keyframes dragon-summon {
  0% {
    transform: translate(-50%, -50%) scale(0.3) rotate(-90deg);
    opacity: 0;
    filter: drop-shadow(0 0 10px red) brightness(2);
  }
  50% {
    transform: translate(-50%, -50%) scale(1.2) rotate(15deg);
    opacity: 1;
    filter: drop-shadow(0 0 15px orange) brightness(1.5);
  }
  100% {
    transform: translate(-50%, -50%) scale(1) rotate(0deg);
    filter: drop-shadow(0 0 12px crimson);
  }
}

@keyframes wave-flag {
  0% {
    transform: perspective(1000px) rotateY(0deg) translateY(0);
  }
  25% {
    transform: perspective(1000px) rotateY(2deg) translateY(-1px);
  }
  50% {
    transform: perspective(1000px) rotateY(-2.5deg) translateY(1px);
  }
  75% {
    transform: perspective(1000px) rotateY(1.5deg) translateY(-1px);
  }
  100% {
    transform: perspective(1000px) rotateY(0deg) translateY(0);
  }
}

@keyframes hpZoomBounce {
  0% {
    transform: scale(1);
    filter: drop-shadow(0 0 0px transparent);
  }
  30% {
    transform: scale(1.3);
    filter: drop-shadow(0 0 6px rgba(255,255,255,0.6));
  }
  60% {
    transform: scale(0.9);
  }
  100% {
    transform: scale(1);
    filter: drop-shadow(0 0 0px transparent);
  }
}

.animate-hp {
  animation: hpZoomBounce 0.4s ease-out;
  position: relative;
  z-index: 100;
}

.hp-particle {
  position: absolute;
  width: 14px; /* 💥 plus grosse particule */
  height: 14px;
  border-radius: 50%;
  pointer-events: none;
  opacity: 0.9;
  animation: explode 0.8s ease-out forwards;
  z-index: 101;
  transform: translate(-50%, -50%);
  left: 50%;
  top: 50%;
}

.hp-particle.heal {
  background: radial-gradient(white, #6eff96);
  box-shadow: 0 0 12px #6eff96;
}

.hp-particle.damage {
  background: radial-gradient(white, #ff1e1e);
  box-shadow: 0 0 12px #ff1e1e;
}

@keyframes explode {
  0% {
    transform: translate(-50%, -50%) scale(1);
    opacity: 1;
  }
  100% {
    transform: translate(var(--dx), var(--dy)) scale(0.6);
    opacity: 0;
  }
}

.dragon-wrapper {
  position: relative;
  display: inline-block;
}

#btn-dragon.special-button {
  padding: 8px 60px;               /* Plus aplati */
  height: auto !important;         /* Ne pas hériter d'une hauteur fixe */
  min-height: unset !important;    /* Empêche toute hauteur minimale forcée */
  line-height: 1.2;                /* Pour garder le texte lisible */
  align-self: center;              /* Centre verticalement dans le panneau */
  margin: 10px 0;                  /* Optionnel : espace au-dessus et en dessous */
  box-sizing: border-box;
  font-family: 'Pirata One', cursive;
  font-size: 2.2rem;
  background-color: #3a1c06;
  color: #f5deb3;
  border: 2px solid #d4a65c;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s ease-in-out;
}

#btn-dragon.special-button:hover {
  background-color: #5a2d0c;
  transform: scale(1.05);
}

.dragon-tooltip {
  position: fixed;
  bottom: 110%;
  left: 10%;
  transform: translateX(-50%);
  background-color: #3a1c06;
  color: #f5deb3;
  padding: 10px 20px;
  border-radius: 8px;
  font-size: 1.2rem;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease, transform 0.3s ease;
  box-shadow: 0 0 8px #5a320d;
  border: 1px solid #333;
  font-family: 'Pirata One', cursive;
  z-index: 10;
}

.dragon-wrapper:hover .dragon-tooltip {
  opacity: 1;
  transform: translateX(-50%) translateY(-6px);
}

/* Vidéo du tavernier tout en haut mais dans les limites */
#tavernier-ghost {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  z-index: 9999; /* Au-dessus des bannières */
  pointer-events: none;
}

#tavernier-video {
  width: 100%;
  height: 100%;
  object-fit: cover;
}