#content-in {
    padding-top: 5px;
}
#top-container {
    position: relative;

    #edition-tab {
        display: flex;
        margin-bottom: 5px;

        button {
            display: block;
            font-size: 1em;
            border: none;
            padding: 10px 20px;
            cursor: pointer;
            background-color: transparent;
            line-height: 1em;

            border-bottom: 2px solid #ddd;
        }
        button.active {
            border-bottom: 2px solid #222;
        }
        div {
            height: 38px;
            border-bottom: 2px solid #ddd;
            flex-grow: 1;
        }
    }
}

#h1-title {
    display: flex;
    gap: 5px;
    justify-content: end;

    i, h1 {
        display: block;
        font-size: small;
        color: #aaa;
    }
    i {
        margin-top: 5px;
    }
}
h1 {
    margin: 0;
}


.tab-container {
    width: 100%;
    overflow-x: scroll;
    display: flex;
    gap: 5px;

    button {
        display: block;
        flex: 0 0 auto;

        width: fit-content;

        font-size: 0.9em;
        border: none;
        background-color: #f5f5f5;
        padding: 8px 15px;
        border-radius: 22px;
        cursor: pointer;

        height: 36.5px;
    }
    button.active {
        background: #4db4b4;
        color: white;
    }
    #following.active {
        background: #E18007;
    }
    #search-button-topic-side {
        height: 37px; width: 37px;
        border-radius: 50%;
        padding: 0;
    }
}
#topic-tab button.active {
    background: #4db4b4;
    color: white;
}
#tag-card-cotainer button.active {
    background: #E18007;
    color: white;
}

#topic-tab, #tag-tab, #gallery-container-in {
    -ms-overflow-style: none;
    scrollbar-width: none;
}
#topic-tab::-webkit-scrollbar,
#tag-tab::-webkit-scrollbar,
#gallery-container-in::-webkit-scrollbar {
    display: none;
}


#tag-tab {
    #search-button-topic-side {
        display: none;
    }

    #tag-search-tab {
        position: relative;
        display: flex;
        gap: 5px;
        width: 210px;

        input {
            border-radius: 18.5px;
            height: 37px;
            border: #e3e3e3 2px solid;
        }

        input:focus, input:focus-visible {
            border-color: #4CB4B4;
            outline: none;
        }
        #delete-kw-btn {
            position: absolute;
            display: none;
            right: 6px; top: 0px;
            width: 30px;
            color: #666666;
            background-color: transparent;
            font-size: 1.2em;
            padding: 0; margin: 0;
            outline: none;
            border: none;
        }
    }
    #tag-search-tab:has(#search-button-topic-side.unfocused) {
        display: none;
    }
    #tag-search-tab:has(#search-button-topic-side.focused) {
        display: block;
    }
    #tag-card-cotainer {
        display: flex;
        gap: 5px;
    }
}

#tag-tab:has(#tag-card-cotainer:not(:empty)) input:is(:focus, :focus-visible) {
    border-color: #E18007;
    outline: none;
}
#tag-tab:has(#tag-card-cotainer:not(:empty)) #search-button-topic-side.focused + input {
    padding-right: 30px;
}
#tag-tab:has(#tag-card-cotainer:not(:empty)) #search-button-topic-side.focused + input + #delete-kw-btn {
    display: block;
}
#tag-tab:has(#tag-search-tab #search-button-topic-side.focused) {
    #tag-card-cotainer button {
        display: none;
    }
}
#tag-tab:has(#tag-card-cotainer:not(:empty)) {
    #search-button-topic-side {
        background: #E18007;
        color: white;
    }
}



#sort-tab {
    display: flex;
    gap: 5px;

    button {
        display: block;
        flex: 0 0 auto;

        width: fit-content;

        font-size: 0.9em;
        line-height: 0.9em;
        border: #e3e3e3 2px solid;
        /* background-color: #f5f5f5; */
        background: transparent;
        padding: 8px 15px;
        border-radius: 22px;
        cursor: pointer;

        height: 36.5px;
    }
    button.active {
        background: #4db4b4;
        color: white;
        border: none;
    }
}



#contents-container {
    display: grid;
    margin-top: 15px;
    grid-auto-flow: dense;

    .card-v2 a {
        display: block;
        text-decoration: none;
        color: #222;
        height: 100%;
        -webkit-user-drag: none;
        -khtml-user-drag: none;
    }

    .card-v2 {
        width: 100%;
        cursor: pointer;
        -webkit-user-drag:none;
        -khtml-user-drag:none;
        border-radius: 6px;
        position: relative;
        transition: all 0.15s;

        .card-desc {
            width: 100%;
            aspect-ratio: 16 / 9;
            padding: 10px;
            border-radius: 6px;
            color: white;
            overflow: hidden;
            font-size: small;
            line-height: 1.3em;
        }
        .card-thumb {
            width: 100%;
            aspect-ratio: 16 / 9;
            object-fit: cover;
            border-radius: 6px;
        }
        .card-title {
            width: 100%; height: fit-content;
            /* min-height: 40px; */
            max-height: 80px;
            margin-bottom: 6px;
            
            font-size: small; font-weight: bold;

            text-overflow: ellipsis;
            display: -webkit-box;
            -webkit-box-orient: vertical;
            -webkit-line-clamp: 3;
            overflow: hidden;
        }


        .card-meta-container-up {
            display: flex;
            gap: 5px;

            .cat-indicator, .edt-indicator, .file-indicator {
                border-radius: 14px;
                font-size: small;
                padding: 2px 10px;
                height: 28px;
                transition: all 0.15s;
            }
            .je, .be, .mc {
                color: white;
            }
            :not(.je, .be, .mc) {
                background-color: #f5f5f5;
            }
            .be { background-color: #38895b; }
            .je { background-color: #6fa73b; }
            .mc { background-color: #3b9aa7; }
        }
        .card-meta-container-md {
            display: flex;
            justify-content: space-between;
            margin: 7px 0;
            font-size: small;

            .counter-container {
                display: flex;
                gap: 10px;
                .counter {
                    display: flex;
                    gap: 5px;
                }
                .file-counter {
                    .icon {
                        font-size: 2.2em;
                        position: absolute;
                        width: 60px; height: 60px;
                        right: -10px; top: -5px;
                        display: flex;
                        justify-content: center;

                        div {
                            margin: auto 0;
                        }
                    }
                    .count {
                        color: white;
                        position: absolute;
                        width: 60px; height: 60px;
                        right: -10px; top: -5px;
                        display: flex;
                        justify-content: center;
                        margin: auto 0;

                        div {
                            margin-top: 22px;
                        }
                    }
                }
            }
            

            .card-date {
                text-align: right;
            }
        }
        .card-meta-container-dw {
            display: grid;
            grid-template-rows: 25px;
            grid-template-columns: 25px 25px 1fr;
            gap: 5px;

            .rank_badge_bg {
                grid-row: 1 / 2;
                grid-column: 1 / 2;
                width: 25px; height: 25px;

                .rank_badge_text {
                    font-size: small;
                }
            }
            .card-avatar {
                grid-row: 1 / 2;
                grid-column: 2 / 3;
                border-radius: 50%;
            }
            .card-lab-name {
                line-height: 20px;
                grid-row: 1 / 2;
                grid-column: 3 / 4;
                font-size: small;
            }
        }
    }
    .card-v2.thumb {
        flex: 0 0 auto; /* ← shrinkさせない & 幅固定 */
    }
}
.file-indicator { display: block; }
.file-counter { display: none; }
@media screen and ((max-width: 460px) or ((min-width: 630px) and (max-width: 689px)) or ((min-width: 910px) and (max-width: 1029px))) {
    .file-indicator { display: none; }
    .file-counter { display: block; }
}
@media screen and (max-width: 629px) {
    #contents-container {
        grid-template-columns: 1fr 1fr;
        gap: 10px;
    }
    #gallery-container {
        margin: 10px 0;
    }
}
@media screen and (min-width: 630px) and (max-width: 834px) {
    #contents-container {
        grid-template-columns: 1fr 1fr 1fr;
        gap: 20px;
    }
}
@media screen and (min-width: 835px) and (max-width: 909px) {
    #contents-container {
        grid-template-columns: 1fr 1fr;
        gap: 20px;
    }
}
@media screen and (min-width: 910px) {
    #contents-container {
        grid-template-columns: 1fr 1fr 1fr;
        gap: 20px;
    }
}


#empty-message:not(.visible) {
    display: none;
}



.card-list-wrapper,
#topic-tab-wrapper {
    position: relative;
}



.bookmarked-icon {
    position: absolute;

    top: 10px; right: 20px;
    font-size: 1.5em;
    color: rgb(73, 125, 228);
}
.title-bookmarked-icon {
    color: rgb(73, 125, 228);
}

#empty-message {
    display: flex;
    flex-direction: column;
    margin: 30px 0 20px 0;

    div {
        width: 100%;
        text-align: center;

        i {
            color: #ddd;
            font-size: 4em;
            margin-bottom: 15px;
        }
        .large {
            font-size: large;
        }
    }
}

#gallery-container {
    grid-column-start: 1;
    grid-column-end: -1;
    position: relative;
    padding: 10px 0 10px 0px;

    #gallery-container-in {
        width: 100%;
        overflow-y: scroll;
        display: flex;
        gap: 10px;

        .gallery-image-wrapper {
            text-decoration: none;
            color: white !important;
            display: block;
            flex-shrink: 0;
            width: 160px;
            filter: drop-shadow(2px 2px 2px rgba(0, 0, 0, 0.3));
            margin-bottom: 10px;
            transition: all 0.15s;

            .gallery-image { background-color: white; }
            img {
                object-fit: cover;
                width: 100%;
                aspect-ratio: 4 / 3;
            }
            .gallery-image-description {
                background-color: #1B6967;
                padding: 10px 20px;

                .author-name {
                    font-size: small;
                }
                .timeago {
                    font-size: small;
                    text-align: end;
                }
            }
        }
        .gallery-more {
            height: 100%;
            background-color: #1B6967;
            display: flex; justify-content: center;

            div {
                margin: auto 0;
                height: fit-content;
                text-align: center;
            }

            i {
                font-size: 28px;
            }
        }
        a:has(.gallery-more) {
            width: 100px;
            margin-right: 30px;
        }
    }

    .rightside-fade {
        position: absolute;
        width: 35px; height: 100%;
        right: 0; bottom: 0;
        background: linear-gradient(to right, rgba(255, 255, 255, 0), rgba(255, 255, 255, 1));
    }
}
#gallery-container > a {
    color: #2d2d2d;
    text-decoration: none;
    font-size: large;
    font-weight: bold;
    margin-bottom: 5px;
    display: block;
}



body:not(.--CLIENT-USE-TOUCH, .--CLIENT-USE-PEN) .card-v2:hover {
    transform: scale(0.97);
}
body:not(.--CLIENT-USE-TOUCH, .--CLIENT-USE-PEN) .gallery-image-wrapper:hover {
    transform: scale(0.97);
}
body:not(.--CLIENT-USE-TOUCH, .--CLIENT-USE-PEN) #edition-tab button:hover {
    color: #aaa
}
body:not(.--CLIENT-USE-TOUCH, .--CLIENT-USE-PEN) #gallery-container a:hover {
    color: #aaa;
}
body:not(.--CLIENT-USE-TOUCH, .--CLIENT-USE-PEN) #topic-tab button:not(.active):hover {
    background-color: #dddddd;
}
body:not(.--CLIENT-USE-TOUCH, .--CLIENT-USE-PEN) #search-button-topic-side:hover {
    background-color: #dddddd;
}
body:not(.--CLIENT-USE-TOUCH, .--CLIENT-USE-PEN) #add-keyword:hover {
    background-color: #dddddd;
}
body:not(.--CLIENT-USE-TOUCH, .--CLIENT-USE-PEN) #delete-kw-btn:hover {
    color: #cccccc
}
body:not(.--CLIENT-USE-TOUCH, .--CLIENT-USE-PEN) #tag-tab:has(#tag-card-cotainer:not(:empty)) #search-button-topic-side:hover {
    background-color: #fcb256;
}
body:not(.--CLIENT-USE-TOUCH, .--CLIENT-USE-PEN) .card:hover {
    background-color: rgba(0, 0, 0, 0.1);
}