/* ============================================================
   BOOK DETAIL PAGE — ULTRA-PREMIUM DESIGN
   ============================================================ */

*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }

:root {
  --bg: #0a1220;
  --surface: #111c2e;
  --surface2: #162235;
  --gold: #f4d03f;
  --gold-dim: #c9a227;
  --text: #e2e8f0;
  --muted: #94a3b8;
  --border: rgba(255,255,255,0.07);
  --radius: 16px;
}

/* Cinematic film grain */
body::after {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 9998;
  opacity: 0.04;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.65' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

body {
  font-family: 'Inter', 'Merriweather', serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.7;
  cursor: none;
  min-height: 100vh;
}
@media (max-width: 768px) { body { cursor: auto; } }

/* ── Custom cursor ── */
.custom-cursor {
  position: fixed;
  width: 12px; height: 12px;
  background: var(--gold);
  border-radius: 50%;
  pointer-events: none;
  z-index: 20000;
  transform: translate(-50%, -50%);
  transition: width 0.3s, height 0.3s, background 0.3s;
  box-shadow: 0 0 10px rgba(244,208,63,0.6);
  mix-blend-mode: screen;
}
.custom-cursor.hover {
  width: 45px; height: 45px;
  background: rgba(244,208,63,0.15);
  border: 1px solid var(--gold);
  box-shadow: 0 0 20px rgba(244,208,63,0.4);
}
@media (max-width: 768px) { .custom-cursor { display: none !important; } }

/* ── Page layout ── */
.book-detail-page {
  max-width: 1180px;
  margin: 0 auto;
  padding: 110px 5% 5rem;
}

/* ── Breadcrumb ── */
.breadcrumb {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.85rem;
  color: var(--muted);
  margin-bottom: 2.5rem;
  flex-wrap: wrap;
}
.breadcrumb a {
  color: var(--gold);
  text-decoration: none;
  transition: opacity 0.2s;
}
.breadcrumb a:hover { opacity: 0.7; }
.breadcrumb span { color: var(--muted); }
.breadcrumb .sep { opacity: 0.4; }

/* ── Main detail card ── */
.book-detail {
  display: grid;
  grid-template-columns: 300px 1fr;
  gap: 3.5rem;
  align-items: start;
}
@media (max-width: 860px) {
  .book-detail { grid-template-columns: 1fr; }
  .cover-col { display: flex; justify-content: center; }
}

/* ── Cover ── */
.cover-col { position: sticky; top: 100px; }
.book-cover-img {
  width: 100%;
  max-width: 300px;
  border-radius: var(--radius);
  box-shadow: 0 20px 60px rgba(0,0,0,0.7), 0 0 0 1px rgba(244,208,63,0.1);
  display: block;
  aspect-ratio: 2/3;
  object-fit: cover;
  transition: transform 0.4s, box-shadow 0.4s;
}
.book-cover-img:hover {
  transform: translateY(-8px) scale(1.02);
  box-shadow: 0 30px 80px rgba(0,0,0,0.8), 0 0 0 1px rgba(244,208,63,0.25), 0 0 40px rgba(244,208,63,0.1);
}

/* ── Info col ── */
.genre-badge {
  display: inline-block;
  padding: 0.3rem 0.9rem;
  background: rgba(244,208,63,0.1);
  border: 1px solid rgba(244,208,63,0.3);
  border-radius: 999px;
  color: var(--gold);
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin-bottom: 1rem;
}

.book-title {
  font-family: 'Merriweather', serif;
  font-size: clamp(1.6rem, 4vw, 2.5rem);
  font-weight: 700;
  line-height: 1.25;
  background: linear-gradient(135deg, #f4d03f 0%, #ffe993 50%, #d4af37 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  background-size: 200% auto;
  animation: goldShimmer 6s linear infinite;
  margin-bottom: 0.4rem;
}
@keyframes goldShimmer {
  0%   { background-position: 0% 50%; }
  50%  { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}

.book-author {
  font-size: 1rem;
  color: var(--muted);
  font-style: italic;
  margin-bottom: 1.5rem;
}

/* ── Meta pills ── */
.meta-pills {
  display: flex;
  gap: 0.6rem;
  flex-wrap: wrap;
  margin-bottom: 1.8rem;
}
.meta-pill {
  padding: 0.35rem 1rem;
  border-radius: 999px;
  background: rgba(255,255,255,0.06);
  border: 1px solid var(--border);
  font-size: 0.8rem;
  color: var(--muted);
}

/* ── Action buttons ── */
.actions {
  display: flex;
  gap: 1rem;
  margin-bottom: 2rem;
  flex-wrap: wrap;
}
.btn-read {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 1.8rem;
  background: linear-gradient(135deg, #f4d03f, #c9a227);
  color: #0a1220;
  border: none;
  border-radius: 999px;
  font-weight: 700;
  font-size: 0.95rem;
  cursor: pointer;
  transition: all 0.3s;
  box-shadow: 0 4px 15px rgba(244,208,63,0.25);
}
.btn-read:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(244,208,63,0.4);
}
.btn-list {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 1.8rem;
  background: transparent;
  color: var(--gold);
  border: 1.5px solid rgba(244,208,63,0.4);
  border-radius: 999px;
  font-weight: 600;
  font-size: 0.95rem;
  cursor: pointer;
  transition: all 0.3s;
}
.btn-list:hover {
  background: rgba(244,208,63,0.1);
  border-color: var(--gold);
}

/* ── Divider ── */
.divider {
  height: 1px;
  background: var(--border);
  margin: 1.8rem 0;
}

/* ── Description ── */
.description {
  font-size: 0.97rem;
  color: #b0bec5;
  line-height: 1.9;
  margin-bottom: 2rem;
}

/* ── Book meta table ── */
.book-meta {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.8rem 2rem;
  margin-bottom: 2rem;
}
@media (max-width: 500px) { .book-meta { grid-template-columns: 1fr; } }
.meta-item strong {
  color: var(--gold);
  font-size: 0.78rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  display: block;
  margin-bottom: 0.2rem;
}
.meta-item span {
  font-size: 0.92rem;
  color: var(--text);
}

/* ── Share section ── */
.share-section h3 {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 0.8rem;
}
.share-btns { display: flex; gap: 0.7rem; flex-wrap: wrap; }
.share-btn {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.5rem 1.2rem;
  border-radius: 8px;
  text-decoration: none;
  font-size: 0.85rem;
  font-weight: 600;
  color: #fff;
  transition: transform 0.2s, box-shadow 0.2s;
}
.share-btn:hover { transform: translateY(-2px); }
.share-whatsapp { background: #25D366; }
.share-facebook { background: #1877f2; }
.share-twitter  { background: #1da1f2; }

/* ── Footer ── */
footer {
  background: #0f1b2d;
  padding: 3rem 5%;
  color: var(--muted);
  margin-top: 4rem;
  border-top: 1px solid var(--border);
}
.footer-container {
  max-width: 1180px;
  margin: 0 auto;
  display: flex;
  flex-wrap: wrap;
  gap: 2.5rem;
  justify-content: space-between;
}
.footer-logo p { font-size: 0.85rem; line-height: 1.6; }
.footer-links h4 { color: #fff; margin-bottom: 1rem; font-size: 0.9rem; letter-spacing: 0.05em; }
.footer-links ul { list-style: none; }
.footer-links ul li { margin-bottom: 0.5rem; }
.footer-links ul li a { color: var(--muted); text-decoration: none; font-size: 0.88rem; transition: color 0.2s; }
.footer-links ul li a:hover { color: var(--gold); }

/* ============================================================
   MAGICAL VINTAGE STORYBOOK INTRO ANIMATION OVERLAY
   ============================================================ */
#storybook-intro-overlay {
  position: fixed;
  inset: 0;
  z-index: 10000;
  background: radial-gradient(circle at center, #101929 0%, #040810 100%);
  display: flex;
  justify-content: center;
  align-items: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 1s cubic-bezier(0.4, 0, 0.2, 1);
  overflow: hidden;
}

#storybook-intro-overlay.active {
  opacity: 1;
  pointer-events: all;
}

/* Skip Button */
.skip-intro-btn {
  position: absolute;
  top: 30px;
  right: 40px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(244, 208, 63, 0.3);
  padding: 0.6rem 1.5rem;
  border-radius: 30px;
  color: rgba(244, 208, 63, 0.9);
  font-family: 'Inter', sans-serif;
  font-size: 0.85rem;
  font-weight: 500;
  letter-spacing: 0.05em;
  cursor: pointer;
  z-index: 10010;
  transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.skip-intro-btn:hover {
  background: rgba(244, 208, 63, 0.12);
  border-color: var(--gold);
  color: #fff;
  transform: translateY(-2px);
  box-shadow: 0 5px 15px rgba(244, 208, 63, 0.2);
}

/* Spotlights & Ambient Glows */
.intro-spotlight {
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 700px;
  height: 600px;
  background: radial-gradient(circle, rgba(244, 208, 63, 0.08) 0%, rgba(244, 208, 63, 0) 70%);
  pointer-events: none;
  z-index: 1;
}

.ambient-glow-overlay {
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at center, rgba(244, 208, 63, 0.02) 0%, rgba(0, 0, 0, 0) 80%);
  pointer-events: none;
  z-index: 2;
  transition: opacity 2s ease;
  opacity: 0;
}

.ambient-glow-overlay.active {
  opacity: 1;
}

/* Fog & rays overlay */
.fog-overlay {
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse at 50% 80%, rgba(244, 208, 63, 0.03) 0%, rgba(10, 18, 32, 0) 60%);
  pointer-events: none;
  z-index: 2;
  mix-blend-mode: screen;
  filter: blur(40px);
  animation: driftFog 20s ease-in-out infinite alternate;
}

@keyframes driftFog {
  0% { transform: scale(1) translate(0, 0); }
  50% { transform: scale(1.1) translate(-20px, 10px); }
  100% { transform: scale(1) translate(20px, -10px); }
}

/* Particle Canvas */
#intro-particles-canvas {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 8;
}

/* 3D Scene viewport */
.scene-3d {
  position: relative;
  width: 100%;
  height: 100%;
  display: flex;
  justify-content: center;
  align-items: center;
  perspective: 1600px;
  perspective-origin: 50% 45%;
  transform-style: preserve-3d;
  z-index: 5;
  transition: transform 6.5s cubic-bezier(0.15, 0.85, 0.35, 1);
  will-change: transform;
}

.scene-3d.zoomed {
  transform: scale(1.15) translateZ(120px) translateY(-10px);
}

/* 3D Book Container */
.book-3d {
  width: 320px;
  height: 460px;
  position: relative;
  transform-style: preserve-3d;
  transform: rotateX(25deg) rotateY(-22deg) rotateZ(-3deg);
  transition: transform 4s cubic-bezier(0.2, 0.8, 0.25, 1);
  will-change: transform;
}

.book-3d.opened {
  transform: rotateX(15deg) rotateY(-5deg) rotateZ(0deg);
}

.book-face {
  position: absolute;
  inset: 0;
  transform-style: preserve-3d;
  backface-visibility: hidden;
  border-radius: 12px;
}

/* Front Cover */
.cover-front {
  background: linear-gradient(135deg, #1b0f02 0%, #2f1904 50%, #120700 100%);
  border: 1px solid rgba(244, 208, 63, 0.15);
  transform-origin: left center;
  z-index: 20;
  transition: transform 3s cubic-bezier(0.25, 1, 0.3, 1);
  box-shadow: inset 0 0 50px rgba(0,0,0,0.9), 0 15px 35px rgba(0,0,0,0.8), 0 0 0 1px rgba(244,208,63,0.05);
  will-change: transform;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 25px;
}

.book-3d.opened .cover-front {
  transform: rotateY(-165deg);
}

/* Cover Design details */
.cover-design {
  border: 2px solid rgba(244, 208, 63, 0.3);
  border-radius: 8px;
  width: 100%;
  height: 100%;
  padding: 30px 15px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  position: relative;
}

.cover-design::before {
  content: "";
  position: absolute;
  inset: 4px;
  border: 1px dashed rgba(244, 208, 63, 0.15);
  border-radius: 6px;
  pointer-events: none;
}

/* Gold Ornamental Corners */
.cover-design::after {
  content: "✦";
  color: var(--gold);
  font-size: 1.2rem;
  opacity: 0.65;
  position: absolute;
  top: 10px;
}

.cover-title {
  font-family: 'Merriweather', Georgia, serif;
  font-size: 1.6rem;
  font-weight: 700;
  text-align: center;
  line-height: 1.35;
  color: #fff;
  text-shadow: 0 2px 4px rgba(0,0,0,0.8);
  background: linear-gradient(135deg, #fff 0%, #f4d03f 60%, #b08d18 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: 1.5rem;
}

.cover-divider {
  color: var(--gold);
  opacity: 0.5;
  font-size: 0.9rem;
  margin-bottom: 1.5rem;
  letter-spacing: 0.2em;
}

.cover-author {
  font-family: 'Inter', sans-serif;
  font-size: 0.85rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: rgba(255, 255, 255, 0.7);
  text-shadow: 0 1px 3px rgba(0,0,0,0.8);
}

/* Spine Cover Thickness */
.spine-3d {
  position: absolute;
  left: 0;
  width: 14px;
  height: 100%;
  background: linear-gradient(to right, #0f0700, #1b0f02, #0d0600);
  transform: rotateY(-90deg) translateZ(7px);
  box-shadow: inset 0 0 15px rgba(0,0,0,0.8);
}

/* Back Cover */
.cover-back {
  background: linear-gradient(135deg, #100800 0%, #201000 100%);
  transform: translateZ(-14px);
  box-shadow: inset 0 0 55px rgba(0,0,0,0.95), 0 15px 45px rgba(0,0,0,0.9);
}

/* Paper Pages */
.page-3d {
  position: absolute;
  inset: 6px 6px 6px 12px;
  background: radial-gradient(circle at center, #fbf6e1 0%, #ebdfbe 100%);
  border-radius: 4px;
  transform-origin: left center;
  box-shadow: inset 3px 0 12px rgba(0,0,0,0.15), 0 4px 18px rgba(0,0,0,0.2);
  transition: transform 2.6s cubic-bezier(0.2, 0.8, 0.35, 1);
  will-change: transform;
  z-index: 5;
}

/* Inside Page Content Layout */
.page-face-front, .page-face-back {
  position: absolute;
  inset: 0;
  padding: 40px 25px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  box-shadow: inset 20px 0 40px rgba(0, 0, 0, 0.04), inset -10px 0 20px rgba(0, 0, 0, 0.02);
}

.page-face-back {
  transform: rotateY(180deg);
  background: radial-gradient(circle at center, #f6edd0 0%, #e2d4a5 100%);
}

/* Vintage filigree divider */
.filigree-divider {
  width: 70%;
  height: 1px;
  background: rgba(44, 33, 12, 0.15);
  margin: 15px auto;
  position: relative;
}

.filigree-divider::after {
  content: "❦";
  color: #634f31;
  font-size: 0.8rem;
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  background: #fbf6e1;
  padding: 0 10px;
}

.page-face-back .filigree-divider::after {
  background: #f6edd0;
}

/* Storybook typography */
.page-text {
  font-family: 'Merriweather', Georgia, serif;
  font-size: 0.82rem;
  color: #3e321e;
  line-height: 1.8;
  text-align: justify;
}

.page-text-heading {
  font-family: 'Merriweather', Georgia, serif;
  font-size: 1rem;
  color: #271f11;
  font-weight: 700;
  margin-bottom: 8px;
  letter-spacing: 0.02em;
}

.page-text-heading-sub {
  font-family: 'Inter', sans-serif;
  font-size: 0.65rem;
  text-transform: uppercase;
  color: #6c5a3b;
  font-weight: 600;
  letter-spacing: 0.1em;
  margin-bottom: 12px;
}

.drop-cap {
  font-size: 2.2rem;
  float: left;
  line-height: 0.85;
  margin-top: 5px;
  margin-right: 6px;
  font-weight: 700;
  color: #8c6e3b;
}

/* Right Stack Page (remaining flat) */
.page-right-stack {
  z-index: 4;
}

/* Staggered Page Turns */
.page-turning-1 { transition-delay: 0.3s; z-index: 9; }
.page-turning-2 { transition-delay: 0.6s; z-index: 8; }
.page-turning-3 { transition-delay: 0.9s; z-index: 7; }

.book-3d.opened .page-turning-1 { transform: rotateY(-158deg); }
.book-3d.opened .page-turning-2 { transform: rotateY(-148deg); }
.book-3d.opened .page-turning-3 { transform: rotateY(-138deg); }

/* Left inside cover parchment */
.cover-inner {
  position: absolute;
  inset: 0;
  transform: rotateY(180deg);
  backface-visibility: hidden;
  background: radial-gradient(circle at center, #eee8d0 0%, #dbcfab 100%);
  border-radius: 11px;
  border-right: 5px solid #201202;
  box-shadow: inset 15px 0 25px rgba(0,0,0,0.15);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px;
}

.ex-libris {
  border: 1px solid rgba(135, 110, 68, 0.3);
  width: 100%;
  height: 100%;
  padding: 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
  text-align: center;
}

.ex-libris h3 {
  font-family: 'Merriweather', serif;
  font-size: 0.85rem;
  letter-spacing: 0.08em;
  color: #5c4a2b;
  text-transform: uppercase;
  margin-bottom: 25px;
}

.ex-libris-crest {
  font-size: 2.2rem;
  color: #8c7346;
  margin-bottom: 20px;
}

.ex-libris-owner {
  font-family: 'Georgia', serif;
  font-size: 0.95rem;
  color: #3e321e;
  font-style: italic;
  border-bottom: 1px solid rgba(92, 74, 43, 0.2);
  width: 80%;
  padding-bottom: 5px;
}

/* Magical Glow Reveal Inside */
.magical-glow-revealed {
  position: absolute;
  top: 50%;
  left: 30px;
  width: 150px;
  height: 380px;
  transform: translateY(-50%) scaleX(0);
  transform-origin: left center;
  background: radial-gradient(ellipse at center, rgba(244, 208, 63, 0.45) 0%, rgba(244, 208, 63, 0.08) 50%, rgba(0,0,0,0) 80%);
  filter: blur(15px);
  z-index: 6;
  pointer-events: none;
  opacity: 0;
  transition: transform 3.5s cubic-bezier(0.15, 0.85, 0.35, 1) 0.6s, opacity 3s ease 0.6s;
  mix-blend-mode: screen;
}

.book-3d.opened .magical-glow-revealed {
  transform: translateY(-50%) scaleX(1.8);
  opacity: 1;
}

/* Responsive adjustment for small viewports */
@media (max-width: 500px) {
  .scene-3d {
    transform: scale(0.7) translateY(-30px);
  }
  .scene-3d.zoomed {
    transform: scale(0.8) translateZ(50px) translateY(-40px);
  }
  .skip-intro-btn {
    top: 20px;
    right: 20px;
    padding: 0.4rem 1rem;
    font-size: 0.75rem;
  }
}

/* ============================================================
   KINDLE-STYLE SUMMARY READER OVERLAY
   ============================================================ */
#kindle-reader-overlay {
  position: fixed;
  inset: 0;
  z-index: 10100; /* Higher than storybook intro */
  background: rgba(8, 12, 20, 0.95);
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.5s ease;
  backdrop-filter: blur(15px);
  -webkit-backdrop-filter: blur(15px);
}

#kindle-reader-overlay.active {
  opacity: 1;
  pointer-events: all;
}

/* Kindle Reader Top Toolbar */
.kindle-toolbar {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 60px;
  background: #0b0f19;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 2rem;
  z-index: 10110;
  transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.4s ease;
}

/* Netflix-style Auto-Hide in Fullscreen */
#kindle-reader-overlay.fullscreen .kindle-toolbar {
  transform: translateY(-100%);
  opacity: 0;
}

@media (hover: hover) and (pointer: fine) {
  #kindle-reader-overlay.fullscreen .kindle-toolbar::after {
    content: "";
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    height: 80px; /* Hit area extending below toolbar */
  }
  #kindle-reader-overlay.fullscreen .kindle-toolbar-hover-area:hover .kindle-toolbar,
  #kindle-reader-overlay.fullscreen .kindle-toolbar:hover {
    transform: translateY(0);
    opacity: 1;
  }
}
@media (max-width: 768px) {
  .kindle-toolbar {
    padding: 0 1rem;
  }
}

.kindle-title {
  font-family: 'Merriweather', Georgia, serif;
  font-size: 0.95rem;
  color: #fff;
  font-weight: 500;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.kindle-controls {
  display: flex;
  align-items: center;
  gap: 1.2rem;
}

.kindle-btn {
  background: transparent;
  border: none;
  color: var(--muted);
  font-size: 1.2rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color 0.2s, transform 0.2s;
  padding: 8px;
  border-radius: 50%;
}

.kindle-btn:hover {
  color: var(--gold);
  transform: scale(1.05);
  background: rgba(255, 255, 255, 0.05);
}

/* Theme Switcher in Toolbar */
.theme-selector {
  display: flex;
  gap: 0.8rem;
  padding: 4px;
}

.theme-opt {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  cursor: pointer;
  border: 2px solid transparent;
  transition: transform 0.2s, border-color 0.2s;
}

.theme-opt:hover {
  transform: scale(1.1);
}

.theme-opt.active {
  border-color: var(--gold);
}

.theme-opt.parchment {
  background: #fbf6e3;
}

.theme-opt.sepia {
  background: #f4ecd8;
}

.theme-opt.dark {
  background: #232323;
}

/* Font Size Controls */
.font-controls {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 2px 8px;
}

.font-btn {
  background: transparent;
  border: none;
  color: var(--muted);
  font-size: 0.85rem;
  font-weight: bold;
  cursor: pointer;
  padding: 4px 8px;
  transition: color 0.2s;
}

.font-btn:hover {
  color: var(--gold);
}

.font-btn.btn-larger {
  font-size: 1.1rem;
}

/* Kindle Reader Container */
.kindle-container {
  width: 90%;
  max-width: 960px;
  height: 93%;
  margin-top: auto;
  margin-bottom: auto;
  display: flex;
  justify-content: center;
  align-items: center;
  position: relative;
}

/* Kindle Book Frame */
.kindle-book {
  display: flex;
  width: 100%;
  height: 100%;
  background: #fbf6e3; /* Default Parchment */
  color: #2c2518;
  border-radius: 12px;
  box-shadow: 0 30px 70px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(0, 0, 0, 0.1);
  overflow: hidden;
  position: relative;
  transition: background 0.3s, color 0.3s, transform 0.3s;
}

/* Fullscreen / Full View adjustments */
#kindle-reader-overlay.fullscreen .kindle-container {
  width: 100%;
  max-width: 100%;
  height: 100vh;
  margin-top: 0;
}

#kindle-reader-overlay.fullscreen .kindle-book {
  border-radius: 0;
}

/* Kindle Reader Themes */
.kindle-book.theme-parchment {
  background: #fbf6e3;
  color: #2c2518;
}

.kindle-book.theme-sepia {
  background: #f4ecd8;
  color: #433422;
}

.kindle-book.theme-dark {
  background: #121212;
  color: #e0e0e0;
}

/* Kindle Book Page Layout */
.kindle-page-wrapper {
  flex: 1;
  display: flex;
  position: relative;
  height: 100%;
}

.kindle-page-pane {
  flex: 1;
  padding: 3.5rem 4rem;
  overflow-y: auto;
  position: relative;
  display: flex;
  flex-direction: column;
  height: 100%;
}

/* Scrollbar styling for page content */
.kindle-page-pane::-webkit-scrollbar {
  width: 6px;
}
.kindle-page-pane::-webkit-scrollbar-track {
  background: transparent;
}
.kindle-page-pane::-webkit-scrollbar-thumb {
  background: rgba(0, 0, 0, 0.15);
  border-radius: 4px;
}
.kindle-book.theme-dark .kindle-page-pane::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.15);
}

/* Page Dividers (for two-page layout) */
.kindle-page-divider {
  width: 1px;
  background: rgba(0, 0, 0, 0.08);
  height: 90%;
  align-self: center;
  position: relative;
}

.kindle-book.theme-dark .kindle-page-divider {
  background: rgba(255, 255, 255, 0.08);
}

.kindle-page-divider::before {
  content: "";
  position: absolute;
  top: 0; bottom: 0;
  left: -5px; right: -5px;
  background: linear-gradient(to right, rgba(0,0,0,0.02), rgba(0,0,0,0.06), rgba(0,0,0,0.02));
}

.kindle-book.theme-dark .kindle-page-divider::before {
  background: linear-gradient(to right, rgba(255,255,255,0.005), rgba(255,255,255,0.02), rgba(255,255,255,0.005));
}

/* Page Content Typography */
.kindle-page-content {
  font-family: 'Merriweather', Georgia, serif;
  font-size: 1.05em;
  line-height: 1.85;
  text-align: justify;
  flex: 1;
}

.kindle-page-content h1,
.kindle-page-content h2 {
  font-family: 'Merriweather', serif;
  font-size: 1.5rem;
  font-weight: 700;
  margin-bottom: 1.5rem;
  background: none;
  -webkit-text-fill-color: var(--book-theme-color, #c0392b);
  color: var(--book-theme-color, #c0392b);
  animation: none;
  text-shadow: none;
  border-bottom: 2px solid rgba(0, 0, 0, 0.06);
  padding-bottom: 8px;
}

.kindle-book.theme-dark .kindle-page-content h1,
.kindle-book.theme-dark .kindle-page-content h2 {
  border-color: rgba(255, 255, 255, 0.08);
  /* Make colors slightly brighter in dark mode for better contrast */
  filter: brightness(1.2);
}

.kindle-page-content p {
  margin-bottom: 1.2rem;
  text-indent: 1.5em;
}

.kindle-page-content p:first-of-type {
  text-indent: 0;
}

.kindle-page-content ul, .kindle-page-content ol {
  margin-bottom: 1.2rem;
  padding-left: 1.5rem;
}

.kindle-page-content li {
  margin-bottom: 0.5rem;
}

/* Dropcap for summary start */
.kindle-dropcap {
  font-size: 3rem;
  font-weight: 700;
  float: left;
  line-height: 0.8;
  margin-top: 6px;
  margin-right: 8px;
  color: #8c6e3b;
}

/* Footer / Header indicators inside Kindle Book */
.kindle-book-header {
  font-size: 0.72rem;
  text-transform: uppercase;
  color: rgba(0, 0, 0, 0.4);
  letter-spacing: 0.1em;
  margin-bottom: 1.5rem;
  border-bottom: 1px solid rgba(0,0,0,0.04);
  padding-bottom: 4px;
}

.kindle-book.theme-dark .kindle-book-header {
  color: rgba(255, 255, 255, 0.4);
  border-color: rgba(255,255,255,0.04);
}

.kindle-book-footer {
  font-size: 0.75rem;
  color: rgba(0, 0, 0, 0.4);
  text-align: center;
  margin-top: auto;
  padding-top: 1.5rem;
}

.kindle-book.theme-dark .kindle-book-footer {
  color: rgba(255, 255, 255, 0.4);
}

.kindle-nav-arrow {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 50px;
  height: 50px;
  border-radius: 50%;
  background: var(--gold, #f4d03f);
  border: none;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.4);
  color: #0a1220;
  font-size: 1.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.2s, transform 0.2s, color 0.2s, opacity 0.3s ease;
  z-index: 10120;
}

/* Netflix-style Auto-Hide Navigation Arrows in Fullscreen */
#kindle-reader-overlay.fullscreen .kindle-nav-arrow {
  opacity: 0;
  transform: translateY(-50%) scale(0.9);
}

/* Move arrows inside the screen when in fullscreen mode */
#kindle-reader-overlay.fullscreen .kindle-nav-arrow.arrow-prev {
  left: 30px;
}
#kindle-reader-overlay.fullscreen .kindle-nav-arrow.arrow-next {
  right: 30px;
  left: auto;
}

@media (hover: hover) and (pointer: fine) {
  /* Create a massive invisible hit area on the edges of the screen to detect mouse hover easily */
  #kindle-reader-overlay.fullscreen .kindle-nav-arrow::after {
    content: "";
    position: absolute;
    top: -30vh;
    bottom: -30vh;
    left: -100px;
    right: -100px;
  }
  
  #kindle-reader-overlay.fullscreen .kindle-nav-arrow:hover {
    opacity: 1;
    transform: translateY(-50%) scale(1.1);
  }
}

.kindle-nav-arrow:hover {
  background: #ffe993;
  color: #0a1220;
  transform: translateY(-50%) scale(1.1);
  box-shadow: 0 0 20px rgba(244, 208, 63, 0.6);
}

.kindle-nav-arrow.arrow-prev {
  left: -70px;
}

.kindle-nav-arrow.arrow-next {
  right: -70px;
}

/* Disabled State */
.kindle-nav-arrow.disabled {
  opacity: 0.25;
  pointer-events: none;
  cursor: not-allowed;
}

/* Mobile responsive adjustments */
@media (max-width: 1100px) {
  .kindle-nav-arrow.arrow-prev {
    left: 15px;
  }
  .kindle-nav-arrow.arrow-next {
    right: 15px;
  }
  .kindle-container {
    width: 94%;
  }
}

@media (max-width: 768px) {
  .kindle-page-divider {
    display: none;
  }
  .kindle-page-pane.pane-right {
    display: none; /* Collapses to single page view */
  }
  .kindle-page-pane {
    padding: 2rem 2.5rem;
  }
  .kindle-nav-arrow {
    width: 42px;
    height: 42px;
    font-size: 1.2rem;
  }
}

/* Animation for page turning transition */
.kindle-page-content.page-turn {
  animation: pageTurnAnim 0.4s ease-out;
}

@keyframes pageTurnAnim {
  0% {
    opacity: 0;
    transform: translateX(15px);
  }
  100% {
    opacity: 1;
    transform: translateX(0);
  }
}





