/* --- 1. Styles Généraux & Body --- */
body {
  margin: 0;
  font-family: 'Nunito', sans-serif;
  text-align: center;
  color: #2F3E46;
  background: linear-gradient(135deg, #4da6ff, #70b3ff, #8cc1ff, #a8ceff, #bde7ff, #ccefff, #daf5ff, #e6fbff, #f9e7a1, #f6d87d, #f3c759, #f1b63a, #e7a3a3, #df8f8f, #d97a7a, #d26363, #5a9ae8, #417bcc);
  background-size: 1800% 1800%;
  background-repeat: no-repeat;
  background-attachment: fixed;
  animation: gradientAnimation 120s linear infinite;
}
@keyframes gradientAnimation {
  0% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}
body::before {
  content: "";
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(255,255,255,0.4);
  pointer-events: none;
  z-index: -1;
}

/* --- 2. Titres et Texte --- */
h1 {
  font-size: 3.5rem;
  background-color: #5A8AC6;
  padding: 20px 60px;
  margin: 40px auto;
  width: fit-content;
  border-radius: 50px;
  color: #fff;
  box-shadow: 0 8px 24px #5A8AC680;
  text-shadow: 0 2px 5px #465f7c;
  z-index: 10;
  position: relative;
}
.info {
  color: #5A8AC6;
  font-weight: 700;
  user-select: none;
  white-space: nowrap;
}

/* --- 3. Inputs --- */
input {
  border: 3px solid #5A8AC6;
  border-radius: 50px;
  font-family: 'Nunito', sans-serif;
  font-size: 20px;
  color: #5A8AC6;
  padding: 10px 20px;
  min-height: 30px;
  box-shadow: 0 6px 18px #00000026;
}

/* --- 4. Boutons --- */
button,
.améloration button,
#menuSecondaire button,
#paneau button {
  border: 3px solid #5A8AC6;
  border-radius: 50px;
  background-color: white;
  color: #5A8AC6;
  font-family: 'Nunito', sans-serif;
  font-size: 20px;
  min-height: 40px;
  min-width: 160px;
  padding: 0 20px;
  margin: 0 3px;
  box-shadow: 0 6px 16px #00000026;
  cursor: pointer;
  transition: all 0.3s;
  display: inline-block;
  vertical-align: middle;
}
button:hover,
.améloration button:hover,
#btnMenu:hover,
#menuSecondaire button:hover,
#menuClose:hover,
#paneau button:hover {
  background-color: #5A8AC6;
  color: #fff;
  text-shadow: 0 2px 5px #465f7c;
  transform: scale(1.1);
  box-shadow: 0 8px 24px rgba(0,0,0,0.3);
}

/* --- 5. Pierre principale --- */
#principale {
  padding: 20px 50px;
  justify-content: center;
  align-items: center;
  font-size: 2rem;
  margin: 50px 0;
}
#container {
  display: inline-block;
  transition: transform 0.3s ease, filter 0.3s ease;
}
#container.clicked-container {
  transform: scale(0.9);
  filter: brightness(120%) grayscale(100%);
}
#container img {
  width: 100px;
  height: auto;
  transition: none;
  will-change: transform, filter;
  z-index: 10;
}
@keyframes rotation_pierre {
  0% { transform: rotate(-10deg); }
  100% { transform: rotate(10deg); }
}
@keyframes scale_shadow_pierre {
  0% { transform: scale(1); filter: drop-shadow(0 4px 4px #cae4ff); }
  50% { transform: scale(1.1); filter: drop-shadow(0 12px 16px #bde7ff); }
  100% { transform: scale(1); filter: drop-shadow(0 4px 4px #cae4ff); }
}
button:hover #container .wrapper {
  animation: rotation_pierre 4s linear infinite alternate;
}
button:hover #container .wrapper img {
  animation: scale_shadow_pierre 4s ease-in-out infinite alternate;
}

/* --- 6. Section Amélioration --- */
/* --- 6. Section Amélioration --- */
.améloration {
  display: flex;
  flex-wrap: wrap;
  gap: 15px; /* Garde cet espacement standard entre tous les éléments flexibles */
  justify-content: center;
  align-items: center; /* Important pour aligner tous les boutons verticalement */
  padding: 20px;
  position: relative;
  overflow: visible;
}

/* Assure que le score-wrapper ne perturbe pas l'alignement flex */
.améloration .score-wrapper {
    flex-shrink: 0; /* Empêche le score de rétrécir */
    flex-grow: 0;   /* Empêche le score de grandir */
    align-self: center; /* S'assure qu'il est bien centré verticalement dans la ligne */
}
.améloration p {
  font-size: 30px;
  color: #5A8AC6;
  margin: 0 0 10px;
  text-align: center;
  width: 100%;
}

/* --- 7. Menu Bouton et Panneau Amélioré --- */
#btnMenu,
#menuClose {
  font-size: 20px;
  min-width: 40px;
  min-height: 40px;
  text-align: center;
  display: inline-block;
  vertical-align: middle;
  background: none;
  border: none;
  cursor: pointer;
  transition: all 0.3s ease;
  color: #5A8AC6;
}

#btnMenu {
  border-radius: 50%;
  width: 45px;
  height: 45px;
  background: linear-gradient(135deg, #ffffff, #f2f9ff);
  border: 3px solid #5A8AC6;
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
  font-size: 2em;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 5px;
  z-index: 10;
  position: relative;
}
#btnMenu:hover {
  background: #5A8AC6;
  color: #fff;
  transform: scale(1.1);
  box-shadow: 0 6px 18px rgba(0,0,0,0.2);
}
#btnMenu.open {
  border-color: #e07a7a;
  transform: rotate(135deg) scale(1.1);
  background: linear-gradient(135deg, #e7a3a3, #f5cccc);
}
#btnMenuIcon {
  transition: transform 0.3s, color 0.3s;
}
#btnMenu.open #btnMenuIcon {
  color: white;
  transform: rotate(45deg);
}

#menuSecondaire {
  top: 100px;
  left: 50%;
  transform: translateX(-50%) translateY(-20px) scale(0.95);
  opacity: 0;
  pointer-events: none;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 15px;
  background: rgba(255, 255, 255, 0.85);
  box-shadow: 0 12px 32px rgba(90, 138, 198, 0.25);
  border-radius: 20px;
  padding: 25px 20px 20px;
  transition: opacity 0.4s ease, transform 0.4s ease;
  backdrop-filter: blur(6px);
  z-index: 10000;
}
#menuSecondaire.open {
  opacity: 1;
  pointer-events: auto;
  transform: translateX(-50%) translateY(0) scale(1);
}
#menuSecondaire button {
  opacity: 0;
  transform: translateY(-20px) scale(0.95);
  transition: opacity 0.4s, transform 0.4s;
}
#menuSecondaire.open button {
  opacity: 1;
  transform: translateY(0) scale(1);
}

/* --- 8 à 13 : Panneau, Infos, Switch, Responsive, Carrousel, Viewer --- */

#paneau {
  position: fixed;
  bottom: -500px;
  left: 0;
  width: 100%;
  background: white;
  box-shadow: 0 -4px 20px #00000033;
  transition: bottom 0.5s;
  padding: 30px;
  text-align: center;
  z-index: 1000;
  color: #5A8AC6;
  border-top: 3px solid #5A8AC6;
  display: flex;
  flex-direction: column;
  align-items: center;
  overflow-y: visible;
  max-height: 85vh;
  box-sizing: border-box;
}
#paneau.ouvert {
  bottom: 0;
  height: auto;
  max-height: 80vh;
}
#paneau h2 {
  margin-top: 0;
  margin-bottom: 10px;
  font-size: 1.7rem;
}
#paneau button, #paneau input {
  margin: 5px;
  font-size: 20px;
  padding: 5px 10px;
  max-width: 80%;
}
#closePaneau {
  position: absolute;
  top: 10%;
  right: 10%;
  font-size: 30px !important;
  background: transparent !important;
  border: none !important;
  cursor: pointer;
  box-shadow: none !important;
  transition: transform 0.3s;
}
#closePaneau:hover {
  transform: scale(1.2);
  color: #417bcc;
  text-shadow: none !important;
}

.information {
  display: grid;
  grid-template-columns: 1fr .3fr 1fr .3fr;
  column-gap: 50px;
  row-gap: 5px;
  text-align: left;
  align-items: start;
  justify-content: center;
  padding-top: 10px;
  box-sizing: border-box;
}
.information p {
  font-size: 0.9rem;
  margin: 2px 0;
  line-height: 1.2;
}

.switch {
  position: relative;
  display: inline-block;
  width: 60px;
  height: 34px;
}
.switch input {
  opacity: 0;
  width: 0;
  height: 0;
}
.slider {
  position: absolute;
  cursor: pointer;
  top: 0; left: 0; right: 0; bottom: 0;
  background-color: #ccc;
  transition: .4s;
}
.slider:before {
  content: "";
  position: absolute;
  height: 26px;
  width: 26px;
  left: 4px;
  bottom: 4px;
  background-color: white;
  transition: .4s;
}
input:checked + .slider {
  background-color: #5A8AC6;
}
input:focus + .slider {
  box-shadow: 0 0 1px #5A8AC6;
}
input:checked + .slider:before {
  transform: translateX(26px);
}
.slider.round {
  border-radius: 34px;
}
.slider.round:before {
  border-radius: 50%;
}
.paramétre {
  font-size: 30px;
  margin: 15px auto;
  line-height: 1.2;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 20px;
  width: fit-content;
  padding: 5px 0;
}
.paramétre p {
  margin: 0;
  white-space: nowrap;
  font-size: 20px;
}

@media (max-width: 400px) {
  #paneau {
    font-size: 1.2rem;
  }
  #paneau button, #paneau input {
    display: block;
    width: 50%;
    margin: 20px auto;
  }
}

.souvenir-carousel-container {
  position: relative;
  width: 100%;
  max-width: 500px;
  margin: 10px auto 20px auto;
  overflow: visible;
  padding: 0 40px;
  box-sizing: border-box;
  z-index: 5;
}
.souvenir-carousel-blur {
  border: 10px solid rgb(255,255,255);
  background-color: white;
  pointer-events: none;
  position: absolute;
  top: 0;
  width: 40px;
  height: 100%;
  z-index: 20;
  transform: scale(1.05);
}
.souvenir-carousel-blur.left { left: 0; filter: blur(10px); }
.souvenir-carousel-blur.right { right: 0; filter: blur(10px); }

.souvenir-carousel {
  display: flex;
  gap: 40px;
  overflow-x: scroll;
  scroll-snap-type: x mandatory;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  -ms-overflow-style: none;
  padding-bottom: 10px;
  justify-content: flex-start;
}
.souvenir-carousel::-webkit-scrollbar { display: none; }

.souvenir-item {
  flex: 0 0 auto;
  width: 120px;
  height: 120px;
  scroll-snap-align: center;
  background-color: #f0f0f0;
  border: 3px solid #5A8AC6;
  border-radius: 20px;
  box-shadow: 0 4px 10px rgba(0,0,0,0.1);
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  overflow: hidden;
  transition: transform 1s, box-shadow 1s;
  cursor: pointer;
  z-index: 1;
  position: relative;
  margin: 20px 0;
}
.souvenir-item:hover {
  transform: scale(1.15);
  box-shadow: 0 8px 15px rgba(0,0,0,0.3);
  z-index: 2;
}

.souvenir-image-wrapper {
  position: relative;
  width: 100%;
  height: 100%;
  overflow: hidden;
  border-radius: 13px;
}
.souvenir-image {
  position: absolute;
  top: 0; left: 0;
  width: 100%; height: 100%;
  object-fit: cover;
  transition: filter 0.5s;
}
.souvenir-item.locked .souvenir-image {
  filter: blur(8px) grayscale(80%);
}
.souvenir-item.unlocked .souvenir-image {
  filter: blur(0) grayscale(0);
}
.lock-overlay, .unlocked-overlay {
  position: absolute;
  top: 0; left: 0;
  width: 100%; height: 100%;
  border-radius: 13px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  z-index: 1;
  opacity: 0;
  transition: opacity 0.3s, background-color 0.3s;
}
.lock-overlay {
  background-color: rgba(0,0,0,0.7);
}
.souvenir-item.locked:hover .lock-overlay {
  opacity: 1;
  background-color: rgba(0,0,0,0.5);
}
.lock-overlay h3 {
  color: white;
  font-size: 2em;
  margin-bottom: 5px;
  text-shadow: 0 0 10px black;
}
.souvenir-cost {
  color: #FFD700;
  font-size: 1.5em;
  font-weight: bold;
  margin-top: 5px;
  text-shadow: 0 0 5px black;
}
.lock-icon {
  font-size: 4em;
  color: rgba(255,255,255,0.8);
  text-shadow: 0 0 15px black;
  margin-top: 15px;
}

.unlocked-overlay {
  background-color: rgba(0,0,0,0.7);
}
.souvenir-item.unlocked:hover .unlocked-overlay {
  opacity: 1;
  background-color: rgba(0,0,0,0.5);
}
.unlocked-overlay h3 {
  color: white;
  font-size: 1.5em;
  margin-bottom: 20px;
  text-shadow: 0 0 10px black;
}
.souvenir-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: 80%;
}
.souvenir-actions button {
  font-size: 1em;
  padding: 10px 15px;
  width: 100%;
  background-color: #5A8AC6;
  color: white;
  border: none;
  border-radius: 8px;
  transition: background-color 0.2s, transform 0.2s;
}
.souvenir-actions button:hover {
  background-color: #417bcc;
  transform: scale(1.05);
  box-shadow: 0 4px 8px rgba(0,0,0,0.3);
}

.carousel-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  background-color: rgba(90,138,198,0.8);
  color: white;
  border: none;
  min-width: 40px !important;
  min-height: 40px !important;
  font-size: 2em;
  display: flex;
  justify-content: center;
  align-items: center;
  cursor: pointer;
  z-index: 100;
  box-shadow: 0 2px 5px rgba(0,0,0,0.2);
  padding: 20px 10px 10px 10px;
  transition: opacity 0.4s, transform 0.4s, background-color 1s;
}
.carousel-nav:hover {
  background-color: #417bcc;
  transform: translateY(-50%) scale(1.1);
}
.carousel-nav.prev { left: 10px; }
.carousel-nav.next { right: 10px; }

@media (max-width: 600px) {
  .souvenir-item { width: 90%; margin: 0 auto; }
  .souvenir-carousel-container { padding: 0 20px; }
  .carousel-nav { width: 30px; height: 30px; font-size: 1.5em; }
  .carousel-nav.prev { left: 5px; }
  .carousel-nav.next { right: 5px; }
}

#animationViewer {
  position: fixed;
  top: 0; left: 0;
  width: 100%; height: 100%;
  backdrop-filter: blur(10px);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 2000;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.4s, visibility 0.4s, backdrop-filter 0.4s;
}
#animationViewer.viewer-visible {
  opacity: 1;
  visibility: visible;
}
.viewer-content {
  background: linear-gradient(145deg, #e6f0ff, #cce0ff);
  border: 3px solid #5A8AC6;
  max-width: 900px;
  width: 90vw;
  height: 75%;
  max-height: 650px;
  box-shadow: 0 0 8px rgba(90,138,198,0.3);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  align-items: center;
  transform: scale(0.4);
  opacity: 0;
  transition: transform 0.6s cubic-bezier(0.68,-0.55,0.27,1.55), opacity 0.6s;
  color: #2F3E46;
  border-radius: 30px;
  padding: 30px;
  margin: 50px;
}
#animationViewer.viewer-visible .viewer-content {
  transform: scale(1);
  opacity: 1;
}

#additionalButtons {
    display: flex;
    flex-wrap: wrap;
    gap: 15px; /* Important : doit correspondre au gap de .améloration pour la cohérence */
    overflow: hidden;
    max-height: 0;
    opacity: 0;
    padding-top: 0; /* Pas de padding quand caché */
    width: 100%; /* S'assure qu'il utilise toute la largeur pour le flex-wrap */
    justify-content: center;
    transition: max-height 0.5s ease-out, opacity 0.5s ease-out, padding-top 0.5s ease-out; /* Ajoute padding-top à la transition */
}

#additionalButtons.additional-buttons-visible {
    max-height: 200px; /* Hauteur suffisante pour contenir les boutons révélés (ajuster si tu ajoutes plus de lignes) */
    opacity: 1;
    padding-top: 15px; /* Un petit padding pour espacer les boutons révélés des boutons du dessus */
}

#additionalButtons.additional-buttons-visible {
    max-height: 200px; /* Une hauteur suffisante pour contenir les boutons révélés (ajuster si besoin) */
    opacity: 1; /* Révèle les boutons */
    padding-top: 0; /* Ajoute un peu d'espace avec les boutons du dessus */
}

/* Styles du bouton "Plus" / "Moins" */
#btnToggleAdditional {
    /* Dimensions pour le rendre rond et petit */
    width: 40px; /* Largeur fixe */
    height: 40px; /* Hauteur fixe, égale à la largeur pour un cercle */
    border-radius: 50%; /* Rend le bouton parfaitement rond */
    padding: 0; /* Supprime le padding pour le centrage du texte/icône */
    display: flex; /* Utilise flexbox pour centrer l'icône/texte */
    justify-content: center; /* Centre horizontalement */
    align-items: center; /* Centre verticalement */
    font-size: 1.6rem; 
    line-height: 1; 
    min-width: unset; 
    margin: 0 3px; 
    box-sizing: border-box; 
    white-space: nowrap; 
    transition: all 0.4s ease-in-out; 
  }

/* Ajustements au hover si nécessaire, mais il devrait hériter du style générique `button:hover` */
#btnToggleAdditional:hover {
    /* Tu peux ajouter des styles spécifiques au hover si tu veux un effet différent */
    background-color: #5A8AC6;
    color: #ffffff;
    text-shadow: 0 2px 5px #465f7c;
    transform: scale(1.1);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
    transition: all 0.4s ease;
}

/* Style de l'icône à l'intérieur du bouton */
#btnToggleAdditional #toggleIcon {
    transition: all 0.4s ease; /* <-- déplace ici */
    margin-right: 0;
}

/* Quand le bouton est "expanded", l'icône tourne */
#btnToggleAdditional.expanded #toggleIcon {
    transform: rotate(225deg);
}


/* Ajustements pour la section .améloration (si nécessaire) */
.améloration {
  /* Assure-toi que display: flex, flex-wrap: wrap, gap, et justify-content: center sont bien présents */
  display: flex;
  flex-wrap: wrap;
  gap: 15px; /* Uniformise l'espacement avec les boutons supplémentaires */
  justify-content: center;
  align-items: center;
  padding: 20px; /* Maintient le padding */
  /* Retire toute hauteur ou max-height qui pourrait contraindre ici */
}

/* Le bouton de fermeture du panneau principal reste comme avant */
#closePaneau {
  position: absolute;
  top: 15px;
  right: 15px;
  font-size: 30px !important;
  background: transparent !important;
  border: none !important;
  cursor: pointer;
  box-shadow: none !important;
  transition: transform 0.3s;
  color: #5A8AC6;
  z-index: 1001; /* Très important pour qu'il soit au-dessus de tout */
}
#closePaneau:hover {
  transform: scale(1.2);
  color: #417bcc;
  text-shadow: none !important;
}



#contenuPanneau {
  flex-grow: 1;
  width: 100%;
  overflow-y: auto; /* C'est ICI que le scroll est */
  max-height: calc(85vh - 60px - 40px); /* Ajuste cette valeur si nécessaire */
  box-sizing: border-box;
  padding: 0 15px;
}