/* Microinteraccions: resposta en tocar, entrades suaus, finestres i avisos més vius.
   S'usa «scale»/«translate» (propietats independents) perquè no xafen els «transform» que ja tenen els botons. */
:root{--fx-ease:cubic-bezier(.2,.8,.2,1);--fx-spring:cubic-bezier(.34,1.56,.64,1)}

/* Botons: s'alcen un pèl en passar el ratolí i s'enfonsen en prémer */
button,.btn,a.start-btn,a.nv-all,.community-card{transition:scale .16s var(--fx-ease),translate .2s var(--fx-ease),filter .2s,box-shadow .2s,border-color .2s,background-color .2s,opacity .2s}
@media (hover:hover){
  button:not(:disabled):hover,.btn:hover,a.start-btn:hover{filter:brightness(1.08)}
  .guess-btn:not(:disabled):hover,.start-btn:not(:disabled):hover,.primary:not(:disabled):hover,.community-card:hover{translate:0 -2px}
}
button:not(:disabled):active,.btn:active,a.start-btn:active,a.nv-all:active,.community-card:active{scale:.96;translate:0 0;filter:brightness(.97);transition-duration:.06s}

/* Focus visible per a teclat */
:where(button,a,input,select,textarea,summary,[tabindex]):focus-visible{outline:3px solid var(--yellow,#ffd452);outline-offset:3px;border-radius:inherit}
:where(input,textarea,select):focus{box-shadow:0 0 0 4px rgba(255,212,82,.16);transition:box-shadow .2s}

/* Entrades escalonades dels blocs de la portada */
@keyframes fx-rise{from{opacity:0;translate:0 14px}to{opacity:1;translate:0 0}}
.hero,.home-countdown,.home-novetats:not([hidden]),.home-mosaic:not([hidden]),.home-podi:not([hidden]),.parelles-reward:not([hidden]){animation:fx-rise .55s var(--fx-ease) both}
.home-countdown{animation-delay:.06s}.home-novetats{animation-delay:.12s}.home-mosaic{animation-delay:.18s}.home-podi{animation-delay:.24s}.parelles-reward{animation-delay:.3s}

/* Panells que s'obrin (mosaic, agenda, comunitat) */
@keyframes fx-unfold{from{opacity:0;translate:0 -8px;scale:.985}to{opacity:1;translate:0 0;scale:1}}
.community-panel:not([hidden]){animation:fx-unfold .35s var(--fx-ease) both;transform-origin:top center}
details[open]>:not(summary){animation:fx-unfold .3s var(--fx-ease) both}
summary{transition:color .2s}

/* Finestres modals: apareixen amb un xicotet bot */
@keyframes fx-pop{from{opacity:0;scale:.92;translate:0 10px}to{opacity:1;scale:1;translate:0 0}}
@keyframes fx-fade{from{opacity:0}to{opacity:1}}
.modal-back.show{animation:fx-fade .22s ease both}
.modal-back.show .modal{animation:fx-pop .38s var(--fx-spring) both}

/* Avís flotant: entra amb rebot i brilla un instant */
.toast{transition:opacity .22s,transform .42s var(--fx-spring),box-shadow .4s;backdrop-filter:blur(6px)}
.toast.show{box-shadow:0 10px 30px rgba(0,0,0,.35),0 0 0 3px rgba(255,212,82,.35)}

/* Mosaic: barra de progrés amb lluentor i salt quan algú destapa una casella */
@keyframes fx-shine{from{background-position:-200% 0}to{background-position:200% 0}}
.mosaic-visual progress::-webkit-progress-value{background:linear-gradient(90deg,var(--yellow,#ffd452) 0%,#fff3b8 45%,var(--yellow,#ffd452) 60%);background-size:200% 100%;animation:fx-shine 2.6s linear infinite;transition:width .6s var(--fx-ease)}
.mosaic-visual progress::-moz-progress-bar{background:var(--yellow,#ffd452)}
@keyframes fx-bump{0%{scale:1}35%{scale:1.14;color:var(--yellow,#ffd452)}100%{scale:1}}
.fx-bump{display:inline-block;animation:fx-bump .7s var(--fx-spring)}
.mosaic-preview{transition:scale .3s var(--fx-spring),box-shadow .3s}
.mosaic-card:hover .mosaic-preview{scale:1.05;box-shadow:0 6px 18px rgba(0,0,0,.35)}
.mosaic-success,.mosaic-feedback.ok{animation:fx-pop .45s var(--fx-spring) both}
.mosaic-feedback.ko,.mosaic-feedback.err{animation:fx-shake .4s ease both}
@keyframes fx-shake{0%,100%{translate:0 0}20%{translate:-6px 0}40%{translate:6px 0}60%{translate:-4px 0}80%{translate:3px 0}}
.mosaic-steps li{animation:fx-rise .45s var(--fx-ease) both}
.mosaic-steps li:nth-child(2){animation-delay:.08s}.mosaic-steps li:nth-child(3){animation-delay:.16s}

/* Resultat i missatges que apareixen */
.result.show{animation:fx-pop .45s var(--fx-spring) both}

@media (prefers-reduced-motion:reduce){
  *,*::before,*::after{animation-duration:.01ms!important;animation-iteration-count:1!important;transition-duration:.01ms!important}
  button:active,.community-card:active{scale:1}
}
