* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: "Microsoft YaHei", Arial, sans-serif;
}
body {
    background-color: #f5f5f5;
    color: #333;
    line-height: 1.6;
}
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}
.btn {
    display: inline-block;
    padding: 6px 16px;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s ease;
    border: none;
    font-size: 14px;
}
:root {
    --main-color: #ff7c24;
    --main-hover: #ff6a00;
    --border-color: #e5e5e5;
    --text-light: #999;
}

/* 头部布局 */
header {
    background: #fff;
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    z-index: 999;
}
.header-main {
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: 60px;
}
.logo {
    font-size: 24px;
    font-weight: bold;
    color: var(--main-color);
}
.nav {
    display: flex;
    gap: 30px;
    margin: 0 auto;
}
.user-info {
    display: flex;
    gap: 15px;
    align-items: center;
}
.logo {
    font-size: 24px;
    font-weight: bold;
    color: var(--main-color);
}
.logo span {
    font-size: 16px;
    color: #666;
    margin-left: 8px;
}
.nav {
    display: flex;
    gap: 30px;
}
.nav a {
    font-size: 16px;
    text-decoration: none;
    color: #333;
}
.nav a:hover, .nav a.active {
    color: var(--main-color);
    border-bottom: 2px solid var(--main-color);
    padding-bottom: 3px;
}
.user-info {
    display: flex;
    gap: 15px;
    align-items: center;
}
.user-info a {
    color: var(--main-color);
    text-decoration: none;
}
.avatar-small {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: var(--main-color);
    color: #fff;
    text-align: center;
    line-height: 30px;
    font-size: 14px;
}
.msg-icon {
    position: relative;
    cursor: pointer;
}
.msg-badge {
    position: absolute;
    top: -5px;
    right: -5px;
    background: #ff4d4f;
    color: #fff;
    border-radius: 50%;
    width: 16px;
    height: 16px;
    font-size: 10px;
    text-align: center;
    line-height: 16px;
}

/* 主体 */
main {
    display: flex;
    margin-top: 20px;
    gap: 20px;
}
.main-content {
    flex: 1;
    background: #fff;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    overflow: hidden;
    padding: 20px;
    position: relative;
    min-height: 400px;
}
.sidebar {
    width: 260px;
    display: flex;
    flex-direction: column;
    gap: 20px;
}
.side-card {
    background: #fff;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    padding: 15px;
}
.side-title {
    font-size: 16px;
    font-weight: bold;
    border-bottom: 2px solid var(--main-color);
    padding-bottom: 8px;
    margin-bottom: 15px;
}
.stat-item {
    display: flex;
    justify-content: space-between;
    margin-bottom: 10px;
}
.stat-num {
    color: var(--main-color);
    font-weight: bold;
}
.hot-tag {
    display: inline-block;
    background: #fff5ef;
    color: var(--main-color);
    padding: 3px 8px;
    border-radius: 12px;
    font-size: 12px;
    margin: 0 5px 8px 0;
    cursor: pointer;
}
.hot-tag:hover {
    background: var(--main-color);
    color: #fff;
}

/* 帖子列表 */
.post-item {
    display: flex;
    gap: 12px;
    padding: 15px 0;
    border-bottom: 1px dashed var(--border-color);
    cursor: pointer;
    transition: background 0.2s;
}
.post-item:hover {
    background: #fff5ef;
}
.avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--main-color);
    color: #fff;
    text-align: center;
    line-height: 40px;
    font-size: 18px;
}
.post-content {
    flex: 1;
}
.post-title {
    font-size: 17px;
    font-weight: 500;
    margin-bottom: 6px;
}
.post-meta {
    display: flex;
    justify-content: space-between;
    font-size: 12px;
    color: var(--text-light);
}
.tags {
    color: var(--main-color);
}
.post-actions {
    display: flex;
    gap: 15px;
    margin-top: 8px;
    font-size: 12px;
}
.post-actions span {
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 4px;
}
.post-actions span:hover {
    color: var(--main-color);
}
.liked {
    color: var(--main-color);
}

/* 模态框通用样式 */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 20px;
}
.modal-content {
    background: #fff;
    border-radius: 8px;
    width: 100%;
    max-width: 800px;
    max-height: 90vh;
    overflow-y: auto;
}
.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px;
    border-bottom: 1px solid var(--border-color);
}
.modal-title {
    font-size: 18px;
    font-weight: bold;
    color: var(--main-color);
}
.modal-close {
    font-size: 20px;
    cursor: pointer;
}
.modal-body {
    padding: 15px;
}
.modal-footer {
    padding: 15px;
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}
.btn-primary {
    background: var(--main-color);
    color: #fff;
}
.btn-primary:hover {
    background: var(--main-hover);
}
.btn-secondary {
    background: #f0f0f0;
    color: #333;
}
.btn-secondary:hover {
    background: #e0e0e0;
}

/* 表单元素 */
.form-group {
    margin-bottom: 15px;
}
.form-label {
    display: block;
    margin-bottom: 5px;
    font-size: 14px;
}
.form-input {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    font-size: 14px;
    outline: none;
}
.form-input:focus {
    border-color: var(--main-color);
}
.editor-toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    padding: 10px;
    background: #f8f8f8;
    border: 1px solid var(--border-color);
    border-radius: 4px 4px 0 0;
    margin-bottom: 10px;
}
.editor-btn {
    padding: 5px 10px;
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
    display: flex;
    align-items: center;
    gap: 4px;
}
.editor-btn:hover {
    background: var(--main-light);
    border-color: var(--main-color);
}
.editor-textarea {
    width: 100%;
    min-height: 250px;
    padding: 10px;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    font-family: monospace;
    resize: vertical;
}
.editor-preview {
    padding: 10px;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    background: #fafafa;
    min-height: 100px;
}

/* 帖子详情模态框 */
.post-detail-header {
    padding-bottom: 15px;
    border-bottom: 1px solid var(--border-color);
}
.post-detail-title {
    font-size: 22px;
    font-weight: bold;
    margin-bottom: 10px;
}
.post-detail-meta {
    font-size: 12px;
    color: var(--text-light);
    margin-bottom: 15px;
}
.post-detail-actions {
    display: flex;
    gap: 15px;
}
.post-detail-content {
    padding: 15px 0;
    line-height: 1.8;
}
.post-detail-content a {
    color: var(--main-color);
    text-decoration: none;
}
.post-detail-content a:hover {
    text-decoration: underline;
}
.copy-code-btn {
    position: absolute;
    top: 5px;
    right: 5px;
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 3px;
    padding: 2px 6px;
    cursor: pointer;
    font-size: 12px;
}

/* 评论区 */
.comments-section {
    margin-top: 20px;
}
.comment-input-box {
    margin: 15px 0;
}
.comment-input-box textarea {
    width: 100%;
    padding: 10px;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    resize: vertical;
}
.comment-input-box button {
    margin-top: 10px;
}
.comment-item {
    background: #f9f9f9;
    border-radius: 6px;
    padding: 12px;
    margin-bottom: 12px;
}
.comment-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 8px;
    font-size: 12px;
}
.comment-author {
    font-weight: bold;
    color: var(--main-color);
}
.comment-time {
    color: #999;
}
.comment-actions {
    display: flex;
    gap: 12px;
    margin-top: 8px;
    font-size: 12px;
}
.comment-like, .comment-report {
    cursor: pointer;
}
.comment-like:hover, .comment-report:hover {
    color: var(--main-color);
}

/* 用户主页（洛谷风格） */
.user-profile {
    background: #fff;
    border-radius: 12px;
    overflow: hidden;
    position: relative;
    box-shadow: 0 2px 12px rgba(0,0,0,0.08);
}
.user-profile::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 180px;
    background: url('/images/bg.jpg') no-repeat center center;
    background-size: cover;
    z-index: 0;
    opacity: 0.7;
}
.user-header {
    position: relative;
    z-index: 1;
    display: flex;
    gap: 32px;
    align-items: center;
    padding: 32px 32px 20px 32px;
    background: rgba(255,255,255,0.85);
    backdrop-filter: blur(4px);
    border-bottom: 1px solid rgba(0,0,0,0.05);
}
.user-avatar-large {
    width: 100px;
    height: 100px;
    border-radius: 50%;
    background: var(--main-color);
    color: #fff;
    font-size: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 3px solid #fff;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    cursor: pointer;
    position: relative;
}
.user-avatar-large:hover::after {
    content: "更换头像";
    position: absolute;
    bottom: -25px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0,0,0,0.7);
    color: #fff;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 12px;
    white-space: nowrap;
}
.user-info {
    flex: 1;
}
.user-info h2 {
    font-size: 28px;
    margin-bottom: 8px;
}
.user-info p {
    margin: 5px 0;
    color: #555;
    line-height: 1.4;
}
.edit-profile-btn {
    margin-top: 10px;
    background: #fff;
    border: 1px solid #ddd;
    color: var(--main-color);
    border-radius: 20px;
    padding: 6px 16px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.2s;
}
.edit-profile-btn:hover {
    border-color: var(--main-color);
    background: #f9f9f9;
}
.uid-display {
    position: absolute;
    bottom: 16px;
    right: 24px;
    font-size: 14px;
    color: #fff;
    background: rgba(0,0,0,0.5);
    padding: 4px 12px;
    border-radius: 20px;
    z-index: 1;
    backdrop-filter: blur(2px);
}
.user-posts {
    position: relative;
    z-index: 1;
    padding: 20px 32px;
    background: #fff;
}
.user-posts h3 {
    font-size: 18px;
    margin-bottom: 16px;
}
.user-posts .post-item {
    padding: 12px 0;
    border-bottom: 1px solid #eee;
    cursor: pointer;
}
.user-posts .post-title {
    font-size: 16px;
    font-weight: 500;
    margin-bottom: 4px;
}
.user-posts .post-meta {
    font-size: 12px;
    color: #888;
}

/* 博客页面单列布局 */
.post-full {
    max-width: 900px;
    margin: 0 auto;
    background: #fff;
    border-radius: 12px;
    padding: 32px;
    box-shadow: 0 2px 12px rgba(0,0,0,0.08);
}
.post-title-full {
    font-size: 28px;
    margin-bottom: 16px;
}
.post-meta-full {
    color: #666;
    margin-bottom: 24px;
    border-bottom: 1px solid #eee;
    padding-bottom: 16px;
}
.post-meta-full a {
    color: var(--main-color);
}
.post-content-full {
    line-height: 1.8;
}
.post-content-full a {
    color: var(--main-color);
}
.post-actions-full {
    margin: 24px 0;
    display: flex;
    gap: 12px;
}
.comments-section-full {
    margin-top: 32px;
    border-top: 1px solid #eee;
    padding-top: 24px;
}
.tag-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 12px;
}
.tag {
    background: #f0f0f0;
    padding: 4px 12px;
    border-radius: 16px;
    font-size: 12px;
    color: #666;
}

/* 关于页面链接 */
.about a {
    color: var(--main-color);
}
.about a:hover {
    text-decoration: underline;
}

/* 发帖按钮 */
.create-post-btn {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: var(--main-color);
    color: #fff;
    font-size: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 2px 10px rgba(0,0,0,0.2);
    transition: transform 0.2s;
}
.create-post-btn:hover {
    transform: scale(1.05);
    background: var(--main-hover);
}

/* 自定义提示框 */
.custom-toast {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0,0,0,0.85);
    color: #fff;
    padding: 12px 24px;
    border-radius: 8px;
    font-size: 14px;
    z-index: 9999;
    opacity: 0;
    transition: opacity 0.3s;
    pointer-events: none;
    text-align: center;
    white-space: nowrap;
}
.custom-toast.show {
    opacity: 1;
}
.toast-success { border-left: 4px solid #00C851; }
.toast-error { border-left: 4px solid #ff4444; }
.toast-info { border-left: 4px solid #ff9800; }

/* 自定义确认框 */
.custom-confirm {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
}
.custom-confirm[style*="display: none"] {
    display: none !important;
}
.confirm-content {
    background: #fff;
    border-radius: 8px;
    padding: 20px;
    max-width: 400px;
    width: 90%;
}
.confirm-title {
    font-size: 16px;
    font-weight: bold;
    margin-bottom: 15px;
}
.confirm-btns {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 20px;
}

/* 加载动画（仅帖子列表区域） */
.content-loader {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255,255,255,0.9);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 10;
    border-radius: 8px;
}
.dot-jump-loader {
    display: flex;
    gap: 18px;
    margin-bottom: 20px;
}
.dot {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: #ff9f43;
    animation: jump 1.05s linear forwards;
}
.dot:nth-child(1) { animation-delay: 0s; }
.dot:nth-child(2) { animation-delay: 0.25s; }
.dot:nth-child(3) { animation-delay: 0.5s; }
.dot:nth-child(4) { animation-delay: 0.75s; }
.dot:nth-child(5) { animation-delay: 1.0s; }
.dot:nth-child(6) { animation-delay: 1.25s; }
@keyframes jump {
    0% { transform: translateY(0); opacity: 1; }
    15% { transform: translateY(-30px); }
    30% { transform: translateY(-40px); }
    40% { transform: translateY(-38px); }
    50% { transform: translateY(-30px); }
    60% { transform: translateY(-15px); }
    70% { transform: translateY(0); }
}
.loader-text {
    color: #ff9f43;
    font-size: 18px;
    letter-spacing: 2px;
}

/* 响应式 */
@media (max-width: 768px) {
.header-main {
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: 60px;
}
.logo {
    font-size: 24px;
    font-weight: bold;
    color: var(--main-color);
}
.nav {
    display: flex;
    gap: 30px;
    margin: 0 auto;
}
.user-info {
    display: flex;
    gap: 15px;
    align-items: center;
}
    .nav {
        justify-content: center;
        flex-wrap: wrap;
    }
    .user-info {
        justify-content: center;
    }
    main {
        flex-direction: column;
    }
    .sidebar {
        width: 100%;
    }
    .user-header {
        flex-direction: column !important;
        text-align: center;
    }
    .uid-display {
        position: static;
        margin-top: 10px;
        text-align: center;
    }
}

/* ===== 强制修复头部布局（覆盖所有样式） ===== */
header .header-main {
    display: flex !important;
    justify-content: space-between !important;
    align-items: center !important;
    width: 100% !important;
}
header .logo {
    flex: 0 0 auto !important;
}
header .nav {
    display: flex !important;
    gap: 30px !important;
    flex: 1 !important;
    justify-content: center !important;
}
header .user-info {
    flex: 0 0 auto !important;
    margin-left: auto !important;
}

/* 调整用户主页背景图高度和层级 */
.user-profile::before {
    height: 150px !important;
    opacity: 0.6 !important;
}
.user-header {
    padding: 20px 20px 10px 20px !important;
    background: rgba(255,255,255,0.95) !important;
}
.edit-profile-btn {
    position: absolute !important;
    bottom: 16px !important;
    right: 24px !important;
    z-index: 3 !important;
}
.uid-display {
    bottom: 16px !important;
    left: 24px !important;
    z-index: 3 !important;
}

/* 用户信息移至底部 */
.user-header {
    align-items: flex-end !important;
}
.user-info {
    margin-top: auto !important;
    padding-bottom: 10px !important;
}

/* 消息提示动画改为滑入 */
.custom-toast {
    top: -100px !important;
    left: 50% !important;
    transform: translateX(-50%) !important;
    transition: top 0.3s ease-in-out !important;
    opacity: 1 !important;
}
.custom-toast.show {
    top: 20px !important;
}

/* 确保没有其他提示框干扰 */
#customToast {
    z-index: 10001 !important;
}

/* UID 悬浮框固定 */
.user-profile .uid-display {
    position: fixed !important;
    bottom: 20px !important;
    right: 20px !important;
    z-index: 1000 !important;
    background: rgba(0,0,0,0.7) !important;
    backdrop-filter: blur(4px);
}

/* 消息提示丝滑动画 */
.custom-toast {
    transition: transform 0.3s cubic-bezier(0.2, 0.9, 0.4, 1.1), opacity 0.2s !important;
    transform: translateX(-50%) translateY(-100px) !important;
}
.custom-toast.show {
    transform: translateX(-50%) translateY(0) !important;
}

/* 确保没有其他提示框干扰 */
#customToast {
    z-index: 10001 !important;
    border: none !important;
    box-shadow: none !important;
}
.custom-toast {
    background: rgba(0,0,0,0.85) !important;
    color: #fff !important;
    border-left: none !important;
}

/* 消息提示：丝滑弹出和收回 */
.custom-toast {
    transition: transform 0.3s cubic-bezier(0.2, 0.9, 0.4, 1.1), opacity 0.2s !important;
    transform: translateX(-50%) translateY(-100px) !important;
    opacity: 0 !important;
}
.custom-toast.show {
    transform: translateX(-50%) translateY(0) !important;
    opacity: 1 !important;
}
/* 移除原有 opacity 过渡冲突 */
.custom-toast {
    opacity: 0;
}
.custom-toast.show {
    opacity: 1;
}

/* 编辑主页按钮固定在背景图右下角 */
.user-profile {
    position: relative;
}
.edit-profile-btn {
    position: absolute !important;
    bottom: 16px !important;
    right: 24px !important;
    z-index: 10 !important;
    margin: 0 !important;
}

/* UID 显示宽度自适应 */
.uid-display {
    display: inline-block !important;
    width: auto !important;
    padding: 4px 12px !important;
    white-space: nowrap !important;
}

#login-error {
    color: #ff4444 !important;
    font-size: 12px !important;
    margin-top: 5px !important;
}

/* 确保他人主页样式与当前用户一致 */
.user-profile {
    background: #fff !important;
    border-radius: 12px !important;
    overflow: hidden !important;
    position: relative !important;
    box-shadow: 0 2px 12px rgba(0,0,0,0.08) !important;
}
.user-profile::before {
    content: "" !important;
    position: absolute !important;
    top: 0 !important;
    left: 0 !important;
    width: 100% !important;
    height: 180px !important;
    background: url('/images/bg.jpg') no-repeat center center !important;
    background-size: cover !important;
    z-index: 0 !important;
    opacity: 0.7 !important;
}
.user-header {
    position: relative !important;
    z-index: 1 !important;
    display: flex !important;
    gap: 32px !important;
    align-items: center !important;
    padding: 32px 32px 20px 32px !important;
    background: rgba(255,255,255,0.85) !important;
    backdrop-filter: blur(4px) !important;
    border-bottom: 1px solid rgba(0,0,0,0.05) !important;
}
.user-avatar-large {
    width: 100px !important;
    height: 100px !important;
    border-radius: 50% !important;
    background: var(--main-color) !important;
    color: #fff !important;
    font-size: 48px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    border: 3px solid #fff !important;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1) !important;
}
.user-info {
    flex: 1 !important;
}
.user-info h2 {
    font-size: 28px !important;
    margin-bottom: 8px !important;
}
.user-info p {
    margin: 5px 0 !important;
    color: #555 !important;
    line-height: 1.4 !important;
}
.uid-display {
    position: absolute !important;
    bottom: 16px !important;
    right: 24px !important;
    z-index: 2 !important;
    background: rgba(0,0,0,0.5) !important;
    color: #fff !important;
    padding: 4px 12px !important;
    border-radius: 20px !important;
    font-size: 14px !important;
    backdrop-filter: blur(2px) !important;
}
.user-posts {
    position: relative !important;
    z-index: 1 !important;
    padding: 20px 32px !important;
    background: #fff !important;
}
.user-posts h3 {
    font-size: 18px !important;
    margin-bottom: 16px !important;
}
.user-posts .post-item {
    padding: 12px 0 !important;
    border-bottom: 1px solid #eee !important;
    cursor: pointer !important;
}
.user-posts .post-title {
    font-size: 16px !important;
    font-weight: 500 !important;
    margin-bottom: 4px !important;
}
.user-posts .post-meta {
    font-size: 12px !important;
    color: #888 !important;
}

/* 编辑主页按钮固定在背景图右下角 */
.edit-profile-btn {
    position: fixed !important;
    bottom: 80px !important;
    right: 20px !important;
    z-index: 1000 !important;
}

/* UID 显示自适应宽度 */
.uid-display {
    display: inline-block !important;
    width: auto !important;
    padding: 4px 12px !important;
    white-space: nowrap !important;
}

/* 消息提示丝滑收回（增加过渡） */
.custom-toast {
    transition: transform 0.3s cubic-bezier(0.2, 0.9, 0.4, 1.1), opacity 0.3s !important;
}
.custom-toast.hide {
    transform: translateX(-50%) translateY(-100px) !important;
    opacity: 0 !important;
}

/* 消息消失动画 */
.custom-toast.hide {
    transform: translateX(-50%) translateY(-100px) !important;
    opacity: 0 !important;
}

/* 消息提示收回动画 */
.custom-toast {
    transition: transform 0.3s cubic-bezier(0.2, 0.9, 0.4, 1.1), opacity 0.3s !important;
    transform: translateX(-50%) translateY(-100px) !important;
}
.custom-toast.show {
    transform: translateX(-50%) translateY(0) !important;
}
.custom-toast.hide {
    transform: translateX(-50%) translateY(-100px) !important;
    opacity: 0 !important;
}
