/* Performance Optimizations for Dragon Den */

/* Disable heavy animations on lower-end devices */
@media (max-width: 768px), (prefers-reduced-motion: reduce) {
  /* Remove all background animations */
  body::before,
  body::after {
    animation: none !important;
    opacity: 0.05 !important;
  }
  
  /* Simplify header effects */
  .game-header::before {
    display: none;
  }
  
  /* Remove glow animations */
  .logo i,
  .logo .accent {
    animation: none;
    text-shadow: 0 0 5px var(--dragon-gold);
  }
  
  /* Simplify class card effects */
  .class-icon {
    filter: none;
    animation: none;
  }
  
  .class-card:hover .class-icon {
    animation: none;
    transform: translateY(-2px);
  }
}

/* GPU Acceleration for key elements */
.game-header,
.class-card,
.modal-content,
.logo {
  transform: translateZ(0);
  backface-visibility: hidden;
}

/* Optimize transitions */
.class-card,
.stat-orb,
.quick-stat {
  transition-property: transform, border-color;
  transition-duration: 0.2s;
  transition-timing-function: ease;
}

/* Reduce backdrop-filter usage */
@media (max-width: 1024px) {
  .game-header,
  .modal-content {
    backdrop-filter: none;
    background: rgba(26, 26, 26, 0.98);
  }
}

/* Optimize font rendering */
body {
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeSpeed;
}

/* Reduce shadow complexity */
.class-card {
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

.class-card:hover {
  box-shadow: 0 8px 16px rgba(251, 191, 36, 0.15);
}

/* Simplify gradients on mobile */
@media (max-width: 768px) {
  body {
    background: #0f0f0f;
  }
  
  .class-card {
    background: rgba(26, 26, 26, 0.98);
  }
  
  /* Remove complex gradients from abilities */
  .ability {
    background: var(--dragon-red);
  }
}

/* Optimize animation performance */
@keyframes dragonBreathLight {
  0%, 100% { opacity: 0.06; }
  50% { opacity: 0.08; }
}

@keyframes emberFloatLight {
  0% { transform: translate3d(0, 0, 0); }
  100% { transform: translate3d(0, -5px, 0); }
}

/* Reduce repaints */
.class-grid {
  contain: layout style paint;
}

.class-card {
  contain: layout style;
}

/* Optimize for 60fps */
.unified-stats-bar,
.health-fill-compact,
.mana-fill-compact,
.xp-fill-compact {
  will-change: transform;
}

/* Critical rendering path optimization */
.game-container {
  contain: layout;
}

/* Reduce layout thrashing */
.modal {
  contain: layout style paint;
}

/* Battery saving mode */
@media (prefers-reduced-motion: reduce) {
  * {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* High performance mode for modern browsers */
@supports (backdrop-filter: blur(10px)) {
  .game-header {
    backdrop-filter: blur(8px);
  }
}

/* Optimize for touch devices */
@media (hover: none) {
  .class-card:hover {
    transform: none;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
  }
  
  .stat-orb:hover,
  .quick-stat:hover {
    transform: none;
  }
}

/* Memory optimization */
.class-card,
.stat-orb {
  transform-style: preserve-3d;
  perspective: 1000px;
}

/* Reduce composite layers */
.logo i,
.logo .accent {
  will-change: auto;
}

/* Optimize for low-end devices */
@media (max-device-width: 480px) {
  /* Remove all animations */
  * {
    animation: none !important;
    transition: none !important;
  }
  
  /* Simplify backgrounds */
  body::before,
  body::after {
    display: none;
  }
  
  /* Reduce visual complexity */
  .class-icon {
    filter: none;
  }
  
  .game-header {
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
  }
}
