* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Poppins', sans-serif;
}

body {
    background: #1e1e1e;
    color: #fff;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.container {
    max-width: 100%;
    margin: 0 auto;
    padding: 2rem;
}

.header {
    display: flex;
    align-items: center;
    gap: 2rem;
    margin-bottom: 3rem;
}

.logo {
    font-size: 2rem;
    font-weight: 600;
    color: #ff6b6b;
    text-shadow: 0 0 10px rgba(255, 0, 0, 0.5);
}

.search-bar {
    flex: 1;
    left: 35%;
    position: relative;
}

/* 下拉框美化 */
.custom-select {
    position: relative;
    width: 180px;
}

.custom-select select {
    appearance: none;
    width: 100%;
    padding: 1rem 3rem 1rem 1rem;
    border: 2px solid #ecf0f1;
    border-radius: 8px;
    background: linear-gradient(to right,
            #ffffff 0%,
            #ffffff 90%,
            #3498db 90%,
            #3498db 100%);
    color: #2c3e50;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.3s ease;
    border-radius: 25px;
}

.custom-select select:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.3);
    border-color: #3498db;
}

.search-btn {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    padding: 1rem;
    background: transparent;
    border: none;
    color: #fff;
    cursor: pointer;
    font-size: 1.5rem;
    transition: all 0.3s ease;
}

.search-btn-left {
    left: 5%;
}

.search-btn-center {
    left: 45%;
}

.search-btn-right {
    right: 5%;
}


.search-btn:hover {
    color: #ff6b6b;
    transform: translateY(-50%) scale(1.1);
}

.gallery {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(500px, 1fr));
    gap: 2rem;
    /* 与排行榜宽度匹配 */
    margin-bottom: 3rem;
    margin-top: 6rem;
}



.gallery-item:hover {
    transform: translateY(-10px);
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.7);
}

.image-wrapper {
    position: relative;
    width: 100%;
    padding-top: 75%;
    overflow: hidden;
    border-radius: 25px;
}

.image-frame {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border: none;
    background: #000;
    transition: filter 0.5s ease;
}

.image-frame:hover {
    filter: brightness(80%);
}

.loading-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 25px;
    opacity: 0;
    transition: opacity 0.5s ease;
}

.loading-overlay.active {
    opacity: 1;
}

.loader {
    border: 4px solid #ff6b6b;
    border-top: 4px solid #fff;
    border-radius: 50%;
    width: 50px;
    height: 50px;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

footer {
    text-align: center;
    padding: 2rem;
    background: rgba(0, 0, 0, 0.9);
    margin-top: auto;
}

footer p {
    color: rgba(255, 255, 255, 0.7);
    font-size: 0.9rem;
}

footer a {
    color: #ff6b6b;
    text-decoration: none;
    font-weight: 600;
}

footer a:hover {
    text-decoration: underline;
}

@media (max-width: 768px) {
    .header {
        flex-direction: column;
        gap: 1rem;
    }

    .search-bar {
        /* 居中显示按钮 */
        width: 100%;
    }

    .gallery {
        margin-right: 0;
    }

    .ranking-module {
        position: static;
        margin: 10px 0;
        width: 100%;
        max-width: 100%;
        border-radius: 0;
        box-shadow: none;
        background: transparent;
    }
}

.auth-controls {
    display: flex;
    gap: 1rem;
    margin-left: auto;
    position: relative;
    /* 用于定位模态框 */
}

.modal {
    position: fixed;
    z-index: 1;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0, 0, 0, 0.4);
}

.modal-content {
    background-color: #fefefe;
    margin: 15% auto;
    padding: 25px;
    border: 1px solid #888;
    width: 30%;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.33);
}

.close {
    color: #aaa;
    float: right;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
}

.close:hover,
.close:focus {
    color: black;
    text-decoration: none;
    cursor: pointer;
}

.login-btn,
.register-btn {
    background: transparent;
    border: 2px solid #ff6b6b;
    color: #ff6b6b;
    padding: 0.8rem 1.5rem;
    border-radius: 25px;
    transition: all 0.3s;
    font-weight: 600;
}

.login-btn:hover,
.register-btn:hover {
    background: #ff6b6b;
    color: white;
}

.user-info {
    position: absolute;
    top: 2rem;
    right: 2rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    background: rgba(0, 0, 0, 0.5);
    padding: 0.5rem 1rem;
    border-radius: 25px;
}

.user-info #username {
    color: #ff6b6b;
    font-weight: 600;
}


#authModal h2 {
    color: #ff6b6b;
    margin-bottom: 15px;
    font-weight: 600;
    text-align: center;
}

.modal input {
    width: 100%;
    padding: 12px;
    margin: 8px 0;
    border: 2px solid #ecf0f1;
    border-radius: 8px;
    font-size: 1rem;
    transition: border-color 0.3s ease;
}

.modal input:focus {
    border-color: #ff6b6b;
    box-shadow: 0 0 5px rgba(255, 107, 107, 0.8);
    outline: none;
}

.modal button {
    width: 100%;
    padding: 12px;
    background: #ff6b6b;
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.3s ease;
}

.modal button:hover {
    background: #e65c5c;
    transform: translateY(-2px);
}

.switch-link {
    text-align: center;
    margin: 15px 0;
    color: #ff6b6b;
    font-size: 0.9rem;
}

.switch-link span {
    color: #ff6b6b;
    cursor: pointer;
    text-decoration: underline;
}

.active {
    background: #ff6b6b;
    color: white;
}


/* 文档3：CSS样式调整 */
.gallery-item {
    position: relative;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 25px;
    transition: all 0.3s ease;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    /* 关键修改 */
    width: auto;
    height: auto;
    max-width: 100%;
    overflow: hidden; /* 添加滚动条 */
}

.image-content {
    width: 100%;
    height: 100%;
    max-width: 100%;
    max-height: 100vh;
    object-fit: contain; /* 保持比例完整显示 */
    /* 新增 */
    margin: 0 auto; /* 水平居中 */
}

.image-actions {
    position: absolute;
    bottom: 15px;
    right: 15px;
    z-index: 2;
    pointer-events: none;
}

.like-btn {
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    background: rgba(0, 0, 0, 0.6);
    border-radius: 50px;
    padding: 8px;
    cursor: pointer;
    pointer-events: auto;
    transition: all 0.3s ease;

}

.like-btn:hover {
    background: rgba(255, 107, 107, 0.9);
}

.like-btn.liked {
    background: #ff6b6b;
}

.like-count {
    color: rgba(255, 255, 255, 0.9);
    font-size: 12px;
    line-height: 1;
    transition: color 0.3s ease;
}



/* 文档3：CSS样式调整 */
.ranking-module {
    position: fixed;
    bottom: 20px;
    left: 20px;
    /* 从右侧改为左侧 */
    width: 300px;
    max-width: calc(100% - 40px);
    background: rgba(0, 0, 0, 0.8);
    border-radius: 15px;
    box-shadow: 0 0 20px rgba(0, 0, 0, 0.5);
    z-index: 999;
    transition: all 0.3s ease;
    overflow: hidden;

    /* 新增移动端适配 */
    @media (max-width: 768px) {
        left: 10px;
        bottom: 10px;
        width: calc(100% - 20px);
    }
}

.ranking-module.collapsed {
    width: 40px;
    max-width: 40px;
}

.ranking-container {
    position: fixed;
    bottom: 20px;
    left: 20px;
    /* 调整为左侧显示 */
    width: 30vw;
    /* 固定宽度为视口宽度的30% */
    max-width: 400px;
    /* 最大宽度限制 */
    background: rgba(0, 0, 0, 0.8);
    border-radius: 15px;
    padding: 15px;
    box-shadow: 0 0 20px rgba(0, 0, 0, 0.5);
    z-index: 999;
    overflow: hidden;
    /* 隐藏溢出内容 */
}

.scrollable-content {
    max-height: 400px;
    overflow-y: auto;
    padding: 10px 0;
}

.ranking-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 15px;
}

.title {
    color: #ff6b6b;
    font-size: 1rem;
    transition: all 0.3s ease;
}

.collapsed .title {
    opacity: 0;
    visibility: hidden;
}

.toggle-btn {
    background: transparent;
    border: none;
    color: #ff6b6b;
    font-size: 1.2rem;
    cursor: pointer;
    padding: 5px;
}


.close-btn {
    background: transparent;
    border: none;
    color: #ff6b6b;
    font-size: 1.5rem;
    cursor: pointer;
}

.ranking-list {
    list-style: none;
    padding: 0;
}

.ranking-item {
    display: flex;
    align-items: center;
    margin-bottom: 10px;
    padding-bottom: 10px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.ranking-item:last-child {
    border-bottom: none;
    margin-bottom: 0;
}

.rank-badge {
    background: #ff6b6b;
    color: white;
    padding: 3px 10px;
    border-radius: 50%;
    font-size: 0.8rem;
    margin-right: 1rem;
}

.ranking-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    margin-right: 10px;
}

.ranking-content {
    flex-grow: 1;
}

.ranking-title {
    color: #ff6b6b;
    font-size: 0.9rem;
    margin-bottom: 3px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: normal;
    /* 允许换行 */
    word-wrap: break-word;
    /* 自动换行 */
    max-width: 250px;
    /* 设置最大宽度 */
    display: inline-block;
    /* 启用max-width生效 */

    transition: max-width 0.3s ease;
}

.ranking-meta {
    color: rgba(255, 255, 255, 0.7);
    font-size: 0.8rem;
}





/* 在文档4的CSS中添加以下样式 */
.comment-module {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 15px;
    padding: 15px;
    margin-top: 15px;
    box-shadow: 0 10px 20px rgba(0,0,0,0.3);
    transition: all 0.3s ease;
}

.comment-module.collapsed .comments-list {
    max-height: 0;
    overflow: hidden;
}

.comment-module.collapsed .comment-form {
    display: none;
}

.comment-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

.comment-title {
    color: #ff6b6b;
    font-size: 1rem;
    transition: all 0.3s ease;
}

.comments-list {
    max-height: 300px;
    overflow-y: auto;
    padding: 10px 0;
}

.comment-item {
    padding: 10px 15px;
    border-bottom: 1px solid rgba(255,255,255,0.1);
    margin-bottom: 10px;
    position: relative;
}

.comment-item:last-child {
    border-bottom: none;
    margin-bottom: 0;
}

.comment-meta {
    color: rgba(255,255,255,0.7);
    font-size: 0.8rem;
}

.comment-content {
    color: #fff;
    font-size: 0.9rem;
    margin: 5px 0;
}

.comment-actions {
    position: absolute;
    right: 15px;
    top: 10px;
    display: none;
}

.comment-item:hover .comment-actions {
    display: block;
}

.action-btn {
    background: transparent;
    border: none;
    color: #ff6b6b;
    font-size: 0.9rem;
    cursor: pointer;
    margin-left: 8px;
}

.comment-form {
    display: flex;
    gap: 10px;
    margin-top: 10px;
}

.comment-form textarea {
    flex: 1;
    padding: 8px;
    border: 2px solid #3498db;
    border-radius: 8px;
    font-size: 1rem;
    resize: vertical;
    min-height: 60px;
}

.action-buttons {
    display: flex;
    gap: 8px;
}

.cancel-btn {
    background: transparent;
    border: 2px solid rgba(255,255,255,0.3);
    color: rgba(255,255,255,0.7);
    padding: 8px 15px;
    border-radius: 8px;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.3s ease;
}

.cancel-btn:hover {
    background: rgba(255,255,255,0.1);
    color: #fff;
}

.submit-btn {
    padding: 8px 15px;
    background: #ff6b6b;
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.3s ease;
}

.submit-btn:hover {
    background: #e65c5c;
}

