.casebook-dialog { width: min(670px, calc(100% - 28px)); }
.casefile-dialog { width: min(580px, calc(100% - 28px)); }
.casebook-dialog .dialog-head, .casefile-dialog .dialog-head {
  margin: -24px -24px 20px;
  padding: 16px 22px;
  align-items: flex-start;
  background: var(--navy);
  color: var(--cream);
  border-bottom: 3px solid #b9d98c;
}
.casebook-dialog .dialog-head h2, .casefile-dialog .dialog-head h2 {
  margin: 0;
  line-height: 1.12;
  letter-spacing: -.035em;
}
.casebook-dialog .close-dialog, .casefile-dialog .close-dialog {
  flex-shrink: 0;
  width: 34px;
  height: 34px;
  border-color: #868298;
  background: transparent;
  color: var(--cream);
}
.book-tools {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 11px 15px;
}
.book-tools label, .book-related > span {
  font: 11px var(--mono);
  letter-spacing: .045em;
  text-transform: uppercase;
  color: #585363;
}
.book-tools label { display: grid; gap: 5px; min-width: 0; }
.book-search { grid-column: 1 / -1; }
.book-tools input, .book-tools select {
  width: 100%;
  min-width: 0;
  border: 1px solid #88838a;
  border-radius: 4px;
  background: #fffef9;
  color: var(--ink);
  font: 16px Outfit, system-ui, sans-serif;
  padding: 9px 10px;
}
.book-tools input:focus-visible, .book-tools select:focus-visible {
  outline: 2px solid #7153cf;
  outline-offset: 2px;
}
.book-status {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 5px 10px;
  min-height: 46px;
  padding: 8px 0;
  color: #56505d;
  font: 12px var(--mono);
}
#book-read { padding-left: 10px; border-left: 1px solid #aea9b1; }
#book-reset {
  margin-left: auto;
  padding: 4px 0;
  background: none;
  border: 0;
  text-decoration: underline;
  text-underline-offset: 3px;
}
.book-list {
  overflow-y: auto;
  max-height: min(45dvh, 460px);
  margin: 0;
  padding: 0;
  list-style: none;
  scrollbar-gutter: stable;
  overscroll-behavior: contain;
}
.book-list:not(:empty) { border-block: 1px solid #aba79c; }
.book-list li + li { border-top: 1px dashed #c3beb3; }
.book-list button {
  display: flex;
  align-items: center;
  gap: 11px;
  width: 100%;
  padding: 10px 9px;
  text-align: left;
  background: transparent;
  border: 0;
}
.book-list button:hover, .book-list button:focus-visible { background: #ececdf; }
.book-list button:focus-visible { outline-offset: -3px; }
.book-result-copy { display: grid; flex: 1; gap: 3px; min-width: 0; }
.book-result-copy strong { font-size: 17px; line-height: 1.22; }
.book-result-copy small { color: #5b5862; font-size: 13px; line-height: 1.25; }
.book-arrow { color: #60596c; font-size: 23px; }
.book-seen {
  background: #deebce;
  color: #3c5839;
  border-radius: 3px;
  padding: 3px 6px;
  font: 11px var(--mono);
}
#book-empty { margin: 0; padding: 15px 0; border-top: 1px solid #aba79c; }
.book-outcome { margin: 16px 0; padding: 12px 15px; background: #e8eedc; border-left: 3px solid #77965c; }
.book-outcome .file-heading { margin: 0 0 4px; }
.casefile-dialog .file-sources a { margin-top: 5px; }
.casefile-dialog .file-sources a span { display: inline; }
.book-later-source { margin-top: 10px; }
.book-actions { display: flex; flex-wrap: wrap; gap: 10px; }
.book-related { display: grid; gap: 4px; margin-bottom: 20px; }
.book-related button {
  justify-self: start;
  padding: 2px 0;
  text-align: start;
  color: #463b60;
  background: transparent;
  border: 0;
  text-decoration: underline;
  text-underline-offset: 3px;
}
@media (max-width: 620px), (pointer: coarse) {
  #book-reset, .book-related button, .book-tools input, .book-tools select { min-height: 44px; }
}
@media (max-width: 620px) {
  #nav-casebook { width: 36px; border: 1px solid #737184; border-radius: 4px; }
  #nav-casebook span { display: none; }
  .casebook-dialog .dialog-body, .casefile-dialog .dialog-body { padding: 15px; }
  .casebook-dialog .dialog-head, .casefile-dialog .dialog-head { margin: -15px -15px 15px; padding: 14px; }
  .casefile-dialog .dialog-head h2 { font-size: 24px; }
  .book-tools { gap: 9px; }
  .book-tools select { padding-inline: 5px; }
  .book-list button { padding-inline: 3px; }
  .book-status { font-size: 11px; gap: 5px 7px; }
}

@media (max-width: 390px) {
  #help { width: 36px; padding: 6px; }
  #help span { display: none; }
}
