body {
    font-family: Arial, sans-serif;
    background-color: #f3eacb; /* Couleur sable du désert */
    text-align: center;
}

.container {
    margin: 40px auto;
    padding: 20px;
    width: 380px;
    background: #a4ddf0; /* Couleur bleu clair représentant une oasis */
    box-shadow: 0 2px 10px rgba(0,0,0,0.2);
    border-radius: 20px;
    position: relative;
}

input {
    display: block;
    width: 90%;
    padding: 8px;
    margin: 10px auto;
    border-radius: 5px;
    border: 1px solid #ccc;
}

button {
    padding: 10px 15px;
    margin: 5px;
    background: #4caf50;
    color: white;
    border: none;
    border-radius: 5px;
    cursor: pointer;
}

button:hover {
    background: #45a049;
}

#auth-msg {
    color: red;
}

#status {
    font-weight: bold;
    margin-top: 10px;
}

#cactus {
    position: relative;
    width: 150px;
    margin: 15px;
    top: 100px;
}

#game {
    background-color: #fff9e6;
    border-radius: 15px;
    padding: 25px;
    box-shadow: inset 0 0 10px rgba(0,0,0,0.1);
    margin-top: 15px;
    display: none;
    min-height: 420px; /* ↑ augmente la hauteur disponible */
    position: relative;
  }
  

#game-area {
    position: relative;
    display: inline-block;
    margin-bottom: 20px;
    width: 100%;
}

#elements img {
    position: absolute;
    width: 40px;
    height: 40px;
    cursor: pointer;
}

/*#elements #water {
    bottom: -20px;
    left: 50%;
    transform: translateX(-50%);
}*/

#xp-bar {
    position: absolute;
    top: 5px;
    left: 1px;
    display: flex;
    align-items: center;
    font-size: 13px;
    font-weight: bold;
    width: 180px;
    z-index: 2;
}

#progress-container {
    flex-grow: 1;
    height: 10px;
    background: #eee;
    margin: 0 8px;
    border-radius: 5px;
    overflow: hidden;
}

#progress-fill {
    height: 100%;
    width: 0%;
    background: linear-gradient(to right, #4caf50, #81c784);
    transition: width 0.4s ease;
}

#hydratation-bar {
    width: 150px;
    height: 10px;
    background: #eee;
    border-radius: 5px;
    margin: 10px auto;
    overflow: hidden;
}

#hydratation-fill {
    height: 100%;
    width: 100%;
    background-color: blue;
    transition: width 0.3s ease, background-color 0.3s ease;
}

#rain {
    position: absolute;
    top: 100px;
    left: 125px;
    width: 150px;
    height: 150px;
    pointer-events: none;
    overflow: hidden;
}

.drop {
    position: absolute;
    width: 2px;
    height: 10px;
    background: #00f;
    animation: fall 1s linear infinite;
}

@keyframes fall {
    0% {
        top: -10px;
        opacity: 1;
    }
    100% {
        top: 150px;
        opacity: 0;
    }
}

#collect-all {
    bottom: 10px;
    right: 10px;
    width: 40px;
    height: 40px;
    cursor: pointer;
    z-index: 3;
}

#currency-display {
    position: absolute;
    top: 0px;
    right: 10px;
    display: flex;
    gap: 10px;
    align-items: center;
}

.currency {
    display: flex;
    align-items: center;
    font-weight: bold;
    font-size: 14px;
}

.currency img {
    width: 20px;
    height: 20px;
    margin-right: 4px;
}

#quest-avatar {
    position: absolute;
    top: 50px;
    left: -20px;
    width: 80px;
    height: 80px;
    cursor: pointer;
    z-index: 1001;
}

#quest-window {
    position: absolute;
    top: 140px;
    left: 10px;
    width: 200px;
    background: #fff9e6;
    border: 2px solid #4caf50;
    border-radius: 8px;
    padding: 10px;
    box-shadow: 0px 0px 10px rgba(0,0,0,0.2);
    font-size: 14px;
    text-align: left;
    z-index: 10004;
}

#upgrade-button {
    bottom: 80px;
    left: 10px;
    width: 40px;
    height: 40px;
    cursor: pointer;
    z-index: 5;
  }
  
  #upgrade-window {
    position: absolute;
    top: 50px;
    left: 50%;
    transform: translateX(-50%);
    width: 320px;
    max-height: 400px;
    overflow-y: auto;
    background: #fff9e6;
    border: 2px solid #333;
    border-radius: 10px;
    padding: 10px;
    z-index: 150000;
    display: none;
  }
  
  .skill {
    border: 1px solid #aaa;
    padding: 8px;
    margin: 5px;
    border-radius: 6px;
    background: #fafafa;
  }
  .skill.locked {
    opacity: 0.5;
  }

  .skill-tree-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 12px;
    padding: 10px 0;
  }
  
  .skill-card {
    background-color: #fffef8;
    border: 2px solid #4caf50;
    border-radius: 8px;
    padding: 10px;
    font-size: 14px;
    box-shadow: 0px 2px 4px rgba(0,0,0,0.1);
    text-align: center;
  }
  
  .skill-card h4 {
    margin: 5px 0;
    font-size: 16px;
    color: #2e7d32;
  }
  
  .skill-card button {
    margin-top: 5px;
    background-color: #4caf50;
    color: white;
    border: none;
    border-radius: 4px;
    padding: 6px 10px;
    cursor: pointer;
    font-size: 13px;
  }
  
  .skill-card button:disabled {
    background-color: #ccc;
    cursor: not-allowed;
  }

  #xp-floating-area {
    position: absolute;
    left: 70%;
    top: 90%;
    transform: translateX(-50%);
    pointer-events: none;
    z-index: 10;
  }
  @media (max-width: 600px) {
    #xp-floating-area {
      left: 65%;     /* recentré pour petits écrans */
      top: 100%;      /* légèrement descendu */
    }
  }
  
  
  .xp-float {
    position: absolute;
    font-size: 16px;
    font-weight: bold;
    color: #4caf50;
    animation: floatUp 1.2s ease-out forwards;
  }
  
  .xp-float.minus {
    color: #f44336;
  }
  
  @keyframes floatUp {
    0% { opacity: 1; transform: translate(-50%, 0); }
    100% { opacity: 0; transform: translate(-50%, -60px); }
  }
  
  #minigame-button {
    bottom: 10px;
    left: 10px;
    width: 40px;
    height: 40px;
    cursor: pointer;
    z-index: 5;
  }
  
  #minigame-window {
    position: absolute;
    top: 60px;
    left: 50%;
    transform: translateX(-50%);
    width: 300px;
    background: #fff8e1;
    border: 2px solid #4caf50;
    border-radius: 10px;
    padding: 15px;
    box-shadow: 0 0 10px rgba(0,0,0,0.2);
    z-index: 150000;
  }
  
  #minijeu-zone {
    margin-top: 15px;
  }
  
  #roue-wrapper {
    position: relative;
    width: 200px;
    height: 200px;
    margin: 0 auto 10px;
  }
  
  #roue {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    border: 6px solid #4caf50;
    background: conic-gradient(
      #fdd835 0deg 60deg,
      #4fc3f7 60deg 120deg,
      #81c784 120deg 180deg,
      #e57373 180deg 240deg,
      #ba68c8 240deg 300deg,
      #ffd54f 300deg 360deg
    );
    transition: transform 4s ease-out;
  }
  
  #aiguille {
    position: absolute;
    top: -10px;
    left: 50%;
    transform: translateX(-50%);
    width: 0;
    height: 0;
    border-left: 10px solid transparent;
    border-right: 10px solid transparent;
    border-bottom: 20px solid #f44336;
    z-index: 10;
  }

  #popup-recompense {
    position: fixed;
    top: 30%;
    left: 50%;
    transform: translateX(-50%);
    background: #ffffff;
    border: 3px solid #4caf50;
    border-radius: 12px;
    padding: 20px 30px;
    font-size: 20px;
    font-weight: bold;
    color: #4caf50;
    box-shadow: 0 0 20px rgba(0, 0, 0, 0.3);
    z-index: 99999;
    animation: popFade 2s ease-out forwards;
  }
  
  @keyframes popFade {
    0% { transform: translateX(-50%) scale(0.5); opacity: 0; }
    50% { transform: translateX(-50%) scale(1.1); opacity: 1; }
    100% { transform: translateX(-50%) scale(1); opacity: 0; }
  }

  #roue {
    position: relative;
    width: 200px;
    height: 200px;
    border-radius: 50%;
    border: 6px solid #4caf50;
    background: #fff;
    transition: transform 4s ease-out;
    overflow: hidden;
  }
  
  .segment {
    position: absolute;
    width: 50%;
    height: 100%;
    left: 50%;
    top: 0;
    transform-origin: 0% 50%;
    display: flex;
    justify-content: center;
    align-items: center;
  }
  
  .segment span {
    transform: rotate(-60deg);
    font-size: 24px;
    font-weight: bold;
    position: absolute;
    left: 30px;
  }
  #roue {
    position: relative;
    width: 200px;
    height: 200px;
    border-radius: 50%;
    border: 6px solid #4caf50;
    background: conic-gradient(
      #fdd835 0deg 60deg,
      #4fc3f7 60deg 120deg,
      #81c784 120deg 180deg,
      #e57373 180deg 240deg,
      #ba68c8 240deg 300deg,
      #ffd54f 300deg 360deg
    );
    transition: transform 4s ease-out;
    overflow: hidden;
  }
  
  .emoji {
    position: absolute;
    top: 50%;
    left: 50%;
    transform-origin: 0 0;
    transform: rotate(0deg); /* sera remplacé dynamiquement */
    font-size: 22px;
    font-weight: bold;
    pointer-events: none;
  }
  
  
  #aiguille {
    position: absolute;
    top: -10px;
    left: 50%;
    transform: translateX(-50%);
    width: 0;
    height: 0;
    border-left: 10px solid transparent;
    border-right: 10px solid transparent;
    border-bottom: 20px solid #f44336;
    z-index: 10;
  }
  
  
  .segment {
    position: absolute;
    width: 50%;
    height: 100%;
    left: 50%;
    top: 0;
    transform-origin: 0% 50%;
    clip-path: polygon(0% 0%, 100% 50%, 0% 100%);
    display: flex;
    align-items: center;
    justify-content: flex-start;
  }
  
  .segment span {
    font-size: 22px;
    font-weight: bold;
    margin-left: 15px;
  }
  
  .emoji.pulse {
    animation: pulse 0.5s ease-out 2;
  }
  
  @keyframes pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.3); }
    100% { transform: scale(1); }
  }

  .popup-quest {
    position: fixed;
    top: 30%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: gold;
    padding: 20px 30px;
    border-radius: 20px;
    box-shadow: 0 0 20px rgba(255, 215, 0, 0.7);
    text-align: center;
    display: none;
    z-index: 999999;
    animation: popQuest 1s ease;
  }
  
  @keyframes popQuest {
    0% { transform: scale(0.5) translate(-50%, -50%); opacity: 0; }
    50% { transform: scale(1.1) translate(-50%, -50%); opacity: 1; }
    100% { transform: scale(1) translate(-50%, -50%); opacity: 1; }
  }
  
  #clean-button {
    bottom: 80px;
    right: 10px;
    width: 40px;
    height: 40px;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    z-index: 50;
  }
  
  #clean-button:hover {
    transform: scale(1.1) rotate(-5deg);
    box-shadow: 0 0 10px rgba(255, 255, 255, 0.6);
  }
  
  #clean-button:active {
    transform: scale(0.95);
  }

  #vulture {
    position: absolute;
    width: 90px;
    height: 90px;
    top: 50px;
    left: 70%;
    z-index: 10;
  }
  
  
  .vulture-health-bar {
    position: absolute;
    width: 60px;
    height: 8px;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid #222;
    top: 35px;
    left: calc(70% + 0px);
    transform: translateX(-50%);
    border-radius: 4px;
    overflow: hidden;
    z-index: 11;
  }
  
  .vulture-health-fill {
    height: 100%;
    background: red;
    width: 100%;
    transition: width 0.2s ease;
  }
  
  @keyframes vultureAttack {
    0% {
      transform: rotate(0deg) translate(0, 0);
    }
    50% {
      transform: rotate(-15deg) translate(-10px, 10px);
    }
    100% {
      transform: rotate(0deg) translate(0, 0);
    }
  }

  @media (max-width: 600px) {
    #vautour {
      width: 70px;
      height: 70px;
      top: 40px;
      left: 65%; /* centré un peu plus vers le milieu pour petits écrans */
    }
  
    .vulture-health-bar {
      width: 70px;
      height: 8px;
      top: 25px;
      left: 65%;
    }
  }
  
  

  /*MOBILE FRIENDLY */
  /* 📱 Adaptation mobile */
@media (max-width: 600px) {
  body {
    font-size: 14px;
    margin: 0;
    padding: 0;
    overflow-x: hidden;
  }

  #game {
    padding: 10px;
    min-height: 80vh;
  }

  #elements img {
    width: 32px;
    height: 32px;
  }

  #clean-button,
  #collect-all,
  #minigame-button,
  #upgrade-button {
    width: 60px !important;
    height: 60px !important;
    bottom: 15px !important;
    right: 15px !important;
  }

  #xp-bar {
    font-size: 11px;
    width: 140px;
  }

  .popup-quest {
    font-size: 16px;
    padding: 15px 20px;
  }

  #quest-avatar {
    width: 60px;
    height: 60px;
    top: 40px;
    left: -10px;
  }

  #quest-window {
    width: 180px;
    font-size: 13px;
  }

  #upgrade-window {
    width: 90%;
    max-height: 300px;
  }

  .skill-card {
    font-size: 13px;
  }

  #currency-display {
    font-size: 12px;
    gap: 5px;
  }

  .currency img {
    width: 16px;
    height: 16px;
  }

  #cactus {
    width: 120px;
  }

  .xp-float {
    font-size: 14px;
  }
}
/* --- Conteneur des boutons --- */
#mobile-buttons {
  position: absolute;
  bottom: 10px;
  right: 10px;
  z-index: 100;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 12px;
}

/* Style des boutons généraux */
#mobile-buttons img {
  width: 50px;
  height: 50px;
  cursor: pointer;
  transition: transform 0.2s ease;
}

#mobile-buttons img:hover {
  transform: scale(1.1);
}

/* --- Adaptation mobile --- */
@media (max-width: 600px) {
  #mobile-buttons {
    flex-direction: column;
    align-items: flex-end;
    gap: 12px;
  }

  #mobile-buttons img {
    width: 60px;
    height: 60px;
  }
}

/* --- Colonnes de boutons --- */
#button-column-left,
#button-column-right {
  position: absolute;
  bottom: 10px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  z-index: 100;
}

#button-column-left {
  left: 10px;
}

#button-column-right {
  right: 10px;
}

#button-column-left img,
#button-column-right img {
  width: 50px;
  height: 50px;
  cursor: pointer;
  transition: transform 0.2s ease;
}

#button-column-left img:hover,
#button-column-right img:hover {
  transform: scale(1.1);
}

/* --- Responsive mobile --- */
@media (max-width: 600px) {
  #button-column-left img,
  #button-column-right img {
    width: 60px;
    height: 60px;
  }
}

#cactus.grow {
  animation: growCactus 0.6s ease;
}

@keyframes growCactus {
  0% { transform: scale(0.8); }
  50% { transform: scale(1.2); }
  100% { transform: scale(1); }
}

#baby-toy {
  position: absolute;
  width: 30px;
  height: 30px;
  top: 180px; /* ajuster selon le cactus */
  left: 50%;
  transform: translateX(-50%);
  z-index: 6;
  animation: suck 0.5s infinite alternate ease-in-out;
}

@media (max-width: 600px) {
  #baby-toy {
    width: 36px;
    height: 36px;
    top: 164px; /* ajuste si besoin */
  }
}


@keyframes suck {
  0% { transform: translateX(-50%) translateY(0); }
  100% { transform: translateX(-50%) translateY(2px); }
}

#water {
  position: absolute;
  left: 150px;
  bottom: -130px; /* ajuste selon visuel */
  width: 60px;
  cursor: pointer;
  z-index: 50;
}

/* Mobile : adapte si nécessaire */
@media (max-width: 600px) {
  #water {
    width: 90px;
    bottom: 140px;
  }
}

#xp-container {
  position: absolute;
  left: 10px; /* même alignement que l’arrosoir */
  bottom: 450px; /* légèrement sous #water */
  width: 200px;
  text-align: left;
  z-index: 49;
}

#xp-bar {
  display: flex;
  align-items: center;
  font-size: 13px;
  font-weight: bold;
  width: 100%;
  margin-bottom: 5px;
}

#progress-container {
  flex-grow: 1;
  height: 10px;
  background: #eee;
  margin: 0 8px;
  border-radius: 5px;
  overflow: hidden;
}

#status {
  font-weight: bold;
  font-size: 13px;
  color: #333;
}

#hydration-container {
  position: absolute;
  left: 100px;
  bottom: 70px; /* aligné sous l’arrosoir */
  text-align: left;
  width: 200px;
  z-index: 40;
}

#hydration-container #status {
  font-weight: bold;
  font-size: 13px;
  margin-bottom: 5px;
  color: #333;
  text-align: center;
}

#hydration-container #hydratation-bar {
  margin: 0 auto;
}

@media (max-width: 600px) {
  /* Arrosoir : bas centré */
  #water {
    position: absolute;
    bottom: -200px;
    left: 50%;
    transform: translateX(-50%);
    width: 90px;
    z-index: 50;
  }

  /* Statut + barre hydratation : juste au-dessus de l’arrosoir */
  #hydration-container {
    position: absolute;
    bottom: 180px;
    left: 50%;
    transform: translateX(-50%);
    width: 90%;
    text-align: center;
    z-index: 40;
  }

  #hydration-container #status {
    font-size: 14px;
    font-weight: bold;
    margin-bottom: 5px;
  }

  #hydration-container #hydratation-bar {
    margin: 0 auto;
    width: 100%;
  }

  /* Barre XP : en haut, plus compacte */
  #xp-container {
    top: 10px;
    left: 10px;
    width: 160px;
  }

  #xp-bar {
    font-size: 12px;
  }
}

#minigame-window,
#upgrade-window {
  z-index: 999999 !important; /* passe au-dessus de tout */
  background-color: rgba(255, 248, 225, 0.95); /* léger voile */
  backdrop-filter: blur(2px); /* optionnel, effet doux */
}

.close-button {
  position: absolute;
  top: 8px;
  right: 10px;
  background: transparent;
  border: none;
  font-size: 22px;
  font-weight: bold;
  cursor: pointer;
  color: #333;
  z-index: 1000;
}

.close-button:hover {
  color: red;
}


.open-shop-btn {
  position: absolute; /* ← clé ici */
  display: block;
  top: 380px;
  right: 100px;
  background: #ffc107;
  border: none;
  padding: 12px 20px;
  border-radius: 8px;
  font-size: 1.2em;
  cursor: pointer;
  box-shadow: 2px 2px 6px rgba(0, 0, 0, 0.2);
}

@media (max-width: 600px) {
  .open-shop-btn {
    position: absolute;
    top: 550px;     /* ← Ajuste ici pour le "descendre" visuellement */
    left: 50%;
    transform: translateX(-50%);
    width: 140px;
    padding: 10px 16px;
    font-size: 1.1em;
    border-radius: 8px;
    background: #ffc107;
    box-shadow: 2px 2px 6px rgba(0, 0, 0, 0.2);
    z-index: 999999;
  }
}






.shop-modal {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.6);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 1001;
}

.shop-modal.hidden {
  display: none;
}

.shop-content {
  background: #fffbe6;
  border: 3px solid #c2a04a;
  border-radius: 12px;
  padding: 20px;
  width: 90%;
  max-width: 400px;
  animation: fadeIn 0.3s ease-out;
}

.shop-tabs {
  display: flex;
  justify-content: space-around;
  margin-bottom: 10px;
}

.tab {
  background: #ffe089;
  border: none;
  padding: 6px 12px;
  border-radius: 6px;
  cursor: pointer;
}

.tab.active {
  background: #ffd45c;
  font-weight: bold;
}

.shop-tab { display: none; }
.shop-tab.active { display: block; }

.shop-item {
  background: #fff2c2;
  margin: 8px 0;
  padding: 10px;
  border-radius: 8px;
  cursor: pointer;
  transition: transform 0.2s ease, background 0.2s;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.shop-item:hover {
  background: #ffeaa7;
  transform: scale(1.03);
}

.boost-cactus {
  font-size: 1.5em;
  animation: wiggle 1s infinite;
}

@keyframes wiggle {
  0%, 100% { transform: rotate(0deg); }
  25% { transform: rotate(5deg); }
  75% { transform: rotate(-5deg); }
}

@keyframes fadeIn {
  from { opacity: 0; transform: scale(0.9); }
  to { opacity: 1; transform: scale(1); }
}


#elements img {
  pointer-events: auto;
  z-index: 50; /* assure-toi qu’ils sont au-dessus du cactus et de la pluie */
}

.ad-left, .ad-right {
  position: fixed;
  top: 0;
  width: 160px;
  height: 600px;
  z-index: 1000;
}

.ad-left {
  left: 0;
}

.ad-right {
  right: 0;
}

@media (max-width: 600px) {
  .desktop-only {
    display: none !important;
  }
}

#mobile-banner {
  width: 320px;
  height: 50px;
  margin: 20px auto 0 auto;
  text-align: center;
}


@media (min-width: 601px) {
  #mobile-banner {
    display: none;
  }
}

