* { box-sizing: border-box; }
:root {
  --bg: #fff8f4;
  --surface: #ffffff;
  --surface-2: #fff0f4;
  --line: #1b1720;
  --text: #17131b;
  --muted: #625968;
  --accent: #ef4b8b;
  --accent-2: #8f2b61;
  --violet: #7d4cff;
  --danger: #d63b3b;
  --yellow: #ffd43b;
}
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background:
    radial-gradient(circle at 15% 0%, rgba(239,75,139,.16), transparent 32%),
    radial-gradient(circle at 90% 15%, rgba(125,76,255,.12), transparent 30%),
    var(--bg);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
button { font: inherit; }
.app-shell { min-height: 100vh; }
.topbar {
  height: 76px; padding: 0 5vw; display: flex; align-items: center;
  justify-content: space-between; gap: 24px; border-bottom: 1px solid var(--line);
  background: rgba(255,248,244,.88); backdrop-filter: blur(14px);
  position: sticky; top: 0; z-index: 20;
}
.brand { display: flex; align-items: center; gap: 10px; min-width: 180px; }
.brand-mark {
  width: 38px; height: 38px; display: grid; place-items: center;
  border: 2px solid var(--text); color: var(--accent); font-weight: 1000; background: var(--yellow);
  transform: skew(-8deg);
}
.brand strong { display: block; letter-spacing: .08em; }
.brand span:last-child { display: block; color: var(--muted); font-size: 11px; margin-top: 1px; }
.nav-tabs { display: flex; gap: 4px; }
.nav-tab, .filter {
  border: 0; background: transparent; color: var(--muted); cursor: pointer;
  padding: 10px 14px; border-radius: 9px; transition: .2s ease;
}
.nav-tab:hover, .filter:hover { color: var(--text); background: var(--surface-2); }
.nav-tab.active { color: #fff; background: var(--text); }
.header-actions { min-width: 180px; display: flex; justify-content: flex-end; align-items: center; gap: 12px; }
.collection-count { color: var(--accent); font-size: 13px; font-weight: 700; }
.reset-btn {
  border: 2px solid var(--line); color: var(--text); background: transparent;
  border-radius: 8px; padding: 8px 10px; cursor: pointer; font-size: 11px;
}
.reset-btn:hover { border-color: var(--danger); color: var(--danger); }
main { width: min(1180px, 90vw); margin: 0 auto; }
.page { display: none; padding: 72px 0 100px; }
.page.active { display: block; }
.hero { max-width: 760px; margin-bottom: 58px; }
.eyebrow { color: var(--accent); font-size: 11px; letter-spacing: .18em; font-weight: 800; margin: 0 0 10px; }
h1 { font-size: clamp(50px, 8vw, 92px); line-height: .88; margin: 0 0 20px; letter-spacing: -.065em; text-transform: uppercase; text-wrap: balance; }
h2 { font-size: 28px; margin: 0; letter-spacing: -.03em; }
.hero-copy { color: var(--muted); line-height: 1.7; max-width: 650px; margin: 0; }
.pack-zone { min-height: 510px; display: flex; flex-direction: column; align-items: center; justify-content: center; }
.pack {
  width: 245px; height: 350px; border: 3px solid var(--text); border-radius: 10px;
  background:
    linear-gradient(135deg, rgba(239,75,139,.24), transparent 42%),
    linear-gradient(160deg, #201923, #100d14);
  box-shadow: 12px 14px 0 var(--text), 0 30px 80px rgba(28,15,25,.22);
  position: relative; overflow: hidden; display: flex; flex-direction: column;
  align-items: center; justify-content: center; transform: rotate(-3deg);
  transition: transform .35s, box-shadow .35s;
}
.pack:hover { transform: rotate(0deg) translateY(-8px); box-shadow: 15px 18px 0 var(--text), 0 38px 100px rgba(28,15,25,.25); }
.pack::before { content: ""; position: absolute; inset: 14px; border: 1px solid rgba(255,255,255,.08); border-radius: 12px; }
.pack-glow { position: absolute; width: 180px; height: 180px; background: rgba(232,255,91,.13); filter: blur(55px); }
.pack-logo { position: relative; font-size: 56px; font-weight: 1000; letter-spacing: .08em; color: white; }
.pack-sub { position: relative; margin-top: 8px; color: var(--accent); font-size: 11px; letter-spacing: .2em; }
.pack-seal { position: absolute; bottom: 27px; color: var(--accent); font-size: 22px; }
.primary-btn {
  margin-top: 28px; border: 2px solid var(--text); background: var(--accent); color: #fff; font-weight: 900;
  letter-spacing: .04em; border-radius: 10px; padding: 15px 22px; cursor: pointer;
  box-shadow: 6px 7px 0 var(--text); transition: .2s;
}
.primary-btn:hover { transform: translate(-2px,-2px); box-shadow: 9px 10px 0 var(--text); }
.primary-btn:disabled { opacity: .45; cursor: not-allowed; transform: none; }
.cooldown-label { color: var(--muted); font-size: 12px; min-height: 18px; }
.last-pack-section { margin-top: 20px; }
.hidden { display: none !important; }
.section-heading { display: flex; justify-content: space-between; align-items: end; margin-bottom: 25px; }
.result-summary { color: var(--muted); font-size: 12px; }
.pack-results { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 15px; }
.card {
  position: relative; border-radius: 8px; overflow: hidden; cursor: pointer;
  border: 2px solid var(--line); background: var(--surface); transition: transform .25s, border .25s, box-shadow .25s;
}
.card:hover { transform: translateY(-7px) rotate(-1deg); border-color: var(--accent); box-shadow: 8px 10px 0 rgba(23,19,27,.18); }
.card img { display: block; width: 100%; aspect-ratio: 5/7; object-fit: cover; background: #171b23; }
.card-info { padding: 11px; }
.card-number { color: var(--muted); font-size: 10px; }
.card-title { font-size: 13px; font-weight: 750; margin-top: 3px; line-height: 1.2; }
.card-meta { display: flex; justify-content: space-between; gap: 5px; margin-top: 8px; font-size: 9px; color: var(--muted); }
.card.rare { border-color: var(--violet); box-shadow: 0 0 0 2px rgba(125,76,255,.18), 0 12px 35px rgba(125,76,255,.18); animation: rareGlow 2.2s ease-in-out infinite; }
.card.rare::after { content: "RARE"; position: absolute; top: 8px; right: 8px; padding: 5px 7px; background: var(--violet); color: #fff; font-size: 8px; font-weight: 900; border-radius: 4px; }
.reveal { animation: reveal .55s cubic-bezier(.2,.8,.2,1) both; }
.rare-reveal { animation: reveal .55s cubic-bezier(.2,.8,.2,1) both, rareBurst 1.5s ease-out .25s 1, rareGlow 2.2s ease-in-out 1.75s infinite; }
@keyframes rareBurst { 0% { filter: brightness(1); box-shadow: 0 0 0 0 rgba(125,76,255,0); } 30% { filter: brightness(1.7); box-shadow: 0 0 0 12px rgba(125,76,255,.25), 0 0 70px rgba(239,75,139,.55); } 100% { filter: brightness(1); } }
.reveal:nth-child(2) { animation-delay: .08s; } .reveal:nth-child(3) { animation-delay: .16s; }
.reveal:nth-child(4) { animation-delay: .24s; } .reveal:nth-child(5) { animation-delay: .32s; } .reveal:nth-child(6) { animation-delay: .40s; }
@keyframes rareGlow { 0%,100% { box-shadow: 0 0 0 2px rgba(125,76,255,.16), 0 12px 35px rgba(125,76,255,.12); } 50% { box-shadow: 0 0 0 5px rgba(125,76,255,.28), 0 0 45px rgba(239,75,139,.32), 0 20px 55px rgba(125,76,255,.24); } }
@keyframes reveal { from { opacity: 0; transform: translateY(30px) rotateY(70deg) scale(.9); } to { opacity: 1; transform: none; } }
.catalog-head { display: flex; justify-content: space-between; align-items: end; gap: 30px; margin-bottom: 42px; }
.discovery { text-align: right; }
.discovery strong { display: block; font-size: 38px; color: var(--accent); letter-spacing: -.04em; }
.discovery span { color: var(--muted); font-size: 12px; }
.filters { display: flex; justify-content: space-between; gap: 18px; flex-wrap: wrap; padding: 14px; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; margin-bottom: 25px; }
.filter-group { display: flex; gap: 4px; flex-wrap: wrap; }
.filter.active { color: #fff; background: var(--text); font-weight: 800; }
.catalog-grid { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 18px; }
.unknown { cursor: default; }
.unknown:hover { transform: none; box-shadow: none; }
.unknown img { filter: grayscale(1) brightness(.18); }
.unknown .card-title { color: #606a7b; }
.unknown .card-info { background: #0d1016; }
.possessed { color: var(--accent); font-weight: 800; }
.modal {
  position: fixed; inset: 0; z-index: 50; display: grid; place-items: center;
  background: rgba(23,19,27,.86); backdrop-filter: blur(12px); padding: 30px;
}
.modal-close {
  position: fixed; top: 24px; right: 28px; width: 42px; height: 42px; border: 1px solid var(--line);
  border-radius: 50%; background: var(--surface); color: white; font-size: 25px; cursor: pointer;
}
#modal-card { width: min(390px, 82vw); }
#modal-card .card { cursor: default; }
#modal-card .card:hover { transform: none; }
.toast {
  position: fixed; left: 50%; bottom: 25px; transform: translate(-50%, 20px);
  background: #eef2f7; color: #111; padding: 12px 17px; border-radius: 9px; font-size: 13px;
  opacity: 0; pointer-events: none; transition: .25s; z-index: 80;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
@media (max-width: 900px) {
  .topbar { padding: 0 20px; } .header-actions { min-width: auto; } .reset-btn { display: none; }
  .pack-results { grid-template-columns: repeat(3, 1fr); }
  .catalog-grid { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 620px) {
  .topbar { height: auto; min-height: 70px; flex-wrap: wrap; padding: 12px 16px; }
  .brand { min-width: auto; } .header-actions { display: none; }
  .nav-tabs { order: 3; width: 100%; } .nav-tab { flex: 1; }
  main { width: min(92vw, 560px); }
  .page { padding-top: 45px; } .hero { margin-bottom: 25px; }
  h1 { font-size: 48px; }
  .pack { width: 210px; height: 300px; }
  .pack-zone { min-height: 430px; }
  .pack-results { grid-template-columns: repeat(2, 1fr); }
  .catalog-grid { grid-template-columns: repeat(2, 1fr); gap: 12px; }
  .catalog-head { align-items: start; flex-direction: column; }
  .discovery { text-align: left; }
  .discovery strong { font-size: 30px; }
  .filters { padding: 10px; }
}

/* Révélation cinématique plein écran */
body.reveal-active { overflow: hidden; }
.card-reveal-stage {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  overflow: hidden;
  background: #100d14;
  isolation: isolate;
}
.card-reveal-stage .reveal-backdrop {
  position: absolute;
  inset: -15%;
  background:
    radial-gradient(circle at 50% 48%, rgba(239,75,139,.20), transparent 28%),
    radial-gradient(circle at 50% 55%, rgba(125,76,255,.20), transparent 48%),
    #100d14;
  filter: saturate(1.1);
  animation: revealBackdrop 2.8s ease-in-out infinite;
}
.card-reveal-stage.rare-stage .reveal-backdrop {
  background:
    radial-gradient(circle at 50% 45%, rgba(255,212,59,.20), transparent 20%),
    radial-gradient(circle at 50% 50%, rgba(239,75,139,.34), transparent 38%),
    radial-gradient(circle at 50% 55%, rgba(125,76,255,.34), transparent 58%),
    #100d14;
}
.reveal-sparkles {
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: .6;
  background-image:
    radial-gradient(circle, rgba(255,255,255,.9) 0 1px, transparent 1.5px),
    radial-gradient(circle, rgba(255,212,59,.7) 0 1px, transparent 1.5px);
  background-size: 91px 113px, 137px 151px;
  animation: sparkleDrift 8s linear infinite;
}
.rare-stage .reveal-sparkles { opacity: .95; animation: sparkleDrift 3s linear infinite, sparklePulse 1.2s ease-in-out infinite; }
.reveal-card-wrap {
  position: relative;
  z-index: 3;
  width: min(68vw, 72vh, 680px);
  aspect-ratio: 5 / 7;
  filter: drop-shadow(0 35px 70px rgba(0,0,0,.45));
  cursor: pointer;
}
.reveal-card-wrap .card {
  width: 100%;
  height: 100%;
  border-width: 3px;
  border-radius: 16px;
  box-shadow: 18px 22px 0 rgba(0,0,0,.45), 0 0 80px rgba(239,75,139,.18);
  cursor: pointer;
}
.reveal-card-wrap .card img { height: 100%; aspect-ratio: auto; object-fit: cover; }
.reveal-card-wrap .card-info { position: absolute; left: 0; right: 0; bottom: 0; padding: 28px 26px; background: linear-gradient(transparent, rgba(10,8,13,.92)); color: #fff; }
.reveal-card-wrap .card-number, .reveal-card-wrap .card-meta { color: rgba(255,255,255,.72); }
.reveal-card-wrap .card-title { font-size: clamp(20px, 3vw, 34px); text-shadow: 0 3px 15px rgba(0,0,0,.5); }
.reveal-card-wrap.is-rare .card {
  border-color: var(--violet);
  box-shadow: 18px 22px 0 rgba(0,0,0,.42), 0 0 0 4px rgba(125,76,255,.28), 0 0 65px rgba(239,75,139,.58), 0 0 130px rgba(125,76,255,.5);
}
.reveal-card-wrap.play { animation: fullscreenCardIn .78s cubic-bezier(.14,.86,.2,1) both; }
.reveal-card-wrap.play.is-rare { animation: fullscreenCardIn .78s cubic-bezier(.14,.86,.2,1) both, fullscreenRareGlow 1.25s ease-in-out .2s infinite; }
.reveal-card-wrap.leave { animation: fullscreenCardOut .22s cubic-bezier(.7,0,1,.35) both; }
.reveal-caption {
  position: absolute;
  z-index: 4;
  left: 50%;
  bottom: 30px;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 14px;
  color: #fff;
  font-size: 11px;
  letter-spacing: .15em;
  text-transform: uppercase;
  text-align: center;
  white-space: nowrap;
}
.reveal-caption strong { color: var(--accent); }
.rare-stage .reveal-caption strong { color: var(--yellow); }
.reveal-skip {
  position: absolute;
  z-index: 5;
  right: 24px;
  bottom: 25px;
  border: 1px solid rgba(255,255,255,.35);
  background: rgba(255,255,255,.08);
  color: #fff;
  padding: 10px 14px;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: .08em;
  cursor: pointer;
  backdrop-filter: blur(8px);
}
.reveal-skip:hover { background: rgba(255,255,255,.16); }
.card-reveal-stage.closing .reveal-card-wrap { animation: fullscreenCardOut .3s ease-in both; }
@keyframes fullscreenCardIn {
  0% { opacity: 0; transform: perspective(1400px) translateY(65px) rotateX(18deg) rotateZ(-2deg) scale(.72); filter: brightness(.65) blur(4px); }
  45% { opacity: 1; filter: brightness(1.25) blur(0); }
  100% { opacity: 1; transform: perspective(1400px) translateY(0) rotateX(0) rotateZ(-1deg) scale(1); filter: brightness(1) blur(0); }
}
@keyframes fullscreenCardOut {
  from { opacity: 1; transform: scale(1) translateY(0); }
  to { opacity: 0; transform: scale(1.07) translateY(-25px); }
}
@keyframes fullscreenRareGlow {
  0%, 100% { filter: drop-shadow(0 35px 70px rgba(0,0,0,.45)); }
  50% { filter: drop-shadow(0 0 38px rgba(239,75,139,.8)) drop-shadow(0 0 95px rgba(125,76,255,.65)); }
}
@keyframes revealBackdrop { 0%,100% { transform: scale(1); opacity: .85; } 50% { transform: scale(1.06); opacity: 1; } }
@keyframes sparkleDrift { from { transform: translate3d(0,0,0) scale(1); } to { transform: translate3d(-45px,-65px,0) scale(1.04); } }
@keyframes sparklePulse { 0%,100% { opacity: .55; } 50% { opacity: 1; } }
@media (max-width: 620px) {
  .reveal-card-wrap { width: min(82vw, 72vh); }
  .reveal-card-wrap .card-info { padding: 20px 18px; }
  .reveal-caption { bottom: 20px; }
  .reveal-skip { right: 14px; bottom: 14px; }
}
@media (prefers-reduced-motion: reduce) {
  .reveal-card-wrap.play, .reveal-card-wrap.play.is-rare, .reveal-card-wrap.leave,
  .card-reveal-stage .reveal-backdrop, .reveal-sparkles { animation: none; }
}
