.profile-finished-books,
.profile-finished-books-state {
  min-height: 240px;
}

.profile-finished-books-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 20px;
}

body[data-page="profile-public"] .profile-finished-books-grid {
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 12px;
}

.profile-finished-book-card {
  min-width: 0;
  padding: 14px;
  border: 1px solid var(--panel-border);
  border-radius: var(--radius-lg);
  background: var(--surface-panel);
  box-shadow: var(--shadow-soft);
}

body[data-page="profile-public"] .profile-finished-book-card {
  padding: 11px;
}

.profile-finished-book-open {
  display: grid;
  width: 100%;
  min-width: 0;
  padding: 0;
  border: 0;
  background: transparent;
  color: inherit;
  text-align: left;
  cursor: pointer;
}

.profile-finished-book-cover {
  display: grid;
  width: 100%;
  aspect-ratio: 2 / 3;
  place-items: center;
  overflow: hidden;
  border-radius: 10px;
  background: var(--bg-soft);
  color: var(--muted);
  font-weight: 800;
}

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

.profile-finished-book-copy {
  display: grid;
  gap: 4px;
  min-width: 0;
  padding-top: 12px;
}

.profile-finished-book-copy strong,
.profile-finished-book-copy span {
  overflow: hidden;
  text-overflow: ellipsis;
}

.profile-finished-book-copy strong {
  color: var(--text);
  line-height: 1.35;
  white-space: nowrap;
}

.profile-finished-book-copy span {
  color: var(--muted);
  font-size: 0.86rem;
  white-space: nowrap;
}

.profile-finished-book-open:hover .profile-finished-book-copy strong,
.profile-finished-book-open:focus-visible .profile-finished-book-copy strong {
  color: var(--accent-strong);
}

.profile-finished-book-meta {
  display: grid;
  gap: 5px;
  min-height: 44px;
  margin-top: 10px;
  color: var(--muted);
  font-size: 0.78rem;
}

.profile-finished-book-rating {
  color: var(--accent-strong);
  font-weight: 800;
}

.profile-finished-book-review {
  margin-top: 10px;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--accent-strong);
  font: inherit;
  font-size: 0.82rem;
  font-weight: 800;
  cursor: pointer;
}

.profile-finished-book-review:hover,
.profile-finished-book-review:focus-visible {
  text-decoration: underline;
}

.profile-finished-books-pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 6px;
  padding-top: 24px;
}

.profile-finished-books-pagination-button,
.profile-finished-books-pagination-ellipsis {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 34px;
  height: 34px;
  padding: 0 10px;
  border: 1px solid var(--panel-border);
  border-radius: 11px;
  background: var(--surface-panel);
  color: var(--text);
  font: inherit;
  font-size: 0.78rem;
  font-weight: 800;
}

.profile-finished-books-pagination-button {
  cursor: pointer;
}

.profile-finished-books-pagination-button:hover,
.profile-finished-books-pagination-button:focus-visible,
.profile-finished-books-pagination-button.is-active {
  border-color: color-mix(in srgb, var(--accent) 46%, var(--panel-border) 54%);
  background: color-mix(in srgb, var(--accent-soft) 58%, var(--surface-panel) 42%);
  color: var(--accent);
  outline: none;
}

.profile-finished-books-pagination-button:disabled {
  cursor: default;
  opacity: 0.42;
  pointer-events: none;
}

.profile-finished-books-pagination-ellipsis {
  color: var(--muted);
}

.profile-finished-books-state {
  display: grid;
  align-content: center;
  justify-items: center;
  gap: 10px;
  padding: 32px;
  color: var(--muted);
  text-align: center;
}

.profile-finished-books-state h3,
.profile-finished-books-state p {
  margin: 0;
}

.profile-finished-books-state h3 {
  color: var(--text);
}

.profile-finished-book-skeleton {
  aspect-ratio: 2 / 3;
  border-radius: var(--radius-lg);
  background:
    linear-gradient(100deg, transparent 20%, color-mix(in srgb, var(--text) 8%, transparent) 42%, transparent 64%),
    var(--surface-panel);
  background-size: 220% 100%;
  animation: profile-finished-books-pulse 1.4s ease-in-out infinite;
}

.profile-settings-switch {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  min-height: 42px;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--text);
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}

.profile-settings-row .profile-settings-switch > span {
  display: inline-block;
}

.profile-settings-row .profile-settings-switch-track {
  position: relative;
  width: 46px;
  height: 26px;
  flex: 0 0 auto;
  border: 1px solid var(--panel-border);
  border-radius: 999px;
  background: var(--bg-soft);
  transition: background 160ms ease, border-color 160ms ease;
}

.profile-settings-row .profile-settings-switch-track > span {
  position: absolute;
  top: 3px;
  left: 3px;
  display: block;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--muted);
  transition: transform 160ms ease, background 160ms ease;
}

.profile-settings-switch[aria-checked="true"] .profile-settings-switch-track {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.profile-settings-switch[aria-checked="true"] .profile-settings-switch-track > span {
  transform: translateX(20px);
  background: var(--accent-strong);
}

.profile-settings-switch:disabled {
  cursor: wait;
  opacity: 0.65;
}

@keyframes profile-finished-books-pulse {
  from { background-position: 100% 0; }
  to { background-position: -120% 0; }
}

@media (max-width: 1300px) {
  body[data-page="profile-public"] .profile-finished-books-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

@media (max-width: 1100px) {
  .profile-finished-books-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  body[data-page="profile-public"] .profile-finished-books-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 760px) {
  .profile-finished-books-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
  }

  body[data-page="profile-public"] .profile-finished-books-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
  }

  .profile-finished-book-card {
    padding: 10px;
  }

  .profile-settings-switch {
    justify-content: flex-start;
  }
}

@media (max-width: 420px) {
  .profile-finished-books-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  body[data-page="profile-public"] .profile-finished-books-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .profile-finished-book-card {
    max-width: 280px;
    width: 100%;
    justify-self: center;
  }
}

@media (prefers-reduced-motion: reduce) {
  .profile-finished-book-skeleton {
    animation: none;
  }
}
