:root {
  --ink: #10201a;
  --muted: #65716c;
  --paper: #f4f2e9;
  --card: #fffdf7;
  --line: rgba(16, 32, 26, .14);
  --accent: #e9aa2f;
  --deep: #11251d;
  --radius: 18px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  color: var(--ink);
  background: var(--paper);
  font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", sans-serif;
  min-width: 320px;
}
button, input { font: inherit; }
button { color: inherit; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }

.site-header {
  height: 78px;
  padding: 0 clamp(22px, 5vw, 76px);
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 11px; color: inherit; text-decoration: none; font-weight: 750; letter-spacing: .02em; }
.brand-mark { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 8px 8px 8px 2px; color: var(--paper); background: var(--deep); font-family: ui-serif, "Songti SC", serif; }
.header-note { color: var(--muted); font-size: .88rem; }
main { width: min(1440px, 100%); margin: 0 auto; padding: 0 clamp(22px, 5vw, 76px); }
.intro { min-height: 330px; display: grid; grid-template-columns: 1.45fr .75fr; align-items: end; gap: 48px; padding: 66px 0 56px; border-bottom: 1px solid var(--line); }
.eyebrow { margin: 0 0 16px; color: #7f6021; font-size: .74rem; letter-spacing: .24em; font-weight: 750; }
h1 { margin: 0; max-width: 760px; font-family: ui-serif, Georgia, "Songti SC", serif; font-size: clamp(2.9rem, 7vw, 6.2rem); line-height: .98; letter-spacing: -.055em; font-weight: 520; }
h1 em { color: #a96820; font-weight: inherit; }
.intro-copy { margin: 0 0 6px; max-width: 390px; color: var(--muted); font-size: clamp(1rem, 1.35vw, 1.15rem); line-height: 1.8; }
.library { padding: 32px 0 70px; }
.toolbar { display: flex; align-items: stretch; gap: 18px; }
.search-box { flex: 1; height: 58px; display: flex; align-items: center; gap: 13px; padding: 0 18px; background: var(--card); border: 1px solid var(--line); border-radius: 14px; box-shadow: 0 5px 18px rgba(16,32,26,.04); }
.search-box:focus-within { border-color: rgba(169,104,32,.65); box-shadow: 0 0 0 4px rgba(233,170,47,.14); }
.search-box svg { width: 21px; fill: none; stroke: currentColor; stroke-width: 1.7; color: var(--muted); }
.search-box input { flex: 1; min-width: 0; border: 0; outline: 0; background: transparent; color: var(--ink); font-size: 1rem; }
.search-box input::placeholder { color: #89928e; }
kbd { border: 1px solid var(--line); border-radius: 6px; padding: 3px 7px; color: var(--muted); font-family: inherit; font-size: .75rem; }
.count { width: 104px; display: grid; place-content: center; text-align: center; border: 1px solid var(--line); border-radius: 14px; }
.count strong { font-family: ui-serif, Georgia, serif; font-size: 1.35rem; line-height: 1; }
.count span { margin-top: 3px; color: var(--muted); font-size: .72rem; }
.tag-filters { display: flex; gap: 8px; overflow-x: auto; padding: 20px 0 28px; scrollbar-width: none; }
.tag-filters::-webkit-scrollbar { display: none; }
.tag-filter { flex: none; border: 1px solid var(--line); border-radius: 999px; padding: 8px 13px; background: transparent; cursor: pointer; font-size: .86rem; }
.tag-filter:hover, .tag-filter[aria-pressed="true"] { background: var(--deep); color: var(--paper); border-color: var(--deep); }
.tag-select { flex: none; max-width: 160px; border: 1px solid var(--line); border-radius: 999px; padding: 8px 32px 8px 13px; color: var(--ink); background: var(--card); cursor: pointer; font-size: .86rem; }
.book-grid { display: grid; grid-template-columns: repeat(5, minmax(0,1fr)); gap: 42px 24px; }
.book-card { min-width: 0; }
.book-open { width: 100%; padding: 0; border: 0; background: transparent; text-align: left; cursor: pointer; }
.cover-wrap { position: relative; aspect-ratio: 2 / 3; overflow: hidden; border-radius: 4px 12px 12px 4px; background: #d9d5c8; box-shadow: -5px 9px 19px rgba(16,32,26,.16), inset 3px 0 rgba(255,255,255,.35); transition: transform .24s ease, box-shadow .24s ease; }
.book-open:hover .cover-wrap { transform: translateY(-5px) rotate(.25deg); box-shadow: -7px 15px 28px rgba(16,32,26,.21); }
.book-open:focus-visible { outline: 3px solid var(--accent); outline-offset: 7px; border-radius: 8px; }
.cover { width: 100%; height: 100%; object-fit: cover; display: block; position: relative; z-index: 1; }
.cover[src=""] { display: none; }
.cover-placeholder { position: absolute; inset: 0; display: flex; flex-direction: column; justify-content: space-between; padding: 22px 18px; color: var(--paper); background: var(--placeholder, var(--deep)); }
.cover-placeholder::before { content: ""; position: absolute; inset: 0; opacity: .2; background: repeating-linear-gradient(135deg, transparent 0 16px, rgba(255,255,255,.2) 17px 18px); }
.cover-placeholder span, .cover-placeholder small { position: relative; }
.cover-placeholder span { font-family: ui-serif, Georgia, "Songti SC", serif; font-size: clamp(1.05rem, 1.6vw, 1.5rem); line-height: 1.28; }
.cover-placeholder small { font-size: .7rem; opacity: .72; }
.book-info { padding: 15px 2px 0; }
.book-title { margin: 0 0 6px; font-family: ui-serif, Georgia, "Songti SC", serif; font-size: 1.05rem; line-height: 1.35; font-weight: 650; }
.book-author { margin: 0; color: var(--muted); font-size: .83rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.book-tags { display: flex; gap: 5px; flex-wrap: wrap; margin-top: 10px; }
.book-tags span { padding: 3px 7px; border-radius: 5px; color: #73551c; background: rgba(233,170,47,.14); font-size: .68rem; }
.empty-state { padding: 80px 20px; text-align: center; }
.empty-state > span { font-family: ui-serif, serif; font-size: 3rem; color: #a96820; }
.empty-state h2 { margin: 10px 0 6px; font-family: ui-serif, serif; }
.empty-state p { margin: 0 0 18px; color: var(--muted); }
.empty-state button { border: 1px solid var(--deep); border-radius: 9px; padding: 9px 14px; background: var(--deep); color: var(--paper); cursor: pointer; }
footer { padding: 28px clamp(22px, 5vw, 76px) 44px; border-top: 1px solid var(--line); color: var(--muted); font-size: .8rem; }
dialog { width: min(790px, calc(100% - 28px)); padding: 0; border: 0; border-radius: 22px; background: var(--card); color: var(--ink); box-shadow: 0 24px 90px rgba(8,20,15,.36); }
dialog::backdrop { background: rgba(7,17,13,.62); backdrop-filter: blur(5px); }
.dialog-close { position: absolute; z-index: 2; right: 13px; top: 13px; width: 38px; height: 38px; border: 1px solid var(--line); border-radius: 50%; background: rgba(255,253,247,.9); cursor: pointer; font-size: 1.5rem; }
.dialog-book { display: grid; grid-template-columns: 220px 1fr; gap: 34px; padding: 38px; }
.dialog-book img { width: 100%; aspect-ratio: 2/3; object-fit: cover; border-radius: 4px 10px 10px 4px; box-shadow: -6px 12px 24px rgba(16,32,26,.2); background: #ddd7c8; }
.dialog-meta { padding: 15px 0 5px; }
.dialog-meta .eyebrow { margin-bottom: 10px; }
.dialog-meta h2 { margin: 0; font-family: ui-serif, Georgia, "Songti SC", serif; font-size: clamp(1.8rem, 4vw, 2.75rem); line-height: 1.15; }
.dialog-author { color: var(--muted); margin: 10px 0 22px; }
.dialog-description { color: #3f4b46; line-height: 1.8; white-space: pre-line; }
.dialog-description:empty::after { content: "这本书暂时没有简介。"; color: var(--muted); }

@media (max-width: 1050px) { .book-grid { grid-template-columns: repeat(4,1fr); } }
@media (max-width: 760px) {
  .site-header { height: 66px; }
  .header-note { display: none; }
  .intro { min-height: 260px; grid-template-columns: 1fr; gap: 28px; padding: 46px 0 38px; }
  .book-grid { grid-template-columns: repeat(2, minmax(0,1fr)); gap: 34px 18px; }
  .dialog-book { grid-template-columns: 125px 1fr; gap: 20px; padding: 28px 22px; }
}
@media (max-width: 440px) {
  kbd { display: none; }
  .count { width: 76px; }
  .book-title { font-size: .98rem; }
  .dialog-book { grid-template-columns: 1fr; }
  .dialog-book img { width: 130px; }
}
@media (prefers-reduced-motion: reduce) { * { scroll-behavior: auto !important; transition: none !important; } }
