/* MHK Library — a bookstore-style catalogue (light) with a night-desk reader (dark).
   Layout: sticky search header, featured hero, horizontal shelves, book page with reviews. */
:root {
  --bg: #ffffff;
  --surface: #f4f3ef;
  --ink: #14202b;
  --ink-2: #3a4652;
  --muted: #6b7682;
  --line: #e3e1da;
  --accent: #1d5c63;          /* deep teal, from the cover's shadows */
  --accent-ink: #ffffff;
  --brass: #b4842f;           /* clock brass */
  --star: #e2a521;
  --danger: #b3261e;
  --hero: #14202b;
  --hero-ink: #f3ece0;
  --radius: 10px;
  --display: "Fraunces", "Iowan Old Style", Georgia, serif;
  --ui: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --urdu: "Noto Nastaliq Urdu", "Noto Naskh Arabic", serif;
  --hindi: "Noto Sans Devanagari", "Kohinoor Devanagari", sans-serif;
  color-scheme: light;
}
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 15px/1.55 var(--ui); min-height: 100vh; display: flex; flex-direction: column; }
img { max-width: 100%; display: block; }
a { color: var(--accent); }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
[hidden] { display: none !important; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; left: -999px; top: 8px; z-index: 100; background: var(--ink); color: #fff; padding: 8px 12px; border-radius: 6px; }
.skip:focus { left: 8px; }
.hi { font-family: var(--hindi); }
.ur { font-family: var(--urdu); line-height: 1.9; }

.wrap { width: 100%; max-width: 1180px; margin-inline: auto;
  padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); }
.main { flex: 1; padding-block: 28px 56px; outline: none; }

/* ---------- buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 42px; padding: 0 18px;
  border-radius: 999px; border: 1px solid var(--line); background: var(--bg); cursor: pointer; text-decoration: none;
  font-weight: 500; color: var(--ink); white-space: nowrap; }
.btn:hover { border-color: var(--ink-2); }
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn-primary:hover { background: #17494f; border-color: #17494f; }
.btn-block { width: 100%; }
.btn-sm { min-height: 34px; padding: 0 14px; font-size: 0.9rem; }
.btn-link { border: 0; background: none; padding: 0; color: var(--accent); cursor: pointer; text-decoration: underline; min-height: 0; }

/* ---------- header */
.site-head { position: sticky; top: 0; z-index: 20; background: var(--bg); border-bottom: 1px solid var(--line);
  padding-top: env(safe-area-inset-top, 0px); }
.head-row { display: flex; align-items: center; gap: 18px; min-height: 64px; }
.logo { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--ink); font-family: var(--display); font-weight: 600; font-size: 1.25rem; white-space: nowrap; }
.logo-mark { width: 26px; height: 26px; border-radius: 50%; border: 2px solid var(--brass); position: relative; flex-shrink: 0; }
.logo-mark::before, .logo-mark::after { content: ""; position: absolute; left: 50%; top: 50%; width: 2px; background: var(--brass); transform-origin: 50% 0; border-radius: 1px; }
.logo-mark::before { height: 7px; transform: rotate(160deg); }
.logo-mark::after { height: 9px; transform: rotate(255deg); }
.search { flex: 1; display: flex; max-width: 520px; margin-inline: auto; border: 1px solid var(--line); border-radius: 999px; background: var(--surface); overflow: hidden; }
.search:focus-within { border-color: var(--accent); background: var(--bg); }
.search input { flex: 1; min-width: 0; border: 0; background: transparent; padding: 10px 16px; outline: none; }
.search button { border: 0; background: transparent; padding: 0 14px; cursor: pointer; color: var(--muted); }
.head-nav { display: flex; align-items: center; gap: 14px; }
.nav-link { color: var(--ink); text-decoration: none; font-weight: 500; }
.nav-link:hover { color: var(--accent); }
.user-area { display: flex; align-items: center; gap: 8px; position: relative; }
.avatar { width: 36px; height: 36px; border-radius: 50%; background: var(--accent); color: #fff; display: grid; place-items: center; font-weight: 600; border: 0; cursor: pointer; }
.menu { position: absolute; right: 0; top: calc(100% + 8px); width: 260px; background: var(--bg); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: 0 12px 32px rgba(20, 32, 43, 0.14); padding: 14px; display: grid; gap: 10px; z-index: 30; }
.menu .who { display: grid; gap: 2px; min-width: 0; }
.menu .who b { font-weight: 600; }
.menu .who span { color: var(--muted); font-size: 0.85rem; overflow-wrap: anywhere; }

@media (max-width: 760px) {
  .head-row { flex-wrap: wrap; gap: 10px 14px; padding-block: 10px; }
  .search { order: 3; flex-basis: 100%; max-width: none; }
  .head-nav { margin-left: auto; gap: 8px; }
  .head-row { flex-wrap: wrap; }
  .logo { font-size: 1.1rem; }
}
@media (max-width: 440px) {
  .nav-link { display: none; }
  .head-row { column-gap: 8px; }
  .logo { gap: 8px; font-size: 1.02rem; }
  .logo-mark { width: 22px; height: 22px; }
  .user-area .btn-sm { padding: 0 11px; }
}

/* ---------- stars */
.stars { --size: 15px; display: inline-flex; gap: 1px; vertical-align: middle; }
.stars i { width: var(--size); height: var(--size); display: block; background: #d9d6cc;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M12 2.5l2.9 6.1 6.6.8-4.9 4.5 1.3 6.6L12 17.2l-5.9 3.3 1.3-6.6-4.9-4.5 6.6-.8z'/%3E%3C/svg%3E") center/contain no-repeat;
          mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M12 2.5l2.9 6.1 6.6.8-4.9 4.5 1.3 6.6L12 17.2l-5.9 3.3 1.3-6.6-4.9-4.5 6.6-.8z'/%3E%3C/svg%3E") center/contain no-repeat; }
.stars i.on { background: var(--star); }
.stars i.half { background: linear-gradient(90deg, var(--star) 50%, #d9d6cc 50%); }
.rating-line { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 0.88rem; flex-wrap: wrap; }
.rating-line b { color: var(--ink); font-weight: 600; }

/* ---------- covers & cards */
.cover { aspect-ratio: 5 / 7; width: 100%; object-fit: cover; border-radius: 3px 6px 6px 3px; background: var(--surface);
  box-shadow: inset 3px 0 0 rgba(255,255,255,.08), 0 1px 2px rgba(0,0,0,.12), 0 10px 24px -10px rgba(20,32,43,.45); }
.card { display: grid; grid-template-rows: 1fr auto; gap: 10px; min-width: 0; }
.card-link { display: grid; align-content: start; gap: 8px; text-decoration: none; color: var(--ink); min-width: 0; }
.card-read { width: 100%; }
.card-link:hover .cover { transform: translateY(-3px); }
.card .cover { transition: transform .2s ease; }
.card h3 { font: 600 0.98rem/1.3 var(--ui); margin: 4px 0 0; text-wrap: balance; }
.card .by { color: var(--muted); font-size: 0.86rem; }
.langs-mini { display: flex; gap: 4px; flex-wrap: wrap; }
.chip { display: inline-flex; align-items: center; gap: 4px; border: 1px solid var(--line); border-radius: 999px; padding: 2px 9px; font-size: 0.76rem; color: var(--ink-2); background: var(--bg); text-decoration: none; }
a.chip:hover { border-color: var(--accent); color: var(--accent); }

.shelf { margin-top: 44px; }
.shelf-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 16px; }
.shelf-head h2, .page-title { font: 600 1.45rem/1.2 var(--display); margin: 0; }
.shelf-head a { font-weight: 500; text-decoration: none; white-space: nowrap; }
.shelf-row { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(150px, 180px); gap: 22px; overflow-x: auto; padding-bottom: 10px; scroll-snap-type: x proximity; }
.shelf-row > * { scroll-snap-align: start; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 30px 22px; }
.empty { padding: 28px; border: 1px dashed var(--line); border-radius: var(--radius); color: var(--muted); text-align: center; }

/* ---------- hero */
.hero { background: var(--hero); color: var(--hero-ink); border-radius: 16px; overflow: hidden; position: relative;
  display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.25fr); align-items: center; gap: clamp(20px, 5vw, 64px);
  padding: clamp(24px, 5vw, 56px); }
.hero::before { content: ""; position: absolute; inset: 0; background: radial-gradient(ellipse 60% 80% at 25% 40%, rgba(180,132,47,.25), transparent 70%); pointer-events: none; }
.hero > * { position: relative; }
.hero .cover { max-width: 300px; margin-inline: auto; transform: perspective(1400px) rotateY(-10deg); box-shadow: 0 30px 60px -20px rgba(0,0,0,.7), 8px 8px 0 -2px #e9e1d2, 9px 9px 0 -2px #a99c86; }
.eyebrow { font-size: 0.74rem; font-weight: 600; letter-spacing: .16em; text-transform: uppercase; color: var(--brass); }
.hero h1 { font: 600 clamp(1.9rem, 4.2vw, 3.1rem)/1.06 var(--display); margin: 10px 0 6px; text-wrap: balance; }
.hero .by { color: #c8bfae; margin: 0 0 14px; }
.hero .blurb { font: italic 400 1.15rem/1.5 var(--display); color: #efe6d6; margin: 0 0 12px; max-width: 46ch; }
.hero p.desc { color: #c8bfae; max-width: 58ch; margin: 0 0 20px; }
.hero .rating-line { color: #c8bfae; margin-bottom: 18px; }
.hero .rating-line b { color: #fff; }
.hero-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.hero .btn { border-color: rgba(243,236,224,.3); background: transparent; color: var(--hero-ink); }
.hero .btn:hover { border-color: var(--hero-ink); }
.hero .btn-primary { background: var(--brass); border-color: var(--brass); color: #1a1408; }
.hero .btn-primary:hover { background: #c99539; border-color: #c99539; }
@media (max-width: 760px) {
  .hero { grid-template-columns: 1fr; text-align: center; }
  .hero .cover { max-width: 190px; transform: none; }
  .hero .blurb, .hero p.desc { margin-inline: auto; }
  .hero-actions, .hero .rating-line { justify-content: center; }
}

.lang-strip { margin-top: 26px; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.lang-strip a { background: var(--surface); border-radius: var(--radius); padding: 16px 18px; display: grid; gap: 4px; text-decoration: none; color: var(--ink); border: 1px solid transparent; transition: border-color .15s, background .15s; }
.lang-strip a:hover { border-color: var(--accent); background: var(--bg); }
.lang-strip em { font-style: normal; font-weight: 600; color: var(--accent); font-size: 0.9rem; margin-top: 4px; }
.cover-link { display: block; border-radius: 3px 6px 6px 3px; }
.cover-link:hover .cover { transform: translateY(-3px); }
.book-cover .cover { transition: transform .2s ease; }
.lang-strip b { font-weight: 600; }
.lang-strip span { color: var(--muted); font-size: 0.88rem; }
@media (max-width: 760px) { .lang-strip { grid-template-columns: 1fr; } }

/* ---------- browse */
.browse { display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: 32px; margin-top: 18px; }
.filters { display: grid; gap: 22px; align-content: start; }
.filters h3 { font: 600 0.78rem/1 var(--ui); letter-spacing: .12em; text-transform: uppercase; color: var(--muted); margin: 0 0 10px; }
.filters ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
.filters button { width: 100%; text-align: left; border: 0; background: none; padding: 7px 10px; border-radius: 8px; cursor: pointer; display: flex; justify-content: space-between; gap: 8px; }
.filters button:hover { background: var(--surface); }
.filters button[aria-pressed="true"] { background: var(--accent); color: #fff; }
.filters button span { color: inherit; opacity: .7; font-variant-numeric: tabular-nums; }
.browse-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 20px; }
.browse-top p { margin: 0; color: var(--muted); }
.select { border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; background: var(--bg); }
@media (max-width: 760px) {
  .browse { grid-template-columns: 1fr; gap: 18px; }
  .filters { grid-template-columns: 1fr 1fr; gap: 14px; }
}

/* ---------- book page */
.crumbs { font-size: 0.86rem; color: var(--muted); display: flex; gap: 6px; flex-wrap: wrap; }
.crumbs a { color: var(--muted); text-decoration: none; }
.crumbs a:hover { color: var(--accent); }
.book { display: grid; grid-template-columns: minmax(0, 300px) minmax(0, 1fr); gap: clamp(24px, 5vw, 56px); margin-top: 20px; align-items: start; }
.book-cover { display: grid; gap: 12px; }
.book-cover .back-toggle { justify-self: center; }
.cover-read { min-height: 50px; font-size: 1.05rem; }
.cover-lang { display: grid; grid-template-columns: auto 1fr; align-items: center; gap: 8px; font-size: 0.86rem; color: var(--muted); }
.cover-lang select { min-height: 38px; padding: 0 10px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); color: var(--ink); font: inherit; font-size: 0.92rem; min-width: 0; }
.cover-note { margin: -4px 0 0; text-align: center; font-size: 0.84rem; color: var(--muted); }
.book h1 { font: 600 clamp(1.8rem, 3.6vw, 2.6rem)/1.08 var(--display); margin: 6px 0 4px; text-wrap: balance; }
.book .sub { font: italic 400 1.1rem var(--display); color: var(--ink-2); margin: 0 0 6px; }
.book .by { margin: 0 0 14px; color: var(--ink-2); }
.book .series { color: var(--muted); font-size: 0.9rem; margin: 0 0 14px; }
.genres { display: flex; gap: 6px; flex-wrap: wrap; margin: 14px 0 22px; }
.read-box { border: 1px solid var(--line); border-radius: 14px; padding: 18px; display: grid; gap: 12px; background: var(--surface); }
.read-box h2 { font: 600 0.8rem/1 var(--ui); letter-spacing: .12em; text-transform: uppercase; color: var(--muted); margin: 0; }
.read-langs { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; }
.read-lang { display: flex; align-items: center; justify-content: space-between; gap: 10px; min-height: 56px; padding: 8px 16px;
  border-radius: 10px; border: 1px solid var(--line); background: var(--bg); cursor: pointer; text-align: left; }
.read-lang:hover { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.read-lang .n { font-size: 1.15rem; font-weight: 500; }
.read-lang .n.ur { font-size: 1.2rem; }
.read-lang .m { font-size: 0.78rem; color: var(--muted); white-space: nowrap; display: grid; justify-items: end; gap: 2px; }
.read-lang .m b { color: var(--accent); font-size: 0.88rem; font-weight: 600; }
.read-box { border-color: var(--accent); background: #eef4f3; }
.read-box h2 { color: var(--accent); font-size: 0.85rem; }
.prose { max-width: 66ch; }
.prose p { margin: 0 0 14px; }
.details { display: grid; grid-template-columns: max-content 1fr; gap: 8px 18px; margin: 0; font-size: 0.92rem; }
.details dt { color: var(--muted); }
.details dd { margin: 0; }
.section-title { font: 600 1.35rem/1.2 var(--display); margin: 40px 0 16px; }
@media (max-width: 760px) {
  .book { grid-template-columns: 1fr; }
  .book-cover { max-width: 220px; margin-inline: auto; }
}

/* ---------- reviews */
.reviews { display: grid; grid-template-columns: minmax(0, 300px) minmax(0, 1fr); gap: clamp(24px, 5vw, 56px); align-items: start; }
.summary { display: grid; gap: 10px; }
.summary .big { font: 600 3rem/1 var(--display); }
.dist { display: grid; gap: 6px; margin-top: 6px; }
.dist div { display: grid; grid-template-columns: 46px 1fr 32px; align-items: center; gap: 8px; font-size: 0.84rem; color: var(--muted); font-variant-numeric: tabular-nums; }
.bar { height: 8px; border-radius: 4px; background: var(--surface); overflow: hidden; }
.bar span { display: block; height: 100%; background: var(--star); border-radius: 4px; }
.write { border: 1px solid var(--line); border-radius: 14px; padding: 18px; display: grid; gap: 12px; }
.write h3 { margin: 0; font: 600 1.05rem var(--ui); }
.star-input { display: flex; gap: 2px; }
.star-input button { border: 0; background: none; padding: 2px; cursor: pointer; }
.star-input button i { --size: 30px; }
.star-input .stars { --size: 30px; }
.row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
textarea, .field { width: 100%; border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; background: var(--bg); }
textarea { min-height: 110px; resize: vertical; }
textarea:focus, .field:focus, .auth input:focus, .auth select:focus { border-color: var(--accent); outline: none; box-shadow: 0 0 0 3px rgba(29,92,99,.15); }
.count-hint { color: var(--muted); font-size: 0.8rem; margin-left: auto; font-variant-numeric: tabular-nums; }
.review-list { list-style: none; margin: 18px 0 0; padding: 0; display: grid; }
.review { display: grid; grid-template-columns: 40px minmax(0, 1fr); gap: 12px; padding: 18px 0; border-top: 1px solid var(--line); }
.review .av { width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; font-weight: 600; color: #fff; background: var(--accent); }
.review .meta { display: flex; gap: 8px 12px; align-items: center; flex-wrap: wrap; font-size: 0.85rem; color: var(--muted); }
.review .meta b { color: var(--ink); font-size: 0.95rem; }
.review p { margin: 8px 0 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.review .act { margin-top: 6px; }
@media (max-width: 760px) { .reviews { grid-template-columns: 1fr; } }

/* ---------- auth dialog */
.auth { border: 0; border-radius: 16px; padding: 26px; width: min(440px, calc(100vw - 24px)); max-height: calc(100dvh - 24px); overflow-y: auto; box-shadow: 0 30px 80px rgba(20,32,43,.35); color: var(--ink); }
.auth::backdrop { background: rgba(20, 32, 43, 0.55); }
.auth-x { position: absolute; right: 12px; top: 10px; margin: 0; }
.auth-x button { border: 0; background: none; font-size: 1.6rem; line-height: 1; cursor: pointer; color: var(--muted); padding: 4px 8px; }
.auth-tabs { display: grid; grid-template-columns: 1fr 1fr; background: var(--surface); border-radius: 999px; padding: 4px; margin: 8px 0 14px; }
.auth-tabs button { border: 0; background: none; border-radius: 999px; padding: 9px; cursor: pointer; font-weight: 500; color: var(--muted); }
.auth-tabs button[aria-selected="true"] { background: var(--bg); color: var(--ink); box-shadow: 0 1px 3px rgba(0,0,0,.12); }
.auth-why { margin: 0 0 14px; color: var(--muted); font-size: 0.92rem; }
.auth-form { display: grid; gap: 6px; }
.auth-form label { font-weight: 500; font-size: 0.9rem; margin-top: 8px; }
.auth-form .hint { color: var(--muted); font-weight: 400; }
.auth input, .auth select { width: 100%; border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; background: var(--bg); min-height: 44px; }
.pw { position: relative; }
.pw input { padding-right: 64px; }
.pw-eye { position: absolute; right: 6px; top: 50%; transform: translateY(-50%); border: 0; background: none; color: var(--accent); cursor: pointer; font-size: 0.85rem; padding: 6px; }
.phone { display: grid; grid-template-columns: minmax(0, 150px) minmax(0, 1fr); gap: 8px; }
.form-err { color: var(--danger); font-size: 0.88rem; margin: 6px 0 2px; min-height: 0; }
.form-err:empty { display: none; }
.auth .btn-block { margin-top: 12px; }
.fine { color: var(--muted); font-size: 0.8rem; margin: 10px 0 0; }
.hp { position: absolute; left: -5000px; width: 1px; height: 1px; overflow: hidden; }

.toast { position: fixed; left: 50%; bottom: calc(24px + env(safe-area-inset-bottom, 0px)); transform: translateX(-50%); z-index: 80;
  background: var(--ink); color: #fff; padding: 10px 18px; border-radius: 999px; box-shadow: 0 10px 30px rgba(0,0,0,.25); max-width: calc(100vw - 32px); }

.site-foot { border-top: 1px solid var(--line); padding-block: 22px calc(22px + env(safe-area-inset-bottom, 0px)); color: var(--muted); font-size: 0.88rem; }
.foot-row { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.foot-row a { color: var(--muted); }
.ai-note { margin: 10px 0 0; font-size: 0.72rem; color: var(--muted); opacity: .8; letter-spacing: .01em; }

/* =================================================================== reader (dark) */
.reader { position: fixed; inset: 0; z-index: 50; display: grid; grid-template-rows: auto 1fr auto; height: 100%; height: 100dvh;
  color: #f1e8d8; font-family: var(--ui); overflow: hidden;
  background: radial-gradient(ellipse 70% 55% at 50% 38%, rgba(201,163,94,.13), transparent 70%), radial-gradient(ellipse 120% 90% at 50% 100%, #142023, #0d1416 70%);
  background-color: #0d1416; }
.r-bar { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding-block: calc(10px + env(safe-area-inset-top, 0px)) 10px;
  padding-left: max(12px, env(safe-area-inset-left, 0px)); padding-right: max(12px, env(safe-area-inset-right, 0px)); }
.r-title { font-family: var(--display); font-size: 1.02rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; flex: 1; text-align: center; }
.r-tools { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
.r-ghost { border: 1px solid rgba(241,232,216,.16); background: transparent; border-radius: 999px; cursor: pointer; padding: 6px 14px; font-size: 0.85rem; min-height: 34px; color: #f1e8d8; }
.r-ghost:hover { border-color: rgba(241,232,216,.4); }
.r-langs { display: flex; border: 1px solid rgba(241,232,216,.16); border-radius: 999px; padding: 3px; gap: 2px; }
.r-langs button { border: 0; background: transparent; cursor: pointer; border-radius: 999px; padding: 4px 12px; font-size: 0.85rem; color: #a99c86; min-height: 30px; }
.r-langs button.ur { padding-block: 0; font-size: 0.92rem; }
.r-langs button[aria-pressed="true"] { background: #c9a35e; color: #1a1408; }
.r-stage { position: relative; display: grid; place-items: center; min-height: 0; padding-inline: 8px; }
.touch .r-stage, .touch .stf__parent { touch-action: pan-x pan-y pinch-zoom; -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }
.r-stage .page { background: #f6efe1; }
/* phones/tablets: swipe strip */
.r-stage .strip { position: absolute; inset: 0; display: flex; overflow-x: auto; overflow-y: hidden; scroll-snap-type: x mandatory;
  overscroll-behavior-x: contain; scrollbar-width: none; touch-action: pan-x pan-y pinch-zoom; -webkit-overflow-scrolling: touch; direction: ltr; }
.r-stage .strip::-webkit-scrollbar { display: none; }
.r-stage .strip .slide { flex: 0 0 100%; height: 100%; scroll-snap-align: center; scroll-snap-stop: always; display: flex; align-items: center; justify-content: center; padding: 8px 10px; box-sizing: border-box; container-type: size; }
.r-stage .strip img { width: min(100cqw, 100cqh * 560 / 784); height: auto; aspect-ratio: 560 / 784; object-fit: contain; display: block; background: #f6efe1; border-radius: 3px;
  box-shadow: 0 12px 34px rgba(0,0,0,.55), 0 0 0 1px rgba(255,255,255,.04); user-select: none; -webkit-user-drag: none; }
.r-stage .page img { width: 100%; height: 100%; display: block; object-fit: cover; user-select: none; -webkit-user-drag: none; }
.r-controls { display: flex; align-items: center; justify-content: center; gap: 14px; padding-block: 8px calc(12px + env(safe-area-inset-bottom, 0px));
  padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); }
.r-nav { width: 40px; height: 40px; border-radius: 50%; border: 1px solid rgba(241,232,216,.16); background: transparent; cursor: pointer; display: grid; place-items: center; font-size: 1.1rem; flex-shrink: 0; color: #f1e8d8; }
.r-nav:hover:not(:disabled) { border-color: #c9a35e; color: #c9a35e; }
.r-nav:disabled { opacity: .3; cursor: default; }
.r-track { display: grid; gap: 6px; width: min(420px, 60vw); }
.r-track input { width: 100%; accent-color: #c9a35e; }
.r-where { font-size: 0.78rem; color: #a99c86; text-align: center; font-variant-numeric: tabular-nums; }
.r-scrim { position: fixed; inset: 0; background: rgba(0,0,0,.5); z-index: 60; }
.r-drawer { position: fixed; top: 0; right: 0; bottom: 0; z-index: 61; width: min(380px, 92vw); overflow-y: auto; background: #172326; border-left: 1px solid rgba(241,232,216,.14);
  padding: calc(20px + env(safe-area-inset-top, 0px)) max(22px, env(safe-area-inset-right, 0px)) calc(20px + env(safe-area-inset-bottom, 0px)) 22px; display: grid; align-content: start; gap: 14px; }
.r-drawer header { display: flex; align-items: center; justify-content: space-between; }
.r-drawer h2 { font: 500 1.6rem var(--display); margin: 0; }
.r-toc { list-style: none; margin: 0; padding: 0; display: grid; }
.r-toc button { width: 100%; display: grid; grid-template-columns: 1fr auto; align-items: baseline; gap: 2px 12px; background: transparent; border: 0; border-bottom: 1px solid rgba(241,232,216,.14); padding: 11px 2px; cursor: pointer; text-align: left; color: #f1e8d8; }
.r-toc button:hover .t, .r-toc button.here .t { color: #c9a35e; }
.r-toc .t.ur { font-size: 1.05rem; }
.r-toc .s { grid-column: 1; font-size: 0.78rem; color: #a99c86; }
.r-toc .p { grid-column: 2; grid-row: 1 / span 2; font-size: 0.8rem; color: #a99c86; font-variant-numeric: tabular-nums; }
@media (max-width: 640px) {
  .r-title { display: none; }
  .r-ghost .lbl { display: none; }
  .r-langs button { padding: 4px 9px; }
}
/* StPageFlip 2.0.7 stylesheet (src/Style/stPageFlip.css), inlined */
.stf__parent { position: relative; display: block; box-sizing: border-box; transform: translateZ(0); -ms-touch-action: pan-y; touch-action: pan-y; }
.sft__wrapper, .stf__wrapper { position: relative; width: 100%; height: 100%; box-sizing: border-box; }
.stf__parent canvas { position: absolute; width: 100%; height: 100%; left: 0; top: 0; }
.stf__block { position: absolute; width: 100%; height: 100%; box-sizing: border-box; perspective: 2000px; }
.stf__item { display: none; position: absolute; transform-style: preserve-3d; }
.stf__outerShadow, .stf__innerShadow, .stf__hardShadow, .stf__hardInnerShadow { position: absolute; left: 0; top: 0; }
body.reading { overflow: hidden; }

@media (prefers-reduced-motion: reduce) {
  .card .cover, .hero .cover { transition: none; transform: none; }
}

.read-note { margin: -4px 0 0; font-size: 0.88rem; color: var(--muted); }
.read-start { min-height: 50px; font-size: 1.02rem; }
.read-lang .m b { display: inline-block; padding: 3px 10px; border-radius: 999px; border: 1px solid var(--accent); }

/* ---------- plain book list in index.html, shown until the app loads (and read by search engines) */
.seo-list h1 { font-family: var(--display); margin: 0 0 4px; }
.seo-list p { color: var(--ink-2); margin: 0 0 18px; }
.seo-list ul { list-style: none; padding: 0; margin: 0; display: grid; gap: 14px; }
.seo-list a { display: flex; gap: 14px; align-items: center; text-decoration: none; color: var(--ink); }
.seo-list img { width: 70px; border-radius: 4px; }

/* ---------- book page for search engines and sharing: /books/<id>/ (book.php) */
.bp-nav { margin-left: auto; }
.bp { display: grid; grid-template-columns: minmax(200px, 300px) minmax(0, 1fr); gap: 40px; align-items: start; padding-block: 8px 24px; }
.bp .cover { width: 100%; height: auto; border-radius: 6px; box-shadow: 0 18px 40px rgba(20,32,43,.22); }
.bp h1 { font-family: var(--display); font-size: clamp(1.9rem, 4vw, 2.7rem); line-height: 1.1; margin: 0 0 6px; }
.bp .sub { color: var(--ink-2); font-size: 1.1rem; margin: 0 0 4px; }
.bp .by { color: var(--muted); margin: 0 0 14px; }
.bp .stars { color: var(--star); letter-spacing: 2px; }
.bp .rate { margin: 0 0 16px; color: var(--ink-2); }
.bp .blurb { font-family: var(--display); font-style: italic; font-size: 1.2rem; margin: 0 0 14px; }
.bp .reads { display: flex; flex-wrap: wrap; gap: 10px; margin: 20px 0 8px; }
.bp .chips { display: flex; flex-wrap: wrap; gap: 8px; margin: 14px 0; }
.bp .chips span { border: 1px solid var(--line); border-radius: 999px; padding: 3px 12px; font-size: .88rem; color: var(--ink-2); }
.bp h2 { font-family: var(--display); font-size: 1.3rem; margin: 30px 0 10px; }
.bp ol { padding-left: 1.3em; color: var(--ink-2); }
.bp ol li { margin: 4px 0; }
.bp .eds { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 10px; }
.bp .eds a { display: block; border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; text-decoration: none; color: var(--ink); }
.bp .eds a:hover { border-color: var(--accent); }
.bp .eds b { display: block; font-size: 1.15rem; }
.bp .eds span { color: var(--muted); font-size: .88rem; }
@media (max-width: 720px) {
  .bp { grid-template-columns: minmax(0, 1fr); gap: 24px; }
  .bp .bp-cover { max-width: 260px; }
  .bp .eds { grid-template-columns: 1fr 1fr; }
}
.crumbs + .bp { margin-top: 18px; }
