/* Custom animations and styles */
@keyframes float {
    0%, 100% { transform: translateY(0px) rotate(0deg); opacity: 0.7; }
    50% { transform: translateY(-20px) rotate(180deg); opacity: 1; }
}

.animate-float {
    animation: float 6s ease-in-out infinite;
}

@keyframes pulse-glow {
    0%, 100% { box-shadow: 0 0 5px rgba(0, 212, 255, 0.3); }
    50% { box-shadow: 0 0 20px rgba(0, 212, 255, 0.6); }
}

.game-button {
    animation: pulse-glow 2s ease-in-out infinite;
}

.game-button:hover {
    animation: none;
    box-shadow: 0 0 25px rgba(57, 255, 20, 0.6);
}

/* Enhanced copy button animation */
@keyframes copy-success {
    0% { transform: scale(1); }
    50% { transform: scale(1.1); box-shadow: 0 0 20px rgba(255, 215, 0, 0.8); }
    100% { transform: scale(1); }
}

.copy-mega-button {
    position: relative;
    overflow: hidden;
}

.copy-mega-button::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent);
    transition: left 0.5s;
}

.copy-mega-button:hover::before {
    left: 100%;
}

/* Ultra-stable input field styles */
.stable-input, .stable-textarea {
    caret-color: #00d4ff;
    will-change: contents;
    transform: translateZ(0);
    backface-visibility: hidden;
    -webkit-font-smoothing: antialiased;
}

.stable-input:focus, .stable-textarea:focus {
    outline: none !important;
    box-shadow: 0 0 0 2px rgba(0, 212, 255, 0.3), 0 0 8px rgba(0, 212, 255, 0.2) !important;
    border-color: #00d4ff !important;
}

/* Prevent input lag and cursor jumping */
.stable-input {
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.stable-textarea {
    resize: vertical;
    min-height: 160px;
    line-height: 1.6;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

/* Enhanced focus indicators for accessibility */
*:focus-visible {
    outline: 2px solid #00d4ff;
    outline-offset: 2px;
}

/* Custom slider styles */
.slider {
    -webkit-appearance: none;
    appearance: none;
    height: 6px;
    background: linear-gradient(to right, #2d2d44, #00d4ff);
    outline: none;
    border-radius: 3px;
    cursor: pointer;
}

.slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 18px;
    height: 18px;
    background: #00d4ff;
    cursor: pointer;
    border-radius: 50%;
    box-shadow: 0 0 10px rgba(0, 212, 255, 0.5);
    transition: all 0.15s ease;
}

.slider::-webkit-slider-thumb:hover {
    transform: scale(1.2);
    box-shadow: 0 0 15px rgba(0, 212, 255, 0.8);
}

.slider::-moz-range-thumb {
    width: 18px;
    height: 18px;
    background: #00d4ff;
    cursor: pointer;
    border-radius: 50%;
    border: none;
    box-shadow: 0 0 10px rgba(0, 212, 255, 0.5);
}

.slider:focus::-webkit-slider-thumb {
    box-shadow: 0 0 0 3px rgba(0, 212, 255, 0.3), 0 0 15px rgba(0, 212, 255, 0.8);
}

/* Optimized scrollbar styles */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: rgba(45, 45, 68, 0.3);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb {
    background: linear-gradient(to bottom, #00d4ff, #ff1493);
    border-radius: 4px;
    transition: all 0.2s ease;
}

::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(to bottom, #39ff14, #00d4ff);
    box-shadow: 0 0 10px rgba(0, 212, 255, 0.5);
}

/* Enhanced button hover effects */
button:not(:disabled):hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

button:not(:disabled):active {
    transform: translateY(0px);
}

button:disabled {
    cursor: not-allowed;
    opacity: 0.5;
}

/* Copy success animation trigger */
.copy-success {
    animation: copy-success 0.6s ease-out;
}

/* Loading animation */
@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

.animate-spin-slow {
    animation: spin 3s linear infinite;
}

/* Card hover effects */
.hover-lift:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.2);
}

/* Gradient text effects */
.gradient-text {
    background: linear-gradient(45deg, #00d4ff, #39ff14, #ff1493);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    background-size: 200% 200%;
    animation: gradient-shift 3s ease-in-out infinite;
}

@keyframes gradient-shift {
    0%, 100% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
}

/* Enhanced keyboard navigation */
.tab-focus:focus {
    z-index: 10;
    box-shadow: 0 0 0 3px rgba(0, 212, 255, 0.5);
}

/* Performance optimizations */
.will-change-transform {
    will-change: transform;
}

.gpu-accelerated {
    transform: translateZ(0);
    backface-visibility: hidden;
    perspective: 1000px;
}

/* Mobile optimizations */
@media (max-width: 768px) {
    .font-game {
        font-size: 0.9em;
    }
    
    .stable-input, .stable-textarea {
        font-size: 16px; /* Prevent zoom on iOS */
    }
    
    .copy-mega-button {
        padding: 1rem;
        font-size: 0.9rem;
    }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    .animate-float,
    .game-button,
    .gradient-text {
        animation: none;
    }
    
    button:hover {
        transform: none;
    }
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .stable-input:focus, .stable-textarea:focus {
        border-width: 3px;
        border-color: #ffffff;
    }
    
    .copy-mega-button {
        border: 2px solid #ffffff;
    }
}

/* Dark mode enhancements */
@media (prefers-color-scheme: dark) {
    .stable-input, .stable-textarea {
        color-scheme: dark;
    }
}