/* Page publique de sélection du nouveau mode Défi.
   Le fichier est volontairement isolé pour ne pas perturber le jeu actuel. */

.defi-page {
  max-width: 920px;
}

.defi-page .topbar.app-header {
  max-width: 920px;
  margin-left: auto;
  margin-right: auto;
}

.defi-hero {
  max-width: 860px;
  margin: 8px auto 16px;
  padding: 22px 20px 12px;
  text-align: center;
  color: #2b1a12;
}

.defi-kicker {
  margin: 0 0 8px;
  color: #5f8f2c;
  font-weight: 950;
  text-transform: uppercase;
  letter-spacing: .08em;
  font-size: .78rem;
}

.defi-hero h2,
.defi-play-placeholder h2 {
  margin: 0;
  color: #2b160c;
  font-size: clamp(2rem, 5vw, 3.2rem);
  line-height: 1.03;
  text-shadow: 0 1px 0 rgba(255,255,255,.8);
}

.defi-intro {
  max-width: 680px;
  margin: 10px auto 0;
  font-size: 1.05rem;
  font-weight: 700;
  color: #4c3222;
  line-height: 1.35;
}

.defi-grid {
  display: grid;
  gap: 16px;
  max-width: 860px;
  margin: 0 auto 18px;
}

.defi-card {
  position: relative;
  display: grid;
  grid-template-columns: minmax(160px, 34%) 1fr;
  overflow: hidden;
  min-height: 164px;
  border: 3px solid var(--wood);
  border-radius: 20px;
  background: rgba(255, 249, 229, .96);
  box-shadow: 0 5px 0 rgba(0,0,0,.18), 0 16px 34px rgba(72, 42, 20, .16);
  transition: transform .16s ease, box-shadow .16s ease, border-color .16s ease;
}

.defi-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 7px 0 rgba(0,0,0,.17), 0 20px 40px rgba(72, 42, 20, .20);
}

.defi-card--disabled {
  opacity: .75;
}

.defi-card-visual {
  position: relative;
  min-height: 100%;
  display: grid;
  place-items: center;
  isolation: isolate;
  background:
    radial-gradient(circle at 22% 20%, rgba(255,255,255,.85) 0 12%, transparent 13%),
    radial-gradient(circle at 70% 28%, rgba(255,255,255,.65) 0 9%, transparent 10%),
    linear-gradient(180deg, #d7efd1 0%, #b7d97d 58%, #78aa48 100%);
}

.defi-card-visual::after {
  content: "";
  position: absolute;
  inset: auto 0 0;
  height: 38%;
  background:
    radial-gradient(circle at 18% 95%, rgba(255,255,255,.95) 0 4px, transparent 5px),
    radial-gradient(circle at 48% 82%, rgba(255,229,126,.9) 0 4px, transparent 5px),
    radial-gradient(circle at 75% 90%, rgba(255,255,255,.95) 0 4px, transparent 5px),
    linear-gradient(145deg, rgba(69, 125, 49, .7), rgba(35, 95, 39, .25));
  z-index: -1;
}

.defi-card-visual img {
  width: 100%;
  height: 100%;
  min-height: 164px;
  object-fit: cover;
  display: block;
}

.defi-card-icon {
  display: grid;
  place-items: center;
  width: 92px;
  height: 92px;
  border-radius: 50%;
  background: rgba(255, 250, 232, .78);
  border: 2px solid rgba(255,255,255,.95);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.7), 0 8px 18px rgba(70, 50, 30, .18);
  font-size: 3.15rem;
}

.defi-card-content {
  padding: 22px 24px 18px;
  min-width: 0;
}

.defi-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.defi-card h3 {
  margin: 0;
  color: #2f6f1f;
  font-size: clamp(1.55rem, 3.6vw, 2.25rem);
  line-height: 1.05;
}

.defi-card p {
  margin: 10px 0 0;
  max-width: 34rem;
  font-size: 1.08rem;
  font-weight: 650;
  line-height: 1.35;
  color: #3a291f;
}

.defi-arrow {
  display: inline-grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  color: #fffbe8;
  background: #5f8f2c;
  font-size: 2.3rem;
  line-height: 1;
  box-shadow: 0 3px 0 rgba(0,0,0,.18);
  flex: 0 0 auto;
}

.defi-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 16px;
}

.defi-meta span {
  display: inline-flex;
  align-items: center;
  min-height: 32px;
  padding: 6px 12px;
  border: 1.5px solid rgba(124, 63, 25, .28);
  border-radius: 999px;
  background: rgba(255,255,255,.52);
  color: #4a2d1a;
  font-weight: 900;
  line-height: 1;
}

.defi-meta .defi-badge {
  border-color: transparent;
  background: #dff0c1;
  color: #315f1e;
}

.defi-card-link {
  position: absolute;
  inset: 0;
  z-index: 2;
  border-radius: inherit;
}

.defi-warning {
  margin-top: 12px !important;
  color: #8b2514 !important;
  font-size: .95rem !important;
}

.defi-card--orange {
  border-color: #cf7d18;
}
.defi-card--orange .defi-card-visual {
  background: linear-gradient(180deg, #ffe3a5 0%, #f6bd55 58%, #d58a26 100%);
}
.defi-card--orange h3 { color: #cf6e13; }
.defi-card--orange .defi-arrow,
.defi-card--orange .defi-badge { background: #df871c; color: #fff6dc; }

.defi-card--bleu-vert {
  border-color: #2f8f8d;
}
.defi-card--bleu-vert .defi-card-visual {
  background: linear-gradient(180deg, #ccefed 0%, #8cd2cc 58%, #4aa7a2 100%);
}
.defi-card--bleu-vert h3 { color: #157a78; }
.defi-card--bleu-vert .defi-arrow,
.defi-card--bleu-vert .defi-badge { background: #2f8f8d; color: #eaffff; }

.defi-card--brun {
  border-color: #8b5a24;
}
.defi-card--brun .defi-card-visual {
  background: linear-gradient(180deg, #edd5a5 0%, #c99855 58%, #8b5a24 100%);
}
.defi-card--brun h3 { color: #5c3517; }
.defi-card--brun .defi-arrow,
.defi-card--brun .defi-badge { background: #87521d; color: #fff6e3; }

.defi-card--rouge {
  border-color: #b34931;
}
.defi-card--rouge .defi-card-visual {
  background: linear-gradient(180deg, #ffd3c7 0%, #e58a6f 58%, #b34931 100%);
}
.defi-card--rouge h3 { color: #9c321f; }
.defi-card--rouge .defi-arrow,
.defi-card--rouge .defi-badge { background: #b34931; color: #fff6f1; }

.defi-card--violet {
  border-color: #7553a7;
}
.defi-card--violet .defi-card-visual {
  background: linear-gradient(180deg, #e3d4ff 0%, #b695ee 58%, #7553a7 100%);
}
.defi-card--violet h3 { color: #5b3a8d; }
.defi-card--violet .defi-arrow,
.defi-card--violet .defi-badge { background: #7553a7; color: #fff8ff; }

.defi-learning-link,
.defi-next,
.defi-play-placeholder {
  max-width: 860px;
  margin-left: auto;
  margin-right: auto;
}

.defi-learning-link {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-top: 18px;
  border-color: #477426;
}

.defi-learning-link h3,
.defi-next h3,
.defi-play-placeholder h2 {
  margin-top: 0;
}

.defi-secondary-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  padding: 9px 16px;
  border: 3px solid #477426;
  border-radius: 10px;
  background: #dff0c1;
  color: #254a16;
  font-weight: 950;
  text-decoration: none;
  box-shadow: 0 3px 0 rgba(0,0,0,.16);
  white-space: nowrap;
}

.defi-secondary-link:hover {
  transform: translateY(-1px);
  background: #cfe7a4;
}

.defi-config-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(190px, 1fr));
  gap: 12px;
  margin: 22px 0;
}

.defi-config-list div {
  padding: 12px;
  border: 2px solid rgba(124, 63, 25, .45);
  border-radius: 10px;
  background: rgba(255,255,255,.42);
}

.defi-config-list dt {
  color: #5a2a12;
  font-weight: 900;
  font-size: .86rem;
}

.defi-config-list dd {
  margin: 4px 0 0;
  font-weight: 950;
  font-size: 1.15rem;
}

.defi-placeholder-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.defi-error {
  max-width: 860px;
  margin: 0 auto 18px;
  border-color: #9a2d18;
}

@media (max-width: 760px) {
  .defi-page {
    padding: 8px;
  }

  .defi-hero {
    padding: 14px 8px 8px;
  }

  .defi-intro {
    font-size: .94rem;
  }

  .defi-grid {
    gap: 12px;
  }

  .defi-card {
    grid-template-columns: 112px 1fr;
    min-height: 132px;
    border-width: 2px;
    border-radius: 15px;
  }

  .defi-card-visual img {
    min-height: 132px;
  }

  .defi-card-icon {
    width: 70px;
    height: 70px;
    font-size: 2.4rem;
  }

  .defi-card-content {
    padding: 14px 12px 12px;
  }

  .defi-card h3 {
    font-size: 1.32rem;
  }

  .defi-card p {
    margin-top: 7px;
    font-size: .9rem;
    line-height: 1.25;
  }

  .defi-arrow {
    width: 34px;
    height: 34px;
    font-size: 1.8rem;
  }

  .defi-meta {
    margin-top: 10px;
    gap: 6px;
  }

  .defi-meta span {
    min-height: 27px;
    padding: 5px 8px;
    font-size: .78rem;
  }

  .defi-learning-link {
    display: block;
  }

  .defi-learning-link .defi-secondary-link {
    margin-top: 12px;
    width: 100%;
  }

  .defi-config-list {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 420px) {
  .defi-card {
    grid-template-columns: 92px 1fr;
  }

  .defi-card-content {
    padding: 12px 10px;
  }

  .defi-card h3 {
    font-size: 1.16rem;
  }

  .defi-card p {
    font-size: .82rem;
  }

  .defi-meta span:nth-child(n+4) {
    display: none;
  }
}


/* ─────────────────────────────────────────────────────────────
   Défi v1.21.16 — haut de page Défi + classement compact
   ───────────────────────────────────────────────────────────── */

.defi-hero {
  margin-bottom: 10px;
  padding-bottom: 8px;
}

.defi-top-scores {
  max-width: 860px;
  margin: 0 auto 18px;
  padding: 14px 16px 16px;
  border-color: rgba(95, 143, 44, .45);
  background:
    linear-gradient(135deg, rgba(244, 252, 229, .95), rgba(255, 248, 226, .95));
}

.defi-top-scores-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 2px 12px;
  align-items: end;
  margin-bottom: 10px;
  color: #2b160c;
}

.defi-top-scores-head span {
  color: #2f6b35;
  font-size: .70rem;
  font-weight: 950;
  text-transform: uppercase;
  letter-spacing: .075em;
}

.defi-top-scores-head h3 {
  grid-column: 1;
  margin: 0;
  color: #2b160c;
  font-size: clamp(1.25rem, 2.8vw, 1.7rem);
  line-height: 1.05;
}

.defi-top-scores-head small {
  grid-column: 2;
  grid-row: 1 / span 2;
  align-self: center;
  padding: 6px 10px;
  border: 2px solid rgba(95, 143, 44, .35);
  border-radius: 999px;
  color: #2f6b35;
  background: rgba(229, 246, 209, .8);
  font-weight: 900;
  white-space: nowrap;
}

.defi-top-scores-list {
  display: grid;
  gap: 7px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.defi-top-scores-list li {
  display: grid;
  grid-template-columns: 30px minmax(0, 1fr) minmax(82px, max-content) minmax(48px, max-content);
  align-items: center;
  gap: 8px;
  min-height: 40px;
  padding: 7px 10px;
  border: 1px solid rgba(121, 91, 54, .18);
  border-radius: 12px;
  background: rgba(255, 253, 240, .78);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.65);
}

.defi-top-rank {
  display: inline-grid;
  place-items: center;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  color: #5a3517;
  background: linear-gradient(135deg, #ffdd72, #c88726);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.55), 0 1px 2px rgba(55,35,20,.14);
  font-weight: 950;
  font-size: .82rem;
}

.defi-top-player {
  min-width: 0;
  display: grid;
  gap: 1px;
}

.defi-top-player strong {
  min-width: 0;
  overflow: hidden;
  color: #2b160c;
  font-size: .92rem;
  font-weight: 950;
  line-height: 1.05;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.defi-top-player small {
  min-width: 0;
  overflow: hidden;
  color: #5b3722;
  font-size: .64rem;
  font-weight: 850;
  line-height: 1.05;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.defi-top-points,
.defi-top-time {
  justify-self: end;
  color: #2b160c;
  font-size: .86rem;
  font-weight: 950;
  white-space: nowrap;
}

.defi-top-time {
  color: #5b3722;
}

@media (min-width: 760px) {
  .defi-top-scores-list {
    grid-template-columns: 1fr 1fr;
  }

  .defi-top-scores-list li:first-child {
    grid-column: 1 / -1;
  }
}

@media (max-width: 700px) {
  .defi-hero {
    padding-top: 12px;
  }

  .defi-top-scores {
    padding: 12px 10px;
  }

  .defi-top-scores-head {
    grid-template-columns: 1fr;
  }

  .defi-top-scores-head small {
    grid-column: 1;
    grid-row: auto;
    width: fit-content;
    font-size: .68rem;
  }

  .defi-top-scores-list li {
    grid-template-columns: 28px minmax(0, 1fr) minmax(70px, max-content) minmax(42px, max-content);
    gap: 6px;
    padding: 6px 8px;
  }

  .defi-top-player small {
    font-size: .60rem;
  }

  .defi-top-points,
  .defi-top-time {
    font-size: .78rem;
  }
}

/* ─────────────────────────────────────────────────────────────
   Défi v1.21.17 — classement Défi propre sur la page de choix
   Objectif : remplacer le bloc brut par une carte compacte et cohérente.
   ───────────────────────────────────────────────────────────── */

.defi-top-scores.panel {
  max-width: 860px;
  margin: 0 auto 18px;
  padding: 14px 16px 15px;
  border: 3px solid rgba(87, 137, 67, .72);
  border-radius: 18px;
  background:
    linear-gradient(135deg, rgba(255, 252, 236, .96), rgba(232, 245, 210, .86));
  box-shadow: 0 4px 0 rgba(0, 0, 0, .12), 0 14px 28px rgba(72, 42, 20, .12);
  color: #2b1a12;
}

.defi-top-scores-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 10px;
}

.defi-top-scores-head span {
  display: block;
  margin-bottom: 2px;
  color: #2f7837;
  font-size: .74rem;
  font-weight: 950;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.defi-top-scores-head h3 {
  margin: 0;
  color: #2b160c;
  font-size: clamp(1.25rem, 2.6vw, 1.75rem);
  line-height: 1.05;
}

.defi-top-scores-head small {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 30px;
  padding: 6px 12px;
  border: 2px solid rgba(142, 103, 71, .42);
  border-radius: 999px;
  background: rgba(255, 249, 229, .74);
  color: #4c3222;
  font-size: .76rem;
  font-weight: 850;
  white-space: nowrap;
}

.defi-top-scores-list {
  list-style: none;
  display: grid;
  gap: 7px;
  margin: 0;
  padding: 0;
  counter-reset: none;
}

.defi-top-scores-list li {
  display: grid;
  grid-template-columns: 32px minmax(0, 1fr) minmax(88px, max-content) minmax(48px, max-content);
  align-items: center;
  gap: 9px;
  min-height: 42px;
  padding: 6px 10px;
  border: 1px solid rgba(138, 103, 72, .22);
  border-radius: 12px;
  background: rgba(255, 253, 242, .74);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .72);
}

.defi-top-rank {
  display: inline-grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 1px solid rgba(135, 95, 49, .32);
  background: linear-gradient(135deg, #ffe487, #d5a33f);
  color: #5b3517;
  font-weight: 950;
  font-size: .82rem;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .75), 0 2px 4px rgba(79, 45, 23, .14);
}

.defi-top-scores-list li:nth-child(2) .defi-top-rank {
  background: linear-gradient(135deg, #fffdf6, #cfc5b3);
}

.defi-top-scores-list li:nth-child(3) .defi-top-rank {
  background: linear-gradient(135deg, #f4c491, #bd7a45);
  color: #fff7df;
}

.defi-top-player {
  min-width: 0;
  display: grid;
  gap: 1px;
}

.defi-top-player strong {
  overflow: hidden;
  color: #2b160c;
  font-size: .96rem;
  font-weight: 950;
  line-height: 1.02;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.defi-top-player small {
  overflow: hidden;
  color: #6a3d24;
  font-size: .68rem;
  font-weight: 800;
  line-height: 1.05;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.defi-top-points,
.defi-top-time {
  justify-self: end;
  color: #2b160c;
  font-size: .88rem;
  font-weight: 950;
  white-space: nowrap;
}

.defi-top-time {
  color: #5a3421;
}

@media (max-width: 700px) {
  .defi-hero {
    padding-top: 14px;
    margin-bottom: 10px;
  }

  .defi-top-scores.panel {
    margin-bottom: 14px;
    padding: 12px;
    border-radius: 15px;
  }

  .defi-top-scores-head {
    align-items: flex-start;
    flex-direction: column;
    gap: 6px;
  }

  .defi-top-scores-head small {
    min-height: 0;
    padding: 4px 9px;
    font-size: .68rem;
  }

  .defi-top-scores-list li {
    grid-template-columns: 28px minmax(0, 1fr) minmax(70px, max-content);
    gap: 7px;
    min-height: 38px;
    padding: 5px 8px;
  }

  .defi-top-time {
    display: none;
  }

  .defi-top-player strong {
    font-size: .88rem;
  }

  .defi-top-player small {
    font-size: .62rem;
  }

  .defi-top-points {
    font-size: .80rem;
  }
}

/* ─────────────────────────────────────────────────────────────
   Défi v1.21.18 — haut de page plus cohérent + scores en fenêtre flottante
   ───────────────────────────────────────────────────────────── */

.defi-hero.defi-hero-card {
  max-width: 860px;
  margin: 28px auto 18px;
  padding: 18px 22px;
  border: 3px solid rgba(129, 73, 36, .88);
  border-radius: 18px;
  background:
    radial-gradient(circle at 8% 20%, rgba(255, 255, 255, .54), transparent 34%),
    linear-gradient(135deg, rgba(255, 249, 223, .96), rgba(238, 244, 207, .86));
  box-shadow: 0 4px 0 rgba(0, 0, 0, .14), 0 16px 30px rgba(71, 43, 22, .13);
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 16px;
  align-items: center;
  text-align: left;
}

.defi-hero-card .defi-kicker {
  display: inline-flex;
  width: fit-content;
  margin: 0 0 7px;
  padding: 5px 11px;
  border: 2px solid rgba(61, 142, 66, .45);
  border-radius: 999px;
  background: rgba(214, 242, 198, .75);
  color: #2f7837;
  font-size: .74rem;
  font-weight: 950;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.defi-hero-card h2 {
  margin: 0;
  color: #2b160c;
  font-size: clamp(2.15rem, 5vw, 3.55rem);
  line-height: .96;
  letter-spacing: -0.045em;
}

.defi-hero-card .defi-intro {
  max-width: 620px;
  margin: 10px 0 0;
  color: #4c2a18;
  font-size: clamp(.98rem, 1.7vw, 1.12rem);
  font-weight: 800;
  line-height: 1.32;
}

.defi-score-open {
  appearance: none;
  border: 2px solid rgba(112, 83, 52, .38);
  border-radius: 16px;
  padding: 10px 13px;
  background: rgba(255, 253, 242, .86);
  color: #2b160c;
  cursor: pointer;
  box-shadow: 0 3px 0 rgba(82, 47, 22, .15);
  display: grid;
  gap: 2px;
  min-width: 178px;
  text-align: left;
}

.defi-score-open span {
  font-size: .95rem;
  font-weight: 950;
  white-space: nowrap;
}

.defi-score-open small {
  color: #5f3c25;
  font-size: .66rem;
  font-weight: 850;
  line-height: 1.1;
}

.defi-score-open:hover,
.defi-score-open:focus-visible {
  border-color: rgba(48, 119, 54, .6);
  background: rgba(231, 246, 214, .9);
  outline: none;
  transform: translateY(-1px);
}

.defi-scores-modal[hidden] {
  display: none !important;
}

.defi-scores-modal {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: grid;
  place-items: center;
  padding: 18px;
}

.defi-scores-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(43, 25, 11, .42);
  backdrop-filter: blur(2px);
}

.defi-scores-floating {
  position: relative;
  z-index: 1;
  width: min(760px, calc(100vw - 28px));
  max-height: min(86vh, 620px);
  overflow: auto;
  margin: 0;
  padding: 16px 18px 18px;
  border: 3px solid rgba(87, 137, 67, .78);
  border-radius: 19px;
  background:
    linear-gradient(135deg, rgba(255, 252, 236, .98), rgba(232, 245, 210, .93));
  box-shadow: 0 12px 0 rgba(0, 0, 0, .13), 0 28px 60px rgba(31, 18, 8, .35);
  color: #2b1a12;
}

.defi-scores-floating:focus {
  outline: none;
}

.defi-scores-close {
  position: absolute;
  top: 10px;
  right: 12px;
  width: 34px;
  height: 34px;
  border: 2px solid rgba(129, 73, 36, .32);
  border-radius: 50%;
  background: rgba(255, 249, 229, .94);
  color: #4c2a18;
  cursor: pointer;
  font-size: 1.35rem;
  font-weight: 950;
  line-height: 1;
}

.defi-scores-close:hover,
.defi-scores-close:focus-visible {
  border-color: rgba(48, 119, 54, .65);
  color: #2f7837;
  outline: none;
}

.defi-scores-floating .defi-top-scores-head {
  padding-right: 42px;
}

.defi-scores-floating .defi-top-scores-list {
  grid-template-columns: 1fr !important;
}

.defi-scores-floating .defi-top-scores-list li:first-child {
  grid-column: auto !important;
}

body.defi-scores-opened {
  overflow: hidden;
}

@media (max-width: 700px) {
  .defi-hero.defi-hero-card {
    margin: 16px auto 14px;
    padding: 15px 14px;
    grid-template-columns: 1fr;
    text-align: left;
  }

  .defi-hero-card h2 {
    font-size: clamp(2rem, 11vw, 2.75rem);
  }

  .defi-score-open {
    width: 100%;
    min-width: 0;
    grid-template-columns: 1fr;
    padding: 9px 12px;
  }

  .defi-scores-modal {
    align-items: end;
    padding: 10px;
  }

  .defi-scores-floating {
    width: 100%;
    max-height: 88vh;
    padding: 14px 12px 16px;
    border-radius: 17px;
  }
}


/* Défi v1.21.19 — fenêtre scores : Top 10 */
.defi-scores-floating .defi-top-scores-list {
  gap: 7px !important;
}

.defi-scores-floating .defi-top-scores-list li {
  min-height: 42px;
}

@media (max-width: 700px) {
  .defi-scores-floating .defi-top-scores-list {
    gap: 6px !important;
  }

  .defi-scores-floating .defi-top-scores-list li {
    min-height: 40px;
  }
}

/* ─────────────────────────────────────────────────────────────
   Défi v1.21.21 — visuels de niveaux dans un rond fixe animé
   - les images personnalisées ne remplissent plus toute la zone gauche ;
   - elles sont affichées comme les icônes, dans un médaillon rond fixe ;
   - léger flottement CSS, contenu strictement dans la zone gauche ;
   - respect de l'option système « réduire les animations ».
   ───────────────────────────────────────────────────────────── */

.defi-card-visual {
  overflow: hidden !important;
  min-height: 164px !important;
}

.defi-card-visual > img,
.defi-card-icon {
  width: 94px !important;
  height: 94px !important;
  min-width: 94px !important;
  min-height: 94px !important;
  max-width: 94px !important;
  max-height: 94px !important;
  box-sizing: border-box !important;
  border-radius: 50% !important;
  border: 2px solid rgba(255, 255, 255, .96) !important;
  background: rgba(255, 250, 232, .82) !important;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.75), 0 8px 18px rgba(70, 50, 30, .20) !important;
  transform-origin: center center !important;
  will-change: transform !important;
  animation: defiBadgeFloatA 7.5s ease-in-out infinite !important;
}

.defi-card-visual > img {
  display: block !important;
  padding: 9px !important;
  object-fit: contain !important;
  object-position: center center !important;
}

.defi-card:nth-child(2n) .defi-card-visual > img,
.defi-card:nth-child(2n) .defi-card-icon {
  animation-name: defiBadgeFloatB !important;
  animation-duration: 8.2s !important;
}

.defi-card:nth-child(3n) .defi-card-visual > img,
.defi-card:nth-child(3n) .defi-card-icon {
  animation-name: defiBadgeFloatC !important;
  animation-duration: 7.9s !important;
  animation-delay: -.8s !important;
}

@keyframes defiBadgeFloatA {
  0%, 100% { transform: translate3d(0, 0, 0); }
  25% { transform: translate3d(5px, -4px, 0); }
  50% { transform: translate3d(-3px, 3px, 0); }
  75% { transform: translate3d(4px, 4px, 0); }
}

@keyframes defiBadgeFloatB {
  0%, 100% { transform: translate3d(0, 0, 0); }
  30% { transform: translate3d(-5px, -3px, 0); }
  58% { transform: translate3d(4px, 4px, 0); }
  82% { transform: translate3d(-2px, 5px, 0); }
}

@keyframes defiBadgeFloatC {
  0%, 100% { transform: translate3d(0, 0, 0); }
  28% { transform: translate3d(4px, 3px, 0); }
  54% { transform: translate3d(-5px, -4px, 0); }
  78% { transform: translate3d(3px, -2px, 0); }
}

@media (max-width: 700px) {
  .defi-card-visual {
    min-height: 118px !important;
  }

  .defi-card-visual > img,
  .defi-card-icon {
    width: 78px !important;
    height: 78px !important;
    min-width: 78px !important;
    min-height: 78px !important;
    max-width: 78px !important;
    max-height: 78px !important;
  }

  .defi-card-visual > img {
    padding: 7px !important;
  }
}

@media (prefers-reduced-motion: reduce) {
  .defi-card-visual > img,
  .defi-card-icon {
    animation: none !important;
    transform: none !important;
  }
}


/* ─────────────────────────────────────────────────────────────
   Défi v1.21.22 — flottement plus lent et un peu plus ample
   - mouvement plus visible mais contenu dans la zone gauche ;
   - animation ralentie pour éviter l'effet gadget ;
   - amplitudes réduites sur mobile.
   ───────────────────────────────────────────────────────────── */

.defi-card-visual > img,
.defi-card-icon {
  animation-duration: 15.5s !important;
}

.defi-card:nth-child(2n) .defi-card-visual > img,
.defi-card:nth-child(2n) .defi-card-icon {
  animation-duration: 17s !important;
}

.defi-card:nth-child(3n) .defi-card-visual > img,
.defi-card:nth-child(3n) .defi-card-icon {
  animation-duration: 18.5s !important;
}

@keyframes defiBadgeFloatA {
  0%, 100% { transform: translate3d(0, 0, 0); }
  22% { transform: translate3d(13px, -10px, 0); }
  48% { transform: translate3d(-11px, 9px, 0); }
  74% { transform: translate3d(10px, 11px, 0); }
}

@keyframes defiBadgeFloatB {
  0%, 100% { transform: translate3d(0, 0, 0); }
  26% { transform: translate3d(-14px, -8px, 0); }
  55% { transform: translate3d(12px, 10px, 0); }
  80% { transform: translate3d(-8px, 12px, 0); }
}

@keyframes defiBadgeFloatC {
  0%, 100% { transform: translate3d(0, 0, 0); }
  24% { transform: translate3d(11px, 10px, 0); }
  52% { transform: translate3d(-13px, -10px, 0); }
  78% { transform: translate3d(9px, -8px, 0); }
}

@media (max-width: 700px) {
  .defi-card-visual > img,
  .defi-card-icon {
    animation-duration: 16s !important;
  }

  .defi-card:nth-child(2n) .defi-card-visual > img,
  .defi-card:nth-child(2n) .defi-card-icon {
    animation-duration: 17.5s !important;
  }

  .defi-card:nth-child(3n) .defi-card-visual > img,
  .defi-card:nth-child(3n) .defi-card-icon {
    animation-duration: 18.5s !important;
  }

  @keyframes defiBadgeFloatA {
    0%, 100% { transform: translate3d(0, 0, 0); }
    22% { transform: translate3d(8px, -6px, 0); }
    48% { transform: translate3d(-7px, 6px, 0); }
    74% { transform: translate3d(6px, 7px, 0); }
  }

  @keyframes defiBadgeFloatB {
    0%, 100% { transform: translate3d(0, 0, 0); }
    26% { transform: translate3d(-8px, -6px, 0); }
    55% { transform: translate3d(7px, 7px, 0); }
    80% { transform: translate3d(-6px, 8px, 0); }
  }

  @keyframes defiBadgeFloatC {
    0%, 100% { transform: translate3d(0, 0, 0); }
    24% { transform: translate3d(7px, 6px, 0); }
    52% { transform: translate3d(-8px, -7px, 0); }
    78% { transform: translate3d(6px, -5px, 0); }
  }
}

/* ─────────────────────────────────────────────────────────────
   Défi v1.21.31 — fenêtre scores : Top 10 par niveau
   ───────────────────────────────────────────────────────────── */
.defi-score-level-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  justify-content: center;
  margin: 10px 0 12px;
}

.defi-score-level-tab {
  border: 1px solid rgba(47, 107, 53, .35);
  border-radius: 999px;
  background: rgba(255, 250, 232, .86);
  color: #2f6b35;
  cursor: pointer;
  font-size: .78rem;
  font-weight: 950;
  padding: 6px 10px;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.7);
}

.defi-score-level-tab:hover,
.defi-score-level-tab:focus-visible,
.defi-score-level-tab.is-active {
  background: #47783f;
  border-color: #47783f;
  color: #fff8df;
  outline: none;
}

.defi-score-level-title {
  margin: 0 0 8px;
  color: #4a2a16;
  font-size: .95rem;
  font-weight: 950;
  text-align: center;
}

.defi-score-level-empty {
  margin: 12px 0 4px;
  border: 1px dashed rgba(111, 83, 49, .28);
  border-radius: 12px;
  background: rgba(255, 250, 232, .72);
  color: #6b4b2c;
  font-weight: 800;
  padding: 12px;
  text-align: center;
}

.defi-score-open small {
  display: block;
}

@media (max-width: 700px) {
  .defi-score-level-tabs {
    justify-content: flex-start;
    overflow-x: auto;
    padding-bottom: 2px;
  }

  .defi-score-level-tab {
    flex: 0 0 auto;
    padding: 7px 10px;
  }
}

/* ─────────────────────────────────────────────────────────────
   Défi v1.21.90 — palettes harmonisées avec bulles décoratives
   - toutes les couleurs reprennent la décoration de la carte verte ;
   - ajout des palettes bleu et or / ocre ;
   - les médaillons, images et animations existants sont conservés.
   ───────────────────────────────────────────────────────────── */

.defi-card--vert .defi-card-visual,
.defi-card:not([class*="defi-card--"]) .defi-card-visual {
  background:
    radial-gradient(circle at 22% 20%, rgba(255,255,255,.85) 0 12%, transparent 13%),
    radial-gradient(circle at 70% 28%, rgba(255,255,255,.65) 0 9%, transparent 10%),
    linear-gradient(180deg, #d7efd1 0%, #b7d97d 58%, #78aa48 100%);
}

.defi-card--orange .defi-card-visual {
  background:
    radial-gradient(circle at 22% 20%, rgba(255,255,255,.84) 0 12%, transparent 13%),
    radial-gradient(circle at 70% 28%, rgba(255,255,255,.58) 0 9%, transparent 10%),
    linear-gradient(180deg, #ffe7ad 0%, #f6bd55 58%, #d58a26 100%);
}

.defi-card--bleu-vert .defi-card-visual {
  background:
    radial-gradient(circle at 22% 20%, rgba(255,255,255,.84) 0 12%, transparent 13%),
    radial-gradient(circle at 70% 28%, rgba(255,255,255,.58) 0 9%, transparent 10%),
    linear-gradient(180deg, #d3f3f0 0%, #8cd2cc 58%, #4aa7a2 100%);
}

.defi-card--bleu {
  border-color: #4478b8;
}
.defi-card--bleu .defi-card-visual {
  background:
    radial-gradient(circle at 22% 20%, rgba(255,255,255,.86) 0 12%, transparent 13%),
    radial-gradient(circle at 70% 28%, rgba(255,255,255,.60) 0 9%, transparent 10%),
    linear-gradient(180deg, #dcecff 0%, #91b9ef 58%, #4f82c4 100%);
}
.defi-card--bleu h3 { color: #315f9d; }
.defi-card--bleu .defi-arrow,
.defi-card--bleu .defi-badge { background: #4478b8; color: #f4f9ff; }

.defi-card--violet .defi-card-visual {
  background:
    radial-gradient(circle at 22% 20%, rgba(255,255,255,.84) 0 12%, transparent 13%),
    radial-gradient(circle at 70% 28%, rgba(255,255,255,.57) 0 9%, transparent 10%),
    linear-gradient(180deg, #eadfff 0%, #b695ee 58%, #7553a7 100%);
}

.defi-card--rouge .defi-card-visual {
  background:
    radial-gradient(circle at 22% 20%, rgba(255,255,255,.84) 0 12%, transparent 13%),
    radial-gradient(circle at 70% 28%, rgba(255,255,255,.55) 0 9%, transparent 10%),
    linear-gradient(180deg, #ffd9cf 0%, #e58a6f 58%, #b34931 100%);
}

.defi-card--brun .defi-card-visual {
  background:
    radial-gradient(circle at 22% 20%, rgba(255,255,255,.82) 0 12%, transparent 13%),
    radial-gradient(circle at 70% 28%, rgba(255,255,255,.52) 0 9%, transparent 10%),
    linear-gradient(180deg, #f0ddb7 0%, #c99855 58%, #8b5a24 100%);
}

.defi-card--or {
  border-color: #b68a20;
}
.defi-card--or .defi-card-visual {
  background:
    radial-gradient(circle at 22% 20%, rgba(255,255,255,.86) 0 12%, transparent 13%),
    radial-gradient(circle at 70% 28%, rgba(255,255,255,.62) 0 9%, transparent 10%),
    linear-gradient(180deg, #fff4bd 0%, #efd36b 58%, #bf9331 100%);
}
.defi-card--or h3 { color: #8b6510; }
.defi-card--or .defi-arrow,
.defi-card--or .defi-badge { background: #b68a20; color: #fffbea; }


/* ─────────────────────────────────────────────────────────────
   Défi v1.21.91 — décors de bulles pseudo-aléatoires et stables
   - 8 dispositions calculées automatiquement depuis le slug du niveau ;
   - le décor ne change pas au rechargement de la page ;
   - mêmes variantes dans l'aperçu d'administration et sur la page publique.
   ───────────────────────────────────────────────────────────── */

.defi-card {
  --defi-b1-x: 18%;
  --defi-b1-y: 18%;
  --defi-b1-r: 12%;
  --defi-b2-x: 72%;
  --defi-b2-y: 27%;
  --defi-b2-r: 9%;
  --defi-b3-x: 46%;
  --defi-b3-y: 8%;
  --defi-b3-r: 5%;
  --defi-dot1-x: 18%;
  --defi-dot1-y: 95%;
  --defi-dot2-x: 48%;
  --defi-dot2-y: 82%;
  --defi-dot3-x: 75%;
  --defi-dot3-y: 90%;
  --defi-card-gradient: linear-gradient(180deg, #d7efd1 0%, #b7d97d 58%, #78aa48 100%);
  --defi-ground-gradient: linear-gradient(145deg, rgba(69, 125, 49, .72), rgba(35, 95, 39, .25));
}

.defi-decor--1 {
  --defi-b1-x: 18%; --defi-b1-y: 18%; --defi-b1-r: 12%;
  --defi-b2-x: 72%; --defi-b2-y: 27%; --defi-b2-r: 9%;
  --defi-b3-x: 46%; --defi-b3-y: 8%;  --defi-b3-r: 5%;
  --defi-dot1-x: 18%; --defi-dot1-y: 95%;
  --defi-dot2-x: 48%; --defi-dot2-y: 82%;
  --defi-dot3-x: 75%; --defi-dot3-y: 90%;
}

.defi-decor--2 {
  --defi-b1-x: 78%; --defi-b1-y: 17%; --defi-b1-r: 11%;
  --defi-b2-x: 27%; --defi-b2-y: 34%; --defi-b2-r: 8%;
  --defi-b3-x: 52%; --defi-b3-y: 11%; --defi-b3-r: 6%;
  --defi-dot1-x: 12%; --defi-dot1-y: 86%;
  --defi-dot2-x: 61%; --defi-dot2-y: 93%;
  --defi-dot3-x: 87%; --defi-dot3-y: 78%;
}

.defi-decor--3 {
  --defi-b1-x: 34%; --defi-b1-y: 16%; --defi-b1-r: 13%;
  --defi-b2-x: 84%; --defi-b2-y: 39%; --defi-b2-r: 7%;
  --defi-b3-x: 10%; --defi-b3-y: 44%; --defi-b3-r: 5%;
  --defi-dot1-x: 24%; --defi-dot1-y: 80%;
  --defi-dot2-x: 54%; --defi-dot2-y: 96%;
  --defi-dot3-x: 82%; --defi-dot3-y: 84%;
}

.defi-decor--4 {
  --defi-b1-x: 14%; --defi-b1-y: 35%; --defi-b1-r: 10%;
  --defi-b2-x: 61%; --defi-b2-y: 14%; --defi-b2-r: 12%;
  --defi-b3-x: 88%; --defi-b3-y: 31%; --defi-b3-r: 5%;
  --defi-dot1-x: 9%;  --defi-dot1-y: 92%;
  --defi-dot2-x: 42%; --defi-dot2-y: 78%;
  --defi-dot3-x: 72%; --defi-dot3-y: 95%;
}

.defi-decor--5 {
  --defi-b1-x: 87%; --defi-b1-y: 20%; --defi-b1-r: 13%;
  --defi-b2-x: 42%; --defi-b2-y: 30%; --defi-b2-r: 8%;
  --defi-b3-x: 13%; --defi-b3-y: 12%; --defi-b3-r: 6%;
  --defi-dot1-x: 20%; --defi-dot1-y: 88%;
  --defi-dot2-x: 68%; --defi-dot2-y: 81%;
  --defi-dot3-x: 91%; --defi-dot3-y: 96%;
}

.defi-decor--6 {
  --defi-b1-x: 48%; --defi-b1-y: 13%; --defi-b1-r: 12%;
  --defi-b2-x: 16%; --defi-b2-y: 42%; --defi-b2-r: 8%;
  --defi-b3-x: 83%; --defi-b3-y: 33%; --defi-b3-r: 6%;
  --defi-dot1-x: 14%; --defi-dot1-y: 79%;
  --defi-dot2-x: 50%; --defi-dot2-y: 94%;
  --defi-dot3-x: 80%; --defi-dot3-y: 82%;
}

.defi-decor--7 {
  --defi-b1-x: 23%; --defi-b1-y: 13%; --defi-b1-r: 10%;
  --defi-b2-x: 67%; --defi-b2-y: 39%; --defi-b2-r: 11%;
  --defi-b3-x: 91%; --defi-b3-y: 11%; --defi-b3-r: 4%;
  --defi-dot1-x: 31%; --defi-dot1-y: 95%;
  --defi-dot2-x: 58%; --defi-dot2-y: 79%;
  --defi-dot3-x: 88%; --defi-dot3-y: 91%;
}

.defi-decor--8 {
  --defi-b1-x: 72%; --defi-b1-y: 14%; --defi-b1-r: 12%;
  --defi-b2-x: 19%; --defi-b2-y: 27%; --defi-b2-r: 10%;
  --defi-b3-x: 51%; --defi-b3-y: 43%; --defi-b3-r: 5%;
  --defi-dot1-x: 10%; --defi-dot1-y: 83%;
  --defi-dot2-x: 45%; --defi-dot2-y: 96%;
  --defi-dot3-x: 76%; --defi-dot3-y: 80%;
}

.defi-card--vert,
.defi-card:not([class*="defi-card--"]) {
  --defi-card-gradient: linear-gradient(180deg, #d7efd1 0%, #b7d97d 58%, #78aa48 100%);
  --defi-ground-gradient: linear-gradient(145deg, rgba(69, 125, 49, .72), rgba(35, 95, 39, .25));
}

.defi-card--orange {
  --defi-card-gradient: linear-gradient(180deg, #ffe7ad 0%, #f6bd55 58%, #d58a26 100%);
  --defi-ground-gradient: linear-gradient(145deg, rgba(174, 132, 48, .72), rgba(116, 83, 31, .28));
}

.defi-card--bleu-vert {
  --defi-card-gradient: linear-gradient(180deg, #d3f3f0 0%, #8cd2cc 58%, #4aa7a2 100%);
  --defi-ground-gradient: linear-gradient(145deg, rgba(48, 132, 126, .70), rgba(26, 91, 90, .27));
}

.defi-card--bleu {
  --defi-card-gradient: linear-gradient(180deg, #dcecff 0%, #91b9ef 58%, #4f82c4 100%);
  --defi-ground-gradient: linear-gradient(145deg, rgba(65, 111, 174, .72), rgba(42, 72, 128, .28));
}

.defi-card--violet {
  --defi-card-gradient: linear-gradient(180deg, #eadfff 0%, #b695ee 58%, #7553a7 100%);
  --defi-ground-gradient: linear-gradient(145deg, rgba(108, 78, 158, .72), rgba(70, 48, 112, .27));
}

.defi-card--rouge {
  --defi-card-gradient: linear-gradient(180deg, #ffd9cf 0%, #e58a6f 58%, #b34931 100%);
  --defi-ground-gradient: linear-gradient(145deg, rgba(167, 65, 47, .72), rgba(112, 45, 33, .28));
}

.defi-card--brun {
  --defi-card-gradient: linear-gradient(180deg, #f0ddb7 0%, #c99855 58%, #8b5a24 100%);
  --defi-ground-gradient: linear-gradient(145deg, rgba(130, 82, 31, .74), rgba(82, 50, 24, .28));
}

.defi-card--or {
  --defi-card-gradient: linear-gradient(180deg, #fff4bd 0%, #efd36b 58%, #bf9331 100%);
  --defi-ground-gradient: linear-gradient(145deg, rgba(178, 137, 40, .72), rgba(120, 86, 22, .27));
}

.defi-card .defi-card-visual {
  background:
    radial-gradient(circle at var(--defi-b1-x) var(--defi-b1-y), rgba(255,255,255,.84) 0 var(--defi-b1-r), transparent calc(var(--defi-b1-r) + 1%)),
    radial-gradient(circle at var(--defi-b2-x) var(--defi-b2-y), rgba(255,255,255,.60) 0 var(--defi-b2-r), transparent calc(var(--defi-b2-r) + 1%)),
    radial-gradient(circle at var(--defi-b3-x) var(--defi-b3-y), rgba(255,255,255,.38) 0 var(--defi-b3-r), transparent calc(var(--defi-b3-r) + 1%)),
    var(--defi-card-gradient);
}

.defi-card .defi-card-visual::after {
  background:
    radial-gradient(circle at var(--defi-dot1-x) var(--defi-dot1-y), rgba(255,255,255,.95) 0 4px, transparent 5px),
    radial-gradient(circle at var(--defi-dot2-x) var(--defi-dot2-y), rgba(255,229,126,.92) 0 4px, transparent 5px),
    radial-gradient(circle at var(--defi-dot3-x) var(--defi-dot3-y), rgba(255,255,255,.95) 0 4px, transparent 5px),
    var(--defi-ground-gradient);
}
