.books-sync-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px 16px;
  padding: 10px 14px;
  margin-bottom: var(--space-md);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  background: var(--bg-elevated);
}

.book-target-input {
  width: 72px;
  text-align: center;
  padding: 5px 8px;
}

.books-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(168px, 1fr));
  gap: var(--space-md);
}

.book-card {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 10px;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  background: var(--bg-base);
  cursor: pointer;
  transition: border-color 150ms ease, transform 160ms ease, box-shadow 160ms ease;
}

.book-card:hover {
  border-color: var(--border-strong);
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(17, 18, 22, 0.14);
}

.book-cover-wrap {
  position: relative;
  aspect-ratio: 2 / 3;
  border-radius: var(--radius-md);
  overflow: hidden;
  border: 1px solid var(--border-subtle);
  background: var(--bg-elevated);
  transition: transform 160ms ease, box-shadow 160ms ease;
}

.book-card:hover .book-cover-wrap {
  transform: translateY(-3px);
  box-shadow: 0 10px 24px rgba(17, 18, 22, 0.14);
}

.book-cover-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.book-cover-fallback {
  height: 100%;
  padding: 16px 14px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  color: #f8fafc;
}

.book-cover-fallback strong {
  font-size: 0.95rem;
  line-height: 1.3;
  display: -webkit-box;
  -webkit-line-clamp: 4;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.book-cover-fallback small {
  color: rgba(248, 250, 252, 0.78);
  font-size: 0.75rem;
}

.book-cover-badge,
.book-format-pill {
  position: absolute;
  top: 8px;
  left: 8px;
  padding: 2px 7px;
  border-radius: 999px;
  background: rgba(17, 18, 22, 0.72);
  color: #fff;
  font-size: 0.65rem;
  font-weight: 600;
  letter-spacing: 0.04em;
}

.book-cover-fallback .book-cover-badge {
  position: static;
  align-self: flex-start;
  background: rgba(255, 255, 255, 0.16);
}

.book-del-btn {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 26px;
  height: 26px;
  border-radius: 999px;
  border: 0;
  background: rgba(17, 18, 22, 0.72);
  color: #fff;
  display: grid;
  place-items: center;
  cursor: pointer;
  opacity: 0;
  transition: opacity 150ms ease, background 150ms ease;
}

.book-card:hover .book-del-btn,
.book-del-btn:focus-visible {
  opacity: 1;
}

.book-del-btn:hover {
  background: var(--status-danger);
}

.book-cover-progress {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 4px;
  background: rgba(0, 0, 0, 0.35);
}

.book-cover-progress > div {
  height: 100%;
  background: var(--status-success);
}

.book-card-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.book-card-title {
  margin: 0;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text-primary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.book-card-foot {
  font-size: 0.75rem;
  color: var(--text-secondary);
  margin-bottom: 4px;
}

/* Reader */
.book-reader-shell {
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
  min-height: calc(100vh - 72px);
}

.book-reader-bar,
.book-reader-foot {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 14px;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  background: var(--bg-base);
}

.book-reader-meta {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.book-reader-meta strong { font-size: 0.92rem; color: var(--text-primary); }
.book-reader-meta small { font-size: 0.75rem; color: var(--text-muted); }

.book-reader-stage {
  flex: 1;
  min-height: 420px;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  background: var(--bg-base);
  overflow: auto;
  display: flex;
  justify-content: center;
  padding: 20px;
}

.book-epub-body {
  width: min(72ch, 100%);
  line-height: 1.75;
  color: var(--text-primary);
}

.book-epub-body h1,
.book-epub-body h2,
.book-epub-body h3 {
  margin: 1.2em 0 0.5em;
  line-height: 1.3;
}

.book-epub-body p {
  margin: 0 0 0.9em;
}

.book-epub-body img,
.book-epub-body svg {
  max-width: 100%;
  max-height: 75vh;
  height: auto;
  display: block;
  margin: 0 auto 1em;
}

.book-pdf-wrap {
  display: flex;
  justify-content: center;
  align-items: flex-start;
  width: 100%;
}

.book-pdf-canvas {
  max-width: 100%;
  height: auto;
  border-radius: var(--radius-sm);
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.16);
}

.book-pdf-fallback {
  width: 100%;
  min-height: 70vh;
  border: 0;
}

.book-page-input {
  width: 68px;
  text-align: center;
  padding: 4px 6px;
}
