* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  min-height: 100vh;
  background-color: #ffeeab;
  font-family: 'Fredoka', sans-serif;
  padding: 20px;
  gap: 25px;
}

h1 {
  color: rgb(111, 43, 0);
  font-size: clamp(2rem, 5vw, 3.5rem);
  text-align: center;
  text-transform: uppercase;
}

.calendrier-coeur {
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  grid-template-rows: repeat(7, 1fr);
  gap: 8px;

  /* Garde exactement la forme du cœur peu importe la taille de l'écran */
  width: 100%;
  max-width: 850px;
  aspect-ratio: 8 / 7;

  /* Dessin de la grille en forme de cœur (8 colonnes x 7 lignes) */
  grid-template-areas:
    ".  c1  c1  .   .   c2  c2  . "
    "c3 c4  c6  c6  c7  c8  c9  c10"
    "c5 c11 c6  c6  c12 c8  c13 c15"
    ".  c14 c14 c16 c17 c19 c19 . "
    ".  c20 c21 c16 c18 c19 c19 . "
    ".  .   c22 c22 c23 c23 .   . "
    ".  .   .   c24 c24 .   .   . ";
}

.case {
  background-color: #e94560;
  color: white;
  border-radius: 10px;
  display: flex;
  justify-content: center;
  align-items: center;
  font-size: clamp(0.9rem, 2.2vw, 1.8rem);
  font-weight: bold;
  cursor: pointer;
  transition: transform 0.2s;
}

.case:hover {
  transform: scale(0.96);
  filter: brightness(1.1);
}

/* Attribution de chaque case à sa zone dans le cœur */
.c1  { grid-area: c1; }
.c2  { grid-area: c2; }
.c3  { grid-area: c3; }
.c4  { grid-area: c4; }
.c5  { grid-area: c5; }
.c6  { grid-area: c6; }
.c7  { grid-area: c7; }
.c8  { grid-area: c8; }
.c9  { grid-area: c9; }
.c10 { grid-area: c10; }
.c11 { grid-area: c11; }
.c12 { grid-area: c12; }
.c13 { grid-area: c13; }
.c14 { grid-area: c14; }
.c15 { grid-area: c15; }
.c16 { grid-area: c16; }
.c17 { grid-area: c17; }
.c18 { grid-area: c18; }
.c19 { grid-area: c19; }
.c20 { grid-area: c20; }
.c21 { grid-area: c21; }
.c22 { grid-area: c22; }
.c23 { grid-area: c23; }
.c24 { grid-area: c24; }

/* Couleurs (utilise class="case c1 r" dans le HTML pour en mettre plusieurs de la même couleur) */
.rouge {
  background-color: #f60808;
}

.bleu {
  background-color: #3808f6;
}

.vert {
  background-color: #018d24;
}

.orange {
  background-color: #f69708;
}

.rose {
  background-color: #e34288;
}

.violet {
  background-color: #9200ba;
}

/* Fond sombre et flouté qui recouvre tout l'écran */
.overlay {
  position: fixed;
  inset: 0;
  background-color: rgba(15, 15, 30, 0.65);
  backdrop-filter: blur(8px);
  display: flex;
  justify-content: center;
  align-items: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
  z-index: 100;
}

/* Quand la fenêtre est ouverte */
.overlay.actif {
  opacity: 1;
  pointer-events: auto;
}

/* La case agrandie au centre */
.case-zoom {
  position: relative;
  width: 90%;
  max-width: 400px;
  min-height: 300px;
  background-color: #e94560;
  color: white;
  border-radius: 24px;
  padding: 30px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  text-align: center;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5);
  gap: 15px;
  transform: scale(0.5);
  transition: transform 0.35s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.overlay.actif .case-zoom {
  transform: scale(1);
}

.zoom-numero {
  font-size: 4rem;
  font-weight: bold;
  margin-bottom: 15px;
  text-shadow: 3px 3px 0px rgba(0, 0, 0, 0.25);
}

.zoom-texte {
  font-size: 1.5rem;
  line-height: 1.4;
}

.btn-fermer {
  position: absolute;
  top: 15px;
  right: 15px;
  background: rgba(0, 0, 0, 0.25);
  border: none;
  color: white;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  font-size: 1.2rem;
  cursor: pointer;
  transition: background 0.2s;
}

.btn-fermer:hover {
  background: rgba(0, 0, 0, 0.5);
}

/* Bouton d'ouverture sur la carte zoomée */
.btn-ouvrir {
  background-color: color-mix(in srgb, var(--couleur-case) 65%, white);
  color: white;
  border: 2px solid rgba(255, 255, 255, 0.5);

  padding: 13px 30px;
  font-family: 'Fredoka', sans-serif;
  font-size: 1.15rem;
  font-weight: bold;

  border-radius: 50px;
  cursor: pointer;

  box-shadow:
    0 5px 0 rgba(0, 0, 0, 0.2),
    0 8px 15px rgba(0, 0, 0, 0.15);

  transition: transform 0.15s ease, box-shadow 0.15s ease,
              background-color 0.15s ease;
}

.btn-ouvrir:hover:not(:disabled) {
  background-color: color-mix(in srgb, var(--couleur-case) 50%, white);

  transform: translateY(-2px);

  box-shadow:
    0 7px 0 rgba(0, 0, 0, 0.2),
    0 10px 18px rgba(0, 0, 0, 0.18);
}

.btn-ouvrir:active:not(:disabled) {
  transform: translateY(3px);

  box-shadow:
    0 2px 0 rgba(0, 0, 0, 0.2),
    0 4px 8px rgba(0, 0, 0, 0.15);
}

/* Style quand le bouton est verrouillé (mauvaise date) */
.btn-ouvrir.verrouille {
  background-color: rgba(0, 0, 0, 0.35);
  color: rgba(255, 255, 255, 0.6);
  cursor: not-allowed;
  box-shadow: none;
}

/* Permet de masquer le bouton ou le texte au bon moment */
.cache {
  display: none;
}