/* Wheel Container - Responsive with CSS */
.wheel-container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 400px;
    padding: 20px;
    width: 100%;
    max-width: 800px;
    margin: 0 auto;
    position: relative;
    border-radius: 6px;
    transition: all 0.3s ease;
    background-repeat: no-repeat;
    background-size: cover;
    background-position: center;
}

#wheel {
    display: block;
    width: 100%;
    height: auto;
    max-width: 600px;
    max-height: 600px;
    aspect-ratio: 1;
    /* Optimize for smooth animation */
    will-change: transform;
    backface-visibility: hidden;
    transform-style: preserve-3d;
    border-radius: 50%;
    box-shadow: 0 0 30px rgba(0, 0, 0, 0.3);
}

#spin {
    font-family: "Poppins", sans-serif;
    line-height: 1;
    user-select: none;
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20%;
    height: 20%;
    margin: -10%;
    background: #fff;
    color: #333;
    box-shadow:
        0 0 0 6px currentColor,
        0 0px 12px 4px rgba(0, 0, 0, 0.6);
    border-radius: 50%;
    transition: all 0.2s ease;
    -webkit-transition: all 0.2s ease;
    font-weight: bold;
}

/* Upload Button Styles */
.upload-btn {
    z-index: 10;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    border: none;
    font-size: 12px;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Upload Loading Animation */
#uploadLoading {
    backdrop-filter: blur(5px);
}

.upload-notification {
    animation: slideInRight 0.3s ease-out;
}

@keyframes slideInRight {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}



#spin:hover {
    -webkit-transform: scale(1.05);
    transform: scale(1.05);
    box-shadow:
        0 0 0 6px currentColor,
        0 0px 15px 6px rgba(0, 0, 0, 0.7);
}

#spin::after {
    content: "";
    position: absolute;
    top: -12px;
    border: 8px solid transparent;
    border-bottom-color: currentColor;
    border-top: none;
}

/* Gradient Background */
.gradient-bg {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

/* Animation Classes */
.animate-slow-spin {
    animation: slow-spin 20s linear infinite;
}

@keyframes slow-spin {
    from { 
        -webkit-transform: rotate(0deg); 
        transform: rotate(0deg); 
    }
    to { 
        -webkit-transform: rotate(360deg); 
        transform: rotate(360deg); 
    }
}

/* Gentle idle rotation - very slow and smooth */
.wheel-idle {
    animation: gentle-spin 60s linear infinite;
    -webkit-animation: gentle-spin 60s linear infinite;
}

@keyframes gentle-spin {
    from { 
        -webkit-transform: rotate(0deg); 
        transform: rotate(0deg); 
    }
    to { 
        -webkit-transform: rotate(360deg); 
        transform: rotate(360deg); 
    }
}

.animate-bounce-in {
    animation: bounce-in 0.6s ease-out;
}

@keyframes bounce-in {
    0% { 
        -webkit-transform: scale(0.3); 
        transform: scale(0.3); 
        opacity: 0; 
    }
    50% { 
        -webkit-transform: scale(1.05); 
        transform: scale(1.05); 
    }
    70% { 
        -webkit-transform: scale(0.9); 
        transform: scale(0.9); 
    }
    100% { 
        -webkit-transform: scale(1); 
        transform: scale(1); 
        opacity: 1; 
    }
}

/* Modal Styles */
.modal {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    width: 100% !important;
    height: 100% !important;
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    z-index: 9999 !important;
    opacity: 1;
    visibility: visible;
    transition: all 0.3s ease;
    display: flex !important;
    align-items: center;
    justify-content: center;
    background-color: rgba(0, 0, 0, 0.5);
}

.modal.hidden {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    display: none !important;
}

.modal.show {
    opacity: 1;
    visibility: visible;
    display: flex !important;
}

/* Specific styles for global settings modal */
#globalSettingsModal {
    z-index: 10000 !important;
}

#globalSettingsModal .bg-white {
    position: relative;
    z-index: 10001;
    max-width: 90vw;
    max-height: 90vh;
    overflow-y: auto;
}

/* Override Tailwind hidden class for modals */
.modal.hidden {
    display: none !important;
}

/* Ensure modal shows when not hidden */
.modal:not(.hidden) {
    display: flex !important;
}

/* Debug styles */
.modal-debug {
    border: 2px solid red !important;
    background-color: rgba(255, 0, 0, 0.1) !important;
}

.modal .bg-white {
    animation: bounce-in 0.3s ease-out;
    -webkit-animation: bounce-in 0.3s ease-out;
    transform: scale(1);
    transition: transform 0.3s ease;
}

.modal.show .bg-white {
    transform: scale(1);
}

/* Settings Panel Responsive */
.settings-panel {
    max-height: 70vh;
    overflow-y: auto;
}

.settings-panel::-webkit-scrollbar {
    width: 6px;
}

.settings-panel::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 3px;
}

.settings-panel::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 3px;
}

.settings-panel::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
}

/* Wheel Item Styles */
.wheel-item {
    transition: all 0.3s ease;
    border: 2px solid transparent;
}

.wheel-item:hover {
    border-color: #4F46E5;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

/* Responsive Design */
@media (max-width: 768px) {
    .wheel-container {
        padding: 15px;
        min-height: 300px;
    }
    
    #wheel {
        max-width: 450px;
        max-height: 450px;
    }
    
    #spin {
        width: 20%;
        height: 20%;
        margin: -10%;
        font-size: 0.8em;
    }
    
    .diamond {
        width: 14px;
        height: 14px;
    }
    
    .settings-panel {
        max-height: 50vh;
    }
    
    .grid-cols-2 {
        grid-template-columns: 1fr;
        gap: 0.5rem;
    }
}

@media (max-width: 480px) {
    .wheel-container {
        padding: 10px;
        min-height: 280px;
    }
    
    #wheel {
        max-width: 350px;
        max-height: 350px;
    }
    
    #spin {
        width: 24%;
        height: 24%;
        margin: -12%;
        font-size: 0.7em;
        letter-spacing: 0.5px;
    }
    
    #spin::after {
        border-width: 6px;
        top: -10px;
    }
    
    .diamond {
        width: 12px;
        height: 12px;
    }
}

@media (max-width: 320px) {
    .wheel-container {
        padding: 8px;
        min-height: 250px;
    }
    
    #wheel {
        max-width: 280px;
        max-height: 280px;
    }
    
    #spin {
        width: 26%;
        height: 26%;
        margin: -13%;
        font-size: 0.6em;
        letter-spacing: 0px;
        min-width: 35px;
        min-height: 35px;
    }
    
    #spin::after {
        border-width: 5px;
        top: -8px;
    }
    
    .diamond {
        width: 10px;
        height: 10px;
    }
}

/* High DPI displays */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
    #spin {
        box-shadow:
            0 0 0 8px currentColor,
            0 0px 20px 8px rgba(0, 0, 0, 0.7);
    }
}

/* Touch devices */
@media (hover: none) and (pointer: coarse) {
    #spin {
        /* Touch target for mobile - not too large */
        min-width: 55px;
        min-height: 55px;
    }
    
    #spin:active {
        transform: scale(0.9);
    }
}

/* Results Section Styles */
.results-container {
    scrollbar-width: thin;
    scrollbar-color: #c1c1c1 #f1f1f1;
}

.results-container::-webkit-scrollbar {
    width: 6px;
}

.results-container::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 3px;
}

.results-container::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 3px;
}

.results-container::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
}

.result-item {
    transition: all 0.3s ease;
    border-left: 4px solid transparent;
}

.result-item:hover {
    background-color: #f8f9fa;
    border-left-color: #4F46E5;
    transform: translateX(2px);
}

.result-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 24px;
    height: 24px;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: bold;
    color: white;
}

/* Animation for new results */
.result-new {
    animation: slideInRight 0.5s ease-out;
}

@keyframes slideInRight {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* Image Preview Modal Styles */
#imagePreviewModal .bg-white {
    animation: zoomIn 0.3s ease-out;
}

@keyframes zoomIn {
    from {
        transform: scale(0.7);
        opacity: 0;
    }
    to {
        transform: scale(1);
        opacity: 1;
    }
}

.preview-image-container {
    max-width: 100%;
    max-height: 400px;
    overflow: hidden;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
}

.preview-image-container img {
    max-width: 100%;
    max-height: 400px;
    object-fit: contain;
    border-radius: 12px;
    transition: transform 0.3s ease;
}

.preview-image-container img:hover {
    transform: scale(1.05);
}

.image-info {
    background: #f8f9fa;
    border-radius: 8px;
    padding: 12px;
    margin-top: 16px;
    text-align: left;
}

.image-info-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 4px 0;
    border-bottom: 1px solid #e9ecef;
}

.image-info-item:last-child {
    border-bottom: none;
}

.loading-spinner {
    display: inline-block;
    width: 40px;
    height: 40px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid #3498db;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Stats animation */
.stats-update {
    animation: pulse 0.6s ease-in-out;
}

@keyframes pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.1); }
    100% { transform: scale(1); }
}

/* Global Settings Effects */
.wheel-glow {
    filter: drop-shadow(0 0 20px rgba(255, 215, 0, 0.6));
}

.shake-animation {
    animation: shake 0.8s ease-in-out;
}

/* Diamond Border Effect */
.wheel-diamonds {
    position: relative;
}

.wheel-diamonds::before {
    content: '';
    position: absolute;
    top: -10px;
    left: -10px;
    right: -10px;
    bottom: -10px;
    border-radius: 50%;
    pointer-events: none;
    z-index: 10;
}

.diamond {
    position: absolute;
    width: 16px;
    height: 16px;
    background: linear-gradient(45deg, #FFD700, #FFA500, #FFD700);
    border: 2px solid #FFFFFF;
    border-radius: 3px;
    transform: rotate(45deg);
    box-shadow: 
        0 0 10px rgba(255, 215, 0, 0.8),
        inset 0 0 5px rgba(255, 255, 255, 0.5);
    animation: diamond-sparkle 2s ease-in-out infinite alternate;
    z-index: 10;
    pointer-events: none;
}

.diamond::before {
    content: '';
    position: absolute;
    top: 2px;
    left: 2px;
    right: 2px;
    bottom: 2px;
    background: linear-gradient(135deg, transparent 30%, rgba(255, 255, 255, 0.4) 50%, transparent 70%);
    border-radius: 1px;
}

.diamond::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 4px;
    height: 4px;
    background: rgba(255, 255, 255, 0.9);
    border-radius: 50%;
    transform: translate(-50%, -50%);
    box-shadow: 0 0 3px rgba(255, 255, 255, 0.8);
}

@keyframes diamond-sparkle {
    0% {
        box-shadow: 
            0 0 10px rgba(255, 215, 0, 0.8),
            inset 0 0 5px rgba(255, 255, 255, 0.5);
        transform: rotate(45deg) scale(1);
    }
    100% {
        box-shadow: 
            0 0 15px rgba(255, 215, 0, 1),
            inset 0 0 8px rgba(255, 255, 255, 0.7),
            0 0 20px rgba(255, 215, 0, 0.6);
        transform: rotate(45deg) scale(1.1);
    }
}

@keyframes diamond-flash {
    0% {
        transform: rotate(45deg) scale(1);
        opacity: 1;
    }
    50% {
        transform: rotate(45deg) scale(1.8);
        opacity: 0.9;
    }
    100% {
        transform: rotate(45deg) scale(1.5);
        opacity: 1;
    }
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    10%, 30%, 50%, 70%, 90% { transform: translateX(-2px); }
    20%, 40%, 60%, 80% { transform: translateX(2px); }
}

/* Fireworks Effect */
.fireworks-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 9999;
}

.firework {
    position: absolute;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    animation: firework 2s ease-out;
}

.firework:nth-child(1) {
    background: #ff6b6b;
    top: 20%;
    left: 20%;
    animation-delay: 0s;
}

.firework:nth-child(2) {
    background: #4ecdc4;
    top: 30%;
    right: 20%;
    animation-delay: 0.3s;
}

.firework:nth-child(3) {
    background: #45b7d1;
    top: 40%;
    left: 50%;
    animation-delay: 0.6s;
}

.firework:nth-child(4) {
    background: #96ceb4;
    top: 25%;
    right: 30%;
    animation-delay: 0.9s;
}

.firework:nth-child(5) {
    background: #ffeaa7;
    top: 35%;
    left: 30%;
    animation-delay: 1.2s;
}

@keyframes firework {
    0% {
        transform: scale(0) rotate(0deg);
        opacity: 1;
    }
    25% {
        transform: scale(1) rotate(90deg);
        opacity: 1;
    }
    50% {
        transform: scale(1.5) rotate(180deg);
        opacity: 0.8;
    }
    100% {
        transform: scale(3) rotate(360deg);
        opacity: 0;
    }
}

/* Safari-compatible firework animation */
@keyframes firework-safari {
    0% {
        -webkit-transform: scale(0) rotate(0deg);
        transform: scale(0) rotate(0deg);
        opacity: 1;
    }
    25% {
        -webkit-transform: scale(1) rotate(90deg);
        transform: scale(1) rotate(90deg);
        opacity: 1;
    }
    50% {
        -webkit-transform: scale(1.5) rotate(180deg);
        transform: scale(1.5) rotate(180deg);
        opacity: 0.8;
    }
    100% {
        -webkit-transform: scale(3) rotate(360deg);
        transform: scale(3) rotate(360deg);
        opacity: 0;
    }
}

/* Confetti Effect */
.confetti-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 9998;
    overflow: hidden;
}

.confetti-piece {
    position: absolute;
    width: 10px;
    height: 10px;
    top: -10px;
    animation: confetti-fall 3s linear;
}

@keyframes confetti-fall {
    0% {
        -webkit-transform: translateY(-100vh) rotate(0deg);
        transform: translateY(-100vh) rotate(0deg);
        opacity: 1;
    }
    100% {
        -webkit-transform: translateY(100vh) rotate(720deg);
        transform: translateY(100vh) rotate(720deg);
        opacity: 0;
    }
}

/* Global Settings Panel Styles */
.global-settings-panel {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 16px;
    padding: 20px;
    color: white;
    margin-bottom: 20px;
}

.settings-section {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    padding: 16px;
    margin-bottom: 16px;
    backdrop-filter: blur(10px);
}

.settings-section h4 {
    margin: 0 0 12px 0;
    font-weight: 600;
    color: #fff;
    display: flex;
    align-items: center;
    gap: 8px;
}

.settings-toggle {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 8px;
}

.toggle-switch {
    position: relative;
    width: 44px;
    height: 24px;
    background: rgba(255, 255, 255, 0.3);
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.toggle-switch.active {
    background: #4CAF50;
}

.toggle-switch::after {
    content: '';
    position: absolute;
    top: 2px;
    left: 2px;
    width: 20px;
    height: 20px;
    background: white;
    border-radius: 50%;
    transition: all 0.3s ease;
}

.toggle-switch.active::after {
    transform: translateX(20px);
}

.settings-input {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.1);
    color: white;
    font-size: 14px;
}

.settings-input::placeholder {
    color: rgba(255, 255, 255, 0.7);
}

.settings-select {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.1);
    color: white;
    font-size: 14px;
}

.color-picker-wrapper {
    display: flex;
    align-items: center;
    gap: 10px;
}

.color-preview {
    width: 30px;
    height: 30px;
    border-radius: 6px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    cursor: pointer;
}

/* Global Settings Modal Styles */
.settings-section-modal {
    background: #f8f9fa;
    border-radius: 12px;
    padding: 20px;
    border: 1px solid #e9ecef;
    transition: all 0.3s ease;
}

.settings-section-modal:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    transform: translateY(-2px);
}

.section-title {
    margin: 0 0 16px 0;
    font-weight: 600;
    color: #333;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 1.1em;
    border-bottom: 2px solid #e9ecef;
    padding-bottom: 8px;
}

.settings-input-modal {
    width: 100%;
    padding: 10px 14px;
    border: 2px solid #e9ecef;
    border-radius: 8px;
    background: white;
    color: #333;
    font-size: 14px;
    transition: all 0.3s ease;
}

.settings-input-modal:focus {
    outline: none;
    border-color: #4F46E5;
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}

.settings-input-modal::placeholder {
    color: #9ca3af;
}

.color-picker-wrapper-modal {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    font-weight: 500;
    color: #333;
}

.color-preview-modal {
    width: 40px;
    height: 40px;
    border-radius: 8px;
    border: 3px solid #fff;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    cursor: pointer;
    transition: all 0.3s ease;
}

.color-preview-modal:hover {
    transform: scale(1.1);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

/* Modal Toggle Switch Enhanced */
#globalSettingsModal .toggle-switch {
    position: relative;
    width: 50px;
    height: 28px;
    background: #e5e7eb;
    border-radius: 14px;
    cursor: pointer;
    transition: all 0.3s ease;
    border: 2px solid #d1d5db;
}

#globalSettingsModal .toggle-switch.active {
    background: linear-gradient(135deg, #10b981, #059669);
    border-color: #047857;
}

#globalSettingsModal .toggle-switch::after {
    content: '';
    position: absolute;
    top: 2px;
    left: 2px;
    width: 20px;
    height: 20px;
    background: white;
    border-radius: 50%;
    transition: all 0.3s ease;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

#globalSettingsModal .toggle-switch.active::after {
    transform: translateX(22px);
}

/* Grid layout for modal */
#globalSettingsModal .grid {
    gap: 20px;
}

@media (max-width: 768px) {
    #globalSettingsModal .grid {
        grid-template-columns: 1fr;
    }
    
    #globalSettingsModal .max-w-4xl {
        max-width: 95vw;
    }
}

/* Notification System */
.notification {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 10000;
    padding: 15px 20px;
    border-radius: 10px;
    color: white;
    font-weight: 500;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 250px;
    animation: slideInRight 0.3s ease-out;
}

.notification i {
    font-size: 18px;
    flex-shrink: 0;
}

.notification-success {
    background: linear-gradient(135deg, #4ade80, #22c55e);
}

.notification-error {
    background: linear-gradient(135deg, #ef4444, #dc2626);
}

.notification-info {
    background: linear-gradient(135deg, #3b82f6, #2563eb);
}

.notification.fade-out {
    animation: slideOutRight 0.3s ease-in;
}

@keyframes slideInRight {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes slideOutRight {
    to {
        transform: translateX(100%);
        opacity: 0;
    }
}

/* Fullscreen Mode */
.fullscreen-mode {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    width: 100vw !important;
    height: 100vh !important;
    z-index: 9999 !important;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%) !important;
    /* display: flex !important; */
    /* justify-content: center !important; */
    /* align-items: center !important; */
    margin: 0 !important;
    /* padding: 20px !important; */
}

/* Native Fullscreen Mode */
body.native-fullscreen {
    margin: 0;
    padding: 0;
    overflow: hidden;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

body.native-fullscreen .fullscreen-mode {
    position: fixed!important;
    width: 100vw !important;
    height: 100vh !important;
    z-index: 98 !important;
}

.fullscreen-mode .wheel-container {
    width: auto !important;
    height: 100% !important;
    max-width: 100% !important;
    max-height: 100% !important;
    display: flex !important;
    justify-content: center !important;
    align-items: center !important;
}

.fullscreen-mode canvas {
    width: auto !important;
    height: auto !important;
    max-width: 80vh !important;
    max-height: 80vh !important;
}

.fullscreen-mode #spin {
    transform: scale(1.2) !important;
    box-shadow: 
        0 0 0 6px currentColor,
        0 0px 15px 6px rgba(0, 0, 0, 0.8),
        0 0 30px rgba(255, 255, 255, 0.3) !important;
}

.fullscreen-mode #fullscreenBtn {
    background: rgba(255, 255, 255, 0.2) !important;
    color: white !important;
    backdrop-filter: blur(10px) !important;
    border: 1px solid rgba(255, 255, 255, 0.3) !important;
}

.fullscreen-mode #fullscreenBtn:hover {
    background: rgba(255, 255, 255, 0.3) !important;
    transform: scale(1.1) !important;
}

/* Fullscreen transition */
.fullscreen-transition {
    transition: all 0.5s cubic-bezier(0.4, 0, 0.2, 1) !important;
}

/* Hide other elements in fullscreen */
.fullscreen-mode ~ * {
    display: none !important;
}

/* Fullscreen button states */
#fullscreenBtn {
    transition: all 0.3s ease;
}

#fullscreenBtn.exit-fullscreen {
    background: rgba(255, 255, 255, 0.2);
    color: white;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.3);
}

#fullscreenBtn.exit-fullscreen:hover {
    background: rgba(255, 255, 255, 0.3);
}

/* Responsive fullscreen */
@media (max-width: 768px) {
    .fullscreen-mode {
        padding: 10px !important;
    }
    
    .fullscreen-mode canvas {
        max-width: 90vh !important;
        max-height: 90vh !important;
    }
    
    .fullscreen-mode #spin {
        transform: scale(1.1) !important;
    }
    
    #fullscreenBtn {
        padding: 12px !important;
        top: 8px !important;
        right: 8px !important;
    }
}

@media (max-width: 480px) {
    .fullscreen-mode canvas {
        max-width: 85vh !important;
        max-height: 85vh !important;
    }
    
    #fullscreenBtn {
        padding: 10px !important;
    }
    
    #fullscreenBtn i {
        font-size: 16px !important;
    }
}

/* Fullscreen animation effects */
@keyframes fullscreenEnter {
    from {
        opacity: 0;
        transform: scale(0.8);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.fullscreen-mode .wheel-container > div {
    animation: fullscreenEnter 0.5s ease-out;
}

/* Enhanced background for fullscreen */
.fullscreen-mode::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: 
        radial-gradient(circle at 20% 50%, rgba(120, 119, 198, 0.3) 0%, transparent 50%),
        radial-gradient(circle at 80% 20%, rgba(255, 119, 198, 0.3) 0%, transparent 50%),
        radial-gradient(circle at 40% 80%, rgba(120, 200, 255, 0.3) 0%, transparent 50%);
    pointer-events: none;
}

/* Background Type Selection */
.bg-type-btn {
    padding: 8px 12px;
    border: 2px solid #d1d5db;
    border-radius: 8px;
    background: white;
    color: #6b7280;
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

.bg-type-btn:hover {
    border-color: #9ca3af;
    background: #f9fafb;
}

.bg-type-btn.active {
    border-color: #3b82f6;
    background: #eff6ff;
    color: #3b82f6;
}

.bg-type-btn i {
    font-size: 14px;
}

/* Background Mode Selection */
.bg-mode-btn {
    padding: 8px 12px;
    border: 2px solid #d1d5db;
    border-radius: 8px;
    background: white;
    color: #6b7280;
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

.bg-mode-btn:hover {
    border-color: #9ca3af;
    background: #f9fafb;
}

.bg-mode-btn.active {
    border-color: #10b981;
    background: #ecfdf5;
    color: #10b981;
}

.bg-mode-btn i {
    font-size: 14px;
}

/* Preset Images */
.preset-image {
    width: 100%;
    height: 60px;
    object-fit: cover;
    border-radius: 6px;
    cursor: pointer;
    border: 2px solid transparent;
    transition: all 0.3s ease;
}

.preset-image:hover {
    border-color: #3b82f6;
    transform: scale(1.05);
}

.preset-image.selected {
    border-color: #10b981;
    box-shadow: 0 0 0 2px rgba(16, 185, 129, 0.2);
}

/* Preset Image Grid Containers */
#wheelPresetImages .grid,
#spinPresetImages .grid {
    gap: 0.5rem;
}

#wheelPresetImages img,
#spinPresetImages img {
    aspect-ratio: 1;
    height: auto;
    min-height: 50px;
}

/* Scrollable preset containers */
#wheelPresetImages,
#spinPresetImages {
    scrollbar-width: thin;
    scrollbar-color: rgba(156, 163, 175, 0.5) transparent;
}

#wheelPresetImages::-webkit-scrollbar,
#spinPresetImages::-webkit-scrollbar {
    width: 6px;
}

#wheelPresetImages::-webkit-scrollbar-track,
#spinPresetImages::-webkit-scrollbar-track {
    background: transparent;
}

#wheelPresetImages::-webkit-scrollbar-thumb,
#spinPresetImages::-webkit-scrollbar-thumb {
    background-color: rgba(156, 163, 175, 0.5);
    border-radius: 3px;
}

#wheelPresetImages::-webkit-scrollbar-thumb:hover,
#spinPresetImages::-webkit-scrollbar-thumb:hover {
    background-color: rgba(156, 163, 175, 0.7);
}

/* Image Source Toggle Buttons */
.image-source-btn {
    font-size: 12px;
    font-weight: 500;
    min-width: 70px;
    transition: all 0.2s ease;
}

.image-source-btn:hover {
    transform: translateY(-1px);
}

/* Unsplash Gallery Styles */
.unsplash-search-container input {
    font-size: 14px;
}

.unsplash-search-container button {
    min-width: 40px;
}

.category-btn {
    font-size: 11px;
    white-space: nowrap;
}

.category-btn.active {
    background-color: #3b82f6 !important;
    color: white !important;
}

/* Loading and error states */
.unsplash-gallery .loading-state {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    color: #6b7280;
}

.unsplash-gallery .error-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    color: #ef4444;
    text-align: center;
}

.unsplash-gallery .empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    color: #6b7280;
    text-align: center;
}

/* Background Image Options */
#wheelImageOption,
#spinImageOption {
    transition: all 0.3s ease;
}

#wheelImageOption.show,
#spinImageOption.show {
    display: block !important;
}

/* Image preview in settings */
.image-preview {
    width: 100%;
    height: 80px;
    background-size: cover;
    background-position: center;
    border-radius: 8px;
    border: 2px dashed #d1d5db;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #9ca3af;
    font-size: 12px;
    margin-top: 8px;
}

.image-preview.has-image {
    border-style: solid;
    border-color: #10b981;
}

/* Canvas styles */
#wheel {
    background: transparent;
}

/* ========== ENHANCED VISUAL EFFECTS ========== */

/* Enhanced Particle Effect with Gradient & Glow */
.particle-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 9998;
    overflow: hidden;
    perspective: 1000px;
    -webkit-perspective: 1000px;
}

.particle {
    position: absolute;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    opacity: 1;
    will-change: transform, opacity;
    -webkit-backface-visibility: hidden;
    backface-visibility: hidden;
    background: radial-gradient(circle at 30% 30%, rgba(255, 255, 255, 0.9), currentColor);
    box-shadow: 
        0 0 6px currentColor,
        0 0 12px rgba(255, 255, 255, 0.5),
        inset 0 0 4px rgba(255, 255, 255, 0.3);
    animation: particle-enhanced 3s ease-out forwards;
    -webkit-animation: particle-enhanced 3s ease-out forwards;
}

.particle::before {
    content: '';
    position: absolute;
    top: -2px;
    left: -2px;
    right: -2px;
    bottom: -2px;
    background: conic-gradient(from 0deg, transparent, currentColor, transparent);
    border-radius: 50%;
    z-index: -1;
    opacity: 0.6;
    animation: particle-rotate 2s linear infinite;
    -webkit-animation: particle-rotate 2s linear infinite;
}

@keyframes particle-enhanced {
    0% {
        transform: translateY(0) translateZ(0) scale(0.5) rotate(0deg);
        opacity: 1;
        filter: brightness(1.5) blur(0px);
    }
    25% {
        transform: translateY(-80px) translateZ(50px) scale(1.2) rotate(90deg);
        opacity: 1;
        filter: brightness(2) blur(0.5px);
    }
    50% {
        transform: translateY(-160px) translateZ(100px) scale(1.5) rotate(180deg);
        opacity: 0.8;
        filter: brightness(1.8) blur(1px);
    }
    75% {
        transform: translateY(-240px) translateZ(150px) scale(1.2) rotate(270deg);
        opacity: 0.4;
        filter: brightness(1.2) blur(1.5px);
    }
    100% {
        transform: translateY(-320px) translateZ(200px) scale(0.8) rotate(360deg);
        opacity: 0;
        filter: brightness(0.5) blur(2px);
    }
}

@-webkit-keyframes particle-enhanced {
    0% {
        -webkit-transform: translateY(0) translateZ(0) scale(0.5) rotate(0deg);
        opacity: 1;
        -webkit-filter: brightness(1.5) blur(0px);
    }
    25% {
        -webkit-transform: translateY(-80px) translateZ(50px) scale(1.2) rotate(90deg);
        opacity: 1;
        -webkit-filter: brightness(2) blur(0.5px);
    }
    50% {
        -webkit-transform: translateY(-160px) translateZ(100px) scale(1.5) rotate(180deg);
        opacity: 0.8;
        -webkit-filter: brightness(1.8) blur(1px);
    }
    75% {
        -webkit-transform: translateY(-240px) translateZ(150px) scale(1.2) rotate(270deg);
        opacity: 0.4;
        -webkit-filter: brightness(1.2) blur(1.5px);
    }
    100% {
        -webkit-transform: translateY(-320px) translateZ(200px) scale(0.8) rotate(360deg);
        opacity: 0;
        -webkit-filter: brightness(0.5) blur(2px);
    }
}

@keyframes particle-rotate {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

@-webkit-keyframes particle-rotate {
    from { -webkit-transform: rotate(0deg); }
    to { -webkit-transform: rotate(360deg); }
}

/* Enhanced Star Burst Effect with 3D & Glow */
.starburst-container {
    position: fixed;
    top: 50%;
    left: 50%;
    width: 400px;
    height: 400px;
    transform: translate(-50%, -50%);
    pointer-events: none;
    z-index: 9999;
    perspective: 1000px;
    -webkit-perspective: 1000px;
}

.star {
    position: absolute;
    width: 12px;
    height: 12px;
    background: linear-gradient(45deg, #ffd700, #ffed4e, #fff59d);
    clip-path: polygon(50% 0%, 61% 35%, 98% 35%, 68% 57%, 79% 91%, 50% 70%, 21% 91%, 32% 57%, 2% 35%, 39% 35%);
    animation: star-burst-enhanced 2s cubic-bezier(0.25, 0.46, 0.45, 0.94) forwards;
    -webkit-animation: star-burst-enhanced 2s cubic-bezier(0.25, 0.46, 0.45, 0.94) forwards;
    box-shadow: 
        0 0 8px currentColor,
        0 0 16px rgba(255, 215, 0, 0.6),
        0 0 24px rgba(255, 215, 0, 0.3);
    filter: drop-shadow(0 0 4px rgba(255, 215, 0, 0.8));
    -webkit-filter: drop-shadow(0 0 4px rgba(255, 215, 0, 0.8));
}

.star::before {
    content: '';
    position: absolute;
    top: -2px;
    left: -2px;
    right: -2px;
    bottom: -2px;
    background: conic-gradient(from 0deg, transparent, rgba(255, 215, 0, 0.3), transparent);
    clip-path: polygon(50% 0%, 61% 35%, 98% 35%, 68% 57%, 79% 91%, 50% 70%, 21% 91%, 32% 57%, 2% 35%, 39% 35%);
    z-index: -1;
    animation: star-glow-rotate 1s linear infinite;
    -webkit-animation: star-glow-rotate 1s linear infinite;
}

@keyframes star-burst-enhanced {
    0% {
        transform: scale(0) rotate(0deg) translateZ(0);
        opacity: 1;
        filter: brightness(2) saturate(1.5);
    }
    25% {
        transform: scale(0.8) rotate(90deg) translateZ(50px);
        opacity: 1;
        filter: brightness(2.5) saturate(2);
    }
    50% {
        transform: scale(1.5) rotate(180deg) translateZ(100px);
        opacity: 0.9;
        filter: brightness(2) saturate(1.8);
    }
    75% {
        transform: scale(2) rotate(270deg) translateZ(150px);
        opacity: 0.5;
        filter: brightness(1.5) saturate(1.2);
    }
    100% {
        transform: scale(3) rotate(360deg) translateZ(200px);
        opacity: 0;
        filter: brightness(1) saturate(0.8);
    }
}

@-webkit-keyframes star-burst-enhanced {
    0% {
        -webkit-transform: scale(0) rotate(0deg) translateZ(0);
        opacity: 1;
        -webkit-filter: brightness(2) saturate(1.5);
    }
    25% {
        -webkit-transform: scale(0.8) rotate(90deg) translateZ(50px);
        opacity: 1;
        -webkit-filter: brightness(2.5) saturate(2);
    }
    50% {
        -webkit-transform: scale(1.5) rotate(180deg) translateZ(100px);
        opacity: 0.9;
        -webkit-filter: brightness(2) saturate(1.8);
    }
    75% {
        -webkit-transform: scale(2) rotate(270deg) translateZ(150px);
        opacity: 0.5;
        -webkit-filter: brightness(1.5) saturate(1.2);
    }
    100% {
        -webkit-transform: scale(3) rotate(360deg) translateZ(200px);
        opacity: 0;
        -webkit-filter: brightness(1) saturate(0.8);
    }
}

@keyframes star-glow-rotate {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

@-webkit-keyframes star-glow-rotate {
    from { -webkit-transform: rotate(0deg); }
    to { -webkit-transform: rotate(360deg); }
}

/* Enhanced Lightning Effect with Realistic Bolts */
.lightning-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 9997;
    background: radial-gradient(circle at center, rgba(135, 206, 250, 0.2) 0%, rgba(255, 255, 255, 0.1) 40%, transparent 70%);
    animation: lightning-flash-enhanced 1.2s ease-out;
    -webkit-animation: lightning-flash-enhanced 1.2s ease-out;
}

.lightning-bolt {
    position: absolute;
    width: 6px;
    background: linear-gradient(to bottom, 
        rgba(255, 255, 255, 1) 0%,
        rgba(135, 206, 250, 0.9) 20%,
        rgba(65, 105, 225, 0.8) 50%,
        rgba(25, 25, 112, 0.6) 80%,
        transparent 100%);
    transform-origin: top center;
    animation: lightning-strike-enhanced 0.8s cubic-bezier(0.25, 0.46, 0.45, 0.94) forwards;
    -webkit-animation: lightning-strike-enhanced 0.8s cubic-bezier(0.25, 0.46, 0.45, 0.94) forwards;
    box-shadow: 
        0 0 8px rgba(135, 206, 250, 0.8),
        0 0 16px rgba(65, 105, 225, 0.6),
        0 0 24px rgba(25, 25, 112, 0.4);
    filter: drop-shadow(0 0 6px rgba(255, 255, 255, 0.8));
    -webkit-filter: drop-shadow(0 0 6px rgba(255, 255, 255, 0.8));
}

.lightning-bolt::before {
    content: '';
    position: absolute;
    top: 0;
    left: -2px;
    width: 10px;
    height: 100%;
    background: linear-gradient(to right,
        transparent 0%,
        rgba(255, 255, 255, 0.3) 20%,
        rgba(135, 206, 250, 0.5) 50%,
        rgba(255, 255, 255, 0.3) 80%,
        transparent 100%);
    animation: lightning-glow 0.1s ease-in-out infinite alternate;
    -webkit-animation: lightning-glow 0.1s ease-in-out infinite alternate;
}

.lightning-bolt::after {
    content: '';
    position: absolute;
    top: 0;
    left: 50%;
    width: 2px;
    height: 100%;
    background: rgba(255, 255, 255, 0.9);
    transform: translateX(-50%);
    -webkit-transform: translateX(-50%);
}

@keyframes lightning-flash-enhanced {
    0%, 15%, 35%, 55%, 75%, 100% { 
        opacity: 0; 
        background: radial-gradient(circle at center, rgba(135, 206, 250, 0.1) 0%, transparent 70%);
    }
    5%, 25%, 45%, 65%, 85% { 
        opacity: 1; 
        background: radial-gradient(circle at center, rgba(255, 255, 255, 0.3) 0%, rgba(135, 206, 250, 0.2) 40%, transparent 70%);
    }
}

@-webkit-keyframes lightning-flash-enhanced {
    0%, 15%, 35%, 55%, 75%, 100% { 
        opacity: 0; 
        background: -webkit-radial-gradient(circle at center, rgba(135, 206, 250, 0.1) 0%, transparent 70%);
    }
    5%, 25%, 45%, 65%, 85% { 
        opacity: 1; 
        background: -webkit-radial-gradient(circle at center, rgba(255, 255, 255, 0.3) 0%, rgba(135, 206, 250, 0.2) 40%, transparent 70%);
    }
}

@keyframes lightning-strike-enhanced {
    0% {
        height: 0px;
        opacity: 1;
        transform: scaleY(0) scaleX(1);
        filter: brightness(3) blur(0px);
    }
    20% {
        height: 150px;
        opacity: 1;
        transform: scaleY(0.3) scaleX(1.2);
        filter: brightness(2.5) blur(0.5px);
    }
    40% {
        height: 300px;
        opacity: 0.9;
        transform: scaleY(0.7) scaleX(1.5);
        filter: brightness(2) blur(1px);
    }
    70% {
        height: 450px;
        opacity: 0.6;
        transform: scaleY(1) scaleX(1.2);
        filter: brightness(1.5) blur(1.5px);
    }
    100% {
        height: 600px;
        opacity: 0;
        transform: scaleY(1.2) scaleX(0.8);
        filter: brightness(1) blur(2px);
    }
}

@-webkit-keyframes lightning-strike-enhanced {
    0% {
        height: 0px;
        opacity: 1;
        -webkit-transform: scaleY(0) scaleX(1);
        -webkit-filter: brightness(3) blur(0px);
    }
    20% {
        height: 150px;
        opacity: 1;
        -webkit-transform: scaleY(0.3) scaleX(1.2);
        -webkit-filter: brightness(2.5) blur(0.5px);
    }
    40% {
        height: 300px;
        opacity: 0.9;
        -webkit-transform: scaleY(0.7) scaleX(1.5);
        -webkit-filter: brightness(2) blur(1px);
    }
    70% {
        height: 450px;
        opacity: 0.6;
        -webkit-transform: scaleY(1) scaleX(1.2);
        -webkit-filter: brightness(1.5) blur(1.5px);
    }
    100% {
        height: 600px;
        opacity: 0;
        -webkit-transform: scaleY(1.2) scaleX(0.8);
        -webkit-filter: brightness(1) blur(2px);
    }
}

@keyframes lightning-glow {
    0% { opacity: 0.6; }
    100% { opacity: 1; }
}

@-webkit-keyframes lightning-glow {
    0% { opacity: 0.6; }
    100% { opacity: 1; }
}

/* Enhanced Ripple Effect with 3D Waves */
.ripple-container {
    position: fixed;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    transform: translate(-50%, -50%);
    pointer-events: none;
    z-index: 9996;
    perspective: 1000px;
    -webkit-perspective: 1000px;
}

.ripple {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 40px;
    height: 40px;
    border: 3px solid transparent;
    border-radius: 50%;
    transform: translate(-50%, -50%) scale(0) rotateX(0deg);
    -webkit-transform: translate(-50%, -50%) scale(0) rotateX(0deg);
    animation: ripple-expand-enhanced 2s cubic-bezier(0.25, 0.46, 0.45, 0.94) forwards;
    -webkit-animation: ripple-expand-enhanced 2s cubic-bezier(0.25, 0.46, 0.45, 0.94) forwards;
    background: radial-gradient(circle at center, 
        transparent 60%, 
        rgba(79, 195, 247, 0.3) 70%, 
        rgba(79, 195, 247, 0.6) 80%, 
        rgba(79, 195, 247, 0.3) 90%, 
        transparent 100%);
    box-shadow: 
        0 0 0 1px rgba(79, 195, 247, 0.4),
        0 0 20px rgba(79, 195, 247, 0.3),
        inset 0 0 20px rgba(255, 255, 255, 0.1);
}

.ripple::before {
    content: '';
    position: absolute;
    top: -3px;
    left: -3px;
    right: -3px;
    bottom: -3px;
    border: 2px solid rgba(79, 195, 247, 0.6);
    border-radius: 50%;
    animation: ripple-inner-glow 2s ease-out forwards;
    -webkit-animation: ripple-inner-glow 2s ease-out forwards;
}

.ripple::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 8px;
    height: 8px;
    background: radial-gradient(circle, rgba(255, 255, 255, 0.9), rgba(79, 195, 247, 0.6));
    border-radius: 50%;
    transform: translate(-50%, -50%);
    -webkit-transform: translate(-50%, -50%);
    animation: ripple-center-pulse 2s ease-out forwards;
    -webkit-animation: ripple-center-pulse 2s ease-out forwards;
}

@keyframes ripple-expand-enhanced {
    0% {
        transform: translate(-50%, -50%) scale(0) rotateX(0deg);
        opacity: 1;
        filter: brightness(2) blur(0px);
    }
    25% {
        transform: translate(-50%, -50%) scale(5) rotateX(15deg);
        opacity: 0.9;
        filter: brightness(1.8) blur(0.5px);
    }
    50% {
        transform: translate(-50%, -50%) scale(12) rotateX(30deg);
        opacity: 0.7;
        filter: brightness(1.5) blur(1px);
    }
    75% {
        transform: translate(-50%, -50%) scale(18) rotateX(45deg);
        opacity: 0.4;
        filter: brightness(1.2) blur(1.5px);
    }
    100% {
        transform: translate(-50%, -50%) scale(25) rotateX(60deg);
        opacity: 0;
        filter: brightness(1) blur(2px);
    }
}

@-webkit-keyframes ripple-expand-enhanced {
    0% {
        -webkit-transform: translate(-50%, -50%) scale(0) rotateX(0deg);
        opacity: 1;
        -webkit-filter: brightness(2) blur(0px);
    }
    25% {
        -webkit-transform: translate(-50%, -50%) scale(5) rotateX(15deg);
        opacity: 0.9;
        -webkit-filter: brightness(1.8) blur(0.5px);
    }
    50% {
        -webkit-transform: translate(-50%, -50%) scale(12) rotateX(30deg);
        opacity: 0.7;
        -webkit-filter: brightness(1.5) blur(1px);
    }
    75% {
        -webkit-transform: translate(-50%, -50%) scale(18) rotateX(45deg);
        opacity: 0.4;
        -webkit-filter: brightness(1.2) blur(1.5px);
    }
    100% {
        -webkit-transform: translate(-50%, -50%) scale(25) rotateX(60deg);
        opacity: 0;
        -webkit-filter: brightness(1) blur(2px);
    }
}

@keyframes ripple-inner-glow {
    0% { opacity: 1; transform: scale(0.8); }
    50% { opacity: 0.8; transform: scale(1.2); }
    100% { opacity: 0; transform: scale(2); }
}

@-webkit-keyframes ripple-inner-glow {
    0% { opacity: 1; -webkit-transform: scale(0.8); }
    50% { opacity: 0.8; -webkit-transform: scale(1.2); }
    100% { opacity: 0; -webkit-transform: scale(2); }
}

@keyframes ripple-center-pulse {
    0% { opacity: 1; transform: translate(-50%, -50%) scale(1); }
    50% { opacity: 0.8; transform: translate(-50%, -50%) scale(0.5); }
    100% { opacity: 0; transform: translate(-50%, -50%) scale(0); }
}

@-webkit-keyframes ripple-center-pulse {
    0% { opacity: 1; -webkit-transform: translate(-50%, -50%) scale(1); }
    50% { opacity: 0.8; -webkit-transform: translate(-50%, -50%) scale(0.5); }
    100% { opacity: 0; -webkit-transform: translate(-50%, -50%) scale(0); }
}

/* Enhanced Spiral Effect with Galaxy Theme */
.spiral-container {
    position: fixed;
    top: 50%;
    left: 50%;
    width: 400px;
    height: 400px;
    transform: translate(-50%, -50%);
    pointer-events: none;
    z-index: 9995;
    perspective: 1000px;
    -webkit-perspective: 1000px;
}

.spiral-dot {
    position: absolute;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: radial-gradient(circle at 30% 30%, 
        rgba(255, 255, 255, 0.9), 
        rgba(255, 107, 107, 0.8), 
        rgba(78, 205, 196, 0.6));
    animation: spiral-rotate-enhanced 3s cubic-bezier(0.25, 0.46, 0.45, 0.94) forwards;
    -webkit-animation: spiral-rotate-enhanced 3s cubic-bezier(0.25, 0.46, 0.45, 0.94) forwards;
    box-shadow: 
        0 0 8px currentColor,
        0 0 16px rgba(255, 107, 107, 0.4),
        0 0 24px rgba(78, 205, 196, 0.3);
    filter: drop-shadow(0 0 4px rgba(255, 255, 255, 0.6));
    -webkit-filter: drop-shadow(0 0 4px rgba(255, 255, 255, 0.6));
}

.spiral-dot::before {
    content: '';
    position: absolute;
    top: -2px;
    left: -2px;
    right: -2px;
    bottom: -2px;
    border-radius: 50%;
    background: conic-gradient(from 0deg, 
        transparent, 
        rgba(255, 107, 107, 0.3), 
        rgba(78, 205, 196, 0.3), 
        transparent);
    z-index: -1;
    animation: spiral-glow-rotate 1.5s linear infinite;
    -webkit-animation: spiral-glow-rotate 1.5s linear infinite;
}

.spiral-dot::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 4px;
    height: 4px;
    background: rgba(255, 255, 255, 0.9);
    border-radius: 50%;
    transform: translate(-50%, -50%);
    -webkit-transform: translate(-50%, -50%);
    animation: spiral-center-twinkle 0.8s ease-in-out infinite alternate;
    -webkit-animation: spiral-center-twinkle 0.8s ease-in-out infinite alternate;
}

@keyframes spiral-rotate-enhanced {
    0% {
        transform: rotate(0deg) translateX(30px) rotate(0deg) scale(0.5) translateZ(0);
        opacity: 1;
        filter: brightness(2) saturate(1.5);
    }
    25% {
        transform: rotate(180deg) translateX(80px) rotate(-180deg) scale(1.2) translateZ(50px);
        opacity: 1;
        filter: brightness(1.8) saturate(1.3);
    }
    50% {
        transform: rotate(360deg) translateX(130px) rotate(-360deg) scale(1.5) translateZ(100px);
        opacity: 0.8;
        filter: brightness(1.5) saturate(1.1);
    }
    75% {
        transform: rotate(540deg) translateX(180px) rotate(-540deg) scale(1.2) translateZ(150px);
        opacity: 0.4;
        filter: brightness(1.2) saturate(0.9);
    }
    100% {
        transform: rotate(720deg) translateX(220px) rotate(-720deg) scale(0.3) translateZ(200px);
        opacity: 0;
        filter: brightness(1) saturate(0.7);
    }
}

@-webkit-keyframes spiral-rotate-enhanced {
    0% {
        -webkit-transform: rotate(0deg) translateX(30px) rotate(0deg) scale(0.5) translateZ(0);
        opacity: 1;
        -webkit-filter: brightness(2) saturate(1.5);
    }
    25% {
        -webkit-transform: rotate(180deg) translateX(80px) rotate(-180deg) scale(1.2) translateZ(50px);
        opacity: 1;
        -webkit-filter: brightness(1.8) saturate(1.3);
    }
    50% {
        -webkit-transform: rotate(360deg) translateX(130px) rotate(-360deg) scale(1.5) translateZ(100px);
        opacity: 0.8;
        -webkit-filter: brightness(1.5) saturate(1.1);
    }
    75% {
        -webkit-transform: rotate(540deg) translateX(180px) rotate(-540deg) scale(1.2) translateZ(150px);
        opacity: 0.4;
        -webkit-filter: brightness(1.2) saturate(0.9);
    }
    100% {
        -webkit-transform: rotate(720deg) translateX(220px) rotate(-720deg) scale(0.3) translateZ(200px);
        opacity: 0;
        -webkit-filter: brightness(1) saturate(0.7);
    }
}

@keyframes spiral-glow-rotate {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

@-webkit-keyframes spiral-glow-rotate {
    from { -webkit-transform: rotate(0deg); }
    to { -webkit-transform: rotate(360deg); }
}

@keyframes spiral-center-twinkle {
    0% { opacity: 0.6; transform: translate(-50%, -50%) scale(0.8); }
    100% { opacity: 1; transform: translate(-50%, -50%) scale(1.2); }
}

@-webkit-keyframes spiral-center-twinkle {
    0% { opacity: 0.6; -webkit-transform: translate(-50%, -50%) scale(0.8); }
    100% { opacity: 1; -webkit-transform: translate(-50%, -50%) scale(1.2); }
}

/* Enhanced Bubble Effect with Realistic Physics */
.bubble-container {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 9994;
    overflow: hidden;
    perspective: 1000px;
    -webkit-perspective: 1000px;
}

.bubble {
    position: absolute;
    bottom: -30px;
    border-radius: 50%;
    background: radial-gradient(circle at 30% 30%, 
        rgba(255, 255, 255, 0.9), 
        rgba(135, 206, 250, 0.7), 
        rgba(0, 150, 255, 0.5));
    animation: bubble-rise-enhanced 4s cubic-bezier(0.25, 0.46, 0.45, 0.94) forwards;
    -webkit-animation: bubble-rise-enhanced 4s cubic-bezier(0.25, 0.46, 0.45, 0.94) forwards;
    box-shadow: 
        inset -5px -5px 10px rgba(255, 255, 255, 0.6),
        inset 5px 5px 10px rgba(0, 150, 255, 0.3),
        0 0 15px rgba(135, 206, 250, 0.5);
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.1));
    -webkit-filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.1));
}

.bubble::before {
    content: '';
    position: absolute;
    top: 15%;
    left: 25%;
    width: 30%;
    height: 30%;
    background: radial-gradient(circle, rgba(255, 255, 255, 0.8), transparent);
    border-radius: 50%;
    animation: bubble-shimmer 2s ease-in-out infinite alternate;
    -webkit-animation: bubble-shimmer 2s ease-in-out infinite alternate;
}

.bubble::after {
    content: '';
    position: absolute;
    top: 60%;
    right: 20%;
    width: 15%;
    height: 15%;
    background: radial-gradient(circle, rgba(255, 255, 255, 0.6), transparent);
    border-radius: 50%;
    animation: bubble-highlight 1.5s ease-in-out infinite alternate;
    -webkit-animation: bubble-highlight 1.5s ease-in-out infinite alternate;
}

@keyframes bubble-rise-enhanced {
    0% {
        transform: translateY(0) translateX(0) scale(0.3) rotate(0deg) rotateY(0deg);
        opacity: 0.8;
        filter: brightness(1.2) blur(0px);
    }
    25% {
        transform: translateY(-25vh) translateX(20px) scale(0.8) rotate(90deg) rotateY(90deg);
        opacity: 1;
        filter: brightness(1.1) blur(0.5px);
    }
    50% {
        transform: translateY(-50vh) translateX(-15px) scale(1.2) rotate(180deg) rotateY(180deg);
        opacity: 1;
        filter: brightness(1) blur(1px);
    }
    75% {
        transform: translateY(-75vh) translateX(30px) scale(1) rotate(270deg) rotateY(270deg);
        opacity: 0.6;
        filter: brightness(0.9) blur(1.5px);
    }
    100% {
        transform: translateY(-110vh) translateX(-10px) scale(0.6) rotate(360deg) rotateY(360deg);
        opacity: 0;
        filter: brightness(0.8) blur(2px);
    }
}

@-webkit-keyframes bubble-rise-enhanced {
    0% {
        -webkit-transform: translateY(0) translateX(0) scale(0.3) rotate(0deg) rotateY(0deg);
        opacity: 0.8;
        -webkit-filter: brightness(1.2) blur(0px);
    }
    25% {
        -webkit-transform: translateY(-25vh) translateX(20px) scale(0.8) rotate(90deg) rotateY(90deg);
        opacity: 1;
        -webkit-filter: brightness(1.1) blur(0.5px);
    }
    50% {
        -webkit-transform: translateY(-50vh) translateX(-15px) scale(1.2) rotate(180deg) rotateY(180deg);
        opacity: 1;
        -webkit-filter: brightness(1) blur(1px);
    }
    75% {
        -webkit-transform: translateY(-75vh) translateX(30px) scale(1) rotate(270deg) rotateY(270deg);
        opacity: 0.6;
        -webkit-filter: brightness(0.9) blur(1.5px);
    }
    100% {
        -webkit-transform: translateY(-110vh) translateX(-10px) scale(0.6) rotate(360deg) rotateY(360deg);
        opacity: 0;
        -webkit-filter: brightness(0.8) blur(2px);
    }
}

@keyframes bubble-shimmer {
    0% { opacity: 0.6; transform: scale(0.8); }
    100% { opacity: 0.9; transform: scale(1.2); }
}

@-webkit-keyframes bubble-shimmer {
    0% { opacity: 0.6; -webkit-transform: scale(0.8); }
    100% { opacity: 0.9; -webkit-transform: scale(1.2); }
}

@keyframes bubble-highlight {
    0% { opacity: 0.4; }
    100% { opacity: 0.8; }
}

@-webkit-keyframes bubble-highlight {
    0% { opacity: 0.4; }
    100% { opacity: 0.8; }
}

/* Enhanced Screen Flash Effect with Multiple Layers */
.screen-flash {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: 
        radial-gradient(circle at 30% 40%, rgba(255, 215, 0, 0.4) 0%, transparent 50%),
        radial-gradient(circle at 70% 60%, rgba(255, 255, 255, 0.6) 0%, transparent 40%),
        radial-gradient(circle at center, rgba(255, 255, 255, 0.8) 0%, rgba(255, 255, 255, 0.3) 30%, transparent 70%);
    pointer-events: none;
    z-index: 9993;
    animation: screen-flash-enhanced 0.8s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    -webkit-animation: screen-flash-enhanced 0.8s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.screen-flash::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: conic-gradient(from 0deg, 
        transparent, 
        rgba(255, 215, 0, 0.2), 
        rgba(255, 255, 255, 0.3), 
        rgba(255, 215, 0, 0.2), 
        transparent);
    animation: screen-flash-rotate 0.8s linear;
    -webkit-animation: screen-flash-rotate 0.8s linear;
}

@keyframes screen-flash-effect {
    0% { opacity: 0; }
    50% { opacity: 1; }
    100% { opacity: 0; }
}

@-webkit-keyframes screen-flash-effect {
    0% { opacity: 0; }
    50% { opacity: 1; }
    100% { opacity: 0; }
}

@keyframes screen-flash-enhanced {
    0% { 
        opacity: 0; 
        transform: scale(0.8);
        filter: brightness(1);
    }
    20% { 
        opacity: 0.8; 
        transform: scale(1.1);
        filter: brightness(2);
    }
    40% { 
        opacity: 0.4; 
        transform: scale(1.05);
        filter: brightness(1.5);
    }
    60% { 
        opacity: 0.7; 
        transform: scale(1.08);
        filter: brightness(1.8);
    }
    80% { 
        opacity: 0.3; 
        transform: scale(1.02);
        filter: brightness(1.2);
    }
    100% { 
        opacity: 0; 
        transform: scale(1);
        filter: brightness(1);
    }
}

@-webkit-keyframes screen-flash-enhanced {
    0% { 
        opacity: 0; 
        -webkit-transform: scale(0.8);
        -webkit-filter: brightness(1);
    }
    20% { 
        opacity: 0.8; 
        -webkit-transform: scale(1.1);
        -webkit-filter: brightness(2);
    }
    40% { 
        opacity: 0.4; 
        -webkit-transform: scale(1.05);
        -webkit-filter: brightness(1.5);
    }
    60% { 
        opacity: 0.7; 
        -webkit-transform: scale(1.08);
        -webkit-filter: brightness(1.8);
    }
    80% { 
        opacity: 0.3; 
        -webkit-transform: scale(1.02);
        -webkit-filter: brightness(1.2);
    }
    100% { 
        opacity: 0; 
        -webkit-transform: scale(1);
        -webkit-filter: brightness(1);
    }
}

@keyframes screen-flash-rotate {
    from { transform: rotate(0deg); opacity: 0.8; }
    to { transform: rotate(360deg); opacity: 0; }
}

@-webkit-keyframes screen-flash-rotate {
    from { -webkit-transform: rotate(0deg); opacity: 0.8; }
    to { -webkit-transform: rotate(360deg); opacity: 0; }
}

/* Wheel Vibration Effect */
.wheel-vibrate {
    animation: wheel-vibration 0.3s ease-in-out;
    -webkit-animation: wheel-vibration 0.3s ease-in-out;
}

@keyframes wheel-vibration {
    0%, 100% { transform: translate(0, 0) rotate(0deg); }
    10% { transform: translate(-2px, -1px) rotate(-1deg); }
    20% { transform: translate(2px, 1px) rotate(1deg); }
    30% { transform: translate(-1px, 2px) rotate(-1deg); }
    40% { transform: translate(1px, -2px) rotate(1deg); }
    50% { transform: translate(-2px, 1px) rotate(-1deg); }
    60% { transform: translate(2px, -1px) rotate(1deg); }
    70% { transform: translate(-1px, -2px) rotate(-1deg); }
    80% { transform: translate(1px, 2px) rotate(1deg); }
    90% { transform: translate(-2px, -1px) rotate(-1deg); }
}

@-webkit-keyframes wheel-vibration {
    0%, 100% { -webkit-transform: translate(0, 0) rotate(0deg); }
    10% { -webkit-transform: translate(-2px, -1px) rotate(-1deg); }
    20% { -webkit-transform: translate(2px, 1px) rotate(1deg); }
    30% { -webkit-transform: translate(-1px, 2px) rotate(-1deg); }
    40% { -webkit-transform: translate(1px, -2px) rotate(1deg); }
    50% { -webkit-transform: translate(-2px, 1px) rotate(-1deg); }
    60% { -webkit-transform: translate(2px, -1px) rotate(1deg); }
    70% { -webkit-transform: translate(-1px, -2px) rotate(-1deg); }
    80% { -webkit-transform: translate(1px, 2px) rotate(1deg); }
    90% { -webkit-transform: translate(-2px, -1px) rotate(-1deg); }
}

/* Mobile Optimizations */
@media (max-width: 768px) {
    .particle {
        width: 3px;
        height: 3px;
    }
    
    .star {
        width: 4px;
        height: 4px;
    }
    
    .spiral-dot {
        width: 6px;
        height: 6px;
    }
    
    .bubble {
        width: 15px;
        height: 15px;
    }
    
    .lightning-bolt {
        width: 3px;
    }
    
    /* Reduce animation complexity on mobile */
    @keyframes particle-float {
        0% { transform: translateY(0) scale(1); opacity: 1; }
        100% { transform: translateY(-150px) scale(0.8); opacity: 0; }
    }
    
    @-webkit-keyframes particle-float {
        0% { -webkit-transform: translateY(0) scale(1); opacity: 1; }
        100% { -webkit-transform: translateY(-150px) scale(0.8); opacity: 0; }
    }
}

/* Enhanced screen flash animations */
@keyframes screen-flash-gold {
    0% {
        opacity: 0;
        transform: scale(0.8) rotate(0deg);
        filter: brightness(1) saturate(1);
    }
    20% {
        opacity: 0.95;
        transform: scale(1.1) rotate(2deg);
        filter: brightness(1.8) saturate(1.6);
    }
    40% {
        opacity: 0.8;
        transform: scale(1.05) rotate(-1deg);
        filter: brightness(1.5) saturate(1.4);
    }
    60% {
        opacity: 0.6;  
        transform: scale(1.02) rotate(1deg);
        filter: brightness(1.2) saturate(1.2);
    }
    100% {
        opacity: 0;
        transform: scale(1) rotate(0deg);
        filter: brightness(1) saturate(1);
    }
}

@keyframes screen-flash-diamond {
    0% {
        opacity: 0;
        transform: scale(0.9);
        filter: brightness(1) blur(0px);
    }
    15% {
        opacity: 1;
        transform: scale(1.15);
        filter: brightness(2.5) blur(1px);
    }
    35% {
        opacity: 0.9;
        transform: scale(1.08);
        filter: brightness(2) blur(0.5px);
    }
    55% {
        opacity: 0.7;
        transform: scale(1.03);
        filter: brightness(1.5) blur(0px);
    }
    100% {
        opacity: 0;
        transform: scale(1);
        filter: brightness(1) blur(0px);
    }
}

@keyframes screen-flash-aurora {
    0% {
        opacity: 0;
        transform: scale(0.7) rotateZ(0deg);
        filter: brightness(1) saturate(1) hue-rotate(0deg);
    }
    25% {
        opacity: 0.9;
        transform: scale(1.2) rotateZ(5deg);
        filter: brightness(1.6) saturate(1.8) hue-rotate(30deg);
    }
    50% {
        opacity: 0.7;
        transform: scale(1.1) rotateZ(-3deg);
        filter: brightness(1.4) saturate(1.6) hue-rotate(60deg);
    }
    75% {
        opacity: 0.5;
        transform: scale(1.05) rotateZ(2deg);
        filter: brightness(1.2) saturate(1.3) hue-rotate(90deg);
    }
    100% {
        opacity: 0;
        transform: scale(1) rotateZ(0deg);
        filter: brightness(1) saturate(1) hue-rotate(120deg);
    }
}

@keyframes screen-flash-rainbow {
    0% {
        opacity: 0;
        transform: scale(0.6) rotate(0deg);
        filter: brightness(1) saturate(1);
    }
    20% {
        opacity: 0.85;
        transform: scale(1.3) rotate(90deg);
        filter: brightness(1.4) saturate(2);
    }
    40% {
        opacity: 0.75;
        transform: scale(1.15) rotate(180deg);
        filter: brightness(1.3) saturate(1.8);
    }
    60% {
        opacity: 0.6;
        transform: scale(1.08) rotate(270deg);
        filter: brightness(1.15) saturate(1.5);
    }
    100% {
        opacity: 0;
        transform: scale(1) rotate(360deg);
        filter: brightness(1) saturate(1);
    }
}

/* Enhanced bubble classes */
.bubble-large {
    animation: bubble-rise-large var(--rise-speed, 4s) ease-out forwards !important;
    -webkit-animation: bubble-rise-large var(--rise-speed, 4s) ease-out forwards !important;
}

.bubble-medium {
    animation: bubble-rise-medium var(--rise-speed, 4.5s) ease-out forwards !important;    
    -webkit-animation: bubble-rise-medium var(--rise-speed, 4.5s) ease-out forwards !important;
}

.bubble-small {
    animation: bubble-rise-small var(--rise-speed, 5s) ease-out forwards !important;
    -webkit-animation: bubble-rise-small var(--rise-speed, 5s) ease-out forwards !important;
}

@keyframes bubble-rise-large {
    0% {
        bottom: -50px;
        opacity: 0;
        transform: translateX(0) scale(0.8) rotateZ(0deg);
    }
    10% {
        opacity: 0.8;
        transform: translateX(0) scale(1) rotateZ(5deg);
    }
    25% {
        transform: translateX(calc(var(--drift-x, 0px) * 0.3)) scale(1.1) rotateZ(-3deg);
    }
    50% {
        transform: translateX(calc(var(--drift-x, 0px) * 0.7)) scale(1.05) rotateZ(8deg);
    }
    75% {
        transform: translateX(var(--drift-x, 0px)) scale(0.95) rotateZ(-5deg);
    }
    90% {
        opacity: 0.6;
        transform: translateX(var(--drift-x, 0px)) scale(0.8) rotateZ(3deg);
    }
    100% {
        bottom: 100vh;
        opacity: 0;
        transform: translateX(var(--drift-x, 0px)) scale(0.5) rotateZ(0deg);
    }
}

@keyframes bubble-rise-medium {
    0% {
        bottom: -30px;
        opacity: 0;
        transform: translateX(0) scale(0.7) rotateZ(0deg);
    }
    15% {
        opacity: 0.9;
        transform: translateX(0) scale(1) rotateZ(-8deg);
    }
    30% {
        transform: translateX(calc(var(--drift-x, 0px) * 0.4)) scale(1.08) rotateZ(12deg);
    }
    60% {
        transform: translateX(calc(var(--drift-x, 0px) * 0.8)) scale(1.02) rotateZ(-6deg);
    }
    85% {
        opacity: 0.4;
        transform: translateX(var(--drift-x, 0px)) scale(0.85) rotateZ(4deg);
    }
    100% {
        bottom: 100vh;
        opacity: 0;
        transform: translateX(var(--drift-x, 0px)) scale(0.3) rotateZ(0deg);
    }
}

@keyframes bubble-rise-small {
    0% {
        bottom: -20px;
        opacity: 0;
        transform: translateX(0) scale(0.6) rotateZ(0deg);
    }
    20% {
        opacity: 1;
        transform: translateX(0) scale(1) rotateZ(15deg);
    }
    40% {
        transform: translateX(calc(var(--drift-x, 0px) * 0.5)) scale(1.12) rotateZ(-10deg);
    }
    70% {
        transform: translateX(calc(var(--drift-x, 0px) * 0.9)) scale(1.05) rotateZ(8deg);
    }
    95% {
        opacity: 0.3;
        transform: translateX(var(--drift-x, 0px)) scale(0.9) rotateZ(-3deg);
    }
    100% {
        bottom: 100vh;
        opacity: 0;
        transform: translateX(var(--drift-x, 0px)) scale(0.2) rotateZ(0deg);
    }
}

/* Enhanced star classes */
.star-large {
    width: 16px !important;
    height: 16px !important;
    animation: star-burst-large 2.5s ease-out forwards !important;
    -webkit-animation: star-burst-large 2.5s ease-out forwards !important;
}

.star-medium {
    width: 12px !important;
    height: 12px !important;
    animation: star-burst-medium 2.8s ease-out forwards !important;
    -webkit-animation: star-burst-medium 2.8s ease-out forwards !important;
}

.star-small {
    width: 8px !important;
    height: 8px !important;
    animation: star-burst-small 3.2s ease-out forwards !important;
    -webkit-animation: star-burst-small 3.2s ease-out forwards !important;
}

@keyframes star-burst-large {
    0% {
        opacity: 0;
        transform: scale(0) rotate(0deg);
        filter: brightness(2) saturate(2);
    }
    20% {
        opacity: 1;
        transform: scale(1.5) rotate(90deg);
        filter: brightness(1.8) saturate(1.8);
    }
    50% {
        opacity: 0.9;
        transform: scale(1.2) rotate(180deg);
        filter: brightness(1.4) saturate(1.4);
    }
    100% {
        opacity: 0;
        transform: scale(0.3) rotate(360deg);
        filter: brightness(0.8) saturate(0.8);
    }
}

@keyframes star-burst-medium {
    0% {
        opacity: 0;
        transform: scale(0) rotate(0deg) translateZ(0);
        filter: brightness(1.8) saturate(1.8);
    }
    25% {
        opacity: 1;
        transform: scale(1.3) rotate(120deg) translateZ(20px);
        filter: brightness(1.6) saturate(1.6);
    }
    60% {
        opacity: 0.8;
        transform: scale(1) rotate(240deg) translateZ(40px);
        filter: brightness(1.2) saturate(1.2);
    }
    100% {
        opacity: 0;
        transform: scale(0.2) rotate(360deg) translateZ(60px);
        filter: brightness(0.6) saturate(0.6);
    }
}

@keyframes star-burst-small {
    0% {
        opacity: 0;
        transform: scale(0) rotate(0deg) translateY(0);
        filter: brightness(1.5) saturate(1.5);
    }
    30% {
        opacity: 1;
        transform: scale(1.1) rotate(180deg) translateY(-10px);
        filter: brightness(1.3) saturate(1.3);
    }
    70% {
        opacity: 0.7;
        transform: scale(0.9) rotate(270deg) translateY(-20px);
        filter: brightness(1.1) saturate(1.1);
    }
    100% {
        opacity: 0;
        transform: scale(0.1) rotate(360deg) translateY(-30px);
        filter: brightness(0.7) saturate(0.7);
    }
}

/* Enhanced particle animation keyframes */
@keyframes particle-enhanced {
    0% {
        opacity: 1;
        transform: translate3d(0, 0, 0) scale(0.8) rotateZ(0deg);
        box-shadow: 
            0 0 25px currentColor,
            0 0 50px rgba(255, 255, 255, 0.8),
            inset 0 0 20px rgba(255, 255, 255, 0.6);
        filter: brightness(1.2) saturate(1.5);
    }
    25% {
        opacity: 0.95;
        transform: translate3d(calc(var(--end-x) * 0.3), calc(var(--end-y) * 0.3), 30px) scale(1.3) rotateZ(90deg);
        box-shadow: 
            0 0 35px currentColor,
            0 0 70px rgba(255, 255, 255, 0.9),
            inset 0 0 25px rgba(255, 255, 255, 0.7);
        filter: brightness(1.4) saturate(1.8) hue-rotate(15deg);
    }
    50% {
        opacity: 0.9;
        transform: translate3d(calc(var(--end-x) * 0.6), calc(var(--end-y) * 0.6), 60px) scale(1.5) rotateZ(180deg);
        box-shadow: 
            0 0 40px currentColor,
            0 0 80px rgba(255, 255, 255, 0.7),
            inset 0 0 30px rgba(255, 255, 255, 0.5);
        filter: brightness(1.6) saturate(2) hue-rotate(30deg);
    }
    75% {
        opacity: 0.6;
        transform: translate3d(calc(var(--end-x) * 0.85), calc(var(--end-y) * 0.85), 90px) scale(1.1) rotateZ(270deg);
        box-shadow: 
            0 0 25px currentColor,
            0 0 50px rgba(255, 255, 255, 0.4),
            inset 0 0 15px rgba(255, 255, 255, 0.3);
        filter: brightness(1.2) saturate(1.2) hue-rotate(45deg);
    }
    100% {
        opacity: 0;
        transform: translate3d(var(--end-x), var(--end-y), 120px) scale(0.2) rotateZ(360deg);
        box-shadow: 
            0 0 10px currentColor,
            0 0 20px rgba(255, 255, 255, 0.2),
            inset 0 0 5px rgba(255, 255, 255, 0.1);
        filter: brightness(0.8) saturate(0.8) hue-rotate(60deg);
    }
}

@-webkit-keyframes particle-enhanced {
    0% {
        opacity: 1;
        -webkit-transform: translate3d(0, 0, 0) scale(0.8) rotateZ(0deg);
        -webkit-box-shadow: 
            0 0 25px currentColor,
            0 0 50px rgba(255, 255, 255, 0.8),
            inset 0 0 20px rgba(255, 255, 255, 0.6);
        -webkit-filter: brightness(1.2) saturate(1.5);
    }
    25% {
        opacity: 0.95;
        -webkit-transform: translate3d(calc(var(--end-x) * 0.3), calc(var(--end-y) * 0.3), 30px) scale(1.3) rotateZ(90deg);
        -webkit-box-shadow: 
            0 0 35px currentColor,
            0 0 70px rgba(255, 255, 255, 0.9),
            inset 0 0 25px rgba(255, 255, 255, 0.7);
        -webkit-filter: brightness(1.4) saturate(1.8) hue-rotate(15deg);
    }
    50% {
        opacity: 0.9;
        -webkit-transform: translate3d(calc(var(--end-x) * 0.6), calc(var(--end-y) * 0.6), 60px) scale(1.5) rotateZ(180deg);
        -webkit-box-shadow: 
            0 0 40px currentColor,
            0 0 80px rgba(255, 255, 255, 0.7),
            inset 0 0 30px rgba(255, 255, 255, 0.5);
        -webkit-filter: brightness(1.6) saturate(2) hue-rotate(30deg);
    }
    75% {
        opacity: 0.6;
        -webkit-transform: translate3d(calc(var(--end-x) * 0.85), calc(var(--end-y) * 0.85), 90px) scale(1.1) rotateZ(270deg);
        -webkit-box-shadow: 
            0 0 25px currentColor,
            0 0 50px rgba(255, 255, 255, 0.4),
            inset 0 0 15px rgba(255, 255, 255, 0.3);
        -webkit-filter: brightness(1.2) saturate(1.2) hue-rotate(45deg);
    }
    100% {
        opacity: 0;
        -webkit-transform: translate3d(var(--end-x), var(--end-y), 120px) scale(0.2) rotateZ(360deg);
        -webkit-box-shadow: 
            0 0 10px currentColor,
            0 0 20px rgba(255, 255, 255, 0.2),
            inset 0 0 5px rgba(255, 255, 255, 0.1);
        -webkit-filter: brightness(0.8) saturate(0.8) hue-rotate(60deg);
    }
}

/* Touch device optimizations */
@media (hover: none) and (pointer: coarse) {
    .wheel-container {
        -webkit-tap-highlight-color: transparent;
        touch-action: manipulation;
        padding: 15px;
    }
    
    #spin {
        -webkit-tap-highlight-color: transparent;
        touch-action: manipulation;
        user-select: none;
        -webkit-user-select: none;
        -webkit-touch-callout: none;
        min-width: 80px;
        min-height: 80px;
        font-size: 16px;
    }
    
    /* Optimize effects for touch devices */
    .particle, .star, .spiral-dot, .bubble {
        will-change: transform;
        transform: translateZ(0);
        -webkit-transform: translateZ(0);
    }
}

/* Safari-specific optimizations */
@supports (-webkit-appearance: none) {
    /* Force hardware acceleration on Safari */
    .wheel-container,
    #wheel,
    #spin,
    .particle-container,
    .starburst-container,
    .lightning-container,
    .ripple-container,
    .spiral-container,
    .bubble-container {
        -webkit-transform: translateZ(0);
        transform: translateZ(0);
        -webkit-backface-visibility: hidden;
        backface-visibility: hidden;
        -webkit-perspective: 1000px;
        perspective: 1000px;
    }
    
    /* Ensure Safari recognizes our custom keyframes */
    .particle {
        -webkit-animation-fill-mode: forwards;
        animation-fill-mode: forwards;
    }
    
    .star {
        -webkit-animation-fill-mode: forwards;
        animation-fill-mode: forwards;
    }
    
    .ripple {
        -webkit-animation-fill-mode: forwards;
        animation-fill-mode: forwards;
    }
    
    /* Fix Safari transform issues */
    #wheel {
        -webkit-transform-style: preserve-3d;
        transform-style: preserve-3d;
    }
}

/* High DPI display optimizations */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
    .particle, .star, .spiral-dot {
        border-radius: 50%;
        -webkit-border-radius: 50%;
    }
    
    .lightning-bolt {
        background: linear-gradient(to bottom, #ffffff, #4fc3f7, #29b6f6);
        -webkit-background: -webkit-linear-gradient(top, #ffffff, #4fc3f7, #29b6f6);
    }
}

/* Performance optimizations for older devices */
@media (max-width: 480px) {
    /* Reduce particle count and complexity on very small screens */
    .particle-container {
        overflow: hidden;
    }
    
    /* Simplify animations for performance */
    @keyframes particle-float {
        0% { transform: translateY(0) scale(1); opacity: 1; }
        100% { transform: translateY(-100px) scale(0.8); opacity: 0; }
    }
    
    @keyframes star-burst {
        0% { transform: scale(0); opacity: 1; }
        100% { transform: scale(1.5); opacity: 0; }
    }
    
    @keyframes spiral-rotate {
        0% { transform: rotate(0deg) translateX(10px); opacity: 1; }
        100% { transform: rotate(360deg) translateX(80px); opacity: 0; }
    }
}

/* Reduce motion for accessibility */
@media (prefers-reduced-motion: reduce) {
    .particle, .star, .spiral-dot, .bubble, .lightning-bolt, .ripple {
        animation-duration: 0.5s !important;
        -webkit-animation-duration: 0.5s !important;
    }
    
    .wheel-vibrate {
        animation: none !important;
        -webkit-animation: none !important;
    }
    
    .screen-flash {
        animation-duration: 0.2s !important;
        -webkit-animation-duration: 0.2s !important;
    }
}

/* Share Button Enhancements */
#shareBtn {
    position: relative;
    overflow: hidden;
}

#shareBtn::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;
}

#shareBtn:hover::before {
    left: 100%;
}

#shareBtn:hover {
    background: rgba(255, 255, 255, 1);
    transform: scale(1.1) rotate(5deg);
    box-shadow: 0 8px 25px rgba(34, 197, 94, 0.3);
}

/* Share Modal Animations */
#shareModal {
    animation: fadeIn 0.3s ease-out;
}

#shareModal > div {
    animation: slideUp 0.3s ease-out;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes slideUp {
    from { 
        opacity: 0;
        transform: translateY(30px) scale(0.9);
    }
    to { 
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* Social buttons hover effects */
#shareFacebook:hover { transform: translateY(-2px); box-shadow: 0 4px 15px rgba(59, 89, 152, 0.4); }
#shareTwitter:hover { transform: translateY(-2px); box-shadow: 0 4px 15px rgba(29, 161, 242, 0.4); }
#shareWhatsApp:hover { transform: translateY(-2px); box-shadow: 0 4px 15px rgba(37, 211, 102, 0.4); }
#shareTelegram:hover { transform: translateY(-2px); box-shadow: 0 4px 15px rgba(0, 136, 204, 0.4); }

/* QR Code container styling */
#qrCodeContainer {
    animation: slideDown 0.3s ease-out;
}

@keyframes slideDown {
    from { 
        opacity: 0;
        transform: translateY(-10px);
        max-height: 0;
    }
    to { 
        opacity: 1;
        transform: translateY(0);
        max-height: 300px;
    }
}

/* Copy success message */
#copySuccess {
    animation: pulseGreen 0.5s ease-out;
}

@keyframes pulseGreen {
    0%, 100% { opacity: 0; transform: scale(0.8); }
    50% { opacity: 1; transform: scale(1.05); }
}

/* Mobile responsiveness for share modal */
@media (max-width: 640px) {
    #shareModal > div {
        margin: 16px;
        max-width: calc(100% - 32px);
    }
    
    #shareBtn {
        right: 60px !important; /* Adjust position for mobile */
        padding: 10px !important;
    }
    
    #shareBtn i {
        font-size: 14px !important;
    }
}
