:root {
  color-scheme: light dark;
  --text-color: #333;
  --bg-color: #f9f9f9;
  --border-color: #ccc;
  --timestamp-color: #666;
  --shadow-color: rgba(0, 0, 0, 0.1);
  --button-text: #fff;
  --button-bg: rgba(211, 211, 211, 0.5);
  --button-hover-bg: #333333;
  --link-color: #000000;
  /* 链接颜色 */
  --link-hover-color: #0052a3;
  /* 链接悬停颜色 */
  /* 使用系统默认字体 */
  --font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
}

/* 设置全局字体 */
body {
  font-family: var(--font-family);
}

@media (prefers-color-scheme: dark) {
  :root {
    --text-color: #e0e0e0;
    --bg-color: #1a1a1a;
    --border-color: #404040;
    --timestamp-color: #999;
    --shadow-color: rgba(0, 0, 0, 0.3);
    --button-bg: #404040;
    --button-hover-bg: #505050;
    --link-color: #ffffff;
    /* 暗色模式链接颜色 */
    --link-hover-color: #99ccff;
    /* 暗色模式链接悬停颜色 */
  }

  @media (prefers-color-scheme: dark) {
    .comment-title {
      color: #ffffff !important;
      /* 强制覆盖 */
    }
  }

  body {
    background-color: #181818;
    color: var(--text-color);
  }

  input,
  textarea {
    background-color: #1a1a1a;
    /* 调整背景色以减少刺眼感 */
    color: var(--text-color);
    border-color: var(--border-color);
  }
}

/* 评论项样式 */
.comment-item {
  position: relative;
  margin: 0 auto;
  max-width: 1080px;
  border: 1px solid var(--border-color);
  border-radius: 20px;
  padding: 15px;
  margin-bottom: 15px;
  background-color: var(--bg-color);
  box-shadow: 0 4px 10px var(--shadow-color);
  color: var(--text-color);
  transition: background-color 0.3s, border-color 0.3s, box-shadow 0.3s;
  word-break: break-all;
}

body .comment-title {
  font-weight: bold;
  margin-bottom: 10px;
  color: var(--link-color);
  text-decoration: none;
  display: block;
  transition: color 0.3s;
}

body .comment-title:hover {
  color: var(--link-hover-color);
  /* 使用链接悬停颜色 */
  padding-bottom: 2px;
  /* 增加底部间距，避免视觉拥挤 */
}

.comment-content img {
  max-width: 100%;
  height: auto;
  display: block;
  margin: 10px 0;
  border-radius: 4px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.comment-content {
  word-break: break-all;
  margin-bottom: 10px;
  color: var(--text-color);
  text-decoration: none;
}

.comment-meta {
  display: flex;
  /* 使用 Flexbox 布局 */
  align-items: center;
  /* 垂直居中对齐 */
  gap: 10px;
  /* 设置作者信息和时间戳之间的间距 */
  font-size: 14px;
  color: #666;
  margin-top: 5px;
  /* 与上方内容保持间距 */
}

.user-link {
  color: var(--timestamp-color);
  /* 链接颜色 */
  font-weight: bold;
  text-decoration: none;
}

.user-link:hover {
  text-decoration: underline;
  /* 鼠标悬停时显示下划线 */
}

.comment-timestamp {
  position: absolute;
  /* 使用绝对定位 */
  bottom: 10px;
  /* 距离底部 10px */
  right: 15px;
  /* 距离右侧 15px */
  font-size: 12px;
  /* 调整字体大小 */
  color: var(--timestamp-color);
  white-space: nowrap;
  /* 防止换行 */
}

.write-post,
.back-link {
  position: fixed;
  /* 关键：使按钮相对于视口固定定位 */
  top: 10px;
  /* 距离页面顶部 20px */
  right: 10px;
  /* 距离页面右侧 20px */
  border: 0;
  border-radius: 20px;
  width: 120px;
  height: 40px;
  font-size: 20px;
  display: flex;
  justify-content: center;
  /* 水平居中 */
  align-items: center;
  /* 垂直居中 */
  box-shadow: 0 4px 10px var(--shadow-color);
  z-index: 1000;
  /* 确保按钮在其他内容之上 */
  background-color: rgba(255, 255, 255, 0.1);
  /* 半透明背景 */
  backdrop-filter: blur(3px);
  /* 毛玻璃模糊效果 */
  -webkit-backdrop-filter: blur(3px);
  /* 兼容 Safari */
}

/* 分页样式 */
#pagination {
  position: fixed;
  /* 使容器相对于视口固定定位 */
  left: 0;
  right: 0;
  margin-left: auto;
  margin-right: auto;
  /* 水平居中 */
  max-width: 600px;
  display: flex;
  justify-content: center;
  /* 元素水平居中 */
  align-items: center;
  /* 元素垂直居中 */
  border: 0;
  border-radius: 20px;
  bottom: 10px;
  padding: 20px;
  gap: 5px;
  z-index: 1000;
  /* 确保容器在其他内容之上 */
  box-shadow: 0 4px 10px var(--shadow-color);
  background-color: rgba(255, 255, 255, 0.1);
  /* 半透明背景 */
  backdrop-filter: blur(3px);
  /* 毛玻璃模糊效果 */
  -webkit-backdrop-filter: blur(3px);
  /* 兼容 Safari */
}

/* 翻页按钮样式 */
.prev-page-btn,
.next-page-btn {
  width: 45%;
  padding: 0.7em;
  color: var(--button-text);
  background-color: var(--button-bg);
  border: none;
  border-radius: 0.3em;
  font-size: 1em;
  transition: all 0.3s ease;
  text-align: center;
}

@media (max-width: 900px) {

  .prev-page-btn,
  .next-page-btn {
    width: 40%;
    /* 在小屏幕上缩小按钮宽度 */
    font-size: 0.9em;
    /* 调整字体大小 */
  }
}

@media (max-width: 480px) {

  .prev-page-btn,
  .next-page-btn {
    width: 90%;
    /* 在超小屏幕上让按钮占据更多空间 */
    font-size: 0.8em;
  }
}

.prev-page-btn:hover,
.next-page-btn:hover,
.write-post:hover,
.push-btn:hover,
.back-link:hover {
  background-color: var(--button-bg);
  transform: translateY(-1px);
  /* 减小位移，避免抖动 */
  box-shadow: 0 2px 8px var(--shadow-color);
}

.prev-page-btn:active,
.next-page-btn:active {
  transform: translateY(0);
  box-shadow: none;
}



.prev-page-btn.disabled,
.next-page-btn.disabled {
  opacity: 0.6;
  cursor: not-allowed;
  background-color: rgba(0, 0, 0, 0.1);
  /* 更明显的禁用背景色 */
}

/* 推送布局 */
.push {
  margin: 0 auto;
  max-width: 1080px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.push-btn {
  background-color: var(--button-bg);
  color: var(--button-text);
  border: 0;
  border-radius: 20px;
  width: 120px;
  height: 50px;
  font-size: 20px;
  display: flex;
  justify-content: center;
  /* 水平居中 */
  align-items: center;
  /* 垂直居中 */
  box-shadow: 0 4px 10px var(--shadow-color);
}

#name {
  height: 2rem;
  /* 使用相对单位 */
}

#comment {
  resize: both;
  min-height: 100px;
  width: 100%;
}

/* 表单样式 */
form {
  max-width: 80%;
  /* 根据屏幕宽度调整 */
  margin: auto;
  padding: 1em;
  border: 1px solid var(--border-color);
  border-radius: 20px;
  background-color: var(--bg-color);
}

.container {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 100vh;
  padding: 2rem 0;
}

div+div {
  margin-top: 1em;
}

label {
  display: block;
  margin-bottom: .5em;
  color: var(--text-color);
}

input {
  /*input: not(.CodeMirror-input),
  textarea: not(.CodeMirror-textarea): not(#comment) {
  width: 100%;
  padding: 0.5em;
  border: 1px solid var(--border-color);
  border-radius: 0.3em;
  background-color: var(--bg-color);
  color: var(--text-color);
  box-sizing: border-box;
}*/

  width: 100%;
  padding: 0.5em;
  border: 1px solid var(--border-color);
  border-radius: 0.3em;
  background-color: var(--bg-color);
  color: var(--text-color);
  box-sizing: border-box;
}

textarea {
  width: 100%;
  padding: 0.5em;
  border: 1px solid var(--border-color);
  border-radius: 0.3em;
  background-color: var(--bg-color);
  color: var(--text-color);
  box-sizing: border-box;
  font-family: inherit;
  /* 继承字体 */
  line-height: 1.5;
  /* 设置行高 */
}

/* 链接样式 */
a {
  color: var(--link-color);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

/* 响应式设计 */
@media (max-width: 768px) {
  .comment-item {
    border-radius: 15px;
    padding: 12px;
  }

  #pagination {
    max-width: 280px;
    padding: 15px;
  }

  .write-post,
  .back-link {
    width: 100px;
    height: 40px;
    font-size: 16px;
  }

  form {
    max-width: 95%;
    padding: 0.8em;
  }
}

/* 响应式设计 */
@media (max-width: 480px) {
  .comment-item {
    border-radius: 10px;
    padding: 10px;
  }

  #pagination {
    max-width: 250px;
    padding: 10px;
  }

  .write-post,
  .back-link {
    width: 90px;
    height: 35px;
    font-size: 14px;
    top: 5px;
    right: 5px;
  }

  form {
    max-width: 100%;
    padding: 0.5em;
  }
}

.CodeMirror {
  border: 1px solid #ccc;
  border-radius: 4px;
  font-family: monospace;
  font-size: 14px;
  height: auto;
  /* 允许编辑器自动调整高度 */
}

.CodeMirror-focused {
  border-color: #007bff;
  box-shadow: 0 0 0 0.2rem rgba(0, 123, 255, 0.25);
}

/* 编辑器全屏模式样式 */
.CodeMirror-fullscreen {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  height: auto;
  z-index: 9999;
  border-radius: 0;
}