/* =========================================================================
   calendar.css — interface publique « Le calendrier de l'Avent de Line ».

   Direction artistique : nuit féerique (bleu nuit #100d24, violet électrique,
   rose néon), verre dépoli, décor 100 % CSS (aucune image, aucun CDN).
   Grille : 3 colonnes (mobile) → 4 (tablette) → 6 × 4 (desktop).
   Les animations ne touchent que `transform` / `opacity` (voir animations.css).
   ========================================================================= */

/* ---- Page & ambiance cosmique ------------------------------------------ */
.page--calendar {
  position: relative;
  overflow-x: hidden;
  background-color: var(--night-900);
  isolation: isolate;
}

.page--calendar .page__main {
  position: relative;
  z-index: 1;
  max-width: 1060px;
  padding-inline: clamp(0.75rem, 3vw, 2rem);
}

.page--calendar .page__footer {
  position: relative;
  z-index: 1;
}

/* =========================================================================
   DÉCOR — couches fixes, purement décoratives (aria-hidden côté HTML)
   ========================================================================= */
.decor {
  position: fixed;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  pointer-events: none;
  contain: strict;
}

/* Nébuleuse : 3 dégradés radiaux violet / rose / lavande. */
.decor::before {
  content: '';
  position: absolute;
  inset: -12%;
  background-image:
    radial-gradient(58% 44% at 18% 10%, rgba(101, 84, 184, 0.42), transparent 70%),
    radial-gradient(48% 38% at 84% 16%, rgba(230, 138, 191, 0.2), transparent 72%),
    radial-gradient(52% 44% at 62% 86%, rgba(76, 60, 146, 0.34), transparent 74%),
    radial-gradient(40% 34% at 6% 74%, rgba(133, 136, 216, 0.2), transparent 72%);
}

/* Champ d'étoiles généré sans image : deux tuiles de points répétées. */
.decor__stars,
.decor__stars::after {
  content: '';
  position: absolute;
  inset: 0;
  background-repeat: repeat;
}

.decor__stars {
  background-image:
    radial-gradient(1.6px 1.6px at 12% 18%, rgba(255, 255, 255, 0.95), transparent 70%),
    radial-gradient(1.2px 1.2px at 78% 12%, rgba(255, 227, 244, 0.9), transparent 70%),
    radial-gradient(1px 1px at 44% 62%, rgba(214, 220, 255, 0.85), transparent 70%),
    radial-gradient(1.4px 1.4px at 88% 54%, rgba(255, 255, 255, 0.7), transparent 70%),
    radial-gradient(1px 1px at 26% 84%, rgba(255, 227, 244, 0.8), transparent 70%),
    radial-gradient(1.2px 1.2px at 62% 34%, rgba(255, 255, 255, 0.65), transparent 70%);
  background-size:
    260px 260px,
    340px 340px,
    300px 300px,
    380px 380px,
    320px 320px,
    420px 420px;
  animation: star-twinkle 7s var(--ease-soft) infinite alternate;
}

.decor__stars::after {
  background-image:
    radial-gradient(1px 1px at 20% 40%, rgba(255, 255, 255, 0.6), transparent 70%),
    radial-gradient(1.5px 1.5px at 70% 78%, rgba(255, 227, 244, 0.55), transparent 70%),
    radial-gradient(0.9px 0.9px at 46% 8%, rgba(214, 220, 255, 0.6), transparent 70%);
  background-size:
    210px 210px,
    290px 290px,
    360px 360px;
  animation: star-twinkle 9s var(--ease-soft) infinite alternate-reverse;
  animation-delay: -3s;
}

/* Bokeh : halos flous très discrets (dérive lente de transform). */
.decor__bokeh {
  position: absolute;
  inset: -8%;
  background-image:
    radial-gradient(circle at 16% 68%, rgba(230, 138, 191, 0.12) 0 54px, transparent 56px),
    radial-gradient(circle at 84% 40%, rgba(133, 136, 216, 0.12) 0 70px, transparent 72px),
    radial-gradient(circle at 58% 12%, rgba(244, 182, 216, 0.08) 0 44px, transparent 46px);
  animation: trail-slide 26s var(--ease-soft) infinite;
}

/* --- Cadeaux « 3D » en CSS pur ------------------------------------------ */
.decor__gift {
  position: absolute;
  width: clamp(56px, 6vw, 82px);
  aspect-ratio: 1.2 / 1;
  border-radius: 6px;
  background: linear-gradient(150deg, #8a6bd6, #4c3c92 52%, #2c2359 100%);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.38),
    inset -10px -12px 20px rgba(0, 0, 0, 0.38),
    0 20px 34px rgba(4, 2, 14, 0.55);
  animation: gift-float 11s var(--ease-soft) infinite;
  will-change: transform;
}

/* Ruban vertical. */
.decor__gift::before {
  content: '';
  position: absolute;
  top: 0;
  bottom: 0;
  left: calc(50% - 6px);
  width: 12px;
  background: linear-gradient(90deg, #f4b6d8, #e68abf 45%, #c4479a);
  box-shadow: 0 0 12px rgba(230, 138, 191, 0.55);
}

/* Ruban horizontal. */
.decor__gift::after {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  top: calc(50% - 6px);
  height: 12px;
  background: linear-gradient(180deg, #f4b6d8, #e68abf 45%, #c4479a);
}

/* Couvercle + reflet. */
.decor__gift-lid {
  position: absolute;
  left: -5%;
  right: -5%;
  top: -18%;
  height: 24%;
  border-radius: 5px;
  background: linear-gradient(160deg, #a68ce8, #6c58c0 60%, #4c3c92);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.45),
    0 10px 18px rgba(4, 2, 14, 0.45);
}

.decor__gift-lid::before {
  content: '';
  position: absolute;
  top: 0;
  bottom: 0;
  left: calc(50% - 6px);
  width: 12px;
  background: linear-gradient(90deg, #ffe3f2, #e68abf 50%, #c4479a);
}

/* Nœud papillon (deux boucles + cœur lumineux). */
.decor__gift-bow {
  position: absolute;
  left: 50%;
  top: -40%;
  width: 58%;
  height: 30%;
  transform: translateX(-50%);
  background: radial-gradient(circle at 50% 62%, #ffe3f2 0 3px, transparent 4px);
}

.decor__gift-bow::before,
.decor__gift-bow::after {
  content: '';
  position: absolute;
  top: 0;
  width: 46%;
  height: 100%;
  border: 3px solid #f4b6d8;
  border-radius: 60% 60% 40% 40%;
  background: rgba(230, 138, 191, 0.22);
  box-shadow: inset 0 0 10px rgba(255, 227, 244, 0.35);
}

.decor__gift-bow::before {
  left: 0;
  transform: rotate(-14deg);
}

.decor__gift-bow::after {
  right: 0;
  transform: rotate(14deg);
}

.decor__gift--a {
  top: 9vh;
  left: 3.5vw;
}

.decor__gift--b {
  top: 17vh;
  right: 4vw;
  animation-delay: -3.5s;
  animation-duration: 13s;
}

.decor__gift--c {
  bottom: 10vh;
  left: 6vw;
  animation-delay: -6s;
  animation-duration: 14s;
  opacity: 0.9;
}

/* --- Cristaux / polyèdres translucides ---------------------------------- */
.decor__crystal {
  position: absolute;
  width: clamp(46px, 5vw, 72px);
  aspect-ratio: 0.68 / 1;
  clip-path: polygon(50% 0%, 100% 34%, 78% 100%, 22% 100%, 0% 34%);
  background-image:
    linear-gradient(118deg, transparent 42%, rgba(255, 255, 255, 0.38) 50%, transparent 60%),
    linear-gradient(160deg, rgba(133, 136, 216, 0.72), rgba(101, 84, 184, 0.4) 48%, rgba(230, 138, 191, 0.32));
  animation: crystal-drift 12s var(--ease-soft) infinite;
  filter: drop-shadow(0 12px 22px rgba(101, 84, 184, 0.4));
  will-change: transform;
}

.decor__crystal::before {
  content: '';
  position: absolute;
  inset: 0;
  clip-path: polygon(50% 0%, 100% 34%, 50% 52%, 0% 34%);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.42), rgba(255, 255, 255, 0.05));
}

.decor__crystal::after {
  content: '';
  position: absolute;
  left: 46%;
  top: 6%;
  width: 6%;
  height: 74%;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.75), transparent);
  transform: rotate(9deg);
}

.decor__crystal--a {
  top: 27vh;
  right: 3.5vw;
}

.decor__crystal--b {
  bottom: 20vh;
  right: 7vw;
  animation-delay: -5s;
  animation-duration: 14s;
}

.decor__crystal--c {
  bottom: 30vh;
  left: 2.5vw;
  width: clamp(34px, 3.6vw, 54px);
  animation-delay: -2.5s;
  opacity: 0.85;
}

/* --- Étoiles décoratives à quatre branches ------------------------------ */
.decor__star {
  position: absolute;
  width: 18px;
  height: 18px;
  clip-path: polygon(
    50% 0%,
    61% 39%,
    100% 50%,
    61% 61%,
    50% 100%,
    39% 61%,
    0% 50%,
    39% 39%
  );
  background: linear-gradient(150deg, #ffffff, #f4b6d8 55%, #8588d8);
  animation: sparkle-pulse 5s var(--ease-soft) infinite;
}

.decor__star--a {
  top: 13vh;
  left: 30vw;
  animation-delay: -1s;
}

.decor__star--b {
  top: 22vh;
  right: 22vw;
  width: 12px;
  height: 12px;
  animation-delay: -2.4s;
}

.decor__star--c {
  bottom: 17vh;
  left: 28vw;
  width: 14px;
  height: 14px;
  animation-delay: -3.6s;
}

.decor__star--d {
  bottom: 9vh;
  right: 30vw;
  width: 10px;
  height: 10px;
  animation-delay: -0.6s;
}

.decor__star--e {
  top: 46vh;
  left: 7vw;
  width: 9px;
  height: 9px;
  animation-delay: -4.2s;
}

/* --- Traînées lumineuses discrètes -------------------------------------- */
.decor__trail {
  position: absolute;
  width: clamp(90px, 12vw, 180px);
  height: 1.5px;
  border-radius: 999px;
  background: linear-gradient(90deg, transparent, rgba(230, 138, 191, 0.75), transparent);
  animation: trail-slide 10s var(--ease-soft) infinite;
}

.decor__trail--a {
  top: 34vh;
  right: 16vw;
  transform: rotate(-24deg);
}

.decor__trail--b {
  bottom: 26vh;
  left: 14vw;
  transform: rotate(18deg);
  animation-delay: -4s;
  opacity: 0.8;
}

/* --- Particules lumineuses (14, plafond ≤ 40) --------------------------- */
.decor__particles {
  position: absolute;
  inset: 0;
}

.decor__particles span {
  position: absolute;
  width: 3px;
  height: 3px;
  border-radius: 50%;
  background: #f4b6d8;
  box-shadow: 0 0 8px rgba(244, 182, 216, 0.9);
  opacity: 0;
  animation: particle-drift 9s linear infinite;
}

.decor__particles span:nth-child(1) {
  left: 8%;
  bottom: 22%;
  animation-delay: 0s;
}

.decor__particles span:nth-child(2) {
  left: 17%;
  bottom: 12%;
  animation-delay: -1.4s;
  animation-duration: 11s;
}

.decor__particles span:nth-child(3) {
  left: 26%;
  bottom: 8%;
  animation-delay: -2.2s;
  animation-duration: 8s;
}

.decor__particles span:nth-child(4) {
  left: 36%;
  bottom: 18%;
  animation-delay: -3.4s;
  animation-duration: 10s;
}

.decor__particles span:nth-child(5) {
  left: 45%;
  bottom: 6%;
  animation-delay: -0.8s;
  animation-duration: 12s;
}

.decor__particles span:nth-child(6) {
  left: 55%;
  bottom: 14%;
  animation-delay: -4.6s;
  animation-duration: 9s;
}

.decor__particles span:nth-child(7) {
  left: 64%;
  bottom: 9%;
  animation-delay: -2.8s;
  animation-duration: 10.5s;
}

.decor__particles span:nth-child(8) {
  left: 73%;
  bottom: 20%;
  animation-delay: -5.2s;
  animation-duration: 8.5s;
}

.decor__particles span:nth-child(9) {
  left: 82%;
  bottom: 11%;
  animation-delay: -1.9s;
  animation-duration: 11.5s;
}

.decor__particles span:nth-child(10) {
  left: 91%;
  bottom: 24%;
  animation-delay: -3.9s;
  animation-duration: 9.5s;
}

.decor__particles span:nth-child(11) {
  left: 30%;
  bottom: 30%;
  animation-delay: -6.1s;
  animation-duration: 12.5s;
}

.decor__particles span:nth-child(12) {
  left: 68%;
  bottom: 32%;
  animation-delay: -0.4s;
  animation-duration: 10s;
}

.decor__particles span:nth-child(13) {
  left: 12%;
  bottom: 36%;
  animation-delay: -7.2s;
  animation-duration: 13s;
}

.decor__particles span:nth-child(14) {
  left: 87%;
  bottom: 38%;
  animation-delay: -2.6s;
  animation-duration: 11s;
}

/* =========================================================================
   EN-TÊTE
   ========================================================================= */
.hero {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 820px;
  margin: 0 auto;
  padding: clamp(2rem, 7vh, 4.25rem) 1.1rem 0.25rem;
  text-align: center;
}

.hero__title {
  font-size: var(--step-3);
  letter-spacing: -0.02em;
  background-image: linear-gradient(
    100deg,
    #ffffff 0%,
    var(--pink-soft) 32%,
    var(--lavender) 68%,
    var(--pink) 100%
  );
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  -webkit-text-fill-color: transparent;
  filter: drop-shadow(0 6px 26px rgba(230, 138, 191, 0.35));
}

.hero__title::after {
  content: '';
  display: block;
  width: clamp(88px, 16vw, 150px);
  height: 2px;
  margin: 0.9rem auto 0;
  border-radius: 999px;
  background: linear-gradient(90deg, transparent, var(--pink), var(--lavender), transparent);
  box-shadow: 0 0 16px rgba(230, 138, 191, 0.65);
}

.hero__subtitle {
  margin-top: 0.85rem;
  color: var(--text-soft);
  font-size: var(--step-0);
  letter-spacing: 0.01em;
}

@supports not ((background-clip: text) or (-webkit-background-clip: text)) {
  .hero__title {
    color: var(--pink-soft);
    -webkit-text-fill-color: currentColor;
  }
}

/* =========================================================================
   COMPTE À REBOURS — chiffres en verre dépoli
   ========================================================================= */
.countdown {
  position: relative;
  z-index: 1;
  max-width: 720px;
  margin: clamp(1.6rem, 4vh, 2.6rem) auto 0.5rem;
  padding: clamp(1.1rem, 3vw, 1.6rem) clamp(0.9rem, 3vw, 1.4rem);
  border-radius: var(--radius-xl);
  border: 1px solid var(--border);
  background: linear-gradient(
    155deg,
    rgba(230, 138, 191, 0.12),
    rgba(255, 255, 255, 0.03) 40%,
    rgba(101, 84, 184, 0.1)
  );
  -webkit-backdrop-filter: blur(14px) saturate(125%);
  backdrop-filter: blur(14px) saturate(125%);
  box-shadow: var(--shadow-md), var(--halo-soft), inset 0 1px 0 rgba(255, 255, 255, 0.16);
  text-align: center;
}

.countdown__message {
  font-family: var(--font-serif);
  font-weight: 700;
  font-size: var(--step-1);
  color: var(--text);
  margin-bottom: 1rem;
}

.countdown__grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: clamp(0.4rem, 1.6vw, 0.7rem);
}

.countdown__unit {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.2rem;
  padding: 0.6rem 0.3rem 0.5rem;
  border-radius: var(--radius-md);
  background: linear-gradient(165deg, rgba(255, 255, 255, 0.1), rgba(255, 255, 255, 0.02));
  border: 1px solid rgba(255, 255, 255, 0.16);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.22);
}

.countdown__value {
  font-size: clamp(1.5rem, 1.1rem + 2.4vw, 2.5rem);
  font-weight: 700;
  font-variant-numeric: tabular-nums lining-nums;
  color: #ffe8f5;
  text-shadow: 0 0 20px rgba(230, 138, 191, 0.55);
  line-height: 1.1;
}

.countdown__label {
  font-size: var(--step--2);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--text-soft);
}

.countdown__hint {
  margin-top: 0.9rem;
  font-size: var(--step--1);
  color: var(--text-soft);
}

/* =========================================================================
   GRILLE DES 24 CASES
   ========================================================================= */
.calendar {
  position: relative;
  z-index: 1;
  margin-top: clamp(1.5rem, 4vh, 2.4rem);
}

.calendar__head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.35rem 1rem;
  margin-bottom: 1rem;
  padding-inline: 0.15rem;
}

.calendar__title {
  font-size: var(--step-2);
  color: var(--text);
}

.calendar__status {
  font-size: var(--step--1);
  color: var(--text-soft);
}

.grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: clamp(0.45rem, 1.5vw, 0.9rem);
}

.cell {
  min-width: 0;
}

/* --- Bouton d'une case : verre dépoli + bordure en dégradé --------------- */
.cell__button {
  position: relative;
  isolation: isolate;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.2rem;
  width: 100%;
  aspect-ratio: 1 / 1;
  min-height: 44px;
  padding: 0.4rem;
  border-radius: var(--radius-md);
  border: 1px solid transparent;
  background:
    linear-gradient(
        160deg,
        rgba(255, 255, 255, 0.12),
        rgba(255, 255, 255, 0.02) 55%,
        rgba(101, 84, 184, 0.18)
      )
      padding-box;
  color: var(--text);
  cursor: pointer;
  box-shadow:
    0 10px 24px rgba(5, 3, 16, 0.5),
    inset 0 1px 0 rgba(255, 255, 255, 0.16);
  -webkit-backdrop-filter: blur(9px) saturate(130%);
  backdrop-filter: blur(9px) saturate(130%);
  transition:
    transform var(--dur-base) var(--ease-out),
    box-shadow var(--dur-base) var(--ease-out),
    border-color var(--dur-base) var(--ease-out);
}

/* Bordure en dégradé violet/rose (pseudo-élément masqué, 100 % CSS). */
.cell__button::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  padding: 1px;
  background: linear-gradient(
    145deg,
    rgba(230, 138, 191, 0.85),
    rgba(133, 136, 216, 0.5) 45%,
    rgba(101, 84, 184, 0.85)
  );
  -webkit-mask:
    linear-gradient(#000 0 0) content-box,
    linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask:
    linear-gradient(#000 0 0) content-box,
    linear-gradient(#000 0 0);
  mask-composite: exclude;
  pointer-events: none;
  z-index: 2;
}

/* Halo dynamique (opacity animée uniquement). */
.cell__button::after {
  content: '';
  position: absolute;
  inset: -16%;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(230, 138, 191, 0.45), rgba(230, 138, 191, 0) 68%);
  opacity: 0;
  transition: opacity var(--dur-base) var(--ease-out);
  pointer-events: none;
  z-index: -1;
}

.cell__button:hover::after,
.cell__button:focus-visible::after {
  opacity: 1;
}

.cell__button:hover {
  transform: translateY(-3px) scale(1.03);
}

.cell__button:active {
  transform: translateY(0) scale(0.99);
}

.cell__button:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 3px;
}

.cell__number {
  font-family: var(--font-serif);
  font-size: clamp(1.2rem, 1rem + 1.8vw, 2.2rem);
  font-weight: 700;
  font-variant-numeric: lining-nums tabular-nums;
  line-height: 1;
  color: #fbf7ff;
  text-shadow: 0 1px 8px rgba(10, 6, 24, 0.6);
}

.cell__badge {
  font-family: var(--font-sans);
  font-size: clamp(0.7rem, 1.6vw, 0.95rem);
  line-height: 1;
  opacity: 0.9;
}

.cell__hint {
  font-family: var(--font-sans);
  font-size: clamp(0.42rem, 1.05vw, 0.62rem);
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  white-space: nowrap;
  line-height: 1.2;
  padding: 0.12em 0.55em;
  border-radius: 999px;
  background: linear-gradient(120deg, #ffe3f2, var(--pink-soft));
  color: #4a1036;
  box-shadow: 0 0 14px rgba(230, 138, 191, 0.7);
}

/* --- État `locked` : atténué, cadenas discret ---------------------------- */
.cell__button--locked {
  cursor: not-allowed;
  background: linear-gradient(160deg, rgba(255, 255, 255, 0.05), rgba(255, 255, 255, 0.012)) padding-box;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06);
  color: #cdc4e2;
}

.cell__button--locked::before {
  background: linear-gradient(145deg, rgba(133, 136, 216, 0.3), rgba(101, 84, 184, 0.25));
}

.cell__button--locked::after {
  display: none;
}

.cell__button--locked:hover {
  transform: none;
}

.cell__button--locked .cell__number {
  color: #cdc4e2;
  text-shadow: none;
}

.cell__button--locked .cell__badge {
  opacity: 0.42;
  font-size: clamp(0.62rem, 1.4vw, 0.8rem);
}

/* --- État `openable` : jour courant, halo rose + pulsation lente -------- */
.cell__button--openable {
  background:
    linear-gradient(
        160deg,
        rgba(255, 214, 238, 0.24),
        rgba(230, 138, 191, 0.14) 45%,
        rgba(101, 84, 184, 0.22)
      )
      padding-box;
  box-shadow:
    0 0 0 2px rgba(255, 226, 244, 0.6),
    0 0 26px rgba(230, 138, 191, 0.55),
    0 0 58px rgba(101, 84, 184, 0.38),
    inset 0 1px 0 rgba(255, 255, 255, 0.35);
}

.cell__button--openable::before {
  background: linear-gradient(145deg, #ffe3f2, var(--pink) 48%, var(--lavender));
}

.cell__button--openable::after {
  opacity: 0.9;
  background: radial-gradient(
    circle,
    rgba(255, 226, 244, 0.65),
    rgba(230, 138, 191, 0.3) 45%,
    rgba(230, 138, 191, 0) 70%
  );
  animation: today-ring 2.8s var(--ease-soft) infinite;
}

.cell__button--openable .cell__number {
  color: #ffffff;
  text-shadow: 0 0 18px rgba(230, 138, 191, 0.9);
}

.cell__button--openable .cell__badge {
  color: #fff3fa;
}

/* --- État `opened` : violet lumineux + coche ---------------------------- */
.cell__button--opened {
  background:
    linear-gradient(
        160deg,
        rgba(133, 136, 216, 0.26),
        rgba(101, 84, 184, 0.14) 55%,
        rgba(255, 255, 255, 0.05)
      )
      padding-box;
  box-shadow:
    0 8px 22px rgba(5, 3, 16, 0.45),
    inset 0 1px 0 rgba(255, 255, 255, 0.22);
}

.cell__button--opened::before {
  background: linear-gradient(145deg, rgba(133, 136, 216, 0.95), rgba(230, 138, 191, 0.6));
}

.cell__button--opened .cell__number {
  color: #f1ecff;
}

.cell__button--opened .cell__badge {
  color: #ffe1f2;
  text-shadow: 0 0 14px rgba(230, 138, 191, 0.85);
}

/* Petit reflet « volet entrouvert » en haut à gauche. */
.cell__button--opened .cell__number::before {
  content: '';
  position: absolute;
  top: 8%;
  left: 8%;
  width: 34%;
  height: 34%;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 255, 255, 0.28), transparent 70%);
  pointer-events: none;
}

/* --- État `missed` : grisé, non ouverte -------------------------------- */
.cell__button--missed {
  background: rgba(255, 255, 255, 0.035) padding-box;
  box-shadow: none;
  color: #b6aecf;
}

.cell__button--missed::before {
  background: linear-gradient(145deg, rgba(160, 160, 190, 0.3), rgba(120, 120, 155, 0.22));
}

.cell__button--missed .cell__number {
  color: #b6aecf;
  text-shadow: none;
}

.cell__button--missed .cell__badge {
  opacity: 0.55;
}

/* --- État `empty` : « surprise en préparation » ------------------------ */
.cell__button--empty {
  background:
    repeating-linear-gradient(
        135deg,
        rgba(255, 255, 255, 0.075) 0 7px,
        rgba(255, 255, 255, 0.02) 7px 14px
      )
      padding-box;
  box-shadow: inset 0 0 24px rgba(230, 138, 191, 0.12);
}

.cell__button--empty::before {
  background: linear-gradient(145deg, rgba(244, 182, 216, 0.6), rgba(133, 136, 216, 0.5));
}

.cell__button--empty .cell__number {
  color: #e6dcf7;
}

.cell__button--empty .cell__badge {
  opacity: 1;
  filter: none;
}

/* --- Secousse (refus serveur) et éclat d'ouverture (hooks JS) ---------- */
.cell__button--shake {
  animation: cell-shake 300ms var(--ease-soft);
}

.cell__button--fresh {
  animation: cell-open 620ms var(--ease-out);
}

/* --- Apparition en cascade (24 cases, ≤ ~560 ms) ----------------------- */
.grid--enter .cell {
  animation: cell-reveal var(--dur-slow) var(--ease-out) both;
}

.grid--enter .cell:nth-child(1) {
  animation-delay: 0ms;
}

.grid--enter .cell:nth-child(2) {
  animation-delay: 24ms;
}

.grid--enter .cell:nth-child(3) {
  animation-delay: 48ms;
}

.grid--enter .cell:nth-child(4) {
  animation-delay: 72ms;
}

.grid--enter .cell:nth-child(5) {
  animation-delay: 96ms;
}

.grid--enter .cell:nth-child(6) {
  animation-delay: 120ms;
}

.grid--enter .cell:nth-child(7) {
  animation-delay: 144ms;
}

.grid--enter .cell:nth-child(8) {
  animation-delay: 168ms;
}

.grid--enter .cell:nth-child(9) {
  animation-delay: 192ms;
}

.grid--enter .cell:nth-child(10) {
  animation-delay: 216ms;
}

.grid--enter .cell:nth-child(11) {
  animation-delay: 240ms;
}

.grid--enter .cell:nth-child(12) {
  animation-delay: 264ms;
}

.grid--enter .cell:nth-child(13) {
  animation-delay: 288ms;
}

.grid--enter .cell:nth-child(14) {
  animation-delay: 312ms;
}

.grid--enter .cell:nth-child(15) {
  animation-delay: 336ms;
}

.grid--enter .cell:nth-child(16) {
  animation-delay: 360ms;
}

.grid--enter .cell:nth-child(17) {
  animation-delay: 384ms;
}

.grid--enter .cell:nth-child(18) {
  animation-delay: 408ms;
}

.grid--enter .cell:nth-child(19) {
  animation-delay: 432ms;
}

.grid--enter .cell:nth-child(20) {
  animation-delay: 456ms;
}

.grid--enter .cell:nth-child(21) {
  animation-delay: 480ms;
}

.grid--enter .cell:nth-child(22) {
  animation-delay: 504ms;
}

.grid--enter .cell:nth-child(23) {
  animation-delay: 528ms;
}

.grid--enter .cell:nth-child(24) {
  animation-delay: 552ms;
}

/* =========================================================================
   LÉGENDE
   ========================================================================= */
.calendar__legend {
  margin-top: 1.15rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem 1.1rem;
  font-size: var(--step--1);
  color: var(--text-soft);
}

.legend-item {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}

.legend-item::before {
  content: '';
  width: 0.75rem;
  height: 0.75rem;
  border-radius: 4px;
  border: 1px solid var(--border-strong);
  background: rgba(255, 255, 255, 0.1);
}

.legend-item--openable::before {
  border-color: #ffe3f2;
  background: linear-gradient(150deg, #ffe3f2, var(--pink));
  box-shadow: 0 0 10px rgba(230, 138, 191, 0.7);
}

.legend-item--opened::before {
  border-color: var(--lavender);
  background: linear-gradient(150deg, var(--lavender), var(--violet));
}

.legend-item--missed::before {
  border-style: dotted;
  background: rgba(255, 255, 255, 0.08);
}

.legend-item--empty::before {
  background: repeating-linear-gradient(
    135deg,
    rgba(255, 255, 255, 0.3) 0 3px,
    rgba(255, 255, 255, 0.08) 3px 6px
  );
}

/* =========================================================================
   ÉCRANS SECONDAIRES (chargement, erreur, code d'accès)
   ========================================================================= */
.page--calendar .panel {
  position: relative;
  z-index: 1;
  border-radius: var(--radius-xl);
  border: 1px solid var(--border);
  background: linear-gradient(
    155deg,
    rgba(255, 255, 255, 0.1),
    rgba(255, 255, 255, 0.02) 55%,
    rgba(101, 84, 184, 0.14)
  );
  -webkit-backdrop-filter: blur(14px) saturate(125%);
  backdrop-filter: blur(14px) saturate(125%);
  box-shadow: var(--shadow-md), inset 0 1px 0 rgba(255, 255, 255, 0.14);
}

.page--calendar .panel--error {
  border-color: var(--danger);
  background: linear-gradient(155deg, rgba(255, 159, 176, 0.18), rgba(255, 159, 176, 0.06));
}

.page--calendar .panel--access {
  max-width: 460px;
  margin: clamp(1.5rem, 6vh, 3rem) auto 0;
  border-color: var(--border-strong);
}

.panel--access .panel__title {
  color: var(--pink-soft);
}

.card__hint {
  margin-top: 0.85rem;
  font-size: var(--step--1);
  color: var(--text-soft);
}

.loader {
  position: relative;
  z-index: 1;
}

.skeleton {
  background: rgba(255, 255, 255, 0.07);
}

/* =========================================================================
   REPLI SANS JAVASCRIPT (<noscript>) : grille statique lisible
   ========================================================================= */
.grid--fallback {
  margin-top: 1rem;
}

.grid--fallback li {
  display: flex;
  align-items: center;
  justify-content: center;
  aspect-ratio: 1 / 1;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.06);
  color: var(--text);
  font-family: var(--font-serif);
  font-size: clamp(1.05rem, 1rem + 1.4vw, 1.8rem);
  font-weight: 700;
}

/* =========================================================================
   MODALE D'UNE CASE
   ========================================================================= */
.modal {
  width: 100%;
  max-width: 100vw;
  max-height: 100dvh;
  height: 100dvh;
  margin: 0;
  border: 0;
  padding: 0;
  background: transparent;
}

.modal::backdrop {
  background:
    radial-gradient(circle at 50% 28%, rgba(101, 84, 184, 0.34), rgba(6, 4, 16, 0.9) 62%);
  -webkit-backdrop-filter: blur(3px);
  backdrop-filter: blur(3px);
}

.modal__inner {
  position: relative;
  display: flex;
  flex-direction: column;
  height: 100%;
  overflow-y: auto;
  background: linear-gradient(180deg, #191438 0%, #100d24 55%, #0b0819 100%);
  animation: modal-in var(--dur-slow) var(--ease-out);
}

/* Flash de récompense (classe `is-revealing` posée par modal.js). */
.modal__inner.is-revealing::before {
  content: '';
  position: absolute;
  inset: 0;
  z-index: 2;
  pointer-events: none;
  background: radial-gradient(
    circle at 50% 36%,
    rgba(255, 226, 244, 0.8),
    rgba(230, 138, 191, 0.28) 38%,
    rgba(230, 138, 191, 0) 70%
  );
  animation: reward-flash 1.2s var(--ease-out) forwards;
}

.modal__close {
  position: absolute;
  top: max(0.7rem, env(safe-area-inset-top));
  right: 0.7rem;
  z-index: 6;
  background: rgba(12, 8, 28, 0.62);
  color: #ffffff;
  border-color: rgba(255, 255, 255, 0.18);
}

.modal__close:hover {
  background: rgba(12, 8, 28, 0.9);
  border-color: var(--pink);
}

.modal__figure {
  display: flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  padding: 0.5rem;
  background: radial-gradient(circle at 50% 40%, #1c1740, #0a0718);
}

.modal__img {
  max-width: 100%;
  max-height: 62dvh;
  width: auto;
  height: auto;
  object-fit: contain;
  border-radius: var(--radius-sm);
  animation: image-zoom 520ms var(--ease-out);
}

.modal__body {
  padding: 1.35rem 1.2rem 2rem;
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}

.modal__eyebrow {
  font-size: var(--step--2);
  text-transform: uppercase;
  letter-spacing: 0.16em;
  color: var(--pink-soft);
  font-weight: 800;
}

.modal__title {
  font-size: var(--step-2);
  color: var(--text);
}

.modal__text {
  color: var(--text-soft);
  white-space: pre-line;
}

.modal__placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.8rem;
  padding: 2.5rem 1rem;
  text-align: center;
}

.modal__placeholder-icon {
  font-size: clamp(2.6rem, 8vw, 3.6rem);
  line-height: 1;
  filter: drop-shadow(0 0 22px rgba(230, 138, 191, 0.55));
}

.modal__actions {
  margin-top: 0.85rem;
}

/* --- Explosion de confettis (24 pièces, ~1,2 s) ------------------------- */
.confetti-layer {
  position: absolute;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
  z-index: 4;
}

.confetti {
  position: absolute;
  left: 50%;
  top: 42%;
  width: 9px;
  height: 14px;
  border-radius: 2px;
  opacity: 0;
  background: var(--pink);
  box-shadow: 0 0 8px rgba(255, 255, 255, 0.35);
  animation: confetti-burst 1.2s var(--ease-out) forwards;
}

.confetti:nth-child(4n + 1) {
  background: var(--pink);
}

.confetti:nth-child(4n + 2) {
  background: var(--lavender);
}

.confetti:nth-child(4n + 3) {
  background: var(--gold-pink);
}

.confetti:nth-child(4n + 4) {
  background: var(--magenta);
}

.confetti:nth-child(1) {
  --tx: -140px;
  --ty: -120px;
  --rot: 480deg;
}

.confetti:nth-child(2) {
  --tx: -90px;
  --ty: -180px;
  --rot: 620deg;
  width: 7px;
  height: 11px;
}

.confetti:nth-child(3) {
  --tx: -30px;
  --ty: -210px;
  --rot: 540deg;
  animation-delay: 0.04s;
}

.confetti:nth-child(4) {
  --tx: 40px;
  --ty: -200px;
  --rot: 700deg;
  width: 6px;
  height: 12px;
}

.confetti:nth-child(5) {
  --tx: 100px;
  --ty: -160px;
  --rot: 520deg;
  animation-delay: 0.06s;
}

.confetti:nth-child(6) {
  --tx: 160px;
  --ty: -90px;
  --rot: 640deg;
}

.confetti:nth-child(7) {
  --tx: 190px;
  --ty: -10px;
  --rot: 560deg;
  width: 11px;
  height: 9px;
}

.confetti:nth-child(8) {
  --tx: 170px;
  --ty: 80px;
  --rot: 720deg;
  animation-delay: 0.08s;
}

.confetti:nth-child(9) {
  --tx: 120px;
  --ty: 160px;
  --rot: 500deg;
}

.confetti:nth-child(10) {
  --tx: 50px;
  --ty: 210px;
  --rot: 660deg;
  width: 7px;
  height: 10px;
}

.confetti:nth-child(11) {
  --tx: -20px;
  --ty: 230px;
  --rot: 580deg;
  animation-delay: 0.1s;
}

.confetti:nth-child(12) {
  --tx: -90px;
  --ty: 200px;
  --rot: 700deg;
}

.confetti:nth-child(13) {
  --tx: -150px;
  --ty: 150px;
  --rot: 520deg;
  width: 10px;
  height: 8px;
}

.confetti:nth-child(14) {
  --tx: -190px;
  --ty: 70px;
  --rot: 640deg;
  animation-delay: 0.07s;
}

.confetti:nth-child(15) {
  --tx: -200px;
  --ty: -10px;
  --rot: 560deg;
}

.confetti:nth-child(16) {
  --tx: -180px;
  --ty: -80px;
  --rot: 690deg;
  width: 6px;
  height: 9px;
}

.confetti:nth-child(17) {
  --tx: -120px;
  --ty: -40px;
  --rot: 540deg;
  animation-delay: 0.03s;
}

.confetti:nth-child(18) {
  --tx: -70px;
  --ty: -60px;
  --rot: 660deg;
}

.confetti:nth-child(19) {
  --tx: 0px;
  --ty: -90px;
  --rot: 500deg;
  width: 12px;
  height: 12px;
}

.confetti:nth-child(20) {
  --tx: 70px;
  --ty: -30px;
  --rot: 620deg;
  animation-delay: 0.09s;
}

.confetti:nth-child(21) {
  --tx: 110px;
  --ty: 40px;
  --rot: 540deg;
}

.confetti:nth-child(22) {
  --tx: 20px;
  --ty: 120px;
  --rot: 700deg;
  width: 8px;
  height: 11px;
}

.confetti:nth-child(23) {
  --tx: -60px;
  --ty: 110px;
  --rot: 580deg;
  animation-delay: 0.05s;
}

.confetti:nth-child(24) {
  --tx: -110px;
  --ty: 30px;
  --rot: 660deg;
}

/* =========================================================================
   RESPONSIVE
   ========================================================================= */
/* Mobile : 24 flous simultanés + décor pèsent sur les GPU d'entrée de gamme.
   On conserve le rendu verre (dégradés translucides) sans `backdrop-filter`. */
@media (max-width: 599px) {
  .cell__button {
    -webkit-backdrop-filter: none;
    backdrop-filter: none;
  }
}

@media (max-width: 768px) {
  .decor__gift,
  .decor__crystal,
  .decor__trail {
    display: none;
  }

  .decor__particles span:nth-child(n + 9) {
    display: none;
  }

  .decor__star--a,
  .decor__star--b {
    opacity: 0.8;
  }
}

@media (min-width: 600px) {
  .grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .modal {
    width: min(92vw, 620px);
    max-width: 620px;
    height: auto;
    max-height: 90dvh;
    margin: auto;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
  }

  .modal__inner {
    height: auto;
    max-height: 90dvh;
    border-radius: var(--radius-lg);
  }

  .modal__img {
    max-height: 56dvh;
  }
}

@media (min-width: 900px) {
  .grid {
    grid-template-columns: repeat(6, minmax(0, 1fr));
  }

  .hero {
    padding-top: clamp(2.5rem, 8vh, 4.5rem);
  }

  .countdown {
    margin-top: 2.6rem;
  }
}

/* Très petits écrans : on garde 3 colonnes lisibles. */
@media (max-width: 380px) {
  .cell__number {
    font-size: 1.25rem;
  }

  .cell__hint {
    font-size: 0.4rem;
    padding: 0.1em 0.4em;
  }

  .calendar__legend {
    gap: 0.35rem 0.7rem;
  }
}

/* =========================================================================
   REPLIS & PRÉFÉRENCES
   ========================================================================= */
@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  .cell__button {
    background: linear-gradient(160deg, #241e4a, #15112c 60%, #1c1638);
  }

  .cell__button--locked {
    background: #1a1630;
  }

  .cell__button--missed {
    background: #171326;
  }

  .countdown,
  .page--calendar .panel {
    background: linear-gradient(160deg, #211b45, #14102b);
  }
}

/* Sans `mask-composite`, le pseudo de bordure peindrait un rectangle plein
   par-dessus les numéros : on le désactive et on revient à une bordure simple. */
@supports not ((mask-composite: exclude) or (-webkit-mask-composite: xor)) {
  .cell__button {
    border-color: var(--border-strong);
  }

  .cell__button::before {
    display: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  .decor,
  .decor::before,
  .decor::after,
  .decor *,
  .decor *::before,
  .decor *::after {
    animation: none !important;
  }

  .decor__particles span {
    opacity: 0.4;
  }

  .confetti-layer,
  .modal__inner.is-revealing::before {
    display: none;
  }

  .grid--enter .cell {
    animation: none;
  }

  .cell__button--openable::after {
    animation: none;
    opacity: 0.55;
  }

  .cell__button--openable {
    box-shadow:
      0 0 0 3px rgba(255, 226, 244, 0.55),
      0 0 30px rgba(230, 138, 191, 0.45);
  }

  .cell__button:hover {
    transform: none;
  }
}

@media (prefers-contrast: more) {
  .cell__button {
    border-color: #ffffff;
  }

  .cell__button--locked .cell__number,
  .cell__button--missed .cell__number {
    color: #ffffff;
  }

  .hero__subtitle,
  .calendar__status,
  .countdown__label,
  .calendar__legend,
  .modal__text {
    color: #ffffff;
  }
}

/* Contraste système forcé (Windows « contraste élevé »). */
@media (forced-colors: active) {
  .hero__title {
    background: none;
    color: CanvasText;
    -webkit-text-fill-color: CanvasText;
    filter: none;
  }

  .cell__button {
    border: 1px solid ButtonText;
    forced-color-adjust: none;
    background: Canvas;
    color: CanvasText;
  }

  .cell__button--openable {
    outline: 3px solid Highlight;
  }

  .cell__hint {
    border: 1px solid CanvasText;
  }

  .decor,
  .decor__particles {
    display: none;
  }
}

/* Impression : on retire tout le décor animé. */
@media print {
  .decor,
  .decor__particles {
    display: none !important;
  }

  .cell__button {
    background: #ffffff !important;
    color: #000000 !important;
    box-shadow: none !important;
    -webkit-backdrop-filter: none;
    backdrop-filter: none;
  }

  .cell__button::before,
  .cell__button::after {
    display: none;
  }
}
