/* =========================================================
   eLib - Stylesheet Utama
   4 tema white label: biru (default), hijau, ungu, jingga
   ========================================================= */
:root,
[data-theme="biru"] {
  --primary: #2563eb; --primary-2: #1d4ed8; --accent: #0ea5e9;
  --bg: #f8fafc; --surface: #ffffff; --text: #0f172a; --muted: #64748b;
  --border: #e2e8f0; --ok: #16a34a; --warn: #d97706; --danger: #dc2626;
}
[data-theme="hijau"] {
  --primary: #059669; --primary-2: #047857; --accent: #10b981;
  --bg: #f6fdf9; --surface: #ffffff; --text: #052e1f; --muted: #5b7168;
  --border: #d9efe5; --ok: #059669; --warn: #d97706; --danger: #dc2626;
}
[data-theme="ungu"] {
  --primary: #7c3aed; --primary-2: #6d28d9; --accent: #a78bfa;
  --bg: #faf8ff; --surface: #ffffff; --text: #1e1b31; --muted: #6b688a;
  --border: #e9e3fb; --ok: #16a34a; --warn: #d97706; --danger: #dc2626;
}
[data-theme="jingga"] {
  --primary: #ea580c; --primary-2: #c2410c; --accent: #f97316;
  --bg: #fffaf5; --surface: #ffffff; --text: #2b1508; --muted: #8a6a56;
  --border: #f6e3d5; --ok: #16a34a; --warn: #d97706; --danger: #dc2626;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: "Segoe UI", system-ui, -apple-system, Roboto, "Helvetica Neue", Arial, sans-serif;
  background: var(--bg); color: var(--text); line-height: 1.6; font-size: 15px;
}
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; }
code { background: #f1f5f9; padding: 1px 6px; border-radius: 4px; font-size: .9em; }
.container { width: min(1160px, 92vw); margin: 0 auto; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.narrow { width: min(920px, 94vw); }
hr { border: 0; border-top: 1px solid var(--border); margin: 1rem 0; }

/* ---------- Header / Nav ---------- */
.site-main { background: #ffffff; }
.site-header { background: var(--surface); border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 50; font-size: 9.25pt; }
.site-header .brand-text strong { font-size: 10pt; }
.header-inner { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: .6rem 0; flex-wrap: nowrap; }
.brand { display: flex; align-items: center; gap: .6rem; color: var(--text); flex-wrap: nowrap; white-space: nowrap; flex-shrink: 0; }
.brand:hover { text-decoration: none; }
.brand-mark {
  display: inline-flex; align-items: center; justify-content: center;
  width: 40px; height: 40px; border-radius: 10px; color: #fff; font-weight: 800;
  background: linear-gradient(135deg, var(--primary), var(--accent));
}
.brand-logo { height: 40px; }
.brand-text { display: flex; flex-direction: column; line-height: 1.15; }
.brand-text strong { font-size: 1rem; }
.brand-text small { color: var(--muted); font-size: .75rem; }
.nav { display: flex; align-items: center; gap: .2rem; flex-wrap: nowrap; min-width: 0; overflow-x: auto; scrollbar-width: none; }
.nav::-webkit-scrollbar { display: none; }
.nav > a { padding: .45rem .7rem; border-radius: 8px; color: var(--text); font-weight: 500; white-space: nowrap; }
.nav > a:hover { background: var(--bg); text-decoration: none; }
.nav > a.on { color: var(--primary); background: color-mix(in srgb, var(--primary) 10%, transparent); }
.nav-sep { width: 1px; height: 26px; background: var(--border); margin: 0 .3rem; }
.nav-user { display: inline-flex; align-items: center; gap: .4rem; }
.nav-burger { display: none; background: none; border: 1px solid var(--border); border-radius: 8px; font-size: 1.1rem; padding: .2rem .55rem; cursor: pointer; }
.banner img { width: 100%; max-height: 300px; object-fit: cover; display: block; }
.hero-banner { color: #fff; padding: 2.2rem 0; }
.hero-banner h1 { margin: 0 0 .3rem; font-size: 1.7rem; text-shadow: 0 2px 8px rgba(0,0,0,.35); }
.hero-banner p { margin: 0; opacity: .95; text-shadow: 0 1px 6px rgba(0,0,0,.35); }

/* ---------- Flash & Offline ---------- */
.flash-wrap { padding: .8rem 0 0; }
.flash-wrap.pad { padding: .8rem 1.2rem 0; }
.flash { padding: .7rem 1rem; border-radius: 10px; margin-bottom: .5rem; border: 1px solid transparent; font-size: .93rem; }
.flash-success { background: #ecfdf5; border-color: #a7f3d0; color: #065f46; }
.flash-error   { background: #fef2f2; border-color: #fecaca; color: #991b1b; }
.flash-warning { background: #fffbeb; border-color: #fde68a; color: #92400e; }
.flash-info    { background: #eff6ff; border-color: #bfdbfe; color: #1e40af; }
.offline-banner {
  background: #1f2937; color: #f9fafb; text-align: center;
  padding: .5rem 1rem; font-size: .9rem; position: sticky; top: 58px; z-index: 49;
}

/* ---------- Tombol ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .4rem;
  padding: .55rem 1.1rem; border-radius: 10px; border: 1px solid transparent;
  font-weight: 600; font-size: .93rem; cursor: pointer; transition: .15s; text-decoration: none !important;
}
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-2); }
.btn-outline { background: transparent; border-color: var(--border); color: var(--text); }
.btn-outline:hover { border-color: var(--primary); color: var(--primary); }

/* Konteks latar gelap (hero landing dgn gambar/gradien): font putih */
.cx-hero .btn-outline,
.cx-cta-band .btn-outline,
.portal-hero .btn-outline {
  border-color: rgba(255,255,255,.8);
  color: #fff;
}
.cx-hero .btn-outline:hover,
.cx-cta-band .btn-outline:hover,
.portal-hero .btn-outline:hover {
  border-color: #fff;
  background: rgba(255,255,255,.15);
  color: #fff;
}
.btn-ghost { background: transparent; color: var(--text); border-color: transparent; }
.btn-ghost:hover { background: var(--bg); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { filter: brightness(.92); }
.btn-sm { padding: .35rem .75rem; font-size: .85rem; }
.btn-xs { padding: .18rem .5rem; font-size: .75rem; border-radius: 7px; }
.btn-block { display: flex; width: 100%; margin-top: .55rem; }
.btn-row { display: flex; gap: .4rem; flex-wrap: wrap; }

/* ---------- Hero ---------- */
.hero-section { background: linear-gradient(180deg, color-mix(in srgb, var(--primary) 8%, var(--surface)), var(--bg)); border-bottom: 1px solid var(--border); }
/* Banner sebagai background hero (halaman depan) — desktop & mobile */
.hero-section.has-banner { background-image: var(--hero-banner-desktop, var(--hero-banner-mobile)); background-size: cover; background-position: center; position: relative; }
.hero-section.has-banner::before { content: ""; position: absolute; inset: 0;
  background: linear-gradient(90deg, color-mix(in srgb, var(--surface) 94%, transparent), color-mix(in srgb, var(--surface) 55%, transparent)); }
.hero-section.has-banner .hero-inner { position: relative; z-index: 1; }
.hero-inner { display: grid; grid-template-columns: 1.4fr .8fr; gap: 2rem; align-items: center; padding: 2.6rem 0; }
.hero-inner h1 { font-size: 2rem; margin: 0 0 .6rem; line-height: 1.25; }
.hero-inner h1 span { color: var(--primary); }
.hero-inner p { color: var(--muted); margin: 0 0 1.1rem; }
.hero-actions { display: flex; gap: .6rem; flex-wrap: wrap; }
.hero-art { border-radius: 20px; min-height: 230px; display: flex; align-items: center; justify-content: center; color: #fff; }
.hero-book { font-size: 3rem; text-align: center; text-shadow: 0 3px 12px rgba(0,0,0,.35); }
.hero-book small { font-size: 1rem; letter-spacing: 3px; }
.stat-row { display: flex; gap: 1.6rem; margin-top: 1.4rem; flex-wrap: wrap; }
.stat { display: flex; flex-direction: column; }
.stat strong { font-size: 1.3rem; color: var(--primary); }
.stat span { font-size: .8rem; color: var(--muted); }

/* ---------- Section & kartu ---------- */
.section { padding: 1.8rem 0; }
.section-title { font-size: 1.25rem; margin: 0 0 .9rem; }
.section-head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }
.chip-row { display: flex; gap: .5rem; flex-wrap: wrap; margin-bottom: 1rem; }
.chip {
  background: var(--surface); border: 1px solid var(--border); border-radius: 999px;
  padding: .32rem .85rem; font-size: .87rem; color: var(--text); display: inline-flex; gap: .35rem; align-items: center;
}
.chip:hover { border-color: var(--primary); color: var(--primary); text-decoration: none; }
.chip.on { background: var(--primary); color: #fff; border-color: var(--primary); }
.chip small { background: var(--bg); border-radius: 999px; padding: 0 .4rem; }
.chip.on small { background: rgba(255,255,255,.25); color: #fff; }
.chip-sm { font-size: .74rem; padding: .1rem .6rem; text-transform: capitalize; }

.book-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(155px, 1fr)); gap: 1rem; }
.book-card {
  background: var(--surface); border: 1px solid var(--border); border-radius: 14px;
  overflow: hidden; color: var(--text); transition: .15s; display: flex; flex-direction: column;
}
.book-card:hover { transform: translateY(-3px); box-shadow: 0 10px 24px rgba(15, 23, 42, .10); text-decoration: none; }
.book-cover { position: relative; aspect-ratio: 3/4; background: #eef2ff; }
.book-cover img { width: 100%; height: 100%; object-fit: cover; }
.cover-ph {
  display: flex; align-items: center; justify-content: center; width: 100%; height: 100%;
  color: #fff; font-size: 2rem; font-weight: 800; letter-spacing: 2px; text-shadow: 0 2px 8px rgba(0,0,0,.3);
}
.cover-lg { aspect-ratio: 3/4; border-radius: 12px; font-size: 3.6rem; min-height: 320px; }
.book-cover .badge { position: absolute; top: 6px; left: 6px; }
.book-meta { padding: .6rem .7rem .8rem; }
.book-meta h4 { margin: 0; font-size: .92rem; line-height: 1.35; }
.book-meta .muted { font-size: .78rem; margin: .2rem 0 .3rem; }
.book-sub { display: flex; justify-content: space-between; font-size: .76rem; }
.star { color: #f59e0b; }
.book-slot { position: relative; }
.book-slot form { position: absolute; right: 6px; top: 6px; }

.badge { display: inline-block; padding: .1rem .55rem; border-radius: 999px; font-size: .72rem; font-weight: 700; }
.badge-digital, .badge-tersedia, .badge-kembali, .badge-publish { background: #ecfdf5; color: #047857; }
.badge-fisik, .badge-dipinjam, .badge-pending { background: #eff6ff; color: #1d4ed8; }
.badge-dua { background: #f5f3ff; color: #6d28d9; }
.badge-terlambat, .badge-hilang, .badge-draft, .badge-batal { background: #fef2f2; color: #b91c1c; }
.badge-aktif { background: #ecfdf5; color: #047857; }
.badge-selesai { background: #f1f5f9; color: #475569; }

/* ---------- Panel / form ---------- */
.panel {
  background: var(--surface); border: 1px solid var(--border); border-radius: 14px;
  padding: 1.1rem 1.2rem; margin-bottom: 1rem;
}
.panel h3 { margin-top: 0; }
label { display: block; font-size: .86rem; font-weight: 600; margin-bottom: .7rem; color: var(--text); }
input[type="text"], input[type="email"], input[type="password"], input[type="number"],
input[type="date"], input[type="file"], input[type="search"], select, textarea {
  width: 100%; padding: .55rem .7rem; border: 1px solid var(--border); border-radius: 9px;
  font: inherit; background: var(--surface); color: var(--text); margin-top: .25rem;
}
input:focus, select:focus, textarea:focus { outline: 2px solid color-mix(in srgb, var(--primary) 35%, transparent); border-color: var(--primary); }
textarea { resize: vertical; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 .9rem; }
.inline-form { display: flex; gap: .5rem; align-items: center; flex-wrap: wrap; margin-bottom: .9rem; }
.inline-form input, .inline-form select { margin-top: 0; width: auto; min-width: 220px; }
.filter-bar, .search-bar { display: flex; gap: .5rem; flex-wrap: wrap; margin-bottom: 1.1rem; }
.filter-bar input, .filter-bar select, .search-bar input, .search-bar select { margin-top: 0; min-width: 150px; width: auto; flex: 1; }
.search-bar select { flex: 0 0 auto; }

/* ---------- Tabel ---------- */
.table { width: 100%; border-collapse: collapse; background: var(--surface); border-radius: 12px; overflow: hidden; }
.table th, .table td { border-bottom: 1px solid var(--border); padding: .6rem .7rem; text-align: left; font-size: .88rem; vertical-align: middle; }
.table th { background: var(--bg); font-weight: 700; position: sticky; top: 0; }
.table tr:hover td { background: color-mix(in srgb, var(--primary) 4%, transparent); }
.table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: 12px; }

/* ---------- Kartu daftar ---------- */
.card-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 1rem; }
.info-card {
  background: var(--surface); border: 1px solid var(--border); border-radius: 14px; padding: 1rem;
  color: var(--text); transition: .15s; display: block;
}
.info-card:hover { transform: translateY(-2px); box-shadow: 0 8px 20px rgba(15,23,42,.08); text-decoration: none; }
.info-card h4 { margin: .5rem 0 .3rem; font-size: 1rem; }
.list-stack { display: flex; flex-direction: column; gap: .8rem; }
.list-card {
  display: flex; gap: 1rem; background: var(--surface); border: 1px solid var(--border);
  border-radius: 14px; padding: .9rem 1rem; color: var(--text); align-items: center;
}
.list-card:hover { text-decoration: none; border-color: var(--primary); }
.list-card h3 { margin: .2rem 0 .25rem; font-size: 1.05rem; }
.list-thumb { width: 74px; height: 92px; border-radius: 10px; object-fit: cover; flex: 0 0 auto; }
.list-thumb-ph { display: flex; align-items: center; justify-content: center; font-size: 1.6rem; color: #fff; }
.empty { text-align: center; color: var(--muted); padding: 2.2rem 1rem; background: var(--surface); border: 1px dashed var(--border); border-radius: 14px; }

/* ---------- Detail buku ---------- */
.detail-grid { display: grid; grid-template-columns: 280px 1fr; gap: 1.6rem; margin-top: .8rem; }
.detail-cover { display: flex; flex-direction: column; gap: .5rem; }
.detail-cover img { border-radius: 12px; box-shadow: 0 10px 26px rgba(15,23,42,.14); }
.detail-info h1 { margin: .4rem 0 .2rem; font-size: 1.7rem; }
.detail-by { color: var(--muted); margin-top: 0; }
.meta-table { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: .45rem .9rem; margin: .9rem 0; }
.meta-table > div { display: flex; justify-content: space-between; gap: .5rem; border-bottom: 1px dashed var(--border); padding-bottom: .3rem; font-size: .88rem; }
.meta-table span { color: var(--muted); }
.synopsis { white-space: pre-line; color: var(--text); }
.pill { display: inline-block; padding: .2rem .7rem; border-radius: 999px; font-size: .8rem; font-weight: 700; }
.pill-loan { background: #eff6ff; color: #1d4ed8; }
.pill-admin_sekolah, .pill-pustakawan { background: #eff6ff; color: #1d4ed8; }
.pill-admin_pusat { background: #f5f3ff; color: #6d28d9; }
.pill-member { background: #ecfdf5; color: #047857; }
.progress { background: var(--border); border-radius: 999px; height: 10px; overflow: hidden; }
.progress > span { display: block; height: 100%; background: linear-gradient(90deg, var(--primary), var(--accent)); }

/* ---------- Rating ---------- */
.star-form { display: flex; gap: .5rem; align-items: center; flex-wrap: wrap; }
.star-opt { margin: 0; cursor: pointer; color: #f59e0b; font-size: 1.15rem; }
.star-opt input { display: none; }
.star-opt input:checked ~ *, .star-form:hover .star-opt { opacity: .55; }
.star-form .star-opt:hover { opacity: 1; }
.review { border-bottom: 1px dashed var(--border); padding: .55rem 0; }
.review-head { display: flex; gap: .6rem; align-items: center; flex-wrap: wrap; }
.review p { margin: .3rem 0 0; font-size: .92rem; }

/* ---------- Auth ---------- */
.auth-wrap { min-height: 72vh; display: flex; align-items: center; justify-content: center; padding: 2rem 1rem; }
.auth-card { background: var(--surface); border: 1px solid var(--border); border-radius: 18px; padding: 1.7rem; width: min(560px, 96vw); box-shadow: 0 18px 40px rgba(15,23,42,.08); }
.auth-head { text-align: center; margin-bottom: 1.1rem; }
.auth-head h1 { margin: .5rem 0 .1rem; font-size: 1.4rem; }
.auth-links { display: flex; justify-content: space-between; gap: .6rem; flex-wrap: wrap; margin-top: 1rem; font-size: .9rem; }
.demo-box { margin-top: 1rem; background: var(--bg); border: 1px dashed var(--border); border-radius: 10px; padding: .6rem .8rem; font-size: .87rem; }
.demo-box ul { margin: .4rem 0 0; padding-left: 1.1rem; }

/* ---------- Modal ---------- */
.modal { position: fixed; inset: 0; background: rgba(15,23,42,.55); display: flex; align-items: center; justify-content: center; z-index: 100; padding: 1rem; }
.modal[hidden] { display: none; }
.modal-box { background: var(--surface); border-radius: 16px; padding: 1.4rem; width: min(560px, 94vw); position: relative; }
.modal-box h3 { margin-top: 0; }
.modal-info { border-top: 5px solid var(--warn); }
.modal-close { position: absolute; top: .5rem; right: .8rem; background: none; border: 0; font-size: 1.6rem; cursor: pointer; color: var(--muted); }
.modal-box form { display: flex; gap: .5rem; flex-wrap: wrap; }
.modal-box form select { flex: 0 0 auto; width: auto; margin-top: 0; }
.modal-box form input { flex: 1 1 220px; margin-top: 0; }
body.modal-open { overflow: hidden; }

/* ---------- Rak ---------- */
.shelf-layout { display: grid; grid-template-columns: 260px 1fr; gap: 1rem; align-items: start; }
.shelf-list { display: flex; flex-direction: column; gap: .5rem; }
.shelf-item { display: flex; flex-direction: column; background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: .7rem .85rem; color: var(--text); }
.shelf-item:hover { border-color: var(--primary); text-decoration: none; }
.shelf-item.on { border-color: var(--primary); background: color-mix(in srgb, var(--primary) 7%, var(--surface)); }

/* ---------- Donasi ---------- */
.donation-card { display: flex; flex-direction: column; }
.donation-cover { border-radius: 10px; margin-bottom: .6rem; }

/* ---------- Profil ---------- */
.stat-cards { gap: .8rem; }
.stat-cards .stat { flex: 1; min-width: 130px; background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: .8rem; align-items: center; }
.profile-photo { display: flex; justify-content: center; margin-bottom: .7rem; }
.profile-photo img { width: 120px; height: 120px; border-radius: 50%; object-fit: cover; }
.avatar { width: 28px; height: 28px; border-radius: 50%; object-fit: cover; }
.avatar-txt { display: inline-flex; align-items: center; justify-content: center; background: var(--primary); color: #fff; font-weight: 700; }
.avatar-big { width: 120px; height: 120px; font-size: 2.6rem; }

/* ---------- Artikel ---------- */
.article-thumb { width: 100%; max-height: 340px; object-fit: cover; border-radius: 14px; margin: .8rem 0; }
.article-body { font-size: 1.02rem; }
.article-body p { margin: .8rem 0; }

/* ---------- Footer ---------- */
.site-footer { background: #0f172a; color: #cbd5e1; margin-top: 2.4rem; }
.footer-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 1.4rem; padding: 2rem 0 1rem; }
.footer-grid h4 { color: #fff; margin: 0 0 .6rem; }
.footer-grid a { display: block; color: #94a3b8; padding: .12rem 0; }
.footer-grid a:hover { color: #fff; }
.footer-bottom { text-align: center; border-top: 1px solid #1e293b; padding: .8rem; font-size: .85rem; color: #94a3b8; }

/* ---------- Pagination ---------- */
.pagination { display: flex; gap: .35rem; justify-content: center; margin-top: 1.4rem; flex-wrap: wrap; }
.pagination a { padding: .35rem .75rem; border: 1px solid var(--border); border-radius: 8px; background: var(--surface); color: var(--text); }
.pagination a.on { background: var(--primary); color: #fff; border-color: var(--primary); }

/* =========================================================
   READER
   ========================================================= */
.reader { min-height: 100vh; background: #f5f5f4; }
.reader.dark { background: #111827; color: #e5e7eb; }

/* ---------- Layar penuh (fullscreen) saat membaca ---------- */
.reader:fullscreen {
  width: 100vw;
  height: 100vh;
  background: #f5f5f4;      /* timpa default hitam UA */
  overflow-y: auto;          /* biarkan konten di-scroll */
}
.reader:fullscreen .reader-pdf { height: calc(100vh - 56px); }
.reader:fullscreen.dark { background: #111827; }
.reader:fullscreen::backdrop { background: #f5f5f4; }
.reader:fullscreen.dark::backdrop { background: #111827; }
/* Safari lama (prefix webkit) */
.reader:-webkit-full-screen { width: 100vw; height: 100vh; background: #f5f5f4; }
.reader:-webkit-full-screen .reader-pdf { height: calc(100vh - 56px); }
.reader-bar {
  position: sticky; top: 0; z-index: 40; display: flex; align-items: center; gap: .7rem;
  background: var(--surface); border-bottom: 1px solid var(--border); padding: .5rem .9rem; flex-wrap: wrap;
}
.reader-title { display: flex; flex-direction: column; line-height: 1.2; flex: 1; min-width: 160px; }
.reader-title strong { font-size: .95rem; }
.reader-title span { font-size: .78rem; }
.reader-tools { display: flex; gap: .25rem; flex-wrap: wrap; }
.tool {
  background: transparent; border: 1px solid var(--border); border-radius: 8px;
  padding: .25rem .5rem; cursor: pointer; font-size: 1rem;
}
.tool:hover { border-color: var(--primary); }
.tool-stat { cursor: default; font-size: .8rem; color: var(--muted); }
.reader.dark .tool { border-color: #374151; color: #e5e7eb; }
.reader.dark .reader-bar { background: #1f2937; border-color: #374151; }

.find-bar { display: flex; gap: .5rem; align-items: center; padding: .5rem .9rem; background: var(--surface); border-bottom: 1px solid var(--border); }
.find-bar input { margin-top: 0; max-width: 320px; }

.reader-body { max-width: 820px; margin: 0 auto; padding: 1.4rem 1rem 6rem; font-size: 100%; }
.reader-page { display: none; background: #fff; border-radius: 14px; padding: 1.8rem 2rem; box-shadow: 0 8px 24px rgba(0,0,0,.06); }
.reader-page.on { display: block; animation: fade .25s ease; }
.reader.dark .reader-page { background: #1f2937; box-shadow: none; }
.reader-page .page-title { margin-top: 0; border-bottom: 2px solid var(--primary); padding-bottom: .4rem; }
.reader-page p { margin: .85rem 0; text-align: justify; }
.reader-page mark { background: #fde68a; color: #111; border-radius: 3px; padding: 0 2px; }
@keyframes fade { from { opacity: .2; transform: translateY(6px);} to { opacity: 1; transform: none; } }

.reader-nav {
  position: fixed; bottom: 0; left: 0; right: 0; display: flex; gap: .8rem; align-items: center;
  background: var(--surface); border-top: 1px solid var(--border); padding: .55rem 1rem; z-index: 40;
}
.reader-nav input[type="range"] { flex: 1; margin-top: 0; }
.reader-pdf { height: calc(100vh - 56px); }
.reader-pdf iframe { width: 100%; height: 100%; border: 0; background: #fff; }

.toc-panel {
  position: fixed; top: 56px; right: 0; width: min(320px, 92vw); bottom: 0;
  background: var(--surface); border-left: 1px solid var(--border); padding: 1rem; overflow-y: auto; z-index: 45;
}
.toc-panel ul { list-style: none; padding: 0; margin: .4rem 0; }
.toc-panel li a { display: block; padding: .4rem .5rem; border-radius: 8px; color: var(--text); font-size: .9rem; }
.toc-panel li a:hover { background: var(--bg); text-decoration: none; }

/* ---------- Error pages ---------- */
.error-page { display: flex; align-items: center; justify-content: center; min-height: 100vh; background: var(--bg); }
.error-box { text-align: center; background: var(--surface); border: 1px solid var(--border); border-radius: 18px; padding: 2.4rem; width: min(460px, 92vw); }
.error-code { font-size: 3.4rem; font-weight: 800; color: var(--primary); }

/* ---------- Responsive ---------- */
@media (max-width: 900px) {
  .hero-inner { grid-template-columns: 1fr; }
  .hero-art { min-height: 150px; }
  .detail-grid { grid-template-columns: 1fr; }
  .detail-cover { max-width: 260px; }
  .shelf-layout { grid-template-columns: 1fr; }
  .grid-2 { grid-template-columns: 1fr; }
}
@media (max-width: 1000px) {
  .nav > a { padding: .45rem .5rem; }
  .brand-text small { display: none; }
}
@media (max-width: 760px) {
  .hero-section.has-banner { background-image: var(--hero-banner-mobile, var(--hero-banner-desktop)); }
  .nav { display: none; width: 100%; flex-direction: column; align-items: stretch; overflow-x: visible; }
  .nav.open { display: flex; }
  .nav-burger { display: inline-block; order: 99; }
  .header-inner { justify-content: space-between; }
  .book-grid { grid-template-columns: repeat(auto-fill, minmax(128px, 1fr)); }
  .banner img { max-height: 160px; }
}

/* ---------- Print ---------- */
@media print {
  .site-header, .site-footer, .offline-banner, .filter-bar, .btn, .reader-nav, .reader-tools { display: none !important; }
  body { background: #fff; }
  .table { border: 1px solid #000; }
}
