/* 模型库：手机双列交错 / 电脑宽屏多列 */

.library-body,
.library-body button,
.library-body input,
.library-body select,
.library-body textarea,
.library-body a {
  font-family: "等线 Light", "DengXian Light", DengXian, sans-serif !important;
  font-weight: 300 !important;
}

.library-body {
  background:
    radial-gradient(900px 500px at 50% -10%, rgba(184, 220, 245, 0.45), transparent 55%),
    linear-gradient(180deg, #eef4f9 0%, #f5f5f2 40%, #f7fafc 100%);
  min-height: 100vh;
}

.library-nav {
  background: rgba(245, 245, 242, 0.92) !important;
  backdrop-filter: blur(8px);
}

.library-main {
  max-width: 720px;
  margin: 0 auto;
  padding: 5.2rem 0.85rem 2.5rem;
  width: 100%;
  box-sizing: border-box;
}

html.app-embed .library-main {
  padding: 0.75rem 0.7rem 1.5rem;
  max-width: none;
}

html.app-embed .library-nav {
  display: none !important;
}

/* App：不显示标题/说明/提示文案，只留模型流 */
html.app-embed .library-top,
html.app-embed .library-lead,
html.app-embed .empty-hint {
  display: none !important;
}

/* App 双列：方格略收紧，圆角缩小 */
html.app-embed .library-main {
  padding: 0.55rem 0.55rem 1.25rem;
}

html.app-embed .masonry-2 {
  column-gap: 0.5rem;
}

html.app-embed .masonry-card {
  margin: 0 0 0.5rem;
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(30, 40, 60, 0.05);
}

html.app-embed .masonry-thumb,
html.app-embed .masonry-thumb.gallery,
html.app-embed .masonry-thumb img,
html.app-embed .masonry-thumb.gallery .gallery-img {
  border-radius: 8px 8px 0 0;
}

html.app-embed .masonry-meta {
  padding: 0.4rem 0.45rem 0.55rem;
}

.library-top {
  margin-bottom: 1rem;
  padding: 0 0.15rem;
}

/* 搜索 + 分类（App 内也显示） */
.library-toolbar {
  margin: 0 0 0.85rem;
  padding: 0 0.1rem;
}

.search-box {
  display: flex;
  gap: 0.45rem;
  margin-bottom: 0.65rem;
}

.search-box input[type="search"] {
  flex: 1;
  min-width: 0;
  border: 1px solid rgba(30, 40, 60, 0.12);
  background: rgba(255, 255, 255, 0.92);
  border-radius: 10px;
  padding: 0.55rem 0.75rem;
  font-size: 0.92rem;
  color: var(--ink, #1e1e20);
  outline: none;
}

.search-box input[type="search"]:focus {
  border-color: rgba(255, 87, 34, 0.55);
  box-shadow: 0 0 0 3px rgba(255, 87, 34, 0.12);
}

.search-btn {
  border: 0;
  border-radius: 10px;
  padding: 0.55rem 0.9rem;
  background: #ff5722;
  color: #fff;
  font-size: 0.9rem;
  cursor: pointer;
  white-space: nowrap;
}

.search-btn:active {
  transform: scale(0.98);
}

.category-bar,
.subcategory-bar {
  display: flex;
  flex-wrap: nowrap;
  gap: 0.4rem;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  padding: 0.1rem 0 0.25rem;
}

.category-bar::-webkit-scrollbar,
.subcategory-bar::-webkit-scrollbar {
  display: none;
}

.subcategory-bar {
  margin-top: 0.2rem;
}

.subcategory-bar.is-empty {
  display: none;
}

.cat-chip,
.sub-chip {
  flex: 0 0 auto;
  border: 1px solid rgba(30, 40, 60, 0.1);
  background: rgba(255, 255, 255, 0.88);
  color: #3a4450;
  border-radius: 999px;
  padding: 0.35rem 0.75rem;
  font-size: 0.82rem;
  cursor: pointer;
  line-height: 1.2;
}

.cat-chip.is-core {
  border-color: rgba(255, 87, 34, 0.28);
  background: rgba(255, 243, 237, 0.95);
}

.cat-chip.is-on,
.sub-chip.is-on {
  background: #ff5722;
  border-color: #ff5722;
  color: #fff;
}

.result-hint {
  margin: 0.35rem 0 0;
  min-height: 1.1em;
  font-size: 0.78rem;
  color: var(--ink-soft, #6b7280);
}

.card-cat {
  display: none;
}

html.app-embed .library-toolbar {
  margin-bottom: 0.55rem;
}

html.app-embed .search-box input[type="search"] {
  padding: 0.48rem 0.65rem;
  font-size: 0.88rem;
  border-radius: 8px;
}

html.app-embed .search-btn {
  padding: 0.48rem 0.75rem;
  border-radius: 8px;
  font-size: 0.85rem;
}

html.app-embed .cat-chip,
html.app-embed .sub-chip {
  padding: 0.3rem 0.65rem;
  font-size: 0.78rem;
}

html.app-embed .result-hint {
  font-size: 0.72rem;
}

html.app-embed .empty-hint {
  display: block !important;
  column-span: all;
}

.library-top h1 {
  font-family: var(--font-display);
  font-size: 1.75rem;
  margin: 0 0 0.25rem;
  letter-spacing: -0.02em;
  font-weight: 300;
}

.library-top p {
  margin: 0;
  color: var(--ink-soft);
  font-size: 0.92rem;
}

/* 手机默认：两列交错 */
.masonry-2 {
  column-count: 2;
  column-gap: 0.7rem;
}

.masonry-card {
  display: block;
  break-inside: avoid;
  margin: 0 0 0.7rem;
  border-radius: 16px;
  overflow: hidden;
  background: #fff;
  border: 1px solid rgba(30, 30, 32, 0.06);
  box-shadow: 0 8px 22px rgba(30, 40, 60, 0.05);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  text-decoration: none;
  color: inherit;
}

.masonry-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 14px 28px rgba(30, 40, 60, 0.1);
}

.masonry-thumb {
  background: linear-gradient(160deg, #e8f2fa, #f4f7fa);
  overflow: hidden;
  position: relative;
}

.masonry-thumb img {
  width: 100%;
  height: auto;
  display: block;
  aspect-ratio: 1 / 1.05;
  object-fit: cover;
}

.masonry-card.is-tall .masonry-thumb img {
  aspect-ratio: 1 / 1.28;
}

.masonry-card.is-short .masonry-thumb img {
  aspect-ratio: 1 / 0.88;
}

.masonry-thumb.gallery {
  aspect-ratio: 1 / 1.05;
}

.masonry-card.is-tall .masonry-thumb.gallery {
  aspect-ratio: 1 / 1.28;
}

.masonry-card.is-short .masonry-thumb.gallery {
  aspect-ratio: 1 / 0.88;
}

.masonry-thumb.gallery .gallery-img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0;
  transition: opacity 0.35s ease;
  aspect-ratio: auto;
}

.masonry-thumb.gallery .gallery-img.is-on {
  opacity: 1;
}

.gallery-dots {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 8px;
  display: flex;
  justify-content: center;
  gap: 5px;
  z-index: 2;
}

.gallery-dots .dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  border: 0;
  padding: 0;
  background: rgba(255, 255, 255, 0.55);
  cursor: pointer;
}

.gallery-dots .dot.is-on {
  background: #ff5722;
}

.masonry-meta {
  padding: 0.65rem 0.75rem 0.8rem;
}

.masonry-meta strong {
  display: block;
  font-family: var(--font-display);
  font-size: 0.95rem;
  margin-bottom: 0.15rem;
  color: var(--ink);
  font-weight: 300;
}

.masonry-meta span {
  font-size: 0.78rem;
  color: var(--ink-soft);
}

.empty-hint {
  column-span: all;
  color: var(--ink-soft);
  padding: 1rem 0.2rem;
}

/* 平板：三列 */
@media (min-width: 768px) {
  html:not(.app-embed) .library-main {
    max-width: 980px;
    padding: 5.5rem 1.5rem 3rem;
  }

  html:not(.app-embed) .library-top h1 {
    font-size: 2.1rem;
  }

  html:not(.app-embed) .masonry-2 {
    column-count: 3;
    column-gap: 1rem;
  }

  html:not(.app-embed) .masonry-card {
    margin-bottom: 1rem;
    border-radius: 18px;
  }
}

/* 电脑宽屏：四列 */
@media (min-width: 1100px) {
  html:not(.app-embed) .library-main {
    max-width: 1280px;
    padding: 6rem 2rem 3.5rem;
  }

  html:not(.app-embed) .library-top {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1.4rem;
  }

  html:not(.app-embed) .masonry-2 {
    column-count: 4;
    column-gap: 1.15rem;
  }

  html:not(.app-embed) .masonry-meta strong {
    font-size: 1.02rem;
  }
}

/* 超宽屏：五列 */
@media (min-width: 1500px) {
  html:not(.app-embed) .library-main {
    max-width: 1480px;
  }

  html:not(.app-embed) .masonry-2 {
    column-count: 5;
    column-gap: 1.2rem;
  }
}

/* App / 窄屏强制保持两列交错 */
html.app-embed .masonry-2 {
  column-count: 2 !important;
  column-gap: 0.5rem !important;
}

html.app-embed .masonry-card {
  border-radius: 8px !important;
}

/* 推荐 / 热门 / 关注 */
.feed-tabs {
  display: flex;
  gap: 0.35rem;
  margin: 0 0 0.75rem;
  padding: 0.2rem;
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid rgba(40, 60, 90, 0.08);
  border-radius: 999px;
  width: fit-content;
  max-width: 100%;
}

.feed-tab {
  appearance: none;
  border: 0;
  background: transparent;
  color: #5a6578;
  font-size: 0.92rem;
  padding: 0.42rem 1rem;
  border-radius: 999px;
  cursor: pointer;
  line-height: 1.2;
}

.feed-tab.is-on {
  background: #1f2a3d;
  color: #fff;
}

.card-author {
  color: #2a6f97;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.card-hot {
  display: block;
  margin-top: 0.15rem;
  font-style: normal;
  font-size: 0.78rem;
  color: #8a6a3a;
}

.card-pin {
  position: absolute;
  top: 0.45rem;
  left: 0.45rem;
  z-index: 2;
  margin: 0;
  padding: 0.18rem 0.5rem;
  border-radius: 999px;
  background: rgba(234, 88, 12, 0.92);
  color: #fff;
  font-style: normal;
  font-size: 0.72rem;
  line-height: 1.2;
}

.masonry-card.is-pinned {
  box-shadow: 0 6px 18px rgba(234, 88, 12, 0.12);
}

html.app-embed .feed-tabs {
  margin: 0.15rem 0 0.55rem;
}

@media (max-width: 767px) {
  .masonry-2 {
    column-count: 2;
    column-gap: 0.7rem;
  }
}
