/* ================================================================
   Liblib 镜像页 · 布局校准 + 左侧导航补齐
   基准来自 CDP 实测 liblib.art：
     header  48px fixed
     navbar  200px fixed
     main    padding: 48px 0 0 200px
     图卡    5 列，宽约 232
     dock    760 宽，在内容区居中（x≈428）
   ================================================================ */

/* ---------- Mantine 变量（原站由 JS 注入） ---------- */
:root {
  --mantine-header-height: 48px;
  --mantine-navbar-width: 200px;
  --mantine-padding: 16px;
}

/* ---------- Header：48px + fixed ---------- */
header.mantine-Header-root {
  position: fixed !important;
  top: 0 !important;
  left: 0 !important;
  right: 0 !important;
  height: 48px !important;
  min-height: 48px !important;
  z-index: 200 !important;
  background: #fff !important;
}
[data-mantine-color-scheme="dark"] header.mantine-Header-root {
  background: #1c1c1c !important;
}

/* ---------- Main：让出 header + navbar ---------- */
main.mantine-AppShell-main {
  padding: 48px 0 0 200px !important;
}

/* ---------- 左侧导航（原 DOM 缺失，这里补齐） ---------- */
.lbgen-nav {
  position: fixed;
  left: 0;
  top: 48px;
  bottom: 0;
  width: 200px;
  background: #fff;
  border-right: 1px solid rgba(0, 0, 0, 0.06);
  z-index: 150;
  display: flex;
  flex-direction: column;
  padding: 12px 10px 16px;
  overflow-y: auto;
  box-sizing: border-box;
}
[data-mantine-color-scheme="dark"] .lbgen-nav {
  background: #1c1c1c;
  border-right-color: rgba(255, 255, 255, 0.08);
}

.lbgen-nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  height: 40px;
  padding: 0 12px;
  border-radius: 8px;
  color: #525252;
  font-size: 14px;
  cursor: pointer;
  transition: background 0.16s, color 0.16s;
  user-select: none;
  white-space: nowrap;
  text-decoration: none;
}
.lbgen-nav-item svg {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}
.lbgen-nav-item:hover {
  background: rgba(0, 0, 0, 0.04);
  color: #0d0d0d;
}
.lbgen-nav-item.active {
  background: rgba(31, 109, 255, 0.08);
  color: #0f4fd9;
  font-weight: 500;
}
[data-mantine-color-scheme="dark"] .lbgen-nav-item {
  color: #b0b0b0;
}
[data-mantine-color-scheme="dark"] .lbgen-nav-item:hover {
  background: rgba(255, 255, 255, 0.06);
  color: #f7f7f7;
}
[data-mantine-color-scheme="dark"] .lbgen-nav-item.active {
  background: rgba(71, 142, 255, 0.12);
  color: #478eff;
}

.lbgen-nav-title {
  font-size: 12px;
  color: #a8a8a8;
  padding: 14px 12px 6px;
  user-select: none;
}
.lbgen-nav-sep {
  height: 1px;
  background: rgba(0, 0, 0, 0.06);
  margin: 10px 5px;
}
[data-mantine-color-scheme="dark"] .lbgen-nav-sep {
  background: rgba(255, 255, 255, 0.08);
}

/* ---------- 图墙：绝对定位虚拟瀑布 -> 多列 ---------- */
div[style*="position: relative"][style*="max-height"] {
  height: auto !important;
  max-height: none !important;
  column-count: 5;
  column-gap: 12px;
}
@media (max-width: 1280px) {
  div[style*="position: relative"][style*="max-height"] {
    column-count: 4;
  }
}
@media (max-width: 980px) {
  div[style*="position: relative"][style*="max-height"] {
    column-count: 3;
  }
}
@media (max-width: 680px) {
  div[style*="position: relative"][style*="max-height"] {
    column-count: 2;
  }
}

div[style*="position: absolute"][style*="writing-mode"] {
  position: static !important;
  width: auto !important;
  top: auto !important;
  left: auto !important;
  margin-bottom: 12px;
  break-inside: avoid;
  -webkit-column-break-inside: avoid;
}

a[data-role="image-card"] {
  display: block;
  width: 100%;
}
a[data-role="image-card"] img {
  width: 100% !important;
  height: auto !important;
  display: block;
}

/* ---------- 底部输入条 ---------- */
div[class*="fixed"][class*="bottom-"] {
  min-height: 48px;
}

/* ---------- 去掉顶部 banner 大图（用户要求） ---------- */
/* banner 是轮播容器里那张超大横图，隐藏它的容器整块 */
img[src*="/banner/"],
div:has(> img[src*="/banner/"]),
div[class*="banner"],
[class*="Banner"] {
  display: none !important;
}

/* banner 隐藏后留下的空位一并收掉 */
div[class*="overflow-hidden"]:has(img[src*="/banner/"]) {
  display: none !important;
}

/* ---------- 面板：提示词工具条 ---------- */
.lbgen-promptbar {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 8px;
}
.lbgen-mini {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  border: 1px solid rgba(0, 0, 0, 0.08);
  background: transparent;
  color: #787878;
  font-family: inherit;
  font-size: 12px;
  padding: 5px 10px;
  border-radius: 7px;
  cursor: pointer;
  transition: 0.15s;
}
.lbgen-mini:hover {
  color: #0f4fd9;
  border-color: rgba(31, 109, 255, 0.4);
  background: rgba(31, 109, 255, 0.05);
}
.lbgen-mini:active {
  transform: scale(0.97);
}
.lbgen-len {
  margin-left: auto;
  font-size: 11px;
  color: #a8a8a8;
  font-variant-numeric: tabular-nums;
}

/* tab 禁用态 */
.lbgen-tabs button.disabled,
.lbgen-tabs button:disabled {
  color: #c4c4c4;
  cursor: not-allowed;
  opacity: 0.55;
}
.lbgen-tabs button.disabled:hover {
  background: transparent;
  color: #c4c4c4;
}

/* 风格里「不加风格」的样式 */
.lbgen-styles button.none {
  font-style: italic;
  opacity: 0.85;
}

/* ---------- Lightbox 操作条 ---------- */
.lbgen-lb .bar {
  position: absolute;
  bottom: 28px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 8px;
  align-items: center;
}
.lbgen-lb .act {
  background: rgba(255, 255, 255, 0.16);
  color: #fff;
  border: 0;
  padding: 9px 20px;
  border-radius: 999px;
  font-size: 13px;
  font-family: inherit;
  text-decoration: none;
  cursor: pointer;
  backdrop-filter: blur(10px);
  transition: 0.15s;
  white-space: nowrap;
}
.lbgen-lb .act:hover:not(:disabled) {
  background: rgba(255, 255, 255, 0.3);
}
.lbgen-lb .act:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

/* ---------- 历史卡片按钮 ---------- */
.lbgen-hbtn {
  border: 0;
  background: rgba(0, 0, 0, 0.62);
  color: #fff;
  font-family: inherit;
  font-size: 11px;
  padding: 3px 8px;
  border-radius: 6px;
  cursor: pointer;
  backdrop-filter: blur(6px);
  transition: 0.15s;
}
.lbgen-hbtn:hover {
  background: rgba(0, 0, 0, 0.82);
}
.lbgen-hbtn.danger:hover {
  background: rgba(200, 40, 40, 0.9);
}

/* ---------- 第三方残留 ---------- */
.aliyunCaptcha-hidden,
.aliyunCaptcha-top,
.aliyunCaptcha-sliding-text-box,
[id^="aliyunCaptcha"],
iframe[src*="captcha"],
div[class*="captcha"] {
  display: none !important;
}

/* ---------- 滚动条 ---------- */
.mantine-AppShell-main {
  scrollbar-width: thin;
}
.mantine-AppShell-main::-webkit-scrollbar {
  width: 8px;
}
.mantine-AppShell-main::-webkit-scrollbar-thumb {
  background: rgba(0, 0, 0, 0.15);
  border-radius: 8px;
}

/* ================================================================
   创作面板
   ================================================================ */
.lbgen-mask {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  backdrop-filter: blur(2px);
  z-index: 8000;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.22s ease;
}
.lbgen-mask.open {
  opacity: 1;
  pointer-events: auto;
}

.lbgen-panel {
  position: fixed;
  left: calc(50% + 100px);
  top: 50%;
  transform: translate(-50%, calc(-50% + 16px)) scale(0.98);
  width: min(720px, calc(100vw - 232px));
  max-height: min(86vh, 780px);
  background: #fff;
  border-radius: 16px;
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.22);
  z-index: 8001;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.24s ease, transform 0.24s ease;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.lbgen-panel.open {
  opacity: 1;
  pointer-events: auto;
  transform: translate(-50%, -50%) scale(1);
}
[data-mantine-color-scheme="dark"] .lbgen-panel {
  background: #1c1c1c;
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.7);
}

.lbgen-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  border-bottom: 1px solid rgba(0, 0, 0, 0.06);
  flex-shrink: 0;
}
[data-mantine-color-scheme="dark"] .lbgen-head {
  border-bottom-color: rgba(255, 255, 255, 0.08);
}
.lbgen-tabs {
  display: flex;
  gap: 2px;
}
.lbgen-tabs button {
  border: 0;
  background: transparent;
  font-family: inherit;
  font-size: 13px;
  color: #787878;
  padding: 6px 14px;
  border-radius: 20px;
  cursor: pointer;
  transition: 0.16s;
}
.lbgen-tabs button:hover {
  color: #0d0d0d;
  background: rgba(0, 0, 0, 0.04);
}
.lbgen-tabs button.active {
  color: #0f4fd9;
  font-weight: 500;
}
.lbgen-x {
  border: 0;
  background: transparent;
  cursor: pointer;
  color: #787878;
  width: 30px;
  height: 30px;
  border-radius: 8px;
  display: grid;
  place-items: center;
}
.lbgen-x:hover {
  background: rgba(0, 0, 0, 0.06);
}

.lbgen-body {
  padding: 16px 18px 18px;
  overflow-y: auto;
  flex: 1;
}

.lbgen-prompt {
  width: 100%;
  min-height: 96px;
  resize: vertical;
  border: 1px solid rgba(0, 0, 0, 0.1);
  border-radius: 12px;
  padding: 12px 14px;
  font-family: inherit;
  font-size: 14px;
  line-height: 1.65;
  color: #0d0d0d;
  background: #f7f7f7;
  outline: none;
  transition: 0.18s;
  box-sizing: border-box;
}
[data-mantine-color-scheme="dark"] .lbgen-prompt {
  background: #141517;
  color: #f7f7f7;
  border-color: rgba(255, 255, 255, 0.12);
}
.lbgen-prompt::placeholder {
  color: #a8a8a8;
}
.lbgen-prompt:focus {
  border-color: #1f6dff;
  background: #fff;
  box-shadow: 0 0 0 3px rgba(31, 109, 255, 0.1);
}

.lbgen-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 12px;
  flex-wrap: wrap;
}
.lbgen-label {
  font-size: 12.5px;
  color: #787878;
  flex-shrink: 0;
}
.lbgen-seg {
  display: flex;
  gap: 2px;
  background: #f0f0f0;
  border-radius: 9px;
  padding: 3px;
}
[data-mantine-color-scheme="dark"] .lbgen-seg {
  background: #25262b;
}
.lbgen-seg button {
  border: 0;
  background: transparent;
  font-family: inherit;
  font-size: 12.5px;
  color: #787878;
  padding: 5px 11px;
  border-radius: 7px;
  cursor: pointer;
  transition: 0.16s;
  font-variant-numeric: tabular-nums;
}
.lbgen-seg button:hover {
  color: #0d0d0d;
}
.lbgen-seg button.active {
  background: #fff;
  color: #0f4fd9;
  font-weight: 500;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}
[data-mantine-color-scheme="dark"] .lbgen-seg button.active {
  background: #1c1c1c;
  color: #478eff;
}

.lbgen-styles {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  padding-bottom: 2px;
  scrollbar-width: none;
  flex: 1;
}
.lbgen-styles::-webkit-scrollbar {
  display: none;
}
.lbgen-styles button {
  flex-shrink: 0;
  border: 1px solid rgba(0, 0, 0, 0.08);
  background: transparent;
  font-family: inherit;
  font-size: 12.5px;
  color: #787878;
  padding: 5px 12px;
  border-radius: 20px;
  cursor: pointer;
  transition: 0.16s;
  white-space: nowrap;
}
.lbgen-styles button:hover {
  color: #0d0d0d;
  border-color: rgba(0, 0, 0, 0.16);
}
.lbgen-styles button.active {
  border-color: #1f6dff;
  color: #0f4fd9;
  background: rgba(31, 109, 255, 0.07);
  font-weight: 500;
}

.lbgen-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 18px;
  border-top: 1px solid rgba(0, 0, 0, 0.06);
  flex-shrink: 0;
}
[data-mantine-color-scheme="dark"] .lbgen-foot {
  border-top-color: rgba(255, 255, 255, 0.08);
}
.lbgen-cost {
  font-size: 12px;
  color: #a8a8a8;
}
.lbgen-cost b {
  color: #1f6dff;
  font-weight: 500;
}
.lbgen-go {
  border: 0;
  border-radius: 999px;
  background: #1f6dff;
  color: #fff;
  font-family: inherit;
  font-size: 14px;
  font-weight: 500;
  padding: 10px 28px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  transition: 0.18s;
  box-shadow: 0 3px 9px rgba(20, 24, 32, 0.14);
}
.lbgen-go:hover {
  filter: brightness(1.08);
  transform: translateY(-1px);
}
.lbgen-go:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  transform: none;
  filter: none;
}

/* ---------- 新卡片动画 / 骨架 ---------- */
.lbgen-new {
  animation: lbgenIn 0.35s ease both;
}
@keyframes lbgenIn {
  from {
    opacity: 0;
    transform: translateY(10px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: none;
  }
}
.lbgen-skel {
  border-radius: 6px;
  background: linear-gradient(100deg, #f0f0f0 30%, #e4e4e4 50%, #f0f0f0 70%);
  background-size: 200% 100%;
  animation: lbgenShimmer 1.4s infinite;
}
@keyframes lbgenShimmer {
  from {
    background-position: 200% 0;
  }
  to {
    background-position: -200% 0;
  }
}

/* ---------- toast ---------- */
.lbgen-toast {
  position: fixed;
  left: calc(50% + 100px);
  bottom: 96px;
  transform: translate(-50%, 14px);
  background: rgba(13, 13, 13, 0.92);
  color: #fff;
  font-size: 13px;
  padding: 10px 18px;
  border-radius: 10px;
  z-index: 9000;
  opacity: 0;
  pointer-events: none;
  transition: 0.24s;
  backdrop-filter: blur(10px);
  white-space: nowrap;
}
.lbgen-toast.show {
  opacity: 1;
  transform: translate(-50%, 0);
}
.lbgen-toast.err {
  background: rgba(200, 40, 40, 0.94);
}

/* ---------- 大图 ---------- */
.lbgen-lb {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.92);
  z-index: 9500;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  transition: 0.2s;
}
.lbgen-lb.open {
  opacity: 1;
  visibility: visible;
}
.lbgen-lb img {
  max-width: 90vw;
  max-height: 86vh;
  border-radius: 8px;
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.6);
}
.lbgen-lb .x {
  position: absolute;
  top: 22px;
  right: 24px;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 0;
  background: rgba(255, 255, 255, 0.14);
  color: #fff;
  cursor: pointer;
  display: grid;
  place-items: center;
}
.lbgen-lb .x:hover {
  background: rgba(255, 255, 255, 0.26);
}
.lbgen-lb .dl {
  position: absolute;
  bottom: 28px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(255, 255, 255, 0.16);
  color: #fff;
  padding: 9px 24px;
  border-radius: 999px;
  font-size: 13px;
  text-decoration: none;
  backdrop-filter: blur(10px);
}
.lbgen-lb .dl:hover {
  background: rgba(255, 255, 255, 0.3);
}
