.cards-grid { 
  display: grid; 
  /* Ajustement de la hauteur min en vh pour compresser les cartes sans scroll */
  grid-template-columns: repeat(3, minmax(0, min(27vw, 13.5vh, 140px))); 
  justify-content: center; 
  gap: clamp(5px, 1.25vh, 12px) clamp(7px, 2vw, 18px); 
  align-items: start; 
}
.card-tile { position: relative; display: grid; gap: 0; min-width: 0; }

.card-stars { text-align: center; color: var(--yellow); text-shadow: 0 2px 0 rgba(11, 19, 50, 0.4); font-size: 1rem; margin-bottom: 3px; letter-spacing: 1px; }
.card-number-label { text-align: center; font-weight: 950; color: var(--navy); margin-top: 6px; font-size: 0.9rem; }

.card-image-wrapper { position: relative; }
.card-image-btn { position: relative; display: block; width: 100%; padding: 0; border-radius: 15px; background: transparent; box-shadow: none; }

.card-image-btn > img:not(.card-set-icon) { 
  display: block; 
  width: 100%; 
  aspect-ratio: 5 / 7; 
  object-fit: cover; 
  border-radius: 12px; 
  filter: saturate(1.04); 
}
.card-tile.missing .card-image-btn > img:not(.card-set-icon) { opacity: .48; filter: saturate(.7); }

.card-set-icon { 
  position: absolute; 
  top: -10px; 
  left: -10px; 
  width: clamp(28px, 7vw, 36px); 
  height: clamp(28px, 7vw, 36px); 
  border-radius: 50%; 
  border: 3px solid white; 
  background: var(--navy); 
  z-index: 10; 
  box-shadow: 0 3px 6px rgba(0,0,0,0.3); 
  object-fit: cover; 
}

.no-picture { 
  display: flex; 
  align-items: center; 
  justify-content: center; 
  text-align: center; 
  width: 100%; 
  aspect-ratio: 5 / 7; 
  background: #e0e5f0; 
  border-radius: 12px; 
  color: #6a7b9c; 
  font-size: 0.8rem; 
  font-weight: 800; 
  padding: 4px; 
  border: 2px dashed #aab5ce; 
  box-sizing: border-box; 
}

.missing-cover { position: absolute; inset: 13% 7% 11%; display: grid; place-items: end center; padding-bottom: 17%; border-radius: 18px; color: #70def0; background: linear-gradient(rgba(23, 167, 191, .80), rgba(31, 136, 172, .88)), repeating-linear-gradient(45deg, rgba(255,255,255,.10) 0 12px, transparent 12px 24px); border: 4px solid rgba(7, 49, 84, .6); box-shadow: inset 0 -18px 0 rgba(10, 54, 83, .36); font-size: clamp(.72rem, 3vw, 1rem); font-weight: 950; text-shadow: 0 2px 0 rgba(0,0,0,.25); }
.missing-cover.gold-cover { color: #ffd38a; background: linear-gradient(rgba(241, 153, 58, .80), rgba(206, 102, 41, .90)), repeating-linear-gradient(45deg, rgba(255,255,255,.12) 0 12px, transparent 12px 24px); border-color: rgba(152, 76, 24, .7); }

.owned-badge, .trade-badge, .gold-badge { position: absolute; z-index: 3; border: 3px solid #101833; border-radius: 12px; font-weight: 950; text-shadow: 0 2px 0 rgba(0,0,0,.25); }
.owned-badge { top: 52%; right: 7%; min-width: 40px; padding: 2px 6px; font-size: clamp(.68rem, 2vh, .86rem); color: white; background: #151d34; }
.trade-badge { right: 6%; bottom: 18%; padding: 3px 7px; color: var(--navy); background: #fff; font-size: .72rem; text-shadow: none; }
.gold-badge { left: 7%; top: 10%; padding: 3px 8px; color: #6a3700; background: linear-gradient(180deg, #fff3a4, #ffc759); text-shadow: none; font-size: clamp(.58rem, 1.7vh, .74rem); }

.card-controls { position: absolute; z-index: 5; left: 50%; bottom: 2.5%; transform: translateX(-50%); width: 78%; min-height: 24px; margin: 0; padding: 2px 4px; border-width: 3px; border-radius: 999px; background: var(--cream); border: 4px solid var(--navy); box-shadow: 0 3px 0 rgba(23,35,69,.22); display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 4px; }
.card-controls button { display: grid; place-items: center; width: clamp(19px, 3.6vh, 26px); height: clamp(19px, 3.6vh, 26px); border-radius: 999px; color: white; background: var(--purple); font-size: clamp(.85rem, 2.8vh, 1.05rem); font-weight: 950; }
.card-controls strong { min-width: 18px; text-align: center; font-size: clamp(.75rem, 2.5vh, .95rem); }

.autosave-pill { display: inline-flex; align-items: center; min-height: 26px; padding: 4px 9px; border-radius: 999px; border: 3px solid var(--navy); color: var(--navy); background: rgba(255, 255, 255, .9); font-size: .72rem; font-weight: 950; box-shadow: 0 3px 0 rgba(23,35,69,.18); }
.autosave-pill.saving, .autosave-pill.pending { background: #fff1a8; }
.autosave-pill.saved { background: #d9ffe5; }

@media (max-width: 700px) {
  .cards-grid { grid-template-columns: repeat(3, minmax(0, min(29vw, 13vh, 126px))); gap: clamp(4px, 1vh, 9px) clamp(4px, 1.5vw, 10px); }
  .card-controls { width: 82%; padding: 2px 3px; }
  .trade-badge { display: none; }
  .owned-badge { min-width: 44px; font-size: .82rem; }
  .gold-badge { font-size: .68rem; }
}

@media (max-width: 420px) {
  .cards-grid { grid-template-columns: repeat(3, minmax(0, min(30vw, 12.5vh, 116px))); }
  .card-controls { width: 86%; gap: 1px; padding: 3px; }
  .card-controls button { width: 24px; height: 24px; font-size: 1rem; }
  .autosave-pill { font-size: .64rem; min-height: 22px; padding: 3px 7px; border-width: 2px; }
  .missing-cover { border-width: 3px; font-size: .65rem; }
  .no-picture { font-size: 0.65rem; }
}

