.works-gallery-container {
    width: 100%;
    padding: 20px;
}

/* h2タイトルを中央揃え */
.works-gallery-container h2 {
    text-align: center;
    margin-bottom: 30px;
}

/* カテゴリーフィルターをスタイリッシュに */
.category-filter {
    display: flex;
    justify-content: center;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
    margin: 20px 0 40px 0;
    padding: 0 20px;
}

.filter-btn {
    background: transparent;
    border: 1px solid #e0e0e0;
    padding: 6px 18px;
    cursor: pointer;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 500;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    color: #666;
    position: relative;
    overflow: hidden;
    min-width: 60px;
    white-space: nowrap;
}

.filter-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.4), transparent);
    transition: left 0.5s;
}

.filter-btn:hover::before {
    left: 100%;
}

.filter-btn:hover {
    border-color: #333;
    color: #333;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

.filter-btn.active {
    background: #333;
    border-color: #333;
    color: #fff;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
}

.filter-btn.active:hover {
    background: #222;
    border-color: #222;
}

.gallery-grid {
    columns: 5;
    column-gap: 0;
    width: 100%;
}

.gallery-item {
    position: relative;
    overflow: hidden;
    cursor: pointer;
    transition: all 0.3s ease;
    background: white;
    break-inside: avoid;
    display: block;
    width: 100%;
    margin-bottom: 0;
}

.gallery-item img {
    width: 100%;
    height: auto;
    object-fit: cover;
    display: block;
    transition: transform 0.3s ease;
}

.gallery-item:hover img {
    transform: scale(1.05);
}

.gallery-item .overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.gallery-item:hover .overlay {
    opacity: 1;
}

.overlay-content {
    text-align: center;
    padding: 20px;
}

.overlay-title {
    font-size: 1.2rem;
    font-weight: bold;
    margin-bottom: 10px;
}

.overlay-description {
    font-size: 0.9rem;
    opacity: 0.9;
}

/* ランダムアニメーション */
@keyframes bounce {
    0%, 100% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(-10px);
    }
}

@keyframes pulse {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.02);
    }
}

@keyframes wiggle {
    0%, 100% {
        transform: rotate(0deg);
    }
    25% {
        transform: rotate(1deg);
    }
    75% {
        transform: rotate(-1deg);
    }
}

@keyframes glow {
    0%, 100% {
        box-shadow: 0 0 5px rgba(74, 144, 226, 0.3);
    }
    50% {
        box-shadow: 0 0 20px rgba(74, 144, 226, 0.6);
    }
}

.animate-bounce {
    animation: bounce 0.8s ease-in-out;
}

.animate-pulse {
    animation: pulse 1s ease-in-out;
}

.animate-wiggle {
    animation: wiggle 0.6s ease-in-out;
}

.animate-glow {
    animation: glow 1.2s ease-in-out;
}

/* Lightbox */
.lightbox {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.9);
    cursor: pointer;
}

.lightbox-content {
    position: relative;
    margin: auto;
    padding: 0;
    width: 90%;
    max-width: 1200px;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: default;
}

.lightbox-image {
    max-width: 100%;
    max-height: 90%;
    object-fit: contain;
    opacity: 0;
    transition: opacity 0.3s ease;
    cursor: pointer;
}

.lightbox-image.show {
    opacity: 1;
}

.close {
    position: absolute;
    top: 15px;
    right: 35px;
    color: #f1f1f1;
    font-size: 40px;
    font-weight: bold;
    cursor: pointer;
    z-index: 1001;
}

.close:hover {
    color: #bbb;
}

.nav-button {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background-color: rgba(255, 255, 255, 0.2);
    color: white;
    border: none;
    font-size: 24px;
    padding: 15px 20px;
    cursor: pointer;
    transition: background-color 0.3s ease;
    z-index: 1001;
    border-radius: 5px;
}

.nav-button:hover {
    background-color: rgba(255, 255, 255, 0.4);
}

.prev {
    left: 20px;
}

.next {
    right: 20px;
}

.image-counter {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    color: white;
    font-size: 16px;
    background-color: rgba(0, 0, 0, 0.5);
    padding: 10px 20px;
    border-radius: 20px;
}

.loading {
    text-align: center;
    padding: 40px;
    font-size: 1.2rem;
    color: #666;
}

.loading-spinner {
    display: inline-block;
    width: 40px;
    height: 40px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid #4a90e2;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-right: 10px;
}

.no-more-images {
    text-align: center;
    padding: 40px;
    font-size: 1.2rem;
    color: #666;
    font-style: italic;
}

@keyframes spin {
    0% {
        transform: rotate(0deg);
    }
    100% {
        transform: rotate(360deg);
    }
}

@media (max-width: 1200px) {
    .gallery-grid {
        columns: 4;
    }
}

@media (max-width: 900px) {
    .gallery-grid {
        columns: 3;
    }
}

@media (max-width: 600px) {
    .gallery-grid {
        columns: 2;
    }

    .nav-button {
        font-size: 18px;
        padding: 12px 16px;
    }

    .prev {
        left: 10px;
    }

    .next {
        right: 10px;
    }

    .close {
        top: 10px;
        right: 20px;
        font-size: 30px;
    }

    .filter-btn {
        font-size: 10px;
        padding: 5px 14px;
        margin: 3px;
    }

    .category-filter {
        gap: 6px;
    }
}

@media (max-width: 400px) {
    .gallery-grid {
        columns: 1;
    }

    .nav-button {
        font-size: 16px;
        padding: 10px 12px;
    }

    .prev {
        left: 5px;
    }

    .next {
        right: 5px;
    }

    .close {
        top: 5px;
        right: 15px;
        font-size: 25px;
    }

    .filter-btn {
        font-size: 9px;
        padding: 4px 12px;
    }
}