/* AskSasson Reader, progressive reading layer (guide pages + /read book shell).
   Loaded only on reader-enabled pages. Theme/font classes live on <html> so
   they apply before first paint on repeat visits. */

/* ── Reading progress bar ── */
.reader-progressbar {
  position: fixed;
  top: 0;
  left: 0;
  height: 4px;
  width: 100%;
  background: transparent;
  z-index: 1200;
  pointer-events: none;
}
.reader-progressbar span {
  display: block;
  height: 100%;
  width: 0;
  background: var(--secondary);
  transition: width 0.15s linear;
}

/* ── Floating toolbar ── */
.reader-toolbar {
  position: fixed;
  bottom: 18px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 4px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 999px;
  box-shadow: 0 6px 24px rgba(15, 35, 60, 0.18);
  padding: 6px 10px;
  z-index: 1100;
}
.reader-toolbar button {
  appearance: none;
  border: none;
  background: transparent;
  color: var(--dark);
  font: inherit;
  font-size: 14px;
  font-weight: 700;
  min-width: 40px;
  min-height: 40px;
  border-radius: 999px;
  cursor: pointer;
  padding: 0 10px;
}
.reader-toolbar button:hover {
  background: var(--light);
}
.reader-toolbar .reader-progress-label {
  font-size: 12.5px;
  font-weight: 700;
  color: var(--muted);
  padding: 0 8px;
  white-space: nowrap;
}
.reader-toolbar .reader-sep {
  width: 1px;
  height: 22px;
  background: var(--border);
  flex-shrink: 0;
}

/* Narrow screens: the toolbar holds 8+ controls — let it scroll instead of
   overflowing the viewport. */
@media (max-width: 640px) {
  .reader-toolbar {
    left: 8px;
    right: 8px;
    transform: none;
    max-width: none;
    overflow-x: auto;
    justify-content: flex-start;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }
  .reader-toolbar::-webkit-scrollbar {
    display: none;
  }
  .reader-toolbar button {
    flex-shrink: 0;
  }
  .reader-resume,
  .reader-tts-bar {
    max-width: calc(100vw - 16px);
  }
  .reader-resume span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
}

/* Theme menu (popup above toolbar) */
.reader-theme-menu {
  position: fixed;
  bottom: 76px;
  left: 50%;
  transform: translateX(-50%);
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: 0 6px 24px rgba(15, 35, 60, 0.18);
  padding: 6px;
  z-index: 1100;
  display: none;
}
.reader-theme-menu.is-open {
  display: block;
}
.reader-theme-menu button {
  display: block;
  width: 100%;
  text-align: left;
  border: none;
  background: transparent;
  font: inherit;
  font-size: 14px;
  padding: 9px 14px;
  border-radius: 8px;
  cursor: pointer;
  color: var(--dark);
}
.reader-theme-menu button:hover {
  background: var(--light);
}
.reader-theme-menu button[aria-pressed='true'] {
  font-weight: 800;
  color: var(--primary);
}

/* ── Resume chip ── */
.reader-resume {
  position: fixed;
  bottom: 78px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--dark);
  color: #fff;
  border-radius: 999px;
  padding: 8px 8px 8px 16px;
  font-size: 13.5px;
  z-index: 1100;
  box-shadow: 0 6px 24px rgba(15, 35, 60, 0.25);
}
.reader-resume button {
  border: none;
  font: inherit;
  font-size: 13px;
  font-weight: 700;
  border-radius: 999px;
  padding: 6px 12px;
  cursor: pointer;
}
.reader-resume .reader-resume-go {
  background: var(--secondary);
  color: #1f2933;
}
.reader-resume .reader-resume-dismiss {
  background: transparent;
  color: #cbd5e1;
}

/* ── Font size (classes on <html>) ── */
html.reader-font-sm .chapter p,
html.reader-font-sm .chapter-list li,
html.reader-font-sm .reader-chapter p,
html.reader-font-sm .reader-chapter li {
  font-size: 14.5px;
  line-height: 1.7;
}
html.reader-font-lg .chapter p,
html.reader-font-lg .chapter-list li,
html.reader-font-lg .reader-chapter p,
html.reader-font-lg .reader-chapter li {
  font-size: 18px;
  line-height: 1.85;
}
html.reader-font-xl .chapter p,
html.reader-font-xl .chapter-list li,
html.reader-font-xl .reader-chapter p,
html.reader-font-xl .reader-chapter li {
  font-size: 20px;
  line-height: 1.9;
}

/* ── Themes (classes on <html>) ──
   Guide pages hardcode several grays, so each theme overrides the chapter
   building blocks explicitly. */

/* Dark */
html.reader-theme-dark body {
  background: #111827;
  color: #e5e7eb;
}
html.reader-theme-dark .chapter,
html.reader-theme-dark .chapter:nth-child(even) {
  background: #111827;
  border-color: #273449;
}
html.reader-theme-dark .chapter p,
html.reader-theme-dark .chapter-list li,
html.reader-theme-dark .chapter-stat-label {
  color: #cbd5e1;
}
html.reader-theme-dark .chapter h2,
html.reader-theme-dark .chapter h3 {
  color: #f3f4f6;
}
html.reader-theme-dark .chapter-key-point,
html.reader-theme-dark .chapter-stat,
html.reader-theme-dark .chapter-example,
html.reader-theme-dark .guide-disclaimer {
  background: #1f2937;
  color: #d1d5db;
  box-shadow: none;
}
html.reader-theme-dark .guide-disclaimer strong {
  color: #e5e7eb;
}
html.reader-theme-dark .ebook-nav {
  background: #1f2937;
  border-color: #273449;
}
html.reader-theme-dark .ebook-nav a {
  color: #9ca3af;
}
html.reader-theme-dark .reader-toolbar,
html.reader-theme-dark .reader-theme-menu {
  background: #1f2937;
  border-color: #374151;
}
html.reader-theme-dark .reader-toolbar button,
html.reader-theme-dark .reader-theme-menu button {
  color: #e5e7eb;
}
html.reader-theme-dark .reader-toolbar button:hover,
html.reader-theme-dark .reader-theme-menu button:hover {
  background: #273449;
}
html.reader-theme-dark .reader-shell,
html.reader-theme-dark .reader-toc,
html.reader-theme-dark .reader-chapter {
  background: transparent;
  color: #e5e7eb;
}
html.reader-theme-dark .reader-toc a {
  color: #cbd5e1;
}
html.reader-theme-dark .reader-chapter h1,
html.reader-theme-dark .reader-chapter h2,
html.reader-theme-dark .reader-chapter h3 {
  color: #f3f4f6;
}

/* Sepia */
html.reader-theme-sepia body {
  background: #f4ecd8;
  color: #433422;
}
html.reader-theme-sepia .chapter,
html.reader-theme-sepia .chapter:nth-child(even) {
  background: #f4ecd8;
  border-color: #e0d3b8;
}
html.reader-theme-sepia .chapter p,
html.reader-theme-sepia .chapter-list li,
html.reader-theme-sepia .chapter-stat-label,
html.reader-theme-sepia .reader-chapter p,
html.reader-theme-sepia .reader-chapter li {
  color: #4a3a26;
}
html.reader-theme-sepia .chapter-key-point,
html.reader-theme-sepia .chapter-stat,
html.reader-theme-sepia .chapter-example,
html.reader-theme-sepia .guide-disclaimer {
  background: #faf5e6;
  color: #4a3a26;
  box-shadow: none;
}
html.reader-theme-sepia .ebook-nav {
  background: #faf5e6;
  border-color: #e0d3b8;
}

/* High contrast */
html.reader-theme-contrast body {
  background: #fff;
  color: #000;
}
html.reader-theme-contrast .chapter,
html.reader-theme-contrast .chapter:nth-child(even) {
  background: #fff;
  border-color: #000;
}
html.reader-theme-contrast .chapter p,
html.reader-theme-contrast .chapter-list li,
html.reader-theme-contrast .chapter-stat-label,
html.reader-theme-contrast .reader-chapter p,
html.reader-theme-contrast .reader-chapter li {
  color: #000;
}
html.reader-theme-contrast .chapter h2,
html.reader-theme-contrast .chapter h3,
html.reader-theme-contrast .chapter-label {
  color: #000;
}
html.reader-theme-contrast a {
  text-decoration: underline;
}
html.reader-theme-contrast .chapter-key-point,
html.reader-theme-contrast .chapter-stat,
html.reader-theme-contrast .chapter-example,
html.reader-theme-contrast .guide-disclaimer {
  background: #fff;
  color: #000;
  border: 2px solid #000;
  box-shadow: none;
}

/* ── Book shell (/read pages) ── */
.reader-shell {
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
  gap: 40px;
  max-width: 1200px;
  margin: 0 auto;
  padding: 32px 16px 120px;
}
.reader-toc {
  position: sticky;
  top: 84px;
  align-self: start;
  border-right: 1px solid var(--border);
  padding-right: 20px;
}
.reader-toc h2 {
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 12px;
}
.reader-toc ol {
  list-style: none;
}
.reader-toc li {
  margin-bottom: 4px;
}
.reader-toc a {
  display: block;
  padding: 8px 10px;
  border-radius: 8px;
  font-size: 14px;
  line-height: 1.4;
  color: var(--dark);
}
.reader-toc a:hover {
  background: var(--light);
}
.reader-toc li.is-current a {
  background: var(--light);
  font-weight: 800;
  color: var(--primary);
}
.reader-toc li.is-done a::after {
  content: ' \2713';
  color: var(--success);
  font-weight: 800;
}
.reader-toc .reader-toc-meta {
  display: block;
  font-size: 12px;
  color: var(--muted);
  font-weight: 400;
}
.reader-chapter {
  max-width: 740px;
}
.reader-chapter h1 {
  font-size: clamp(1.6rem, 3vw, 2.1rem);
  line-height: 1.25;
  margin-bottom: 8px;
}
.reader-chapter-meta {
  font-size: 13px;
  color: var(--muted);
  margin-bottom: 28px;
}
.reader-chapter p,
.reader-chapter li {
  font-size: 16px;
  line-height: 1.8;
  margin-bottom: 18px;
}
.reader-chapter ul,
.reader-chapter ol {
  padding-left: 1.4em;
}
.reader-chapter h2,
.reader-chapter h3 {
  margin: 32px 0 12px;
}
.reader-chapter hr {
  border: none;
  border-top: 1px solid var(--border);
  margin: 36px 0;
}
.reader-chapter-nav {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-top: 48px;
  padding-top: 24px;
  border-top: 1px solid var(--border);
}
.reader-chapter-nav a {
  display: inline-block;
  padding: 12px 18px;
  border: 1px solid var(--border);
  border-radius: 10px;
  font-weight: 700;
  font-size: 14.5px;
  max-width: 48%;
}
.reader-chapter-nav a:hover {
  border-color: var(--primary);
}
.reader-disclaimer {
  margin-top: 40px;
  padding: 16px 20px;
  background: var(--light);
  border: 1px solid var(--border);
  border-radius: 10px;
  font-size: 13px;
  line-height: 1.6;
  color: var(--muted);
}
.reader-loading,
.reader-error {
  padding: 60px 0;
  font-size: 15px;
  color: var(--muted);
}
.reader-toc-toggle {
  display: none;
}

@media (max-width: 860px) {
  .reader-shell {
    grid-template-columns: 1fr;
    gap: 0;
  }
  .reader-toc {
    position: static;
    border-right: none;
    border-bottom: 1px solid var(--border);
    padding: 0 0 16px;
    margin-bottom: 24px;
    display: none;
  }
  .reader-toc.is-open {
    display: block;
  }
  .reader-toc-toggle {
    display: inline-block;
    margin: 0 0 16px;
    padding: 10px 16px;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: #fff;
    font: inherit;
    font-weight: 700;
    font-size: 14px;
    cursor: pointer;
  }
}

/* ── Print: current chapter only ── */
@media print {
  .reader-toolbar,
  .reader-progressbar,
  .reader-theme-menu,
  .reader-resume,
  .reader-toc,
  .reader-toc-toggle,
  .reader-chapter-nav,
  .ebook-nav,
  .ebook-cta,
  header,
  footer {
    display: none !important;
  }
  html.reader-print-chapter section.chapter:not(.reader-print-target) {
    display: none !important;
  }
  html.reader-print-chapter .page-hero {
    display: none !important;
  }
  .reader-shell {
    display: block;
    padding: 0;
  }
}

/* ════ Search ════ */
.reader-search-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 25, 40, 0.45);
  z-index: 1300;
  display: none;
  align-items: flex-start;
  justify-content: center;
  padding: 9vh 16px 16px;
}
.reader-search-overlay.is-open {
  display: flex;
}
.reader-search-panel {
  width: 100%;
  max-width: 640px;
  background: #fff;
  border-radius: 14px;
  box-shadow: 0 18px 60px rgba(10, 20, 40, 0.35);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  max-height: 76vh;
}
.reader-search-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
}
.reader-search-row input {
  flex: 1;
  border: none;
  outline: none;
  font: inherit;
  font-size: 17px;
  padding: 6px 4px;
  background: transparent;
  color: inherit;
}
.reader-search-close {
  border: none;
  background: transparent;
  font: inherit;
  font-size: 20px;
  line-height: 1;
  min-width: 36px;
  min-height: 36px;
  border-radius: 8px;
  cursor: pointer;
  color: var(--muted);
}
.reader-search-close:hover {
  background: var(--light);
}
.reader-search-status {
  padding: 8px 16px 0;
  font-size: 13px;
  font-weight: 700;
  color: var(--muted);
}
.reader-search-results {
  overflow-y: auto;
  padding: 8px;
}
.reader-search-chapter {
  font-size: 11.5px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--primary);
  padding: 12px 10px 4px;
}
.reader-search-result {
  display: block;
  width: 100%;
  text-align: left;
  border: none;
  background: transparent;
  font: inherit;
  font-size: 14px;
  line-height: 1.55;
  color: var(--dark);
  padding: 8px 10px;
  border-radius: 8px;
  cursor: pointer;
}
.reader-search-result:hover,
.reader-search-result.is-active {
  background: var(--light);
}
.reader-search-result mark {
  background: var(--secondary);
  color: #1f2933;
  border-radius: 3px;
  padding: 0 2px;
  font-weight: 700;
}
.reader-search-hint {
  padding: 8px 16px 12px;
  font-size: 12px;
  color: var(--muted);
  border-top: 1px solid var(--border);
}
mark.reader-search-mark {
  background: rgba(214, 162, 30, 0.45);
  color: inherit;
  border-radius: 2px;
}
mark.reader-search-mark.is-active {
  background: var(--secondary);
  color: #1f2933;
  box-shadow: 0 0 0 2px var(--secondary);
}

/* ════ Highlights & notes ════ */
mark.reader-hl {
  color: inherit;
  border-radius: 2px;
  cursor: pointer;
  padding: 0.06em 0;
}
mark.reader-hl-yellow {
  background: rgba(250, 204, 21, 0.45);
}
mark.reader-hl-blue {
  background: rgba(96, 165, 250, 0.4);
}
mark.reader-hl-green {
  background: rgba(74, 222, 128, 0.4);
}
mark.reader-hl-pink {
  background: rgba(244, 114, 182, 0.4);
}
mark.reader-hl.is-flash {
  outline: 3px solid var(--primary);
  outline-offset: 1px;
}
html.reader-theme-dark mark.reader-hl-yellow {
  background: rgba(202, 138, 4, 0.55);
}
html.reader-theme-dark mark.reader-hl-blue {
  background: rgba(37, 99, 235, 0.5);
}
html.reader-theme-dark mark.reader-hl-green {
  background: rgba(22, 163, 74, 0.5);
}
html.reader-theme-dark mark.reader-hl-pink {
  background: rgba(219, 39, 119, 0.5);
}
html.reader-theme-contrast mark.reader-hl {
  outline: 2px solid #000;
}

.reader-selection-bar {
  position: fixed;
  display: none;
  align-items: center;
  gap: 6px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 999px;
  box-shadow: 0 8px 28px rgba(15, 35, 60, 0.22);
  padding: 6px 10px;
  z-index: 1250;
}
.reader-selection-bar.is-open {
  display: flex;
}
.reader-hl-dot {
  width: 24px;
  height: 24px;
  min-width: 24px;
  border-radius: 50%;
  border: 2px solid rgba(0, 0, 0, 0.18);
  cursor: pointer;
  padding: 0;
  display: inline-block;
  flex-shrink: 0;
}
.reader-hl-dot-yellow {
  background: #facc15;
}
.reader-hl-dot-blue {
  background: #60a5fa;
}
.reader-hl-dot-green {
  background: #4ade80;
}
.reader-hl-dot-pink {
  background: #f472b6;
}
.reader-selection-note {
  border: none;
  background: transparent;
  font: inherit;
  font-size: 13.5px;
  font-weight: 700;
  color: var(--dark);
  padding: 4px 8px;
  border-radius: 8px;
  cursor: pointer;
}
.reader-selection-note:hover {
  background: var(--light);
}
.reader-hl-remove {
  color: var(--error);
}
html.reader-theme-dark .reader-selection-bar {
  background: #1f2937;
  border-color: #374151;
}
html.reader-theme-dark .reader-selection-note {
  color: #e5e7eb;
}

.reader-notes-panel {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: min(380px, 100vw);
  background: #fff;
  border-left: 1px solid var(--border);
  box-shadow: -8px 0 30px rgba(15, 35, 60, 0.15);
  z-index: 1240;
  display: flex;
  flex-direction: column;
  transform: translateX(105%);
  transition: transform 0.25s ease;
}
.reader-notes-panel.is-open {
  transform: translateX(0);
}
.reader-notes-head {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
}
.reader-notes-head h2 {
  flex: 1;
  font-size: 16px;
  margin: 0;
}
.reader-notes-head button {
  border: 1px solid var(--border);
  background: #fff;
  font: inherit;
  font-size: 13px;
  font-weight: 700;
  padding: 6px 12px;
  border-radius: 8px;
  cursor: pointer;
}
.reader-notes-head button:hover {
  border-color: var(--primary);
}
.reader-notes-head .reader-search-close {
  border: none;
}
.reader-notes-list {
  overflow-y: auto;
  padding: 12px 16px 90px;
}
.reader-notes-list h3 {
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--primary);
  margin: 16px 0 8px;
}
.reader-notes-empty {
  font-size: 14px;
  color: var(--muted);
  line-height: 1.6;
  padding-top: 12px;
}
.reader-notes-item {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 12px;
  margin-bottom: 10px;
}
.reader-notes-quote {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  width: 100%;
  text-align: left;
  border: none;
  background: transparent;
  font: inherit;
  font-size: 13.5px;
  line-height: 1.55;
  color: var(--dark);
  cursor: pointer;
  padding: 0;
}
.reader-notes-quote:hover {
  color: var(--primary);
}
.reader-notes-quote .reader-hl-dot {
  width: 12px;
  height: 12px;
  min-width: 12px;
  margin-top: 4px;
  border-width: 1px;
  cursor: inherit;
}
.reader-notes-note {
  font-size: 13px;
  color: var(--muted);
  margin: 8px 0 0 20px;
  white-space: pre-wrap;
}
.reader-notes-editor {
  margin: 8px 0 0 20px;
}
.reader-notes-editor textarea {
  width: 100%;
  font: inherit;
  font-size: 13.5px;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px;
  resize: vertical;
}
.reader-notes-editor button {
  margin-top: 6px;
  border: 1px solid var(--border);
  background: var(--primary);
  color: #fff;
  font: inherit;
  font-size: 12.5px;
  font-weight: 700;
  padding: 6px 12px;
  border-radius: 8px;
  cursor: pointer;
}
.reader-notes-actions {
  display: flex;
  gap: 10px;
  margin: 8px 0 0 20px;
}
.reader-notes-actions button {
  border: none;
  background: transparent;
  font: inherit;
  font-size: 12.5px;
  font-weight: 700;
  color: var(--primary);
  cursor: pointer;
  padding: 2px 0;
}
.reader-notes-actions .reader-hl-remove {
  color: var(--error);
}
html.reader-theme-dark .reader-notes-panel,
html.reader-theme-dark .reader-notes-head button {
  background: #1f2937;
  border-color: #374151;
  color: #e5e7eb;
}
html.reader-theme-dark .reader-notes-quote,
html.reader-theme-dark .reader-notes-list h3 {
  color: #e5e7eb;
}
html.reader-theme-dark .reader-search-panel {
  background: #1f2937;
  color: #e5e7eb;
}
html.reader-theme-dark .reader-search-result {
  color: #e5e7eb;
}
html.reader-theme-dark .reader-search-result:hover,
html.reader-theme-dark .reader-search-result.is-active,
html.reader-theme-dark .reader-search-close:hover {
  background: #273449;
}

/* ════ Read aloud (TTS) ════ */
.reader-tts-bar {
  position: fixed;
  bottom: 78px;
  left: 50%;
  transform: translateX(-50%);
  display: none;
  align-items: center;
  gap: 6px;
  background: var(--dark);
  color: #fff;
  border-radius: 999px;
  padding: 8px 14px;
  z-index: 1100;
  box-shadow: 0 6px 24px rgba(15, 35, 60, 0.25);
}
.reader-tts-bar.is-open {
  display: flex;
}
.reader-tts-bar button {
  border: none;
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  font: inherit;
  font-size: 13px;
  font-weight: 700;
  min-height: 34px;
  padding: 0 14px;
  border-radius: 999px;
  cursor: pointer;
}
.reader-tts-bar button:hover {
  background: rgba(255, 255, 255, 0.22);
}
.reader-tts-status {
  font-size: 12.5px;
  opacity: 0.75;
  padding: 0 6px;
  white-space: nowrap;
}
.reader-tts-active {
  background: rgba(214, 162, 30, 0.18);
  box-shadow: -4px 0 0 0 var(--secondary);
  border-radius: 4px;
  transition: background 0.2s;
}
html.reader-theme-dark .reader-tts-active {
  background: rgba(214, 162, 30, 0.25);
}

/* ════ Page mode ════ */
.reader-pages-viewport {
  position: relative;
  overflow: hidden;
  perspective: 1600px;
}
.reader-pages-content {
  position: relative;
  column-fill: auto;
  transition: transform 0.32s cubic-bezier(0.22, 0.61, 0.36, 1);
  transform-origin: left center;
  will-change: transform;
}
.reader-pages-content img {
  max-height: 60vh;
}
.reader-pages-content.is-turn-fwd {
  animation: reader-turn-fwd 0.32s cubic-bezier(0.22, 0.61, 0.36, 1);
}
.reader-pages-content.is-turn-back {
  animation: reader-turn-back 0.32s cubic-bezier(0.22, 0.61, 0.36, 1);
}
@keyframes reader-turn-fwd {
  0% {
    filter: brightness(1);
  }
  45% {
    transform-origin: right center;
    filter: brightness(0.96);
  }
  100% {
    filter: brightness(1);
  }
}
@keyframes reader-turn-back {
  0% {
    filter: brightness(1);
  }
  45% {
    transform-origin: left center;
    filter: brightness(0.96);
  }
  100% {
    filter: brightness(1);
  }
}
.reader-page-zone {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 56px;
  border: none;
  background: transparent;
  color: transparent;
  font-size: 34px;
  cursor: pointer;
  z-index: 5;
  transition: color 0.15s, background 0.15s;
}
.reader-page-zone:hover,
.reader-page-zone:focus-visible {
  color: var(--primary);
  background: linear-gradient(to right, rgba(21, 101, 192, 0.06), transparent);
}
.reader-page-zone-prev {
  left: 0;
}
.reader-page-zone-next {
  right: 0;
  background: linear-gradient(to left, rgba(21, 101, 192, 0), transparent);
}
.reader-page-zone-next:hover,
.reader-page-zone-next:focus-visible {
  background: linear-gradient(to left, rgba(21, 101, 192, 0.06), transparent);
}
/* The page edge: a soft gradient that sells the "sheet" effect */
.reader-pages-viewport::after {
  content: '';
  position: absolute;
  top: 0;
  bottom: 0;
  right: 0;
  width: 14px;
  pointer-events: none;
  background: linear-gradient(to left, rgba(15, 35, 60, 0.08), transparent);
}
html.reader-page-mode .reader-chapter {
  max-width: none;
}
html.reader-theme-dark .reader-pages-viewport::after {
  background: linear-gradient(to left, rgba(0, 0, 0, 0.35), transparent);
}

/* ════ Interactive education blocks (book mode) ════ */
.reader-extras {
  max-width: 740px;
  margin-top: 40px;
  display: grid;
  gap: 20px;
}
.reader-extras-heading {
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--primary);
  margin: 0 0 12px;
}
.reader-takeaways,
.reader-quiz,
.reader-checklist {
  background: #fff;
  border: 1px solid var(--border);
  border-left: 4px solid var(--primary);
  border-radius: 12px;
  padding: 20px 24px;
}
.reader-takeaways ul {
  list-style: none;
  padding: 0;
  margin: 0;
}
.reader-takeaways li {
  position: relative;
  padding: 8px 0 8px 26px;
  font-size: 15px;
  line-height: 1.65;
  border-bottom: 1px solid var(--light);
}
.reader-takeaways li:last-child {
  border-bottom: none;
}
.reader-takeaways li::before {
  content: '→';
  position: absolute;
  left: 0;
  color: var(--primary);
  font-weight: 700;
}
.reader-quiz {
  border-left-color: var(--secondary);
}
.reader-quiz .reader-extras-heading {
  color: var(--secondary-dark);
}
.reader-quiz-question {
  font-size: 15.5px;
  font-weight: 700;
  margin: 0 0 14px;
}
.reader-quiz-option {
  display: block;
  width: 100%;
  text-align: left;
  font: inherit;
  font-size: 14.5px;
  line-height: 1.5;
  background: var(--light);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 11px 14px;
  margin-bottom: 8px;
  cursor: pointer;
}
.reader-quiz-option:hover {
  border-color: var(--primary);
}
.reader-quiz-option.is-chosen.is-correct {
  border-color: var(--success);
  background: #ecf8ee;
}
.reader-quiz-option.is-chosen.is-neutral {
  border-color: var(--secondary);
  background: #fdf6e4;
}
.reader-quiz-feedback {
  font-size: 14px;
  line-height: 1.6;
  border-radius: 10px;
  padding: 12px 14px;
  margin: 10px 0 0;
}
.reader-quiz-feedback.is-correct {
  background: #ecf8ee;
  color: #1d5a23;
}
.reader-quiz-feedback.is-neutral {
  background: #fdf6e4;
  color: #6b5413;
}
.reader-checklist {
  border-left-color: var(--success);
}
.reader-checklist .reader-extras-heading {
  color: var(--success);
}
.reader-checklist-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 8px 0;
  font-size: 15px;
  line-height: 1.6;
  cursor: pointer;
  border-bottom: 1px solid var(--light);
}
.reader-checklist-item:last-of-type {
  border-bottom: none;
}
.reader-checklist-item input {
  margin-top: 4px;
  width: 17px;
  height: 17px;
  flex-shrink: 0;
  accent-color: var(--success);
}
.reader-checklist-item input:checked + span {
  color: var(--muted);
  text-decoration: line-through;
  text-decoration-color: rgba(107, 114, 128, 0.5);
}
.reader-cta {
  background: linear-gradient(135deg, #0d47a1, #1565c0);
  color: #fff;
  border-radius: 14px;
  padding: 28px;
  text-align: center;
}
.reader-cta h2 {
  color: #fff;
  font-size: 1.35rem;
  margin: 0 0 10px;
}
.reader-cta p {
  font-size: 15px;
  opacity: 0.9;
  margin: 0 auto 18px;
  max-width: 480px;
}
.reader-cta-actions {
  display: flex;
  gap: 12px;
  justify-content: center;
  flex-wrap: wrap;
}
.reader-cta-primary,
.reader-cta-secondary {
  display: inline-block;
  font-weight: 700;
  font-size: 14.5px;
  padding: 11px 20px;
  border-radius: 10px;
}
.reader-cta-primary {
  background: #fff;
  color: #1565c0;
}
.reader-cta-primary:hover {
  background: #f0f4ff;
}
.reader-cta-secondary {
  border: 1px solid rgba(255, 255, 255, 0.5);
  color: #fff;
}
.reader-cta .reader-extras-fine {
  color: rgba(255, 255, 255, 0.65);
}
.reader-extras-fine {
  font-size: 11.5px;
  line-height: 1.5;
  color: var(--muted);
  margin: 12px 0 0;
}
html.reader-theme-dark .reader-takeaways,
html.reader-theme-dark .reader-quiz,
html.reader-theme-dark .reader-checklist {
  background: #1f2937;
  border-color: #374151;
  color: #e5e7eb;
}
html.reader-theme-dark .reader-takeaways li {
  border-bottom-color: #273449;
}
html.reader-theme-dark .reader-quiz-option {
  background: #273449;
  border-color: #374151;
  color: #e5e7eb;
}
html.reader-theme-dark .reader-quiz-option.is-chosen.is-correct {
  background: rgba(46, 125, 50, 0.25);
}
html.reader-theme-dark .reader-quiz-option.is-chosen.is-neutral {
  background: rgba(214, 162, 30, 0.2);
}
html.reader-theme-dark .reader-quiz-feedback.is-correct {
  background: rgba(46, 125, 50, 0.25);
  color: #a7e3ad;
}
html.reader-theme-dark .reader-quiz-feedback.is-neutral {
  background: rgba(214, 162, 30, 0.2);
  color: #ecd9a0;
}
html.reader-theme-dark .reader-checklist-item {
  border-bottom-color: #273449;
}
html.reader-theme-contrast .reader-takeaways,
html.reader-theme-contrast .reader-quiz,
html.reader-theme-contrast .reader-checklist {
  border: 2px solid #000;
}

/* ════ Print: keep highlights visible, hide reader chrome ════ */
@media print {
  .reader-search-overlay,
  .reader-selection-bar,
  .reader-notes-panel,
  .reader-tts-bar,
  .reader-page-zone,
  .reader-quiz,
  .reader-cta {
    display: none !important;
  }
  /* Takeaways + checklist print as a worksheet */
  .reader-takeaways,
  .reader-checklist {
    border: 1px solid #999;
    break-inside: avoid;
  }
  mark.reader-hl {
    background: none !important;
    border-bottom: 2px solid #555;
  }
  mark.reader-search-mark {
    background: none !important;
  }
}

@media (prefers-reduced-motion: reduce) {
  .reader-progressbar span,
  .reader-notes-panel,
  .reader-pages-content {
    transition: none;
  }
  .reader-pages-content.is-turn-fwd,
  .reader-pages-content.is-turn-back {
    animation: none;
  }
}
