/* 留言板 — 与友人帐同套视觉（紧凑页头 + 卡片 + 居中） */

body[data-type="comments"] #web_bg,
body:has(#comments-topics) #web_bg {
  background: var(--anzhiyu-background);
}

body[data-type="comments"] #content-inner.layout,
body:has(#comments-topics) #content-inner.layout {
  max-width: 1180px;
  padding: 0 clamp(1rem, 3vw, 1.5rem) 2.5rem;
}

body[data-type="comments"] #page-header,
body:has(#comments-topics) #page-header {
  margin-bottom: 0 !important;
}

body[data-type="comments"] #content-inner.layout > div:first-child,
body:has(#comments-topics) #content-inner.layout > div:first-child {
  width: 100%;
}

body[data-type="comments"] #page,
body:has(#comments-topics) #page {
  --cm-text: #111827;
  --cm-muted: #4b5563;
  --cm-border: #e5e7eb;
  --cm-surface: #ffffff;
  --cm-surface-soft: #f8fafc;
  --cm-accent: #2563eb;
  --cm-accent-soft: rgba(37, 99, 235, 0.08);
  --cm-radius: 12px;
}

[data-theme="dark"] body[data-type="comments"] #page,
[data-theme="dark"] body:has(#comments-topics) #page {
  --cm-text: #f3f4f6;
  --cm-muted: #9ca3af;
  --cm-border: rgba(255, 255, 255, 0.12);
  --cm-surface: rgba(28, 32, 42, 0.96);
  --cm-surface-soft: rgba(36, 41, 54, 0.92);
  --cm-accent: #60a5fa;
  --cm-accent-soft: rgba(96, 165, 250, 0.12);
}

body[data-type="comments"] #page,
body[data-type="comments"] main #page,
body:has(#comments-topics) #page {
  background: transparent !important;
  box-shadow: none !important;
  border: none !important;
  padding: 0 !important;
  color: var(--cm-text);
}

/* 页内标题 */
body[data-type="comments"] #page .page-title,
body:has(#comments-topics) #page .page-title {
  display: block !important;
  margin: 0.75rem 0 1.25rem;
  padding: 0;
  font-size: clamp(1.75rem, 3.5vw, 2.25rem);
  font-weight: 800;
  letter-spacing: 0.04em;
  color: var(--cm-text);
  line-height: 1.2;
  text-align: center;
}

body[data-type="comments"] #page .page-title::before,
body:has(#comments-topics) #page .page-title::before {
  content: "\eb16";
  font-family: anzhiyufont, "anzhiyufont" !important;
  display: block;
  width: 3.25rem;
  height: 3.25rem;
  margin: 0 auto 0.65rem;
  border-radius: 50%;
  font-size: 1.35rem;
  line-height: 3.25rem;
  color: var(--cm-accent);
  background: var(--cm-accent-soft);
  border: 1px solid rgba(37, 99, 235, 0.15);
  box-shadow: 0 8px 24px rgba(37, 99, 235, 0.12);
}

body[data-type="comments"] #page .page-title::after,
body:has(#comments-topics) #page .page-title::after {
  content: "技术讨论、小说反馈、项目合作——都欢迎在这里留言";
  display: block;
  margin-top: 0.45rem;
  font-size: 0.92rem;
  font-weight: 500;
  letter-spacing: 0;
  color: var(--cm-muted);
  line-height: 1.6;
  text-align: center;
  max-width: 36rem;
  margin-left: auto;
  margin-right: auto;
}

body[data-type="comments"] #page > hr,
body:has(#comments-topics) #page > hr {
  display: none;
}

body[data-type="comments"] #article-container,
body:has(#comments-topics) #article-container {
  margin: 0;
  padding: 0;
}

/* 话题标签（类似友链彩色图标条） */
body[data-type="comments"] .comments-topics,
body:has(#comments-topics) .comments-topics {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: 0.75rem 1rem;
  max-width: 42rem;
  margin: 0 auto 1.25rem;
  padding: 0 0.25rem;
}

body[data-type="comments"] .comments-topic,
body:has(#comments-topics) .comments-topic {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 5.5rem;
  padding: 0.45rem 0.95rem;
  border-radius: 999px;
  font-size: 0.82rem;
  font-weight: 600;
  color: #fff;
  background: var(--topic-color, var(--cm-accent));
  box-shadow: 0 6px 16px rgba(15, 23, 42, 0.12);
  animation: comments-topic-float 3.2s ease-in-out infinite;
  will-change: transform;
}

body[data-type="comments"] .comments-topic:nth-child(2),
body:has(#comments-topics) .comments-topic:nth-child(2) {
  animation-delay: 0.4s;
}

body[data-type="comments"] .comments-topic:nth-child(3),
body:has(#comments-topics) .comments-topic:nth-child(3) {
  animation-delay: 0.8s;
}

body[data-type="comments"] .comments-topic:nth-child(4),
body:has(#comments-topics) .comments-topic:nth-child(4) {
  animation-delay: 1.2s;
}

@keyframes comments-topic-float {
  0%, 100% { transform: translate3d(0, 0, 0); }
  50% { transform: translate3d(0, -3px, 0); }
}

/* 评论主卡片 */
body[data-type="comments"] #post-comment,
body:has(#comments-topics) #post-comment {
  margin: 0;
  padding: 0;
  border: 1px solid var(--cm-border);
  border-radius: var(--cm-radius);
  background: var(--cm-surface);
  box-shadow: 0 4px 24px rgba(15, 23, 42, 0.06);
  overflow: clip;
}

body[data-type="comments"] #post-comment .comment-head,
body:has(#comments-topics) #post-comment .comment-head {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 0.65rem;
  margin: 0;
  padding: 1.5rem 1.45rem 1.25rem;
  background: linear-gradient(135deg, var(--cm-surface) 0%, var(--cm-surface-soft) 55%, var(--cm-accent-soft) 100%);
  border-bottom: 1px solid var(--cm-border);
}

body[data-type="comments"] #post-comment .comment-head .comment-headline,
body:has(#comments-topics) #post-comment .comment-head .comment-headline {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.25rem;
  width: 100%;
  margin: 0;
  font-size: 1rem;
  font-weight: 800;
  color: var(--cm-text);
}

body[data-type="comments"] #post-comment .comment-head .comment-headline i,
body:has(#comments-topics) #post-comment .comment-head .comment-headline i {
  font-size: 0.95rem;
  color: var(--cm-accent);
}

body[data-type="comments"] #post-comment .comment-head .comment-headline span,
body:has(#comments-topics) #post-comment .comment-head .comment-headline span {
  font-size: clamp(1.2rem, 2.4vw, 1.45rem);
  font-weight: 800;
  letter-spacing: 0.02em;
}

body[data-type="comments"] #post-comment .comment-head .comment-randomInfo,
body:has(#comments-topics) #post-comment .comment-head .comment-randomInfo {
  margin: 0;
  font-size: 0.84rem;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.35rem 0.85rem;
}

body[data-type="comments"] #post-comment .comment-head .comment-randomInfo a,
body:has(#comments-topics) #post-comment .comment-head .comment-randomInfo a {
  color: var(--cm-accent) !important;
  font-weight: 600;
  text-decoration: none;
}

body[data-type="comments"] #post-comment .comment-head .comment-randomInfo a:hover,
body:has(#comments-topics) #post-comment .comment-head .comment-randomInfo a:hover {
  text-decoration: underline;
}

body[data-type="comments"] #post-comment .comment-tips,
body:has(#comments-topics) #post-comment .comment-tips {
  display: block !important;
  width: 100%;
  max-width: 36rem;
  margin: 0.15rem 0 0;
  padding: 0.75rem 1rem;
  border-radius: 8px;
  border-top: 3px solid var(--cm-accent);
  background: var(--cm-accent-soft);
  color: var(--cm-muted) !important;
  font-size: 0.88rem;
  line-height: 1.65;
  text-align: center;
  opacity: 1 !important;
}

body[data-type="comments"] #post-comment .comment-wrap,
body:has(#comments-topics) #post-comment .comment-wrap {
  margin-top: 0.35rem;
  padding: 2rem 1.35rem 1.5rem;
}

/* Twikoo 区域对比度 */
body[data-type="comments"] #twikoo .tk-comments .tk-input .el-textarea__inner,
body:has(#comments-topics) #twikoo .tk-comments .tk-input .el-textarea__inner {
  color: var(--cm-text) !important;
  background: var(--cm-surface-soft) !important;
  border-color: var(--cm-border) !important;
}

body[data-type="comments"] #twikoo .tk-comments .el-input__inner,
body:has(#comments-topics) #twikoo .tk-comments .el-input__inner {
  color: var(--cm-text) !important;
  background: var(--cm-surface-soft) !important;
}

body[data-type="comments"] #twikoo .tk-comments-container .tk-content,
body:has(#comments-topics) #twikoo .tk-comments-container .tk-content {
  color: var(--cm-text) !important;
}

body[data-type="comments"] #twikoo .tk-comments-container .tk-nick,
body:has(#comments-topics) #twikoo .tk-comments-container .tk-nick {
  color: var(--cm-text) !important;
}

body[data-type="comments"] #twikoo .tk-comments .el-button--primary,
body:has(#comments-topics) #twikoo .tk-comments .el-button--primary {
  background: var(--cm-accent) !important;
  border-color: var(--cm-accent) !important;
}

@media screen and (max-width: 768px) {
  body[data-type="comments"] #post-comment .comment-wrap,
  body:has(#comments-topics) #post-comment .comment-wrap {
    padding: 1.65rem 0.85rem 1.1rem;
  }

  body[data-type="comments"] .comments-topics,
  body:has(#comments-topics) .comments-topics {
    gap: 0.55rem 0.65rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  body[data-type="comments"] .comments-topic,
  body:has(#comments-topics) .comments-topic {
    animation: none !important;
  }
}
