@import url('https://fonts.googleapis.com/css2?family=Cinzel+Decorative:wght@700;900&family=Cinzel:wght@400;600&family=IM+Fell+English:ital@0;1&family=Crimson+Text:ital,wght@0,400;0,600;1,400&display=swap');

/* ===== VARIABLES ===== */
:root {
  --or:         #c9a84c;
  --or-light:   #f0d080;
  --dark:       #060b06;
  --surface:    #0d140d;
  --text:       #e8e0ce;
  --muted:      #7a8a6a;

  --commune-border: rgba(154,184,112,0.4);
  --commune-glow:   rgba(140,170,100,0.2);
  --commune-gem:    #9ab870;

  --rare-border: rgba(70,190,165,0.5);
  --rare-glow:   rgba(60,170,145,0.22);
  --rare-gem:    #46be9f;

  --legendaire-border: rgba(201,168,76,0.7);
  --legendaire-glow:   rgba(201,168,76,0.35);
  --legendaire-gem:    #c9a84c;
}

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

/* ===== BODY + FOND ===== */
body {
  background: var(--dark);
  color: var(--text);
  font-family: 'Crimson Text', Georgia, serif;
  min-height: 100vh;
  overflow-x: hidden;
}

body::before {
  content: '';
  position: fixed;
  inset: 0;
  background-image:
    radial-gradient(1px 1px at  8% 15%, rgba(200,230,150,0.28) 0%, transparent 100%),
    radial-gradient(1px 1px at 22% 72%, rgba(200,230,150,0.18) 0%, transparent 100%),
    radial-gradient(1px 1px at 45%  8%, rgba(255,255,255,0.22) 0%, transparent 100%),
    radial-gradient(1px 1px at 63% 88%, rgba(200,230,150,0.16) 0%, transparent 100%),
    radial-gradient(1px 1px at 78% 32%, rgba(255,255,255,0.20) 0%, transparent 100%),
    radial-gradient(1px 1px at 91% 60%, rgba(200,230,150,0.22) 0%, transparent 100%),
    radial-gradient(1px 1px at 35% 55%, rgba(255,255,255,0.13) 0%, transparent 100%),
    radial-gradient(1px 1px at 17% 42%, rgba(200,230,150,0.15) 0%, transparent 100%),
    radial-gradient(1px 1px at 82% 78%, rgba(255,255,255,0.18) 0%, transparent 100%),
    radial-gradient(2px 2px at 55% 40%, rgba(201,168,76,0.22) 0%, transparent 100%),
    radial-gradient(2px 2px at 18% 90%, rgba(201,168,76,0.16) 0%, transparent 100%),
    radial-gradient(ellipse 90% 50% at 50% 0%,   rgba(30,60,18,0.5)  0%, transparent 70%),
    radial-gradient(ellipse 70% 40% at 50% 100%, rgba(15,35,8,0.55)  0%, transparent 70%);
  pointer-events: none;
  z-index: 0;
}

/* ===== HEADER ===== */
header {
  position: relative;
  z-index: 1;
  text-align: center;
  padding: 2.5rem 1rem 1.5rem;
  border-bottom: 1px solid rgba(201,168,76,0.15);
  background: linear-gradient(to bottom, rgba(4,8,3,0.98), transparent);
}

.site-title {
  font-family: 'Cinzel Decorative', serif;
  font-size: clamp(1.6rem, 4vw, 2.8rem);
  font-weight: 700;
  color: var(--or-light);
  letter-spacing: 0.08em;
  text-shadow: 0 0 40px rgba(201,168,76,0.4), 0 2px 4px rgba(0,0,0,0.9);
}

.site-subtitle {
  font-family: 'IM Fell English', serif;
  font-style: italic;
  font-size: 0.82rem;
  letter-spacing: 0.22em;
  color: var(--muted);
  margin-top: 6px;
  text-transform: uppercase;
}

.ornement {
  color: var(--or);
  letter-spacing: 0.5em;
  font-size: 0.75rem;
  margin-bottom: 0.5rem;
  opacity: 0.5;
}

/* ===== NAV ===== */
nav {
  position: relative;
  z-index: 1;
  display: flex;
  justify-content: center;
  gap: 0.25rem;
  padding: 0.7rem 1rem;
  background: rgba(4,8,3,0.92);
  border-bottom: 1px solid rgba(201,168,76,0.1);
  backdrop-filter: blur(6px);
}

nav a {
  font-family: 'Cinzel', serif;
  font-size: 0.75rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--muted);
  text-decoration: none;
  padding: 0.5rem 1.5rem;
  border: 1px solid transparent;
  border-radius: 3px;
  transition: all 0.25s ease;
}

nav a:hover {
  color: var(--or);
  border-color: rgba(201,168,76,0.25);
  background: rgba(201,168,76,0.04);
}

nav a.active {
  color: var(--or-light);
  border-color: rgba(201,168,76,0.4);
  background: rgba(201,168,76,0.07);
  box-shadow: 0 0 16px rgba(201,168,76,0.07);
}

/* ===== FLASH ===== */
.flash-overlay {
  position: fixed;
  inset: 0;
  background: radial-gradient(ellipse at center, rgba(160,210,100,0.3), rgba(201,168,76,0.15) 45%, transparent 70%);
  opacity: 0;
  pointer-events: none;
  z-index: 25;
}

.flash-overlay.flash {
  animation: bigFlash 0.9s ease-out forwards;
}

@keyframes bigFlash {
  0%  { opacity: 0; }
  18% { opacity: 1; }
  100%{ opacity: 0; }
}

/* ===== ÉCRAN BOOSTER ===== */
#screen-pack {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2.5rem;
  padding: 2rem 1rem;
  transition: opacity 0.5s ease, transform 0.5s ease;
}

#screen-pack.hide {
  display: none;
  transform: scale(1.04);
  pointer-events: none;
}

/* ===== LE BOOSTER ===== */
.pack-wrapper {
  position: relative;
  width: 244px;
  height: 374px;
  cursor: pointer;
  transition: transform 0.3s ease;
}

.pack-wrapper:hover { transform: translateY(-7px) rotate(-1.5deg); }

.pack-wrapper:hover .pack-body {
  box-shadow:
    0 30px 80px rgba(0,0,0,0.85),
    0 0 50px rgba(201,168,76,0.18),
    0 0 100px rgba(80,140,50,0.10),
    inset 0 1px 0 rgba(255,255,255,0.10);
}

.pack-wrapper:hover .pack-shine { opacity: 0.75; }

.pack-body {
  position: absolute;
  inset: 0;
  border-radius: 12px;
  background: linear-gradient(165deg, #0d2009 0%, #162c0e 38%, #0a1807 65%, #050e04 100%);
  border: 1px solid rgba(201,168,76,0.32);
  box-shadow:
    0 20px 60px rgba(0,0,0,0.75),
    0 0 35px rgba(80,130,50,0.07),
    inset 0 1px 0 rgba(255,255,255,0.07);
  overflow: hidden;
  transition: box-shadow 0.3s ease;
}

.pack-body::before {
  content: '';
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse 80% 55% at 30% 22%, rgba(90,150,50,0.13) 0%, transparent 60%),
    radial-gradient(ellipse 55% 75% at 72% 78%, rgba(50,90,30,0.10) 0%, transparent 60%);
  border-radius: 12px;
}

.pack-body::after {
  content: '';
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(
    0deg, transparent, transparent 3px,
    rgba(255,255,255,0.01) 3px, rgba(255,255,255,0.01) 4px
  );
  border-radius: 12px;
}

.pack-shine {
  position: absolute;
  top: -40%; left: -40%;
  width: 180%; height: 180%;
  background: radial-gradient(ellipse at 38% 32%, rgba(255,255,255,0.055) 0%, transparent 55%);
  pointer-events: none;
  opacity: 0.32;
  transition: opacity 0.3s ease;
  border-radius: 50%;
}

.pack-tear {
  position: absolute;
  top: 20%; left: -2px; right: -2px;
  height: 1px;
  background: linear-gradient(90deg,
    transparent,
    rgba(201,168,76,0.48) 25%,
    rgba(255,228,120,0.78) 50%,
    rgba(201,168,76,0.48) 75%,
    transparent);
  opacity: 0.38;
}

.pack-emblem {
  position: absolute;
  top: 50%; left: 50%;
  transform: translate(-50%, -52%);
  width: 90px; height: 90px;
}

.pack-emblem svg {
  width: 100%; height: 100%;
  filter: drop-shadow(0 0 10px rgba(201,168,76,0.42));
}

.pack-label {
  position: absolute;
  bottom: 20px; left: 0; right: 0;
  text-align: center;
  font-family: 'Cinzel', serif;
  font-size: 0.625rem;
  letter-spacing: 0.24em;
  color: var(--or);
  text-transform: uppercase;
  opacity: 0.72;
}

.pack-count {
  position: absolute;
  top: 14px; left: 0; right: 0;
  text-align: center;
  font-family: 'Cinzel', serif;
  font-size: 1rem;
  letter-spacing: 0.17em;
  color: var(--muted);
}

.open-btn {
  background: linear-gradient(135deg, #182808, #2a4814, #182808);
  border: 1px solid var(--or);
  color: var(--or-light);
  font-family: 'Cinzel', serif;
  font-size: 0.68rem;
  letter-spacing: 0.25em;
  padding: 13px 38px;
  border-radius: 3px;
  cursor: pointer;
  text-transform: uppercase;
  transition: all 0.25s ease;
  box-shadow: 0 4px 20px rgba(201,168,76,0.10), inset 0 1px 0 rgba(255,255,255,0.07);
  position: relative;
  overflow: hidden;
}

.open-btn::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(255,255,255,0.04), transparent);
  opacity: 0;
  transition: opacity 0.25s;
}

.open-btn:hover {
  background: linear-gradient(135deg, #243c12, #3e6820, #243c12);
  box-shadow: 0 6px 30px rgba(201,168,76,0.22), 0 0 18px rgba(90,150,50,0.10);
  transform: translateY(-1px);
}

.open-btn:hover::before { opacity: 1; }
.open-btn:active { transform: translateY(0); }

/* ===== ÉCRAN CARTES ===== */
#screen-cards {
  inset: 0;
  padding-top: 128px; /* header + nav height */
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2rem;
  z-index: 10;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.5s ease;
  padding: 1rem;
}

#screen-cards.show {
  opacity: 1;
  pointer-events: all;
}

.cards-title {
  font-family: 'Cinzel', serif;
  font-size: 0.62rem;
  letter-spacing: 0.36em;
  color: var(--muted);
  text-transform: uppercase;
}

.cards-grid {
  display: flex;
  gap: 60px;
  justify-content: center;
  flex-wrap: wrap;
  max-width: 1020px;
}

/* ===== CARTE ===== */
.card {
  width: 244px;
  height: 374px;
  border-radius: 12px;
  position: relative;
  cursor: pointer;
  perspective: 900px;
  flex-shrink: 0;
  opacity: 0;
  transform: translateY(18px);
}

.card.enter { animation: cardEnter 0.48s ease forwards; }

@keyframes cardEnter {
  to { opacity: 1; transform: translateY(0); }
}

.card-inner {
  width: 100%;
  height: 100%;
  position: relative;
  transform-style: preserve-3d;
  transform: rotateY(180deg);
  transition: transform 0.7s cubic-bezier(0.34, 1.56, 0.64, 1);
  border-radius: 10px;
}

.card.revealed .card-inner {
  transform: rotateY(0deg) scale(1);
}

.card.revealed:hover .card-inner {
  transform: rotateY(0deg) scale(1.07) translateY(-5px);
}

/* DOS */
.card-back {
  position: absolute;
  inset: 0;
  border-radius: 10px;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  background: linear-gradient(165deg, #0d2009, #162c0e, #0a1807);
  border: 1px solid rgba(201,168,76,0.28);
  transform: rotateY(180deg);
  display: flex;
  align-items: center;
  justify-content: center;
}

.card-back-pattern {
  width: 56%;
  height: 56%;
  border: 1px solid rgba(201,168,76,0.32);
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* FACE */
.card-front {
  position: absolute;
  inset: 0;
  border-radius: 10px;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  border: 1px solid rgba(255,255,255,0.08);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  box-shadow: 0 8px 32px rgba(0,0,0,0.75);
}

.card-art {
  flex: 1;
  position: relative;
  overflow: hidden;
}

.card-art-placeholder {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 3rem;
}

.card-art img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.card-rarity-gem {
  position: absolute;
  top: 6px; right: 6px;
  width: 9px; height: 9px;
  border-radius: 50%;
  border: 1px solid rgba(255,255,255,0.22);
}

.card-info {
  padding: 8px 10px 9px;
  border-top: 1px solid rgba(255,255,255,0.06);
}

.card-nom {
  font-family: 'Cinzel', serif;
  font-size: 1.125rem;
  font-weight: 600;
  color: #fff;
  letter-spacing: 0.04em;
  overflow: hidden;
}

.card-latin {
  font-family: 'IM Fell English', serif;
  font-style: italic;
  font-size: 1rem;
  color: var(--muted);
  margin-top: 2px;
}

.card-resume {
  font-size: 0.75rem;
  color: rgba(232,224,206,0.58);
  margin-top: 4px;
  line-height: 1.35;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 5px;
}

.card-rarete-label {
  font-family: 'Cinzel', serif;
  font-size: 0.625rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.card-wiki-link {
  font-size: 0.625rem;
  color: var(--muted);
  text-decoration: none;
  transition: color 0.2s;
}
.card-wiki-link:hover { color: var(--or); }

/* ===== RARETÉS ===== */
.rarete-commune .card-front    { border-color: var(--commune-border); }
.rarete-commune .card-info     { background: rgba(12,22,8,0.88); }
.rarete-commune .card-rarity-gem  { background: var(--commune-gem); box-shadow: 0 0 6px var(--commune-gem); }
.rarete-commune .card-rarete-label { color: var(--commune-gem); }
.rarete-commune .card-art-placeholder { background: linear-gradient(145deg, #122010, #1e3318); }

.rarete-rare .card-front    { border-color: var(--rare-border); box-shadow: 0 8px 32px rgba(0,0,0,0.75), 0 0 18px var(--rare-glow); }
.rarete-rare .card-info     { background: rgba(5,18,15,0.90); }
.rarete-rare .card-rarity-gem  { background: var(--rare-gem); box-shadow: 0 0 8px var(--rare-gem); }
.rarete-rare .card-rarete-label { color: var(--rare-gem); }
.rarete-rare .card-art-placeholder { background: linear-gradient(145deg, #0a1e1c, #0f2e28); }

.rarete-legendaire .card-front { border-color: var(--legendaire-border); box-shadow: 0 8px 32px rgba(0,0,0,0.75), 0 0 28px var(--legendaire-glow); }
.rarete-legendaire .card-info  { background: rgba(28,18,4,0.92); }
.rarete-legendaire .card-rarity-gem { background: var(--legendaire-gem); box-shadow: 0 0 12px var(--legendaire-gem); }
.rarete-legendaire .card-rarete-label { color: var(--or-light); }
.rarete-legendaire .card-art-placeholder { background: linear-gradient(145deg, #1c1204, #2e1e08); }

/* Shimmer légendaire */
.rarete-legendaire .card-art::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(110deg,
    transparent 20%,
    rgba(255,220,80,0.10) 40%,
    rgba(255,255,160,0.16) 50%,
    rgba(255,220,80,0.10) 60%,
    transparent 80%);
  animation: shimmer 3.5s ease-in-out infinite;
  pointer-events: none;
}

@keyframes shimmer {
  0%,100% { opacity: 0.4; transform: translateX(-30%); }
  50%     { opacity: 1;   transform: translateX(30%); }
}

/* tooltip supprimé — spoile la rareté avant révélation */

/* ===== BOUTONS ===== */
.bottom-actions {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
  justify-content: center;
}

.action-btn {
  background: transparent;
  border: 1px solid rgba(201,168,76,0.28);
  color: var(--or);
  font-family: 'Cinzel', serif;
  font-size: 0.75rem;
  letter-spacing: 0.2em;
  padding: 10px 22px;
  border-radius: 3px;
  cursor: pointer;
  text-transform: uppercase;
  transition: all 0.2s ease;
  text-decoration: none;
  display: inline-block;
}

.action-btn:hover {
  background: rgba(201,168,76,0.07);
  border-color: var(--or);
  box-shadow: 0 0 14px rgba(201,168,76,0.12);
  color: var(--or-light);
}

.action-btn.primary {
  background: linear-gradient(135deg, #182808, #2a4814);
  border-color: var(--or);
  color: var(--or-light);
}

.action-btn.primary:hover {
  box-shadow: 0 4px 20px rgba(201,168,76,0.2), 0 0 14px rgba(80,140,40,0.10);
}

.btn-divider {
  width: 1px; height: 20px;
  background: rgba(201,168,76,0.16);
}

/* ===== PARTICULES ===== */
.particle {
  position: fixed;
  width: 4px; height: 4px;
  border-radius: 50%;
  pointer-events: none;
  z-index: 50;
  animation: particleFly var(--dur, 0.9s) ease-out forwards;
}

@keyframes particleFly {
  0%   { transform: translate(0,0) scale(1.2); opacity: 1; }
  100% { transform: translate(var(--tx),var(--ty)) scale(0); opacity: 0; }
}

/* ===== PAGE COLLECTION ===== */
main {
  position: relative;
  z-index: 1;
  max-width: 1060px;
  margin: 0 auto;
  padding: 3rem 1.5rem 5rem;
}

.collection-header {
  display: flex;
  align-items: baseline;
  gap: 1rem;
  margin-bottom: 2.5rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid rgba(201,168,76,0.12);
}

.collection-titre {
  font-family: 'Cinzel Decorative', serif;
  font-size: 1.5rem;
  color: var(--or-light);
  text-shadow: 0 0 30px rgba(201,168,76,0.25);
}

.collection-compteur {
  font-family: 'IM Fell English', serif;
  font-style: italic;
  color: var(--muted);
  font-size: 1rem;
}

.collection-grille {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.collection-card {
  width: 244px;
  aspect-ratio: 244/374;
  border-radius: 12px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  box-shadow: 0 6px 22px rgba(0,0,0,0.65);
  transition: transform 0.25s ease, box-shadow 0.25s ease;
  border: 1px solid rgba(255,255,255,0.06);
  justify-self: center;
}

.collection-card:hover { transform: translateY(-4px) scale(1.02); }

.rarete-commune.collection-card    { border-color: var(--commune-border); }
.rarete-rare.collection-card       { border-color: var(--rare-border); box-shadow: 0 6px 22px rgba(0,0,0,0.65), 0 0 14px var(--rare-glow); }
.rarete-legendaire.collection-card { border-color: var(--legendaire-border); box-shadow: 0 6px 22px rgba(0,0,0,0.65), 0 0 22px var(--legendaire-glow); }

.collection-card .card-art  { flex: 1; position: relative; overflow: hidden; }
.collection-card .card-info { padding: 8px 10px 9px; border-top: 1px solid rgba(255,255,255,0.06); }

.rarete-commune.collection-card .card-info    { background: rgba(12,22,8,0.92); }
.rarete-rare.collection-card .card-info       { background: rgba(5,18,15,0.92); }
.rarete-legendaire.collection-card .card-info { background: rgba(28,18,4,0.94); }

.card-slot {
  width: 244px;
  aspect-ratio: 244/374;
  justify-self: center;
  border-radius: 12px;
  border: 1px dashed rgba(201,168,76,0.10);
  background: rgba(255,255,255,0.012);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 5px;
  background: #343434;
}

.card-slot .slot-num {
  font-family: 'Cinzel', serif;
  font-size: 1rem;
  color: rgba(201,168,76,1);
  letter-spacing: 0.1em;
}

.card-slot .slot-txt {
  font-family: 'IM Fell English', serif;
  font-style: italic;
  font-size: 0.875rem;
  color: rgba(201,168,76,1);
  letter-spacing: 0.08em;
}

/* ===== FOOTER ===== */
footer {
  position: relative;
  z-index: 1;
  text-align: center;
  padding: 1.5rem;
  border-top: 1px solid rgba(201,168,76,0.07);
  font-family: 'IM Fell English', serif;
  font-style: italic;
  color: var(--muted);
  opacity: 0.4;
  font-size: 0.8rem;
}

/* ===== RESPONSIVE ===== */
@media (max-width: 700px) {
  .card { width: 160px; height: 245px; }
  .cards-grid { gap: 12px; }
  .collection-grille { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); }
  .collection-card, .card-slot { width: 100%; }
}