/* Pokémon cards: holo, tilt, foil sheen, catch burst and game accents.
   Files in css/ load in name order (index.html); later files win on equal selectors. */
/* ---------- Cards ---------- */
.card-grid { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 14px; }
@media (max-width: 1400px) { .card-grid { grid-template-columns: repeat(5, minmax(0, 1fr)); } }
@media (max-width: 1150px) { .card-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
@media (max-width: 900px) { .card-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 560px) { .card-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; } }

.pcard {
  --rx: 0deg; --ry: 0deg; --mx: 50%; --my: 50%;
  position: relative; display: flex; flex-direction: column; align-items: center; cursor: pointer; outline: none;
  padding: 14px 12px 16px; border-radius: var(--radius);
  background: var(--surface); border: 1px solid var(--border);
  /* Off-screen cards are skipped entirely until they scroll into view. */
  content-visibility: auto; contain-intrinsic-size: auto 250px;
  transition: transform .25s ease-out, border-color .2s;
}
/* Tilt only on the card under the pointer (class set from JS). */
.pcard.tilt { transform: perspective(900px) rotateX(var(--rx)) rotateY(var(--ry)); z-index: 2; }
.pcard:hover { border-color: var(--border-2); }
.pcard:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
.pcard.flash { animation: flash 1.2s ease-out; }
@keyframes flash { 0%, 40% { outline: 3px solid var(--brand); outline-offset: 3px; } }

.card-top { width: 100%; display: flex; align-items: center; gap: 6px; min-height: 22px; }
.no { font: 700 11px/1 var(--mono); color: var(--faint); letter-spacing: .02em; }
.form-tag {
  max-width: 100%; margin-top: 6px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  font: 700 9px/1 var(--mono); letter-spacing: .06em; text-transform: uppercase;
  padding: 4px 6px; border-radius: 6px; background: var(--surface-2); border: 1px solid var(--border); color: var(--muted);
}
.sprite { position: relative; width: 112px; height: 112px; margin: 14px 0 14px; display: grid; place-items: center; }
.sprite img { width: 100%; height: 100%; object-fit: contain; filter: var(--silhouette); transition: filter .35s, transform .35s; }
.pcard:hover .sprite img { filter: none; transform: scale(1.08); }
.nosprite { font-size: 36px; font-weight: 800; color: var(--faint); }
.pname { margin: 0; max-width: 100%; font-size: 15px; font-weight: 750; letter-spacing: -.02em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.types { display: flex; gap: 3px; justify-content: center; min-height: 18px; margin: 8px 0 4px; }
.types img { height: 16px; display: block; border-radius: 3px; }
.pcard:not(.on) .types { opacity: .55; transition: opacity .2s; }
.pcard:hover .types { opacity: 1; }

.form-tag.blank { visibility: hidden; }

.seal { flex: none; width: 22px; height: 22px; margin-left: auto; transform: scale(0) rotate(-90deg); transition: transform .45s cubic-bezier(.3, 1.6, .5, 1); }

/* Caught: holographic card */
.pcard.on {
  border: 1.5px solid transparent;
  background: var(--caught-bg) padding-box, var(--holo-conic) border-box;
  box-shadow: 0 10px 24px -18px color-mix(in srgb, var(--accent, #ff7ad9) 80%, transparent);
}
.pcard.on:hover { animation: spin 3s linear infinite; }
@keyframes spin { to { --spin: 360deg; } }
.pcard.on .sprite img { filter: none; }
.pcard.on .sprite::before {
  content: ""; position: absolute; inset: 8%; border-radius: 50%; z-index: -1;
  background: radial-gradient(circle, color-mix(in srgb, var(--accent, #ffd36e) 38%, transparent), transparent 68%);
}
.pcard.on .no { color: var(--text); }
.pcard.on .seal { transform: scale(1) rotate(0); }
/* Foil sheen that follows the pointer */
.pcard.on:hover::after {
  content: ""; position: absolute; inset: 0; border-radius: inherit; pointer-events: none; mix-blend-mode: soft-light;
  background:
    radial-gradient(circle at var(--mx) var(--my), rgba(255, 255, 255, .7), transparent 45%),
    repeating-linear-gradient(115deg, #ff7ad9 0 6%, #ffd36e 12%, #7afcff 18%, #9d7bff 24%, #ff7ad9 30%);
  background-size: 100% 100%, 300% 300%;
  background-position: center, var(--mx) var(--my);
  opacity: .55;
}

/* Catch burst */
.burst { position: fixed; width: 0; height: 0; z-index: 90; pointer-events: none; }
.burst svg { position: absolute; width: 14px; height: 14px; margin: -7px; animation: burst .75s cubic-bezier(.1, .8, .3, 1) forwards; }
@keyframes burst {
  0% { transform: translate(0, 0) scale(.2) rotate(0); opacity: 1; }
  100% { transform: translate(var(--dx), var(--dy)) scale(1) rotate(160deg); opacity: 0; }
}

/* Game accents on game pages */
.game-mode .pcard.on { background: var(--caught-bg) padding-box, conic-gradient(from var(--spin, 0deg), var(--accent), var(--accent2), #ffd36e, var(--accent)) border-box; }

.empty-state {
  display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 90px 20px; text-align: center;
  border: 1.5px dashed var(--border-2); border-radius: 28px; color: var(--muted); font-size: 16px; font-weight: 600;
}
.empty-state svg { width: 36px; height: 36px; opacity: .8; }
