body {
    margin:0;
    background:#111;
    color:white;
    font-family:sans-serif;

    padding-bottom: 60px;
}

#gallery {
    display:grid;
    grid-template-columns:repeat(auto-fill,minmax(280px,1fr));
    gap:16px;
    padding:16px;
}

.card {
    position:relative;
}

.card img {
    width: 100%;
    aspect-ratio: 336 / 432;    /* サムネイルサイズ */
    object-fit: cover;
    display: block;
    background: #222;
    opacity: 0;
    transition: opacity .25s;
    cursor: pointer;
}

.card.loading img {
    animation: pulse 1.2s infinite;
}

.card img.loaded {
    opacity: 1;
}

@keyframes pulse {
    0% {
        background: #222;
    }
    50% {
        background: #333;
    }
    100% {
        background: #222;
    }
}

.overlay {
    position:absolute;
    left:0;
    right:0;
    bottom:0;
    display:flex;
    justify-content:space-between;
    background:rgba(0,0,0,.7);
    padding:8px 12px;
}

.hidden {
    display:none;
}

.modal {
    position:fixed;
    inset:0;
    background:rgba(0,0,0,.85);
    z-index:1000;
    overflow-y:auto;
    padding:20px;
}

#closeModal {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 1200;

    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255,255,255,.95);
    border-radius: 4px;
    border: none;
    cursor: pointer;
    padding: 4px;
}

.modal-content {
    max-width: 940px;
    margin: 0 auto;
    background: #222;
    border-radius: 12px;
    padding: 20px;
}

.artwork-images {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
}

.artwork-image {
    width: auto;
    max-width: 100%;
    height: auto;
    display: block;
    margin: 0 auto;
    border-radius: 8px;
    background: #222;
    opacity: 0;
    transition: opacity .25s ease;
}

.artwork-image.loaded {
    opacity: 1;
}

.artwork-nav {
    display:flex;
    justify-content:center;
    gap:12px;
    margin-bottom:20px;
}

.nav-thumb {
    width:140px;
    cursor:pointer;
    text-align:center;
}

.nav-thumb img {
    width:100%;
    aspect-ratio:336 / 432; /* サムネイルサイズで調整 */
    object-fit:cover;
    display:block;
    border-radius:6px;
}

.nav-thumb.current img {
    border:3px solid white;
}

.nav-label {
    display:block;
    margin-top:4px;
    font-size:12px;
}

.nav-thumb.empty {
    visibility:hidden;
}

.nav-title {
    display:block;
    margin-top:6px;
    font-size:12px;
    white-space:nowrap;
    overflow:hidden;
    text-overflow:ellipsis;
}

.nav-thumb.current .nav-title {
    font-weight:bold;
}

#imageCounter {
    position: fixed;
    top: 70px;
    right: 20px;
    z-index: 1200;
    background: rgba(0,0,0,.7);
    padding: 6px 12px;
    border-radius: 20px;
}

.artwork-header {
    display:flex;
    justify-content:space-between;
    align-items:center;
}

.like-button {
    border:none;
    border-radius:20px;
    padding:8px 16px;
    cursor:pointer;
    font-size:15px;

    display: flex;
    align-items: center;
    gap: 0.25em;
}

.like-button.liked {
    opacity:0.7;
}

.artwork-actions {
    display: flex;
    gap: 10px;
    align-items: center;
}

.share-button {
    display: inline-block;
    padding: 8px 16px;
    border-radius: 20px;
    background: #000;
    color: white;
    text-decoration: none;
    font-size: 15px;
}

.share-button:hover {
    opacity: 0.8;
}

#loadTrigger {
    height: 1px;
}

.site-header {
    position: sticky;
    top: 0;
    z-index: 500;
    padding: 14px 20px;
    background: rgba(0,0,0,.6);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid rgba(255,255,255,.1);
}

.site-title {
    font-family: Arial, sans-serif;
    font-size: 28px;
    font-weight: 700;
}

.site-tagline {
    font-size: 13px;
    color: #bbb;
}

.site-footer {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;

    padding: 8px 20px;

    background: rgba(0,0,0,.65);
    backdrop-filter: blur(12px);

    text-align: center;
    font-size: 12px;
    color: #888;

    z-index: 500;

    border-top: 1px solid rgba(255,255,255,.08);
}

.site-footer a {
    color: #9fc5ff;
    text-decoration: none;
}

.site-footer a:hover {
    color: #c7dcff;
}

.favorite-svg {
    font-size: 1.4em;
    color: #FE3F70;
    vertical-align: middle;
}

.card-like {
    display: flex;
    align-items: center;
    gap: 0.25em;
}

/* Mobile */
@media (max-width:768px) {
    .nav-title {
        display:none;
    }

    .artwork-header {
        display:flex;
        flex-direction:column;
        align-items:flex-start;
        gap:10px;
    }

    .artwork-nav {
        gap:8px;
    }

    .nav-thumb {
        width:90px;
    }

    .artwork-actions {
        margin-bottom: 8px;
    }
}