/* 元仓 MetaDepot · 详情/版本页样式（从 app.css 拆出，app.css 之后加载，勿放公共规则） */

.btn-danger-solid {
  background: var(--danger);
  color: #fff;
}

.btn-danger-solid:hover {
  background: #d92b2b;
}

.tag-line {
  background: var(--bg-card);
  border: 1px solid var(--border);
}

.asset-hero {
  background: var(--bg-card);
  border-radius: var(--radius-card);
  padding: 24px;
}

.asset-hero .top {
  display: flex;
  gap: 16px;
  align-items: flex-start;
}

.asset-hero .icon-xl {
  width: 56px;
  height: 56px;
  border-radius: 14px;
  flex: none;
  background: var(--primary-soft);
  color: var(--primary);
  display: grid;
  place-items: center;
}

.asset-hero .icon-xl[src],
.asset-hero img.icon-xl {
  background: transparent;
  object-fit: contain;
}

.asset-hero h1 {
  font-size: 24px;
  line-height: 32px;
  margin-top: 6px;
}

.asset-hero .summary {
  margin-top: 8px;
  font-size: 14px;
  line-height: 22px;
  color: var(--text-sub);
}

.asset-hero .meta {
  margin-top: 12px;
  display: flex;
  align-items: center;
  gap: 8px 14px;
  flex-wrap: wrap;
  font-size: 13px;
  color: var(--text-sub);
}

.asset-hero .meta strong {
  color: var(--text-main);
  font-weight: 600;
}

.asset-hero .meta-sub {
  margin-top: 6px;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  font-size: 12px;
  color: var(--text-muted);
}

.asset-hero .tag-group {
  margin-top: 14px;
}

/* 相关资产卡片：去边框，靠淡阴影衬出层次 */
[data-asset-id] .asset-card {
  border-color: transparent;
  box-shadow: 0 1px 4px rgba(31, 35, 41, 0.06);
}

/* 站外收录详情页 */
.ext-hero .ext-cover {
  width: 132px;
  height: 132px;
  border-radius: 16px;
  object-fit: cover;
  flex: none;
  background: var(--bg-subtle);
  border: 1px solid var(--divider);
}

.ext-actions {
  margin-top: 12px;
}

.ext-host {
  display: flex;
  align-items: center;
  gap: 4px;
  color: var(--text-muted);
}

.ext-lang-head {
  margin-bottom: 12px;
}

@media (max-width: 767px) {
  .ext-hero .ext-cover {
    width: 88px;
    height: 88px;
  }

}

/* 吸顶 tabs：独立于 hero 卡，滚动时固定在顶栏下方 */
.detail-tabs {
  position: sticky;
  top: var(--nav-height);
  z-index: 20;
  margin-top: 16px;
  padding: 0 16px;
  background: var(--bg-card);
  border-radius: var(--radius-card) var(--radius-card) 0 0;
  box-shadow: 0 -6px 12px -10px rgba(31, 35, 41, 0.18);
}

.detail-tabs .tabs {
  margin: 0;
  overflow-x: auto;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}

.detail-tabs .tabs::-webkit-scrollbar {
  display: none;
}

/* 面板标题与二级标题 */
.panel > h3 {
  margin-bottom: 12px;
}

.sub-head {
  margin: 20px 0 12px;
}

/* 版本 tab 头部与单按钮操作区 */
.ver-head {
  margin-bottom: 8px;
}

.version-actions.single {
  display: flex;
  justify-content: flex-end;
}

/* 右栏操作卡 */
.op-card .op-meta {
  margin-top: 4px;
}

.op-card .op-actions {
  margin-top: 16px;
}

.op-card .model-list {
  margin-top: 6px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.op-card .hash-val {
  max-width: 150px;
}

/* 历史版本 / 撤回提示条 */
.detail-banner {
  margin-bottom: 16px;
}

/* 相关资产区块 */
.detail-section {
  margin-top: 16px;
}

/* 详情页评论区 */
#comments .comment-list {
  gap: 8px;
}

#comments .comment-item {
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  transition: background var(--dur) var(--ease);
}

#comments .comment-item:hover {
  background: var(--bg-subtle);
}

#comments .comment-item.is-reply {
  padding-left: 48px;
}

/* 回复目标提示条 */
.reply-chip {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  border-radius: var(--radius-pill);
  background: var(--bg-subtle);
  font-size: 12px;
  color: var(--text-sub);
}

.reply-chip[hidden] {
  display: none;
}

.reply-chip .btn {
  margin-left: auto;
}

#comments .comment-avatar {
  width: 36px;
  height: 36px;
  font-weight: 600;
}

.comment-form {
  margin-top: 16px;
}

.comment-form .form-foot {
  margin-top: 8px;
  justify-content: flex-end;
}

.comments-login {
  margin-top: 16px;
}

.comments-more {
  margin-top: 12px;
}

/* 举报弹窗表单 */
.report-form {
  margin-top: 16px;
}

/* 长内容折叠：内容溢出后才显示展开/收起按钮，遮罩随内容底色变化 */
.collapse {
  position: relative;
}

.collapse-body {
  position: relative;
  overflow: hidden;
}

.collapse-body.is-collapsed::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 60%;
  min-height: 160px;
  max-height: 320px;
  background: linear-gradient(180deg, transparent, var(--bg-card) 82%);
  pointer-events: none;
}

.collapse-body.prompt-preview.is-collapsed::after {
  background: linear-gradient(180deg, transparent, var(--bg-subtle) 88%);
}

.collapse-body.code-box.is-collapsed::after {
  background: linear-gradient(180deg, transparent, var(--bg-page) 88%);
}

.collapse-body.code-box.dark.is-collapsed::after {
  background: linear-gradient(180deg, transparent, #1f2329 88%);
}

.collapse-foot {
  display: flex;
  justify-content: center;
  margin-top: 8px;
}

/* 收起时把展开按钮叠放到内容底部遮罩上，不再占用额外高度；
   :has 兜底，避免脚本缓存导致容器类名未同步时按钮掉回内容下方 */
.collapse.is-collapsed .collapse-foot,
.collapse:has(.collapse-body.is-collapsed) .collapse-foot {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  margin-top: 0;
  padding-bottom: 12px;
  pointer-events: none;
}

.collapse.is-collapsed .collapse-toggle,
.collapse:has(.collapse-body.is-collapsed) .collapse-toggle {
  pointer-events: auto;
}

.collapse-toggle {
  color: var(--primary-text);
}

.prompt-help {
  margin-top: 8px;
}

/* 变量说明示例输入输出 */
.vars-examples {
  margin-top: 20px;
}

/* files tab 的运行时信息条 */
.detail-note {
  margin-top: 16px;
}

.op-card {
  background: var(--bg-card);
  border-radius: var(--radius-card);
  padding: 20px;
  position: sticky;
  top: 84px;
}

.op-version {
  display: flex;
  align-items: baseline;
  gap: 8px;
}

.op-version .ver {
  font-size: 24px;
  font-weight: 700;
  color: var(--text-main);
  font-variant-numeric: tabular-nums;
}

.op-card .divider {
  height: 1px;
  background: var(--divider);
  margin: 16px 0;
}

.code-box {
  background: var(--bg-page);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  font-family: var(--font-mono);
  font-size: 12px;
  line-height: 18px;
  color: var(--text-main);
  word-break: break-all;
  border: 1px solid var(--divider);
}

.code-box.dark {
  background: #1f2329;
  color: #e8eaed;
  border-color: #1f2329;
}

.panel {
  background: var(--bg-card);
  border-radius: 0 0 var(--radius-card) var(--radius-card);
  padding: 24px;
}

.panel.standalone {
  border-radius: var(--radius-card);
  margin-top: 16px;
}

.prompt-preview {
  position: relative;
  background: var(--bg-subtle);
  border: 1px solid var(--divider);
  border-radius: var(--radius-sm);
  padding: 16px;
  font-family: var(--font-mono);
  font-size: 14px;
  line-height: 24px;
  color: var(--text-main);
  white-space: pre-wrap;
  word-break: break-word;
}

/* 收起遮罩由 .collapse-body.is-collapsed 统一处理 */

.prompt-preview .var {
  color: var(--primary-text);
  background: var(--primary-soft);
  border-radius: 4px;
  padding: 0 3px;
}

.version-row {
  display: grid;
  grid-template-columns: 104px minmax(0, 1fr) 200px;
  gap: 16px;
  padding: 16px 0;
  border-bottom: 1px solid var(--divider);
  align-items: start;
}

.version-row:last-child {
  border-bottom: 0;
}

.version-no {
  font-family: var(--font-mono);
  font-size: 14px;
  font-weight: 600;
  color: var(--text-main);
}

.version-meta {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 4px;
}

.version-log {
  font-size: 13px;
  color: var(--text-sub);
  line-height: 21px;
  margin-top: 4px;
}

.version-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
}

.version-actions .btn {
  white-space: nowrap;
  padding: 0 8px;
}

.version-actions>div {
  display: contents;
}

/* 版本对比 */
.diff {
  font-family: var(--font-mono);
  font-size: 12px;
  line-height: 20px;
  border: 1px solid var(--divider);
  border-radius: var(--radius-sm);
  overflow: hidden;
}

.diff-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
}

.diff-cell {
  padding: 4px 10px;
  border-bottom: 1px solid var(--divider);
  white-space: pre-wrap;
  word-break: break-word;
}

.diff-cell:first-child {
  border-right: 1px solid var(--divider);
}

.diff-cell.add {
  background: #f2fbf5;
  color: #0b7a2a;
}

.diff-cell.del {
  background: #fdf3f3;
  color: #c22b2b;
}

/* 依赖树 */
.dep-tree {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.tree-node {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--divider);
  background: var(--bg-card);
  font-size: 13px;
}

.tree-node .line {
  position: relative;
  width: 16px;
  height: 1px;
  background: var(--border);
}

.tree-node .badge {
  margin-left: auto;
}

/* 详情页浮动互动栏（参考图一）：点赞 / 评论 / 收藏 / 分享 / 举报 */
.detail-actions {
  position: fixed;
  left: max(12px, calc(50% - 720px));
  top: 50%;
  transform: translateY(-50%);
  display: flex;
  flex-direction: column;
  gap: 16px;
  z-index: 30;
}

@media (max-width: 1359px) {
  .detail-actions {
    position: static;
    transform: none;
    flex-direction: row;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 4px;
  }

  .detail-actions .act {
    width: 44px;
    height: 44px;
  }

}

.detail-actions .act {
  position: relative;
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: var(--bg-card, #fff);
  background: rgba(255, 255, 255, .8);
  border: none;
  box-shadow: 0 2px 10px rgba(31, 35, 41, 0.10);
  color: var(--text-secondary, #646a73);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: transform 120ms ease, box-shadow 120ms ease, color 120ms ease;
}

.detail-actions .act:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(31, 35, 41, 0.14);
  color: var(--text-main, #1f2329);
}

.detail-actions .act:active {
  transform: translateY(0);
}

.detail-actions .act:disabled {
  opacity: 0.55;
  cursor: wait;
}

.detail-actions .act.active {
  color: var(--accent, #D97706);
}

/* 深色模式：白色圆形按钮改为深色半透明底 + 浅色图标 */
:root[data-theme="dark"] .detail-actions .act {
  background: rgba(28, 29, 34, 0.8);
  color: var(--text-sub, #c7cad0);
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.45);
}

:root[data-theme="dark"] .detail-actions .act:hover {
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.5);
  color: var(--text-main, #f2f3f5);
}

.detail-actions .act-badge {
  position: absolute;
  top: -6px;
  right: -10px;
  min-width: 22px;
  height: 22px;
  padding: 0 6px;
  border-radius: 11px;
  background: var(--text-secondary, #646a73);
  color: #fff;
  font-size: 12px;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ---------- 响应式 ---------- */
@media (max-width: 1199px) {
  .op-card {
    position: static;
  }

}

@media (max-width: 767px) {
  .version-row {
    grid-template-columns: 1fr;
  }

  .version-actions {
    justify-content: flex-start;
  }

}

:root[data-theme="dark"] .diff-cell.add {
  background: rgba(0, 180, 42, 0.14);
  color: #7fe0a0;
}

:root[data-theme="dark"] .diff-cell.del {
  background: rgba(245, 63, 63, 0.14);
  color: #ff9b9b;
}

.prompt-gallery {
  margin-bottom: 16px;
}

.gallery-main {
  position: relative;
  display: block;
  width: fit-content;
  max-width: 100%;
  height: 320px;
  padding: 0;
  cursor: zoom-in;
  border: 1px solid var(--divider);
  border-radius: var(--radius-card);
  overflow: hidden;
  background: var(--bg-page);
}

.gallery-main img {
  height: 100%;
  width: auto;
  max-width: 100%;
  object-fit: contain;
  display: block;
}

.gallery-hint {
  position: absolute;
  right: 10px;
  bottom: 10px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  height: 26px;
  padding: 0 10px;
  border-radius: var(--radius-pill);
  background: rgba(17, 18, 22, 0.62);
  color: #fff;
  font-size: 12px;
  backdrop-filter: blur(6px);
}

.gallery-main:hover .gallery-hint {
  background: rgba(17, 18, 22, 0.78);
}

.gallery-main:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

.gallery-thumbs {
  display: flex;
  gap: 8px;
  margin-top: 10px;
  overflow-x: auto;
  padding-bottom: 2px;
}

.gallery-thumb {
  flex: none;
  width: 76px;
  height: 56px;
  padding: 0;
  cursor: pointer;
  border: 1px solid var(--divider);
  border-radius: 8px;
  overflow: hidden;
  background: var(--bg-card);
  opacity: 0.72;
  transition: opacity var(--dur) var(--ease), border-color var(--dur) var(--ease);
}

.gallery-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.gallery-thumb:hover {
  opacity: 1;
  border-color: var(--text-placeholder);
}

.gallery-thumb.active {
  opacity: 1;
  border-color: var(--primary);
}

.gallery-thumb:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

.gallery-lightbox {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: grid;
  place-items: center;
  padding: 24px;
}

.gallery-lightbox[hidden] {
  display: none;
}

.gallery-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(11, 12, 15, 0.74);
}

.gallery-figure {
  position: relative;
  margin: 0;
  max-width: min(1080px, 92vw);
  max-height: 88vh;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.gallery-figure img {
  max-width: 100%;
  max-height: calc(88vh - 56px);
  object-fit: contain;
  border-radius: var(--radius-card);
  background: #0f1013;
  display: block;
}

.gallery-figure figcaption {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  color: rgba(255, 255, 255, 0.86);
  font-size: 13px;
}

.gallery-count {
  font-variant-numeric: tabular-nums;
  opacity: 0.7;
}

.gallery-nav, .gallery-close {
  position: absolute;
  display: grid;
  place-items: center;
  cursor: pointer;
  width: 36px;
  height: 36px;
  border: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.16);
  color: #fff;
  transition: background var(--dur) var(--ease);
}

.gallery-nav:hover, .gallery-close:hover {
  background: rgba(255, 255, 255, 0.3);
}

.gallery-nav:focus-visible, .gallery-close:focus-visible {
  outline: 2px solid #fff;
  outline-offset: 2px;
}

.gallery-nav.prev {
  left: -52px;
  top: 50%;
  transform: translateY(-50%);
}

.gallery-nav.next {
  right: -52px;
  top: 50%;
  transform: translateY(-50%);
}

.gallery-close {
  right: -52px;
  top: -46px;
}

@media (max-width: 767px) {
  .gallery-main {
    height: 240px;
  }

  .gallery-thumb {
    width: 64px;
    height: 48px;
  }

  .gallery-nav.prev {
    left: 8px;
  }

  .gallery-nav.next {
    right: 8px;
  }

  .gallery-close {
    right: 8px;
    top: -44px;
  }

  .gallery-lightbox {
    padding: 16px;
  }

}
