* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: Arial, sans-serif;
    padding: 20px;
    padding-right: calc(40vw + 20px); /* Space for floating image */
    background-color: #f5f5f5;
}

h1 {
    margin-bottom: 30px;
    color: #333;
}

/* Filename list styling */
#filename-list {
    list-style: none;
    max-width: 600px;
}

#filename-list li {
    padding: 0px;
    margin-bottom: 0px;
    background-color: #f5f5f5;
    /* border: 1px solid #ddd; */
    /* border-radius: 5px; */
    font-size: 12px;
    cursor: pointer;
    transition: background-color 0.2s;
}
/*
#filename-list li:hover {
    background-color: #f0f0f0;
} */

#filename-list li.active {
    /* background-color: #e3f2fd; */
    /* border-color: #2196F3; */
    /* font-weight: bold; */
    filter: url(#displacement);
}

/* Floating container - TOP RIGHT */
#floating-container {
    position: fixed;
    top: 0px;
    right: 0px;
    width: 40vw;
    min-width: 100px;
    max-width: 90vw;
    background-color: white;
    border: 0px solid #333;
    border-radius: 0px;
    box-shadow: 0 0px 0px rgba(0, 0, 0, 0.3);
    padding: 0px;
    z-index: 1000;
    display: none; /* Hidden initially */
    filter: url(#displacement_02);
}

#floating-container.visible {
    display: block;
}

#filename-display {
    font-size: 14px;
    font-weight: bold;
    margin-bottom: 0px;
    color: #2196F3;
    text-align: center;
}

#floating-image {
    width: 100%;
    height: auto;
    border-radius: 0px;
    display: block;
    cursor: pointer;
    transition: transform 0.001s ease;
    filter: url(#displacement_03);
}

#floating-image.flipped {
    transform: rotate(180deg);
}

#resize-handle {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 18px;
    height: 18px;
    cursor: nwse-resize;
    background: linear-gradient(135deg, transparent 40%, #aaa 40%, #aaa 50%, transparent 50%, transparent 65%, #aaa 65%, #aaa 75%, transparent 75%);
}

#zoom-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: black;
    z-index: 9999;
    justify-content: center;
    align-items: center;
    touch-action: none;
    overflow: hidden;
}

#zoom-overlay.visible {
    display: flex;
}

#zoom-image {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    touch-action: none;
    will-change: transform;
    filter: url(#displacement_03);
}

#instructions {
    position: fixed;
    bottom: 32px;
    left: 50%;
    transform: translateX(-50%);
    padding: 8px 14px;
    border-radius: 10px;
    background-color: rgba(150, 150, 150, 0.2);
    -webkit-backdrop-filter: blur(20px);
    backdrop-filter: blur(20px);
    font-size: 9px;
    font-family: monospace;
    color: white;
    text-align: center;
    line-height: 1.2;
    z-index: 2000;
    cursor: pointer;
    transition: opacity 0.4s ease;
    white-space: nowrap;
}

#instructions .desktop { display: inline; }
#instructions .mobile  { display: none; }

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

@media (max-width: 600px) {
    #instructions .desktop { display: none; }
    #instructions .mobile  { display: inline; }
}

#update-label {
    position: fixed;
    bottom: 10px;
    right: 10px;
    font-size: 10px;
    color: #aaa;
    z-index: 999;
}

/* Add some bottom padding so you can scroll past last item */
body::after {
    content: '';
    display: block;
    height: 100vh;
}

/* Mobile: full-screen background image, list scrolls on top */
@media (max-width: 600px) {
    body {
        padding-right: 20px;
        padding-top: 20px;
        background-color: #f5f5f5;
    }

    #floating-container {
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        width: 100vw !important;
        max-width: 100%;
        height: 50vh;
        overflow: hidden;
        background-color: transparent;
        z-index: 0;
        pointer-events: none;
    }

    #floating-image {
        width: 100%;
        height: 100%;
        object-fit: contain;
        object-position: right center;
    }

    #filename-list li {
        font-size: 14px;
    }

    #resize-handle {
        display: none;
    }
}