* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Consolas', monospace;
    font-size: 14px;
}

html, body {
    height: 100%;
    width: 100%;
    position: relative;
    overflow: hidden;
}

body {
    font-family: 'Consolas', monospace;
    font-size: 14px;
    background-color: black;
    height: 100vh;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    position: relative;
    overflow: hidden;
}

.container {
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    align-items: center;
    height: 100vh;
    width: 100vw;
    position: fixed;
    top: 0;
    left: 0;
    padding-top: 15vh; /* Reduced from 20vh to position content higher */
}

.prophecy-header {
    color: white;
    text-align: center;
    margin-bottom: 20px;
    font-family: 'Salernomi J', 'Times New Roman', serif;
    font-size: 24px;
    /* Absolute positioning to completely prevent movement */
    position: absolute;
    top: 15vh; /* Match the container's padding-top */
    left: 0;
    width: 100%;
    z-index: 1;
}

.image-container {
    position: relative;
    padding: 6px; /* Increased padding to account for the 1px border */
    background-color: black;
    border: 0px solid white; /* Start with no border */
    border-radius: 4px;
    box-shadow: 0 0 20px rgba(255, 255, 255, 0.15);
    /* Use fixed dimensions that won't change */
    display: flex;
    justify-content: center;
    align-items: center;
    /* Size with fixed aspect ratio */
    width: min(80vw, 600px);
    aspect-ratio: 4/3;
    box-sizing: border-box; /* Include border in width calculation */
    transition: border 0.3s ease, padding 0.3s ease; /* Smooth transition for both */
    margin-top: 50px; /* Add margin to position it below the fixed header */
}

/* Border appears when image is loaded */
.image-container.loaded {
    border: 1px solid white;
    padding: 5px; /* Reduce padding to compensate for border */
}

/* Add a loading spinner */
.image-container::before {
    content: "★";
    display: block;
    position: absolute;
    color: white;
    font-size: 24px;
    animation: spin 1.5s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Hide the spinner when image is loaded */
.image-container.loaded::before {
    display: none;
}

#random-image {
    display: block;
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    opacity: 0; /* Start with invisible image */
    transition: opacity 0.3s ease; /* Smooth fade-in effect */
}

#random-image.loaded {
    opacity: 1;
}

.menu-toggle {
    position: fixed;
    top: 20px;
    left: 20px;
    z-index: 1000;
    cursor: pointer;
}

.star {
    color: white;
    font-size: 24px;
}

.menu {
    position: fixed;
    top: 0;
    left: -250px;
    width: 250px;
    height: 100%;
    background-color: #1a1a1a;
    z-index: 999;
    transition: left 0.3s ease;
}

.menu.open {
    left: 0;
}

.menu ul {
    list-style: none;
    padding: 70px 0 0 0;
}

.menu ul li {
    padding: 15px 30px;
}

.menu ul li a {
    color: white;
    text-decoration: none;
    font-size: 16px;
}

.overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.7);
    z-index: 998;
    display: none;
}

/* Dark/Light mode for info panel */
.info-panel {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 80%;
    max-width: 600px;
    padding: 30px;
    border-radius: 5px;
    z-index: 1001;
    display: none;
}

/* Default dark mode styles */
.info-panel {
    background-color: #1a1a1a;
    color: #ffffff;
}

/* Light mode styles */
@media (prefers-color-scheme: light) {
    .info-panel {
        background-color: #ffffff;
        color: #000000;
    }
    
    .close-btn {
        color: #000000;
    }
}

.close-btn {
    position: absolute;
    top: 10px;
    right: 15px;
    font-size: 24px;
    cursor: pointer;
}

.info-content {
    margin-top: 10px;
}

.info-content h2 {
    margin-bottom: 20px;
    font-size: 18px;
}

.info-content p {
    margin-bottom: 15px;
    line-height: 1.5;
    font-size: 14px;
}

/* Header styles */
.prophecy-header {
    color: white;
    text-align: center;
    margin-bottom: 20px;
    font-family: 'Salernomi J', 'Times New Roman', serif;
    font-size: 24px;
}

#current-time {
    font-style: italic;
    font-family: 'Salernomi J', 'Times New Roman', serif;
    font-size: inherit; /* Inherit the font size from parent */
}

/* Mobile optimizations */
@media (max-width: 768px) {
    /* Smaller prophecy header text on mobile */
    .prophecy-header {
        font-size: 18px;
        top: 15vh; /* Same as desktop now */
    }
    
    /* Ensure current-time is properly sized on mobile */
    #current-time {
        font-size: 18px; /* Match parent font size */
    }
    
    /* Container padding adjustment for mobile */
    .container {
        padding-top: 15vh; /* Same as desktop now */
    }
    
    /* Adjust image container for mobile */
    .image-container {
        width: 90vw; /* Use more screen width on mobile */
        padding: 4px; /* Initial padding on mobile */
        margin-top: 40px; /* Less margin on mobile */
    }
    
    /* Border for mobile */
    .image-container.loaded {
        border-width: 1px;
        padding: 3px; /* Reduce padding to compensate for border */
    }
}

/* Add specific styles to make canvas downloadable on mobile */
#image-canvas {
    touch-action: none; /* Prevents default touch actions to allow custom handling */
    user-select: none; /* Prevents unintended selection */
    -webkit-user-select: none; /* Safari-specific */
    -webkit-touch-callout: none; /* iOS Safari */
}