.chips-stack {
    position: relative;
    overflow: visible;  
    cursor: pointer;
    /* Prevent mobile touch issues */
    touch-action: manipulation;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
    -webkit-touch-callout: none;
}

.spiral-image {
  pointer-events: none;
  position: absolute;
  width: 179%;
  height: 99%;
  z-index: 10000;
  transform: rotateX(351deg) rotateZ(330deg) rotateY(154deg);
  right: -34%;
  top: -3%;
}

.background-chip {
  position: absolute !important;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  object-fit: contain;
  opacity: 0.2;
  transition: transform 0.2s ease, box-shadow 0.2s ease, filter 0.2s ease;
}

.background-chip:active {
  opacity: 0.3;
}

@media (hover: hover) and (pointer: fine) {
  .background-chip:hover {
    opacity: 0.3;
  }
}
  
.chip-image {
    position: absolute !important;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: contain;
    transition: transform 0.2s ease, box-shadow 0.2s ease, filter 0.2s ease;
    /* Ensure consistent cursor behavior */
    cursor: inherit;
    transform: translateZ(0); /* Force hardware acceleration */
    will-change: transform; /* Optimize for transform changes */
}

/* Add cursor to hover state only */
.top-chip {
    cursor: pointer;
}

.top-chip:active {
    transform: scale(1.1);
    cursor: pointer;
    /* Prevent cursor flickering during scale animation */
    transform-origin: center center;
}

/* Fix empty hover rule */
.top-chip:active::before {
    content: "";
    pointer-events: none;
}

@media (hover: hover) and (pointer: fine) {
  .top-chip:hover {
    transform: scale(1.1);
    cursor: pointer;
    /* Prevent cursor flickering during scale animation */
    transform-origin: center center;
  }
  .top-chip:active::before {
    content: "";
    pointer-events: none;
}
}

/* Selected chip styling */
.selected-chip {
    transform: scale(1.05);
    cursor: pointer;
}

.chip-glow {
  position: relative;
}



/* Remove duplicate rule - keep only one ::after */
.chip-image::after {
    position: absolute;
    left: 50%;
    top: -1.8em;
    transform: translateX(-50%);
    padding: 2px 4px;
    font: 600 10px/1.6 system-ui, sans-serif;
    color: #e9fafa;
    background: rgba(0, 0, 0, 0.55);
    border-radius: 50%;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.12s ease;
    white-space: nowrap;
    z-index: -1;
}

/* All chips lift together immediately and stay lifted */
.chip-image.bounce {
  position: absolute;
  animation: 
    chipLift 0.1s ease-out forwards,
    chipDrop 0.3s ease-in forwards;
  animation-delay: 
    0s,
    calc(var(--chip-drop-delay, 0s));
}

/* Lift animation - all chips go up together */
@keyframes chipLift {
  0%   { transform: translateY(0); }
  100% { transform: translateY(calc(var(--lift-height, 0px) * -1)); }
}

/* Drop animation - chips come back down */
@keyframes chipDrop {
  0%   { transform: translateY(calc(var(--lift-height, 0px) * -1)); }
  30%  { transform: translateY(calc(var(--lift-height, 0px) * -1)); }
  100% { transform: translateY(0); }
}

/* Disable bouncing animation on mobile devices */
@media(max-width:500px) {
  .chip-image.bounce {
    animation: none;
  }
  
  /* Additional mobile fixes */
  .chips-stack {
    touch-action: manipulation;
  }
}

@media(max-height:570px) {
  .spiral-image {
    top:40%
  }
}

@media(min-height:570px) and (max-height:700px) {
  .spiral-image {
    top: calc(0.03 * 10vh); /* 3% of screen height */
  }  
}

@media(min-height:700px) and (max-height:900px) {
  .spiral-image {
    top:5%
  }
}
