:root {
  --bg: #0d0b16;
  --bg-2: #171328;
  --panel: #1e1934;
  --text: #ece8ff;
  --muted: #9a93b8;
  --accent: #b18cff;

  --c-commune: #9ea3ad;
  --c-peu_commun: #4cc471;
  --c-rare: #3d9bff;
  --c-epique: #b25cff;
  --c-legendaire: #ffb422;
  --c-mythique: #ff4fa3;

  --card-w: 200px;
}

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

body {
  font-family: "Inter", system-ui, sans-serif;
  color: var(--text);
  background:
    radial-gradient(ellipse at 20% 0%, #2a1d52 0%, transparent 55%),
    radial-gradient(ellipse at 90% 100%, #1d2f52 0%, transparent 50%),
    var(--bg);
  min-height: 100vh;
}

button { font: inherit; cursor: pointer; border: none; }

/* ---------- Top bar ---------- */
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  flex-wrap: wrap; gap: 12px;
  padding: 16px 28px;
  border-bottom: 1px solid #ffffff14;
  background: #0d0b16cc;
  backdrop-filter: blur(8px);
  position: sticky; top: 0; z-index: 20;
}
.logo { font-family: "Cinzel", serif; font-size: 1.5rem; letter-spacing: .04em; }
.logo span { color: var(--accent); }
.tabs { display: flex; gap: 6px; }
.tab {
  background: transparent; color: var(--muted);
  padding: 8px 16px; border-radius: 999px; font-weight: 600;
}
.tab.active { background: var(--panel); color: var(--text); }
.pill {
  font-size: .75rem; background: #ffffff1a; padding: 2px 8px; border-radius: 999px; margin-left: 4px;
}

main { max-width: 1200px; margin: 0 auto; padding: 32px 20px 60px; }
.view { display: none; }
.view.active { display: grid; }
#view-booster { grid-template-columns: 1fr 260px; gap: 32px; }
@media (max-width: 860px) { #view-booster { grid-template-columns: 1fr; } }
#view-collection.active { display: block; }
.hidden { display: none !important; }

/* ---------- Booster ---------- */
.booster-zone {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  min-height: 520px; gap: 28px;
}

.pack {
  --p1: #5b2bd6; --p2: #1b0b4d; --p3: #07031a;
  --f1: #ffe08a; --f2: #ff9ad5; --f3: #8fd3ff; --glow: #8f5cff;
  position: relative; width: 236px; height: 344px; perspective: 800px; cursor: pointer;
  filter: drop-shadow(0 22px 44px color-mix(in srgb, var(--glow) 45%, transparent));
  transition: transform .3s;
}
.pack:hover { transform: translateY(-6px) rotate(-1deg); }
.pack.disabled { cursor: not-allowed; filter: grayscale(.7) brightness(.6); }
.pack.disabled:hover { transform: none; }

/* Paquet : couleurs données par la collection (variables --p*, --f*, --glow) */
.pack-inner {
  position: relative; width: 100%; height: 100%;
  border-radius: 12px; overflow: hidden;
  background:
    radial-gradient(1.5px 1.5px at 20% 30%, #fff9, transparent),
    radial-gradient(1px 1px at 70% 18%, #fff8, transparent),
    radial-gradient(1.5px 1.5px at 82% 62%, #fff7, transparent),
    radial-gradient(1px 1px at 12% 78%, #fff8, transparent),
    radial-gradient(1px 1px at 55% 88%, #fff6, transparent),
    radial-gradient(circle at 50% 38%, color-mix(in srgb, var(--p1) 70%, #fff 10%) 0%, transparent 55%),
    linear-gradient(165deg, var(--p1), var(--p2) 55%, var(--p3));
  border: 2px solid color-mix(in srgb, var(--f1) 55%, transparent);
  box-shadow: inset 0 0 30px #0008;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px;
  text-align: center; padding: 26px 14px;
}
.pack-inner::after { /* reflet holographique */
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background: linear-gradient(115deg, transparent 30%, #ffffff3a 45%, transparent 60%);
  background-size: 250% 100%;
  animation: shine 3.5s infinite;
}
@keyframes shine { from { background-position: 150% 0; } to { background-position: -100% 0; } }
.pack-crimp { /* bords sertis du sachet */
  position: absolute; left: 0; right: 0; height: 16px;
  background: repeating-linear-gradient(90deg, var(--f1) 0 5px, var(--f2) 5px 10px, var(--f3) 10px 15px);
  opacity: .75;
}
.pack-crimp.top { top: 0; }
.pack-crimp.bottom { bottom: 0; }
.pack-series {
  font-size: .62rem; letter-spacing: .3em; text-transform: uppercase;
  color: color-mix(in srgb, var(--f1) 80%, #fff); opacity: .9;
}
.pack-portal { /* hublot avec l'illustration de la collection */
  position: relative; width: 142px; height: 142px; border-radius: 50%; margin: 6px 0 4px;
  padding: 4px; background: conic-gradient(var(--f1), var(--f2), var(--f3), var(--f1));
  box-shadow: 0 0 26px color-mix(in srgb, var(--glow) 80%, transparent);
  animation: portal-spin 8s linear infinite;
}
.pack-portal img, .pack-portal span {
  width: 100%; height: 100%; border-radius: 50%; object-fit: cover; display: grid; place-items: center;
  font-size: 3rem; background: var(--p3);
  animation: portal-spin 8s linear infinite reverse; /* l'image reste droite */
}
@keyframes portal-spin { to { transform: rotate(360deg); } }
.pack-title {
  font-family: "Cinzel", serif; font-size: 1.55rem; font-weight: 800; line-height: 1.1;
  background: linear-gradient(90deg, var(--f1), var(--f2), var(--f3), var(--f1));
  background-size: 200% 100%; -webkit-background-clip: text; background-clip: text; color: transparent;
  animation: foil 6s linear infinite; filter: drop-shadow(0 2px 6px #0009);
}
@keyframes foil { to { background-position: 200% 0; } }
.pack-tagline { font-size: .72rem; font-style: italic; color: #e9e2ffcc; max-width: 180px; line-height: 1.35; }
.pack-sub { margin-top: 4px; color: #d9c6ff; font-size: .7rem; letter-spacing: .22em; text-transform: uppercase; }

.pack-emblem { font-size: 3.5rem; color: #ffe08a; text-shadow: 0 0 20px #ffcc4d; } /* écran de connexion */

/* Choix de la collection */
.set-picker { display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; }
.set-chip {
  display: flex; align-items: center; gap: 10px; padding: 6px 14px 6px 6px; border-radius: 999px;
  background: linear-gradient(135deg, color-mix(in srgb, var(--p1) 45%, var(--panel)), var(--panel));
  color: var(--text); border: 1px solid #ffffff18; text-align: left; font-size: .85rem;
}
.set-chip.active { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.set-chip small { display: block; color: var(--muted); font-size: .72rem; }
.set-chip-cover { width: 34px; height: 34px; border-radius: 50%; overflow: hidden; display: grid; place-items: center; background: var(--p2); }
.set-chip-cover img { width: 100%; height: 100%; object-fit: cover; }
.collection-set-title { display: flex; flex-direction: column; gap: 2px; }
.collection-set-title b { font-family: "Cinzel", serif; font-size: 1.4rem; }
.collection-set-title span { font-size: .85rem; }

.pack.shaking { animation: shake .6s ease-in-out; }
@keyframes shake {
  0%,100% { transform: rotate(0); }
  20% { transform: rotate(-5deg) scale(1.03); }
  40% { transform: rotate(5deg) scale(1.05); }
  60% { transform: rotate(-4deg) scale(1.07); }
  80% { transform: rotate(3deg) scale(1.1); }
}
.pack.burst { animation: burst .45s ease-in forwards; }
@keyframes burst {
  to { transform: scale(1.5); opacity: 0; filter: brightness(3) blur(6px); }
}

.controls { display: flex; flex-direction: column; align-items: center; gap: 10px; }
/* Beaucoup de cartes : les boutons restent visibles en bas de l'écran */
.booster-zone:has(.reveal.many:not(.hidden)) .controls {
  position: sticky; bottom: 16px; z-index: 5;
}
.booster-zone:has(.reveal.many:not(.hidden)) .btn-secondary { box-shadow: 0 8px 24px #000a; }
.open-buttons { display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; }
.btn-primary, .btn-secondary {
  padding: 12px 28px; border-radius: 999px; font-weight: 600; font-size: 1rem;
  transition: transform .15s, opacity .2s;
}
.btn-primary {
  background: linear-gradient(135deg, #b18cff, #6a3cff); color: white;
  box-shadow: 0 8px 24px #6a3cff66;
}
.btn-primary:hover:not(:disabled) { transform: translateY(-2px); }
.btn-primary:disabled { opacity: .4; cursor: not-allowed; box-shadow: none; }
.btn-secondary { background: var(--panel); color: var(--text); border: 1px solid #ffffff22; }
.timer { color: var(--muted); font-variant-numeric: tabular-nums; min-height: 1.4em; }
.timer strong { color: var(--text); font-size: 1.2rem; }
.timer small { font-size: .85rem; }
.timer small strong { font-size: 1rem; }

/* Nombre de boosters en stock (pastille sur le paquet) */
.pack-count {
  position: absolute; top: -10px; right: -12px; z-index: 3;
  background: var(--accent); color: #160c2b; font-weight: 800; font-size: 1.05rem;
  padding: .2em .6em; border-radius: 999px; box-shadow: 0 4px 14px #0008;
}
.pack-count.hidden { display: none; }

.reveal { display: flex; gap: 22px; flex-wrap: wrap; justify-content: center; }
.reveal.many { --card-w: 150px; gap: 14px; max-width: 1100px; }

/* ---------- Carte (flip) ---------- */
.flip {
  width: var(--card-w); aspect-ratio: 5 / 7;
  perspective: 1000px; cursor: pointer;
  animation: deal .5s cubic-bezier(.2,.9,.3,1.3) backwards;
}
@keyframes deal { from { transform: translateY(80px) scale(.6); opacity: 0; } }
.flip-inner {
  position: relative; width: 100%; height: 100%;
  transition: transform .7s cubic-bezier(.3,.8,.3,1);
  transform-style: preserve-3d;
}
.flip.flipped .flip-inner { transform: rotateY(180deg); }
.flip:not(.flipped):hover .flip-inner { transform: translateY(-6px); }
.flip-front, .flip-back {
  position: absolute; inset: 0; backface-visibility: hidden; border-radius: 12px;
}
.flip-front { transform: rotateY(180deg); }

.card-back {
  width: 100%; height: 100%; border-radius: 12px;
  background:
    radial-gradient(circle at center, #ffe08a33 0 18%, transparent 19%),
    repeating-conic-gradient(from 0deg, #3a1f80 0 15deg, #2a0f63 15deg 30deg);
  border: 4px solid #d9c6ff66;
  display: grid; place-items: center;
  font-size: 3rem; color: #ffe08a;
}
/* Indice de rareté sur le dos (lueur) */
.flip[data-rarity="epique"] .card-back { box-shadow: 0 0 25px var(--c-epique); }
.flip[data-rarity="legendaire"] .card-back { box-shadow: 0 0 35px var(--c-legendaire); animation: pulse 1.2s infinite; }
.flip[data-rarity="mythique"] .card-back { box-shadow: 0 0 45px var(--c-mythique); animation: pulse .8s infinite; }
@keyframes pulse { 50% { filter: brightness(1.35); } }

/* ---------- Face de carte ---------- */
.card {
  --rc: var(--c-commune);
  width: 100%; height: 100%;
  border-radius: 12px; padding: 7px;
  background: linear-gradient(160deg, var(--rc), color-mix(in srgb, var(--rc) 35%, #000));
  display: flex; flex-direction: column;
  position: relative; overflow: hidden;
  box-shadow: 0 10px 30px #0008;
  font-size: calc(var(--card-w) / 200 * 1rem);
  color: #fff;
}
.card.r-peu_commun { --rc: var(--c-peu_commun); }
.card.r-rare { --rc: var(--c-rare); }
.card.r-epique { --rc: var(--c-epique); }
.card.r-legendaire { --rc: var(--c-legendaire); }
.card.r-mythique {
  --rc: var(--c-mythique);
  background: linear-gradient(120deg, #ff4fa3, #ffb422, #4fffb0, #3d9bff, #b25cff, #ff4fa3);
  background-size: 300% 300%;
  animation: rainbow 4s linear infinite;
}
@keyframes rainbow { to { background-position: 300% 0; } }

/* reflet holographique pour épique+ */
.card.r-epique::after, .card.r-legendaire::after, .card.r-mythique::after {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background: linear-gradient(115deg, transparent 35%, #ffffff55 48%, transparent 60%);
  background-size: 250% 100%;
  animation: shine 3s infinite;
  mix-blend-mode: overlay;
}

.card-head {
  display: flex; justify-content: space-between; align-items: center; gap: 4px;
  background: #0009; border-radius: 6px; padding: .3em .5em;
}
.card-name { font-family: "Cinzel", serif; font-weight: 800; font-size: .72em; line-height: 1.1; }
.card-art {
  flex: 1; margin: 6px 0; border-radius: 6px;
  display: grid; place-items: center;
  font-size: 3.6em;
  border: 2px solid #0006;
  text-shadow: 0 6px 18px #0008;
  /* fond de secours (cartes sans image) : teinte de la rareté */
  background: radial-gradient(circle at 50% 40%, color-mix(in srgb, var(--rc) 70%, #fff), color-mix(in srgb, var(--rc) 30%, #000));
}
.card-art { overflow: hidden; position: relative; }
.card-art img {
  position: absolute; inset: 0; width: 100%; height: 100%;
  object-fit: cover; display: block;
}
/* Cartes avec photo : l'image remplit toute la carte */
.card.full-art .card-art {
  position: absolute; inset: 7px; margin: 0; z-index: 0; border-radius: 8px;
}
.card.full-art .card-art img { object-position: center 25%; }
.card.full-art > :not(.card-art) { position: relative; z-index: 1; }
.card.full-art .card-head { margin-bottom: auto; }
.card.full-art .card-rarity {
  align-self: center; background: #000a; border-radius: 999px; padding: .2em .8em;
}
.card.full-art .card-text { background: #f4efe2e6; }
.card::after { z-index: 2; }

.card-rarity {
  text-align: center; font-size: .58em; font-weight: 600; letter-spacing: .15em;
  text-transform: uppercase; margin-bottom: 4px;
}
.card-text {
  background: #f4efe2; color: #2a2238; border-radius: 6px;
  padding: .45em .55em; font-size: .62em; font-style: italic; min-height: 3.4em;
}
.card-stats {
  display: flex; justify-content: space-between; margin-top: 5px;
  font-weight: 600; font-size: .7em;
}
.card-stats span { background: #0009; padding: .15em .55em; border-radius: 999px; }
.card-stats .card-cat {
  font-weight: 500; font-size: .8em; align-self: center;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0;
}
.card-num { opacity: .65; font-weight: 400; letter-spacing: .05em; margin-left: .3em; }

.new-badge {
  position: absolute; top: -10px; right: -10px; z-index: 5;
  background: #ff3d6e; color: white; font-weight: 800; font-size: .75rem;
  padding: 4px 10px; border-radius: 999px; box-shadow: 0 4px 12px #0007;
  transform: rotate(12deg);
}

/* ---------- Taux ---------- */
.rates {
  background: var(--panel); border-radius: 16px; padding: 20px;
  align-self: start; border: 1px solid #ffffff10;
}
.rates h2 { font-family: "Cinzel", serif; font-size: 1.05rem; margin-bottom: 14px; }
.rates ul { list-style: none; display: flex; flex-direction: column; gap: 8px; }
.rates li { display: flex; align-items: center; gap: 10px; font-size: .92rem; }
.rates li .dot { width: 12px; height: 12px; border-radius: 50%; }
.rates li .pct { margin-left: auto; color: var(--muted); font-variant-numeric: tabular-nums; }
.stats { margin-top: 18px; color: var(--muted); font-size: .85rem; line-height: 1.6; }

.dot.commune { background: var(--c-commune); }
.dot.peu_commun { background: var(--c-peu_commun); }
.dot.rare { background: var(--c-rare); }
.dot.epique { background: var(--c-epique); }
.dot.legendaire { background: var(--c-legendaire); }
.dot.mythique { background: linear-gradient(135deg, #ff4fa3, #ffb422, #3d9bff); }

/* ---------- Collection ---------- */
.collection-head { margin-bottom: 24px; display: flex; flex-direction: column; gap: 14px; }
.filters { display: flex; gap: 8px; flex-wrap: wrap; }
.filter {
  background: var(--panel); color: var(--muted); padding: 7px 14px; border-radius: 999px;
  font-size: .88rem; display: flex; align-items: center; gap: 6px; border: 1px solid transparent;
}
.filter.active { color: var(--text); border-color: var(--accent); }
.progress { height: 8px; background: var(--panel); border-radius: 999px; overflow: hidden; }
#progress-bar { height: 100%; width: 0; background: linear-gradient(90deg, #6a3cff, #ff4fa3); transition: width .5s; }

.grid {
  --card-w: 170px;
  display: grid; grid-template-columns: repeat(auto-fill, minmax(var(--card-w), 1fr));
  gap: 18px; justify-items: center;
}
.slot { width: var(--card-w); aspect-ratio: 5 / 7; position: relative; cursor: pointer; transition: transform .2s; }
.slot:hover { transform: translateY(-4px); }
.slot.missing { cursor: default; }
.slot.missing:hover { transform: none; }
.slot .count {
  position: absolute; top: -8px; right: -8px; z-index: 5;
  background: #000c; border: 1px solid #ffffff44; font-size: .78rem; font-weight: 600;
  padding: 2px 8px; border-radius: 999px;
}
.empty-card {
  width: 100%; height: 100%; border-radius: 12px;
  border: 2px dashed #ffffff22; background: #ffffff06;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px;
  color: #ffffff40; font-family: "Cinzel", serif;
}
.empty-card .q { font-size: 2.6rem; }
.empty-card .n { font-size: .8rem; }

/* ---------- Modal ---------- */
.modal {
  position: fixed; inset: 0; z-index: 50; background: #000c;
  display: grid; place-items: center; backdrop-filter: blur(4px);
}
#modal-card { --card-w: min(340px, 80vw); width: var(--card-w); aspect-ratio: 5 / 7; animation: deal .3s ease-out; }

/* ---------- Flash plein écran (légendaire / mythique) ---------- */
.flash {
  position: fixed; inset: 0; pointer-events: none; z-index: 40;
  animation: flash 1s ease-out forwards;
}
@keyframes flash { from { opacity: .8; } to { opacity: 0; } }

@media (max-width: 520px) {
  :root { --card-w: 150px; }
  .grid { --card-w: 140px; }
  .topbar { padding: 12px 16px; }
}

/* ---------- Compte / connexion ---------- */
.user { display: flex; align-items: center; gap: 10px; }
.user-avatar { width: 32px; height: 32px; border-radius: 50%; background: var(--panel); }
.user-name { font-weight: 600; max-width: 160px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.btn-link { background: none; color: var(--muted); text-decoration: underline; font-size: .85rem; }
.btn-link:hover { color: var(--text); }

.login {
  position: fixed; inset: 0; z-index: 60; display: grid; place-items: center; padding: 16px;
  background: radial-gradient(ellipse at 50% 30%, #2a1d52, var(--bg) 70%);
}
.login-box {
  max-width: 380px; width: 100%; text-align: center;
  background: var(--panel); border: 1px solid #ffffff14; border-radius: 20px; padding: 36px 28px;
  display: flex; flex-direction: column; align-items: center; gap: 16px;
}
.login-box h2 { font-family: "Cinzel", serif; font-size: 1.5rem; }
.login-box p { color: var(--muted); line-height: 1.5; }
.btn-discord {
  display: inline-flex; align-items: center; gap: 10px;
  background: #5865f2; color: white; text-decoration: none; font-weight: 600;
  padding: 12px 24px; border-radius: 999px; transition: transform .15s, background .15s;
}
.btn-discord:hover { background: #4752c4; transform: translateY(-2px); }
.login-msg { color: #ff8fa3 !important; font-size: .9rem; min-height: 1em; }
.error { color: #ff8fa3; font-size: .9rem; min-height: 1em; }

/* ============================================================
   Marché
   ============================================================ */
:root { --up: #4cd98a; --down: #ff6b81; }
.muted { color: var(--muted); }
.center { text-align: center; }

/* Solde dans l'en-tête */
.wallet {
  background: var(--panel); border: 1px solid #ffd76a44; color: #ffe08a;
  padding: 4px 10px; border-radius: 999px; font-size: .9rem; white-space: nowrap;
}
.timer .bonus { color: #ffe08a; font-size: .9rem; }
.buy-booster { display: flex; align-items: center; gap: 8px; font-size: .9rem; color: var(--muted); }
.buy-booster input {
  width: 58px; background: var(--panel); color: var(--text); border: 1px solid #ffffff22;
  border-radius: 8px; padding: 5px 8px; font: inherit;
}
.buy-booster button:disabled { opacity: .45; cursor: not-allowed; text-decoration: none; }
.booster-zone:has(.reveal:not(.hidden)) .buy-booster { display: none; }

/* Doublons (collection) */
.collection-actions { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.btn-secondary.small, .btn-primary.small { padding: 8px 16px; font-size: .9rem; }
.btn-secondary:disabled { opacity: .45; cursor: not-allowed; }

/* « Voir au marché » sous le zoom d'une carte */
#modal-card { position: relative; }
.modal-market {
  position: absolute; top: calc(100% + 14px); left: 50%; transform: translateX(-50%);
  white-space: nowrap;
}

#view-market.active { display: block; }
.market-head {
  display: flex; justify-content: space-between; align-items: flex-end; gap: 20px;
  flex-wrap: wrap; margin-bottom: 18px;
}
.market-title { font-family: "Cinzel", serif; font-size: 1.6rem; margin-bottom: 6px; }
.market-head p { max-width: 640px; font-size: .9rem; line-height: 1.5; }
.wallet-big {
  background: var(--panel); border: 1px solid #ffd76a44; border-radius: 14px;
  padding: 10px 18px; font-size: 1.3rem; color: #ffe08a;
}
.wallet-big span { font-size: .85rem; color: var(--muted); }

.market-tools { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-bottom: 16px; }
.market-tools input[type=search], .market-tools select, .trade-line input {
  background: var(--panel); color: var(--text); border: 1px solid #ffffff22;
  border-radius: 10px; padding: 8px 12px; font: inherit; font-size: .9rem;
}
.market-tools input[type=search] { flex: 1 1 220px; min-width: 0; }
.check { display: flex; align-items: center; gap: 6px; color: var(--muted); font-size: .9rem; cursor: pointer; }

.market-layout { display: grid; grid-template-columns: 1fr 300px; gap: 20px; align-items: start; }
@media (max-width: 1000px) { .market-layout { grid-template-columns: 1fr; } }

.market-table-wrap { background: var(--bg-2); border-radius: 14px; border: 1px solid #ffffff10; overflow: hidden; }
.market-row {
  display: grid; align-items: center; gap: 10px; width: 100%;
  grid-template-columns: 44px minmax(140px, 1.6fr) 70px 96px 84px 70px 74px minmax(90px, 1fr);
  padding: 8px 12px; background: none; color: var(--text); text-align: left;
  border-bottom: 1px solid #ffffff0a; font-size: .9rem;
}
button.market-row:hover { background: #ffffff08; }
.market-row-head { color: var(--muted); font-size: .75rem; text-transform: uppercase; letter-spacing: .06em; background: #0003; }
.thumb {
  width: 40px; height: 52px; border-radius: 6px; overflow: hidden; display: grid; place-items: center;
  border: 2px solid var(--c-commune); background: var(--panel); font-size: 1.3rem;
}
.thumb img { width: 100%; height: 100%; object-fit: cover; object-position: center 25%; }
.thumb.r-peu_commun { border-color: var(--c-peu_commun); }
.thumb.r-rare { border-color: var(--c-rare); }
.thumb.r-epique { border-color: var(--c-epique); }
.thumb.r-legendaire { border-color: var(--c-legendaire); }
.thumb.r-mythique { border-color: var(--c-mythique); }
.m-name { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.m-name b { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.m-name small { color: var(--muted); font-size: .75rem; display: flex; align-items: center; gap: 5px; }
.m-name .dot, .detail-top .dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }
.m-price { font-weight: 600; font-variant-numeric: tabular-nums; }
.m-offers, .m-bank { font-size: .82rem; }
.empty { padding: 20px; }

.spark { display: block; }
.spark polyline { fill: none; stroke-width: 1.6; stroke: var(--muted); }
.spark.up polyline { stroke: var(--up); }
.spark.down polyline { stroke: var(--down); }
.chg { font-weight: 600; font-size: .82rem; font-variant-numeric: tabular-nums; white-space: nowrap; }
.chg.up { color: var(--up); }
.chg.down { color: var(--down); }
.chg.flat { color: var(--muted); }

@media (max-width: 760px) {
  .market-row { grid-template-columns: 40px 1fr 74px 64px; }
  .market-row > :nth-child(3), .market-row > :nth-child(4),
  .market-row > :nth-child(7), .market-row > :nth-child(8) { display: none; }
}

.market-side { background: var(--bg-2); border-radius: 14px; border: 1px solid #ffffff10; padding: 16px; }
.market-side h3 { font-family: "Cinzel", serif; font-size: 1rem; margin: 4px 0 10px; }
.market-side h3:not(:first-child) { margin-top: 20px; }
.side-list { display: flex; flex-direction: column; gap: 6px; font-size: .85rem; }
.side-item { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.side-item small { display: block; font-size: .72rem; }
.link { background: none; color: var(--accent); padding: 0; font: inherit; text-align: left; }
.link:hover { text-decoration: underline; }
.btn-mini {
  background: var(--panel); color: var(--text); border: 1px solid #ffffff22;
  border-radius: 8px; padding: 4px 10px; font-size: .8rem;
}
.btn-mini.buy { background: var(--accent); color: #160c2b; border: none; font-weight: 600; }
.btn-mini:disabled { opacity: .4; cursor: not-allowed; }

/* Fiche carte */
.overlay {
  position: fixed; inset: 0; z-index: 45; background: #000b; backdrop-filter: blur(4px);
  display: flex; justify-content: center; align-items: flex-start; overflow-y: auto; padding: 32px 16px;
}
.detail-box {
  position: relative; width: min(1040px, 100%); background: var(--bg-2);
  border: 1px solid #ffffff18; border-radius: 18px; padding: 24px; animation: deal .25s ease-out;
}
.detail-close {
  position: absolute; top: 12px; right: 12px; width: 34px; height: 34px; border-radius: 50%;
  background: var(--panel); color: var(--text); font-size: 1rem;
}
.detail-grid { display: grid; grid-template-columns: 240px 1fr; gap: 24px; }
@media (max-width: 760px) { .detail-grid { grid-template-columns: 1fr; } .detail-card { justify-self: center; } }
.detail-card { --card-w: 240px; width: 240px; }
.detail-card .card { aspect-ratio: 5 / 7; height: auto; margin-bottom: 10px; }
.detail-main { min-width: 0; }
.detail-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; flex-wrap: wrap; padding-right: 36px; }
.detail-top h2 { font-family: "Cinzel", serif; font-size: 1.5rem; }
.detail-top p { font-size: .85rem; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.detail-price { font-size: 1.6rem; font-weight: 700; display: flex; align-items: baseline; gap: 10px; }
.range-tabs { display: flex; gap: 6px; margin: 14px 0 8px; }

.price-chart { position: relative; width: 100%; }
.price-chart svg { display: block; width: 100%; height: auto; overflow: visible; }
.price-chart .gridline { stroke: #ffffff10; }
.price-chart .axis { fill: var(--muted); font-size: 11px; font-family: Inter, sans-serif; }
.price-chart .line { fill: none; stroke: var(--accent); stroke-width: 2; stroke-linejoin: round; }
.price-chart .base { stroke: #ffe08a66; stroke-dasharray: 4 4; }
.price-chart .sale { fill: #ffe08a; stroke: var(--bg-2); stroke-width: 2; }
.price-chart .vol-bank { fill: #b18cff66; }
.price-chart .vol-player { fill: #ffe08aaa; }
.price-chart .vol-axis { stroke: #ffffff18; }
.price-chart .cursor line { stroke: #ffffff55; stroke-dasharray: 3 3; }
.price-chart .cursor circle { fill: var(--accent); stroke: #fff; stroke-width: 2; }
.price-chart .cursor.hidden { display: none; }
.price-chart .hit { fill: transparent; cursor: crosshair; }
.chart-tip {
  position: absolute; pointer-events: none; background: #000d; border: 1px solid #ffffff22;
  border-radius: 8px; padding: 6px 10px; font-size: .8rem; white-space: nowrap;
}
.chart-legend { display: flex; flex-wrap: wrap; gap: 14px; font-size: .75rem; color: var(--muted); margin-top: 6px; }
.chart-legend i { display: inline-block; width: 14px; height: 10px; margin-right: 5px; vertical-align: middle; border-radius: 2px; }
.lg-line { background: var(--accent); height: 3px !important; }
.lg-sale { background: #ffe08a; border-radius: 50% !important; width: 10px !important; }
.lg-bank { background: #b18cff66; }
.lg-player { background: #ffe08aaa; }
.lg-base { border-top: 2px dashed #ffe08a88; height: 0 !important; }

.detail-stats { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 10px; margin: 16px 0; }
.detail-stats div { background: var(--panel); border-radius: 10px; padding: 8px 12px; display: flex; flex-direction: column; gap: 2px; }
.detail-stats small { color: var(--muted); font-size: .75rem; }

.trade-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px; }
.trade-box { background: var(--panel); border-radius: 12px; padding: 14px; display: flex; flex-direction: column; gap: 8px; }
.trade-box h4 { font-size: .95rem; }
.trade-box p { font-size: .8rem; line-height: 1.4; flex: 1; }
.trade-line { display: flex; gap: 8px; }
.trade-line input { width: 72px; flex: 0 0 auto; }
.trade-line button { white-space: nowrap; }
.trade-line button { flex: 1; }

.offers-title { margin: 18px 0 8px; font-size: .95rem; }
.offers { display: flex; flex-direction: column; gap: 6px; }
.offer {
  display: grid; grid-template-columns: 1fr auto auto auto; gap: 12px; align-items: center;
  background: var(--panel); border-radius: 10px; padding: 8px 12px; font-size: .88rem;
}

/* Notifications */
.toast {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%); z-index: 60;
  background: var(--panel); border: 1px solid var(--accent); color: var(--text);
  padding: 10px 18px; border-radius: 12px; box-shadow: 0 10px 30px #000a; font-size: .92rem;
  animation: deal .25s ease-out; max-width: calc(100vw - 32px);
}
.toast.err { border-color: var(--down); }

/* ============================================================
   Profil
   ============================================================ */
#view-profile.active { display: block; }
#user-avatar, #user-name { cursor: pointer; }
.small { font-size: .8rem; }
.p-head { display: flex; align-items: center; gap: 18px; margin-bottom: 22px; }
.p-avatar { width: 72px; height: 72px; border-radius: 50%; border: 3px solid var(--accent); background: var(--panel); }
.p-head h2 { font-family: "Cinzel", serif; font-size: 1.8rem; }
.p-head p { font-size: .9rem; }

.p-tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 12px; margin-bottom: 20px; }
.p-tile {
  background: var(--bg-2); border: 1px solid #ffffff10; border-radius: 14px; padding: 14px 16px;
  display: flex; flex-direction: column; gap: 4px;
}
.p-tile small { color: var(--muted); font-size: .78rem; text-transform: uppercase; letter-spacing: .05em; }
.p-tile b { font-size: 1.5rem; font-variant-numeric: tabular-nums; }
.p-tile span { color: var(--muted); font-size: .8rem; }

.p-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
@media (max-width: 1000px) { .p-grid { grid-template-columns: 1fr 1fr; } }
@media (max-width: 680px) { .p-grid { grid-template-columns: 1fr; } }
.p-card { background: var(--bg-2); border: 1px solid #ffffff10; border-radius: 14px; padding: 16px 18px; min-width: 0; }
.p-wide { grid-column: 1 / -1; }
.p-card h3 { font-family: "Cinzel", serif; font-size: 1rem; margin-bottom: 10px; }

.p-activity svg { display: block; width: 100%; height: auto; }
.p-activity .bar { fill: var(--accent); }
.p-activity .bar.empty { fill: #ffffff14; }
.p-activity .axis { fill: var(--muted); font-size: 11px; font-family: Inter, sans-serif; }
.p-activity .gridline { stroke: #ffffff10; }

.p-rarities { display: flex; flex-direction: column; gap: 9px; margin-top: 10px; }
.p-rar { display: grid; grid-template-columns: 110px 1fr 40px 40px; gap: 8px; align-items: center; font-size: .85rem; }
.p-rar > span { display: flex; align-items: center; gap: 6px; }
.p-rar .dot, .p-set-rar .dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }
.p-rar b { font-variant-numeric: tabular-nums; }
.p-bar { position: relative; height: 8px; background: #ffffff10; border-radius: 99px; }
.p-bar.big { height: 10px; margin: 6px 0; }
.p-bar .fill { position: absolute; inset: 0 auto 0 0; border-radius: 99px; background: var(--accent); }
.p-bar .fill.commune { background: var(--c-commune); }
.p-bar .fill.peu_commun { background: var(--c-peu_commun); }
.p-bar .fill.rare { background: var(--c-rare); }
.p-bar .fill.epique { background: var(--c-epique); }
.p-bar .fill.legendaire { background: var(--c-legendaire); }
.p-bar .fill.mythique { background: linear-gradient(90deg, #ff4fa3, #ffb422, #3d9bff); }
.p-bar .fill.all { background: linear-gradient(90deg, #b18cff, #ff4fa3); }
.p-bar .exp { position: absolute; top: -3px; bottom: -3px; width: 2px; background: #fff; border-radius: 2px; transform: translateX(-1px); }

.p-set { margin-bottom: 14px; }
.p-set-head { display: flex; justify-content: space-between; gap: 8px; font-size: .9rem; }
.p-set-head span { color: var(--muted); }
.p-set-rar { display: flex; flex-wrap: wrap; gap: 10px; font-size: .78rem; color: var(--muted); }
.p-set-rar > span { display: flex; align-items: center; gap: 4px; }

.p-list { display: grid; grid-template-columns: 1fr auto; gap: 8px 12px; font-size: .88rem; }
.p-list dt { color: var(--muted); }
.p-list dd { text-align: right; font-weight: 600; font-variant-numeric: tabular-nums; }

.p-pulls { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 10px; }
.p-pull {
  display: flex; align-items: center; gap: 10px; background: var(--panel); color: var(--text);
  border-radius: 10px; padding: 8px; text-align: left; min-width: 0;
}
.p-pull:hover { background: color-mix(in srgb, var(--panel) 80%, #fff); }
.p-pull > span:last-child { display: flex; flex-direction: column; min-width: 0; }
.p-pull b { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: .88rem; }
.p-pull small { font-size: .75rem; }
