body {
  font-family: sans-serif;
  font-size: 16px;
  line-height: 1.6;
  margin: 0;
  padding: 0 1rem;
  background-color: #edf2f7; /* Light blue background */
  color: #2c3e50; /* Dark slate text */
}

/* Demo: hide tenant name for white-labeled appearance */
.tenant-name {
  display: none !important;
}

/* Header layout for white-label demo - full-width blue bar */
.site-header {
  width: 100%;
  background: #2f4f90;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 24px;
  box-sizing: border-box;
}

.tenant-logo {
  height: 48px;
}

.site-header-return {
  font-size: 14px;
  opacity: 0.9;
}

/* Additional Supporting References — upgraded UI */
.reference-grid {
  list-style: none;
  padding-left: 0;
  margin-top: 6px;
  display: flex;
  flex-wrap: wrap;
  gap: 10px 12px;
}

/* Each item becomes more "card-like" */
.reference-grid li {
  margin: 0;
}

/* Pill / chip style */
.reference-grid a {
  display: block;
  padding: 8px 12px;
  background-color: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  color: #1e40af;
  text-decoration: none;
  font-size: 0.92rem;
  font-weight: 500;
  line-height: 1.3;

  transition: all 0.15s ease;
}

/* Hover = feels clickable */
.reference-grid a:hover,
.reference-grid a:focus {
  background-color: #eff6ff;
  border-color: #bfdbfe;
  color: #1d4ed8;
  transform: translateY(-1px);
  box-shadow: 0 2px 6px rgba(0,0,0,0.05);
  outline: none;
}

/* Better mobile spacing */
@media (max-width: 640px) {
  .reference-grid {
    gap: 8px 10px;
  }
}

.reference-group {
  margin-top: 10px;
}

.reference-group-title {
  font-size: 0.8rem;
  font-weight: 600;
  color: #475569;
  margin-bottom: 4px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

/* Quiz CTA Styling */
.quiz-cta {
  position: sticky;
  bottom: 0;
  inset-inline: 0;
  z-index: 50;
  background: rgba(15, 23, 42, 0.92); /* slate-900-ish */
  backdrop-filter: saturate(140%) blur(8px);
  border-top: 1px solid rgba(255,255,255,.08);
  padding: 10px env(safe-area-inset-right) calc(10px + env(safe-area-inset-bottom)) env(safe-area-inset-left);
  transform: translateY(100%);
  transition: transform .25s ease;
}
.quiz-cta.show { transform: translateY(0); }
.quiz-cta.hidden { display: none; } /* initial state until we confirm a quiz exists */

.quiz-cta__inner {
  max-width: 880px;
  margin: 0 auto;
  display: flex; gap: 12px; align-items: center; justify-content: space-between;
}
.quiz-cta__text { color: #e5e7eb; font-size: 14px; }
.quiz-cta__btn {
  appearance: none; cursor: pointer;
  border: 1px solid rgba(255,255,255,.15);
  background: #1f2937; color: #fff;
  padding: 10px 14px; border-radius: 10px; font-weight: 600;
}
.quiz-cta__btn:hover { background: #273449; }

/* Scoped under .study-view - see study view section below */

main {
  max-width: 800px;
  margin: auto;
  padding: 2rem 1rem;
  background-color: #ffffff;
  border-radius: 8px;
  box-shadow: 0 0 10px rgba(0, 0, 0, 0.05);
}

.section {
  margin-bottom: 2rem;
}

label {
  font-weight: bold;
}

select,
input[type="text"],
button:not(.ask-in-chat) {
  width: 100%;
  padding: 0.5rem;
  margin-top: 0.5rem;
  margin-bottom: 1.25rem;
  border-radius: 4px;
  border: 1px solid #ccc;
  font-size: 1rem;
}

button:not(.ask-in-chat) {
  background-color: #2b6cb0; /* Deep blue */
  color: white;
  border: none;
  cursor: pointer;
}

/* Force ask-in-chat buttons to always be inline — overrides all global button rules */
button.ask-in-chat {
  display: inline !important;
  width: auto !important;
  padding: 0 !important;
  margin: 0 !important;
  background: none !important;
  border: none !important;
  box-shadow: none !important;
  border-radius: 0 !important;
  font: inherit !important;
  color: #2f5fb3;
  cursor: pointer;
  text-align: left;
}

button:hover,
button:focus {
  background-color: #234e84; /* Darker blue hover */
}

#thinking {
  font-style: italic;
  margin-top: 0.5rem;
}

#answerBox {
  margin-top: 1rem;
  background-color: #f0f4ff; /* Soft blue background */
  padding: 1rem;
  border-left: 4px solid #2b6cb0;
  border-radius: 4px;
}

.suggested-questions h4 {
  margin-bottom: 0.5rem;
}

.suggested-questions ul {
  padding-left: 1.5rem;
}

.markdown-body {
  padding-top: 1rem;
}

.follow-up {
  background-color: #fffdf5;
  border-left: 3px solid #f4d35e; /* Soft gold */
  padding: 0.75rem 1rem;
  margin-top: 1.5rem;
  border-radius: 4px;
  font-size: 0.95rem;
  color: #2c3e50;
}

.follow-up a button {
  margin-top: 0.25rem;
  font-size: 0.85rem;
  padding: 0.4rem 0.75rem;
}
@media (max-width: 600px) {
  .responsive-table {
    width: 100vw;               /* Use full screen width */
    margin-left: -1rem;         /* Counteracts body padding */
    margin-right: -1rem;
    overflow-x: hidden;         /* Prevent unwanted scrolling */
  }

  .responsive-table table {
    width: 100%;
    table-layout: fixed;
    border-collapse: collapse;
  }

  .responsive-table th,
  .responsive-table td {
    font-size: 14px;            /* Smaller text for mobile */
    padding: 0.4rem;
    white-space: normal;        /* Allow wrapping */
    word-break: break-word;     /* Wrap long words if needed */
  }
}

/* Quiz Styles */
.quiz {
  background-color: #f8f9fa;
  border: 1px solid #dee2e6;
  border-radius: 8px;
  padding: 2rem;
  margin: 2rem 0;
}

.quiz h2 {
  color: #2b6cb0;
  margin-bottom: 1.5rem;
  text-align: center;
}

.quiz form div {
  margin-bottom: 1.5rem;
}

.quiz label {
  display: block;
  font-weight: 600;
  margin-bottom: 0.5rem;
  color: #2c3e50;
}

.quiz input[type="radio"] {
  width: auto;
  margin-right: 0.5rem;
}

.quiz input[type="text"] {
  width: 100%;
  padding: 0.75rem;
  border: 1px solid #ced4da;
  border-radius: 4px;
  font-size: 1rem;
}

.quiz button {
  background-color: #28a745;
  color: white;
  padding: 0.75rem 1.5rem;
  border: none;
  border-radius: 4px;
  font-size: 1rem;
  cursor: pointer;
  transition: background-color 0.2s;
}

.quiz button:hover {
  background-color: #218838;
}

#take-quiz-btn {
  background-color: #17a2b8;
  color: white;
  border: none;
  border-radius: 50px;
  padding: 0.75rem 1.5rem;
  font-size: 1rem;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
  transition: all 0.2s;
  z-index: 1000;
}

#take-quiz-btn:hover {
  background-color: #138496;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

#quiz-feedback {
  background-color: #e8f5e8;
  border: 1px solid #c3e6c3;
  border-radius: 6px;
  padding: 1.5rem;
  margin-top: 1.5rem;
}

#quiz-feedback ul {
  margin: 0.5rem 0;
  padding-left: 1.5rem;
}

#quiz-feedback li {
  margin-bottom: 0.25rem;
}

.return-home {
  margin: 1rem 0;
  text-align: center;
}

.return-home a {
  text-decoration: none;
  color: #1d4ed8; /* blue */
  font-weight: 500;
}

.return-home a:hover {
  text-decoration: underline;
}

/* shared study list styling (used by Romans/John/Matthew too) - scoped under .study-view */
.study-view .study-list{
  list-style:none;
  margin:0;
  padding:0;
  display:grid;
  grid-template-columns:repeat(2, minmax(280px,1fr));
  gap:8px 16px;
}
@media (max-width:768px){ .study-view .study-list{ grid-template-columns:1fr; } }
.study-view .study-list li{ margin:0; }
.study-view .study-link{ text-decoration:none; }
.study-view .study-link .icon{ margin-right:8px; }
.study-view .study-index {
  list-style: none;
  padding-left: 1.5rem;
  margin: .5rem 0 1rem;
  text-align: left;
}
.study-view .study-index li {
  margin: 6px 0;
}

/* Base tooltip styles */
#verse-tooltip {
  position: absolute;            /* desktop default; JS may switch to fixed */
  max-width: min(92vw, 420px);
  max-height: calc(100vh - 24px);/* never exceed viewport; prevents offscreen */
  overflow: auto;                 /* let the tooltip scroll, not the page */
  -webkit-overflow-scrolling: touch;
  z-index: 9999;
  padding: 12px;
  border-radius: 10px;
  box-shadow: 0 10px 20px rgba(0,0,0,.25);
  background: #fff;
}

/* When JS decides it's better above the target */
#verse-tooltip.is-above::after { /* optional arrow styling if you use one */}

/* Mobile fallback: turn it into a bottom-sheet if space is tight */
@media (max-width: 768px) {
  #verse-tooltip.mobile-fixed {
    position: fixed !important;
    left: env(safe-area-inset-left, 0);
    right: env(safe-area-inset-right, 0);
    bottom: env(safe-area-inset-bottom, 0);
    top: auto !important;
    transform: none !important;
    margin: 0;
    width: auto;
    max-width: none;
    max-height: min(70vh, calc(100vh - 88px));
    border-radius: 14px 14px 0 0;
  }
  /* Optional: prevent the page behind from scrolling when bottom-sheet is open */
  body.tooltip-open {
    overflow: hidden;
    touch-action: none;
  }
}

.verse-tooltip.is-open{
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

/* ----- GP Tooltip System ----- */
/* Backdrop */
.gp-tooltip-backdrop {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.25);
  opacity: 0; pointer-events: none;
  transition: opacity 150ms ease;
  z-index: 9998; /* under tooltip */
}

/* Base tooltip container */
.gp-tooltip {
  position: absolute; /* desktop default; JS will change on mobile */
  max-width: min(92vw, 520px);
  background: #fff;
  border: 1px solid rgba(0,0,0,0.08);
  border-radius: 10px;
  box-shadow: 0 10px 30px rgba(0,0,0,0.20);
  opacity: 0; pointer-events: none;
  transform: translate(-50%, -8px);
  transition: opacity 120ms ease, transform 120ms ease;
  z-index: 9999;
}

/* Tooltip inner scroll area */
.gp-tooltip__content {
  max-height: 75vh;       /* desktop safety */
  overflow: auto;         /* scroll tooltip, not page */
  -webkit-overflow-scrolling: touch;
  padding: 14px 16px;
  line-height: 1.45;
  color: #111;
}

/* Visible state */
.gp-tooltip.is-open {
  opacity: 1; pointer-events: auto;
}

/* Backdrop visible state */
.gp-tooltip-backdrop.is-open {
  opacity: 1; pointer-events: auto;
}

/* Body scroll lock (prevent page scroll while tooltip open) */
.body--tooltip-open {
  overflow: hidden;
  touch-action: none;
}

/* --- Mobile override (<= 768px) --- */
@media (max-width: 768px) {
  .gp-tooltip {
    position: fixed;       /* modal style on mobile */
    left: 50%; top: auto; bottom: 16px;
    width: 92vw;
    transform: translateX(-50%); /* no vertical shift */
  }

  .gp-tooltip__content {
    max-height: 60vh;      /* slightly shorter for keyboard and thumbs */
    padding: 16px;
  }
}

/* Ask A Bible Question header: cross icon */
.cross {
  margin-right: 6px;
  font-size: 0.95em;
  vertical-align: middle;
}

/* Optional: tiny close "X" */
.gp-tooltip__close {
  position: absolute; top: 8px; right: 8px;
  border: 0; background: transparent;
  font-size: 18px; line-height: 1;
  cursor: pointer;
  padding: 6px;
}

/* Review Questions Styling - numbers in HTML via .rq-number, no <ol> */
.review-questions {
  list-style: none;
  padding-left: 0;
}

.review-questions li {
  display: flex;
  align-items: flex-start;
  gap: 6px;
  margin-bottom: 6px;
}

.rq-number {
  font-weight: 600;
  min-width: 18px;
}

.review-questions button.ask-in-chat {
  display: inline;
  background: none;
  border: none;
  color: #1f4e79;
  text-align: left;
  padding: 0;
  font: inherit;
  cursor: pointer;
}

/* Global ask-in-chat buttons: inline, link-like, no background highlight */
.ask-in-chat {
  background: none;
  border: none;
  color: #2f5fb3;
  cursor: pointer;
  text-align: left;
  font: inherit;
  transition: color 0.2s ease;
}

.ask-in-chat:hover,
.ask-in-chat:focus,
.ask-in-chat:active {
  background: none;
  outline: none;
}

/* Checkmark for asked review questions - on the list item */
.review-questions li.asked::after {
  content: "✔";
  color: #22c55e;
  font-weight: bold;
  margin-left: 8px;
}

/* darker color once a review question is clicked */
.review-questions li.asked button.ask-in-chat {
  color: #1e3a8a;   /* darker blue */
  font-weight: 600;
}

/* optional: subtle dimming on hover for asked questions */
.review-questions li.asked button.ask-in-chat:hover {
  color: #1e40af;
}

@media (max-width: 640px) {
  .review-questions {
    font-size: 0.95rem;
  }
  .review-questions li {
    margin-bottom: 0.7rem;
  }
}

/* Disable scroll anchoring on main study container to prevent upward jumps
   when the sticky chat updates DOM and buttons are focused */
article.study-content,
.study-content,
.study-container {
  overflow-anchor: none;
}

/* Return Navigation Styling */
.return-bar {
  margin: 8px 0 12px;
}
.return-link {
  color: #1e40af;         /* indigo-800 */
  font-weight: 600;
  text-decoration: none;
}
.return-link:hover {
  text-decoration: underline;
}

/* Emoji Styling */
.emoji {
  display: inline-block;
  line-height: 1; /* keeps the glyph from being clipped */
  margin-right: .35rem;
  font-family:
    "Apple Color Emoji","Segoe UI Emoji","Noto Color Emoji",
    "EmojiOne Color","Twemoji Mozilla", sans-serif; /* cross-platform emoji */
}

/* Visually hidden text for screen readers */
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* Make sure no legacy icon sneaks in */
.chatbot-fab::before { content: none !important; }

/* Small round blue FAB */
.chatbot-fab {
  position: fixed; right: 16px; bottom: 16px;
  width: 56px; height: 56px; padding: 0; margin: 0;
  border: none; border-radius: 50%;
  background: #1e40af; color: #fff;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 10px 20px rgba(0,0,0,.18), 0 2px 6px rgba(0,0,0,.12);
  cursor: pointer; z-index: 1000;
}

/* The visible icon */
.chatbot-fab .fab-emoji {
  font-size: 26px;
  line-height: 1;
  font-family: "Apple Color Emoji","Segoe UI Emoji","Noto Color Emoji",sans-serif;
}

.chatbot-fab:focus-visible { outline: 3px solid #93c5fd; outline-offset: 2px; }
.chatbot-fab:active { transform: translateY(1px); }

/* Kill any legacy pseudo-icons */
.chatbot-fab::before,
#bot-icon::before,
.chatbot-toggle::before { content: none !important; }

/* Ensure the emoji shows nicely */
.chatbot-fab .fab-emoji {
  font-size: 26px;
  line-height: 1;
  font-family: "Apple Color Emoji","Segoe UI Emoji","Noto Color Emoji","Twemoji Mozilla",sans-serif;
}

.bot-header { 
  line-height: 1.25; 
  overflow: visible; 
}

.emoji-ponder { 
  display: inline-block; 
  line-height: 1; 
  margin-right: .35rem; 
}

/* Layout */
.gp-layout {
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: 1rem;
}

/* Header */
.gp-header {
  margin-bottom: 1rem;
}

.gp-page-title {
  font-size: 1.6rem;
  font-weight: 700;
  margin: 0 0 0.5rem;
}

.gp-study-nav {
  display: flex;
  flex-wrap: wrap;
  gap: .5rem;
}

/* Sidebar */
.gp-sidebar {
  position: sticky;
  top: 1rem;
  max-height: calc(100vh - 2rem);
  overflow: auto;
  padding-right: .25rem;
  border-right: 1px solid rgba(0,0,0,.07);
}

/* Main */
.gp-main { min-width: 0; }

/* Manifest index (from _studies_index.html) */
.gp-book { font-weight: 700; margin: .5rem 0 .25rem; }
.gp-items { display: grid; gap: .25rem; }
.gp-study-item { display:block; padding:.35rem .5rem; border-radius:.5rem; text-decoration:none; }
.gp-study-item:hover { background: rgba(0,0,0,0.05); }
.gp-ref { font-size:.85rem; color:#666; font-weight:500; margin-bottom:.2rem; }
.gp-title { font-weight:600; }
.gp-meta { font-size:.9rem; opacity:.8; }

/* Active link highlight (optional) */
.gp-study-item.active { background: rgba(0,0,0,0.08); }

/* Study Navigation */
.gp-study-nav { 
  display: flex; 
  align-items: center; 
  gap: .5rem; 
  margin: 1rem 0; 
}

.gp-study-nav .gp-spacer { 
  flex: 1; 
}

/* Base button style (your blue pill) */
.gp-btn {
  display: inline-block;
  padding: 0.55rem 1.25rem;
  border-radius: 9999px;
  font-weight: 600;
  text-decoration: none;
  text-align: center;
  transition: background 0.2s;
  color: #fff;
  background-color: #2a66f0;
}

.gp-btn:hover {
  background-color: #1f50c4;
}

.gp-btn:active {
  background-color: #173c91;
}

/* Secondary button (outline style for Return) */
.gp-btn-secondary {
  background-color: #fff;
  color: #2a66f0;
  border: 2px solid #2a66f0;
}

.gp-btn-secondary:hover {
  background-color: #f0f4ff;
}

/* Mobile behavior */
@media (max-width: 900px) {
  .gp-layout {
    grid-template-columns: 1fr;
  }
  .gp-sidebar {
    display: none;
  }
}

/* Study Page Layout - All styles scoped under .study-view */
/* 1️⃣ Page Container */
.study-view {
  background: #f8f5f0; /* parchment */
  padding: 3rem 1rem;
  font-family: Georgia, "Times New Roman", serif;
}

/* 2️⃣ Reading Width */
.study-view .study-container {
  max-width: 820px;
  margin: 0 auto;
  box-sizing: border-box;
}

/* 1️⃣ Title & Subtitle Styling */
.study-view .study-title {
  font-size: 2rem;
  font-weight: 600;
  color: #1f3d7a;
}

.study-view .study-passage {
  font-size: 0.95rem;
  color: #475569;
  margin-top: 4px;
  margin-bottom: 16px;
  font-style: italic;
}

.study-view .study-subtitle {
  font-size: 1rem;
  color: #6b7280;
  margin-bottom: 1.75rem;
}
.study-view .study-nav {
  display: flex;
  justify-content: space-between;
  gap: 8px;   /* adds breathing room between buttons */
  margin: 15px 0;
}

.study-view .study-nav a {
  flex: 1;              /* equal width */
  text-align: center;
  background: #e6ecf5;   /* lighter ministry blue */
  padding: 12px;
  border-radius: 6px;
  font-weight: 600;
  color: #002b5c;        /* navy text */
  text-decoration: none;
}

.study-view .study-nav a:hover {
  background: #e0e0e0;
}
.study-view .study-nav .spacer { flex: 1; } /* pushes prev/next to the right */
.study-view .study-card { background: #fff; border-radius: 14px; padding: 20px; box-shadow: 0 6px 18px rgba(0,0,0,.06); }

/* Card mobile-friendly padding */
.card {
  padding: 1.25rem;
}
@media (max-width: 640px) {
  .card {
    padding: 1rem;
  }
}

/* 2️⃣ Section Cards (Softer, Less Boxy) */
.study-view section {
  background: #ffffff;
  border-left: 4px solid #2f6fb2;
  padding: 2.25rem 2.5rem;
  margin-bottom: 2.75rem;
  border-radius: 8px;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.035);
}

/* 3️⃣ Section Headings (Subtle Authority) */
.study-view h2 {
  font-size: 1.35rem;
  color: #2f6fb2;
  margin-top: 0;
  margin-bottom: 1.25rem;
  letter-spacing: 0.02em;
}

.study-view h2::after {
  content: "";
  display: block;
  width: 48px;
  height: 2px;
  background: #dbe6f5;
  margin-top: 0.5rem;
}

/* Passage card (Study Details: primary passage from metadata) */
.passage-card {
  background: #f8f9fb;
  border-left: 4px solid #2c4fa3;
  padding: 14px 16px;
  border-radius: 8px;
  margin-bottom: 18px;
}

.passage-label {
  font-weight: 600;
  color: #2c4fa3;
  margin-bottom: 4px;
}

.passage-ref a {
  font-size: 17px;
  font-weight: 500;
  color: #1a3faa;
  text-decoration: none;
}

.passage-ref a:hover {
  text-decoration: underline;
}

.passage-scripture-text {
  margin-top: 10px;
  margin-left: 1em;
  font-style: italic;
  font-size: 0.95rem;
  line-height: 1.6;
  color: #374151;
}

/* 5️⃣ Passage Block (📖) — in-body passage styling (legacy) */
.study-view .passage {
  font-style: italic;
  font-size: 1.05rem;
  background: #f2f6fb;
  border-left: 4px solid #4a90e2;
  padding: 1rem 1.25rem;
  margin-bottom: 1.5rem;
}

/* 4️⃣ Paragraph Rhythm (Readers Stay Longer) */
.study-view p {
  line-height: 1.75;
  margin-bottom: 1.15rem;
  color: #1f2937;
}

/* 5️⃣ Lists (Calm, Not Dense) */
.study-view ul {
  padding-left: 1.5rem;
  margin-bottom: 1.5rem;
}

.study-view li {
  margin-bottom: 0.65rem;
}

/* 8️⃣ Mark/Highlight Styling (Study Notes) */
mark {
  background: #fff3a3;
  padding: 2px 4px;
  border-radius: 3px;
}

.study-view mark {
  background-color: #fff3b0;
  padding: 0.1em 0.25em;
  border-radius: 3px;
  box-decoration-break: clone;
}

/* 8️⃣ Highlight Blocks (Multi-paragraph emphasis) */
.study-view .highlight-block {
  background: #fff8e6;
  border-left: 4px solid #e0b85c;
  padding: 1rem 1.25rem;
  margin: 1.25rem 0;
  border-radius: 6px;
}

.study-view .highlight-block p:last-child {
  margin-bottom: 0;
}

.study-view .highlight-block strong {
  color: #8a6d1d;
}

/* 8️⃣ Blockquotes (Trusted Insight) — word-break so long refs/URLs don't break layout */
.study-view blockquote {
  font-style: normal;
  border-left: 4px solid #c4a15a;
  padding-left: 1rem;
  padding-top: 1rem;
  padding-right: 1.25rem;
  padding-bottom: 1rem;
  background: #faf8f3;
  color: #555;
  overflow-wrap: break-word;
  word-break: break-word;
}

/* Study content readability */
.study-content {
  line-height: 1.7;
}
@media (max-width: 640px) {
  .study-content {
    font-size: 0.98rem;
    line-height: 1.65;
  }
}
@media (min-width: 768px) {
  .study-content {
    font-size: 1.05rem;
  }
}

/* Readable markdown defaults - Updated to match improvements. Word-break for long refs/URLs/Hebrew/Greek. */
.study-view #study-content {
  font-size: 1.05rem;
  line-height: 1.7;
  color: #1f2937;
  overflow-wrap: break-word;
  word-break: break-word;
}
.study-view #study-content h2 { 
  font-size: 1.35rem;
  color: #2f6fb2;
  margin-top: 0;
  margin-bottom: 1.25rem;
  letter-spacing: 0.02em;
}
.study-view #study-content h2::after {
  content: "";
  display: block;
  width: 48px;
  height: 2px;
  background: #dbe6f5;
  margin-top: 0.5rem;
}
.study-view #study-content h2 span,
.study-view #study-content h3 span {
  opacity: 0.85;
}
.study-view #study-content h3 { font-size: 1.25rem; margin: 1.25rem 0 .4rem; color: #153e7a; }
.study-view #study-content p { 
  line-height: 1.75;
  margin-bottom: 1.15rem;
  color: #1f2937;
}
.study-view #study-content ul, .study-view #study-content ol { 
  padding-left: 1.5rem;
  margin-bottom: 1.5rem;
}
.study-view #study-content li { margin-bottom: 0.65rem; }

/* Scripture & Cross Reference links */
.study-content a:link {
  color: #2563eb;           /* blue-600 */
  text-decoration: underline;
  text-underline-offset: 2px;
}

.study-content a:visited {
  color: #7c3aed;           /* purple-600 */
}

.study-content a:hover {
  color: #1d4ed8;           /* blue-700 */
}

/* Cross Reference link styling */
.cross-ref {
  user-select: none;
  color: #1e6bd6;
  text-decoration: underline;
  font-weight: 500;
  cursor: pointer;
}
.cross-ref:hover {
  color: #0f4aa1;
}

/* Cross Reference tooltip styling */
.study-content .cross-ref-tooltip {
  color: #2563eb;                /* blue-600 */
  text-decoration: underline;
  text-decoration-thickness: 1.5px;
  text-underline-offset: 2px;
  text-decoration-skip-ink: none;
  cursor: pointer;
}

.study-content .cross-ref-tooltip:hover {
  color: #1d4ed8;                /* blue-700 */
}

.study-view #study-content hr { border: 0; border-top: 1px solid #e5e7eb; margin: 1.2rem 0; }

/* Scripture Highlight Block */
.study-view #study-content blockquote {
  background: #f8fafc;
  border-left: 4px solid #4f7cff;
  padding: 18px 22px;
  margin: 22px 0;
  border-radius: 8px;
  font-style: italic;
  color: #2c2c2c;
  overflow-wrap: break-word;
  word-break: break-word;
}
.study-view #study-content blockquote strong {
  font-style: normal;
  font-weight: 600;
}

.study-view #study-content code { background: #f3f4f6; padding: 2px 5px; border-radius: 6px; }
.study-view pre code { display: block; padding: 12px; overflow-x: auto; }

/* Headings and section titles */
.study-view .study-container h1, 
.study-view .study-container h2, 
.study-view .study-container h3 {
  line-height: 1.3; 
  word-wrap: break-word; 
}

/* Mobile: keep existing layout; just prevent overflow */
@media (max-width: 640px) {
  .study-view #gp-tooltip {
    max-height: 85dvh;                  /* never taller than viewport */
    overflow: auto;                      /* scroll inside the panel */
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;        /* prevent background scroll */
    padding-bottom: max(12px, env(safe-area-inset-bottom));
  }
}

/* Mobile: verse tooltip is a fixed popup above the home bar */
@media (max-width: 640px) {
  .study-view #verse-tooltip {
    position: fixed !important;
    left: 50% !important;
    transform: translateX(-50%);
    bottom: max(84px, calc(env(safe-area-inset-bottom) + 72px));
    width: clamp(280px, 94vw, 720px);
    max-height: 58dvh;
    overflow: auto;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
    z-index: 10050; /* above bot panel & footer */
  }
}

/* 6️⃣ Icons: Keep Them, Just Quiet Them */
.study-view h2 span,
.study-view h3 span {
  opacity: 0.85;
}

/* 7️⃣ Mobile Comfort (Pastors Will Read on Phones) */
@media (max-width: 640px) {
  .study-view section {
    padding: 1.75rem 1.5rem;
  }

  .study-view .study-title {
    font-size: 1.6rem;
  }
}

/* Mobile layout improvements */
@media (max-width: 768px) {
  .study-view .study-content {
    max-width: 100%;     /* allow full width */
    width: 100%;
    padding-left: 16px;  /* keep comfortable side spacing */
    padding-right: 16px;
  }

  .study-view .study-content p,
  .study-view .study-content h1,
  .study-view .study-content h2,
  .study-view .study-content h3 {
    line-height: 1.6;    /* easier reading on small screens */
  }
}

/* Mobile layout adjustments */
@media (max-width: 768px) {
  /* Reduce study title size */
  .study-view h1, 
  .study-view .study-title {
    font-size: 1.4rem !important;   /* smaller headline */
    line-height: 1.3;
    text-align: center;
    margin-bottom: 1rem;
  }

  /* Nav buttons: stack icon above text */
  .study-view .nav-buttons {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    margin-top: 1.5rem;
  }

  .study-view .nav-buttons a {
    flex: 1;
    display: flex;
    flex-direction: column;   /* always icon first, text second */
    align-items: center;
    justify-content: center;
    padding: 0.75rem;
    border-radius: 8px;
    font-size: 0.9rem;
  }

  /* Always put icons/emojis above text */
  .study-view .nav-buttons a img,
  .study-view .nav-buttons a svg,
  .study-view .nav-buttons a i,
  .study-view .nav-buttons a .emoji {
    order: -1;
    margin-bottom: 0.25rem;
    font-size: 1.4rem;
  }
}

/* Study Link Styles */
/* Default study links */
.study-view .study-list a,
.study-view .study-selector a {
  color: #0066cc; /* blue for unvisited */
  text-decoration: none;
}

/* Hover effect */
.study-view .study-list a:hover,
.study-view .study-selector a:hover {
  color: #004499;
  text-decoration: underline;
}

/* ✅ Visited links */
.study-view .study-list a:visited,
.study-view .study-selector a:visited {
  color: purple;
}

/* Study index links */
.study-view .gp-study-item:link {
  color: #0066cc;
}
.study-view .gp-study-item:visited {
  color: purple !important;
}
.study-view .gp-study-item:hover {
  color: #004499;
  text-decoration: underline;
}

/* Take Quiz Button Styling */
.study-view .take-quiz-section {
  margin-top: 2rem;
  text-align: center;
}
.study-view .take-quiz-section .gp-btn {
  font-size: 1rem;
  padding: 0.75rem 1.5rem;
  color: white !important;
}

/* Fix review question alignment */

.review-questions-section li {
  margin-bottom: 8px;
}

.review-questions-section .ask-in-chat {
  width: auto;
  padding: 0;
  margin: 0;
  display: inline;
  background: none;
  border: none;
  font: inherit;
  color: #1e4fa8;
  cursor: pointer;
}

.review-questions-section .ask-in-chat:hover {
  text-decoration: underline;
}

/* Fix Review Question button layout */

.review-questions-section .ask-in-chat {
  width: auto !important;
  display: inline !important;
  padding: 0 !important;
  margin: 0 !important;
  border: none;
  background: none;
  font: inherit;
  color: #2b6cb0;
  cursor: pointer;
}

.review-questions-section li {
  margin-bottom: 8px;
}

/* Fix Review Question list alignment - ul, numbers in .rq-number */
.review-questions-section ul.review-questions,
.review-questions-section ol {
  list-style: none;
  padding-left: 0;
}

.review-questions-section ul.review-questions li,
.review-questions-section ol li {
  display: flex;
  align-items: flex-start;
  gap: 6px;
  margin-bottom: 8px;
}

.review-questions-section .rq-number {
  font-weight: 600;
  min-width: 18px;
}

.review-questions-section .ask-in-chat {
  width: auto !important;
  display: inline !important;
  padding: 0 !important;
  margin: 0 !important;
}

/* Force chatbot button to remain a floating circle */
#chatbot-open.chatbot-fab {
  position: fixed !important;
  right: 16px !important;
  bottom: 16px !important;
  width: 56px !important;
  height: 56px !important;
  border-radius: 50% !important;
  background: #1e40af !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  padding: 0 !important;
  margin: 0 !important;
}
