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

body {
    font-family: 'Courier New', Courier, monospace;
    font-size: 14px;
    color: #333;
    background: #fff;
}

a { color: #0066cc; text-decoration: none; }
a:hover { text-decoration: underline; }

/* Header */
header {
    position: sticky;
    top: 0;
    z-index: 100;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 1.5rem;
    height: 50px;
    background: #fff;
    border-bottom: 1px solid #ddd;
}
.header-left { display: flex; align-items: center; gap: 1rem; }
.header-right { display: flex; align-items: center; gap: 1rem; }
.logo { font-weight: bold; font-size: 16px; color: #333; }
.logo:hover { text-decoration: none; }
.tagline { color: #888; font-size: 12px; }
#asset-count { color: #888; font-size: 12px; white-space: nowrap; }

header input[type="text"] {
    font-family: inherit;
    font-size: 13px;
    padding: 0.3em 0.6em;
    border: 1px solid #ccc;
    border-radius: 3px;
    width: 220px;
}
header input[type="text"]:focus {
    outline: none;
    border-color: #0066cc;
}

/* Filters */
.filters {
    position: sticky;
    top: 50px;
    z-index: 99;
    background: #f9f9f9;
    border-bottom: 1px solid #ddd;
    padding: 0.5rem 1.5rem;
}
.filter-row {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    margin-bottom: 0.3rem;
}
.filter-row:last-child { margin-bottom: 0; }
.filter-row label {
    font-size: 12px;
    color: #888;
    min-width: 50px;
}

.pill {
    font-family: inherit;
    font-size: 11px;
    padding: 0.2em 0.5em;
    background: #eee;
    border: 1px solid #ccc;
    border-radius: 3px;
    cursor: pointer;
    transition: all 0.15s;
}
.pill:hover { background: #ddd; }
.pill.active {
    background: #0066cc;
    color: #fff;
    border-color: #0066cc;
}

.filter-row select {
    font-family: inherit;
    font-size: 12px;
    padding: 0.2em 0.4em;
    border: 1px solid #ccc;
    border-radius: 3px;
    max-width: 300px;
}

/* Asset grid */
main { padding: 1rem 1.5rem; }

.asset-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    gap: 0.5rem;
}

.asset-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 0.5rem;
    border: 1px solid #eee;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.15s;
    min-height: 90px;
    justify-content: center;
}
.asset-card:hover {
    border-color: #0066cc;
    background: #f5f8fc;
}

.asset-card img {
    max-width: 48px;
    max-height: 48px;
    image-rendering: pixelated;
    margin-bottom: 0.3rem;
}
.asset-card img.large {
    max-width: 64px;
    max-height: 64px;
}

.asset-card .label {
    font-size: 9px;
    color: #888;
    text-align: center;
    word-break: break-all;
    line-height: 1.2;
    max-width: 100%;
    overflow: hidden;
}

.asset-type-badge {
    font-size: 8px;
    padding: 0.1em 0.3em;
    border-radius: 2px;
    text-transform: uppercase;
    font-weight: bold;
}
.badge-ico { background: #e3f2fd; color: #1565c0; }
.badge-cur { background: #e8f5e9; color: #2e7d32; }
.badge-ani { background: #fff3e0; color: #e65100; }
.badge-bmp { background: #fce4ec; color: #c62828; }
.badge-raw { background: #f3e5f5; color: #6a1b9a; }

/* Checkerboard background for transparency */
.checker {
    background-image:
        linear-gradient(45deg, #e0e0e0 25%, transparent 25%),
        linear-gradient(-45deg, #e0e0e0 25%, transparent 25%),
        linear-gradient(45deg, transparent 75%, #e0e0e0 75%),
        linear-gradient(-45deg, transparent 75%, #e0e0e0 75%);
    background-size: 8px 8px;
    background-position: 0 0, 0 4px, 4px -4px, -4px 0;
}

/* Scroll sentinel */
.scroll-sentinel {
    display: flex;
    justify-content: center;
    padding: 1rem;
    grid-column: 1 / -1;
    color: #888;
    font-size: 12px;
}

/* No results */
.no-results {
    grid-column: 1 / -1;
    text-align: center;
    padding: 3rem;
    color: #888;
}

/* Modal */
.modal-overlay {
    display: none;
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.5);
    z-index: 200;
    justify-content: center;
    align-items: center;
}
.modal-overlay.open {
    display: flex;
}

.modal {
    background: #fff;
    border-radius: 6px;
    padding: 1.5rem;
    max-width: 700px;
    width: 90%;
    max-height: 85vh;
    overflow-y: auto;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid #eee;
}
.modal-header h2 {
    font-size: 16px;
    font-family: inherit;
}
.modal-close {
    font-size: 20px;
    cursor: pointer;
    color: #888;
    background: none;
    border: none;
    font-family: inherit;
}
.modal-close:hover { color: #333; }

.modal-preview {
    display: flex;
    justify-content: center;
    padding: 1.5rem;
    margin-bottom: 1rem;
    border: 1px solid #eee;
    border-radius: 4px;
}
.modal-preview img {
    image-rendering: pixelated;
    max-width: 100%;
}
.modal-preview.checker {
    background-size: 16px 16px;
    background-position: 0 0, 0 8px, 8px -8px, -8px 0;
}

.detail-grid {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 0.3rem 1rem;
    font-size: 13px;
    margin-bottom: 1rem;
}
.detail-grid dt { color: #888; }
.detail-grid dd { color: #333; }

.size-variants {
    margin-top: 1rem;
}
.size-variants h3 {
    font-size: 13px;
    font-family: inherit;
    margin-bottom: 0.5rem;
}
.size-grid {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}
.size-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 0.5rem;
    border: 1px solid #eee;
    border-radius: 4px;
}
.size-item img {
    image-rendering: pixelated;
}
.size-item .size-label {
    font-size: 10px;
    color: #888;
    margin-top: 0.3rem;
}

.os-appearances {
    margin-top: 1rem;
}
.os-appearances h3 {
    font-size: 13px;
    font-family: inherit;
    margin-bottom: 0.5rem;
}
.os-list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.3rem;
}
.os-tag {
    font-size: 11px;
    padding: 0.2em 0.5em;
    background: #f0f0f0;
    border-radius: 3px;
}

/* Responsive */
@media (max-width: 768px) {
    header { flex-direction: column; height: auto; padding: 0.5rem 1rem; gap: 0.3rem; }
    .header-left, .header-right { width: 100%; }
    header input[type="text"] { width: 100%; }
    .tagline { display: none; }
    .filters { top: auto; position: static; }
    .asset-grid { grid-template-columns: repeat(auto-fill, minmax(80px, 1fr)); }
}
