/* 素材库：左文件夹树 / 中卡片网格 / 右详情；挑选框复用树和卡片 */
body:has(#view-assets:not(.hidden)) main { overflow: hidden; display: flex; flex-direction: column; }
#view-assets:not(.hidden) { flex: 1; min-height: 0; display: flex; flex-direction: column; }
/* 三栏板子吃满页头下面剩下的高 */
#view-assets:not(.hidden) > .page { flex: 1; min-height: 0; }
.as-page { flex: 1; min-height: 0; display: grid; grid-template-columns: 220px 1fr 300px; gap: 0;
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius-lg); overflow: hidden; }
.as-tree, .as-main, .as-detail {
  min-height: 0; overflow: auto; background: var(--panel); border: 0; border-radius: 0;
}
.as-page > .as-tree { background: var(--sunk); border-right: 1px solid var(--line); }
.as-page > .as-detail { border-left: 1px solid var(--line); }
.as-tree { padding: 8px; display: flex; flex-direction: column; gap: 2px; }
.as-node {
  display: flex; justify-content: space-between; align-items: center; gap: 8px; width: 100%;
  padding: 8px 8px; border: 0; background: transparent; border-radius: 6px; font-size: var(--fs-sm); color: var(--text);
}
.as-node em { font-style: normal; font-size: var(--fs-xs); color: var(--muted); }
.as-node:hover:not(:disabled) { background: rgba(22, 23, 26, .05); }
.as-node.on { background: #fff; color: var(--text); font-weight: 600; box-shadow: 0 0 0 1px var(--line); }
.as-node.d1 { font-weight: 600; }
.as-node.d2 { padding-left: 20px; }
.as-node.d3 { padding-left: 32px; color: var(--muted); }
.as-node.d3.on { color: var(--text); }
.as-main { padding: 16px; display: flex; flex-direction: column; gap: 16px; }
.as-top { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.as-top h2 { margin: 0; font-size: var(--fs-lg); }
.as-top h2 small { font-weight: 400; color: var(--muted); font-size: var(--fs-xs); margin-left: 8px; }

.as-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); grid-auto-rows: max-content; gap: 12px; align-content: start; }
.as-card { border: 0; border-radius: 4px; background: transparent; cursor: pointer; overflow: visible; }
.as-card .as-thumb { border-radius: 4px; overflow: hidden; box-shadow: 0 0 0 1px rgba(22, 23, 26, .08); transition: box-shadow var(--ease); }
.as-card:hover .as-thumb { box-shadow: 0 0 0 2px var(--text); }
.as-card:focus-visible { outline: none; }
.as-card.sel .as-thumb, .as-card:focus-visible .as-thumb { box-shadow: 0 0 0 2px var(--accent); }
.as-thumb { position: relative; height: 0; padding-top: 177.78%; background: var(--monitor); }
.as-thumb img, .as-thumb video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.as-thumb video { opacity: 0; }
.as-thumb video.on { opacity: 1; }
.as-kind, .as-dur, .as-b {
  position: absolute; padding: 0 4px; border-radius: 4px; font-size: var(--fs-xs); line-height: 18px;
}
.as-kind { left: 5px; top: 5px; color: #fff; }
.as-kind.ai { background: var(--accent); }
.as-kind.src { background: rgba(0, 0, 0, .6); }
.as-dur { right: 5px; bottom: 5px; background: rgba(0, 0, 0, .6); color: #fff; font-variant-numeric: tabular-nums; }
.as-b { right: 5px; top: 5px; }
.as-b.run { background: var(--run); color: #fff; }
.as-b.bad { background: var(--fail); color: #fff; }
.as-meta { padding: 8px 2px 4px; display: flex; flex-direction: column; gap: 2px; }
.as-meta b { font-size: var(--fs-xs); font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.as-meta small { font-size: var(--fs-xs); color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.as-fit { font-size: var(--fs-xs); color: var(--muted); }
.as-fit.ok { color: var(--ok); }
.as-fit.warn { color: var(--run); }

.as-detail { padding: 16px; display: flex; flex-direction: column; gap: 12px; }
.as-player { width: 100%; max-height: 46vh; background: var(--monitor); border-radius: 4px; }
.as-detail .field[hidden] { display: none; }
.as-tags { display: flex; flex-wrap: wrap; gap: 4px; margin: 0; }
.as-tags span { font-size: var(--fs-xs); padding: 1px 8px; border-radius: 10px; background: var(--sunk); color: var(--muted); }
.as-bad { color: var(--fail); font-size: var(--fs-xs); margin: 0; }
.as-row { display: flex; gap: 8px; flex-wrap: wrap; }
.as-row a.btn { text-decoration: none; }
.as-row a.off { pointer-events: none; opacity: .42; }
.as-multi-h { margin: 0; font-size: var(--fs-lg); }
.as-main .as-card { user-select: none; }
.as-danger { color: var(--fail); }

/* 挑选框 */
.as-pick { position: fixed; inset: 0; z-index: 55; background: rgba(22, 23, 26, .45); display: flex; align-items: center; justify-content: center; }
.as-pick-dlg {
  width: min(1100px, calc(100vw - 32px)); height: min(760px, calc(100vh - 48px)); display: flex; flex-direction: column;
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius-lg); overflow: hidden; box-shadow: var(--shadow-pop);
}
.as-pick-h { display: flex; align-items: center; gap: 12px; padding: 12px 16px; border-bottom: 1px solid var(--line); }
.as-pick-h h3 { margin: 0; font-size: var(--fs-md); }
.as-x { margin-left: auto; width: 30px; height: 30px; padding: 0; text-align: center; font-size: var(--fs-lg); border-radius: 6px; }
.as-pick-b { flex: 1; min-height: 0; display: grid; grid-template-columns: 200px 1fr; }
.as-pick-b .as-tree { border: 0; border-right: 1px solid var(--line); border-radius: 0; }
.as-pick-b .as-grid { overflow: auto; padding: 12px; }
.as-pick-f { display: flex; align-items: center; gap: 8px; padding: 12px 16px; border-top: 1px solid var(--line); font-size: var(--fs-sm); }
.as-pick-f span { margin-right: auto; }
.as-pick-f .btn { min-width: 88px; }

@media (max-width: 900px) {
  .as-page { grid-template-columns: 1fr; }
  .as-pick-b { grid-template-columns: 1fr; }
}
