/* Zhuijuba Personal Library V6 — scoped, shared by desktop / phone / tablet */
#libraryModal.library-v6-host {
  --lv6-panel: #0f1b2b;
  --lv6-panel-2: #122238;
  --lv6-card: rgba(255,255,255,.025);
  --lv6-card-hover: rgba(255,255,255,.045);
  --lv6-text: #f5f8fc;
  --lv6-muted: #91a0b5;
  --lv6-faint: #66758a;
  --lv6-line: rgba(150,181,221,.16);
  --lv6-blue: #4d8cff;
  --lv6-blue-soft: rgba(77,140,255,.12);
  --lv6-blue-line: rgba(77,140,255,.82);
  --lv6-danger: #df4f63;
  --lv6-danger-hover: #ea6073;
  --lv6-success: #58d49c;
  --lv6-shadow: 0 24px 70px rgba(0,0,0,.48);
  --lv6-radius: 18px;
}

html[data-theme="light"] #libraryModal.library-v6-host {
  --lv6-panel: #ffffff;
  --lv6-panel-2: #f7f9fc;
  --lv6-card: #ffffff;
  --lv6-card-hover: #f8fbff;
  --lv6-text: #111827;
  --lv6-muted: #5f6f84;
  --lv6-faint: #8290a3;
  --lv6-line: #dce3ec;
  --lv6-blue-soft: rgba(77,140,255,.09);
  --lv6-blue-line: rgba(77,140,255,.72);
  --lv6-danger: #d8465b;
  --lv6-danger-hover: #c9384e;
  --lv6-success: #168b59;
  --lv6-shadow: 0 26px 70px rgba(31,50,76,.18);
}

#libraryModal .library-modal {
  width: min(1040px, calc(100vw - 32px));
  height: min(82dvh, 760px);
  max-height: calc(100dvh - 32px);
  padding: 0;
  overflow: hidden;
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr) auto;
  color: var(--lv6-text);
  background: var(--lv6-panel);
  border: 1px solid var(--lv6-line);
  border-radius: var(--lv6-radius);
  box-shadow: var(--lv6-shadow);
}

#libraryModal .library-v6-close {
  top: 18px;
  right: 18px;
  width: 40px;
  height: 40px;
  color: var(--lv6-muted);
  background: var(--lv6-card-hover);
  border: 1px solid var(--lv6-line);
  border-radius: 50%;
}

#libraryModal .library-v6-close:hover,
#libraryModal .library-v6-close:focus-visible { color: var(--lv6-text); border-color: var(--lv6-blue-line); outline: none; }

#libraryModal .library-v6-head {
  min-height: 104px;
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 22px 76px 16px 28px;
}

#libraryModal .library-v6-title-wrap { min-width: 0; }
#libraryModal .library-v6-eyebrow {
  display: block;
  margin-bottom: 3px;
  color: var(--lv6-blue);
  font-size: 11px;
  font-weight: 800;
  line-height: 1.2;
  letter-spacing: .14em;
}
#libraryModal .library-v6-title-wrap h2 { margin: 0; color: var(--lv6-text); font-size: 29px; line-height: 1.15; letter-spacing: -.02em; }

#libraryModal .library-v6-manage {
  min-width: 74px;
  height: 38px;
  margin-left: auto;
  padding: 0 16px;
  color: var(--lv6-blue);
  font-weight: 700;
  background: var(--lv6-blue-soft);
  border: 1px solid rgba(77,140,255,.34);
  border-radius: 10px;
}
#libraryModal .library-v6-manage:hover:not(:disabled),
#libraryModal .library-v6-manage:focus-visible { border-color: var(--lv6-blue); outline: none; }
#libraryModal .library-v6-manage:disabled { opacity: .42; cursor: not-allowed; }

#libraryModal .library-v6-tabs {
  display: flex;
  gap: 8px;
  padding: 0 28px 16px;
  border-bottom: 1px solid var(--lv6-line);
}
#libraryModal .library-v6-tabs button {
  min-width: 104px;
  height: 38px;
  padding: 0 16px;
  color: var(--lv6-muted);
  font-weight: 700;
  background: var(--lv6-card);
  border: 1px solid var(--lv6-line);
  border-radius: 999px;
}
#libraryModal .library-v6-tabs button.is-active { color: #fff; background: var(--lv6-blue); border-color: var(--lv6-blue); }
#libraryModal .library-v6-tabs button:focus-visible { outline: 2px solid var(--lv6-blue); outline-offset: 2px; }
#libraryModal .library-v6-tabs button:disabled { cursor: not-allowed; opacity: .6; }

#libraryModal .library-v6-body {
  min-height: 0;
  overflow: hidden;
  position: relative;
}

#libraryModal .library-v6-list {
  height: 100%;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  align-content: start;
  gap: 12px;
  padding: 18px 28px 24px;
  scrollbar-gutter: stable;
}
#libraryModal .library-v6-card {
  position: relative;
  min-width: 0;
  overflow: hidden;
  background: var(--lv6-card);
  border: 1px solid var(--lv6-line);
  border-radius: 14px;
  transition: border-color .16s ease, background .16s ease, box-shadow .16s ease;
}
#libraryModal .library-v6-card:hover { background: var(--lv6-card-hover); }
#libraryModal .library-v6-card.is-selected {
  background: var(--lv6-blue-soft);
  border-color: var(--lv6-blue-line);
  box-shadow: inset 0 0 0 1px rgba(77,140,255,.14);
}
#libraryModal .library-v6-card__link {
  min-width: 0;
  display: grid;
  grid-template-rows: 150px auto;
  color: inherit;
}
#libraryModal .library-v6-poster {
  position: relative;
  display: block;
  overflow: hidden;
  background: linear-gradient(145deg, rgba(77,140,255,.18), rgba(255,255,255,.03));
}
#libraryModal .library-v6-poster img { display: block; width: 100%; height: 100%; object-fit: cover; }
#libraryModal .library-v6-poster.is-fallback::after {
  content: "暂无海报";
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: var(--lv6-faint);
  font-size: 12px;
}
#libraryModal .library-v6-copy { min-width: 0; display: flex; flex-direction: column; padding: 11px 12px 13px; }
#libraryModal .library-v6-title {
  display: -webkit-box;
  min-height: 1.45em;
  overflow: hidden;
  color: var(--lv6-text);
  font-size: 14px;
  line-height: 1.45;
  font-weight: 750;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}
#libraryModal .library-v6-meta,
#libraryModal .library-v6-source { margin-top: 3px; overflow: hidden; color: var(--lv6-muted); font-size: 12px; line-height: 1.45; text-overflow: ellipsis; white-space: nowrap; }
#libraryModal .library-v6-source { color: var(--lv6-faint); font-size: 11px; }
#libraryModal .library-v6-watch { margin-top: 7px; color: #7eb0ff; font-size: 12px; font-weight: 700; }
html[data-theme="light"] #libraryModal .library-v6-watch { color: #2d6bc9; }
#libraryModal .library-v6-progress { height: 4px; margin-top: 6px; overflow: hidden; background: rgba(125,145,170,.24); border-radius: 999px; }
#libraryModal .library-v6-progress i { display: block; height: 100%; background: var(--lv6-blue); border-radius: inherit; }

#libraryModal .library-v6-check {
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 3;
  width: 44px;
  height: 44px;
  display: none;
  place-items: center;
  cursor: pointer;
}
#libraryModal .library-v6-check__input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
#libraryModal .library-v6-check__box {
  width: 23px;
  height: 23px;
  display: grid;
  place-items: center;
  color: transparent;
  font-size: 14px;
  font-weight: 900;
  background: rgba(10,18,29,.72);
  border: 2px solid rgba(190,204,222,.86);
  border-radius: 6px;
}
html[data-theme="light"] #libraryModal .library-v6-check__box { background: #fff; border-color: #8b9bb0; }
#libraryModal .library-v6-check__input:checked + .library-v6-check__box { color: #fff; background: var(--lv6-blue); border-color: var(--lv6-blue); }
#libraryModal .library-v6-check__input:focus-visible + .library-v6-check__box { outline: 2px solid var(--lv6-blue); outline-offset: 3px; }
#libraryModal .library-modal.is-managing .library-v6-check { display: grid; }
#libraryModal .library-modal.is-managing .library-v6-card { cursor: pointer; user-select: none; }
#libraryModal .library-modal.is-managing .library-v6-card__link { pointer-events: none; }

#libraryModal .library-v6-empty {
  position: absolute;
  inset: 0;
  display: grid;
  place-content: center;
  justify-items: center;
  padding: 36px;
  color: var(--lv6-muted);
  text-align: center;
}
#libraryModal .library-v6-empty[hidden] { display: none !important; }
#libraryModal .library-v6-empty-icon { width: 42px; height: 42px; display: grid; place-items: center; margin-bottom: 12px; color: var(--lv6-blue); background: var(--lv6-blue-soft); border-radius: 12px; }
#libraryModal .library-v6-empty strong { color: var(--lv6-text); font-size: 15px; }
#libraryModal .library-v6-empty p { margin-top: 4px; font-size: 12px; }

#libraryModal .library-v6-toolbar {
  position: relative;
  z-index: 6;
  min-height: 68px;
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 12px;
  padding: 11px 28px;
  background: color-mix(in srgb, var(--lv6-panel) 96%, transparent);
  border-top: 1px solid var(--lv6-line);
  backdrop-filter: blur(16px);
}
#libraryModal .library-v6-toolbar[hidden] { display: none !important; }
#libraryModal .library-v6-all { position: relative; min-height: 44px; display: inline-flex; align-items: center; gap: 9px; cursor: pointer; }
#libraryModal .library-v6-all input { position: absolute; width: 44px; height: 44px; opacity: 0; cursor: pointer; }
#libraryModal .library-v6-box { width: 22px; height: 22px; display: grid; place-items: center; color: transparent; border: 2px solid var(--lv6-muted); border-radius: 6px; font-size: 13px; font-weight: 900; }
#libraryModal .library-v6-all input:checked + .library-v6-box { color: #fff; background: var(--lv6-blue); border-color: var(--lv6-blue); }
#libraryModal .library-v6-all input:indeterminate + .library-v6-box { color: transparent; background: var(--lv6-blue); border-color: var(--lv6-blue); }
#libraryModal .library-v6-all input:indeterminate + .library-v6-box::after { content: ""; width: 10px; height: 2px; background: #fff; border-radius: 2px; }
#libraryModal .library-v6-all input:focus-visible + .library-v6-box { outline: 2px solid var(--lv6-blue); outline-offset: 3px; }
#libraryModal .library-v6-all strong { color: var(--lv6-text); font-size: 12px; }
#libraryModal .library-v6-selected { color: var(--lv6-muted); font-size: 12px; }
#libraryModal .library-v6-action {
  min-width: 180px;
  min-height: 42px;
  padding: 0 20px;
  color: #fff;
  font-weight: 750;
  background: var(--lv6-danger);
  border: 1px solid transparent;
  border-radius: 10px;
}
#libraryModal .library-v6-action:hover:not(:disabled) { background: var(--lv6-danger-hover); }
#libraryModal .library-v6-action:focus-visible { outline: 2px solid var(--lv6-danger); outline-offset: 2px; }
#libraryModal .library-v6-action:disabled { opacity: .42; cursor: not-allowed; }

#libraryModal .library-v6-feedback {
  position: absolute;
  right: 28px;
  bottom: 82px;
  z-index: 12;
  max-width: min(420px, calc(100% - 56px));
  padding: 11px 14px;
  color: var(--lv6-text);
  font-size: 12px;
  font-weight: 700;
  background: color-mix(in srgb, var(--lv6-panel-2) 94%, transparent);
  border: 1px solid color-mix(in srgb, var(--lv6-success) 52%, var(--lv6-line));
  border-radius: 11px;
  box-shadow: 0 12px 30px rgba(0,0,0,.2);
}
#libraryModal .library-v6-feedback.is-error { border-color: color-mix(in srgb, var(--lv6-danger) 62%, var(--lv6-line)); }
#libraryModal .library-v6-feedback[hidden] { display: none !important; }

#libraryModal .library-v6-confirm { position: absolute; inset: 0; z-index: 20; display: grid; place-items: center; padding: 24px; }
#libraryModal .library-v6-confirm[hidden] { display: none !important; }
#libraryModal .library-v6-confirm__backdrop { position: absolute; inset: 0; background: rgba(3,8,16,.62); backdrop-filter: blur(5px); }
#libraryModal .library-v6-confirm__dialog { position: relative; width: min(390px, 100%); padding: 22px; color: var(--lv6-text); background: var(--lv6-panel); border: 1px solid var(--lv6-line); border-radius: 15px; box-shadow: var(--lv6-shadow); }
#libraryModal .library-v6-confirm__dialog h3 { margin: 0; font-size: 18px; }
#libraryModal .library-v6-confirm__dialog p { margin: 8px 0 0; color: var(--lv6-muted); font-size: 13px; line-height: 1.6; }
#libraryModal .library-v6-confirm__actions { display: flex; justify-content: flex-end; gap: 9px; margin-top: 20px; }
#libraryModal .library-v6-confirm__actions button { min-width: 84px; min-height: 40px; padding: 0 14px; font-weight: 700; border-radius: 9px; }
#libraryModal .library-v6-confirm-cancel { color: var(--lv6-text); background: var(--lv6-card); border: 1px solid var(--lv6-line); }
#libraryModal .library-v6-confirm-delete { color: #fff; background: var(--lv6-danger); }
#libraryModal .library-v6-confirm__actions button:focus-visible { outline: 2px solid var(--lv6-blue); outline-offset: 2px; }

#libraryModal .library-v6-skeleton { grid-column: 1 / -1; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
#libraryModal .library-v6-skeleton i { height: 236px; border-radius: 14px; background: linear-gradient(90deg, var(--lv6-card) 20%, var(--lv6-card-hover) 50%, var(--lv6-card) 80%); background-size: 220% 100%; animation: libraryV6Skeleton 1.2s linear infinite; }
@keyframes libraryV6Skeleton { to { background-position: -220% 0; } }

@media (max-width: 1099px) {
  #libraryModal .library-modal { width: min(900px, calc(100vw - 24px)); height: min(88dvh, 760px); }
  #libraryModal .library-v6-list,
  #libraryModal .library-v6-skeleton { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  #libraryModal .library-v6-card__link { min-height: 126px; grid-template-columns: 92px minmax(0, 1fr); grid-template-rows: auto; }
  #libraryModal .library-v6-poster { height: 126px; }
  #libraryModal .library-v6-copy { justify-content: center; padding: 12px 54px 12px 12px; }
  #libraryModal .library-v6-skeleton i { height: 126px; }
}

@media (max-width: 680px) {
  #libraryModal.site-modal { align-items: stretch; padding: max(8px, env(safe-area-inset-top)) 8px max(8px, env(safe-area-inset-bottom)); }
  #libraryModal .library-modal {
    width: 100%;
    height: calc(100dvh - max(16px, env(safe-area-inset-top)) - max(16px, env(safe-area-inset-bottom)));
    max-height: none;
    border-radius: 16px;
  }
  #libraryModal .library-v6-head { min-height: 88px; padding: 18px 62px 12px 18px; }
  #libraryModal .library-v6-title-wrap h2 { font-size: 25px; }
  #libraryModal .library-v6-close { top: 14px; right: 14px; }
  #libraryModal .library-v6-manage { min-width: 66px; height: 36px; padding: 0 12px; }
  #libraryModal .library-v6-tabs { gap: 6px; padding: 0 18px 13px; }
  #libraryModal .library-v6-tabs button { min-width: 0; flex: 1 1 0; height: 38px; padding: 0 7px; font-size: 12px; }
  #libraryModal .library-v6-list,
  #libraryModal .library-v6-skeleton { grid-template-columns: minmax(0, 1fr); }
  #libraryModal .library-v6-list { gap: 9px; padding: 12px 14px 18px; }
  #libraryModal .library-v6-card__link { min-height: 112px; grid-template-columns: 82px minmax(0,1fr); }
  #libraryModal .library-v6-poster { height: 112px; }
  #libraryModal .library-v6-copy { padding: 10px 50px 10px 11px; }
  #libraryModal .library-v6-title { font-size: 14px; }
  #libraryModal .library-v6-meta,
  #libraryModal .library-v6-watch { font-size: 12px; }
  #libraryModal .library-v6-source { display: none; }
  #libraryModal .library-v6-skeleton i { height: 112px; }
  #libraryModal .library-v6-toolbar {
    grid-template-columns: auto 1fr;
    gap: 6px 10px;
    padding: 9px 14px calc(9px + env(safe-area-inset-bottom));
  }
  #libraryModal .library-v6-selected { text-align: right; }
  #libraryModal .library-v6-action { grid-column: 1 / -1; width: 100%; min-height: 44px; }
  #libraryModal .library-v6-feedback { right: 14px; bottom: calc(116px + env(safe-area-inset-bottom)); max-width: calc(100% - 28px); }
}

@media (max-height: 620px) and (min-width: 681px) {
  #libraryModal .library-modal { height: calc(100dvh - 20px); }
  #libraryModal .library-v6-head { min-height: 82px; padding-top: 14px; padding-bottom: 10px; }
  #libraryModal .library-v6-tabs { padding-bottom: 10px; }
}

@media (prefers-reduced-motion: reduce) {
  #libraryModal *, #libraryModal *::before, #libraryModal *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; }
}


/* =========================================================
   Personal Library V6.1 — card height / scroll fix
   2026-09-25

   Root fix:
   the list itself previously had `height:100%` + its own scrolling.
   In the live modal this allowed CSS Grid rows to be compressed by
   the constrained body height, producing the thin "poster strips"
   seen on desktop, tablet and phone.

   V6.1 makes the BODY the single scroll container and lets the grid
   size its rows from real card content.
   ========================================================= */

#libraryModal .library-v6-body {
  overflow-x: hidden !important;
  overflow-y: auto !important;
  overscroll-behavior: contain;
  scrollbar-gutter: stable;
}

#libraryModal .library-v6-list {
  height: auto !important;
  min-height: 100% !important;
  overflow: visible !important;
  grid-auto-rows: max-content !important;
  align-items: start !important;
  align-content: start !important;
  scrollbar-gutter: auto !important;
}

#libraryModal .library-v6-card {
  height: auto !important;
  min-height: 238px;
  align-self: start !important;
}

#libraryModal .library-v6-card__link {
  height: auto !important;
  min-height: 238px !important;
  grid-template-rows: 150px minmax(88px, auto) !important;
}

#libraryModal .library-v6-poster {
  min-height: 150px;
}

/* Tablet: compact horizontal cards, never vertically compressed. */
@media (max-width: 1099px) {
  #libraryModal .library-v6-card {
    min-height: 126px;
  }

  #libraryModal .library-v6-card__link {
    min-height: 126px !important;
    grid-template-rows: auto !important;
  }

  #libraryModal .library-v6-poster {
    min-height: 126px;
  }
}

/* Phone: one-column compact rows. */
@media (max-width: 680px) {
  #libraryModal .library-v6-card {
    min-height: 112px;
  }

  #libraryModal .library-v6-card__link {
    min-height: 112px !important;
  }

  #libraryModal .library-v6-poster {
    min-height: 112px;
  }
}

/* The check glyph is an existing grid item; position the mixed-state dash independently. */
#libraryModal .library-v6-box{position:relative;box-sizing:border-box;flex:none}#libraryModal .library-v6-all input:indeterminate+.library-v6-box{font-size:0}#libraryModal .library-v6-all input:indeterminate+.library-v6-box::after{position:absolute;left:50%;top:50%;transform:translate(-50%,-50%);display:block;width:10px;height:2px;margin:0}

/* Fix the dialog to the visual viewport, independent of page and tablet modal layouts. */
#libraryModal.library-v6-host .library-modal{position:fixed!important;inset:0!important;margin:auto!important;width:min(1040px,calc(100vw - 32px))!important;height:min(82dvh,760px)!important;max-height:calc(100dvh - 32px)!important;transform:none!important}
@media(max-width:680px){#libraryModal.library-v6-host .library-modal{width:calc(100vw - 24px)!important;height:min(86dvh,760px)!important;max-height:calc(100dvh - 24px)!important}}
