:root {
  --pointer-x: 0;
  --pointer-y: 0;
  --card-width: 350px;
  --rotate-x: 20deg;
  --rotate-y: -20deg;
  --parallax-x: 5%;
  --parallax-y: 5%;
}

.player-card-container {
  perspective: 1000px;
  width: var(--card-width);
  height: calc(var(--card-width) * 1.4);
}

.player-card {
  width: 100%;
  height: 100%;
  position: relative;
  transform-style: preserve-3d;
  transition: transform 0.2s ease;
  cursor: pointer;
  overflow: visible;
}

.player-card[data-active="true"] {
  transition: transform 0s;
}

.player-card[data-active="true"]:hover {
  transform: rotateX(calc(var(--pointer-y) * var(--rotate-x)))
    rotateY(calc(var(--pointer-x) * var(--rotate-y)));
  animation: set backwards 0.2s;
}

@keyframes set {
  0% {
    transform: rotateX(0deg) rotateY(0deg);
  }
}

.player-card img {
  width: 100%;
  height: auto;
  object-fit: contain;
  transition: transform 0.2s ease, filter 0.3s ease;
  will-change: transform, filter;
  filter: drop-shadow(0 20px 40px rgba(0, 0, 0, 0.3));
  position: relative;
  z-index: 1;
}

/* Default hover effect (AllStar - Golden) */
.player-card[data-active="true"]:hover img {
  transition: transform 0s, filter 0s;
  transform: translate(
    calc(var(--pointer-x) * var(--parallax-x)),
    calc(var(--pointer-y) * var(--parallax-y))
  );
  filter: drop-shadow(0 20px 40px rgba(0, 0, 0, 0.3))
    drop-shadow(0 0 20px rgba(255, 215, 0, 0.4)) brightness(1.1);
  animation: set-img backwards 0.2s;
}

/* NHL Card - Red glow */
.player-card[data-card-type="nhl"][data-active="true"]:hover img {
  filter: drop-shadow(0 20px 40px rgba(0, 0, 0, 0.3))
    drop-shadow(0 0 20px rgba(220, 38, 38, 0.6)) 
    drop-shadow(0 0 40px rgba(239, 68, 68, 0.3)) brightness(1.1);
}

/* Pro Card - Blue/White glow */
.player-card[data-card-type="pro"][data-active="true"]:hover img {
  filter: drop-shadow(0 20px 40px rgba(0, 0, 0, 0.3))
    drop-shadow(0 0 20px rgba(59, 130, 246, 0.6)) 
    drop-shadow(0 0 40px rgba(147, 197, 253, 0.4))
    drop-shadow(0 0 60px rgba(255, 255, 255, 0.2)) brightness(1.1);
}

@keyframes set-img {
  0% {
    transform: translate(0, 0);
  }
}

/* Individual sparkle stars - direct children of player-card */
.sparkle-star {
  position: absolute;
  width: 4px;
  height: 4px;
  background: white;
  border-radius: 50%;
  pointer-events: none;
  transform: translate(-50%, -50%);
  z-index: 2;
}

/* Default sparkle star glow (AllStar - Golden) */
.sparkle-star::before {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 100%;
  height: 100%;
  background: white;
  border-radius: 50%;
  box-shadow: 0 0 6px rgba(255, 255, 255, 0.9), 0 0 12px rgba(255, 223, 0, 0.6),
    0 0 20px rgba(255, 223, 0, 0.3);
}

/* NHL Card sparkles - Red glow */
.player-card[data-card-type="nhl"] .sparkle-star::before {
  box-shadow: 0 0 6px rgba(255, 255, 255, 0.9), 0 0 12px rgba(220, 38, 38, 0.7),
    0 0 20px rgba(239, 68, 68, 0.4);
}

/* Pro Card sparkles - Blue/White glow */
.player-card[data-card-type="pro"] .sparkle-star::before {
  box-shadow: 0 0 6px rgba(255, 255, 255, 0.9), 0 0 12px rgba(59, 130, 246, 0.7),
    0 0 20px rgba(147, 197, 253, 0.4), 0 0 30px rgba(255, 255, 255, 0.2);
}

/* Four-pointed star shape */
.sparkle-star.four-point {
  background: transparent;
  width: 10px;
  height: 10px;
}

/* Default four-point star (AllStar - Golden) */
.sparkle-star.four-point::before {
  width: 2px;
  height: 100%;
  background: white;
  border-radius: 0;
  box-shadow: 0 0 6px rgba(255, 255, 255, 1), 0 0 12px rgba(255, 223, 0, 0.8);
}

.sparkle-star.four-point::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 100%;
  height: 2px;
  background: white;
  border-radius: 0;
  box-shadow: 0 0 6px rgba(255, 255, 255, 1), 0 0 12px rgba(255, 223, 0, 0.8);
}

/* NHL Card four-point stars - Red glow */
.player-card[data-card-type="nhl"] .sparkle-star.four-point::before {
  box-shadow: 0 0 6px rgba(255, 255, 255, 1), 0 0 12px rgba(220, 38, 38, 0.9);
}

.player-card[data-card-type="nhl"] .sparkle-star.four-point::after {
  box-shadow: 0 0 6px rgba(255, 255, 255, 1), 0 0 12px rgba(220, 38, 38, 0.9);
}

/* Pro Card four-point stars - Blue/White glow */
.player-card[data-card-type="pro"] .sparkle-star.four-point::before {
  box-shadow: 0 0 6px rgba(255, 255, 255, 1), 0 0 12px rgba(59, 130, 246, 0.9), 
    0 0 20px rgba(255, 255, 255, 0.3);
}

.player-card[data-card-type="pro"] .sparkle-star.four-point::after {
  box-shadow: 0 0 6px rgba(255, 255, 255, 1), 0 0 12px rgba(59, 130, 246, 0.9), 
    0 0 20px rgba(255, 255, 255, 0.3);
}

/* Passive sparkle animation (always visible) */
.sparkle-star.passive {
  animation: passive-sparkle 3s ease-in-out infinite;
}

.sparkle-star.passive:nth-child(odd) {
  animation-delay: 0.5s;
  animation-duration: 2.5s;
}

.sparkle-star.passive:nth-child(even) {
  animation-delay: 1s;
  animation-duration: 3.5s;
}

@keyframes passive-sparkle {
  0%,
  100% {
    opacity: 0;
    transform: translate(-50%, -50%) scale(0.3);
  }
  50% {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
  }
}

/* Active sparkle animation (on hover) */
.sparkle-star.active {
  animation: active-sparkle 0.8s ease-out forwards;
}

@keyframes active-sparkle {
  0% {
    opacity: 0;
    transform: translate(-50%, -50%) scale(0) rotate(0deg);
  }
  50% {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1.2) rotate(180deg);
  }
  100% {
    opacity: 0;
    transform: translate(-50%, -50%) scale(0.3) rotate(360deg);
  }
}

/* Mobile optimization */
@media (max-width: 768px) {
  :root {
    --card-width: 180px;
  }

  .player-card img {
    filter: drop-shadow(0 15px 30px rgba(0, 0, 0, 0.4));
  }

  .sparkle-star {
    width: 3px;
    height: 3px;
  }

  .sparkle-star.four-point {
    width: 8px;
    height: 8px;
  }
}

/* Prevent hover effects on touch devices */
@media (hover: none) {
  .player-card[data-active="true"]:active {
    transform: rotateX(5deg) rotateY(-5deg);
  }

  .player-card[data-active="true"]:active img {
    transform: translate(2%, 2%);
  }
}

.carousel-container {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 2rem;
}

.carousel-track {
  width: 400px;
  height: 500px;
  position: relative;
  perspective: 1000px;
}

.carousel-slide {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  transform: translateX(100px) rotateY(20deg);
  transition: all 0.8s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  pointer-events: none;
}

.carousel-slide.active {
  opacity: 1;
  transform: translateX(0) rotateY(0);
  pointer-events: all;
  z-index: 10;
}

.carousel-slide.prev {
  opacity: 0.6;
  transform: translateX(-100px) rotateY(-20deg) scale(0.8);
  pointer-events: none;
  z-index: 5;
}

.carousel-slide.next {
  opacity: 0.6;
  transform: translateX(100px) rotateY(20deg) scale(0.8);
  pointer-events: none;
  z-index: 5;
}

.carousel-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  background: rgba(255, 255, 255, 0.2);
  border: none;
  color: white;
  width: 60px;
  height: 60px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.3s ease;
  backdrop-filter: blur(10px);
  z-index: 20;
}

.carousel-nav:hover {
  background: rgba(255, 255, 255, 0.3);
  transform: translateY(-50%) scale(1.1);
}

.carousel-nav-prev {
  left: -40px;
}

.carousel-nav-next {
  right: -40px;
}

.carousel-indicators {
  display: flex;
  justify-content: center;
  gap: 1rem;
  margin-bottom: 2rem;
}

.carousel-indicator {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  border: none;
  background: rgba(255, 255, 255, 0.4);
  cursor: pointer;
  transition: all 0.3s ease;
}

.carousel-indicator.active {
  background: white;
  transform: scale(1.2);
}

.carousel-indicator:hover {
  background: rgba(255, 255, 255, 0.8);
}

/* Mobile Responsive */
@media (max-width: 768px) {
  .carousel-track {
    width: 300px;
    height: 400px;
  }

  .carousel-nav-prev {
    left: -20px;
  }

  .carousel-nav-next {
    right: -20px;
  }

  .carousel-nav {
    width: 50px;
    height: 50px;
  }
}