/* ============================================================
   Trophy / Achievement Modal — 20100vancode.com
   Cheerful & classy. Scale + gentle bounce + soft glow.
   ============================================================ */

/* --- Floating "Claim Trophies" button --- */
#trophy-check-btn {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  z-index: 9998;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.15);
  background: rgba(255, 255, 255, 0.06);
  backdrop-filter: blur(12px);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  transform: scale(0.8);
  transition: opacity 0.4s ease, visibility 0.4s ease, transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1),
              box-shadow 0.25s ease, border-color 0.25s ease;
}

#trophy-check-btn.trophy-btn--visible {
  opacity: 1;
  visibility: visible;
  transform: scale(1);
}

#trophy-check-btn:hover {
  border-color: rgba(255, 255, 255, 0.35);
  background: rgba(255, 255, 255, 0.1);
  box-shadow: 0 0 20px rgba(255, 255, 255, 0.06);
}

#trophy-check-btn svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: rgba(255, 255, 255, 0.6);
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

#trophy-check-btn:hover svg {
  stroke: #fff;
}

#trophy-check-btn.trophy-btn--empty {
  animation: trophy-btn-shake 0.5s ease;
}

/* --- Modal overlay --- */
#trophy-modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(8px);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.4s ease, visibility 0.4s ease;
}

#trophy-modal-overlay.trophy-active {
  opacity: 1;
  visibility: visible;
}

#trophy-modal-overlay.trophy-hidden {
  opacity: 0;
  visibility: hidden;
}

/* --- Modal content --- */
.trophy-modal {
  position: relative;
  max-width: 580px;
  width: 90%;
  max-height: 85vh;
  overflow-y: auto;
  padding: 2.5rem 2rem 2rem;
  background: linear-gradient(145deg, #0d0d0d 0%, #1a1a1a 100%);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 20px;
  box-shadow:
    0 0 60px rgba(255, 215, 0, 0.06),
    0 0 120px rgba(0, 229, 255, 0.04),
    0 24px 48px rgba(0, 0, 0, 0.5);
  animation: trophy-modal-enter 0.55s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

@keyframes trophy-modal-enter {
  0% {
    opacity: 0;
    transform: scale(0.7) translateY(30px);
  }
  60% {
    opacity: 1;
    transform: scale(1.03) translateY(-4px);
  }
  100% {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

/* --- Close button --- */
#trophy-modal-close {
  position: absolute;
  top: 1rem;
  right: 1rem;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.05);
  color: rgba(255, 255, 255, 0.5);
  font-size: 18px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  line-height: 1;
}

#trophy-modal-close:hover {
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
  border-color: rgba(255, 255, 255, 0.25);
}

/* --- Modal header --- */
.trophy-modal__header {
  text-align: center;
  margin-bottom: 1.5rem;
}

.trophy-modal__header h2 {
  font-size: 1.5rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: #fff;
  margin: 0;
}

.trophy-modal__header p {
  font-size: 0.85rem;
  color: rgba(255, 255, 255, 0.45);
  margin: 0.4rem 0 0;
}

/* --- Trophy cards container --- */
#trophy-cards-container {
  display: flex;
  flex-direction: column;
  gap: 2.5rem;
}

/* --- Trophy wrapper (icon above card) --- */
.trophy-wrapper {
  display: flex;
  flex-direction: column;
  align-items: center;
  animation: trophy-card-in 0.5s cubic-bezier(0.34, 1.56, 0.64, 1) backwards;
}

.trophy-wrapper:nth-child(1) { animation-delay: 0.15s; }
.trophy-wrapper:nth-child(2) { animation-delay: 0.3s; }
.trophy-wrapper:nth-child(3) { animation-delay: 0.45s; }

/* --- Trophy image (outside card, animated) --- */
.trophy-card__icon {
  width: 240px;
  height: 240px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: -1.5rem;
  position: relative;
  z-index: 2;
  animation: trophy-float 3s ease-in-out infinite, trophy-icon-enter 0.6s cubic-bezier(0.34, 1.56, 0.64, 1) backwards;
  animation-delay: 0.1s, 0s;
  filter: drop-shadow(0 8px 24px rgba(0,0,0,0.4));
}

.trophy-card__icon img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

/* Gold glow behind icon */
.trophy-card__icon--gold::after {
  content: '';
  position: absolute;
  inset: 10%;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255,215,0,0.15) 0%, rgba(255,165,0,0.05) 50%, transparent 70%);
  z-index: -1;
  animation: trophy-pulse-glow 2.5s ease-in-out infinite;
}

/* Cellular glow behind icon */
.trophy-card__icon--cellular::after {
  content: '';
  position: absolute;
  inset: 10%;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(0,229,255,0.12) 0%, rgba(124,77,255,0.05) 50%, transparent 70%);
  z-index: -1;
  animation: trophy-pulse-glow 2.5s ease-in-out infinite;
}

@keyframes trophy-float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-8px); }
}

@keyframes trophy-icon-enter {
  0% {
    opacity: 0;
    transform: scale(0.5) translateY(20px);
  }
  100% {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

@keyframes trophy-pulse-glow {
  0%, 100% { opacity: 0.6; transform: scale(1); }
  50% { opacity: 1; transform: scale(1.08); }
}

/* --- Individual trophy card (text + buttons only) --- */
.trophy-card {
  position: relative;
  border-radius: 16px;
  padding: 2.5rem 1.5rem 1.5rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  width: 100%;
  z-index: 1;
  transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.3s ease;
}

.trophy-card:hover {
  transform: scale(1.05);
}

@keyframes trophy-card-in {
  0% {
    opacity: 0;
    transform: translateY(16px) scale(0.95);
  }
  100% {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

/* Gold theme (Joyride) */
.trophy-card--gold {
  background: linear-gradient(135deg, rgba(255, 215, 0, 0.06) 0%, rgba(255, 165, 0, 0.04) 100%);
  border: 1px solid rgba(255, 215, 0, 0.15);
  box-shadow: 0 0 24px rgba(255, 215, 0, 0.05);
}

.trophy-card--gold:hover {
  border-color: rgba(255, 215, 0, 0.3);
  box-shadow: 0 0 40px rgba(255, 215, 0, 0.1);
}

/* Cellular theme (Game of Life) */
.trophy-card--cellular {
  background: linear-gradient(135deg, rgba(0, 229, 255, 0.06) 0%, rgba(124, 77, 255, 0.04) 100%);
  border: 1px solid rgba(0, 229, 255, 0.15);
  box-shadow: 0 0 24px rgba(0, 229, 255, 0.05);
}

.trophy-card--cellular:hover {
  border-color: rgba(0, 229, 255, 0.3);
  box-shadow: 0 0 40px rgba(0, 229, 255, 0.1);
}

/* Card body */
.trophy-card__body {
  width: 100%;
}

.trophy-card__title {
  font-size: 1.25rem;
  font-weight: 700;
  color: #fff;
  margin: 0 0 0.4rem;
}

.trophy-card--gold .trophy-card__title {
  background: linear-gradient(90deg, #FFD700, #FFA500);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.trophy-card--cellular .trophy-card__title {
  background: linear-gradient(90deg, #00E5FF, #7C4DFF);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.trophy-card__desc {
  font-size: 0.9rem;
  color: rgba(255, 255, 255, 0.55);
  margin: 0 0 0.75rem;
  line-height: 1.5;
}

.trophy-card__game {
  display: inline-block;
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding: 0.2rem 0.6rem;
  border-radius: 100px;
  background: rgba(255, 255, 255, 0.06);
  color: rgba(255, 255, 255, 0.4);
}

.trophy-card--gold .trophy-card__game {
  color: rgba(255, 215, 0, 0.6);
  background: rgba(255, 215, 0, 0.08);
}

.trophy-card--cellular .trophy-card__game {
  color: rgba(0, 229, 255, 0.6);
  background: rgba(0, 229, 255, 0.08);
}

/* Card actions */
.trophy-card__actions {
  display: flex;
  gap: 0.6rem;
  margin-top: 0.5rem;
  justify-content: center;
}

.trophy-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.4rem 0.8rem;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(255, 255, 255, 0.04);
  color: rgba(255, 255, 255, 0.6);
  font-size: 0.75rem;
  cursor: pointer;
  transition: all 0.2s ease;
  font-family: inherit;
}

.trophy-btn:hover {
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
  border-color: rgba(255, 255, 255, 0.2);
}

.trophy-btn svg {
  flex-shrink: 0;
}

.trophy-card--gold .trophy-btn:hover {
  border-color: rgba(255, 215, 0, 0.3);
  color: #FFD700;
}

.trophy-card--cellular .trophy-btn:hover {
  border-color: rgba(0, 229, 255, 0.3);
  color: #00E5FF;
}

/* --- Confetti --- */
#trophy-confetti {
  position: fixed;
  inset: 0;
  z-index: 10000;
  pointer-events: none;
  overflow: hidden;
}

.trophy-confetti-piece {
  position: absolute;
  top: -10px;
  border-radius: 2px;
  opacity: 0;
  animation: trophy-confetti-fall linear forwards;
}

@keyframes trophy-confetti-fall {
  0% {
    opacity: 1;
    transform: translateY(0) rotate(0deg) scale(1);
  }
  70% {
    opacity: 0.8;
  }
  100% {
    opacity: 0;
    transform: translateY(100vh) rotate(720deg) scale(0.3);
  }
}

/* --- Responsive --- */
@media (max-width: 640px) {
  .trophy-modal {
    padding: 2rem 1.25rem 1.5rem;
    border-radius: 16px;
  }

  .trophy-card__icon {
    width: 180px;
    height: 180px;
    margin-bottom: -1rem;
  }

  .trophy-card {
    padding: 2rem 1.25rem 1.25rem;
  }

  #trophy-check-btn {
    bottom: 1.25rem;
    right: 1.25rem;
    width: 40px;
    height: 40px;
  }
}

/* --- Lightbox for trophy image --- */
#trophy-lightbox {
  position: fixed;
  inset: 0;
  z-index: 10001;
  display: flex;
  align-items: center;
  justify-content: center;
}

.trophy-lightbox-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.9);
  backdrop-filter: blur(8px);
}

.trophy-lightbox-content {
  position: relative;
  max-width: 90vw;
  max-height: 90vh;
  display: flex;
  align-items: center;
  justify-content: center;
}

.trophy-lightbox-content img {
  max-width: 100%;
  max-height: 90vh;
  object-fit: contain;
  border-radius: 12px;
  box-shadow: 0 0 60px rgba(0, 0, 0, 0.8);
}

.trophy-lightbox-close {
  position: absolute;
  top: -50px;
  right: 0;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.2);
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
  font-size: 20px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
}

.trophy-lightbox-close:hover {
  background: rgba(255, 255, 255, 0.2);
  border-color: rgba(255, 255, 255, 0.4);
}

.trophy-card__icon {
  cursor: pointer;
  transition: transform 0.3s ease;
}

.trophy-card__icon:hover {
  transform: scale(1.05);
}
