/* ═══════════════════════════════════════════════════════════════════
   TROPHY UNLOCK MODAL — TopPopote
   Modale dynamique de déblocage de trophée
   Glassmorphism · Dark/Light · Particules CSS
═══════════════════════════════════════════════════════════════════ */

/* ── Variables ── */
:root {
  --tu-bg-dark: rgba(2, 8, 4, 0.88);
  --tu-card-bg: rgba(255, 255, 255, 0.06);
  --tu-card-border: rgba(255, 255, 255, 0.1);
  --tu-card-shadow: 0 8px 60px rgba(0, 0, 0, 0.6), 0 0 120px rgba(16, 185, 129, 0.08);
  --tu-text-primary: #fff;
  --tu-text-secondary: rgba(255, 255, 255, 0.6);
  --tu-text-muted: rgba(255, 255, 255, 0.35);
  --tu-accent: #34d399;
  --tu-accent-glow: rgba(52, 211, 153, 0.25);
  --tu-close-bg: rgba(255, 255, 255, 0.06);
  --tu-close-hover: rgba(255, 255, 255, 0.12);
  --tu-particle-opacity: 1;

  /* Rarity colors */
  --tu-rarity-common: #9ca3af;
  --tu-rarity-uncommon: #34d399;
  --tu-rarity-rare: #3b82f6;
  --tu-rarity-epic: #a855f7;
  --tu-rarity-legendary: #f59e0b;
  --tu-rarity-mythic: #ec4899;
}

[data-theme="light"] {
  --tu-bg-dark: rgba(255, 255, 255, 0.75);
  --tu-card-bg: rgba(255, 255, 255, 0.82);
  --tu-card-border: rgba(0, 0, 0, 0.06);
  --tu-card-shadow: 0 8px 60px rgba(0, 0, 0, 0.12), 0 0 80px rgba(16, 185, 129, 0.06);
  --tu-text-primary: #0f172a;
  --tu-text-secondary: rgba(15, 23, 42, 0.55);
  --tu-text-muted: rgba(15, 23, 42, 0.3);
  --tu-close-bg: rgba(0, 0, 0, 0.04);
  --tu-close-hover: rgba(0, 0, 0, 0.08);
  --tu-particle-opacity: 0.5;
}

/* ── Overlay ── */
.tu-overlay {
  position: fixed;
  inset: 0;
  z-index: 99999;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.35s ease, visibility 0.35s ease;
}
.tu-overlay.is-open {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

/* ── Backdrop ── */
.tu-backdrop {
  position: absolute;
  inset: 0;
  background: var(--tu-bg-dark);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

/* ── Particules container ── */
.tu-particles {
  position: absolute;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
  opacity: var(--tu-particle-opacity);
}

/* ── Card (glassmorphism) ── */
.tu-card {
  position: relative;
  width: 340px;
  max-width: 90vw;
  background: var(--tu-card-bg);
  backdrop-filter: blur(40px) saturate(1.4);
  -webkit-backdrop-filter: blur(40px) saturate(1.4);
  border: 1px solid var(--tu-card-border);
  border-radius: 24px;
  padding: 40px 32px 36px;
  text-align: center;
  box-shadow: var(--tu-card-shadow);
  transform: translateY(40px) scale(0.92);
  opacity: 0;
  transition: transform 0.5s cubic-bezier(0.34, 1.56, 0.64, 1),
              opacity 0.4s ease;
}
.tu-overlay.is-open .tu-card {
  transform: translateY(0) scale(1);
  opacity: 1;
}

/* ── Glow derrière la card ── */
.tu-glow {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 280px;
  height: 280px;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  background: radial-gradient(circle, var(--tu-accent-glow) 0%, transparent 70%);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.6s ease 0.2s;
}
.tu-overlay.is-open .tu-glow {
  opacity: 1;
}

/* ── Close button ── */
.tu-close {
  position: absolute;
  top: 14px;
  right: 14px;
  width: 32px;
  height: 32px;
  border: none;
  border-radius: 50%;
  background: var(--tu-close-bg);
  color: var(--tu-text-secondary);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s, color 0.2s, transform 0.2s;
  z-index: 2;
}
.tu-close:hover {
  background: var(--tu-close-hover);
  color: var(--tu-text-primary);
  transform: scale(1.1);
}

/* ── Icon ── */
.tu-icon-wrap {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 120px;
  height: 120px;
  margin-bottom: 24px;
  opacity: 0;
  transform: scale(0.5) rotate(-10deg);
  transition: transform 0.6s cubic-bezier(0.34, 1.56, 0.64, 1) 0.15s,
              opacity 0.4s ease 0.15s;
}
.tu-overlay.is-open .tu-icon-wrap {
  opacity: 1;
  transform: scale(1) rotate(0deg);
}

.tu-icon {
  width: 100px;
  height: 100px;
  filter: drop-shadow(0 4px 24px var(--tu-accent-glow));
}

/* ── Label (eyebrow) ── */
.tu-label {
  font-family: 'Poppins', sans-serif;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 2.5px;
  text-transform: uppercase;
  color: var(--tu-accent);
  margin-bottom: 10px;
  opacity: 0;
  transform: translateY(12px);
  transition: transform 0.4s ease 0.3s, opacity 0.4s ease 0.3s;
}
.tu-overlay.is-open .tu-label {
  opacity: 1;
  transform: translateY(0);
}

/* ── Title ── */
.tu-title {
  font-family: 'Poppins', sans-serif;
  font-size: 22px;
  font-weight: 800;
  color: var(--tu-text-primary);
  line-height: 1.25;
  margin-bottom: 10px;
  opacity: 0;
  transform: translateY(12px);
  transition: transform 0.4s ease 0.4s, opacity 0.4s ease 0.4s;
}
.tu-overlay.is-open .tu-title {
  opacity: 1;
  transform: translateY(0);
}

/* ── Description ── */
.tu-desc {
  font-family: 'Poppins', sans-serif;
  font-size: 13.5px;
  font-weight: 500;
  color: var(--tu-text-secondary);
  line-height: 1.55;
  margin-bottom: 18px;
  opacity: 0;
  transform: translateY(12px);
  transition: transform 0.4s ease 0.5s, opacity 0.4s ease 0.5s;
}
.tu-overlay.is-open .tu-desc {
  opacity: 1;
  transform: translateY(0);
}

/* ── Rarity badge ── */
.tu-rarity {
  display: inline-block;
  font-family: 'Poppins', sans-serif;
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  padding: 5px 14px;
  border-radius: 999px;
  border: 1px solid currentColor;
  opacity: 0;
  transform: translateY(12px);
  transition: transform 0.4s ease 0.6s, opacity 0.4s ease 0.6s;
}
.tu-overlay.is-open .tu-rarity {
  opacity: 1;
  transform: translateY(0);
}
.tu-rarity[data-rarity="common"]    { color: var(--tu-rarity-common);    background: rgba(156,163,175,0.1); }
.tu-rarity[data-rarity="uncommon"]  { color: var(--tu-rarity-uncommon);  background: rgba(52,211,153,0.1); }
.tu-rarity[data-rarity="rare"]      { color: var(--tu-rarity-rare);      background: rgba(59,130,246,0.1); }
.tu-rarity[data-rarity="epic"]      { color: var(--tu-rarity-epic);      background: rgba(168,85,247,0.1); }
.tu-rarity[data-rarity="legendary"] { color: var(--tu-rarity-legendary); background: rgba(245,158,11,0.1); }
.tu-rarity[data-rarity="mythic"]    { color: var(--tu-rarity-mythic);    background: rgba(236,72,153,0.1); }

[data-theme="light"] .tu-rarity[data-rarity="common"]    { background: rgba(156,163,175,0.08); }
[data-theme="light"] .tu-rarity[data-rarity="uncommon"]  { background: rgba(52,211,153,0.08); }
[data-theme="light"] .tu-rarity[data-rarity="rare"]      { background: rgba(59,130,246,0.08); }
[data-theme="light"] .tu-rarity[data-rarity="epic"]      { background: rgba(168,85,247,0.08); }
[data-theme="light"] .tu-rarity[data-rarity="legendary"] { background: rgba(245,158,11,0.08); }
[data-theme="light"] .tu-rarity[data-rarity="mythic"]    { background: rgba(236,72,153,0.08); }

/* ═══════════════════════════════════════
   PARTICULES CSS (confettis)
═══════════════════════════════════════ */

.tu-particle {
  position: absolute;
  width: 6px;
  height: 6px;
  border-radius: 2px;
  opacity: 0;
  pointer-events: none;
}

.tu-overlay.is-open .tu-particle {
  animation: tuParticleFall var(--tu-dur, 2.4s) var(--tu-delay, 0s) cubic-bezier(0.25, 0.46, 0.45, 0.94) forwards;
}

@keyframes tuParticleFall {
  0% {
    opacity: 1;
    transform: translate(0, 0) rotate(0deg) scale(1);
  }
  15% {
    opacity: 1;
  }
  100% {
    opacity: 0;
    transform: translate(var(--tu-drift, 60px), var(--tu-drop, 320px)) rotate(var(--tu-spin, 720deg)) scale(0.3);
  }
}

/* Variations de forme */
.tu-particle.tu-p-circle { border-radius: 50%; }
.tu-particle.tu-p-rect   { border-radius: 1px; width: 8px; height: 4px; }
.tu-particle.tu-p-star   { border-radius: 0; width: 0; height: 0;
                            background: transparent;
                            border-left: 4px solid transparent;
                            border-right: 4px solid transparent;
                            border-bottom: 8px solid var(--tu-p-color, #34d399); }

/* ═══════════════════════════════════════
   RESPONSIVE
═══════════════════════════════════════ */

@media (max-width: 400px) {
  .tu-card {
    width: 92vw;
    padding: 32px 20px 28px;
    border-radius: 20px;
  }
  .tu-icon-wrap {
    width: 96px;
    height: 96px;
  }
  .tu-icon {
    width: 80px;
    height: 80px;
  }
  .tu-title {
    font-size: 18px;
  }
  .tu-desc {
    font-size: 12.5px;
  }
}
