:root {
    --bg-color: #0a0a0a;
    --surface-color: #171717;
    --text-main: #ffffff;
    --text-muted: #a3a3a3;
    --accent-pink: #ff6699;
    --accent-green: #00FF99;
    --accent-blue: #33ccff;
    --border-color: #262626;
    --hover-bg: #2a2a2a;
}

body {
    margin: 0;
    padding: 0;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background-color: var(--bg-color);
    color: var(--text-main);
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

a {
    color: var(--accent-blue);
    text-decoration: none;
    transition: color 0.2s ease;
}

a:hover {
    color: var(--accent-pink);
}

/* Layout */
#site-header {
    background-color: var(--surface-color);
    padding: 1rem 2rem;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 1.1rem;
    font-weight: 500;
}

#home-link {
    color: var(--accent-green);
    font-weight: bold;
}

#breadcrumbs span {
    color: var(--text-muted);
}

#layout {
    display: flex;
    flex: 1;
    max-width: 1400px;
    margin: 0 auto;
    width: 100%;
    padding: 2rem;
    box-sizing: border-box;
    gap: 2rem;
}

main#app {
    flex: 1;
    min-width: 0;
}

aside#sidebar {
    width: 250px;
    flex-shrink: 0;
}

footer {
    text-align: center;
    padding: 1.5rem;
    border-top: 1px solid var(--border-color);
    background-color: var(--surface-color);
    color: var(--text-muted);
    font-size: 0.9rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

@media (max-width: 800px) {
    #layout {
        flex-direction: column;
    }
    aside#sidebar {
        width: 100%;
    }
}

/* Sidebar */
aside#sidebar h3 {
    color: var(--accent-green);
    font-size: 1rem;
    margin-top: 0;
    margin-bottom: 1rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

aside#sidebar ol {
    list-style: decimal inside;
    padding: 0;
    margin: 0 0 2rem 0;
}

aside#sidebar li {
    margin-bottom: 0.5rem;
    font-size: 0.9rem;
    word-break: break-word;
    overflow-wrap: anywhere;
}

/* Grid */
.grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 1.5rem;
}

.card {
    display: flex;
    flex-direction: column;
    background: var(--surface-color);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    overflow: hidden;
    transition: transform 0.2s ease, border-color 0.2s ease;
}

.card:hover {
    transform: translateY(-4px);
    border-color: var(--accent-pink);
}

.card.is-album {
    border-color: #1f4024; /* subtle green tint for albums */
}

.card.is-album:hover {
    border-color: var(--accent-green);
}

/* Thumbnail / Sprite handling */
.thumb-img {
    width: 100%;
    aspect-ratio: 1 / 1;
    object-fit: cover;
    display: block;
}

.thumb-sprite {
    width: 100%;
    aspect-ratio: 1 / 1;
    background-repeat: no-repeat;
    background-size: 1600px auto; /* 10 columns * 160px */
}

/* We must scale the 160x160 cell to whatever width the grid column is */
/* Since background-position handles exact pixel offsets of the original image, 
   CSS sprites in responsive fluid grids can be tricky.
   A standard trick is using an inner div or ensuring the grid cells lock near 160px.
   We will lock the sprite container to exactly 160x160 and center it to avoid distortion. */
.card .thumb-sprite {
    width: 160px;
    height: 160px;
    margin: 0 auto;
}

.card-info {
    padding: 0.75rem;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    background: var(--surface-color);
}

.card-title {
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-main);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.card-stats {
    font-size: 0.8rem;
    color: var(--accent-pink);
}

/* Pagination */
.pagination {
    margin-top: 2rem;
    display: flex;
    justify-content: center;
    gap: 0.5rem;
}

.pagination a, .pagination .current-page {
    padding: 0.5rem 1rem;
    border-radius: 4px;
    background: var(--surface-color);
    border: 1px solid var(--border-color);
}

.pagination .current-page {
    color: var(--bg-color);
    background: var(--accent-blue);
    border-color: var(--accent-blue);
    font-weight: bold;
}

/* Item View */
.item-view {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2rem;
}

.item-nav {
    display: flex;
    gap: 1rem;
    align-items: center;
}

.nav-btn {
    padding: 0.5rem 1rem;
    background: var(--surface-color);
    border: 1px solid var(--border-color);
    border-radius: 4px;
}

.nav-btn.disabled {
    color: var(--border-color);
    pointer-events: none;
}

.main-image-container {
    max-width: 100%;
}

.main-image {
    max-width: 100%;
    height: auto;
    border: 4px solid var(--surface-color);
    border-radius: 4px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.5);
}

.tinymenu {
    display: flex;
    flex-wrap: wrap;
    gap: 0.25rem;
    justify-content: center;
    max-width: 100%;
    margin-top: 1rem;
}

.tiny-item {
    width: 40px;
    height: 40px;
    border: 2px solid transparent;
    border-radius: 2px;
    opacity: 0.6;
    transition: opacity 0.2s, border-color 0.2s;
    box-sizing: border-box;
}

.tiny-sprite {
    background-size: 400px auto; /* 10 columns * 40px */
    background-repeat: no-repeat;
}

.tiny-item:hover {
    opacity: 1;
    border-color: var(--accent-pink);
}

.tiny-item.selected {
    opacity: 1;
    border-color: var(--accent-blue);
    transform: scale(1.1);
}

.exif-data {
    display: flex;
    flex-wrap: wrap;
    gap: 1.5rem;
    justify-content: center;
    color: var(--text-muted);
    font-size: 0.9rem;
    background: var(--surface-color);
    padding: 1rem 2rem;
    border-radius: 8px;
    border: 1px solid var(--border-color);
}

.loading {
    text-align: center;
    padding: 4rem;
    color: var(--accent-blue);
    font-size: 1.2rem;
}

.error {
    text-align: center;
    padding: 4rem;
    color: var(--accent-pink);
    font-size: 1.2rem;
}
