@keyframes floatParticle {
  0%, 100% {
    transform: translateY(0px) translateX(0px);
    opacity: 0.4;
  }
  25% {
    transform: translateY(-10px) translateX(2px);
    opacity: 0.8;
  }
  50% {
    transform: translateY(-5px) translateX(-2px);
    opacity: 0.6;
  }
  75% {
    transform: translateY(-15px) translateX(1px);
    opacity: 0.9;
  }
}

@keyframes constellationTwinkle {
  0%, 100% {
    opacity: 0.3;
    transform: scale(1);
  }
  50% {
    opacity: 0.8;
    transform: scale(1.2);
  }
}

.planetCard {
  cursor: pointer;
  transition: all 0.2s ease-in-out;
}

.planetCard:hover {
  transform: translateY(-2px);
  filter: brightness(1.1) !important;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3), inset 0 1px 0 rgba(255, 255, 255, 0.1) !important;
}

.planetCard:hover .planetCardHighlight {
  opacity: 0.8;
}

.planetCardHighlight {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.1) 0%, rgba(255, 255, 255, 0.05) 100%);
  border-radius: 12px;
  opacity: 0;
  transition: opacity 0.2s ease-in-out;
  pointer-events: none;
  z-index: 2;
}

.legendaryConstellation {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background:
    radial-gradient(1px 1px at 20% 30%, rgba(255, 215, 0, 0.8), transparent),
    radial-gradient(1px 1px at 40% 70%, rgba(255, 215, 0, 0.6), transparent),
    radial-gradient(1px 1px at 90% 40%, rgba(255, 215, 0, 0.7), transparent),
    radial-gradient(1px 1px at 60% 20%, rgba(255, 215, 0, 0.5), transparent),
    radial-gradient(1px 1px at 15% 80%, rgba(255, 215, 0, 0.6), transparent),
    radial-gradient(1px 1px at 80% 80%, rgba(255, 215, 0, 0.4), transparent);
  animation: constellationTwinkle 3s ease-in-out infinite;
  z-index: 0;
}

.floatingParticle {
  position: absolute;
  width: 3px;
  height: 3px;
  background: radial-gradient(circle, rgba(255, 215, 0, 0.8) 0%, transparent 70%);
  border-radius: 50%;
  z-index: 1;
  animation: floatParticle ease-in-out infinite;
}

.legendaryBackground {
  background:
    linear-gradient(135deg, var(--planet-bg) 0%, rgba(15, 23, 42, 0.6) 100%),
    radial-gradient(circle at 20% 80%, rgba(255, 215, 0, 0.1) 0%, transparent 50%),
    radial-gradient(circle at 80% 20%, rgba(255, 215, 0, 0.08) 0%, transparent 50%),
    radial-gradient(circle at 40% 40%, rgba(255, 215, 0, 0.06) 0%, transparent 50%);
}

.particle1 {
  top: 20%;
  left: 10%;
  animation-duration: 3s;
  animation-delay: 0s;
}

.particle2 {
  top: 35%;
  left: 30%;
  animation-duration: 3.5s;
  animation-delay: 0.8s;
}

.particle3 {
  top: 50%;
  left: 50%;
  animation-duration: 4s;
  animation-delay: 1.6s;
}

.particle4 {
  top: 65%;
  left: 70%;
  animation-duration: 4.5s;
  animation-delay: 2.4s;
}

.particle5 {
  top: 80%;
  left: 90%;
  animation-duration: 5s;
  animation-delay: 3.2s;
}

/* Planet color variables */
:root {
  --cultural-background: rgba(59, 130, 246, 0.12);
  --cultural-border: rgba(59, 130, 246, 0.3);
  --cultural-shadow: rgba(59, 130, 246, 0.08);
  --cultural-highlight: rgba(59, 130, 246, 0.4);

  --hazardous-background: rgba(239, 68, 68, 0.12);
  --hazardous-border: rgba(239, 68, 68, 0.3);
  --hazardous-shadow: rgba(239, 68, 68, 0.08);
  --hazardous-highlight: rgba(239, 68, 68, 0.4);

  --industrial-background: rgba(34, 197, 94, 0.12);
  --industrial-border: rgba(34, 197, 94, 0.3);
  --industrial-shadow: rgba(34, 197, 94, 0.08);
  --industrial-highlight: rgba(34, 197, 94, 0.4);

  --faction-background: rgba(107, 114, 128, 0.12);
  --faction-border: rgba(107, 114, 128, 0.3);
  --faction-shadow: rgba(107, 114, 128, 0.08);
  --faction-highlight: rgba(107, 114, 128, 0.4);

  --mr-background: rgba(107, 114, 128, 0.12);
  --mr-border: rgba(107, 114, 128, 0.3);
  --mr-shadow: rgba(107, 114, 128, 0.08);
  --mr-highlight: rgba(107, 114, 128, 0.4);

  --default-background: rgba(107, 114, 128, 0.12);
  --default-border: rgba(107, 114, 128, 0.3);
  --default-shadow: rgba(107, 114, 128, 0.08);
  --default-highlight: rgba(107, 114, 128, 0.4);
}

/* Main stack styling */
.mainStack {
  padding: 6px 3px;
  height: 140px;
  position: relative;
  justify-content: space-between;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 2px 8px var(--planet-shadow), inset 0 1px 0 rgba(255, 255, 255, 0.05);
  border: 1px solid var(--planet-border);
}

.noRightRadius {
  border-top-right-radius: 0;
  border-bottom-right-radius: 0;
  border-right: none; /* avoid double border; ability's left border acts as divider */
}

.mainStack:not(.legendary) {
  background: linear-gradient(135deg, var(--planet-background) 0%, rgba(15, 23, 42, 0.6) 100%);
}
.internalSeparator { display: none; }
.mainStack.exhausted {
  filter: grayscale(0.4);
  opacity: 0.4;
}

/* Icon container */
.iconContainer {
  display: flex;
  justify-content: center;
  width: 100%;
}

/* Bottom stack */
.bottomStack {
  gap: 4px;
  position: relative;
  z-index: 1;
}

/* Name and values group */
.nameGroup {
  gap: 0;
  align-items: flex-end;
  min-width: 34px;
}

/* Planet name text */
.planetName {
  font-size: 12px;
  color: white;
  font-weight: 700;
  writing-mode: vertical-rl;
  text-orientation: sideways;
  white-space: nowrap;
  transform: rotate(180deg);
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.8);
}

/* Values stack */
.valuesStack {
  gap: 2px;
  align-items: flex-start;
}

/* Icons stack */
.iconsStack {
  gap: 1px;
}

/* Resource/Influence containers */
.valueContainer {
  position: relative;
  width: 16px;
  height: 16px;
}

/* Value text */
.valueText {
  font-size: var(--mantine-font-size-xs);
  color: white;
  font-weight: 700;
  position: absolute;
  top: 1px;
  left: 5px;
}

.influenceValueText {
  font-size: var(--mantine-font-size-xs);
  color: white;
  font-weight: 700;
  position: absolute;
  top: 2px;
  left: 5px;
}

/* Resource image */
.resourceImage {
  width: 16px;
  position: absolute;
  top: 0;
  left: 0;
}

/* Influence icon container */
.influenceIconContainer {
  position: absolute;
  top: 0;
  left: 0;
}

/* Faction icon */
.factionIcon {
  width: 24px;
  height: 24px;
}


/* Exhausted overlay */
.exhaustedOverlay {
  position: absolute;
  top: -1px;
  left: -1px;
  right: -1px;
  bottom: -1px;
  background: rgba(0, 0, 0, 0.3);
  border-radius: 12px;
  z-index: 10;
  pointer-events: none;
}

/* Subtle top highlight */
.topHighlight {
  position: absolute;
  top: 0;
  left: 20%;
  right: 20%;
  height: 1px;
  z-index: 3;
}


/* Popover dropdown */
.popoverDropdown {
  padding: 0;
}

.attachmentIcon {
  width: 18px;
  height: 18px;
  object-fit: contain;
  filter: drop-shadow(0 1px 1px rgba(0, 0, 0, 0.6));
}

.legendaryWrapper {
  display: flex;
  align-items: stretch;
  gap: 0;
}
