/* ============================================
   LESSON VIEWER - REDESIGNED LAYOUT
   Desktop: Sidebar (Left) + Content (Right)
   Mobile: Fullscreen + Slide-in Menu
   ============================================ */

/* Navbar Title (Desktop Only) */
.navbar-title {
  flex: 1;
  text-align: center;
  font-size: var(--text-base);
  font-weight: var(--font-semibold);
  color: var(--gray-700);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 400px;
}

/* Breadcrumb Wrapper */
.breadcrumb-wrapper {
  padding-top: var(--space-4);
}

/* Main Layout Container */
.lesson-viewer-layout {
  padding: var(--space-6) 0;
  min-height: calc(100vh - var(--navbar-height));
}

.lesson-layout {
  display: flex;
  gap: var(--space-6);
  align-items: flex-start;
}

/* ============================================
   LEFT SIDEBAR (Desktop)
   ============================================ */

.lesson-sidebar {
  width: 220px;
  background-color: var(--white);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-sm);
  position: sticky;
  top: calc(var(--navbar-height) + var(--space-4));
  max-height: calc(100vh - var(--navbar-height) - var(--space-8));
  overflow-y: auto;
  flex-shrink: 0;
}

.sidebar-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: var(--space-5);
  border-bottom: 1px solid var(--gray-200);
}

.sidebar-header h3 {
  font-size: var(--text-lg);
  font-weight: var(--font-semibold);
  color: var(--gray-900);
  margin: 0;
}

.sidebar-close {
  display: none; /* Hidden on desktop */
  width: 32px;
  height: 32px;
  border: none;
  background: var(--gray-100);
  border-radius: var(--radius-md);
  cursor: pointer;
  font-size: var(--text-xl);
  color: var(--gray-600);
  transition: all var(--transition-base);
}

.sidebar-close:hover {
  background: var(--gray-200);
  color: var(--gray-900);
}

.sidebar-content {
  padding: var(--space-5);
}

/* Sidebar Sections */
.sidebar-section {
  margin-bottom: var(--space-6);
}

.sidebar-section:last-child {
  margin-bottom: 0;
}

.sidebar-section-title {
  font-size: var(--text-sm);
  font-weight: var(--font-semibold);
  color: var(--gray-600);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: var(--space-3);
}

/* Lesson Info */
.lesson-info {
  padding: var(--space-4);
  background: var(--gray-50);
  border-radius: var(--radius-lg);
}

.lesson-info-title {
  font-size: var(--text-base);
  font-weight: var(--font-semibold);
  color: var(--gray-900);
  margin-bottom: var(--space-2);
  line-height: 1.4;
}

.lesson-info-meta {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  font-size: var(--text-xs);
  color: var(--gray-600);
}

/* Sidebar Tabs */
.sidebar-tabs {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.sidebar-tab {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  background: var(--white);
  border: 2px solid var(--gray-200);
  border-radius: var(--radius-lg);
  cursor: pointer;
  transition: all var(--transition-base);
  font-size: var(--text-sm);
  font-weight: var(--font-medium);
  color: var(--gray-700);
  text-align: left;
}

.sidebar-tab:hover {
  border-color: var(--primary-blue);
  background: var(--primary-lighter);
}

.sidebar-tab-active {
  border-color: var(--primary-blue);
  background: var(--primary-blue);
  color: var(--white);
}

.tab-icon {
  font-size: var(--text-lg);
  flex-shrink: 0;
}

.tab-label {
  flex: 1;
}

/* Sidebar Actions */
.sidebar-actions {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.sidebar-action-btn {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  background: var(--white);
  border: 2px solid var(--gray-200);
  border-radius: var(--radius-lg);
  cursor: pointer;
  transition: all var(--transition-base);
  font-size: var(--text-sm);
  font-weight: var(--font-medium);
  color: var(--gray-700);
  text-align: left;
}

.sidebar-action-btn:hover {
  border-color: var(--gray-300);
  background: var(--gray-50);
}

.action-icon {
  font-size: var(--text-lg);
  flex-shrink: 0;
}

.action-label {
  flex: 1;
}

/* Sidebar Navigation */
.sidebar-navigation {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.sidebar-nav-btn {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  background: var(--gray-50);
  border: 2px solid var(--gray-200);
  border-radius: var(--radius-lg);
  cursor: pointer;
  transition: all var(--transition-base);
  text-align: left;
}

.sidebar-nav-btn:hover {
  border-color: var(--primary-blue);
  background: var(--primary-lighter);
}

.nav-arrow {
  font-size: var(--text-xl);
  color: var(--primary-blue);
  flex-shrink: 0;
}

.nav-info {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.nav-label {
  font-size: var(--text-xs);
  color: var(--gray-500);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.nav-title {
  font-size: var(--text-sm);
  font-weight: var(--font-semibold);
  color: var(--gray-900);
}

/* Sidebar Hint */
.sidebar-hint {
  padding: var(--space-3);
  background: var(--primary-lighter);
  border-radius: var(--radius-md);
  font-size: var(--text-xs);
  color: var(--primary-dark);
  text-align: center;
  line-height: 1.5;
}

.mobile-only {
  display: none;
}

/* ============================================
   RIGHT CONTENT AREA (Desktop)
   ============================================ */

.lesson-content-area {
  flex: 1;
  min-width: 0;
}

.content-box {
  background-color: var(--white);
  border-radius: var(--radius-xl);
  padding: var(--space-10);
  box-shadow: var(--shadow-sm);
  min-height: 500px;
  overflow-y: auto;
  position: relative;
}

.loading-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: var(--space-12);
  gap: var(--space-4);
}

.loading-container p {
  color: var(--gray-600);
  margin: 0;
}

/* Lesson Content Wrapper */
.lesson-content {
  max-width: 100%;
  word-wrap: break-word;
  animation: fadeIn 0.3s ease-out;
  padding-bottom: 80px;  /* Space for floating nav */
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Sidebar Overlay (Mobile) */
.sidebar-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  z-index: calc(var(--z-sticky) + 1);
  opacity: 0;
  transition: opacity var(--transition-base);
}

.sidebar-overlay.active {
  display: block;
  opacity: 1;
}

/* ============================================
   SCROLLBAR STYLING (Sidebar)
   ============================================ */

.lesson-sidebar::-webkit-scrollbar {
  width: 6px;
}

.lesson-sidebar::-webkit-scrollbar-track {
  background: var(--gray-100);
}

.lesson-sidebar::-webkit-scrollbar-thumb {
  background: var(--gray-300);
  border-radius: 3px;
}

.lesson-sidebar::-webkit-scrollbar-thumb:hover {
  background: var(--gray-400);
}

.qa-contribute-btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;

  padding: 0.45rem 0.9rem;
  min-height: 32px;
  font-size: 12.5px;
  font-weight: 600;

  color: #ffffff;
  background: linear-gradient(
    270deg,
    #6a11cb,
    #2575fc,
    #00c6ff,
    #6a11cb
  );
  background-size: 500% 500%;
  animation: gradientFlow 6s linear infinite;

  border: none;
  border-radius: 999px;
  cursor: pointer;
  white-space: nowrap;
  text-decoration: none;

  box-shadow: 0 3px 10px rgba(37, 117, 252, 0.35);
  transition: transform 0.2s ease, box-shadow 0.2s ease;

  -webkit-tap-highlight-color: transparent;
}

@media (hover: hover) {
  .qa-contribute-btn:hover {
    transform: translateY(-1px) scale(1.02);
    box-shadow: 0 6px 16px rgba(37, 117, 252, 0.5);
  }
}

.qa-contribute-btn:active {
  transform: scale(0.96);
}

@keyframes gradientFlow {
  0% { background-position: 0% 50%; }
  100% { background-position: 100% 50%; }
}

@media (prefers-reduced-motion: reduce) {
  .qa-contribute-btn {
    animation: none;
  }
}

/* Watch Video button — lives in the content-header, next to Single/Multi Page toggle.
   Only rendered when the current lesson has a video (see displayContent() in lesson-viewer.js). */
.content-video-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  border: none;
  border-radius: 8px;
  background: #8B4513;
  color: #ffffff;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.25s ease;
  margin-right: auto; /* pushes to the left while the toggle stays right-aligned */
  white-space: nowrap;
}

.content-video-btn:hover {
  background: #723a0f;
  transform: translateY(-1px);
  box-shadow: 0 2px 6px rgba(139, 69, 19, 0.3);
}

.content-video-btn:active {
  transform: scale(0.97);
}

.content-video-icon {
  font-size: 1rem;
}

@media (max-width: 600px) {
  .content-video-label {
    display: none;
  }
  .content-video-btn {
    padding: 8px 10px;
  }
}

/* Video Modal */
.video-modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  z-index: 2000;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.video-modal-overlay.active {
  display: flex;
}

.video-modal {
  position: relative;
  width: 100%;
  max-width: 960px;
  background: #000;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
}

.video-modal-close {
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 2001;
  width: 34px;
  height: 34px;
  border: none;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.6);
  color: #fff;
  font-size: 16px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s ease;
}

.video-modal-close:hover {
  background: rgba(0, 0, 0, 0.85);
}

.video-modal-player {
  position: relative;
  width: 100%;
  padding-top: 56.25%; /* 16:9 */
}

.video-modal-player iframe {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  border: none;
}

.navbar-logo {
  display: flex;
  gap: 8px;
  text-decoration: none;
  color: #000;
}

.logo-icon {
  font-size: 22px;
  line-height: 1;
  transform: translateY(4px);
}

.logo-text {
  display: flex;
  flex-direction: column;
  line-height: 1.05;
}

.logo-text span {
  font-weight: 600;
}

.hidden {
  display: none !important;
}

html {
  scroll-behavior: smooth;
}

.avatar-view {
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  vertical-align: middle;
  display: inline-flex;
  align-items: center;
}

.avatar-view img {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--gray-200);
  transition: border-color var(--transition-base);
}

.avatar-view:hover img {
  border-color: var(--primary-blue);
}

/* ============================================
   VIEW MODE TOGGLE - Single/Multi Page
   ============================================ */

.content-header {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  padding: 0.75rem 1rem;
  border-bottom: none;
  background: transparent;
  border-radius: 0;
  margin: -1rem -1rem 1rem -1rem;
}

.view-mode-toggle {
  display: flex;
  background: #e8dcc8;
  border-radius: 8px;
  padding: 4px;
  gap: 4px;
}

.view-mode-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  border: none;
  border-radius: 6px;
  background: transparent;
  color: #7a6050;
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.25s ease;
}

.view-mode-btn:hover:not(.active):not(:disabled) {
  background: rgba(255, 255, 255, 0.5);
  color: #5c4033;
}

.view-mode-btn.active {
  background: #8B4513;
  color: white;
  box-shadow: 0 2px 6px rgba(139, 69, 19, 0.3);
}

.view-mode-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.view-mode-btn:disabled:hover {
  background: transparent;
}

.view-mode-icon {
  font-size: 1rem;
}

.view-mode-label {
  white-space: nowrap;
}

/* ============================================
   FLOATING PAGE NAVIGATION - Multi Page Mode
   ============================================ */

.page-navigation {
  position: fixed;
  bottom: 20px;
  left: calc(50% + 175px);
  transform: translateX(-50%);
  z-index: 1000;
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-radius: 50px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15), 
              0 0 0 1px rgba(139, 69, 19, 0.1);
  padding: 8px 16px;
  transition: all 0.3s ease;
  animation: slideUp 0.4s ease-out;
}

.page-navigation:hover {
  box-shadow: 0 6px 25px rgba(0, 0, 0, 0.2), 
              0 0 0 1px rgba(139, 69, 19, 0.2);
  transform: translateX(-50%) translateY(-2px);
}

.page-nav-container {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
}

.page-nav-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 10px 18px;
  background: linear-gradient(135deg, #8B4513 0%, #A0522D 100%);
  color: white;
  border: none;
  border-radius: 25px;
  cursor: pointer;
  font-size: 0.9rem;
  font-weight: 500;
  transition: all 0.3s ease;
  box-shadow: 0 2px 8px rgba(139, 69, 19, 0.3);
}

.page-nav-btn:hover:not(.disabled) {
  background: linear-gradient(135deg, #A0522D 0%, #8B4513 100%);
  transform: scale(1.05);
  box-shadow: 0 4px 12px rgba(139, 69, 19, 0.4);
}

.page-nav-btn:active:not(.disabled) {
  transform: scale(0.98);
}

.page-nav-btn.disabled {
  background: #ccc;
  color: #888;
  cursor: not-allowed;
  box-shadow: none;
}

.page-nav-arrow {
  font-size: 1.1rem;
  font-weight: bold;
}

.page-nav-text {
  white-space: nowrap;
}

.page-indicator {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  background: linear-gradient(135deg, #f5ebe0 0%, #e8dcc8 100%);
  border-radius: 20px;
  font-weight: 600;
  color: #5c4033;
  min-width: 80px;
  justify-content: center;
}

.page-current {
  font-size: 1.1rem;
  color: #8B4513;
}

.page-separator {
  color: #a08060;
}

.page-total {
  font-size: 0.95rem;
  color: #7a6050;
}

.page-navigation.nav-hidden {
  opacity: 0;
  pointer-events: none;
  transform: translateX(-50%) translateY(20px);
}

.caramel .page-navigation {
  background: rgba(250, 246, 240, 0.95);
}

.caramel .page-indicator {
  background: linear-gradient(135deg, #f5ebe0 0%, #e8dcc8 100%);
}

@keyframes slideUp {
  from {
    opacity: 0;
    transform: translateX(-50%) translateY(30px);
  }
  to {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
  }
}

/* ============================================
   MOBILE RESPONSIVE
   ============================================ */

@media (max-width: 768px) {
  .container {
    padding: 0;
    margin: 0;
  }

  .lesson-viewer-layout {
    padding: var(--space-2) 0;
  }

  .lesson-layout {
    gap: var(--space-2);
  }

  .content-box {
    padding: var(--space-3);
    border-radius: var(--radius-lg);
    box-shadow: none;
  }

  .lesson-content {
    padding-bottom: 40px;
  }

  .content-header {
    padding: 0.5rem 0.75rem;
    margin: -0.75rem -0.75rem 0.75rem -0.75rem;
  }

  .view-mode-toggle {
    padding: 3px;
  }

  .view-mode-btn {
    padding: 6px 10px;
    font-size: 0.8rem;
  }

  .view-mode-label {
    display: none;
  }

  .view-mode-icon {
    font-size: 1.2rem;
  }

  .page-navigation {
    bottom: 15px;
    left: 50%;
    right: auto;
    transform: translateX(-50%);
    margin-left: 0;
    padding: 6px 12px;
    border-radius: 40px;
    width: auto;
    max-width: 85%;
  }

  .page-nav-container {
    gap: 8px;
  }

  .page-nav-btn {
    padding: 8px 14px;
    font-size: 0.85rem;
    border-radius: 20px;
  }

  .page-nav-text {
    display: none;
  }

  .page-nav-arrow {
    font-size: 1.3rem;
  }

  .page-indicator {
    padding: 6px 12px;
    min-width: 60px;
  }
}

/* ============================================
   TOOLTIP FOR DISABLED BUTTON
   ============================================ */

.view-mode-btn[disabled] {
  position: relative;
}

.view-mode-btn[disabled]:hover::after {
  content: attr(title);
  position: absolute;
  bottom: -35px;
  left: 50%;
  transform: translateX(-50%);
  background: #333;
  color: white;
  padding: 5px 10px;
  border-radius: 4px;
  font-size: 0.75rem;
  white-space: nowrap;
  z-index: 100;
}

/* ============================================
   NAVBAR MOBILE FIX - Prevent overflow
   ============================================ */

.navbar-menu {
  display: flex;
  align-items: center;
  gap: 6px !important;
  flex-shrink: 0;
}

.avatar-trigger {
  padding: 2px !important;
}

@media (max-width: 767px) {
  .navbar-container {
    padding: 0 10px !important;
    gap: 0 !important;
    overflow: visible;
  }

  .navbar-logo {
    flex-shrink: 1;
    min-width: 0;
  }

  .logo-text span {
    font-size: 12px !important;
  }

  .logo-icon {
    font-size: 18px !important;
  }

  .navbar-title {
    display: none !important;
  }

  .navbar-menu {
    gap: 4px !important;
    flex-shrink: 0;
  }

  .qa-contribute-btn {
    font-size: 10px !important;
    padding: 5px 10px !important;
    min-height: 28px !important;
    width: auto !important;
    height: auto !important;
    border-radius: 999px !important;
    flex-shrink: 0;
    white-space: nowrap;
  }

  .lan-change-btn {
    font-size: 10px !important;
    padding: 4px 7px !important;
    white-space: nowrap;
    flex-shrink: 0;
    display: flex !important;
  }

  .avatar-img-wrap {
    width: 30px !important;
    height: 30px !important;
  }

  .mobile-menu-btn {
    flex-shrink: 0;
    width: 32px !important;
    height: 32px !important;
    padding: 4px !important;
  }

  .logo-text {
    display: flex !important;
  }

  .logo-text span {
    font-size: 11px !important;
  }
}

@media (max-width: 380px) {
  .qa-contribute-btn {
    font-size: 9px !important;
    padding: 4px 7px !important;
  }

  .lan-change-btn {
    font-size: 9px !important;
    padding: 3px 5px !important;
  }
}

.beta-badge {
  background-color: #6366f1;
  color: white;
  font-size: 0.65rem;
  font-weight: bold;
  padding: 2px 6px;
  border-radius: 4px;
  margin-left: 8px;
  vertical-align: middle;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.lp-toolbar {
  position: sticky;
  top: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  background: transparent;
  border-bottom: 1px solid #e8dcc8;
  border-radius: 8px 8px 0 0;
  margin: -1rem -1rem 1rem -1rem;
  flex-wrap: wrap;
}

.lp-edited-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: #FEF3C7;
  color: #92400E;
  border: 1.5px solid #F59E0B;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 700;
}

.lp-edit-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  background: #8B4513;
  color: white;
  border: none;
  border-radius: 7px;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.2s;
}

.lp-edit-btn:hover { background: #A0522D; }

.lp-revert-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  background: transparent;
  color: #7a6050;
  border: 1.5px solid #d4b896;
  border-radius: 7px;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s;
}

.lp-revert-btn:hover { border-color: #8B4513; color: #8B4513; }

.lp-save-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 16px;
  background: #2d7d46;
  color: white;
  border: none;
  border-radius: 7px;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.2s;
  margin-left: auto;
}

.lp-save-btn:hover { background: #1a5c32; }
.lp-save-btn:disabled { opacity: 0.5; cursor: not-allowed; }

.lp-editor-wrap {
  border: 2px solid #8B4513;
  border-radius: 8px;
  overflow: hidden;
  margin-bottom: 16px;
}

.lp-editor-wrap .ql-toolbar { border: none; border-bottom: 1px solid #e8dcc8; background: #faf6f0; }
.lp-editor-wrap .ql-container { border: none; font-family: inherit; font-size: 0.95rem; }
.lp-editor-wrap .ql-editor { min-height: 400px; padding: 20px 24px; }
/* LP toolbar fixed — push content down so it doesn't hide under toolbar */
#content-box:has(.lp-toolbar) .lesson-content {
  padding-top: 60px;
}






/* ── Allow chat children to receive clicks ── */
.chat-float-container > * {
  pointer-events: auto;
}

/* ── Scroll FAB ── */
.scroll-fab {
  position: fixed;
  bottom: 176px;      /* sits above the čevi bunny */
  right: 52px;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  border: none;
  background: #c8960c;
  color: #fff;
  font-size: 1.3rem;
  font-weight: bold;
  cursor: pointer;
  display: none;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 14px rgba(140,100,0,0.4);
  z-index: 99999;
  transition: transform 0.2s ease, background 0.2s ease;
}
.scroll-fab:hover {
  background: #a07820;
  transform: scale(1.1);
}
@media (max-width: 768px) {
  .scroll-fab {
    width: 52px;
    height: 52px;
    font-size: 1.4rem;
    bottom: 118px;
    right: 21px;
  }
}
.lp-edit-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  pointer-events: none;
}

/* ============================================
   DIGEST TAB
   ============================================ */
.digest-hint {
  margin: 0 0 16px;
  font-size: 0.85rem;
  color: #7a6050;
}

.digest-gallery {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.digest-card {
  margin: 0;
  border-radius: 14px;
  overflow: hidden;
  background: #fff;
  cursor: zoom-in;
  box-shadow: 0 4px 18px rgba(139, 69, 19, 0.12);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.digest-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 26px rgba(139, 69, 19, 0.2);
}

.digest-card img {
  display: block;
  width: 100%;
  height: auto;
}

.digest-empty {
  padding: 48px 24px;
  text-align: center;
  border-radius: 14px;
  background: #faf6f0;
  color: #7a6050;
  border: 2px dashed #d4b896;
  font-weight: 500;
}

/* Lightbox — above scroll-fab (z-index 99999) */
.digest-lightbox {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 100000;
  background: rgba(20, 12, 4, 0.92);
}

.digest-lightbox.active {
  display: flex;
}

.digest-lightbox-scroll {
  flex: 1;
  display: flex;
  overflow: auto;
  -webkit-overflow-scrolling: touch;
}

.digest-lightbox-scroll img {
  margin: auto;                 /* centres, and stays scrollable when zoomed */
  max-width: 100%;
  max-height: 100vh;
  object-fit: contain;
  cursor: zoom-in;
}

.digest-lightbox-scroll img.zoomed {
  max-width: none;
  max-height: none;
  width: 200%;
  cursor: zoom-out;
}

.digest-lightbox-close {
  position: absolute;
  top: 16px;
  right: 16px;
  z-index: 1;
  width: 44px;
  height: 44px;
  border: none;
  border-radius: 50%;
  color: #fff;
  font-size: 18px;
  cursor: pointer;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.4);
}



@media (min-width: 1200px) {
  .digest-lightbox-scroll img.zoomed { width: 140%; }
}
/* Lightbox navigation — prev/next + counter */
.digest-lightbox-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  z-index: 1;
  width: 48px;
  height: 48px;
  border: none;
  border-radius: 50%;
  color: #fff;
  font-size: 30px;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.4);
  transition: background 0.2s ease, opacity 0.2s ease;
}
.digest-lightbox-prev { left: 16px; }
.digest-lightbox-next { right: 16px; }
.digest-lightbox-nav:hover:not(:disabled) { background: #A0522D; }
.digest-lightbox-nav:disabled { opacity: 0.25; cursor: default; }

.digest-lightbox-counter {
  position: absolute;
  bottom: 16px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 1;
  padding: 6px 14px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.6);
  color: #fff;
  font-size: 0.9rem;
  font-weight: 600;
  pointer-events: none;
}

@media (max-width: 600px) {
  .digest-lightbox-nav {
    width: 38px;
    height: 38px;
    font-size: 24px;
    background: rgba(139, 69, 19, 0.55);   /* lighter so it doesn't cover the image */
  }
  .digest-lightbox-prev { left: 6px; }
  .digest-lightbox-next { right: 6px; }
}
.whiteboard-modal-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,.6);
  display: none; align-items: center; justify-content: center; z-index: 10000;
}
.whiteboard-modal-overlay.open { display: flex; }
.whiteboard-modal {
  width: 95vw; height: 90vh; background: #fff; border-radius: 12px;
  overflow: hidden; display: flex; flex-direction: column;
}
.whiteboard-modal-header {
  display: flex; justify-content: space-between; align-items: center;
  padding: 8px 14px; font-weight: 600; border-bottom: 1px solid #e5e5e5;
}
.whiteboard-modal-header button {
  background: none; border: none; font-size: 18px; cursor: pointer;
}
#whiteboard { flex: 1; min-height: 0; }
.whiteboard-modal-actions { display: flex; gap: 4px; }

.whiteboard-pill {
  position: fixed; left: 16px; bottom: 20px; z-index: 10001;
  display: none; align-items: center;
  background: #8B4513; color: #fff; border-radius: 999px; overflow: hidden;
  box-shadow: 0 4px 14px rgba(139, 69, 19, 0.4);
}
.whiteboard-pill.show { display: flex; }
.whiteboard-pill button {
  background: none; border: none; color: #fff; cursor: pointer;
  font-size: 0.85rem; font-weight: 600; padding: 10px 14px;
}
.whiteboard-pill button + button { padding: 10px 12px; border-left: 1px solid rgba(255, 255, 255, 0.3); }
/* hide the scroll button while the čevi chat is open (it would float over the chat) */
body:has(#chat-container.is-open) .scroll-fab { display: none !important; }
