:root {
  --bg: #050505;
  --card: #141414;
  --line: rgba(255,255,255,.08);
  --text: #f5f5f5;
  --muted: #9aa0a6;
  --accent: #3b82f6;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  min-height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
}

body {
  overflow: auto;
  padding: 32px 20px 96px;
  padding-left: max(20px, env(safe-area-inset-left));
  padding-right: max(20px, env(safe-area-inset-right));
}

.wrap {
  width: min(920px, 100%);
  margin: 0 auto;
}

.hero {
  text-align: center;
  margin-bottom: 36px;
}

.eyebrow {
  color: var(--accent);
  letter-spacing: .28em;
  font-size: 12px;
  margin-bottom: 10px;
}

h1 {
  font-size: 28px;
  font-weight: 700;
  margin-bottom: 8px;
}

.sub { color: var(--muted); font-size: 14px; }
.hint-line {
  color: var(--muted);
  font-size: 13px;
  margin-top: 8px;
  line-height: 1.5;
}
.site-link-wrap { margin-top: 14px; }
.site-link {
  display: inline-block;
  color: var(--accent);
  text-decoration: none;
  font-size: 14px;
}
.site-link:hover,
.site-link:focus-visible {
  text-decoration: underline;
}

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

.grid.single {
  grid-template-columns: minmax(0, 380px);
  justify-content: center;
}

.book-card {
  display: block;
  text-decoration: none;
  color: inherit;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 18px;
  overflow: hidden;
  transition: transform .18s ease, border-color .18s ease;
}

.book-card:hover,
.book-card:focus-visible {
  transform: translateY(-3px);
  border-color: rgba(59,130,246,.55);
  outline: none;
}

.book-cover {
  position: relative;
  aspect-ratio: 1600 / 2186;
  background: #0b0b0b;
  overflow: hidden;
}
.open-badge {
  position: absolute;
  right: 10px;
  bottom: 10px;
  z-index: 1;
  padding: 4px 8px;
  border-radius: 999px;
  background: rgba(8,8,8,.78);
  color: #fff;
  font-size: 12px;
  letter-spacing: .02em;
  pointer-events: none;
}
.book-cover img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
  background: #fff;
}

.book-meta { padding: 16px 16px 18px; }

.book-meta h2 {
  font-size: 18px;
  font-weight: 650;
  margin-bottom: 6px;
}

.book-meta .pages {
  color: var(--accent);
  font-size: 13px;
  margin-bottom: 8px;
}

.book-meta .desc {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.empty {
  text-align: center;
  color: var(--muted);
  padding: 40px 0;
}

@media (max-width: 720px) {
  body {
    padding: 18px 12px 96px;
    padding-left: max(12px, env(safe-area-inset-left));
    padding-right: max(12px, env(safe-area-inset-right));
  }
  .hero { margin-bottom: 16px; }
  h1 { font-size: 20px; }
  .sub { font-size: 12px; }
  .site-link { font-size: 13px; }
  .grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
  }
  .grid.single {
    grid-template-columns: minmax(0, 280px);
  }
  .book-card { border-radius: 12px; }
  .book-meta { padding: 10px 10px 12px; }
  .book-meta h2 {
    font-size: 14px;
    margin-bottom: 4px;
  }
  .book-meta .pages {
    font-size: 12px;
    margin-bottom: 4px;
  }
  .hint-line { font-size: 12px; }
  .open-badge { font-size: 11px; right: 8px; bottom: 8px; padding: 3px 7px; }
  .book-meta .desc {
    font-size: 11px;
    -webkit-line-clamp: 2;
  }
}

.contact-bar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 40;
  display: flex;
  gap: 8px;
  justify-content: center;
  padding: 10px 12px calc(10px + env(safe-area-inset-bottom, 0px));
  background: rgba(8, 8, 8, .92);
  border-top: 1px solid var(--line);
  backdrop-filter: blur(12px);
}
.contact-bar[hidden] { display: none; }
.contact-pill {
  flex: 1;
  max-width: 180px;
  text-align: center;
  text-decoration: none;
  color: var(--text);
  background: #1c1c1c;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 10px 8px;
  font-size: 13px;
}
.contact-pill[hidden] { display: none; }
.toast {
  position: fixed;
  top: 20px;
  left: 50%;
  transform: translateX(-50%) translateY(-100px);
  background: #333;
  color: #fff;
  padding: 14px 18px;
  border-radius: 8px;
  z-index: 99;
  opacity: 0;
  transition: all .3s;
  min-width: 220px;
  max-width: calc(100vw - 32px);
  text-align: center;
  pointer-events: none;
}
.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}
.toast.success { background: #10b981; }
.toast.error { background: #ef4444; }
.toast.info { background: #3b82f6; }
@media (max-width: 720px) {
  .contact-pill { font-size: 12px; padding: 9px 6px; }
}
