:root {
    --primary: #6B46C1;
    --primary-dark: #553C9A;
    --primary-light: #9333EA;
    --accent: #F59E0B;
    --success: #10B981;
    --rare: #3B82F6;
    --epic: #8B5CF6;
    --legendary: #F97316;
    --bg-dark: #0F0E17;
    --bg-medium: #1A1825;
    --text-primary: #FFFFFE;
    --text-secondary: #A7A9BE;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    background: radial-gradient(ellipse at center, var(--bg-medium) 0%, var(--bg-dark) 100%);
    background-color: var(--bg-dark); /* Fallback for mobile */
    color: var(--text-primary);
    height: 100vh;
    overflow: hidden;
    position: relative;
    -webkit-text-size-adjust: 100%; /* Prevent iOS text scaling */
}

#particleCanvas {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1;
}

#app {
    position: relative;
    z-index: 2;
    height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 20px;
}

/* Stats Bar */
.stats-bar {
    display: flex;
    gap: 30px;
    margin-bottom: 30px;  /* Increased spacing to prevent overlap */
    animation: slideDown 0.5s ease-out;
    position: relative;
    z-index: 10;  /* Ensure stats stay above progress bars */
}

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

.stat-label {
    font-size: 10px;
    color: var(--text-secondary);
    letter-spacing: 2px;
    margin-bottom: 5px;
}

.stat-value {
    font-size: 24px;
    font-weight: bold;
    background: linear-gradient(135deg, var(--primary-light), var(--accent));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* Progress Bars */
.progress-container {
    width: 100%;
    max-width: 400px;
    margin-bottom: 40px;
    margin-top: 10px;  /* Add top margin to prevent overlap */
}

.progress-bar, .combo-bar {
    position: relative;
    height: 30px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 15px;
    overflow: hidden;
    margin-bottom: 15px;  /* Increased spacing between bars */
    backdrop-filter: blur(10px);
    width: 100%;  /* Ensure full width on mobile */
}

.progress-fill, .combo-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary), var(--primary-light));
    border-radius: 15px;
    transition: width 0.3s ease-out;
    box-shadow: 0 0 20px rgba(147, 51, 234, 0.5);
}

.combo-fill {
    background: linear-gradient(90deg, var(--accent), var(--legendary));
}

.progress-text, .combo-text {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 12px;
    font-weight: bold;
    text-shadow: 0 0 10px rgba(0, 0, 0, 0.5);
}

/* Main Button */
.button-container {
    position: relative;
    margin: 30px 0;  /* Reduced margin for better mobile spacing */
    z-index: 100;  /* Keep button above other elements */
}

.button-glow {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 250px;
    height: 250px;
    background: radial-gradient(circle, rgba(147, 51, 234, 0.3), transparent);
    border-radius: 50%;
    animation: pulse 2s infinite;
    pointer-events: none;
}

.button-ring {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 220px;
    height: 220px;
    border: 3px solid rgba(147, 51, 234, 0.3);
    border-radius: 50%;
    animation: rotate 10s linear infinite;
    pointer-events: none;
}

.dopamine-button {
    position: relative;
    width: 200px;
    height: 200px;
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 50%;
    background: linear-gradient(145deg,
        rgba(255, 255, 255, 0.15) 0%,
        rgba(168, 85, 247, 0.95) 10%,
        rgba(147, 51, 234, 1) 30%,
        rgba(126, 34, 206, 1) 70%,
        rgba(107, 33, 168, 0.95) 90%,
        rgba(0, 0, 0, 0.15) 100%);
    color: white;
    font-size: 20px;
    font-weight: 900;
    cursor: pointer;
    transition: all 0.08s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    box-shadow: 
        inset 0 3px 15px rgba(255, 255, 255, 0.3),
        inset 0 -3px 15px rgba(0, 0, 0, 0.4),
        0 20px 50px rgba(147, 51, 234, 0.5),
        0 40px 80px rgba(147, 51, 234, 0.25),
        0 0 120px rgba(147, 51, 234, 0.15);
    text-shadow: 
        0 2px 4px rgba(0, 0, 0, 0.5),
        0 0 30px rgba(255, 255, 255, 0.4);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 10px;
    animation: float 3s ease-in-out infinite;
    transform: translateZ(0);
    will-change: transform, box-shadow;
    backface-visibility: hidden;
    -webkit-font-smoothing: antialiased;
}

.dopamine-button:hover {
    transform: scale(1.06) translateZ(0);
    box-shadow: 
        0 15px 50px rgba(147, 51, 234, 0.6),
        inset 0 -5px 15px rgba(0, 0, 0, 0.2);
}

.dopamine-button:active {
    transform: scale(0.94) translateZ(0);
    box-shadow: 
        inset 0 5px 20px rgba(0, 0, 0, 0.5),
        inset 0 -2px 10px rgba(255, 255, 255, 0.2),
        0 5px 20px rgba(147, 51, 234, 0.3);
    background: linear-gradient(145deg,
        rgba(0, 0, 0, 0.2) 0%,
        rgba(126, 34, 206, 1) 10%,
        rgba(107, 33, 168, 1) 50%,
        rgba(147, 51, 234, 1) 90%,
        rgba(255, 255, 255, 0.1) 100%);
}

/* Enhanced touch feedback for mobile devices */
@media (hover: none) and (pointer: coarse) {
    .dopamine-button:hover {
        transform: none;  /* Disable hover on touch devices */
    }
    
    .dopamine-button:active {
        transform: scale(0.92);
        transition: transform 0.08s;  /* Faster feedback */
    }
}

/* Mobile-specific optimizations */
body.mobile {
    overscroll-behavior: none;  /* Prevent pull-to-refresh */
    overflow: hidden;
    position: fixed;
    width: 100%;
    height: 100vh;
    background-color: var(--bg-dark); /* Force dark background */
    background: radial-gradient(ellipse at center, var(--bg-medium) 0%, var(--bg-dark) 100%);
}

body.mobile #app {
    height: 100vh;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

body.mobile .dopamine-button {
    /* Prevent text selection on long press */
    -webkit-user-select: none;
    -webkit-touch-callout: none;
    -webkit-tap-highlight-color: transparent;
}

body.mobile .floating-number {
    font-size: 24px;  /* Bigger feedback text on mobile */
}

/* Enable sound button for iOS */
.enable-sound-btn {
    position: fixed;
    top: 80px;
    left: 50%;
    transform: translateX(-50%);
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 25px;
    font-size: 16px;
    font-weight: bold;
    cursor: pointer;
    z-index: 10000;
    box-shadow: 0 5px 20px rgba(107, 70, 193, 0.5);
    transition: all 0.3s;
}

.enable-sound-btn:active {
    transform: translateX(-50%) scale(0.95);
}

.enable-sound-btn.hidden {
    display: none;
}

/* PWA Install Banner */
.install-banner {
    position: fixed;
    bottom: -100px;
    left: 0;
    right: 0;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    padding: 15px;
    box-shadow: 0 -5px 20px rgba(0, 0, 0, 0.3);
    transition: bottom 0.3s ease;
    z-index: 10000;
}

.install-banner.show {
    bottom: 0;
}

.install-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    color: white;
    font-weight: 600;
}

.install-buttons {
    display: flex;
    gap: 10px;
}

.install-btn, .dismiss-btn {
    padding: 8px 20px;
    border: none;
    border-radius: 20px;
    font-weight: bold;
    cursor: pointer;
    transition: transform 0.2s;
}

.install-btn {
    background: white;
    color: var(--primary);
}

.dismiss-btn {
    background: rgba(255, 255, 255, 0.2);
    color: white;
}

.install-btn:active, .dismiss-btn:active {
    transform: scale(0.95);
}

@media (min-width: 768px) {
    .install-content {
        flex-direction: row;
        justify-content: space-between;
        max-width: 600px;
        margin: 0 auto;
    }
}

.dopamine-button.charging {
    animation: charge 0.5s ease-in-out;
}

.button-emoji {
    font-size: 50px;
    animation: bounce 2s infinite;
}

.click-feedback {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    pointer-events: none;
}

/* Floating Numbers */
#floatingNumbers {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 100;
}

.floating-number {
    position: absolute;
    font-size: 24px;
    font-weight: bold;
    animation: floatUp 2s ease-out forwards;
    text-shadow: 0 0 10px currentColor;
}

.floating-number.rare {
    color: var(--rare);
    font-size: 32px;
}

.floating-number.epic {
    color: var(--epic);
    font-size: 36px;
}

.floating-number.legendary {
    color: var(--legendary);
    font-size: 42px;
    animation: floatUpLegendary 3s ease-out forwards;
}

/* Achievement Popup */
.achievement-popup {
    position: fixed;
    top: -100px;
    left: 50%;
    transform: translateX(-50%);
    background: linear-gradient(135deg, var(--success), var(--primary));
    padding: 15px 30px;
    border-radius: 50px;
    display: flex;
    align-items: center;
    gap: 15px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
    transition: top 0.5s ease-out;
    z-index: 1000;
    pointer-events: none;  /* Allow clicks to pass through */
}

.achievement-popup.show {
    top: 50px;
}

.achievement-icon {
    font-size: 30px;
}

.achievement-text {
    font-weight: bold;
    font-size: 14px;
}

/* Rare Drop Alert - Non-blocking */
.rare-drop {
    position: fixed;
    top: 25%;
    left: 50%;
    transform: translateX(-50%) scale(0);
    background: radial-gradient(ellipse, rgba(139, 92, 246, 0.95), rgba(59, 130, 246, 0.95));
    padding: 25px 40px;
    border-radius: 20px;
    text-align: center;
    box-shadow: 0 0 100px rgba(139, 92, 246, 0.8);
    transition: transform 0.5s ease-out;
    z-index: 999;
    pointer-events: none;  /* Allow clicks to pass through */
}

.rare-drop.show {
    transform: translateX(-50%) scale(1);
    animation: rareGlow 2s ease-in-out, floatUp 2s ease-out;
}

.rare-drop-icon {
    font-size: 60px;
    margin-bottom: 10px;
}

.rare-drop-text {
    font-size: 24px;
    font-weight: bold;
}

/* Stats Panel */
.stats-panel {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 20px;
    background: rgba(26, 24, 37, 0.9);
    padding: 15px 25px;
    border-radius: 50px;
    backdrop-filter: blur(10px);
}

.mini-stat {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.mini-stat.addiction-timer .mini-label {
    color: var(--accent);
    font-weight: bold;
}

.mini-stat.addiction-timer .mini-value {
    font-size: 16px;
    font-weight: bold;
    animation: timerPulse 2s infinite;
}

@keyframes timerPulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.7; }
}

.mini-label {
    font-size: 9px;
    color: var(--text-secondary);
    margin-bottom: 3px;
}

.mini-value {
    font-size: 14px;
    font-weight: bold;
    color: var(--primary-light);
}

/* Activity Feed */
.activity-feed {
    position: fixed;
    right: 20px;
    top: 20px;
    width: 250px;
    background: rgba(26, 24, 37, 0.9);
    border-radius: 15px;
    padding: 15px;
    backdrop-filter: blur(10px);
    max-height: 300px;
    overflow-y: auto;
}

.activity-title {
    font-size: 10px;
    letter-spacing: 2px;
    color: var(--text-secondary);
    margin-bottom: 10px;
}

.activity-item {
    font-size: 12px;
    margin-bottom: 8px;
    opacity: 0;
    animation: fadeIn 0.5s forwards;
}

/* Golden Hour */
.golden-hour {
    position: fixed;
    top: -60px;
    left: 0;
    right: 0;
    background: linear-gradient(90deg, var(--accent), var(--legendary));
    padding: 15px;
    text-align: center;
    font-weight: bold;
    transition: top 0.3s ease-out;
    z-index: 500;
}

.golden-hour.active {
    top: 0;
    animation: goldenPulse 1s infinite;
}

.golden-content {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 20px;
}

.golden-timer {
    background: rgba(0, 0, 0, 0.2);
    padding: 5px 10px;
    border-radius: 20px;
}

/* Level Up Modal */
.level-up-modal {
    position: fixed;
    top: 20%;
    left: 50%;
    transform: translateX(-50%);
    pointer-events: none;  /* Allow clicks to pass through */
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 2000;
}

.level-up-modal.show {
    display: flex;
    animation: fadeIn 0.5s;
}

.level-up-content {
    text-align: center;
    animation: scaleIn 0.5s ease-out;
    background: rgba(15, 14, 23, 0.95);
    backdrop-filter: blur(20px);
    border: 3px solid var(--primary-light);
    border-radius: 30px;
    padding: 40px 60px;
    box-shadow: 0 0 100px rgba(107, 70, 193, 0.8),
                0 0 200px rgba(107, 70, 193, 0.4);
}

.level-up-content h2 {
    font-size: 48px;
    background: linear-gradient(135deg, var(--primary-light), var(--accent));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 20px;
}

.level-up-number {
    font-size: 120px;
    font-weight: bold;
    animation: levelUpNumber 1s ease-out;
}

/* Animations */
@keyframes pulse {
    0%, 100% { opacity: 0.3; transform: scale(1); }
    50% { opacity: 0.6; transform: scale(1.1); }
}

@keyframes rotate {
    0% { transform: translate(-50%, -50%) rotate(0deg); }
    100% { transform: translate(-50%, -50%) rotate(360deg); }
}

@keyframes float {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-10px); }
}

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

/* Ghost Reward (Near Miss Display) */
.ghost-reward {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(0, 0, 0, 0.9);
    border: 2px solid var(--accent);
    border-radius: 20px;
    padding: 30px;
    text-align: center;
    opacity: 0;
    transition: opacity 0.5s;
    z-index: 3000;
    pointer-events: none;
}

.ghost-reward.show {
    opacity: 1;
    animation: ghostPulse 2s infinite;
}

.ghost-text {
    color: var(--text-secondary);
    font-size: 14px;
    margin-bottom: 10px;
}

.ghost-tier {
    font-size: 36px;
    font-weight: bold;
    margin: 10px 0;
    text-transform: uppercase;
}

.ghost-tier.epic {
    color: var(--epic);
    text-shadow: 0 0 20px var(--epic);
}

.ghost-tier.legendary {
    color: var(--legendary);
    text-shadow: 0 0 30px var(--legendary);
    animation: legendaryGlow 1s infinite;
}

.ghost-points {
    color: var(--accent);
    font-size: 24px;
    font-weight: bold;
}

@keyframes ghostPulse {
    0%, 100% { transform: translate(-50%, -50%) scale(1); }
    50% { transform: translate(-50%, -50%) scale(1.05); }
}

@keyframes legendaryGlow {
    0%, 100% { filter: brightness(1); }
    50% { filter: brightness(1.5); }
}

/* Mystery Box Modal */
.mystery-box-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.95);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 5000;
    opacity: 0;
    transition: opacity 0.3s;
}

.mystery-box-modal.show {
    opacity: 1;
}

.mystery-box-content {
    background: linear-gradient(135deg, #1A1825, #2D2B3D);
    border: 3px solid var(--primary-light);
    border-radius: 30px;
    padding: 40px;
    text-align: center;
    max-width: 600px;
}

.mystery-box-content h2 {
    color: var(--accent);
    margin-bottom: 20px;
    font-size: 32px;
}

.mystery-boxes {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
    margin: 30px 0;
}

.mystery-box-item {
    width: 100px;
    height: 100px;
    background: linear-gradient(135deg, var(--primary), var(--primary-light));
    border: 2px solid var(--accent);
    border-radius: 15px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 48px;
    cursor: pointer;
    transition: all 0.3s;
    position: relative;
}

.mystery-box-item:hover:not(.revealed) {
    transform: scale(1.1);
    box-shadow: 0 0 30px rgba(245, 158, 11, 0.5);
}

.mystery-box-item.revealed {
    cursor: default;
    animation: revealBox 0.5s;
}

.mystery-box-item.revealed.legendary {
    background: linear-gradient(135deg, #FFD700, #FFA500);
    border-color: #FFD700;
}

.mystery-box-item.revealed.epic {
    background: linear-gradient(135deg, #9333EA, #C084FC);
    border-color: #9333EA;
}

.mystery-box-item.revealed.rare {
    background: linear-gradient(135deg, #3B82F6, #60A5FA);
    border-color: #3B82F6;
}

.mystery-box-item.revealed.unselected {
    opacity: 0.3;
}

.prize-amount {
    font-size: 20px;
    font-weight: bold;
    color: white;
}

.prize-tier {
    font-size: 12px;
    text-transform: uppercase;
    margin-top: 5px;
}

.prize-amount.missed, .prize-tier.missed {
    color: #666;
}

.mystery-box-results h3 {
    color: var(--accent);
    font-size: 24px;
    margin: 20px 0;
}

.mystery-box-close {
    background: linear-gradient(135deg, var(--primary-light), var(--accent));
    color: white;
    border: none;
    padding: 15px 40px;
    border-radius: 50px;
    font-size: 18px;
    cursor: pointer;
    transition: all 0.3s;
}

.mystery-box-close:hover {
    transform: scale(1.1);
    box-shadow: 0 0 30px rgba(245, 158, 11, 0.5);
}

@keyframes revealBox {
    0% { transform: rotateY(0); }
    50% { transform: rotateY(180deg); }
    100% { transform: rotateY(360deg); }
}

/* Critical Hit Effects */
.critical-hit {
    position: fixed;
    font-size: 28px;
    font-weight: bold;
    color: #FFD700;
    text-shadow: 0 0 20px rgba(255, 215, 0, 0.8);
    pointer-events: none;
    z-index: 10000;
    animation: criticalPop 2s ease-out forwards;
}

@keyframes criticalPop {
    0% {
        transform: translate(-50%, -50%) scale(0) rotate(0deg);
        opacity: 1;
    }
    50% {
        transform: translate(-50%, -50%) scale(1.5) rotate(180deg);
    }
    100% {
        transform: translate(-50%, -150%) scale(1) rotate(360deg);
        opacity: 0;
    }
}

.critical-flash {
    animation: flashScreen 0.2s;
}

@keyframes flashScreen {
    0%, 100% { filter: brightness(1); }
    50% { filter: brightness(1.5) saturate(2); }
}

/* Streak Bonus Display */
.streak-bonus {
    position: fixed;
    left: 50%;
    top: 40%;
    transform: translateX(-50%) scale(0);
    background: linear-gradient(135deg, #FFD700, #FFA500);
    padding: 20px 40px;
    border-radius: 20px;
    text-align: center;
    color: #000;
    font-weight: bold;
    pointer-events: none;
    z-index: 5000;
    transition: transform 0.3s;
}

.streak-bonus.show {
    transform: translateX(-50%) scale(1);
    animation: streakPulse 2s;
}

.streak-number {
    font-size: 32px;
    text-transform: uppercase;
}

.streak-points {
    font-size: 18px;
    margin-top: 5px;
}

@keyframes streakPulse {
    0%, 100% { transform: translateX(-50%) scale(1); }
    25% { transform: translateX(-50%) scale(1.1); }
    50% { transform: translateX(-50%) scale(1.05); }
    75% { transform: translateX(-50%) scale(1.1); }
}

/* Beast Mode Effects */
.beast-mode {
    animation: beastModePulse 0.5s infinite;
}

.beast-mode #theButton {
    box-shadow: 0 0 100px rgba(255, 215, 0, 0.8),
                0 0 200px rgba(255, 215, 0, 0.4),
                0 0 300px rgba(255, 215, 0, 0.2);
    animation: beastModeButton 0.3s infinite;
}

@keyframes beastModePulse {
    0%, 100% { 
        background: radial-gradient(circle at center, rgba(255, 215, 0, 0.1), transparent);
    }
    50% { 
        background: radial-gradient(circle at center, rgba(255, 215, 0, 0.2), transparent);
    }
}

@keyframes beastModeButton {
    0%, 100% { transform: scale(1) rotate(0deg); }
    25% { transform: scale(1.05) rotate(1deg); }
    50% { transform: scale(1.1) rotate(-1deg); }
    75% { transform: scale(1.05) rotate(1deg); }
}

@keyframes bounce {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.1); }
}

@keyframes floatUp {
    0% { 
        opacity: 1; 
        transform: translateY(0) scale(1);
    }
    100% { 
        opacity: 0; 
        transform: translateY(-100px) scale(1.5);
    }
}

@keyframes floatUpLegendary {
    0% { 
        opacity: 1; 
        transform: translateY(0) scale(1) rotate(0deg);
    }
    100% { 
        opacity: 0; 
        transform: translateY(-150px) scale(2) rotate(360deg);
    }
}

@keyframes charge {
    0% { transform: scale(1) rotate(0deg); }
    50% { transform: scale(1.2) rotate(5deg); }
    100% { transform: scale(1) rotate(0deg); }
}

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

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

@keyframes scaleIn {
    from { transform: scale(0); }
    to { transform: scale(1); }
}

@keyframes rareGlow {
    0%, 100% { box-shadow: 0 0 100px rgba(139, 92, 246, 0.8); }
    50% { box-shadow: 0 0 200px rgba(139, 92, 246, 1); }
}

@keyframes goldenPulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.8; }
}

@keyframes levelUpNumber {
    0% { transform: scale(0) rotate(0deg); }
    50% { transform: scale(1.2) rotate(180deg); }
    100% { transform: scale(1) rotate(360deg); }
}

/* Warning Modal */
.warning-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.95);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 3000;
    backdrop-filter: blur(10px);
}

.warning-modal.show {
    display: flex;
    animation: fadeIn 0.5s;
}

.warning-content {
    background: linear-gradient(135deg, #1A1825, #2D2B3D);
    border: 2px solid var(--accent);
    border-radius: 20px;
    padding: 40px;
    max-width: 600px;
    text-align: center;
    box-shadow: 0 0 100px rgba(245, 158, 11, 0.5);
    animation: warningPulse 2s infinite;
}

.warning-icon {
    font-size: 72px;
    margin-bottom: 20px;
    animation: warningBounce 1s infinite;
}

.warning-content h2 {
    color: var(--accent);
    margin-bottom: 20px;
    font-size: 24px;
    letter-spacing: 1px;
}

.warning-text {
    margin-bottom: 30px;
    line-height: 1.6;
}

.warning-text p {
    margin-bottom: 15px;
    color: var(--text-primary);
}

.warning-text strong {
    color: var(--accent);
    text-transform: uppercase;
}

.click-count-warning, .time-spent {
    color: var(--legendary);
    font-weight: bold;
    font-size: 1.2em;
}

.warning-stats-preview {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-bottom: 30px;
    padding: 20px;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 10px;
}

.stat-preview {
    display: flex;
    flex-direction: column;
}

.preview-label {
    font-size: 12px;
    color: var(--text-secondary);
    margin-bottom: 5px;
}

.preview-value {
    font-size: 20px;
    font-weight: bold;
    color: var(--primary-light);
}

.warning-buttons {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.warning-btn {
    padding: 15px 30px;
    border: none;
    border-radius: 50px;
    font-size: 16px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
}

.stats-btn {
    background: linear-gradient(135deg, var(--rare), var(--epic));
    color: white;
}

.continue-btn {
    background: linear-gradient(135deg, var(--legendary), var(--accent));
    color: white;
    animation: continuePulse 2s infinite;
}

.quit-btn {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-secondary);
    border: 1px solid var(--text-secondary);
}

.warning-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
}

.warning-footer {
    margin-top: 20px;
    font-size: 12px;
    color: var(--text-secondary);
    font-style: italic;
}

/* Analytics Dashboard Modal (App Metrics Theme) */
.stats-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.9);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 3001;
    overflow-y: auto;
}

.stats-modal.show {
    display: flex;
    animation: fadeIn 0.5s;
}

.stats-modal-content {
    background: linear-gradient(135deg, #1A1825, #2D2B3D);
    border-radius: 20px;
    padding: 40px;
    max-width: 800px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    position: relative;
    box-shadow: 0 0 50px rgba(147, 51, 234, 0.5);
}

.close-stats {
    position: absolute;
    top: 20px;
    right: 20px;
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 32px;
    cursor: pointer;
    transition: color 0.3s;
}

.close-stats:hover {
    color: var(--text-primary);
}

.stats-modal-content h2 {
    text-align: center;
    margin-bottom: 30px;
    color: var(--primary-light);
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.stat-card {
    background: rgba(0, 0, 0, 0.3);
    padding: 20px;
    border-radius: 15px;
    text-align: center;
    border: 1px solid rgba(147, 51, 234, 0.3);
}

.stat-card-label {
    font-size: 12px;
    color: var(--text-secondary);
    margin-bottom: 10px;
}

.stat-card-value {
    font-size: 28px;
    font-weight: bold;
    color: var(--primary-light);
    margin-bottom: 5px;
}

.stat-card-desc {
    font-size: 10px;
    color: var(--text-secondary);
}

.behavior-analysis {
    background: rgba(0, 0, 0, 0.2);
    padding: 20px;
    border-radius: 15px;
    margin-bottom: 20px;
}

.behavior-analysis h3 {
    color: var(--accent);
    margin-bottom: 15px;
}

.analysis-item {
    display: flex;
    justify-content: space-between;
    padding: 10px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.analysis-label {
    color: var(--text-secondary);
}

.analysis-value {
    color: var(--primary-light);
    font-weight: bold;
}

.recommendations {
    background: rgba(0, 0, 0, 0.2);
    padding: 20px;
    border-radius: 15px;
    margin-bottom: 20px;
}

.recommendations h3 {
    color: var(--success);
    margin-bottom: 15px;
}

.recommendations ul {
    list-style: none;
    padding: 0;
}

.recommendations li {
    padding: 8px 0;
    color: var(--text-primary);
    position: relative;
    padding-left: 20px;
}

.recommendations li:before {
    content: '→';
    position: absolute;
    left: 0;
    color: var(--success);
}

.return-to-addiction {
    width: 100%;
    padding: 20px;
    background: linear-gradient(135deg, var(--primary), var(--primary-light));
    color: white;
    border: none;
    border-radius: 50px;
    font-size: 18px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
    animation: returnPulse 2s infinite;
}

.return-to-addiction:hover {
    transform: scale(1.05);
    box-shadow: 0 15px 40px rgba(147, 51, 234, 0.6);
}

/* Post-Warning Indicator */
.post-warning-indicator {
    position: fixed;
    top: 60px;  /* Moved down to avoid overlap with other UI elements */
    left: 50%;
    transform: translateX(-50%);
    background: rgba(245, 158, 11, 0.95);  /* More opaque for better visibility */
    backdrop-filter: blur(10px);
    padding: 8px 20px;
    border-radius: 20px;
    border: 1px solid var(--accent);
    z-index: 1000;  /* Higher z-index to ensure it's above other elements */
    box-shadow: 0 4px 20px rgba(245, 158, 11, 0.3);
}

.warning-acknowledged {
    color: var(--accent);
    font-size: 12px;
    font-weight: bold;
    letter-spacing: 1px;
}

#clicksSinceWarning {
    color: var(--legendary);
}

/* Warning Animations */
@keyframes warningPulse {
    0%, 100% { 
        box-shadow: 0 0 100px rgba(245, 158, 11, 0.5);
    }
    50% { 
        box-shadow: 0 0 150px rgba(245, 158, 11, 0.8);
    }
}

@keyframes warningBounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-10px); }
}

@keyframes continuePulse {
    0%, 100% { 
        box-shadow: 0 0 20px rgba(245, 158, 11, 0.5);
    }
    50% { 
        box-shadow: 0 0 40px rgba(245, 158, 11, 0.8);
    }
}

@keyframes returnPulse {
    0%, 100% { 
        box-shadow: 0 5px 20px rgba(147, 51, 234, 0.4);
    }
    50% { 
        box-shadow: 0 10px 40px rgba(147, 51, 234, 0.8);
    }
}

/* Near-Miss System - Psychological Manipulation */
.near-miss-bar {
    position: fixed;
    top: 100px;
    left: 50%;
    transform: translateX(-50%);
    background: linear-gradient(135deg, #2C3E50, #34495E);
    border-radius: 15px;
    padding: 20px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
    z-index: 9999;
    min-width: 350px;
    opacity: 0;
    transition: opacity 0.3s, transform 0.3s;
    border: 2px solid rgba(255, 255, 255, 0.1);
}

.near-miss-bar.hidden {
    display: none;
}

.near-miss-bar.show {
    opacity: 1;
    transform: translateX(-50%) scale(1.05);
}

.near-miss-content {
    text-align: center;
    color: white;
}

.near-miss-text {
    font-size: 28px;
    font-weight: bold;
    margin-bottom: 10px;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);
    animation: pulsate 1s infinite;
}

.near-miss-detail {
    font-size: 18px;
    color: #E74C3C;
    margin-bottom: 15px;
    font-weight: 600;
}

.near-miss-progress {
    width: 100%;
    height: 30px;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 15px;
    overflow: hidden;
    position: relative;
    margin-bottom: 15px;
}

.near-miss-fill {
    height: 100%;
    border-radius: 15px;
    transition: width 0.5s ease;
    box-shadow: 0 0 20px rgba(255, 255, 255, 0.5);
}

.near-miss-marker {
    position: absolute;
    top: -5px;
    width: 2px;
    height: 40px;
    background: white;
    box-shadow: 0 0 10px white;
    animation: blink 0.5s infinite;
}

.near-miss-message {
    font-size: 14px;
    color: #FFD700;
    font-style: italic;
    animation: fadeInOut 2s infinite;
}

/* Near-miss tier-specific styles */
.near-miss-legendary .near-miss-text {
    background: linear-gradient(45deg, #FFD700, #FFA500);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.near-miss-epic .near-miss-text {
    background: linear-gradient(45deg, #9B59B6, #8E44AD);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.near-miss-rare .near-miss-text {
    background: linear-gradient(45deg, #3498DB, #2980B9);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* Floating near-miss notifications */
.near-miss-float {
    position: fixed;
    right: 20px;
    top: 150px;
    pointer-events: none;
    z-index: 10000;
}

.near-miss-notification {
    background: rgba(0, 0, 0, 0.9);
    border-radius: 10px;
    padding: 15px;
    margin-bottom: 10px;
    min-width: 200px;
    transform: translateX(300px);
    transition: transform 0.3s, opacity 0.3s;
    opacity: 0;
    border-left: 4px solid #E74C3C;
}

.near-miss-notification.show {
    transform: translateX(0);
    opacity: 1;
}

.near-miss-notification.fade {
    opacity: 0;
    transform: translateX(300px);
}

.near-miss-icon {
    font-size: 30px;
    text-align: center;
    margin-bottom: 5px;
}

.near-miss-percent {
    font-size: 24px;
    font-weight: bold;
    color: #E74C3C;
    text-align: center;
}

.near-miss-label {
    font-size: 12px;
    color: #95A5A6;
    text-align: center;
    margin-top: 5px;
}

/* Breaking point modal */
.near-miss-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.95);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 20000;
    opacity: 0;
    transition: opacity 0.3s;
}

.near-miss-modal.show {
    opacity: 1;
}

.near-miss-modal-content {
    background: linear-gradient(135deg, #2C3E50, #34495E);
    border-radius: 20px;
    padding: 40px;
    max-width: 500px;
    text-align: center;
    color: white;
    animation: modalShake 0.5s;
}

.near-miss-modal-content h2 {
    color: #E74C3C;
    margin-bottom: 20px;
    font-size: 24px;
}

.near-miss-stats {
    display: flex;
    justify-content: space-around;
    margin: 30px 0;
}

.near-miss-stats .stat-item {
    text-align: center;
}

.near-miss-stats .stat-number {
    display: block;
    font-size: 36px;
    font-weight: bold;
    color: #FFD700;
}

.near-miss-stats .stat-label {
    display: block;
    font-size: 12px;
    color: #95A5A6;
    margin-top: 5px;
}

.near-miss-motivation {
    font-size: 18px;
    margin: 20px 0;
}

.near-miss-motivation .highlight {
    color: #2ECC71;
    font-weight: bold;
    animation: pulsate 1s infinite;
}

.near-miss-disclaimer {
    font-size: 10px;
    color: #7F8C8D;
    font-style: italic;
    margin-top: 10px;
}

.continue-btn {
    background: linear-gradient(45deg, #E74C3C, #C0392B);
    color: white;
    border: none;
    padding: 15px 40px;
    border-radius: 30px;
    font-size: 18px;
    font-weight: bold;
    cursor: pointer;
    margin-top: 20px;
    animation: urgentPulse 1s infinite;
    transition: transform 0.2s;
}

.continue-btn:hover {
    transform: scale(1.05);
}

.continue-btn:active {
    transform: scale(0.95);
}

/* Animations for near-miss */
@keyframes nearMissShake {
    0%, 100% { transform: translateX(-50%) rotate(0deg); }
    25% { transform: translateX(-52%) rotate(-1deg); }
    75% { transform: translateX(-48%) rotate(1deg); }
}

@keyframes urgentPulse {
    0%, 100% { box-shadow: 0 0 20px rgba(231, 76, 60, 0.5); }
    50% { box-shadow: 0 0 40px rgba(231, 76, 60, 0.8); }
}

@keyframes modalShake {
    0%, 100% { transform: scale(1); }
    25% { transform: scale(1.02) rotate(-1deg); }
    75% { transform: scale(1.02) rotate(1deg); }
}

@keyframes fadeInOut {
    0%, 100% { opacity: 0.5; }
    50% { opacity: 1; }
}

/* Decay System - Loss Aversion Mechanics */
.decay-warning {
    position: fixed;
    bottom: 100px;  /* Move to bottom so it doesn't cover points */
    left: 50%;
    transform: translateX(-50%);
    background: linear-gradient(135deg, #e74c3c, #c0392b);
    border-radius: 10px;
    padding: 15px 25px;
    box-shadow: 0 5px 30px rgba(231, 76, 60, 0.5);
    z-index: 9998;
    opacity: 0;
    transition: opacity 0.3s, transform 0.3s;
    animation: decayWarningPulse 1s infinite;
}

.decay-warning.hidden {
    display: none;
}

.decay-warning.show {
    opacity: 1;
    transform: translateX(-50%) scale(1.05);
}

.decay-content {
    display: flex;
    align-items: center;
    gap: 15px;
    color: white;
}

.decay-icon {
    font-size: 30px;
    animation: shake 0.5s infinite;
}

.decay-message {
    font-weight: bold;
    font-size: 16px;
}

.decay-live-loss {
    font-size: 20px;
    color: #ffeb3b;
    margin-top: 5px;
    font-weight: bold;
    text-shadow: 0 0 10px rgba(255, 235, 59, 0.5);
}

.decay-rate {
    display: block;
    font-size: 12px;
    color: #ffcccb;
    margin-top: 5px;
}

.decay-timer {
    width: 150px;
    height: 8px;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 4px;
    overflow: hidden;
}

.decay-progress {
    height: 100%;
    width: 0;
    background: linear-gradient(90deg, #3498db, #2980b9);
    transition: width 0.2s, background 0.3s;
}

/* Decay particles */
.decay-particles {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1000;
}

.decay-particle {
    position: absolute;
    color: #e74c3c;
    font-weight: bold;
    font-size: 20px;
    animation: fall linear;
    opacity: 0.8;
}

@keyframes fall {
    from {
        transform: translateY(0) rotate(0deg);
        opacity: 0.8;
    }
    to {
        transform: translateY(100vh) rotate(360deg);
        opacity: 0;
    }
}

/* Decay visual effects */
body.decaying {
    animation: darken 2s forwards;
}

@keyframes darken {
    from {
        filter: brightness(1);
    }
    to {
        filter: brightness(0.7) saturate(0.8);
    }
}

.decay-pulse {
    animation: decayButtonPulse 0.5s infinite !important;
}

@keyframes decayButtonPulse {
    0%, 100% {
        transform: scale(1);
        box-shadow: 0 10px 40px rgba(231, 76, 60, 0.5);
    }
    50% {
        transform: scale(0.98);
        box-shadow: 0 5px 20px rgba(231, 76, 60, 0.8);
    }
}

.decay-shake {
    animation: decayShake 0.2s infinite;
}

@keyframes decayShake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-2px); }
    75% { transform: translateX(2px); }
}

/* Floating decay numbers */
.decay-number {
    position: fixed;
    color: #e74c3c;
    font-size: 30px;
    font-weight: bold;
    pointer-events: none;
    z-index: 10001;
    transform: translate(-50%, -50%);
    transition: all 1s ease-out;
}

/* Panic mode */
.panic-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: radial-gradient(circle, transparent, rgba(231, 76, 60, 0.3));
    pointer-events: none;
    z-index: 9997;
    opacity: 0;
    transition: opacity 0.3s;
}

.panic-overlay.show {
    opacity: 1;
    animation: panicFlash 0.5s infinite;
}

.panic-text {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 40px;
    font-weight: bold;
    color: #e74c3c;
    text-shadow: 0 0 20px rgba(231, 76, 60, 0.8);
    animation: panicTextPulse 0.3s infinite;
}

body.panic-mode {
    animation: panicShake 0.1s infinite;
}

@keyframes panicShake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-5px); }
    75% { transform: translateX(5px); }
}

@keyframes panicFlash {
    0%, 100% { background: radial-gradient(circle, transparent, rgba(231, 76, 60, 0.3)); }
    50% { background: radial-gradient(circle, transparent, rgba(231, 76, 60, 0.5)); }
}

@keyframes panicTextPulse {
    0%, 100% { transform: translate(-50%, -50%) scale(1); }
    50% { transform: translate(-50%, -50%) scale(1.1); }
}

/* Recovery message */
.recovery-message {
    position: fixed;
    bottom: -200px;
    left: 50%;
    transform: translateX(-50%);
    background: linear-gradient(135deg, #2ecc71, #27ae60);
    border-radius: 15px;
    padding: 20px 30px;
    box-shadow: 0 10px 40px rgba(46, 204, 113, 0.5);
    transition: bottom 0.3s ease;
    z-index: 10000;
}

.recovery-message.show {
    bottom: 30px;
}

.recovery-content {
    text-align: center;
    color: white;
}

.recovery-title {
    font-size: 24px;
    font-weight: bold;
    margin-bottom: 10px;
}

.recovery-stats {
    font-size: 16px;
    margin-bottom: 10px;
}

.lost-amount {
    color: #ffeb3b;
    font-weight: bold;
    font-size: 20px;
}

.recovery-tip {
    font-size: 14px;
    font-style: italic;
    opacity: 0.9;
}

@keyframes decayWarningPulse {
    0%, 100% {
        box-shadow: 0 5px 30px rgba(231, 76, 60, 0.5);
    }
    50% {
        box-shadow: 0 5px 50px rgba(231, 76, 60, 0.8);
    }
}

/* Milestone Madness - Extravagant Celebration Effects */
.milestone-celebration {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 100000;
    pointer-events: none;
}

.milestone-celebration.hidden {
    display: none;
}

.milestone-celebration.show {
    animation: milestoneReveal 0.5s;
}

.milestone-announcement {
    text-align: center;
    color: white;
    animation: milestoneFloat 5s ease-in-out;
}

.milestone-prefix {
    font-size: 30px;
    font-weight: bold;
    margin-bottom: 10px;
    text-shadow: 0 0 20px rgba(255, 255, 255, 0.5);
}

.milestone-number {
    font-size: 80px;
    font-weight: bold;
    background: linear-gradient(45deg, #FFD700, #FFA500);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    animation: numberPulse 1s infinite;
}

.milestone-name {
    font-size: 40px;
    font-weight: bold;
    margin-top: 10px;
    text-transform: uppercase;
    letter-spacing: 5px;
}

.milestone-reward {
    font-size: 24px;
    color: #2ecc71;
    margin-top: 20px;
    animation: rewardBounce 0.5s;
}

/* Progress bar */
.milestone-progress {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 8px;
    background: rgba(0, 0, 0, 0.3);
    z-index: 9990;
}

.milestone-track {
    height: 100%;
    position: relative;
}

.milestone-fill {
    height: 100%;
    width: 0;
    background: linear-gradient(90deg, #95a5a6, #7f8c8d);
    transition: width 0.3s, background 0.3s;
    box-shadow: 0 0 10px rgba(255, 255, 255, 0.3);
}

.milestone-next {
    position: absolute;
    right: 10px;
    top: 10px;
    background: rgba(0, 0, 0, 0.8);
    padding: 5px 10px;
    border-radius: 5px;
    color: white;
    font-size: 12px;
}

/* Flash effect */
.milestone-flash {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    pointer-events: none;
    z-index: 99999;
    opacity: 0;
    transition: opacity 0.1s;
}

/* Shake effect */
.milestone-shake {
    animation: milestoneShake 0.1s infinite;
}

@keyframes milestoneShake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-10px) rotate(-1deg); }
    75% { transform: translateX(10px) rotate(1deg); }
}

/* Confetti */
.confetti-container {
    position: fixed;
    top: -50px;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 99998;
}

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

@keyframes confettiFall {
    from {
        transform: translateY(0) rotate(0deg);
        opacity: 1;
    }
    to {
        transform: translateY(100vh) rotate(720deg);
        opacity: 0;
    }
}

/* Fireworks */
.firework {
    position: fixed;
    width: 4px;
    height: 4px;
    background: #FFD700;
    border-radius: 50%;
    z-index: 99997;
    animation: fireworkLaunch 0.5s ease-out;
}

.firework.explode {
    animation: fireworkExplode 1s;
}

@keyframes fireworkLaunch {
    from { transform: translateY(100vh); }
    to { transform: translateY(0); }
}

@keyframes fireworkExplode {
    0% {
        width: 4px;
        height: 4px;
        opacity: 1;
    }
    100% {
        width: 300px;
        height: 300px;
        opacity: 0;
        background: radial-gradient(circle, transparent, #FFD700, transparent);
    }
}

/* Matrix rain */
.matrix-rain {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 99996;
    overflow: hidden;
}

.matrix-column {
    position: absolute;
    color: #00ff00;
    font-family: monospace;
    font-size: 20px;
    animation: matrixFall 3s linear infinite;
}

@keyframes matrixFall {
    from { transform: translateY(-100%); }
    to { transform: translateY(100vh); }
}

/* Golden explosion */
.golden-explosion {
    position: fixed;
    top: 50%;
    left: 50%;
    width: 10px;
    height: 10px;
    background: #FFD700;
    border-radius: 50%;
    z-index: 99995;
    animation: goldenExplode 3s ease-out;
}

@keyframes goldenExplode {
    0% {
        width: 10px;
        height: 10px;
        transform: translate(-50%, -50%) scale(1);
        opacity: 1;
    }
    100% {
        width: 2000px;
        height: 2000px;
        transform: translate(-50%, -50%) scale(100);
        opacity: 0;
    }
}

/* Spotlight */
.milestone-spotlight {
    position: fixed;
    top: 50%;
    left: 50%;
    width: 200px;
    height: 100vh;
    background: linear-gradient(to bottom, transparent, rgba(255, 255, 255, 0.3), transparent);
    transform: translate(-50%, -50%) rotate(0deg);
    transform-origin: center;
    z-index: 99994;
    animation: spotlightSweep 3s;
}

@keyframes spotlightSweep {
    from { transform: translate(-50%, -50%) rotate(-180deg); }
    to { transform: translate(-50%, -50%) rotate(180deg); }
}

/* Rainbow */
.milestone-rainbow {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 100vh;
    background: linear-gradient(to bottom, 
        rgba(255, 0, 0, 0.3),
        rgba(255, 127, 0, 0.3),
        rgba(255, 255, 0, 0.3),
        rgba(0, 255, 0, 0.3),
        rgba(0, 0, 255, 0.3),
        rgba(75, 0, 130, 0.3),
        rgba(148, 0, 211, 0.3));
    pointer-events: none;
    z-index: 99993;
    animation: rainbowPulse 5s;
}

@keyframes rainbowPulse {
    0%, 100% { opacity: 0; }
    50% { opacity: 1; }
}

/* Reality distortion */
@keyframes realityDistort {
    0%, 100% { 
        filter: none;
        transform: scale(1) rotate(0deg);
    }
    25% { 
        filter: hue-rotate(90deg) saturate(2);
        transform: scale(1.1) rotate(5deg);
    }
    50% { 
        filter: hue-rotate(180deg) contrast(2);
        transform: scale(0.9) rotate(-5deg);
    }
    75% { 
        filter: hue-rotate(270deg) brightness(1.5);
        transform: scale(1.05) rotate(3deg);
    }
}

/* Ascension effect */
.ascension-effect {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 99992;
}

.ascension-beam {
    position: absolute;
    bottom: 0;
    left: 50%;
    width: 100px;
    height: 100vh;
    background: linear-gradient(to top, #FFD700, transparent);
    transform: translateX(-50%);
    animation: ascensionBeam 5s;
}

@keyframes ascensionBeam {
    from { 
        height: 0;
        opacity: 0;
    }
    to { 
        height: 100vh;
        opacity: 1;
    }
}

/* Big Bang */
.big-bang {
    position: fixed;
    top: 50%;
    left: 50%;
    width: 1px;
    height: 1px;
    background: white;
    border-radius: 50%;
    z-index: 99991;
    animation: bigBangExpand 5s;
}

@keyframes bigBangExpand {
    0% {
        width: 1px;
        height: 1px;
        transform: translate(-50%, -50%);
        box-shadow: 0 0 0 0 white;
    }
    100% {
        width: 3000px;
        height: 3000px;
        transform: translate(-50%, -50%);
        box-shadow: 0 0 500px 200px rgba(255, 255, 255, 0);
        opacity: 0;
    }
}

/* Beast mode */
body.beast-mode {
    animation: beastModeGlow 0.5s infinite;
}

body.beast-mode * {
    animation: beastModeElement 0.5s infinite;
}

@keyframes beastModeGlow {
    0%, 100% { 
        filter: brightness(1) contrast(1) saturate(1);
        box-shadow: 0 0 50px rgba(255, 0, 0, 0.5);
    }
    50% { 
        filter: brightness(1.5) contrast(1.5) saturate(2);
        box-shadow: 0 0 100px rgba(255, 0, 0, 1);
    }
}

@keyframes beastModeElement {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.02); }
}

.beast-mode-text {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 80px;
    font-weight: bold;
    color: #ff0000;
    text-shadow: 0 0 50px rgba(255, 0, 0, 1);
    z-index: 100003;
    animation: beastTextPulse 1s infinite;
    text-align: center;
    line-height: 1.2;
}

@keyframes beastTextPulse {
    0%, 100% { 
        transform: translate(-50%, -50%) scale(1);
        opacity: 0.8;
    }
    50% { 
        transform: translate(-50%, -50%) scale(1.1);
        opacity: 1;
    }
}

/* Matrix break */
body.matrix-break {
    animation: matrixGlitch 0.1s infinite;
}

@keyframes matrixGlitch {
    0% { transform: translateX(0); filter: none; }
    20% { transform: translateX(-2px); filter: hue-rotate(90deg); }
    40% { transform: translateX(2px); filter: invert(1); }
    60% { transform: translateX(-1px); filter: saturate(3); }
    80% { transform: translateX(1px); filter: contrast(2); }
    100% { transform: translateX(0); filter: none; }
}

.matrix-break-text {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 40px;
    font-weight: bold;
    color: #ff0000;
    font-family: monospace;
    z-index: 100001;
    animation: glitchText 0.1s infinite;
}

/* Milestone banner */
.milestone-banner {
    position: fixed;
    top: -200px;
    left: 50%;
    transform: translateX(-50%);
    background: linear-gradient(135deg, #FFD700, #FFA500);
    border-radius: 20px;
    padding: 30px 50px;
    box-shadow: 0 20px 60px rgba(255, 215, 0, 0.5);
    z-index: 100002;
    transition: top 0.5s ease;
}

.milestone-banner.show {
    top: 50px;
}

.banner-content {
    display: flex;
    align-items: center;
    gap: 30px;
    color: white;
}

.banner-icon {
    font-size: 60px;
    animation: trophySpin 2s infinite;
}

@keyframes trophySpin {
    0%, 100% { transform: rotate(-10deg); }
    50% { transform: rotate(10deg); }
}

.banner-title {
    font-size: 24px;
    font-weight: bold;
}

.banner-milestone {
    font-size: 36px;
    font-weight: bold;
    margin: 10px 0;
}

.banner-name {
    font-size: 20px;
    opacity: 0.9;
}

/* Animations */
@keyframes milestoneReveal {
    from {
        transform: translate(-50%, -50%) scale(0);
        opacity: 0;
    }
    to {
        transform: translate(-50%, -50%) scale(1);
        opacity: 1;
    }
}

@keyframes milestoneFloat {
    0% {
        transform: translateY(0) scale(1);
        opacity: 0;
    }
    20% {
        transform: translateY(-20px) scale(1.2);
        opacity: 1;
    }
    80% {
        transform: translateY(-40px) scale(1.1);
        opacity: 1;
    }
    100% {
        transform: translateY(-60px) scale(0.9);
        opacity: 0;
    }
}

@keyframes numberPulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.1); }
}

@keyframes rewardBounce {
    0% { transform: translateY(20px); opacity: 0; }
    50% { transform: translateY(-10px); }
    100% { transform: translateY(0); opacity: 1; }
}

/* Responsive */
@media (max-width: 768px) {
    /* Decay warning mobile fixes */
    .decay-warning {
        bottom: 60px;  /* Lower on mobile */
        width: 90%;  /* Full width on mobile */
        left: 5%;
        transform: none;
        padding: 10px 15px;
    }
    
    .decay-message {
        font-size: 14px;
    }
    
    .decay-live-loss {
        font-size: 18px;
    }
    
    .stats-bar {
        gap: 15px;
        margin-bottom: 25px;
        flex-wrap: wrap;
        justify-content: center;
    }
    
    .stat-value {
        font-size: 22px;  /* Better readability on mobile */
    }
    
    .progress-container {
        max-width: 90%;  /* Use more screen width on mobile */
        margin: 20px auto 30px;
    }
    
    .progress-bar, .combo-bar {
        height: 25px;  /* Slightly smaller bars on mobile */
        margin-bottom: 12px;
    }
    
    .activity-feed {
        display: none;  /* Hide on mobile to reduce clutter */
    }
    
    .stats-panel {
        flex-wrap: wrap;
        bottom: 10px;
        padding: 10px 15px;
        left: 50%;
        transform: translateX(-50%);
        right: auto;
        justify-content: center;
    }
    
    .dopamine-button, #theButton {
        width: min(60vw, 220px);  /* Responsive sizing */
        height: min(60vw, 220px);
        font-size: 24px;
        /* Enhanced touch interaction */
        touch-action: manipulation;  /* Prevent zoom on double tap */
        -webkit-touch-callout: none;  /* Disable callout on long press */
        -webkit-user-select: none;
        user-select: none;
    }
    
    .button-glow {
        width: calc(min(60vw, 220px) + 40px);
        height: calc(min(60vw, 220px) + 40px);
    }
    
    .button-ring {
        width: calc(min(60vw, 220px) + 20px);
        height: calc(min(60vw, 220px) + 20px);
    }
    
    .warning-content {
        padding: 20px;
        margin: 20px;
    }
    
    .stats-modal-content {
        padding: 20px;
        margin: 20px;
    }
    
    .mystery-boxes {
        grid-template-columns: repeat(3, 80px);  /* Smaller boxes on mobile */
        gap: 10px;
    }
    
    .mystery-box-item {
        width: 80px;
        height: 80px;
        font-size: 36px;
    }
}

@media (max-width: 480px) {
    /* Extra small screens */
    body {
        padding: 10px 5px;  /* Less padding on small screens */
    }
    
    #app {
        padding-top: 10px;
    }
    
    .stats-bar {
        gap: 10px;
        margin-bottom: 15px;
    }
    
    /* Bigger button for small screens */
    .dopamine-button, #theButton {
        width: min(70vw, 250px);
        height: min(70vw, 250px);
        font-size: 28px;
    }
    
    .stat-label {
        font-size: 9px;
    }
    
    .stat-value {
        font-size: 18px;
    }
    
    .activity-feed {
        display: none;  /* Hide on very small screens */
    }
    
    .progress-container {
        max-width: 95%;
    }
}

/* Ghost Cursor System */
.ghost-cursor-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 999;
}

.ghost-cursor {
    position: absolute;
    transition: all 0.8s cubic-bezier(0.4, 0, 0.2, 1);
    opacity: 0.6;
    pointer-events: none;
}

.ghost-pointer {
    font-size: 24px;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.3));
    animation: ghostFloat 2s infinite ease-in-out;
    transition: transform 0.1s;
}

.ghost-label {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 10px;
    margin-top: 4px;
    font-weight: 600;
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.4);
}

@keyframes ghostFloat {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-5px); }
}

/* Anticipation Effects */
.dopamine-button.anticipating {
    animation: anticipationPulse 3s infinite;  /* Slower animation */
}

@keyframes anticipationPulse {
    0%, 100% {
        box-shadow: 0 10px 40px rgba(107, 70, 193, 0.3);
    }
    50% {
        box-shadow: 0 10px 50px rgba(107, 70, 193, 0.4);  /* Reduced intensity */
    }
}

.anticipation-hint {
    position: fixed;
    background: linear-gradient(135deg, #ffd700 0%, #ffed4e 100%);
    color: #333;
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 14px;
    font-weight: 600;
    animation: hintFloat 2s ease-out forwards;
    pointer-events: none;
    z-index: 1001;
    box-shadow: 0 4px 12px rgba(255, 215, 0, 0.4);
}

@keyframes hintFloat {
    0% {
        opacity: 0;
        transform: translateY(20px) scale(0.8);
    }
    20% {
        opacity: 1;
        transform: translateY(-10px) scale(1.05);
    }
    100% {
        opacity: 0;
        transform: translateY(-50px) scale(0.9);
    }
}

/* Near Miss Alert */
.near-miss-alert {
    position: fixed;
    top: 30%;
    left: 50%;
    transform: translateX(-50%);
    background: linear-gradient(135deg, #ff6b6b 0%, #ff8787 100%);
    color: white;
    padding: 20px 30px;
    border-radius: 20px;
    animation: nearMissShake 0.5s ease-out;
    z-index: 1002;
    pointer-events: none;
    box-shadow: 0 10px 30px rgba(255, 107, 107, 0.4);
}

.near-miss-content {
    text-align: center;
}

.near-miss-icon {
    display: block;
    font-size: 48px;
    margin-bottom: 10px;
    animation: iconSpin 0.5s ease-out;
}

.near-miss-text {
    display: block;
    font-size: 20px;
    font-weight: 700;
    margin-bottom: 5px;
}

.near-miss-subtext {
    display: block;
    font-size: 14px;
    opacity: 0.9;
}

@keyframes nearMissShake {
    0%, 100% { transform: translateX(-50%) rotate(0); }
    25% { transform: translateX(-55%) rotate(-2deg); }
    75% { transform: translateX(-45%) rotate(2deg); }
}

@keyframes iconSpin {
    0% { transform: rotate(0) scale(0); }
    50% { transform: rotate(180deg) scale(1.2); }
    100% { transform: rotate(360deg) scale(1); }
}

/* Button shake urgency effect */
.dopamine-button.shake-urgency {
    animation: urgentShake 0.3s infinite;
}

@keyframes urgentShake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-5px) rotate(-1deg); }
    75% { transform: translateX(5px) rotate(1deg); }
}

/* Enhanced floating numbers with physics */
.floating-number {
    animation: floatWithPhysics 1.5s ease-out forwards;  /* Faster to reduce on-screen time */
}

@keyframes floatWithPhysics {
    0% {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
    100% {
        opacity: 0;
        transform: translateY(-120px) scale(0.8);  /* Simplified animation */
    }
}

/* Micro-interactions for buttons */
.dopamine-button:active {
    transform: scale(0.98);
}

.dopamine-button::after {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: 30px;
    background: radial-gradient(circle at center, transparent 0%, rgba(255, 255, 255, 0.1) 100%);
    opacity: 0;
    transition: opacity 0.3s;
}

.dopamine-button:hover::after {
    opacity: 1;
}

/* Version Badge - App Update Theme */
.version-badge {
    position: fixed;
    top: 60px;  /* Moved down to avoid overlap with streak display */
    right: 20px;
    background: rgba(0, 255, 0, 0.15);  /* Slightly more visible */
    color: #4ade80;
    padding: 5px 12px;
    border-radius: 5px;
    font-family: 'Courier New', monospace;
    font-size: 12px;
    font-weight: bold;
    border: 1px solid rgba(0, 255, 0, 0.4);
    z-index: 10000;  /* Very high to ensure visibility */
    transition: all 0.3s ease;
    cursor: default;
    user-select: none;
    backdrop-filter: blur(5px);  /* Add blur for better visibility */
}

.version-badge:hover {
    background: rgba(0, 255, 0, 0.2);
    border-color: rgba(0, 255, 0, 0.5);
    transform: scale(1.05);
}

/* Version badge pulsing when update available */
.version-badge.update-available {
    animation: versionPulse 2s infinite;
    background: rgba(255, 193, 7, 0.1);
    color: #ffc107;
    border-color: rgba(255, 193, 7, 0.3);
}

@keyframes versionPulse {
    0%, 100% {
        box-shadow: 0 0 10px rgba(255, 193, 7, 0.3);
    }
    50% {
        box-shadow: 0 0 20px rgba(255, 193, 7, 0.6);
    }
}

/* Mobile responsiveness for version badge */
@media (max-width: 768px) {
    .version-badge {
        top: 5px;
        right: 10px;
        font-size: 10px;
        padding: 3px 8px;
    }
}

/* Analytics Dashboard Enhancements - App Theme */
.stats-modal-content h2 {
    font-family: 'Courier New', monospace;
    color: #10b981;
    text-shadow: 0 0 10px rgba(16, 185, 129, 0.3);
}

.stats-modal-content h3 {
    font-family: 'Courier New', monospace;
    color: #4ade80;
    font-size: 16px;
    letter-spacing: 1px;
}

/* Make stat cards look more like analytics widgets */
.stat-card {
    border: 1px solid rgba(16, 185, 129, 0.2);
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.05) 0%, rgba(5, 150, 105, 0.05) 100%);
}

.stat-card:hover {
    border-color: rgba(16, 185, 129, 0.4);
    transform: translateY(-2px);
}

.stat-card-label {
    font-family: 'Courier New', monospace;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: #4ade80;
}

.stat-card-desc {
    font-family: 'Courier New', monospace;
    font-size: 10px;
    color: #6b7280;
    font-style: normal;
}

/* Make recommendations look like terminal output */
#statRecommendations {
    font-family: 'Courier New', monospace;
    font-size: 12px;
    color: #fbbf24;
    list-style: none;
    padding: 0;
}

#statRecommendations li {
    margin: 8px 0;
    padding-left: 20px;
    position: relative;
}

#statRecommendations li:before {
    content: '>';
    position: absolute;
    left: 0;
    color: #10b981;
}

/* Dashboard close button tech style */
.return-to-addiction {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    font-family: 'Courier New', monospace;
    letter-spacing: 1px;
}

.return-to-addiction:hover {
    background: linear-gradient(135deg, #059669 0%, #047857 100%);
    box-shadow: 0 0 20px rgba(16, 185, 129, 0.4);
}

/* Next Milestone Indicator - MOTIVATION! */
.next-milestone {
    position: relative;
    z-index: 15;
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.2) 0%, rgba(59, 130, 246, 0.2) 100%);
    border: 2px solid rgba(16, 185, 129, 0.5);
    border-radius: 20px;
    padding: 15px 25px;
    margin-bottom: 30px;
    text-align: center;
    backdrop-filter: blur(10px);
    box-shadow: 0 10px 40px rgba(16, 185, 129, 0.3);
    animation: milestoneGlow 2s ease-in-out infinite;
}

.milestone-label {
    font-size: 11px;
    color: #10B981;
    letter-spacing: 3px;
    font-weight: 700;
    margin-bottom: 5px;
}

.milestone-value {
    font-size: 28px;
    font-weight: 900;
    background: linear-gradient(135deg, #10B981, #3B82F6);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 10px;
}

.milestone-progress-bar {
    height: 8px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    overflow: hidden;
    position: relative;
}

.milestone-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #10B981, #3B82F6);
    border-radius: 10px;
    width: 0%;
    transition: width 0.3s ease-out;
    box-shadow: 0 0 10px rgba(16, 185, 129, 0.8);
}

@keyframes milestoneGlow {
    0%, 100% { box-shadow: 0 10px 40px rgba(16, 185, 129, 0.3); }
    50% { box-shadow: 0 10px 60px rgba(16, 185, 129, 0.6); }
}

/* Mobile Optimization - BIGGER BUTTON! */
@media (max-width: 768px) {
    .dopamine-button {
        width: 200px !important;
        height: 200px !important;
        font-size: 28px !important;
    }

    .button-emoji {
        font-size: 64px !important;
    }

    .next-milestone {
        padding: 12px 20px;
        margin-bottom: 20px;
    }

    .milestone-value {
        font-size: 24px;
    }

    .stats-bar {
        gap: 15px;
        margin-bottom: 20px;
        flex-wrap: wrap;
    }

    .stat-value {
        font-size: 20px;
    }
}

/* Sound Toggle Button */
.sound-toggle {
    position: fixed;
    top: 20px;
    right: 20px;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    border: 2px solid rgba(255, 255, 255, 0.3);
    background: rgba(15, 14, 23, 0.8);
    backdrop-filter: blur(10px);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    z-index: 1000;
    transition: all 0.3s ease;
}

.sound-toggle:hover {
    background: rgba(107, 70, 193, 0.3);
    border-color: var(--primary);
    transform: scale(1.1);
}

.sound-toggle.muted .sound-icon::after {
    content: '🔇';
    position: absolute;
}

.sound-toggle.muted .sound-icon {
    opacity: 0;
}
