/* =========================================
   UNIVERSAL FULL-TEXT SEARCH MODAL (CMD+K)
   ========================================= */

/* Backdrop Overlay */
.search-modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(2, 6, 23, 0.75);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  z-index: 2000;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 60px 16px 20px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.search-modal-backdrop.open {
  opacity: 1;
  pointer-events: auto;
}

/* Modal Window */
.search-modal-window {
  width: 100%;
  max-width: 680px;
  background: linear-gradient(180deg, #0f172a 0%, #090d16 100%);
  border: 1px solid rgba(56, 189, 248, 0.25);
  border-radius: 16px;
  box-shadow: 0 25px 60px rgba(0, 0, 0, 0.7), 0 0 30px rgba(56, 189, 248, 0.15);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  max-height: 80vh;
  transform: translateY(-20px) scale(0.98);
  transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  color: #f8fafc;
}

.search-modal-backdrop.open .search-modal-window {
  transform: translateY(0) scale(1);
}

/* Modal Header / Search Bar */
.search-modal-header {
  padding: 16px 20px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  display: flex;
  align-items: center;
  gap: 12px;
  background: rgba(255, 255, 255, 0.03);
  position: relative;
}

.search-modal-header .search-modal-icon {
  font-size: 20px;
  color: #38bdf8;
  flex-shrink: 0;
}

.search-modal-input {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  font-family: 'Kalam', cursive;
  font-size: 18px;
  color: #f8fafc;
}

.search-modal-input::placeholder {
  color: #64748b;
  font-family: 'Kalam', cursive;
}

.search-modal-kbd {
  font-family: 'Patrick Hand', cursive;
  font-size: 12px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 6px;
  padding: 2px 8px;
  color: #94a3b8;
  flex-shrink: 0;
}

.search-modal-close {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: #cbd5e1;
  font-size: 20px;
  line-height: 1;
  width: 30px;
  height: 30px;
  border-radius: 8px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  flex-shrink: 0;
}

.search-modal-close:hover {
  background: rgba(239, 68, 68, 0.2);
  color: #fca5a5;
  border-color: rgba(239, 68, 68, 0.4);
}

/* Filter Scope Tabs */
.search-modal-filters {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 10px 18px;
  background: rgba(0, 0, 0, 0.2);
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  overflow-x: auto;
}

.search-filter-chip {
  font-family: 'Patrick Hand', cursive;
  font-size: 13px;
  padding: 4px 12px;
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: #cbd5e1;
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.search-filter-chip:hover {
  background: rgba(255, 255, 255, 0.12);
  color: #f8fafc;
}

.search-filter-chip.active {
  background: #0284c7;
  border-color: #38bdf8;
  color: #ffffff;
  font-weight: bold;
  box-shadow: 0 0 10px rgba(56, 189, 248, 0.3);
}

/* Search Results Area */
.search-modal-results {
  flex: 1;
  overflow-y: auto;
  padding: 12px 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

/* Empty State / Suggestions */
.search-empty-state {
  text-align: center;
  padding: 36px 20px;
  color: #64748b;
  font-family: 'Patrick Hand', cursive;
  font-size: 16px;
}

.search-suggestions-title {
  font-size: 13px;
  color: #94a3b8;
  margin-bottom: 12px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.search-suggestions-tags {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
}

.suggestion-tag {
  font-family: 'Caveat', cursive;
  font-size: 16px;
  font-weight: 700;
  padding: 4px 12px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 8px;
  color: #38bdf8;
  cursor: pointer;
  transition: all 0.2s ease;
}

.suggestion-tag:hover {
  background: rgba(56, 189, 248, 0.15);
  border-color: #38bdf8;
  transform: translateY(-1px);
}

/* Individual Search Result Card */
.search-result-card {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 12px 14px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.2s ease;
  text-decoration: none;
  color: #f1f5f9;
}

.search-result-card:hover,
.search-result-card.selected {
  background: rgba(56, 189, 248, 0.12);
  border-color: #38bdf8;
  transform: translateX(4px);
  box-shadow: 0 4px 15px rgba(56, 189, 248, 0.15);
}

.search-result-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.search-result-notebook {
  font-family: 'Patrick Hand', cursive;
  font-size: 12px;
  display: flex;
  align-items: center;
  gap: 6px;
  color: #94a3b8;
}

.notebook-pill {
  padding: 2px 8px;
  border-radius: 10px;
  font-weight: bold;
}

.search-result-page-tag {
  font-family: 'Caveat', cursive;
  font-size: 14px;
  font-weight: 700;
  background: rgba(255, 255, 255, 0.08);
  padding: 1px 8px;
  border-radius: 10px;
  color: #cbd5e1;
}

.search-result-title {
  font-family: 'Caveat', cursive;
  font-size: 19px;
  font-weight: 700;
  color: #f8fafc;
  line-height: 1.2;
}

.search-result-snippet {
  font-family: 'Kalam', cursive;
  font-size: 14px;
  color: #94a3b8;
  line-height: 1.4;
  margin-top: 2px;
}

.search-result-snippet mark,
.drawer-matched-snippet mark {
  background: rgba(251, 191, 36, 0.35);
  color: #fef08a;
  padding: 1px 4px;
  border-radius: 3px;
  font-weight: bold;
  border: 1px solid rgba(251, 191, 36, 0.4);
}

/* Modal Footer */
.search-modal-footer {
  padding: 10px 18px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(0, 0, 0, 0.3);
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-family: 'Patrick Hand', cursive;
  font-size: 13px;
  color: #64748b;
}

.search-shortcuts {
  display: flex;
  align-items: center;
  gap: 12px;
}

.search-shortcuts span {
  display: flex;
  align-items: center;
  gap: 4px;
}

.search-shortcuts kbd {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 4px;
  padding: 1px 6px;
  font-size: 11px;
  color: #cbd5e1;
}

/* Live Matched Snippet inside Topic Sidenav Drawer */
.drawer-matched-snippet {
  margin-top: 6px;
  padding: 6px 8px;
  background: rgba(0, 0, 0, 0.3);
  border-radius: 6px;
  border-left: 2px solid #38bdf8;
  font-family: 'Kalam', cursive;
  font-size: 13px;
  color: #cbd5e1;
  line-height: 1.35;
}

/* Search Trigger Button in Topbar */
.topbar-search-btn {
  font-family: 'Caveat', cursive;
  font-size: 16px;
  font-weight: 700;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 8px;
  padding: 5px 12px;
  color: #cbd5e1;
  cursor: pointer;
  transition: all 0.2s ease;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.topbar-search-btn:hover {
  background: rgba(56, 189, 248, 0.18);
  border-color: #38bdf8;
  color: #38bdf8;
  transform: translateY(-1px);
}

.topbar-search-btn .kbd-hint {
  font-family: 'Patrick Hand', cursive;
  font-size: 11px;
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 4px;
  padding: 1px 5px;
  color: #94a3b8;
}

/* Hub Hero Search Box */
.hub-search-container {
  width: 100%;
  max-width: 600px;
  margin: 0 auto 36px;
}

.hub-search-box {
  display: flex;
  align-items: center;
  gap: 12px;
  background: rgba(15, 23, 42, 0.8);
  border: 2px solid rgba(56, 189, 248, 0.3);
  border-radius: 30px;
  padding: 12px 24px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4), 0 0 20px rgba(56, 189, 248, 0.15);
  cursor: pointer;
  transition: all 0.3s ease;
}

.hub-search-box:hover {
  border-color: #38bdf8;
  transform: translateY(-2px);
  box-shadow: 0 15px 40px rgba(0, 0, 0, 0.5), 0 0 30px rgba(56, 189, 248, 0.3);
}

.hub-search-icon {
  font-size: 22px;
  color: #38bdf8;
}

.hub-search-placeholder {
  font-family: 'Kalam', cursive;
  font-size: 18px;
  color: #94a3b8;
  flex: 1;
}

.hub-search-badge {
  font-family: 'Patrick Hand', cursive;
  font-size: 13px;
  background: rgba(56, 189, 248, 0.15);
  border: 1px solid rgba(56, 189, 248, 0.3);
  color: #7dd3fc;
  padding: 3px 10px;
  border-radius: 12px;
}

/* Responsive Mobile Layout for Search */
@media (max-width: 640px) {
  .search-modal-backdrop {
    padding: 16px 8px 10px;
    align-items: flex-start;
  }
  
  .search-modal-window {
    max-height: 92vh;
    border-radius: 12px;
  }

  .search-modal-header {
    padding: 12px 14px;
  }

  .search-modal-input {
    font-size: 16px;
  }

  .search-modal-kbd {
    display: none;
  }

  .topbar-search-btn .kbd-hint {
    display: none;
  }

  .search-modal-footer {
    display: none;
  }
}

/* =========================================
   CREATIVE SPATIAL GLASS TOPBAR & DOCK STYLES
   ========================================= */
header.topbar {
  width: 100%;
  background: rgba(10, 15, 29, 0.82) !important;
  backdrop-filter: blur(20px) saturate(180%) !important;
  -webkit-backdrop-filter: blur(20px) saturate(180%) !important;
  border-bottom: 1px solid rgba(255, 255, 255, 0.12) !important;
  padding: 8px 22px !important;
  display: flex !important;
  align-items: center !important;
  justify-content: space-between !important;
  position: sticky !important;
  top: 0 !important;
  z-index: 100 !important;
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.35) !important;
}

/* Reading Progress Bar pinned to topbar */
.topbar-progress-track {
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 2.5px;
  background: rgba(255, 255, 255, 0.05);
  overflow: hidden;
}

.topbar-progress-bar {
  height: 100%;
  width: 16.66%;
  background: linear-gradient(90deg, #38bdf8, #818cf8, #ec4899);
  box-shadow: 0 0 10px rgba(56, 189, 248, 0.8);
  transition: width 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.topbar-left {
  display: flex !important;
  align-items: center !important;
  gap: 10px !important;
}

/* Drawer Toggle & Hub Link Capsule Buttons */
.drawer-toggle-btn {
  font-family: 'Caveat', cursive !important;
  font-size: 16px !important;
  font-weight: 700 !important;
  background: rgba(56, 189, 248, 0.15) !important;
  border: 1px solid rgba(56, 189, 248, 0.35) !important;
  color: #e0f2fe !important;
  border-radius: 9999px !important;
  padding: 5px 14px !important;
  cursor: pointer !important;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1) !important;
  display: inline-flex !important;
  align-items: center !important;
  gap: 6px !important;
  box-shadow: 0 2px 10px rgba(56, 189, 248, 0.15) !important;
}

.drawer-toggle-btn:hover {
  background: rgba(56, 189, 248, 0.28) !important;
  border-color: #38bdf8 !important;
  color: #fff !important;
  transform: translateY(-1px) scale(1.03) !important;
  box-shadow: 0 4px 18px rgba(56, 189, 248, 0.3) !important;
}

.home-link-btn {
  font-family: 'Caveat', cursive !important;
  font-size: 16px !important;
  font-weight: 700 !important;
  background: rgba(255, 255, 255, 0.08) !important;
  border: 1px solid rgba(255, 255, 255, 0.15) !important;
  color: #f1f5f9 !important;
  border-radius: 9999px !important;
  padding: 5px 13px !important;
  text-decoration: none !important;
  display: inline-flex !important;
  align-items: center !important;
  gap: 6px !important;
  transition: all 0.2s ease !important;
}

.home-link-btn:hover {
  background: rgba(255, 255, 255, 0.16) !important;
  border-color: rgba(255, 255, 255, 0.3) !important;
  color: #fff !important;
  transform: translateY(-1px) !important;
}

.topbar-title {
  font-family: 'Caveat', cursive !important;
  font-size: 23px !important;
  font-weight: 700 !important;
  color: #f8fafc !important;
  letter-spacing: 0.4px !important;
  display: flex !important;
  align-items: center !important;
  gap: 8px !important;
}

.author-pill {
  font-family: 'Patrick Hand', cursive !important;
  font-size: 13px !important;
  font-weight: normal !important;
  background: rgba(255, 255, 255, 0.06) !important;
  color: #94a3b8 !important;
  padding: 2px 9px !important;
  border-radius: 9999px !important;
  border: 1px solid rgba(255, 255, 255, 0.1) !important;
}

/* Unified Segmented Center Pagination Dock */
.topbar-center {
  display: inline-flex !important;
  align-items: center !important;
  background: rgba(15, 23, 42, 0.75) !important;
  backdrop-filter: blur(12px) !important;
  -webkit-backdrop-filter: blur(12px) !important;
  border: 1px solid rgba(255, 255, 255, 0.14) !important;
  border-radius: 9999px !important;
  padding: 3px 6px !important;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3), inset 0 1px 0 rgba(255, 255, 255, 0.08) !important;
  gap: 2px !important;
}

.topbar-center .nav-btn {
  background: transparent !important;
  border: none !important;
  color: #f8fafc !important;
  font-family: 'Caveat', cursive !important;
  font-size: 18px !important;
  font-weight: 700 !important;
  padding: 4px 12px !important;
  border-radius: 9999px !important;
  cursor: pointer !important;
  transition: all 0.2s ease !important;
  display: inline-flex !important;
  align-items: center !important;
}

.topbar-center .nav-btn:hover:not(:disabled) {
  background: rgba(255, 255, 255, 0.14) !important;
  color: #38bdf8 !important;
  transform: scale(1.05) !important;
}

.topbar-center .nav-btn:disabled {
  opacity: 0.3 !important;
  cursor: not-allowed !important;
}

.topbar-center .page-indicator {
  font-family: 'Patrick Hand', cursive !important;
  font-size: 14px !important;
  color: #e2e8f0 !important;
  padding: 0 12px !important;
  font-weight: bold !important;
  border-left: 1px solid rgba(255, 255, 255, 0.1) !important;
  border-right: 1px solid rgba(255, 255, 255, 0.1) !important;
  white-space: nowrap !important;
}

/* Right Section Action Buttons */
.topbar-right {
  display: flex !important;
  align-items: center !important;
  gap: 10px !important;
}

.topbar-search-btn {
  font-family: 'Caveat', cursive !important;
  font-size: 17px !important;
  font-weight: 700 !important;
  background: rgba(255, 255, 255, 0.08) !important;
  border: 1px solid rgba(255, 255, 255, 0.15) !important;
  border-radius: 9999px !important;
  padding: 5px 14px !important;
  color: #f8fafc !important;
  cursor: pointer !important;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1) !important;
  display: inline-flex !important;
  align-items: center !important;
  gap: 8px !important;
}

.topbar-search-btn:hover {
  background: rgba(56, 189, 248, 0.2) !important;
  border-color: rgba(56, 189, 248, 0.5) !important;
  color: #38bdf8 !important;
  transform: translateY(-1px) scale(1.02) !important;
  box-shadow: 0 0 16px rgba(56, 189, 248, 0.35) !important;
}

.topbar-right .pdf-btn {
  font-family: 'Caveat', cursive !important;
  font-size: 17px !important;
  font-weight: 700 !important;
  background: linear-gradient(135deg, rgba(245, 158, 11, 0.2), rgba(239, 68, 68, 0.2)) !important;
  border: 1px solid rgba(245, 158, 11, 0.4) !important;
  color: #fde047 !important;
  border-radius: 9999px !important;
  padding: 5px 14px !important;
  cursor: pointer !important;
  transition: all 0.2s ease !important;
  box-shadow: 0 2px 10px rgba(245, 158, 11, 0.15) !important;
}

.topbar-right .pdf-btn:hover {
  background: linear-gradient(135deg, rgba(245, 158, 11, 0.4), rgba(239, 68, 68, 0.4)) !important;
  border-color: #f59e0b !important;
  color: #fff !important;
  transform: translateY(-1px) scale(1.02) !important;
  box-shadow: 0 4px 18px rgba(245, 158, 11, 0.35) !important;
}

/* Mobile responsive topbar adjustments */
@media (max-width: 900px) {
  .author-pill {
    display: none !important;
  }
}

@media (max-width: 768px) {
  header.topbar {
    padding: 8px 12px !important;
    gap: 8px !important;
  }

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

  .topbar-center .page-indicator {
    padding: 0 6px !important;
    font-size: 13px !important;
  }

  .topbar-center .nav-btn {
    padding: 3px 8px !important;
    font-size: 16px !important;
  }
}

/* =========================================
   IN-PAGE SEARCH HIGHLIGHT (on notebook content)
   ========================================= */
mark.page-search-highlight {
  background: rgba(251, 191, 36, 0.5);
  color: inherit;
  padding: 2px 4px;
  border-radius: 4px;
  border: 2px solid #fbbf24;
  box-shadow: 0 0 12px rgba(251, 191, 36, 0.6), 0 0 4px rgba(251, 191, 36, 0.3);
  animation: highlightPulse 1.5s ease-in-out 2;
  font-weight: bold;
}

@keyframes highlightPulse {
  0%, 100% { box-shadow: 0 0 12px rgba(251, 191, 36, 0.6); }
  50% { box-shadow: 0 0 24px rgba(251, 191, 36, 0.9), 0 0 8px rgba(251, 191, 36, 0.5); }
}

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

/* =========================================
   UNIVERSAL THEME SWITCHER & PALETTES
   ========================================= */

/* Topbar Theme Switcher Pill */
.topbar-theme-wrapper {
  position: relative;
  display: inline-flex;
}

.topbar-theme-btn {
  font-family: 'Caveat', cursive !important;
  font-size: 17px !important;
  font-weight: 700 !important;
  background: rgba(255, 255, 255, 0.08) !important;
  border: 1px solid rgba(255, 255, 255, 0.15) !important;
  border-radius: 9999px !important;
  padding: 5px 13px !important;
  color: #f8fafc !important;
  cursor: pointer !important;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1) !important;
  display: inline-flex !important;
  align-items: center !important;
  gap: 6px !important;
}

.topbar-theme-btn:hover {
  background: rgba(168, 85, 247, 0.22) !important;
  border-color: rgba(168, 85, 247, 0.5) !important;
  color: #d8b4fe !important;
  transform: translateY(-1px) scale(1.02) !important;
  box-shadow: 0 0 16px rgba(168, 85, 247, 0.35) !important;
}

.theme-active-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  display: inline-block;
  box-shadow: 0 0 8px currentColor;
}

/* Theme Dropdown Popover */
.theme-popover-menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  background: linear-gradient(180deg, #0f172a 0%, #090d16 100%);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 16px;
  padding: 8px;
  min-width: 220px;
  box-shadow: 0 20px 45px rgba(0, 0, 0, 0.65), 0 0 25px rgba(168, 85, 247, 0.2);
  z-index: 1000;
  display: none;
  flex-direction: column;
  gap: 4px;
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  animation: popoverFadeIn 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.theme-popover-menu.open {
  display: flex;
}

@keyframes popoverFadeIn {
  from { opacity: 0; transform: translateY(-8px) scale(0.95); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.theme-popover-title {
  font-family: 'Patrick Hand', cursive;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: #94a3b8;
  padding: 4px 10px 6px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  margin-bottom: 2px;
}

.theme-option-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.2s ease;
  font-family: 'Patrick Hand', cursive;
  font-size: 15px;
  color: #cbd5e1;
  border: 1px solid transparent;
}

.theme-option-item:hover {
  background: rgba(255, 255, 255, 0.08);
  color: #f8fafc;
}

.theme-option-item.active {
  background: rgba(168, 85, 247, 0.2);
  border-color: rgba(168, 85, 247, 0.4);
  color: #ffffff;
  font-weight: bold;
}

.theme-option-left {
  display: flex;
  align-items: center;
  gap: 10px;
}

.theme-swatch-circle {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.3);
  flex-shrink: 0;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.4);
}

.theme-check-icon {
  font-size: 14px;
  color: #a855f7;
  display: none;
}

.theme-option-item.active .theme-check-icon {
  display: block;
}

/* Topic Drawer Theme Selector Grid */
.drawer-theme-section {
  padding: 12px 16px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.drawer-theme-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: 8px;
}

.drawer-theme-card {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  cursor: pointer;
  transition: all 0.2s ease;
  font-family: 'Patrick Hand', cursive;
  font-size: 13px;
  color: #cbd5e1;
}

.drawer-theme-card:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.2);
  color: #fff;
}

.drawer-theme-card.active {
  background: rgba(168, 85, 247, 0.25);
  border-color: rgba(168, 85, 247, 0.6);
  color: #fff;
  font-weight: bold;
}

/* =========================================
   THEME PALETTE OVERRIDES:
   1. [data-theme="warm-paper"] (Classic Default)
   2. [data-theme="dark"] (Dark Obsidian / Chalkboard)
   3. [data-theme="sepia"] (Vintage Sepia Parchment)
   4. [data-theme="blueprint"] (Tech Blueprint Grid)
   ========================================= */

/* --- 1. CLASSIC WARM PAPER --- */
html[data-theme="warm-paper"], body[data-theme="warm-paper"] {
  --paper-bg: #fdfbf7;
  --paper-lines: rgba(180, 160, 130, 0.28);
  --paper-margin-line: rgba(220, 38, 38, 0.25);
  --ink-dark: #1e293b;
  --ink-medium: #334155;
  --hole-bg: #1e293b;
  --spiral-metal: #78716c;
  --spiral-ring: #d6d3d1;
}

/* --- 2. DARK OBSIDIAN / CHALKBOARD --- */
html[data-theme="dark"], body[data-theme="dark"] {
  --paper-bg: #0f172a;
  --paper-lines: rgba(255, 255, 255, 0.08);
  --paper-margin-line: rgba(244, 63, 94, 0.35);
  --hole-bg: #020617;
  --spiral-metal: #475569;
  --spiral-ring: #64748b;
  --ink-dark: #f8fafc;
  --ink-medium: #cbd5e1;
  --ink-blue: #38bdf8;
  --ink-red: #f43f5e;
  --ink-green: #34d399;
  --ink-yellow: #fbbf24;
  --ink-purple: #c084fc;
  --blue: #38bdf8;
  --red: #f43f5e;
  --green: #34d399;
  --yellow: #fbbf24;
  --purple: #c084fc;
  --bg-blue: rgba(56, 189, 248, 0.15);
  --bg-red: rgba(244, 63, 94, 0.15);
  --bg-green: rgba(52, 211, 153, 0.15);
  --bg-yellow: rgba(251, 191, 36, 0.15);
  --bg-purple: rgba(192, 132, 252, 0.15);
}

html[data-theme="dark"] .notebook-page,
body[data-theme="dark"] .notebook-page {
  background-color: #0f172a !important;
  color: #f8fafc !important;
  border: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.7), 0 0 30px rgba(56, 189, 248, 0.1) !important;
}

html[data-theme="dark"] .notebook-inner,
body[data-theme="dark"] .notebook-inner {
  background-image: 
    linear-gradient(90deg, transparent 56px, rgba(244, 63, 94, 0.35) 56px, rgba(244, 63, 94, 0.35) 58px, transparent 58px),
    linear-gradient(rgba(255, 255, 255, 0.08) 1px, transparent 1px) !important;
}

/* Dark mode card, diagram & table cell translucency */
html[data-theme="dark"] .feature-card,
html[data-theme="dark"] .remember-box,
html[data-theme="dark"] .tip-box,
html[data-theme="dark"] .diagram-box,
html[data-theme="dark"] .section-block,
html[data-theme="dark"] .compare-table,
html[data-theme="dark"] .timeline-card,
html[data-theme="dark"] .definition-card,
html[data-theme="dark"] .step-card,
html[data-theme="dark"] .rule-card,
html[data-theme="dark"] .flow-node,
html[data-theme="dark"] .arch-node,
html[data-theme="dark"] .summary-card {
  background-color: rgba(30, 41, 59, 0.85) !important;
  border-color: rgba(255, 255, 255, 0.15) !important;
  color: #f8fafc !important;
}

html[data-theme="dark"] .compare-cell,
html[data-theme="dark"] .compare-row,
html[data-theme="dark"] th,
html[data-theme="dark"] td {
  border-color: rgba(255, 255, 255, 0.1) !important;
  color: #f8fafc !important;
}

html[data-theme="dark"] p,
html[data-theme="dark"] li,
html[data-theme="dark"] .handwritten-dark-text,
html[data-theme="dark"] .col-left,
html[data-theme="dark"] .col-right {
  color: #f1f5f9 !important;
}

html[data-theme="dark"] .page-footer {
  color: #64748b !important;
}

/* --- 3. VINTAGE SEPIA PARCHMENT --- */
html[data-theme="sepia"], body[data-theme="sepia"] {
  --paper-bg: #f4ebd0;
  --paper-lines: rgba(160, 130, 90, 0.25);
  --paper-margin-line: rgba(180, 80, 50, 0.3);
  --hole-bg: #1c140c;
  --spiral-metal: #8c7355;
  --spiral-ring: #b8a287;
  --ink-dark: #2c1d11;
  --ink-medium: #4a3728;
  --ink-blue: #1c528a;
  --ink-red: #a82020;
  --ink-green: #2d663b;
  --ink-yellow: #a86208;
  --ink-purple: #5c357a;
  --blue: #1c528a;
  --red: #a82020;
  --green: #2d663b;
  --yellow: #a86208;
  --purple: #5c357a;
}

html[data-theme="sepia"] .notebook-page,
body[data-theme="sepia"] .notebook-page {
  background-color: #f4ebd0 !important;
  color: #2c1d11 !important;
  box-shadow: 0 20px 50px rgba(44, 29, 17, 0.45) !important;
}

html[data-theme="sepia"] .notebook-inner,
body[data-theme="sepia"] .notebook-inner {
  background-image: 
    linear-gradient(90deg, transparent 56px, rgba(180, 80, 50, 0.3) 56px, rgba(180, 80, 50, 0.3) 58px, transparent 58px),
    linear-gradient(rgba(160, 130, 90, 0.25) 1px, transparent 1px) !important;
}

html[data-theme="sepia"] .feature-card,
html[data-theme="sepia"] .remember-box,
html[data-theme="sepia"] .tip-box,
html[data-theme="sepia"] .diagram-box,
html[data-theme="sepia"] .compare-table {
  background-color: rgba(255, 250, 235, 0.85) !important;
  border-color: rgba(160, 130, 90, 0.3) !important;
  color: #2c1d11 !important;
}

/* --- 4. TECH BLUEPRINT GRID --- */
html[data-theme="blueprint"], body[data-theme="blueprint"] {
  --paper-bg: #09223e;
  --paper-lines: rgba(56, 189, 248, 0.16);
  --paper-margin-line: rgba(56, 189, 248, 0.45);
  --hole-bg: #030b14;
  --spiral-metal: #1e3a5f;
  --spiral-ring: #38bdf8;
  --ink-dark: #f0f9ff;
  --ink-medium: #bae6fd;
  --ink-blue: #38bdf8;
  --ink-red: #fb7185;
  --ink-green: #4ade80;
  --ink-yellow: #fde047;
  --ink-purple: #a78bfa;
  --blue: #38bdf8;
  --red: #fb7185;
  --green: #4ade80;
  --yellow: #fde047;
  --purple: #a78bfa;
  --bg-blue: rgba(56, 189, 248, 0.18);
  --bg-red: rgba(251, 113, 133, 0.18);
  --bg-green: rgba(74, 222, 128, 0.18);
  --bg-yellow: rgba(253, 224, 71, 0.18);
  --bg-purple: rgba(167, 139, 250, 0.18);
}

html[data-theme="blueprint"] .notebook-page,
body[data-theme="blueprint"] .notebook-page {
  background-color: #09223e !important;
  color: #f0f9ff !important;
  border: 1px solid rgba(56, 189, 248, 0.3);
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.8), 0 0 35px rgba(56, 189, 248, 0.2) !important;
}

html[data-theme="blueprint"] .notebook-inner,
body[data-theme="blueprint"] .notebook-inner {
  background-image: 
    linear-gradient(90deg, transparent 56px, rgba(56, 189, 248, 0.45) 56px, rgba(56, 189, 248, 0.45) 58px, transparent 58px),
    linear-gradient(rgba(56, 189, 248, 0.16) 1px, transparent 1px) !important;
}

html[data-theme="blueprint"] .feature-card,
html[data-theme="blueprint"] .remember-box,
html[data-theme="blueprint"] .tip-box,
html[data-theme="blueprint"] .diagram-box,
html[data-theme="blueprint"] .compare-table {
  background-color: rgba(15, 35, 60, 0.9) !important;
  border-color: rgba(56, 189, 248, 0.3) !important;
  color: #f0f9ff !important;
}

html[data-theme="blueprint"] p,
html[data-theme="blueprint"] li,
html[data-theme="blueprint"] .handwritten-dark-text,
html[data-theme="blueprint"] .col-left,
html[data-theme="blueprint"] .col-right {
  color: #e0f2fe !important;
}
