/* ==== Base Reset ==== */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

/* ==== Body and Theme ==== */
body {
  background-color: #000000;
  color: #e0e0e0;
  font-family: 'Georgia', serif;
  line-height: 1.7;
  padding: 2rem;
}

/* ==== Header ==== */
header {
  text-align: center;
  margin-top: 4rem; /* 👈 This adds that breathing room above the title */
  margin-bottom: 1rem; /* Optional: controls space below it */
}

h1 {
  font-size: 3rem;
  color: #f9f9f9;
}

h2 {
  font-size: 2rem;
  color: #ffffff;
  font-weight: 600;
  text-align: center;
  margin-top: 2rem;
  margin-bottom: 1rem;
  text-shadow: 0 0 4px rgba(255, 255, 255, 0.1);
  border-bottom: 2px solid #ffffff33;
  display: inline-block;
  padding-bottom: 0.4rem;
  margin-left: auto;
  margin-right: auto;
}

h3 {
  font-size: 1.5rem;
  color: #dddddd;
  font-weight: 500;
  margin-top: 2rem;
  text-align: center;
  text-decoration: underline;
  text-underline-offset: 6px;
}

/* Light Mode (default) */
.subtitle {
  color: #000;
  transition: color 0.3s ease;
}

/* Dark Mode */
.chapter-title {
  color: #000;
  transition: color 0.3s ease;
}

body.dark-mode .chapter-title {
  color: #fff;
}



/* ==== Main Book Content ==== */
main {
  max-width: 800px;
  margin: 0 auto;
  width: 100%;
  padding: 0 2rem;
}

.book h2 {
  margin-top: 5rem;
  margin-bottom: 3rem;
  font-size: 3rem;
  text-align: center;
  letter-spacing: 1px;
  transition: color 0.3s ease;
}

.book {
  font-size: 16px; /* This is the default that JS will override */
}

.book p {
  margin: 0.5rem 0;
  text-indent: 2em;
  line-height: 1.7;
  text-align: left;
  font-weight: normal !important;
  font-family: 'Georgia', serif !important;
  font-weight: normal !important;
  font-family: 'Georgia', serif !important;
  font-size: inherit !important;
}

.book p:empty {
  display: none;
}

.book p, .book strong, .book em, .book span {
  text-transform: none;
}

/* ==== Footer ==== */
footer {
  text-align: center;
  margin-top: 3rem;
  font-size: 0.9rem;
  color: #888;
}

/* ==== Cleaned Up & Mobile-Friendly ==== */
@media (max-width: 600px) {
  body {
    padding: 1rem;
    font-size: 1rem;
    line-height: 1.6;
  }

  main, section, article {
    width: 100%;
    max-width: 100%;
    margin: 0;
    padding: 0;
  }

  h1 {
    font-size: 1.6rem;
    text-align: center;
    line-height: 1.4;
    margin: 2rem 0;
    white-space: normal;
    word-break: break-word;
    max-width: 90%;
    margin-left: auto;
    margin-right: auto;
  }

  .book h2 {
    font-size: 1.5rem;
    margin-top: 4rem;
    margin-bottom: 1.5rem;
    text-align: center;
  }

  .book p {
    text-indent: 1.5em;
    margin: 0.3rem 0;
    line-height: 1.6;
    font-size: 0.95rem;
  }

  .book p:empty {
    display: none;
  }

.chapter-jump select {
  width: 85%;
  font-size: 0.85rem;
  padding: 0.4rem 0.6rem;
  border-radius: 4px;
}
}

/* ==== Chapter Dropdown Styles ==== */
.chapter-jump {
  display: flex;
  justify-content: center;
  margin-top: 0.5rem;
  margin-bottom: 2rem;
}

.chapter-jump select {
  padding: 0.5rem 1rem;
  font-size: 1rem;
  border-radius: 6px;
  border: none;
  background-color: #222;
  color: #fff;
  font-family: 'Georgia', serif;
}

.chapter-jump select:focus {
  outline: 2px solid #ffcc66;
}



/* ==== Enforce Consistent Text Size in Story ==== */
.book p,
.book div,
.book h3,
.book h4,
.book span {
  font-size: 1rem !important;
  line-height: 1.7;
  font-weight: normal;
}

/* ==== hamburger menu ==== */
/* ==== Hamburger Button ==== */
.hamburger-container {
  position: fixed;
  top: 1rem;
  right: 1rem;
  z-index: 9999;
}

@media (max-width: 768px) {
  .hamburger-container {
    top: 4rem;
  }
}

.hamburger {
  background-color: #222;
  color: #fff;
  font-size: 1.5rem;
  border: none;
  padding: 0.5rem 1rem;
  cursor: pointer;
  border-radius: 5px;
}

.dropdown-menu {
  display: none;
  position: absolute;
  top: 2.5rem;
  right: 0;
  background-color: #333;
  border: 1px solid #444;
  border-radius: 5px;
  padding: 0.5rem;
  max-height: 300px;
  overflow-y: auto;
  width: 200px;
}

.dropdown-menu a {
  display: block;
  color: #fff;
  text-decoration: none;
  padding: 0.4rem 0;
  font-size: 0.95rem;
}

.dropdown-menu a:hover {
  background-color: #555;
}


/* === Theme Toggle Styling === */
.theme-toggle {
  position: fixed;
  top: 7rem;
  left: 50%;
  transform: translateX(-50%);
  z-index: 9999;
}

.theme-toggle input {
  display: none;
}

.toggle-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background-color: #444;
  border-radius: 50px;
  width: 60px;
  height: 30px;
  padding: 0 5px;
  position: relative;
  cursor: pointer;
  transition: background-color 0.3s ease;
}

.toggle-label .icon {
  font-size: 16px;
  z-index: 2;
  pointer-events: none;
}

.toggle-ball {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 24px;
  height: 24px;
  background-color: #fff;
  border-radius: 50%;
  transition: transform 0.3s ease;
  z-index: 1;
}

#theme-switch:checked + .toggle-label .toggle-ball {
  transform: translateX(30px);
}

/* Optional: Light/Dark Theme Styles */

.theme-toggle {
  position: relative;
  display: flex;
  justify-content: center;
  margin-top: 1rem;
  margin-bottom: 0.5rem;
  z-index: 999;
}


body.light-mode {
  background-color: #ffffff;
  color: #000000;
}

body.dark-mode {
  background-color: #000000;
  color: #ffffff;
}
/* Title and Chapter Header Colors */
body.light-mode h1,
body.light-mode .book h2 {
  color: #000000;
}

body.dark-mode h1,
body.dark-mode .book h2 {
  color: #ffffff;
}

.back-to-library {
  position: relative;
  display: inline-block;
  margin: 1rem 0 0 1rem; /* Top space, no crowding */
  color: #fff;
  font-size: 0.95rem;
  text-decoration: none;
  background-color: #444;
  padding: 0.4rem 0.7rem;
  border-radius: 4px;
  transition: background-color 0.3s ease;
}


.back-to-library:hover {
  background-color: #666;
}

/* Light mode variant */
body.light-mode .back-to-library {
  color: #000;
  background-color: #ddd;
}

body.light-mode .back-to-library:hover {
  background-color: #bbb;
}

/* ==== Back to Top Button ==== */
#back-to-top {
  text-align: center;
  margin: 4rem 0 2rem;
}

#back-to-top a {
  display: inline-block;
  padding: 0.6rem 1rem;
  font-size: 0.95rem;
  color: #ffffff;
  background-color: #444;
  border-radius: 6px;
  text-decoration: none;
  transition: background-color 0.3s ease;
}

#back-to-top a:hover {
  background-color: #666;
}

/* Light mode version */
body.light-mode #back-to-top a {
  color: #000000;
  background-color: #ddd;
}

body.light-mode #back-to-top a:hover {
  background-color: #bbb;
}

/* ==== Reading Progress Bar ==== */
#scroll-progress-container {
  position: fixed;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 4px;
  background-color: rgba(36, 120, 245, 0.1); /* faint base */
  z-index: 9999;
}

#scroll-progress-bar {
  height: 100%;
  width: 0%;
  background-color: #a0f0e0; /* pale teal */
  transition: width 0.2s ease-out;
}

.back-button {
  display: inline-block;
  padding: 8px 12px;
  background-color: #444;
  color: white;
  text-decoration: none;
  border-radius: 5px;
  font-weight: bold;
  font-size: 0.9rem;
  margin: 10px;
  max-width: 90%;
  text-align: center;
}

.back-button:hover {
  background-color: #666;
}

@media (max-width: 600px) {
  .back-button {
    font-size: 0.85rem;
    padding: 6px 10px;
    margin: 8px;
  }
}

.text-size-selector {
  margin-top: 10px;
  margin-bottom: 10px;
  text-align: center;
}

.text-size-selector select {
  padding: 6px;
  font-size: 1em;
  border-radius: 4px;
}

/* ==== Font Size Inheritance Fix for Chapters ==== */
.book,
.book section,
.book section[id^="chapter"],
.book section[id^="chapter"] p {
  font-size: inherit !important;
}

/* === Font Size Scaling Fix === */
.book {
  font-size: 16px; /* base size for all content */
}

.book,
.book p,
.book li,
.book span,
.book section,
.book section[id^="chapter"],
.book section[id^="chapter"] p {
  font-size: inherit;
  font-family: 'Georgia', serif !important;
}

/* Restore proper size to chapter titles */



h1, h2, h3, h4, h5, h6 {
  text-align: center !important;
  margin-left: auto !important;
  margin-right: auto !important;
  display: block;
}

h1, h2, h3, h4, h5, h6 {
  border-bottom: none !important;
  text-decoration: none !important;
}

.book h1,
.book h2,
.book h3 {
  font-size: 2.8rem !important;
  font-weight: 700;
  
  text-align: center;
  line-height: 1.3;
}



html body .book section[id^="chapter"] > h2 {
  all: unset;
  font-size: 2.8rem !important;
  font-weight: 700 !important;
  color: #ffffff
  font-family: 'Georgia', serif !important;
  text-align: center !important;
  line-height: 1.3 !important;
  margin-top: 5rem !important;
  margin-bottom: 3rem !important;
  display: block !important;
}




.book section[id^="chapter"] h2 {
  all: unset;
  font-size: 2.8rem;
  font-weight: 700 !important;
  color: #ffffff
  text-align: center !important;
  line-height: 1.3 !important;
  font-family: 'Georgia', serif !important;
  margin-top: 5rem !important;
  margin-bottom: 3rem !important;
  display: block !important;
}

/* Adjust main title and chapter headers */
.book h1 {
  font-size: 2rem !important;
  font-weight: 700 !important;
  text-align: center !important;
  font-family: 'Georgia', serif !important;
  color: #ffffff
  margin-top: 3rem !important;
  margin-bottom: 2rem !important;
}

.book section[id^="chapter"] h2 {
  font-size: 1.6rem !important;
  font-weight: 600 !important;
  text-align: center !important;
  font-family: 'Georgia', serif !important;
  color: #000000
  margin-top: 3rem !important;
  margin-bottom: 2rem !important;
}

@media screen and (max-width: 600px) {
  .book h1 {
    font-size: 1.8rem !important;
  }

  .chapter-content h2,
  .book h2,
  section[id^="chapter"] h2 {
    font-size: 1.5rem !important;
    line-height: 1.2;
    margin-top: 3rem;
    margin-bottom: 2rem;
  }

  .book p {
    font-size: 1rem;
  }
}

@media screen and (max-width: 600px) {
  .book section[id^="chapter"] h2 {
    font-size: 1.8rem !important;
  }
}

@media (max-width: 768px) {
  .theme-toggle {
    top: 0rem;         /* Move it higher or lower on mobile */
    left: 1rem;        /* Push it toward the left side */
    transform: none;   /* Remove center transform */
  }
}

.chapter-text-size-selector {
  text-align: center;
  margin: 1rem auto 2rem;
}

.chapter-text-size-selector select {
  padding: 6px 12px;
  font-size: 1rem;
  border-radius: 4px;
  font-family: 'Georgia', serif;
  background-color: #222;
  color: #fff;
  border: none;
}

body.light-mode .chapter-text-size-selector select {
  background-color: #eee;
  color: #000;
}

/* === Text Size Selector Styles === */
.text-size-selector {
  margin: 1rem auto;
  text-align: center;
  font-family: 'Georgia', serif;
}

.text-size-selector select {
  padding: 0.3em;
  font-size: 1em;
  border-radius: 5px;
  border: 1px solid #999;
}

/* 🔥 FINAL OVERRIDE FOR THEME-AWARE TITLE COLORS */

body.light-mode html body .book section[id^="chapter"] > h2 {
  color: #000000 !important;
}

body.dark-mode html body .book section[id^="chapter"] > h2 {
  color: #ffffff !important;
}

/* 💬Comment Button */
.chapter-button-container {
  display: flex;
  justify-content: center;
  margin: 2em 0;
}

.chapter-button {
  background-color: #000; /* black button */
  color: #fff;            /* white text */
  padding: 0.75em 1.5em;
  border-radius: 999px;   /* super rounded */
  font-size: 1.1em;
  font-weight: bold;
  text-decoration: none;
  box-shadow: 0 0 10px #f3efef80;
  transition: all 0.3s ease;
}

.chapter-button:hover {
  background-color: #1a1a1a;
  transform: scale(1.05);
}

/* === Anti-copy + Blur-on-blur + Watermark === */
.noselect, .noselect * {
  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
  user-select: none;
}

.blurred .book {  /* blur the reading area when tab not active */
  filter: blur(8px);
  transition: filter 150ms ease;
}

/* Hide preview in print */
@media print {
  body { display: none !important; }
}

/* Subtle, full-page watermark (pointer-events off so it can't be clicked) */
.watermark {
  position: fixed;
  inset: 0;
  z-index: 9998;
  pointer-events: none;
  opacity: 0.20;
  mix-blend-mode: multiply;
}
.watermark::before {
  content: attr(data-watermark);
  position: absolute;
  top: -20%;
  left: -20%;
  width: 200%;
  height: 200%;
  display: grid;
  place-items: center;
  transform: rotate(-25deg);
  font: 600 18px/1.2 Georgia, serif;
  color: #ffffff;
  letter-spacing: 1px;
  text-align: center;
}

/* Deter selection in reading area; allow inputs */
.book, main, body { user-select: none !important; }
input, textarea, button, select { user-select: text !important; }
@media print { body { display: none !important; } } /* kills Save-as-PDF */

/* Deter selection in reading area; allow inputs */
.book, main, body { user-select: none !important; -webkit-user-select: none !important; }
input, textarea, button, select { user-select: text !important; -webkit-user-select: text !important; }

/* Hide preview on print / Save-as-PDF */
@media print { body { display: none !important; } }

/* Blur when tab not active (toggled by .blurred on <html>) */
.blurred .book { filter: blur(8px); transition: filter 150ms ease; }

/* Watermark overlay (already in your file) — it reads data-watermark */
.watermark { position: fixed; inset: 0; z-index: 9998; pointer-events: none; opacity: .20; mix-blend-mode: multiply; }
.watermark::before {
  content: attr(data-watermark);
  position: absolute; top: -20%; left: -20%;
  width: 200%; height: 200%;
  display: grid; place-items: center;
  transform: rotate(-25deg);
  font: 600 18px/1.2 Georgia, serif;
  color: #ffffff; letter-spacing: 1px; text-align: center;
}

/* --- Mobile anti-copy + callout suppressors --- */
html, body, .book, main {
  -webkit-user-select: none !important;  /* iOS/Android */
  user-select: none !important;
  -webkit-touch-callout: none !important; /* kills iOS long-press menu */
}

img, svg, a, [draggable] {
  -webkit-touch-callout: none !important;
}

/* Allow selection in actual inputs so forms still work */
input, textarea, button, select {
  -webkit-user-select: text !important;
  user-select: text !important;
  -webkit-touch-callout: default !important;
}

/* Tap-to-continue overlay for mobile blur/pause */
#mobileGuard {
  position: fixed; inset: 0; z-index: 2147483646;
  display: none; /* toggled by JS */
  align-items: center; justify-content: center;
  backdrop-filter: blur(12px);
  background: rgba(0,0,0,0.35);
  pointer-events: auto;
}
#mobileGuard.show { display: flex; }
#mobileGuard .mg-box {
  padding: 1rem 1.25rem; border-radius: 12px;
  background: rgba(0,0,0,0.6); color: #fff; 
  font: 600 1rem/1.2 system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
  text-align: center;
}

/* First-load Legal Notice Overlay */
#legalNotice {
  position: fixed;
  inset: 0;
  z-index: 2147483647;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0,0,0,0.88);
  backdrop-filter: blur(10px);
  color: #fff;
  text-align: center;
  padding: 1rem;
}

#legalNotice .ln-box {
  background: rgba(0,0,0,0.55);
  border: 1px solid rgba(255,0,0,0.25);
  box-shadow: 0 6px 24px rgba(0,0,0,0.55);
  border-radius: 14px;
  padding: 1.5rem 1.25rem;
  max-width: 90%;
  font-size: 0.95rem;
  line-height: 1.4;
  text-transform: uppercase;
  letter-spacing: 0.6px;
}

#legalNotice .ln-box strong {
  display: block;
  color: #fff;
  margin-bottom: .5rem;
  font-size: 1rem;
}

#acknowledgeNotice {
  margin-top: .75rem;
  background: #b30000;
  color: #fff;
  border: none;
  padding: .6rem 1.2rem;
  border-radius: 6px;
  cursor: pointer;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.8px;
}
#acknowledgeNotice:hover {
  background: #e60000;
}

/* ==== Reader Safe-Area Control Spacing ==== */
:root {
  --reader-safe-top: calc(env(safe-area-inset-top, 0px) + 0.75rem);
  --reader-edge-space: clamp(0.75rem, 4vw, 1rem);
  --reader-control-gap: 0.9rem;
}

body {
  padding-top: calc(2rem + env(safe-area-inset-top, 0px));
}

header {
  margin-top: calc(4rem + env(safe-area-inset-top, 0px));
  padding-top: 0.35rem;
}

.hamburger-container {
  top: var(--reader-safe-top);
  right: var(--reader-edge-space);
}

.dropdown-menu {
  margin-top: 0.35rem;
}

.back-button {
  margin-top: var(--reader-safe-top);
  margin-left: var(--reader-edge-space);
  position: relative;
  z-index: 9998;
}

.theme-toggle {
  margin-top: var(--reader-control-gap);
}

.chapter-text-size-selector {
  margin-top: var(--reader-control-gap);
}

@media (max-width: 768px) {
  body {
    padding-top: calc(1rem + env(safe-area-inset-top, 0px));
  }

  header {
    margin-top: calc(3.5rem + env(safe-area-inset-top, 0px));
  }

  .theme-toggle {
    position: relative;
    top: auto;
    left: auto;
    transform: none;
    margin-top: 1rem;
  }
}

/* ==== Ad Preview Landing Pages ==== */
/* Ad-preview-specific CSS overrides */
.ad-preview-page .back-button,
.ad-preview-page .hamburger-container,
.ad-preview-page .theme-toggle,
.ad-preview-page .chapter-text-size-selector,
.ad-preview-page #back-to-top {
  display: none !important;
}

.ad-preview-page {
  background: #ffffff;
  color: #1a1a1a;
  padding: calc(0.85rem + env(safe-area-inset-top, 0px)) 1rem 2.5rem;
  scroll-padding-bottom: 6.5rem;
}

.ad-preview-page header {
  margin-top: 0;
  margin-bottom: 0.85rem;
  padding-top: 0;
}

.ad-preview-page h1 {
  font-size: clamp(1.9rem, 7vw, 2.5rem);
  letter-spacing: 0.03em;
  line-height: 1.15;
  margin: 0 auto;
  max-width: 12ch;
}

.ad-preview-page main {
  max-width: 720px;
  padding: 0;
}

.ad-preview-page #preview-reader-content {
  display: grid;
  gap: 1rem;
}

.ad-preview-page .ad-preview-intro {
  text-align: center;
  margin: 0 auto;
}

.ad-preview-page .preview-hero {
  margin: 0 auto 0.75rem;
  width: 100%;
}

.ad-preview-page .preview-cover-image {
  display: block;
  width: 100%;
  max-width: 420px;
  max-height: 48vh;
  margin: 0 auto;
  object-fit: cover;
  border-radius: 20px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.4);
}

.ad-preview-page #welcome h2 {
  font-size: clamp(1.3rem, 5vw, 1.75rem) !important;
  margin: 0 auto 0.75rem !important;
  border-bottom: none !important;
  text-shadow: none;
  color: #111111 !important;
}

.ad-preview-page .ad-preview-intro p {
  max-width: 34rem;
  margin: 0.45rem auto;
  text-align: center !important;
  text-indent: 0 !important;
  color: #555555;
  font-size: clamp(0.98rem, 3.8vw, 1.05rem) !important;
  line-height: 1.65;
}

.ad-preview-page .reader-status,
.ad-preview-page .preview-access-cta {
  width: 100%;
  max-width: 760px;
  margin: 0 auto;
  border-radius: 20px;
  box-sizing: border-box;
}

.ad-preview-page .reader-status {
  padding: 0.95rem 1rem;
  border: 1px solid rgba(0, 0, 0, 0.08);
  background: #f8f8f8;
  text-align: center;
  color: #444444;
}

.ad-preview-page .reader-status[data-state="empty"],
.ad-preview-page .reader-status[data-state="error"] {
  border-color: rgba(0, 0, 0, 0.08);
  background: #f3f4f6;
}

.ad-preview-page #chapters-container {
  padding: clamp(1rem, 4vw, 1.5rem);
  background: #f3f4f6;
  border: 1px solid rgba(0, 0, 0, 0.08);
  border-radius: 16px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
  overflow-x: clip;
}

.ad-preview-page .preview-chapter-block + .preview-chapter-block {
  margin-top: 2.25rem;
}

.ad-preview-page .preview-chapter-block h1,
.ad-preview-page .preview-chapter-block h2,
.ad-preview-page .preview-chapter-block h3 {
  font-family: Georgia, serif !important;
  text-align: center !important;
  text-decoration: none !important;
  border-bottom: none !important;
  color: #111111 !important;
  line-height: 1.25 !important;
  text-shadow: none !important;
}

.ad-preview-page .preview-chapter-block h1,
.ad-preview-page .preview-chapter-block h2 {
  font-size: clamp(1.45rem, 5.5vw, 2rem) !important;
  margin: 0 0 1.4rem !important;
}

.ad-preview-page .preview-chapter-block h3 {
  font-size: clamp(1.2rem, 4.8vw, 1.5rem) !important;
  margin: 1.5rem 0 1rem !important;
}

.ad-preview-page .preview-chapter-block p,
.ad-preview-page .preview-chapter-block li,
.ad-preview-page .preview-chapter-block blockquote,
.ad-preview-page .preview-chapter-block div,
.ad-preview-page .preview-chapter-block span {
  font-size: 1rem !important;
  line-height: 1.78 !important;
  color: #1a1a1a;
}

.ad-preview-page .preview-chapter-block p {
  text-indent: 1.4em !important;
  margin: 0.45rem 0 !important;
}

/* Preview-content no-select protection while preserving taps on links/buttons */
.ad-preview-page #preview-reader-content,
.ad-preview-page #chapters-container,
.ad-preview-page .preview-chapter-block,
.ad-preview-page .preview-chapter-block *:not(a):not(button) {
  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
}

.ad-preview-page a,
.ad-preview-page button {
  -webkit-user-select: auto;
  -moz-user-select: auto;
  -ms-user-select: auto;
  user-select: auto;
  -webkit-touch-callout: default;
  touch-action: manipulation;
}

.ad-preview-page .preview-access-cta {
  padding: 1.35rem 1.1rem 1.25rem;
  border: 1px solid rgba(0, 0, 0, 0.08);
  background: #f8f8f8;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
  text-align: center;
}

.ad-preview-page .preview-access-cta strong {
  display: block;
  font-size: clamp(1.15rem, 4.5vw, 1.45rem);
  color: #111111;
  margin-bottom: 0.65rem;
}

.ad-preview-page .preview-access-cta p {
  margin: 0 auto;
  max-width: 30rem;
  text-indent: 0 !important;
  text-align: center !important;
  color: #444444;
}

.cta-button,
.ad-preview-page .preview-access-cta .unlock-btn,
.ad-preview-page .sticky-cta-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: min(100%, 320px);
  min-height: 52px;
  margin-top: 1rem;
  max-width: 320px;
  padding: 16px 22px;
  border: 1px solid rgba(161, 98, 7, 0.4);
  border-radius: 12px;
  background: linear-gradient(
    135deg,
    #facc15 0%,
    #eab308 40%,
    #ca8a04 100%
  );
  color: #111111;
  font-size: 1rem;
  font-weight: 700;
  text-decoration: none;
  box-shadow: 0 6px 14px rgba(202, 138, 4, 0.25);
  transition: transform 160ms ease, box-shadow 160ms ease;
}

.cta-button:hover,
.ad-preview-page .preview-access-cta .unlock-btn:hover,
.ad-preview-page .sticky-cta-link:hover {
  transform: scale(1.03);
  box-shadow: 0 10px 22px rgba(202, 138, 4, 0.35);
}

.cta-button:active,
.ad-preview-page .preview-access-cta .unlock-btn:active,
.ad-preview-page .sticky-cta-link:active {
  transform: scale(0.98);
}

.ad-preview-page .preview-access-cta .cta-subtext {
  margin-top: 0.7rem;
  font-size: 0.88rem !important;
  opacity: 0.78;
}

.ad-preview-page .sticky-mobile-cta {
  position: fixed;
  right: 0;
  bottom: 0;
  left: 0;
  z-index: 9997;
  display: flex;
  justify-content: center;
  padding: 0.75rem 0.9rem calc(0.9rem + env(safe-area-inset-bottom, 0px));
  background: linear-gradient(180deg, rgba(255, 255, 255, 0), rgba(255, 255, 255, 0.94) 38%, rgba(255, 255, 255, 0.98) 100%);
  opacity: 0;
  pointer-events: none;
  transform: translateY(110%);
  transition: opacity 180ms ease, transform 180ms ease;
}

.ad-preview-page .sticky-mobile-cta.is-visible {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}

.ad-preview-page .sticky-cta-link {
  width: min(100%, 360px);
  min-height: 50px;
  border-radius: 999px;
  text-decoration: none;
  box-shadow: 0 14px 30px rgba(0, 0, 0, 0.28);
}

.ad-preview-page #unlock {
  scroll-margin-bottom: 6.5rem;
}

/* Light-mode preview loading card to match the updated reading surface */
.ad-preview-page #loading-state > div {
  background: #ffffff !important;
  color: #111111 !important;
  border: 1px solid rgba(0, 0, 0, 0.08);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08) !important;
}

.ad-preview-page #loading-state h2,
.ad-preview-page #loading-state p {
  color: #111111 !important;
}

@media (max-width: 600px) {
  .ad-preview-page {
    padding: calc(0.7rem + env(safe-area-inset-top, 0px)) 0.8rem calc(6rem + env(safe-area-inset-bottom, 0px));
  }

  .ad-preview-page h1 {
    font-size: 1.75rem;
    max-width: 10ch;
  }

  .ad-preview-page .preview-cover-image {
    max-height: 45vh;
    border-radius: 18px;
  }

  .ad-preview-page #chapters-container {
    padding: 1rem 0.9rem;
    border-radius: 16px;
  }

  .ad-preview-page .preview-access-cta {
    padding: 1.15rem 0.95rem 1.05rem;
  }

  .ad-preview-page .preview-access-cta .unlock-btn,
  .ad-preview-page .sticky-cta-link {
    width: 100%;
    max-width: none;
  }
}

@media (min-width: 769px) {
  .ad-preview-page .sticky-mobile-cta {
    display: none;
  }
}

/* Final heading color override for light-mode ad preview pages.
   This wins over earlier global heading rules like h1/h2/h3,
   .book h1, .book h2, .book section[id^="chapter"] h2,
   .chapter-title, and dark-mode title overrides. */
.ad-preview-page h1,
.ad-preview-page h2,
.ad-preview-page h3,
.ad-preview-page h4,
.ad-preview-page h5,
.ad-preview-page h6 {
  color: #1a1a1a !important;
  opacity: 1 !important;
  text-shadow: none !important;
  mix-blend-mode: normal !important;
}

.ad-preview-page .book-title,
.ad-preview-page .chapter-title,
.ad-preview-page .title {
  color: #1a1a1a !important;
  opacity: 1 !important;
  text-shadow: none !important;
  mix-blend-mode: normal !important;
}
