/* Base styles */
html, body {
    height: 100%; /* Ensure full height */
    overflow: hidden; /* Prevent scrollbars */
}

body {
    margin: 0;
    padding: 0;
    font-family: 'Courier New', Courier, monospace;
    background-color: #1a1a1a;
}

/* 3D container - full screen with lowest z-index */
#container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
}

/* Background timer - always visible during cooldown */
#background-timer {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    z-index: 10; /* Increased z-index to ensure visibility */
    pointer-events: none; /* Allow clicks to pass through */
    opacity: 1;
    transition: opacity 0.5s ease-in-out;
    padding-top: 5vh;
}

#background-timer.hidden {
    opacity: 0;
    display: none; /* Added display:none when hidden */
}

.timer-content {
    font-family: 'Dancing Script', cursive;
    color: #ffffff; /* Brightened color for better visibility */
    text-align: center;
    font-size: 2.8rem;
    line-height: 1.2;
    text-shadow: 0 0 10px rgba(220, 20, 60, 0.9), 0 0 20px rgba(220, 20, 60, 0.8), 0 0 30px rgba(220, 20, 60, 0.6);
    background-color: rgba(0, 0, 0, 0.6); /* Darkened background for better contrast */
    padding: 15px 30px;
    border-radius: 15px;
    backdrop-filter: blur(3px);
    border: 2px solid rgba(220, 20, 60, 0.5); /* Added border for visibility */
    box-shadow: 0 0 25px rgba(220, 20, 60, 0.4); /* Added glow effect */
}

#bg-time-remaining {
    display: block;
    font-size: 3.5rem;
    color: rgba(255, 50, 50, 1); /* Increased opacity for brightness */
    margin-top: 10px;
    font-weight: bold;
    text-shadow: 0 0 15px rgba(255, 50, 50, 0.8); /* Enhanced glow */
}

/* Loading indicator */
#loading-indicator {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background-color: rgba(0, 0, 0, 0.7);
    color: white;
    padding: 15px 20px;
    border-radius: 5px;
    z-index: 1000;
    font-size: 1.2em;
}

/* Fortune display box */
#fortune-display {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 1000;
    text-align: center;
    width: 320px;
    opacity: 1;
    transition: opacity 0.5s ease-in-out;
}

#fortune-display.hidden {
    opacity: 0;
    pointer-events: none;
}

/* Fortune paper styling */
.fortune-paper {
    background-color: #FFFACD; /* Light yellow paper-like color */
    border: 1px solid #E0D8A8;
    border-radius: 4px;
    padding: 25px;
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.4), 0 0 0 1px rgba(0, 0, 0, 0.1);
    transform: rotate(-1deg);
    position: relative;
    max-width: 100%;
}

.fortune-paper::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-image: 
        linear-gradient(rgba(255, 255, 255, 0.2) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255, 255, 255, 0.2) 1px, transparent 1px);
    background-size: 20px 20px;
    pointer-events: none;
    z-index: 0;
    border-radius: 3px;
}

#fortune-text {
    margin: 0;
    font-family: 'Kalam', cursive;
    font-size: 1.4em;
    color: #333;
    position: relative;
    z-index: 1;
    line-height: 1.4;
}

/* Footer */
#footer {
    position: fixed;
    bottom: 10px;
    left: 0;
    right: 0;
    text-align: center;
    color: #ccc;
    font-size: 0.9em;
    z-index: 1000;
    padding: 10px;
}

#footer a {
    color: #DC143C;
    text-decoration: none;
    font-weight: bold;
    transition: color 0.3s;
}

#footer a:hover {
    color: #fff;
    text-decoration: underline;
}

/* Mobile optimization */
@media (max-width: 600px) {
    .timer-content {
        font-size: 2rem;
        padding: 10px 20px;
    }
    
    #bg-time-remaining {
        font-size: 2.5rem;
    }
    
    #fortune-display {
        width: 85%;
    }
    
    #fortune-text {
        font-size: 1.2em;
    }
    
    #footer {
        font-size: 0.8em;
        bottom: 5px;
    }
}