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

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "PingFang SC", "Microsoft YaHei", sans-serif;
    background-color: #f0f0f0;
    background-image: linear-gradient(rgba(0,0,0,.03) 1px, transparent 1px), linear-gradient(90deg, rgba(0,0,0,.03) 1px, transparent 1px);
    background-size: 20px 20px;
    min-height: 100vh; padding: 40px 20px; display: flex; justify-content: center;
}

.comment-section { width: 100%; max-width: 960px; background: #fff; border-radius: 12px; padding: 40px 50px 30px; box-shadow: 0 1px 6px rgba(0,0,0,.06); }

.comment-title {
    text-align: center; margin-bottom: 20px; font-size: 22px; font-weight: 600; color: #333;
    display: flex; align-items: center; justify-content: center; gap: 8px;
}
.comment-title::before, .comment-title::after {
    content: ''; flex: 1; max-width: 120px; height: 1px; background: linear-gradient(to right, transparent, #ccc, transparent);
}
.title-icon { width: 28px; height: 28px; }

.sort-bar { display: flex; gap: 6px; margin-bottom: 20px; }
.sort-btn { padding: 5px 14px; border: 1px solid #e0e0e0; background: #fff; border-radius: 4px; cursor: pointer; font-size: 13px; color: #666; transition: all .15s; }
.sort-btn:hover, .sort-btn.active { border-color: #4ecda0; color: #4ecda0; background: #f0faf5; }

.editor-wrapper { border: 1px solid #e0e0e0; border-radius: 8px; overflow: hidden; margin-bottom: 15px; }
.editor-content {
    min-height: 100px; padding: 15px 18px; font-size: 15px; line-height: 1.7;
    color: #333; outline: none; background: #fafafa; word-break: break-word;
}
.editor-content:empty::before { content: attr(data-placeholder); color: #bbb; pointer-events: none; }
.editor-content:focus { background: #fff; }
.editor-content blockquote { margin: 8px 0; padding: 8px 14px; border-left: 3px solid #ddd; color: #999; background: #f5f5f5; border-radius: 0 4px 4px 0; }
.editor-content code { background: #f0f0f0; padding: 2px 5px; border-radius: 3px; font-family: Consolas, Monaco, "Courier New", monospace; font-size: 13px; }
.editor-content pre { background: #2d2d2d; color: #ccc; padding: 12px 16px; border-radius: 6px; overflow-x: auto; margin: 8px 0; font-size: 13px; line-height: 1.5; }
.editor-content pre code { background: none; padding: 0; color: inherit; }

.editor-toolbar { display: flex; align-items: center; gap: 2px; padding: 8px 12px; border-top: 1px solid #eee; background: #fafafa; flex-wrap: wrap; }
.toolbar-btn {
    width: 32px; height: 32px; display: inline-flex; align-items: center; justify-content: center;
    border: none; background: transparent; cursor: pointer; border-radius: 4px; font-size: 15px; color: #555; transition: background .15s; font-family: inherit;
}
.toolbar-btn:hover { background: #e8e8e8; }
.toolbar-btn.bold { font-weight: 700; }
.toolbar-btn.italic { font-style: italic; }
.toolbar-btn.underline { text-decoration: underline; }
.toolbar-btn.strikethrough { text-decoration: line-through; }
.toolbar-btn.code-btn { font-family: Consolas, Monaco, "Courier New", monospace; font-size: 14px; letter-spacing: -1px; }
.toolbar-btn.source-btn { font-family: Consolas, Monaco, "Courier New", monospace; font-size: 13px; }
.toolbar-btn.quote-btn { font-size: 15px; font-weight: 600; }
.toolbar-divider { width: 1px; height: 20px; background: #ddd; margin: 0 4px; }

.form-row { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; flex-wrap: wrap; }
.form-input {
    flex: 1; min-width: 150px; height: 42px; padding: 0 14px; border: 1px solid #e0e0e0; border-radius: 6px;
    font-size: 14px; color: #333; background: #fff; outline: none; transition: border-color .2s;
}
.form-input::placeholder { color: #bbb; }
.form-input:focus { border-color: #999; }
.login-hint { font-size: 13px; color: #999; white-space: nowrap; }

.submit-row { display: flex; justify-content: flex-end; margin-bottom: 20px; }
.submit-btn {
    display: inline-flex; align-items: center; gap: 6px; padding: 10px 24px; background: #4ecda0;
    color: #fff; border: none; border-radius: 6px; font-size: 15px; font-weight: 500; cursor: pointer; transition: background .2s; letter-spacing: .5px;
}
.submit-btn:hover { background: #3dc493; }
.submit-btn svg { width: 16px; height: 16px; }

.comment-count { font-size: 14px; color: #666; padding: 10px 0; border-top: 1px solid #f0f0f0; }

.comments-list { margin-top: 10px; }

.comment-item { display: flex; gap: 14px; padding: 20px 0; border-bottom: 1px solid #f0f0f0; position: relative; }
.comment-item:last-child { border-bottom: none; }
.comment-item.pinned { background: #fffde7; margin: 0 -20px; padding: 20px; border-radius: 8px; border-bottom: 1px solid #f5f0d0; }

.comment-avatar {
    width: 42px; height: 42px; border-radius: 50%; flex-shrink: 0;
    display: flex; align-items: center; justify-content: center; font-size: 16px; font-weight: 600; color: #fff;
}
.comment-body { flex: 1; min-width: 0; }
.comment-meta { display: flex; align-items: center; gap: 10px; margin-bottom: 6px; flex-wrap: wrap; }
.comment-nickname { font-size: 15px; font-weight: 600; color: #333; }
.comment-website { font-size: 13px; color: #999; text-decoration: none; }
.comment-website:hover { color: #4ecda0; }
.comment-time { font-size: 12px; color: #bbb; }
.comment-pinned-badge { font-size: 11px; color: #f1c40f; font-weight: 600; }
.comment-text { font-size: 14px; line-height: 1.7; color: #555; word-break: break-word; }
.comment-text blockquote { margin: 8px 0; padding: 8px 14px; border-left: 3px solid #ddd; color: #999; background: #f9f9f9; border-radius: 0 4px 4px 0; }
.comment-text code { background: #f0f0f0; padding: 2px 5px; border-radius: 3px; font-family: Consolas, Monaco, "Courier New", monospace; font-size: 13px; }
.comment-text pre { background: #2d2d2d; color: #ccc; padding: 12px 16px; border-radius: 6px; overflow-x: auto; margin: 8px 0; font-size: 13px; line-height: 1.5; }
.comment-text pre code { background: none; padding: 0; color: inherit; }
.comment-text .mention { color: #4ecda0; font-weight: 600; text-decoration: none; cursor: pointer; }
.comment-text .mention:hover { text-decoration: underline; }

.comment-actions { display: flex; align-items: center; gap: 12px; margin-top: 8px; }
.vote-btn {
    display: inline-flex; align-items: center; gap: 4px; background: none; border: none; cursor: pointer;
    font-size: 13px; color: #999; padding: 2px 6px; border-radius: 4px; transition: all .15s;
}
.vote-btn:hover { background: #f0f0f0; }
.vote-btn.voted-up { color: #4ecda0; }
.vote-btn.voted-down { color: #e74c3c; }
.reply-btn {
    background: none; border: none; cursor: pointer; font-size: 13px; color: #999;
    padding: 2px 6px; border-radius: 4px; transition: all .15s;
}
.reply-btn:hover { background: #f0f0f0; color: #4ecda0; }

.reply-box { margin-top: 12px; padding: 12px; background: #f9f9f9; border-radius: 8px; }
.reply-box .editor-wrapper { margin-bottom: 8px; }
.reply-box .editor-content { min-height: 60px; font-size: 14px; }
.reply-box .form-row { margin-bottom: 8px; }
.reply-box .form-input { height: 36px; font-size: 13px; min-width: 120px; }
.reply-box .submit-btn { padding: 7px 16px; font-size: 13px; }
.reply-box .cancel-btn { padding: 7px 16px; font-size: 13px; background: #f0f0f0; color: #666; border: none; border-radius: 6px; cursor: pointer; margin-right: 8px; }
.reply-box .cancel-btn:hover { background: #e0e0e0; }

.replies-list { margin-left: 0; padding-left: 20px; border-left: 2px solid #f0f0f0; }
.replies-list .comment-item { padding: 14px 0; }
.replies-list .comment-avatar { width: 34px; height: 34px; font-size: 13px; }

.comment-delete {
    position: absolute; top: 20px; right: 0; background: none; border: none; color: #ccc;
    cursor: pointer; font-size: 13px; opacity: 0; transition: opacity .2s; padding: 4px 8px; border-radius: 4px;
}
.comment-item:hover > .comment-delete { opacity: 1; }
.comment-delete:hover { color: #e74c3c; background: #fef0f0; }

.pagination { display: flex; justify-content: center; gap: 6px; margin-top: 20px; flex-wrap: wrap; }
.pagination button {
    padding: 6px 14px; border: 1px solid #e0e0e0; background: #fff; border-radius: 4px;
    font-size: 13px; color: #666; cursor: pointer; transition: all .15s;
}
.pagination button:hover { border-color: #4ecda0; color: #4ecda0; }
.pagination button.active { background: #4ecda0; border-color: #4ecda0; color: #fff; }
.pagination button:disabled { opacity: .4; cursor: not-allowed; }

.no-comments { text-align: center; padding: 30px 0; color: #ccc; font-size: 14px; }

.emoji-picker { position: fixed; background: #fff; border: 1px solid #e0e0e0; border-radius: 8px; box-shadow: 0 4px 16px rgba(0,0,0,.12); padding: 10px; z-index: 9999; width: 320px; }
.emoji-grid { display: grid; grid-template-columns: repeat(8, 1fr); gap: 4px; }
.emoji-item { width: 34px; height: 34px; display: flex; align-items: center; justify-content: center; cursor: pointer; border-radius: 4px; font-size: 20px; transition: background .15s; }
.emoji-item:hover { background: #f0f0f0; }

.mention-picker {
    position: fixed; background: #fff; border: 1px solid #e0e0e0; border-radius: 8px;
    box-shadow: 0 4px 16px rgba(0,0,0,.12); z-index: 9999; width: 200px; max-height: 200px; overflow-y: auto;
}
.mention-item { padding: 8px 14px; cursor: pointer; font-size: 14px; color: #333; transition: background .15s; }
.mention-item:hover, .mention-item.active { background: #f0faf5; color: #4ecda0; }
.mention-empty { padding: 12px; text-align: center; color: #ccc; font-size: 13px; }

.toast {
    position: fixed; top: 30px; left: 50%; transform: translateX(-50%); padding: 10px 24px;
    background: #333; color: #fff; border-radius: 6px; font-size: 14px; z-index: 99999;
    opacity: 0; transition: opacity .3s; pointer-events: none;
}
.toast.show { opacity: 1; }
.toast.error { background: #e74c3c; }
.toast.success { background: #4ecda0; }

@media (max-width: 640px) {
    body { padding: 15px 10px; }
    .comment-section { padding: 25px 20px 20px; }
    .form-row { flex-direction: column; }
    .form-input { min-width: 100%; }
    .login-hint { margin-left: 0; }
    .replies-list { padding-left: 12px; }
}
