/* ===== 作品库 ===== */
* { box-sizing: border-box; }
html, body {
  margin: 0;
  height: 100%;
  background: #0b0e13;
  color: #e8edf6;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  font-size: 13px;
}

.lib-wrap {
  min-height: 100%;
  display: flex;
  flex-direction: column;
}

.lib-topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 14px;
  height: 60px;
  padding: 0 26px;
  background: rgba(13, 17, 23, .88);
  border-bottom: 1px solid #1d2531;
  backdrop-filter: blur(12px);
}
.brand {
  display: flex;
  align-items: center;
  gap: 9px;
  font-size: 14.5px;
  font-weight: 700;
  letter-spacing: .3px;
}
.brand-mark {
  width: 26px;
  height: 26px;
  border-radius: 8px;
  background: conic-gradient(from 210deg, #6c8cff, #22d3ee, #6c8cff);
  position: relative;
  box-shadow: 0 0 16px rgba(108, 140, 255, .45);
}
.brand-mark::after {
  content: '';
  position: absolute;
  inset: 6px;
  border-radius: 50%;
  border: 1.5px solid rgba(9, 12, 18, .92);
}
.brand-sub {
  font-size: 10px;
  font-weight: 500;
  color: #6b7a91;
  letter-spacing: 1.2px;
  text-transform: uppercase;
}
.spacer { flex: 1; }

.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 34px;
  padding: 0 14px;
  border-radius: 9px;
  border: 1px solid #2a3442;
  background: #1a212b;
  color: #d9e2f0;
  font-size: 12.5px;
  font-family: inherit;
  cursor: pointer;
  white-space: nowrap;
  transition: background .15s, border-color .15s, transform .1s;
}
.btn:hover { background: #222b38; border-color: #38465a; }
.btn:active { transform: scale(.98); }
.btn svg { width: 15px; height: 15px; }
.btn.primary {
  background: linear-gradient(180deg, #5d7dfa, #4a66e0);
  border-color: #6a86ff;
  color: #fff;
  box-shadow: 0 4px 14px rgba(76, 102, 224, .35);
}
.btn.primary:hover { background: linear-gradient(180deg, #6a89ff, #5270ea); }
.btn.ghost { background: transparent; border-color: transparent; color: #9aa8bd; }
.btn.ghost:hover { background: rgba(255, 255, 255, .06); }
.btn.big { height: 44px; padding: 0 22px; font-size: 14px; }

.lib-main {
  flex: 1;
  width: 100%;
  max-width: 1320px;
  margin: 0 auto;
  padding: 30px 26px 60px;
}

.lib-head {
  display: flex;
  align-items: baseline;
  gap: 14px;
  margin-bottom: 22px;
}
.lib-head h1 {
  margin: 0;
  font-size: 21px;
  font-weight: 600;
  letter-spacing: .3px;
}
.lib-head .count {
  font-size: 12px;
  color: #7c8ba2;
  background: #171f29;
  border: 1px solid #232d3b;
  border-radius: 999px;
  padding: 2px 9px;
  vertical-align: middle;
  margin-left: 6px;
}
.lib-head .lib-sub {
  color: #63718a;
  font-size: 12.5px;
  margin-left: auto;
}

.proj-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(268px, 1fr));
  gap: 20px;
}

.card {
  position: relative;
  border-radius: 14px;
  overflow: hidden;
  background: #131a23;
  border: 1px solid #1f2835;
  cursor: pointer;
  transition: transform .16s ease, border-color .16s, box-shadow .16s;
}
.card:hover {
  transform: translateY(-3px);
  border-color: #35435a;
  box-shadow: 0 18px 40px rgba(0, 0, 0, .45);
}

.card-cover {
  position: relative;
  aspect-ratio: 16 / 9;
  background: #0e141c;
  overflow: hidden;
}
.card-cover img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform .4s ease, opacity .2s;
}
.card:hover .card-cover img { transform: scale(1.04); }
.card-cover .no-cover {
  width: 100%;
  height: 100%;
  display: grid;
  place-items: center;
  color: #3d4b60;
  background:
    radial-gradient(circle at 30% 25%, rgba(108, 140, 255, .18), transparent 55%),
    repeating-linear-gradient(45deg, #121a24, #121a24 6px, #0f1520 6px, #0f1520 12px);
  font-size: 12px;
}
.card-badge {
  position: absolute;
  left: 10px;
  top: 10px;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 11px;
  color: #dbe4f3;
  background: rgba(9, 13, 19, .68);
  border: 1px solid rgba(255, 255, 255, .14);
  backdrop-filter: blur(6px);
}

.card-actions {
  position: absolute;
  inset: auto 0 0 0;
  display: flex;
  gap: 8px;
  padding: 12px;
  background: linear-gradient(to top, rgba(6, 9, 14, .9), rgba(6, 9, 14, 0));
  opacity: 0;
  transform: translateY(6px);
  transition: opacity .18s, transform .18s;
}
.card:hover .card-actions { opacity: 1; transform: none; }
.card-actions button {
  height: 30px;
  padding: 0 12px;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, .18);
  background: rgba(22, 29, 39, .85);
  color: #e6ecf7;
  font-size: 12px;
  font-family: inherit;
  cursor: pointer;
}
.card-actions button:hover { background: rgba(50, 62, 82, .95); }
.card-actions button.primary {
  background: linear-gradient(180deg, #5d7dfa, #4a66e0);
  border-color: #6a86ff;
  color: #fff;
}
.card-actions .more { margin-left: auto; width: 32px; padding: 0; font-size: 15px; line-height: 1; }

.card-body { padding: 12px 14px 14px; }
.card-body h3 {
  margin: 0 0 5px;
  font-size: 14px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.card-meta { font-size: 11.5px; color: #6d7c93; }

/* 空状态 */
.lib-empty {
  display: none;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 70px 20px 40px;
}
.lib-empty.is-on { display: flex; }
.lib-empty .art {
  width: 96px;
  height: 96px;
  border-radius: 28px;
  margin-bottom: 22px;
  display: grid;
  place-items: center;
  background:
    radial-gradient(circle at 32% 26%, rgba(108, 140, 255, .42), transparent 60%),
    radial-gradient(circle at 70% 78%, rgba(34, 211, 238, .3), transparent 62%),
    #121a24;
  border: 1px solid rgba(108, 140, 255, .28);
  box-shadow: 0 18px 50px rgba(60, 90, 200, .22);
}
.lib-empty .art svg { width: 44px; height: 44px; color: #a9bbff; }
.lib-empty h2 { margin: 0 0 10px; font-size: 19px; font-weight: 600; }
.lib-empty p { margin: 0 0 22px; color: #7b8aa1; font-size: 13px; line-height: 1.9; }
.lib-empty p.tiny { margin: 20px 0 0; font-size: 11.5px; color: #4d5b70; }

.lib-foot {
  margin-top: 40px;
  padding-top: 18px;
  border-top: 1px solid #1a222d;
  color: #4f5d72;
  font-size: 11.5px;
  line-height: 1.9;
}

/* 卡片菜单 */
.card-menu {
  position: fixed;
  z-index: 300;
  min-width: 172px;
  padding: 6px;
  border-radius: 10px;
  background: #182028;
  border: 1px solid #2b3646;
  box-shadow: 0 18px 40px rgba(0, 0, 0, .55);
}
.card-menu button {
  display: block;
  width: 100%;
  text-align: left;
  padding: 8px 10px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: #d6e0ef;
  font-size: 12.5px;
  font-family: inherit;
  cursor: pointer;
}
.card-menu button:hover { background: rgba(255, 255, 255, .08); }
.card-menu button.danger { color: #ff9b9b; }

/* 拖拽遮罩 */
.drop-mask {
  position: fixed;
  inset: 0;
  z-index: 400;
  display: none;
  place-content: center;
  background: rgba(10, 16, 26, .84);
  border: 2px dashed #4c6bd8;
  color: #cdd9f0;
  font-size: 16px;
  pointer-events: none;
}
.drop-mask.is-on { display: grid; }

/* 进度 */
.progress-mask {
  position: fixed;
  inset: 0;
  z-index: 500;
  display: none;
  place-items: center;
  background: rgba(8, 11, 16, .78);
  backdrop-filter: blur(3px);
}
.progress-mask.is-on { display: grid; }
.progress-box {
  width: min(380px, calc(100vw - 48px));
  padding: 26px 26px 22px;
  border-radius: 16px;
  background: #131a24;
  border: 1px solid #27313f;
  text-align: center;
  box-shadow: 0 30px 80px rgba(0, 0, 0, .6);
}
.progress-box .spinner {
  width: 34px;
  height: 34px;
  margin: 0 auto 16px;
  border-radius: 50%;
  border: 2.5px solid rgba(255, 255, 255, .16);
  border-top-color: #6c8cff;
  animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.progress-box h3 { margin: 0 0 8px; font-size: 15px; }
.progress-box p { margin: 0; color: #8b9ab0; font-size: 12.5px; }

/* 弹窗 */
.modal-mask {
  position: fixed;
  inset: 0;
  z-index: 600;
  display: none;
  place-items: center;
  background: rgba(5, 8, 12, .66);
  backdrop-filter: blur(3px);
}
.modal-mask.is-on { display: grid; }
.modal {
  width: min(560px, calc(100vw - 40px));
  max-height: 82vh;
  overflow-y: auto;
  padding: 24px;
  border-radius: 16px;
  background: #131a24;
  border: 1px solid #27313f;
  box-shadow: 0 30px 80px rgba(0, 0, 0, .6);
}
.modal h3 { margin: 0 0 16px; font-size: 16px; }
.modal dl { margin: 0; display: grid; grid-template-columns: auto 1fr; gap: 11px 18px; font-size: 12.5px; }
.modal dt { color: #a8b7cd; white-space: nowrap; }
.modal dd { margin: 0; color: #7d8da5; line-height: 1.7; }
.modal .close-row { margin-top: 20px; text-align: right; }
.modal kbd {
  display: inline-block;
  padding: 1px 5px;
  border-radius: 4px;
  background: #222c39;
  border: 1px solid #354152;
  border-bottom-width: 2px;
  font-size: 10.5px;
  font-family: inherit;
  color: #c5d2e6;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 34px;
  transform: translateX(-50%);
  z-index: 700;
  padding: 11px 18px;
  border-radius: 10px;
  background: rgba(24, 30, 40, .96);
  border: 1px solid rgba(255, 255, 255, .14);
  box-shadow: 0 12px 30px rgba(0, 0, 0, .45);
  font-size: 13px;
  transition: opacity .3s, transform .3s;
}
.toast.is-out { opacity: 0; transform: translate(-50%, 10px); }

@media (max-width: 640px) {
  .lib-main { padding: 20px 14px 40px; }
  .lib-head { flex-direction: column; align-items: flex-start; gap: 6px; }
  .lib-head .lib-sub { margin-left: 0; }
  .lib-topbar { padding: 0 12px; gap: 6px; height: 56px; }
  .brand-name, .brand-sub, #btn-help { display: none; }
  .btn { padding: 0 11px; font-size: 12px; }
  .proj-grid { grid-template-columns: 1fr; }
}
