.shelf-heading {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 20px;
}
.shelf-heading h1 {
  margin-bottom: 0;
}
.shelf-page > .page-description {
  margin: 20px 0 32px;
}
.shelf-button {
  min-height: 44px;
  border: 1px solid var(--line);
  background: var(--bg);
  padding: 8px 13px;
  font-size: 14px;
  line-height: 1.6;
  display: inline-block;
  cursor: pointer;
}
.shelf-button:hover {
  border-color: var(--accent);
  color: var(--accent);
}
.shelf-tools {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 24px;
}
.search-label {
  position: relative;
  display: block;
  flex: 1;
  max-width: 550px;
  font-size: 14px;
  color: var(--muted);
}
.search-label input {
  margin-top: 8px;
  padding: 13px 110px 13px 15px;
  width: 100%;
  border: 1px solid var(--line);
  background: var(--bg);
  color: var(--text);
  font: inherit;
  font-size: 15px;
}
.search-label kbd {
  position: absolute;
  right: 12px;
  bottom: 15px;
  font-size: 12px;
}
.shelf-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}
.shelf-notice {
  font-size: 13px;
  padding: 13px 16px;
  border: 1px solid var(--line);
  background: var(--surface);
}
.shelf-layout {
  display: grid;
  grid-template-columns: 190px minmax(0, 1fr);
  gap: 40px;
  border-top: 1px solid var(--line);
  padding-top: 28px;
}
.filter-heading {
  font-size: 13px;
  margin: 0 0 12px;
}
.book-groups {
  display: flex;
  flex-direction: column;
  gap: 5px;
  margin-bottom: 24px;
}
.group-button {
  min-height: 44px;
  text-align: left;
  font: inherit;
  font-size: 14px;
  padding: 8px 10px;
  border: 0;
  background: transparent;
}
.group-button[aria-pressed="true"] {
  color: var(--accent);
  background: var(--surface);
}
.filter-label {
  display: block;
  font-size: 14px;
  color: var(--muted);
  margin-bottom: 18px;
}
.filter-label select {
  display: block;
  margin-top: 8px;
  width: 100%;
  padding: 9px 7px;
  color: var(--text);
  background: var(--bg);
  border: 1px solid var(--line);
  font: inherit;
}
.shelf-views {
  display: flex;
  gap: 20px;
  flex-wrap: wrap;
  border-bottom: 1px solid var(--line);
  padding-bottom: 14px;
}
.shelf-views button {
  min-height: 44px;
  font: inherit;
  font-size: 14px;
  border: 0;
  background: transparent;
  padding: 0 0 4px;
}
.shelf-views button[aria-pressed="true"] {
  color: var(--accent);
  box-shadow: 0 1px var(--accent);
}
.book-count {
  font-size: 14px;
  color: var(--muted);
  margin: 18px 0 24px;
}
.book-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 36px 26px;
}
.book-open {
  border: 0;
  background: transparent;
  padding: 0;
  text-align: left;
  width: 100%;
  font: inherit;
}
.book-cover {
  aspect-ratio: 3/4;
  position: relative;
  background: var(--surface);
  overflow: hidden;
}
.cover-placeholder {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  border: 1px solid var(--line);
  padding: 20px 16px;
  border-left: 1px solid var(--line);
}
.cover-kicker {
  color: var(--muted);
  font-size: 12px;
  letter-spacing: 0.14em;
}
.cover-title {
  font-family: var(--font-heading);
  font-size: clamp(19px, 1.7vw, 24px);
  line-height: 1.7;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 4;
  -webkit-box-orient: vertical;
}
.cover-author {
  font-size: 12px;
  color: var(--text);
}
.book-cover img {
  position: absolute;
  width: 100%;
  height: 100%;
  inset: 0;
  object-fit: contain;
  background: var(--surface);
}
.book-title {
  font-size: 15px;
  line-height: 1.7;
  margin: 15px 0 8px;
  overflow-wrap: anywhere;
}
.book-authors,
.detail-authors {
  display: flex;
  gap: 5px 10px;
  flex-wrap: wrap;
  font-size: 14px;
  color: var(--muted);
}
.author-link {
  min-height: 28px;
  border: 0;
  padding: 0;
  background: none;
  color: var(--muted);
  font: inherit;
  font-size: 14px;
  text-align: left;
}
.author-link:hover {
  color: var(--accent);
  text-decoration: underline;
}
.book-meta {
  font-size: 13px;
  color: var(--muted);
  line-height: 1.8;
  margin: 8px 0;
  overflow-wrap: anywhere;
}
.book-score {
  font-size: 13px;
  margin: 8px 0;
}
.book-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 10px;
}
.tag-button,
.status-tag {
  min-height: 28px;
  font: inherit;
  font-size: 12px;
  padding: 4px 8px;
  border: 0;
  background: var(--surface);
  color: var(--muted);
}
.tag-button:hover {
  color: var(--accent);
}
.distribution-row {
  position: relative;
  width: 100%;
  display: flex;
  justify-content: space-between;
  gap: 15px;
  padding: 19px 0;
  border: 0;
  border-bottom: 1px solid var(--line);
  background: none;
  text-align: left;
  font: inherit;
  font-size: 14px;
}
.distribution-number {
  white-space: nowrap;
  color: var(--muted);
  font-size: 14px;
}
.distribution-bar {
  position: absolute;
  bottom: 0;
  left: 0;
  height: 2px;
  background: var(--accent);
  opacity: 0.6;
}
.book-dialog {
  border: 1px solid var(--line);
  background: var(--bg);
  color: var(--text);
  padding: 26px;
  max-width: 650px;
  width: calc(100% - 32px);
  max-height: 88vh;
  overflow: auto;
}
.book-dialog::backdrop {
  background: rgb(20 27 32 / 55%);
}
.dialog-heading {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 18px;
  font-size: 14px;
  border-bottom: 1px solid var(--line);
  padding-bottom: 16px;
  margin-bottom: 25px;
}
.dialog-heading h2 {
  font-size: 20px;
}
#detail-content > .book-cover {
  max-width: 170px;
  float: right;
  width: 32%;
  margin: 0 0 20px 24px;
}
.detail-title {
  font-size: 25px;
  margin-bottom: 16px;
}
.detail-subtitle {
  font-size: 15px;
  font-weight: 400;
  margin: 28px 0 10px;
}
.detail-prose {
  font-size: 14px;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  line-height: 2;
}
.editor-dialog {
  max-width: 800px;
}
.editor-note,
#storage-status,
#editor-message {
  font-size: 14px;
  color: var(--muted);
  line-height: 1.9;
}
.editor-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin: 20px 0;
}
.import-label input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
}
.import-label:focus-within {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}
.book-form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 15px;
}
.book-form-grid label {
  font-size: 14px;
  color: var(--muted);
}
.book-form-grid input,
.book-form-grid select,
.book-form-grid textarea {
  font: inherit;
  display: block;
  width: 100%;
  margin-top: 5px;
  border: 1px solid var(--line);
  background: var(--bg);
  color: var(--text);
  padding: 10px;
}
.book-form-grid textarea {
  resize: vertical;
}
.book-form-grid .wide {
  grid-column: 1/-1;
}
.editor-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 0;
  border-top: 1px solid var(--line);
}
.editor-row > span {
  flex: 1;
  font-size: 13px;
  overflow-wrap: anywhere;
}
.primary {
  background: var(--accent);
  color: var(--bg);
}
@media (max-width: 1000px) {
  .shelf-layout {
    grid-template-columns: 160px minmax(0, 1fr);
    gap: 25px;
  }
  .book-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .shelf-tools {
    flex-wrap: wrap;
  }
  .search-label {
    max-width: none;
    min-width: 260px;
  }
  .shelf-views {
    gap: 14px;
  }
  .cover-title {
    font-family: var(--font-heading);
    font-size: 20px;
  }
}
@media (max-width: 760px) {
  .shelf-heading h1 {
    font-size: 27px;
  }
  .shelf-layout {
    grid-template-columns: 1fr;
    gap: 20px;
  }
  .shelf-layout aside {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px 14px;
  }
  .filter-heading,
  .book-groups {
    grid-column: 1/-1;
  }
  .book-groups {
    flex-direction: row;
    flex-wrap: wrap;
    margin-bottom: 10px;
  }
  .group-button {
    padding: 7px 9px;
  }
  .filter-label {
    margin-bottom: 7px;
  }
  .book-grid {
    gap: 30px 18px;
  }
  .cover-title {
    font-family: var(--font-heading);
    font-size: 19px;
  }
  .search-label {
    min-width: 0;
    flex-basis: 100%;
  }
  .search-label kbd {
    display: none;
  }
  .search-label input {
    padding-right: 15px;
  }
  .shelf-tools {
    gap: 14px;
  }
  .shelf-actions {
    width: 100%;
  }
  .book-form-grid {
    grid-template-columns: 1fr;
  }
  .book-dialog {
    padding: 20px;
  }
  .shelf-views {
    gap: 15px;
  }
  .shelf-heading .shelf-button {
    white-space: nowrap;
  }
}

.filter-toggle {
  display: none;
}
.book-count,
.distribution-number,
.book-score {
  font-variant-numeric: tabular-nums;
}
.book-open:hover .book-title {
  color: var(--accent);
}
.book-card {
  min-width: 0;
}
.book-cover {
  background: var(--surface);
}
.book-card:nth-child(3n + 2) .book-cover {
  background: var(--selection);
}
.cover-kicker {
  letter-spacing: 0.08em;
}
.book-dialog h2 {
  font-family: var(--font-heading);
}
.book-form-grid input,
.book-form-grid select {
  min-height: 44px;
}
.primary:hover {
  color: var(--bg);
  filter: brightness(0.93);
}
.shelf-page .empty {
  padding-top: 32px;
}
@media (max-width: 760px) {
  .filter-toggle {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin: 0 0 20px;
  }
  #shelf-filters {
    display: none;
  }
  #shelf-filters.is-open {
    display: grid;
  }
  .shelf-layout {
    padding-top: 22px;
  }
  .shelf-views {
    gap: 6px 18px;
  }
  .shelf-views button {
    font-size: 13px;
  }
  .book-title {
    font-size: 16px;
  }
  .book-meta,
  .book-score,
  .tag-button,
  .status-tag {
    font-size: 12px;
  }
  .cover-title {
    font-size: 20px;
  }
  .cover-kicker,
  .cover-author {
    font-size: 11px;
  }
}
