/* Jeux de Noël : page à part, en rouge et sapin, avec des flocons. */
.page-noel {
  --noel-rouge: #c8102e;
  --noel-rouge-ombre: #8e0b20;
  --noel-sapin: #0f6b3a;
  --noel-sapin-ombre: #0a4a28;
}

.page-noel h1,
.page-noel h2,
.page-noel h3 {
  font-weight: 900;
  line-height: 1.12;
}

/* Les flocons, au bord des aplats rouges, loin du texte */
.noel-haut,
.noel-section--rouge {
  background-color: var(--noel-rouge);
  background-image: url("/img/noel/flocon.svg"), url("/img/noel/flocon.svg"), url("/img/noel/flocon.svg"), url("/img/noel/flocon.svg"), url("/img/noel/flocon.svg");
  background-repeat: no-repeat;
  background-position: right 7.5rem top 1rem, right 11rem top 0.4rem, right 14rem top 1.1rem, left 1rem bottom 4.75rem, right 2rem bottom 4.75rem;
  background-size: 30px, 22px, 18px, 30px, 44px;
  color: #fff;
}

.noel-haut {
  position: relative;
  background-image: none;
}

.noel-haut-grille {
  position: relative;
  z-index: 1;
}

/* La guirlande : les ampoules brillent chacune à leur rythme */
.noel-guirlande {
  position: absolute;
  top: 0;
  left: 0;
  width: 2600px;
  max-width: none;
  height: 62px;
}

.noel-fil {
  fill: none;
  stroke: var(--noel-sapin-ombre);
  stroke-width: 3;
}

.noel-guirlande rect {
  fill: var(--noel-sapin-ombre);
}

.noel-guirlande .a1 ellipse { fill: #ffc83d; }
.noel-guirlande .a2 ellipse { fill: #7ee081; animation-delay: 0.5s; }
.noel-guirlande .a3 ellipse { fill: #fff; animation-delay: 0.9s; }
.noel-guirlande .a4 ellipse { fill: #7fd0ff; animation-delay: 1.3s; }

.noel-guirlande ellipse {
  animation: noel-brille 1.8s ease-in-out infinite alternate;
}

@keyframes noel-brille {
  from { opacity: 1; }
  to { opacity: 0.45; }
}

/* La neige qui tombe en haut de page */
.noel-chute {
  position: absolute;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
}

.noel-chute i {
  position: absolute;
  top: -40px;
  left: var(--x);
  width: var(--s);
  height: var(--s);
  background: url("/img/noel/flocon.svg") center / contain no-repeat;
  animation: noel-tombe var(--t) linear var(--d) infinite;
}

@keyframes noel-tombe {
  to { transform: translateY(1250px) rotate(240deg); }
}

/* Les collines enneigées entre les blocs */
.page-noel {
  --colline: clamp(36px, 5vw, 72px);
}

.noel-section {
  position: relative;
}

.noel-colline {
  position: absolute;
  bottom: calc(100% - 1px);
  left: 0;
  width: 100%;
  height: var(--colline);
}

.noel-colline-neige { fill: #fff; }
.noel-colline--blanc .noel-colline-fond { fill: #fff; }
.noel-colline--rouge .noel-colline-fond { fill: var(--noel-rouge); }
.noel-colline--sapin .noel-colline-fond { fill: var(--noel-sapin); }
.noel-colline--nuit .noel-colline-fond { fill: var(--bleu); }

/* Sapin et cadeaux posés sur la neige, à cheval sur la photo */
.noel-galet-zone {
  position: relative;
  justify-self: center;
  width: min(100%, 32rem);
}

.noel-deco {
  position: absolute;
  z-index: 2;
}

.noel-deco--sapin {
  bottom: -6%;
  left: -7%;
  width: 24%;
}

.noel-deco--cadeau {
  right: -3%;
  bottom: -7%;
  width: 18%;
}

.noel-deco--cadeau-vert {
  right: 14%;
  bottom: -8%;
  width: 13%;
}

.noel-titre {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.noel-titre-deco {
  flex: none;
  width: clamp(3.25rem, 2.5rem + 4vw, 6rem);
}

/* La neige sur les cartes rouges */
.noel-section--blanc .noel-carte {
  position: relative;
  overflow: hidden;
  padding-top: 2.1rem;
}

.noel-section--blanc .noel-carte::before {
  content: "";
  position: absolute;
  top: -1px;
  right: 0;
  left: 0;
  height: 20px;
  background: url("/img/noel/neige-carte.svg") left top / 120px 20px repeat-x;
}

/* Les étoiles sur le sapin et sur le ciel de la fin */
.noel-section--sapin,
.noel-suite {
  background-image: url("/img/noel/etoile.svg"), url("/img/noel/etoile.svg"), url("/img/noel/etoile.svg"), url("/img/noel/etoile.svg"), url("/img/noel/etoile.svg"), url("/img/noel/etoile.svg");
  background-repeat: no-repeat;
  background-position: 3% 8%, 22% 3%, 62% 5%, 90% 12%, 96% 62%, 2% 74%;
  background-size: 20px, 13px, 16px, 22px, 14px, 16px;
}

@media (prefers-reduced-motion: reduce) {
  .noel-guirlande ellipse {
    animation: none;
  }
}

.noel-haut h1,
.noel-section--rouge h2,
.noel-section--sapin h2,
.noel-suite h2 {
  color: #fff;
}

.noel-haut {
  overflow: hidden;
  padding-top: calc(clamp(2.5rem, 1.5rem + 4vw, 4.5rem) + 2.5rem);
  padding-bottom: calc(var(--colline) + 1.75rem);
}

.noel-haut-grille {
  display: grid;
  gap: 2rem;
  align-items: center;
}

.noel-haut h1 {
  margin: 0;
  font-size: clamp(3rem, 2rem + 5vw, 5.25rem);
  letter-spacing: -0.02em;
}

.noel-chapo {
  max-width: 34rem;
  margin: 1rem 0 0;
  font-size: clamp(1.2rem, 1.1rem + 0.5vw, 1.45rem);
  font-weight: 700;
  line-height: 1.35;
}

.noel-gratuit {
  margin: 0.75rem 0 0;
  color: #fff;
  font-weight: 800;
}

.noel-raccourcis {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  margin: 1.5rem 0 0;
  padding: 0;
  list-style: none;
}

.noel-raccourcis a {
  display: inline-flex;
  padding: 0.65rem 1rem;
  border-radius: 999px;
  background: #fff;
  box-shadow: 0 4px 0 var(--noel-rouge-ombre);
  color: var(--noel-rouge);
  font-weight: 800;
  text-decoration: none;
}

.noel-raccourcis a:active {
  transform: translateY(3px);
  box-shadow: 0 1px 0 var(--noel-rouge-ombre);
}

.noel-galet {
  width: 100%;
}

@media (min-width: 56rem) {
  .noel-haut-grille {
    grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr);
  }
}

/* --- Les quatre moments ------------------------------------------------------------------------------------------ */
.noel-section {
  padding-top: clamp(2.75rem, 2rem + 3vw, 4.5rem);
  padding-bottom: calc(clamp(2.75rem, 2rem + 3vw, 4.5rem) + var(--colline));
}

.noel-suite {
  padding-bottom: clamp(2.75rem, 2rem + 3vw, 4.5rem);
}

.noel-section h2 {
  margin: 0;
  font-size: clamp(1.9rem, 1.4rem + 2vw, 2.9rem);
}

.noel-intro {
  margin: 0.5rem 0 1.5rem;
  font-size: 1.15rem;
  font-weight: 700;
}

.noel-section--blanc h2 {
  color: var(--noel-rouge);
}

.noel-section--sapin {
  background: var(--noel-sapin);
  color: #fff;
}

.noel-cartes {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 19rem), 1fr));
  gap: 1rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.noel-carte {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  padding: 1.35rem;
  border-radius: var(--arrondi);
  background: #fff;
  box-shadow: 0 5px 0 rgb(0 0 0 / 0.2);
  color: var(--encre);
}

.noel-carte h3 {
  margin: 0;
  color: var(--noel-rouge);
  font-size: 1.45rem;
}

.noel-section--sapin .noel-carte h3 {
  color: var(--noel-sapin);
}

.noel-carte p {
  margin: 0;
}

.noel-carte .noel-revise {
  margin-top: auto;
  font-size: 0.95rem;
  font-weight: 700;
}

.noel-materiel {
  align-self: flex-start;
  padding: 0.15rem 0.7rem;
  border-radius: 999px;
  background: var(--soleil);
  color: var(--encre);
  font-size: 0.875rem;
  font-weight: 800;
}

.noel-section--blanc .noel-carte {
  background: var(--noel-rouge);
  box-shadow: 0 5px 0 var(--noel-rouge-ombre);
  color: #fff;
}

.noel-section--blanc .noel-carte h3 {
  color: #fff;
}

/* --- Les jeux sur écran ------------------------------------------------------------------------------------------ */
.noel-classes {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
  margin: 0 0 1.5rem;
  padding: 0;
  border: 0;
}

.noel-classes legend {
  float: left;
  margin-right: 0.5rem;
  font-weight: 800;
}

.noel-classes label {
  position: relative;
  cursor: pointer;
}

.noel-classes input {
  position: absolute;
  opacity: 0;
}

.noel-classes span {
  display: block;
  min-width: 3.4rem;
  padding: 0.55rem 0.85rem;
  border-radius: 0.9rem;
  background: var(--noel-rouge-ombre);
  color: #fff;
  font-weight: 800;
  text-align: center;
}

.noel-classes input:checked + span {
  background: #fff;
  box-shadow: 0 4px 0 var(--noel-rouge-ombre);
  color: var(--noel-rouge);
}

.noel-classes input:focus-visible + span {
  outline: 3px solid var(--soleil);
  outline-offset: 2px;
}

.noel-jeux {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 20rem), 1fr));
  gap: 1.25rem;
  align-items: start;
}

.noel-jeu {
  position: relative;
  overflow: hidden;
  padding: 1.25rem;
  border-radius: var(--arrondi);
  background: #fff;
  box-shadow: 0 5px 0 var(--noel-rouge-ombre);
  color: var(--encre);
}

.noel-jeu h3 {
  margin: 0;
  color: var(--noel-rouge);
  font-size: 1.45rem;
}

.noel-consigne {
  min-height: 3.2em;
  margin: 0.4rem 0 0.75rem;
  font-size: 1rem;
  line-height: 1.35;
}

.noel-statut {
  min-height: 1.6em;
  margin: 0.6rem 0 0.4rem;
  color: var(--noel-rouge);
  font-weight: 800;
}

.noel-recommencer {
  min-height: 2.75rem;
  padding: 0.5rem 0.9rem;
  border: 0;
  border-radius: 0.8rem;
  background: var(--noel-sapin);
  box-shadow: 0 3px 0 var(--noel-sapin-ombre);
  color: #fff;
  font: inherit;
  font-size: 0.95rem;
  font-weight: 800;
  cursor: pointer;
}

.noel-recommencer:active {
  transform: translateY(2px);
  box-shadow: 0 1px 0 var(--noel-sapin-ombre);
}

/* Coloriage */
.noel-palette {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 0.4rem;
  margin-bottom: 0.75rem;
}

.noel-couleur {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 0.4rem 0.1rem;
  border: 3px solid transparent;
  border-radius: 0.8rem;
  color: #fff;
  font: inherit;
  font-weight: 900;
  line-height: 1.1;
  cursor: pointer;
}

.noel-couleur span {
  font-size: 1.2rem;
}

.noel-couleur small {
  font-size: 0.875rem;
}

.noel-couleur--rouge { background: #d6182f; }
.noel-couleur--vert { background: #15803d; }
.noel-couleur--jaune { background: #ffc83d; color: var(--encre); }
.noel-couleur--bleu { background: #5ab2f0; color: var(--encre); }
.noel-couleur--marron { background: #96623a; }

.noel-couleur[aria-pressed="true"] {
  border-color: var(--encre);
  transform: translateY(-2px);
}

.noel-dessin svg {
  width: 100%;
  height: auto;
  border-radius: 1rem;
}

.noel-forme {
  stroke: var(--encre);
  stroke-width: 2.5;
  stroke-linejoin: round;
}

.noel-zone {
  cursor: pointer;
  transform-box: fill-box;
  transform-origin: center;
}

.noel-zone text {
  fill: var(--encre);
  stroke: #fff;
  stroke-width: 4px;
  paint-order: stroke;
  font-family: var(--police);
  font-size: 18px;
  font-weight: 800;
  text-anchor: middle;
}

.noel-zone:focus-visible {
  outline: none;
}

.noel-zone:focus-visible .noel-forme {
  stroke: var(--bleu);
  stroke-width: 5;
}

.noel-zone.noel-non {
  animation: noel-non 0.28s ease;
}

@keyframes noel-non {
  25% { transform: translateX(-5px); }
  75% { transform: translateX(5px); }
}

.noel-decor circle {
  fill: #fff;
  pointer-events: none;
}

.noel-neige-sol {
  fill: #eef3fb;
  pointer-events: none;
}

/* Points à relier */
.noel-point {
  cursor: pointer;
}

.noel-point-zone {
  fill: transparent;
}

.noel-point:not(.noel-point--suivant) .noel-point-zone {
  pointer-events: none;
}

.noel-point-rond {
  fill: var(--encre);
}

.noel-point text {
  fill: var(--encre);
  stroke: #fff;
  stroke-width: 4px;
  paint-order: stroke;
  font-family: var(--police);
  font-size: 17px;
  font-weight: 800;
  text-anchor: middle;
}

.noel-point--fait .noel-point-rond {
  fill: var(--noel-sapin);
}

.noel-point--suivant .noel-point-rond {
  fill: var(--noel-rouge);
}

.noel-point:focus-visible {
  outline: none;
}

.noel-point:focus-visible .noel-point-zone {
  fill: rgb(24 0 173 / 0.2);
}

.noel-trace {
  fill: none;
  stroke: var(--noel-sapin);
  stroke-width: 5;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* Sudoku */
.noel-sudoku {
  display: grid;
  gap: 3px;
  max-width: 22rem;
  margin-inline: auto;
}

.noel-case {
  aspect-ratio: 1;
  padding: 0;
  border: 0;
  border-radius: 0.5rem;
  background: #f3e3e6;
  color: var(--noel-sapin);
  font: inherit;
  font-size: 1.4rem;
  font-weight: 900;
  cursor: pointer;
}

.noel-case--donnee {
  background: var(--noel-rouge);
  color: #fff;
  cursor: default;
}

.noel-case--choisie {
  outline: 3px solid var(--bleu);
  outline-offset: -3px;
}

.noel-case--revoir {
  background: #fff;
  box-shadow: inset 0 0 0 3px var(--noel-rouge);
  color: var(--noel-rouge-ombre);
}

.noel-clavier {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.4rem;
  margin-top: 0.75rem;
}

.noel-touche {
  min-width: 2.75rem;
  min-height: 2.75rem;
  padding: 0 0.4rem;
  border: 0;
  border-radius: 0.7rem;
  background: var(--soleil);
  box-shadow: 0 3px 0 var(--soleil-ombre);
  color: var(--encre);
  font: inherit;
  font-weight: 900;
  cursor: pointer;
}

.noel-touche:active {
  transform: translateY(2px);
  box-shadow: 0 1px 0 var(--soleil-ombre);
}

.noel-touche--effacer {
  background: #eee;
  box-shadow: 0 3px 0 #c7c7c7;
  font-size: 0.875rem;
}

/* Mémo */
.noel-memo {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.4rem;
}

.noel-memo-carte {
  aspect-ratio: 1;
  padding: 0.15rem;
  border: 0;
  border-radius: 0.7rem;
  background: var(--noel-rouge) url("/img/noel/flocon.svg") center / 55% no-repeat;
  box-shadow: 0 3px 0 var(--noel-rouge-ombre);
  color: var(--encre);
  font: inherit;
  font-size: 1rem;
  font-weight: 800;
  line-height: 1.1;
  cursor: pointer;
}

.noel-memo-carte--ouverte {
  background: var(--soleil);
  box-shadow: 0 3px 0 var(--soleil-ombre);
}

.noel-memo-carte--trouvee {
  background: #15803d;
  box-shadow: none;
  color: #fff;
  cursor: default;
}

/* Mots mêlés */
.noel-mots-liste {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
  margin: 0 0 0.6rem;
  padding: 0;
  list-style: none;
}

.noel-mots-liste li {
  padding: 0.1rem 0.5rem;
  border-radius: 999px;
  background: var(--soleil);
  font-size: 0.875rem;
  font-weight: 800;
}

.noel-mots-liste .noel-mot-trouve {
  background: #15803d;
  color: #fff;
  text-decoration: line-through;
}

.noel-mots {
  display: grid;
  gap: 2px;
}

.noel-lettre {
  aspect-ratio: 1;
  padding: 0;
  border: 0;
  border-radius: 0.3rem;
  background: #f3e3e6;
  color: var(--encre);
  font: inherit;
  font-size: clamp(1rem, 4.4vw, 1.25rem);
  font-weight: 800;
  line-height: 1;
  cursor: pointer;
}

.noel-lettre--choisie {
  background: var(--bleu);
  color: #fff;
}

.noel-lettre--trouvee {
  background: #15803d;
  color: #fff;
}

/* Labyrinthe */
.noel-laby svg {
  width: 100%;
  height: auto;
}

.noel-laby-mur {
  fill: none;
  stroke: var(--noel-rouge);
  stroke-width: 4;
  stroke-linecap: round;
}

.noel-laby-trace {
  fill: none;
  stroke: var(--soleil);
  stroke-width: 7;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.noel-fleches {
  display: grid;
  grid-template-columns: repeat(3, 3.2rem);
  justify-content: center;
  gap: 0.3rem;
  margin-top: 0.6rem;
}

.noel-fleches .noel-touche {
  font-family: system-ui, sans-serif;
  font-size: 1.4rem;
}

.noel-fleches [data-sens="haut"] { grid-column: 2; }
.noel-fleches [data-sens="gauche"] { grid-column: 1; grid-row: 2; }
.noel-fleches [data-sens="bas"] { grid-column: 2; grid-row: 2; }
.noel-fleches [data-sens="droite"] { grid-column: 3; grid-row: 2; }

/* Lettres en vrac */
.noel-reponse,
.noel-vrac {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.25rem;
  margin-bottom: 0.6rem;
}

.noel-tuile {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 2.75rem;
  height: 2.75rem;
  padding: 0 0.2rem;
  border: 0;
  border-radius: 0.6rem;
  background: var(--soleil);
  box-shadow: 0 3px 0 var(--soleil-ombre);
  color: var(--encre);
  font: inherit;
  font-size: 1.2rem;
  font-weight: 900;
  cursor: pointer;
}

.noel-tuile:disabled {
  background: #eee;
  box-shadow: none;
  color: #bbb;
  cursor: default;
}

.noel-tuile--vide {
  background: #f3e3e6;
  box-shadow: none;
  cursor: default;
}

.noel-effacer {
  margin-right: 1.25rem;
  background: var(--noel-rouge);
  box-shadow: 0 3px 0 var(--noel-rouge-ombre);
}

/* Une réponse dès que le doigt se pose, sans le délai du double toucher */
.noel-jeu button,
.noel-zone,
.noel-point {
  touch-action: manipulation;
}

.noel-couleur:active,
.noel-memo-carte:active:not(:disabled),
.noel-lettre:active,
.noel-case:active:not(:disabled),
.noel-tuile:active:not(:disabled) {
  transform: translateY(2px);
}

.noel-jeu button:focus-visible {
  outline: 3px solid var(--bleu);
  outline-offset: 2px;
}

/* La neige qui tombe quand un jeu est fini */
.noel-neige {
  position: absolute;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
}

.noel-neige i {
  position: absolute;
  top: -40px;
  left: var(--x);
  width: var(--s);
  height: var(--s);
  background: url("/img/noel/flocon-rouge.svg") center / contain no-repeat;
  animation: noel-chute var(--t) linear var(--d) both;
}

@keyframes noel-chute {
  to { transform: translateY(760px) rotate(200deg); }
}

@media (prefers-reduced-motion: reduce) {
  .noel-zone.noel-non {
    animation: none;
  }
}

/* --- Et après les vacances --------------------------------------------------------------------------------------- */
.noel-suite {
  background: var(--bleu);
  color: #fff;
  text-align: center;
}

.noel-suite h2 {
  margin-inline: auto;
}

.noel-suite p {
  max-width: 38rem;
  margin: 0.75rem auto 1.5rem;
  font-size: 1.15rem;
}
