:root {
  --pink-light: #ffe4ec;
  --pink: #ffb6c1;
  --pink-deep: #f78fa7;
  --lavender: #e6d7f5;
  --cream: #fff9f5;
  --gold: #d4a574;
  --text: #5a4552;
}

* { box-sizing: border-box; }

html, body {
  height: 100%;
}

body {
  margin: 0;
  font-family: 'Quicksand', sans-serif;
  color: var(--text);
  background: linear-gradient(135deg, var(--cream) 0%, var(--pink-light) 50%, var(--lavender) 100%);
  background-attachment: fixed;
  overflow: hidden;
  position: relative;
  touch-action: manipulation;
}

/* Coeurs flottants en fond */
.hearts-bg {
  position: fixed;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
  z-index: 0;
}

.floating-heart {
  position: absolute;
  bottom: -10%;
  font-size: 1.5rem;
  opacity: 0.5;
  animation: floatUp linear forwards;
  color: var(--pink-deep);
}

@keyframes floatUp {
  0% { transform: translateY(0) translateX(0) rotate(0deg); opacity: 0; }
  10% { opacity: 0.6; }
  100% { transform: translateY(-110vh) translateX(var(--drift, 20px)) rotate(360deg); opacity: 0; }
}

/* Écrans */
.screen {
  position: relative;
  z-index: 1;
  height: 100vh;
  height: 100dvh;
  display: none;
  align-items: center;
  justify-content: center;
  padding: clamp(0.5rem, 3vh, 1.5rem) clamp(0.6rem, 4vw, 1.5rem);
  opacity: 0;
  animation: fadeIn 0.7s ease forwards;
  overflow: hidden;
}

.screen.active {
  display: flex;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}

.card {
  background: rgba(255, 255, 255, 0.6);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.8);
  border-radius: 28px;
  padding: clamp(1.25rem, 4vh, 3rem) clamp(1.25rem, 5vw, 2.5rem);
  max-width: 560px;
  width: 100%;
  max-height: 100%;
  overflow-y: auto;
  text-align: center;
  box-shadow: 0 20px 60px rgba(247, 143, 167, 0.25);
  display: flex;
  flex-direction: column;
}

.card::-webkit-scrollbar {
  width: 5px;
}

.card::-webkit-scrollbar-thumb {
  background: var(--pink-light);
  border-radius: 999px;
}

.eyebrow {
  text-transform: uppercase;
  letter-spacing: 0.15em;
  font-size: clamp(0.65rem, 1.8vh, 0.75rem);
  color: var(--pink-deep);
  font-weight: 600;
  margin: 0 0 0.5rem;
  flex: 0 0 auto;
}

.title {
  font-family: 'Dancing Script', cursive;
  font-size: clamp(1.9rem, 6vh, 3rem);
  margin: 0 0 clamp(0.5rem, 2vh, 1rem);
  color: var(--pink-deep);
  line-height: 1.2;
  flex: 0 0 auto;
}

.title-sm {
  font-size: clamp(1.4rem, 4.5vh, 2.3rem);
}

.subtitle {
  font-size: clamp(0.85rem, 2.2vh, 1.05rem);
  line-height: 1.5;
  margin: 0 0 clamp(1rem, 3vh, 2rem);
  flex: 0 0 auto;
}

.subtitle-sm {
  font-size: clamp(0.78rem, 2vh, 0.95rem);
  line-height: 1.35;
  margin: 0 0 clamp(0.5rem, 1.5vh, 1rem);
  opacity: 0.85;
  flex: 0 0 auto;
}

.btn {
  font-family: 'Quicksand', sans-serif;
  font-weight: 700;
  font-size: clamp(0.9rem, 2.2vh, 1.05rem);
  color: white;
  background: linear-gradient(135deg, var(--pink-deep), var(--gold));
  border: none;
  padding: clamp(0.7rem, 2vh, 0.9rem) clamp(1.6rem, 4vw, 2.2rem);
  border-radius: 999px;
  cursor: pointer;
  box-shadow: 0 10px 25px rgba(247, 143, 167, 0.4);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  flex: 0 0 auto;
}

.btn:hover {
  transform: translateY(-2px) scale(1.03);
  box-shadow: 0 14px 30px rgba(247, 143, 167, 0.5);
}

.btn:active {
  transform: translateY(0) scale(0.98);
}

.btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  transform: none;
}

/* Jeu memory */
.card-game {
  max-width: 620px;
}

.game-stats {
  display: flex;
  justify-content: center;
  gap: 2rem;
  font-weight: 600;
  color: var(--pink-deep);
  margin-bottom: clamp(0.6rem, 2vh, 1.5rem);
  font-size: clamp(0.8rem, 2vh, 0.95rem);
  flex: 0 0 auto;
}

.memory-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  grid-template-rows: repeat(4, 1fr);
  gap: clamp(0.35rem, 1.2vh, 0.7rem);
  perspective: 1000px;
  flex: 0 0 auto;
  height: clamp(220px, 46vh, 380px);
}

.memory-card {
  cursor: pointer;
  position: relative;
  transform-style: preserve-3d;
  transition: transform 0.5s cubic-bezier(0.4, 0.2, 0.2, 1);
}

.memory-card.flipped {
  transform: rotateY(180deg);
}

.memory-card.matched {
  transform: rotateY(180deg);
  opacity: 0.55;
}

.card-face {
  position: absolute;
  inset: 0;
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: clamp(1rem, 3.2vh, 1.6rem);
  backface-visibility: hidden;
}

.card-front {
  background: linear-gradient(135deg, var(--pink-deep), var(--pink));
  color: white;
}

.card-back {
  background: white;
  transform: rotateY(180deg);
  box-shadow: inset 0 0 0 2px var(--pink-light);
}

/* La carte de révélation s'étire sur toute la hauteur de l'écran
   pour que la galerie (flex:1) puisse occuper tout l'espace restant. */
.card-reveal {
  align-self: stretch;
  height: 100%;
  max-width: 620px;
  padding: clamp(0.9rem, 2.2vh, 1.6rem) clamp(1rem, 4vw, 1.75rem);
}

/* Textes resserrés sur cet écran pour laisser un maximum de place aux photos */
.card-reveal .eyebrow {
  margin-bottom: clamp(0.15rem, 0.6vh, 0.4rem);
}

.card-reveal .title {
  margin-bottom: clamp(0.15rem, 0.6vh, 0.4rem);
}

.card-reveal .subtitle-sm {
  margin-bottom: clamp(0.2rem, 0.8vh, 0.5rem);
}

.card-reveal .btn {
  padding: clamp(0.5rem, 1.4vh, 0.7rem) clamp(1.3rem, 3vw, 1.8rem);
  font-size: clamp(0.8rem, 1.8vh, 0.95rem);
  margin-bottom: clamp(0.2rem, 0.8vh, 0.5rem);
}

.card-reveal .signature {
  font-size: clamp(1rem, 2.5vh, 1.4rem);
}

/* Galerie photos */
.gallery-title {
  font-family: 'Dancing Script', cursive;
  font-size: clamp(1.1rem, 3.2vh, 1.6rem);
  color: var(--pink-deep);
  margin: 0 0 clamp(0.2rem, 0.8vh, 0.5rem);
  transition: opacity 0.25s ease;
  flex: 0 0 auto;
}

/* La rangée contient la grille de photos. Sur la toute dernière "page"
   (après la dernière catégorie), la grille disparaît et le bouton
   d'appel à l'action occupe seul tout l'espace. */
.gallery-row {
  display: flex;
  align-items: stretch;
  gap: clamp(0.4rem, 1.5vw, 0.8rem);
  margin-bottom: clamp(0.25rem, 0.8vh, 0.6rem);
  flex: 1 1 0;
  min-height: 60px;
}

.gallery {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  grid-template-rows: repeat(2, 1fr);
  gap: clamp(0.25rem, 0.8vh, 0.6rem);
  transition: opacity 0.25s ease;
  flex: 1 1 auto;
  min-width: 0;
}

.gallery-row.cta-page .gallery {
  display: none;
}

.gallery-row.cta-page {
  align-items: center;
  justify-content: center;
}

.gallery-cta-btn {
  width: 85%;
  flex: 0 0 auto;
  border: none;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--pink-deep), var(--gold));
  color: white;
  font-family: 'Quicksand', sans-serif;
  font-weight: 700;
  font-size: clamp(0.85rem, 2.1vh, 1.05rem);
  line-height: 1.3;
  text-align: center;
  white-space: nowrap;
  cursor: pointer;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 1.1rem 0.6rem;
  box-shadow: 0 10px 25px rgba(247, 143, 167, 0.4);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

/* N'apparaît que sur la dernière page (celle sans photos) */
.gallery-row.cta-page .gallery-cta-btn {
  display: flex;
  animation: ctaPop 0.35s ease;
}

@keyframes ctaPop {
  from { opacity: 0; transform: scale(0.85); }
  to { opacity: 1; transform: scale(1); }
}

.gallery-cta-btn:hover {
  transform: scale(1.04);
  box-shadow: 0 14px 30px rgba(247, 143, 167, 0.5);
}

.gallery-cta-btn:active {
  transform: scale(0.97);
}

.photo-placeholder {
  border-radius: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2rem;
  color: white;
  opacity: 0.9;
  overflow: hidden;
}

.photo-placeholder img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: inherit;
}

.ph-1 { background: linear-gradient(135deg, #ffb6c1, #f78fa7); }
.ph-2 { background: linear-gradient(135deg, #e6d7f5, #c9a8e8); }
.ph-3 { background: linear-gradient(135deg, #d4a574, #f0c896); }
.ph-4 { background: linear-gradient(135deg, #f78fa7, #e6d7f5); }

/* Navigation galerie */
.gallery-nav {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1.2rem;
  margin-bottom: clamp(0.25rem, 0.8vh, 0.6rem);
  flex: 0 0 auto;
}

.arrow-btn {
  width: clamp(32px, 8vh, 40px);
  height: clamp(32px, 8vh, 40px);
  border-radius: 50%;
  border: none;
  background: linear-gradient(135deg, var(--pink-deep), var(--gold));
  color: white;
  font-size: 1rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 8px 20px rgba(247, 143, 167, 0.35);
  transition: transform 0.2s ease;
  flex-shrink: 0;
}

.arrow-btn:hover {
  transform: scale(1.08);
}

.arrow-btn:active {
  transform: scale(0.95);
}

.gallery-dots {
  display: flex;
  gap: 0.4rem;
}

.dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--pink-light);
  transition: background 0.2s ease, transform 0.2s ease;
}

.dot.active {
  background: var(--pink-deep);
  transform: scale(1.2);
}


.video-wrapper {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  border-radius: 18px;
  overflow: hidden;
  box-shadow: 0 15px 40px rgba(247, 143, 167, 0.3);
}

.video-wrapper iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
}

.signature {
  font-family: 'Dancing Script', cursive;
  font-size: clamp(1.2rem, 3.5vh, 1.8rem);
  color: var(--pink-deep);
  margin: 0;
  flex: 0 0 auto;
}

/* Bouton "Passer" */
.skip-btn {
  display: block;
  flex: 0 0 auto;
  margin: clamp(0.5rem, 1.5vh, 1.2rem) auto 0;
  background: none;
  border: none;
  color: var(--text);
  opacity: 0.55;
  font-family: 'Quicksand', sans-serif;
  font-size: clamp(0.75rem, 1.8vh, 0.85rem);
  text-decoration: underline;
  cursor: pointer;
  transition: opacity 0.2s ease;
}

.skip-btn:hover {
  opacity: 0.9;
}

/* Modale code secret */
.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 10;
  background: rgba(90, 69, 82, 0.35);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
  padding: 1rem;
}

.modal-overlay.active {
  opacity: 1;
  pointer-events: auto;
}

.modal-box {
  background: var(--cream);
  border-radius: 22px;
  padding: 2rem 1.8rem;
  max-width: 320px;
  width: 100%;
  text-align: center;
  box-shadow: 0 20px 50px rgba(90, 69, 82, 0.3);
  transform: translateY(10px);
  transition: transform 0.25s ease;
}

.modal-overlay.active .modal-box {
  transform: translateY(0);
}

.video-modal-box {
  max-width: 560px;
  padding: 1rem;
  position: relative;
}

.modal-close {
  position: absolute;
  top: -14px;
  right: -14px;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: none;
  background: linear-gradient(135deg, var(--pink-deep), var(--gold));
  color: white;
  font-size: 0.9rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 6px 16px rgba(90, 69, 82, 0.35);
  transition: transform 0.2s ease;
}

.modal-close:hover {
  transform: scale(1.08);
}

.modal-title {
  font-family: 'Dancing Script', cursive;
  font-size: 1.7rem;
  color: var(--pink-deep);
  margin: 0 0 0.4rem;
}

.modal-text {
  font-size: 0.9rem;
  margin: 0 0 1.2rem;
  opacity: 0.85;
}

.modal-input {
  width: 100%;
  padding: 0.7rem 1rem;
  border-radius: 999px;
  border: 2px solid var(--pink-light);
  background: white;
  font-family: 'Quicksand', sans-serif;
  font-size: 1rem;
  text-align: center;
  outline: none;
  box-sizing: border-box;
}

.modal-input:focus {
  border-color: var(--pink-deep);
}

.modal-input.shake {
  animation: shake 0.4s ease;
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  20%, 60% { transform: translateX(-6px); }
  40%, 80% { transform: translateX(6px); }
}

.modal-error {
  display: none;
  color: #d1495b;
  font-size: 0.85rem;
  margin: 0.6rem 0 0;
}

.modal-actions {
  display: flex;
  gap: 0.8rem;
  justify-content: center;
  margin-top: 1.3rem;
}

.btn-ghost {
  background: none;
  color: var(--pink-deep);
  box-shadow: none;
  border: 2px solid var(--pink-light);
}

.btn-ghost:hover {
  box-shadow: none;
  background: var(--pink-light);
}

/* QCM */
.card-qcm {
  max-width: 560px;
}

.qcm-progress {
  font-size: clamp(0.75rem, 1.8vh, 0.85rem);
  font-weight: 600;
  color: var(--pink-deep);
  opacity: 0.8;
  margin-bottom: clamp(0.4rem, 1.2vh, 0.8rem);
  flex: 0 0 auto;
}

.qcm-question {
  font-size: clamp(0.95rem, 2.6vh, 1.1rem);
  font-weight: 600;
  margin: 0 0 clamp(0.75rem, 2vh, 1.3rem);
  line-height: 1.4;
  flex: 0 0 auto;
}

.qcm-options {
  display: flex;
  flex-direction: column;
  gap: clamp(0.4rem, 1.2vh, 0.7rem);
  margin-bottom: clamp(0.75rem, 2vh, 1.5rem);
  flex: 0 1 auto;
  min-height: 0;
  overflow-y: auto;
}

.qcm-option {
  font-family: 'Quicksand', sans-serif;
  font-size: clamp(0.85rem, 2vh, 0.95rem);
  font-weight: 600;
  color: var(--text);
  background: white;
  border: 2px solid var(--pink-light);
  border-radius: 14px;
  padding: clamp(0.55rem, 1.8vh, 0.8rem) clamp(0.9rem, 3vw, 1.2rem);
  text-align: left;
  cursor: pointer;
  transition: border-color 0.2s ease, background 0.2s ease, transform 0.15s ease;
  flex-shrink: 0;
}

.qcm-option:hover:not(:disabled) {
  border-color: var(--pink-deep);
  transform: translateY(-1px);
}

.qcm-option:disabled {
  cursor: default;
}

.qcm-option.correct {
  background: #e3f5e6;
  border-color: #6fbf7a;
  color: #2e6b3a;
}

.qcm-option.wrong {
  background: #fbe4e6;
  border-color: #e08a92;
  color: #a13d46;
}

.qcm-score {
  display: block;
  font-family: 'Dancing Script', cursive;
  font-size: clamp(2rem, 6vh, 3rem);
  color: var(--pink-deep);
  margin-bottom: 0.3rem;
}

/* Petits écrans très courts (mobile en paysage) : on resserre encore */
@media (max-height: 480px) {
  .card { padding: 0.75rem 1.25rem; }
  .eyebrow { margin-bottom: 0.2rem; }
  .title, .subtitle, .subtitle-sm, .gallery-title { margin-bottom: 0.3rem; }
}
