/* Le memory du village : la page du jeu (la logique est dans jeu.js) */
.jeu-h{padding:clamp(104px,11vw,128px) 0 4px;text-align:center}
.jeu-h h1{font-size:clamp(44px,5.4vw,76px);line-height:1}
.jeu-h .lead{max-width:56ch;margin:12px auto 0;font-size:clamp(18px,1.6vw,21px)}
.mem{padding:26px 0 clamp(60px,8vw,100px);position:relative;z-index:2}
.mem .wrap{max-width:880px}

/* la barre : niveau, compteurs, nouvelle partie */
.mem-barre{display:flex;flex-wrap:wrap;align-items:center;justify-content:center;gap:12px 18px;margin-bottom:22px}
.mem-niv{display:flex;gap:6px;background:#F6F0E6;border:1px solid #E8DFD0;border-radius:12px;padding:5px}
.mem-niv button{min-height:56px;padding:6px 16px;border-radius:9px;display:flex;flex-direction:column;align-items:center;justify-content:center;line-height:1.15;color:#2A2520;cursor:pointer;transition:background .2s,color .2s}
.mem-niv b{font-size:18px;font-weight:700}
.mem-niv small{font-size:14px;color:#5A4E44}
.mem-niv button:hover{background:#fff}
.mem-niv button[aria-pressed="true"]{background:#8B4A23;color:#fff}
.mem-niv button[aria-pressed="true"] small{color:#F6F0E6}
.mem-stats{display:flex;gap:8px;margin:0}
.mem-stats div{min-width:84px;min-height:56px;padding:6px 12px;border:1px solid #E8DFD0;border-radius:12px;text-align:center;background:#fff;display:flex;flex-direction:column;justify-content:center}
.mem-stats dt{font-size:13px;font-weight:700;letter-spacing:.06em;text-transform:uppercase;color:#5A4E44}
.mem-stats dd{margin:0;font-size:22px;font-weight:800;color:#2A2520;font-variant-numeric:tabular-nums;line-height:1.1}
.mem-nouv{height:56px;font-size:17px}
.mem-nouv svg{fill:none;stroke:currentColor;stroke-width:2.4;stroke-linecap:round;stroke-linejoin:round}
.mem button:focus-visible,.mem a:focus-visible,.mem-fiche a:focus-visible,.mem-fiche button:focus-visible{outline:3px solid #8B4A23;outline-offset:3px}

/* la grille : 4 colonnes sur ordinateur, 3 sur téléphone */
.mem-grille{list-style:none;margin:0 auto;padding:0;display:grid;grid-template-columns:repeat(4,1fr);gap:14px;max-width:680px}
.mem-grille.n8{max-width:640px}
.mem-grille li{aspect-ratio:1;min-width:0}
.mem-grille[hidden],.mem-fin[hidden],.mem-vide[hidden]{display:none}

/* une carte : un bouton qui se retourne en 3D */
.mc{display:block;width:100%;height:100%;padding:0;border-radius:12px;perspective:900px;cursor:pointer;-webkit-tap-highlight-color:transparent;touch-action:manipulation}
.mc-in{position:relative;display:block;width:100%;height:100%;transform-style:preserve-3d;transition:transform .55s cubic-bezier(.2,.8,.2,1)}
.mc.vue .mc-in{transform:rotateY(180deg)}
.mc-dos,.mc-face{position:absolute;inset:0;border-radius:12px;overflow:hidden;-webkit-backface-visibility:hidden;backface-visibility:hidden}
.mc-dos{display:flex;flex-direction:column;align-items:center;justify-content:center;gap:4px;background-color:#F6F0E6;border:2px solid #E8DFD0;color:#8B4A23;
  background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='44' height='44' viewBox='0 0 64 64'%3E%3Cg fill='%238B4A23' fill-opacity='.09'%3E%3Cellipse cx='32' cy='44' rx='11' ry='9'/%3E%3Ccircle cx='17' cy='33' r='5'/%3E%3Ccircle cx='26' cy='24' r='5'/%3E%3Ccircle cx='38' cy='24' r='5'/%3E%3Ccircle cx='47' cy='33' r='5'/%3E%3C/g%3E%3C/svg%3E");
  background-size:44px 44px;box-shadow:0 10px 22px -16px rgba(58,33,16,.55);transition:border-color .2s}
.mc-dos::before{content:"";position:absolute;inset:7px;border:1.5px solid rgba(139,74,35,.28);border-radius:7px;pointer-events:none}
.mc-dos svg{width:38%;max-width:62px;height:auto;fill:#8B4A23}
.mc-dos b{font-family:'Caveat Brush',cursive;font-weight:400;font-size:clamp(15px,1.9vw,20px);line-height:1;text-align:center;padding:0 8px;color:#5B3417}
.mc:hover .mc-dos{border-color:#8B4A23}
.mc-face{transform:rotateY(180deg);background:#fff;border:2px solid #E8DFD0;box-shadow:0 10px 22px -16px rgba(58,33,16,.55)}
.mc-face img{position:absolute;inset:0;width:100%;height:100%;object-fit:cover}
.mc-nom{position:absolute;left:0;right:0;bottom:0;padding:18px 8px 7px;background:linear-gradient(transparent,rgba(30,18,8,.78));color:#fff;font-weight:700;font-size:18px;line-height:1.1;text-align:center;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.mc-tag{position:absolute;top:7px;left:7px;background:#8B4A23;color:#fff;font-style:normal;font-weight:700;font-size:13px;line-height:1;padding:6px 8px;border-radius:7px}
.mc-ok{position:absolute;top:7px;right:7px;width:30px;height:30px;border-radius:50%;background:#fff;border:2px solid #8B4A23;display:none;align-items:center;justify-content:center}
.mc-ok svg{width:16px;height:16px;fill:none;stroke:#8B4A23;stroke-width:3;stroke-linecap:round;stroke-linejoin:round}
.mc.trouvee{cursor:default}
.mc.trouvee .mc-face{border:3px solid #8B4A23}
.mc.trouvee .mc-ok{display:flex}

.mem-vide{text-align:center;font-size:19px;color:#5A4E44;padding:30px 0}
.mem-annonce{position:absolute;width:1px;height:1px;overflow:hidden;clip:rect(0 0 0 0);white-space:nowrap}
.mem-cale{height:0}

/* la petite fiche du chien retrouvé, posée en bas de l'écran : elle ne bloque pas le jeu */
.mem-fiche{position:fixed;left:50%;bottom:12px;z-index:950;width:min(760px,calc(100% - 24px));transform:translate(-50%,0);
  background:#fff;border:1px solid #E8DFD0;border-radius:12px;box-shadow:0 24px 60px -24px rgba(58,33,16,.55);padding:14px 64px 14px 14px;
  display:grid;grid-template-columns:110px 1fr auto;gap:18px;align-items:center;transition:transform .45s cubic-bezier(.2,.8,.2,1),opacity .3s}
.mem-fiche[hidden]{display:none}
.mem-fiche.part{transform:translate(-50%,24px);opacity:0}
.mf-img{width:110px;height:110px;border-radius:10px;object-fit:cover;display:block;background:#F6F0E6}
.mf-txt{min-width:0}
.mf-k{font-size:14px;font-weight:700;letter-spacing:.06em;text-transform:uppercase;color:#8B4A23}
.mf-nom{font-family:'Caveat Brush',cursive;font-weight:400;font-size:34px;line-height:1;color:#2A2520;margin:2px 0}
.mf-info{font-size:18px;line-height:1.35;color:#2A2520}
.mf-info span{color:#5A4E44}
.mf-act{display:flex;flex-direction:column;gap:8px}
.mf-act .btn{height:56px;font-size:17px;padding:0 22px;justify-content:center}
.mf-x{position:absolute;top:8px;right:8px;width:48px;height:48px;border-radius:10px;font-size:28px;line-height:1;color:#5B3417;display:flex;align-items:center;justify-content:center;cursor:pointer}
.mf-x:hover{background:#F6F0E6}

/* la fin de partie, à la place de la grille */
.mem-fin{text-align:center;background:#F6F0E6;border:1px solid #E8DFD0;border-radius:12px;padding:clamp(24px,4vw,40px) clamp(16px,4vw,40px);outline:none}
.mem-fin h2{font-size:clamp(36px,4.6vw,56px);line-height:1.05;color:#5B3417}
.mem-fin .mfin-sc{font-size:20px;margin-top:12px;color:#2A2520}
.mem-fin .mfin-rec{font-size:17px;margin-top:6px;color:#5A4E44}
.mem-fin .mfin-rec.nouveau{color:#8B4A23;font-weight:700}
.mfin-t{font-size:18px;font-weight:700;margin:24px 0 12px;color:#2A2520}
.mfin-liste{list-style:none;margin:0;padding:0;display:grid;grid-template-columns:repeat(auto-fill,minmax(118px,1fr));gap:12px}
.mfin-liste a{display:block;background:#fff;border:1px solid #E8DFD0;border-radius:12px;overflow:hidden;color:#2A2520;text-align:center;transition:border-color .2s,transform .25s}
.mfin-liste a:hover{border-color:#8B4A23;transform:translateY(-2px)}
.mfin-liste img{display:block;width:100%;aspect-ratio:1;object-fit:cover}
.mfin-liste b{display:block;font-size:17px;padding:8px 6px 2px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.mfin-liste small{display:block;font-size:14px;color:#5A4E44;padding:0 6px 10px}
.mfin-liste small.dispo{color:#8B4A23;font-weight:700}
.mfin-act{display:flex;flex-wrap:wrap;gap:12px;justify-content:center;margin-top:26px}
.mfin-act .btn{height:60px;font-size:18px;padding:0 30px;justify-content:center}
.mfin-act svg{fill:none;stroke:currentColor;stroke-width:2.4;stroke-linecap:round;stroke-linejoin:round}

@media(max-width:700px){
  .mem .wrap{width:calc(100% - 24px)}
  .mem-barre{gap:10px;margin-bottom:16px}
  .mem-niv{width:100%}
  .mem-niv button{flex:1;padding:6px 6px}
  .mem-stats{width:100%}
  .mem-stats div{flex:1;min-width:0}
  .mem-nouv{width:100%;justify-content:center}
  .mem-grille,.mem-grille.n8{grid-template-columns:repeat(3,1fr);gap:9px}
  .mc-nom{font-size:16px;padding:16px 4px 6px}
  .mc-tag{font-size:12px;padding:5px 6px;top:5px;left:5px}
  .mc-ok{width:26px;height:26px;top:5px;right:5px}
  .mem-fiche{grid-template-columns:76px 1fr;gap:12px;padding:12px;bottom:8px;width:calc(100% - 16px)}
  .mf-txt{padding-right:40px}
  .mf-img{width:76px;height:76px}
  .mf-nom{font-size:30px}
  .mf-info{font-size:17px}
  .mf-act{grid-column:1 / -1;flex-direction:row}
  .mf-act .btn{flex:1;padding:0 12px;justify-content:center}
  .mfin-act .btn{width:100%}
  .mfin-liste{grid-template-columns:repeat(3,1fr);gap:8px}
  .mfin-liste b{font-size:16px}
}
@media(prefers-reduced-motion:reduce){
  .mc-in{transition:none}
  .mem-fiche,.mfin-liste a,.mc-dos{transition:none}
}

/* la fête du chien de la race, dans la fiche et à la fin */
.mf-fete{position:absolute;right:54px;top:-58px;width:92px;height:92px;pointer-events:none;opacity:0;transform:translateY(16px) scale(.7);transition:opacity .35s,transform .55s cubic-bezier(.2,.9,.25,1.3)}
.mf-fete.on{opacity:1;transform:none}
.mfin-chien{width:150px;height:150px;margin:0 auto 4px;opacity:0;transform:scale(.6);transition:opacity .4s,transform .7s cubic-bezier(.2,.9,.25,1.3)}
.mfin-chien.on{opacity:1;transform:none}
@media(max-width:700px){.mf-fete{width:72px;height:72px;top:-46px;right:44px}.mfin-chien{width:120px;height:120px}}
@media(prefers-reduced-motion:reduce){.mf-fete,.mfin-chien{transition:none}}
