:root { 
    --primary: #6366f1; 
    --primary-hover: #4f46e5;
    --primary-light: #eef2ff;
    --bg: #f8fafc; 
    --card-bg: #ffffff; 
    --text: #0f172a; 
    --text-secondary: #475569;
    --text-muted: #94a3b8;
    --border: #f1f5f9;
    --border-hover: #e2e8f0;
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.05);
    --shadow-lg: 0 12px 24px -4px rgba(0, 0, 0, 0.08);
    --radius: 14px;
}

*, *::before, *::after { box-sizing: border-box; }

html, body {
    max-width: 100%;
    overflow-x: hidden;
}

body { 
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "PingFang SC", "Microsoft YaHei", sans-serif; 
    background-color: var(--bg); 
    color: var(--text); 
    margin: 0; 
    padding: 0; 
    line-height: 1.7; 
    -webkit-tap-highlight-color: transparent;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

header { 
    background: rgba(255, 255, 255, 0.95); 
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-bottom: 1px solid rgba(226, 232, 240, 0.8);
    padding: 14px 0; 
    position: sticky; 
    top: 0; 
    z-index: 100; 
    width: 100%;
}
.header-content { 
    max-width: 1140px; 
    margin: 0 auto; 
    padding: 0 20px; 
    display: flex; 
    justify-content: space-between; 
    align-items: center; 
    position: relative;
}

.brand-logo { display: flex; align-items: center; gap: 10px; text-decoration: none; min-height: 44px; }
.site-title { font-size: 1.3rem; font-weight: 700; color: var(--text); }

.menu-toggle { 
    display: none; 
    background: none; 
    border: none; 
    font-size: 1.5rem; 
    cursor: pointer; 
    padding: 8px 12px;
    min-width: 44px;
    min-height: 44px;
    border-radius: 8px;
    align-items: center;
    justify-content: center;
    touch-action: manipulation;
}

.nav-links { display: flex; gap: 8px; align-items: center; list-style: none; margin: 0; padding: 0; }
.nav-links a { color: var(--text-secondary); text-decoration: none; font-size: 0.95rem; font-weight: 500; padding: 8px 16px; border-radius: 8px; min-height: 40px; display: inline-flex; align-items: center; }
.nav-links a:hover { color: var(--primary); background: var(--primary-light); }

.user-nav { display: flex; align-items: center; gap: 10px; border-left: 1px solid #e2e8f0; padding-left: 16px; margin-left: 8px; }

.layout-container { 
    max-width: 1140px; 
    margin: 25px auto 0 auto; 
    padding: 0 20px; 
    display: grid; 
    grid-template-columns: 1fr 300px; 
    gap: 25px; 
    width: 100%;
}

main { min-width: 0; }

.post-card { 
    background: var(--card-bg); 
    border-radius: var(--radius); 
    padding: 24px; 
    margin-bottom: 18px; 
    box-shadow: var(--shadow-sm); 
    border: 1px solid var(--border); 
    overflow: hidden;
}

.post-title { margin: 0 0 14px 0; font-size: 1.5rem; font-weight: 700; line-height: 1.4; word-break: break-word; }
.post-title a { color: var(--text); text-decoration: none; }

/* 文章详情排版与移动端防溢出适配 */
.post-detail-content { 
    font-size: 1.05rem; 
    line-height: 1.85; 
    color: #334155; 
    margin: 20px 0; 
    word-break: break-word; 
    overflow-wrap: break-word; 
    max-width: 100%;
}
.post-detail-content::after { content: ""; display: table; clear: both; }

.post-detail-content p { 
    margin-top: 0; 
    margin-bottom: 1.6em; 
    line-height: 1.85; 
    letter-spacing: 0.2px; 
    word-break: break-word;
}
.post-detail-content h1, 
.post-detail-content h2, 
.post-detail-content h3, 
.post-detail-content h4 { 
    margin-top: 1.8em; 
    margin-bottom: 0.8em; 
    line-height: 1.4; 
    color: var(--text); 
    font-weight: 700; 
    word-break: break-word;
}
.post-detail-content ul, 
.post-detail-content ol { 
    margin-top: 0; 
    margin-bottom: 1.6em; 
    padding-left: 1.5em; 
    line-height: 1.85; 
}
.post-detail-content li { 
    margin-bottom: 0.5em; 
    word-break: break-word;
}
.post-detail-content blockquote { 
    margin: 1.6em 0; 
    padding: 14px 20px; 
    background: var(--bg); 
    border-left: 4px solid var(--primary); 
    border-radius: 0 8px 8px 0; 
    color: var(--text-secondary); 
    overflow-x: auto;
}
.post-detail-content img { 
    max-width: 100% !important; 
    height: auto !important; 
    border-radius: 8px; 
    margin: 16px 0; 
    display: block; 
}
.post-detail-content pre, 
.post-detail-content table { 
    max-width: 100%; 
    overflow-x: auto; 
    display: block; 
    margin-bottom: 1.6em; 
}

/* 文章内部代码块及其复制按钮组件样式 */
.code-block-wrapper {
    position: relative;
    margin: 1.6em 0;
    border-radius: 8px;
    background: #1e293b;
    overflow: hidden;
}
.code-block-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #0f172a;
    padding: 6px 14px;
    font-size: 0.8rem;
    color: #94a3b8;
    border-bottom: 1px solid #334155;
}
.code-block-header .code-lang {
    font-weight: 600;
    text-transform: uppercase;
}
.code-copy-btn {
    background: #334155;
    color: #f8fafc;
    border: none;
    padding: 4px 10px;
    border-radius: 4px;
    font-size: 0.78rem;
    cursor: pointer;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}
.code-copy-btn:hover {
    background: var(--primary);
    color: #ffffff;
}
.code-copy-btn.copied {
    background: #10b981;
    color: #ffffff;
}
.code-block-wrapper pre {
    margin: 0 !important;
    padding: 14px 16px;
    background: transparent !important;
    color: #f8fafc;
    font-family: Consolas, Monaco, "Andale Mono", "Ubuntu Mono", monospace;
    font-size: 0.9rem;
    line-height: 1.5;
    overflow-x: auto;
}
.code-block-wrapper pre code {
    background: transparent !important;
    padding: 0 !important;
    color: inherit;
    font-family: inherit;
}

.article-right-ad {
    float: right; margin: 10px 0 15px 20px; max-width: 260px; width: 100%;
    background: #ffffff; border: 1px solid var(--border-hover); border-radius: 10px;
    padding: 10px; box-shadow: 0 2px 8px rgba(0,0,0,0.06); text-align: center; position: relative;
}
.article-right-ad .ad-tag { position: absolute; top: 4px; right: 6px; font-size: 0.65rem; color: var(--text-muted); background: rgba(241, 245, 249, 0.9); padding: 1px 5px; border-radius: 4px; line-height: 1; border: 1px solid #e2e8f0; }
.article-right-ad img { max-width: 100%; height: auto; border-radius: 6px; display: block; margin: 0 auto; }
.article-right-ad .ad-text-box { padding: 16px 10px 8px 10px; font-size: 0.95rem; color: var(--primary); font-weight: 600; line-height: 1.4; word-break: break-all; }
.article-right-ad a { text-decoration: none; display: block; }

.badge { display: inline-flex; align-items: center; padding: 2px 8px; font-size: 0.75rem; border-radius: 6px; font-weight: 600; margin-right: 6px; }
.badge-top { background: #fef2f2; color: #ef4444; border: 1px solid #fee2e2; }
.badge-hot { background: #fff7ed; color: #f97316; border: 1px solid #ffedd5; }

.meta { font-size: 0.85rem; color: var(--text-muted); display: flex; gap: 18px; align-items: center; margin-bottom: 15px; flex-wrap: wrap; }

.sidebar { display: flex; flex-direction: column; gap: 20px; min-width: 0; }
.widget { background: var(--card-bg); border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow-sm); border: 1px solid var(--border); overflow: hidden; }
.widget-title { font-size: 1rem; font-weight: 700; margin: 0 0 15px 0; padding-bottom: 12px; border-bottom: 1px solid var(--border); }
.widget-list { list-style: none; padding: 0; margin: 0; }
.widget-list li { margin-bottom: 12px; display: flex; justify-content: space-between; align-items: center; font-size: 0.88rem; gap: 6px; }
.widget-list a { color: var(--text-secondary); text-decoration: none; flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-height: 36px; display: inline-flex; align-items: center; min-width: 0; }

footer { background: var(--card-bg); border-top: 1px solid var(--border); padding: 35px 20px; text-align: center; margin-top: 50px; width: 100%; }
.stats-bar { display: inline-flex; flex-wrap: wrap; justify-content: center; gap: 12px 28px; background: #f8fafc; padding: 10px 24px; border-radius: 30px; font-size: 0.85rem; border: 1px solid var(--border); max-width: 100%; }

/* 赞/不喜欢 操作区域修缮 */
.like-section { 
    text-align: center; 
    margin: 40px 0 20px 0; 
    display: flex; 
    justify-content: center; 
    align-items: center; 
    gap: 16px; 
    flex-wrap: nowrap; 
    width: 100%;
}
.btn-like {
    background: var(--primary-light); color: var(--primary); border: 1px solid var(--primary);
    padding: 10px 24px; border-radius: 30px; font-size: 0.95rem; font-weight: 600; cursor: pointer;
    transition: all 0.3s; display: inline-flex; align-items: center; justify-content: center; gap: 6px;
    min-height: 46px; touch-action: manipulation; white-space: nowrap;
    max-width: 180px; flex: 1;
}
.btn-like:hover, .btn-like:active { background: var(--primary); color: #fff; }
.btn-like:disabled { background: var(--border); color: var(--text-muted); border-color: var(--border); cursor: not-allowed; }

/* 不喜欢按钮样式 */
.btn-dislike {
    background: #f1f5f9; color: #64748b; border: 1px solid #cbd5e1;
    padding: 10px 24px; border-radius: 30px; font-size: 0.95rem; font-weight: 600; cursor: pointer;
    transition: all 0.3s; display: inline-flex; align-items: center; justify-content: center; gap: 6px;
    min-height: 46px; touch-action: manipulation; white-space: nowrap;
    max-width: 180px; flex: 1;
}
.btn-dislike:hover, .btn-dislike:active { background: #64748b; color: #fff; }
.btn-dislike:disabled { background: var(--border); color: var(--text-muted); border-color: var(--border); cursor: not-allowed; }

.read-more-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    font-size: 0.88rem;
    font-weight: 600;
    color: var(--primary);
    text-decoration: none;
    background: var(--primary-light);
    padding: 8px 16px;
    min-height: 38px;
    border-radius: 20px;
    transition: all 0.2s;
    touch-action: manipulation;
}
.read-more-link:hover, .read-more-link:active {
    background: var(--primary);
    color: #fff;
}

.comments-section { margin-top: 30px; padding-top: 20px; border-top: 1px solid var(--border); overflow: hidden; }
.comments-title { font-size: 1.2rem; font-weight: 700; margin-bottom: 20px; }
.comment-item { display: flex; gap: 15px; padding: 18px 0; border-bottom: 1px dashed var(--border); }
.comment-item:last-child { border-bottom: none; }

.comment-avatar img { width: 45px; height: 45px; border-radius: 50%; object-fit: cover; border: 1px solid var(--border); background: #f1f5f9; flex-shrink: 0; }
.comment-content-wrap { flex: 1; min-width: 0; }

.comment-meta { font-size: 0.85rem; color: var(--text-muted); margin-bottom: 6px; }
.comment-user { font-weight: 600; color: var(--text); margin-right: 10px; font-size: 0.95rem; }
.comment-body { font-size: 0.95rem; color: var(--text-secondary); line-height: 1.65; word-break: break-word; }

.comment-form-box { background: var(--bg); padding: 20px; border-radius: 12px; margin-top: 30px; overflow: hidden; }
.form-group { margin-bottom: 15px; }
.form-control { width: 100%; padding: 12px; border: 1px solid var(--border-hover); border-radius: 8px; font-family: inherit; font-size: 0.95rem; transition: border-color 0.2s; min-height: 44px; }
.form-control:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-light); }
textarea.form-control { resize: vertical; min-height: 110px; }

.editor-toolbar { margin-bottom: 8px; }
.btn-emoji { 
    background: transparent; border: 1px solid var(--border-hover); border-radius: 8px; 
    cursor: pointer; font-size: 0.92rem; padding: 8px 14px; min-height: 40px; 
    color: var(--text-secondary); transition: all 0.2s; display: inline-flex; align-items: center; 
    touch-action: manipulation;
}
.btn-emoji:hover, .btn-emoji:active { background: var(--border); color: var(--text); }

.emoji-panel { 
    position: absolute; 
    top: 42px; 
    left: 0; 
    background: #fff; 
    border: 1px solid var(--border); 
    box-shadow: var(--shadow-lg); 
    padding: 10px; 
    border-radius: 10px; 
    z-index: 20; 
    display: grid; 
    grid-template-columns: repeat(auto-fill, minmax(36px, 1fr)); 
    gap: 6px; 
    width: 320px; 
    max-width: 100%; 
    max-height: 220px; 
    overflow-y: auto; 
    box-sizing: border-box;
}
.emoji-item { 
    cursor: pointer; 
    font-size: 1.25rem; 
    text-align: center; 
    padding: 6px; 
    border-radius: 6px; 
    transition: transform 0.1s; 
    min-height: 36px; 
    display: flex; 
    align-items: center; 
    justify-content: center; 
}
.emoji-item:hover, .emoji-item:active { background: var(--primary-light); transform: scale(1.1); }
.position-relative { position: relative; }

.btn-submit { 
    background: var(--primary); color: #fff; border: none; padding: 12px 28px; 
    min-height: 46px; border-radius: 8px; font-weight: 600; font-size: 1rem; 
    cursor: pointer; transition: background 0.3s; touch-action: manipulation; 
    width: auto;
}
.btn-submit:hover, .btn-submit:active { background: var(--primary-hover); }

.image-modal {
    display: none; position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0, 0, 0, 0.85); z-index: 1000; justify-content: center; align-items: center;
    opacity: 0; transition: opacity 0.3s; backdrop-filter: blur(5px);
}
.image-modal.active { display: flex; opacity: 1; }
.image-modal img { max-width: 90%; max-height: 90%; border-radius: 8px; box-shadow: 0 10px 25px rgba(0,0,0,0.5); object-fit: contain; }
.close-modal { position: absolute; top: 20px; right: 30px; color: #fff; font-size: 35px; cursor: pointer; font-weight: bold; }

@media (max-width: 868px) {
    .layout-container { grid-template-columns: 1fr; padding: 0 14px; margin-top: 15px; }
    .post-card { padding: 18px; border-radius: 12px; }
    .post-title { font-size: 1.25rem; }
    .menu-toggle { display: inline-flex; }
    .nav-links { 
        display: none; flex-direction: column; width: 100%; position: absolute; 
        top: 100%; left: 0; right: 0; background: var(--card-bg); 
        padding: 16px 20px; box-shadow: 0 12px 24px rgba(0,0,0,0.1); 
        z-index: 999; border-bottom: 1px solid var(--border);
    }
    .nav-links.active { display: flex; }
    .nav-links a { width: 100%; min-height: 44px; }
    .article-right-ad { float: none; clear: both; margin: 20px auto; max-width: 100%; width: 100%; }
    .btn-submit { width: 100%; }
    .comment-item { flex-direction: column; gap: 10px; }
    .comment-avatar img { width: 36px; height: 36px; }
    
    /* 移动端细调点赞区域 */
    .like-section {
        gap: 12px;
        margin: 25px 0 15px 0;
    }
    .btn-like, .btn-dislike {
        padding: 8px 12px;
        font-size: 0.9rem;
        min-height: 42px;
    }
}