/* ========================================
   READER STYLES
   ======================================== */


  /* ========================================
     §06  DARK MODE — TEXT ELEMENTS
     ======================================== */

  /* --- Text elements --- */
  html.dark-mode p,
  html.dark-mode sup,
  html.dark-mode h1,
  html.dark-mode h2 {
    color: #f0f0f0;
  }

  html.dark-mode p {
    color: #e0e0e0;
  }

  /* ========================================
     §07  DARK MODE — NAVIGATION & DROPDOWNS
     ======================================== */

  /* --- Glass navigation bar --- */
  html.dark-mode .glass-nav {
    background: rgba(26, 26, 26, 1);
    border-bottom-color: rgba(255, 255, 255, 0.08);
  }

  /* --- Nav logo text --- */
  html.dark-mode .glass-nav a.prose-bible {
    color: #f0f0f0;
  }

  html.dark-mode .glass-nav a.prose-bible span {
    color: #737373;
  }

  /* --- Theme toggle button --- */
  html.dark-mode #theme-toggle {
    background-color: transparent;
    color: #d1d5db;
    border: none;
  }

  html.dark-mode #theme-toggle:hover {
    background-color: #333333;
    color: #ffffff;
  }

  html.dark-mode #theme-toggle::before {
    background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke="%239ca3af" stroke-width="1.5"><path stroke-linecap="round" stroke-linejoin="round" d="M12 3v2.25m6.364.386l-1.591 1.591M21 12h-2.25m-.386 6.364l-1.591-1.591M12 18.75V21m-4.773-4.227l-1.591 1.591M5.25 12H3m4.227-4.773L5.636 5.636M15.75 12a3.75 3.75 0 11-7.5 0 3.75 3.75 0 017.5 0z"/></svg>');
  }

  /* --- Dropdown buttons (Books + Chapters + Settings) --- */
  html.dark-mode #dropdown-button,
  html.dark-mode #chapter-dropdown-button,
  html.dark-mode #settings-dropdown-button {
    background-color: #2a2a2a;
    color: #e0e0e0;
    --tw-ring-color: #404040;
    box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.3);
  }

  html.dark-mode #dropdown-button:hover,
  html.dark-mode #chapter-dropdown-button:hover,
  html.dark-mode #settings-dropdown-button:hover {
    background-color: #333333;
  }

  html.dark-mode #dropdown-button svg,
  html.dark-mode #chapter-dropdown-button svg,
  html.dark-mode #settings-dropdown-button svg {
    color: #9ca3af;
  }

  /* --- Dropdown menu panels (Books + Chapters + Settings) --- */
  html.dark-mode #dropdown-menu,
  html.dark-mode #chapter-dropdown-menu,
  html.dark-mode #settings-dropdown-menu {
    background-color: #252525;
    --tw-ring-color: rgba(255, 255, 255, 0.1);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
  }

  /* Settings dropdown dark mode tweaks */
  html.dark-mode #settings-dropdown-menu .text-gray-900 {
    color: #f0f0f0;
  }

  html.dark-mode #settings-dropdown-menu .text-gray-500 {
    color: #9ca3af;
  }

  html.dark-mode #settings-dropdown-menu .text-gray-700 {
    color: #d1d5db;
  }

  html.dark-mode #settings-dropdown-menu .border-gray-100 {
    border-color: #333333;
  }

  html.dark-mode #settings-dropdown-menu .hover\:bg-gray-100:hover {
    background-color: #333333;
    color: #ffffff;
  }

  html.dark-mode #settings-dropdown-menu .text-gray-400 {
    color: #6b7280;
  }

  /* ========================================
     §08  DARK MODE — CHAPTER PILLS & DROPDOWN MENUS
     ======================================== */

  /* --- Chapter pills dark mode --- */
  html.dark-mode .chapter-pill {
    background-color: #333333;
    color: #d1d5db;
  }

  html.dark-mode .chapter-pill:hover {
    background-color: #404040;
    color: #f3f4f6;
  }

  html.dark-mode .chapter-pill-active {
    background-color: #e0e0e0;
    color: #1a1a1a;
  }

  html.dark-mode .chapter-pill-active:hover {
    background-color: #f0f0f0;
    color: #1a1a1a;
  }

  /* Dropdown section headers (Old Testament / New Testament) */
  html.dark-mode #dropdown-menu .bg-gray-50 {
    background-color: #1e1e1e;
    color: #808080;
  }

  html.dark-mode #dropdown-menu .border-gray-100 {
    border-color: #333333;
  }

  /* Dropdown links */
  html.dark-mode #dropdown-menu a {
    color: #d0d0d0;
  }

  html.dark-mode #dropdown-menu a:hover {
    background-color: #333333;
    color: #ffffff;
  }

  /* Dropdown scrollbar */
  html.dark-mode .dropdown-scroll::-webkit-scrollbar-thumb {
    background-color: #555555;
  }

  /* --- Chapter borders --- */
  html.dark-mode h2.border-b {
    border-color: #333333;
  }

  /* ========================================
     §09  DARK MODE — VERSE, SPINNER, FOOTER, ERROR
     ======================================== */

  /* --- Verse hover states --- */
  html.dark-mode .verse:hover {
    background-color: #252525 !important;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
  }

  /* Reset the Tailwind hover:bg-white in dark mode */
  html.dark-mode .hover\:bg-white {
    background-color: transparent;
  }

  /* --- Loading spinner --- */
  html.dark-mode #loading-spinner p {
    color: #9ca3af;
  }

  html.dark-mode #loading-spinner svg {
    color: #6b7280;
  }

  /* --- Footer --- */
  html.dark-mode footer {
    background-color: #111111;
    border-top-color: #252525;
  }

  html.dark-mode footer p {
    color: inherit;
  }

  html.dark-mode footer a:hover {
    color: #d4a853;
  }

  /* --- Error state --- */
  html.dark-mode .bg-red-50 {
    background-color: #2a1a1a;
    border-color: #4a2020;
  }

  html.dark-mode .text-red-600 {
    color: #f87171;
  }

  html.dark-mode .text-red-800 {
    color: #fca5a5;
  }

  /* ========================================
    SCROLL TO TOP BUTTON
    ======================================== */

  #scroll-to-top {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    border: 1px solid #d1d5db;
    background-color: rgba(255, 255, 255, 0.9);
    color: #374151;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    transition:
      opacity 0.3s ease,
      transform 0.3s ease,
      background-color 0.2s ease,
      box-shadow 0.2s ease;
    transform: translateY(10px);
  }

  #scroll-to-top.visible {
    opacity: 1 !important;
    pointer-events: auto;
    transform: translateY(0);
  }

  #scroll-to-top:hover {
    background-color: #f3f4f6;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  }

  #scroll-to-top:active {
    transform: translateY(0) scale(0.95);
  }

  /* Dark mode variant */
  html.dark-mode #scroll-to-top {
    background-color: rgba(42, 42, 42, 0.9);
    color: #e0e0e0;
    border-color: #404040;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
  }

  html.dark-mode #scroll-to-top:hover {
    background-color: rgba(51, 51, 51, 0.95);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
  }

  /* ========================================
     §11  VERSE CONTAINER & FAVORITED STATE
     ======================================== */

  .verse-container {
    background-color: #fafafa;
    border-radius: 10px;
    padding: 5px;
    display: block;
    position: relative;
  }

  html.dark-mode .verse-container {
    background-color: #252525;
  }

  .verse-container.favorited {
    background-color: #fef9ee;
    border-left: 3px solid #d4a853;
  }

  html.dark-mode .verse-container.favorited {
    background-color: #2e2718;
    border-left: 3px solid #d4a853;
  }

  /* --- Important Verse (Favorited + Has Note) --- */
  .verse-container.favorited.has-note {
    background: linear-gradient(to right, #fefce8, #fef9ee);
    border-left: 4px solid #d4a853;
    box-shadow: 0 2px 10px rgba(212, 168, 83, 0.15);
    position: relative;
  }

  .verse-container.favorited.has-note::after {
    content: '✨';
    position: absolute;
    top: -8px;
    right: -8px;
    font-size: 1.2rem;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.1));
  }

  html.dark-mode .verse-container.favorited.has-note {
    background: linear-gradient(to right, #2e2718, #252015);
    border-left: 4px solid #d4a853;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
  }

  /* ========================================
     §12  VERSE TEXT, PROSE-BIBLE, CHAPTER HEADING
     ======================================== */

  .verse {
    transition:
      background-color 0.2s ease,
      transform 0.2s ease,
      box-shadow 0.2s ease,
      color 0.3s ease;
    font-size: var(--verse-font-size) !important;
    color: var(--verse-text-color) !important;
    line-height: var(--verse-line-height) !important;
  }

  .prose-bible {
    font-family: var(--verse-font-family) !important;
  }

  /* --- Chapter Heading with Next-Chapter Arrow --- */
  .chapter-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 1.5rem;
    font-weight: 700;
    color: #1f2937;
    margin-top: 4rem;
    margin-bottom: 2rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid #e5e7eb;
    font-family: var(--verse-font-family);
  }

  @media (min-width: 768px) {
    .chapter-heading {
      font-size: 1.875rem;
    }
  }

  html.dark-mode .chapter-heading {
    color: #e5e7eb;
    border-bottom-color: #333333;
  }

  /* ========================================
     §13  NEXT CHAPTER BUTTON
     ======================================== */

  .next-chapter-btn {
    position: sticky;
    top: 140px;
    float: right;
    margin-right: -60px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    border: 1px solid #d1d5db;
    border-radius: 50%;
    background: #ffffff;
    color: #6b7280;
    cursor: pointer;
    z-index: 10;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    transition: all 0.2s ease;
    overflow: hidden;
    /* clip the ghost number to the circle */
  }

  /* Ghost chapter number rendered as background text.
   attr(data-current) is updated by updateProgress() in book_script.js.
   The number is intentionally oversized so only part of it shows,
   giving a subtle "watermark" effect rather than a readable label. */
  .next-chapter-btn::before {
    content: attr(data-current);
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: 'Inter', system-ui, sans-serif;
    font-size: 1.7rem;
    font-weight: 900;
    letter-spacing: -0.04em;
    color: #c5a059;
    opacity: 0.18;
    pointer-events: none;
    user-select: none;
    line-height: 1;
    transition: opacity 0.3s ease;
  }

  /* Bring the ghost up slightly on hover so users can "read" the number */
  .next-chapter-btn:hover::before {
    opacity: 0.32;
  }

  .next-chapter-btn:hover {
    background-color: #f3f4f6;
    color: #374151;
    transform: scale(1.1);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  }

  .next-chapter-btn:active {
    transform: scale(0.95);
  }

  .next-chapter-btn svg {
    position: relative;
    /* sit above the ::before ghost */
    z-index: 1;
    transition: transform 0.2s ease;
  }

  .next-chapter-btn:hover svg {
    transform: translateY(2px);
  }

  @media (max-width: 1200px) {
    .next-chapter-btn {
      margin-right: 0;
      float: none;
      position: absolute;
      right: 10px;
      top: 0;
    }
  }

  .chapter-heading,
  .verse-container {
    scroll-margin-top: 140px;
  }

  html.dark-mode .next-chapter-btn {
    background: #2a2a2a;
    border-color: #404040;
    color: #9ca3af;
  }

  html.dark-mode .next-chapter-btn::before {
    color: #c5a059;
    opacity: 0.22;
  }

  html.dark-mode .next-chapter-btn:hover::before {
    opacity: 0.4;
  }

  html.dark-mode .next-chapter-btn:hover {
    background: #333333;
    color: #e0e0e0;
    border-color: #6b7280;
  }

  /* ========================================
     §14  VERSE HIGHLIGHTS (TARGET, TTS, SEARCH PULSE)
     ======================================== */

  /* --- Deep-linked / Search Target Highlight --- */
  .highlight-target {
    background-color: #fffae6;
    /* A soft yellow */
    border-left: 4px solid #fbc02d;
    /* A strong yellow accent line */
    transition: background-color 1s ease;
    /* Fades the color in nicely */
  }

  /* --- TTS Active Verse Highlight --- */
  .tts-active-verse {
    background-color: #e0e7ff;
    border-left: 4px solid #4f46e5;
    border-radius: 8px;
    transition: background-color 0.3s ease, border-color 0.3s ease;
  }

  html.dark-mode .tts-active-verse {
    background-color: #1e1b4b;
    border-left-color: #6366f1;
  }

  /* --- Premium Search Target Pulse --- */
  @keyframes pulse-highlight {
    0% {
      background-color: transparent;
    }

    30% {
      background-color: #fef08a;
      transform: scale(1.01);
      box-shadow: 0 0 15px rgba(254, 240, 138, 0.5);
    }

    60% {
      background-color: transparent;
      transform: scale(1);
    }

    100% {
      background-color: rgba(254, 240, 138, 0.2);
    }
  }

  .search-target-pulse {
    animation: pulse-highlight 1.5s ease-out 2 forwards;
    border-left: 4px solid #facc15;
    border-radius: 8px;
    position: relative;
    z-index: 5;
  }

  html.dark-mode .search-target-pulse {
    animation-name: pulse-highlight-dark;
    border-left-color: #854d0e;
  }

  @keyframes pulse-highlight-dark {
    0% {
      background-color: transparent;
    }

    30% {
      background-color: rgba(133, 77, 14, 0.4);
      transform: scale(1.01);
      box-shadow: 0 0 15px rgba(133, 77, 14, 0.3);
    }

    60% {
      background-color: transparent;
      transform: scale(1);
    }

    100% {
      background-color: rgba(133, 77, 14, 0.2);
    }
  }

  /* ========================================
     §15  FONT TOOLBAR SETTINGS
     ======================================== */

  /* --- Font Toolbar Settings --- */
  .font-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 12px;
    padding: 8px 16px;
    background: #ffffff;
    border-top: 1px solid #e5e7eb;
    font-size: 0.875rem;
    color: #4b5563;
  }

  html.dark-mode .font-toolbar {
    background: #1a1a1a;
    border-top-color: rgba(255, 255, 255, 0.08);
    color: #d1d5db;
  }

  .font-toolbar select,
  .font-toolbar input[type="color"] {
    background: #f9fafb;
    border: 1px solid #d1d5db;
    border-radius: 4px;
    padding: 4px 8px;
    color: #111827;
    font-size: 0.875rem;
    outline: none;
    cursor: pointer;
  }

  html.dark-mode .font-toolbar select,
  html.dark-mode .font-toolbar input[type="color"] {
    background: #374151;
    border-color: #4b5563;
    color: #f3f4f6;
  }

  .font-toolbar div {
    display: flex;
    align-items: center;
    gap: 6px;
  }

  .font-toolbar input[type="color"] {
    padding: 0;
    height: 26px;
    width: 26px;
    border-radius: 50%;
    overflow: hidden;
  }

  .font-toolbar input[type="color"]::-webkit-color-swatch-wrapper {
    padding: 0;
  }

  .font-toolbar input[type="color"]::-webkit-color-swatch {
    border: none;
  }

  /* ========================================
     §16  VERSE OVERFLOW MENU
     ======================================== */

  .verse-overflow {
    position: relative;
    display: flex;
    align-items: flex-start;
    flex-shrink: 0;
    z-index: 10;
  }

  .overflow-trigger {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    background: transparent;
    cursor: pointer;
    font-size: 1.25rem;
    color: #9ca3af;
    border-radius: 6px;
    transition:
      background-color 0.2s ease,
      color 0.2s ease;
    line-height: 1;
    letter-spacing: 1px;
  }

  .overflow-trigger:hover {
    background-color: rgba(0, 0, 0, 0.06);
    color: #4b5563;
  }

  html.dark-mode .overflow-trigger {
    color: #6b7280;
  }

  html.dark-mode .overflow-trigger:hover {
    background-color: rgba(255, 255, 255, 0.08);
    color: #d1d5db;
  }

  /* Dropdown menu — hidden by default */
  .overflow-menu {
    position: absolute;
    top: 0;
    right: 100%;
    margin-right: 4px;
    min-width: 170px;
    background: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    box-shadow:
      0 4px 16px rgba(0, 0, 0, 0.1),
      0 1px 3px rgba(0, 0, 0, 0.06);
    padding: 4px;
    opacity: 0;
    visibility: hidden;
    transform: scale(0.95) translateX(4px);
    transition:
      opacity 0.15s ease,
      transform 0.15s ease,
      visibility 0.15s ease;
    z-index: 20;
  }

  /* Show when opened via click/tap */
  .overflow-menu.open {
    opacity: 1;
    visibility: visible;
    transform: scale(1) translateX(0);
  }

  html.dark-mode .overflow-menu {
    background: #2a2a2a;
    border-color: #404040;
    box-shadow:
      0 4px 16px rgba(0, 0, 0, 0.35),
      0 1px 3px rgba(0, 0, 0, 0.2);
  }

  /* Menu items */
  .overflow-item {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    padding: 8px 12px;
    border: none;
    background: transparent;
    cursor: pointer;
    font-size: 0.85rem;
    font-weight: 500;
    color: #374151;
    border-radius: 6px;
    transition: background-color 0.15s ease;
    white-space: nowrap;
    text-align: left;
  }

  .overflow-item:hover,
  .overflow-item:focus-visible {
    background-color: #f3f4f6;
    outline: none;
  }

  html.dark-mode .overflow-item {
    color: #d1d5db;
  }

  html.dark-mode .overflow-item:hover,
  html.dark-mode .overflow-item:focus-visible {
    background-color: #333333;
    outline: none;
  }

  .overflow-icon {
    font-size: 1rem;
    line-height: 1;
  }

  /* Keyboard focus ring on the trigger — only for keyboard navigation */
  .overflow-trigger:focus-visible {
    outline: 2px solid #6366f1;
    outline-offset: 2px;
  }

  html.dark-mode .overflow-trigger:focus-visible {
    outline-color: #818cf8;
  }

  /* ========================================
     §17  NOTES SECTION & NOTE INPUT
     ======================================== */

  /* --- Notes Textarea — hidden by default --- */
  .notes-section {
    display: none;
    width: 100%;
    margin-top: 8px;
    background: transparent;
    border: none;
    border-radius: 8px;
    padding: 12px;
    animation: noteSlideDown 0.2s ease-out;
  }

  .notes-section.open {
    display: block;
  }

  @keyframes noteSlideDown {
    from {
      opacity: 0;
      transform: translateY(-6px);
    }

    to {
      opacity: 1;
      transform: translateY(0);
    }
  }

  html.dark-mode .notes-section {
    background: #1e1e1e;
    border-color: #333333;
  }

  body.light-mode p.note-text {
    color: #1f2937;
    background-color: transparent;
    border: none;
    padding: 0;
    margin: 0;
  }

  .note-input {
    width: 100%;
    min-height: 80px;
    padding: 12px 14px;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    font-family: "Inter", sans-serif;
    font-size: 0.95rem;
    line-height: 1.5;
    resize: vertical;
    box-sizing: border-box;
    background: #ffffff;
    color: #1f2937;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05) inset;
    transition:
      border-color 0.2s ease,
      box-shadow 0.2s ease;
  }

  .note-input:focus {
    outline: none;
    border-color: #d4a853;
    box-shadow:
      0 0 0 3px rgba(212, 168, 83, 0.15),
      0 1px 2px rgba(0, 0, 0, 0.05) inset;
  }

  html.dark-mode .note-input {
    background: #252525;
    border-color: #333333;
    color: #f0f0f0;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2) inset;
  }

  html.dark-mode .note-input:focus {
    border-color: #d4a853;
    box-shadow:
      0 0 0 3px rgba(212, 168, 83, 0.15),
      0 1px 2px rgba(0, 0, 0, 0.2) inset;
  }

  .action-bar {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 8px;
  }

  .save-note-btn {
    padding: 8px 16px;
    background-color: #1f2937;
    color: #ffffff;
    border: none;
    border-radius: 8px;
    font-family: "Inter", sans-serif;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition:
      background-color 0.2s ease,
      transform 0.15s ease,
      box-shadow 0.2s ease;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
  }

  .save-note-btn:hover {
    background-color: #374151;
    transform: translateY(-1px);
    box-shadow:
      0 4px 6px -1px rgba(0, 0, 0, 0.1),
      0 2px 4px -1px rgba(0, 0, 0, 0.06);
  }

  .save-note-btn:active {
    transform: translateY(0);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
  }

  html.dark-mode .save-note-btn {
    background-color: #e0e0e0;
    color: #1a1a1a;
  }

  html.dark-mode .save-note-btn:hover {
    background-color: #ffffff;
    box-shadow: 0 4px 6px -1px rgba(255, 255, 255, 0.1);
  }

  .save-status {
    color: #16a34a;
    font-size: 0.85em;
    font-weight: 500;
    opacity: 0;
    transition: opacity 0.3s ease;
  }

  /* A class we will toggle with JS to show the saved message */
  .save-status.show {
    opacity: 1;
  }

  html.dark-mode .save-status {
    color: #4ade80;
  }


  /* ========================================
     §18  DEEP-LINK VERSE HIGHLIGHT
     ======================================== */

  /* --- Deep-link Verse Highlight --- */
  .verse-highlight {
    animation: verseHighlightPulse 2.5s ease-out forwards;
    border-radius: 8px;
  }

  @keyframes verseHighlightPulse {
    0% {
      background-color: rgba(253, 224, 71, 0.5);
    }

    70% {
      background-color: rgba(253, 224, 71, 0.25);
    }

    100% {
      background-color: transparent;
    }
  }

  html.dark-mode .verse-highlight {
    animation: verseHighlightPulseDark 2.5s ease-out forwards;
  }

  @keyframes verseHighlightPulseDark {
    0% {
      background-color: rgba(133, 77, 14, 0.5);
    }

    70% {
      background-color: rgba(133, 77, 14, 0.25);
    }

    100% {
      background-color: transparent;
    }
  }

  /* Dark mode styles for color picker wrapper and memorize wrapper */
  html.dark-mode .color-picker-wrapper,
  html.dark-mode .memorize-wrapper,
  html.dark-mode .reference-wrapper {
    background-color: #2a2a2a;
    border-top-color: #404040;
  }

  html.dark-mode .memorize-wrapper label,
  html.dark-mode .reference-wrapper label {
    color: #9ca3af;
  }

  html.dark-mode .apply-highlight-btn {
    background-color: #333333;
    color: #e0e0e0;
  }

  html.dark-mode .apply-highlight-btn:hover {
    background-color: #404040;
    color: #ffffff;
  }

  html.dark-mode .clear-highlight-btn:hover,
  html.dark-mode .clear-memorize-btn:hover {
    background-color: #3a2020;
  }

  /* ========================================
     §19  HIGHLIGHTED TEXT & MEMORY MODE BUTTONS
     ======================================== */

  /* --- Base style for our generated highlights --- */
  .highlighted-text {
    border-radius: 3px;
    padding: 2px 0;
  }

  .first-letter-btn,
  .fill-in-the-blanks-btn,
  .skip-a-word-btn {
    background: transparent;
    border: none;
    cursor: pointer;
    transition: background-color 0.15s ease;
    margin-left: 10px;
    text-align: left;
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    font-size: 0.85rem;
    font-weight: 500;
    color: #374151;
    padding: 4px 8px;
    border-radius: 6px;
  }

  .first-letter-btn:hover,
  .fill-in-the-blanks-btn:hover,
  .skip-a-word-btn:hover {
    background-color: #f3f4f6;
  }

  html.dark-mode .first-letter-btn,
  html.dark-mode .fill-in-the-blanks-btn,
  html.dark-mode .skip-a-word-btn {
    color: #d1d5db;
  }

  html.dark-mode .first-letter-btn:hover,
  html.dark-mode .fill-in-the-blanks-btn:hover,
  html.dark-mode .skip-a-word-btn:hover {
    background-color: #333333;
  }

  /* The visual style when the verse is reduced to first letters */
  .memory-mode .verse {
    color: #a0a0a0;
    font-family: monospace;
    letter-spacing: 1px;
  }

  /* The visual style for verses with missing words */
  .fill-blanks-mode .verse,
  .skip-word-mode .verse {
    color: #888888;
    font-family: monospace;
    letter-spacing: 2px;
  }

  /* ========================================
     §20  CROSS-REFERENCE TAGS
     ======================================== */

  /* --- Styling for the Cross-Reference Tags --- */
  .linked-references-container:not(.hidden),
  .tsk-references-container:not(.hidden) {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px dashed #ecf0f1;
    align-items: center;
  }

  .ref-tag.has-flex {
    display: flex;
    align-items: center;
    gap: 4px;
  }

  .ref-tag-text:hover {
    text-decoration: underline;
  }

  .ref-delete {
    margin-left: 4px;
    color: #ef4444;
    font-weight: bold;
    background: transparent;
    border: none;
    cursor: pointer;
    font-size: 1.1rem;
    line-height: 1;
    transition: color 0.2s;
    padding: 0 4px;
  }

  .ref-delete:hover {
    color: #b91c1c;
  }

  html.dark-mode .ref-delete {
    color: #f87171;
  }

  html.dark-mode .ref-delete:hover {
    color: #ef4444;
  }

  .ref-tag {
    background-color: #e8f4f8;
    color: #2980b9;
    padding: 5px 12px;
    border-radius: 15px;
    font-size: 0.9em;
    font-weight: bold;
    border: 1px solid #bde0f0;
    cursor: pointer;
    transition: background-color 0.2s;
  }

  .ref-tag:hover {
    background-color: #bde0f0;
  }

  html.dark-mode .linked-references-container,
  html.dark-mode .tsk-references-container {
    border-top-color: #404040;
  }

  html.dark-mode .ref-tag {
    background-color: #1e3a5f;
    color: #93c5fd;
    border-color: #3b82f6;
  }

  html.dark-mode .ref-tag:hover {
    background-color: #2563eb;
    color: #ffffff;
  }

  /* ========================================
     §21  VIEW TRANSITIONS
     ======================================== */

  /* =========================================================================
     Modern View Transitions
     ========================================================================= */

  @view-transition {
    navigation: auto;
  }

  /* Persist the navigation component across page loads */
  site-nav {
    display: block;
    min-height: 64px;
    view-transition-name: site-nav;
    position: sticky;
    top: 0;
    z-index: 50;
  }

  /* Base custom animations for the full page fade-and-slide */
  @keyframes fade-in-up {
    from {
      opacity: 0;
      transform: translateY(10px);
    }

    to {
      opacity: 1;
      transform: translateY(0);
    }
  }

  @keyframes fade-out-up {
    from {
      opacity: 1;
      transform: translateY(0);
    }

    to {
      opacity: 0;
      transform: translateY(-10px);
    }
  }

  /* Apply new keyframes to the root view transition */
  ::view-transition-old(root) {
    animation: 200ms cubic-bezier(0.4, 0, 1, 1) both fade-out-up;
  }

  ::view-transition-new(root) {
    animation: 200ms cubic-bezier(0, 0, 0.2, 1) both fade-in-up;
  }

  /* Disable the default fade on site-nav so it just morphs bounds */
  ::view-transition-old(site-nav),
  ::view-transition-new(site-nav) {
    animation: none;
    mix-blend-mode: normal;
  }

  /* ========================================
     §22  CROSS-REFERENCE TOOLTIPS
     ======================================== */

  /* ========================================
     CROSS-REFERENCE TOOLTIPS
     ======================================== */

  .xref-tooltip {
    position: absolute;
    z-index: 1000;
    max-width: 320px;
    width: 280px;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(0, 0, 0, 0.08);
    border-radius: 12px;
    box-shadow:
      0 10px 25px -5px rgba(0, 0, 0, 0.1),
      0 8px 10px -6px rgba(0, 0, 0, 0.1);
    padding: 14px;
    font-family: var(--verse-font-family);
    font-size: 0.95rem;
    line-height: 1.6;
    color: #1f2937;
    opacity: 0;
    transform: translateY(10px) scale(0.95);
    transition:
      opacity 0.2s ease,
      transform 0.2s cubic-bezier(0.16, 1, 0.3, 1),
      visibility 0.2s;
    visibility: hidden;
    pointer-events: none;
  }

  .xref-tooltip.visible {
    opacity: 1;
    visibility: visible;
    transform: translateY(0) scale(1);
    pointer-events: auto;
  }

  .xref-tooltip-header {
    display: block;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #9ca3af;
    margin-bottom: 8px;
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
    padding-bottom: 4px;
  }

  .xref-tooltip-content {
    font-style: italic;
    color: #374151;
  }

  /* Arrow/Caret */
  .xref-tooltip::after {
    content: "";
    position: absolute;
    width: 12px;
    height: 12px;
    background: inherit;
    border: inherit;
    border-left: none;
    border-top: none;
    transform: rotate(45deg);
    bottom: -7px;
    left: 20px;
    z-index: -1;
  }

  /* Dark Mode Tooltip */
  html.dark-mode .xref-tooltip {
    background: rgba(24, 24, 27, 0.95);
    border-color: rgba(255, 255, 255, 0.1);
    color: #e5e7eb;
    box-shadow:
      0 20px 25px -5px rgba(0, 0, 0, 0.3),
      0 10px 10px -5px rgba(0, 0, 0, 0.2);
  }

  html.dark-mode .xref-tooltip-header {
    color: #6b7280;
    border-bottom-color: rgba(255, 255, 255, 0.05);
  }

  html.dark-mode .xref-tooltip-content {
    color: #d1d5db;
  }

  /* ========================================
     §23  DICTIONARY LINKED WORDS & DICT TOOLTIP
     ======================================== */

  /* Styling the words that JavaScript finds */
  .dict-linked-word {
    border-bottom: 2px dotted #c5a059;
    cursor: help;
    color: inherit;
    transition: all 0.2s ease;
    padding: 0 1px;
    /* Suppress the 300 ms double-tap delay on touch devices so the
     pointerup handler fires immediately on the first tap. */
    touch-action: manipulation;
  }

  .dict-linked-word:hover,
  .dict-linked-word:active {
    background-color: rgba(197, 160, 89, 0.1);
    border-bottom-style: solid;
  }

  html.dark-mode .dict-linked-word {
    border-bottom-color: #854d0e;
  }

  html.dark-mode .dict-linked-word:hover,
  html.dark-mode .dict-linked-word:active {
    background-color: rgba(133, 77, 14, 0.2);
  }

  /* The Tooltip styling */
  .dict-tooltip {
    position: absolute;
    z-index: 2000;
    background: rgba(255, 255, 255, 0.98);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border: 1px solid rgba(197, 160, 89, 0.3);
    color: #1f2937;
    padding: 0;
    border-radius: 12px;
    font-size: 0.9rem;
    width: clamp(280px, 40vw, 450px);
    max-width: calc(100vw - 32px);
    box-shadow:
      0 10px 25px -5px rgba(0, 0, 0, 0.1),
      0 8px 10px -6px rgba(0, 0, 0, 0.1);
    pointer-events: auto;
    opacity: 0;
    transform: translateY(5px);
    transition: opacity 0.2s ease, transform 0.2s ease;
    display: none;
    overflow: hidden;
  }

  .dict-tooltip.visible {
    opacity: 1;
    transform: translateY(0);
  }

  .dict-tooltip-header {
    background: #f8f9fa;
    padding: 8px 16px;
    font-weight: 700;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #c5a059;
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
  }

  .dict-tooltip-content {
    padding: 12px 16px;
    line-height: 1.6;
    font-family: var(--verse-font-family);
    color: #4b5563;
  }

  .dict-tooltip-footer {
    margin-top: 0.75rem;
    text-align: right;
  }

  .dict-read-more-link {
    color: #6366f1;
    font-size: 0.75rem;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    transition: color 0.2s ease;
  }

  .dict-read-more-link:hover {
    color: #818cf8;
  }

  .dict-read-more-link svg {
    width: 0.875rem;
    height: 0.875rem;
  }

  /* Dark Mode Tooltip */
  html.dark-mode .dict-tooltip {
    background: rgba(24, 24, 27, 0.98);
    border-color: rgba(133, 77, 14, 0.3);
    color: #e5e7eb;
  }

  html.dark-mode .dict-tooltip-header {
    background: #18181b;
    color: #c5a059;
    border-bottom-color: rgba(255, 255, 255, 0.05);
  }

  html.dark-mode .dict-tooltip-content {
    color: #d1d5db;
  }

  html.dark-mode .dict-read-more-link {
    color: #818cf8;
  }

  html.dark-mode .dict-read-more-link:hover {
    color: #a5b4fc;
  }

  /* A tiny triangle pointing down */
  .dict-tooltip::after {
    content: "";
    position: absolute;
    top: 100%;
    left: 50%;
    margin-left: -6px;
    border-width: 6px;
    border-style: solid;
    border-color: rgba(255, 255, 255, 0.98) transparent transparent transparent;
  }

  html.dark-mode .dict-tooltip::after {
    border-color: rgba(24, 24, 27, 0.98) transparent transparent transparent;
  }

  /* ========================================
   EASTER EGG INDICATORS
   ======================================== */

  .easter-egg-indicator {
    position: absolute;
    bottom: 8px;
    right: 8px;
    width: 32px;
    height: 32px;
    padding: 6px;
    background: white;
    border: 1px solid #e5e7eb;
    border-radius: 50%;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    cursor: pointer;
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    opacity: 0;
    transform: scale(0.5) translateY(10px);
  }

  .easter-egg-indicator.visible {
    opacity: 1;
    transform: scale(1) translateY(0);
  }

  .easter-egg-indicator:hover {
    transform: scale(1.1) translateY(-2px);
    background: #fdf2f2;
    border-color: #fecaca;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
  }

  .easter-egg-indicator svg {
    width: 100%;
    height: 100%;
    stroke: #c5a059;
    fill: none;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
  }

  .easter-egg-indicator:hover svg {
    stroke: #b91c1c;
  }

  html.dark-mode .easter-egg-indicator {
    background: #18181b;
    border-color: #27272a;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.3);
  }

  html.dark-mode .easter-egg-indicator:hover {
    background: #27272a;
  }

  /* Pulse animation for un-clicked eggs */
  @keyframes egg-pulse {
    0% {
      box-shadow: 0 0 0 0 rgba(197, 160, 89, 0.4);
    }

    70% {
      box-shadow: 0 0 0 10px rgba(197, 160, 89, 0);
    }

    100% {
      box-shadow: 0 0 0 0 rgba(197, 160, 89, 0);
    }
  }

  .easter-egg-indicator.visible:not(.clicked) {
    animation: egg-pulse 2s infinite;
  }

  /* ========================================
   EASTER EGG MODAL
   ======================================== */

  /* ========================================
     §25  EASTER EGG MODAL
     ======================================== */

  .ee-modal-overlay {
    position: fixed;
    inset: 0;
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
  }

  .ee-modal-overlay.active {
    opacity: 1;
    visibility: visible;
  }

  .ee-modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(9, 9, 11, 0.85);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
  }

  .ee-modal-content {
    position: relative;
    width: 90%;
    max-width: 800px;
    background: white;
    border-radius: 24px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    overflow: hidden;
    z-index: 10;
    transform: translateY(20px);
    transition: all 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
  }

  .ee-modal-overlay.active .ee-modal-content {
    transform: translateY(0);
  }

  html.dark-mode .ee-modal-content {
    background: #18181b;
    border: 1px solid #27272a;
  }

  .ee-modal-close {
    position: absolute;
    top: 16px;
    right: 16px;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.05);
    border: none;
    font-size: 24px;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #71717a;
    transition: all 0.2s;
    z-index: 20;
  }

  .ee-modal-close:hover {
    background: #f4f4f5;
    color: #18181b;
    transform: rotate(90deg);
  }

  html.dark-mode .ee-modal-close:hover {
    background: #27272a;
    color: white;
  }

  .ee-modal-header {
    padding: 32px 32px 16px;
  }

  .ee-modal-badge {
    display: inline-block;
    padding: 4px 12px;
    background: #fef2f2;
    color: #b91c1c;
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    border-radius: 9999px;
    margin-bottom: 12px;
  }

  html.dark-mode .ee-modal-badge {
    background: #450a0a;
    color: #fca5a5;
  }

  .ee-modal-title {
    font-family: 'Playfair Display', serif;
    font-size: 2rem;
    font-weight: 700;
    color: #09090b;
    margin: 0;
  }

  html.dark-mode .ee-modal-title {
    color: white;
  }

  .ee-modal-subtitle {
    font-size: 0.875rem;
    color: #71717a;
    margin-top: 4px;
  }

  .ee-modal-body {
    padding: 0 32px;
    max-height: 60vh;
    overflow-y: auto;
  }

  .ee-media-container {
    border-radius: 16px;
    overflow: hidden;
    background: #f4f4f5;
    margin-bottom: 24px;
  }

  html.dark-mode .ee-media-container {
    background: #09090b;
  }

  .ee-media-container.video {
    aspect-ratio: 16 / 9;
  }

  .ee-media-container.video iframe {
    width: 100%;
    height: 100%;
  }

  .ee-image-content {
    width: 100%;
    height: auto;
    display: block;
  }

  /* Audio Player Stylings */
  .ee-media-container.audio {
    padding: 40px;
    text-align: center;
    background: linear-gradient(135deg, #18181b, #09090b);
  }

  .ee-audio-player {
    width: 100%;
    margin-top: 24px;
  }

  .ee-audio-visualizer {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    height: 60px;
  }

  .ee-audio-visualizer span {
    width: 4px;
    height: 20%;
    background: #c5a059;
    border-radius: 2px;
    animation: visualize 1s infinite ease-in-out;
  }

  .ee-audio-visualizer span:nth-child(2) {
    animation-delay: 0.2s;
  }

  .ee-audio-visualizer span:nth-child(3) {
    animation-delay: 0.4s;
  }

  .ee-audio-visualizer span:nth-child(4) {
    animation-delay: 0.6s;
  }

  .ee-audio-visualizer span:nth-child(5) {
    animation-delay: 0.8s;
  }

  @keyframes visualize {

    0%,
    100% {
      height: 20%;
    }

    50% {
      height: 100%;
    }
  }

  .ee-modal-footer {
    padding: 16px 32px 32px;
    text-align: center;
  }

  .ee-modal-hint {
    font-size: 0.75rem;
    font-weight: 600;
    color: #c5a059;
    letter-spacing: 0.05em;
    font-style: italic;
  }

  body.modal-open {
    overflow: hidden;
  }

  /* ========================================
     §26  CROSS-REFERENCE AUTOCOMPLETE
     ======================================== */

  /* ── Cross-reference autocomplete ─────────────────────────────────── */
  .ref-autocomplete {
    list-style: none;
    margin: 0;
    padding: 2px;
  }

  .ref-ac-item {
    padding: 5px 10px;
    font-size: 0.75rem;
    font-family: 'Inter', sans-serif;
    color: #374151;
    border-radius: 4px;
    cursor: pointer;
    transition: background-color 0.1s ease;
  }

  .ref-ac-item:hover {
    background-color: #eef2ff;
    color: #4f46e5;
  }

  html.dark-mode .ref-autocomplete {
    background: #1e1e1e;
    border-color: #404040;
  }

  html.dark-mode .ref-ac-item {
    color: #d1d5db;
  }

  html.dark-mode .ref-ac-item:hover {
    background-color: #312e81;
    color: #c7d2fe;
  }

  /* Validation border states */
  .ref-input-ok {
    border-color: #22c55e !important;
    box-shadow: 0 0 0 2px rgba(34, 197, 94, 0.15) !important;
  }

  .ref-input-error {
    border-color: #ef4444 !important;
    box-shadow: 0 0 0 2px rgba(239, 68, 68, 0.15) !important;
  }

  /* ========================================
   INDEX / HOME PAGE SPECIFIC STYLES
   ======================================== */

  /* ========================================
     §36  READER — SEMANTIC DECOUPLING CLASSES
     ======================================== */

  /* =========================================
     READER DECOUPLING — SEMANTIC CLASSES
     ========================================= */

  .hidden {
    display: none !important;
  }

  .chapter-wrapper {
    position: relative;
  }

  .verse-container {
    margin-bottom: 1rem;
    display: block;
    background-color: #f9fafb;
    border-radius: 0.75rem;
    padding: 0.75rem;
    border: 1px solid #e5e7eb;
    transition: box-shadow 0.2s, transform 0.2s;
    overflow: visible;
    position: relative;
    z-index: 1;
  }

  .verse-container::after {
    content: "";
    display: table;
    clear: both;
  }

  .verse-container:hover,
  .verse-container:has(.open) {
    z-index: 30;
  }

  .verse-container:hover {
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    transform: translateY(-2px);
  }

  html.dark-mode .verse-container {
    background-color: #18181b;
    border-color: #27272a;
  }

  .verse-overflow {
    float: right;
    margin-left: 0.75rem;
    margin-top: 0.5rem;
    border: none;
  }

  /* ========================================
     §37  READER — MAIN LAYOUT
     ======================================== */

  /* --- Layout --- */
  .reader-main {
    position: relative;
    max-width: 56rem;
    margin: 0 auto;
    padding: 1rem 1rem;
    min-height: 100vh;
  }

  @media (min-width: 640px) {
    .reader-main {
      padding: 1rem 1.5rem;
    }
  }

  @media (min-width: 768px) {
    .reader-main {
      padding: 2rem 1.5rem;
    }
  }

  /* ========================================
     §38  READER — TOOLBAR
     ======================================== */

  /* --- Toolbar --- */
  .reader-toolbar {
    position: sticky;
    top: 64px;
    z-index: 40;
    background-color: rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-bottom: 1px solid #e5e7eb;
    box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    padding: 0.625rem 1rem;
    margin-bottom: 1rem;
    transition: background-color 0.3s, border-color 0.3s;
  }

  html.dark-mode .reader-toolbar {
    background-color: rgba(9, 9, 11, 0.8);
    border-bottom-color: #1e293b;
  }

  .reader-toolbar-inner {
    max-width: 56rem;
    margin: 0 auto;
    display: flex;
    flex-direction: row;
    gap: 0.75rem;
    align-items: center;
    font-size: 0.875rem;
    flex-wrap: nowrap;
  }

  .reader-toolbar-group {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    white-space: nowrap;
  }

  .reader-toolbar-group.hidden-sm {
    display: none;
  }

  @media (min-width: 640px) {
    .reader-toolbar-group.hidden-sm {
      display: flex;
    }
  }

  .reader-toolbar-group.hidden-md {
    display: none;
  }

  @media (min-width: 768px) {
    .reader-toolbar-group.hidden-md {
      display: flex;
    }
  }

  .reader-toolbar-group.ml-auto {
    margin-left: auto;
    flex-shrink: 0;
  }

  .reader-toolbar-label {
    color: #6b7280;
    font-weight: 500;
  }

  html.dark-mode .reader-toolbar-label {
    color: #9ca3af;
  }

  .reader-toolbar-label.hidden-sm {
    display: none;
  }

  @media (min-width: 640px) {
    .reader-toolbar-label.hidden-sm {
      display: inline;
    }
  }

  /* Icon-only labels for the toolbar */
  .reader-toolbar-icon-label {
    display: flex;
    align-items: center;
    justify-content: center;
    color: #9ca3af;
    cursor: default;
    flex-shrink: 0;
    transition: color 0.15s ease;
    line-height: 1;
  }

  .reader-toolbar-icon-label:hover {
    color: #1D2D44;
  }

  html.dark-mode .reader-toolbar-icon-label {
    color: #64748b;
  }

  html.dark-mode .reader-toolbar-icon-label:hover {
    color: #e2e8f0;
  }

  /* --- Breadcrumb back link --- */
  .reader-breadcrumb {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0.25rem 0.5rem 0.25rem 0.25rem;
    border-radius: 0.375rem;
    font-size: 0.75rem;
    font-weight: 600;
    color: #6b7280;
    text-decoration: none;
    white-space: nowrap;
    flex-shrink: 0;
    transition: color 0.15s ease, background-color 0.15s ease;
  }

  .reader-breadcrumb:hover {
    color: var(--color-indigo-800, #2A3F5C);
    background-color: #f3f4f6;
  }

  .reader-breadcrumb-label {
    display: none;            /* icon-only on mobile */
  }

  @media (min-width: 640px) {
    .reader-breadcrumb-label {
      display: inline;
    }
  }

  html.dark-mode .reader-breadcrumb {
    color: #64748b;
  }

  html.dark-mode .reader-breadcrumb:hover {
    color: #e2e8f0;
    background-color: #1e293b;
  }

  /* Vertical divider between breadcrumb and typography controls */
  .reader-toolbar-divider {
    width: 1px;
    height: 1.25rem;
    background-color: #e5e7eb;
    flex-shrink: 0;
    align-self: center;
  }

  html.dark-mode .reader-toolbar-divider {
    background-color: #334155;
  }

  .reader-select {
    background-color: #f9fafb;
    border: 1px solid #d1d5db;
    border-radius: 0.375rem;
    padding: 0.25rem 0.5rem;
    color: #374151;
    font-size: 0.75rem;
    cursor: pointer;
  }

  .reader-select:focus {
    outline: none;
    box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.5);
  }

  @media (min-width: 640px) {
    .reader-select {
      font-size: 0.875rem;
    }
  }

  html.dark-mode .reader-select {
    background-color: #1e293b;
    border-color: #334155;
    color: #e2e8f0;
  }

  .reader-color-picker {
    height: 1.5rem;
    width: 1.5rem;
    border-radius: 0.25rem;
    cursor: pointer;
    border: none;
    padding: 0;
    background-color: transparent;
  }

  /* ========================================
     §39  READER — READING MODE TOGGLE
     ======================================== */

  /* ── Reading Mode Toggle ─────────────────────────────────────────────── */
  .reading-mode-toggle {
    display: flex;
    background-color: #f1f5f9;
    border-radius: 9999px;
    padding: 2px;
    gap: 0;
    border: 1px solid #e2e8f0;
  }

  html.dark-mode .reading-mode-toggle {
    background-color: #1e293b;
    border-color: #334155;
  }

  .mode-btn {
    border: none;
    background: transparent;
    border-radius: 9999px;
    padding: 0.2rem 0.625rem;
    font-size: 0.7rem;
    font-weight: 600;
    font-family: 'Inter', sans-serif;
    color: #64748b;
    cursor: pointer;
    transition: background-color 0.2s ease, color 0.2s ease, box-shadow 0.2s ease;
    white-space: nowrap;
  }

  @media (min-width: 640px) {
    .mode-btn {
      font-size: 0.75rem;
      padding: 0.25rem 0.75rem;
    }
  }

  .mode-btn.active {
    background-color: #ffffff;
    color: #1D2D44;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12);
  }

  html.dark-mode .mode-btn {
    color: #94a3b8;
  }

  html.dark-mode .mode-btn.active {
    background-color: #334155;
    color: #e2e8f0;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
  }

  /* ══════════════════════════════════════════════════════════════════════════
     MOBILE TYPOGRAPHY FAB + BOTTOM SHEET
     Breakpoint: < 700 px the sticky toolbar is hidden; the Aa FAB + sheet
     take over.  ≥ 700 px the FAB/sheet are hidden.
  ══════════════════════════════════════════════════════════════════════════ */

  /* ── Desktop: hide FAB & sheet ─────────────────────────────────────────── */
  .type-fab,
  .type-sheet-backdrop,
  .type-sheet {
    display: none;
  }

  @media (max-width: 699px) {
    /* Hide the sticky toolbar — no more horizontal overflow on body */
    #reader-toolbar {
      display: none;
    }

    /* ── "Aa" Floating Action Button ──────────────────────────────────────── */
    .type-fab {
      display: flex;
      align-items: center;
      justify-content: center;
      position: fixed;
      bottom: 20px;          /* sits below the TTS bar when active */
      right: 16px;
      z-index: 45;
      width: 44px;
      height: 44px;
      border-radius: 50%;
      border: none;
      background: #1D2D44;
      color: #ffffff;
      box-shadow:
        0 4px 14px rgba(0, 0, 0, 0.22),
        0 1px 3px rgba(0, 0, 0, 0.1);
      cursor: pointer;
      transition:
        transform 0.18s ease,
        box-shadow 0.18s ease,
        background-color 0.18s ease;
      -webkit-tap-highlight-color: transparent;
    }

    .type-fab:hover,
    .type-fab:focus-visible {
      transform: scale(1.08);
      box-shadow:
        0 6px 20px rgba(0, 0, 0, 0.28),
        0 2px 6px rgba(0, 0, 0, 0.12);
    }

    .type-fab:active {
      transform: scale(0.94);
    }

    /* Rotate/tint the FAB when the sheet is open */
    .type-fab[aria-expanded="true"] {
      background: #C5A059;
    }

    .type-fab-label {
      font-family: 'Inter', sans-serif;
      font-size: 0.875rem;
      font-weight: 700;
      letter-spacing: -0.02em;
      line-height: 1;
      user-select: none;
    }

    html.dark-mode .type-fab {
      background: #C5A059;
      color: #09090b;
      box-shadow:
        0 4px 14px rgba(0, 0, 0, 0.45),
        0 1px 3px rgba(0, 0, 0, 0.2);
    }

    html.dark-mode .type-fab[aria-expanded="true"] {
      background: #d4b475;
    }

    /* ── Backdrop ──────────────────────────────────────────────────────────── */
    .type-sheet-backdrop {
      display: block;
      position: fixed;
      inset: 0;
      z-index: 48;
      background: rgba(0, 0, 0, 0);
      pointer-events: none;
      transition: background 0.28s ease;
    }

    .type-sheet-backdrop.open {
      background: rgba(0, 0, 0, 0.45);
      pointer-events: auto;
    }

    /* ── Bottom Sheet ──────────────────────────────────────────────────────── */
    .type-sheet {
      display: block;
      position: fixed;
      bottom: 0;
      left: 0;
      right: 0;
      z-index: 49;
      background: #ffffff;
      border-radius: 20px 20px 0 0;
      box-shadow: 0 -4px 32px rgba(0, 0, 0, 0.15);
      transform: translateY(100%);
      transition: transform 0.32s cubic-bezier(0.32, 0.72, 0, 1);
      padding-bottom: env(safe-area-inset-bottom, 0px);
      will-change: transform;
    }

    .type-sheet.open {
      transform: translateY(0);
    }

    html.dark-mode .type-sheet {
      background: #18181b;
      box-shadow: 0 -4px 32px rgba(0, 0, 0, 0.5);
    }

    /* ── Drag Handle ────────────────────────────────────────────────────────── */
    .type-sheet-handle {
      width: 36px;
      height: 4px;
      border-radius: 2px;
      background: #d1d5db;
      margin: 12px auto 0;
    }

    html.dark-mode .type-sheet-handle {
      background: #3f3f46;
    }

    /* ── Sheet Header ───────────────────────────────────────────────────────── */
    .type-sheet-header {
      display: flex;
      align-items: center;
      justify-content: space-between;
      padding: 12px 20px 8px;
      border-bottom: 1px solid #f3f4f6;
    }

    html.dark-mode .type-sheet-header {
      border-bottom-color: #27272a;
    }

    .type-sheet-title {
      font-family: 'Inter', sans-serif;
      font-size: 0.95rem;
      font-weight: 700;
      color: #111827;
      letter-spacing: -0.01em;
    }

    html.dark-mode .type-sheet-title {
      color: #f4f4f5;
    }

    .type-sheet-close {
      display: flex;
      align-items: center;
      justify-content: center;
      width: 32px;
      height: 32px;
      border: none;
      background: #f3f4f6;
      color: #6b7280;
      border-radius: 50%;
      cursor: pointer;
      transition: background 0.15s ease, color 0.15s ease;
      padding: 0;
    }

    .type-sheet-close:hover {
      background: #e5e7eb;
      color: #374151;
    }

    html.dark-mode .type-sheet-close {
      background: #27272a;
      color: #9ca3af;
    }

    html.dark-mode .type-sheet-close:hover {
      background: #3f3f46;
      color: #e4e4e7;
    }

    /* ── Sheet Body ─────────────────────────────────────────────────────────── */
    .type-sheet-body {
      padding: 8px 0 16px;
    }

    /* ── Rows ──────────────────────────────────────────────────────────────── */
    .type-sheet-row {
      display: flex;
      align-items: center;
      justify-content: space-between;
      padding: 13px 20px;
      border-bottom: 1px solid #f9fafb;
      gap: 12px;
    }

    .type-sheet-row:last-child {
      border-bottom: none;
    }

    html.dark-mode .type-sheet-row {
      border-bottom-color: #27272a;
    }

    .type-sheet-label {
      display: flex;
      align-items: center;
      gap: 8px;
      font-family: 'Inter', sans-serif;
      font-size: 0.875rem;
      font-weight: 500;
      color: #374151;
      white-space: nowrap;
      flex-shrink: 0;
    }

    html.dark-mode .type-sheet-label {
      color: #d1d5db;
    }

    .type-sheet-label svg {
      color: #9ca3af;
      flex-shrink: 0;
    }

    html.dark-mode .type-sheet-label svg {
      color: #6b7280;
    }

    /* ── Sheet Selects ──────────────────────────────────────────────────────── */
    .type-sheet-select {
      flex: 1;
      min-width: 0;
      background: #f9fafb;
      border: 1px solid #e5e7eb;
      border-radius: 8px;
      padding: 8px 10px;
      font-family: 'Inter', sans-serif;
      font-size: 0.875rem;
      color: #111827;
      cursor: pointer;
      outline: none;
      appearance: auto;
      -webkit-appearance: auto;
      transition: border-color 0.15s ease, box-shadow 0.15s ease;
    }

    .type-sheet-select:focus {
      border-color: #C5A059;
      box-shadow: 0 0 0 3px rgba(197, 160, 89, 0.15);
    }

    html.dark-mode .type-sheet-select {
      background: #27272a;
      border-color: #3f3f46;
      color: #f4f4f5;
    }

    html.dark-mode .type-sheet-select:focus {
      border-color: #C5A059;
    }

    /* ── Color Picker ───────────────────────────────────────────────────────── */
    .type-sheet-color {
      width: 36px;
      height: 36px;
      border: 2px solid #e5e7eb;
      border-radius: 50%;
      background: transparent;
      padding: 0;
      cursor: pointer;
      overflow: hidden;
      flex-shrink: 0;
    }

    .type-sheet-color::-webkit-color-swatch-wrapper { padding: 0; }
    .type-sheet-color::-webkit-color-swatch { border: none; border-radius: 50%; }

    html.dark-mode .type-sheet-color {
      border-color: #3f3f46;
    }

    /* ── Mode Toggle Row ──────────────────────────────────────────────────── */
    .type-sheet-row--mode {
      align-items: center;
    }

    .sheet-mode-toggle {
      flex: 1;
      justify-content: flex-end;
    }
  }

  /* ========================================
     §41  READER — READING MODE PROSE LAYOUT
     ======================================== */

  /* ── Reading Mode Prose Layout ─────────────────────────────────────────── */
  .reading-prose-block {
    font-family: var(--verse-font-family);
    font-size: var(--verse-font-size);
    color: var(--verse-text-color);
    line-height: var(--verse-line-height);
    letter-spacing: var(--verse-letter-spacing);
    text-align: justify;
    hyphens: auto;
    margin: 0 0 2rem 0;
  }

  /* Traditional KJV superscript verse numbers in reading mode */
  .reading-prose-block .verse-number-sup {
    font-size: 0.6em;
    font-weight: 700;
    vertical-align: super;
    line-height: 0;
    color: #C5A059;
    margin-right: 0.1em;
    margin-left: 0.35em;
    font-family: 'Inter', sans-serif;
    letter-spacing: normal;
  }

  /* First verse number in each prose block has no leading margin */
  .reading-prose-block .verse-number-sup:first-child {
    margin-left: 0;
  }

  .reading-mode-chapter .reading-chapter-heading {
    border-bottom: 1px solid rgba(0, 0, 0, 0.08);
    margin-bottom: 1.5rem;
  }

  html.dark-mode .reading-mode-chapter .reading-chapter-heading {
    border-bottom-color: rgba(255, 255, 255, 0.08);
  }


  /* ========================================
     §42  READER — TTS BAR
     ======================================== */

  /* --- TTS Bar --- */
  .tts-bar {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 50;
    transform: translateY(100%);
    opacity: 0;
    pointer-events: none;
    transition: all 0.3s ease-in-out;
  }

  @media (max-width: 699px) {
    .tts-bar {
      bottom: 70px; /* sits above the typography FAB */
    }
  }

  .tts-bar.active {
    transform: translateY(0);
    opacity: 1;
    pointer-events: auto;
  }

  .tts-bar-inner {
    max-width: 56rem;
    margin: 0 auto;
    padding: 1rem 1rem 1.5rem;
  }

  @media (min-width: 640px) {
    .tts-bar-inner {
      padding-left: 1.5rem;
      padding-right: 1.5rem;
    }
  }

  .tts-panel {
    background-color: rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    border: 1px solid #e5e7eb;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    border-radius: 1rem;
    padding: 1rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
  }

  @media (min-width: 640px) {
    .tts-panel {
      flex-direction: row;
    }
  }

  html.dark-mode .tts-panel {
    background-color: rgba(15, 23, 42, 0.8);
    border-color: #334155;
  }

  .tts-controls {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex: 1;
    width: 100%;
    justify-content: space-between;
  }

  @media (min-width: 640px) {
    .tts-controls {
      width: auto;
      justify-content: flex-start;
    }
  }

  .tts-btn-play {
    width: 2.5rem;
    height: 2.5rem;
    border-radius: 9999px;
    background-color: var(--color-indigo-600, #4f46e5);
    color: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.2s;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    flex-shrink: 0;
    border: none;
    cursor: pointer;
  }

  .tts-btn-play:hover {
    background-color: var(--color-indigo-700, #4338ca);
  }

  .tts-btn-stop {
    width: 2.5rem;
    height: 2.5rem;
    border-radius: 9999px;
    background-color: #fee2e2;
    color: #dc2626;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.2s;
    flex-shrink: 0;
    border: none;
    cursor: pointer;
  }

  .tts-btn-stop:hover {
    background-color: #fecaca;
  }

  .tts-settings {
    display: flex;
    align-items: center;
    gap: 1rem;
    width: 100%;
  }

  @media (min-width: 640px) {
    .tts-settings {
      width: auto;
    }
  }

  .tts-select {
    flex: 1;
    background-color: #f9fafb;
    border: 1px solid #d1d5db;
    border-radius: 0.375rem;
    padding: 0.375rem 0.5rem;
    font-size: 0.875rem;
    color: #374151;
    cursor: pointer;
    text-overflow: ellipsis;
    overflow: hidden;
    white-space: nowrap;
  }

  @media (min-width: 640px) {
    .tts-select {
      width: 12rem;
      flex: none;
    }
  }

  html.dark-mode .tts-select {
    background-color: #1e293b;
    border-color: #475569;
    color: #e2e8f0;
  }

  .tts-rate-group {
    display: none;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.875rem;
    color: #4b5563;
    white-space: nowrap;
  }

  @media (min-width: 640px) {
    .tts-rate-group {
      display: flex;
    }
  }

  html.dark-mode .tts-rate-group {
    color: #d1d5db;
  }

  .tts-rate-input {
    width: 5rem;
    cursor: pointer;
    accent-color: var(--color-indigo-600, #4f46e5);
  }

  .tts-rate-display {
    width: 2rem;
    text-align: right;
    font-weight: 500;
  }

  .tts-btn-close {
    padding: 0.5rem;
    color: #9ca3af;
    border-radius: 9999px;
    transition: all 0.2s;
    background: transparent;
    border: none;
    cursor: pointer;
  }

  .tts-btn-close:hover {
    color: #4b5563;
    background-color: #f3f4f6;
  }

  html.dark-mode .tts-btn-close:hover {
    color: #e2e8f0;
    background-color: #1e293b;
  }

  /* ========================================
     §43  READER — CHAPTER WRAP & SKELETON LOADER
     ======================================== */

  /* --- Reader Chapter Wrapper (opacity target for fade-in) --- */
  #reader-chapter-wrap {
    opacity: 0;
    transition: opacity 0.5s ease-in-out;
  }

  #reader-chapter-wrap.is-visible {
    opacity: 1;
  }

  /* --- Reader Skeleton (shimmer placeholders) --- */
  .reader-skeleton {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    z-index: 10;
    transition: opacity 0.35s ease-out;
    pointer-events: auto;
    user-select: none;
    cursor: progress;
  }

  .reader-skeleton:hover .skeleton-bar {
    animation-duration: 0.8s;
    filter: brightness(0.95);
  }

  html.dark-mode .reader-skeleton:hover .skeleton-bar {
    filter: brightness(1.2);
  }

  .reader-skeleton.is-hidden {
    opacity: 0;
    pointer-events: none;
  }

  /* Shimmer keyframe: sweeps a highlight left→right */
  @keyframes skeleton-shimmer {
    0% {
      background-position: -600px 0;
    }

    100% {
      background-position: 600px 0;
    }
  }

  /* Base skeleton bar — all shimmer elements inherit from this */
  .skeleton-bar {
    border-radius: 6px;
    background-color: #e5e7eb;
    background-image: linear-gradient(90deg,
        #e5e7eb 0px,
        #f3f4f6 200px,
        #e5e7eb 400px);
    background-size: 600px 100%;
    animation: skeleton-shimmer 1.4s ease-in-out infinite;
  }

  html.dark-mode .skeleton-bar {
    background-color: #27272a;
    background-image: linear-gradient(90deg,
        #27272a 0px,
        #3f3f46 200px,
        #27272a 400px);
  }

  /* Chapter number pill */
  .skeleton-chapter-label {
    width: 6rem;
    height: 1.25rem;
    margin-bottom: 1.25rem;
  }

  /* A fake verse block */
  .skeleton-verse {
    background-color: #f9fafb;
    border: 1px solid #e5e7eb;
    border-radius: 0.75rem;
    padding: 0.875rem 1rem;
    margin-bottom: 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
  }

  html.dark-mode .skeleton-verse {
    background-color: #18181b;
    border-color: #27272a;
  }

  /* Verse number badge */
  .skeleton-verse-num {
    width: 1.5rem;
    height: 1rem;
    border-radius: 4px;
  }

  /* Text lines inside verse */
  .skeleton-line-full {
    width: 100%;
    height: 0.875rem;
  }

  .skeleton-line-80 {
    width: 80%;
    height: 0.875rem;
  }

  .skeleton-line-65 {
    width: 65%;
    height: 0.875rem;
  }

  .skeleton-line-90 {
    width: 90%;
    height: 0.875rem;
  }

  .skeleton-line-50 {
    width: 50%;
    height: 0.875rem;
  }

  /* Stagger the shimmer offset so bars don't pulse in sync */
  .skeleton-verse:nth-child(2) .skeleton-bar {
    animation-delay: 0.1s;
  }

  .skeleton-verse:nth-child(3) .skeleton-bar {
    animation-delay: 0.2s;
  }

  .skeleton-verse:nth-child(4) .skeleton-bar {
    animation-delay: 0.3s;
  }

  .skeleton-verse:nth-child(5) .skeleton-bar {
    animation-delay: 0.4s;
  }

  /* ========================================
     §44  READER — DYNAMIC ELEMENTS (LOADING, SENTINEL, ERROR)
     ======================================== */

  /* --- Reader Dynamic Elements --- */
  .reader-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 5rem 0;
  }

  .reader-loading svg {
    width: 2.5rem;
    height: 2.5rem;
    margin-bottom: 1rem;
    color: #9ca3af;
    animation: reader-spin 1s linear infinite;
  }

  @keyframes reader-spin {
    from {
      transform: rotate(0deg);
    }

    to {
      transform: rotate(360deg);
    }
  }

  .reader-loading p {
    color: #6b7280;
    font-weight: 500;
  }

  .reader-sentinel {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 4rem 0;
  }

  .reader-sentinel svg {
    margin-bottom: 0.75rem;
    color: #9ca3af;
  }

  .reader-sentinel-spin {
    width: 2rem;
    height: 2rem;
    margin-bottom: 0.75rem;
    color: #9ca3af;
    animation: reader-spin 1s linear infinite;
  }

  .reader-sentinel-track {
    opacity: 0.25;
  }

  .reader-sentinel-head {
    opacity: 0.75;
  }

  .reader-sentinel p {
    color: #9ca3af;
    font-size: 0.875rem;
    font-weight: 500;
  }

  .reader-error {
    padding: 1.5rem;
    background-color: #fef2f2;
    color: #dc2626;
    border-radius: 0.75rem;
    text-align: center;
    border: 1px solid #fecaca;
    box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    margin-top: 2.5rem;
  }

  html.dark-mode .reader-error {
    background-color: #450a0a;
    border-color: #7f1d1d;
    color: #fca5a5;
  }

  .reader-error svg {
    margin: 0 auto 0.75rem;
    color: #f87171;
  }

  .reader-error h3 {
    font-size: 1.125rem;
    font-weight: 500;
    color: #991b1b;
    margin-bottom: 0.5rem;
  }

  html.dark-mode .reader-error h3 {
    color: #fecaca;
  }

  .reader-error p {
    margin-bottom: 1rem;
  }

  .reader-error-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1.25rem;
    border-radius: 0.375rem;
    background-color: #dc2626;
    color: #ffffff;
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    border: none;
    transition: background-color 0.2s;
    box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  }

  .reader-error-btn:hover {
    background-color: #b91c1c;
  }

  /* ========================================
     §45  READER — BOOK HEADER & TITLE
     ======================================== */

  .reader-book-header {
    text-align: center;
    margin-bottom: 4rem;
    position: relative;
  }

  .reader-book-title {
    font-size: 2.25rem;
    font-weight: 700;
    color: var(--verse-text-color);
    margin-bottom: 1.5rem;
    letter-spacing: -0.025em;
  }

  @media (min-width: 768px) {
    .reader-book-title {
      font-size: 3.75rem;
    }
  }

  /* ========================================
     §46  READER — READING PROGRESS PILL
     ======================================== */

  /* --- Book-page Reading Progress Pill --- */
  .reader-progress-pill {
    display: inline-grid;
    grid-template-columns: 4.5rem auto;
    align-items: center;
    gap: 0.625rem;
    margin: 0 auto 0.5rem;
    padding: 0.375rem 0.875rem 0.375rem 0.75rem;
    border-radius: 9999px;
    background-color: rgba(255, 255, 255, 0.75);
    border: 1px solid rgba(197, 160, 89, 0.3);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.07);
    animation: pill-fade-in 0.4s ease both;
  }

  @keyframes pill-fade-in {
    from { opacity: 0; transform: translateY(6px); }
    to   { opacity: 1; transform: translateY(0);   }
  }

  /* Track — the grey rail */
  .reader-progress-pill::before {
    content: '';
    grid-column: 1;
    grid-row: 1;
    display: block;
    width: 100%;
    height: 0.375rem;
    border-radius: 9999px;
    background-color: #e5e7eb;
  }

  /* Fill bar — sits in the same grid cell as track */
  .reader-progress-fill-bar {
    grid-column: 1;
    grid-row: 1;
    display: block;
    height: 0.375rem;
    border-radius: 9999px;
    background: linear-gradient(90deg, #c5a059, #d4b475);
    min-width: 2px;
    transition: width 0.6s cubic-bezier(0.16, 1, 0.3, 1);
    box-shadow: 0 0 6px rgba(197, 160, 89, 0.4);
    z-index: 1;
  }

  .reader-progress-label-text {
    grid-column: 2;
    grid-row: 1;
    font-family: 'Inter', system-ui, sans-serif;
    font-size: 0.6875rem;
    font-weight: 600;
    color: #6b7280;
    letter-spacing: 0.01em;
    white-space: nowrap;
  }

  html.dark-mode .reader-progress-pill {
    background-color: rgba(30, 41, 59, 0.75);
    border-color: rgba(197, 160, 89, 0.25);
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.3);
  }

  html.dark-mode .reader-progress-pill::before {
    background-color: #334155;
  }

  html.dark-mode .reader-progress-label-text {
    color: #94a3b8;
  }

  /* ========================================
     §47  READER — SAVE INDICATOR
     ======================================== */

  .reader-save-indicator {
    position: fixed;
    bottom: 6rem;
    left: 50%;
    transform: translateX(-50%) translateY(10px);
    background-color: rgba(15, 23, 42, 0.9);
    color: #ffffff;
    padding: 0.5rem 1rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 700;
    transition: all 0.3s;
    opacity: 0;
    pointer-events: none;
    z-index: 100;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.1);
  }

  /* ========================================
     §48  READER — VERSE TEMPLATE OVERRIDES
     ======================================== */

  /* --- Verse Template Overrides --- */
  p.verse {
    display: block;
    cursor: text;
    color: var(--verse-text-color);
  }

  p.verse:hover {
    /* Hover handled by .verse-container */
  }

  .verse-number-sup {
    font-size: 0.875rem;
    font-weight: 700;
    color: #9ca3af;
    margin-right: 0.75rem;
    user-select: none;
  }

  .verse-menu-panel {
    padding: 0.5rem;
    margin-top: 0.25rem;
    border-top: 1px solid #f3f4f6;
    background-color: #f9fafb;
    border-radius: 0.375rem;
    cursor: default;
  }

  html.dark-mode .verse-menu-panel {
    background-color: #1e293b;
    border-top-color: #334155;
  }

  .verse-menu-label {
    font-size: 0.75rem;
    color: #6b7280;
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
  }

  html.dark-mode .verse-menu-label {
    color: #9ca3af;
  }

  .color-swatch-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    margin-bottom: 0.75rem;
  }

  .panel-action-btn {
    font-size: 0.75rem;
    font-weight: 500;
    width: 100%;
    text-align: center;
    padding: 0.375rem 0.25rem;
    border-radius: 0.25rem;
    transition: background-color 0.2s, color 0.2s;
    background: transparent;
    border: none;
    cursor: pointer;
  }

  .panel-action-btn.danger {
    color: #ef4444;
  }

  .panel-action-btn.danger:hover {
    color: #b91c1c;
    background-color: #fef2f2;
  }

  html.dark-mode .panel-action-btn.danger:hover {
    background-color: #450a0a;
    color: #fca5a5;
  }

  .panel-input-group {
    position: relative;
  }

  .panel-input {
    width: 100%;
    padding: 0.5rem;
    border: 1px solid #d1d5db;
    border-radius: 0.375rem;
    font-size: 0.75rem;
    color: #1f2937;
    background-color: #ffffff;
  }

  .panel-input::placeholder {
    color: #9ca3af;
  }

  html.dark-mode .panel-input {
    background-color: #334155;
    border-color: #475569;
    color: #f3f4f6;
  }

  .panel-autocomplete {
    position: absolute;
    left: 0;
    right: 0;
    top: 100%;
    margin-top: 0.125rem;
    z-index: 30;
    background-color: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 0.375rem;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
    max-height: 9rem;
    overflow-y: auto;
  }

  html.dark-mode .panel-autocomplete {
    background-color: #1e293b;
    border-color: #334155;
  }

  .panel-error {
    font-size: 0.75rem;
    color: #ef4444;
    margin-top: 0.25rem;
    font-weight: 500;
  }

  /* ========================================
     §49  READER — MEMORIZE & MEMORY BUTTONS
     ======================================== */

  .memorize-btn-group {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.5rem;
    margin-bottom: 0.75rem;
  }

  .memory-quick-toggle-bar {
    display: none;
    justify-content: flex-end;
    margin-top: 0.25rem;
    margin-bottom: 0.5rem;
    padding-right: 0.5rem;
  }

  .memory-quick-toggle-bar.active {
    display: flex;
    gap: 0.5rem;
  }

  .memory-quick-toggle-btn {
    font-size: 0.75rem;
    padding: 0.25rem 0.625rem;
    background-color: #f3f4f6;
    color: #4b5563;
    border-radius: 0.25rem;
    display: flex;
    align-items: center;
    gap: 0.375rem;
    transition: background-color 0.2s;
    border: 1px solid #e5e7eb;
    cursor: pointer;
  }

  .memory-quick-toggle-btn:hover {
    background-color: #e5e7eb;
  }

  html.dark-mode .memory-quick-toggle-btn {
    background-color: #334155;
    color: #cbd5e1;
    border-color: #475569;
  }

  html.dark-mode .memory-quick-toggle-btn:hover {
    background-color: #475569;
  }

  .memory-indicator {
    width: 0.5rem;
    height: 0.5rem;
    border-radius: 9999px;
    background-color: #22c55e;
  }

  /* ========================================
     §50  READER — NOTE DISPLAY & NOTES SECTION
     ======================================== */

  .note-display-wrapper {
    display: flex;
    align-items: flex-start;
    gap: 0.5rem;
    padding-top: 0.5rem;
    padding-bottom: 0.25rem;
  }

  .note-icon {
    color: #9ca3af;
    margin-top: 0.125rem;
  }

  .note-content {
    font-family: sans-serif;
    color: #374151;
    font-size: 0.875rem;
    line-height: 1.625;
    white-space: pre-wrap;
    flex: 1;
  }

  html.dark-mode .note-content {
    color: #d1d5db;
  }

  .note-actions {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-left: auto;
  }

  .note-action-btn {
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    background: transparent;
    border: none;
    padding: 0;
  }

  .note-action-btn.edit {
    color: #6b7280;
  }

  .note-action-btn.edit:hover {
    color: #1f2937;
  }

  html.dark-mode .note-action-btn.edit {
    color: #9ca3af;
  }

  html.dark-mode .note-action-btn.edit:hover {
    color: #f3f4f6;
  }

  .note-action-btn.delete {
    color: #f87171;
  }

  .note-action-btn.delete:hover {
    color: #b91c1c;
  }

  .note-action-btn.cancel {
    color: #6b7280;
  }

  .note-action-btn.cancel:hover {
    color: #1f2937;
  }

  .notes-section:not(.open) {
    display: none;
  }

  .notes-section {
    clear: both;
    margin-top: 0.5rem;
    padding-top: 0.5rem;
    border-top: 1px dashed #e5e7eb;
  }

  html.dark-mode .notes-section {
    border-top-color: #374151;
  }

  .note-editor {
    margin-top: 0.5rem;
  }

  .note-input {
    width: 100%;
    padding: 0.5rem;
    border: 1px solid #e5e7eb;
    border-radius: 0.25rem;
    font-size: 0.875rem;
    color: #374151;
    background-color: #f9fafb;
    resize: vertical;
    min-height: 60px;
    font-family: var(--font-sans, system-ui, sans-serif);
    line-height: 1.625;
    box-sizing: border-box;
  }

  .note-input:focus {
    outline: none;
    box-shadow: 0 0 0 1px #d1d5db;
  }

  html.dark-mode .note-input {
    background-color: #374151;
    border-color: #4b5563;
    color: #f3f4f6;
  }

  html.dark-mode .note-input:focus {
    box-shadow: 0 0 0 1px #6b7280;
  }

  .action-bar {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-top: 0.5rem;
  }

  /* ========================================
     §52  READER — SENTINEL / LOADING SPINNER (SECOND DEFINITION)
     ======================================== */

  /* --- Reader Sentinel / Loading Spinner --- */
  .reader-sentinel {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 3rem 0;
    gap: 0.75rem;
    color: #64748b;
    font-size: 0.875rem;
  }

  .dark-mode .reader-sentinel {
    color: #94a3b8;
  }

  .reader-sentinel-spin {
    width: 2rem;
    height: 2rem;
    animation: spin 1s linear infinite;
    color: var(--color-gold-500);
  }

  .reader-sentinel-track {
    opacity: 0.2;
  }

  .reader-sentinel-head {
    opacity: 0.8;
  }

