/* CONCARD - THEME PIXEL ART / RETRO 8-BIT */
* { margin: 0; padding: 0; box-sizing: border-box; }
:root {
  --bg-deep: #0b0f1a;
  --bg-panel: #141a2b;
  --bg-panel-2: #1c2438;
  --ink: #eef2ff;
  --ink-dim: #8b96b8;
  --cyan: #46e8ff;
  --gold: #ffd23f;
  --bronze: #ff9e42;
  --silver: #dfe8f2;
  --platine: #46e8ff;
  --pink: #ff6ad5;
  --green: #7dff6e;
  --red: #ff5a5a;
  --ease-out: cubic-bezier(0.23, 1, 0.32, 1);
  --ease-in-out: cubic-bezier(0.45, 0, 0.25, 1);
  --ease-spring: cubic-bezier(0.34, 1.4, 0.64, 1);
  --ease-smooth: cubic-bezier(0.25, 1, 0.5, 1);
  --dur-fast: 160ms;
  --dur-normal: 260ms;
  --dur-smooth: 420ms;
  --img-outline: rgba(255, 255, 255, 0.1);
  --border: #3b4667;
  --bg-sunken: #0d1220;
  --shadow: #05070d;
}
html {
  background: var(--bg-deep);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
body {
  font-family: "VT323", "Courier New", monospace;
  font-size: 20px;
  color: var(--ink);
  min-height: 100vh;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  background:
    radial-gradient(circle at 50% -10%, #1a2340 0%, transparent 60%),
    repeating-linear-gradient(0deg, transparent 0 39px, rgba(70, 232, 255, 0.03) 39px 40px),
    repeating-linear-gradient(90deg, transparent 0 39px, rgba(70, 232, 255, 0.03) 39px 40px),
    var(--bg-deep);
  image-rendering: pixelated;
  overflow-x: hidden;
}
body::before {
  content: "";
  position: fixed;
  inset: 0;
  background: repeating-linear-gradient(0deg, rgba(0,0,0,0.16) 0px, rgba(0,0,0,0.16) 2px, transparent 2px, transparent 4px);
  pointer-events: none;
  z-index: 9998;
}
body::after {
  content: "";
  position: fixed;
  inset-inline: 0;
  height: 120px;
  background: linear-gradient(180deg, transparent, rgba(70,232,255,0.045), transparent);
  animation: crtSweep 7s linear infinite;
  pointer-events: none;
  z-index: 9997;
}
@keyframes crtSweep { 0% { top: -140px; } 100% { top: 100vh; } }
.container { text-align: center; padding: 32px 16px; width: 100%; max-width: 560px; margin-block: auto; }
[hidden] { display: none !important; }
img, canvas { image-rendering: pixelated; }
h1 {
  font-family: "Press Start 2P", monospace;
  font-size: 22px;
  line-height: 1.25;
  letter-spacing: 1px;
  text-wrap: balance;
  margin-bottom: 18px;
  color: var(--gold);
  text-shadow: 3px 3px 0 #7a3d00, 6px 6px 0 rgba(0,0,0,0.55);
  animation: titleBob 3.2s ease-in-out infinite;
}
@keyframes titleBob {
  0%, 100% { transform: translateY(0); filter: drop-shadow(0 4px 6px rgba(0,0,0,0.4)); }
  50% { transform: translateY(-5px); filter: drop-shadow(0 8px 14px rgba(255,210,63,0.3)); }
}
.odds { color: var(--ink-dim); font-size: 19px; margin-bottom: 24px; line-height: 1.5; text-wrap: pretty; }
.odds b { color: var(--ink); }
.px-border {
  position: relative;
  border: 4px solid var(--border);
  box-shadow: 0 4px 0 0 var(--shadow), inset 0 0 0 2px var(--bg-sunken);
}
.px-corners {
  --c: 8px;
  -webkit-mask: linear-gradient(#000 0 0) top left / calc(100% - var(--c)) calc(100% - var(--c)) no-repeat, linear-gradient(#000 0 0) top right / var(--c) calc(100% - var(--c)) no-repeat, linear-gradient(#000 0 0) bottom left / calc(100% - var(--c)) var(--c) no-repeat, linear-gradient(#000 0 0) bottom right / var(--c) var(--c) no-repeat;
  mask: linear-gradient(#000 0 0) top left / calc(100% - var(--c)) calc(100% - var(--c)) no-repeat, linear-gradient(#000 0 0) top right / var(--c) calc(100% - var(--c)) no-repeat, linear-gradient(#000 0 0) bottom left / calc(100% - var(--c)) var(--c) no-repeat, linear-gradient(#000 0 0) bottom right / var(--c) var(--c) no-repeat;
}
/* ============================================================
   COMPTE
   ============================================================ */
.account-bar {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 12px;
  margin-bottom: 24px;
  font-size: 19px;
}
.account-status { color: var(--ink-dim); }
.account-status b { color: var(--gold); }
.account-btn {
  font-family: "Press Start 2P", monospace;
  font-size: 10px;
  background: var(--bg-panel-2);
  border: 3px solid #4a5878;
  color: var(--ink);
  padding: 9px 14px;
  cursor: pointer;
  position: relative;
  box-shadow: 0 4px 0 var(--shadow);
  transition: transform var(--dur-fast) var(--ease-out),
              border-color var(--dur-fast) var(--ease-out),
              color var(--dur-fast) var(--ease-out),
              box-shadow var(--dur-fast) var(--ease-out),
              filter var(--dur-fast) var(--ease-out);
}
.account-btn:hover { border-color: var(--cyan); color: var(--cyan); }
.account-btn:focus-visible { outline: 2px solid var(--cyan); outline-offset: 2px; }
.account-btn:active { transform: translateY(3px) scale(0.97); box-shadow: 0 1px 0 var(--shadow); }
.account-btn.primary {
  background: var(--cyan);
  color: #06222b;
  border-color: #9ff5ff;
  text-shadow: none;
}
.account-btn.primary:hover { color: #06222b; filter: brightness(1.1); }
.account-btn:disabled { opacity: 0.5; cursor: not-allowed; }
.account-panel {
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-width: 340px;
  margin: 0 auto 18px;
  padding: 16px;
  border: 4px solid var(--border);
  background: var(--bg-panel);
  box-shadow: 0 5px 0 var(--shadow), inset 0 0 0 2px var(--bg-sunken);
  animation: panelIn var(--dur-normal) var(--ease-spring);
}
@keyframes panelIn {
  from { opacity: 0; transform: translateY(-10px) scale(0.97); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}
.account-panel input {
  font-family: "VT323", monospace;
  font-size: 20px;
  background: var(--bg-sunken);
  border: 3px solid var(--border);
  color: var(--ink);
  padding: 9px 12px;
  outline: none;
  transition: border-color var(--dur-fast) var(--ease-out);
}
.account-panel input:focus { border-color: var(--cyan); }
.account-actions { display: flex; gap: 8px; }
.account-actions .account-btn { flex: 1; }
.account-msg { font-size: 18px; line-height: 1.4; color: var(--red); margin: 0; min-height: 20px; }

/* ============================================================
   ONGLETS
   ============================================================ */
.tabs {
  display: flex;
  justify-content: center;
  gap: 10px;
  margin-bottom: 24px;
  flex-wrap: wrap;
}
.tab {
  font-family: "Press Start 2P", monospace;
  font-size: 10px;
  color: var(--ink-dim);
  background: var(--bg-panel);
  border: 3px solid var(--border);
  padding: 11px 14px;
  cursor: pointer;
  box-shadow: 0 4px 0 var(--shadow);
  transition: transform var(--dur-fast) var(--ease-out),
              border-color var(--dur-fast) var(--ease-out),
              color var(--dur-fast) var(--ease-out),
              background-color var(--dur-fast) var(--ease-out),
              box-shadow var(--dur-fast) var(--ease-out);
}
.tab:hover { color: var(--ink); border-color: #5a6c96; }
.tab:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }
.tab:active { transform: translateY(3px) scale(0.97); box-shadow: 0 1px 0 var(--shadow); }
.tab.active {
  color: #06222b;
  background: var(--gold);
  border-color: #ffe98a;
  text-shadow: none;
  box-shadow: 0 4px 0 #7a5a00;
}
.tab.active:active { box-shadow: 0 1px 0 #7a5a00; }

/* ============================================================
   INVENTAIRE
   ============================================================ */
.inv-progress { color: var(--ink-dim); font-size: 20px; line-height: 1.4; margin-bottom: 24px; }
.inv-progress b { color: var(--ink); }
.inv-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  grid-template-rows: repeat(4, auto);
  grid-auto-flow: column;
  gap: 12px;
  /* Plus large que le conteneur (1 colonne = 1 personnage), recentrée */
  width: min(880px, 96vw);
  max-width: none;
  position: relative;
  left: 50%;
  transform: translateX(-50%);
}
.inv-slot {
  position: relative;
  aspect-ratio: 5 / 7;
  background: var(--bg-panel);
  border: 3px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  cursor: pointer;
  transition-property: transform, scale, border-color, box-shadow;
  transition-duration: 150ms;
  transition-timing-function: cubic-bezier(0.2, 0, 0, 1);
}
.inv-slot:hover { transform: translate(-2px, -4px); z-index: 2; }
.inv-slot:active { scale: 0.96; }
.inv-slot:focus-visible { outline: 2px solid var(--cyan); outline-offset: 2px; }
.inv-slot::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(105deg, transparent 40%, rgba(255,255,255,0.3) 50%, transparent 60%);
  transform: translateX(-150%);
  transition-property: transform;
  transition-duration: 550ms;
  transition-timing-function: cubic-bezier(0.2, 0, 0, 1);
  pointer-events: none;
}
.inv-slot:hover::after { transform: translateX(150%); }
.inv-slot.rarity-normal { border-color: #8a93a8; }
.inv-slot.rarity-bronze { border-color: #c96a1d; }
.inv-slot.rarity-silver { border-color: #aab8cf; }
.inv-slot.rarity-platine { border-color: #2ec9e8; }
.inv-slot.rarity-normal:hover { border-color: #c7ccd6; box-shadow: 0 0 0 3px rgba(156,163,175,0.35), 0 6px 0 var(--shadow); }
.inv-slot.rarity-bronze:hover { border-color: var(--bronze); box-shadow: 0 0 0 3px rgba(255,158,66,0.4), 0 6px 0 var(--shadow); }
.inv-slot.rarity-silver:hover { border-color: #eef3f9; box-shadow: 0 0 0 3px rgba(223,232,245,0.45), 0 6px 0 var(--shadow); }
.inv-slot.rarity-platine:hover { border-color: var(--cyan); box-shadow: 0 0 0 3px rgba(70,232,255,0.5), 0 6px 0 var(--shadow); }
.inv-slot:hover .inv-name { color: #ffffff; }
.inv-slot.locked:hover .inv-lock { transform: scale(1.15); color: #8b96ad; }
.inv-slot img { width: 100%; height: 100%; object-fit: contain; padding: 6px; }
.inv-slot.locked {
  border-style: dashed;
  background: repeating-linear-gradient(45deg, #10141f 0 8px, #151b2b 8px 16px);
}
.inv-lock {
  font-family: "Press Start 2P", monospace;
  font-size: 26px;
  color: #3f4a63;
  user-select: none;
}
.inv-name {
  position: absolute;
  bottom: 0;
  inset-inline: 0;
  text-align: center;
  font-family: "VT323", monospace;
  font-size: 15px;
  letter-spacing: 1px;
  color: var(--ink);
  background: rgba(6,9,16,0.85);
  padding: 3px 0;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}
.inv-slot.locked .inv-name { color: #5b6683; }
.inv-count {
  position: absolute;
  top: 4px;
  inset-inline-end: 4px;
  font-family: "Press Start 2P", monospace;
  font-size: 10px;
  font-variant-numeric: tabular-nums;
  background: #06090f;
  border: 2px solid var(--border);
  padding: 3px 5px;
}
.inv-rarity {
  position: absolute;
  top: 4px;
  inset-inline-start: 4px;
  font-family: "VT323", monospace;
  font-size: 13px;
  letter-spacing: 1px;
  text-transform: uppercase;
  background: #06090f;
  border: 2px solid var(--border);
  padding: 1px 5px;
}
.inv-slot.rarity-normal .inv-count, .inv-slot.rarity-normal .inv-rarity { color: #c7ccd6; }
.inv-slot.rarity-bronze .inv-count, .inv-slot.rarity-bronze .inv-rarity { color: var(--bronze); }
.inv-slot.rarity-silver .inv-count, .inv-slot.rarity-silver .inv-rarity { color: #e4ebf3; }
.inv-slot.rarity-platine .inv-count, .inv-slot.rarity-platine .inv-rarity { color: var(--cyan); }
/* ============================================================
   SCENE D OUVERTURE
   ============================================================ */
.card-stage {
  position: relative;
  display: flex;
  justify-content: center;
  align-items: center;
  margin-bottom: 28px;
  min-height: 480px;
  perspective: 1200px;
  overflow: visible;
  transition: filter 0.4s ease;
}
.stage-glow {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 320px;
  height: 320px;
  transform: translate(-50%, -50%);
  background: radial-gradient(circle, rgba(70,232,255,0.08), transparent 70%);
  z-index: 0;
  pointer-events: none;
  opacity: 0;
  transition-property: opacity, transform;
  transition-duration: 400ms;
  transition-timing-function: cubic-bezier(0.2, 0, 0, 1);
}
.card-stage.telegraph .stage-glow {
  opacity: 1;
  transform: translate(-50%, -50%) scale(1.3);
}
.card-stage.bronze .stage-glow {
  background: radial-gradient(circle, rgba(255,140,40,0.35), rgba(217,90,20,0.15) 50%, transparent 70%);
}
.card-stage.silver .stage-glow {
  background: radial-gradient(circle, rgba(223,232,245,0.45), rgba(70,232,255,0.2) 50%, transparent 70%);
}
.card-stage.platine .stage-glow {
  background: radial-gradient(circle, rgba(70,232,255,0.5), rgba(255,106,213,0.3) 45%, rgba(255,210,63,0.18) 65%, transparent 75%);
}
.card-pillar {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 140px;
  height: 800px;
  opacity: 0;
  pointer-events: none;
  z-index: 1;
  transition-property: opacity;
  transition-duration: 400ms;
  transition-timing-function: cubic-bezier(0.2, 0, 0, 1);
}
.card-stage.telegraph.bronze .card-pillar {
  opacity: 0.75;
  background: linear-gradient(90deg, transparent, rgba(255,160,60,0.6) 50%, transparent);
}
.card-stage.telegraph.silver .card-pillar {
  opacity: 0.85;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.85) 50%, transparent);
}
.card-stage.telegraph.platine .card-pillar {
  opacity: 0.95;
  width: 180px;
  background: linear-gradient(90deg, transparent, rgba(70,232,255,0.7) 35%, #ffffff 50%, rgba(255,106,213,0.7) 65%, transparent);
}
.card-aura {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 320px;
  height: 460px;
  opacity: 0;
  pointer-events: none;
  z-index: 1;
  transition-property: opacity, box-shadow;
  transition-duration: 400ms;
  transition-timing-function: cubic-bezier(0.2, 0, 0, 1);
}
.card-stage.telegraph.bronze .card-aura {
  opacity: 0.85;
  box-shadow: 0 0 35px rgba(255,140,40,0.6), inset 0 0 20px rgba(255,180,80,0.3);
}
.card-stage.telegraph.silver .card-aura {
  opacity: 0.9;
  box-shadow: 0 0 45px rgba(223,232,245,0.8), inset 0 0 25px rgba(70,232,255,0.4);
}
.card-stage.telegraph.platine .card-aura {
  opacity: 1;
  box-shadow: 0 0 50px rgba(70,232,255,0.85), 0 0 90px rgba(255,106,213,0.6);
}
.card-rays {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 480px;
  height: 480px;
  transform: translate(-50%, -50%);
  z-index: 1;
  opacity: 0;
  transition-property: opacity;
  transition-duration: 400ms;
  transition-timing-function: cubic-bezier(0.2, 0, 0, 1);
  pointer-events: none;
}
.card-rays.on { opacity: 0.8; }
.card-rays.bronze {
  background: repeating-conic-gradient(from 0deg, rgba(255,160,50,0.6) 0deg 6deg, transparent 6deg 30deg);
  -webkit-mask: radial-gradient(circle, transparent 25%, #000 65%);
  mask: radial-gradient(circle, transparent 25%, #000 65%);
  animation: raysSpin 14s linear infinite;
}
.card-rays.silver {
  background: repeating-conic-gradient(from 0deg, rgba(255,255,255,0.75) 0deg 5deg, transparent 5deg 24deg);
  -webkit-mask: radial-gradient(circle, transparent 22%, #000 68%);
  mask: radial-gradient(circle, transparent 22%, #000 68%);
  animation: raysSpin 10s linear infinite;
}
.card-rays.platine {
  background:
    repeating-conic-gradient(from 0deg, rgba(70,232,255,0.85) 0deg 4deg, transparent 4deg 18deg),
    repeating-conic-gradient(from 6deg, rgba(255,106,213,0.75) 0deg 5deg, transparent 5deg 24deg);
  -webkit-mask: radial-gradient(circle, transparent 20%, #000 70%);
  mask: radial-gradient(circle, transparent 20%, #000 70%);
  animation: raysSpin 6s linear infinite;
}
@keyframes raysSpin {
  from { transform: translate(-50%, -50%) rotate(0deg); }
  to { transform: translate(-50%, -50%) rotate(360deg); }
}

/* ============================================================
   LA CARTE
   ============================================================ */
.card-stack {
  position: relative;
  z-index: 2;
  width: min(300px, 80vw);
  aspect-ratio: 5 / 7;
  perspective: 1000px;
  touch-action: none;
  user-select: none;
}
@property --drag-x {
  syntax: "<length>";
  inherits: false;
  initial-value: 0px;
}
@property --drag-rot {
  syntax: "<angle>";
  inherits: false;
  initial-value: 0deg;
}
.card {
  position: absolute;
  inset: 0;
  z-index: 2;
  width: 100%;
  height: 100%;
  --rx: 0deg;
  --ry: 0deg;
  --sx: 50%;
  --sy: 50%;
  --tilt-x: 0;
  --drag-x: 0px;
  --drag-rot: 0deg;
  perspective: 1000px;
  transform-style: preserve-3d;
  will-change: transform;
  transition-property: box-shadow;
  transition-duration: 400ms;
  transition-timing-function: cubic-bezier(0.2, 0, 0, 1);
  cursor: pointer;
}
.card.card-under,
.card.card-under:not(.revealed) {
  z-index: 1;
  pointer-events: none;
  transform: none;
  opacity: 0;
  visibility: hidden;
  box-shadow: none !important;
  filter: none !important;
  transition: none;
}
.card.card-under.ready.peeking {
  opacity: 1;
  visibility: visible;
  transform: scale(0.96) translateY(4px);
  transition: transform 260ms var(--ease-out), opacity 260ms var(--ease-out);
}
.card:not(.revealed):not(.card-under) {
  transform: none;
}
.card.revealed {
  transform: rotateX(var(--rx, 0deg)) rotateY(var(--ry, 0deg)) translateX(var(--drag-x, 0px)) rotate(var(--drag-rot, 0deg));
  transition-property: box-shadow, transform;
  transition-duration: 400ms, 180ms;
  transition-timing-function: cubic-bezier(0.2, 0, 0, 1), cubic-bezier(0.2, 0, 0, 1);
}
.card.dragging {
  transition: none;
  z-index: 4;
}
.card.sliding-out {
  pointer-events: none;
  z-index: 5;
  transition: transform 420ms cubic-bezier(0.25, 1, 0.5, 1), opacity 380ms var(--ease-out);
}
.card.sliding-out.out-right {
  transform: translateX(140%) translateY(-20px) rotate(15deg) scale(0.92);
  opacity: 0;
}
.card.sliding-out.out-left {
  transform: translateX(-140%) translateY(-20px) rotate(-15deg) scale(0.92);
  opacity: 0;
}
.card-shine {
  position: absolute;
  inset: 0;
  z-index: 4;
  pointer-events: none;
  opacity: 0;
  transition-property: opacity;
  transition-duration: 300ms;
  transition-timing-function: cubic-bezier(0.2, 0, 0, 1);
  background: radial-gradient(130% 130% at var(--sx, 50%) var(--sy, 50%), rgba(255,255,255,0.45), rgba(255,255,255,0) 50%);
}
.card.revealed .card-shine { opacity: 0.85; }
.card-inner {
  position: relative;
  width: 100%;
  height: 100%;
  transform: rotateY(0deg) translateZ(0);
  transform-style: preserve-3d;
  transition: transform 620ms cubic-bezier(0.25, 1, 0.5, 1);
  will-change: transform;
}
.card-inner-under {
  transform: rotateY(180deg);
  transition: none;
}
.card.flip .card-inner { transform: rotateY(180deg) translateZ(16px); }
.card.revealed .card-inner { transform: rotateY(180deg) translateZ(0); }
.card-face {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  transform: rotateY(0deg);
  background: var(--bg-panel-2);
  border: 4px solid var(--border);
  box-shadow: inset 0 0 0 2px var(--bg-sunken);
}
.card-front { transform: rotateY(180deg); }
.back-frame {
  position: absolute;
  inset: 12px;
  border: 3px solid #4a5878;
  background:
    repeating-linear-gradient(45deg, rgba(70,232,255,0.05) 0 8px, transparent 8px 16px),
    repeating-linear-gradient(-45deg, rgba(70,232,255,0.05) 0 8px, transparent 8px 16px),
    #121a2c;
  display: flex;
  align-items: center;
  justify-content: center;
}
.back-emblem {
  font-family: "Press Start 2P", monospace;
  font-size: 52px;
  color: var(--cyan);
  text-shadow: 4px 4px 0 #0a4a58, 0 0 24px rgba(70,232,255,0.7);
  animation: emblemFloat 2.2s ease-in-out infinite;
  user-select: none;
}
@keyframes emblemFloat {
  0%, 100% { transform: translateY(0) scale(1); filter: drop-shadow(0 0 16px rgba(70,232,255,0.5)); }
  50% { transform: translateY(-7px) scale(1.04); filter: drop-shadow(0 0 28px rgba(70,232,255,0.9)); }
}
  50% { transform: translateY(-7px); }
}
.card.telegraph .card-back { animation: telegraphGlow 0.8s ease-in-out infinite alternate; }
@keyframes telegraphGlow {
  0% { box-shadow: inset 0 0 0 2px var(--bg-sunken), 0 0 8px rgba(255,255,255,0.2); }
  100% { box-shadow: inset 0 0 0 2px var(--bg-sunken), 0 0 45px var(--telegraph, rgba(255,255,255,0.75)); }
}
  50% { box-shadow: inset 0 0 0 2px var(--bg-sunken), 0 0 44px var(--telegraph, rgba(255,255,255,0.65)); }
}
.card.telegraph.rarity-normal .card-back { --telegraph: rgba(156,163,175,0.7); }
.card.telegraph.rarity-bronze .card-back {
  --telegraph: rgba(255,160,50,0.95);
  animation: telegraphGlow 0.6s ease-in-out infinite alternate;
}
.card.telegraph.rarity-silver .card-back {
  --telegraph: rgba(235,245,255,1);
  animation: telegraphGlow 0.45s ease-in-out infinite alternate;
}
.card.telegraph.rarity-platine .card-back {
  animation: telegraphGlowPlatine 0.4s ease-in-out infinite alternate;
}
@keyframes telegraphGlowPlatine {
  0% { box-shadow: inset 0 0 0 2px var(--bg-sunken), 0 0 22px rgba(70,232,255,0.6), 0 0 44px rgba(255,106,213,0.4); }
  100% { box-shadow: inset 0 0 0 2px var(--bg-sunken), 0 0 60px rgba(70,232,255,1), 0 0 100px rgba(255,106,213,0.95), 0 0 140px rgba(255,210,63,0.75); }
}
  50% { box-shadow: inset 0 0 0 2px var(--bg-sunken), 0 0 55px rgba(70,232,255,1), 0 0 95px rgba(255,106,213,0.9), 0 0 130px rgba(255,210,63,0.7); }
}
.card.shaking { animation: cardShake 0.6s cubic-bezier(0.36, 0.07, 0.19, 0.97); }
@keyframes cardShake {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-8px) rotate(-1deg); }
  40% { transform: translateX(7px) rotate(1deg); }
  60% { transform: translateX(-5px) rotate(-0.5deg); }
  80% { transform: translateX(3px) rotate(0.5deg); }
}
  15% { transform: translateX(-9px); }
  30% { transform: translateX(9px); }
  45% { transform: translateX(-8px); }
  60% { transform: translateX(8px); }
  75% { transform: translateX(-5px); }
  90% { transform: translateX(4px); }
}
.card img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  pointer-events: none;
  user-select: none;
  -webkit-user-drag: none;
}
.card-foil {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 2;
  opacity: 0;
  transition-property: opacity;
  transition-duration: 400ms;
  transition-timing-function: cubic-bezier(0.2, 0, 0, 1);
}
.card.rarity-bronze .card-foil {
  opacity: 0.75;
  background:
    radial-gradient(85% 85% at var(--sx, 50%) var(--sy, 50%), rgba(255,220,130,0.45) 0%, rgba(255,130,20,0.2) 35%, transparent 70%),
    linear-gradient(calc(125deg + var(--tilt-x, 0) * 35deg), transparent 20%, rgba(255,200,100,0.35) 45%, rgba(255,120,30,0.25) 55%, transparent 80%);
  mix-blend-mode: color-dodge;
}
.card.rarity-silver .card-foil {
  opacity: 0.9;
  background:
    radial-gradient(80% 80% at var(--sx, 50%) var(--sy, 50%), rgba(255,255,255,0.65) 0%, rgba(150,230,255,0.35) 40%, transparent 75%),
    linear-gradient(calc(130deg + var(--tilt-x, 0) * 40deg), transparent 20%, rgba(255,255,255,0.55) 42%, rgba(70,232,255,0.4) 52%, transparent 78%);
  mix-blend-mode: color-dodge;
}
.card.rarity-platine .card-foil {
  opacity: 1;
  background:
    radial-gradient(75% 75% at var(--sx, 50%) var(--sy, 50%), rgba(255,255,255,0.75) 0%, rgba(70,232,255,0.4) 35%, transparent 70%),
    repeating-linear-gradient(calc(135deg + var(--tilt-x, 0) * 50deg),
      rgba(255,0,128,0.35) 0%, rgba(255,180,0,0.35) 10%, rgba(0,255,160,0.35) 20%, rgba(0,200,255,0.35) 30%, rgba(180,0,255,0.35) 40%, rgba(255,0,128,0.35) 50%);
  background-size: 200% 200%;
  mix-blend-mode: color-dodge;
  animation: holoShift 5s ease-in-out infinite alternate;
}
@keyframes holoShift {
  0% { background-position: 0% 0%; }
  100% { background-position: 100% 100%; }
}
  50% { background-position: 100% 100%; }
  100% { background-position: 0% 0%; }
}
/* --- Glitter : petites etoiles discretes (fix mosaique de carres) --- */
.card-glitter {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 3;
  opacity: 0;
  transition-property: opacity;
  transition-duration: 400ms;
  transition-timing-function: cubic-bezier(0.2, 0, 0, 1);
  overflow: hidden;
}
.card.rarity-platine .card-glitter {
  opacity: 0.9;
  background-image:
    radial-gradient(circle at 18% 22%, #ffffff 0 2px, transparent 3px),
    radial-gradient(circle at 78% 18%, #7feaff 0 2px, transparent 3px),
    radial-gradient(circle at 32% 68%, #ffe484 0 2px, transparent 3px),
    radial-gradient(circle at 68% 78%, #ff88f0 0 2px, transparent 3px),
    radial-gradient(circle at 88% 52%, #ffffff 0 1.5px, transparent 2.5px),
    radial-gradient(circle at 12% 82%, #7ffffa 0 1.5px, transparent 2.5px),
    radial-gradient(circle at 48% 8%, #ffffff 0 1.5px, transparent 2.5px),
    radial-gradient(circle at 92% 88%, #ffffff 0 1px, transparent 2px);
  background-size: 120px 120px;
  mix-blend-mode: screen;
  animation: glitterTwinkle 1.1s ease-in-out infinite alternate;
}
.card.rarity-silver .card-glitter {
  opacity: 0.7;
  background-image:
    radial-gradient(circle at 22% 28%, #ffffff 0 2px, transparent 3px),
    radial-gradient(circle at 72% 62%, #c4eeff 0 2px, transparent 3px),
    radial-gradient(circle at 42% 82%, #ffffff 0 1.5px, transparent 2.5px),
    radial-gradient(circle at 82% 18%, #ffffff 0 1.5px, transparent 2.5px);
  background-size: 100px 100px;
  mix-blend-mode: screen;
  animation: glitterTwinkle 1.1s ease-in-out infinite alternate;
}
@keyframes glitterTwinkle {
  0% { opacity: 0.35; transform: scale(0.97); }
  100% { opacity: 0.95; transform: scale(1.03); }
}
  100% { opacity: 0.9; transform: scale(1.02); }
}
.card-front::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(110deg, transparent 38%, rgba(255,255,255,0.55) 50%, transparent 62%);
  transform: translateX(-130%);
  pointer-events: none;
  z-index: 3;
}
.card.flip .card-front::after,
.card.revealed .card-front::after {
  animation: shineSweep 0.85s var(--ease-out) 0.08s;
}
@keyframes shineSweep {
  to { transform: translateX(130%); }
}
.card.rarity-normal { box-shadow: 0 6px 0 var(--shadow); }
.card.rarity-bronze { box-shadow: 0 6px 0 var(--shadow), 0 0 35px rgba(255,140,40,0.7); }
.card.rarity-silver { box-shadow: 0 6px 0 var(--shadow), 0 0 45px rgba(255,255,255,0.85); }
.card.rarity-platine {
  box-shadow:
    0 6px 0 var(--shadow),
    0 0 50px rgba(70,232,255,0.95),
    0 0 95px rgba(255,106,213,0.7),
    0 0 140px rgba(255,210,63,0.45);
  animation: platineAura 3.6s ease-in-out infinite alternate;
}
@keyframes platineAura {
  0% {
    box-shadow:
      0 6px 0 var(--shadow),
      0 0 45px rgba(70,232,255,0.85),
      0 0 85px rgba(255,106,213,0.55),
      0 0 130px rgba(255,210,63,0.35);
  }
  100% {
    box-shadow:
      0 6px 0 var(--shadow),
      0 0 65px rgba(255,210,63,0.95),
      0 0 115px rgba(70,232,255,0.85),
      0 0 160px rgba(255,106,213,0.65);
  }
}
.card.rarity-normal .card-face { border-color: #8a93a8; }
.card.rarity-bronze .card-face {
  border-color: var(--bronze);
  box-shadow: inset 0 0 18px rgba(255,140,40,0.4);
}
.card.rarity-silver .card-face {
  border-color: #ffffff;
  box-shadow: inset 0 0 22px rgba(200,230,255,0.5);
}
.card.rarity-platine .card-face {
  border-color: #b3f0ff;
  box-shadow: inset 0 0 26px rgba(70,232,255,0.65);
}
.rarity-badge {
  position: absolute;
  bottom: 12px;
  left: 50%;
  transform: translateX(-50%);
  font-family: "Press Start 2P", monospace;
  font-size: 10px;
  letter-spacing: 1px;
  text-transform: uppercase;
  white-space: nowrap;
  padding: 7px 12px;
  border: 3px solid;
  z-index: 4;
}
.rarity-normal .rarity-badge {
  color: #d1d5db;
  background: #10141f;
  border-color: #8a93a8;
}
.rarity-bronze .rarity-badge {
  color: #fff1d6;
  background: #a35612;
  border-color: var(--bronze);
  text-shadow: 2px 2px 0 rgba(0,0,0,0.6);
}
.rarity-silver .rarity-badge {
  color: #0c1524;
  background: #e8eef8;
  border-color: #ffffff;
  text-shadow: none;
}
.rarity-platine .rarity-badge {
  color: #06222b;
  background: var(--cyan);
  border-color: #ffffff;
  text-shadow: none;
  animation: platineBadge 1.8s ease-in-out infinite alternate;
}
@keyframes platineBadge {
  0% { background: var(--cyan); }
  100% { background: var(--gold); }
}
.burst {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 740px;
  height: 600px;
  transform: translate(-50%, -50%);
  z-index: 5;
  pointer-events: none;
}
/* --- Flash plein ecran --- */
.flash {
  position: fixed;
  inset: 0;
  background: radial-gradient(circle at 50% 42%, #ffffff, rgba(255,255,255,0.45) 55%, transparent 75%);
  opacity: 0;
  pointer-events: none;
  z-index: 300;
}
.flash.go { animation: flashOut 0.6s cubic-bezier(0.16, 1, 0.3, 1) forwards; }
.flash.bronze {
  background: radial-gradient(circle at 50% 42%, rgba(255,210,130,0.9), rgba(217,130,43,0.45) 50%, transparent 75%);
}
.flash.silver {
  background: radial-gradient(circle at 50% 42%, #ffffff, rgba(180,230,255,0.7) 50%, transparent 80%);
}
.flash.platine {
  background: radial-gradient(circle at 50% 42%, #ffffff, rgba(70,232,255,0.85) 40%, rgba(255,106,213,0.5) 60%, transparent 85%);
}
.flash.super {
  background: radial-gradient(circle at 50% 42%, #ffffff 0%, #ffffff 25%, rgba(70,232,255,0.9) 45%, rgba(255,106,213,0.6) 65%, transparent 90%);
  animation: flashSuper 0.9s cubic-bezier(0.16, 1, 0.3, 1) forwards !important;
}
@keyframes flashOut {
  0% { opacity: 0.95; }
  100% { opacity: 0; }
}
  100% { opacity: 0; }
}
@keyframes flashSuper {
  0% { opacity: 0; }
  15% { opacity: 1; }
  45% { opacity: 0.65; }
  100% { opacity: 0; }
}
  8% { opacity: 1; }
  20% { opacity: 0.55; }
  32% { opacity: 1; }
  100% { opacity: 0; }
}
.card-stage.stage-shake { animation: stageShake 0.5s cubic-bezier(0.36, 0.07, 0.19, 0.97); }
@keyframes stageShake {
  0%, 100% { transform: translate(0, 0); }
  20% { transform: translate(-7px, 4px); }
  40% { transform: translate(7px, -4px); }
  60% { transform: translate(-4px, 2px); }
  80% { transform: translate(3px, -1px); }
}
  15% { transform: translate(-8px, 5px); }
  30% { transform: translate(8px, -5px); }
  45% { transform: translate(-6px, 4px); }
  60% { transform: translate(6px, -3px); }
  75% { transform: translate(-4px, 2px); }
  90% { transform: translate(3px, -1px); }
}
.pity-text {
  margin-top: 14px;
  font-size: 19px;
  line-height: 1.4;
  color: var(--ink-dim);
  min-height: 22px;
  font-variant-numeric: tabular-nums;
}
.pity-text.hot {
  color: var(--gold);
  animation: pityPulse 0.8s ease-in-out infinite alternate;
  text-shadow: 0 0 18px rgba(255,210,63,0.8);
}
@keyframes pityPulse {
  0% { opacity: 0.65; }
  100% { opacity: 1; }
}
  50% { opacity: 1; }
}
.pity-bar {
  margin: 10px auto 0;
  width: 220px;
  height: 12px;
  border: 3px solid var(--border);
  background: var(--bg-sunken);
  box-shadow: inset 0 0 0 2px var(--shadow);
  overflow: hidden;
}
.pity-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, #46e8ff, #ffd23f);
  width: 0%;
  transition-property: width;
  transition-duration: 400ms;
  transition-timing-function: cubic-bezier(0.2, 0, 0, 1);
}
.pity-bar.hot .pity-bar-fill {
  background: linear-gradient(90deg, #ffd23f, #ff9e42, #ff6ad5);
  animation: pityBarFlicker 0.6s ease-in-out infinite alternate;
}
@keyframes pityBarFlicker {
  0%, 100% { filter: brightness(1); }
  50% { filter: brightness(1.5); }
}
.sound-btn { font-size: 13px; padding: 8px 12px; }
/* Cross-fade icône son : scale 0.25→1, opacity 0→1, blur 4px→0, 300ms */
.sound-btn .snd {
  display: inline-block;
  transition-property: opacity, scale, filter, transform;
  transition-duration: 300ms;
  transition-timing-function: cubic-bezier(0.2, 0, 0, 1);
}
.sound-btn .snd[hidden] { display: none !important; }
.sound-btn.pop .snd:not([hidden]) {
  animation: sndPop 300ms cubic-bezier(0.2, 0, 0, 1);
}
@keyframes sndPop {
  from { opacity: 0; scale: 0.25; filter: blur(4px); }
  to { opacity: 1; scale: 1; filter: blur(0); }
}
/* Stagger inventaire : entrée rare, ~100ms entre groupes */
.inv-grid.enter .inv-slot {
  opacity: 0;
  transform: translateY(12px);
  filter: blur(4px);
  animation: invIn 400ms cubic-bezier(0.2, 0, 0, 1) forwards;
}
.inv-grid.enter .inv-slot:nth-child(4n+2) { animation-delay: 100ms; }
.inv-grid.enter .inv-slot:nth-child(4n+3) { animation-delay: 200ms; }
.inv-grid.enter .inv-slot:nth-child(4n+4) { animation-delay: 300ms; }
@keyframes invIn {
  to { opacity: 1; transform: translateY(0); filter: blur(0); }
}

/* ============================================================
   BOUTON OUVRIR - GROS BOUTON ARCADE
   ============================================================ */
.open-btn {
  position: relative;
  font-family: "Press Start 2P", monospace;
  font-size: 13px;
  color: #2b1200;
  background: linear-gradient(180deg, #ffe066, var(--gold) 45%, #e8a600);
  border: 4px solid #fff2b3;
  padding: 16px 28px;
  cursor: pointer;
  box-shadow: 0 7px 0 #7a5a00, 0 0 26px rgba(255,210,63,0.45);
  transition-property: transform, scale, filter, box-shadow;
  transition-duration: 150ms;
  transition-timing-function: cubic-bezier(0.2, 0, 0, 1);
  animation: btnPulse 1.6s ease-in-out infinite;
}
@keyframes btnPulse {
  0%, 100% { box-shadow: 0 7px 0 #7a5a00, 0 0 18px rgba(255,210,63,0.35); }
  50% { box-shadow: 0 7px 0 #7a5a00, 0 0 34px rgba(255,210,63,0.75); }
}
.open-btn:hover:not(:disabled) { filter: brightness(1.12); }
.open-btn:focus-visible { outline: 2px solid #fff2b3; outline-offset: 3px; }
.open-btn:active:not(:disabled) {
  transform: translateY(6px) scale(0.96);
  box-shadow: 0 1px 0 #7a5a00;
  animation: none;
}
.open-btn:disabled {
  filter: grayscale(0.7);
  opacity: 0.55;
  cursor: not-allowed;
  animation: none;
}
.open-btn.onfire {
  animation: btnPulse 0.7s ease-in-out infinite, btnFire 0.35s ease-in-out infinite !important;
  background: linear-gradient(180deg, #ffe066, #ff9e42 45%, #ff5a1a);
  border-color: #fff2b3;
  color: #2b1200;
  box-shadow: 0 7px 0 #7a2a00, 0 0 34px rgba(255,140,40,0.8);
}
@keyframes btnFire {
  0%, 100% { filter: brightness(1) saturate(1); }
  50% { filter: brightness(1.25) saturate(1.4); }
}

/* ============================================================
   STATISTIQUES
   ============================================================ */
.stats {
  display: flex;
  justify-content: center;
  gap: 10px;
  margin-top: 28px;
  flex-wrap: wrap;
}
.stat {
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 78px;
  padding: 8px 6px;
  background: var(--bg-panel);
  border: 3px solid var(--border);
  box-shadow: 0 4px 0 var(--shadow);
  transition-property: transform, scale, border-color;
  transition-duration: 150ms;
  transition-timing-function: cubic-bezier(0.2, 0, 0, 1);
}
.stat span { font-family: "Press Start 2P", monospace; font-size: 15px; font-variant-numeric: tabular-nums; }
.stat small {
  font-family: "VT323", monospace;
  color: var(--ink-dim);
  font-size: 16px;
  margin-top: 5px;
}
.stat-normal span { color: #c7ccd6; }
.stat-bronze span { color: var(--bronze); }
.stat-silver span { color: #e4ebf3; }
.stat-platine span { color: var(--cyan); }
.stat.stat-bump {
  animation: statBump 0.45s var(--ease-spring);
  border-color: var(--gold);
}
@keyframes statBump {
  0% { transform: scale(1); }
  40% { transform: scale(1.14); }
  100% { transform: scale(1); }
}
  35% { transform: scale(1.12); }
  100% { transform: scale(1); }
}
@media (max-width: 700px) {
  /* 2 colonnes en flux ligne : les paires N/B et S/P restent groupées */
  .inv-grid {
    grid-auto-flow: row;
    grid-template-columns: repeat(2, 1fr);
    grid-template-rows: none;
    width: 100%;
    left: auto;
    transform: none;
  }
}
/* ============================================================
   MODALE
   ============================================================ */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(5,7,12,0.88);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: calc(24px + env(safe-area-inset-top)) calc(24px + env(safe-area-inset-right)) calc(24px + env(safe-area-inset-bottom)) calc(24px + env(safe-area-inset-left));
  transition-property: opacity;
  transition-duration: 150ms;
  transition-timing-function: cubic-bezier(0.2, 0, 0, 1);
}
.modal-overlay[hidden] { display: none !important; }
.modal-overlay.closing { opacity: 0; }
.modal-overlay.closing .modal-card {
  opacity: 0;
  transform: translateY(-12px) scale(0.98);
}
.modal-card {
  position: relative;
  max-width: 380px;
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  will-change: transform, opacity;
  transition-property: transform, opacity;
  transition-duration: 150ms;
  transition-timing-function: cubic-bezier(0.2, 0, 0, 1);
  animation: modalIn var(--dur-normal) var(--ease-spring);
}
@keyframes modalIn {
  from { transform: translateY(14px) scale(0.95); opacity: 0; filter: blur(4px); }
  to { transform: translateY(0) scale(1); opacity: 1; filter: blur(0); }
}
  to { transform: translateY(0) scale(1); opacity: 1; filter: blur(0); }
}
.modal-frame {
  position: relative;
  width: min(300px, 78vw);
  aspect-ratio: 5 / 7;
  background: var(--bg-panel-2);
  border: 4px solid var(--border);
  box-shadow: 0 6px 0 var(--shadow);
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}
.modal-frame img { width: 100%; height: 100%; object-fit: contain; }
.modal-frame.locked { border-style: dashed; }
.modal-lock {
  font-family: "Press Start 2P", monospace;
  font-size: 48px;
  color: #3f4a63;
  user-select: none;
}
.modal-badge {
  position: absolute;
  bottom: 12px;
  left: 50%;
  transform: translateX(-50%);
  font-family: "Press Start 2P", monospace;
  font-size: 10px;
  letter-spacing: 1px;
  text-transform: uppercase;
  background: #06090f;
  border: 3px solid var(--border);
  padding: 6px 10px;
}
.modal-card.rarity-normal .modal-frame {
  border-color: #8a93a8;
  box-shadow: 0 6px 0 var(--shadow), 0 0 30px rgba(156,163,175,0.35);
}
.modal-card.rarity-bronze .modal-frame {
  border-color: #c96a1d;
  box-shadow: 0 6px 0 var(--shadow), 0 0 38px rgba(255,158,66,0.5);
}
.modal-card.rarity-silver .modal-frame {
  border-color: #aab8cf;
  box-shadow: 0 6px 0 var(--shadow), 0 0 40px rgba(223,232,245,0.5);
}
.modal-card.rarity-platine .modal-frame {
  border-color: #2ec9e8;
  box-shadow: 0 6px 0 var(--shadow), 0 0 44px rgba(70,232,255,0.6);
}
.modal-card.rarity-normal .modal-badge { color: #c7ccd6; border-color: #8a93a8; }
.modal-card.rarity-bronze .modal-badge { color: var(--bronze); border-color: #c96a1d; }
.modal-card.rarity-silver .modal-badge { color: #e4ebf3; border-color: #aab8cf; }
.modal-card.rarity-platine .modal-badge { color: var(--cyan); border-color: #2ec9e8; }
.modal-name {
  font-family: "Press Start 2P", monospace;
  font-size: 15px;
  line-height: 1.4;
  letter-spacing: 1px;
  color: var(--gold);
  text-align: center;
  text-transform: uppercase;
  text-wrap: balance;
  text-shadow: 2px 2px 0 rgba(0,0,0,0.6);
}
.modal-sub { font-size: 19px; line-height: 1.5; color: var(--ink-dim); text-align: center; text-wrap: pretty; }
.modal-close {
  position: absolute;
  top: -12px;
  inset-inline-end: -12px;
  width: 40px;
  height: 40px;
  border: 3px solid #4a5878;
  background: var(--bg-panel-2);
  color: var(--ink);
  font-family: "Press Start 2P", monospace;
  font-size: 12px;
  line-height: 1;
  cursor: pointer;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 0 var(--shadow);
  transition-property: transform, scale, border-color, color, box-shadow;
  transition-duration: 150ms;
  transition-timing-function: cubic-bezier(0.2, 0, 0, 1);
}
.modal-close span { display: inline-block; transform: translateY(-1px); }
.modal-close:hover { border-color: var(--red); color: var(--red); }
.modal-close:focus-visible { outline: 2px solid var(--red); outline-offset: 2px; }
.modal-close:active { transform: translateY(3px) scale(0.96); box-shadow: 0 1px 0 var(--shadow); }
/* ============================================================
   ANNONCE DE RARETE (Bronze / Silver / Platine)
   ============================================================ */
.announce {
  position: fixed;
  top: 22%;
  left: 50%;
  transform: translate(-50%, -50%) scale(1);
  font-family: "Press Start 2P", monospace;
  font-size: clamp(15px, 5vw, 30px);
  letter-spacing: 2px;
  color: #ffffff;
  text-shadow: 4px 4px 0 #000;
  white-space: nowrap;
  pointer-events: none;
  z-index: 400;
  opacity: 0;
}
.announce.show { animation: announceSlam 1.8s var(--ease-spring) forwards; }
.announce.bronze { color: var(--bronze); }
.announce.silver { color: var(--silver); }
.announce.platine { font-size: clamp(16px, 6vw, 36px); }
.announce.show.platine {
  animation: announceSlam 2s var(--ease-spring) forwards, announceRainbow 1.2s ease-in-out infinite alternate;
}
@keyframes announceSlam {
  0% { opacity: 0; transform: translate(-50%, -50%) scale(0.8); }
  14% { opacity: 1; transform: translate(-50%, -50%) scale(1.08); }
  24% { transform: translate(-50%, -50%) scale(1); }
  80% { opacity: 1; transform: translate(-50%, -50%) scale(1); }
  100% { opacity: 0; transform: translate(-50%, -60%) scale(0.95); }
}
@keyframes announceRainbow {
  0% { color: var(--cyan); }
  33% { color: var(--pink); }
  66% { color: var(--gold); }
}
.edge-glow {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 350;
  opacity: 0;
  transition-property: opacity;
  transition-duration: 250ms;
  transition-timing-function: cubic-bezier(0.2, 0, 0, 1);
}
.edge-glow.on {
  opacity: 1;
  animation: edgePulse 1.2s ease-in-out infinite alternate;
}
.edge-glow.bronze { box-shadow: inset 0 0 70px 22px rgba(255,140,40,0.5); }
.edge-glow.silver { box-shadow: inset 0 0 85px 26px rgba(223,232,245,0.55); }
.edge-glow.platine {
  box-shadow: inset 0 0 100px 32px rgba(70,232,255,0.6), inset 0 0 150px 55px rgba(255,106,213,0.4);
}
@keyframes edgePulse {
  0% { opacity: 0.5; }
  100% { opacity: 1; }
}
  50% { opacity: 1; }
}

/* ============================================================
   EFFETS CINEMATIQUES (slow-mo, hit-stop, chroma, etc.)
   ============================================================ */
.card-stage.slowmo .card {
  filter: saturate(1.4) contrast(1.15) brightness(1.15);
  transition: filter 0.3s;
}
.card-stage.slowmo .card-back { animation-duration: 0.18s !important; }
.card-stage.slowmo .card-rays.on {
  animation-duration: 2.2s !important;
  opacity: 1;
}
.card-stage.slowmo::before {
  content: "";
  position: absolute;
  inset: -8%;
  background: radial-gradient(circle at 50% 50%, transparent 42%, rgba(0,0,0,0.55) 78%);
  pointer-events: none;
  z-index: 4;
  animation: slowmoVignetteIn 0.5s ease forwards;
}
@keyframes slowmoVignetteIn {
  from { opacity: 0; }
  to { opacity: 1; }
}
.card.chroma::before,
.card.chroma::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;
  z-index: 2;
  animation: chromaGhost 0.35s ease-out forwards;
}
.card.chroma::before {
  background: inherit;
  transform: translate(3px, 0);
  mix-blend-mode: screen;
  opacity: 0.7;
}
.card.chroma::after {
  background: inherit;
  transform: translate(-3px, 0);
  mix-blend-mode: screen;
  opacity: 0.7;
}
@keyframes chromaGhost {
  0% { opacity: 0.7; }
  100% { opacity: 0; }
}
.card-stage.hitstop .card,
.card-stage.hitstop .card-rays,
.card-stage.hitstop .card-pillar,
.card-stage.hitstop .card-aura {
  animation-play-state: paused !important;
}
.card-stage.platine::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 300px;
  height: 300px;
  transform: translate(-50%, -50%) scale(0);
  border: 6px solid rgba(255,255,255,0.9);
  box-shadow: 0 0 40px rgba(70,232,255,0.8), inset 0 0 40px rgba(255,106,213,0.6);
  border-radius: 50%;
  opacity: 0;
  pointer-events: none;
  z-index: 3;
}
.card-stage.platine.ringboom::after {
  animation: ringBoom 0.7s cubic-bezier(0.1, 0.6, 0.2, 1) forwards;
}
@keyframes ringBoom {
  0% { transform: translate(-50%,-50%) scale(0.2); opacity: 1; border-width: 10px; }
  100% { transform: translate(-50%,-50%) scale(3.2); opacity: 0; border-width: 2px; }
}
.new-badge {
  position: fixed;
  top: 34%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-family: "Press Start 2P", monospace;
  font-size: clamp(13px, 4vw, 22px);
  color: var(--green);
  letter-spacing: 2px;
  text-shadow: 3px 3px 0 #0a3a0a, 0 0 30px rgba(125,255,110,0.8);
  pointer-events: none;
  z-index: 410;
  opacity: 0;
  white-space: nowrap;
}
.new-badge.show { animation: newBadgeSlam 1.8s var(--ease-spring) forwards; }
@keyframes newBadgeSlam {
  0% { opacity: 0; transform: translate(-50%,-50%) scale(0.6) rotate(-4deg); }
  18% { opacity: 1; transform: translate(-50%,-50%) scale(1.15) rotate(1deg); }
  30% { transform: translate(-50%,-50%) scale(1); }
  80% { opacity: 1; transform: translate(-50%,-50%) scale(1); }
  100% { opacity: 0; transform: translate(-50%,-65%) scale(0.9); }
}
.card.revealpop .card-inner {
  animation: revealPop 0.55s cubic-bezier(0.2, 1.4, 0.35, 1) both;
}
@keyframes revealPop {
  0% { transform: rotateY(180deg) scale(1); }
  45% { transform: rotateY(180deg) scale(1.13); }
  70% { transform: rotateY(180deg) scale(0.97); }
  100% { transform: rotateY(180deg) scale(1); }
}
.card.shaking.megashake { animation: megaShake 0.45s ease-in-out infinite alternate !important; }
@keyframes megaShake {
  0% { transform: translate(-6px, 3px) rotate(-1.5deg); }
  100% { transform: translate(6px, -3px) rotate(1.5deg); }
}
  15% { transform: translate(-11px, 4px) rotate(-2deg); }
  30% { transform: translate(11px, -4px) rotate(2deg); }
  45% { transform: translate(-9px, -3px) rotate(-1.5deg); }
  60% { transform: translate(9px, 3px) rotate(1.5deg); }
  75% { transform: translate(-6px, 2px) rotate(-1deg); }
  90% { transform: translate(5px, -2px) rotate(1deg); }
}


/* --- Toast de progression de collection --- */
.toast-stack {
  position: fixed;
  bottom: calc(22px + env(safe-area-inset-bottom));
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  z-index: 500;
  pointer-events: none;
}
.toast {
  font-family: "VT323", monospace;
  font-size: 20px;
  letter-spacing: 1px;
  color: var(--ink);
  background: rgba(10,14,24,0.95);
  border: 3px solid var(--border);
  padding: 8px 18px;
  box-shadow: 0 4px 0 var(--shadow);
  opacity: 0;
  transform: translateY(12px);
  filter: blur(4px);
  animation: toastIn 2.6s var(--ease-out) forwards;
  white-space: nowrap;
  max-width: min(520px, 92vw);
  overflow: hidden;
  text-overflow: ellipsis;
}
.toast.bronze { border-color: var(--bronze); color: var(--bronze); }
.toast.silver { border-color: var(--silver); color: var(--silver); }
.toast.platine {
  border-color: var(--platine);
  color: var(--platine);
  box-shadow: 0 4px 0 var(--shadow), 0 0 22px rgba(70,232,255,0.5);
}
.toast.gold { border-color: var(--gold); color: var(--gold); }
@keyframes toastIn {
  0% { opacity: 0; transform: translateY(14px) scale(0.96); filter: blur(3px); }
  10% { opacity: 1; transform: translateY(0) scale(1); filter: blur(0); }
  85% { opacity: 1; transform: translateY(0) scale(1); filter: blur(0); }
  100% { opacity: 0; transform: translateY(-12px) scale(0.96); filter: blur(3px); }
}
.streak-counter {
  position: fixed;
  top: calc(16px + env(safe-area-inset-top));
  inset-inline-end: calc(18px + env(safe-area-inset-right));
  font-family: "Press Start 2P", monospace;
  font-size: 11px;
  font-variant-numeric: tabular-nums;
  color: var(--gold);
  text-shadow: 2px 2px 0 #5a3a00;
  z-index: 450;
  opacity: 0;
  transform: translateX(20px);
  transition-property: opacity, transform;
  transition-duration: 300ms;
  transition-timing-function: cubic-bezier(0.2, 0, 0, 1);
  pointer-events: none;
  text-align: end;
  line-height: 1.7;
}
.streak-counter.show { opacity: 1; transform: translateX(0); }
.streak-counter .streak-num {
  font-size: 18px;
  display: inline-block;
  animation: streakPop 0.4s cubic-bezier(0.2, 1.6, 0.4, 1);
}
@keyframes streakPop {
  0% { transform: scale(0.4); }
  100% { transform: scale(1); }
}
.inv-slot.just-got {
  animation: slotJustGot 0.8s var(--ease-spring);
  z-index: 5;
}
@keyframes slotJustGot {
  0% { transform: scale(1); box-shadow: 0 0 0 0 rgba(125,255,110,0.9); }
  35% { transform: scale(1.15); box-shadow: 0 0 0 8px rgba(125,255,110,0.5); }
  70% { transform: scale(1.03); }
  100% { transform: scale(1); box-shadow: 0 0 0 0 rgba(125,255,110,0); }
}
  30% { transform: scale(1.15); box-shadow: 0 0 0 6px rgba(125,255,110,0.6); }
  60% { transform: scale(1.05); }
  100% { transform: scale(1); box-shadow: 0 0 0 0 rgba(125,255,110,0); }
}
body.impact-platine { animation: bodyImpact 0.4s var(--ease-out); }
@keyframes bodyImpact {
  0%, 100% { transform: translate(0,0); }
  25% { transform: translate(-4px, 2px); }
  50% { transform: translate(4px, -2px); }
  75% { transform: translate(-2px, -1px); }
}
  20% { transform: translate(-5px, 3px); }
  40% { transform: translate(5px, -3px); }
  60% { transform: translate(-3px, -2px); }
  80% { transform: translate(3px, 2px); }
}
.card.revealed.rarity-platine::before {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 600px;
  height: 80px;
  transform: translate(-50%, -50%) rotate(-35deg);
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.35), transparent);
  z-index: 3;
  pointer-events: none;
  animation: divineSweep 3.4s linear infinite;
}
@keyframes divineSweep {
  0% { transform: translate(-50%, -50%) rotate(-35deg) translateX(-320px); opacity: 0; }
  15% { opacity: 0.9; }
  50% { transform: translate(-50%, -50%) rotate(-35deg) translateX(320px); opacity: 0.9; }
  65% { opacity: 0; }
  100% { transform: translate(-50%, -50%) rotate(-35deg) translateX(320px); opacity: 0; }
}

@media (prefers-reduced-motion: reduce) {
  .card.revealpop .card-inner,
    .card.revealed.rarity-platine::before,
  .card.shaking.megashake,
  .open-btn.onfire,
  .open-btn,
  .announce.show,
  .new-badge.show,
  .card-rays,
  .card-foil,
  .card-glitter,
  .modal-card,
  .inv-grid.enter .inv-slot,
  .toast,
  .sound-btn.pop .snd:not([hidden]),
  body.impact-platine {
    animation: none !important;
    transition: none !important;
  }
}
/* Image de la carte — rayon concentrique (parent net, inset 8px) + outline neutre */
.card-front img {
  position: absolute;
  inset: 8px;
  width: calc(100% - 16px);
  height: calc(100% - 16px);
  object-fit: contain;
  border-radius: 2px;
  outline: 1px solid var(--img-outline);
  outline-offset: -1px;
  opacity: 0;
  transition-property: opacity;
  transition-duration: 300ms;
  transition-timing-function: cubic-bezier(0.2, 0, 0, 1);
}
.inv-slot img,
.modal-frame img {
  outline: 1px solid var(--img-outline);
  outline-offset: -1px;
}

.card.revealed .card-front img,
.card.flip .card-front img,
.card-under.ready .card-front img {
  opacity: 1;
}

/* ==========================================================================
   PANNEAU D'ADMINISTRATION CONCARD (CLOUD FLARE KV)
   ========================================================================== */

.admin-container {
  max-width: 680px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 20px;
  animation: viewFadeIn 280ms var(--ease-out);
}

@keyframes viewFadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

.admin-header {
  text-align: center;
  margin-bottom: 5px;
}

.admin-header h2 {
  font-family: "Press Start 2P", monospace;
  font-size: 16px;
  color: var(--cyan);
  text-shadow: 0 0 10px rgba(70, 232, 255, 0.4);
  margin-bottom: 6px;
}

.admin-subtitle {
  font-size: 18px;
  color: var(--ink-dim);
}

.admin-auth-box {
  background: var(--bg-panel);
  border: 2px solid var(--border);
  padding: 16px;
  border-radius: 4px;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.3);
}

.admin-auth-box label {
  display: block;
  font-size: 18px;
  color: var(--gold);
  margin-bottom: 8px;
}

.admin-key-row {
  display: flex;
  gap: 10px;
}

.admin-key-row input {
  flex: 1;
  background: var(--bg-sunken);
  border: 2px solid var(--border);
  color: var(--ink);
  font-family: "VT323", monospace;
  font-size: 20px;
  padding: 8px 12px;
  border-radius: 4px;
  outline: none;
  transition: border-color 200ms;
}

.admin-key-row input:focus {
  border-color: var(--cyan);
  box-shadow: 0 0 8px rgba(70, 232, 255, 0.3);
}

.admin-msg {
  font-size: 16px;
  margin-top: 8px;
  min-height: 20px;
}
.admin-msg.success { color: var(--green); }
.admin-msg.error { color: var(--red); }

.admin-card-box,
.admin-catalog-box {
  background: var(--bg-panel);
  border: 2px solid var(--border);
  border-radius: 4px;
  padding: 20px;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.3);
}

.admin-card-box h3,
.admin-catalog-box h3 {
  font-family: "Press Start 2P", monospace;
  font-size: 13px;
  color: var(--gold);
  margin-bottom: 16px;
  text-shadow: 0 0 8px rgba(255, 210, 63, 0.3);
}

.admin-form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.form-group.full-width {
  grid-column: 1 / -1;
}

.form-group label {
  font-size: 17px;
  color: var(--ink-dim);
}

.form-group input,
.form-group select {
  background: var(--bg-sunken);
  border: 2px solid var(--border);
  color: var(--ink);
  font-family: "VT323", monospace;
  font-size: 20px;
  padding: 8px 12px;
  border-radius: 4px;
  outline: none;
}

.form-group input:focus,
.form-group select:focus {
  border-color: var(--cyan);
  box-shadow: 0 0 8px rgba(70, 232, 255, 0.3);
}

.form-group select option {
  background: var(--bg-panel-2);
  color: var(--ink);
}

.admin-upload-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 6px;
}

.admin-or {
  color: var(--ink-dim);
  font-size: 16px;
}

.admin-file-label {
  display: inline-flex;
  align-items: center;
  background: var(--bg-panel-2);
  border: 1px dashed var(--cyan);
  color: var(--cyan);
  padding: 6px 14px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 17px;
  transition: all 200ms;
}

.admin-file-label:hover {
  background: rgba(70, 232, 255, 0.15);
  box-shadow: 0 0 10px rgba(70, 232, 255, 0.25);
}

.admin-file-label input[type="file"] {
  display: none;
}

/* Aperçu en direct */
.admin-preview-section {
  margin: 18px 0;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.admin-preview-section h4 {
  font-size: 16px;
  color: var(--ink-dim);
  margin-bottom: 10px;
}

.admin-preview-card {
  width: 150px;
  height: 215px;
  border-radius: 6px;
  background: var(--bg-sunken);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  padding: 10px;
  position: relative;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.6);
  border: 3px solid #666;
  transition: all 250ms;
}

.admin-preview-card.rarity-normal {
  border-color: var(--green);
  box-shadow: 0 0 14px rgba(125, 255, 110, 0.3);
}
.admin-preview-card.rarity-bronze {
  border-color: var(--bronze);
  box-shadow: 0 0 16px rgba(255, 158, 66, 0.4);
}
.admin-preview-card.rarity-silver {
  border-color: var(--silver);
  box-shadow: 0 0 18px rgba(223, 232, 242, 0.5);
}
.admin-preview-card.rarity-platine {
  border-color: var(--cyan);
  box-shadow: 0 0 24px rgba(70, 232, 255, 0.6);
  animation: chromaPulse 2.5s infinite alternate;
}

.preview-badge {
  font-family: "Press Start 2P", monospace;
  font-size: 8px;
  padding: 3px 8px;
  border-radius: 2px;
  background: rgba(0, 0, 0, 0.7);
  color: #fff;
  text-transform: uppercase;
}
.rarity-normal .preview-badge { color: var(--green); border: 1px solid var(--green); }
.rarity-bronze .preview-badge { color: var(--bronze); border: 1px solid var(--bronze); }
.rarity-silver .preview-badge { color: var(--silver); border: 1px solid var(--silver); }
.rarity-platine .preview-badge { color: var(--cyan); border: 1px solid var(--cyan); }

.preview-img-container {
  flex: 1;
  width: 100%;
  margin: 6px 0;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  background: rgba(0, 0, 0, 0.25);
  border-radius: 3px;
}

.preview-img-container img {
  max-width: 100%;
  max-height: 120px;
  object-fit: contain;
}

.preview-placeholder {
  font-size: 38px;
  color: var(--border);
  font-family: "Press Start 2P", monospace;
}

.preview-name {
  font-size: 16px;
  font-weight: bold;
  text-align: center;
  max-width: 100%;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--ink);
}

.admin-form-actions {
  display: flex;
  justify-content: center;
  margin-top: 10px;
}

.btn-large {
  padding: 10px 24px !important;
  font-size: 18px !important;
}

.account-btn.danger {
  background: #381216;
  border-color: var(--red);
  color: var(--red);
}

.account-btn.danger:hover {
  background: #54171d;
  box-shadow: 0 0 10px rgba(255, 90, 90, 0.4);
}

/* Listing du catalogue Admin */
.catalog-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 16px;
  border-bottom: 1px solid var(--border);
  padding-bottom: 12px;
}

.catalog-actions {
  display: flex;
  gap: 8px;
}

.admin-catalog-list {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.catalog-rarity-group {
  background: var(--bg-panel-2);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 12px;
}

.catalog-rarity-title {
  font-family: "Press Start 2P", monospace;
  font-size: 10px;
  margin-bottom: 10px;
  padding-bottom: 4px;
  border-bottom: 1px dashed var(--border);
  display: flex;
  justify-content: space-between;
}
.catalog-rarity-title.normal { color: var(--green); }
.catalog-rarity-title.bronze { color: var(--bronze); }
.catalog-rarity-title.silver { color: var(--silver); }
.catalog-rarity-title.platine { color: var(--cyan); }

.catalog-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
  gap: 10px;
}

.catalog-item {
  background: var(--bg-sunken);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 8px;
  display: flex;
  flex-direction: column;
  align-items: center;
  position: relative;
  transition: transform 150ms, border-color 150ms;
}

.catalog-item:hover {
  transform: translateY(-2px);
  border-color: var(--cyan);
}

.catalog-item-thumb {
  width: 70px;
  height: 70px;
  object-fit: contain;
  margin-bottom: 6px;
  background: rgba(0, 0, 0, 0.2);
  border-radius: 2px;
}

.catalog-item-name {
  font-size: 15px;
  font-weight: bold;
  text-align: center;
  max-width: 100%;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--ink);
  margin-bottom: 6px;
}

.catalog-del-btn {
  background: transparent;
  border: 1px solid var(--red);
  color: var(--red);
  border-radius: 3px;
  padding: 2px 6px;
  font-family: "VT323", monospace;
  font-size: 14px;
  cursor: pointer;
  transition: all 150ms;
  width: 100%;
}

.catalog-del-btn:hover {
  background: var(--red);
  color: #fff;
  box-shadow: 0 0 8px rgba(255, 90, 90, 0.4);
}

@media (max-width: 600px) {
  .admin-form-grid {
    grid-template-columns: 1fr;
  }
  .catalog-header {
    flex-direction: column;
    align-items: flex-start;
  }
}