.global-comment {
  background: #ffffff;
  border-radius: 20px;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.08);
  padding: 24px 20px 32px;
  transition: all 0.2s;
}

/* ===== 头部 ===== */
.comments-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-bottom: 18px;
  border-bottom: 1px solid #edf0f5;
  margin-bottom: 20px;
  flex-wrap: wrap;
  gap: 8px;
}
.comments-header h2 {
  font-size: 20px;
  font-weight: 700;
  color: #1e2a3a;
  letter-spacing: 0.3px;
  margin-block-start: 0;
  margin-block-end: 0;
}
.comments-header h2 span {
  font-weight: 400;
  font-size: 15px;
  color: #8895aa;
  margin-left: 8px;
}
.comments-header .comment-sort-btn {
  font-size: 14px;
  color: #5e6f8d;
  background: #f0f3f8;
  border: none;
  padding: 6px 16px;
  border-radius: 30px;
  cursor: pointer;
  transition: 0.2s;
}
.comments-header .comment-sort-btn:hover {
  background: #e4e9f2;
}

/* ===== 发表评论区域 ===== */
#commentInputArea {
  margin-bottom: 24px;
  border-radius: 16px;
  background: #ffffff;
  padding: 16px 16px 12px;
  border: 1px solid #edf0f5;
  transition: all 0.2s;
}

.comment-section-title {
  font-size: 18px;
  font-weight: 700;
  color: #1e2a3a;
}

/* ---- 未登录 ---- */
.login-prompt {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.login-row {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: #888;
  background: #f5f5f5;
  padding: 0px 12px 0 0;
  border-radius: 18px;
  cursor: pointer;
  transition: background 0.2s, color 0.2s;
}
.login-btn {
  flex-shrink: 0;
  padding: 3px 12px;
  background: #5b7cfa;
  color: #fff;
  border: none;
  border-radius: 20px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: 0.2s;
  letter-spacing: 0.3px;
}
.login-btn:hover {
  background: #4a6ae0;
  transform: scale(0.97);
}
.login-text {
  font-size: 14px;
  font-weight: 400;
  color: #888;
}

.input-preview {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: #f5f6fa;
  border-radius: 10px;
  padding: 12px 16px;
  border: 1px solid #e8ecf3;
}
.input-preview .placeholder {
  color: #b8c5d6;
  font-size: 15px;
  user-select: none;
}
.input-preview .counter {
  color: #b8c5d6;
  font-size: 13px;
  font-weight: 500;
  flex-shrink: 0;
  margin-left: 12px;
}

.footer-links {
  display: flex;
  justify-content: flex-end;
  padding-top: 4px;
}
.changyan-link {
  color: #5b7cfa;
  font-size: 14px;
  font-weight: 500;
  text-decoration: none;
  cursor: default;
}
.changyan-link:hover {
  text-decoration: underline;
}

/* ---- 已登录 ---- */
.comment-input-form {
  display: none;
}
.comment-input-form .new-comment-form {
  display: flex;
  gap: 12px;
  align-items: flex-start;
}
.comment-input-form .new-comment-form .avatar {
  flex-shrink: 0;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  font-weight: 600;
  color: #fff;
  background: #5b7cfa;
  user-select: none;
  text-transform: uppercase;
}
.comment-input-form .new-comment-form .input-wrap {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.comment-input-form .new-comment-form textarea {
  width: 100%;
  padding: 12px 16px;
  border: 1.5px solid #e4e9f2;
  border-radius: 14px;
  font-size: 15px;
  font-family: inherit;
  resize: vertical;
  min-height: 56px;
  max-height: 130px;
  transition: border 0.2s;
  background: #fafbfc;
  color: #1e2a3a;
  line-height: 1.5;
}
.comment-input-form .new-comment-form textarea:focus {
  outline: none;
  border-color: #5b7cfa;
  box-shadow: 0 0 0 3px rgba(91, 124, 250, 0.10);
}
.textarea-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}
.textarea-footer .counter {
  font-size: 13px;
  color: #b8c5d6;
  font-weight: 500;
}
.textarea-footer .counter.warning {
  color: #e85d75;
}
.textarea-footer .submit-new {
  padding: 8px 24px;
  background: #1e2a3a;
  color: #fff;
  border: none;
  border-radius: 30px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  letter-spacing: 0.3px;
}
.textarea-footer .submit-new:hover {
  background: #2d3a4e;
  transform: scale(0.97);
}
.textarea-footer .submit-new:active {
  transform: scale(0.94);
}
.comment-input-form .footer-links {
  margin-top: 6px;
  padding-top: 0;
}

/* ===== 评论列表 ===== */
.comment-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

/* ===== 加载状态 ===== */
.loading-state {
  text-align: center;
  padding: 40px 0;
  color: #b8c5d6;
  font-size: 15px;
}
.loading-state .spinner {
  display: inline-block;
  width: 32px;
  height: 32px;
  border: 3px solid #edf0f5;
  border-top-color: #5b7cfa;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin-bottom: 12px;
}
@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}
.error-state {
  text-align: center;
  padding: 40px 0;
  color: #e85d75;
  font-size: 15px;
}
.error-state .retry-btn {
  margin-top: 12px;
  padding: 6px 20px;
  background: #5b7cfa;
  color: #fff;
  border: none;
  border-radius: 20px;
  cursor: pointer;
  font-size: 14px;
}

/* ===== 单条评论 ===== */
.comment-item {
  padding: 14px 0 10px;
  border-bottom: 1px solid #f0f3f8;
  transition: background 0.15s;
}
.comment-item:last-child {
  border-bottom: none;
}

.comment-item.level-1 {
  padding-left: 0;
}
.comment-item.level-2 {
  padding-left: 44px;
}
.comment-item.level-3 {
  padding-left: 76px;
}
.comment-item.level-4 {
  padding-left: 108px;
}

.comment-item.has-parent {
  position: relative;
}
.comment-item.has-parent::before {
  content: '';
  position: absolute;
  left: 20px;
  top: 0;
  bottom: 0;
  width: 2px;
  background: #e8ecf3;
  border-radius: 2px;
}
.comment-item.level-2.has-parent::before {
  left: 20px;
}
.comment-item.level-3.has-parent::before {
  left: 52px;
}
.comment-item.level-4.has-parent::before {
  left: 84px;
}

/* ===== 评论头部 ===== */
.comment-meta {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 4px;
  flex-wrap: wrap;
}
.avatar {
  flex-shrink: 0;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  font-weight: 600;
  color: #fff;
  background: #7c8ba0;
  user-select: none;
  text-transform: uppercase;
}
.avatar.color-1 {
  background: #5b7cfa;
}
.avatar.color-2 {
  background: #f5a623;
}
.avatar.color-3 {
  background: #e85d75;
}
.avatar.color-4 {
  background: #2ec4b6;
}
.avatar.color-5 {
  background: #9b6bcc;
}
.avatar.color-6 {
  background: #ff7e67;
}
.avatar.color-7 {
  background: #4a9eff;
}
.avatar.color-8 {
  background: #ffb347;
}
.avatar.color-9 {
  background: #6c5b7b;
}
.avatar.color-10 {
  background: #3acf7a;
}
.avatar.color-11 {
  background: #f08a5d;
}
.avatar.color-12 {
  background: #b83b5e;
}
.avatar.color-13 {
  background: #2d6187;
}
.avatar.color-14 {
  background: #6a2c70;
}
.avatar.color-15 {
  background: #0f3460;
}

.comment-author {
  font-size: 15px;
  font-weight: 600;
  color: #1e2a3a;
}
.comment-tag {
  font-size: 11px;
  font-weight: 500;
  color: #fff;
  background: #b8c5d6;
  padding: 0 8px;
  border-radius: 20px;
  line-height: 18px;
  display: inline-block;
  flex-shrink: 0;
}
.comment-tag.tag-blue {
  background: #5b7cfa;
}
.comment-tag.tag-orange {
  background: #f5a623;
}
.comment-tag.tag-red {
  background: #e85d75;
}
.comment-tag.tag-green {
  background: #2ec4b6;
}
.comment-tag.tag-purple {
  background: #9b6bcc;
}
.comment-tag.tag-pink {
  background: #ff7e67;
}
.comment-tag.tag-cyan {
  background: #4a9eff;
}
.comment-tag.tag-gold {
  background: #ffb347;
}
.comment-tag.tag-gray {
  background: #b8c5d6;
}

.comment-time {
  font-size: 13px;
  color: #8895aa;
  margin-left: auto;
  flex-shrink: 0;
}

.comment-area-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}
/* ===== 评论内容 ===== */
.comment-body {
  font-size: 15px;
  line-height: 1.6;
  color: #1e2a3a;
  padding: 4px 0 6px 46px;
  word-break: break-word;
}
.comment-item.level-2 .comment-body,
.comment-item.level-3 .comment-body,
.comment-item.level-4 .comment-body {
  padding-left: 0;
}

/* ===== 操作栏 ===== */
.comment-actions {
  display: flex;
  align-items: center;
  gap: 18px;
  padding-left: 46px;
  margin-top: 2px;
  flex-wrap: wrap;
}
.comment-item.level-2 .comment-actions,
.comment-item.level-3 .comment-actions,
.comment-item.level-4 .comment-actions {
  padding-left: 0;
}

.action-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 13px;
  color: #8895aa;
  background: none;
  border: none;
  cursor: pointer;
  padding: 2px 6px;
  border-radius: 6px;
  transition: all 0.15s;
  font-weight: 500;
}
.action-btn:hover {
  color: #5b7cfa;
  background: #f0f4ff;
}
.action-btn.liked {
  color: #e85d75;
}
.action-btn.liked:hover {
  color: #c94a62;
  background: #fef0f3;
}
.action-btn .icon {
  font-size: 16px;
  line-height: 1;
}
.action-btn .count {
  font-size: 13px;
  min-width: 12px;
}

/* ===== 回复表单 ===== */
.reply-form {
  display: none;
  margin-top: 10px;
  padding-left: 46px;
  animation: slideDown 0.2s ease;
}
.comment-item.level-2 .reply-form,
.comment-item.level-3 .reply-form,
.comment-item.level-4 .reply-form {
  padding-left: 0;
}
.reply-form.open {
  display: block;
}
@keyframes slideDown {
  0% {
    opacity: 0;
    transform: translateY(-6px);
  }
  100% {
    opacity: 1;
    transform: translateY(0);
  }
}
.reply-form .form-row {
  display: flex;
  gap: 10px;
  align-items: flex-end;
  flex-wrap: wrap;
}
.reply-form textarea {
  flex: 1;
  padding: 10px 14px;
  border: 1.5px solid #e4e9f2;
  border-radius: 12px;
  font-size: 14px;
  font-family: inherit;
  resize: vertical;
  min-height: 52px;
  max-height: 120px;
  transition: border 0.2s;
  background: #fafbfc;
  color: #1e2a3a;
  line-height: 1.5;
}
.reply-form textarea:focus {
  outline: none;
  border-color: #5b7cfa;
  background: #ffffff;
  box-shadow: 0 0 0 3px rgba(91, 124, 250, 0.12);
}
.reply-form .submit-reply {
  flex-shrink: 0;
  padding: 10px 22px;
  background: #5b7cfa;
  color: #fff;
  border: none;
  border-radius: 12px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  white-space: nowrap;
}
.reply-form .submit-reply:hover {
  background: #4a6ae0;
  transform: scale(0.97);
}
.reply-form .cancel-reply {
  flex-shrink: 0;
  padding: 10px 16px;
  background: transparent;
  color: #8895aa;
  border: none;
  font-size: 14px;
  cursor: pointer;
  transition: 0.2s;
}
.reply-form .cancel-reply:hover {
  color: #1e2a3a;
}

/* ===== 折叠按钮 ===== */
.fold-toggle {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 14px;
  color: #5b7cfa;
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px 10px;
  border-radius: 20px;
  font-weight: 500;
  transition: 0.15s;
  margin-top: 4px;
}
.fold-toggle:hover {
  background: #f0f4ff;
}
.fold-toggle .arrow {
  display: inline-block;
  transition: transform 0.25s;
  font-size: 12px;
}
.fold-toggle .arrow.expanded {
  transform: rotate(180deg);
}

/* ===== 空状态 ===== */
.empty-state {
  text-align: center;
  padding: 40px 0;
  color: #b8c5d6;
  font-size: 15px;
}

/* ===== 自定义模态弹框 ===== */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.35);
  backdrop-filter: blur(2px);
  align-items: center;
  justify-content: center;
  z-index: 9999;
  animation: fadeIn 0.2s ease;
}
.modal-overlay.active {
  display: flex;
}
.modal-box {
  background: #ffffff;
  border-radius: 20px;
  padding: 32px 28px 24px;
  max-width: 380px;
  width: 90%;
  box-shadow: 0 12px 48px rgba(0, 0, 0, 0.2);
  text-align: center;
  animation: scaleIn 0.25s ease;
}
.modal-box .modal-icon {
  font-size: 40px;
  margin-bottom: 12px;
}
.modal-box .modal-message {
  font-size: 16px;
  color: #1e2a3a;
  line-height: 1.6;
  margin-bottom: 20px;
  word-break: break-word;
}
.modal-box .modal-btn {
  padding: 8px 36px;
  background: #5b7cfa;
  color: #fff;
  border: none;
  border-radius: 30px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: 0.2s;
}
.modal-box .modal-btn:hover {
  background: #4a6ae0;
  transform: scale(0.97);
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}
@keyframes scaleIn {
  from {
    transform: scale(0.9);
    opacity: 0;
  }
  to {
    transform: scale(1);
    opacity: 1;
  }
}

/* ===== 响应式 ===== */
@media (max-width: 600px) {
  .global-comment {
    padding: 16px 12px 24px;
    border-radius: 14px;
  }
  .comment-item.level-2 {
    padding-left: 20px;
  }
  .comment-item.level-3 {
    padding-left: 36px;
  }
  .comment-item.level-4 {
    padding-left: 52px;
  }
  .comment-item.has-parent::before {
    display: none;
  }
  .comment-body {
    padding-left: 0 !important;
  }
  .comment-actions {
    padding-left: 0 !important;
  }
  .reply-form {
    padding-left: 0 !important;
  }
  .comment-meta {
    gap: 4px 8px;
  }
  .comment-time {
    margin-left: 0;
    width: 100%;
  }
  .reply-form .form-row {
    flex-direction: column;
    align-items: stretch;
  }
  .reply-form .submit-reply {
    width: 100%;
  }
  .reply-form .cancel-reply {
    text-align: center;
  }
  .comment-input-form .new-comment-form {
    flex-direction: column;
  }
  .comment-input-form .new-comment-form .input-wrap {
    width: 100%;
  }
  .textarea-footer {
    flex-direction: column;
    align-items: stretch;
  }
  .textarea-footer .submit-new {
    width: 100%;
    align-self: stretch;
  }
  .comments-header {
    flex-wrap: wrap;
  }
  .login-row {
    flex-wrap: wrap;
  }
  .modal-box {
    padding: 24px 20px 20px;
  }
}

/* ===== 工具 ===== */
.hidden {
  display: none !important;
}
.text-muted {
  color: #8895aa;
}
.mt-2 {
  margin-top: 8px;
}