/* 资源详情页 /soft/{ref} — 与 public-browse.css 搭配 */

.cs-item-detail-page {
  scroll-behavior: smooth;
}

.cs-item-detail-page .breadcrumb {
  padding: 0.35rem 0.85rem;
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid var(--surface-border);
}

.cs-item-detail-page .cs-item-hero {
  position: relative;
  border-radius: var(--radius-lg);
  padding: 1.35rem 1.5rem;
  background: linear-gradient(115deg, rgba(30, 111, 217, 0.09) 0%, rgba(255, 255, 255, 0.96) 45%, rgba(30, 111, 217, 0.06) 78%, rgba(241, 245, 249, 0.85) 100%);
  border: 1px solid var(--surface-border);
  box-shadow: var(--shadow-card);
}

/* 详情页标题：比 Bootstrap h3 更克制，避免长标题压迫版面 */
.cs-item-detail-page .cs-item-hero .cs-item-title {
  font-size: clamp(1.125rem, 2.2vw, 1.375rem);
  font-weight: 700;
  line-height: 1.35;
  letter-spacing: -0.02em;
  color: #1e293b;
}

.cs-item-detail-page .cs-item-hero .cs-item-version {
  font-size: 0.95rem;
  font-weight: 500;
  margin-left: 0.35rem;
  white-space: nowrap;
  vertical-align: 0.05em;
}

/* 详情页标签：胶囊描边 + 浅底，与列表 meta 芯片同系；窄屏单行横向滑动 */
.cs-item-detail-page .cs-item-tag-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.4rem 0.55rem;
  margin-top: 0.5rem;
  min-width: 0;
}

.cs-item-detail-page .cs-item-tag-row__icon {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  line-height: 1;
  color: #64748b;
}

.cs-item-detail-page .cs-item-tag-row__icon .bx {
  font-size: 1.05rem;
  vertical-align: -0.05em;
}

.cs-item-detail-page .cs-item-tag-link {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  font-size: 0.8125rem;
  font-weight: 500;
  line-height: 1.3;
  color: var(--bs-primary, #1e6fd9);
  text-decoration: none;
  white-space: nowrap;
  padding: 0.22rem 0.6rem;
  border-radius: 999px;
  border: 1px solid rgba(var(--bs-primary-rgb), 0.26);
  background: rgba(var(--bs-primary-rgb), 0.06);
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.75) inset,
    0 1px 2px rgba(15, 23, 42, 0.04);
  transition:
    border-color 0.15s ease,
    background 0.15s ease,
    color 0.15s ease,
    box-shadow 0.15s ease;
}

.cs-item-detail-page .cs-item-tag-link:hover {
  color: var(--primary-dark, #1557b8);
  text-decoration: none;
  border-color: rgba(var(--bs-primary-rgb), 0.42);
  background: rgba(var(--bs-primary-rgb), 0.11);
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.9) inset,
    0 2px 6px rgba(var(--bs-primary-rgb), 0.12);
}

.cs-item-detail-page .cs-item-tag-link:focus-visible {
  outline: none;
  box-shadow: 0 0 0 2px rgba(var(--bs-primary-rgb), 0.22);
}

@media (max-width: 767.98px) {
  .cs-item-detail-page .cs-item-tag-row {
    flex-wrap: nowrap;
    gap: 0.5rem;
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    padding-bottom: 2px;
    margin-right: -0.25rem;
    padding-right: 0.25rem;
  }

  .cs-item-detail-page .cs-item-tag-row::-webkit-scrollbar {
    display: none;
  }
}

/* 统计 +（可选）语言/库/系统/界面：移动端纵向；PC 横向紧跟日期后 */
.cs-item-detail-page .cs-item-hero-stat-row {
  margin-top: 0.75rem;
}

.cs-item-detail-page .cs-item-hero-metrics {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 1rem 1.25rem;
  margin-top: 0;
  padding: 0;
  border-radius: 0;
  background: transparent;
  border: none;
  box-shadow: none;
}

@media (min-width: 992px) {
  .cs-item-detail-page .cs-item-hero-stat-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 1rem 1.25rem;
  }

  .cs-item-detail-page .cs-item-hero-props {
    margin-top: 0 !important;
    padding-top: 0 !important;
    border-top: none !important;
  }
}

/* 详情首屏右侧：点赞 / 踩 / 收藏 / 举报 — 统一高度与内边距；踩为单字 + scaleY 翻转图标，避免显小 */
.cs-item-detail-page .cs-item-hero-actions {
  align-items: center;
}

.cs-item-detail-page .cs-item-hero-actions > .btn.btn-sm {
  min-height: 2.125rem;
  padding-left: 0.7rem;
  padding-right: 0.7rem;
}

.cs-item-detail-page .cs-item-hero-actions > .btn.btn-sm .bx-hand-dislike-flip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1em;
  height: 1em;
  flex-shrink: 0;
  line-height: 1;
  vertical-align: middle;
}

.cs-item-detail-page .cs-item-hero-actions > .btn.js-dislike {
  min-width: 4.85rem;
}

.cs-item-detail-page .cs-item-hero-metrics .cs-item-stat {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0;
  border-radius: 0;
  font-size: 0.8125rem;
  font-weight: 500;
  color: #475569;
  letter-spacing: 0;
  background: none;
  border: none;
  box-shadow: none;
  white-space: nowrap;
}

.cs-item-detail-page .cs-item-hero-metrics .cs-item-stat i {
  font-size: 1rem;
  color: var(--bs-primary, #1e6fd9);
  opacity: 0.88;
}

/* 统计行下方、作者上方：仅图标 + 值（有数据才输出），悬停见 title 提示 */
.cs-item-detail-page .cs-item-hero-props {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 1.1rem;
  margin-top: 0.65rem;
  padding-top: 0.65rem;
  border-top: 1px solid rgba(15, 23, 42, 0.06);
  font-size: 0.8125rem;
  line-height: 1.45;
  color: #475569;
}

.cs-item-detail-page .cs-item-hero-prop-item {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem;
  max-width: 100%;
}

.cs-item-detail-page .cs-item-hero-prop-icon {
  flex-shrink: 0;
  font-size: 1.05rem;
  color: var(--bs-primary, #1e6fd9);
  opacity: 0.92;
  line-height: 1;
}

.cs-item-detail-page .cs-item-hero-prop-val {
  min-width: 0;
  word-break: break-word;
}

/* 简介 Markdown 渲染（与详情区共用排版） */
.cs-item-detail-page .cs-item-about-card .cs-item-about-intro.cs-markdown-body {
  font-size: 0.9375rem;
  line-height: 1.7;
  color: #475569;
}

.cs-item-detail-page .cs-item-about-card .cs-item-about-intro {
  font-size: 0.9375rem;
  line-height: 1.7;
  color: #475569;
}

.cs-item-detail-page .cs-item-about-card .cs-item-about-links .text-muted {
  display: inline-block;
  margin-bottom: 0.2rem;
}

/* 顶部简介：卡片化，与下方「详情 HTML」区块区分 */
.cs-item-detail-page .cs-item-intro-panel {
  border-radius: var(--radius-md);
  border: 1px solid var(--surface-border);
  background: linear-gradient(165deg, rgba(255, 255, 255, 0.98) 0%, rgba(248, 250, 252, 0.96) 55%, rgba(255, 255, 255, 0.99) 100%);
  box-shadow: var(--shadow-xs);
  padding: 1rem 1.15rem 1.1rem;
}

.cs-item-detail-page .cs-item-intro-panel__title {
  font-size: 0.8125rem;
  font-weight: 700;
  color: #334155;
  margin: 0 0 0.55rem;
  letter-spacing: 0.03em;
}

.cs-item-detail-page .cs-item-intro-panel__body {
  margin: 0;
  font-size: 0.9375rem;
  line-height: 1.7;
  color: #475569;
}

.cs-item-detail-page .card {
  border-radius: var(--radius-md) !important;
  border: 1px solid var(--surface-border) !important;
  box-shadow: var(--shadow-xs) !important;
}

.cs-item-detail-page .cs-item-side .list-group-item {
  border-color: var(--surface-border) !important;
}

/* 详情页作者条：「作者：xxx」+ 关注 / 私信（单行优先） */
.cs-item-detail-page .cs-item-author-contact-strip {
  padding: 0.35rem 0;
}

.cs-item-detail-page .cs-item-author-line {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  gap: 0.65rem 1rem;
  min-width: 0;
}

.cs-item-detail-page .cs-item-author-line__name {
  flex: 1 1 auto;
  min-width: 0;
  font-size: 0.875rem;
  font-weight: 600;
  color: #334155;
  letter-spacing: -0.01em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.cs-item-detail-page .cs-item-author-line__actions {
  flex: 0 0 auto;
  display: inline-flex;
  flex-wrap: nowrap;
  align-items: center;
  gap: 0.5rem;
}

/* 大厂风胶囊按钮：主色「关注」+ 浅色描边「私信」 */
.cs-item-detail-page .cs-btn-author-follow {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  padding: 0.4rem 1rem;
  border-radius: 999px;
  font-weight: 600;
  font-size: 0.8125rem;
  line-height: 1.25;
  border-width: 1px;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.06);
  transition:
    background-color 0.15s ease,
    border-color 0.15s ease,
    color 0.15s ease,
    box-shadow 0.15s ease;
}

.cs-item-detail-page .cs-btn-author-follow.btn-primary {
  border-color: transparent;
  box-shadow:
    0 1px 2px rgba(30, 111, 217, 0.22),
    0 1px 3px rgba(15, 23, 42, 0.08);
}

.cs-item-detail-page .cs-btn-author-follow.btn-primary:hover {
  box-shadow:
    0 2px 6px rgba(30, 111, 217, 0.28),
    0 1px 3px rgba(15, 23, 42, 0.08);
}

.cs-item-detail-page .cs-btn-author-follow.btn-outline-secondary {
  box-shadow: none;
  font-weight: 600;
}

.cs-item-detail-page .cs-btn-author-follow .bx {
  font-size: 1.05rem;
}

.cs-item-detail-page .cs-btn-author-dm {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  padding: 0.4rem 1rem;
  border-radius: 999px;
  font-weight: 600;
  font-size: 0.8125rem;
  line-height: 1.25;
  color: #334155 !important;
  background: #fff !important;
  border: 1px solid #e2e8f0 !important;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
  text-decoration: none !important;
  transition:
    background-color 0.15s ease,
    border-color 0.15s ease,
    color 0.15s ease,
    box-shadow 0.15s ease;
}

.cs-item-detail-page .cs-btn-author-dm:hover:not(:disabled) {
  background: #f8fafc !important;
  border-color: #cbd5e1 !important;
  color: #1e293b !important;
}

.cs-item-detail-page .cs-btn-author-dm .bx {
  font-size: 1.05rem;
  color: #64748b;
}

.cs-item-detail-page .cs-btn-author-dm--disabled {
  opacity: 0.48;
  cursor: not-allowed;
  pointer-events: none;
}

@media (max-width: 575.98px) {
  .cs-item-detail-page .cs-item-author-line {
    flex-wrap: wrap;
  }

  .cs-item-detail-page .cs-item-author-line .cs-item-author-line__name {
    flex: 1 1 100%;
    white-space: normal;
  }
}

.cs-item-detail-page .cs-md-panel {
  background: rgba(248, 250, 252, 0.95);
  border: 1px solid rgba(15, 23, 42, 0.08);
  border-radius: var(--radius-md);
  padding: 1rem 1.15rem;
}

.cs-item-detail-page .cs-markdown-body {
  font-size: 0.95rem;
  line-height: 1.65;
  color: #334155;
  word-wrap: break-word;
  overflow-wrap: break-word;
}

.cs-item-detail-page .cs-markdown-body > *:first-child {
  margin-top: 0 !important;
}

.cs-item-detail-page .cs-markdown-body > *:last-child {
  margin-bottom: 0 !important;
}

.cs-item-detail-page .cs-markdown-body h1,
.cs-item-detail-page .cs-markdown-body h2,
.cs-item-detail-page .cs-markdown-body h3,
.cs-item-detail-page .cs-markdown-body h4 {
  margin-top: 1.25rem;
  margin-bottom: 0.5rem;
  font-weight: 650;
  color: #0f172a;
  line-height: 1.35;
}

.cs-item-detail-page .cs-markdown-body h1 { font-size: 1.35rem; }
.cs-item-detail-page .cs-markdown-body h2 { font-size: 1.2rem; }
.cs-item-detail-page .cs-markdown-body h3 { font-size: 1.08rem; }
.cs-item-detail-page .cs-markdown-body h4 { font-size: 1rem; }

.cs-item-detail-page .cs-markdown-body p {
  margin-bottom: 0.75rem;
}

.cs-item-detail-page .cs-markdown-body a {
  color: var(--bs-primary, #0d6efd);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.cs-item-detail-page .cs-markdown-body a:hover {
  text-decoration-thickness: 2px;
}

.cs-item-detail-page .cs-markdown-body ul,
.cs-item-detail-page .cs-markdown-body ol {
  margin-bottom: 0.75rem;
  padding-left: 1.35rem;
}

.cs-item-detail-page .cs-markdown-body li {
  margin-bottom: 0.25rem;
}

.cs-item-detail-page .cs-markdown-body blockquote {
  margin: 0.75rem 0;
  padding: 0.5rem 0.85rem;
  border-left: 4px solid rgba(13, 110, 253, 0.45);
  background: rgba(15, 23, 42, 0.04);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  color: #475569;
}

.cs-item-detail-page .cs-markdown-body hr {
  margin: 1.25rem 0;
  border: 0;
  border-top: 1px solid rgba(15, 23, 42, 0.1);
  opacity: 1;
}

.cs-item-detail-page .cs-markdown-body table {
  width: 100%;
  margin-bottom: 1rem;
  font-size: 0.875rem;
  border-collapse: collapse;
  border: 1px solid rgba(15, 23, 42, 0.12);
  border-radius: var(--radius-sm);
  overflow: hidden;
}

.cs-item-detail-page .cs-markdown-body th,
.cs-item-detail-page .cs-markdown-body td {
  padding: 0.45rem 0.6rem;
  border: 1px solid rgba(15, 23, 42, 0.1);
  vertical-align: top;
}

.cs-item-detail-page .cs-markdown-body th {
  background: rgba(15, 23, 42, 0.05);
  font-weight: 600;
  text-align: left;
}

.cs-item-detail-page .cs-markdown-body .cs-md-code-wrap {
  position: relative;
  margin: 0.75rem 0;
}

.cs-item-detail-page .cs-markdown-body pre {
  margin: 0.75rem 0;
  padding: 0.85rem 1rem;
  font-size: 0.82rem;
  line-height: 1.5;
  background: #1a2f4d;
  color: #e2e8f0;
  border-radius: var(--radius-sm);
  overflow-x: auto;
  border: 1px solid rgba(59, 130, 246, 0.22);
}

.cs-item-detail-page .cs-markdown-body .cs-md-code-wrap > pre {
  margin: 0;
  padding: 0.85rem 1rem;
}

.cs-markdown-body .cs-md-code-copy-btn {
  position: absolute;
  top: 0.45rem;
  right: 0.45rem;
  z-index: 2;
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.18rem 0.5rem;
  font-size: 0.72rem;
  line-height: 1.2;
  color: rgba(226, 232, 240, 0.92);
  background: rgba(30, 58, 95, 0.88);
  border: 1px solid rgba(147, 197, 253, 0.28);
  border-radius: 0.25rem;
  cursor: pointer;
  opacity: 0;
  pointer-events: none;
  transition:
    opacity 0.15s ease,
    color 0.15s ease,
    background 0.15s ease,
    border-color 0.15s ease;
}

.cs-markdown-body .cs-md-code-wrap:hover .cs-md-code-copy-btn,
.cs-markdown-body .cs-md-code-copy-btn:focus,
.cs-markdown-body .cs-md-code-copy-btn.is-copied {
  opacity: 1;
  pointer-events: auto;
}

.cs-markdown-body .cs-md-code-copy-btn .bx {
  font-size: 0.95rem;
  line-height: 1;
}

.cs-markdown-body .cs-md-code-copy-btn:hover,
.cs-markdown-body .cs-md-code-copy-btn:focus {
  color: #fff;
  background: rgba(37, 99, 235, 0.58);
  border-color: rgba(147, 197, 253, 0.45);
  outline: none;
}

.cs-markdown-body .cs-md-code-copy-btn.is-copied {
  color: #bfdbfe;
  background: rgba(30, 64, 175, 0.72);
  border-color: rgba(147, 197, 253, 0.5);
}

.cs-item-detail-page .cs-markdown-body pre code {
  padding: 0;
  font-size: inherit;
  color: inherit;
  background: transparent;
  border-radius: 0;
}

.cs-item-detail-page .cs-markdown-body code {
  padding: 0.12rem 0.35rem;
  font-size: 0.86em;
  background: rgba(15, 23, 42, 0.07);
  border-radius: 0.25rem;
  color: #b45309;
}

.cs-item-detail-page .cs-markdown-body img {
  max-width: 100%;
  height: auto;
  border-radius: var(--radius-sm);
  margin: 0.5rem 0;
}

/* Markdown 表格横向滚动（窄屏） */
.cs-markdown-body .cs-md-table-wrap {
  width: 100%;
  max-width: 100%;
  margin-bottom: 1rem;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(15, 23, 42, 0.08);
}

.cs-markdown-body .cs-md-table-wrap > table {
  margin-bottom: 0;
  min-width: 28rem;
}

/* Mermaid / 流程图容器 */
.cs-markdown-body .cs-md-diagram {
  position: relative;
  margin: 1rem 0 1.25rem;
  padding: 1rem 0.75rem 2.75rem;
  border-radius: var(--radius-md);
  border: 1px solid rgba(37, 99, 235, 0.18);
  background: linear-gradient(180deg, rgba(239, 246, 255, 0.85) 0%, rgba(248, 250, 252, 0.95) 100%);
  overflow-x: auto;
  text-align: center;
}

.cs-markdown-body .cs-md-diagram--zoomable {
  cursor: zoom-in;
}

.cs-markdown-body .cs-md-diagram__zoom-btn {
  position: absolute;
  top: 0.5rem;
  right: 0.5rem;
  z-index: 2;
  font-size: 0.75rem;
  color: #2563eb;
  background: rgba(255, 255, 255, 0.96);
}

.cs-markdown-body .cs-md-diagram__zoom-btn:hover,
.cs-markdown-body .cs-md-diagram__zoom-btn:focus {
  color: #1d4ed8;
  border-color: rgba(37, 99, 235, 0.35);
  background: #fff;
}

.cs-markdown-body .cs-md-diagram__render {
  overflow-x: auto;
  text-align: center;
}

.cs-markdown-body .cs-md-diagram__render svg {
  max-width: 100%;
  height: auto;
}

.cs-markdown-body .cs-md-diagram pre.mermaid {
  margin: 0;
  padding: 0;
  background: transparent;
  border: 0;
  color: inherit;
  font-size: 0.875rem;
  line-height: 1.45;
  overflow: visible;
  white-space: pre-wrap;
  word-break: break-word;
  text-align: left;
  display: inline-block;
  min-width: min(100%, 20rem);
}

.cs-markdown-body .cs-md-diagram svg {
  max-width: 100%;
  height: auto;
}

/* 图表放大预览 */
body.cs-md-diagram-lightbox-open {
  overflow: hidden;
}

.cs-md-diagram-lightbox {
  position: fixed;
  inset: 0;
  z-index: 1060;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.cs-md-diagram-lightbox.is-open {
  display: flex;
}

.cs-md-diagram-lightbox__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.72);
}

.cs-md-diagram-lightbox__panel {
  position: relative;
  z-index: 1;
  width: min(96vw, 72rem);
  max-height: 92vh;
  display: flex;
  flex-direction: column;
  background: #fff;
  border-radius: var(--radius-md);
  box-shadow: 0 24px 48px rgba(15, 23, 42, 0.28);
  overflow: hidden;
}

.cs-md-diagram-lightbox__toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.5rem;
  padding: 0.65rem 0.75rem;
  border-bottom: 1px solid rgba(15, 23, 42, 0.08);
  background: linear-gradient(180deg, rgba(239, 246, 255, 0.95) 0%, #fff 100%);
}

.cs-md-diagram-lightbox__pan-hint {
  flex: 1 1 auto;
  min-width: 0;
  font-size: 0.78rem;
  color: #64748b;
  user-select: none;
}

.cs-md-diagram-lightbox__toolbar-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
  flex-shrink: 0;
}

.cs-md-diagram-lightbox__viewport {
  overflow: auto;
  padding: 1rem;
  background: #f8fafc;
  flex: 1 1 auto;
  min-height: 12rem;
  -webkit-overflow-scrolling: touch;
  text-align: center;
  touch-action: none;
}

.cs-md-diagram-lightbox__viewport.is-pannable {
  cursor: grab;
}

.cs-md-diagram-lightbox__viewport.is-panning {
  cursor: grabbing;
  user-select: none;
}

.cs-md-diagram-lightbox__stage {
  display: inline-block;
  transform-origin: top left;
  min-width: min-content;
  min-height: 2rem;
  margin: 0 auto;
}

.cs-md-diagram-lightbox__clone {
  display: inline-block;
  line-height: 0;
}

.cs-md-diagram-lightbox__stage svg,
.cs-md-diagram-lightbox__clone svg {
  display: block !important;
  max-width: none !important;
  overflow: visible !important;
}

.cs-md-diagram-lightbox__stage foreignObject,
.cs-md-diagram-lightbox__clone foreignObject {
  overflow: visible;
}

/* 文章详情页：与资源详情 hero / 卡片布局对齐 */
.cs-article-detail-page .cs-article-cover-card .card-img-top {
  max-height: 420px;
  object-fit: cover;
}

.cs-article-detail-page .cs-article-content-card .card-header {
  background: linear-gradient(90deg, rgba(37, 99, 235, 0.08) 0%, rgba(255, 255, 255, 0.96) 100%);
  border-bottom: 1px solid rgba(15, 23, 42, 0.06);
}

.cs-article-detail-page .cs-article-sidebar-card .list-group-item {
  border-color: rgba(15, 23, 42, 0.06);
}

.cs-article-detail-page .cs-article-actions .btn.active-like {
  color: #2563eb;
  border-color: #2563eb;
  background: rgba(37, 99, 235, 0.06);
}

.cs-article-detail-page .cs-article-actions .btn.active-dislike {
  color: #64748b;
  border-color: #64748b;
  background: rgba(100, 116, 139, 0.06);
}

.cs-article-detail-page .cs-article-actions .btn.active-fav {
  color: #dc2626;
  border-color: #dc2626;
  background: rgba(220, 38, 38, 0.06);
}

.cs-article-detail-page .cs-article-preview-badge {
  position: fixed;
  top: 5rem;
  right: 1rem;
  z-index: 100;
  opacity: 0.92;
}

/* 后台审核内嵌预览：限制高度 */
.cs-markdown-body.admin-audit-md {
  max-height: 28rem;
  overflow: auto;
  padding-right: 0.25rem;
}

.cs-item-detail-page #comments .list-group-item {
  border-color: rgba(15, 23, 42, 0.06) !important;
}

/* 侧栏「相关资源」：标题 + 版本一行，类型与下载次行徽标化 */
.cs-item-detail-page .cs-related-card .card-body {
  border-top: 1px solid rgba(15, 23, 42, 0.06);
}

.cs-item-detail-page .cs-related-card__head {
  font-size: 0.8125rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: #334155;
  padding-bottom: 0.35rem !important;
}

.cs-item-detail-page .cs-related-list {
  padding: 0 0.25rem;
}

.cs-item-detail-page .cs-related-item {
  padding: 0.65rem 0.75rem;
  border-radius: var(--radius-sm);
  transition: background 0.15s ease;
}

.cs-item-detail-page .cs-related-item + .cs-related-item {
  margin-top: 0.35rem;
}

@media (hover: hover) and (pointer: fine) {
  .cs-item-detail-page .cs-related-item:hover {
    background: rgba(var(--bs-primary-rgb, 30, 111, 217), 0.06);
  }
}

.cs-item-detail-page .cs-related-item__title-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.4rem;
}

.cs-item-detail-page .cs-related-item__link {
  flex: 1 1 auto;
  min-width: 0;
  font-size: 0.8125rem;
  font-weight: 500;
  line-height: 1.45;
  color: var(--bs-primary, #1e6fd9);
  text-decoration: none;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  overflow: hidden;
  transition: color 0.15s ease;
}

.cs-item-detail-page .cs-related-item__link:hover {
  color: var(--primary-dark, #1557b8);
  text-decoration: none;
}

.cs-item-detail-page .cs-related-item__ver {
  flex: 0 0 auto;
  font-size: 0.6875rem;
  font-weight: 600;
  line-height: 1.2;
  padding: 0.12rem 0.38rem;
  border-radius: 999px;
  color: #64748b;
  background: rgba(148, 163, 184, 0.18);
  white-space: nowrap;
  align-self: flex-start;
}

.cs-item-detail-page .cs-related-item__meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.45rem 0.65rem;
}

.cs-item-detail-page .cs-related-item__type {
  font-size: 0.6875rem;
  font-weight: 500;
  color: #475569;
  padding: 0.15rem 0.45rem;
  border-radius: 999px;
  background: rgba(241, 245, 249, 0.95);
  border: 1px solid rgba(148, 163, 184, 0.35);
  line-height: 1.2;
}

.cs-item-detail-page .cs-related-item__dl {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  font-size: 0.6875rem;
  font-weight: 600;
  color: #64748b;
  padding: 0.15rem 0.45rem;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.9);
  border: 1px solid rgba(148, 163, 184, 0.28);
}

.cs-item-detail-page .cs-related-item__dl .bx {
  font-size: 0.85rem;
  color: #94a3b8;
  line-height: 1;
}

.cs-item-detail-page .cs-related-item__dl-num {
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.02em;
  color: #475569;
}

/* 游客「需登录」与已登录「举报」弹窗：同系圆角与宽度 */
.cs-item-detail-page .cs-item-login-modal .modal-dialog {
  max-width: 400px;
}

.cs-item-detail-page #reportModal .modal-dialog {
  max-width: 440px;
}

/* ---------- 评论区 ---------- */
.cs-item-detail-page .cs-comment-list {
  display: flex;
  flex-direction: column;
  gap: 0;
  margin-top: 0.25rem;
}

.cs-item-detail-page .cs-comment-card {
  display: flex;
  gap: 0.85rem;
  padding: 1rem 0;
  border-bottom: 1px solid rgba(148, 163, 184, 0.28);
}

.cs-item-detail-page .cs-comment-card:last-child {
  border-bottom: none;
  padding-bottom: 0.25rem;
}

.cs-item-detail-page .cs-comment-card__avatar {
  flex-shrink: 0;
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.95rem;
  font-weight: 700;
  color: #1e40af;
  background: linear-gradient(145deg, rgba(30, 111, 217, 0.18), rgba(96, 165, 250, 0.12));
  border: 1px solid rgba(30, 111, 217, 0.22);
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.06);
}

.cs-item-detail-page .cs-comment-card__main {
  flex: 1;
  min-width: 0;
}

.cs-item-detail-page .cs-comment-card__head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.35rem 0.75rem;
  margin-bottom: 0.35rem;
}

.cs-item-detail-page .cs-comment-card__user {
  font-size: 0.875rem;
  font-weight: 600;
  color: #0f172a;
}

.cs-item-detail-page .cs-comment-card__date {
  font-size: 0.75rem;
  font-weight: 500;
  color: #94a3b8;
}

.cs-item-detail-page .cs-comment-card__content {
  font-size: 0.875rem;
  line-height: 1.55;
  color: #334155;
  margin-bottom: 0.65rem;
}

.cs-item-detail-page .cs-comment-card__foot {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.4rem;
}

.cs-item-detail-page .cs-comment-vote {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
  border: 1px solid rgba(148, 163, 184, 0.45);
  background: rgba(248, 250, 252, 0.9);
  color: #64748b;
  font-size: 0.75rem;
  font-weight: 600;
  line-height: 1.2;
  transition:
    color 0.15s ease,
    border-color 0.15s ease,
    background 0.15s ease;
}

.cs-item-detail-page .cs-comment-vote .bx {
  font-size: 1rem;
  line-height: 1;
}

.cs-item-detail-page .cs-comment-vote:hover {
  border-color: rgba(30, 111, 217, 0.45);
  color: #1e6fd9;
  background: rgba(30, 111, 217, 0.06);
}

.cs-item-detail-page .cs-comment-vote.active {
  border-color: rgba(30, 111, 217, 0.55);
  color: #1e6fd9;
  background: rgba(30, 111, 217, 0.1);
}

.cs-item-detail-page .cs-comment-vote.js-comment-dislike.active {
  border-color: rgba(100, 116, 139, 0.65);
  color: #475569;
  background: rgba(241, 245, 249, 0.95);
}

.cs-item-detail-page .cs-comment-vote .js-comment-like-stat,
.cs-item-detail-page .cs-comment-vote .js-comment-dislike-stat {
  font-variant-numeric: tabular-nums;
  min-width: 1rem;
  text-align: center;
}

/* 评论区：卡片列表 + 行为值 + 赞/踩 */
.cs-item-detail-page .cs-comment-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.cs-item-detail-page .cs-comment-item {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: 0.65rem 1rem;
  padding: 0.85rem 1rem;
  border-radius: var(--radius-md, 0.5rem);
  border: 1px solid var(--surface-border, #e2e8f0);
  background: linear-gradient(145deg, rgba(248, 250, 252, 0.95) 0%, rgba(255, 255, 255, 1) 55%);
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.05);
}

.cs-item-detail-page .cs-comment-item__main {
  flex: 1 1 12rem;
  min-width: 0;
}

.cs-item-detail-page .cs-comment-item__meta {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.35rem 0.65rem;
  margin-bottom: 0.4rem;
}

.cs-item-detail-page .cs-comment-item__user {
  font-weight: 600;
  font-size: 0.875rem;
  color: #1e293b;
}

.cs-item-detail-page .cs-comment-item__date {
  font-size: 0.75rem;
  color: #94a3b8;
}

.cs-item-detail-page .cs-comment-item__text {
  font-size: 0.875rem;
  line-height: 1.55;
  color: #334155;
}

.cs-item-detail-page .cs-comment-item__side {
  flex: 0 0 auto;
  display: flex;
  flex-direction: row;
  flex-wrap: nowrap;
  align-items: center;
  justify-content: flex-end;
  gap: 0.5rem;
}

.cs-item-detail-page .cs-comment-item__score-num {
  font-size: 1.125rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: #1e6fd9;
  line-height: 1;
  min-width: 1.25rem;
  text-align: right;
}

.cs-item-detail-page .cs-comment-item__vote .btn {
  padding: 0.22rem 0.42rem;
  line-height: 1;
}

.cs-item-detail-page .cs-comment-item__vote .btn .bx {
  font-size: 0.82rem;
  display: inline-block;
  vertical-align: middle;
  line-height: 1;
}

/* header.css 中 .btn-outline-primary { color: ... !important } 会盖住激活态白字，导致蓝底上看不见图标 */
.cs-item-detail-page .cs-comment-item__vote .js-cmt-like.active.btn-outline-primary {
  color: #fff !important;
  background-color: var(--primary-color, var(--bs-primary));
  border-color: var(--primary-color, var(--bs-primary));
}

.cs-item-detail-page .cs-comment-item__vote .js-cmt-like.active.btn-outline-primary .bx {
  color: #fff !important;
}

.cs-item-detail-page .cs-comment-item__vote .js-cmt-dislike.active.btn-outline-secondary {
  color: #fff !important;
  background-color: var(--bs-secondary);
  border-color: var(--bs-secondary);
}

.cs-item-detail-page .cs-comment-item__vote .js-cmt-dislike.active.btn-outline-secondary .bx {
  color: #fff !important;
}

@media (max-width: 575.98px) {
  .cs-item-detail-page .cs-comment-item__side {
    width: 100%;
    justify-content: flex-start;
  }
}

/* 代码难度星级（投稿 / 详情 / 用户中心共用 class） */
.cs-code-diff-stars {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.05rem 0.12rem;
  line-height: 1.2;
}

.cs-code-diff-stars .bx {
  font-size: 1.05rem;
  vertical-align: -0.08em;
}

.cs-item-detail-page .cs-code-difficulty-prop .cs-code-diff-stars .bx {
  font-size: 1.12rem;
}

/* 详情页社媒分享（国际 + 国内站点） */
.cs-item-detail-page .cs-item-share-strip {
  max-width: 100%;
}

.cs-item-detail-page .cs-item-share-heading {
  align-self: center;
  font-weight: 600;
}

.cs-item-detail-page .cs-item-share-btn {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.25rem;
  height: 2.25rem;
  border-radius: 0.375rem;
  border: none;
  padding: 0;
  color: #fff;
  text-decoration: none;
  cursor: pointer;
  transition:
    transform 0.15s ease,
    box-shadow 0.15s ease,
    filter 0.15s ease;
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.28) inset,
    0 1px 2px rgba(15, 23, 42, 0.12);
}

.cs-item-detail-page .cs-item-share-btn .bx {
  font-size: 1.35rem;
  line-height: 1;
}

.cs-item-detail-page .cs-item-share-btn:hover {
  filter: brightness(1.06);
  transform: translateY(-1px);
  color: #fff;
}

.cs-item-detail-page .cs-item-share-btn:focus-visible {
  outline: 2px solid rgba(var(--bs-primary-rgb, 30, 111, 217), 0.55);
  outline-offset: 2px;
}

.cs-item-detail-page .cs-item-share-btn--fb {
  background: #1877f2;
}

.cs-item-detail-page .cs-item-share-btn--x {
  background: #000;
  color: #fff;
}

.cs-item-detail-page .cs-item-share-btn--x .cs-item-share-x-svg {
  display: block;
  width: 1.05rem;
  height: 1.05rem;
}

.cs-item-detail-page .cs-item-share-btn--x:hover {
  color: #fff;
}

.cs-item-detail-page .cs-item-share-btn--linkedin {
  background: #0a66c2;
}

.cs-item-detail-page .cs-item-share-btn--pin {
  background: #bd081c;
}

.cs-item-detail-page .cs-item-share-btn--mail {
  background: #52606d;
}

.cs-item-detail-page .cs-item-share-btn--qrscan {
  background: #334155;
}

.cs-item-detail-page .cs-item-share-btn--qrscan .cs-item-share-qr-svg {
  display: block;
  width: 1.2rem;
  height: 1.2rem;
}

.cs-item-detail-page .cs-item-share-btn--copyclip {
  background: #475569;
}

.cs-item-detail-page .cs-item-share-weibo-svg {
  display: block;
  width: 1.2rem;
  height: 1.2rem;
}

.cs-item-detail-page .cs-item-share-btn--wechat {
  background: #07c160;
}

.cs-item-detail-page .cs-item-share-btn--wechat .bx {
  font-size: 1.45rem;
}

.cs-item-detail-page .cs-item-share-btn--qzone {
  background: #1e88e5;
  font-family: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

.cs-item-detail-page .cs-item-share-qzone-z {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.05rem;
  height: 1.05rem;
  border-radius: 0.2rem;
  background: linear-gradient(145deg, #ffeb3b 0%, #ffc107 100%);
  color: #1565c0;
  font-size: 0.78rem;
  font-weight: 800;
  line-height: 1;
  box-shadow: 0 0 0 1px rgba(21, 101, 192, 0.35);
}

.cs-item-detail-page .cs-item-share-btn--weibo {
  background: #fff;
  color: #e6162d;
  box-shadow:
    0 0 0 1px rgba(230, 22, 45, 0.35) inset,
    0 1px 2px rgba(15, 23, 42, 0.08);
}

.cs-item-detail-page .cs-item-share-btn--weibo:hover {
  color: #c41222;
}

.cs-item-detail-page .cs-item-share-btn--tieba {
  background: #fff;
  color: #1e6fd9;
  box-shadow:
    0 0 0 1px rgba(30, 111, 217, 0.35) inset,
    0 1px 2px rgba(15, 23, 42, 0.08);
  position: relative;
}

.cs-item-detail-page .cs-item-share-btn--tieba::before {
  content: "";
  position: absolute;
  top: 0.28rem;
  left: 50%;
  transform: translateX(-50%);
  width: 0.35rem;
  height: 0.35rem;
  border-radius: 50%;
  background: #e53935;
  box-shadow: 0 0 0 1px rgba(229, 57, 53, 0.35);
}

.cs-item-detail-page .cs-item-share-tieba-char {
  font-size: 1rem;
  font-weight: 700;
  line-height: 1;
  margin-top: 0.35rem;
  letter-spacing: 0.02em;
}

.cs-item-detail-page .cs-item-share-btn--tieba:hover {
  color: #1557b8;
}

.cs-share-wechat-modal .cs-share-wechat-qr {
  max-width: 100%;
}

.cs-share-wechat-modal #csShareWechatQr,
.cs-share-qr-modal #csSharePageQrImg {
  max-width: 100%;
  height: auto;
}

@media (max-width: 575.98px) {
  .cs-item-detail-page .cs-item-share-heading {
    width: 100%;
  }
}

