body {
    font-family: system-ui, sans-serif;
    margin: 0;
    background: #0e1116;
    color: #e6e6e6;
}

body.terminal-theme {
    background: #000;
    color: #d0fff0;
    font-family: "SFMono-Regular", Consolas, Menlo, monospace;
}

header {
    padding: 1rem;
    background: #161b22;
    position: sticky;
    top: 0;
    z-index: 10;
    box-shadow: 0 2px 4px rgba(0, 0, 0, .4);
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    align-items: center;
}

h1 {
    margin: 0;
    font-size: 1.25rem;
}

#search {
    padding: .5rem .75rem;
    font-size: 1rem;
    border-radius: 4px;
    border: 1px solid #30363d;
    background: #0d1117;
    color: #e6e6e6;
    min-width: 220px;
}

.filters {
    display: flex;
    gap: .75rem;
    flex-wrap: wrap;
    font-size: .85rem;
}

.filters label {
    display: flex;
    gap: .25rem;
    align-items: center;
}

main {
    padding: 1rem;
}

.grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 1rem;
}

.card {
    display: flex;
    flex-direction: column;
    gap: .5rem;
    padding: .5rem;
    background: #161b22;
    border: 1px solid #30363d;
    border-radius: 8px;
    text-decoration: none;
    color: #e6e6e6;
    position: relative;
    overflow: hidden;
    cursor: pointer;
}

.card:hover {
    border-color: #58a6ff;
    box-shadow: 0 0 0 1px #58a6ff33;
}

.card .thumb {
    aspect-ratio: 4 / 3;
    background: #0d1117;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    border-radius: 4px;
}

.card img {
    max-width: 100%;
    max-height: 100%;
    object-fit: cover;
    display: block;
}

.card .icon {
    font-size: 2.25rem;
    opacity: .7;
}

.card .meta {
    display: flex;
    flex-direction: column;
    gap: .25rem;
    font-size: .7rem;
}

.card .name {
    word-break: break-all;
    line-height: 1.1;
}

.card .size {
    opacity: .6;
}

.preview {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, .85);
    display: flex;
    flex-direction: column;
    padding: 2rem;
}

.preview.hidden {
    display: none;
}

#closePreview {
    position: absolute;
    top: 1rem;
    right: 1rem;
    background: #30363d;
    color: #e6e6e6;
    border: none;
    border-radius: 50%;
    width: 2.25rem;
    height: 2.25rem;
    font-size: 1.25rem;
    cursor: pointer;
}

#previewContent {
    flex: 1;
    min-height: 0;
    overflow: auto;
    display: flex;
    align-items: center;
    justify-content: center;
}

#previewContent img,
#previewContent video,
#previewContent audio,
#previewContent iframe {
    max-width: 100%;
    max-height: 100%;
}

#previewContent pre {
    background: #161b22;
    padding: 1rem;
    border-radius: 8px;
    max-width: 100%;
    white-space: pre-wrap;
    word-break: break-word;
}

footer {
    padding: 1rem;
    text-align: center;
    font-size: .7rem;
    opacity: .5;
}

/* Search Suggestions */
.suggestions-box {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: #020806;
    border: 1px solid #133;
    border-top: none;
    border-radius: 0 0 6px 6px;
    max-height: 300px;
    overflow-y: auto;
    z-index: 50;
    display: none;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
}

.suggestions-box.show {
    display: block;
}

.suggestion-item {
    padding: 0.6rem 1rem;
    font-size: 0.85rem;
    color: #9ff;
    border-bottom: 1px solid #133;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.suggestion-item:last-child {
    border-bottom: none;
}

.suggestion-item:hover,
.suggestion-item.active {
    background: #0c512f;
    color: #fff;
}

.suggestion-item .type {
    font-size: 0.7rem;
    opacity: 0.6;
    text-transform: uppercase;
    border: 1px solid #3fffb0;
    padding: 2px 6px;
    border-radius: 4px;
}

.search-wrapper {
    position: relative;
    flex: 1 1 100%;
    /* Full width on small, adapts on large */
    max-width: 600px;
}