:root {
  color-scheme: light;
  font-family: Inter, "PingFang SC", "Microsoft YaHei", Arial, sans-serif;
  color: #17212b;
  background: #f6f7f9;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
}

a {
  color: inherit;
  text-decoration: none;
}

.shell {
  width: min(1120px, calc(100vw - 32px));
  margin: 0 auto;
  padding: 32px 0;
}

.topbar {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 24px;
  padding-bottom: 24px;
  border-bottom: 1px solid #dce2e8;
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: 34px;
  line-height: 1.15;
}

h2 {
  font-size: 20px;
  margin-bottom: 12px;
}

.topbar p,
.person-card span,
.source-row span,
.meta,
.empty {
  color: #607080;
}

.search,
#import-form {
  display: flex;
  gap: 8px;
}

input {
  width: min(360px, 48vw);
  height: 40px;
  border: 1px solid #cbd5df;
  border-radius: 6px;
  padding: 0 12px;
  font: inherit;
  background: #fff;
}

select {
  height: 40px;
  border: 1px solid #cbd5df;
  border-radius: 6px;
  padding: 0 10px;
  font: inherit;
  background: #fff;
}

button {
  height: 40px;
  border: 0;
  border-radius: 6px;
  padding: 0 16px;
  font: inherit;
  font-weight: 650;
  color: #fff;
  background: #1264a3;
  cursor: pointer;
}

button:disabled {
  cursor: wait;
  opacity: 0.65;
}

.toolbar {
  display: flex;
  align-items: center;
  gap: 16px;
  min-height: 72px;
}

#import-status {
  color: #356338;
}

#enrich-status {
  color: #356338;
}

.categories {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 12px;
  margin-bottom: 24px;
}

.cat-card {
  display: grid;
  align-content: start;
  gap: 6px;
  min-height: 92px;
  padding: 16px;
  border: 1px solid #dde5ed;
  border-radius: 10px;
  background: #fff;
  transition: border-color 0.15s, box-shadow 0.15s, transform 0.15s;
}

.cat-card:hover {
  border-color: #1264a3;
  box-shadow: 0 4px 14px rgba(18, 100, 163, 0.12);
  transform: translateY(-2px);
}

.cat-card.active {
  border-color: #1264a3;
  background: #eef5fb;
}

.cat-name {
  font-size: 17px;
  font-weight: 700;
  color: #17212b;
}

.cat-count {
  font-size: 13px;
  font-weight: 650;
  color: #1264a3;
  font-variant-numeric: tabular-nums;
}

.cat-examples {
  font-size: 12px;
  line-height: 1.5;
  color: #607080;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.filter-note {
  margin: 0 0 16px;
  color: #607080;
  font-size: 14px;
}

.filter-note a {
  color: #1264a3;
  font-weight: 650;
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 12px;
}

.person-card,
.profile,
.section {
  background: #fff;
  border: 1px solid #dde5ed;
  border-radius: 8px;
}

.person-card {
  display: grid;
  gap: 10px 12px;
  min-height: 200px;
  padding: 16px;
  align-items: start;
}

.person-card p {
  display: -webkit-box;
  overflow: hidden;
  line-height: 1.55;
  -webkit-line-clamp: 4;
  -webkit-box-orient: vertical;
}

.back {
  display: inline-block;
  margin-bottom: 16px;
  color: #1264a3;
  font-weight: 650;
}

.profile,
.section {
  padding: 20px;
  margin-bottom: 16px;
}

.profile {
  display: block;
  padding: 20px;
  margin-bottom: 16px;
}

.profile-head {
  display: flex;
  gap: 20px;
  align-items: flex-start;
  margin-bottom: 18px;
}

.profile-avatar {
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
}

.profile-head-text {
  min-width: 0;
}

.enrich-controls {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.meta span {
  padding: 4px 8px;
  border: 1px solid #d7e0e8;
  border-radius: 999px;
}

.source-row {
  display: grid;
  gap: 4px;
  padding: 12px 0;
  border-top: 1px solid #edf1f4;
}

.source-row:first-of-type {
  border-top: 0;
}

.book-list {
  display: grid;
  gap: 10px;
}

.book-row {
  display: grid;
  grid-template-columns: 52px 1fr;
  align-items: center;
  gap: 12px;
  min-height: 72px;
  padding: 10px 0;
  border-top: 1px solid #edf1f4;
}

.book-row[hidden],
.book-filter-empty[hidden] {
  display: none;
}

.book-row:first-child {
  border-top: 0;
}

.book-row img,
.book-cover-placeholder {
  width: 52px;
  height: 72px;
  border: 1px solid #d7e0e8;
  border-radius: 4px;
  background: #eef2f5;
}

.book-row img {
  object-fit: cover;
}

.book-cover-placeholder {
  display: grid;
  place-items: center;
  color: #607080;
  font-size: 18px;
  font-weight: 700;
}

.book-info {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.book-info strong,
.book-info em {
  overflow-wrap: anywhere;
}

.book-row em {
  color: #607080;
  font-style: normal;
}

.empty {
  padding: 18px;
  border: 1px dashed #cbd5df;
  border-radius: 8px;
}

.profile .bio {
  font-size: 16px;
  line-height: 1.7;
  color: #2a3744;
}

.facts {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 12px 20px;
  margin: 0;
}

.facts div {
  display: grid;
  gap: 2px;
}

.facts dt {
  font-size: 12px;
  color: #8a96a3;
  letter-spacing: 0.04em;
}

.facts dd {
  margin: 0;
  font-size: 15px;
  font-weight: 600;
  color: #17212b;
}

.fact-tags {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.fact-tags-label {
  font-size: 13px;
  color: #8a96a3;
  margin-right: 4px;
}

.tag {
  padding: 4px 10px;
  border-radius: 999px;
  background: #eef5fb;
  color: #1264a3;
  font-size: 13px;
  font-weight: 600;
}

.tag.muted {
  background: #eef1f4;
  color: #51606e;
  font-weight: 500;
}

.links {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.ext {
  display: inline-flex;
  align-items: center;
  padding: 8px 14px;
  border: 1px solid #cbd5df;
  border-radius: 6px;
  color: #324152;
  font-size: 14px;
  font-weight: 600;
  transition: border-color 0.15s, color 0.15s;
}

.ext:hover {
  border-color: #1264a3;
  color: #1264a3;
}

/* 头像：固定尺寸、不裁剪、等比缩放居中 */
.avatar,
.avatar-lg {
  border-radius: 10px;
  object-fit: contain;
  background: #f0f2f5;
  overflow: hidden;
  flex-shrink: 0;
}

.avatar {
  width: 72px;
  height: 72px;
  align-self: start;
  box-shadow: 0 1px 3px rgba(20, 40, 60, 0.1);
}

.person-card .avatar.placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 28px;
  font-weight: 700;
  color: #8899aa;
  background: #e8ecf1;
}

.avatar-lg {
  width: 112px;
  height: 112px;
  box-shadow: 0 2px 8px rgba(20, 40, 60, 0.15);
}

.avatar-lg.placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 42px;
  font-weight: 700;
  color: #8899aa;
  background: #e8ecf1;
}

.profile {
  display: block;
}

.profile h1 {
  margin: 0;
}

.profile .bio {
  margin-top: 8px;
}

.pagination {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
  margin: 28px 0 8px;
}

.page-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 36px;
  padding: 6px 10px;
  border-radius: 8px;
  background: #fff;
  border: 1px solid #dde4ea;
  color: #2a3b4d;
  text-decoration: none;
  font-size: 14px;
  transition: background 0.15s, border-color 0.15s;
}

.page-link:hover {
  border-color: #9fb3c6;
}

.page-link.active {
  background: #2a3b4d;
  color: #fff;
  border-color: #2a3b4d;
}

.page-link.disabled {
  color: #b6c1cc;
  cursor: default;
  pointer-events: none;
}

.page-info {
  margin-left: auto;
  color: #6b7a8a;
  font-size: 13px;
}

@media (max-width: 720px) {
  .topbar,
  .toolbar,
  .search,
  #import-form {
    align-items: stretch;
    flex-direction: column;
  }

  input {
    width: 100%;
  }

  .page-info {
    margin-left: 0;
    width: 100%;
  }
}

.source-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 12px;
}

.source-card {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 12px 14px;
  border: 1px solid #e2e8ee;
  border-radius: 10px;
  background: #fff;
  text-decoration: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.source-card:hover {
  border-color: #9fb3c6;
  box-shadow: 0 2px 8px rgba(20, 40, 60, 0.08);
}

.source-platform {
  font-size: 12px;
  font-weight: 700;
  color: #1264a3;
  letter-spacing: 0.03em;
}

.source-name {
  font-size: 14px;
  color: #2a3b4d;
}

.section-note {
  font-size: 12px;
  font-weight: 600;
  color: #fff;
  background: #9aa7b4;
  border-radius: 999px;
  padding: 2px 10px;
  margin-left: 8px;
  vertical-align: middle;
}

.section-hint {
  margin: 4px 0 14px;
  font-size: 13px;
  color: #6b7a8a;
}

.image-attribution {
  margin: 6px 0 0;
  font-size: 11px;
  line-height: 1.4;
  color: #93a0ad;
  max-width: 112px;
}

.about-link {
  align-self: center;
  color: #1264a3;
  text-decoration: none;
  font-size: 14px;
  font-weight: 600;
  white-space: nowrap;
}

.about-link:hover {
  text-decoration: underline;
}

.about-list {
  margin: 8px 0 0;
  padding-left: 20px;
  line-height: 1.9;
  color: #2a3b4d;
}

.about-list li {
  margin-bottom: 4px;
}
