@import url("https://fonts.googleapis.com/css2?family=Orbitron:wght@400;500;600;700;800;900&family=Rajdhani:wght@400;500;600;700&display=swap");

body {
  margin: 0;
  padding: 0;
  overflow: hidden;
  background-color: #0a0a0f;
  display: flex;
  justify-content: center;
  align-items: center;
  height: 100vh;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  font-family: "Rajdhani", "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
}

/* ═══════════════════════════════════════════════════════════════════════════
   START SCREEN - HIGH DOPAMINE EDITION 🔥
   ═══════════════════════════════════════════════════════════════════════════ */

#start-screen {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  box-sizing: border-box;
  background: radial-gradient(
      ellipse at 50% 0%,
      rgba(0, 255, 136, 0.08) 0%,
      transparent 50%
    ),
    radial-gradient(
      ellipse at 0% 100%,
      rgba(255, 0, 128, 0.06) 0%,
      transparent 40%
    ),
    radial-gradient(
      ellipse at 100% 100%,
      rgba(0, 200, 255, 0.06) 0%,
      transparent 40%
    ),
    linear-gradient(180deg, #0a0a0f 0%, #0f1a1a 50%, #0a0a0f 100%);
  padding: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 60;
  pointer-events: auto;
  overflow: hidden;
}

/* Animated grid background */
.bg-grid {
  position: absolute;
  inset: 0;
  background-image: linear-gradient(
      rgba(0, 255, 136, 0.03) 1px,
      transparent 1px
    ),
    linear-gradient(90deg, rgba(0, 255, 136, 0.03) 1px, transparent 1px);
  background-size: 50px 50px;
  animation: gridMove 20s linear infinite;
  mask-image: radial-gradient(ellipse at center, black 30%, transparent 70%);
  -webkit-mask-image: radial-gradient(
    ellipse at center,
    black 30%,
    transparent 70%
  );
}

@keyframes gridMove {
  0% {
    transform: perspective(500px) rotateX(60deg) translateY(0);
  }
  100% {
    transform: perspective(500px) rotateX(60deg) translateY(50px);
  }
}

/* Floating glow orbs */
.bg-glow {
  position: absolute;
  border-radius: 50%;
  filter: blur(80px);
  opacity: 0.4;
  animation: floatGlow 8s ease-in-out infinite;
}

.bg-glow-1 {
  width: 400px;
  height: 400px;
  background: radial-gradient(circle, #00ff88 0%, transparent 70%);
  top: -100px;
  left: 10%;
  animation-delay: 0s;
}

.bg-glow-2 {
  width: 300px;
  height: 300px;
  background: radial-gradient(circle, #ff0080 0%, transparent 70%);
  bottom: -50px;
  right: 15%;
  animation-delay: -3s;
}

.bg-glow-3 {
  width: 350px;
  height: 350px;
  background: radial-gradient(circle, #00d4ff 0%, transparent 70%);
  top: 50%;
  right: -100px;
  animation-delay: -5s;
}

@keyframes floatGlow {
  0%,
  100% {
    transform: translate(0, 0) scale(1);
    opacity: 0.3;
  }
  25% {
    transform: translate(30px, -20px) scale(1.1);
    opacity: 0.5;
  }
  50% {
    transform: translate(-20px, 30px) scale(0.9);
    opacity: 0.4;
  }
  75% {
    transform: translate(-30px, -10px) scale(1.05);
    opacity: 0.35;
  }
}

/* Floating game icons */
.floating-icons {
  position: absolute;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
}

.float-icon {
  position: absolute;
  font-size: 2rem;
  opacity: 0.15;
  left: var(--x);
  animation: iconFloat var(--duration) ease-in-out infinite;
  animation-delay: var(--delay);
  filter: blur(1px);
}

@keyframes iconFloat {
  0% {
    transform: translateY(100vh) rotate(0deg);
    opacity: 0;
  }
  10% {
    opacity: 0.2;
  }
  90% {
    opacity: 0.2;
  }
  100% {
    transform: translateY(-100px) rotate(360deg);
    opacity: 0;
  }
}

/* Floating particles */
.floating-particles {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

/* Boss ribbon - enhanced */
.boss-ribbon {
  position: absolute;
  top: 30px;
  right: -50px;
  background: linear-gradient(135deg, #ff0080, #ff6600, #ffcc00);
  background-size: 200% 200%;
  color: #000;
  font-family: "Orbitron", sans-serif;
  font-weight: 900;
  font-size: 14px;
  letter-spacing: 2px;
  padding: 12px 60px;
  transform: rotate(25deg);
  text-transform: uppercase;
  border-radius: 4px;
  box-shadow: 0 4px 30px rgba(255, 0, 128, 0.5), 0 0 60px rgba(255, 102, 0, 0.3),
    inset 0 -2px 10px rgba(0, 0, 0, 0.2);
  animation: ribbonPulse 2s ease-in-out infinite,
    ribbonGradient 3s linear infinite;
  pointer-events: none;
  display: flex;
  align-items: center;
  gap: 8px;
  z-index: 10;
}

.ribbon-icon {
  animation: ribbonIconBounce 0.5s ease-in-out infinite alternate;
}

@keyframes ribbonIconBounce {
  0% {
    transform: scale(1) rotate(-10deg);
  }
  100% {
    transform: scale(1.2) rotate(10deg);
  }
}

@keyframes ribbonPulse {
  0%,
  100% {
    transform: rotate(25deg) scale(1);
    box-shadow: 0 4px 30px rgba(255, 0, 128, 0.5),
      0 0 60px rgba(255, 102, 0, 0.3);
  }
  50% {
    transform: rotate(25deg) scale(1.05);
    box-shadow: 0 4px 50px rgba(255, 0, 128, 0.7),
      0 0 80px rgba(255, 102, 0, 0.5);
  }
}

@keyframes ribbonGradient {
  0% {
    background-position: 0% 50%;
  }
  50% {
    background-position: 100% 50%;
  }
  100% {
    background-position: 0% 50%;
  }
}

/* Main card */
.start-card {
  position: relative;
  background: linear-gradient(
    165deg,
    rgba(20, 30, 30, 0.95) 0%,
    rgba(10, 15, 15, 0.98) 100%
  );
  padding: 40px 48px;
  border-radius: 24px;
  border: 1px solid rgba(0, 255, 136, 0.15);
  box-shadow: 0 25px 80px rgba(0, 0, 0, 0.8), 0 0 60px rgba(0, 255, 136, 0.15),
    inset 0 1px 0 rgba(255, 255, 255, 0.05);
  color: white;
  text-align: center;
  max-width: 480px;
  width: 92%;
  animation: cardEntrance 0.8s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
  transform: translateY(30px);
  opacity: 0;
  overflow: hidden;
}

.card-shine {
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(
    90deg,
    transparent,
    rgba(255, 255, 255, 0.05),
    transparent
  );
  animation: cardShine 4s ease-in-out infinite;
  pointer-events: none;
}

@keyframes cardShine {
  0%,
  100% {
    left: -100%;
  }
  50% {
    left: 100%;
  }
}

@keyframes cardEntrance {
  0% {
    transform: translateY(50px) scale(0.9);
    opacity: 0;
  }
  100% {
    transform: translateY(0) scale(1);
    opacity: 1;
  }
}

/* Logo styling */
.start-logo {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin-bottom: 8px;
}

.logo-text {
  font-family: "Orbitron", sans-serif;
  font-size: 18px;
  font-weight: 500;
  letter-spacing: 12px;
  color: rgba(255, 255, 255, 0.7);
  animation: logoFadeIn 0.6s ease-out 0.3s forwards;
  opacity: 0;
}

.logo-arena {
  font-family: "Orbitron", sans-serif;
  font-size: 52px;
  font-weight: 900;
  letter-spacing: 8px;
  background: linear-gradient(135deg, #00ff88 0%, #00ffcc 50%, #00ff88 100%);
  background-size: 200% auto;
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  filter: drop-shadow(0 0 30px rgba(0, 255, 136, 0.5));
  animation: logoGlow 3s ease-in-out infinite,
    logoSlideIn 0.8s cubic-bezier(0.34, 1.56, 0.64, 1) 0.2s forwards;
  opacity: 0;
  transform: translateY(20px);
}

.logo-underline {
  width: 120px;
  height: 3px;
  background: linear-gradient(90deg, transparent, #00ff88, transparent);
  margin: 12px auto 0;
  animation: underlineExpand 0.8s ease-out 0.6s forwards;
  transform: scaleX(0);
}

@keyframes logoFadeIn {
  to {
    opacity: 1;
  }
}

@keyframes logoSlideIn {
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes logoGlow {
  0%,
  100% {
    filter: drop-shadow(0 0 20px rgba(0, 255, 136, 0.4));
    background-position: 0% center;
  }
  50% {
    filter: drop-shadow(0 0 40px rgba(0, 255, 136, 0.7))
      drop-shadow(0 0 60px rgba(0, 255, 200, 0.3));
    background-position: 100% center;
  }
}

@keyframes underlineExpand {
  to {
    transform: scaleX(1);
  }
}

/* Tagline */
.start-tagline {
  margin: 24px 0 28px;
  display: flex;
  justify-content: center;
  gap: 16px;
  flex-wrap: wrap;
}

.tagline-word {
  font-size: 18px;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.8);
  animation: taglineSlide 0.5s ease-out forwards;
  animation-delay: calc(0.8s + var(--i) * 0.15s);
  opacity: 0;
  transform: translateY(10px);
}

.tagline-word:nth-child(1) {
  color: #ff6b6b;
}
.tagline-word:nth-child(2) {
  color: #ffd93d;
}
.tagline-word:nth-child(3) {
  color: #00ff88;
}

@keyframes taglineSlide {
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Details section */
.start-details {
  background: rgba(0, 255, 136, 0.03);
  border: 1px solid rgba(0, 255, 136, 0.1);
  border-radius: 16px;
  padding: 20px;
  margin-bottom: 28px;
  animation: detailsFadeIn 0.6s ease-out 1.2s forwards;
  opacity: 0;
}

@keyframes detailsFadeIn {
  to {
    opacity: 1;
  }
}

.detail-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 0;
  color: rgba(255, 255, 255, 0.75);
  font-size: 15px;
  text-align: left;
}

.detail-item + .detail-item {
  border-top: 1px solid rgba(255, 255, 255, 0.05);
}

.detail-icon {
  font-size: 20px;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 255, 136, 0.1);
  border-radius: 8px;
  flex-shrink: 0;
}

/* Primary button - START RUN */
.action-btn.primary {
  position: relative;
  background: transparent;
  border: none;
  padding: 0;
  cursor: pointer;
  width: 100%;
  height: 60px;
  border-radius: 12px;
  overflow: hidden;
  animation: btnEntrance 0.6s ease-out 1.4s forwards;
  opacity: 0;
  transform: translateY(10px);
}

.action-btn.primary .btn-bg {
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, #00ff88, #00cc6a);
  transition: all 0.3s ease;
}

.action-btn.primary .btn-bg::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(
    135deg,
    transparent 0%,
    rgba(255, 255, 255, 0.2) 50%,
    transparent 100%
  );
  transform: translateX(-100%);
  transition: transform 0.6s ease;
}

.action-btn.primary:hover .btn-bg::before {
  transform: translateX(100%);
}

.action-btn.primary .btn-text {
  position: relative;
  z-index: 1;
  font-family: "Orbitron", sans-serif;
  font-size: 18px;
  font-weight: 700;
  letter-spacing: 3px;
  color: #000;
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.3);
}

.action-btn.primary:hover {
  transform: translateY(-2px) scale(1.02);
  box-shadow: 0 10px 40px rgba(0, 255, 136, 0.4),
    0 0 60px rgba(0, 255, 136, 0.2);
}

.action-btn.primary:active {
  transform: scale(0.98);
}

.pulse-btn::after {
  content: "";
  position: absolute;
  inset: -4px;
  border-radius: 16px;
  border: 2px solid rgba(0, 255, 136, 0.5);
  animation: btnPulse 2s ease-in-out infinite;
}

@keyframes btnPulse {
  0%,
  100% {
    transform: scale(1);
    opacity: 0.5;
  }
  50% {
    transform: scale(1.05);
    opacity: 0;
  }
}

@keyframes btnEntrance {
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Secondary buttons */
.secondary-btns {
  display: flex;
  gap: 12px;
  margin-top: 16px;
  animation: btnEntrance 0.6s ease-out 1.6s forwards;
  opacity: 0;
}

.action-btn.secondary {
  flex: 1;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: rgba(255, 255, 255, 0.8);
  padding: 14px 20px;
  border-radius: 10px;
  font-family: "Rajdhani", sans-serif;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.action-btn.secondary:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(0, 255, 136, 0.3);
  color: #fff;
  transform: translateY(-2px);
}

.action-btn.secondary span {
  font-size: 16px;
}

/* Version tag */
.version-tag {
  position: absolute;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 12px;
  color: rgba(255, 255, 255, 0.3);
  letter-spacing: 1px;
  animation: fadeIn 1s ease-out 2s forwards;
  opacity: 0;
}

@keyframes fadeIn {
  to {
    opacity: 1;
  }
}

/* CSS Particles */
.floating-particles::before,
.floating-particles::after {
  content: "";
  position: absolute;
  width: 4px;
  height: 4px;
  background: #00ff88;
  border-radius: 50%;
  box-shadow: 100vw 10vh 0 0 rgba(0, 255, 136, 0.3),
    20vw 30vh 0 0 rgba(0, 255, 136, 0.2), 80vw 50vh 0 0 rgba(255, 0, 128, 0.2),
    40vw 70vh 0 0 rgba(0, 200, 255, 0.3), 60vw 20vh 0 0 rgba(0, 255, 136, 0.25),
    90vw 80vh 0 0 rgba(255, 200, 0, 0.2), 10vw 60vh 0 0 rgba(0, 255, 136, 0.15),
    70vw 40vh 0 0 rgba(255, 0, 128, 0.25), 30vw 90vh 0 0 rgba(0, 200, 255, 0.2),
    50vw 15vh 0 0 rgba(0, 255, 136, 0.3);
  animation: particleDrift 25s linear infinite;
}

.floating-particles::after {
  animation-delay: -12s;
  box-shadow: 15vw 25vh 0 0 rgba(255, 0, 128, 0.2),
    85vw 45vh 0 0 rgba(0, 255, 136, 0.25), 35vw 65vh 0 0 rgba(0, 200, 255, 0.2),
    55vw 85vh 0 0 rgba(255, 200, 0, 0.3), 75vw 5vh 0 0 rgba(0, 255, 136, 0.2),
    25vw 55vh 0 0 rgba(255, 0, 128, 0.15), 95vw 35vh 0 0 rgba(0, 255, 136, 0.25),
    5vw 75vh 0 0 rgba(0, 200, 255, 0.3), 45vw 95vh 0 0 rgba(0, 255, 136, 0.2),
    65vw 30vh 0 0 rgba(255, 200, 0, 0.2);
}

@keyframes particleDrift {
  0% {
    transform: translateY(0) translateX(0);
  }
  25% {
    transform: translateY(-10vh) translateX(5vw);
  }
  50% {
    transform: translateY(-5vh) translateX(-3vw);
  }
  75% {
    transform: translateY(-15vh) translateX(2vw);
  }
  100% {
    transform: translateY(0) translateX(0);
  }
}

/* Mobile responsiveness for start screen */
@media (max-width: 600px) {
  .start-card {
    padding: 28px 24px;
    border-radius: 20px;
  }

  .logo-text {
    font-size: 14px;
    letter-spacing: 8px;
  }

  .logo-arena {
    font-size: 36px;
    letter-spacing: 4px;
  }

  .logo-underline {
    width: 80px;
  }

  .start-tagline {
    gap: 10px;
    margin: 20px 0 24px;
  }

  .tagline-word {
    font-size: 15px;
  }

  .start-details {
    padding: 16px;
  }

  .detail-item {
    font-size: 14px;
    gap: 10px;
  }

  .detail-icon {
    font-size: 18px;
    width: 28px;
    height: 28px;
  }

  .action-btn.primary {
    height: 54px;
  }

  .action-btn.primary .btn-text {
    font-size: 15px;
    letter-spacing: 2px;
  }

  .secondary-btns {
    flex-direction: column;
    gap: 10px;
  }

  .action-btn.secondary {
    padding: 12px 16px;
    font-size: 14px;
  }

  .boss-ribbon {
    font-size: 11px;
    padding: 10px 45px;
    top: 20px;
    right: -45px;
  }

  .bg-glow-1 {
    width: 250px;
    height: 250px;
  }
  .bg-glow-2 {
    width: 200px;
    height: 200px;
  }
  .bg-glow-3 {
    width: 220px;
    height: 220px;
  }

  .float-icon {
    font-size: 1.5rem;
  }

  .version-tag {
    bottom: 12px;
    font-size: 11px;
  }
}

/* Extra small screens */
@media (max-width: 380px) {
  .logo-arena {
    font-size: 30px;
  }

  .start-card {
    padding: 24px 20px;
  }

  .boss-ribbon {
    font-size: 10px;
    padding: 8px 40px;
  }
}

canvas {
  background-color: #0a0a0f;
  box-shadow: 0 0 60px rgba(0, 0, 0, 0.8), 0 0 100px rgba(0, 255, 136, 0.1);
  -webkit-tap-highlight-color: transparent;
}

#ui-layer {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 20px;
  box-sizing: border-box;
  z-index: 10;
}

.top-controls {
  position: absolute;
  top: 20px;
  right: 20px;
  pointer-events: auto;
  display: flex;
  gap: 10px;
}

.icon-btn {
  background: rgba(0, 0, 0, 0.6);
  border: 1px solid #444;
  color: white;
  font-size: 24px;
  width: 50px;
  height: 50px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  justify-content: center;
  align-items: center;
  transition: background 0.2s;
}

.icon-btn:hover {
  background: rgba(0, 0, 0, 0.8);
  border-color: #fff;
}

/* Weapon Slots */
.weapon-slots-container {
  position: absolute;
  bottom: 20px;
  left: 20px;
  display: flex;
  gap: 10px;
  pointer-events: auto;
}

#boss-banner {
  position: absolute;
  top: 160px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(255, 111, 0, 0.2);
  border: 1px solid #ffb74d;
  color: #ffcc80;
  padding: 10px 16px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: bold;
  letter-spacing: 1px;
  text-shadow: 0 0 6px rgba(0, 0, 0, 0.6);
}

#boss-banner .boss-icon {
  font-size: 22px;
}

#boss-health {
  position: absolute;
  top: 160px;
  left: 50%;
  transform: translateX(-50%);
  width: min(480px, 80vw);
  background: rgba(0, 0, 0, 0.7);
  border: 1px solid rgba(255, 204, 128, 0.5);
  border-radius: 12px;
  padding: 8px 12px;
  box-shadow: 0 0 18px rgba(255, 148, 77, 0.3);
}

.boss-health-label {
  color: #ffcc80;
  font-weight: 700;
  margin-bottom: 6px;
  text-align: center;
}

.boss-health-bar {
  width: 100%;
  height: 14px;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 204, 128, 0.5);
  border-radius: 8px;
  overflow: hidden;
}

#boss-health-fill {
  height: 100%;
  width: 100%;
  background: linear-gradient(90deg, #ff7043, #ffa726);
  box-shadow: 0 0 10px rgba(255, 112, 67, 0.6);
}

.weapon-slot {
  width: 60px;
  height: 60px;
  background: rgba(0, 0, 0, 0.6);
  border: 2px solid #444;
  border-radius: 8px;
  display: flex;
  justify-content: center;
  align-items: center;
  position: relative;
  transition: all 0.2s;
}

.weapon-slot.active {
  border-color: #4caf50;
  box-shadow: 0 0 10px rgba(76, 175, 80, 0.3);
}

.weapon-slot .slot-number {
  position: absolute;
  top: 2px;
  left: 5px;
  font-size: 10px;
  color: #888;
}

.weapon-slot .weapon-icon {
  font-size: 24px;
}

/* Mobile Adjustments for slots */
@media (max-width: 600px) {
  .weapon-slots-container {
    bottom: 10px;
    left: 10px;
    gap: 8px;
  }

  .weapon-slot {
    width: 50px;
    height: 50px;
  }
}

/* Modal Styles */
.hidden {
  display: none !important;
}

#upgrade-modal,
#leaderboard-modal,
#settings-modal,
#game-over-modal {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.85);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 70;
  pointer-events: auto; /* Enable clicks */
}

.modal-content {
  background: #2a2a2a;
  padding: 20px;
  border-radius: 15px;
  text-align: center;
  width: 90%;
  max-width: 400px;
  color: white;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
  border: 1px solid #444;
}

.modal-content h2 {
  color: #4caf50;
  margin-top: 0;
}

/* ═══════════════════════════════════════════════════════════════════════════
   UPGRADE ROLL ANIMATION SYSTEM - MAXIMUM DOPAMINE EDITION 🎰✨
   ═══════════════════════════════════════════════════════════════════════════ */

/* Upgrade modal background pulse */
#upgrade-modal {
  transition: background 0.3s;
}

#upgrade-modal.pulse-bg {
  animation: bgPulse 0.8s ease-out;
}

@keyframes bgPulse {
  0% {
    background: rgba(0, 0, 0, 0.85);
  }
  50% {
    background: rgba(40, 20, 60, 0.9);
  }
  100% {
    background: rgba(0, 0, 0, 0.85);
  }
}

#upgrade-options {
  perspective: 1200px;
  position: relative;
}

.upgrade-card {
  background: #333;
  margin: 10px 0;
  padding: 15px;
  border-radius: 12px;
  cursor: pointer;
  transition: transform 0.15s ease-out, background 0.2s, box-shadow 0.3s;
  border: 1px solid #444;
  text-align: left;
  position: relative;
  overflow: hidden;
  transform-style: preserve-3d;
  opacity: 0;
  transform: rotateX(90deg) scale(0.8);
}

.upgrade-card.rolling {
  animation: cardRoll 0.15s ease-out infinite;
  pointer-events: none;
  opacity: 1;
  transform: none;
}

.upgrade-card.revealing {
  animation: cardReveal 0.6s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
  pointer-events: none;
}

.upgrade-card.revealed {
  opacity: 1;
  transform: rotateX(0) scale(1);
  pointer-events: auto;
}

.upgrade-card.revealed:active {
  transform: scale(0.96);
}

.upgrade-card.revealed:hover {
  background: #3a3a3a;
  transform: scale(1.03) translateY(-2px);
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.4);
}

/* LEGENDARY CARD - Rainbow border animation */
.upgrade-card[data-rarity="LEGENDARY"] {
  background: linear-gradient(135deg, #1a1a1a 0%, #2d2000 100%);
}

.upgrade-card[data-rarity="LEGENDARY"].revealed {
  animation: legendaryPulse 2s ease-in-out infinite;
}

.upgrade-card[data-rarity="LEGENDARY"]::after {
  content: "";
  position: absolute;
  inset: -3px;
  border-radius: 14px;
  background: linear-gradient(
    45deg,
    #ff0000,
    #ff7300,
    #fffb00,
    #48ff00,
    #00ffd5,
    #002bff,
    #7a00ff,
    #ff00c8,
    #ff0000
  );
  background-size: 400%;
  z-index: -1;
  animation: rainbowBorder 3s linear infinite;
  filter: blur(4px);
  opacity: 0.8;
}

@keyframes rainbowBorder {
  0% {
    background-position: 0% 50%;
  }
  50% {
    background-position: 100% 50%;
  }
  100% {
    background-position: 0% 50%;
  }
}

@keyframes legendaryPulse {
  0%,
  100% {
    box-shadow: 0 0 20px rgba(255, 215, 0, 0.6), 0 0 40px rgba(255, 215, 0, 0.3),
      0 0 60px rgba(255, 215, 0, 0.1);
  }
  50% {
    box-shadow: 0 0 30px rgba(255, 215, 0, 0.8), 0 0 60px rgba(255, 215, 0, 0.4),
      0 0 90px rgba(255, 215, 0, 0.2);
  }
}

/* EPIC CARD - Purple glow */
.upgrade-card[data-rarity="EPIC"] {
  background: linear-gradient(135deg, #1a1a1a 0%, #1a0025 100%);
}

.upgrade-card[data-rarity="EPIC"].revealed {
  animation: epicPulse 2s ease-in-out infinite;
}

@keyframes epicPulse {
  0%,
  100% {
    box-shadow: 0 0 15px rgba(156, 39, 176, 0.5),
      0 0 30px rgba(156, 39, 176, 0.2);
  }
  50% {
    box-shadow: 0 0 25px rgba(156, 39, 176, 0.7),
      0 0 50px rgba(156, 39, 176, 0.3);
  }
}

/* RARE CARD - Blue shimmer */
.upgrade-card[data-rarity="RARE"] {
  background: linear-gradient(135deg, #1a1a1a 0%, #001a2d 100%);
}

.upgrade-card[data-rarity="RARE"].revealed {
  animation: rarePulse 2.5s ease-in-out infinite;
}

@keyframes rarePulse {
  0%,
  100% {
    box-shadow: 0 0 10px rgba(33, 150, 243, 0.4);
  }
  50% {
    box-shadow: 0 0 20px rgba(33, 150, 243, 0.6);
  }
}

/* Rarity glow pulse on reveal - INTENSIFIED */
.upgrade-card.glow-burst::before {
  content: "";
  position: absolute;
  inset: -20px;
  border-radius: 20px;
  opacity: 0;
  animation: glowBurst 0.8s ease-out forwards;
  pointer-events: none;
  z-index: -1;
}

.upgrade-card[data-rarity="LEGENDARY"].glow-burst::before {
  background: radial-gradient(circle, rgba(255, 215, 0, 1), transparent 60%);
  inset: -40px;
}

.upgrade-card[data-rarity="EPIC"].glow-burst::before {
  background: radial-gradient(circle, rgba(156, 39, 176, 0.9), transparent 60%);
  inset: -30px;
}

.upgrade-card[data-rarity="RARE"].glow-burst::before {
  background: radial-gradient(circle, rgba(33, 150, 243, 0.8), transparent 60%);
}

.upgrade-card[data-rarity="COMMON"].glow-burst::before {
  background: radial-gradient(
    circle,
    rgba(158, 158, 158, 0.6),
    transparent 60%
  );
}

/* Sparkle effect - BIGGER AND MORE */
.upgrade-card .sparkle {
  position: absolute;
  width: 6px;
  height: 6px;
  background: white;
  border-radius: 50%;
  pointer-events: none;
  animation: sparkle 0.8s ease-out forwards;
  box-shadow: 0 0 6px currentColor, 0 0 12px currentColor;
}

.upgrade-card .sparkle.star {
  width: 0;
  height: 0;
  background: none;
  border-radius: 0;
  animation: starSparkle 1s ease-out forwards;
}

.upgrade-card .sparkle.star::before {
  content: "✦";
  font-size: 16px;
  position: absolute;
  transform: translate(-50%, -50%);
}

@keyframes sparkle {
  0% {
    transform: scale(0) rotate(0deg);
    opacity: 1;
  }
  50% {
    transform: scale(1.5) rotate(90deg);
    opacity: 1;
  }
  100% {
    transform: scale(0) rotate(180deg) translateY(-30px);
    opacity: 0;
  }
}

@keyframes starSparkle {
  0% {
    transform: scale(0) rotate(0deg);
    opacity: 1;
  }
  50% {
    transform: scale(1.5) rotate(180deg);
    opacity: 1;
  }
  100% {
    transform: scale(0) rotate(360deg) translateY(-50px);
    opacity: 0;
  }
}

@keyframes cardRoll {
  0% {
    transform: translateY(-100%) rotateX(-90deg);
    opacity: 0.3;
  }
  50% {
    transform: translateY(0) rotateX(0deg);
    opacity: 0.6;
  }
  100% {
    transform: translateY(100%) rotateX(90deg);
    opacity: 0.3;
  }
}

@keyframes cardReveal {
  0% {
    opacity: 0;
    transform: rotateX(90deg) scale(0.5) translateY(-40px);
    filter: blur(10px);
  }
  40% {
    opacity: 0.9;
    transform: rotateX(-15deg) scale(1.1) translateY(10px);
    filter: blur(0);
  }
  70% {
    transform: rotateX(5deg) scale(0.98) translateY(-5px);
  }
  100% {
    opacity: 1;
    transform: rotateX(0) scale(1) translateY(0);
    filter: blur(0);
  }
}

@keyframes glowBurst {
  0% {
    opacity: 0;
    transform: scale(0.5);
  }
  30% {
    opacity: 1;
    transform: scale(1.2);
  }
  100% {
    opacity: 0;
    transform: scale(2);
  }
}

/* Screen flash for legendary - MULTIPLE LAYERS */
.legendary-flash {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 100;
  animation: legendaryFlash 0.6s ease-out forwards;
}

.legendary-flash::before {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(
    circle at center,
    rgba(255, 215, 0, 0.6),
    transparent 50%
  );
  animation: flashPulse 0.6s ease-out;
}

.legendary-flash::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(
    45deg,
    transparent 40%,
    rgba(255, 255, 255, 0.3) 50%,
    transparent 60%
  );
  animation: flashSweep 0.4s ease-out;
}

@keyframes legendaryFlash {
  0% {
    opacity: 0;
    background: rgba(255, 215, 0, 0);
  }
  20% {
    opacity: 1;
    background: rgba(255, 215, 0, 0.15);
  }
  100% {
    opacity: 0;
    background: rgba(255, 215, 0, 0);
  }
}

@keyframes flashPulse {
  0% {
    transform: scale(0.5);
    opacity: 0;
  }
  50% {
    transform: scale(1);
    opacity: 1;
  }
  100% {
    transform: scale(1.5);
    opacity: 0;
  }
}

@keyframes flashSweep {
  0% {
    transform: translateX(-100%);
  }
  100% {
    transform: translateX(100%);
  }
}

/* CONFETTI! 🎊 */
.confetti-container {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 99;
  overflow: hidden;
}

.confetti {
  position: absolute;
  width: 10px;
  height: 10px;
  top: -20px;
  animation: confettiFall linear forwards;
}

.confetti.square {
  border-radius: 2px;
}

.confetti.circle {
  border-radius: 50%;
}

.confetti.star::before {
  content: "★";
  font-size: 14px;
}

@keyframes confettiFall {
  0% {
    transform: translateY(0) rotate(0deg) scale(1);
    opacity: 1;
  }
  100% {
    transform: translateY(100vh) rotate(720deg) scale(0.5);
    opacity: 0;
  }
}

/* LEGENDARY TEXT BURST */
.legendary-text-burst {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 48px;
  font-weight: 900;
  color: #ffd700;
  text-shadow: 0 0 20px #ffd700, 0 0 40px #ff8c00, 0 0 60px #ff4500,
    2px 2px 0 #000, -2px -2px 0 #000, 2px -2px 0 #000, -2px 2px 0 #000;
  pointer-events: none;
  z-index: 101;
  animation: textBurst 1s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
  letter-spacing: 4px;
}

@keyframes textBurst {
  0% {
    transform: translate(-50%, -50%) scale(0) rotate(-10deg);
    opacity: 0;
  }
  30% {
    transform: translate(-50%, -50%) scale(1.3) rotate(5deg);
    opacity: 1;
  }
  50% {
    transform: translate(-50%, -50%) scale(1) rotate(0deg);
  }
  80% {
    transform: translate(-50%, -50%) scale(1.05) rotate(-2deg);
    opacity: 1;
  }
  100% {
    transform: translate(-50%, -50%) scale(0.8) rotate(0deg);
    opacity: 0;
  }
}

/* Screen shake */
.screen-shake {
  animation: screenShake 0.4s ease-out;
}

@keyframes screenShake {
  0%,
  100% {
    transform: translate(0, 0);
  }
  10% {
    transform: translate(-5px, -3px);
  }
  20% {
    transform: translate(5px, 3px);
  }
  30% {
    transform: translate(-4px, 2px);
  }
  40% {
    transform: translate(4px, -2px);
  }
  50% {
    transform: translate(-3px, 3px);
  }
  60% {
    transform: translate(3px, -1px);
  }
  70% {
    transform: translate(-2px, 1px);
  }
  80% {
    transform: translate(2px, -1px);
  }
  90% {
    transform: translate(-1px, 0);
  }
}

/* Rolling placeholder cards - SLOT MACHINE STYLE */
.roll-placeholder {
  background: linear-gradient(135deg, #3a3a3a, #2a2a2a);
  margin: 10px 0;
  padding: 15px;
  border-radius: 12px;
  border: 2px solid #555;
  height: 85px;
  position: relative;
  overflow: hidden;
  box-shadow: inset 0 2px 10px rgba(0, 0, 0, 0.5);
}

.roll-placeholder::before {
  content: "";
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(
    0deg,
    transparent,
    transparent 20px,
    rgba(255, 255, 255, 0.03) 20px,
    rgba(255, 255, 255, 0.03) 40px
  );
  animation: slotScroll 0.1s linear infinite;
}

.roll-placeholder::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(
    90deg,
    transparent,
    rgba(255, 255, 255, 0.15),
    transparent
  );
  animation: shimmer 0.6s infinite;
}

/* Fake cards scrolling inside placeholder */
.roll-placeholder .fake-card {
  position: absolute;
  left: 10px;
  right: 10px;
  height: 60px;
  background: linear-gradient(135deg, #444, #333);
  border-radius: 8px;
  border: 2px solid #666;
  animation: fakeCardScroll 0.12s linear infinite;
}

@keyframes slotScroll {
  0% {
    transform: translateY(0);
  }
  100% {
    transform: translateY(40px);
  }
}

@keyframes fakeCardScroll {
  0% {
    transform: translateY(-100%);
    opacity: 0.5;
  }
  50% {
    transform: translateY(50%);
    opacity: 0.8;
  }
  100% {
    transform: translateY(200%);
    opacity: 0.5;
  }
}

@keyframes shimmer {
  0% {
    transform: translateX(-100%);
  }
  100% {
    transform: translateX(100%);
  }
}

/* Title animation - MORE DRAMATIC */
#upgrade-title.animate {
  animation: titlePop 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);
}

#upgrade-title {
  position: relative;
}

#upgrade-title.legendary-title {
  color: #ffd700 !important;
  text-shadow: 0 0 10px #ffd700, 0 0 20px #ff8c00;
  animation: titlePop 0.6s cubic-bezier(0.34, 1.56, 0.64, 1),
    legendaryTitleGlow 1.5s ease-in-out infinite;
}

@keyframes legendaryTitleGlow {
  0%,
  100% {
    text-shadow: 0 0 10px #ffd700, 0 0 20px #ff8c00;
  }
  50% {
    text-shadow: 0 0 20px #ffd700, 0 0 40px #ff8c00, 0 0 60px #ff4500;
  }
}

@keyframes titlePop {
  0% {
    transform: scale(0.5);
    opacity: 0;
  }
  100% {
    transform: scale(1);
    opacity: 1;
  }
}

.upgrade-title {
  font-weight: bold;
  font-size: 18px;
  color: #fff;
  margin-bottom: 5px;
}

.upgrade-desc {
  font-size: 14px;
  color: #aaa;
}

/* Leaderboard Specifics */
.tabs {
  display: flex;
  justify-content: center;
  margin-bottom: 15px;
  gap: 10px;
}

.tab-btn {
  background: #333;
  border: none;
  padding: 8px 16px;
  color: #aaa;
  border-radius: 20px;
  cursor: pointer;
  font-weight: bold;
  transition: all 0.2s;
}

.tab-btn.active {
  background: #4caf50;
  color: white;
}

#leaderboard-list {
  max-height: 300px;
  overflow-y: auto;
  margin-bottom: 15px;
  text-align: left;
}

.score-entry {
  display: flex;
  justify-content: space-between;
  padding: 10px;
  border-bottom: 1px solid #444;
}

.score-entry:last-child {
  border-bottom: none;
}

.rank {
  font-weight: bold;
  width: 30px;
  color: #fdd835;
}

.name {
  flex-grow: 1;
}

.score-val {
  font-weight: bold;
  color: #4caf50;
}

.action-btn {
  background: #444;
  color: white;
  border: none;
  padding: 10px 20px;
  border-radius: 5px;
  cursor: pointer;
  font-size: 16px;
}

.action-btn:hover {
  background: #555;
}

.action-btn.primary {
  background: linear-gradient(135deg, #4caf50, #6ee070);
  color: #0b1a0b;
  font-weight: 800;
  letter-spacing: 0.5px;
  box-shadow: 0 10px 30px rgba(76, 175, 80, 0.4);
}

.action-btn.primary:hover {
  background: linear-gradient(135deg, #6ee070, #4caf50);
}

/* Settings Specifics */
.setting-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 15px;
  background: #333;
  border-radius: 8px;
  margin-bottom: 20px;
}

.setting-row label {
  font-size: 18px;
  font-weight: bold;
}

.setting-row input[type="checkbox"] {
  width: 24px;
  height: 24px;
  cursor: pointer;
  accent-color: #4caf50;
}

/* Volume Control Styles */
.volume-row {
  flex-direction: column;
  align-items: stretch;
  gap: 10px;
}

.volume-row label {
  text-align: left;
}

.volume-control {
  display: flex;
  align-items: center;
  gap: 12px;
}

.volume-slider {
  flex: 1;
  height: 8px;
  -webkit-appearance: none;
  appearance: none;
  background: linear-gradient(90deg, #2a2a2a, #333);
  border-radius: 4px;
  outline: none;
  cursor: pointer;
}

.volume-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 20px;
  height: 20px;
  background: linear-gradient(135deg, #00ff88, #00cc6a);
  border-radius: 50%;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(0, 255, 136, 0.4);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.volume-slider::-webkit-slider-thumb:hover {
  transform: scale(1.15);
  box-shadow: 0 4px 16px rgba(0, 255, 136, 0.6);
}

.volume-slider::-moz-range-thumb {
  width: 20px;
  height: 20px;
  background: linear-gradient(135deg, #00ff88, #00cc6a);
  border-radius: 50%;
  cursor: pointer;
  border: none;
  box-shadow: 0 2px 8px rgba(0, 255, 136, 0.4);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.volume-slider::-moz-range-thumb:hover {
  transform: scale(1.15);
  box-shadow: 0 4px 16px rgba(0, 255, 136, 0.6);
}

.volume-slider::-moz-range-track {
  background: linear-gradient(90deg, #2a2a2a, #333);
  height: 8px;
  border-radius: 4px;
}

.volume-value {
  font-size: 14px;
  font-weight: 600;
  color: #00ff88;
  min-width: 40px;
  text-align: right;
}

/* Mobile Adjustments */
@media (max-width: 600px) {
  .top-controls {
    top: 10px;
    right: 10px;
    gap: 8px;
  }

  .icon-btn {
    width: 36px;
    height: 36px;
    font-size: 18px;
  }

  .boss-ribbon {
    top: 12px;
    right: -28px;
    padding: 8px 32px;
    font-size: 12px;
    border-radius: 10px;
  }

  #boss-banner {
    top: 130px;
    padding: 8px 12px;
    font-size: 14px;
  }

  #boss-banner .boss-icon {
    font-size: 18px;
  }

  #boss-health {
    top: 130px;
    padding: 6px 10px;
  }

  .boss-health-bar {
    height: 10px;
  }
}

/* ═══════════════════════════════════════════════════════════════════════════
   META PROGRESSION SYSTEM - PERMANENT UPGRADES 💎
   ═══════════════════════════════════════════════════════════════════════════ */

/* Upgrades Button on Start Screen */
.action-btn.upgrades-btn {
  position: relative;
  background: transparent;
  border: none;
  padding: 0;
  cursor: pointer;
  width: 100%;
  height: 52px;
  border-radius: 10px;
  overflow: hidden;
  margin-top: 16px;
  margin-bottom: 12px;
  animation: btnEntrance 0.6s ease-out 1.5s forwards;
  opacity: 0;
  transform: translateY(10px);
}

.action-btn.upgrades-btn .btn-bg.upgrades-bg {
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, #9c27b0, #7b1fa2, #6a1b9a);
  transition: all 0.3s ease;
}

.action-btn.upgrades-btn .btn-bg.upgrades-bg::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(
    135deg,
    transparent 0%,
    rgba(255, 255, 255, 0.2) 50%,
    transparent 100%
  );
  transform: translateX(-100%);
  transition: transform 0.6s ease;
}

.action-btn.upgrades-btn:hover .btn-bg.upgrades-bg::before {
  transform: translateX(100%);
}

.action-btn.upgrades-btn .btn-text {
  position: relative;
  z-index: 1;
  font-family: "Orbitron", sans-serif;
  font-size: 16px;
  font-weight: 700;
  letter-spacing: 2px;
  color: #fff;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.action-btn.upgrades-btn:hover {
  transform: translateY(-2px) scale(1.02);
  box-shadow: 0 8px 30px rgba(156, 39, 176, 0.4),
    0 0 40px rgba(156, 39, 176, 0.2);
}

.action-btn.upgrades-btn:active {
  transform: scale(0.98);
}

.pulse-upgrades::after {
  content: "";
  position: absolute;
  inset: -3px;
  border-radius: 13px;
  border: 2px solid rgba(156, 39, 176, 0.5);
  animation: upgradePulse 2.5s ease-in-out infinite;
}

@keyframes upgradePulse {
  0%,
  100% {
    transform: scale(1);
    opacity: 0.4;
  }
  50% {
    transform: scale(1.03);
    opacity: 0;
  }
}

.essence-preview {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  background: rgba(0, 0, 0, 0.3);
  padding: 4px 10px;
  border-radius: 12px;
  font-size: 12px;
  font-family: "Rajdhani", sans-serif;
  font-weight: 600;
  color: #e1bee7;
  z-index: 2;
}

/* Meta Upgrades Modal */
#meta-upgrades-modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.9);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 80;
  pointer-events: auto;
  backdrop-filter: blur(4px);
}

#meta-upgrades-modal .modal-content.meta-modal {
  background: linear-gradient(
    165deg,
    rgba(30, 20, 40, 0.98),
    rgba(15, 10, 20, 0.99)
  );
  padding: 0;
  border-radius: 20px;
  max-width: 700px;
  width: 95%;
  max-height: 85vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  border: 1px solid rgba(156, 39, 176, 0.3);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.8), 0 0 40px rgba(156, 39, 176, 0.2),
    inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

.meta-header {
  padding: 20px 24px;
  background: linear-gradient(180deg, rgba(156, 39, 176, 0.15), transparent);
  border-bottom: 1px solid rgba(156, 39, 176, 0.2);
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
}

.meta-header h2 {
  margin: 0;
  font-family: "Orbitron", sans-serif;
  font-size: 22px;
  color: #e1bee7;
  text-shadow: 0 0 20px rgba(156, 39, 176, 0.5);
}

.essence-display {
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(0, 0, 0, 0.4);
  padding: 8px 16px;
  border-radius: 20px;
  border: 1px solid rgba(156, 39, 176, 0.3);
}

.essence-display .essence-icon {
  font-size: 20px;
  animation: essenceGlow 2s ease-in-out infinite;
}

@keyframes essenceGlow {
  0%,
  100% {
    transform: scale(1);
    filter: brightness(1);
  }
  50% {
    transform: scale(1.1);
    filter: brightness(1.3);
  }
}

.essence-display .essence-amount {
  font-family: "Orbitron", sans-serif;
  font-size: 20px;
  font-weight: 700;
  color: #ce93d8;
}

.essence-display .essence-label {
  font-size: 12px;
  color: rgba(255, 255, 255, 0.5);
  text-transform: uppercase;
  letter-spacing: 1px;
}

/* Upgrade Grid */
.meta-upgrade-grid {
  padding: 16px 20px;
  overflow-y: auto;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.upgrade-category {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.category-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  background: rgba(var(--cat-color-rgb, 100, 100, 100), 0.1);
  border-radius: 8px;
  border-left: 3px solid var(--cat-color, #888);
}

.category-header .category-icon {
  font-size: 18px;
}

.category-header .category-name {
  font-family: "Orbitron", sans-serif;
  font-size: 14px;
  font-weight: 600;
  color: var(--cat-color, #fff);
  text-transform: uppercase;
  letter-spacing: 2px;
}

.category-upgrades {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 12px;
}

/* Upgrade Card */
.meta-upgrade-card {
  background: linear-gradient(
    145deg,
    rgba(40, 30, 50, 0.9),
    rgba(25, 20, 35, 0.95)
  );
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  padding: 14px;
  cursor: pointer;
  transition: all 0.2s ease;
  position: relative;
  overflow: hidden;
}

.meta-upgrade-card::before {
  content: "";
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(
    90deg,
    transparent,
    rgba(255, 255, 255, 0.05),
    transparent
  );
  transition: left 0.5s ease;
}

.meta-upgrade-card:hover::before {
  left: 100%;
}

.meta-upgrade-card:hover {
  transform: translateY(-3px);
  border-color: rgba(156, 39, 176, 0.5);
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.4), 0 0 20px rgba(156, 39, 176, 0.15);
}

.meta-upgrade-card.locked {
  opacity: 0.6;
  cursor: not-allowed;
}

.meta-upgrade-card.locked:hover {
  transform: none;
  box-shadow: none;
}

.meta-upgrade-card.maxed {
  background: linear-gradient(
    145deg,
    rgba(76, 175, 80, 0.15),
    rgba(40, 80, 40, 0.2)
  );
  border-color: rgba(76, 175, 80, 0.3);
  cursor: default;
}

.meta-upgrade-card.maxed:hover {
  transform: none;
}

.meta-upgrade-card.shake {
  animation: cardShake 0.4s ease-out;
}

@keyframes cardShake {
  0%,
  100% {
    transform: translateX(0);
  }
  20% {
    transform: translateX(-8px);
  }
  40% {
    transform: translateX(8px);
  }
  60% {
    transform: translateX(-4px);
  }
  80% {
    transform: translateX(4px);
  }
}

.meta-upgrade-card.purchased {
  animation: purchaseFlash 0.6s ease-out;
}

@keyframes purchaseFlash {
  0% {
    box-shadow: 0 0 0 0 rgba(156, 39, 176, 0.8);
  }
  50% {
    box-shadow: 0 0 30px 10px rgba(156, 39, 176, 0.4);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(156, 39, 176, 0);
  }
}

.upgrade-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
}

.upgrade-header .upgrade-icon {
  font-size: 24px;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(156, 39, 176, 0.2);
  border-radius: 8px;
}

.upgrade-info {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.upgrade-info .upgrade-name {
  font-family: "Rajdhani", sans-serif;
  font-size: 15px;
  font-weight: 700;
  color: #fff;
}

.upgrade-info .upgrade-level {
  font-size: 11px;
  color: rgba(255, 255, 255, 0.5);
  text-transform: uppercase;
  letter-spacing: 1px;
}

.upgrade-description {
  font-size: 13px;
  color: rgba(255, 255, 255, 0.7);
  margin-bottom: 10px;
  line-height: 1.4;
}

.upgrade-progress {
  margin-bottom: 10px;
}

.upgrade-progress .progress-bar {
  height: 4px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 2px;
  overflow: hidden;
}

.upgrade-progress .progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #9c27b0, #ce93d8);
  border-radius: 2px;
  transition: width 0.3s ease;
}

.upgrade-cost {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  background: rgba(0, 0, 0, 0.3);
  border-radius: 6px;
  width: fit-content;
}

.upgrade-cost .cost-icon {
  font-size: 14px;
}

.upgrade-cost .cost-amount {
  font-family: "Orbitron", sans-serif;
  font-size: 14px;
  font-weight: 600;
  color: #888;
}

.upgrade-cost.affordable .cost-amount {
  color: #ce93d8;
}

.upgrade-cost .cost-next {
  font-size: 11px;
  color: rgba(76, 175, 80, 0.8);
  margin-left: 4px;
}

.upgrade-maxed {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 6px 10px;
  background: rgba(76, 175, 80, 0.2);
  border-radius: 6px;
  color: #81c784;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
}

.purchase-sparkle {
  position: absolute;
  width: 6px;
  height: 6px;
  background: #ce93d8;
  border-radius: 50%;
  pointer-events: none;
  animation: purchaseSparkle 0.8s ease-out forwards;
}

@keyframes purchaseSparkle {
  0% {
    transform: scale(0);
    opacity: 1;
  }
  100% {
    transform: scale(2) translateY(-20px);
    opacity: 0;
  }
}

/* Meta Footer */
.meta-footer {
  padding: 16px 24px;
  background: rgba(0, 0, 0, 0.3);
  border-top: 1px solid rgba(255, 255, 255, 0.05);
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 16px;
}

.meta-stats {
  display: flex;
  gap: 20px;
  flex-wrap: wrap;
}

.stat-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
}

.stat-item .stat-icon {
  font-size: 16px;
}

.stat-item .stat-value {
  font-family: "Orbitron", sans-serif;
  font-size: 14px;
  font-weight: 600;
  color: #fff;
}

.stat-item .stat-label {
  font-size: 10px;
  color: rgba(255, 255, 255, 0.4);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* Essence Earned Display (Game Over) */
.essence-earned {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin: 16px 0;
  padding: 12px 20px;
  background: linear-gradient(
    135deg,
    rgba(156, 39, 176, 0.2),
    rgba(103, 58, 183, 0.2)
  );
  border: 1px solid rgba(156, 39, 176, 0.3);
  border-radius: 12px;
  animation: essenceEarnedPop 0.5s cubic-bezier(0.34, 1.56, 0.64, 1) 0.3s
    forwards;
  opacity: 0;
  transform: scale(0.8);
}

@keyframes essenceEarnedPop {
  to {
    opacity: 1;
    transform: scale(1);
  }
}

.essence-earned .essence-icon {
  font-size: 24px;
  animation: essenceGlow 1.5s ease-in-out infinite;
}

.essence-earned #essence-earned-val {
  font-family: "Orbitron", sans-serif;
  font-size: 28px;
  font-weight: 700;
  color: #ce93d8;
  text-shadow: 0 0 10px rgba(156, 39, 176, 0.5);
}

.essence-earned .essence-text {
  font-size: 14px;
  color: rgba(255, 255, 255, 0.6);
  margin-left: 4px;
}

/* Spend Essence Button (Game Over) */
.action-btn.spend-essence-btn {
  background: linear-gradient(135deg, rgba(156, 39, 176, 0.3), rgba(103, 58, 183, 0.3));
  border: 2px solid rgba(156, 39, 176, 0.5);
  color: #ce93d8;
  padding: 12px 24px;
  font-size: 15px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  transition: all 0.3s ease;
}

.action-btn.spend-essence-btn:hover {
  background: linear-gradient(135deg, rgba(156, 39, 176, 0.5), rgba(103, 58, 183, 0.5));
  border-color: rgba(156, 39, 176, 0.8);
  color: #fff;
  transform: translateY(-2px);
  box-shadow: 0 4px 20px rgba(156, 39, 176, 0.4);
}

.action-btn.spend-essence-btn span {
  font-size: 16px;
}

/* Mobile Adjustments for Meta UI */
@media (max-width: 600px) {
  .meta-header {
    padding: 16px 18px;
    flex-direction: column;
    text-align: center;
  }

  .meta-header h2 {
    font-size: 18px;
  }

  .essence-display {
    width: 100%;
    justify-content: center;
  }

  .meta-upgrade-grid {
    padding: 12px 16px;
  }

  .category-upgrades {
    grid-template-columns: 1fr;
  }

  .meta-footer {
    flex-direction: column;
    text-align: center;
  }

  .meta-stats {
    justify-content: center;
    width: 100%;
  }

  .action-btn.upgrades-btn {
    height: 48px;
  }

  .action-btn.upgrades-btn .btn-text {
    font-size: 14px;
  }
}

/* ═══════════════════════════════════════════════════════════════════════════
   PATCH NOTES SYSTEM 📋
   ═══════════════════════════════════════════════════════════════════════════ */

/* Patch Notes Button on Start Screen */
.action-btn.patch-notes-btn {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: rgba(255, 255, 255, 0.7);
  padding: 10px 20px;
  border-radius: 8px;
  font-family: "Rajdhani", sans-serif;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-top: 12px;
  width: 100%;
  animation: btnEntrance 0.6s ease-out 1.7s forwards;
  opacity: 0;
}

.action-btn.patch-notes-btn:hover {
  background: rgba(0, 200, 255, 0.1);
  border-color: rgba(0, 200, 255, 0.4);
  color: #00d4ff;
  transform: translateY(-1px);
  box-shadow: 0 4px 15px rgba(0, 200, 255, 0.15);
}

.action-btn.patch-notes-btn span {
  font-size: 14px;
}

/* New patch indicator */
.action-btn.patch-notes-btn.has-new {
  position: relative;
  border-color: rgba(0, 255, 136, 0.4);
}

/* Glow effect using pseudo-element so it doesn't affect button visibility */
.action-btn.patch-notes-btn.has-new::after {
  content: "";
  position: absolute;
  inset: -2px;
  border-radius: 10px;
  border: 2px solid rgba(0, 255, 136, 0.5);
  animation: newPatchGlow 2s ease-in-out infinite;
  pointer-events: none;
}

.action-btn.patch-notes-btn.has-new:hover {
  border-color: rgba(0, 255, 136, 0.6);
  box-shadow: 0 4px 20px rgba(0, 255, 136, 0.25);
}

.action-btn.patch-notes-btn.has-new:hover::after {
  animation: none;
  border-color: rgba(0, 255, 136, 0.8);
}

@keyframes newPatchGlow {
  0%, 100% {
    opacity: 0.4;
    transform: scale(1);
  }
  50% {
    opacity: 1;
    transform: scale(1.02);
    box-shadow: 0 0 20px rgba(0, 255, 136, 0.4);
  }
}

.new-indicator {
  position: absolute;
  top: -8px;
  right: -8px;
  background: linear-gradient(135deg, #00ff88, #00cc6a);
  color: #000;
  font-size: 9px !important;
  font-weight: 800;
  padding: 3px 6px;
  border-radius: 6px;
  letter-spacing: 0.5px;
  animation: newBadgeBounce 1s ease-in-out infinite;
  box-shadow: 0 2px 8px rgba(0, 255, 136, 0.4);
}

@keyframes newBadgeBounce {
  0%, 100% {
    transform: scale(1) rotate(-2deg);
  }
  50% {
    transform: scale(1.1) rotate(2deg);
  }
}

/* Patch Notes Modal */
#patch-notes-modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.92);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 80;
  pointer-events: auto;
  backdrop-filter: blur(6px);
}

#patch-notes-modal .modal-content.patch-notes-modal {
  background: linear-gradient(
    165deg,
    rgba(15, 25, 35, 0.98),
    rgba(5, 10, 20, 0.99)
  );
  padding: 0;
  border-radius: 20px;
  max-width: 600px;
  width: 95%;
  max-height: 80vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  border: 1px solid rgba(0, 200, 255, 0.2);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.8), 
    0 0 50px rgba(0, 200, 255, 0.1),
    inset 0 1px 0 rgba(255, 255, 255, 0.05);
  animation: modalSlideIn 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes modalSlideIn {
  from {
    opacity: 0;
    transform: scale(0.9) translateY(20px);
  }
  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

.patch-notes-header {
  padding: 24px 28px 16px;
  background: linear-gradient(180deg, rgba(0, 200, 255, 0.1), transparent);
  border-bottom: 1px solid rgba(0, 200, 255, 0.15);
  text-align: center;
}

.patch-notes-header h2 {
  margin: 0;
  font-family: "Orbitron", sans-serif;
  font-size: 24px;
  color: #00d4ff;
  text-shadow: 0 0 20px rgba(0, 200, 255, 0.5);
}

.patch-notes-subtitle {
  margin-top: 6px;
  font-size: 13px;
  color: rgba(255, 255, 255, 0.5);
  letter-spacing: 1px;
}

.patch-notes-content {
  padding: 20px 24px;
  overflow-y: auto;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.patch-notes-content::-webkit-scrollbar {
  width: 6px;
}

.patch-notes-content::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.05);
  border-radius: 3px;
}

.patch-notes-content::-webkit-scrollbar-thumb {
  background: rgba(0, 200, 255, 0.3);
  border-radius: 3px;
}

.patch-notes-content::-webkit-scrollbar-thumb:hover {
  background: rgba(0, 200, 255, 0.5);
}

/* Patch Entry */
.patch-entry {
  background: linear-gradient(
    145deg,
    rgba(20, 30, 45, 0.8),
    rgba(10, 15, 25, 0.9)
  );
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 14px;
  padding: 18px;
  animation: patchSlideIn 0.5s ease-out backwards;
}

@keyframes patchSlideIn {
  from {
    opacity: 0;
    transform: translateX(-20px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

.patch-entry.latest {
  border-color: rgba(0, 255, 136, 0.3);
  box-shadow: 0 0 30px rgba(0, 255, 136, 0.08);
}

.patch-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
}

.patch-version-badge {
  font-family: "Orbitron", sans-serif;
  font-size: 12px;
  font-weight: 700;
  color: rgba(255, 255, 255, 0.6);
  background: rgba(255, 255, 255, 0.08);
  padding: 4px 10px;
  border-radius: 12px;
  letter-spacing: 1px;
}

.patch-version-badge.new {
  color: #00ff88;
  background: rgba(0, 255, 136, 0.15);
  border: 1px solid rgba(0, 255, 136, 0.3);
  animation: newBadgePulse 2s ease-in-out infinite;
}

@keyframes newBadgePulse {
  0%, 100% {
    box-shadow: 0 0 0 0 rgba(0, 255, 136, 0.4);
  }
  50% {
    box-shadow: 0 0 10px 2px rgba(0, 255, 136, 0.2);
  }
}

.patch-date {
  font-size: 12px;
  color: rgba(255, 255, 255, 0.4);
}

.patch-title {
  margin: 0 0 14px 0;
  font-family: "Rajdhani", sans-serif;
  font-size: 20px;
  font-weight: 700;
  color: #fff;
}

/* Highlights */
.patch-highlights {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 16px;
}

.highlight-item {
  font-size: 13px;
  color: rgba(255, 255, 255, 0.85);
  background: rgba(0, 200, 255, 0.08);
  border: 1px solid rgba(0, 200, 255, 0.15);
  padding: 6px 12px;
  border-radius: 8px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

/* Change List */
.patch-changes {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.change-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  font-size: 13px;
  color: rgba(255, 255, 255, 0.75);
  padding: 8px 10px;
  background: rgba(0, 0, 0, 0.2);
  border-radius: 8px;
  border-left: 3px solid transparent;
}

.change-item.change-feature {
  border-left-color: #00ff88;
}

.change-item.change-improvement {
  border-left-color: #00d4ff;
}

.change-item.change-fix {
  border-left-color: #ffd93d;
}

.change-item.change-balance {
  border-left-color: #ff6b6b;
}

.change-tag {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  white-space: nowrap;
  opacity: 0.9;
}

.change-feature .change-tag {
  color: #00ff88;
}

.change-improvement .change-tag {
  color: #00d4ff;
}

.change-fix .change-tag {
  color: #ffd93d;
}

.change-balance .change-tag {
  color: #ff6b6b;
}

.change-text {
  flex: 1;
  line-height: 1.4;
}

/* Patch Notes Footer */
.patch-notes-footer {
  padding: 16px 24px;
  background: rgba(0, 0, 0, 0.3);
  border-top: 1px solid rgba(255, 255, 255, 0.05);
  display: flex;
  justify-content: center;
}

/* Mobile Adjustments for Patch Notes */
@media (max-width: 600px) {
  #patch-notes-modal .modal-content.patch-notes-modal {
    max-height: 85vh;
    border-radius: 16px;
  }

  .patch-notes-header {
    padding: 18px 20px 14px;
  }

  .patch-notes-header h2 {
    font-size: 20px;
  }

  .patch-notes-content {
    padding: 16px 18px;
    gap: 16px;
  }

  .patch-entry {
    padding: 14px;
  }

  .patch-title {
    font-size: 17px;
  }

  .patch-highlights {
    flex-direction: column;
  }

  .highlight-item {
    font-size: 12px;
    padding: 5px 10px;
  }

  .change-item {
    font-size: 12px;
    padding: 6px 8px;
  }

  .change-tag {
    font-size: 9px;
  }

  .action-btn.patch-notes-btn {
    font-size: 12px;
    padding: 8px 16px;
  }
}
