:root {
  --bg: #0a0a18;
  --bg2: #11112a;
  --ink: #f5f5ff;
  --muted: #a7a7c8;
  --common: #9aa3b2;
  --rare: #3da5ff;
  --epic: #b15bff;
  --legendary: #ffb02e;
  --mythic: #ff3d7f;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; }

body {
  font-family: "Outfit", system-ui, sans-serif;
  background: var(--bg);
  color: var(--ink);
  overflow-x: hidden;
}

/* ---------- HERO ---------- */
.hero {
  position: relative;
  height: 100vh;
  min-height: 600px;
  display: grid;
  place-items: center;
  overflow: hidden;
  background: radial-gradient(ellipse at 50% 20%, #2a1b4a 0%, #0a0a18 60%);
}
.hero-layer {
  position: absolute;
  inset: -20%;
  will-change: transform;
}
.stars {
  background-image:
    radial-gradient(2px 2px at 20% 30%, #fff, transparent),
    radial-gradient(2px 2px at 60% 70%, #fff, transparent),
    radial-gradient(1px 1px at 80% 20%, #fff, transparent),
    radial-gradient(1.5px 1.5px at 40% 80%, #fff, transparent),
    radial-gradient(1px 1px at 90% 60%, #fff, transparent),
    radial-gradient(2px 2px at 10% 60%, #fff, transparent),
    radial-gradient(1px 1px at 33% 15%, #fff, transparent),
    radial-gradient(1.5px 1.5px at 70% 40%, #fff, transparent);
  background-size: 100% 100%;
  opacity: 0.8;
}
.nebula {
  background:
    radial-gradient(circle at 30% 40%, rgba(177,91,255,0.35), transparent 40%),
    radial-gradient(circle at 75% 60%, rgba(61,165,255,0.3), transparent 45%),
    radial-gradient(circle at 50% 80%, rgba(255,61,127,0.25), transparent 40%);
  filter: blur(20px);
}
.glow {
  background: radial-gradient(circle at 50% 35%, rgba(255,176,46,0.12), transparent 35%);
}
.hero-content {
  position: relative;
  text-align: center;
  z-index: 2;
  padding: 1rem;
  animation: fadeUp 1s ease both;
}
.kicker {
  letter-spacing: 0.35em;
  text-transform: uppercase;
  font-size: 0.8rem;
  color: var(--legendary);
  margin-bottom: 1rem;
}
.hero-title {
  font-family: "Bangers", cursive;
  font-size: clamp(3rem, 12vw, 9rem);
  line-height: 0.92;
  letter-spacing: 0.02em;
  text-shadow: 0 0 30px rgba(177,91,255,0.6), 4px 4px 0 #ff3d7f;
  background: linear-gradient(180deg, #fff 0%, #ffd98a 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}
.hero-sub {
  margin-top: 1.2rem;
  font-size: clamp(1rem, 2.4vw, 1.6rem);
  color: var(--muted);
}
.hero-badge {
  display: inline-block;
  margin-top: 1.6rem;
  padding: 0.55rem 1.3rem;
  border: 2px solid var(--legendary);
  border-radius: 999px;
  font-weight: 800;
  letter-spacing: 0.12em;
  font-size: 0.8rem;
  color: var(--legendary);
  box-shadow: 0 0 24px rgba(255,176,46,0.35);
}
.scroll-hint {
  margin-top: 2.5rem;
  color: var(--muted);
  font-size: 0.85rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  animation: bob 1.6s ease-in-out infinite;
}

/* ---------- MARQUEE BAND ---------- */
.bandstrip {
  background: linear-gradient(90deg, #ff3d7f, #b15bff, #3da5ff);
  padding: 0.7rem 0;
  overflow: hidden;
  white-space: nowrap;
}
.band-track {
  display: inline-block;
  white-space: nowrap;
  animation: marquee 30s linear infinite;
  font-family: "Bangers", cursive;
  font-size: 1.3rem;
  letter-spacing: 0.05em;
}
.band-track span { padding: 0 1.5rem; opacity: 0.95; }

/* ---------- INTRO ---------- */
.intro { text-align: center; padding: 4rem 1.5rem 1rem; }
.section-title {
  font-family: "Bangers", cursive;
  font-size: clamp(2.2rem, 7vw, 4rem);
  letter-spacing: 0.03em;
}
.section-note { color: var(--muted); margin-top: 0.6rem; }
.legend { display: inline-flex; gap: 0.9rem; flex-wrap: wrap; justify-content: center; margin-top: 0.8rem; font-size: 0.8rem; width: 100%; }
.dot { width: 11px; height: 11px; border-radius: 50%; display: inline-block; margin-right: 0.25rem; vertical-align: middle; }
.dot.common { background: var(--common); }
.dot.rare { background: var(--rare); }
.dot.epic { background: var(--epic); }
.dot.legendary { background: var(--legendary); }
.dot.mythic { background: var(--mythic); }

/* ---------- GRID ---------- */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 1.8rem;
  max-width: 1200px;
  margin: 2rem auto 5rem;
  padding: 0 1.5rem;
}

/* ---------- CARD ---------- */
.card {
  perspective: 1200px;
  aspect-ratio: 3 / 4.4;
  cursor: pointer;
  opacity: 0;
  transform: translateY(40px);
  transition: opacity 0.6s ease, transform 0.6s ease;
}
.card.in { opacity: 1; transform: translateY(0); }

.card-inner {
  position: relative;
  width: 100%;
  height: 100%;
  transition: transform 0.7s cubic-bezier(0.4, 0.2, 0.2, 1);
  transform-style: preserve-3d;
}
.card.flipped .card-inner { transform: rotateY(180deg); }

.face {
  position: absolute;
  inset: 0;
  backface-visibility: hidden;
  border-radius: 18px;
  overflow: hidden;
  border: 3px solid var(--tier, #555);
  background: linear-gradient(160deg, #16162e, #0c0c1c);
  box-shadow: 0 12px 30px rgba(0,0,0,0.5), 0 0 24px var(--tierglow, transparent);
  display: flex;
  flex-direction: column;
}

/* FRONT */
.card-num {
  position: absolute; top: 8px; left: 12px; z-index: 3;
  font-family: "Bangers", cursive; font-size: 1.4rem;
  color: var(--tier); text-shadow: 0 1px 4px #000;
}
.rarity-tag {
  position: absolute; top: 10px; right: 10px; z-index: 3;
  font-size: 0.6rem; font-weight: 800; letter-spacing: 0.12em;
  text-transform: uppercase; padding: 3px 8px; border-radius: 999px;
  background: var(--tier); color: #0a0a18;
}
.photo-wrap {
  position: relative; flex: 1 1 auto; min-height: 180px; overflow: hidden;
  background: linear-gradient(160deg, #23234a, #14142c);
}
.photo-wrap img { width: 100%; height: 100%; object-fit: cover; display: block; }
.photo-wrap::after {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(180deg, transparent 55%, rgba(10,10,24,0.95));
}
.placeholder {
  width: 100%; height: 100%; display: grid; place-items: center;
  color: var(--tier); font-family: "Bangers", cursive;
}
.placeholder .ph-num { font-size: 3.4rem; line-height: 1; }
.placeholder .ph-txt { font-size: 0.8rem; letter-spacing: 0.2em; color: var(--muted); }
.front-text { position: relative; padding: 0.5rem 1rem 1rem; margin-top: -2.2rem; z-index: 2; }
.cname { font-family: "Bangers", cursive; font-size: 1.9rem; letter-spacing: 0.02em; }
.ctitle { color: var(--tier); font-weight: 700; font-size: 0.9rem; }
.flip-cue { margin-top: 0.4rem; font-size: 0.7rem; color: var(--muted); letter-spacing: 0.1em; text-transform: uppercase; }

/* BACK */
.back {
  transform: rotateY(180deg);
  padding: 1.1rem 1.1rem 1rem;
  justify-content: flex-start;
}
.back h3 { font-family: "Bangers", cursive; font-size: 1.6rem; color: var(--tier); }
.back .ctitle { margin-bottom: 0.5rem; }
.blurb { font-size: 0.82rem; color: #d9d9f0; line-height: 1.4; margin-bottom: 0.7rem; }
.tags { display: flex; flex-wrap: wrap; gap: 0.3rem; margin-bottom: 0.7rem; }
.tag { font-size: 0.62rem; padding: 2px 7px; border-radius: 999px; background: rgba(255,255,255,0.08); border: 1px solid rgba(255,255,255,0.12); }
.stats { margin-top: auto; }
.stat { margin-bottom: 0.35rem; }
.stat-row { display: flex; justify-content: space-between; font-size: 0.68rem; margin-bottom: 2px; }
.stat-bar { height: 6px; background: rgba(255,255,255,0.1); border-radius: 999px; overflow: hidden; }
.stat-fill { height: 100%; background: var(--tier); border-radius: 999px; width: 0; transition: width 0.9s ease; }
.flipped .stat-fill { /* width set inline */ }

/* OVER 100 — redlining */
.stat.redline .stat-row span:last-child {
  color: #ff2d2d;
  font-weight: 800;
  text-shadow: 0 0 8px rgba(255,45,45,0.9);
  animation: redblink 0.7s steps(1) infinite;
}
.stat.redline .stat-bar {
  box-shadow: 0 0 10px rgba(255,45,45,0.85);
}
.stat.redline .stat-fill {
  background: linear-gradient(90deg, var(--tier) 60%, #ff7a2d 80%, #ff2d2d 100%);
  animation: redpulse 0.6s ease-in-out infinite alternate;
}
@keyframes redblink { 0% { opacity: 1; } 50% { opacity: 0.45; } }
@keyframes redpulse {
  from { box-shadow: 0 0 4px rgba(255,45,45,0.6) inset; }
  to   { box-shadow: 0 0 12px rgba(255,45,45,1) inset; }
}

/* ---------- FOOTER ---------- */
.footer {
  position: relative; min-height: 60vh; overflow: hidden;
  display: grid; place-items: center; text-align: center;
  background: radial-gradient(ellipse at 50% 100%, #2a1b4a, #0a0a18 70%);
}
.footer-layer {
  position: absolute; inset: -20%;
  background-image:
    radial-gradient(2px 2px at 25% 40%, #fff, transparent),
    radial-gradient(1px 1px at 65% 70%, #fff, transparent),
    radial-gradient(1.5px 1.5px at 85% 30%, #fff, transparent),
    radial-gradient(1px 1px at 15% 75%, #fff, transparent);
  opacity: 0.6;
}
.footer-content { position: relative; z-index: 2; padding: 2rem; }
.footer-title {
  font-family: "Bangers", cursive; font-size: clamp(2.5rem, 9vw, 6rem);
  background: linear-gradient(90deg, #ff3d7f, #b15bff, #3da5ff);
  -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent;
}
.footer-content p { color: var(--muted); margin-top: 0.5rem; }
.footer-small { font-size: 0.8rem; margin-top: 1.4rem !important; }

/* ---------- ANIMATIONS ---------- */
@keyframes fadeUp { from { opacity: 0; transform: translateY(30px); } to { opacity: 1; transform: translateY(0); } }
@keyframes bob { 0%,100% { transform: translateY(0); } 50% { transform: translateY(8px); } }
@keyframes marquee { from { transform: translateX(0); } to { transform: translateX(-50%); } }

@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
  html { scroll-behavior: auto; }
}
