/* ====== VOTRE CSS (inchangé) ====== */
/* Réinitialisation et base */

/* ===== Popup global (au-dessus de toute la page) ===== */
.global-modal[hidden] { display: none !important; }
.global-modal { position: fixed; inset: 0; z-index: 999999; }
.global-modal__backdrop { position: absolute; inset: 0; background: rgba(0,0,0,.6); }
.global-modal__dialog {
  position: absolute; top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  width: min(92vw, 1100px);
  height: min(88vh, 820px);
  background: #fff; border-radius: 16px; overflow: hidden;
  box-shadow: 0 20px 60px rgba(0,0,0,.35);
}
.global-modal__x {
  position: absolute; top: 8px; right: 8px;
  background: rgba(0,0,0,.6); color: #fff; border: 0;
  width: 40px; height: 40px; border-radius: 8px; font-size: 24px; cursor: pointer; z-index: 2;
}
.global-modal__frame { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }

@media (max-width: 768px) {
  .global-modal__dialog { width: 96vw; height: 92vh; border-radius: 12px; }
  .global-modal__x { width: 36px; height: 36px; font-size: 22px; }
}


* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: 'Poppins', sans-serif;
  background-color: #f0f7f0; /* Vert très clair, apaisant */
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  min-height: 100vh;
  padding: 20px;
  color: #3d2914; /* Couleur terre pour le texte par défaut */
}

/* Conteneur principal */
.container {
  background-color: #d4e8d4; /* Vert pastel doux */
  border-top-left-radius: 25px;
  border-top-right-radius: 25px;
  padding: 40px 30px;
  width: 100%;
  max-width: 85vw;
  box-shadow: 0 6px 12px rgba(0, 0, 0, 0.1);
  text-align: center;
  border: 1px solid #b8d8b8; /* Bordure subtile */
}

/* Mascotte */
.mascot-image {
  display: block;
  width: 100%;
  max-width: 700px; /* Plus adaptable */
  height: auto;
  margin: 20px auto 25px;
}

/* Titres */
h1 {
  color: #2a4d2a; /* Vert foncé naturel */
  font-size: 36px;
  margin-bottom: 15px;
  font-weight: 700;
  letter-spacing: 1px;
}

h2 {
  color: #1e3d1e; /* Vert encore plus foncé pour hiérarchie */
  font-size: 28px;
  margin-bottom: 20px;
  font-weight: 600;
}

.subtitle {
  color: #3d2914;
  font-size: 20px;
  margin-bottom: 30px;
  font-style: italic;
  line-height: 1.5;
}

/* Conteneur des puzzles */
.puzzles-container {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 35px;
  margin-top: 20px;
}

/* Élément de puzzle */
.puzzle-item {
  flex: 1;
  min-width: 250px;
  max-width: 300px;
  background-color: #f8f8f800;
  border-radius: 15px;
  padding: 20px;
  transition: transform 0.2s ease;
  cursor: pointer;
}

.puzzle-item:hover {
  transform: translateY(-5px);
  box-shadow: 0 8px 16px rgba(0, 0, 0, 0.15);
}

.puzzle-image {
  width: 152px;
  height: 150px;
  border-radius: 20px;
  object-fit: cover;
  margin: 0 auto 15px;
  clip-path: path(
    'M 20 0 L 200 0 L 200 80 Q 220 90 200 120 L 200 200 L 20 200 L 20 120 Q 0 90 20 80 L 20 0'
  );
  transition: transform 0.3s ease;
  display: block;
}

.puzzle-item:hover .puzzle-image {
  transform: scale(1.05);
  box-shadow: 0 6px 12px rgba(0, 0, 0, 0.2);
}

.puzzle-content {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.puzzle-content h3 {
  color: #2a4d2a;
  font-size: 18px;
  text-align: center;
  margin-bottom: 10px;
}

.puzzle-item:hover .puzzle-content h3 {
  text-decoration: underline;
  color: #1e3d1e;
}

/* Niveau de difficulté */
.difficulty {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  margin-top: 10px;
}

.difficulty-label {
  font-size: 14px;
  color: #3d2914;
  font-weight: 600;
}

.difficulty-icons {
  display: flex;
  gap: 4px;
}

.difficulty-icon {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  color: white;
  font-weight: bold;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.easy {
  background-color: #4caf50;
}
.medium {
  background-color: #ff9800;
}
.hard {
  background-color: #f44336;
}
.footer {
    background-color: #2a4d2a;
    color: #f0f7f0;
    padding: 20px;
    text-align: center;
    width: 100%;
    max-width:85vw;
    font-family: 'Poppins', sans-serif;
    font-size: 14px;
    border-top: 2px solid #b8d8b8;
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.1); /* Ombre pour l'harmoniser avec le conteneur */
    border-bottom-right-radius:25px;
    border-bottom-left-radius:25px;
}
/* Adaptation mobile */
@media (max-width: 768px) {
  .container {
    padding: 25px 20px;
  }
  .puzzles-container {
    flex-direction: column;
    align-items: center;
    gap: 25px;
  }
  .footer {
        padding: 15px;
        font-size: 12px;
  }
  h1 {
    font-size: 28px;
  }
  .subtitle {
    font-size: 18px;
  }
  .puzzle-item {
    max-width: 280px;
  }
  /* Sur mobile, on n’utilise pas l’iframe */
  .viewer { display: none; }
}

/* ====== AJOUTS : zone repliable (dropdown) + boutons ====== */
.viewer {
  margin-top: 28px;
  overflow: hidden;
  transition:
    grid-template-rows 320ms ease,
    opacity 320ms ease,
    transform 320ms ease;
  display: grid;
  grid-template-rows: 0fr; /* replié */
  opacity: 0;
  transform: translateY(-6px);
}

.viewer.open {
  grid-template-rows: 1fr; /* déplié */
  opacity: 1;
  transform: translateY(0);
}

.viewer-inner {
  min-height: 0; /* nécessaire pour l’animation grid */
  background: #e9f4e9;
  border: 1px solid #b8d8b8;
  border-radius: 16px;
  padding: 14px;
}

.viewer-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
  flex-wrap: wrap;
}

.viewer-title {
  font-size: 18px;
  font-weight: 700;
  color: #1e3d1e;
}

.viewer-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}

.btn {
  appearance: none;
  border: 1px solid #7fb37f;
  background: #2a4d2a;
  color: #fff;
  padding: 8px 12px;
  border-radius: 10px;
  font-weight: 600;
  cursor: pointer;
  transition:
    transform 0.12s ease,
    opacity 0.2s ease,
    background 0.2s ease;
}
.btn:hover {
  transform: translateY(-1px);
}
.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}
.btn.secondary {
  background: #3b6a3b;
}
.btn.ghost {
  background: transparent;
  color: #2a4d2a;
  border-color: #9fbe9f;
}

.viewer-iframe-wrap {
  width: 100%;
  aspect-ratio: 16 / 11;
  max-height: 80vh;
  background: #cfe5cf;
  border-radius: 12px;
  overflow: clip;
}
.viewer-iframe {
  width: 100%;
  height: 100%;
  border: 0;
  background: #fff;
}

/* Petite UX: survol d’un item sélectionné */
.puzzle-item.active {
  outline: 2px solid #2a4d2a;
  outline-offset: 2px;
}

.mascot-split {
  display: flex;
  flex-wrap: wrap;          /* allow wrapping */
  justify-content: flex-start; /* let items pack from the left */
  align-items: flex-end;
  width: 100%;
  margin: 20px auto 25px;
  max-width: 80%;
  gap: 0;                   /* optional: adjust if you want spacing */
}

/* Keep aspect ratio and responsive height */
.mascot-part {
  display: block;
  height: clamp(100px, 18vw, 220px);
  width: auto;
  object-fit: contain;
  pointer-events: none;
}

/* 🔑 This makes the second image hug the right edge on every line */
.mascot-right {
  margin-left: auto;
}

@media (max-width: 768px) {
  .mascot-part {
    height: clamp(80px, 22vw, 180px);
  }
}



