/* ===== Pop-up « X a rempli votre offre ! » du Marché (js/marche_popup.js) =====
   Carte crème unie arrondie, sans contour, sous le bandeau (au-dessus de la barre du bas au téléphone). Rien autour n'arrête les clics. */
#mkp { --mkp-bg: #fdeecc; --mkp-band: #f7dc97; --mkp-ink: #3a2412; --mkp-soft: #6b4a28; --mkp-ok: #27602c; --mkp-row: rgba(214, 190, 140, .3); --mkp-bar: #d09a35;
  position: fixed; z-index: 900; left: 50%; top: calc(var(--sticky-h, 0px) + 12px); width: min(496px, calc(100vw / var(--page-zoom, 1) - 24px)); transform: translateX(-50%); pointer-events: none; }
html.dark-win #mkp { --mkp-bg: var(--dw-bg); --mkp-band: var(--dw-band); --mkp-ink: var(--dw-ink); --mkp-soft: var(--dw-ink-2); --mkp-ok: var(--dw-ok); --mkp-row: rgba(255, 226, 170, .08); --mkp-bar: var(--dw-accent); color-scheme: dark; }
html.tel #mkp { top: auto; bottom: calc(var(--nav-all) + 10px); width: calc(100vw - 16px - var(--sl) - var(--sr)); max-width: 480px; }
#mkp.mkp-wait { visibility: hidden; }
#mkp.mkp-wait .mkp-card { pointer-events: none; }
.mkp-live { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

.mkp-card { position: relative; pointer-events: auto; display: flex; flex-direction: column; max-height: calc((100dvh / var(--page-zoom, 1)) - var(--sticky-h, 0px) - 24px); overflow: hidden; border: 0; border-radius: 16px;
  background: var(--mkp-bg); color: var(--mkp-ink); font: 16px/1.25 var(--font-text); box-shadow: 0 10px 30px rgba(0, 0, 0, .5); transform-origin: 50% 0; animation: mkp-in .5s cubic-bezier(.2, 1.5, .4, 1) both; }
@media (max-width: 860px) { html:not(.tel) #mkp { top: 12px; } html:not(.tel) .mkp-card { max-height: calc(100dvh - 24px); } }
html.tel .mkp-card { max-height: calc(100dvh - var(--nav-all) - 20px); transform-origin: 50% 100%; }
.mkp-card.mkp-out { position: absolute; left: 0; right: 0; top: 0; pointer-events: none; animation: mkp-out .28s ease-in both; }
html.tel .mkp-card.mkp-out { top: auto; bottom: 0; }
.mkp-head { flex: none; display: grid; grid-template-columns: 34px minmax(0, 1fr) auto; align-items: center; gap: 10px; padding: 8px 12px; background: var(--mkp-band); }
.mkp-head > b { font: 19px/1.2 var(--font-title); color: var(--mkp-ink); }
html:not(.dark-win) .mkp-head .btn.close { filter: drop-shadow(0 2px 2px rgba(58, 36, 18, .6)); }
.mkp-sign { display: grid; place-items: center; width: 34px; height: 34px; animation: mkp-swing .9s .25s ease-in-out; transform-origin: 50% 0; }
.mkp-sign img.ui-ico { width: 34px; height: 34px; margin: 0; object-fit: contain; }
.mkp-list { flex: 0 1 auto; min-height: 0; overflow: auto; list-style: none; margin: 0; padding: 10px 10px 0; display: flex; flex-direction: column; gap: 8px; scrollbar-width: thin; }
.mkp-row { flex: none; display: grid; grid-template-columns: 50px minmax(0, 1fr) auto; align-items: center; gap: 10px; padding: 7px 12px 7px 8px; border-radius: 12px; background: var(--mkp-row); animation: mkp-row .42s calc(.16s + var(--i) * .09s) cubic-bezier(.2, 1.3, .4, 1) both; }
.mkp-face { width: 50px; height: 50px; border-radius: 50%; overflow: hidden; background: var(--mkp-band); animation: mkp-face .5s calc(.24s + var(--i) * .09s) cubic-bezier(.2, 1.7, .4, 1) both; }
.mkp-face img { display: block; width: 100%; height: 100%; object-fit: cover; object-position: 50% 0; }
.mkp-txt { min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.mkp-name { display: inline-block; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; vertical-align: bottom; font-weight: 700; }
.mkp-full .mkp-what { color: var(--mkp-ok); font-weight: 700; }
.mkp-txt small { display: grid; grid-template-columns: 22px minmax(0, 1fr); align-items: center; gap: 6px; font-size: 15px; line-height: 1.2; color: var(--mkp-soft); }
.mkp-txt small img, .mkp-gain img { width: 22px; height: 22px; margin: 0; object-fit: contain; vertical-align: -5px; }
/* Nombre jamais séparé de son signe */
.mkp-nw { white-space: nowrap; }
.mkp-gain { text-align: right; white-space: nowrap; font-size: 18px; animation: mkp-gain .5s calc(.45s + var(--i) * .09s) cubic-bezier(.2, 1.8, .4, 1) both; }
.mkp-gain img { width: 26px; height: 26px; vertical-align: -7px; }
.mkp-more { flex: none; display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 4px 12px; padding: 6px 12px; animation: mkp-row .42s calc(.16s + var(--i) * .09s) both; }
.mkp-sums { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 2px 12px; }
.mkp-sums > span { white-space: nowrap; }
.mkp-sums img { width: 20px; height: 20px; margin: 0; object-fit: contain; vertical-align: -4px; }
.mkp-foot { flex: none; display: flex; justify-content: center; padding: 10px 12px 14px; }
.mkp-time { position: absolute; left: 0; right: 0; bottom: 0; height: 4px; background: var(--mkp-bar); transform-origin: 0 50%; transition: transform .25s linear; }
/* Carte complétée pendant qu'elle est ouverte : pas de nouvelle entrée, un simple rebond */
.mkp-card.mkp-add { animation: mkp-bump .4s ease-out; }
.mkp-add .mkp-sign { animation: none; }

.mkp-coin { position: absolute; left: 50%; top: 18px; width: 22px; height: 22px; margin-left: -11px; background: url("../img/ui/or.png") center / contain no-repeat; opacity: 0; animation: mkp-coin 1.1s var(--d) cubic-bezier(.2, .7, .5, 1) both; }
html.tel .mkp-coin { top: -6px; }

@keyframes mkp-in { from { opacity: 0; transform: translateY(-34px) scale(.82); } }
html.tel .mkp-card:not(.mkp-add, .mkp-out) { animation-name: mkp-in-tel; }
@keyframes mkp-in-tel { from { opacity: 0; transform: translateY(40px) scale(.86); } }
@keyframes mkp-out { to { opacity: 0; transform: translateY(-16px) scale(.94); } }
@keyframes mkp-bump { 40% { transform: scale(1.03); } }
@keyframes mkp-row { from { opacity: 0; transform: translateX(-22px); } }
@keyframes mkp-face { from { transform: scale(0) rotate(-25deg); } }
@keyframes mkp-gain { from { opacity: 0; transform: scale(.4); } }
@keyframes mkp-swing { 0%, 100% { transform: rotate(0); } 25% { transform: rotate(16deg); } 55% { transform: rotate(-11deg); } 80% { transform: rotate(5deg); } }
@keyframes mkp-coin { 0% { opacity: 0; transform: translate(0, 0) scale(.5); } 15% { opacity: 1; } 55% { opacity: 1; transform: translate(calc(var(--x) * .8), var(--y)) scale(1) rotate(160deg); } 100% { opacity: 0; transform: translate(var(--x), 70px) scale(.8) rotate(380deg); } }
@media (max-width: 480px) {
  /* Gros gain : il passe sous le texte, à droite, plutôt que de couper le nom */
  .mkp-row { display: flex; flex-wrap: wrap; gap: 4px 8px; padding: 6px 10px 6px 6px; }
  .mkp-face { flex: none; }
  .mkp-txt { flex: 1 1 145px; }
  .mkp-gain { margin-left: auto; }
  .mkp-face { width: 44px; height: 44px; }
  .mkp-gain { font-size: 17px; }
}
/* Paysage (peu de hauteur) : la barre de navigation passe à gauche */
@media (orientation: landscape) and (max-height: 520px) {
  html.tel #mkp { left: calc(50% + (var(--nav-w) + var(--sl)) / 2); bottom: 10px; width: min(480px, calc(100vw - var(--nav-w) - var(--sl) - 24px)); }
  html.tel .mkp-card { max-height: calc(100dvh - 20px); }
}
@media (prefers-reduced-motion: reduce) {
  #mkp *, .mkp-card { animation: none !important; transition: none !important; }
}
