/* Base */
* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: Arial, sans-serif;
  color: #222;
  background: #f7f3ff;
}

/* En-tête */
.topbar {
  text-align: center;
  padding: 18px 12px;
}
.topbar h1 {
  margin: 0 0 6px 0;
  color: #8c4fd0;
  font-size: clamp(1.4rem, 2.5vw, 2rem);
}
.subtitle { color: #555; margin: 0 0 12px 0; }

/* Boutons */
.actions { display: flex; gap: 10px; justify-content: center; margin-bottom: 10px; }
.btn {
  appearance: none;
  border: none;
  background: #2fedda;
  color: #111;
  font-weight: 700;
  padding: .7em 1.1em;
  border-radius: 8px;
  cursor: pointer;
  box-shadow: 0 6px 16px rgba(0,0,0,.12);
}
.btn:hover { transform: translateY(-1px); }
.btn--ghost {
  background: transparent;
  border: 2px solid #9f5ed8;
  color: #9f5ed8;
}

/* Grille de cartes */
.grid {
  width: min(94vw, 1000px);
  margin: 10px auto 30px;
  display: grid;
  gap: 16px;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

/* Carte flip */
.card {
  background: transparent;
  border: none;
  padding: 0;
  perspective: 1000px;
  cursor: pointer;
  outline-offset: 4px;
}
.card:focus { outline: 3px solid #9f5ed8; }

.card__inner {
  position: relative;
  width: 100%;
  aspect-ratio: 4/3;
  transform-style: preserve-3d;
  transition: transform .45s ease;
  border-radius: 14px;
  box-shadow: 0 10px 22px rgba(0,0,0,.08);
  background: #fff;
}
.card[aria-pressed="true"] .card__inner {
  transform: rotateY(180deg);
}

.card__face {
  position: absolute;
  inset: 0;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  border-radius: 14px;
  display: grid;
  place-items: center;
  padding: 14px;
}
.card__face--front {
  background: #ffffff;
}
.card__face--front img {
  width: 80%;
  height: auto;
  display: block;
}
.card__face--back {
  background: #9f5ed8;
  color: #fff;
  transform: rotateY(180deg);
}
.label {
  font-size: clamp(1.1rem, 2.4vw, 1.6rem);
  font-weight: 800;
  letter-spacing: .5px;
}

footer.foot {
  text-align: center;
  margin-top: 40px;
  padding: 30px 0;
  border-top: 2px solid #e0d0f5;
  display: flex;
  flex-direction: column;
  align-items: center;
  background: #faf7fc;
}

footer.foot .btn-group {
  display: flex;
  gap: 12px;
  justify-content: center;
  flex-wrap: wrap;
  margin-bottom: 10px;
}

.back-btn {
  background-color: #8c4fd0;
  color: #fff;
  text-decoration: none;
  font-weight: 600;
  padding: 10px 18px;
  border-radius: 8px;
  box-shadow: 0 4px 10px rgba(0,0,0,0.15);
  transition: background-color 0.2s ease, transform 0.2s ease;
}
.back-btn:hover {
  background-color: #a46fe3;
  transform: translateY(-2px);
}

.footer-text {
  margin-top: 10px;
  color: #777;
  font-size: 0.9rem;
  text-align: center;
}
