/* ============================================================================
   素材库页面
   左分类 / 右网格。全部颜色走变量，深色主题自动跟随。
   历史教训：这里写死颜色会在夜间主题下变成一块白板。
   ========================================================================== */

.asbody {
  height: 100vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* 顶部项目切换器（跟画布页同一个观感） */
header .pselect {
  max-width: 220px;
  font-size: 12px;
  padding: 4px 8px;
  border: 1px solid var(--line2);
  border-radius: 7px;
  background: var(--panel);
  color: var(--ink);
  font-family: inherit;
  cursor: pointer;
}
header .pselect:disabled {
  color: var(--ink3);
  cursor: default;
}

.aswrap {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
}

/* ------------------------------- 左分类 ------------------------------- */

.asside {
  flex: none;
  width: 208px;
  border-right: 1px solid var(--line);
  background: var(--panel2);
  display: flex;
  flex-direction: column;
  min-height: 0;
}
.assidehead {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 12px 12px 8px;
  font-size: 12px;
  color: var(--ink2);
}
.ascats {
  list-style: none;
  margin: 0;
  padding: 0 8px;
  overflow: auto;
  flex: 1 1 auto;
}
.ascat {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 7px 9px;
  border-radius: 8px;
  font-size: 12.5px;
  color: var(--ink2);
  cursor: pointer;
  user-select: none;
}
.ascat:hover {
  background: var(--hover);
  color: var(--ink);
}
.ascat.on {
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 600;
}
/* 拖拽归档：把卡片拖到左边的分类上，落点要高亮成一个"框"，否则不知道松手会去哪 */
.ascat.drop {
  background: var(--accent-soft);
  color: var(--accent);
  box-shadow: inset 0 0 0 1.5px var(--accent-line);
}
.asitem.dragging {
  opacity: 0.45;
}
.ascat .nm {
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.ascat .n {
  font-size: 10.5px;
  color: var(--ink3);
  font-weight: 400;
}
.ascat.on .n {
  color: var(--accent);
}
/* 操作按钮默认不占地方，指到哪一行才出来 */
.ascat .ops {
  display: none;
  gap: 2px;
}
.ascat:hover .ops {
  display: flex;
}
.ascat:hover .n {
  display: none;
}
.ascat .ico {
  border: 0;
  background: transparent;
  color: var(--ink3);
  cursor: pointer;
  font-size: 11px;
  padding: 2px 4px;
  border-radius: 5px;
  line-height: 1;
}
.ascat .ico:hover {
  background: var(--soft);
  color: var(--ink);
}
.astip {
  margin: 8px 12px 12px;
  font-size: 10.5px;
  line-height: 1.7;
  color: var(--ink3);
}

/* ------------------------------- 右网格 ------------------------------- */

.asmain {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  flex-direction: column;
  min-height: 0;
}
.astools {
  flex: none;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--line);
}
.astools input {
  width: 260px;
  max-width: 46vw;
}
.aspath {
  font-size: 11px;
  color: var(--ink3);
  font-family: ui-monospace, Menlo, Consolas, monospace;
}

.asgrid {
  flex: 1 1 auto;
  overflow: auto;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(194px, 1fr));
  gap: 14px;
  padding: 16px;
  align-content: start;
}

.asitem {
  margin: 0;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--panel);
  box-shadow: var(--shadow);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  min-width: 0;
}
.asitem .thumb {
  position: relative;
  aspect-ratio: 1 / 1;
  background: var(--sunken);
  cursor: zoom-in;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}
.asitem .thumb img,
.asitem .thumb video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.asitem .thumb .vtag {
  position: absolute;
  left: 7px;
  bottom: 7px;
  font-size: 10px;
  padding: 1px 6px;
  border-radius: 20px;
  background: rgba(0, 0, 0, 0.55);
  color: #fff;
}
.asitem figcaption {
  padding: 9px 10px 10px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}
.asitem .nm {
  font-size: 12px;
  color: var(--ink);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.asitem .meta {
  font-size: 10.5px;
  color: var(--ink3);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.asitem .ops {
  display: flex;
  gap: 4px;
  margin-top: 4px;
  flex-wrap: wrap;
}
.asitem .ops .btn {
  flex: 1 1 auto;
  padding: 4px 6px;
  font-size: 11px;
  text-align: center;
}
/* 删除只做"红字 + 指上去才红底"：全局 .btn.danger 是实心红块，
   放在这么小的卡片里会变成一个看不出字的红疙瘩 */
.asitem .ops .btn.del {
  color: var(--danger);
}
.asitem .ops .btn.del:hover {
  background: var(--danger-soft);
  color: var(--danger);
}

/* display:flex/grid 会盖掉 [hidden]，所以这两条必须写 */
.asgrid[hidden],
.asempty[hidden] {
  display: none !important;
}

.asempty {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  color: var(--ink3);
  font-size: 12px;
  text-align: center;
  padding: 40px;
}
.asempty b {
  font-size: 14px;
  color: var(--ink2);
}
.asempty .btn {
  margin-top: 10px;
}

/* ------------------------------- 大图 ------------------------------- */

.aslb {
  position: fixed;
  inset: 0;
  z-index: 200;
  /*
   * 半透明一律不行：0.88 时顶栏的「去画布 / 夜晚」会像鬼影浮在大图上，0.96 也还是能看出
   * 一块块更黑的字（2026-10-31 两次截图对比确认）。看图的场合就该只剩图和操作，所以直接不透明。
   */
  background: #0a0d13;
  display: flex;
  flex-direction: column;
}
.aslb[hidden] {
  display: none;
}
/*
 * 壳里：整块往下让出标题栏那一条。
 *
 * Windows 的最小化/最大化/关闭是**原生画的**（壳用 titleBarStyle:'hidden' +
 * titleBarOverlay），网页既盖不住也删不掉 —— 之前大图 inset:0 顶到窗口最上面，
 * 我们的「下载/关闭/圆圈×」正好压在那三个按钮底下（2026-11-01 用户截图）。
 * 让出 52px 之后两边各在各的位置上，谁也不挡谁。
 * 浏览器里没有 body.inshell，保持整屏覆盖。
 */
body.inshell .aslb {
  top: 52px;
}
.aslbbar {
  flex: none;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  color: #fff;
  font-size: 12.5px;
  /* 给右上角圆圈 × 让位，否则标题压到它身上 */
  padding-right: 72px;
}
/*
 * 深色遮罩上的按钮要单独配色。
 * 直接复用 .btn 的话在白天主题下是「深色字 + 白底」——白底那个还行，
 * 但 .btn.ghost 是「深色字 + 透明底」，贴在近黑背景上等于看不见（截图里「关闭」就是这样）。
 */
.aslbbar .btn {
  background: rgba(255, 255, 255, 0.16);
  border-color: rgba(255, 255, 255, 0.34);
  color: #fff;
}
.aslbbar .btn:hover {
  background: #fff;
  border-color: #fff;
  color: #111;
}
.aslbbar .btn.ghost {
  background: transparent;
  border-color: transparent;
  color: rgba(255, 255, 255, 0.86);
}
.aslbbar .btn.ghost:hover {
  background: rgba(255, 255, 255, 0.16);
  color: #fff;
}
.aslbbar .spacer {
  flex: 1 1 auto;
}
.aslbbody {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 20px 20px;
}
.aslbbody img,
.aslbbody video {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  border-radius: 8px;
}

/* 圆圈 × —— 大图上最像「关闭」的那个东西。
   做 40px 见方、白描边、深底，压在图片右上角外侧，永远不会被图片盖住。 */
.aslbx {
  position: absolute;
  right: 16px;
  top: 12px;
  z-index: 5;
  width: 40px;
  height: 40px;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  border: 1.5px solid rgba(255, 255, 255, 0.55);
  background: rgba(18, 24, 32, 0.55);
  color: #fff;
  font-family: inherit;
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
  transition: background .15s, color .15s, border-color .15s, transform .12s;
}
.aslbx:hover {
  background: #fff;
  color: #111;
  border-color: #fff;
}
.aslbx:active {
  transform: scale(0.94);
}
.aslbx:focus-visible {
  outline: 2px solid #fff;
  outline-offset: 2px;
}

/* ------------------------------- 确认框 ------------------------------- */

.asmask {
  position: fixed;
  inset: 0;
  z-index: 300;
  background: rgba(20, 22, 26, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
.asmodal {
  background: var(--panel);
  border-radius: 14px;
  padding: 20px 22px;
  max-width: 420px;
  width: 100%;
  box-shadow: var(--shadow);
}
.asmodal p {
  margin: 0 0 16px;
  font-size: 13px;
  line-height: 1.75;
  color: var(--ink);
}
.asmodal .row {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
}
