/* --- General & Resets --- */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Exo 2', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

html, body {
    height: 100%;
    overflow: hidden;
    background-color: rgba(0, 0, 0);
}

/* --- SPLASH CONTAINER & CENTERING --- */
#splash-container {
    height: 100vh;
    width: 100vw;
    position: fixed;
    top: 0;
    left: 0;
    display: flex;
    justify-content: center;
    align-items: center;
    text-align: center;
    color: white;
    z-index: 10;
    visibility: visible;
    transition: opacity 0.5s ease, transform 0.5s ease, visibility 0s linear;
    pointer-events: none;
}

/* --- "FROSTED GLASS" CONTENT PANEL --- */
#splash-content {
    position: relative;
    padding: 2.5rem;
    max-width: 850px;
    width: 90%;
    background: rgba(10, 10, 20, 0.25);
    backdrop-filter: blur(8px) saturate(150%);
    -webkit-backdrop-filter: blur(8px) saturate(150%);
    border-radius: 20px;
    border: 1px solid rgba(255, 255, 255, 0.15);
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
    pointer-events: auto;
}

/* --- TYPOGRAPHY --- */
#splash-content h1 { font-size: 3.8rem; font-weight: 700; margin-bottom: 0.5rem; text-shadow: 0 4px 20px rgba(0,0,0,0.6); }
#splash-content p { font-size: 1.3rem; font-weight: 300; margin-bottom: 2.5rem; text-shadow: 0 2px 8px rgba(0,0,0,0.6); opacity: 0.9; }

/* --- TRANSPARENT PNG ICON BUTTON STYLES --- */
.button-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1.5rem;
    justify-content: center;
}

.button-row {
    display: flex;
    gap: 1.5rem;
    justify-content: center;
}

.nav-button {
    background: transparent;
    color: white;
    width: 160px;
    height: 160px;
    text-decoration: none;
    border: 3px solid white;
    border-radius: 20px;
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
}

.nav-button img {
    width: 64px;
    height: 64px;
    object-fit: contain;
    transition: transform 0.3s ease;
}

.nav-button span {
    font-size: 1.1rem;
    font-weight: 600;
    text-shadow: 0 2px 4px rgba(0,0,0,0.8);
}

.nav-button:hover {
    transform: translateY(-5px);
    background: rgba(255, 255, 255, 0.05);
}

.nav-button:hover img {
    transform: scale(1.1);
}

.nav-button.play { border-color: #00ff99; }
.nav-button.play:hover { box-shadow: 0 0 25px -5px #00ff99; }

.nav-button.memory { border-color: #9d00ff; }
.nav-button.memory:hover { box-shadow: 0 0 25px -5px #9d00ff; }

.nav-button.simulator { border-color: #ff3333; }
.nav-button.simulator:hover { box-shadow: 0 0 25px -5px #ff3333; }

.nav-button.youtwo { border-color: #ff0000; }
.nav-button.youtwo:hover { box-shadow: 0 0 25px -5px #ff0000; }

.nav-button.floofbook { border-color: #1877f2; }
.nav-button.floofbook:hover { box-shadow: 0 0 25px -5px #1877f2; }

/* --- VIEWER MODE & ICON BUTTONS --- */
.icon-button { background: rgba(0, 0, 0, 0.4); color: white; border: 1px solid rgba(255, 255, 255, 0.3); border-radius: 50%; display: flex; align-items: center; justify-content: center; transition: all 0.3s ease; backdrop-filter: blur(5px); padding: 0; }
.icon-button:hover { background: rgba(255, 255, 255, 0.3); transform: scale(1.1); }
#hide-menu-btn { position: absolute; top: 15px; right: 15px; width: 40px; height: 40px; cursor: pointer; }
#viewer-controls { position: fixed; top: 0; left: 0; width: 100%; height: 100%; z-index: 5; opacity: 0; transition: opacity 0.3s ease; pointer-events: none; }
#viewer-controls > * { pointer-events: auto; }
#viewer-controls .top-left { position: absolute; top: 25px; left: 25px; width: 44px; height: 44px; cursor: pointer; }
#show-menu-btn img { width: 40px; height: 40px; } /* Style for the new PNG nav icon */


/* --- CONVEYOR SLIDER STYLES --- */
.slider-container { position: absolute; bottom: 20px; left: 50%; transform: translateX(-50%); width: 50%; max-width: 400px; background: rgba(0, 0, 0, 0.4); padding: 8px 20px; border-radius: 50px; border: 1px solid rgba(255, 255, 255, 0.3); backdrop-filter: blur(5px); }
.conveyor-slider { -webkit-appearance: none; appearance: none; width: 100%; height: 6px; background: rgba(255, 255, 255, 0.3); border-radius: 3px; outline: none; opacity: 0.7; transition: opacity .2s; cursor: grab; }
.conveyor-slider:hover { opacity: 1; }
.conveyor-slider:active { cursor: grabbing; }
.conveyor-slider::-webkit-slider-thumb { -webkit-appearance: none; appearance: none; width: 20px; height: 20px; background: white; border-radius: 50%; cursor: grab; }
.conveyor-slider::-moz-range-thumb { width: 20px; height: 20px; background: white; border-radius: 50%; cursor: grab; }

/* --- State Toggling Classes --- */
body.menu-hidden #splash-container {
    opacity: 0;
    transform: scale(0.9);
    visibility: hidden;
    transition: opacity 0.5s ease, transform 0.5s ease, visibility 0s linear 0.5s;
}
body.menu-hidden #viewer-controls { opacity: 1; }

/* --- IMAGE & LIGHTBOX STYLES --- */
.image-item { cursor: pointer; }
#lightbox-overlay { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0, 0, 0, 0.85); z-index: 2000; display: none; align-items: center; justify-content: center; opacity: 0; transition: opacity 0.4s ease; -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px); }
#lightbox-overlay.visible { display: flex; opacity: 1; }
#lightbox-image { max-width: 90%; max-height: 85%; box-shadow: 0 0 50px rgba(0,0,0,0.5); border-radius: 8px; transform: scale(0.9); transition: transform 0.4s ease; }
#lightbox-overlay.visible #lightbox-image { transform: scale(1); }
#lightbox-close { position: absolute; top: 20px; right: 30px; color: white; font-size: 40px; font-weight: bold; cursor: pointer; transition: transform 0.2s ease; }
#lightbox-close:hover { transform: scale(1.2); color: #ff4d4d; }

/* --- ALL OTHER STYLES (Unchanged) --- */
#stage{position:fixed;top:0;left:0;width:100vw;height:100vh;overflow:hidden;z-index:1}#track{position:absolute;top:0;left:0;height:100%;display:flex;will-change:transform;-webkit-user-select:none;user-select:none;}.scroller-instance{display:flex;flex-direction:column;flex-shrink:0;width:3000px;box-sizing:border-box;padding:8px}.image-row{display:flex;margin-bottom:16px}.image-item{margin-right:16px;border-radius:8px;box-shadow:0 10px 30px rgba(0,0,0,.6);line-height:0;opacity:0;transform:scale(.95);transition:opacity .6s ease,transform .6s ease;}.image-item:last-child{margin-right:0}.image-item.is-loaded{opacity:1;transform:scale(1)}.image-item img{display:block;width:100%;height:100%;border-radius:8px; pointer-events: none;}
body.modal-open #splash-content { pointer-events: none; user-select: none; }
#password-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    display: none; /* MODIFIED: Ensures modal is hidden by default */
    justify-content: center;
    align-items: center;
    opacity: 1;
    transition: opacity 0.3s ease;
}
#password-modal.modal-hidden { opacity: 0; pointer-events: none; }
.modal-content {
    position: relative; /* ADDED: To position the close button */
    background: white;
    padding: 2.5rem;
    border-radius: 15px;
    text-align: center;
    color: #333;
    width: 90%;
    max-width: 400px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.2);
    animation: slide-up 0.5s ease-out;
}

/* === NEW: CLOSE BUTTON STYLE === */
#close-modal-btn {
    position: absolute;
    top: 10px;
    right: 15px;
    font-size: 28px;
    font-weight: bold;
    color: #aaa;
    cursor: pointer;
    transition: color 0.2s ease, transform 0.2s ease;
    line-height: 1;
}

#close-modal-btn:hover {
    color: #333;
    transform: scale(1.1);
}
/* === END NEW STYLES === */

.modal-content h2 { margin-bottom: 1rem; font-size: 1.8rem; }
#password-input { width: 100%; padding: 0.8rem; font-size: 1rem; margin-top: 1rem; border: 1px solid #ccc; border-radius: 8px; }
#password-submit { width: 100%; padding: 0.8rem; font-size: 1.1rem; font-weight: bold; margin-top: 1rem; background: #28a745; color: white; border: none; border-radius: 8px; cursor: pointer; transition: background-color 0.3s ease; }
#password-submit:hover { background: #218838; }
#error-message { color: #dc3545; margin-top: 1rem; font-weight: bold; height: 1em; transition: opacity 0.3s; }
.error-hidden { opacity: 0; }
@keyframes slide-up { from { transform: translateY(30px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }
@keyframes shake { 10%, 90% { transform: translateX(-1px); } 20%, 80% { transform: translateX(2px); } 30%, 50%, 70% { transform: translateX(-4px); } 40%, 60% { transform: translateX(4px); } }

/* ========================================= */
/* === RESPONSIVE STYLES (REVISED) === */
/* ========================================= */

@media (max-width: 768px) {
    #splash-content { padding: 1.5rem; }
    #splash-content h1 { font-size: 1.7rem; }
    #splash-content p { font-size: .8rem; margin-bottom: 2rem; }

    /* New 2-Column Button Layout */
    .button-container {
        flex-direction: row;
        flex-wrap: wrap;
        justify-content: center;
        gap: 1rem;
    }

    .button-row {
        display: contents; /* Makes row containers invisible to flexbox layout */
    }

    .nav-button {
        width: calc(50% - 0.5rem);
        max-width: 100px; /* Reduced max-width for smaller buttons */
        height: auto;
        aspect-ratio: 1 / 1;
        gap: 0.2rem; /* Tighter gap between icon and text */
        border-width: 2px; /* Thinner border */
        border-radius: 12px; /* Slightly smaller radius */
    }

    .nav-button img {
        width: 55%; /* Slightly smaller icon */
        height: 55%;
    }

    .nav-button span {
        font-size: 0.75rem; /* Smaller text */
    }

    .slider-container { width: 80%;}
  

    /* Smaller Password Modal on Mobile */
    .modal-content {
        padding: 1.2rem;
        max-width: 280px;
    }
    .modal-content h2 {
        font-size: 1.2rem;
    }
    .modal-content p {
        font-size: 0.8rem;
    }
}


/* ========================================= */
/* === DELETE FUNCTIONALITY STYLES === */
/* ========================================= */
.delete-btn {
    position: absolute;
    top: 5px;
    right: 5px;
    width: 28px;
    height: 28px;
    background: rgba(0, 0, 0, 0.6);
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.4);
    border-radius: 50%;
    font-size: 20px;
    line-height: 26px; /* Vertically center the '×' */
    text-align: center;
    cursor: pointer;
    z-index: 10;
    opacity: 0; /* Hidden by default */
    transform: scale(0.8);
    transition: all 0.2s ease-in-out;
}

.image-item:hover .delete-btn {
    opacity: 1; /* Show on hover */
    transform: scale(1);
}

.delete-btn:hover {
    background: #ff4d4d;
    color: white;
    transform: scale(1.1) rotate(90deg);
}

.image-item.deleted {
    opacity: 0;
    transform: scale(0.9);
    pointer-events: none; /* Make it unclickable */
    transition: opacity 0.5s ease, transform 0.5s ease;
}