.library-screen {
  grid-column: 1 / -1;
  width: 100%;
  min-width: 0;
  padding-bottom: 28px;
}

.library-tabs,
.library-toolbar-actions,
.library-dialog-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
}

.library-tabs { margin-bottom: 26px; }
.library-button {
  min-height: 42px;
  padding: 10px 16px;
  border: 1px solid rgba(255, 255, 255, .17);
  border-radius: 12px;
  background: rgba(255, 255, 255, .06);
  color: #fff;
  font: inherit;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
}
.library-button:hover { background: rgba(255, 255, 255, .12); }
.library-button[aria-current="page"],
.library-button-primary { background: #be0711; border-color: #e50914; }
.library-button-danger { color: #ffb3b8; border-color: #9d2730; }
.library-button:disabled { cursor: wait; opacity: .5; }
.library-button:focus-visible,
.library-collection:focus-visible,
.library-episode:focus-visible,
.library-field :is(input, select):focus-visible {
  outline: 3px solid #fff;
  outline-offset: 3px;
}

.library-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 24px;
}
.library-toolbar h3,
.library-empty h3 { margin: 0 0 8px; font-size: clamp(20px, 3vw, 27px); overflow-wrap: anywhere; }
.library-toolbar p,
.library-empty p { margin: 0; color: #b4b7be; line-height: 1.55; }
.library-empty {
  padding: clamp(24px, 5vw, 52px);
  border: 1px solid rgba(255, 255, 255, .12);
  border-radius: 20px;
  background: linear-gradient(135deg, rgba(229, 9, 20, .08), rgba(255, 255, 255, .025));
}
.library-empty p { max-width: 660px; margin-bottom: 20px; }
.library-hint { color: #b4b7be; font-size: 13px; line-height: 1.6; }
.library-status { margin: 16px 0 24px; color: #d4d6dc; line-height: 1.5; }
.library-warning { color: #ffda91; padding: 14px; border: 1px solid #755221; border-radius: 12px; line-height: 1.5; }
.library-error { color: #ffb3b8; line-height: 1.5; overflow-wrap: anywhere; }
.library-error:empty { display: none; }

.library-collections,
.library-items,
.library-episodes { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 240px), 1fr)); gap: 20px; }
.library-collection {
  display: grid;
  justify-items: start;
  gap: 12px;
  min-width: 0;
  min-height: 180px;
  padding: 24px;
  border: 1px solid rgba(255, 255, 255, .13);
  border-radius: 18px;
  background: #111214;
  color: #fff;
  text-align: left;
  cursor: pointer;
}
.library-collection:hover { border-color: #bb2733; background: #181416; }
.library-collection strong { font-size: 21px; overflow-wrap: anywhere; }
.library-collection > span:last-child { color: #b4b7be; font-size: 14px; }
.library-collection-mark {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: #460c12;
  color: #ff929c;
  font-size: 20px;
  font-weight: 800;
}
.library-item { min-width: 0; }
.library-item > .library-button { margin-top: 12px; }
.library-day { margin: 28px 0; }
.library-day > h3 { font-size: 20px; margin: 0 0 16px; }
.library-episode {
  display: grid;
  align-content: start;
  gap: 10px;
  min-width: 0;
  padding: 20px;
  border: 1px solid rgba(255, 255, 255, .13);
  border-radius: 16px;
  background: #111214;
  color: #fff;
  text-align: left;
  cursor: pointer;
}
.library-episode:hover { border-color: #bb2733; }
.library-episode strong { font-size: 18px; overflow-wrap: anywhere; }
.library-episode > span:last-child { color: #b4b7be; font-size: 14px; line-height: 1.5; overflow-wrap: anywhere; }
.library-episode-status { color: #ffa7ae; font-size: 12px; font-weight: 800; text-transform: uppercase; letter-spacing: .08em; }
.library-more { margin-top: 24px; }

.library-dialog {
  width: min(480px, calc(100vw - 32px));
  max-height: calc(100dvh - 48px);
  margin: auto;
  padding: 28px;
  border: 1px solid rgba(255, 255, 255, .2);
  border-radius: 20px;
  background: #111214;
  color: #fff;
  box-shadow: 0 28px 100px rgba(0, 0, 0, .65);
  overflow-y: auto;
}
.library-dialog::backdrop { background: rgba(0, 0, 0, .75); }
.library-dialog:not([open]) { display: none; }
.library-dialog h2 { margin: 0 0 12px; font-size: 24px; overflow-wrap: anywhere; }
.library-dialog p { color: #c4c6cd; line-height: 1.55; }
.library-dialog .library-error { color: #ffb3b8; }
.library-field { display: grid; gap: 9px; margin: 20px 0; font-size: 14px; font-weight: 700; }
.library-field input,
.library-field select {
  width: 100%;
  min-width: 0;
  min-height: 44px;
  padding: 11px 12px;
  border: 1px solid rgba(255, 255, 255, .25);
  border-radius: 10px;
  background: #1a1c20;
  color: #fff;
  font: inherit;
  font-size: 16px;
}
.library-dialog-actions { justify-content: flex-end; margin-top: 24px; }
@media (max-width: 420px) {
  .library-tabs > .library-button { flex: 1; padding-inline: 9px; }
  .library-toolbar-actions { gap: 8px; }
  .library-toolbar-actions .library-button { padding-inline: 12px; }
  .library-dialog { padding: 22px; }
}
