/* General Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', 'Arial', sans-serif; /* Using a modern sans-serif font */
    background-color: #111827; /* Tailwind gray-900 */
    color: #f3f4f6; /* Tailwind gray-100 */
    overflow: hidden; /* Prevent scrollbars on the body */
}

#gallery-container {
    position: relative;
    width: 100vw;
    height: 100vh;
}

#gallery-canvas {
    display: block;
    width: 100%;
    height: 100%;
}

/* UI Overlay Elements */
#ui-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none; /* Allow clicks to pass through to canvas */
    z-index: 10;
}

#ui-overlay > div { /* Apply to direct children for pointer events */
    pointer-events: auto; /* Re-enable pointer events for UI elements */
}


/* Title and Controls Info common styles */
#title, #controls-info {
    background: rgba(17, 24, 39, 0.75); /* Tailwind gray-900 with opacity */
    padding: 1rem; /* 16px */
    border-radius: 0.5rem; /* 8px */
    backdrop-filter: blur(8px);
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05); /* Tailwind shadow-xl */
}

#title h1 {
    font-size: 1.5rem; /* 24px */
    margin-bottom: 0.25rem; /* 4px */
    color: #f3f4f6;
    font-weight: 300; /* Light font weight */
}

#title p {
    font-size: 0.875rem; /* 14px */
    color: #d1d5db; /* Tailwind gray-300 */
}

.control-item {
    display: flex;
    align-items: center;
    margin-bottom: 0.5rem; /* 8px */
}
.control-item:last-child {
    margin-bottom: 0;
}

.key {
    display: inline-block;
    min-width: 40px; /* Wider keys for WASD */
    height: 30px;
    background: #374151; /* Tailwind gray-700 */
    border: 1px solid #4b5563; /* Tailwind gray-600 */
    border-radius: 0.375rem; /* 6px */
    text-align: center;
    line-height: 28px; /* Adjust for border */
    margin-right: 0.75rem; /* 12px */
    font-size: 0.875rem; /* 14px */
    color: #f3f4f6;
    font-weight: 500;
    padding: 0 0.5rem;
}

.desc {
    font-size: 0.875rem; /* 14px */
    color: #d1d5db;
}

/* Artwork Info Panel */
#artwork-info-container {
    background: rgba(17, 24, 39, 0.85); /* Darker, more opaque for readability */
    padding: 1.25rem; /* 20px */
    border-radius: 0.75rem; /* 12px */
    backdrop-filter: blur(10px);
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04); /* Tailwind shadow-2xl */
    max-width: 360px; /* Slightly wider */
    opacity: 0; /* Initially hidden, controlled by JS */
    transition: opacity 0.3s ease-in-out, transform 0.3s ease-in-out;
    transform: translateY(-50%) scale(0.95); /* Initial state for animation */
}

#artwork-info-container.visible {
    opacity: 1;
    transform: translateY(-50%) scale(1);
}


#artwork-info-title {
    font-size: 1.25rem; /* 20px */
    margin-bottom: 0.75rem; /* 12px */
    color: #facc15; /* Tailwind yellow-400 */
    font-weight: 600; /* Semibold */
}

#artwork-info-description {
    font-size: 0.875rem; /* 14px */
    color: #e5e7eb; /* Tailwind gray-200 */
    line-height: 1.6; /* Improved readability */
    max-height: 240px; /* Limit height, enable scroll */
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: #4b5563 #374151;
}

#artwork-info-description::-webkit-scrollbar {
    width: 8px;
}

#artwork-info-description::-webkit-scrollbar-track {
    background: #374151; /* Tailwind gray-700 */
    border-radius: 4px;
}

#artwork-info-description::-webkit-scrollbar-thumb {
    background-color: #4b5563; /* Tailwind gray-600 */
    border-radius: 4px;
    border: 2px solid #374151; /* Creates padding around thumb */
}

#artwork-prompt {
    font-size: 0.75rem; /* 12px */
    color: #9ca3af; /* Tailwind gray-400 */
    margin-top: 0.75rem; /* 12px */
    text-align: center;
}

/* Loading Screen */
#loading-screen {
    position: fixed; /* Use fixed for full viewport coverage */
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: #111827; /* Tailwind gray-900 */
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    transition: opacity 0.5s ease-out; /* Smooth fade out */
}

#loading-screen.hidden {
    opacity: 0;
    pointer-events: none;
}

.loading-content h2 {
    font-size: 1.875rem; /* 30px */
    margin-bottom: 1.5rem; /* 24px */
    color: #f3f4f6;
    font-weight: 300;
}

.loading-spinner { /* Replaced loading bar with a spinner */
    width: 4rem; /* 64px */
    height: 4rem; /* 64px */
    border-width: 5px; /* Thicker border */
    border-color: #facc15; /* Tailwind yellow-400 */
    border-top-color: transparent;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

#loading-details {
    color: #9ca3af; /* Tailwind gray-400 */
    margin-top: 1rem; /* 16px */
    font-size: 0.875rem; /* 14px */
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* Responsive Adjustments */
@media (max-width: 768px) {
    #title, #controls-info, #artwork-info-container {
        position: static; /* Allow flow layout on small screens */
        margin: 0.75rem; /* 12px */
        transform: none !important; /* Reset transform */
        max-width: none; /* Full width */
        width: auto;
    }
    
    #ui-overlay {
        display: flex;
        flex-direction: column;
        justify-content: space-between;
        padding: 0.5rem; /* Add some padding to overlay on mobile */
        pointer-events: auto; /* Enable pointer events on the overlay itself for scrolling if needed */
    }

    #artwork-info-container {
        order: 1; /* Place artwork info between title and controls */
        max-height: 150px; /* Adjust height for smaller screens */
    }
     #title { order: 0; }
     #controls-info { order: 2; }

    .key {
        min-width: 30px;
        height: 28px;
        line-height: 26px;
        font-size: 0.8rem;
    }
}
