#sources-dialog {
  --source-ink: #242821;
  --source-paper: #f6f3e8;
  --source-rule: #d6d3c7;
  position: fixed;
  inset: 0 0 0 auto;
  margin: 0;
  width: min(35rem, 100%);
  height: 100%;
  max-height: 100dvh;
  max-width: 100%;
  padding: 0;
  overflow: hidden;
  border: 0;
  border-left: 1px solid var(--source-rule);
  border-radius: 0;
  color: var(--source-ink);
  background: var(--source-paper);
}
#sources-dialog[open] {
  display: flex;
  flex-direction: column;
}
#sources-dialog::backdrop {
  background: rgb(15 19 16 / 72%);
}
.source-library-head {
  flex: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1.1rem clamp(1rem, 3vw, 2rem);
  background: #20251f;
  color: #f6f3e8;
}
#sources-title {
  margin: 0;
  font: 500 clamp(1.6rem, 3vw, 2rem) / 1.1 var(--display, sans-serif);
}
#close-sources {
  padding: 0.55rem 0.85rem;
  border: 1px solid #72796d;
  border-radius: 3px;
  background: transparent;
  color: inherit;
  font: 500 1rem var(--sans, sans-serif);
}
#close-sources:hover {
  background: #343c31;
}
.source-library-list {
  list-style: none;
  margin: 0;
  padding: 0.3rem clamp(1rem, 3vw, 2rem) max(1rem, env(safe-area-inset-bottom));
  overflow-y: auto;
  overscroll-behavior: contain;
}
.source-library-list li {
  padding: 0.75rem 0;
  border-bottom: 1px solid var(--source-rule);
}
.source-library-pick {
  display: grid;
  width: 100%;
  grid-template-columns: 5.5rem minmax(0, 1fr);
  gap: 1rem;
  align-items: center;
  padding: 0.4rem 0;
  border: 0;
  background: transparent;
  color: var(--source-ink);
  text-align: left;
}
.source-library-pick:hover strong {
  text-decoration: underline;
  text-underline-offset: 0.2em;
}
.source-library-thumb {
  width: 100%;
  aspect-ratio: 3 / 2;
  display: grid;
  align-content: center;
  justify-items: center;
  overflow: hidden;
  background: #fff;
  border: 1px solid var(--source-rule);
}
.source-library-thumb img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}
.source-library-thumb[data-kind] {
  background: #eae0ce;
  color: #43382e;
  padding: 0.45rem;
  font:
    italic 1rem Georgia,
    serif;
}
.source-library-thumb[data-kind="critic"] {
  background: #e1e6d9;
  color: #303d31;
}
.source-library-thumb i {
  width: 70%;
  height: 0.52rem;
  margin-top: 0.35rem;
  border-block: 1px solid currentColor;
  opacity: 0.45;
}
.source-library-copy {
  display: grid;
  gap: 0.18rem;
}
.source-library-meta {
  color: #565c51;
  font: 400 0.76rem/1.35 var(--mono, monospace);
}
.source-library-copy strong {
  font: 500 1.17rem/1.19 var(--sans, sans-serif);
}
.source-library-extract {
  font: 400 1rem/1.4 var(--sans, sans-serif);
  color: #484d43;
}
.source-library-credit {
  margin: 0.35rem 0 0 6.5rem;
  font: 400 0.8rem/1.5 var(--sans, sans-serif);
  color: #4d5447;
}
.source-library-credit a {
  color: inherit;
}
#inventory-notes {
  border-block: 1px solid var(--line, #bdbfb4);
  margin-block: 1.25rem;
}
#inventory-notes summary {
  padding-block: 0.85rem;
  font-weight: 600;
}
#audit-contents {
  padding-bottom: 1rem;
}
#inventory-audit {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 0.95rem;
}
#inventory-audit caption {
  text-align: left;
  padding: 0.25rem 0 0.75rem;
}
#inventory-audit th,
#inventory-audit td {
  padding: 0.55rem 0.6rem;
  border-bottom: 1px solid var(--line, #bdbfb4);
}
#inventory-audit thead th {
  font-weight: 500;
}
#inventory-audit tbody th small {
  display: block;
  margin-top: 0.1rem;
  font: 400 0.78rem/1.4 var(--mono, monospace);
}
#inventory-audit tr[data-selected="true"] {
  background: #dfecdc;
  color: #213622;
}
@media (max-width: 620px) {
  #sources-dialog {
    inset: auto 0 0;
    height: min(88dvh, 46rem);
    width: 100%;
    border: 0;
    border-top: 1px solid var(--source-rule);
    border-radius: 0.9rem 0.9rem 0 0;
  }
  .source-library-pick {
    grid-template-columns: 4rem minmax(0, 1fr);
    gap: 0.75rem;
  }
  .source-library-credit {
    margin-left: 0;
  }
  #inventory-audit,
  #inventory-audit tbody {
    display: block;
  }
  #inventory-audit caption {
    display: block;
  }
  #inventory-audit thead {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip-path: inset(50%);
  }
  #inventory-audit tbody tr {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.15rem 0.8rem;
    border-top: 1px solid var(--line, #bdbfb4);
    padding: 0.65rem;
  }
  #inventory-audit tbody th,
  #inventory-audit tbody td {
    border: 0;
    padding: 0.1rem 0;
  }
  #inventory-audit tbody th,
  #inventory-audit td:last-child {
    grid-column: 1 / -1;
  }
  #inventory-audit tbody th small {
    margin-left: 0.5rem;
    display: inline;
  }
  #inventory-audit td::before {
    content: attr(data-label) " ";
    font: 400 0.8rem var(--sans, sans-serif);
    color: #4c5148;
  }
}
