* { margin: 0; padding: 0; box-sizing: border-box; }

:root {
    --primary: #e67e22;
    --primary-dark: #cf6d17;
    --primary-light: #fdf0e3;
    --text: #2c2c2c;
    --text-muted: #888;
    --border: #ececec;
    --bg: #f7f5f1;
    --card: #ffffff;
}

body {
    font-family: "PingFang SC", "Microsoft YaHei", "Helvetica Neue", sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.7;
    -webkit-font-smoothing: antialiased;
}

/* ===== 顶部 ===== */
.site-header {
    background: linear-gradient(135deg, #fff 0%, #fdf6ec 100%);
    border-bottom: 1px solid var(--border);
    padding: 48px 20px;
    text-align: center;
}

.header-inner { max-width: 960px; margin: 0 auto; }

.site-header h1 {
    font-size: 32px;
    color: var(--primary);
    letter-spacing: 2px;
    margin-bottom: 10px;
}

.site-header p { color: var(--text-muted); font-size: 15px; }

/* ===== 布局 ===== */
.container {
    max-width: 960px;
    margin: 0 auto;
    padding: 30px 20px;
}

.layout {
    display: flex;
    gap: 24px;
    align-items: flex-start;
}

.main-col { flex: 1; min-width: 0; }
.sidebar { width: 260px; flex-shrink: 0; }

/* ===== 文章卡片 ===== */
.post-card {
    background: var(--card);
    padding: 24px;
    margin-bottom: 20px;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.04);
    transition: box-shadow 0.2s, transform 0.2s;
}

.post-card:hover {
    box-shadow: 0 6px 20px rgba(0,0,0,0.08);
    transform: translateY(-2px);
}

.post-card h2 { font-size: 20px; margin-bottom: 4px; }
.post-card h2 a { color: var(--text); text-decoration: none; }
.post-card h2 a:hover { color: var(--primary); }

.post-meta { color: #bbb; font-size: 13px; margin: 6px 0; }
/* ===== 卡片左文右图布局 ===== */
.card-body { display: flex; gap: 16px; align-items: center; }
.card-text { flex: 1; min-width: 0; }

.card-thumb {
    width: 150px;
    height: 100px;
    object-fit: cover;
    border-radius: 8px;
    flex-shrink: 0;
}

/* 摘要最多显示两行，超出省略 */
.post-excerpt {
    color: #666;
    font-size: 14px;
    margin-top: 8px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.post-tags { margin-top: 12px; }

/* ===== 标签 ===== */
.tag {
    display: inline-block;
    padding: 2px 10px;
    margin: 0 6px 6px 0;
    background: var(--primary-light);
    color: var(--primary-dark);
    border-radius: 20px;
    font-size: 12px;
    text-decoration: none;
    transition: background 0.2s;
}

.tag:hover { background: #fbe2c8; }

/* ===== 分类徽章（文章卡片 / 详情页）===== */
.post-category {
    display: inline-block;
    margin: 12px 0 0;
    padding: 2px 10px;
    background: var(--primary);
    color: #fff;
    border-radius: 4px;
    font-size: 12px;
    text-decoration: none;
    transition: opacity 0.2s;
}

.post-category:hover { opacity: 0.85; }

/* ===== 侧边栏：分类列表 ===== */
.cat-list { list-style: none; }

.cat-list li {
    border-bottom: 1px dashed var(--border);
}

.cat-list li:last-child { border-bottom: none; }

.cat-list li a {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 0;
    font-size: 14px;
    color: var(--text);
    text-decoration: none;
    transition: color 0.2s;
}

.cat-list li a:hover,
.cat-list li a.active { color: var(--primary); }

.cat-count {
    font-size: 12px;
    color: var(--text-muted);
    background: var(--primary-light);
    padding: 1px 8px;
    border-radius: 10px;
}

/* ===== 侧边栏 ===== */
.widget {
    background: var(--card);
    padding: 20px;
    border-radius: 12px;
    margin-bottom: 20px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.04);
}

.widget h3 {
    font-size: 15px;
    margin-bottom: 14px;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--border);
}

.tag-cloud { line-height: 2; }

/* ===== 侧边栏：热门推荐 ===== */
.hot-list { list-style: none; }

.hot-list li {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 0;
    border-bottom: 1px dashed var(--border);
}

.hot-list li:last-child { border-bottom: none; }

.hot-rank {
    flex-shrink: 0;
    width: 20px;
    height: 20px;
    border-radius: 4px;
    background: var(--primary-light);
    color: var(--primary);
    font-size: 12px;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* 前三名序号加深，突出排名 */
.hot-rank-1 { background: var(--primary); color: #fff; }
.hot-rank-2 { background: #f0a35e; color: #fff; }
.hot-rank-3 { background: #f5c696; color: #fff; }

.hot-list li a {
    flex: 1;
    min-width: 0;
    font-size: 14px;
    color: var(--text);
    text-decoration: none;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    transition: color 0.2s;
}

.hot-list li a:hover { color: var(--primary); }

.search-form input[type="text"] {
    width: 100%;
    margin-bottom: 10px;
}

.search-form button {
    width: 100%;
    margin-top: 0;
}

/* ===== 筛选提示 ===== */
.filter-tip {
    background: var(--primary-light);
    color: var(--primary-dark);
    padding: 12px 16px;
    border-radius: 8px;
    margin-bottom: 20px;
    font-size: 14px;
}

.filter-tip strong { color: var(--primary); font-size: 16px; }

/* ===== 搜索关键词高亮 ===== */
mark {
    background: #ffd54d;
    color: #3a3a3a;
    padding: 0 2px;
    border-radius: 3px;
    font-weight: 600;
}

/* ===== 文章详情 ===== */
.post-title { font-size: 28px; margin-bottom: 8px; line-height: 1.4; }
.post-content { margin-top: 20px; font-size: 16px; color: #3a3a3a; }
.post-content p { margin-bottom: 14px; }

/* ===== 评论 ===== */
.comments { margin-top: 40px; }
.comments h2 { font-size: 18px; margin-bottom: 16px; }

/* 评论项：B站式两栏布局（左头像 + 右内容列），卡片改为分隔线风格 */
.comment-item {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    background: transparent;
    padding: 18px 4px;
    margin-bottom: 0;
    border-radius: 0;
    border-bottom: 1px solid #e3e5e7;
}

.comment-list .comment-item:last-child { border-bottom: none; }

/* 右侧内容列 */
.comment-main {
    flex: 1;
    min-width: 0;
}

.comment-del {
    margin-left: auto;
    color: #e74c3c;
    font-size: 13px;
    text-decoration: none;
}

.comment-del:hover { text-decoration: underline; }

/* 头部行：昵称 + 徽章（时间与操作已移至底部行，B站布局） */
.comment-head { margin-bottom: 6px; display: flex; align-items: center; gap: 8px; }

/* B站普通用户昵称为深灰色，悬停变主题橙 */
.comment-author {
    font-weight: 500;
    color: #61666d;
    font-size: 14px;
    cursor: pointer;
    transition: color 0.15s ease;
}

.comment-author:hover { color: var(--primary); }

/* 时间：位于底部操作行最左（B站布局） */
.comment-time { color: #9499a0; font-size: 12px; margin-right: 12px; flex-shrink: 0; }

.comment-body { color: #444; font-size: 14px; line-height: 1.7; }

/* 评论头像：登录用户显示头像图片，匿名/未登录显示首字占位圆 */
.comment-avatar-img {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
    border: 1px solid var(--border);
}

.comment-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: #d9d9d9;
    color: #fff;
    font-size: 15px;
    font-weight: 500;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

/* 评论底部操作行（点赞 + 点踩 + 回复 + 更多）—— B站模式 */
.comment-foot {
    margin-top: 10px;
    display: flex;
    align-items: center;
    gap: 2px;
}

.comment-like,
.comment-dislike {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: transparent;
    border: none;
    margin: 0;
    padding: 4px 10px;
    color: #9499a0;
    font-size: 13px;
    line-height: 20px;
    cursor: pointer;
    user-select: none;
    border-radius: 6px;
    transition: background 0.15s ease, color 0.15s ease;
}

/* 悬停：浅灰圆角背景（B站同款） */
.comment-like:hover,
.comment-dislike:hover { background: #9499a033; }

/* 点赞/点踩后：数字与图标变主题橙 */
.comment-like.active,
.comment-dislike.active { color: var(--primary); }

.comment-like svg,
.comment-dislike svg {
    stroke: currentColor;
    fill: none;
    transition: fill 0.15s ease;
}

/* 点赞/点踩后图标实心橙 */
.comment-like.active svg,
.comment-dislike.active svg { fill: var(--primary); }

/* 更多（…）菜单：悬停浅灰背景，下拉白色菜单 */
.foot-spacer { flex: 1; }

.comment-more-wrap { position: relative; }

.comment-more {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    margin: 0;
    padding: 4px 8px;
    color: #9499a0;
    cursor: pointer;
    user-select: none;
    border-radius: 6px;
    transition: background 0.15s ease, color 0.15s ease;
}

.comment-more:hover { background: #9499a033; color: #61666d; }

.comment-menu {
    position: absolute;
    right: 0;
    top: 100%;
    z-index: 20;
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 8px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
    padding: 4px;
    min-width: 72px;
    display: flex;
    flex-direction: column;
}

.comment-menu button {
    background: transparent;
    border: none;
    margin: 0;
    padding: 7px 14px;
    font-size: 13px;
    color: #61666d;
    text-align: left;
    cursor: pointer;
    border-radius: 6px;
    white-space: nowrap;
    transition: background 0.15s ease, color 0.15s ease;
}

.comment-menu button:hover { background: #f1f2f3; color: var(--primary); }

.comment-reply {
    background: transparent;
    border: none;
    margin: 0;
    padding: 4px 10px;
    color: #9499a0;
    font-size: 13px;
    line-height: 20px;
    cursor: pointer;
    user-select: none;
    border-radius: 6px;
    transition: background 0.15s ease, color 0.15s ease;
}

.comment-reply:hover { background: #9499a033; }

/* 回复列表：B站式缩进（无竖线、无背景块），子回复头像更小 */
.comment-replies {
    margin-top: 6px;
    padding-left: 0;
}

.comment-reply-item {
    background: transparent;
    border-bottom: none;
    padding: 10px 0 4px;
    margin-bottom: 0;
}

.comment-reply-item:last-child { margin-bottom: 0; padding-bottom: 0; }

.comment-reply-item .comment-avatar-img,
.comment-reply-item .comment-avatar {
    width: 24px;
    height: 24px;
    font-size: 12px;
}

/* 回复正文中的「回复 @某人」前缀 */
.reply-to {
    color: var(--primary);
    font-size: 13px;
    margin-right: 4px;
}

/* 回复表单中的目标指示条 */
.reply-target {
    font-size: 13px;
    color: var(--primary);
    margin-bottom: 8px;
}

.reply-target-name { font-weight: 500; }

/* 回复表单 */
.comment-reply-form {
    margin-top: 12px;
    padding: 14px;
    background: #fafafa;
    border-radius: 8px;
}

.comment-reply-form textarea {
    width: 100%;
    margin-bottom: 10px;
    font-family: inherit;
    font-size: 14px;
}

.comment-reply-form input[type="text"] {
    width: 100%;
    margin-bottom: 10px;
}

.reply-form-actions {
    display: flex;
    gap: 10px;
}

.reply-form-actions button {
    margin-top: 0;
    padding: 7px 18px;
    font-size: 13px;
}

.reply-cancel {
    background: #e0e0e0;
    color: #555;
}

.reply-cancel:hover { background: #d0d0d0; }

.comment-form { margin-top: 0; flex: 1; }

/* ===== 排序栏：最热 / 最新（B站模式） ===== */
.comment-sortbar {
    display: flex;
    align-items: center;
    gap: 4px;
    margin: 14px 0 4px;
    font-size: 13px;
}

.sort-item {
    color: #9499a0;
    text-decoration: none;
    padding: 3px 10px;
    border-radius: 6px;
    transition: color 0.15s ease, background 0.15s ease;
}

.sort-item:hover { color: #61666d; background: #9499a022; }

.sort-item.active {
    color: var(--primary);
    font-weight: 500;
    background: var(--primary-light);
}

.sort-divider {
    width: 1px;
    height: 12px;
    background: var(--border);
    margin: 0 2px;
}

/* ===== 评论发布框置顶（B站模式）：头像 + 输入框 ===== */
.comment-publisher {
    display: flex;
    gap: 12px;
    margin: 16px 0 20px;
    padding-bottom: 18px;
    border-bottom: 1px solid var(--border);
}

.publisher-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
}

.publisher-avatar-letter {
    background: var(--primary);
    color: #fff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    font-weight: 500;
}

.comment-publisher textarea {
    width: 100%;
    background: #f1f2f3;
    border: 1px solid transparent;
    border-radius: 8px;
    padding: 10px 12px;
    font-size: 14px;
    font-family: inherit;
    resize: vertical;
    transition: background 0.15s ease, border-color 0.15s ease;
}

.comment-publisher textarea:focus {
    background: #fff;
    border-color: var(--primary);
    outline: none;
}

.comment-publisher input[type="text"] {
    width: 100%;
    margin-bottom: 8px;
    background: #f1f2f3;
    border: 1px solid transparent;
    border-radius: 8px;
    padding: 8px 12px;
    font-size: 13px;
}

.comment-publisher input[type="text"]:focus {
    background: #fff;
    border-color: var(--primary);
    outline: none;
}

.publisher-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 8px;
}

.publisher-actions button { margin-top: 0; }

/* 评论图片上传按钮（与「回复」一致的浅灰圆角） */
.comment-img-btn {
    flex-shrink: 0;
    background: transparent;
    border: none;
    margin: 0;
    padding: 5px 12px;
    font-size: 13px;
    color: #61666d;
    border-radius: 6px;
    cursor: pointer;
    transition: background 0.15s ease, color 0.15s ease;
}

.comment-img-btn:hover:not(:disabled) {
    background: #9499a033;
    color: var(--primary);
}

.comment-img-btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* Markdown 语法提示 */
.comment-md-hint {
    flex: 1;
    font-size: 12px;
    color: #b2b6bc;
}

/* ===== 评论 Markdown 渲染样式 ===== */
.comment-body code {
    font-family: Consolas, Monaco, "Courier New", monospace;
    background: #f5f6f7;
    color: #c7254e;
    padding: 2px 5px;
    border-radius: 4px;
    font-size: 13px;
}

.comment-body pre {
    background: #f5f6f7;
    border: 1px solid #e8e8e8;
    border-radius: 6px;
    padding: 12px;
    margin: 8px 0;
    overflow-x: auto;
}

.comment-body pre code {
    background: transparent;
    color: #333;
    padding: 0;
    font-size: 13px;
    line-height: 1.5;
}

.comment-body .comment-img {
    display: block;
    max-width: 100%;
    max-height: 320px;
    margin: 8px 0;
    border-radius: 8px;
}

.comment-body a {
    color: var(--primary);
    text-decoration: none;
}

.comment-body a:hover { text-decoration: underline; }

/* ===== 作者徽章（B站UP主标识的橙色版） ===== */
.cbadge {
    flex-shrink: 0;
    font-size: 11px;
    line-height: 1;
    color: #fff;
    background: var(--primary);
    padding: 3px 6px;
    border-radius: 4px;
    font-weight: 400;
}

/* ===== 回复折叠：共N条回复，点击查看（悬停与「回复」按钮一致：浅灰圆角背景） ===== */
.replies-toggle {
    background: transparent;
    border: none;
    margin: 2px 0 8px;
    padding: 4px 10px;
    color: #9499a0;
    font-size: 13px;
    cursor: pointer;
    user-select: none;
    border-radius: 6px;
    transition: background 0.15s ease;
}

.replies-toggle:hover { background: #9499a033; color: #9499a0; }

.comment-replies-extra { margin-bottom: 8px; }

/* ===== 上一篇 / 下一篇 ===== */
.post-nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    margin-top: 24px;
    padding: 12px 16px;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 14px;
}

.post-nav a { color: var(--primary); text-decoration: none; }
.post-nav a:hover { text-decoration: underline; }
.post-nav-next { margin-left: auto; text-align: right; }

/* ===== 作者信息卡片 ===== */
.author-row { display: flex; align-items: center; gap: 12px; }

.author-avatar {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: var(--primary);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    font-weight: 500;
    flex-shrink: 0;
}

.author-avatar-img {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
    border: 2px solid var(--border);
}

.author-name { font-size: 16px; font-weight: 500; }
.author-sub { font-size: 13px; color: var(--text-muted); margin-top: 4px; }

.comment-hint { margin-top: 6px; font-size: 12px; color: var(--text-muted); }
.comment-hint a { color: var(--primary); text-decoration: none; }
.comment-hint a:hover { text-decoration: underline; }

/* ===== 评论审核警告弹窗 ===== */
.modal-mask {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0, 0, 0, 0.45);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 999;
    animation: modalFade 0.2s ease;
}
@keyframes modalFade { from { opacity: 0; } to { opacity: 1; } }

.modal-box {
    background: var(--card);
    border-radius: 12px;
    padding: 28px 32px 24px;
    max-width: 340px;
    width: calc(100% - 48px);
    text-align: center;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.18);
    animation: modalPop 0.22s ease;
}
@keyframes modalPop {
    from { transform: scale(0.88); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}

.modal-icon {
    width: 48px;
    height: 48px;
    margin: 0 auto 14px;
    border-radius: 50%;
    background: #fdeaea;
    color: #e74c3c;
    font-size: 26px;
    font-weight: bold;
    line-height: 48px;
}

.modal-text {
    font-size: 14px;
    color: var(--text);
    line-height: 1.6;
    margin-bottom: 4px;
    word-break: break-all;
}

.modal-btn {
    margin-top: 14px;
    padding: 8px 30px;
    font-size: 14px;
}

.comment-form input[readonly] {
    background: #f5f5f5;
    color: #999;
    cursor: not-allowed;
}

/* ===== 图片 ===== */
.post-img { max-width: 100%; border-radius: 10px; margin: 12px 0; display: block; }
.preview-img { max-width: 160px; margin: 8px 8px 0 0; border-radius: 6px; }

.upload-bar { margin: 12px 0; display: flex; align-items: center; gap: 12px; }
.upload-status { color: var(--text-muted); font-size: 13px; }

/* ===== 分页 ===== */
.pagination { text-align: center; margin-top: 30px; }

.pagination a, .pagination .current {
    display: inline-block;
    padding: 7px 15px;
    margin: 0 4px;
    border-radius: 8px;
    text-decoration: none;
    font-size: 14px;
}

.pagination a { background: var(--card); color: var(--primary); border: 1px solid var(--border); }
.pagination a:hover { background: var(--primary-light); }
.pagination .current { background: var(--primary); color: #fff; }

/* ===== 表单 ===== */
form { background: var(--card); padding: 24px; border-radius: 12px; box-shadow: 0 2px 8px rgba(0,0,0,0.04); }

label { display: block; margin: 16px 0 6px; font-size: 14px; color: #555; }

input[type="text"], input[type="email"], input[type="password"], textarea {
    width: 100%;
    padding: 11px 14px;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-size: 14px;
    font-family: inherit;
    transition: border 0.2s;
}

input[type="text"]:focus, input[type="email"]:focus, input[type="password"]:focus, textarea:focus {
    outline: none;
    border-color: var(--primary);
}

button {
    margin-top: 20px;
    padding: 11px 28px;
    background: var(--primary);
    color: #fff;
    border: none;
    border-radius: 8px;
    font-size: 15px;
    cursor: pointer;
    transition: background 0.2s;
}

button:hover { background: var(--primary-dark); }

/* ===== 其他 ===== */
.empty, .error { text-align: center; color: var(--text-muted); padding: 50px 0; }
.error { color: #e74c3c; }

.site-footer {
    text-align: center;
    padding: 30px 20px;
    color: var(--text-muted);
    border-top: 1px solid var(--border);
    margin-top: 20px;
}

.site-footer a, .back-link { color: var(--primary); text-decoration: none; }
.back-link { display: inline-block; margin-top: 24px; }

/* ===== 响应式 ===== */
@media (max-width: 720px) {
    .layout { flex-direction: column; }
    .sidebar { width: 100%; }
    .site-header h1 { font-size: 26px; }
    .card-thumb { width: 100px; height: 72px; }
}

/* ===== 文章统计行（阅读/赞/收藏） ===== */
.post-stats {
    display: flex;
    gap: 18px;
    margin-top: 14px;
    padding-top: 12px;
    border-top: 1px solid var(--border);
}

.stat-item {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    color: var(--text-muted);
    font-size: 13px;
}

.stat-item svg { stroke: #b5b5b5; }

/* ===== 详情页操作栏（点赞/收藏） ===== */
.post-actions {
    display: flex;
    justify-content: center;
    gap: 16px;
    margin-top: 28px;
}

.action-btn {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    margin-top: 0;
    padding: 9px 26px;
    background: var(--card);
    color: #666;
    border: 1px solid var(--border);
    border-radius: 24px;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s;
}

.action-btn:hover {
    border-color: var(--primary);
    color: var(--primary);
}

.action-btn.active {
    background: var(--primary-light);
    border-color: var(--primary);
    color: var(--primary-dark);
}

.action-count { font-weight: 500; }

.meta-item { margin-left: 14px; }

/* ===== 多行页脚 ===== */
.site-footer {
    text-align: center;
    padding: 30px 20px 40px;
    color: #a0a0a0;
    border-top: 1px solid var(--border);
    margin-top: 40px;
}

.footer-inner { max-width: 960px; margin: 0 auto; }

.footer-row {
    font-size: 13px;
    line-height: 2.2;
}

.footer-row a { color: #8a8a8a; text-decoration: none; }
.footer-row a:hover { color: var(--primary); }

.footer-links a { margin: 0 8px; }

.footer-copy { margin-left: 12px; color: #b5b5b5; }

@media (max-width: 720px) {
    .footer-links { display: flex; flex-direction: column; }
    .footer-copy { display: block; margin: 6px 0 0; }
}

/* ===== 顶部导航栏（logo + 菜单 + 搜索） ===== */
.top-nav {
    background: #fff;
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 100;
}

.nav-inner {
    max-width: 1060px;
    margin: 0 auto;
    padding: 0 20px;
    display: flex;
    align-items: center;
    gap: 8px;
    height: 58px;
}

/* Logo */
.brand {
    display: flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
    margin-right: 8px;
}

.brand-icon {
    width: 38px;
    height: 38px;
    background: var(--primary);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.brand-text { display: flex; flex-direction: column; line-height: 1.25; }

.brand-name {
    color: var(--primary);
    font-size: 17px;
    font-weight: 500;
    white-space: nowrap;
}

.brand-sub { color: var(--text-muted); font-size: 11px; white-space: nowrap; }

/* 菜单 */
.nav-links { display: flex; align-items: center; }

.nav-links a, .nav-right a {
    display: inline-block;
    padding: 0 13px;
    line-height: 58px;
    color: #555;
    text-decoration: none;
    font-size: 15px;
    white-space: nowrap;
}

.nav-links a:hover, .nav-right a:hover { color: var(--primary); }

.nav-links a.active { color: var(--primary); font-weight: 500; }

/* 搜索框（覆盖全局 form 的卡片样式） */
.nav-search {
    position: relative;
    margin-left: auto;
    background: transparent;
    padding: 0;
    border-radius: 0;
    box-shadow: none;
}

.nav-search input {
    width: 190px;
    padding: 8px 38px 8px 16px;
    border: 1px solid #ddd;
    border-radius: 20px;
    font-size: 13px;
    background: #f6f6f6;
    transition: all 0.2s;
}

.nav-search input:focus {
    outline: none;
    border-color: var(--primary);
    background: #fff;
    width: 230px;
}

.nav-search button {
    position: absolute;
    right: 5px;
    top: 50%;
    transform: translateY(-50%);
    margin-top: 0;
    padding: 5px 8px;
    background: transparent;
    border: none;
    color: #999;
    cursor: pointer;
    line-height: 0;
}

.nav-search button:hover { background: transparent; color: var(--primary); }

.nav-user {
    color: var(--primary);
    font-size: 14px;
    padding: 0 6px;
    white-space: nowrap;
}

.nav-user-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 0 6px;
    line-height: normal;
}

.nav-user-avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    object-fit: cover;
    border: 1px solid var(--border);
    flex-shrink: 0;
}

/* 未上传头像时的昵称首字占位圆 */
.nav-user-avatar-fallback {
    background: var(--primary);
    color: #fff;
    font-size: 14px;
    font-weight: 500;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: none;
}

/* ===== 注册 / 登录页（居中卡片） ===== */
.auth-wrap {
    max-width: 420px;
    margin: 50px auto 60px;
    padding: 0 16px;
}

.auth-card { padding: 36px 32px 28px; }

.auth-title {
    text-align: center;
    font-size: 20px;
    font-weight: 500;
    margin-bottom: 22px;
    color: var(--text);
}

.auth-card input[type="text"],
.auth-card input[type="email"],
.auth-card input[type="password"] {
    display: block;
    margin-bottom: 14px;
}

/* 邮箱格式错误态：红框 + 输入框下方提示 */
.auth-card input.input-error { border-color: #e74c3c; }

.auth-card input.input-error:focus { border-color: #e74c3c; }

.field-error {
    color: #e74c3c;
    font-size: 12px;
    text-align: left;
    margin: -8px 2px 10px;
}

/* ===== 验证码行：输入框 + 发送按钮 ===== */
.code-row {
    display: flex;
    gap: 10px;
    align-items: stretch;
    margin-bottom: 14px;
}

/* 输入框在 .code-row 内不允许带下边距（覆盖 .auth-card input[type=...] 的 14px），
   否则行高被撑大、按钮拉伸后比输入框高出一截 */
.auth-card .code-row input {
    flex: 1;
    min-width: 0;
    margin-bottom: 0;
}

.btn-send-code {
    flex-shrink: 0;
    min-width: 110px;
    margin-top: 0;
    padding: 0 16px;
    background: var(--primary-light);
    color: var(--primary-dark);
    border: none;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 600;
    white-space: nowrap;
    cursor: pointer;
    transition: background 0.15s ease, color 0.15s ease;
}

.btn-send-code:hover:not(:disabled) {
    background: var(--primary);
    color: #fff;
}

/* 倒计时/发送中：置灰而非透明化，状态更清晰 */
.btn-send-code:disabled {
    background: #f1f2f3;
    color: #9499a0;
    cursor: not-allowed;
}

/* 发送结果提示：绿色成功 / 红色失败 */
.code-hint { font-size: 12px; text-align: left; margin: -8px 2px 12px; }
.code-hint.ok { color: #27ae60; }
.code-hint.err { color: #e74c3c; }

.auth-card button[type="submit"] {
    display: block;
    width: 100%;
    margin-top: 10px;
}

.auth-avatar {
    width: 72px;
    height: 72px;
    border-radius: 50%;
    background: var(--primary-light);
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 18px;
}

.auth-msg {
    background: #fdeaea;
    color: #c0392b;
    font-size: 13px;
    padding: 9px 12px;
    border-radius: 6px;
    margin-bottom: 14px;
    text-align: center;
}

.auth-remember {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    color: #666;
    margin: 2px 0 4px;
}

.auth-agreement {
    font-size: 12px;
    color: #999;
    text-align: center;
    margin-top: 16px;
}

.auth-agreement a, .auth-alt a { color: var(--primary); text-decoration: none; }

.auth-alt {
    text-align: center;
    font-size: 13px;
    color: #666;
    margin-top: 18px;
    padding-top: 16px;
    border-top: 1px solid var(--border);
}

/* 右侧链接 */
.nav-right { display: flex; align-items: center; }

@media (max-width: 900px) {
    .brand-sub { display: none; }
    .nav-search input { width: 140px; }
    .nav-search input:focus { width: 160px; }
    .nav-links a, .nav-right a { padding: 0 8px; font-size: 14px; }
}

@media (max-width: 640px) {
    .nav-inner { flex-wrap: wrap; height: auto; padding: 10px 16px; row-gap: 10px; }
    .brand { margin-right: 0; }
    .nav-search { order: 10; width: 100%; margin-left: 0; }
    .nav-search input { width: 100%; }
    .nav-search input:focus { width: 100%; }
    .nav-right { margin-left: auto; }
    .nav-links a, .nav-right a { line-height: 40px; }
}

/* ===== 关于类页面（博客园风格） ===== */
.page-title {
    font-size: 22px;
    font-weight: 500;
    padding-bottom: 14px;
    border-bottom: 1px solid var(--border);
    margin-bottom: 0;
}

.page-layout {
    display: flex;
    align-items: stretch;
    min-height: 380px;
}

.page-menu {
    width: 180px;
    flex-shrink: 0;
    padding: 24px 20px 0 0;
    border-right: 1px solid var(--border);
}

.page-menu ul { list-style: none; }

.page-menu li { margin-bottom: 4px; }

.page-menu li a {
    display: block;
    padding: 7px 12px;
    color: #555;
    text-decoration: none;
    font-size: 14px;
    border-radius: 6px;
}

.page-menu li a:hover { color: var(--primary); background: var(--primary-light); }

.page-menu li.active a {
    color: #d9534f;
    font-weight: 500;
}

.page-menu li.active a::before { content: "▶ "; font-size: 12px; }

.page-content {
    flex: 1;
    min-width: 0;
    padding: 24px 0 24px 28px;
    font-size: 15px;
    color: #3a3a3a;
}

.page-content p { margin-bottom: 16px; line-height: 1.9; }

.content-title {
    font-size: 17px;
    font-weight: 500;
    margin-bottom: 20px;
    padding-left: 34px;
    position: relative;
}

.content-title::before {
    content: "➢";
    position: absolute;
    left: 0;
    color: #c0c0c0;
    font-size: 22px;
}

.hint { color: #b0b0b0; font-size: 13px; }

/* ===== 二维码占位卡片 ===== */
.qr-row { display: flex; gap: 24px; flex-wrap: wrap; margin-top: 8px; }

.qr-card {
    width: 220px;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 16px;
    text-align: center;
}

.qr-img {
    height: 160px;
    border: 2px dashed #d8d8d8;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #b5b5b5;
    font-size: 13px;    line-height: 1.8;
    margin-bottom: 12px;
}

.qr-name { font-size: 14px; color: #555; }

/* 真实二维码图片：方形裁剪图，随卡片宽度等比显示 */
.qr-pic {
    width: 100%;
    height: auto;
    display: block;
    margin-bottom: 12px;
    border-radius: 8px;
    border: 1px solid var(--border);
    background: #fff;
}

@media (max-width: 720px) {
    .page-layout { flex-direction: column; }
    .page-menu {
        width: 100%;
        border-right: none;
        border-bottom: 1px solid var(--border);
        padding: 0 0 12px;
    }
    .page-content { padding-left: 0; }
}

/* ===== 个人中心 ===== */
.profile-feedback {
    max-width: 960px;
    margin: 0 auto 16px;
    padding: 11px 16px;
    border-radius: 8px;
    font-size: 14px;
}

.profile-feedback.success { background: #e8f7ee; color: #1e7e34; }
.profile-feedback.error { background: #fdeaea; color: #c0392b; }

.profile-layout {
    display: flex;
    gap: 24px;
    align-items: flex-start;
    max-width: 960px;
    margin: 0 auto;
}

.profile-side { width: 280px; flex-shrink: 0; }

.profile-main { flex: 1; min-width: 0; }

.profile-card {
    background: var(--card);
    border-radius: 12px;
    padding: 24px;
    margin-bottom: 20px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.04);
    text-align: center;
}

/* 个人信息卡中的头像+昵称：整体可点击，跳转编辑页 */
.profile-identity {
    display: block;
    text-decoration: none;
}

.profile-identity:hover .profile-name { color: var(--primary); }

/* 「编辑资料」入口 */
.profile-edit-hint {
    display: inline-block;
    margin-top: 14px;
    font-size: 13px;
    color: var(--primary);
    text-decoration: none;
}

.profile-edit-hint:hover { text-decoration: underline; }

/* 个人信息编辑页：居中窄栏 */
.profile-edit-wrap {
    max-width: 520px;
    margin: 0 auto;
}

.profile-edit-wrap .page-title { margin-bottom: 20px; }

.profile-back { margin: 0 0 16px; }

.profile-avatar {
    width: 76px;
    height: 76px;
    border-radius: 50%;
    background: var(--primary);
    color: #fff;
    font-size: 32px;
    font-weight: 500;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 14px;
}

/* 上传后的头像图片 */
.profile-avatar-img {
    width: 76px;
    height: 76px;
    border-radius: 50%;
    object-fit: cover;
    margin: 0 auto 14px;
    display: block;
    border: 2px solid var(--border);
}

.profile-form input[type="file"] {
    margin-bottom: 12px;
    font-size: 13px;
    color: #666;
}

.profile-name { font-size: 20px; font-weight: 500; color: var(--text); }

.profile-email { color: var(--text-muted); font-size: 13px; margin: 4px 0; }

.profile-join { color: #b5b5b5; font-size: 12px; }

.profile-stats {
    display: flex;
    justify-content: space-around;
    margin-top: 20px;
    padding-top: 18px;
    border-top: 1px solid var(--border);
}

.pstat { text-align: center; }

.pstat strong {
    display: block;
    font-size: 20px;
    color: var(--primary);
    font-weight: 500;
}

.pstat span { font-size: 12px; color: var(--text-muted); }

.profile-card-title {
    font-size: 15px;
    text-align: left;
    margin-bottom: 14px;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--border);
}

.profile-form { text-align: left; }

.profile-form input[type="text"],
.profile-form input[type="password"] {
    margin-bottom: 12px;
}

.profile-form button {
    width: 100%;
    margin-top: 4px;
}

/* 我的文章表格 */
.profile-posts {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

.profile-posts th, .profile-posts td {
    padding: 12px 10px;
    text-align: left;
    border-bottom: 1px solid var(--border);
}

.profile-posts th {
    color: var(--text-muted);
    font-weight: 500;
    font-size: 13px;
    background: #fafafa;
}

.profile-posts .post-title-cell { max-width: 320px; }

.profile-posts .post-title-cell a {
    color: var(--text);
    text-decoration: none;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    display: block;
    max-width: 320px;
}

.profile-posts .post-title-cell a:hover { color: var(--primary); }

@media (max-width: 720px) {
    .profile-layout { flex-direction: column; }
    .profile-side { width: 100%; }
    .profile-posts .post-title-cell,
    .profile-posts .post-title-cell a { max-width: 160px; }
}

/* ===== 发布状态徽章（个人中心） ===== */
.status-badge {
    display: inline-block;
    padding: 2px 10px;
    border-radius: 12px;
    font-size: 12px;
    text-decoration: none;
}

.status-published {
    background: #e8f5e9;
    color: #2e7d32;
}

.status-draft {
    background: #fff3e0;
    color: #e67e22;
}

.status-draft:hover { background: #ffe0b2; }

/* ===== 写文章/编辑：发布按钮组（保存草稿 + 发布） ===== */
.publish-actions {
    display: flex;
    gap: 10px;
    margin-top: 4px;
}

.publish-actions button { margin-top: 0; }

.btn-draft {
    background: #fff;
    color: var(--text-muted);
    border: 1px solid #d0d0d0;
}

.btn-draft:hover:not(:disabled) {
    background: #f5f5f5;
    color: var(--text);
    border-color: #bbb;
}
