/* La ligne du bas (styles dans arcade-clean.css) ouvre le détail : un bouton invisible la couvre.
   Les gains de chaque défi (XP, coins) sont affichés dans le détail. */
.arcade-challenges-open {
  position: absolute; inset: 0; z-index: 1; min-height: 44px; pointer-events: auto;
  padding: 0; border: 0; border-radius: 0; background: none; box-shadow: none; cursor: pointer;
}
.arcade-home-body .arcade-challenges-open:is(:hover, :focus, .is-selected) { outline: none; border: 0; background: none; box-shadow: none; }
.arcade-challenges:has(.arcade-challenges-open:is(:hover, :focus-visible, .is-selected)) .arcade-challenges-title > span { color: var(--arc-mint); }
.arcade-challenges-list li { position: relative; }
.arcade-challenges-list .is-new, .challenge-objective.is-new { animation: challenge-clear 650ms steps(3) backwards; }

/* Défi réussi : la coche pixel (arcade-ui.css .pixel-icon) à la place du compte. Haute de 24 px,
   elle déborde de 4 px en haut et en bas plutôt que de grandir sa ligne : toutes les lignes gardent
   la hauteur du texte, et leurs jauges la même hauteur. */
.arcade-challenges-list .challenge-done-icon { margin-block: -4px; }
.arcade-challenges-list li.is-done > span { color: var(--arc-mint); opacity: .75; }
/* Juste validé : la coche tombe et rebondit en trois pas, comme un objet ramassé. */
.is-new > .challenge-done-icon, .challenge-objective.is-new > .challenge-objective-number { animation: challenge-badge-pop 420ms steps(1) backwards; }
@keyframes challenge-badge-pop {
  0% { transform: scale(0); }
  25% { transform: scale(1.5); }
  50% { transform: scale(.8); }
  75% { transform: scale(1.15); }
  100% { transform: none; }
}
/* Même colonne pour 01/02/03 et la coche : le titre ne se décale pas quand un défi est validé. */
.challenge-objective-number { min-width: 44px; text-align: center; }
@keyframes challenge-clear { from { filter: brightness(1.8); } to { filter: none; } }

/* Detail is available on demand, with the same console screen as the other menus. */
.arcade-home-body #arcade-panel-challenges .challenges-screen { display: grid; grid-template-rows: auto auto minmax(0, 1fr) auto; gap: round(2cqh, 4px); width: 100%; }
/* Like Options and Rejoindre: the cursor of Retour, against the right edge, breathes past it without
   making the screen scroll sideways. */
@media (min-width: 761px) {
  .arcade-home-body #arcade-panel-challenges .arcade-panel-inner { overflow: clip; overflow-clip-margin: 16px; }
}
.challenges-summary { display: flex; justify-content: space-between; align-items: center; gap: 12px; color: var(--screen-muted); font: clamp(14px, 2.8cqh, 22px)/1 'Jersey 15', sans-serif; letter-spacing: .03em; }
/* Jour / Semaine : les pastilles des rayons du Marchand (shop-arena.css), avec leur compteur. */
.challenges-tab-count { margin-left: .4em; }
.challenges-board { display: grid; grid-template-rows: repeat(3, minmax(0, 1fr)); padding: 0; margin: 0; list-style: none; min-height: 0; }
.challenge-objective { display: grid; grid-template-columns: auto minmax(0, 1fr) clamp(120px, 16cqw, 180px); gap: round(2.4cqw, 4px); align-items: center; padding-block: 2cqh; border-bottom: 1px solid var(--screen-line); }
.challenge-objective:last-child { border-bottom: 0; }
.challenge-objective-number { color: var(--screen-muted); font: clamp(24px, 6cqh, 44px)/1 'Jersey 15', sans-serif; }
.challenge-objective-content { display: grid; gap: round(1.4cqh, 4px); min-width: 0; }
.challenge-objective-tier { color: var(--screen-muted); font: clamp(11px, 2.2cqh, 16px)/1 'Jersey 15', sans-serif; letter-spacing: .03em; }
.challenge-objective-label { color: var(--screen-ink); font: clamp(18px, 4.2cqh, 32px)/1 'Jersey 15', sans-serif; font-weight: normal; }
.challenge-objective-bar { height: clamp(4px, .8cqh, 7px); background: var(--screen-raised); mask-image: repeating-linear-gradient(to right, #000 0 calc(10% - 3px), transparent calc(10% - 3px) 10%); }
.challenge-objective-bar i { display: block; height: 100%; background: var(--screen-accent); }
.challenge-objective-score { display: grid; justify-items: end; gap: round(1.6cqh, 4px); white-space: nowrap; }
.challenge-objective-xp { color: var(--screen-accent); font: clamp(19px, 4.2cqh, 32px)/1 'Jersey 15', sans-serif; font-weight: normal; }
/* Les coins s'écrivent partout pareil (boutique, fin de match) : la pièce, puis le montant dans l'accent. */
.challenge-coins { display: inline-flex; align-items: center; gap: 6px; color: var(--screen-accent); white-space: nowrap; }
.challenge-coins b { font-weight: normal; }
.challenge-objective-score .challenge-coins { font: clamp(19px, 4.2cqh, 32px)/1 'Jersey 15', sans-serif; }
/* La barre et son compteur sur une ligne. */
.challenge-objective-progress { display: flex; align-items: center; gap: round(2cqw, 4px); }
.challenge-objective-progress .challenge-objective-bar { flex: 1; min-width: 0; }
.challenge-objective-progress .challenge-objective-count { min-width: 3.2em; text-align: right; }

.challenge-objective-count { color: var(--screen-muted); font: clamp(14px, 2.8cqh, 21px)/1 'Jersey 15', sans-serif; }
.challenge-objective.is-done .challenge-objective-count { color: var(--screen-mint); }
.challenge-objective.is-done .challenge-objective-bar i { background: var(--screen-mint); }
.challenge-objective.is-done .challenge-objective-label { color: var(--screen-muted); }
.challenges-chest[hidden] { display: none; }
.challenges-chest { display: grid; gap: round(1.4cqh, 4px); padding-top: round(2cqh, 4px); border-top: 1px solid var(--screen-line); }
.challenges-chest-label { grid-column: 1 / -1; display: flex; justify-content: space-between; gap: 12px; font: clamp(15px, 3cqh, 22px)/1 'Jersey 15', sans-serif; color: var(--screen-muted); }
.challenges-chest-label strong { color: var(--screen-accent); font-weight: normal; }
/* Les 7 jours, puis le coffre au bout de la piste avec ce qu'il rapporte (XP, puis la pièce et ses coins). */
.challenges-chest-track { display: flex; align-items: center; gap: clamp(10px, 2cqw, 18px); }
.challenges-chest-days { flex: 1; min-width: 0; display: grid; grid-template-columns: repeat(7, 1fr); gap: 5px; }
/* Coffre de la semaine : une case par défi de la semaine. */
.challenges-chest-days.is-week { grid-template-columns: repeat(3, 1fr); }
.challenges-chest-goal { display: inline-flex; align-items: center; gap: clamp(8px, 1.4cqw, 12px); flex: none; }
.challenges-chest-icon { display: block; width: clamp(34px, 6.4cqh, 48px); height: auto; filter: drop-shadow(0 2px var(--screen-shadow)); }
.challenges-chest-reward { display: inline-flex; align-items: center; gap: 12px; font: clamp(16px, 3.2cqh, 24px)/1 'Jersey 15', sans-serif; white-space: nowrap; }
.challenges-chest-reward strong { color: var(--screen-accent); font-weight: normal; }
.challenges-chest-reward .challenge-coins { gap: 4px; }
/* Le coffre se rapproche : il saute un peu la veille de son ouverture. */
.challenges-chest.is-tomorrow .challenges-chest-icon { animation: chest-hop 1.4s steps(2) infinite; }
@keyframes chest-hop { 0%, 70%, 100% { translate: 0 0; } 80% { translate: 0 -3px; } 90% { translate: 0 1px; } }
@media (prefers-reduced-motion: reduce) { .challenges-chest-icon { animation: none !important; } }
.challenges-chest-days i { height: clamp(8px, 1.8cqh, 14px); background: var(--screen-raised); }
.challenges-chest-days .is-done { background: var(--screen-mint); }
.challenges-chest-next { color: var(--screen-muted); font: clamp(14px, 2.5cqh, 19px)/1 'Jersey 15', sans-serif; }
@media (max-width: 760px) {
  .arcade-home-body:has(#arcade-panel-challenges:not([hidden])) { overflow: auto; }
  .arcade-home-body .arcade-cabinet:has(#arcade-panel-challenges:not([hidden])) { min-height: calc(600px + 2 * var(--bezel) + 40px); }
  .arcade-home-body .arcade-cabinet:has(#arcade-panel-challenges:not([hidden])) :is(.arcade-attract, .arcade-bezel) {
    height: max(600px, calc(100dvh - 2 * var(--bezel) - 40px)); aspect-ratio: auto;
  }
  .arcade-home-body #arcade-panel-challenges .challenges-screen { gap: 16px; height: 100%; min-height: 0; overflow: hidden; }
  .challenges-board { display: grid; grid-template-rows: repeat(3, minmax(140px, 1fr)); overflow-y: auto; overscroll-behavior: contain; }
  .challenge-objective { grid-template-columns: 24px minmax(0, 1fr); gap: 12px; padding-block: 18px; }
  .challenge-objective-number { grid-row: 1 / 3; font-size: 28px; align-self: start; }
  .challenge-objective-score { grid-column: 2; display: flex; align-items: baseline; justify-content: space-between; }
  .challenge-objective-content { gap: 10px; }
  .challenge-objective-label { font-size: 23px; }
  .challenge-objective-tier { font-size: 12px; }
  .challenge-objective-xp { font-size: 23px; }
  .challenges-summary { font-size: 15px; }
  .challenges-chest-label { font-size: 17px; }
}
@media (prefers-reduced-motion: reduce) {
  .arcade-challenges-list .is-new, .challenge-objective.is-new, .challenge-done-icon { animation: none; }
}
