/* Interface en jeu */
#ui {
  position: absolute;
  top: 20px;
  left: 20px;
  background: rgba(10, 5, 20, 0.85);
  padding: 15px;
  border-radius: 12px;
  min-width: 300px;
  pointer-events: none;
  border: 1px solid #9d00ff;
  z-index: 10;
  display: none;
}
.ui-header {
  display: flex;
  justify-content: space-between;
  margin-bottom: 10px;
  font-weight: 900;
}
.ui-divider {
  border-bottom: 1px solid #444;
  margin: 10px 0;
}
.stat-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  font-size: 12px;
  color: #aaa;
}
.stat-item span {
  color: #fff;
  font-weight: bold;
}
.stat-crit {
  color: #ff00ff !important;
}

/* --- Barres --- */
.health-bar {
  width: 100%;
  height: 22px;
  background: #220000;
  border: 1px solid #550000;
  border-radius: 4px;
  overflow: hidden;
  margin: 5px 0;
  position: relative;
}
.health-fill {
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, #ff0044, #ff4444);
  transition: width 0.2s;
}
.health-text {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: bold;
  z-index: 2;
}

#timerContainer {
  width: 100%;
  height: 6px;
  background: #001122;
  margin-top: 8px;
  border: 1px solid #004466;
}
#timerBar {
  width: 0%;
  height: 100%;
  background: #00ffff;
  transition: width 0.1s linear;
}

#xpContainer {
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 10px;
  background: #111;
  z-index: 5;
  display: none;
}
#xpBar {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #ffd700, #ffaa00);
  transition: width 0.2s;
}
#levelIndicator {
  position: absolute;
  bottom: 20px;
  width: 100%;
  text-align: center;
  font-size: 32px;
  font-weight: 900;
  color: #ffd700;
  pointer-events: none;
  display: none;
  font-family: "Press Start 2P";
  text-shadow: 0 0 10px #ffaa00;
}

/* --- Compétences --- */
.skill-box {
  margin-top: 12px;
}
.skill-bar {
  height: 5px;
  background: #111;
  border-radius: 2px;
  overflow: hidden;
}
.skill-fill {
  height: 100%;
  transition: width 0.2s;
}
.dash-fill {
  width: 100%;
  background: #00ffff;
  box-shadow: 0 0 5px #00ffff;
}
.ult-fill {
  width: 0%;
  background: #ff6600;
  box-shadow: 0 0 10px #ff6600;
}
.ult-label {
  display: flex;
  justify-content: space-between;
  color: #ffaa00;
}
#ultReadyText {
  display: none;
  animation: blink 0.2s infinite;
  color: #fff;
  font-weight: 900;
  text-shadow: 0 0 10px #fff;
}

#runGoldContainer {
  margin-top: 15px;
  color: #ffff00;
  font-weight: bold;
  font-size: 18px;
}
#uiRunGold {
  margin-left: 8px;
}

/* --- Tutoriel de première partie (ui/tutorial.js) --- */
.tutorial-bubble {
  position: absolute;
  bottom: 80px;
  left: 50%;
  transform: translateX(-50%);
  width: min(520px, calc(100vw - 24px));
  padding: 12px 16px;
  background: rgba(5, 10, 25, 0.88);
  border: 2px solid #00ffff;
  border-radius: 12px;
  box-shadow: 0 0 18px rgba(0, 255, 255, 0.35);
  color: #fff;
  font-size: 15px;
  line-height: 1.4;
  text-align: center;
  z-index: 40;
  display: none;
  pointer-events: none; /* le jeu reste jouable sous la bulle, sauf le bouton PASSER */
}
.tutorial-tag {
  display: block;
  margin-bottom: 4px;
  color: #00ffff;
  font-family: "Press Start 2P";
  font-size: 10px;
}
.tutorial-bubble p {
  margin: 0;
}
.tutorial-bubble button {
  width: auto;
  margin: 8px auto 0;
  padding: 6px 14px;
  font-size: 11px;
  pointer-events: auto;
}

/* --- Indicateurs --- */
#bossWarning {
  position: absolute;
  top: 20%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 40px;
  font-family: "Orbitron"; /* Press Start 2P n'a pas de majuscules accentuées (NÉCRO-HYDRE) */
  font-weight: 900;
  letter-spacing: 6px;
  color: #ff0000;
  display: none;
  animation: shake 0.5s infinite;
  z-index: 50;
  width: 100%;
  text-align: center;
  text-shadow: 4px 4px 0 #550000;
}
#boxIndicator {
  position: absolute;
  top: 100px;
  left: 50%;
  transform: translateX(-50%);
  color: #00ffff;
  font-weight: bold;
  font-size: 14px;
  pointer-events: none;
  z-index: 5;
  display: none;
  animation: bounce 1s infinite;
}
#controls {
  position: absolute;
  bottom: 15px;
  right: 15px;
  color: rgba(255, 255, 255, 0.3);
  font-size: 12px;
  pointer-events: none;
  text-align: right;
}

/* Bandeau de changement de biome */
#biomeBanner {
  position: absolute;
  top: 19%;
  left: 50%;
  transform: translate(-50%, -50%) scale(0.8);
  font-family: "Press Start 2P";
  font-size: 24px;
  letter-spacing: 3px;
  text-shadow:
    0 0 12px currentColor,
    0 0 30px currentColor;
  pointer-events: none;
  white-space: nowrap;
  opacity: 0;
  z-index: 40;
  transition:
    opacity 0.5s,
    transform 0.5s;
}
#biomeBanner.show {
  opacity: 1;
  transform: translate(-50%, -50%) scale(1);
}
@media (max-width: 760px) {
  #biomeBanner {
    font-size: 16px;
  }
}

/* Compteur de combo */
#comboDisplay {
  position: absolute;
  top: 70px;
  right: 20px;
  font-family: "Press Start 2P";
  font-size: 18px;
  color: #ff2a6d;
  text-shadow: 0 0 10px #ff2a6d;
  pointer-events: none;
  z-index: 6;
}
#comboDisplay.hot {
  color: #ffd700;
  text-shadow:
    0 0 10px #ffd700,
    0 0 24px #ff2a6d;
  animation: shake 0.4s infinite;
}
@media (max-width: 760px), (max-height: 560px) {
  #comboDisplay {
    top: calc(90px + env(safe-area-inset-top));
    right: 12px;
    font-size: 12px;
  }
}

/* Barre de vie du boss */
#bossBar {
  position: absolute;
  top: 12px;
  left: 50%;
  transform: translateX(-50%);
  width: min(460px, 44vw);
  pointer-events: none;
  z-index: 6;
  display: none;
  text-align: center;
}
.boss-bar-name {
  font-size: 13px;
  font-weight: 900;
  letter-spacing: 3px;
  text-transform: uppercase;
  color: #fff;
  text-shadow: 0 0 8px #ff0040;
  margin-bottom: 4px;
}
.boss-bar-track {
  height: 10px;
  border: 1px solid rgba(255, 0, 64, 0.7);
  border-radius: 5px;
  background: rgba(20, 0, 8, 0.8);
  box-shadow: 0 0 12px rgba(255, 0, 64, 0.4);
}
#bossBarFill {
  height: 100%;
  width: 100%;
  background: linear-gradient(90deg, #ff0040, #ff6a8e);
  box-shadow: 0 0 10px #ff0040;
  transition: width 0.15s;
}
#bossBar.enraged .boss-bar-name {
  color: #ff6a8e;
  animation: shake 0.5s infinite;
}
#bossWarning.gold {
  color: #ffd700;
  text-shadow: 4px 4px 0 #6a4a00;
}
@media (max-width: 760px), (max-height: 560px) {
  #bossBar {
    top: calc(126px + env(safe-area-inset-top));
    width: 72vw;
  }
  .boss-bar-name {
    font-size: 10px;
    letter-spacing: 2px;
  }
  .boss-bar-track {
    height: 7px;
  }
}
