/* ==================================================================
   succes.css, les écussons et leurs jauges.
   ================================================================== */

.ach-top {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 18px;
}
.ach-lead {
  max-width: 46ch;
  font-size: 13.5px;
  line-height: 1.55;
  color: var(--ink-2);
}
#ach-claim-all b { margin-left: 6px; color: #fff6d6; }

.ach-grid {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
}

.ach {
  --hue: 268;
  position: relative;
  display: grid;
  grid-template-columns: 84px 1fr;
  grid-template-rows: auto auto;
  align-items: center;
  gap: 4px 16px;
  padding: 16px;
  border: 2px solid rgba(20, 14, 51, .9);
  border-radius: 18px;
  background:
    radial-gradient(120% 100% at 0% 0%, hsl(var(--hue) 80% 50% / .22), transparent 62%),
    linear-gradient(180deg, rgba(50, 38, 104, .6), rgba(24, 17, 58, .7));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .1), 0 4px 0 rgba(10, 6, 26, .85);
  overflow: hidden;
}

/* ------------------------------ la médaille ------------------------------
   Rien ne s'anime sur l'image elle-même : un SVG avec une ombre portée
   qu'on met à l'échelle se redessine à chaque image, d'où les saccades
   d'avant. Les mouvements portent sur des calques voisins, en
   transformation et en opacité seulement. */

.ach-badge {
  grid-row: 1 / 3;
  position: relative;
  width: 84px; height: 84px;
  display: grid;
  place-items: center;
}
.ach-medal {
  position: relative;
  z-index: 2;
  width: 76px; height: 76px;
  display: block;
  overflow: hidden;
  border-radius: 50%;
  overflow: visible;
}
.badge-svg { width: 100%; height: 100%; display: block; }
.ach-badge:not(.is-lit) .ach-medal { opacity: .75; }

/* le halo, qui respire sous la médaille */
.ach-halo {
  position: absolute;
  inset: -6px;
  z-index: 1;
  border-radius: 50%;
  background: radial-gradient(closest-side, hsl(var(--hue) 100% 65% / .55), transparent 72%);
  opacity: 0;
}
.ach-badge.is-lit .ach-halo { opacity: .45; }
.ach-badge.is-ready .ach-halo { animation: ach-halo 2s ease-in-out infinite; }
@keyframes ach-halo {
  0%, 100% { opacity: .45; transform: scale(.92); }
  50%      { opacity: 1;   transform: scale(1.12); }
}

/* les rayons, qui tournent derrière une récompense à récupérer */
.ach-rays {
  position: absolute;
  inset: -22px;
  z-index: 0;
  border-radius: 50%;
  background: repeating-conic-gradient(from 0deg, hsl(var(--hue) 100% 75% / .55) 0 8deg, transparent 8deg 24deg);
  -webkit-mask-image: radial-gradient(closest-side, #000 30%, transparent 75%);
          mask-image: radial-gradient(closest-side, #000 30%, transparent 75%);
  opacity: 0;
  transform: scale(.6);
  transition: opacity .4s, transform .5s var(--ease-back);
}
.ach-badge.is-ready .ach-rays,
.ach-badge.is-max .ach-rays {
  opacity: 1;
  transform: scale(1);
  animation: ach-spin 9s linear infinite;
}
.ach-badge.is-max:not(.is-ready) .ach-rays { opacity: .45; animation-duration: 20s; }
@keyframes ach-spin { from { transform: rotate(0); } to { transform: rotate(360deg); } }

/* la médaille à récupérer flotte, et un reflet la traverse */
.ach-badge.is-ready .ach-medal { animation: ach-bob 2s ease-in-out infinite; }
@keyframes ach-bob {
  0%, 100% { translate: 0 0; rotate: -3deg; }
  50%      { translate: 0 -4px; rotate: 3deg; }
}
.ach-shine {
  position: absolute;
  inset: 5px;
  border-radius: 50%;
  overflow: hidden;
  pointer-events: none;
}
.ach-shine::before {
  content: "";
  position: absolute;
  top: -20%; bottom: -20%;
  width: 35%;
  left: 0;
  background: linear-gradient(100deg, transparent, rgba(255, 255, 255, .75), transparent);
  transform: translateX(-150%) skewX(-18deg);
}
.ach-badge.is-lit .ach-shine::before { animation: ach-shine 4.5s ease-in-out infinite; }
.ach-badge.is-ready .ach-shine::before { animation-duration: 2.2s; }
@keyframes ach-shine {
  0%, 70% { transform: translateX(-150%) skewX(-18deg); }
  100%    { transform: translateX(380%) skewX(-18deg); }
}

/* la médaille qu'on vient de récupérer bondit */
.ach.is-claimed .ach-medal { animation: ach-claim .8s cubic-bezier(.3, 1.7, .5, 1); }
@keyframes ach-claim {
  0%   { transform: scale(1); }
  30%  { transform: scale(1.35) rotate(-12deg); }
  100% { transform: scale(1) rotate(0); }
}

.ach-pip {
  position: absolute;
  top: -3px; right: -3px;
  min-width: 20px; height: 20px;
  display: grid; place-items: center;
  padding: 0 5px;
  border-radius: 999px;
  background: #ff3d71;
  color: #fff;
  font-size: 11px;
  font-weight: 800;
  box-shadow: 0 0 10px rgba(255, 61, 113, .8);
}

.ach-body { min-width: 0; }
.ach-body h3 {
  display: flex;
  align-items: baseline;
  gap: 8px;
  font-size: 15.5px;
  letter-spacing: -.01em;
}
.ach-metal {
  font-style: normal;
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--ink-3);
}
.ach-sub {
  margin-top: 3px;
  font-size: 12.5px;
  color: var(--ink-2);
  font-variant-numeric: tabular-nums;
}
.ach-sub b { color: var(--ink); }

.ach-bar {
  margin: 9px 0 6px;
  height: 5px;
  border-radius: 999px;
  background: rgba(255, 255, 255, .09);
  overflow: hidden;
}
.ach-bar i {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, hsl(var(--hue) 70% 45%), hsl(var(--hue) 92% 66%));
  box-shadow: 0 0 10px -2px hsl(var(--hue) 90% 60%);
  transition: width .6s var(--ease-out);
}

.ach-next { font-size: 12px; color: var(--ink-3); }
.ach-gain { color: #ffd36a; font-weight: 700; white-space: nowrap; }

.ach-claim {
  grid-column: 1 / 3;
  margin-top: 12px;
  padding: 10px 14px;
  border: 1px solid hsl(var(--hue) 70% 60% / .55);
  border-radius: 11px;
  background: hsl(var(--hue) 70% 50% / .2);
  color: #fff;
  font: inherit;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  transition: background .2s, transform .15s;
}
.ach-claim:hover:not(:disabled) { background: hsl(var(--hue) 75% 55% / .34); transform: translateY(-1px); }
.ach-claim b { color: #ffe9a8; }
.ach-claim.is-off {
  border-color: var(--line);
  background: transparent;
  color: var(--ink-3);
  cursor: default;
}

@media (max-width: 480px) {
  .ach-grid { grid-template-columns: 1fr; }
  .ach { grid-template-columns: 68px 1fr; gap: 4px 12px; }
  .ach-badge { width: 68px; height: 68px; }
  .ach-medal { width: 62px; height: 62px; }
}

@media (prefers-reduced-motion: reduce) {
  .ach-badge .ach-rays, .ach-badge .ach-medal, .ach-halo, .ach-shine::before { animation: none !important; }
}

/* ---------------------- les groupes de succes ---------------------- */

.ach-grid { display: block; }

.ach-group { margin-bottom: 26px; }
.ach-group-h {
  display: flex;
  align-items: baseline;
  gap: 10px;
  margin-bottom: 11px;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--ink-3);
}
.ach-group-h::after {
  content: "";
  flex: 1 1 auto;
  height: 1px;
  background: var(--line);
}
.ach-group-h em {
  order: 3;
  font-style: normal;
  font-size: 11.5px;
  letter-spacing: 0;
  color: var(--ink-2);
  font-variant-numeric: tabular-nums;
}

.ach-grid-in {
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
}

/* Le metal se lit a la couleur, pas au mot : a treize lignes, repeter
   « Argent » six fois fait du bruit. */
.ach-metal { opacity: .85; }
.ach-metal.is-fer     { color: #79809a; }
.ach-metal.is-cuivre  { color: #e29a5c; }
.ach-metal.is-argent  { color: #e6ecf7; }
.ach-metal.is-or      { color: #ffdf85; }
.ach-metal.is-platine { color: #a8f0e0; }
.ach-metal.is-onyx    { color: #d3aaff; }
.ach-metal.is-prisme  {
  background: linear-gradient(90deg, #ff9ad3, #ffd36a, #6ff0c0, #8bb4ff);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

@media (max-width: 480px) {
  .ach-grid-in { grid-template-columns: 1fr; }
}

/* ------------------------------ la jauge et le bouton ------------------------------ */
.ach-body h3 { font-family: var(--font-display); font-weight: 400; font-size: 18px; letter-spacing: .01em; }
.ach-bar {
  height: 10px;
  border: 2px solid rgba(20, 14, 51, .9);
  background: rgba(10, 6, 28, .8);
}
.ach-bar i {
  position: relative;
  border-radius: 999px;
  background: linear-gradient(90deg, hsl(var(--hue) 90% 50%), hsl(calc(var(--hue) + 30) 100% 68%));
  box-shadow: inset 0 2px 0 rgba(255, 255, 255, .45);
  overflow: hidden;
}
.ach-claim:not(.is-off) {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: 16px;
  color: #3a1d00;
  border: 2px solid rgba(20, 14, 51, .9);
  background: linear-gradient(180deg, #fff3a8, #ffd24a 45%, #ff9f1c);
  box-shadow: inset 0 2px 0 rgba(255,255,255,.8), 0 4px 0 #9a4a00, 0 10px 22px -10px rgba(255,170,40,.9);
  text-shadow: 0 1px 0 rgba(255,255,255,.5);
}
.ach-claim:not(.is-off) b { color: #7a2e00; }
.ach-claim:not(.is-off):active { transform: translateY(3px); box-shadow: inset 0 2px 0 rgba(255,255,255,.7), 0 1px 0 #9a4a00; }
.ach-group-h { font-family: var(--font-display); font-weight: 400; font-size: 16px; letter-spacing: .08em; color: #d7c9ff; }

.fx-lite .ach-rays { animation: none !important; }
.fx-lite .ach-shine { display: none; }

/* ------------------------------ les défis ------------------------------
   Deux colonnes sur ordinateur, l'une sous l'autre sur téléphone. Un défi
   terminé s'allume et son bouton doré appelle le pouce ; un défi
   récupéré s'efface pour laisser la place aux autres. */

.quests {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 6px 18px;
  margin-bottom: 8px;
}
.quests:empty { display: none; }
.quest-col { margin-bottom: 18px; }
.quest-col .ach-group-h { flex-wrap: wrap; row-gap: 4px; }
.quest-col .ach-group-h::after { display: none; }
.quest-timer {
  order: 2;
  margin-left: auto;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-weight: 600;
  font-style: normal;
  font-size: 11.5px;
  letter-spacing: .02em;
  text-transform: none;
  color: var(--ink-2);
}
.quest-col .quest-count { order: 1; }
.quest-list { display: grid; gap: 8px; }

.quest {
  --hue: 268;
  position: relative;
  display: grid;
  grid-template-columns: 44px 1fr auto;
  align-items: center;
  gap: 12px;
  padding: 11px 12px;
  border: 2px solid rgba(20, 14, 51, .9);
  border-radius: 16px;
  background:
    radial-gradient(90% 140% at 0% 50%, hsl(var(--hue) 85% 55% / .2), transparent 60%),
    linear-gradient(180deg, rgba(50, 38, 104, .55), rgba(24, 17, 58, .7));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .1), 0 3px 0 rgba(10, 6, 26, .85);
  overflow: hidden;
}
.quest-ico {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border: 2px solid rgba(20, 14, 51, .9);
  border-radius: 13px;
  background: linear-gradient(180deg, hsl(var(--hue) 90% 68%), hsl(var(--hue) 75% 44%));
  box-shadow: inset 0 2px 0 rgba(255, 255, 255, .45), 0 3px 0 hsl(var(--hue) 60% 22%);
  color: #fff;
}
.quest-ico svg {
  width: 24px;
  height: 24px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  filter: drop-shadow(0 1px 0 rgba(20, 14, 51, .7));
}
.quest-main { min-width: 0; }
.quest-name {
  margin: 0 0 7px;
  font-family: var(--font-display);
  font-size: 15.5px;
  line-height: 1.15;
  color: #fff;
}
.quest-bar {
  position: relative;
  height: 16px;
  border: 2px solid rgba(20, 14, 51, .9);
  border-radius: 999px;
  background: rgba(10, 6, 28, .8);
  overflow: hidden;
}
.quest-bar i {
  position: absolute;
  inset: 0 auto 0 0;
  border-radius: 999px;
  background: linear-gradient(90deg, hsl(var(--hue) 90% 50%), hsl(calc(var(--hue) + 30) 100% 68%));
  box-shadow: inset 0 2px 0 rgba(255, 255, 255, .45);
  transition: width .6s cubic-bezier(.2, .8, .2, 1);
}
.quest-bar span {
  position: relative;
  display: block;
  font-size: 10.5px;
  font-weight: 800;
  line-height: 12px;
  text-align: center;
  color: #fff;
  text-shadow: 0 1px 0 rgba(10, 6, 28, .9);
  font-variant-numeric: tabular-nums;
}
.quest-reward {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 5px 9px 5px 10px;
  border: 2px solid rgba(20, 14, 51, .9);
  border-radius: 999px;
  background: rgba(10, 6, 28, .55);
  font-family: var(--font-display);
  font-size: 15px;
  color: #ffe08a;
  white-space: nowrap;
}
.quest-reward svg {
  width: 15px;
  height: 15px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.2;
}
.quest-claim {
  position: relative;
  display: grid;
  justify-items: center;
  padding: 6px 12px 7px;
  border: 2px solid rgba(20, 14, 51, .9);
  border-radius: 13px;
  background: linear-gradient(180deg, #fff3a8, #ffd24a 45%, #ff9f1c);
  box-shadow: inset 0 2px 0 rgba(255, 255, 255, .8), 0 4px 0 #9a4a00, 0 10px 22px -10px rgba(255, 170, 40, .9);
  color: #3a1d00;
  font-family: var(--font-display);
  font-size: 12px;
  line-height: 1.05;
  cursor: pointer;
  overflow: hidden;
  animation: quest-nudge 2.4s ease-in-out infinite;
}
.quest-claim b { font-weight: 400; font-size: 17px; color: #7a2e00; }
.quest-claim::after {
  content: "";
  position: absolute;
  inset: -20% auto -20% -60%;
  width: 40%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, .85), transparent);
  transform: skewX(-20deg);
  animation: quest-shine 2.4s ease-in-out infinite;
}
.quest-claim:active { transform: translateY(3px); box-shadow: inset 0 2px 0 rgba(255,255,255,.7), 0 1px 0 #9a4a00; animation: none; }
.quest-claim:disabled { opacity: .6; animation: none; }
@keyframes quest-nudge {
  0%, 70%, 100% { transform: none; }
  78% { transform: translateY(-3px) rotate(-3deg); }
  86% { transform: translateY(0) rotate(2deg); }
  93% { transform: rotate(-1deg); }
}
@keyframes quest-shine {
  0%, 55% { transform: translateX(0) skewX(-20deg); }
  100% { transform: translateX(420%) skewX(-20deg); }
}

/* terminé, pas encore récupéré : la carte s'allume */
.quest.is-done {
  border-color: hsl(var(--hue) 90% 70% / .9);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .18), 0 3px 0 rgba(10, 6, 26, .85),
              0 0 0 3px hsl(var(--hue) 90% 60% / .25);
}
.quest.is-done .quest-ico { animation: quest-bob 1.8s ease-in-out infinite; }
@keyframes quest-bob {
  0%, 100% { transform: translateY(0) rotate(0); }
  50% { transform: translateY(-3px) rotate(-4deg); }
}

/* récupéré : en retrait, coché */
.quest.is-claimed { opacity: .6; }
.quest.is-claimed .quest-ico { filter: saturate(.35); }
.quest.is-claimed .quest-bar i { background: linear-gradient(90deg, #3fcf8e, #8af5c1); }
.quest-check {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border: 2px solid rgba(20, 14, 51, .9);
  border-radius: 50%;
  background: linear-gradient(180deg, #8af5c1, #1fb574);
  box-shadow: inset 0 2px 0 rgba(255, 255, 255, .55);
  color: #083d27;
}
.quest-check svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; }
.quest.is-just { opacity: 1; animation: quest-just .9s cubic-bezier(.3, 1.6, .5, 1); }
.quest.is-just .quest-check { animation: quest-stamp .6s cubic-bezier(.3, 1.8, .5, 1); }
@keyframes quest-just {
  0% { transform: scale(.96); }
  40% { transform: scale(1.03); }
  100% { transform: none; }
}
@keyframes quest-stamp {
  0% { transform: scale(2.4) rotate(-25deg); opacity: 0; }
  60% { transform: scale(.9) rotate(4deg); opacity: 1; }
  100% { transform: none; }
}

@media (max-width: 480px) {
  .quests { grid-template-columns: 1fr; }
  .quest { grid-template-columns: 40px 1fr auto; gap: 10px; padding: 10px; }
  .quest-ico { width: 40px; height: 40px; }
  .quest-name { font-size: 14.5px; }
}

.fx-lite .quest-claim::after,
.fx-lite .quest-ico svg { filter: none; }
.fx-lite .quest-claim::after { display: none; }
@media (prefers-reduced-motion: reduce) {
  .quest-claim, .quest-claim::after, .quest.is-done .quest-ico, .quest.is-just, .quest.is-just .quest-check { animation: none !important; }
}

/* Les missions marteau : un cadre doré, et le marteau en lot. */
.quest.is-hammer { border-color: rgba(255, 211, 106, .55); }
.quest.is-hammer .quest-ico { background: linear-gradient(180deg, #ffe08a, #f5a623); color: #5a3000; }
.quest-claim b svg, .quest-reward svg { fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.quest-claim b svg { width: 16px; height: 16px; vertical-align: -2px; margin-left: 2px; }
