/* avent.css — Calendrier de l’Avent (mutualisé WebContent ↔ web-preview).
   Bandeau du choix des jeux, grille des 24 cases, case jouée dans la page
   Défi du jour. Velours bordeaux et dorure : l’éclat vient de l’or sur un fond
   profond, jamais d’aplats vifs. Même registre que les cartes « Nuit ». */
:root {
  --av-or: #e8c266;
  --av-or-clair: #f7e3a1;
  --av-encre: #2b1a05;
  --av-dorure: linear-gradient(115deg, #b98a35 0%, #f7e3a1 28%, #d9ae57 52%, #fff2c7 72%, #b98a35 100%);
  --av-velours: linear-gradient(155deg, #5a0d26 0%, #33071a 55%, #1d0410 100%);
}

/* ── Bandeau ─────────────────────────────────────────────────────────── */
.av-banner {
  position: relative; display: flex; flex-direction: column; align-items: flex-start;
  width: 100%; box-sizing: border-box; min-height: 168px; margin: 0 0 14px; padding: 18px 20px;
  border: 0; border-radius: 18px; text-align: left; cursor: pointer; font-family: inherit; color: #fbf0da;
  background: radial-gradient(90% 85% at 88% 0%, rgba(232, 194, 102, .24), transparent 65%), var(--av-velours);
  box-shadow: 0 0 0 1px rgba(232, 194, 102, .85), 0 0 26px rgba(232, 194, 102, .2), 0 14px 28px rgba(0, 0, 0, .55);
  transition: transform .15s ease;
}
.av-banner:active { transform: scale(.98); }
.av-banner-frame {
  position: absolute; inset: 6px; border-radius: 13px; pointer-events: none;
  border: 1px solid rgba(232, 194, 102, .38);
}
/* Le bonnet dépasse du dessin : la mascotte descend d'autant, pour rester dans le cadre. */
.av-banner-mascot { position: absolute; right: 14px; top: 16px; width: 88px; height: 88px; pointer-events: none; }
.av-banner-mascot svg, .av-mascot svg, .av-entry-mascot svg { display: block; width: 100%; height: 100%; }
.av-banner-badge { position: relative; font-size: .64rem; font-weight: 600; letter-spacing: .2em; text-transform: uppercase; color: var(--av-or); }
.av-banner-title {
  position: relative; margin-top: 6px; padding-bottom: 2px; max-width: 62%;
  font-family: 'Playfair Display', Georgia, serif; font-weight: 700; font-size: 1.5rem; line-height: 1.14;
  background: var(--av-dorure); -webkit-background-clip: text; background-clip: text; color: transparent;
}
.av-banner-bottom { position: relative; margin-top: auto; padding-top: 10px; width: 100%; display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; }
.av-banner-progress { display: flex; flex-direction: column; gap: 7px; font-size: .75rem; font-weight: 500; color: #efe2c8; }
.av-dots { display: grid; grid-template-columns: repeat(12, 6px); gap: 5px; }
.av-dots i { display: block; width: 6px; height: 6px; border-radius: 50%; background: rgba(232, 194, 102, .22); }
.av-dots i.on { background: var(--av-or); }
.av-dots i.soir { background: #fff6d8; box-shadow: 0 0 6px rgba(255, 246, 216, .9); }
.av-banner-cta {
  flex: 0 0 auto; display: inline-flex; align-items: center; min-height: 44px; padding: 0 18px; border-radius: 22px;
  background: var(--av-dorure); color: var(--av-encre); font-size: .86rem; font-weight: 700; text-align: center;
  box-shadow: 0 4px 14px rgba(0, 0, 0, .4);
}

/* Paysage : le bandeau à gauche, les jeux à droite, le titre au-dessus. */
@media (orientation: landscape) {
  #stepGames > .section:has(> .av-banner) {
    display: grid !important; grid-template-columns: minmax(250px, 30%) minmax(0, 1fr);
    column-gap: clamp(14px, 2vw, 24px); align-items: stretch;
  }
  #stepGames > .section:has(> .av-banner) > * { grid-column: 1 / -1; }
  #stepGames > .section:has(> .av-banner) > .av-banner { grid-column: 1; margin: 0; align-self: start; }
  #stepGames > .section:has(> .av-banner) > .game-type-row { grid-column: 2; display: grid !important; grid-template-columns: repeat(3, minmax(0, 1fr)) !important; }
  .av-banner-bottom { flex-direction: column; align-items: stretch; }
  .av-banner-cta { justify-content: center; }
}

/* ── Grille ──────────────────────────────────────────────────────────── */
.av-page {
  position: fixed; inset: 0; z-index: 900; box-sizing: border-box; overflow-y: auto; -webkit-overflow-scrolling: touch;
  display: flex; flex-direction: column;
  padding: max(env(safe-area-inset-top, 0px) + 74px, 116px) max(16px, env(safe-area-inset-right, 0px)) max(16px, env(safe-area-inset-bottom, 0px)) max(16px, env(safe-area-inset-left, 0px));
  background: radial-gradient(110% 42% at 50% 0%, rgba(122, 20, 54, .6), transparent 72%), radial-gradient(90% 30% at 50% 100%, rgba(232, 194, 102, .09), transparent 75%), #10030b;
  color: #fbf0da;
}
.av-page[hidden] { display: none; }
body.avent-grille #homeBtn { z-index: 901; }
.av-head { position: relative; flex: 0 0 auto; display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; }
.av-title {
  margin: 0; padding-bottom: 2px; font-family: 'Playfair Display', Georgia, serif; font-weight: 700; font-size: 1.7rem; line-height: 1.14;
  background: var(--av-dorure); -webkit-background-clip: text; background-clip: text; color: transparent;
}
.av-sub { margin: 4px 0 0; font-size: .84rem; color: #d9cbb5; }
.av-mascot { flex: 0 0 auto; width: 76px; height: 76px; margin-top: -64px; }
.av-grid {
  flex: 1 0 auto; margin-top: 14px; display: grid; gap: 7px;
  grid-template-columns: repeat(4, minmax(0, 1fr)); grid-auto-rows: minmax(68px, 1fr);
}
/* Base : case relevée, éteinte. */
.av-door {
  position: relative; box-sizing: border-box; padding: 0; border-radius: 11px; cursor: pointer; font-family: inherit;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  border: 1px solid rgba(232, 194, 102, .26); background: rgba(232, 194, 102, .05); color: #cdb27a;
  transition: transform .15s ease;
}
.av-door:active:not(:disabled) { transform: scale(.94); }
.av-door b { font-family: 'Playfair Display', Georgia, serif; font-weight: 700; font-size: 1.28rem; line-height: 1.15; }
.av-door small { font-size: .64rem; font-weight: 600; line-height: 1.1; }
.av-door svg { color: var(--av-or); }
.av-fermee { cursor: default; border-color: rgba(232, 194, 102, .62); background: var(--av-velours); color: var(--av-or-clair); opacity: 1; }
.av-fermee::before { content: ''; position: absolute; inset: 3px; border-radius: 8px; border: 1px solid rgba(232, 194, 102, .2); pointer-events: none; }
.av-fermee b { background: var(--av-dorure); -webkit-background-clip: text; background-clip: text; color: transparent; }
.av-soir { border: 0; background: var(--av-dorure); color: var(--av-encre); box-shadow: 0 0 0 1px #fff2c7, 0 0 24px rgba(232, 194, 102, .55); }
.av-soir b { font-size: 1.7rem; }
.av-soir small { text-transform: uppercase; letter-spacing: .08em; font-weight: 700; }
.av-rattraper { border: 1px dashed var(--av-or); background: rgba(232, 194, 102, .1); color: var(--av-or-clair); }
.av-opening { position: relative; z-index: 2; animation: avOuvre .95s cubic-bezier(.45, 0, .2, 1) both; transform-origin: left center; }
/* La porte s'éclaire, puis pivote sur sa charnière. Durée : DUREE_OUVERTURE (avent.js). */
@keyframes avOuvre {
  0%   { transform: none; }
  30%  { transform: scale(1.06); box-shadow: 0 0 0 1px #fff2c7, 0 0 34px rgba(232, 194, 102, .9); }
  100% { transform: perspective(500px) rotateY(-100deg); box-shadow: 0 0 40px rgba(232, 194, 102, .6); opacity: .15; }
}
.av-foot { flex: 0 0 auto; margin-top: 12px; display: flex; flex-direction: column; align-items: center; gap: 10px; }
.av-sum { margin: 0; text-align: center; font-size: .8rem; color: #d9cbb5; }
.av-cta {
  width: 100%; max-width: 420px; min-height: 52px; border: 0; border-radius: 26px; cursor: pointer; font-family: inherit;
  background: var(--av-dorure); color: var(--av-encre); font-size: 1rem; font-weight: 700;
  box-shadow: 0 6px 20px rgba(0, 0, 0, .5);
}
.av-cta[hidden] { display: none; }

@media (orientation: landscape) {
  .av-page {
    display: grid; grid-template-columns: minmax(230px, 30%) minmax(0, 1fr); grid-template-rows: auto 1fr; column-gap: 20px;
    padding-top: max(env(safe-area-inset-top, 0px) + 14px, 20px);
    padding-left: max(88px, env(safe-area-inset-left, 0px) + 74px);
  }
  .av-head { grid-column: 1; grid-row: 1; flex-direction: column; }
  .av-mascot { display: none; }
  .av-foot { grid-column: 1; grid-row: 2; justify-content: flex-end; align-items: stretch; margin: 0; }
  .av-sum { text-align: left; }
  .av-grid { grid-column: 2; grid-row: 1 / span 2; margin: 0; grid-template-columns: repeat(6, minmax(0, 1fr)); grid-auto-rows: minmax(60px, 1fr); }
}

/* ── Entrée depuis la page Défi du jour ──────────────────────────────── */
.av-entry {
  width: 100%; box-sizing: border-box; display: flex; align-items: center; gap: 10px; margin-bottom: 10px; padding: 8px 14px;
  border: 0; border-radius: 14px; cursor: pointer; text-align: left; font-family: inherit; color: var(--av-or);
  background: var(--av-velours); box-shadow: 0 0 0 1px rgba(232, 194, 102, .75);
}
.av-entry-mascot { flex: 0 0 auto; width: 44px; height: 44px; }
.av-entry-txt { flex: 1 1 auto; display: flex; flex-direction: column; font-size: .8rem; color: #efe2c8; }
.av-entry-txt b { font-family: 'Playfair Display', Georgia, serif; font-size: 1rem; color: var(--av-or-clair); }

/* ── La case, jouée dans la page Défi du jour ────────────────────────── */
body.avent-case .d-col-b, body.avent-case #laterBtn { display: none !important; }
body.avent-case .d-grid { display: block !important; }
body.avent-case .d-col-a { max-width: 640px; margin: 0 auto; }
body.avent-case .d-card.cd-face { --c: #e8c266 !important; }
body.avent-case #doneBtn { background: var(--av-dorure) !important; color: var(--av-encre) !important; }
/* Le titre, le retour et la série suivent l’or du calendrier. */
body.avent-case, body.avent-grille { --pink: #e8c266; --pink-soft: #f7e3a1; --pink-hot: #b98a35; }
/* ── Final : les 24 cases relevées (avent.js, finale) ─────────────────── */
.av-finale {
  position: fixed; inset: 0; z-index: 9700; overflow: hidden; display: flex; align-items: center; justify-content: center;
  padding: max(env(safe-area-inset-top, 0px) + 24px, 32px) 24px max(env(safe-area-inset-bottom, 0px) + 24px, 32px);
  background: radial-gradient(70% 45% at 50% 38%, rgba(232, 194, 102, .22), transparent 70%), radial-gradient(120% 70% at 50% 0%, rgba(122, 20, 54, .75), transparent 75%), #0c0208;
  color: #fbf0da; animation: avFondu .6s ease both;
}
.av-finale.av-sortie { animation: avFonduSortie .42s ease both; }
@keyframes avFondu { from { opacity: 0; } }
@keyframes avFonduSortie { to { opacity: 0; transform: scale(1.03); } }
.av-finale-in { position: relative; z-index: 1; width: 100%; max-width: 380px; display: flex; flex-direction: column; align-items: center; text-align: center; }
/* La scène : tout se joue au même centre. */
.av-scene { position: relative; width: 200px; height: 190px; display: grid; place-items: center; }
.av-scene > .av-mini, .av-scene > .av-medal { grid-area: 1 / 1; }
/* Rayons, ondes et étincelles débordent de la scène : posés en absolu sur son centre,
   sans quoi ils élargissent la grille et décentrent le médaillon. */
.av-scene > .av-rayons, .av-scene > .av-onde, .av-scene > .av-eclats { position: absolute; left: 50%; top: 50%; }
.av-scene > .av-rayons { margin: -230px 0 0 -230px; }
.av-scene > .av-onde { margin: -75px 0 0 -75px; }
/* Les 24 cases s'allument une à une, puis sont aspirées vers le centre. */
.av-mini { display: grid; grid-template-columns: repeat(6, 22px); gap: 6px; }
.av-mini i {
  width: 22px; height: 22px; border-radius: 5px; border: 1px solid rgba(232, 194, 102, .35); background: rgba(232, 194, 102, .06);
  animation: avAllume .35s ease var(--d) both, avAspire .45s cubic-bezier(.6, 0, .9, .4) var(--a) both;
}
@keyframes avAllume { to { background: var(--av-dorure); border-color: #fff2c7; box-shadow: 0 0 10px rgba(232, 194, 102, .7); } }
@keyframes avAspire {
  from { background: var(--av-dorure); border-color: #fff2c7; box-shadow: 0 0 10px rgba(232, 194, 102, .7); }
  to { transform: translate(var(--dx), var(--dy)) scale(.15) rotate(90deg); opacity: 0; background: var(--av-dorure); }
}
/* Rayons qui tournent lentement derrière le médaillon. */
.av-rayons {
  width: 460px; height: 460px; border-radius: 50%; opacity: 0;
  background: repeating-conic-gradient(from 0deg, rgba(247, 227, 161, .22) 0deg 5deg, transparent 5deg 20deg);
  -webkit-mask: radial-gradient(circle, #000 18%, transparent 68%); mask: radial-gradient(circle, #000 18%, transparent 68%);
  animation: avRayonsIn .9s ease 1.6s both, avTourne 22s linear 1.6s infinite;
}
@keyframes avRayonsIn { to { opacity: 1; } }
@keyframes avTourne { to { transform: rotate(360deg); } }
/* Onde de choc à l'arrivée du médaillon. */
.av-onde { width: 150px; height: 150px; border-radius: 50%; border: 2px solid #f7e3a1; opacity: 0; animation: avOnde 1.1s cubic-bezier(.1, .6, .3, 1) 1.75s both; }
.av-onde-2 { animation-delay: 1.95s; border-width: 1px; }
@keyframes avOnde { from { opacity: .9; transform: scale(.6); } to { opacity: 0; transform: scale(2.8); } }
/* Gerbe d'étincelles d'or. */
.av-eclats { width: 0; height: 0; }
.av-eclats i {
  position: absolute; left: -3px; top: -3px; width: 6px; height: 6px; border-radius: 50%; opacity: 0;
  background: radial-gradient(circle, #fff 0%, #f7e3a1 45%, transparent 72%); box-shadow: 0 0 8px rgba(247, 227, 161, .9);
  animation: avEclat 1.3s cubic-bezier(.1, .7, .3, 1) 1.75s both;
}
@keyframes avEclat {
  from { opacity: 1; transform: rotate(var(--ang)) translateX(0) scale(1.4); }
  to { opacity: 0; transform: rotate(var(--ang)) translateX(var(--dist)) scale(.3); }
}
/* Le médaillon d'or arrive en pièce qui tourne, avec son reflet. */
.av-medal {
  position: relative; width: 148px; height: 148px; border-radius: 50%; overflow: hidden; display: grid; place-items: center;
  background: var(--av-dorure); box-shadow: 0 0 0 2px #fff2c7, 0 0 0 9px rgba(232, 194, 102, .18), 0 0 60px rgba(232, 194, 102, .65);
  animation: avMedaille 1.1s cubic-bezier(.2, 1.25, .4, 1) 1.55s both, avPulse 3s ease-in-out 3.2s infinite;
}
.av-medal::before { content: ''; position: absolute; inset: 9px; border-radius: 50%; border: 1px solid rgba(43, 26, 5, .35); }
.av-medal::after {
  content: ''; position: absolute; inset: -20%; background: linear-gradient(105deg, transparent 40%, rgba(255, 255, 255, .75) 50%, transparent 60%);
  transform: translateX(-120%); animation: avReflet 1.4s ease 2.5s both, avReflet 1.4s ease 6s infinite;
}
.av-medal span { position: relative; font-family: 'Playfair Display', Georgia, serif; font-weight: 700; font-size: 4rem; color: var(--av-encre); }
@keyframes avMedaille { from { opacity: 0; transform: perspective(600px) rotateY(720deg) scale(.3); } }
@keyframes avPulse { 50% { box-shadow: 0 0 0 2px #fff2c7, 0 0 0 12px rgba(232, 194, 102, .25), 0 0 90px rgba(232, 194, 102, .85); } }
@keyframes avReflet { from { transform: translateX(-120%); } to { transform: translateX(120%); } }
.av-finale-mascot { width: 70px; height: 70px; margin-top: -26px; position: relative; animation: avSaut .7s cubic-bezier(.2, 1.6, .4, 1) 2.2s both; }
@keyframes avSaut { from { opacity: 0; transform: translateY(24px) scale(.6); } }
.av-finale-mascot svg { display: block; width: 100%; height: 100%; }
.av-finale-title {
  margin: 14px 0 0; padding-bottom: 3px; font-family: 'Playfair Display', Georgia, serif; font-weight: 700; font-size: 2rem; line-height: 1.12;
  background: var(--av-dorure); background-size: 220% 100%; -webkit-background-clip: text; background-clip: text; color: transparent;
  animation: avMonte .7s ease 2.3s both, avScintille 4s linear 3s infinite;
}
@keyframes avScintille { from { background-position: 0% 0; } to { background-position: 220% 0; } }
.av-finale-sub { margin: 10px 0 0; font-size: 1rem; line-height: 1.45; color: #e9dcc2; animation: avMonte .7s ease 2.6s both; }
.av-finale-next { margin: 22px 0 0; font-size: .92rem; line-height: 1.45; color: var(--av-or-clair); animation: avMonte .7s ease 2.9s both; }
.av-finale-cta { margin-top: 16px; animation: avMonte .6s ease 3.1s both; }
.av-finale-retour {
  margin-top: 6px; min-height: 44px; padding: 0 16px; border: 0; background: transparent; cursor: pointer;
  font: 500 .9rem inherit; font-family: inherit; color: #d9cbb5; text-decoration: underline; text-underline-offset: 3px;
  animation: avMonte .6s ease 3.3s both;
}
@keyframes avMonte { from { opacity: 0; transform: translateY(14px); } }
/* Pluie de paillettes d'or. */
.av-fx { position: absolute; inset: 0; pointer-events: none; }
.av-fx i {
  position: absolute; top: -12px; left: var(--x); width: var(--s); height: var(--s); border-radius: 50%;
  background: radial-gradient(circle, #fff6d8 0%, #e8c266 55%, transparent 72%);
  animation: avPaillette var(--t) linear var(--r) infinite; opacity: 0;
}
@keyframes avPaillette { 8% { opacity: 1; } 100% { transform: translate(18px, 110vh) rotate(160deg); opacity: .2; } }
.av-calme, .av-calme * { animation: none !important; }
.av-calme .av-mini { display: none; }
body.avent-finale .ds-mascot, body.avent-finale .cards-mascot { display: none !important; }

/* La mascotte flottante recouvrirait une case. */
body.avent-grille .ds-mascot, body.avent-grille .cards-mascot { display: none !important; }
