.lhf-book {
  width: 100%;
  max-width: 960px;
  margin: 0 auto 8px;
  font-family: system-ui, -apple-system, "Hind Siliguri", sans-serif;
}
.lhf-toolbar {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}
.lhf-btn {
  min-width: 44px;
  height: 44px;
  border: 0;
  border-radius: 12px;
  background: #0f172a;
  color: #fff;
  font-size: 1.2rem;
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  padding: 0 14px;
  box-shadow: 0 4px 14px rgba(15, 23, 42, 0.25);
  transition: transform 0.15s, background 0.15s, box-shadow 0.15s;
}
.lhf-btn:hover {
  background: #1e293b;
  transform: translateY(-2px) scale(1.04);
  color: #fff;
  box-shadow: 0 8px 20px rgba(15, 23, 42, 0.3);
}
.lhf-btn:disabled {
  opacity: 0.35;
  cursor: default;
  transform: none;
  box-shadow: none;
}
.lhf-page {
  font-weight: 800;
  font-size: 0.95rem;
  color: #0f172a;
  min-width: 80px;
  text-align: center;
  background: #fff;
  padding: 8px 12px;
  border-radius: 10px;
  border: 1px solid #e2e8f0;
}
.lhf-stage {
  position: relative;
  background:
    radial-gradient(ellipse at 50% 100%, rgba(0,0,0,0.12), transparent 55%),
    linear-gradient(180deg, #d2d8e6 0%, #b4bccd 100%);
  border-radius: 16px;
  padding: 24px 16px 32px;
  min-height: var(--lhf-h, 580px);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.35);
}
.lhf-loading {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  color: #475569;
  z-index: 2;
  letter-spacing: 0.02em;
}
.lhf-book.is-ready .lhf-loading { display: none; }
.lhf-flip {
  width: 100%;
  max-width: 920px;
  margin: 0 auto;
  min-height: 200px;
  display: flex;
  align-items: center;
  justify-content: center;
  touch-action: pan-y;
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
  -webkit-tap-highlight-color: transparent;
  overflow: hidden;
  cursor: grab;
}
.lhf-flip:active { cursor: grabbing; }

/* ---------- 3D book ---------- */
.lhf-b3d {
  position: relative;
  flex: none;
  transform-style: flat;
  transition: transform 0.7s cubic-bezier(.4, 0, .2, 1);
}
.lhf-b3d.is-dragging { transition: none; }
.lhf-leaf {
  position: absolute;
  top: 0;
  left: 50%;
  width: 50%;
  height: 100%;
  transform-origin: left center;
  transform-style: preserve-3d;
  will-change: transform;
  background: #faf8f5;
}
.lhf-b3d.is-mobile .lhf-leaf { left: 0; width: 100%; }
.lhf-face {
  position: absolute;
  inset: 0;
  overflow: hidden;
  background: #faf8f5;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
}
.lhf-back { transform: rotateY(180deg); }
.lhf-face:not(.is-loaded):not(.is-blank) {
  background: linear-gradient(100deg, #f1ede6 30%, #faf8f5 50%, #f1ede6 70%);
  background-size: 200% 100%;
  animation: lhf-shimmer 1.2s linear infinite;
}
@keyframes lhf-shimmer { to { background-position: -200% 0; } }
.lhf-face img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: fill;
  pointer-events: none;
  -webkit-user-drag: none;
  -webkit-touch-callout: none;
}
.lhf-shade {
  position: absolute;
  inset: 0;
  background: #000;
  opacity: 0;
  pointer-events: none;
}
/* spine shading, so it looks like a bound book */
.lhf-face::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: linear-gradient(to right, rgba(0,0,0,.20), rgba(0,0,0,0) 9%);
}
.lhf-back::after {
  background: linear-gradient(to left, rgba(0,0,0,.20), rgba(0,0,0,0) 9%);
}
.lhf-face.is-blank { background: #f3efe8; }
.lhf-b3d.is-mobile .lhf-back::after { background: linear-gradient(to left, rgba(0,0,0,.10), rgba(0,0,0,0) 30%); }

.lhf-error {
  color: #9a3412;
  background: #fff7ed;
  border: 1px solid #fdba74;
  padding: 18px 22px;
  border-radius: 12px;
  font-weight: 600;
  text-align: center;
}
.lhf-error a { color: #c2410c; }
/* ---------- zoom wrapper ---------- */
.lhf-zoom {
  flex: none;
  transform-origin: center center;
  will-change: transform;
}
.lhf-zoom.is-anim { transition: transform 0.28s cubic-bezier(.3, .7, .3, 1); }
.lhf-flip.is-zoomed { cursor: move; }
.lhf-b3d.is-jump { animation: lhf-pop 0.35s ease; }
@keyframes lhf-pop { from { opacity: 0; transform: scale(.96); } to { opacity: 1; } }

/* ---------- toolbar groups ---------- */
.lhf-grp {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  flex-wrap: wrap;
}
.lhf-toolbar { gap: 10px 18px; }
.lhf-btn.is-on { background: #2563eb; }
.lhf-zlevel { min-width: 64px; font-size: 0.9rem; }
.lhf-page.is-click { cursor: pointer; }
.lhf-jump {
  width: 80px;
  height: 36px;
  text-align: center;
  font-weight: 800;
  font-size: 1rem;
  border: 2px solid #2563eb;
  border-radius: 10px;
  background: #fff;
  color: #0f172a;
}
.lhf-jump[hidden], .lhf-page[hidden], .lhf-thumbs[hidden] { display: none !important; }

/* ---------- thumbnails ---------- */
.lhf-thumbs {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 10px 4px 4px;
  margin-top: 10px;
  scrollbar-width: thin;
  -webkit-overflow-scrolling: touch;
}
.lhf-th {
  flex: none;
  width: 58px;
  border: 2px solid transparent;
  border-radius: 6px;
  background: #fff;
  padding: 0;
  cursor: pointer;
  overflow: hidden;
  position: relative;
  box-shadow: 0 2px 8px rgba(15, 23, 42, .25);
}
.lhf-th img {
  display: block;
  width: 100%;
  aspect-ratio: 3 / 4;
  object-fit: cover;
  background: #e5e7eb;
}
.lhf-th span {
  position: absolute;
  bottom: 2px;
  right: 3px;
  font: 700 11px/1 system-ui, sans-serif;
  color: #fff;
  background: rgba(15, 23, 42, .75);
  padding: 2px 5px;
  border-radius: 6px;
}
.lhf-th.is-cur { border-color: #2563eb; }

/* ---------- hint toast ---------- */
.lhf-toast {
  position: absolute;
  left: 50%;
  bottom: 14px;
  transform: translateX(-50%);
  background: rgba(15, 23, 42, .88);
  color: #fff;
  font: 600 13px/1.3 system-ui, sans-serif;
  padding: 8px 14px;
  border-radius: 20px;
  z-index: 20;
  pointer-events: none;
  white-space: nowrap;
  transition: opacity .5s;
}
.lhf-toast.is-hide { opacity: 0; }

/* ---------- night mode ---------- */
.lhf-book.is-night .lhf-stage {
  background: radial-gradient(ellipse at 50% 100%, rgba(0,0,0,.5), transparent 60%), linear-gradient(180deg, #1e293b, #0b1220);
}
.lhf-book.is-night .lhf-face img { filter: invert(.9) hue-rotate(180deg) brightness(.95); }
.lhf-book.is-night .lhf-leaf,
.lhf-book.is-night .lhf-face { background: #181a1f; }
.lhf-book.is-night .lhf-face.is-blank { background: #14161a; }

/* ---------- full screen / reading mode ---------- */
html.lhf-noscroll, html.lhf-noscroll body { overflow: hidden !important; }
.lhf-book.is-fs {
  position: fixed;
  inset: 0;
  z-index: 2147483000;
  max-width: none;
  width: auto;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
  background: #dbe1ec;
  overflow: hidden;
}
.lhf-book.is-fs.is-night { background: #0b1220; }
.lhf-book.is-fs .lhf-stage {
  flex: 1 1 auto;
  min-height: 0;
  border-radius: 0;
  padding: 4px;
}
.lhf-book.is-fs .lhf-flip { max-width: none; }
.lhf-book.is-fs .lhf-toolbar,
.lhf-book.is-fs .lhf-thumbs {
  position: absolute;
  left: 0;
  right: 0;
  z-index: 30;
  margin: 0;
  background: rgba(15, 23, 42, .62);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
  transition: transform .35s ease, opacity .35s ease;
}
.lhf-book.is-fs .lhf-toolbar { top: 0; padding: 8px 8px 8px; }
.lhf-book.is-fs .lhf-thumbs { bottom: 0; padding: 10px 8px 12px; }
.lhf-book.is-fs.ui-hide .lhf-toolbar { transform: translateY(-110%); opacity: 0; pointer-events: none; }
.lhf-book.is-fs.ui-hide .lhf-thumbs { transform: translateY(110%); opacity: 0; pointer-events: none; }
.lhf-book.is-fs.ui-hide .lhf-flip { cursor: none; }

/* ---------- entrance motion ---------- */
.lhf-book.is-ready .lhf-flip { animation: lhf-enter .7s cubic-bezier(.2,.8,.2,1); }
@keyframes lhf-enter {
  from { opacity: 0; transform: translateY(28px) scale(.92) rotateX(10deg); }
  to   { opacity: 1; transform: none; }
}

/* ---------- hand guide ---------- */
.lhf-hand {
  position: absolute;
  inset: 0;
  z-index: 25;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(15, 23, 42, .38);
  border-radius: inherit;
  pointer-events: none;
}
.lhf-book.is-fs .lhf-hand { position: fixed; z-index: 2147483001; }
.lhf-hand-box {
  position: relative;
  width: 260px;
  height: 190px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
}
.lhf-hand-swipe, .lhf-hand-pinch { position: absolute; inset: 0 0 46px 0; display: none; }
.lhf-hand.is-swipe .lhf-hand-swipe, .lhf-hand.is-pinch .lhf-hand-pinch { display: block; }
.lhf-finger {
  position: absolute;
  top: 40%;
  left: 62%;
  font-size: 56px;
  line-height: 1;
  filter: drop-shadow(0 6px 8px rgba(0,0,0,.45));
  animation: lhf-swipe 1.1s ease-in-out infinite;
}
@keyframes lhf-swipe {
  0%   { transform: translateX(40px) rotate(-8deg); opacity: 0; }
  15%  { opacity: 1; }
  80%  { transform: translateX(-110px) rotate(-14deg); opacity: 1; }
  100% { transform: translateX(-130px) rotate(-14deg); opacity: 0; }
}
.lhf-hand-pinch i {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 34px;
  height: 34px;
  margin: -17px 0 0 -17px;
  border-radius: 50%;
  background: rgba(255, 255, 255, .85);
  box-shadow: 0 0 0 6px rgba(255, 255, 255, .28), 0 6px 14px rgba(0, 0, 0, .35);
}
.lhf-hand-pinch i.a { animation: lhf-pinch-a 1.4s ease-in-out infinite; }
.lhf-hand-pinch i.b { animation: lhf-pinch-b 1.4s ease-in-out infinite; }
@keyframes lhf-pinch-a { 0%, 100% { transform: translate(-14px, 14px); } 55% { transform: translate(-58px, -46px); } }
@keyframes lhf-pinch-b { 0%, 100% { transform: translate(14px, -14px); } 55% { transform: translate(58px, 46px); } }
.lhf-hand-txt {
  position: relative;
  margin: 0;
  color: #fff;
  font: 700 15px/1.3 system-ui, sans-serif;
  text-align: center;
  text-shadow: 0 2px 6px rgba(0,0,0,.6);
}

/* paper shading: darker toward the free edge of a lifted page */
.lhf-front .lhf-shade { background: linear-gradient(to right, rgba(0,0,0,.15), rgba(0,0,0,.95)); }
.lhf-back .lhf-shade  { background: linear-gradient(to left,  rgba(0,0,0,.15), rgba(0,0,0,.95)); }

@media (hover: none) {
  .lhf-btn:hover { transform: none; background: #0f172a; }
}
@media (max-width: 700px) {
  .lhf-stage { padding: 12px 6px 16px; min-height: 0; }
  .lhf-btn { min-width: 38px; height: 38px; padding: 0 10px; font-size: 1.05rem; }
  .lhf-zlevel { min-width: 56px; font-size: .8rem; }
  .lhf-toolbar { gap: 8px 12px; margin-bottom: 10px; }
  .lhf-grp { gap: 6px; }
  .lhf-th { width: 48px; }
  .lhf-book.is-fs .lhf-toolbar { padding-top: max(8px, env(safe-area-inset-top)); }
  .lhf-toast { font-size: 12px; }
}
@media (prefers-reduced-motion: reduce) {
  .lhf-b3d { transition: none; }
}
