* { margin: 0; padding: 0; box-sizing: border-box; }
body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    background-color: #f5f7fa;
    color: #333;
    line-height: 1.6;
    padding-top: 120px;
    transition: background-color 0.3s, color 0.3s;
}
body.dark-mode {
    background-color: #1a1a1a;
    color: #e0e0e0;
}
body.dark-mode .fixed-header,
body.dark-mode .author-box,
body.dark-mode .toc-box,
body.dark-mode .article-card,
body.dark-mode .article-detail,
body.dark-mode .right-sidebar,
body.dark-mode .footer,
body.dark-mode .modal-box,
body.dark-mode .editor-toc {
    background-color: #2d2d2d;
    color: #e0e0e0;
}
body.dark-mode .category-bar {
    background-color: #252525;
    border-color: #3d3d3d;
}
body.dark-mode .category-item {
    background-color: #3d3d3d;
    color: #e0e0e0;
    border-color: #4d4d4d;
}
body.dark-mode .category-item.active {
    background-color: #2d8cf0;
    color: #fff;
}
body.dark-mode .search-input,
body.dark-mode input,
body.dark-mode select,
body.dark-mode textarea {
    background-color: #3d3d3d;
    color: #e0e0e0;
    border-color: #4d4d4d;
}
body.dark-mode .article-content pre,
body.dark-mode .article-content code {
    background-color: #3d3d3d;
}
body.dark-mode .edit-toc-item a,
body.dark-mode .toc-item a {
    color: #aaa;
}
body.dark-mode .author-name {
    color: #e0e0e0;
}
body.dark-mode .author-desc {
    color: #aaa;
}
body.dark-mode .author-contact {
    border-color: #4d4d4d;
    color: #888;
}
body.dark-mode .article-excerpt {
    color: #aaa;
}
body.dark-mode .tag {
    background: #3d5a80;
    color: #a0c4ff;
}
body.dark-mode .article-actions {
    border-color: #4d4d4d;
}
body.dark-mode .article-detail h1,
body.dark-mode .article-detail h2,
body.dark-mode .article-detail h3 {
    color: #e0e0e0;
}
body.dark-mode .article-detail .article-meta {
    border-color: #4d4d4d;
}
.fixed-header {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    background: #fff;
    box-shadow: 0 2px 10px rgba(0,0,0,0.08);
    z-index: 999;
    transition: background-color 0.3s;
}
.header { padding: 15px 0; }
.container {
    width: 92%;
    max-width: 1400px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.logo {
    font-size: 24px;
    font-weight: bold;
    color: #2d8cf0;
    text-decoration: none;
    cursor: pointer;
}
.search-box { display: flex; width: 350px; }
.search-input {
    flex: 1;
    padding: 10px 14px;
    border: 1px solid #e5e6eb;
    border-radius: 4px 0 0 4px;
    outline: none;
    font-size: 14px;
}
.search-btn {
    padding: 10px 16px;
    background: #2d8cf0;
    color: #fff;
    border: none;
    border-radius: 0 4px 4px 0;
    cursor: pointer;
}
.category-bar {
    background: #fafbfc;
    padding: 12px 0;
    border-top: 1px solid #f0f0f0;
    transition: background-color 0.3s;
}
.category-list {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}
.category-item {
    padding: 6px 14px;
    background: #fff;
    color: #555;
    border: 1px solid #e5e6eb;
    border-radius: 20px;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s;
}
.category-item:hover {
    border-color: #2d8cf0;
    color: #2d8cf0;
}
.category-item.active {
    background: #2d8cf0;
    color: #fff;
    border-color: #2d8cf0;
}
.header-buttons { display: flex; gap: 10px; }
.write-btn {
    padding: 8px 16px;
    background: #19be6b;
    color: #fff;
    border-radius: 4px;
    cursor: pointer;
    border: none;
}
.back-btn {
    padding: 8px 16px;
    background: #ff9f00;
    color: #fff;
    border-radius: 4px;
    cursor: pointer;
    border: none;
    display: none;
}
.theme-btn {
    padding: 8px 12px;
    background: #666;
    color: #fff;
    border-radius: 4px;
    cursor: pointer;
    border: none;
}
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}
.modal-box {
    background: #fff;
    padding: 30px;
    border-radius: 8px;
    width: 450px;
    transition: background-color 0.3s;
}
.modal-box input,
.modal-box select,
.modal-box textarea {
    width: 100%;
    padding: 10px;
    margin: 10px 0;
    border: 1px solid #eee;
    border-radius: 4px;
    font-size: 14px;
}
.modal-box button {
    width: 100%;
    padding: 10px;
    background: #2d8cf0;
    color: #fff;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    margin-top: 10px;
}
.main {
    display: flex;
    gap: 20px;
    align-items: flex-start;
    width: 100%;
}
.left-sidebar {
    width: 260px;
    flex-shrink: 0;
}
.author-box {
    background: #fff;
    border-radius: 8px;
    padding: 25px;
    text-align: center;
    position: sticky;
    top: 140px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.04);
    transition: background-color 0.3s;
}
.author-avatar {
    width: 100px;
    height: 100px;
    border-radius: 50%;
    margin: 0 auto 15px;
    display: block;
    object-fit: cover;
    border: 3px solid #f0f0f0;
}
.author-name {
    font-size: 18px;
    font-weight: bold;
    margin-bottom: 8px;
    color: #333;
}
.author-desc {
    font-size: 14px;
    color: #666;
    margin-bottom: 15px;
    line-height: 1.6;
}
.author-contact {
    font-size: 13px;
    color: #999;
    margin-top: 10px;
    padding-top: 15px;
    border-top: 1px solid #f0f0f0;
}
.author-contact a {
    color: #2d8cf0;
    text-decoration: none;
}
.toc-box {
    background: #fff;
    border-radius: 8px;
    padding: 20px;
    position: sticky;
    top: 140px;
    display: none;
    box-shadow: 0 2px 10px rgba(0,0,0,0.04);
    transition: background-color 0.3s;
}
.toc-title {
    font-size: 16px;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 1px solid #f0f0f0;
}
.toc-list { list-style: none; }
.toc-item { margin-bottom: 8px; }
.toc-item a {
    color: #666;
    text-decoration: none;
    font-size: 13px;
    display: block;
    padding: 4px 0;
    border-left: 2px solid transparent;
    padding-left: 10px;
}
.toc-item a:hover {
    color: #2d8cf0;
    border-left-color: #2d8cf0;
}
.toc-item.level-3 { padding-left: 15px; }
.content {
    flex: 1;
    min-width: 0;
}
.article-card {
    background: #fff;
    border-radius: 8px;
    padding: 25px;
    margin-bottom: 20px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.04);
    cursor: pointer;
    transition: transform 0.2s, background-color 0.3s;
    position: relative;
}
.article-card:hover { transform: translateY(-3px); }
.article-top-badge {
    position: absolute;
    top: 10px;
    right: 10px;
    background: #ed4014;
    color: #fff;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 12px;
}
.article-title {
    font-size: 20px;
    color: #2d8cf0;
    margin-bottom: 10px;
    text-decoration: none;
    padding-right: 50px;
}
.article-meta {
    font-size: 13px;
    color: #999;
    margin-bottom: 12px;
}
.article-excerpt {
    color: #666;
    font-size: 15px;
    margin-bottom: 10px;
}
.article-tags {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-bottom: 10px;
}
.tag {
    padding: 3px 8px;
    background: #f0f5ff;
    color: #2d8cf0;
    border-radius: 4px;
    font-size: 12px;
}
.article-actions {
    display: flex;
    gap: 10px;
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px solid #f0f0f0;
}
.action-btn {
    padding: 4px 12px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
}
.edit-btn { background: #2d8cf0; color: #fff; }
.delete-btn { background: #ed4014; color: #fff; }
.top-btn { background: #ff9f00; color: #fff; }
.article-detail {
    background: #fff;
    border-radius: 8px;
    padding: 30px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.04);
    transition: background-color 0.3s;
}
.article-detail h1 {
    font-size: 28px;
    margin-bottom: 15px;
    color: #333;
}
.article-detail .article-meta {
    margin-bottom: 25px;
    padding-bottom: 15px;
    border-bottom: 1px solid #eee;
}
.article-detail .article-content {
    font-size: 16px;
    line-height: 1.8;
}
.article-detail .article-content h2 {
    font-size: 22px;
    margin: 30px 0 15px;
    color: #333;
}
.article-detail .article-content h3 {
    font-size: 18px;
    margin: 25px 0 12px;
    color: #444;
}
.article-detail .article-content img {
    max-width: 100%;
    border-radius: 6px;
    margin: 15px 0;
}
.article-detail .article-content pre {
    background: #f5f7fa;
    padding: 15px;
    border-radius: 6px;
    overflow-x: auto;
    margin: 15px 0;
    position: relative;
}
.article-detail .article-content code {
    background: #f0f0f0;
    padding: 2px 6px;
    border-radius: 3px;
    font-family: "Consolas", "Monaco", monospace;
}
.copy-btn {
    position: absolute;
    top: 10px;
    right: 10px;
    padding: 4px 8px;
    background: #2d8cf0;
    color: #fff;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
}
.right-sidebar {
    width: 300px;
    flex-shrink: 0;
    background: #fff;
    border-radius: 8px;
    padding: 20px;
    position: sticky;
    top: 140px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.04);
    transition: background-color 0.3s;
}
.ad-box { width: 100%; }
.ad-box img {
    width: 100%;
    border-radius: 6px;
    display: block;
}
.back-top {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 50px;
    height: 50px;
    background: #2d8cf0;
    color: #fff;
    border-radius: 50%;
    display: none;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    z-index: 998;
    font-size: 24px;
    line-height: 1;
}
.footer {
    text-align: center;
    padding: 30px;
    color: #999;
    background: #fff;
    margin-top: 40px;
    font-size: 14px;
    transition: background-color 0.3s;
}
.footer a {
    color: #999;
    text-decoration: none;
    margin: 0 10px;
}
.footer a:hover { color: #2d8cf0; }
.empty-tip {
    text-align: center;
    padding: 50px;
    color: #999;
    font-size: 16px;
}
.highlight {
    background: #fff3cd;
    padding: 2px 4px;
    border-radius: 3px;
}
body.dark-mode .highlight {
    background: #856404;
    color: #fff;
}
.paste-toast {
    position: fixed;
    top: 150px;
    left: 50%;
    transform: translateX(-50%);
    background: #19be6b;
    color: #fff;
    padding: 10px 20px;
    border-radius: 4px;
    z-index: 1001;
    display: none;
}
.paste-toast.error {
    background: #ed4014;
}
.share-btn {
    padding: 4px 12px;
    background: #2d8cf0;
    color: #fff;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
    margin-left: 10px;
}

/* 两栏编辑器布局 */
.editor-two-col {
    display: flex;
    height: calc(100vh - 230px);
    gap: 20px;
    margin-top: 20px;
}
.editor-toc {
    width: 260px;
    background: #fff;
    border-radius: 8px;
    padding: 20px;
    overflow-y: auto;
    box-shadow: 0 2px 8px rgba(0,0,0,0.04);
}
.editor-toc h3 {
    margin-bottom: 15px;
    padding-bottom: 8px;
    border-bottom: 1px solid #eee;
}
.edit-toc-list {
    list-style: none;
}
.edit-toc-item {
    margin-bottom: 8px;
}
.edit-toc-item a {
    color: #666;
    text-decoration: none;
    font-size: 13px;
    display: block;
    padding: 4px 8px;
    border-left: 2px solid transparent;
    cursor: pointer;
}
.edit-toc-item a:hover {
    color: #2d8cf0;
    border-left-color: #2d8cf0;
}
.edit-toc-item.level-3 {
    padding-left: 20px;
}
.editor-middle {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
}
.CodeMirror {
    height: 100% !important;
    border-radius: 8px;
}
.editor-toolbar {
    border-radius: 8px 8px 0 0;
}
