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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: #f8f8f8;
    color: #333;
    font-size: 14px;
}

.header {
    position: sticky;
    top: 0;
    z-index: 1000;
    background: white;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    padding: 10px 0;
}

.header-content {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 20px;
    flex-wrap: wrap;
}

.title {
    font-size: 18px;
    font-weight: 600;
}

.controls {
    display: flex;
    gap: 15px;
    align-items: center;
    flex: 1;
    justify-content: flex-end;
}

.search-box {
    padding: 6px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 13px;
    outline: none;
    width: 200px;
}

.search-box:focus {
    border-color: #667eea;
}

.page-size-selector {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
}

.page-size-selector select {
    padding: 5px 8px;
    border: 1px solid #ddd;
    border-radius: 4px;
    outline: none;
    cursor: pointer;
    font-size: 13px;
}

.pagination {
    display: flex;
    align-items: center;
    gap: 5px;
}

.page-btn {
    padding: 5px 10px;
    border: 1px solid #ddd;
    background: white;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 13px;
}

.page-btn:hover:not(:disabled) {
    border-color: #667eea;
    color: #667eea;
}

.page-btn.active {
    background: #667eea;
    color: white;
    border-color: #667eea;
}

.page-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.page-info {
    font-size: 12px;
    color: #666;
    padding: 0 10px;
}

.filter-notice {
    background: #fff3cd;
    border: 1px solid #ffeaa7;
    color: #856404;
    padding: 8px 15px;
    border-radius: 4px;
    font-size: 12px;
    margin: 10px auto;
    max-width: 1400px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.gallery-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 15px 20px 30px;
}

.style-row {
    background: white;
    border-radius: 8px;
    margin-bottom: 10px;
    padding: 12px 15px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
    transition: box-shadow 0.2s;
}

.style-row:hover {
    box-shadow: 0 2px 8px rgba(0,0,0,0.12);
}

.style-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.style-label {
    font-weight: 500;
    color: #333;
    font-size: 16px;
}

.style-index {
    font-size: 11px;
    color: #999;
}

.images-grid {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 10px;
}

.image-item {
    text-align: center;
    display: flex;
    flex-direction: column;
}

.image-container {
    width: 100%;
    aspect-ratio: 1;
    border-radius: 6px;
    overflow: hidden;
    background: #f5f5f5;
    position: relative;
    cursor: pointer;
    transition: transform 0.2s;
    border: 1px solid #eee;
    flex-shrink: 0;
}

.image-container:hover {
    transform: scale(1.02);
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    z-index: 1;
}

.image-container img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.image-container.loading {
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: loading 1.5s infinite;
}

@keyframes loading {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

.subject-label {
    font-size: 12px;
    color: #666;
    margin-top: 4px;
    white-space: normal;
    word-wrap: break-word;
    line-height: 1.3;
}

.modal {
    display: none;
    position: fixed;
    z-index: 2000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.95);
}

.modal-content {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    max-width: 90%;
    max-height: 90%;
}

.modal-content img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.close {
    position: absolute;
    top: 20px;
    right: 30px;
    color: white;
    font-size: 36px;
    font-weight: 300;
    cursor: pointer;
    z-index: 2001;
}

.close:hover {
    color: #ccc;
}

.error-msg {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: #d32f2f;
    font-size: 10px;
}

@media (max-width: 1200px) {
    .images-grid {
        grid-template-columns: repeat(4, minmax(0, 1fr));
    }
}

@media (max-width: 768px) {
    .header-content {
        flex-direction: column;
        align-items: stretch;
    }
    
    .controls {
        justify-content: center;
    }
    
    .images-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
        gap: 8px;
    }
}