/* ==========================================================================
   繧ｮ繝｣繝ｩ繝ｪ繝ｼ繝壹�繧ｸ蟆ら畑繧ｹ繧ｿ繧､繝ｫ
   ========================================================================== */

/* 蜈ｨ菴薙�繝懊ャ繧ｯ繧ｹ繝｢繝�Ν繧定ｦ丞ｮ� */
.gallery-container,
.gallery-container * {
    box-sizing: border-box;
}

.gallery-container {
    max-width: 1200px;
    margin: 40px auto;
    padding: 0 20px;
}

.gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 20px;
    margin-top: 24px;
}

.gallery-card {
    background: var(--c-bg-glass);
    backdrop-filter: var(--blur-glass);
    -webkit-backdrop-filter: var(--blur-glass);
    border: 1px solid var(--c-border-glass);
    border-radius: 12px;
    padding: 16px;
    text-align: center;
    transition: transform 0.3s cubic-bezier(0.22, 1, 0.36, 1), box-shadow 0.3s cubic-bezier(0.22, 1, 0.36, 1), border-color 0.3s;
    position: relative;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    height: auto;
    min-height: 100%;
}

/* --- Adjustment --- */
.gallery-card-overlay {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, rgba(255,255,255,0.03) 0%, transparent 100%);
    pointer-events: none;
    z-index: 1;
}

.gallery-card:hover {
    transform: translateY(-8px);
    border-color: rgba(84, 193, 249, 0.6);
    box-shadow: 0 12px 24px rgba(0, 0, 0, 0.4), 0 0 15px rgba(84, 193, 249, 0.2);
}

.gallery-image-wrap {
    position: relative;
    width: 100%;
    height: 200px;
    overflow: hidden;
    border-radius: 4px;
    margin-bottom: 12px;
    background: #111;
}

.gallery-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: top;
    opacity: 0.9;
    transition: opacity 0.3s;
}

.gallery-card:hover .gallery-image {
    opacity: 1;
}

/* --- Adjustment --- */
@keyframes card-fade-in {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.gallery-card.is-entering {
    animation: card-fade-in 0.6s cubic-bezier(0.22, 1, 0.36, 1) forwards;
    opacity: 0;
}

.gallery-name {
    font-size: 1.1rem;
    font-weight: bold;
    color: #fff;
    margin-bottom: 8px;
    line-height: 1.25;
}

.gallery-card-player {
    display: block;
    font-size: 0.75rem;
    font-weight: normal;
    color: var(--c-accent-cyan, #54c1f9);
    margin-top: 4px;
    opacity: 0.8;
}

.gallery-meta-info {
    font-size: 0.85rem;
    color: #888;
    display: flex;
    gap: 12px;
    justify-content: center;
    align-items: baseline; /* 蠎戊ｾｺ縺ｧ謠�∴繧� */
    margin-bottom: 8px;
    flex-wrap: wrap;
    line-height: 1;
}

.gallery-id, .gallery-updated {
    white-space: nowrap;
}

.gallery-btn {
    display: inline-block;
    padding: 6px 16px;
    background: #54c1f9;
    color: #fff;
    text-decoration: none;
    border-radius: 4px;
    font-weight: bold;
}

.gallery-btn:hover {
    background: #3a91c1;
}

/* --- Adjustment --- */
/* Sticky Wrapper (Phase 1) */
.gallery-sticky-wrapper {
    position: sticky;
    top: 50px; /* 蜈ｱ騾壹�繝�ム繝ｼ��50px�峨�逶ｴ荳九↓蠑ｵ繧贋ｻ倥￥繧医≧縺ｫ隱ｿ謨ｴ */
    z-index: 100;
    margin: 0 -20px 24px;
    padding: 12px 20px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    background: transparent;
}

.gallery-sticky-wrapper.is-scrolled {
    background: rgba(13, 13, 18, 0.9);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    padding-top: 6px;
    padding-bottom: 6px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.7);
    border-bottom: 1px solid rgba(84, 193, 249, 0.3); /* 繝阪が繝ｳ繝悶Ν繝ｼ縺ｮ蠅�阜邱� */
}

.gallery-toolbar {
    display: flex;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
    background: var(--c-bg-glass);
    backdrop-filter: var(--blur-glass);
    -webkit-backdrop-filter: var(--blur-glass);
    border: 1px solid var(--c-border-glass);
    padding: 16px 20px;
    border-radius: 12px;
    box-shadow: inset 0 0 10px rgba(0, 243, 255, 0.05);
    transition: all 0.3s ease;
}

.gallery-sticky-wrapper.is-scrolled .gallery-toolbar {
    background: transparent;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    border: none;
    box-shadow: none;
    padding: 8px 10px;
}

.gallery-search-wrap {
    flex: 1;
    min-width: 180px;
    position: relative;
}

.gallery-search-wrap::before {
    content: '';
    position: absolute;
    left: 10px;
    top: 50%;
    transform: translateY(-50%);
    width: 16px;
    height: 16px;
    background-color: #54c1f9;
    -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='11' cy='11' r='8'/%3E%3Cline x1='21' y1='21' x2='16.65' y2='16.65'/%3E%3C/svg%3E");
    mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='11' cy='11' r='8'/%3E%3Cline x1='21' y1='21' x2='16.65' y2='16.65'/%3E%3C/svg%3E");
    -webkit-mask-repeat: no-repeat;
    mask-repeat: no-repeat;
    -webkit-mask-size: contain;
    mask-size: contain;
    pointer-events: none;
}

#gallery-search {
    width: 100%;
    box-sizing: border-box;
    padding: 8px 12px 8px 34px;
    background: #1a1a1e;
    border: 1px solid #444;
    border-radius: 6px;
    color: #fff;
    font-size: 14px;
    transition: border-color 0.2s, box-shadow 0.2s;
}

#gallery-search:focus {
    outline: none;
    border-color: #54c1f9;
    box-shadow: 0 0 0 2px rgba(84, 193, 249, 0.2);
}

#gallery-search::placeholder {
    color: #666;
}

.gallery-search-count {
    font-size: 13px;
    color: #888;
    white-space: nowrap;
}

.gallery-view-btns {
    display: flex;
    gap: 4px;
}

.gallery-view-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    background: #1a1a1e;
    border: 1px solid #444;
    border-radius: 6px;
    cursor: pointer;
    transition: border-color 0.2s, background 0.2s;
    padding: 0;
}

.gallery-view-btn:hover {
    border-color: #54c1f9;
    background: rgba(84, 193, 249, 0.08);
}

.gallery-view-btn.is-active {
    border-color: #54c1f9;
    background: rgba(84, 193, 249, 0.15);
}

.gallery-view-btn svg {
    stroke: #888;
    transition: stroke 0.2s;
}

.gallery-view-btn.is-active svg,
.gallery-view-btn:hover svg {
    stroke: #54c1f9;
}

/* --- Adjustment --- */




/* Aspect Ratio Optimized (Phase 2) */
.gallery-image-wrap {
    width: 100%;
    overflow: hidden;
    background: #1a1a1e;
    position: relative;
    /* Default (PC: 16/9) */
    aspect-ratio: 16 / 9;
}

/* PC narrow / Intermediate */
@media (max-width: 1280px) {
    .gallery-image-wrap {
        aspect-ratio: 4 / 3;
    }
}

/* Tablet: 1.43:1 */
@media (min-width: 768px) and (max-width: 1023px) {
    .gallery-image-wrap {
        aspect-ratio: 1.43 / 1;
    }
}

/* Smartphone: 9:19.5 (Vertical) */
@media (max-width: 767px) {
    .gallery-image-wrap {
        aspect-ratio: 9 / 19.5;
    }
    
    /* Mobile UX: Button Tap Area (Phase 3) */
    .gallery-flag-btn,
    .gallery-copy-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 12px 6px;
    background: transparent;
    border: none;
    border-radius: 0;
    color: #888;
    font-size: 11px;
    font-family: inherit;
    cursor: pointer;
    transition: all 0.2s;
    letter-spacing: 0.03em;
}
    
    .gallery-card-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0;
    margin: auto -16px -16px; /* 繧ｫ繝ｼ繝峨�繝代ョ繧｣繝ｳ繧ｰ繧呈遠縺｡豸医＠縺ｦ遶ｯ縺ｾ縺ｧ蠎�￡繧� */
    border-top: 1px solid rgba(84, 193, 249, 0.2);
    border-radius: 0 0 12px 12px;
    overflow: hidden;
    background: rgba(255, 255, 255, 0.02);
}
    
    .gallery-name {
        font-size: clamp(1rem, 4vw, 1.2rem);
    }
}

.gallery-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.5s ease;
}

.gallery-grid.is-list .gallery-card:hover {
    transform: translateX(6px);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3), 0 0 10px rgba(84, 193, 249, 0.15);
}

/* --- Adjustment --- */
.gallery-grid.is-list .gallery-card::before,
.gallery-grid.is-list .gallery-card::after {
    display: none;
}

/* --- Adjustment --- */
.gallery-grid.is-list .gallery-card-overlay::before,
.gallery-grid.is-list .gallery-card-overlay::after {
    display: none;
}



.gallery-grid.is-list .gallery-image {
    width: 100%;
    height: 100%;
}







/* --- Adjustment --- */
.gallery-no-result {
    color: #ccc;
    font-size: 15px;
    padding: 60px 20px;
    text-align: center;
    display: none;
    background: rgba(20, 20, 26, 0.6);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border: 1px solid rgba(84, 193, 249, 0.15);
    border-radius: 16px;
    margin: 40px auto;
    max-width: 600px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
}

.gallery-no-result p {
    margin-bottom: 12px;
    line-height: 1.6;
}

#gallery-no-result-query {
    color: #54c1f9;
    font-weight: bold;
    padding: 0 4px;
}

.gallery-no-result-hint {
    font-size: 13px;
    color: #777;
    line-height: 1.6;
}

.gallery-no-result::before {
    content: '';
    display: block;
    width: 48px;
    height: 48px;
    margin: 0 auto 24px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2354c1f9' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='11' cy='11' r='8'/%3E%3Cline x1='21' y1='21' x2='16.65' y2='16.65'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-size: contain;
    opacity: 0.8;
    filter: drop-shadow(0 0 8px rgba(84, 193, 249, 0.4));
}

/* --- Adjustment --- */
.gallery-sort-wrap {
    display: flex;
    align-items: center;
    gap: 6px;
    white-space: nowrap;
}

.gallery-sort-wrap label {
    font-size: 13px;
    color: #888;
}

#gallery-sort {
    padding: 6px 28px 6px 10px;
    background: #1a1a1e;
    border: 1px solid #444;
    border-radius: 6px;
    color: #ccc;
    font-size: 13px;
    cursor: pointer;
    appearance: none;
    -webkit-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23888' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 6px center;
    background-size: 16px;
    transition: border-color 0.2s;
}

#gallery-sort:focus {
    outline: none;
    border-color: #54c1f9;
}

.gallery-page-size-wrap {
    display: flex;
    align-items: center;
    gap: 6px;
    white-space: nowrap;
}

.gallery-page-size-wrap label {
    font-size: 13px;
    color: #888;
}

#gallery-page-size {
    padding: 6px 24px 6px 10px;
    background: #1a1a1e;
    border: 1px solid #444;
    border-radius: 6px;
    color: #ccc;
    font-size: 13px;
    cursor: pointer;
    appearance: none;
    -webkit-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23888' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 6px center;
    background-size: 16px;
    transition: border-color 0.2s;
}

#gallery-page-size:focus {
    outline: none;
    border-color: #54c1f9;
}

/* --- Adjustment --- */
/* 驥崎､�＠縺ｦ縺�◆ .gallery-card 縺ｮ螳夂ｾｩ繧貞炎髯､ (荳企Κ縺ｮ蝓ｺ譛ｬ螳夂ｾｩ縺ｫ髮�ｴ�) */

/* --- Adjustment --- */

/* --- Adjustment --- */
.gallery-card > a {
    flex: 1;
    display: flex;
    flex-direction: column;
}

/* --- Adjustment --- */
.gallery-card-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0;
    margin: auto -16px -16px;
    border-top: 1px solid rgba(84, 193, 249, 0.2);
    border-radius: 0 0 12px 12px;
    overflow: hidden;
    background: rgba(255, 255, 255, 0.03);
}



/* --- Adjustment --- */
.gallery-flag-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 12px 6px;
    background: transparent;
    border: none;
    border-right: 1px solid rgba(84, 193, 249, 0.15);
    border-radius: 0;
    color: #888;
    font-size: 11px;
    font-family: inherit;
    cursor: pointer;
    transition: all 0.2s;
    letter-spacing: 0.03em;
}

.gallery-flag-btn:hover {
    background: rgba(84, 193, 249, 0.12);
    color: #54c1f9;
}

.gallery-flag-btn svg {
    stroke: #555;
    flex-shrink: 0;
    transition: stroke 0.2s;
}

.gallery-flag-btn:hover svg {
    stroke: #8b9cf9;
}

/* --- Adjustment --- */
.gallery-copy-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 12px 6px;
    background: transparent;
    border: none;
    border-radius: 0;
    color: #888;
    font-size: 11px;
    font-family: inherit;
    cursor: pointer;
    transition: all 0.2s;
    letter-spacing: 0.03em;
}

.gallery-copy-btn:hover {
    background: rgba(84, 193, 249, 0.12);
    color: #54c1f9;
}

.gallery-copy-btn svg {
    stroke: #666;
    flex-shrink: 0;
    transition: stroke 0.2s;
}

.gallery-copy-btn:hover svg {
    stroke: #8b9cf9;
}

.gallery-copy-btn.copied {
    color: #54c1f9;
    background: rgba(84, 193, 249, 0.1);
}

.gallery-copy-btn.copied svg {
    stroke: #54c1f9;
}

.gallery-copy-btn.copied .gallery-copy-label {
    display: none;
}

.gallery-copy-btn.copied .gallery-copied-label {
    display: inline;
}

.gallery-copy-btn:not(.copied) .gallery-copied-label {
    display: none;
}

/* --- Adjustment --- */






 .gallery-flag-btn { border-right: 1px solid rgba(84, 193, 249, 0.15); } .gallery-flag-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 12px 6px;
    background: transparent;
    border: none;
    border-radius: 0;
    color: #888;
    font-size: 11px;
    font-family: inherit;
    cursor: pointer;
    transition: all 0.2s;
    letter-spacing: 0.03em;
} .gallery-flag-btn { border-right: 1px solid rgba(84, 193, 249, 0.15); }



/* --- Adjustment --- */
.gallery-tooltip {
    position: absolute;
    bottom: calc(100% + 8px);
    left: 50%;
    transform: translateX(-50%);
    background: rgba(20, 20, 26, 0.97);
    border: 1px solid #54c1f9;
    border-radius: 6px;
    padding: 10px 14px;
    color: #ccc;
    font-size: 12px;
    line-height: 1.7;
    white-space: nowrap;
    pointer-events: none;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.15s, visibility 0.15s;
    z-index: 10;
    box-shadow: 0 4px 16px rgba(0,0,0,0.5);
}

.gallery-tooltip::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    border: 6px solid transparent;
    border-top-color: #54c1f9;
}

.gallery-card:hover .gallery-tooltip {
    opacity: 1;
    visibility: visible;
}

/* --- Adjustment --- */
.gallery-grid.is-list .gallery-tooltip {
    display: none;
}

/* --- Adjustment --- */
.gallery-pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    margin-top: 32px;
    flex-wrap: wrap;
}

.gallery-page-btn {
    min-width: 36px;
    height: 36px;
    padding: 0 10px;
    background: #1a1a1e;
    border: 1px solid #444;
    border-radius: 6px;
    color: #ccc;
    font-size: 13px;
    cursor: pointer;
    transition: border-color 0.2s, background 0.2s, color 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.gallery-page-btn:hover:not(:disabled) {
    border-color: #54c1f9;
    color: #54c1f9;
    background: rgba(84, 193, 249, 0.08);
}

.gallery-page-btn.is-current {
    border-color: #54c1f9;
    background: rgba(84, 193, 249, 0.15);
    color: #54c1f9;
    font-weight: bold;
    cursor: default;
}

.gallery-page-btn:disabled {
    opacity: 0.35;
    cursor: default;
}

.gallery-page-info {
    font-size: 13px;
    color: #666;
    padding: 0 4px;
}

/* --- Adjustment --- */

/* --- Adjustment --- */
.gallery-tag-bar {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    padding: 10px 0 4px;
    border-top: 1px solid rgba(255,255,255,0.06);
    margin-top: 4px;
    max-height: 84px; /* 邏�2陦悟� */
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: rgba(84, 193, 249, 0.3) transparent;
}

.gallery-tag-bar::-webkit-scrollbar {
    width: 6px;
}

.gallery-tag-bar::-webkit-scrollbar-track {
    background: transparent;
}

.gallery-tag-bar::-webkit-scrollbar-thumb {
    background: rgba(84, 193, 249, 0.3);
    border-radius: 10px;
}

.gallery-tag-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    flex: 1;
}

.gallery-tag-sort-btns {
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin-right: 8px;
    padding-right: 8px;
    border-right: 1px solid rgba(255, 255, 255, 0.1);
    align-items: stretch;
}

.gallery-tag-sort-btn {
    background: transparent;
    border: 1px solid #444;
    color: #666;
    font-size: 10px;
    padding: 2px 6px;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
}

.gallery-tag-sort-btn:hover {
    border-color: #888;
    color: #aaa;
}

.gallery-tag-sort-btn.is-active {
    border-color: #54c1f9;
    color: #54c1f9;
    background: rgba(84, 193, 249, 0.1);
}

.gallery-tag-filter-label {
    font-size: 12px;
    color: #666;
    white-space: nowrap;
    flex-shrink: 0;
}

.gallery-tag-filter-btn {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 10px;
    background: rgba(255,255,255,0.04);
    border: 1px solid #444;
    border-radius: 20px;
    color: #aaa;
    font-size: 12px;
    cursor: pointer;
    transition: border-color 0.15s, background 0.15s, color 0.15s;
    white-space: nowrap;
}

.gallery-tag-filter-btn:hover {
    border-color: #8b9cf9;
    color: #8b9cf9;
    background: rgba(139, 156, 249, 0.08);
}

.gallery-tag-filter-btn.is-active {
    border-color: var(--c-neon-cyan);
    background: rgba(0, 243, 255, 0.15);
    color: var(--c-neon-cyan);
    font-weight: bold;
    box-shadow: 0 0 10px rgba(0, 243, 255, 0.3);
    text-shadow: 0 0 5px rgba(0, 243, 255, 0.5);
}

/* --- Adjustment --- */
.gallery-card-badges {
    display: flex;
    gap: 6px;
    align-items: center;
    flex-wrap: wrap;
    margin-bottom: 6px;
    max-height: 42px; /* 邏�2陦悟� */
    overflow-y: auto;
    scrollbar-width: none; /* Firefox */
}

.gallery-card-badges::-webkit-scrollbar {
    display: none; /* Chrome, Safari */
}

/* --- Adjustment --- */
.gallery-badge-session {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 8px;
    background: rgba(84, 249, 155, 0.12);
    border: 1px solid rgba(84, 249, 155, 0.5);
    border-radius: 20px;
    color: #54f99b;
    font-size: 11px;
    font-weight: bold;
    letter-spacing: 0.03em;
    white-space: nowrap;
    flex-shrink: 0;
}

.gallery-badge-session::before {
    content: '';
    display: inline-block;
    width: 6px;
    height: 6px;
    background: #54f99b;
    border-radius: 50%;
    animation: gallery-pulse 1.5s ease-in-out infinite;
}

@keyframes gallery-pulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50%       { opacity: 0.5; transform: scale(0.7); }
}

/* --- Adjustment --- */
.gallery-tag {
    display: inline-flex;
    align-items: center;
    padding: 2px 10px;
    background: rgba(139, 156, 249, 0.15);
    border: 1px solid rgba(139, 156, 249, 0.4);
    border-radius: 20px;
    color: #aeb9f2;
    font-size: 11px;
    letter-spacing: 0.02em;
    white-space: nowrap;
    flex-shrink: 0;
    transition: all 0.2s;
}

/* --- 隴厄ｽｴ隴�ｽｰ隴鯉ｽ･隴弱ｊ�｡�ｨ驕会ｽｺ --- */
.gallery-updated {
    font-size: 11px;
    color: #aaa;
    margin-top: 4px; transition: color 0.15s ease;
 }

/* --- Adjustment --- */
.gallery-fav-btn {
    position: absolute;
    top: 8px;
    left: 8px;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(26, 26, 30, 0.85);
    border: 1px solid #444;
    border-radius: 50%;
    cursor: pointer;
    transition: border-color 0.15s, background 0.15s;
    z-index: 2;
    padding: 0;
}

.gallery-fav-btn:hover {
    border-color: #f97;
    background: rgba(255, 153, 119, 0.15);
}

.gallery-fav-btn svg {
    fill: transparent;
    stroke: #666;
    transition: fill 0.2s, stroke 0.2s;
}

.gallery-fav-btn.is-fav svg {
    fill: #f97;
    stroke: #f97;
}

/* --- Adjustment --- */
.gallery-grid.is-list .gallery-fav-btn {
    position: static;
    flex-shrink: 0;
    border-radius: 50%;
    align-self: center;
    margin-left: 12px;
}

/* --- Adjustment --- */
.gallery-session-btn {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 4px 10px;
    font-size: 11px;
    border: 1px solid #444;
    border-radius: 4px;
    background: transparent;
    color: #666;
    cursor: pointer;
    transition: color 0.15s, border-color 0.15s, background 0.15s;
    font-family: inherit;
}

.gallery-session-btn:hover {
    border-color: #54f99b;
    color: #54f99b;
    background: rgba(84, 249, 155, 0.07);
}

.gallery-session-btn.is-active {
    border-color: #54f99b;
    color: #54f99b;
    background: rgba(84, 249, 155, 0.12);
}

/* --- Adjustment --- */
.gallery-meta-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.75);
    z-index: 9990;
    display: flex;
    align-items: center;
    justify-content: center;
}

.gallery-meta-modal {
    background: rgba(26, 26, 30, 0.85);
    backdrop-filter: blur(16px) saturate(180%);
    -webkit-backdrop-filter: blur(16px) saturate(180%);
    border: 1px solid rgba(84, 193, 249, 0.5);
    border-radius: 16px;
    padding: 28px 28px 24px;
    min-width: 320px;
    max-width: 90vw;
    max-height: 90vh;
    overflow-y: auto;
    color: #ccc;
    position: relative;
    box-shadow: 0 8px 32px rgba(0,0,0,0.6);
}

.modal-close-btn {
    position: absolute;
    top: 15px;
    right: 15px;
    background: transparent;
    border: none;
    color: #666;
    cursor: pointer;
    padding: 5px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.2s, transform 0.2s;
    z-index: 5;
}

.modal-close-btn:hover {
    color: var(--c-neon-cyan);
    transform: rotate(90deg);
}

.gallery-meta-modal h3 {
    margin: 0 0 20px;
    font-size: 16px;
    color: var(--c-neon-cyan);
    border-bottom: 1px solid rgba(84, 193, 249, 0.4);
    padding-bottom: 12px;
    text-shadow: 0 0 8px rgba(0, 243, 255, 0.3);
}

.gallery-meta-modal label {
    display: block;
    font-size: 13px;
    color: #888;
    margin-bottom: 5px;
}

.gallery-meta-modal input[type="password"],
.gallery-meta-modal input[type="text"],
.gallery-meta-modal input[type="number"] {
    width: 100%;
    box-sizing: border-box;
    padding: 8px 10px;
    background: #111115;
    border: 1px solid #444;
    border-radius: 5px;
    color: #fff;
    font-size: 13px;
    margin-bottom: 14px;
    transition: border-color 0.2s;
}

.gallery-meta-modal input:focus {
    outline: none;
    border-color: #54c1f9;
}

.gallery-meta-modal .modal-hint {
    font-size: 11px;
    color: #555;
    margin: -10px 0 14px;
}

.gallery-meta-modal .modal-toggle-row {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 16px;
}

.gallery-meta-modal .modal-toggle-label {
    font-size: 13px;
    color: #ccc;
    margin: 0;
    flex: 1;
}

/* --- Adjustment --- */
.gallery-toggle {
    position: relative;
    width: 40px;
    height: 22px;
    flex-shrink: 0;
}

.gallery-toggle input {
    width: 0; height: 0; opacity: 0; position: absolute;
}

.gallery-toggle-slider {
    position: absolute;
    inset: 0;
    background: #333;
    border-radius: 22px;
    cursor: pointer;
    transition: background 0.2s;
}

.gallery-toggle-slider::before {
    content: '';
    position: absolute;
    left: 3px; top: 3px;
    width: 16px; height: 16px;
    background: #fff;
    border-radius: 50%;
    transition: transform 0.2s;
}

.gallery-toggle input:checked + .gallery-toggle-slider {
    background: #54f99b;
    box-shadow: 0 0 10px rgba(84, 249, 155, 0.4);
}

.gallery-toggle input:checked + .gallery-toggle-slider::before {
    transform: translateX(18px);
    box-shadow: 0 0 5px rgba(255, 255, 255, 0.8);
}

.gallery-meta-modal .modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 4px;
}

.gallery-meta-modal .modal-error {
    color: #f55;
    font-size: 12px;
    margin: -8px 0 10px;
    display: none;
}

/* --- Adjustment --- */

/* --- Adjustment --- */
@keyframes gallery-shimmer {
    0%   { background-position: -400px 0; }
    100% { background-position: 400px 0; }
}

.gallery-skeleton {
    pointer-events: none;
    cursor: default;
}

.gallery-skeleton-img {
    width: 100%;
    aspect-ratio: 3/4;
    border-radius: 4px;
    background: linear-gradient(90deg, #222 25%, #2e2e36 50%, #222 75%);
    background-size: 800px 100%;
    animation: gallery-shimmer 1.4s infinite linear;
    margin-bottom: 10px;
}

.gallery-skeleton-line {
    height: 12px;
    border-radius: 4px;
    background: linear-gradient(90deg, #222 25%, #2e2e36 50%, #222 75%);
    background-size: 800px 100%;
    animation: gallery-shimmer 1.4s infinite linear;
    margin-bottom: 8px;
}

.gallery-skeleton-line.w30 { width: 30%; }
.gallery-skeleton-line.w40 { width: 40%; }
.gallery-skeleton-line.w50 { width: 50%; }
.gallery-skeleton-line.w60 { width: 60%; }
.gallery-skeleton-line.w65 { width: 65%; }
.gallery-skeleton-line.w70 { width: 70%; }

/* --- Adjustment --- */
@keyframes gallery-card-in {
    from { opacity: 0; transform: translateY(12px); }
    to   { opacity: 1; transform: translateY(0); }
}

.gallery-card:not(.gallery-skeleton) {
    animation: gallery-card-in 0.25s ease both;
}

/* --- Adjustment --- */
.gallery-toast {
    position: fixed;
    bottom: 32px;
    left: 50%;
    transform: translateX(-50%) translateY(20px);
    padding: 10px 22px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 500;
    white-space: nowrap;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.25s, transform 0.25s;
    z-index: 9999;
    box-shadow: 0 4px 16px rgba(0,0,0,0.4);
    letter-spacing: 0.03em;
    /* --- Adjustment --- */
    background: #2a2a33;
    color: #ccc;
    border: 1px solid #444;
}

.gallery-toast.is-show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

.gallery-toast--success {
    background: rgba(84, 249, 155, 0.12);
    border-color: rgba(84, 249, 155, 0.5);
    color: #54f99b;
}

.gallery-toast--error {
    background: rgba(249, 84, 84, 0.12);
    border-color: rgba(249, 84, 84, 0.5);
    color: #f96060;
}

/* --- Adjustment --- */
.gallery-scroll-top {
    position: fixed;
    bottom: 88px;
    right: 28px;
    width: 44px;
    height: 44px;
    background: rgba(26, 26, 30, 0.9);
    border: 1px solid #444;
    border-radius: 50%;
    color: #888;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transform: translateY(12px);
    transition: opacity 0.25s, visibility 0.25s, transform 0.25s, border-color 0.2s, color 0.2s;
    z-index: 9000;
    box-shadow: 0 2px 12px rgba(0,0,0,0.4);
}

.gallery-scroll-top.is-visible {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.gallery-scroll-top:hover {
    border-color: #54c1f9;
    color: #54c1f9;
    background: rgba(84, 193, 249, 0.1);
}

/* --- 驕ｨ�ｺ霑･�ｶ隲ｷ迢怜愛鬮ｱ�｢ --- */
.gallery-empty-state {
    grid-column: 1 / -1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 20px;
    text-align: center;
    color: #555;
}

.gallery-empty-icon {
    font-size: 48px;
    margin-bottom: 16px;
    line-height: 1;
}

.gallery-empty-title {
    font-size: 16px;
    color: #777;
    font-weight: bold;
    margin-bottom: 8px;
}

.gallery-empty-desc {
    font-size: 13px;
    color: #555;
    line-height: 1.7;
}

/* --- Adjustment --- */
@media (max-width: 768px) {
    .gallery-container {
        margin: 20px auto;
        padding: 0 15px;
    }
    .gallery-toolbar {
        padding: 12px;
        gap: 12px;
        border-radius: 10px;
    }
    .gallery-search-wrap {
        min-width: 100%;
        order: 1;
    }
    .gallery-search-count {
        order: 2;
        font-size: 12px;
    }
    .gallery-sort-wrap {
        order: 3;
        flex: 1;
        justify-content: flex-end;
    }
    .gallery-view-btns {
        order: 4;
    }
    .gallery-grid {
        grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
        gap: 15px;
    }
}

@media (max-width: 480px) {
    .gallery-grid {
        grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
        gap: 10px;
    }
    .gallery-card {
        padding: 12px;
        height: auto;
    }
    .gallery-image-wrap {
        height: 140px;
        margin-bottom: 8px;
    }
    .gallery-name {
        font-size: 1rem;
        margin-bottom: 4px;
    }
    .gallery-id {
        font-size: 0.8rem;
     }
    .gallery-tag-bar {
        font-size: 12px;
        gap: 6px;
    }
    .gallery-tag-filter-btn {
        padding: 4px 10px;
        font-size: 11px;
    }
    .gallery-meta-modal {
        padding: 24px 20px;
        min-width: 280px;
        width: 90%;
    }
}

/* --- Adjustment --- */

/* --- Adjustment --- */
.gallery-variant-selector {
    position: relative;
    display: flex;
    justify-content: flex-start;
    flex-wrap: wrap;
    gap: 6px;
    padding: 4px 0;
    margin: 4px 0 8px 0;
    max-height: 80px;
    overflow-y: auto;
    background: transparent;
    z-index: 10;
    scrollbar-width: thin;
    scrollbar-color: rgba(84, 193, 249, 0.4) transparent;
}

/* 繧ｹ繧ｯ繝ｭ繝ｼ繝ｫ繝舌�繧ｫ繧ｹ繧ｿ繝� (Webkit) */
.gallery-variant-selector::-webkit-scrollbar {
    width: 4px;
}
.gallery-variant-selector::-webkit-scrollbar-track {
    background: transparent;
}
.gallery-variant-selector::-webkit-scrollbar-thumb {
    background: rgba(84, 193, 249, 0.4);
    border-radius: 4px;
}

.gallery-variant-btn {
    padding: 3px 10px;
    font-size: 10px;
    font-weight: 700;
    color: rgba(255, 255, 255, 0.6);
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(4px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    white-space: nowrap;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.gallery-variant-btn:hover {
    background: rgba(84, 193, 249, 0.2);
    color: #fff;
    border-color: rgba(84, 193, 249, 0.4);
}

.gallery-variant-btn.is-active {
    background: rgba(84, 193, 249, 0.2);
    color: #54c1f9;
    border-color: #54c1f9;
    box-shadow: 0 0 8px rgba(84, 193, 249, 0.4);
    text-shadow: 0 0 5px rgba(84, 193, 249, 0.5);
}

/* --- Adjustment --- */
@media (max-width: 580px) {
    .gallery-grid.is-list .gallery-variant-selector {
        margin: 4px 0;
        padding: 0;
        justify-content: flex-start;
        max-height: 60px;
        background: transparent;
    }

    .gallery-meta-modal {
        padding: 20px 20px 16px;
        border-radius: 12px;
    }

    .gallery-meta-modal h3 {
        font-size: 14px;
        margin-bottom: 12px;
        padding-bottom: 8px;
    }
    .gallery-grid.is-list .gallery-variant-btn {
        padding: 2px 6px;
        font-size: 9px;
    }
    
    /* 繝｢繝舌う繝ｫ迚医Μ繧ｹ繝医き繝ｼ繝峨�2谿ｵ讒区�蛹� */
    .gallery-grid.is-list .gallery-card {
        flex-direction: column !important;
        align-items: stretch !important;
        padding: 12px;
        gap: 8px;
    }
    
    .gallery-grid.is-list .gallery-card > a {
        display: flex;
        flex-direction: row;
        align-items: center;
        gap: 12px;
        width: 100%;
        text-decoration: none;
    }
    
    .gallery-grid.is-list .gallery-image-wrap {
        width: 65px;
        height: 65px;
        min-width: 65px;
    }
    
    .gallery-grid.is-list .gallery-card-body {
        margin: 0;
        text-align: left;
    }
    
    .gallery-grid.is-list .gallery-card-actions {
        margin: 4px 0 0 !important;
        width: 100% !important;
        display: grid !important;
        grid-template-columns: 1fr 1fr !important;
        border: 1px solid rgba(84, 193, 249, 0.1) !important;
        border-radius: 6px;
    }
    
    .gallery-grid.is-list .gallery-flag-btn,
    .gallery-grid.is-list .gallery-copy-btn {
        padding: 10px 4px;
        font-size: 10px;
    }
}

.gallery-card:hover .gallery-id { color: #fff; }

.gallery-card:hover .gallery-updated { color: #ccc; }

/* ==========================================================================
   List View Styles (Compact & Vertical Buttons)
   ========================================================================== */

.gallery-grid.is-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.gallery-grid.is-list .gallery-card {
    display: grid !important;
    grid-template-columns: auto 1fr auto;
    align-items: stretch !important;
    text-align: left;
    padding: 0 !important;
    height: auto !important;
    min-height: 80px;
    gap: 0;
    transform: none !important;
    overflow: hidden;
}

.gallery-grid.is-list .gallery-card:hover {
    transform: translateX(6px) !important;
}

.gallery-grid.is-list .gallery-card > a {
    display: flex !important;
    flex-direction: row !important;
    align-items: center;
    flex: 1;
    gap: 16px;
    text-decoration: none;
    color: inherit;
    padding: 12px 0 12px 12px;
}

.gallery-grid.is-list .gallery-image-wrap {
    width: 80px;
    height: 80px;
    min-width: 80px;
    margin-bottom: 0;
    aspect-ratio: 1 / 1 !important;
    border-radius: 4px;
    flex-shrink: 0;
}

.gallery-grid.is-list .gallery-card-body {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding-bottom: 0;
}

.gallery-grid.is-list .gallery-name {
    margin-bottom: 2px;
    font-size: 1.1rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.2;
}

.gallery-grid.is-list .gallery-meta-info {
    justify-content: flex-start;
    align-items: baseline;
    margin-bottom: 0;
    font-size: 0.75rem;
    opacity: 0.7;
    line-height: 1.2;
}

.gallery-grid.is-list .gallery-card-badges,
.gallery-grid.is-list .gallery-variant-selector {
    justify-content: flex-start;
    margin-bottom: 4px;
}

/* --- Vertical Action Buttons (Right Side) --- */
.gallery-grid.is-list .gallery-card-actions {
    display: flex !important;
    flex-direction: column !important;
    width: 56px !important;
    flex-shrink: 0;
    margin: 0 !important;
    border-top: none;
    border-left: 1px solid var(--c-border-card);
    background: rgba(255, 255, 255, 0.03);
    align-self: stretch; /* Grid縺ｮ蟄占ｦ∫ｴ�縺ｨ縺励※蜈ｨ鬮倥∪縺ｧ莨ｸ縺ｰ縺� */
    border-radius: 0 !important;
}

.gallery-grid.is-list .gallery-flag-btn,
.gallery-grid.is-list .gallery-copy-btn {
    flex: 1;
    width: 100%;
    padding: 8px 4px;
    font-size: 10px;
    border: none;
    border-radius: 0 !important; /* 隗剃ｸｸ繧貞屁隗偵↓ */
    display: flex;
    flex-direction: column;
    gap: 2px;
    justify-content: center;
}

.gallery-grid.is-list .gallery-flag-btn {
    border-bottom: 1px solid var(--c-border-card);
}

/* --- Mobile View Adjustments (Extreme Compact) --- */
@media (max-width: 580px) {
    .gallery-grid.is-list .gallery-card {
        padding: 0 !important;
        gap: 0;
        display: grid !important;
        grid-template-columns: auto 1fr auto;
        align-items: stretch !important;
    }

    .gallery-grid.is-list .gallery-card > a {
        gap: 10px;
        padding: 8px 0 8px 8px;
    }

    .gallery-grid.is-list .gallery-image-wrap {
        width: 60px;
        height: 60px;
        min-width: 60px;
    }

    .gallery-grid.is-list .gallery-name {
        font-size: 0.95rem;
        text-align: left;
    }

    .gallery-grid.is-list .gallery-card-player {
        display: inline-block;
        margin-top: 0;
        margin-left: 8px;
        font-size: 0.7rem;
    }

    .gallery-grid.is-list .gallery-id,
    .gallery-grid.is-list .gallery-updated {
        font-size: 0.7rem;
    }

    .gallery-grid.is-list .gallery-card-actions {
        width: 56px !important;
    }

    .gallery-grid.is-list .gallery-variant-selector {
        max-height: 40px !important;
        margin-bottom: 2px !important;
    }
}

/* ギャラリー設定モーダル内でのツールチップ位置調整 */
.gallery-meta-modal .tos-icon-wrap {
    margin-left: 8px;
    /* 見出しとの間隔 */
}

.gallery-meta-modal .tos-tooltip {
    left: -190px;
    right: auto;
    bottom: 130%;
    top: auto;
    transform: translateY(10px);
    width: max-content;
    max-width: min(280px, 85vw);
}

/* ツールチップ内の見出しデザイン */
.gallery-meta-modal .tooltip-title {
    display: block;
    color: #54C1F9;
    font-weight: bold;
    border-bottom: 2px solid rgba(84, 193, 249, 0.4);
    margin: 0 0 10px 0;
    padding-bottom: 6px;
    font-size: 13px;
    text-align: center;
}

.gallery-meta-modal .tos-icon-wrap:hover .tos-tooltip {
    display: block !important;
    opacity: 1;
    transform: translateY(0) !important;
}

.gallery-meta-modal .tos-tooltip::after {
    top: 100% !important;
    bottom: auto !important;
    border-color: var(--c-accent-cyan) transparent transparent transparent !important;
    left: 200px; /* 三角形の位置をアイコンに対応させる */
    right: auto;
}

/* モバイル環境用のはみ出し防止調整 */
@media screen and (max-width: 480px) {
    .gallery-meta-modal .tos-tooltip {
        width: 200px;
        left: -160px;
        right: auto;
    }

    .gallery-meta-modal .tos-tooltip::after {
        left: 170px;
        right: auto;
    }
}