:root {
  /* 亮色 */
  --bg: #ffffff;
  --fg: #111111;
  --card: #f5f5f5;
  --border: #e0e0e0;
  --accent: #0ea5e9;
  --tag-bg: rgba(14, 165, 233, 0.15);
}

[data-theme="dark"] {
  /* 暗色 */
  --bg: #0f0f0f;
  --fg: #e5e5e5;
  --card: #1a1a1a;
  --border: #333333;
  --accent: #0ea5e9;
  --tag-bg: rgba(14, 165, 233, 0.25);
}

/* 平滑过渡 */
body {
  background: var(--bg);
  color: var(--fg);
  transition: background 0.3s, color 0.3s;
}

/* 评论预览滚动条 */
#commentPreview {
  flex: 1;
  min-height: 120px;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0.75rem;
  font-size: 1rem;
  resize: vertical;
  overflow: auto;
  background: var(--card);
}
/* 主题切换按钮 */
.theme-btn {
  background: var(--accent);
  color: #fff;
  border: none;
  padding: 0.4rem 0.8rem;
  border-radius: 18px;
  cursor: pointer;
  font-size: 0.9rem;
  transition: background 0.2s;
  user-select: none;
}

.theme-btn:hover {
  background: #0284c7;
}

/* 按钮文字 */
#themeText {
  pointer-events: none;
}
/* 让按钮排在登录按钮 / 用户名右侧 */
.user-area {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

#themeToggle {
  background: var(--accent);
  color: #fff;
  border: none;
  padding: 0.3rem 0.6rem;
  border-radius: 18px;
  cursor: pointer;
  font-size: 0.85rem;
  white-space: nowrap;
  user-select: none;
  /* 删除所有 position / top / right / z-index 即可 */
}
/* 深色模式兼容性 */
[data-theme="dark"] .topbar {
  background: var(--card);
  box-shadow: 0 1px 2px rgba(0,0,0,.5);
}

[data-theme="dark"] .card {
  background: var(--card);
  border-color: var(--border);
}

[data-theme="dark"] .comment-card,
[data-theme="dark"] .comment-box,
[data-theme="dark"] .markdown-body {
  background: var(--card);
  border-color: var(--border);
  color: var(--fg);
}

[data-theme="dark"] .back-btn {
  background: var(--accent);
  color: #fff;
}

[data-theme="dark"] .back-btn:hover {
  background: #0284c7;
}

[data-theme="dark"] #commentText,
[data-theme="dark"] #commentPreview,
[data-theme="dark"] .editor-toolbar .tool,
[data-theme="dark"] .secondary-btn {
  background: var(--card);
  color: var(--fg);
  border-color: var(--border);
}
