/* Background Elements */
.background-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    pointer-events: none;
    overflow: hidden;
}

.background-element {
    position: absolute;
    border-radius: 50%;
    background: linear-gradient(135deg, #333333 0%, #111111 100%);
    transition: transform 1.5s ease-in-out, opacity 1.5s ease-in-out, left 2s ease-in-out, top 2s ease-in-out;
    box-shadow: 0 0 20px rgba(0, 0, 0, 0.3);
    will-change: transform, opacity, left, top;
}

.background-element.active {
    opacity: 0.3;
    filter: blur(5px);
    transition: all 0.8s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

/* Mobile-specific enhancements for background elements */
@media (max-width: 768px) {
    .background-element {
        box-shadow: 0 0 25px rgba(100, 100, 100, 0.4);
        border: 1px solid rgba(80, 80, 80, 0.1);
    }
    
    .background-element.active {
        opacity: 0.4;
        filter: blur(3px);
    }
}

/* Special animations for rare messages */
@keyframes goldGlow {
    0% { box-shadow: 0 0 10px rgba(255, 215, 0, 0.5), 0 0 10px rgba(255, 215, 0, 0.5) inset; }
    50% { box-shadow: 0 0 30px 5px rgba(255, 215, 0, 0.8), 0 0 10px rgba(255, 215, 0, 0.6) inset; }
    100% { box-shadow: 0 0 10px rgba(255, 215, 0, 0.5), 0 0 10px rgba(255, 215, 0, 0.5) inset; }
}

@keyframes jackpotSpin {
    0% { transform: rotate(0deg) scale(1); }
    25% { transform: rotate(15deg) scale(1.05); }
    50% { transform: rotate(0deg) scale(1.1); }
    75% { transform: rotate(-15deg) scale(1.05); }
    100% { transform: rotate(0deg) scale(1); }
}

@keyframes starsAnimation {
    0% { opacity: 0; transform: translate(0, 0) rotate(0deg); }
    20% { opacity: 1; }
    100% { opacity: 0; transform: translate(var(--tx), var(--ty)) rotate(var(--r)); }
}

@keyframes imageReveal {
    0% {
        opacity: 0;
        transform: scale(0.9) rotate(-2deg);
        filter: blur(10px) brightness(1.5);
    }
    50% {
        opacity: 1;
        transform: scale(1.05) rotate(1deg);
        filter: blur(0px) brightness(1.2);
    }
    100% {
        opacity: 1;
        transform: scale(1) rotate(0);
        filter: blur(0) brightness(1);
    }
}

.gold-border {
    border: 3px solid gold;
    box-shadow: 0 0 15px 3px rgba(255, 215, 0, 0.7);
    animation: goldGlow 1.5s infinite;
    /* Fix for the gap - ensure no background shows through */
    background-color: transparent;
    overflow: hidden;
    /* Add base transition properties for smoother effect start */
    transition: border 2s ease, box-shadow 2s ease;
}

/* Improved smooth fadeout transition for the gold border */
.gold-border-fadeout {
    border: 3px solid rgba(255, 215, 0, 0) !important;
    box-shadow: 0 0 0 0 rgba(255, 215, 0, 0) !important;
    animation: none !important;
    transition: border-color 2s cubic-bezier(0.4, 0, 0.2, 1),
                box-shadow 2s cubic-bezier(0.4, 0, 0.2, 1) !important;
}

/* Make the photo take up all space in the container when gold border is active */
.gold-border .main-photo {
    border-radius: 9px; /* Slightly less than container's border radius */
    margin: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.jackpot-effect {
    animation: jackpotSpin 0.8s ease-in-out;
}

.celebration-star {
    position: absolute;
    width: 20px;
    height: 20px;
    background-image: url("data:image/svg+xml;charset=utf8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 51 48'%3E%3Cpath fill='gold' d='M25.5 0l6.2 17h18.3l-14.5 10.5 5.5 17-15.5-11-15.5 11 5.5-17L0 17h18.3z'/%3E%3C/svg%3E");
    background-size: contain;
    pointer-events: none;
    z-index: 10;
    opacity: 0;
}

.special-image-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 5;
    overflow: hidden;
    border-radius: 12px;
}

.special-image {
    max-height: 100%;
    max-width: 100%;
    object-fit: contain;
    opacity: 0;
}

.special-image.reveal {
    animation: imageReveal 1.5s cubic-bezier(0.26, 0.53, 0.74, 1.48) forwards;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: Arial, sans-serif;
    background-color: #000000;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    overflow: hidden; /* Prevent scrolling */
}

.container {
    width: 100%;
    height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
}

.photo-container {
    position: relative;
    overflow: hidden;
    margin: 0 auto;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
    transition: transform 0.3s ease;
    max-height: 85vh;
    max-width: 85vw;
    display: flex;
    justify-content: center;
    align-items: center;
    transform-origin: center top; /* Add transform origin to keep the top fixed */
    border-radius: 12px; /* Add rounded corners to the container */
}

.photo-container:hover {
    transform: none; /* Remove the conflicting transform scale */
}

.photo-container:hover .main-photo,
.photo-container.touched .main-photo {
    filter: brightness(85%);
    transform: scale(1.5);
    object-fit: cover;
    object-position: center 0%;
    transform-origin: center top;
}

.main-photo {
    max-height: 80vh;
    max-width: 80vw;
    object-fit: contain;
    transition: all 0.5s ease;
    transform-origin: center top; /* Add transform origin to keep the top fixed */
    border-radius: 12px; /* Add rounded corners to the image */
}

.info-overlay {
    position: absolute;
    top: auto;
    left: 0;
    right: 0;
    bottom: -50%;
    height: 50%;
    background: rgba(0, 0, 0, 0.8);
    color: white;
    display: flex;
    flex-direction: column;
    justify-content: flex-start; /* Change from center to allow scrolling from top */
    align-items: center;
    padding: 30px 20px; /* Increase vertical padding */
    transition: all 0.5s ease;
    text-align: center;
    overflow-y: auto; /* Allow scrolling if content is too long */
    /* Improve scrolling on mobile */
    -webkit-overflow-scrolling: touch; /* Smooth scrolling on iOS */
    overscroll-behavior: contain; /* Prevent parent scrolling */
    z-index: 10;
}

.photo-container:hover .info-overlay,
.photo-container.touched .info-overlay {
    bottom: 0;
}

.info-overlay h2 {
    transform: translateY(20px);
    opacity: 0;
    transition: all 0.5s ease 0.1s;
    margin-bottom: 15px;
    font-size: 24px;
    /* Fix for long titles */
    width: 100%;
    word-wrap: break-word;
    overflow-wrap: break-word;
    hyphens: auto;
    padding: 0 10px;
    line-height: 1.2;
}

.info-overlay p {
    transform: translateY(20px);
    opacity: 0;
    transition: all 0.5s ease 0.2s;
    font-size: 16px;
    line-height: 1.6;
    max-width: 90%; /* Ensure text doesn't go too wide */
    margin: 0 auto; /* Center the text block */
    overflow-wrap: break-word; /* Prevent text from overflowing */
}

.photo-container:hover .info-overlay h2,
.photo-container:hover .info-overlay p,
.photo-container.touched .info-overlay h2,
.photo-container.touched .info-overlay p {
    transform: translateY(0);
    opacity: 1;
}

/* Add better scrolling indication for mobile */
@media (max-width: 768px) {
    .info-overlay {
        /* Increase padding to create more space for longer messages */
        padding-bottom: 50px;
        /* Add subtle scroll indicator */
        background: linear-gradient(to bottom, 
                   rgba(0, 0, 0, 0.8) 0%, 
                   rgba(0, 0, 0, 0.8) 90%,
                   rgba(0, 0, 0, 0.7) 100%);
    }
    
    /* Make sure text is fully visible on mobile */
    .info-overlay p {
        width: 100%;
        max-width: 100%;
    }
}

/* Mobile touch interactions */
@media (max-width: 768px) {
    /* Force the overlay to be visible when touched */
    .photo-container.touched .info-overlay {
        bottom: 0 !important;
        opacity: 1 !important;
        visibility: visible !important;
        z-index: 100 !important;
    }
    
    /* Force the text to be visible when touched */
    .photo-container.touched .info-overlay h2,
    .photo-container.touched .info-overlay p {
        opacity: 1 !important;
        transform: translateY(0) !important;
    }
    
    /* Enhanced touch target area */
    .photo-container {
        -webkit-tap-highlight-color: transparent; /* Remove tap highlight on iOS */
    }
    
    /* Make sure the image scales properly */
    .photo-container.touched .main-photo {
        filter: brightness(85%) !important;
        transform: scale(1.5) !important;
        object-fit: cover !important;
        object-position: center 0% !important;
    }
}

/* Mobile touch interactions - Enhanced for click */
@media (max-width: 768px) {
    /* Force the overlay to be visible when touched */
    .photo-container.touched .info-overlay {
        bottom: 0 !important;
        opacity: 1 !important;
        visibility: visible !important;
        z-index: 100 !important;
        transform: translateY(0) !important;
        /* Use hardware acceleration for smoother transitions */
        -webkit-transform: translateZ(0);
        -webkit-backface-visibility: hidden;
    }
    
    /* Force the text to be visible when touched */
    .photo-container.touched .info-overlay h2,
    .photo-container.touched .info-overlay p {
        opacity: 1 !important;
        transform: translateY(0) !important;
    }
    
    /* Increase tap target size */
    .photo-container {
        -webkit-tap-highlight-color: transparent; /* Remove tap highlight on iOS */
        cursor: pointer; /* Show pointer cursor */
    }
    
    /* Make sure the image scales properly on touch */
    .photo-container.touched .main-photo {
        filter: brightness(85%) !important;
        transform: scale(1.5) !important;
        object-fit: cover !important;
        object-position: center 0% !important;
        /* Use hardware acceleration for smoother animations */
        -webkit-transform: scale(1.5) translateZ(0) !important;
        -webkit-backface-visibility: hidden;
    }
    
    /* Optimize for instant touch feedback */
    .main-photo {
        will-change: transform, filter; /* Optimize for animations */
        /* Use hardware acceleration for smoother animations */
        -webkit-transform: translateZ(0);
        -webkit-backface-visibility: hidden;
    }
}

/* Touch indicator for mobile */
.touch-hint {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    background-color: rgba(0, 0, 0, 0.7);
    color: white;
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 14px;
    z-index: 100;
    opacity: 0;
    transition: opacity 0.5s ease;
    pointer-events: none; /* Don't interfere with touch events */
    display: none; /* Hidden by default, shown via JS on touch devices */
}

.touch-hint.visible {
    opacity: 1;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% { transform: translateX(-50%) scale(1); }
    50% { transform: translateX(-50%) scale(1.05); }
    100% { transform: translateX(-50%) scale(1); }
}

/* Countdown timer styling */
.countdown-timer {
    position: fixed;
    bottom: 15px;
    right: 15px;
    font-size: 12px;
    color: rgba(255, 255, 255, 0.6);
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.3);
    font-family: Arial, sans-serif;
    background-color: rgba(0, 0, 0, 0.2);
    padding: 5px 10px;
    border-radius: 10px;
    backdrop-filter: blur(5px);
    transition: opacity 0.3s ease;
    opacity: 0.5;
    z-index: 100;
}

.countdown-timer:hover {
    opacity: 1;
}

#countdown-display {
    white-space: nowrap;
}

/* Legal footer - extremely subtle */
.legal-footer {
    position: fixed;
    bottom: 10px;
    left: 10px;
    z-index: 50;
}

.legal-links {
    display: flex;
    gap: 10px;
}

.legal-links a {
    opacity: 0.2;
    transition: opacity 0.3s ease;
    color: rgba(255, 255, 255, 0.7);
}

.legal-links a:hover {
    opacity: 0.6;
}

/* Admin link styling */
.legal-links a.admin-link {
    opacity: 0.15;  /* Slightly less visible by default */
}

.legal-links a.admin-link:hover {
    opacity: 0.7;   /* More visible on hover than regular links */
    color: rgba(255, 215, 0, 0.8);  /* Gold tint on hover */
}

/* Ensure legal links don't interfere with main content on small screens */
@media (max-width: 768px) {
    .legal-footer {
        bottom: 5px;
        left: 5px;
    }
    
    .legal-links {
        gap: 8px;
    }
    
    .legal-links a svg {
        width: 14px;
        height: 14px;
    }
}