/* Z-INDEX HIERARCHY FIX
 * Establishing consistent layering system
 *
 * LAYERS:
 * 1-99: Base content (particles, backgrounds)
 * 100-199: Game elements (button, stats)
 * 200-299: Floating UI (currency bar, notifications)
 * 300-399: Overlays (golden hour, events)
 * 1000-1999: Modals (warning, stats, level up)
 * 2000-2999: Critical modals (app store, updates)
 * 10000+: System alerts and debug
 */

/* Base Layer (1-99) */
#particleCanvas { z-index: 1 !important; }
.button-glow { z-index: 2 !important; }

/* Game Elements (100-199) */
.stats-bar { z-index: 100 !important; }
.currency-bar { z-index: 101 !important; }
.progress-container { z-index: 102 !important; }
.button-container { z-index: 110 !important; }
.dopamine-button { z-index: 111 !important; }
.stats-panel { z-index: 120 !important; }
.activity-feed { z-index: 130 !important; }
.leaderboard { z-index: 131 !important; }

/* Floating UI (200-299) */
.floating-number { z-index: 200 !important; }
.achievement-popup { z-index: 210 !important; }
.rare-drop { z-index: 211 !important; }
.currency-float { z-index: 212 !important; }
.post-warning-indicator { z-index: 220 !important; }
.version-badge { z-index: 250 !important; }
.app-store-button { z-index: 251 !important; }

/* Game Overlays (300-399) */
.golden-hour { z-index: 300 !important; }
.mystery-box { z-index: 310 !important; }
.streak-terror-display { z-index: 320 !important; }
.tolerance-indicator { z-index: 321 !important; }
.update-button { z-index: 330 !important; }
.prestige-button { z-index: 331 !important; }

/* Standard Modals (1000-1999) */
.warning-modal { z-index: 1000 !important; }
.stats-modal { z-index: 1001 !important; }
.level-up-modal { z-index: 1002 !important; }
.prestige-modal { z-index: 1003 !important; }
.update-modal { z-index: 1004 !important; }

/* Priority Modals (2000-2999) */
.app-store-modal { z-index: 2000 !important; }
.update-loading { z-index: 2001 !important; }
.patch-notes { z-index: 2002 !important; }

/* System Level (10000+) */
.modal-fix-overlay { z-index: 10000 !important; }
.system-notification { z-index: 10001 !important; }
.debug-panel { z-index: 10002 !important; }

/* Special Effects - should be above most things but below modals */
.gravity-well { z-index: 400 !important; }
.dimensional-rift { z-index: 401 !important; }
.reality-distortion { z-index: 402 !important; }

/* Notification layers */
.bonus-alert { z-index: 500 !important; }
.store-notification { z-index: 501 !important; }
.bug-notification { z-index: 502 !important; }

/* Mobile specific */
@media (max-width: 768px) {
    /* Ensure mobile UI stays accessible */
    .mobile-menu { z-index: 900 !important; }
    .mobile-overlay { z-index: 901 !important; }
}

/* Emergency overrides for known problematic elements */
.phantom-cursor { z-index: 150 !important; } /* Below floating numbers */
.juice-effect { z-index: 112 !important; } /* Just above button */
.metamorphosis-creature { z-index: 113 !important; } /* Above juice */

/* Ensure our new app theme elements are properly layered */
.version-badge {
    z-index: 250 !important;
    position: fixed !important;
    top: 60px !important;
    right: 20px !important;
}

.currency-bar {
    z-index: 101 !important;
    position: relative !important;
}

.app-store-button {
    z-index: 251 !important;
    position: fixed !important;
}

.app-store-modal {
    z-index: 2000 !important;
    position: fixed !important;
}

/* Fix any inline styles with excessive z-index */
[style*="z-index: 9"] {
    z-index: 1000 !important;
}

[style*="z-index: 100000"],
[style*="z-index: 99"] {
    z-index: 10000 !important;
}