/* Page d'invitation : le cadeau à ouvrir puis la lettre au Père Noël en 5 étapes. */

/* ---------- Attente et messages ---------- */

.attente {
  padding: 70px 0 40px;
  text-align: center;
  color: #fff;
  font-family: var(--titre);
  font-weight: 700;
  font-size: 1.6rem;
  text-shadow: 0 2px 0 rgba(0, 0, 0, 0.4);
}
.attente img {
  width: 76px;
  transform-origin: 50% 8%;
  animation: cloche 0.45s ease-in-out infinite alternate;
}
@keyframes cloche {
  from {
    transform: rotate(-20deg);
  }
  to {
    transform: rotate(20deg);
  }
}

/* ---------- Le cadeau à ouvrir ---------- */

/* Pleine largeur et rognée : les rayons qui tournent ne doivent pas élargir la page. */
.cadeau-scene {
  position: relative;
  margin: 0 -12px;
  padding: 26px 12px 6px;
  overflow: hidden;
  text-align: center;
}
.accroche {
  margin: 0;
  font-family: var(--titre);
  font-weight: 700;
  font-size: clamp(1.75rem, 7.4vw, 2.5rem);
  line-height: 1.12;
  color: #fff;
  text-shadow:
    0 3px 0 rgba(0, 0, 0, 0.45),
    0 0 18px rgba(0, 0, 0, 0.5);
}
.accroche strong {
  color: var(--or);
}
.gros-cadeau {
  position: relative;
  display: block;
  width: min(58vw, 240px);
  margin: 30px auto 6px;
  padding: 0;
  border: 0;
  background: none;
  cursor: pointer;
}
.gros-cadeau:focus-visible {
  outline: 4px solid #fff;
  outline-offset: 10px;
  border-radius: 18px;
  box-shadow: none;
}
.gros-cadeau .cadeau {
  position: relative;
  display: block;
  width: 100%;
  height: auto;
  overflow: visible;
  transform-origin: 50% 100%;
  filter: drop-shadow(0 12px 10px rgba(0, 0, 0, 0.4));
  animation: tremble 2.4s ease-in-out infinite;
}
.rayons {
  position: absolute;
  left: 50%;
  top: 52%;
  width: 210%;
  aspect-ratio: 1;
  border-radius: 50%;
  pointer-events: none;
  background: repeating-conic-gradient(rgba(255, 215, 90, 0.6) 0 10deg, transparent 10deg 20deg);
  -webkit-mask: radial-gradient(circle, #000 16%, transparent 66%);
  mask: radial-gradient(circle, #000 16%, transparent 66%);
  animation: tourne 22s linear infinite;
}
@keyframes tourne {
  from {
    transform: translate(-50%, -50%) rotate(0);
  }
  to {
    transform: translate(-50%, -50%) rotate(360deg);
  }
}
@keyframes tremble {
  0%,
  58%,
  100% {
    transform: rotate(0) scale(1);
  }
  63% {
    transform: rotate(-7deg) scale(1.06);
  }
  69% {
    transform: rotate(7deg) scale(1.06);
  }
  75% {
    transform: rotate(-5deg) scale(1.04);
  }
  81% {
    transform: rotate(4deg) scale(1.02);
  }
  88% {
    transform: rotate(-2deg);
  }
}
.cadeau .couvercle,
.cadeau .caisse {
  transform-box: fill-box;
  transform-origin: 50% 100%;
}
.gros-cadeau.ouvert .cadeau {
  animation: none;
}
.gros-cadeau.ouvert .couvercle {
  animation: couvercle 0.8s cubic-bezier(0.2, 0.8, 0.3, 1) forwards;
}
.gros-cadeau.ouvert .caisse {
  animation: caisse 0.8s ease-in forwards;
}
.gros-cadeau.ouvert .rayons {
  transition: opacity 0.6s;
  opacity: 0;
}
@keyframes couvercle {
  to {
    transform: translate(46px, -210px) rotate(48deg);
    opacity: 0;
  }
}
@keyframes caisse {
  25% {
    transform: scale(1.12, 0.88);
  }
  100% {
    transform: scale(0.5) translateY(70px);
    opacity: 0;
  }
}
.indication {
  margin: 16px 0 12px;
  color: #fff;
  font-weight: 900;
  font-size: 1.1rem;
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.7);
}
.indication small {
  display: block;
  font-weight: 700;
  font-size: 0.85rem;
  opacity: 0.92;
}

/* ---------- Progression ---------- */

.progression {
  margin: 4px 0 20px;
}
.rail {
  position: relative;
  height: 16px;
  border: 3px solid var(--encre);
  border-radius: 999px;
  background: #f1e3c8;
}
.rail-plein {
  width: 0;
  height: 100%;
  border-radius: 999px;
  background: repeating-linear-gradient(-45deg, #fff 0 8px, var(--rouge) 8px 16px);
  transition: width 0.55s cubic-bezier(0.3, 1.4, 0.5, 1);
  animation: sucre 0.8s linear infinite;
}
@keyframes sucre {
  to {
    background-position: 22.627px 0;
  }
}
.rail-marqueur {
  position: absolute;
  left: 0;
  top: 50%;
  height: 46px;
  width: auto;
  transform: translate(-60%, -58%);
  transition: left 0.55s cubic-bezier(0.3, 1.4, 0.5, 1);
  filter: drop-shadow(0 2px 2px rgba(0, 0, 0, 0.3));
}
.etape-num {
  margin: 12px 0 0;
  text-align: center;
  font-weight: 900;
  font-size: 0.78rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--encre-douce);
}

/* ---------- Étapes ---------- */

.etape {
  min-width: 0;
  margin: 0;
  padding: 0;
  border: 0;
}
.etape legend:focus {
  outline: none;
}
.etape.entre-droite {
  animation: entre-droite 0.45s cubic-bezier(0.2, 1.2, 0.4, 1) both;
}
.etape.entre-gauche {
  animation: entre-gauche 0.45s cubic-bezier(0.2, 1.2, 0.4, 1) both;
}
@keyframes entre-droite {
  from {
    transform: translateX(46px) rotate(2deg);
    opacity: 0;
  }
}
@keyframes entre-gauche {
  from {
    transform: translateX(-46px) rotate(-2deg);
    opacity: 0;
  }
}

.carte.secoue {
  animation: secoue 0.4s;
}
@keyframes secoue {
  20%,
  60% {
    transform: translateX(-9px) rotate(-1deg);
  }
  40%,
  80% {
    transform: translateX(9px) rotate(1deg);
  }
}

/* Étape 1 : le badge « Bonjour, je m'appelle ». */
.badge-nom {
  display: block;
  max-width: 360px;
  margin: 4px auto 6px;
  overflow: hidden;
  border: 3px solid var(--encre);
  border-radius: 20px;
  background: var(--rouge);
  box-shadow: 0 6px 0 var(--rouge-nuit);
  transform: rotate(-2deg);
}
.badge-haut {
  display: block;
  padding: 8px 10px 7px;
  color: #fff;
  font-weight: 800;
  font-size: 0.95rem;
  line-height: 1.05;
  text-align: center;
}
.badge-haut strong {
  display: block;
  font-weight: 900;
  font-size: 1.7rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}
.badge-nom .champ {
  padding: 12px 10px 16px;
  border: 0;
  border-radius: 0;
  box-shadow: none;
  font-family: var(--titre);
  font-size: 2.1rem;
  text-align: center;
}
.badge-nom .champ:focus {
  background: #fffbe6;
  box-shadow: none;
}
.badge-nom::after {
  content: '';
  display: block;
  height: 14px;
}

/* Étape 2 : les boules de Noël qui portent les dates. */
.boules {
  display: flex;
  justify-content: center;
  gap: clamp(10px, 5vw, 40px);
  margin-top: -8px;
}
.boule-choix {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  cursor: pointer;
  transform-origin: 50% 0;
  animation: balance 3.4s ease-in-out infinite;
}
.boule-choix.verte {
  animation-delay: -1.7s;
}
.boule-fil {
  width: 3px;
  height: 30px;
  background: var(--or-fonce);
}
.boule {
  position: relative;
  display: grid;
  place-content: center;
  width: clamp(122px, 35vw, 176px);
  aspect-ratio: 1;
  margin-top: 13px;
  border: 3px solid var(--encre);
  border-radius: 50%;
  background: radial-gradient(circle at 30% 26%, #ffb3ba 0 5%, var(--rouge) 40%, var(--rouge-fonce) 100%);
  box-shadow:
    inset -10px -12px 20px rgba(0, 0, 0, 0.28),
    0 8px 12px rgba(0, 0, 0, 0.25);
  color: #fff;
  line-height: 1;
  text-align: center;
  transition:
    transform 0.25s cubic-bezier(0.2, 1.6, 0.4, 1),
    filter 0.25s,
    box-shadow 0.25s;
}
.verte .boule {
  background: radial-gradient(circle at 30% 26%, #b6f2cf 0 5%, var(--vert) 40%, var(--vert-nuit) 100%);
}
/* La monture dorée. */
.boule::before {
  content: '';
  position: absolute;
  left: 50%;
  top: -16px;
  width: 30px;
  height: 17px;
  margin-left: -15px;
  border: 3px solid var(--encre);
  border-radius: 6px 6px 2px 2px;
  background: linear-gradient(90deg, var(--or-fonce), var(--or) 40%, #fff3b0 55%, var(--or-fonce));
}
.boule::after {
  content: '';
  position: absolute;
  inset: 8px;
  border: 2px dashed rgba(255, 255, 255, 0.6);
  border-radius: 50%;
}
.boule-semaine {
  font-weight: 900;
  font-size: 0.78rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}
.boule-jour {
  font-family: var(--titre);
  font-weight: 700;
  font-size: clamp(3.2rem, 14vw, 4.7rem);
  text-shadow: 0 3px 0 rgba(0, 0, 0, 0.3);
}
.boule-mois {
  font-family: var(--titre);
  font-weight: 700;
  font-size: 1.4rem;
}
.boule-note {
  max-width: 170px;
  margin-top: 8px;
  font-weight: 800;
  font-size: 0.9rem;
  color: var(--encre-douce);
  text-align: center;
}
@keyframes balance {
  0%,
  100% {
    transform: rotate(-3.5deg);
  }
  50% {
    transform: rotate(3.5deg);
  }
}
@keyframes balance-fort {
  0% {
    transform: rotate(0);
  }
  15% {
    transform: rotate(-16deg);
  }
  35% {
    transform: rotate(13deg);
  }
  55% {
    transform: rotate(-9deg);
  }
  78% {
    transform: rotate(6deg);
  }
  100% {
    transform: rotate(-3.5deg);
  }
}
.boule-choix.choisi {
  animation:
    balance-fort 1s ease-in-out,
    balance 3.4s ease-in-out 1s infinite;
}
.boule-choix.choisi .boule {
  transform: scale(1.05);
  box-shadow:
    inset -10px -12px 20px rgba(0, 0, 0, 0.28),
    0 0 0 5px var(--or),
    0 0 26px 9px rgba(255, 207, 63, 0.85);
}
.boules.a-un-choix .boule-choix:not(.choisi) .boule {
  transform: scale(0.9);
  filter: saturate(0.4) brightness(0.95);
}
.boule-choix.choisi::after,
.plat.choisi::after {
  content: '✓';
  position: absolute;
  display: grid;
  place-items: center;
  border: 3px solid var(--encre);
  border-radius: 50%;
  background: var(--or);
  color: var(--encre);
  font-weight: 900;
  animation: tampon 0.35s cubic-bezier(0.2, 1.7, 0.4, 1) both;
}
.boule-choix.choisi::after {
  right: -2px;
  top: 40px;
  z-index: 2;
  width: 38px;
  height: 38px;
  font-size: 1.3rem;
}
@keyframes tampon {
  from {
    transform: scale(0) rotate(-40deg);
  }
}
.boule-choix input:focus-visible ~ .boule,
.option-santa:has(input:focus-visible),
.plat:has(input:focus-visible),
.pastille:has(input:focus-visible) {
  outline: 3px solid var(--vert-nuit);
  outline-offset: 4px;
}

.pastille {
  display: flex;
  width: fit-content;
  margin: 20px auto 0;
  padding: 8px 20px 10px;
  border: 3px solid var(--encre);
  border-radius: 999px;
  background: #fff;
  font-weight: 900;
  cursor: pointer;
  box-shadow: 0 4px 0 var(--encre);
  transition:
    transform 0.1s,
    box-shadow 0.1s;
}
.pastille.choisi {
  background: var(--or);
  transform: translateY(2px);
  box-shadow: 0 2px 0 var(--encre);
}

/* Étape 3 : les envies de plats. */
.plats {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 11px 9px;
}
.plat {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 6px 14px 8px 10px;
  border: 3px solid var(--encre);
  border-radius: 16px;
  background: #fff;
  font-weight: 800;
  line-height: 1.2;
  cursor: pointer;
  user-select: none;
  box-shadow: 0 4px 0 var(--encre);
  transition:
    transform 0.1s,
    box-shadow 0.1s,
    background 0.15s;
}
.plat-emoji {
  font-size: 1.5rem;
  line-height: 1;
}
.plat.choisi {
  border-color: var(--vert-nuit);
  background: var(--vert);
  color: #fff;
  transform: translateY(2px) rotate(-1.5deg);
  box-shadow: 0 2px 0 var(--vert-nuit);
}
.plat.choisi .plat-emoji {
  animation: miam 0.5s cubic-bezier(0.2, 1.6, 0.4, 1);
}
.plat.choisi::after {
  right: -9px;
  top: -11px;
  width: 25px;
  height: 25px;
  border-width: 2px;
  font-size: 0.85rem;
}
@keyframes miam {
  0% {
    transform: scale(1);
  }
  40% {
    transform: scale(1.7) rotate(-18deg);
  }
  100% {
    transform: scale(1);
  }
}

/* Étape 4 : les deux façons de faire le Secret Santa. */
.options-santa {
  display: grid;
  gap: 16px;
}
.option-santa {
  position: relative;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px 12px 10px;
  border: 3px solid var(--encre);
  border-radius: 18px;
  background: #fff;
  cursor: pointer;
  box-shadow: 0 5px 0 var(--encre);
  transition:
    transform 0.12s,
    box-shadow 0.12s,
    background 0.15s;
}
.option-image {
  flex: none;
  width: 86px;
}
.option-image svg {
  display: block;
  width: 100%;
  height: auto;
  overflow: visible;
}
.option-titre {
  display: block;
  font-family: var(--titre);
  font-weight: 700;
  font-size: 1.55rem;
  line-height: 1.1;
  color: var(--rouge);
}
.option-texte {
  display: block;
  margin-top: 3px;
  font-weight: 700;
  font-size: 0.92rem;
  line-height: 1.3;
  color: var(--encre-douce);
}
@media (min-width: 560px) {
  .options-santa {
    grid-template-columns: 1fr 1fr;
  }
  .option-santa {
    flex-direction: column;
    padding: 14px 12px 16px;
    text-align: center;
  }
  .option-image {
    width: 110px;
  }
}
.option-santa.choisi {
  border-color: var(--vert-nuit);
  background: var(--creme);
  transform: translateY(-2px);
  box-shadow:
    0 5px 0 var(--vert-nuit),
    0 0 0 4px var(--or);
}
.options-santa.a-un-choix .option-santa:not(.choisi) {
  opacity: 0.72;
}
.option-santa.choisi::after {
  content: 'Mon choix !';
  position: absolute;
  right: -8px;
  top: -14px;
  padding: 1px 10px 4px;
  border: 2px solid var(--encre);
  border-radius: 8px;
  background: var(--vert);
  color: #fff;
  font-family: var(--titre);
  font-weight: 700;
  font-size: 1.05rem;
  transform: rotate(7deg);
  animation: tampon-texte 0.35s cubic-bezier(0.2, 1.7, 0.4, 1) both;
}
@keyframes tampon-texte {
  from {
    transform: scale(0) rotate(-20deg);
  }
}
.option-santa .papiers,
.option-santa .cadeau-haut {
  transform-box: fill-box;
  transform-origin: 50% 100%;
}
.option-santa.choisi .papiers {
  animation: papiers 0.5s ease-in-out infinite alternate;
}
.option-santa.choisi .cadeau-haut {
  animation: saute 0.45s ease-in-out infinite alternate;
}
@keyframes papiers {
  from {
    transform: translateY(4px) rotate(-5deg);
  }
  to {
    transform: translateY(-6px) rotate(5deg);
  }
}
@keyframes saute {
  to {
    transform: translate(36px, -8px) scale(0.7) rotate(-6deg);
  }
}

/* Étape 5 : le petit mot et le récapitulatif. */
.papier-lettre {
  min-height: 108px;
  line-height: 30px;
  background: repeating-linear-gradient(#fff 0 29px, #cfe2f3 29px 30px);
  background-attachment: local;
  font-weight: 700;
}
.recap {
  margin: 0;
  padding: 8px 14px;
  border: 2px dashed var(--or-fonce);
  border-radius: 14px;
  background: var(--creme);
}
.recap div {
  display: flex;
  gap: 10px;
  padding: 5px 0;
}
.recap div + div {
  border-top: 1px solid rgba(224, 161, 26, 0.35);
}
.recap dt {
  flex: none;
  width: 6.4em;
  font-weight: 900;
  font-size: 0.95rem;
  color: var(--rouge-fonce);
}
.recap dd {
  margin: 0;
  min-width: 0;
  font-weight: 700;
  overflow-wrap: anywhere;
}

/* ---------- Merci ---------- */

.merci {
  text-align: center;
}
.merci .recap {
  margin-top: 4px;
  text-align: left;
}
.danse img {
  width: 118px;
  animation: danse 0.5s ease-in-out infinite alternate;
}
@keyframes danse {
  from {
    transform: rotate(-12deg);
  }
  to {
    transform: rotate(12deg) translateY(-12px);
  }
}
/* ---------- Compteur de bonhommes attrapés ---------- */

/* Posé dans le tapis de neige, pour ne jamais recouvrir le bouton « Retour » de la carte. */
.compteur {
  position: fixed;
  left: 6px;
  bottom: 2px;
  z-index: 9;
  display: flex;
  align-items: center;
  gap: 3px;
  padding: 0 10px 1px 3px;
  border: 2px solid #fff;
  border-radius: 999px;
  background: var(--vert-fonce);
  color: #fff;
  font-family: var(--titre);
  font-weight: 700;
  font-size: 1.1rem;
  line-height: 1;
  pointer-events: none;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.4);
}
.compteur img {
  height: 24px;
}
@media (min-width: 700px) {
  .compteur {
    bottom: 4px;
    padding: 1px 13px 3px 4px;
    font-size: 1.35rem;
  }
  .compteur img {
    height: 32px;
  }
}
.compteur.pop {
  animation: pop 0.35s cubic-bezier(0.2, 1.7, 0.4, 1);
}
@keyframes pop {
  40% {
    transform: scale(1.3) rotate(-6deg);
  }
}

/* Clavier ouvert : on range le décor du bas. */
body.saisie .sol,
body.saisie .compteur,
body.saisie .chute.avant {
  display: none;
}
