:root {
  color-scheme: light;
  --ink: #1e1d1b;
  --muted: #6f6a61;
  --line: #ded8ce;
  --paper: #fbfaf6;
  --panel: #ffffff;
  --accent: #af3e2f;
  --accent-2: #2f6f73;
  --accent-3: #8a6f2a;
  --shadow: 0 16px 44px rgba(35, 30, 23, 0.09);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  color: var(--ink);
  background:
    linear-gradient(180deg, rgba(175, 62, 47, 0.08), rgba(47, 111, 115, 0.05) 34%, transparent 68%),
    var(--paper);
}

a {
  color: inherit;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 16px clamp(20px, 5vw, 64px);
  border-bottom: 1px solid rgba(222, 216, 206, 0.8);
  background: rgba(251, 250, 246, 0.92);
  backdrop-filter: blur(14px);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-weight: 780;
  text-decoration: none;
}

.brand-mark {
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border-radius: 7px;
  color: #fff;
  background: var(--ink);
}

.nav {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.nav a {
  padding: 9px 12px;
  border-radius: 7px;
  color: var(--muted);
  font-size: 0.92rem;
  font-weight: 650;
  text-decoration: none;
}

.nav a:hover,
.nav a.active {
  color: var(--ink);
  background: #efe8dd;
}

.app-shell {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
  padding: 36px 0 72px;
}

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(300px, 0.85fr);
  gap: 32px;
  align-items: end;
  min-height: 430px;
  padding: 44px 0 30px;
}

.eyebrow,
.book-meta-line {
  color: var(--accent);
  font-size: 0.78rem;
  font-weight: 780;
  letter-spacing: 0;
  text-transform: uppercase;
}

.hero h1 {
  max-width: 760px;
  margin: 12px 0 18px;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(3.2rem, 8vw, 7.6rem);
  line-height: 0.9;
  letter-spacing: 0;
}

.hero-copy {
  max-width: 650px;
  color: #4f4a43;
  font-size: clamp(1.05rem, 1.8vw, 1.28rem);
  line-height: 1.62;
}

.hero-actions,
.toolbar,
.filter-row,
.tag-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.hero-actions {
  margin-top: 24px;
}

.button,
.select,
.search-input {
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fff;
  color: var(--ink);
  font: inherit;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 16px;
  font-weight: 740;
  text-decoration: none;
  cursor: pointer;
}

.button.primary {
  border-color: var(--ink);
  color: #fff;
  background: var(--ink);
}

.select {
  padding: 0 12px;
}

.search-input {
  flex: 1 1 260px;
  padding: 0 14px;
}

.shelf-preview {
  display: grid;
  grid-template-columns: repeat(3, minmax(70px, 1fr));
  align-items: end;
  gap: 12px;
  min-height: 260px;
  padding: 18px;
  border-left: 8px solid var(--ink);
  background: #e8dfd2;
  box-shadow: var(--shadow);
}

.spine {
  display: flex;
  align-items: end;
  justify-content: center;
  min-height: var(--h);
  padding: 14px 8px;
  border-radius: 4px 4px 0 0;
  color: #fff;
  background: var(--c);
  font-family: Georgia, "Times New Roman", serif;
  font-size: 0.9rem;
  font-weight: 700;
  text-align: center;
  writing-mode: vertical-rl;
  transform: rotate(180deg);
}

.stat-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(140px, 1fr));
  gap: 12px;
  margin: 22px 0 34px;
}

.stat,
.empty-state {
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.78);
}

.stat strong {
  display: block;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 2.4rem;
  line-height: 1;
}

.stat span,
.empty-state {
  color: var(--muted);
}

.section-head {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 18px;
  margin: 34px 0 16px;
}

.section-head h2,
.page-title h1,
.detail-main h1 {
  margin: 0;
  font-family: Georgia, "Times New Roman", serif;
  letter-spacing: 0;
}

.section-head h2 {
  font-size: clamp(1.8rem, 4vw, 3rem);
}

.page-title h1 {
  font-size: clamp(2.4rem, 5vw, 4.8rem);
}

.page-title p {
  max-width: 720px;
  color: var(--muted);
  line-height: 1.65;
}

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

.book-card {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.82);
  overflow: hidden;
}

.book-card-link {
  display: grid;
  grid-template-columns: 92px minmax(0, 1fr);
  min-height: 184px;
  text-decoration: none;
}

.cover {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  min-height: 184px;
  padding: 12px 10px;
  color: #fff;
  background: linear-gradient(150deg, var(--cover-a), var(--cover-b));
}

.cover.has-image,
.detail-cover:has(img) {
  padding: 0;
  background: #e8dfd2;
}

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

.cover-title,
.cover-author {
  display: block;
  overflow-wrap: anywhere;
}

.cover-title {
  font-family: Georgia, "Times New Roman", serif;
  font-size: 0.88rem;
  font-weight: 750;
  line-height: 1.1;
}

.cover-author {
  font-size: 0.68rem;
  font-weight: 650;
  opacity: 0.82;
}

.book-card-body {
  min-width: 0;
  padding: 16px;
}

.book-card h3 {
  margin: 8px 0 8px;
  font-size: 1.05rem;
  line-height: 1.25;
}

.book-card p {
  display: -webkit-box;
  margin: 0 0 12px;
  overflow: hidden;
  color: var(--muted);
  font-size: 0.92rem;
  line-height: 1.45;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 4;
}

.tag {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 0 9px;
  border: 1px solid #d9d0c3;
  border-radius: 999px;
  color: #555047;
  background: #f7f3ed;
  font-size: 0.75rem;
  font-weight: 680;
}

.toolbar {
  align-items: center;
  margin: 22px 0;
}

.detail-layout {
  display: grid;
  grid-template-columns: minmax(220px, 320px) minmax(0, 1fr);
  gap: 36px;
  align-items: start;
}

.detail-cover {
  min-height: 460px;
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.detail-main h1 {
  margin-top: 8px;
  font-size: clamp(2.2rem, 5vw, 5.4rem);
  line-height: 0.98;
}

.detail-author {
  margin: 14px 0 26px;
  color: var(--muted);
  font-size: 1.1rem;
}

.summary-block,
.note-block {
  max-width: 760px;
  margin: 22px 0;
  font-size: 1.03rem;
  line-height: 1.72;
}

.note-block {
  padding: 16px 18px;
  border-left: 4px solid var(--accent-2);
  background: #edf5f3;
}

.definition-list {
  display: grid;
  grid-template-columns: max-content minmax(0, 1fr);
  gap: 10px 16px;
  margin: 28px 0;
  color: var(--muted);
}

.definition-list dt {
  color: var(--ink);
  font-weight: 780;
}

.theme-cloud {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 14px;
}

.theme-tile {
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.8);
  text-decoration: none;
}

.theme-tile strong {
  display: block;
  font-size: 1.1rem;
}

.theme-tile span {
  color: var(--muted);
}

.admin-layout {
  display: grid;
  grid-template-columns: minmax(280px, 380px) minmax(0, 1fr);
  gap: 22px;
  align-items: start;
}

.admin-list,
.admin-editor {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.82);
}

.admin-list {
  position: sticky;
  top: 90px;
  max-height: calc(100vh - 120px);
  overflow: hidden;
}

.admin-toolbar {
  margin: 0;
  padding: 14px;
  border-bottom: 1px solid var(--line);
}

.admin-count {
  padding: 10px 14px;
  border-bottom: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 700;
}

.admin-book-list {
  max-height: calc(100vh - 245px);
  overflow: auto;
}

.admin-book-button {
  display: block;
  width: 100%;
  padding: 12px 14px;
  border: 0;
  border-bottom: 1px solid #eee7dd;
  background: transparent;
  color: var(--ink);
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.admin-book-button:hover,
.admin-book-button.active {
  background: #f1ebe2;
}

.admin-book-button span {
  display: block;
  font-weight: 760;
  line-height: 1.25;
}

.admin-book-button small {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  line-height: 1.3;
}

.admin-editor {
  padding: clamp(18px, 3vw, 28px);
}

.admin-editor-head {
  display: grid;
  grid-template-columns: 132px minmax(0, 1fr);
  gap: 18px;
  align-items: start;
  margin-bottom: 22px;
}

.admin-cover {
  min-height: 198px;
  border-radius: 7px;
  overflow: hidden;
}

.admin-editor h2 {
  margin: 6px 0 8px;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(1.7rem, 3vw, 3rem);
  line-height: 1;
}

.admin-editor p {
  color: var(--muted);
}

.field-label {
  display: block;
  margin: 18px 0 8px;
  font-weight: 800;
}

.comment-box {
  display: block;
  width: 100%;
  min-height: 190px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  font: inherit;
  line-height: 1.55;
  resize: vertical;
}

.admin-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 14px;
}

.admin-help {
  font-size: 0.92rem;
}

@media (max-width: 820px) {
  .site-header,
  .section-head {
    align-items: flex-start;
    flex-direction: column;
  }

  .hero,
  .detail-layout {
    grid-template-columns: 1fr;
  }

  .admin-layout,
  .admin-editor-head {
    grid-template-columns: 1fr;
  }

  .admin-list {
    position: static;
    max-height: none;
  }

  .admin-book-list {
    max-height: 360px;
  }

  .hero {
    min-height: auto;
    padding-top: 18px;
  }

  .stat-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .detail-cover {
    min-height: 360px;
  }
}

@media (max-width: 520px) {
  .app-shell {
    width: min(100% - 24px, 1180px);
  }

  .book-card-link {
    grid-template-columns: 78px minmax(0, 1fr);
  }

  .cover {
    min-height: 176px;
  }

  .stat-grid {
    grid-template-columns: 1fr;
  }
}
