/**
 * 响指 B 级快照 · 多宽度自适应（覆盖冻结页固定布局）
 */

html {
  font-size: clamp(12px, 0.32vw + 11px, 16px) !important;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  width: 100%;
  overflow-x: hidden;
  overflow-y: auto;
}

body {
  margin: 0;
  width: 100%;
  overflow: visible !important;
  overflow-x: hidden !important;
  min-width: 320px;
}

/* 主滚动条贴在视口右缘：取消 .layout / .community 等内部滚动 */
#app {
  overflow: visible !important;
}

.layout {
  height: auto !important;
  min-height: 100vh;
  max-height: none !important;
  width: 100% !important;
  overflow: visible !important;
  overflow-y: visible !important;
}

.community,
.home-content,
.main-content {
  height: auto !important;
  min-height: calc(100vh - 52px);
  max-height: none !important;
  overflow: visible !important;
  overflow-y: visible !important;
}

#app,
.layout,
.layout-content,
.layout-content-right,
.layout-content-right-container,
main {
  width: 100% !important;
  max-width: 100vw !important;
  min-width: 0 !important;
  box-sizing: border-box;
}

.layout-content-right-container.is-maxWidth {
  max-width: 100% !important;
  width: 100% !important;
  padding-left: clamp(10px, 2.5vw, 36px) !important;
  padding-right: clamp(10px, 2.5vw, 36px) !important;
}

/* ---------- 顶栏搜索区 ---------- */
.layout-search,
.creator-logo,
.header {
  max-width: 100%;
  flex-wrap: wrap;
  gap: 8px;
}

.creator-logo-line {
  margin: 0 clamp(12px, 3vw, 52px) !important;
}

/* ---------- 创意社区：壳层封顶 2000px（步骤 14） ---------- */
.layout-content-right-container.is-maxWidth:has(#community) {
  --snapshot-community-shell-max: 2000px;
  max-width: min(var(--snapshot-community-shell-max), calc(100vw - 70px)) !important;
  width: 100% !important;
  margin-left: auto !important;
  margin-right: auto !important;
  padding-left: 0 !important;
  padding-right: 0 !important;
  box-sizing: border-box !important;
}

#community {
  width: 100% !important;
  max-width: 100% !important;
  min-width: 0 !important;
  box-sizing: border-box !important;
}

#community > .container {
  --snapshot-community-pad-x: clamp(10px, 2.5vw, 36px);
  width: 100% !important;
  max-width: 100% !important;
  min-width: 0 !important;
  margin: 0 !important;
  padding-left: var(--snapshot-community-pad-x) !important;
  padding-right: var(--snapshot-community-pad-x) !important;
  box-sizing: border-box !important;
}

/* 帖子区与 .container 外框同宽（步骤 7） */
#community .main-right,
#community .entry,
#community .entry-list,
#community .entry-card_list,
#community .card-view {
  width: 100% !important;
  max-width: 100% !important;
  min-width: 0 !important;
  box-sizing: border-box !important;
}

#community .entry-list {
  margin-left: calc(-1 * var(--snapshot-community-pad-x, clamp(10px, 2.5vw, 36px))) !important;
  margin-right: calc(-1 * var(--snapshot-community-pad-x, clamp(10px, 2.5vw, 36px))) !important;
  width: calc(100% + 2 * var(--snapshot-community-pad-x, clamp(10px, 2.5vw, 36px))) !important;
  max-width: calc(100% + 2 * var(--snapshot-community-pad-x, clamp(10px, 2.5vw, 36px))) !important;
}

#community .main-right::after {
  display: none !important;
}

/* ---------- 创意社区：主栏 + 推荐区 ---------- */
.community .container,
.main-box {
  flex-wrap: wrap !important;
  align-items: flex-start !important;
  gap: clamp(14px, 2.5vw, 48px) !important;
  width: 100% !important;
}

.main-left,
.sidebar-container {
  flex: 0 0 auto;
}

.main-right {
  flex: 1 1 320px !important;
  min-width: 0 !important;
  width: 100% !important;
  max-width: 100% !important;
}

.sidebar {
  max-width: 100%;
  box-sizing: border-box;
}

.recommend-queue,
.recommend-queue-view {
  max-width: 100%;
}

/* ---------- 创意社区：滚动时固定顶栏 + 分类栏 CSS sticky（步骤 16） ---------- */
#community .subHeader > .el-affix,
#community .entry > .el-affix {
  position: static !important;
  height: auto !important;
  width: 100% !important;
}

#community .subHeader-fixedTop {
  position: sticky !important;
  top: 52px !important;
  z-index: 40 !important;
  background-color: var(--bg-dark-color) !important;
}

#community .entry-head {
  position: sticky !important;
  top: 118px !important;
  z-index: 39 !important;
  background: var(--bg-dark-color) !important;
  height: 40px !important;
  box-sizing: border-box !important;
}

/* 改版后顶栏在 sidebar；原 subHeader 不参与 sticky / fixed */
.snapshot-community-redesign #community .subHeader-fixedTop {
  position: static !important;
  top: auto !important;
  inset: auto !important;
}

/* 改版后二/三级导航整轨吸顶，分类栏不再单独 fixed */
.snapshot-community-redesign #community .entry-head {
  position: relative !important;
  top: auto !important;
  inset: auto !important;
}

.snapshot-community-redesign #community .snapshot-stuck-rail {
  position: fixed !important;
  z-index: 40 !important;
  background: var(--bg-dark-color) !important;
  box-sizing: border-box !important;
}

#community .snapshot-stuck-sub {
  position: fixed !important;
  z-index: 40 !important;
  background: var(--bg-dark-color) !important;
  box-sizing: border-box !important;
}

.snapshot-sticky-placeholder {
  display: none;
  width: 100%;
}

/* 二级 Tab 容器：中等宽度以下改横向 */
@media (max-width: 1180px) {
  .el-affix--fixed {
    position: relative !important;
    inset: auto !important;
    width: 100% !important;
    height: auto !important;
    z-index: 20 !important;
  }

  #community .subHeader-fixedTop,
  #community .entry-head {
    position: sticky !important;
    inset: auto !important;
  }

  #community .subHeader-fixedTop {
    top: 52px !important;
  }

  #community .entry-head {
    top: 112px !important;
  }

  .snapshot-community-redesign #community .subHeader-fixedTop {
    position: relative !important;
    top: auto !important;
    inset: auto !important;
  }

  .tabView .tab-list.tab-flex {
    flex-direction: row !important;
    flex-wrap: wrap !important;
    justify-content: flex-start !important;
    gap: 10px !important;
    padding: 4px 0 14px !important;
  }

  .tab-flex .tab-item {
    width: auto !important;
    min-width: 84px;
  }

  .main-box {
    flex-direction: column !important;
  }

  .sidebar {
    width: 100% !important;
    max-width: 100% !important;
  }

  .main-right {
    flex: 1 1 100% !important;
  }
}

/* ---------- 卡片网格 2/3/4 列 + 20px 间距（步骤 14–15） ---------- */
.post-lists,
.card-view .post-lists {
  display: grid !important;
  width: 100% !important;
  padding: 16px !important;
  box-sizing: border-box !important;
  gap: 20px !important;
  grid-template-columns: repeat(4, minmax(0, 1fr)) !important;
}

.post-card.normal-card,
.post-card.post-warp,
.post-card {
  width: 100% !important;
  max-width: 100% !important;
  min-width: 0 !important;
}

.entry-card_list {
  width: 100% !important;
  min-height: auto !important;
}

@media (max-width: 1023px) {
  .post-lists,
  .card-view .post-lists {
    grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
  }
}

@media (max-width: 767px) {
  .post-lists,
  .card-view .post-lists {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  }
}

/* ---------- 首页：左右分栏堆叠 ---------- */
@media (max-width: 1024px) {
  .layout-content {
    flex-direction: column !important;
  }

  .layout-content-left-fixed,
  .layout-content-right {
    width: 100% !important;
    max-width: 100% !important;
    flex: 1 1 auto !important;
  }

  .sidebar-aside {
    max-height: 40vh;
    overflow-y: auto;
  }
}

/* ---------- 生成资源 / 资源库 ---------- */
.generate-card,
.generate-page,
.library .container,
.res-left-menu-box {
  max-width: 100%;
}

@media (max-width: 900px) {
  .right-aside,
  .side-panel {
    width: 100% !important;
    max-width: 100% !important;
    transform: none !important;
  }
}

/* ---------- 筛选标签换行 ---------- */
.tab-list.entry-tabView,
.entry-tabView,
.filter-box,
.chip-list {
  flex-wrap: wrap !important;
}

/* ---------- 图片与表格防溢出 ---------- */
img,
video,
iframe {
  max-width: 100%;
  height: auto;
}

table {
  max-width: 100%;
  display: block;
  overflow-x: auto;
}

/* ---------- 极窄屏：隐藏次要文案，保留图标导航 ---------- */
@media (max-width: 480px) {
  .menu-item-text span {
    font-size: 10px;
  }

  .tab-list .tab-item {
    padding: 6px 12px !important;
    font-size: 12px !important;
  }

  .layout-content-right-container.is-maxWidth {
    padding-left: 8px !important;
    padding-right: 8px !important;
  }
}
