/* ═══════════════════════ GeoTCG — styles ═══════════════════════ */

@property --mx { syntax: '<percentage>'; inherits: true; initial-value: 50%; }
@property --my { syntax: '<percentage>'; inherits: true; initial-value: 50%; }
@property --angle { syntax: '<angle>'; inherits: false; initial-value: 0deg; }

:root {
  --bg: #060a17;
  --panel: rgba(17, 25, 54, 0.72);
  --panel-solid: #111936;
  --line: rgba(140, 165, 255, 0.16);
  --text: #e9edf8;
  --muted: #8e9abf;
  --accent: #5ad1ff;
  --accent2: #8f6bff;
  --gold: #ffc53d;
  --rainbow: linear-gradient(90deg, #ff5f6d, #ffc371, #fff95b, #5bff95, #5be7ff, #7a5bff, #ff5bf1);

  --holo-rainbow: repeating-linear-gradient(115deg,
      #ff7773 0%, #ffed5f 5%, #a8ff5f 10%, #83fff7 15%, #7894ff 20%, #d875ff 25%, #ff7773 30%);
  --holo-stripes: repeating-linear-gradient(65deg,
      #0e152e 0%, #8fa3a3 2.5%, #b6e3e3 4%, #8fa3a3 5.5%, #0e152e 8%, #0e152e 11%);

  color-scheme: dark;
  font-family: 'Space Grotesk', system-ui, -apple-system, 'Segoe UI', sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
/* Pas de liseré de sélection au toucher (mobile) ; le focus clavier reste visible */
* { -webkit-tap-highlight-color: transparent; }
:focus:not(:focus-visible) { outline: none; }
body {
  color: var(--text);
  background:
    radial-gradient(1100px 650px at 12% -10%, #1b2b6b 0%, transparent 60%),
    radial-gradient(900px 600px at 110% 110%, #3b1659 0%, transparent 55%),
    var(--bg);
  background-attachment: fixed;
  overflow-x: hidden;
}
body.no-scroll { overflow: hidden; }
#bg { position: fixed; inset: 0; z-index: -1; pointer-events: none; }
#bg svg { width: 100%; height: 100%; }
#fx { position: fixed; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 100; }
button { font: inherit; color: inherit; }
code { background: rgba(255,255,255,.08); padding: .1em .4em; border-radius: 4px; }
.muted { color: var(--muted); }
.small { font-size: .85em; }
.center { text-align: center; }
.accent { color: var(--accent); }
.rainbow-text {
  background: var(--rainbow); background-size: 200% 100%;
  -webkit-background-clip: text; background-clip: text; color: transparent;
  animation: textflow 4s linear infinite; font-weight: 600;
}
@keyframes textflow { to { background-position: 200% 0; } }

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 18px;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

/* ───────────── Barre du haut ───────────── */
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap;
  padding: 12px clamp(16px, 3vw, 36px);
  background: rgba(6, 10, 23, 0.72);
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; flex-direction: column; gap: 4px; }
.brand-version { font-size: 11px; line-height: 1; color: var(--muted); letter-spacing: .04em; }
.brand-version:empty { display: none; }
.brand h1 { margin: 0; font-size: 30px; font-weight: 400; line-height: 1; }
.brand h1 .logo { color: #fff; }
.brand h1 .l-tcg { background: linear-gradient(90deg, #5ad1ff, #8f6bff); -webkit-background-clip: text; background-clip: text; color: transparent; }

/* — Logo GeoTCG — */
.logo { display: inline-flex; align-items: center; gap: .3em; font-family: 'Outfit', 'Space Grotesk', system-ui, sans-serif; line-height: 1; white-space: nowrap; }
.logo-word { letter-spacing: -.01em; }
.logo-word .l-geo { font-weight: 300; }
.logo-word .l-tcg { font-weight: 700; letter-spacing: .03em; }
.tabs { display: flex; gap: 6px; background: rgba(255,255,255,.04); border: 1px solid var(--line); border-radius: 999px; padding: 4px; }
.tab { border: 0; background: transparent; padding: 8px 18px; border-radius: 999px; cursor: pointer; color: var(--muted); font-weight: 600; transition: .2s; }
.tab:hover { color: var(--text); }
.tab.active { background: linear-gradient(135deg, var(--accent), var(--accent2)); color: #071022; box-shadow: 0 4px 18px rgba(90, 209, 255, .3); }
.tab-badge { font-size: 11px; background: rgba(0,0,0,.25); padding: 2px 7px; border-radius: 99px; margin-left: 4px; }
.hud { display: flex; align-items: center; gap: 12px; color: var(--muted); font-weight: 600; }
.icon-btn {
  width: 38px; height: 38px; border-radius: 50%; border: 1px solid var(--line); background: rgba(255,255,255,.05);
  cursor: pointer; display: grid; place-items: center; font-size: 16px; transition: .2s;
}
.icon-btn:hover { background: rgba(255,255,255,.12); transform: scale(1.06); }

.btn {
  border: 1px solid var(--line); background: rgba(255,255,255,.07); padding: 11px 22px; border-radius: 12px;
  font-weight: 600; cursor: pointer; transition: transform .15s, box-shadow .2s, background .2s;
}
.btn:hover { background: rgba(255,255,255,.13); transform: translateY(-1px); }
.btn:disabled { opacity: .45; pointer-events: none; }
.btn.primary {
  border: 0; color: #061022;
  background: linear-gradient(135deg, #5ad1ff, #8f6bff 60%, #ff5fd2); background-size: 200% 100%;
  box-shadow: 0 6px 22px rgba(143, 107, 255, .35);
}
.btn.primary:hover { background-position: 100% 0; box-shadow: 0 8px 30px rgba(143, 107, 255, .55); }
.btn.ghost { background: transparent; }
.btn.small { padding: 7px 14px; font-size: 13px; border-radius: 10px; }

/* ───────────── Compte ───────────── */
.auth { position: fixed; inset: 0; z-index: 60; display: grid; place-items: center; padding: 16px; background: rgba(3, 6, 16, .72); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); }
.auth[hidden] { display: none; }
.auth-card { width: min(380px, 100%); padding: 24px; display: flex; flex-direction: column; gap: 14px; background: var(--panel-solid); }
.auth-card h2 { margin: 0; font-family: 'Outfit', 'Space Grotesk', system-ui, sans-serif; font-weight: 700; font-size: 26px; }
#auth-fields { display: flex; flex-direction: column; gap: 12px; }
#auth-fields[hidden] { display: none; }
.auth-card label { display: flex; flex-direction: column; gap: 6px; color: var(--muted); font-size: 13px; }
.auth-card input {
  padding: 11px 14px; border-radius: 12px; border: 1px solid var(--line); background: rgba(0,0,0,.25);
  color: var(--text); font: inherit; font-size: 16px; outline: none;
}
.auth-card input:focus { border-color: var(--accent); }
.auth-error { margin: 0; min-height: 1.3em; color: #ff8a8a; font-size: 14px; }
.auth-actions { display: flex; gap: 10px; }
.auth-actions .primary { flex: 1; }
.auth-switch { align-self: flex-start; border: 0; background: none; padding: 0; color: var(--accent); cursor: pointer; font: inherit; font-size: 14px; }
.auth-switch:hover { text-decoration: underline; }

main { padding: 28px clamp(16px, 3vw, 36px) 80px; max-width: 1480px; margin: 0 auto; }
.view { display: none; }
.view.active { display: block; animation: fadeup .4s ease; }
@keyframes fadeup { from { opacity: 0; transform: translateY(10px); } }

/* ───────────── Boutique ───────────── */
.hero { text-align: center; margin: 10px auto 34px; max-width: 760px; }
.hero h2 { font-family: 'Outfit', 'Space Grotesk', system-ui, sans-serif; font-weight: 700; letter-spacing: -.01em; font-size: clamp(26px, 4vw, 40px); margin: 0 0 10px; }
.hero p { color: var(--muted); font-size: 17px; line-height: 1.5; margin: 0; }

.packs { display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 24px; }
.booster { padding: 26px 22px 22px; text-align: center; display: flex; flex-direction: column; align-items: center; gap: 4px; position: relative; overflow: hidden; }
.booster::before {
  content: ''; position: absolute; inset: -40% -20% auto; height: 70%; z-index: -1; opacity: .5; filter: blur(40px);
  background: radial-gradient(closest-side, var(--glow, #5ad1ff), transparent);
}
.booster.theme-helvetia { --glow: #e3262f; }
.booster.theme-orbis { --glow: #1f6fd6; }
.booster.theme-triangulation { --glow: #22935b; }
.booster.theme-sommet { --glow: #8e44ff; }
.booster.premium { border-color: rgba(255, 215, 106, .45); }
.booster.premium::after {
  content: 'PREMIUM'; position: absolute; top: 16px; right: -34px; transform: rotate(40deg);
  background: linear-gradient(90deg, #ffd76a, #fff3c4, #c8962e); color: #3a2600; font-size: 11px; font-weight: 700;
  letter-spacing: .15em; padding: 4px 40px;
}
.booster h3 { font-family: 'Outfit', 'Space Grotesk', system-ui, sans-serif; font-weight: 700; margin: 18px 0 0; font-size: 22px; }
.booster .tagline { margin: 0; color: var(--accent); font-weight: 600; font-size: 14px; }
.booster .desc { color: var(--muted); font-size: 14px; line-height: 1.45; margin: 8px 0 10px; flex: 1; }
.booster-meta { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; margin-bottom: 14px; font-size: 12px; }
.booster-meta span { border: 1px solid var(--line); border-radius: 99px; padding: 3px 10px; }

.odds { margin-top: 34px; padding: 22px 24px; }
.odds h3 { margin: 0 0 4px; font-family: 'Outfit', 'Space Grotesk', system-ui, sans-serif; font-weight: 700; }
.odds p { margin: 0 0 14px; font-size: 14px; }
.table-wrap { overflow-x: auto; }
.odds table { width: 100%; border-collapse: collapse; font-size: 14px; min-width: 620px; }
.odds th, .odds td { padding: 9px 10px; text-align: center; border-bottom: 1px solid var(--line); }
.odds th:first-child, .odds td:first-child { text-align: left; font-weight: 600; }
.odds th { font-weight: 600; font-size: 13px; }
.rarity-legend { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 16px; }
.leg, .rstat {
  display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border-radius: 99px; font-size: 13px;
  border: 1px solid color-mix(in srgb, var(--rc) 50%, transparent); background: color-mix(in srgb, var(--rc) 10%, transparent);
}
.leg b, .rstat b { color: var(--rc); text-shadow: 0 0 8px var(--rc); }
.leg em, .rstat em { font-style: normal; color: var(--muted); }
.leg.r-M b, .rstat.foil-stat b { background: var(--rainbow); -webkit-background-clip: text; background-clip: text; color: transparent; }
.rstat.foil-stat { --rc: #8af7ff; }

/* ───────────── Boosters (visuel) ───────────── */
.pack {
  --pw: 180px; --prx: 0deg; --pry: 0deg; --pmx: 50%;
  width: var(--pw); aspect-ratio: 220 / 340; position: relative; cursor: pointer; flex: none;
  transform: perspective(800px) rotateX(var(--prx)) rotateY(var(--pry));
  transition: transform .25s ease-out;
  filter: drop-shadow(0 18px 26px rgba(0, 0, 0, .55));
}
.booster:hover .pack { transform: perspective(800px) rotateX(var(--prx)) rotateY(var(--pry)) translateY(-8px) scale(1.03); }
.pack-layer { position: absolute; inset: 0; border-radius: 7px; overflow: hidden; }
.pack-layer > svg { position: absolute; inset: 0; width: 100%; height: 100%; }
.crimp {
  position: absolute; left: 0; right: 0; height: 6%;
  background: repeating-linear-gradient(90deg, rgba(255,255,255,.35) 0 2px, rgba(0,0,0,.3) 2px 4px);
  mix-blend-mode: overlay;
}
.crimp.t { top: 0; } .crimp.b { bottom: 0; }
.pack-label {
  position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: flex-start;
  padding: 33% 8% 12%; text-align: center; /* % de la largeur : le logo passe sous la ligne de déchirure (13–15,5 % de la hauteur) */ color: #fff; text-shadow: 0 2px 8px rgba(0,0,0,.6);
}
.pack-brand { font-size: calc(var(--pw) * .13); line-height: 1; display: flex; flex-direction: column; align-items: center; }
.pack-brand small { display: block; font-family: 'Space Grotesk', sans-serif; font-size: .38em; letter-spacing: .3em; opacity: .85; margin-top: .4em; text-transform: uppercase; }
.pack-name { font-family: 'Outfit', 'Space Grotesk', system-ui, sans-serif; font-weight: 700; font-size: calc(var(--pw) * .125); line-height: 1.05; letter-spacing: -.01em; margin-top: auto; margin-bottom: .45em; }
.pack-sub { font-size: calc(var(--pw) * .06); letter-spacing: .18em; text-transform: uppercase; opacity: .9; }
.pack-shine {
  position: absolute; inset: 0; mix-blend-mode: overlay;
  background: linear-gradient(110deg, transparent 35%, rgba(255,255,255,.7) 48%, transparent 60%);
  background-size: 280% 100%; animation: packshine 3.8s ease-in-out infinite;
}
.pack-holo {
  position: absolute; inset: 0; mix-blend-mode: color-dodge; opacity: .22;
  background-image: var(--holo-rainbow); background-size: 300% 300%; background-position: var(--pmx) 50%;
}
.theme-sommet .pack-holo { opacity: .4; }
@keyframes packshine { 0% { background-position: 130% 0; } 45%, 100% { background-position: -30% 0; } }
.tear-light {
  position: absolute; left: -5%; right: -5%; top: 13.5%; height: 3px; opacity: 0; border-radius: 3px;
  background: #fff; box-shadow: 0 0 20px 8px rgba(255, 240, 200, .9), 0 0 60px 20px rgba(160, 220, 255, .6);
}

.pack.big { --pw: min(280px, 62vw); }
.pack.floating { animation: float 3s ease-in-out infinite; }
.pack.big:hover { transform: perspective(800px) rotateX(var(--prx)) rotateY(var(--pry)) scale(1.04); }
@keyframes float { 50% { translate: 0 -14px; } }
.pack.shaking { animation: packshake .7s ease-in both; }
.pack.shaking .tear-light { animation: tearglow .7s ease-in forwards; }
@keyframes packshake {
  0%, 100% { translate: 0 0; rotate: 0deg; }
  10% { translate: -4px 0; rotate: -2deg; } 20% { translate: 5px 0; rotate: 2deg; }
  30% { translate: -6px 0; rotate: -3deg; } 40% { translate: 7px 0; rotate: 3deg; }
  50% { translate: -8px 2px; rotate: -4deg; } 60% { translate: 8px -2px; rotate: 4deg; }
  70% { translate: -9px 0; rotate: -4deg; } 80% { translate: 9px 0; rotate: 5deg; } 90% { translate: -6px 0; rotate: -3deg; }
}
@keyframes tearglow { to { opacity: 1; } }
.pack.torn .tear-light { opacity: 1; animation: tearfade .6s forwards; }
.pack.torn .pack-top { animation: tearoff .7s cubic-bezier(.3, .6, .4, 1) forwards; }
.pack.torn .pack-main { animation: packdrop .6s .3s cubic-bezier(.6, 0, .8, .4) forwards; }
@keyframes tearoff { to { transform: translate(45%, -160%) rotate(32deg); opacity: 0; } }
@keyframes packdrop { to { transform: translateY(90vh) rotate(-8deg); opacity: 0; } }
@keyframes tearfade { 0% { opacity: 1; transform: scaleX(1.2); } 100% { opacity: 0; transform: scaleX(2); } }

/* ═══════════════════════ CARTES ═══════════════════════ */
.card {
  --w: 220px; --rx: 0deg; --ry: 0deg; --hyp: 0;
  width: var(--w); aspect-ratio: 5 / 7; font-size: calc(var(--w) / 25);
  position: relative; flex: none; perspective: 70em; isolation: isolate;
  user-select: none; -webkit-user-select: none; cursor: pointer;
}
.card .tilt {
  position: absolute; inset: 0; transform-style: preserve-3d;
  transform: rotateX(var(--rx)) rotateY(var(--ry));
  transition: transform .6s cubic-bezier(.2, .9, .2, 1);
}
.card.hovering .tilt { transition: transform .1s linear; }
.card.hovering { z-index: 4; }
.card .inner {
  position: absolute; inset: 0; transform-style: preserve-3d;
  transition: transform .8s cubic-bezier(.35, 1.45, .45, 1);
}
.card.facedown .inner { transform: rotateY(180deg); }
.face {
  position: absolute; inset: 0; border-radius: 1.2em; overflow: hidden;
  backface-visibility: hidden; -webkit-backface-visibility: hidden;
  box-shadow: 0 .9em 2.2em rgba(0, 0, 0, .55), 0 0 0 .05em rgba(0,0,0,.6);
}
.face.back { transform: rotateY(180deg); background: #0a1230; }
.back-img { position: absolute; inset: 0; width: 100%; height: 100%; display: block; -webkit-user-drag: none; }
.back-logo { position: absolute; inset: 0; display: grid; place-items: center; pointer-events: none; }
.back-logo .logo { flex-direction: column; gap: .3em; font-size: 3.5em; color: #ffe2a0; filter: drop-shadow(0 0 .25em rgba(255, 200, 100, .35)); }
.back-logo .l-tcg { background: linear-gradient(180deg, #fff1c8, #e0a948); -webkit-background-clip: text; background-clip: text; color: transparent; }

/* — Recto — */
.front { background: var(--frame); padding: .75em; display: flex; }
.body {
  position: relative; flex: 1; display: flex; flex-direction: column; border-radius: .65em; overflow: hidden;
  background: linear-gradient(170deg, color-mix(in srgb, var(--tc) 40%, #121a33) 0%, #0e1426 55%, color-mix(in srgb, var(--tc) 18%, #0b1020) 100%);
  box-shadow: inset 0 0 0 .08em rgba(255, 255, 255, .14), inset 0 0 1.5em rgba(0,0,0,.4);
}
.head { display: flex; align-items: center; gap: .45em; padding: .45em .7em .35em; min-height: 2.9em; }
.name {
  flex: 1; min-width: 0; font-family: Cinzel, Georgia, serif; font-weight: 700; font-size: 1.15em; line-height: 1.05;
  color: #fff; text-shadow: 0 .08em .2em rgba(0, 0, 0, .7);
}
.name.long { font-size: 1em; }
.name.xlong { font-size: .86em; }
.gem { flex: none; font-size: 1.35em; line-height: 1; color: var(--rc); text-shadow: 0 0 .4em var(--rc), 0 0 .1em #000; }
.art {
  position: relative; margin: 0 .55em; height: 18.5em; border-radius: .35em; overflow: hidden; flex: none;
  box-shadow: 0 0 0 .12em rgba(0, 0, 0, .7), 0 0 0 .24em color-mix(in srgb, var(--tc) 55%, rgba(255,255,255,.25));
}
.art > svg { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.art-photo { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; display: block; background: #0d1426; -webkit-user-drag: none; }
.art.has-photo::after { /* léger vignettage pour fondre la photo dans le cadre */
  content: ''; position: absolute; inset: 0; pointer-events: none;
  box-shadow: inset 0 0 2.2em rgba(0, 0, 0, .45);
}
.type-name { display: inline-flex; align-items: center; gap: .5em; }
.type-dot { width: .7em; height: .7em; border-radius: 50%; background: var(--tc); box-shadow: 0 0 .5em var(--tc); flex: none; }
.typeline {
  display: flex; justify-content: space-between; align-items: center; gap: .4em; margin: .5em .55em 0; padding: .25em .5em;
  font-size: .78em; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: #f1f4ff;
  border-radius: .3em; background: rgba(0, 0, 0, .38); border: .08em solid color-mix(in srgb, var(--tc) 55%, transparent);
}
.region { padding: .1em .45em; border-radius: .25em; font-size: .9em; letter-spacing: .06em; }
.region-CH { background: #d52b1e; color: #fff; }
.region-MO { background: #2b6fd5; color: #fff; }
.text {
  position: relative; z-index: 2; /* au-dessus des reflets holo : reste lisible */
  flex: 1; min-height: 0; margin: .4em .55em 0; padding: .5em .65em; border-radius: .35em;
  background: linear-gradient(175deg, #f8f4ea, #ece5d4); color: #1d2233;
  font-size: 1.14em; line-height: 1.35; display: flex; align-items: center; overflow: hidden;
  box-shadow: inset 0 0 0 .08em rgba(0,0,0,.15);
}
.text.snug { font-size: 1.06em; }
.desc { margin: 0; }
.foot { display: flex; justify-content: space-between; align-items: center; gap: .4em; padding: .38em .6em .45em; font-size: .7em; color: rgba(255, 255, 255, .78); }
.no { white-space: nowrap; font-weight: 700; letter-spacing: .05em; }
.foot-rar { color: var(--rc); font-weight: 700; text-shadow: 0 0 .5em color-mix(in srgb, var(--rc) 60%, transparent); white-space: nowrap; }
.r-M .foot-rar { background: var(--rainbow); -webkit-background-clip: text; background-clip: text; color: transparent; }

/* — Cadres par rareté — */
.r-C { --frame: linear-gradient(150deg, #5d6671, #2b3038 55%, #49515b); }
.r-U { --frame: linear-gradient(150deg, #f5f8fa 0%, #9aa5b0 28%, #eef2f5 50%, #7f8a96 74%, #dfe5ea 100%); }
.r-R { --frame: linear-gradient(150deg, #fff3c4 0%, #d4a136 26%, #fff1bf 48%, #a9771a 73%, #ffe28e 100%); }
.r-E { --frame: linear-gradient(135deg, #8a5cff, #ff6ad5, #5ad1ff, #8a5cff, #ff6ad5); }
.r-E .front { background-size: 300% 300%; animation: framepan 6s linear infinite; }
@keyframes framepan { to { background-position: 300% 300%; } }
.r-L .front {
  background: conic-gradient(from var(--angle), #ffd76a, #fff8dc, #c8962e, #ffefa0, #a8740f, #ffe28e, #ffd76a);
  animation: spin 5s linear infinite;
}
.r-M .front {
  background: conic-gradient(from var(--angle), #ff5f6d, #ffc371, #fff95b, #5bff95, #5be7ff, #7a5bff, #ff5bf1, #ff5f6d);
  animation: spin 3.2s linear infinite;
}
@keyframes spin { to { --angle: 360deg; } }

.r-R .body { box-shadow: inset 0 0 0 .1em rgba(255, 226, 142, .5), inset 0 0 1.5em rgba(0,0,0,.4); }
.r-E .body { background: linear-gradient(170deg, color-mix(in srgb, var(--tc) 40%, #2a1650) 0%, #140d2e 55%, #1a0f3a 100%); }
.r-L .body { background: radial-gradient(ellipse at 50% 0%, rgba(255, 215, 106, .35), transparent 60%), linear-gradient(170deg, color-mix(in srgb, var(--tc) 30%, #2b2008) 0%, #17110a 60%, #2a1d07 100%); }
.r-L .name, .r-M .name {
  background: linear-gradient(90deg, #fff6d0, #ffd36a, #fffbe8, #e0a93a, #fff6d0); background-size: 200% 100%;
  -webkit-background-clip: text; background-clip: text; color: transparent; text-shadow: none;
  filter: drop-shadow(0 .06em .1em rgba(0, 0, 0, .8)); animation: textflow 3s linear infinite;
}
.r-M .name { background-image: var(--rainbow); background-size: 200% 100%; }
.r-L .text { background: linear-gradient(175deg, #fffaf0, #f3e3bd); }
.r-M .body {
  background:
    radial-gradient(1px 1px at 20% 30%, #fff, transparent), radial-gradient(1px 1px at 70% 60%, #fff, transparent),
    radial-gradient(1.5px 1.5px at 40% 80%, #fff, transparent), radial-gradient(1px 1px at 85% 15%, #fff, transparent),
    radial-gradient(ellipse at 25% 0%, #5b2a9e, transparent 60%), radial-gradient(ellipse at 90% 100%, #0f5a85, transparent 60%), #0a0820;
}
.r-M .text { background: linear-gradient(175deg, #ffffff, #efe6ff); }
.r-M .typeline { border-image: var(--rainbow) 1; }

/* — Couches d'effets — */
.fx { position: absolute; inset: 0; pointer-events: none; border-radius: inherit; }
.glare {
  background: radial-gradient(circle at var(--mx) var(--my), rgba(255, 255, 255, .6) 0%, rgba(255, 255, 255, .15) 22%, transparent 55%);
  mix-blend-mode: overlay; opacity: 0; transition: opacity .3s;
}
.card.hovering .glare { opacity: calc(.35 + var(--hyp) * .65); }
.shine {
  display: none; mix-blend-mode: overlay;
  background: linear-gradient(110deg, transparent 38%, rgba(255, 255, 255, .75) 50%, transparent 62%);
  background-size: 260% 100%; background-position: var(--mx) 0;
}
.r-U .shine, .r-R .shine { display: block; }
.r-U .shine { opacity: .5; }
.r-R:not(.hovering) .shine { animation: sweep 4.5s ease-in-out infinite; }
@keyframes sweep { 0% { background-position: 130% 0; } 40%, 100% { background-position: -30% 0; } }

.holo, .art-holo {
  display: none; mix-blend-mode: color-dodge;
  background-image: var(--holo-rainbow), var(--holo-stripes);
  background-blend-mode: overlay;
  background-size: 300% 300%, 260% 260%;
  background-position: var(--mx) var(--my), calc(100% - var(--mx)) var(--my);
  filter: brightness(.75) contrast(1.5) saturate(1.3);
}
.art-holo { position: absolute; inset: 0; opacity: .7; }
.r-E .art-holo, .r-L .art-holo, .r-M .art-holo { display: block; }
.r-L .holo, .r-M .holo, .foil .holo { display: block; }
.r-L .holo { opacity: .28; }
.r-M .holo { opacity: .5; }
.foil .holo { opacity: .55; }
.foil.r-M .holo { opacity: .7; }

.glitter {
  display: none; mix-blend-mode: overlay;
  background-image:
    radial-gradient(circle, #fff 0 .06em, transparent .11em),
    radial-gradient(circle, #fff 0 .05em, transparent .09em),
    radial-gradient(circle, #ffe9a8 0 .05em, transparent .1em);
  background-size: 1.9em 2.1em, 1.3em 1.5em, 2.7em 2.3em;
  background-position: 0 0, .6em .9em, 1.1em .3em;
  -webkit-mask-image: radial-gradient(circle at var(--mx) var(--my), #000 0%, transparent 65%);
  mask-image: radial-gradient(circle at var(--mx) var(--my), #000 0%, transparent 65%);
  opacity: .9;
}
.r-L .glitter, .r-M .glitter, .foil .glitter { display: block; }

.foil-tag {
  position: absolute; top: 26.6em; right: 1.5em; z-index: 2; font-size: .72em; font-weight: 700; padding: .2em .6em;
  border-radius: 99em; color: #10142a; background: var(--rainbow); background-size: 200% 100%;
  animation: textflow 3s linear infinite; box-shadow: 0 0 .8em rgba(160, 240, 255, .7);
}
.foil .front { box-shadow: 0 .9em 2.2em rgba(0, 0, 0, .55), 0 0 1.2em rgba(138, 247, 255, .45); }

/* Balancement automatique des reflets (sans souris) */
@keyframes sway {
  0% { --mx: 15%; --my: 20%; } 25% { --mx: 85%; --my: 35%; }
  50% { --mx: 70%; --my: 85%; } 75% { --mx: 25%; --my: 70%; } 100% { --mx: 15%; --my: 20%; }
}
.card.r-E, .card.r-L, .card.r-M, .card.foil { animation: sway 7s ease-in-out infinite; }
.card.hovering { animation: none !important; }

/* — Aura derrière la carte — */
.aura {
  position: absolute; inset: 1%; border-radius: 1.4em; z-index: -1; pointer-events: none; opacity: 0;
  background: var(--rc);
  filter: blur(1.1em); transition: opacity .5s, inset .8s;
}
.r-E .aura { opacity: .3; }
.r-L .aura { opacity: .7; animation: auraPulse 2.6s ease-in-out infinite; }
.r-M .aura {
  opacity: .85; inset: -1%;
  background: conic-gradient(from var(--angle), #ff5f6d, #fff95b, #5bff95, #5be7ff, #7a5bff, #ff5bf1, #ff5f6d); animation: spin 3s linear infinite, auraPulse 2.2s ease-in-out infinite;
}
.foil .aura { opacity: .35; background: #8af7ff; }
@keyframes auraPulse { 50% { transform: scale(1.07); } }

/* Suspense : indice de rareté sur les cartes face cachée */
.opening .card.facedown .aura { opacity: 0; }
.opening .card.facedown.r-R .aura { opacity: .5; }
.opening .card.facedown.r-E .aura { opacity: .75; }
.opening .card.facedown.r-L .aura { opacity: .9; }
.opening .card.facedown.r-M .aura { opacity: 1; }
.opening .card.facedown.r-L .face.back, .opening .card.facedown.r-M .face.back { box-shadow: 0 0 1.5em var(--rc), 0 .9em 2.2em rgba(0,0,0,.55); }

.card.charging .tilt { animation: charge .09s linear infinite; }
.card.charging .aura { opacity: 1 !important; inset: -9%; }
@keyframes charge {
  0% { transform: translate(.18em, 0) rotate(.7deg); }
  50% { transform: translate(-.18em, .1em) rotate(-.7deg); }
  100% { transform: translate(.1em, -.1em) rotate(.4deg); }
}
.card.mythic-entrance .aura { animation: spin 3s linear infinite, mythicBloom 1.4s ease-out; }
@keyframes mythicBloom { 0% { inset: -30%; opacity: 1; } 100% { inset: -1%; opacity: .85; } }

/* — Badges — */
.badge-new {
  position: absolute; top: -.8em; right: -.8em; z-index: 6; pointer-events: none;
  background: linear-gradient(135deg, #ff3d6e, #ff9a3d); color: #fff; font-weight: 800; font-size: 1.05em;
  padding: .3em .75em; border-radius: 2em; box-shadow: 0 .3em 1em rgba(255, 61, 110, .5);
  transform: rotate(10deg) scale(0); transition: transform .45s cubic-bezier(.3, 1.8, .4, 1) .5s;
}
.card:not(.facedown) .badge-new { transform: rotate(10deg) scale(1); }
.badge-count, .badge-foil {
  position: absolute; bottom: -.7em; z-index: 6; pointer-events: none; font-weight: 700; font-size: 1.15em;
  padding: .2em .65em; border-radius: 1em; background: #0b1020; color: #fff;
  box-shadow: 0 .2em .6em rgba(0,0,0,.5);
}
.badge-count { right: -.4em; border: .1em solid var(--rc); }
.badge-foil { left: -.4em; background: var(--rainbow); color: #10142a; }

/* — Cartes manquantes — */
.card.missing { cursor: default; }
.missing-inner {
  position: absolute; inset: 0; border-radius: 1.2em; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: .4em;
  border: .15em dashed color-mix(in srgb, var(--rc) 45%, transparent); color: var(--muted);
  background: repeating-linear-gradient(45deg, rgba(255,255,255,.025) 0 .7em, transparent .7em 1.4em), rgba(10, 15, 35, .55);
}
.missing-no { position: absolute; top: .9em; left: 1.1em; font-weight: 700; font-size: 1.2em; }
.missing-q { font-family: Cinzel, Georgia, serif; font-size: 4.5em; line-height: 1; opacity: .2; }
.missing-rar { position: absolute; bottom: 1.1em; color: var(--rc); font-size: 1.1em; opacity: .75; }

/* ───────────── Écran d'ouverture ───────────── */
.opening {
  position: fixed; inset: 0; z-index: 50; display: flex; flex-direction: column;
  background: radial-gradient(circle at 50% 42%, rgba(40, 62, 150, .6), rgba(3, 5, 14, .97) 70%);
  backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
  animation: fadein .3s ease;
}
.opening[hidden] { display: none; }
@keyframes fadein { from { opacity: 0; } }
.opening-top { display: flex; justify-content: space-between; align-items: center; padding: 16px 22px; }
.opening-title b { font-family: 'Outfit', 'Space Grotesk', system-ui, sans-serif; font-weight: 700; font-size: 22px; margin-right: 12px; }
.opening-title span { color: var(--muted); font-size: 14px; }
.stage {
  flex: 1; min-height: 0; display: flex; align-items: center; justify-content: center;
  padding: 24px 16px; overflow-y: auto; overflow-x: hidden; position: relative;
}
.reveal-row { display: flex; flex-wrap: wrap; justify-content: center; align-content: center; gap: clamp(12px, 1.4vw, 22px); max-width: 1560px; margin: auto; padding: 14px; }
.reveal-row .card { --w: clamp(132px, 12.4vw, 205px); }
/* — Paquet de cartes en grand — */
.deck-area { display: flex; flex-direction: column; align-items: center; gap: 14px; width: 100%; margin: auto; }
.deck-counter { font-weight: 700; letter-spacing: .2em; color: var(--muted); font-size: 14px; }
.deck {
  --deck-w: clamp(220px, min(80vw, calc((100dvh - 330px) * .714)), 400px);
  position: relative; width: var(--deck-w); aspect-ratio: 5 / 7; cursor: pointer;
  touch-action: pan-y; user-select: none; -webkit-user-select: none;
}
.deck .card {
  --w: var(--deck-w); position: absolute; inset: 0;
  translate: calc(var(--d, 0) * 3px) calc(var(--d, 0) * 4px);
  rotate: calc(var(--d, 0) * .8deg * var(--sgn, 1));
  transition: translate .35s cubic-bezier(.2,.9,.3,1.2), rotate .35s ease;
}
.deck .card:not(.top) { pointer-events: none; }
.deck .card:not(.top) .badge-new { display: none; }
.deck .card.top:not(.facedown):hover { cursor: grab; }
.seen-strip { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; min-height: 96px; }
.seen-strip .card { --w: 66px; }
.seen-strip .card .badge-new, .seen-strip .card .foil-tag { display: none; }

.hint { text-align: center; color: var(--muted); margin: 4px 16px 8px; min-height: 1.4em; }
.hint b { color: var(--text); }
.opening-actions { display: flex; justify-content: center; gap: 12px; padding: 6px 16px 26px; min-height: 76px; flex-wrap: wrap; align-items: flex-start; }

.flash { position: fixed; inset: 0; z-index: 90; pointer-events: none; mix-blend-mode: screen; }
.pop-text {
  position: fixed; z-index: 110; pointer-events: none; white-space: nowrap;
  font-family: 'Outfit', 'Space Grotesk', system-ui, sans-serif; font-weight: 700; font-size: clamp(22px, 3vw, 40px); letter-spacing: .05em;
  color: #fff; text-shadow: 0 0 12px var(--c), 0 0 30px var(--c), 0 3px 0 rgba(0, 0, 0, .6);
}

/* ───────────── Collection ───────────── */
.col-head { padding: 22px 24px; margin-bottom: 16px; }
.col-title { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; flex-wrap: wrap; }
.col-title h2 { margin: 0; font-family: 'Outfit', 'Space Grotesk', system-ui, sans-serif; font-weight: 700; }
.big-count { font-size: 28px; font-weight: 700; }
.progress { height: 12px; border-radius: 99px; background: rgba(255,255,255,.07); overflow: hidden; margin: 12px 0 16px; }
.progress-bar { height: 100%; width: 0; border-radius: 99px; background: linear-gradient(90deg, #5ad1ff, #8f6bff, #ff5fd2, #ffc53d); transition: width .8s cubic-bezier(.2, .9, .2, 1); box-shadow: 0 0 14px rgba(143,107,255,.6); }
.rarity-stats { display: flex; flex-wrap: wrap; gap: 8px; }

.filters { padding: 16px 18px; margin-bottom: 26px; display: flex; flex-direction: column; gap: 12px; }
.filters input[type=search] {
  width: 100%; padding: 11px 14px; border-radius: 12px; border: 1px solid var(--line); background: rgba(0,0,0,.25);
  color: var(--text); font: inherit; outline: none;
}
.filters input[type=search]:focus { border-color: var(--accent); }
.chip-row { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  border: 1px solid color-mix(in srgb, var(--c) 45%, transparent); background: transparent; padding: 5px 11px; border-radius: 99px;
  font-size: 13px; cursor: pointer; color: var(--muted); transition: .15s;
}
.chip:hover { color: var(--text); }
.chip.active { background: color-mix(in srgb, var(--c) 30%, transparent); color: #fff; border-color: var(--c); box-shadow: 0 0 12px color-mix(in srgb, var(--c) 40%, transparent); }
.filter-line { display: flex; flex-wrap: wrap; align-items: center; gap: 14px 20px; font-size: 14px; }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.seg button { border: 0; background: transparent; padding: 7px 14px; cursor: pointer; color: var(--muted); }
.seg button.active { background: rgba(90, 209, 255, .2); color: #fff; }
.toggle, .sel { display: inline-flex; align-items: center; gap: 8px; color: var(--muted); cursor: pointer; }
.sel select { background: rgba(0,0,0,.3); color: var(--text); border: 1px solid var(--line); border-radius: 8px; padding: 5px 8px; font: inherit; }
.sel input[type=range] { accent-color: var(--accent); width: 110px; }
.filter-line .btn { margin-left: auto; }

.grid {
  --gw: 180px;
  display: grid; grid-template-columns: repeat(auto-fill, minmax(var(--gw), 1fr)); gap: 26px 18px; justify-items: center;
}
.grid .card { --w: var(--gw); }
.grid .card:not(.missing):hover .tilt { scale: 1.04; }

/* ───────────── Modale ───────────── */
.modal {
  position: fixed; inset: 0; z-index: 60; display: flex; align-items: center; justify-content: center; gap: 44px; flex-wrap: wrap;
  padding: 24px; overflow-y: auto; background: rgba(3, 5, 14, .86); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
  animation: fadein .25s ease;
}
.modal[hidden] { display: none; }
.modal-card .card { --w: min(340px, 80vw); }
.modal-info { padding: 22px 24px; max-width: 360px; width: 100%; }
.modal-info h2 { margin: 2px 0 4px; font-family: 'Outfit', 'Space Grotesk', system-ui, sans-serif; font-weight: 700; font-size: 26px; }
.mi-no { margin: 0; color: var(--muted); font-size: 13px; letter-spacing: .1em; }
.mi-rar { margin: 0 0 12px; font-weight: 700; }
.mi-desc { margin: 0 0 18px; line-height: 1.5; color: #cfd6ee; }
.modal-info dl { display: grid; grid-template-columns: auto 1fr; gap: 7px 16px; margin: 0 0 18px; font-size: 14px; }
.modal-info dt { color: var(--muted); }
.modal-info dd { margin: 0; font-weight: 600; }
.mi-source { margin: 0 0 16px; padding: 12px 14px; border-radius: 12px; background: rgba(255,255,255,.04); border: 1px solid var(--line); font-size: 12.5px; line-height: 1.45; color: var(--muted); word-break: break-word; }
.mi-source h4 { margin: 0 0 6px; font-size: 12px; letter-spacing: .12em; text-transform: uppercase; color: var(--text); }
.mi-source p { margin: 0 0 3px; }
.mi-source a { color: var(--accent); }
.mi-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 10px; }

/* ───────────── Responsive ───────────── */
@media (max-width: 720px) {
  .topbar { padding: 10px 16px; }
  .tab { padding: 7px 12px; }
  main { padding: 20px 16px 60px; }
  .grid { --gw: 140px !important; gap: 20px 12px; }
  .filter-line .btn { margin-left: 0; }
  .modal { gap: 18px; }
  .reveal-row .card { --w: min(44vw, 200px); }
  .deck { --deck-w: clamp(200px, min(82vw, calc((100dvh - 300px) * .714)), 400px); }
  .seen-strip .card { --w: 46px; }
  .seen-strip { min-height: 70px; gap: 6px; }
  .opening-top { padding: 12px 16px; }
  .opening-title span { display: none; }
  .opening-actions { gap: 8px; padding-bottom: 18px; min-height: 0; }
  .opening-actions .btn { padding: 9px 14px; font-size: 14px; }
}

@media (prefers-reduced-motion: reduce) {
  .card, .card .front, .aura, .pack-shine, .pack.floating, .rainbow-text { animation: none !important; }
}

/* Holo plus discret sur les vraies photos (sinon l'image est délavée) */
.art.has-photo .art-holo { mix-blend-mode: soft-light; opacity: .55; filter: saturate(1.4); }
.front:has(.art.has-photo) .holo { opacity: .22; }
.foil .front:has(.art.has-photo) .holo { opacity: .3; }
.r-M .front:has(.art.has-photo) .holo { opacity: .3; }
.mi-type-dot { display: inline-block; width: .65em; height: .65em; border-radius: 50%; margin-right: .45em; vertical-align: .05em; }

/* Images transparentes (PNG/GIF, souvent des schémas) : fond blanc, image entière */
.art-photo { background: #fff; }
.art-photo.contain { object-fit: contain; padding: .5em; }
