/* ==========================================================================
   DSSSB Junior Scientific Assistant (Cyber Forensic) - 3D Digital Textbook
   Styles: Academic Bookbinding, Upright 3D Transforms, Multi-Theme, Layout
   ========================================================================== */

:root {
  --font-title: 'Cinzel', serif;
  --font-body: 'Crimson Pro', Georgia, serif;
  --font-ui: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;

  /* Parchment Theme (Default) */
  --bg-app: #e9ecef;
  --bg-app-gradient: radial-gradient(circle at 50% 20%, #f7f9fa 0%, #d5dde5 100%);
  --book-cover-leather: #3b1d11;
  --page-bg: #faf7f0;
  --page-bg-subtle: #f3ede2;
  --page-border: #4a3728;
  --text-main: #2b221b;
  --text-muted: #6b5c50;
  --text-heading: #1c140e;
  --accent-color: #8c2d19;
  --accent-hover: #b23b20;
  --accent-gold: #c29033;
  --spine-shadow: rgba(0, 0, 0, 0.45);
  --page-shadow: rgba(30, 20, 15, 0.3);
  --header-bg: rgba(255, 255, 255, 0.9);
  --ui-border: #d0c7b8;
  --ui-btn-bg: #ffffff;
  --ui-btn-text: #2b221b;
  --bg-card: #ffffff;
  --ui-header-bg: #f8fafc;
  
  --badge-it: #1d4ed8;
  --badge-it-bg: #eff6ff;
  --badge-bns: #b45309;
  --badge-bns-bg: #fffbeb;
  --badge-penalty: #b91c1c;
  --badge-penalty-bg: #fef2f2;
}

/* Theme: Crisp White Paper */
body.theme-white {
  --bg-app: #f1f5f9;
  --bg-app-gradient: radial-gradient(circle at 50% 20%, #ffffff 0%, #cbd5e1 100%);
  --book-cover-leather: #0f172a;
  --page-bg: #ffffff;
  --page-bg-subtle: #f8fafc;
  --page-border: #334155;
  --text-main: #1e293b;
  --text-muted: #64748b;
  --text-heading: #0f172a;
  --accent-color: #0369a1;
  --accent-hover: #0284c7;
  --accent-gold: #b45309;
  --spine-shadow: rgba(0, 0, 0, 0.35);
  --page-shadow: rgba(15, 23, 42, 0.25);
  --header-bg: rgba(255, 255, 255, 0.95);
  --ui-border: #cbd5e1;
  --ui-btn-bg: #ffffff;
  --ui-btn-text: #1e293b;
  --bg-card: #ffffff;
  --ui-header-bg: #f8fafc;
}

/* Theme: Dark Forensic Mode */
body.theme-dark {
  --bg-app: #0b1120;
  --bg-app-gradient: radial-gradient(circle at 50% 20%, #1e293b 0%, #030712 100%);
  --book-cover-leather: #020617;
  --page-bg: #1e293b;
  --page-bg-subtle: #131c2e;
  --page-border: #475569;
  --text-main: #e2e8f0;
  --text-muted: #94a3b8;
  --text-heading: #f8fafc;
  --accent-color: #38bdf8;
  --accent-hover: #0284c7;
  --accent-gold: #f59e0b;
  --spine-shadow: rgba(0, 0, 0, 0.85);
  --page-shadow: rgba(0, 0, 0, 0.7);
  --header-bg: rgba(15, 23, 42, 0.95);
  --ui-border: #334155;
  --ui-btn-bg: #1e293b;
  --ui-btn-text: #f1f5f9;
  --bg-card: #0f172a;
  --ui-header-bg: #1e293b;

  --badge-it-bg: #1e3a8a;
  --badge-it: #93c5fd;
  --badge-bns-bg: #78350f;
  --badge-bns: #fcd34d;
  --badge-penalty-bg: #7f1d1d;
  --badge-penalty: #fca5a5;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: var(--font-body);
  background: var(--bg-app-gradient);
  color: var(--text-main);
  height: 100vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  user-select: text;
  transition: background 0.3s ease, color 0.3s ease;
}

/* ==========================================================================
   Top Header Navigation Bar
   ========================================================================== */
.app-header {
  height: 52px;
  background: var(--header-bg);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--ui-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 10px;
  position: relative;
  z-index: 100;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
  gap: 8px;
  white-space: nowrap;
  overflow: hidden;
  max-height: 52px;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

/* Hide redundant title in navbar to prevent collision with search & action tools */
.book-meta {
  display: none !important;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 5px;
  flex-shrink: 0;
}

.btn-icon,
.btn-tool,
.btn-nav {
  font-family: var(--font-ui);
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  background: var(--ui-btn-bg);
  color: var(--ui-btn-text);
  border: 1px solid var(--ui-border);
  border-radius: 6px;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-icon:hover,
.btn-tool:hover,
.btn-nav:hover {
  background: var(--accent-color);
  color: #fff;
  border-color: var(--accent-color);
}

.badge-exam {
  font-family: var(--font-ui);
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  background: var(--accent-color);
  color: #fff;
  padding: 2px 8px;
  border-radius: 4px;
  letter-spacing: 0.5px;
}

.book-title-short {
  font-family: var(--font-title);
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text-heading);
}

/* Search Box - flexible and responsive */
.search-box {
  position: relative;
  flex: 0 1 200px;
  min-width: 90px;
  max-width: 220px;
  display: flex;
  align-items: center;
  margin: 0 4px;
}

.search-box svg {
  position: absolute;
  left: 10px;
  color: var(--text-muted);
  pointer-events: none;
}

.search-box input {
  font-family: var(--font-ui);
  width: 100%;
  padding: 6px 30px 6px 32px;
  background: var(--ui-btn-bg);
  border: 1px solid var(--ui-border);
  border-radius: 20px;
  font-size: 0.85rem;
  color: var(--text-main);
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.search-box input:focus {
  border-color: var(--accent-color);
  box-shadow: 0 0 0 3px rgba(140, 45, 25, 0.15);
}

.btn-clear {
  position: absolute;
  right: 10px;
  background: none;
  border: none;
  font-size: 1.1rem;
  cursor: pointer;
  color: var(--text-muted);
}

.search-dropdown {
  position: absolute;
  top: 38px;
  left: 0;
  width: 100%;
  max-height: 380px;
  overflow-y: auto;
  background: var(--ui-btn-bg);
  border: 1px solid var(--ui-border);
  border-radius: 8px;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.15);
  z-index: 200;
}

.search-item {
  font-family: var(--font-ui);
  padding: 8px 12px;
  border-bottom: 1px solid var(--ui-border);
  cursor: pointer;
  transition: background 0.15s;
}

.search-item:hover {
  background: var(--page-bg-subtle);
}

.search-item-title {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--accent-color);
  display: flex;
  justify-content: space-between;
}

.search-item-snippet {
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-top: 2px;
  line-height: 1.3;
}

.hidden {
  display: none !important;
}

/* ==========================================================================
   Main Reading Stage & 3D Upright Book Architecture
   ========================================================================== */
.reading-stage {
  flex: 1;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 12px 10px;
  overflow: hidden;
  perspective: 1800px;
}

.book-wrapper {
  position: relative;
  display: flex;
  justify-content: center;
  align-items: center;
  width: 100%;
  max-width: 1020px;
}

.book-hardcover-shadow {
  position: absolute;
  width: min(1000px, 96vw);
  height: min(680px, 83vh);
  background: var(--book-cover-leather);
  border-radius: 10px;
  box-shadow: 0 30px 60px var(--page-shadow), 0 10px 20px rgba(0, 0, 0, 0.25), inset 0 0 30px rgba(0,0,0,0.7);
  transform: translateZ(-12px);
  border: 1px solid rgba(255, 255, 255, 0.15);
}

/* Book Container */
.book.upright {
  position: relative;
  width: min(1000px, 95vw);
  height: min(680px, 83vh);
  perspective: 1800px;
  perspective-origin: 50% 50%;
  transform-style: preserve-3d;
  cursor: pointer;
}

/* Page Stacks */
.page-stack {
  position: absolute;
  top: 0;
  width: 50%;
  height: 100%;
  transform-style: preserve-3d;
}

.left-stack {
  right: 50%;
  transform-origin: right center;
  transform: rotateY(2deg);
}

.right-stack {
  left: 50%;
  transform-origin: left center;
  transform: rotateY(-2deg);
}

/* Central Book Spine */
.gap {
  position: absolute;
  top: 0;
  left: calc(50% - 2px);
  width: 4px;
  height: 100%;
  background: linear-gradient(to right, rgba(0, 0, 0, 0.2), rgba(0, 0, 0, 0.04) 50%, rgba(0, 0, 0, 0.2));
  z-index: 50;
  pointer-events: none;
}

/* Active Readable Pages */
.page-active {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: var(--page-bg);
  border: 1px solid var(--page-border);
  box-shadow: inset 0 0 18px rgba(0, 0, 0, 0.04);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.left-page {
  border-right: none;
  border-radius: 4px 0 0 4px;
}

.right-page {
  border-left: none;
  border-radius: 0 4px 4px 0;
}

/* Inner Page Typesetting & Content Container */
.page-content {
  width: 100%;
  height: 100%;
  padding: 16px 20px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  overflow: hidden !important;
  scrollbar-width: none;
  box-sizing: border-box;
}

.page-content::-webkit-scrollbar {
  display: none;
}

.left-page .page-content {
  padding: 16px 18px 16px 22px;
}

.right-page .page-content {
  padding: 16px 22px 16px 18px;
}

/* Header Running Head */
.page-running-head {
  font-family: var(--font-ui);
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--text-muted);
  border-bottom: 1px solid var(--ui-border);
  padding-bottom: 3px;
  margin-bottom: 8px;
  display: flex;
  justify-content: space-between;
  word-break: normal;
  flex-shrink: 0;
}

/* Content Body Typography */
.page-body {
  flex: 1 1 auto;
  min-height: 0;
  font-size: 0.83rem;
  line-height: 1.39;
  color: var(--text-main);
  overflow-y: auto !important;
  overflow-x: hidden !important;
  overflow-wrap: break-word;
  scrollbar-width: thin;
  scrollbar-color: rgba(100, 116, 139, 0.45) rgba(0, 0, 0, 0.04);
  padding-right: 6px;
  scroll-behavior: smooth;
}

.page-body::-webkit-scrollbar {
  width: 6px;
}

.page-body::-webkit-scrollbar-track {
  background: rgba(0, 0, 0, 0.05);
  border-radius: 4px;
}

.page-body::-webkit-scrollbar-thumb {
  background: rgba(100, 116, 139, 0.4);
  border-radius: 4px;
}

.page-body::-webkit-scrollbar-thumb:hover {
  background: rgba(100, 116, 139, 0.75);
}

body[data-active-book="book2"] .page-body {
  scrollbar-color: rgba(2, 132, 199, 0.5) rgba(0, 0, 0, 0.04);
}
body[data-active-book="book2"] .page-body::-webkit-scrollbar-thumb {
  background: rgba(2, 132, 199, 0.5);
}

body[data-active-book="book3"] .page-body {
  scrollbar-color: rgba(124, 58, 237, 0.5) rgba(0, 0, 0, 0.04);
}
body[data-active-book="book3"] .page-body::-webkit-scrollbar-thumb {
  background: rgba(124, 58, 237, 0.5);
}

body[data-active-book="book4"] .page-body {
  scrollbar-color: rgba(5, 150, 105, 0.5) rgba(0, 0, 0, 0.04);
}
body[data-active-book="book4"] .page-body::-webkit-scrollbar-thumb {
  background: rgba(5, 150, 105, 0.5);
}

body[data-active-book="book5"] .page-body {
  scrollbar-color: rgba(217, 119, 6, 0.5) rgba(0, 0, 0, 0.04);
}
body[data-active-book="book5"] .page-body::-webkit-scrollbar-thumb {
  background: rgba(217, 119, 6, 0.5);
}

.page-body h1, .page-body h2, .page-body h3 {
  font-family: var(--font-title);
  color: var(--text-heading);
  line-height: 1.2;
}

.page-body h1 {
  font-size: 1.18rem;
  color: var(--accent-color);
  border-bottom: 1px solid var(--accent-color);
  padding-bottom: 2px;
  margin-top: 0;
  margin-bottom: 6px;
}

.page-body h2 {
  font-size: 1.02rem;
  margin-top: 6px;
  margin-bottom: 4px;
}

.page-body h3 {
  font-size: 0.9rem;
  font-weight: 700;
  margin-top: 5px;
  margin-bottom: 3px;
}

.page-body p {
  margin-bottom: 5px;
  text-align: justify;
}

.page-body ul, .page-body ol {
  margin-left: 16px;
  margin-bottom: 5px;
}

.page-body li {
  margin-bottom: 3px;
}

/* Badges for IT Act, BNS, & Penalties */
.sec-badge {
  font-family: var(--font-ui);
  font-size: 0.75rem;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 3px;
  display: inline-block;
  margin-right: 4px;
}

.sec-badge.it-act {
  background: var(--badge-it-bg);
  color: var(--badge-it);
  border: 1px solid var(--badge-it);
}

.sec-badge.bns {
  background: var(--badge-bns-bg);
  color: var(--badge-bns);
  border: 1px solid var(--badge-bns);
}

.sec-badge.penalty {
  background: var(--badge-penalty-bg);
  color: var(--badge-penalty);
  border: 1px solid var(--badge-penalty);
}

/* Academic Tables inside Book */
.book-table {
  width: 100%;
  border-collapse: collapse;
  font-family: var(--font-ui);
  font-size: 0.78rem;
  margin: 8px 0;
  background: var(--page-bg-subtle);
  border: 1px solid var(--ui-border);
}

.book-table th {
  background: var(--page-border);
  color: #fff;
  padding: 5px 8px;
  text-align: left;
  font-weight: 600;
}

.book-table td {
  padding: 5px 8px;
  border: 1px solid var(--ui-border);
  line-height: 1.3;
}

/* Academic Callouts / Alerts */
.book-callout {
  font-size: 0.85rem;
  padding: 8px 12px;
  border-left: 3px solid var(--accent-color);
  background: var(--page-bg-subtle);
  margin: 8px 0;
  border-radius: 0 4px 4px 0;
}

.book-callout.case {
  border-left-color: #d97706;
}

.book-callout strong {
  color: var(--text-heading);
}

/* Audio Player Button State */
.btn-audio {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: var(--ui-btn-bg);
  color: var(--accent-color);
  border-color: var(--accent-color);
}

.btn-audio.active {
  background: #b45309 !important;
  color: #ffffff !important;
  border-color: #b45309 !important;
  animation: audioPulse 1.4s infinite ease-in-out;
}

@keyframes audioPulse {
  0% { box-shadow: 0 0 0 0 rgba(180, 83, 9, 0.6); }
  70% { box-shadow: 0 0 0 8px rgba(180, 83, 9, 0); }
  100% { box-shadow: 0 0 0 0 rgba(180, 83, 9, 0); }
}

/* Multimedia Book Figures */
.book-figure {
  margin: 6px 0;
  border-radius: 6px;
  overflow: hidden;
  border: 1px solid var(--ui-border);
  background: var(--page-bg-subtle);
}

.book-figure img {
  width: 100%;
  height: 125px;
  object-fit: cover;
  display: block;
}

.book-figure-caption {
  font-family: var(--font-ui);
  font-size: 0.68rem;
  padding: 3px 8px;
  color: var(--text-muted);
  background: var(--page-bg-subtle);
  border-top: 1px solid var(--ui-border);
  display: flex;
  justify-content: space-between;
}

/* Custom Forensic Visual SVG Diagrams */
.forensic-diagram {
  margin: 6px 0;
  border-radius: 6px;
  overflow: hidden;
  border: 1px solid var(--ui-border);
  background: var(--page-bg-subtle);
  padding: 6px;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.04);
}

.forensic-diagram svg {
  width: 100%;
  height: auto;
  max-height: 140px;
  display: block;
  margin: 0 auto;
}

.forensic-diagram .diagram-caption {
  font-family: var(--font-ui);
  font-size: 0.68rem;
  font-weight: 700;
  color: var(--text-heading);
  margin-top: 4px;
  text-align: center;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
}

/* Landmark Case Law Structured Card */
.case-card {
  background: var(--page-bg-subtle);
  border-left: 3px solid #b45309;
  border-radius: 0 5px 5px 0;
  padding: 6px 10px;
  margin: 6px 0;
  font-size: 0.79rem;
  line-height: 1.34;
}

.case-card-header {
  font-family: var(--font-ui);
  font-weight: 700;
  font-size: 0.82rem;
  color: #92400e;
  display: flex;
  justify-content: space-between;
  margin-bottom: 2px;
}

.case-card-badge {
  background: #fef3c7;
  color: #92400e;
  border: 1px solid #f59e0b;
  font-size: 0.68rem;
  padding: 1px 5px;
  border-radius: 3px;
  font-weight: 700;
}

/* Real-World Scenario Card */
.scenario-card {
  background: var(--page-bg-subtle);
  border-left: 3px solid #0369a1;
  border-radius: 0 5px 5px 0;
  padding: 6px 10px;
  margin: 6px 0;
  font-size: 0.79rem;
  line-height: 1.34;
}

.scenario-title {
  font-family: var(--font-ui);
  font-weight: 700;
  font-size: 0.82rem;
  color: #0369a1;
  margin-bottom: 2px;
}

/* Audio active reading highlight */
.page-body.audio-reading-active {
  background: rgba(180, 83, 9, 0.03);
  border-radius: 4px;
}

/* Page Footer with Page Number */
.page-footer {
  font-family: var(--font-ui);
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-muted);
  border-top: 1px solid var(--ui-border);
  padding-top: 4px;
  margin-top: 6px;
  display: flex;
  justify-content: space-between;
  flex-shrink: 0;
}

/* ==========================================================================
   Realistic 3D Content-Bearing Turning Leaf
   Carries the rendered HTML of outgoing and incoming pages during the turn
   ========================================================================== */
.turning-leaf {
  display: none;
  position: absolute;
  top: 0;
  left: 50%;
  width: 50%;
  height: 100%;
  transform-style: preserve-3d;
  pointer-events: none;
  z-index: 70;
}

.turning-leaf.active {
  display: block !important;
}

.turning-leaf.turn-forward {
  transform-origin: left center;
  animation: flipForward3D 0.7s cubic-bezier(0.25, 1, 0.45, 1) forwards;
}

.turning-leaf.turn-backward {
  transform-origin: left center;
  animation: flipBackward3D 0.7s cubic-bezier(0.25, 1, 0.45, 1) forwards;
}

@keyframes flipForward3D {
  0% {
    transform: rotateY(-2deg);
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.05);
  }
  50% {
    transform: rotateY(-90deg) scale(1.015);
    box-shadow: 0 30px 40px rgba(0, 0, 0, 0.35);
  }
  100% {
    transform: rotateY(-182deg);
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.05);
  }
}

@keyframes flipBackward3D {
  0% {
    transform: rotateY(-182deg);
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.05);
  }
  50% {
    transform: rotateY(-90deg) scale(1.015);
    box-shadow: 0 30px 40px rgba(0, 0, 0, 0.35);
  }
  100% {
    transform: rotateY(-2deg);
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.05);
  }
}

/* Front & Back Faces of the Turning Leaf */
.leaf-front,
.leaf-back {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: var(--page-bg);
  border: 1px solid var(--page-border);
  box-shadow: inset 0 0 18px rgba(0, 0, 0, 0.04);
  backface-visibility: hidden;
  overflow: hidden;
  box-sizing: border-box;
}

.leaf-front {
  border-left: none;
  border-radius: 0 4px 4px 0;
  transform: rotateY(0deg);
}

.leaf-back {
  border-right: none;
  border-radius: 4px 0 0 4px;
  transform: rotateY(180deg);
}

/* Page Curvature Lighting Gradient */
.leaf-front::after {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: linear-gradient(to right, rgba(0,0,0,0.18) 0%, rgba(255,255,255,0.08) 50%, rgba(0,0,0,0.1) 100%);
  pointer-events: none;
  opacity: 0;
}

.turning-leaf.turn-forward .leaf-front::after {
  animation: leafLightForward 0.7s ease-in-out forwards;
}

@keyframes leafLightForward {
  0% { opacity: 0; }
  45% { opacity: 0.6; }
  100% { opacity: 0; }
}

.leaf-back::after {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: linear-gradient(to left, rgba(0,0,0,0.18) 0%, rgba(255,255,255,0.08) 50%, rgba(0,0,0,0.1) 100%);
  pointer-events: none;
  opacity: 0;
}

.turning-leaf.turn-forward .leaf-back::after {
  animation: leafLightBack 0.7s ease-in-out forwards;
}

@keyframes leafLightBack {
  0% { opacity: 0; }
  55% { opacity: 0.6; }
  100% { opacity: 0; }
}

/* ==========================================================================
   Bottom Navigation & Controls Bar
   ========================================================================== */
.reading-controls {
  height: 60px;
  background: var(--header-bg);
  backdrop-filter: blur(12px);
  border-top: 1px solid var(--ui-border);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 4px 16px;
  gap: 2px;
}

.controls-container {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
}

.btn-primary {
  background: var(--accent-color);
  color: #fff;
  border-color: var(--accent-color);
}

.btn-primary:hover {
  background: var(--accent-hover);
  border-color: var(--accent-hover);
}

.page-scrubber {
  display: flex;
  align-items: center;
  gap: 8px;
}

.page-scrubber input[type="range"] {
  width: 140px;
  accent-color: var(--accent-color);
  cursor: pointer;
}

.page-indicator {
  font-family: var(--font-ui);
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text-heading);
  min-width: 170px;
  text-align: center;
}

.keyboard-hints {
  font-family: var(--font-ui);
  font-size: 0.72rem;
  color: var(--text-muted);
}

/* ==========================================================================
   Table of Contents Slide-Out Drawer
   ========================================================================== */
.toc-drawer {
  position: fixed;
  top: 0;
  left: 0;
  width: 360px;
  height: 100vh;
  background: var(--ui-btn-bg);
  border-right: 1px solid var(--ui-border);
  box-shadow: 4px 0 25px rgba(0, 0, 0, 0.2);
  z-index: 1000;
  display: flex;
  flex-direction: column;
  transition: transform 0.3s cubic-bezier(0.165, 0.84, 0.44, 1);
  padding: 20px;
}

.toc-drawer.hidden {
  transform: translateX(-100%);
  display: flex !important;
}

.toc-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-bottom: 10px;
  border-bottom: 2px solid var(--accent-color);
}

.toc-header h3 {
  font-family: var(--font-title);
  color: var(--accent-color);
  font-size: 1.25rem;
}

.btn-close {
  background: none;
  border: none;
  font-size: 1.8rem;
  line-height: 1;
  color: var(--text-muted);
  cursor: pointer;
}

.toc-subtitle {
  font-family: var(--font-ui);
  font-size: 0.82rem;
  color: var(--text-muted);
  margin-top: 6px;
  margin-bottom: 14px;
}

.toc-list {
  flex: 1;
  overflow-y: auto;
  list-style: none;
}

.toc-item {
  font-family: var(--font-ui);
  padding: 10px 12px;
  border-bottom: 1px solid var(--ui-border);
  cursor: pointer;
  border-radius: 6px;
  transition: all 0.15s ease;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.toc-item:hover,
.toc-item.active {
  background: var(--page-bg-subtle);
  color: var(--accent-color);
}

.toc-ch-num {
  font-size: 0.78rem;
  font-weight: 800;
  color: var(--accent-color);
  margin-right: 8px;
}

.toc-ch-title {
  font-size: 0.86rem;
  font-weight: 600;
  flex: 1;
}

.toc-page-num {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--text-muted);
  background: var(--ui-border);
  padding: 2px 6px;
  border-radius: 4px;
}

.drawer-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(0, 0, 0, 0.4);
  backdrop-filter: blur(2px);
  z-index: 999;
}

/* ==========================================================================
   Deep Dive Statutory Analysis & Scenario Matrix Drawer
   ========================================================================== */
.deepdive-drawer {
  position: fixed;
  top: 0;
  right: 0;
  width: min(680px, 94vw);
  height: 100vh;
  background: var(--ui-btn-bg);
  border-left: 1px solid var(--ui-border);
  box-shadow: -6px 0 30px rgba(0, 0, 0, 0.28);
  z-index: 1000;
  display: flex;
  flex-direction: column;
  transition: transform 0.3s cubic-bezier(0.165, 0.84, 0.44, 1);
  padding: 0;
}

.deepdive-drawer.hidden {
  transform: translateX(100%);
  display: flex !important;
}

.deepdive-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  padding: 16px 20px 12px;
  background: var(--page-bg-subtle);
  border-bottom: 2px solid var(--accent-color);
}

.deepdive-header h3 {
  font-family: var(--font-title);
  color: var(--accent-color);
  font-size: 1.22rem;
  margin: 0;
}

.deepdive-subtitle {
  font-family: var(--font-ui);
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-top: 4px;
  margin-bottom: 0;
}

.deepdive-nav {
  display: flex;
  overflow-x: auto;
  gap: 6px;
  padding: 10px 16px;
  background: var(--page-bg);
  border-bottom: 1px solid var(--ui-border);
  scrollbar-width: thin;
}

.deepdive-nav::-webkit-scrollbar {
  height: 4px;
}

.dd-tab {
  font-family: var(--font-ui);
  font-size: 0.76rem;
  font-weight: 600;
  white-space: nowrap;
  padding: 5px 12px;
  background: var(--ui-btn-bg);
  border: 1px solid var(--ui-border);
  border-radius: 20px;
  color: var(--text-main);
  cursor: pointer;
  transition: all 0.15s ease;
}

.dd-tab:hover {
  border-color: var(--accent-color);
  color: var(--accent-color);
}

.dd-tab.active {
  background: var(--accent-color);
  color: #fff;
  border-color: var(--accent-color);
  box-shadow: 0 2px 6px rgba(140, 45, 25, 0.25);
}

.deepdive-body {
  flex: 1;
  overflow-y: auto;
  padding: 16px 20px 30px;
  font-family: var(--font-ui);
  color: var(--text-main);
}

.dd-card {
  background: var(--page-bg);
  border: 1px solid var(--ui-border);
  border-radius: 8px;
  padding: 14px 16px;
  margin-bottom: 14px;
}

.dd-card-title {
  font-family: var(--font-title);
  font-size: 1rem;
  font-weight: 700;
  color: var(--accent-color);
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.statute-quote {
  font-family: var(--font-body);
  font-size: 0.95rem;
  font-style: italic;
  background: var(--page-bg-subtle);
  border-left: 3px solid var(--accent-gold);
  padding: 10px 14px;
  border-radius: 0 6px 6px 0;
  margin: 8px 0 12px;
  line-height: 1.45;
}

.ingredient-list {
  list-style: none;
  padding-left: 0;
  margin: 10px 0;
}

.ingredient-list li {
  position: relative;
  padding-left: 18px;
  margin-bottom: 6px;
  font-size: 0.84rem;
  line-height: 1.4;
}

.ingredient-list li::before {
  content: "▪";
  position: absolute;
  left: 2px;
  color: var(--accent-color);
  font-size: 0.95rem;
}

.scenario-grid {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 10px;
}

.scenario-item {
  border: 1px solid var(--ui-border);
  border-radius: 6px;
  background: var(--ui-btn-bg);
  padding: 12px 14px;
}

.scenario-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 6px;
  flex-wrap: wrap;
  gap: 6px;
}

.scenario-name {
  font-weight: 700;
  font-size: 0.88rem;
  color: var(--text-heading);
}

.verdict-tag {
  font-size: 0.72rem;
  font-weight: 800;
  padding: 3px 8px;
  border-radius: 4px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.verdict-offence {
  background: #fef2f2;
  color: #991b1b;
  border: 1px solid #fecaca;
}

.verdict-safe {
  background: #f0fdf4;
  color: #166534;
  border: 1px solid #bbf7d0;
}

.verdict-exempt {
  background: #fffbeb;
  color: #92400e;
  border: 1px solid #fde68a;
}

.scenario-facts {
  font-size: 0.82rem;
  color: var(--text-main);
  margin-bottom: 6px;
  line-height: 1.4;
}

.scenario-legal {
  font-size: 0.8rem;
  color: var(--text-muted);
  background: var(--page-bg-subtle);
  padding: 6px 10px;
  border-radius: 4px;
  line-height: 1.35;
}

.forensic-checklist {
  list-style: none;
  padding-left: 0;
  margin: 10px 0;
}

.forensic-checklist li {
  padding: 6px 10px;
  margin-bottom: 6px;
  background: var(--page-bg-subtle);
  border-radius: 4px;
  font-size: 0.82rem;
  line-height: 1.35;
  border-left: 3px solid var(--accent-color);
}

/* ==========================================================================
   Book Cover Styling (Double Page Grand Presentation)
   ========================================================================== */
.cover-border-box {
  border: 2px double var(--accent-gold);
  border-radius: 6px;
  padding: 16px;
  height: 100%;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  text-align: center;
  box-sizing: border-box;
}

.cover-title-badge {
  font-family: var(--font-ui);
  font-size: 0.75rem;
  font-weight: 800;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: var(--accent-gold);
  border-bottom: 1px solid var(--accent-gold);
  padding-bottom: 4px;
  margin-bottom: 8px;
}

.cover-h1 {
  font-family: var(--font-title);
  font-size: 1.45rem;
  color: var(--accent-color);
  line-height: 1.25;
  margin: 10px 0;
}

.cover-features-list {
  text-align: left;
  font-family: var(--font-ui);
  font-size: 0.8rem;
  line-height: 1.5;
  margin: 12px 0;
  list-style-type: none;
  background: var(--page-bg-subtle);
  padding: 10px 14px;
  border-radius: 6px;
  border: 1px dashed var(--ui-border);
}

.cover-features-list li {
  margin-bottom: 4px;
}

.cover-btn-start {
  font-family: var(--font-ui);
  font-size: 0.95rem;
  font-weight: 700;
  background: var(--accent-color);
  color: #fff;
  border: none;
  padding: 10px 20px;
  border-radius: 25px;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(140, 45, 25, 0.3);
  transition: all 0.2s;
  display: inline-block;
  margin-top: 10px;
}

.cover-btn-start:hover {
  background: var(--accent-hover);
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(140, 45, 25, 0.4);
}

/* ==========================================================================
   Single Page Mode (Mobile Default & Desktop Toggle)
   ========================================================================== */
body.single-page-mode .gap {
  display: none !important;
}

body.single-page-mode .left-stack {
  display: none !important;
}

body.single-page-mode .right-stack {
  position: absolute !important;
  top: 0 !important;
  left: 0 !important;
  width: 100% !important;
  height: 100% !important;
  transform: none !important;
}

body.single-page-mode .right-page {
  border-left: 1px solid var(--page-border) !important;
  border-radius: 8px !important;
}

body.single-page-mode .turning-leaf {
  left: 0 !important;
  width: 100% !important;
}

body.single-page-mode .book-hardcover-shadow {
  width: min(520px, 94vw);
}

body.single-page-mode .book.upright {
  width: min(490px, 92vw);
}

/* ==========================================================================
   Responsive Breakpoints
   ========================================================================== */

/* Tablets & Small Laptops (max-width: 900px) */
@media (max-width: 900px) {
  .book-title-short {
    display: none;
  }
  .search-box {
    width: 240px;
  }
}

/* Mobile & Small Tablets (max-width: 768px) */
@media (max-width: 768px) {
  .app-header {
    height: 50px;
    padding: 0 10px;
    gap: 6px;
  }

  .header-left {
    gap: 6px;
  }

  .book-meta {
    display: none !important;
  }

  .search-box {
    flex: 1;
    width: auto;
    min-width: 80px;
    max-width: 260px;
  }

  .search-box input {
    font-size: 0.8rem;
    padding: 5px 24px 5px 28px;
  }

  .search-box svg {
    left: 8px;
    width: 14px;
    height: 14px;
  }

  .font-controls {
    display: none;
  }

  #fullscreenBtn {
    display: none;
  }

  #deepDiveToggleBtn,
  #audioNarrationBtn {
    display: none !important;
  }

  .btn-icon, .btn-tool, .btn-nav {
    padding: 5px 9px;
    font-size: 0.8rem;
  }

  /* Reading Stage */
  .reading-stage {
    padding: 8px 6px;
    height: calc(100vh - 106px);
  }

  .book-wrapper {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
  }

  .book-hardcover-shadow {
    width: min(490px, 96vw) !important;
    height: min(620px, calc(100vh - 124px)) !important;
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.4) !important;
  }

  .book.upright {
    width: min(470px, 94vw) !important;
    height: min(600px, calc(100vh - 134px)) !important;
  }

  /* Typesetting adjustments for mobile screen */
  .page-content {
    padding: 12px 14px !important;
  }

  .left-page .page-content,
  .right-page .page-content {
    padding: 12px 14px !important;
  }

  .page-running-head {
    font-size: 0.65rem !important;
    margin-bottom: 5px !important;
    padding-bottom: 2px !important;
  }

  .page-footer {
    font-size: 0.72rem !important;
    margin-top: 4px !important;
    padding-top: 3px !important;
  }

  .page-body {
    font-size: 0.82rem !important;
    line-height: 1.36 !important;
  }

  .page-body h1 {
    font-size: 1.05rem !important;
    margin-bottom: 4px !important;
  }

  .page-body h2 {
    font-size: 0.94rem !important;
    margin-top: 4px !important;
    margin-bottom: 3px !important;
  }

  .page-body h3 {
    font-size: 0.84rem !important;
    margin-top: 4px !important;
    margin-bottom: 2px !important;
  }

  .book-table {
    font-size: 0.72rem !important;
    margin: 5px 0 !important;
  }

  .book-table th, 
  .book-table td {
    padding: 4px 6px !important;
  }

  .book-callout,
  .case-card,
  .scenario-card {
    font-size: 0.78rem !important;
    padding: 6px 10px !important;
    margin: 5px 0 !important;
  }

  .book-figure {
    margin: 5px 0 !important;
  }

  .book-figure img {
    height: 105px !important;
  }

  .cover-border-box {
    padding: 10px 12px !important;
  }

  .cover-h1 {
    font-size: 0.98rem !important;
    letter-spacing: 0.5px !important;
    margin: 6px 0 !important;
  }

  .cover-features-list {
    font-size: 0.74rem !important;
    margin: 6px 0 !important;
    padding: 6px 10px !important;
  }

  .cover-features-list li {
    padding: 2px 0 !important;
  }

  .cover-btn-start {
    font-size: 0.82rem !important;
    padding: 7px 16px !important;
    margin-top: 6px !important;
  }

  /* Bottom navigation bar */
  .reading-controls {
    height: 56px;
    padding: 4px 8px;
    gap: 0;
  }

  .controls-container {
    width: 100%;
    justify-content: space-between;
    gap: 4px;
  }

  #firstPageBtn,
  #lastPageBtn,
  #autoFlipBtn,
  #bottomAudioBtn,
  .keyboard-hints {
    display: none !important;
  }

  .btn-nav {
    padding: 6px 10px;
    font-size: 0.82rem;
    min-height: 38px;
  }

  .page-scrubber {
    flex: 1;
    max-width: 180px;
    flex-direction: column;
    gap: 2px;
    align-items: center;
  }

  .page-scrubber input[type="range"] {
    width: 100%;
    height: 5px;
  }

  .page-indicator {
    font-size: 0.7rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 180px;
    text-align: center;
  }

  /* TOC drawer on mobile */
  .toc-drawer {
    width: min(320px, 86vw);
  }

  /* Search dropdown on mobile */
  .search-dropdown {
    position: fixed !important;
    top: 52px !important;
    left: 8px !important;
    right: 8px !important;
    width: auto !important;
    max-height: 65vh !important;
  }

  /* Deep Dive Drawer on Mobile */
  .deepdive-drawer {
    width: 100vw !important;
    max-width: 100vw !important;
    height: 100vh !important;
  }

  .deepdive-nav {
    padding: 6px 10px !important;
    gap: 5px !important;
  }

  .dd-tab {
    font-size: 0.72rem !important;
    padding: 5px 10px !important;
    flex-shrink: 0 !important;
  }
}

/* Very Small Phones (max-width: 440px) */
@media (max-width: 440px) {
  .badge-exam {
    display: none;
  }

  #tocToggleBtn span {
    display: none;
  }

  #tocToggleBtn {
    padding: 6px 8px;
  }

  .page-scrubber {
    max-width: 140px;
  }

  .page-indicator {
    max-width: 140px;
    font-size: 0.67rem;
  }

  .book-table th, .book-table td {
    padding: 3px 4px !important;
    font-size: 0.7rem !important;
  }

  .page-body {
    font-size: 0.8rem !important;
    line-height: 1.34 !important;
  }
}

/* Landscape Mode on Phones (max-height: 520px and landscape) */
@media (max-height: 520px) and (orientation: landscape) {
  .app-header {
    height: 42px;
  }
  .reading-controls {
    height: 46px;
  }
  .reading-stage {
    height: calc(100vh - 88px);
    padding: 4px;
  }
  .book-hardcover-shadow {
    height: calc(100vh - 96px) !important;
  }
  .book.upright {
    height: calc(100vh - 104px) !important;
  }
  .page-content {
    padding: 8px 12px !important;
  }
  .page-body {
    font-size: 0.76rem !important;
    line-height: 1.3 !important;
  }
}


/* ==========================================================================
   2-BOOK MULTI-CURRICULUM SYSTEM STYLES
   ========================================================================== */

/* 2-Book Switcher segmented controls in App Header */
.book-switcher {
  display: flex;
  align-items: center;
  background: rgba(0, 0, 0, 0.06);
  padding: 2px;
  border-radius: 8px;
  border: 1px solid var(--ui-border);
  gap: 2px;
  margin-left: 4px;
}

.book-tab-btn {
  font-family: var(--font-ui);
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-size: 0.77rem;
  font-weight: 600;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  white-space: nowrap;
}

.book-tab-btn:hover {
  color: var(--text-heading);
  background: rgba(255, 255, 255, 0.6);
}

.book-tab-btn.active {
  background: var(--ui-btn-bg);
  color: var(--accent-color);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.12);
  font-weight: 700;
}

.book-tab-btn[data-book-id="book2"].active {
  color: #0284c7;
}

.book-tab-btn[data-book-id="book3"].active {
  color: #7c3aed;
}

.book-tab-btn[data-book-id="book4"].active {
  color: #059669;
}

.book-tab-btn[data-book-id="book5"].active {
  color: #d97706;
}

.book-tab-icon {
  font-size: 0.92rem;
}

/* Bookshelf Button in Header */
.btn-library {
  font-weight: 600;
  color: #92400e;
  border-color: rgba(180, 83, 9, 0.35);
  background: rgba(254, 243, 199, 0.4);
}

.btn-library:hover {
  background: rgba(254, 243, 199, 0.85);
  color: #78350f;
}

/* Bookshelf Modal */
.bookshelf-modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: rgba(15, 23, 42, 0.75);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  animation: fadeIn 0.25s ease-out;
}

.bookshelf-card {
  background: var(--page-bg);
  border: 1px solid var(--ui-border);
  border-radius: 16px;
  box-shadow: 0 25px 60px -15px rgba(0, 0, 0, 0.5);
  width: 100%;
  max-width: 900px;
  max-height: 90vh;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  padding: 24px;
}

.bookshelf-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  border-bottom: 1px solid var(--ui-border);
  padding-bottom: 14px;
  margin-bottom: 20px;
}

.bookshelf-badge {
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 2px 8px;
  border-radius: 4px;
  background: rgba(194, 144, 51, 0.15);
  color: #92400e;
  border: 1px solid rgba(194, 144, 51, 0.3);
  margin-bottom: 6px;
}

.bookshelf-header h2 {
  font-family: var(--font-title);
  font-size: 1.45rem;
  color: var(--text-heading);
  margin: 0 0 4px 0;
}

.bookshelf-subtitle {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin: 0;
}

.bookshelf-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(360px, 1fr));
  gap: 20px;
  margin-bottom: 20px;
}

.book-card-item {
  display: flex;
  background: var(--ui-btn-bg);
  border-radius: 12px;
  border: 2px solid transparent;
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.08);
  overflow: hidden;
  transition: all 0.28s cubic-bezier(0.16, 1, 0.3, 1);
  cursor: pointer;
  position: relative;
}

.book-card-item:hover {
  transform: translateY(-4px);
  box-shadow: 0 14px 28px rgba(0, 0, 0, 0.15);
}

.book-card-item.active-reading {
  border-color: var(--accent-gold);
  box-shadow: 0 8px 24px rgba(194, 144, 51, 0.25);
}

.book-card-spine {
  width: 16px;
  flex-shrink: 0;
}

.spine-book1 {
  background: linear-gradient(90deg, #5c1d11 0%, #8c2d19 50%, #4a150b 100%);
  box-shadow: inset -2px 0 4px rgba(0, 0, 0, 0.3);
}

.spine-book2 {
  background: linear-gradient(90deg, #075985 0%, #0284c7 50%, #034870 100%);
  box-shadow: inset -2px 0 4px rgba(0, 0, 0, 0.3);
}

.spine-book3 {
  background: linear-gradient(90deg, #4c1d95 0%, #7c3aed 50%, #2e1065 100%);
  box-shadow: inset -2px 0 4px rgba(0, 0, 0, 0.3);
}

.spine-book4 {
  background: linear-gradient(90deg, #064e3b 0%, #059669 50%, #022c22 100%);
  box-shadow: inset -2px 0 4px rgba(0, 0, 0, 0.3);
}

.spine-book5 {
  background: linear-gradient(90deg, #78350f 0%, #d97706 50%, #451a03 100%);
  box-shadow: inset -2px 0 4px rgba(0, 0, 0, 0.3);
}

.book-card-cover {
  padding: 16px 18px;
  flex: 1;
  display: flex;
  flex-direction: column;
}

.card-badge {
  display: inline-block;
  font-size: 0.68rem;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 4px;
  background: rgba(140, 45, 25, 0.1);
  color: var(--accent-color);
  border: 1px solid var(--accent-color);
  margin-bottom: 8px;
  align-self: flex-start;
}

.card-badge.badge-teal {
  background: rgba(14, 116, 144, 0.12);
  color: #0284c7;
  border-color: #0284c7;
}

.card-badge.badge-purple {
  background: rgba(124, 58, 237, 0.12);
  color: #7c3aed;
  border-color: #7c3aed;
}

.card-badge.badge-emerald {
  background: rgba(16, 185, 129, 0.12);
  color: #059669;
  border-color: #059669;
}

.card-badge.badge-amber {
  background: rgba(217, 119, 6, 0.12);
  color: #b45309;
  border-color: #d97706;
}

.card-title {
  font-family: var(--font-title);
  font-size: 1.05rem;
  color: var(--accent-color);
  margin: 0 0 6px 0;
  line-height: 1.25;
}

.card-title.title-teal {
  color: #0369a1;
}

.card-title.title-purple {
  color: #6d28d9;
}

.card-title.title-emerald {
  color: #047857;
}

.card-title.title-amber {
  color: #b45309;
}

.card-subtitle {
  font-size: 0.77rem;
  color: var(--text-muted);
  line-height: 1.35;
  margin: 0 0 10px 0;
}

.card-meta {
  font-size: 0.73rem;
  font-weight: 600;
  color: var(--text-heading);
  background: var(--page-bg-subtle);
  padding: 4px 8px;
  border-radius: 4px;
  margin-bottom: 10px;
}

.card-topics {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-bottom: 14px;
  flex: 1;
}

.topic-tag {
  font-size: 0.66rem;
  font-weight: 600;
  padding: 2px 6px;
  border-radius: 3px;
  background: rgba(0, 0, 0, 0.05);
  color: var(--text-main);
  border: 1px solid var(--ui-border);
}

.card-action {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 10px;
  border-top: 1px solid var(--ui-border);
}

.active-badge {
  font-size: 0.72rem;
  font-weight: 700;
  color: #15803d;
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.pulse-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #16a34a;
  display: inline-block;
  box-shadow: 0 0 0 rgba(22, 163, 74, 0.4);
  animation: pulse 1.5s infinite;
}

@keyframes pulse {
  0% { box-shadow: 0 0 0 0 rgba(22, 163, 74, 0.7); }
  70% { box-shadow: 0 0 0 6px rgba(22, 163, 74, 0); }
  100% { box-shadow: 0 0 0 0 rgba(22, 163, 74, 0); }
}

.btn-card-open {
  font-family: var(--font-ui);
  font-size: 0.8rem;
  font-weight: 700;
  padding: 6px 14px;
  border: none;
  border-radius: 6px;
  background: var(--accent-color);
  color: #fff;
  cursor: pointer;
  transition: background 0.2s;
}

.btn-card-open:hover {
  background: var(--accent-hover);
}

.btn-card-open.btn-teal {
  background: #0284c7;
}

.btn-card-open.btn-purple {
  background: #7c3aed;
}

.btn-card-open.btn-purple:hover {
  background: #6d28d9;
}

.btn-card-open.btn-emerald {
  background: #059669;
}

.btn-card-open.btn-emerald:hover {
  background: #047857;
}

.btn-card-open.btn-amber {
  background: #d97706;
}

.btn-card-open.btn-amber:hover {
  background: #b45309;
}

.btn-card-open.btn-teal:hover {
  background: #0369a1;
}

.bookshelf-footer {
  font-size: 0.78rem;
  color: var(--text-muted);
  border-top: 1px solid var(--ui-border);
  padding-top: 12px;
}

/* Toast notification pill */
.toast-notification {
  position: fixed;
  bottom: 60px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: #1e293b;
  color: #f8fafc;
  padding: 8px 18px;
  border-radius: 30px;
  font-family: var(--font-ui);
  font-size: 0.82rem;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
  z-index: 1100;
  opacity: 0;
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  pointer-events: none;
}

.toast-notification.visible {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* Responsive tweaks for book switcher */
@media (max-width: 1024px) {
  .book-meta {
    display: none !important;
  }
}

@media (max-width: 640px) {
  .book-tab-label {
    display: none;
  }
  .book-tab-btn {
    padding: 4px 8px;
  }
  .bookshelf-grid {
    grid-template-columns: 1fr;
  }
}

/* ==========================================================================
   MCQ Practice & Examination Engine (1,000 Questions)
   ========================================================================== */

/* Header MCQ Button */
.btn-mcq {
  background: linear-gradient(135deg, #059669, #047857) !important;
  color: #ffffff !important;
  border-color: #047857 !important;
  font-weight: 600 !important;
  box-shadow: 0 2px 6px rgba(5, 150, 105, 0.25);
  height: 32px !important;
  padding: 0 10px !important;
  white-space: nowrap !important;
  flex-shrink: 0 !important;
  display: inline-flex !important;
  align-items: center !important;
  line-height: 1 !important;
  font-size: 0.8rem !important;
}

.btn-mcq:hover {
  background: linear-gradient(135deg, #10b981, #059669) !important;
  transform: translateY(-1px);
  box-shadow: 0 4px 10px rgba(5, 150, 105, 0.35);
}

/* MCQ Modal Backdrop */
.mcq-modal {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.72);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1060;
  padding: 16px;
  animation: mcqFadeIn 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.mcq-modal.hidden {
  display: none !important;
}

@keyframes mcqFadeIn {
  from { opacity: 0; transform: scale(0.98); }
  to { opacity: 1; transform: scale(1); }
}

/* MCQ Main Dialog Container */
.mcq-container {
  width: 100%;
  max-width: 940px;
  max-height: 92vh;
  background: var(--bg-card);
  border: 1px solid var(--ui-border);
  border-radius: 14px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.35), 0 0 0 1px rgba(255, 255, 255, 0.05);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  color: var(--text-main);
  font-family: var(--font-ui);
}

/* MCQ Header */
.mcq-header {
  padding: 16px 22px;
  background: var(--ui-header-bg);
  border-bottom: 1px solid var(--ui-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.mcq-badge {
  display: inline-block;
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding: 2px 8px;
  border-radius: 4px;
  background: rgba(5, 150, 105, 0.15);
  color: #059669;
  border: 1px solid rgba(5, 150, 105, 0.3);
  margin-bottom: 4px;
}

.mcq-header h2 {
  font-size: 1.15rem;
  font-weight: 700;
  margin: 0;
  color: var(--text-main);
}

.mcq-subtitle {
  font-size: 0.78rem;
  color: var(--text-muted);
  margin: 2px 0 0;
}

/* Book Tabs inside MCQ Modal */
.mcq-book-tabs {
  display: flex;
  overflow-x: auto;
  background: var(--bg-app);
  border-bottom: 1px solid var(--ui-border);
  padding: 4px 12px 0;
  gap: 6px;
  scrollbar-width: none;
}

.mcq-book-tabs::-webkit-scrollbar {
  display: none;
}

.mcq-tab {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 12px;
  border: 1px solid transparent;
  border-bottom: none;
  border-radius: 8px 8px 0 0;
  background: transparent;
  color: var(--text-muted);
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.15s ease;
}

.mcq-tab:hover {
  color: var(--text-main);
  background: rgba(0, 0, 0, 0.04);
}

.mcq-tab.active {
  background: var(--bg-card);
  color: var(--text-main);
  border-color: var(--ui-border);
  border-bottom-color: var(--bg-card);
  margin-bottom: -1px;
}

.tab-badge {
  font-size: 0.65rem;
  padding: 2px 6px;
  border-radius: 4px;
  font-weight: 700;
  background: rgba(140, 45, 25, 0.12);
  color: #8c2d19;
}

.tab-badge.badge-teal {
  background: rgba(15, 118, 110, 0.12);
  color: #0f766e;
}

.tab-badge.badge-purple {
  background: rgba(109, 40, 217, 0.12);
  color: #6d28d9;
}

.tab-badge.badge-emerald {
  background: rgba(4, 120, 87, 0.12);
  color: #047857;
}

.tab-badge.badge-amber {
  background: rgba(180, 83, 9, 0.12);
  color: #b45309;
}

/* MCQ Toolbar */
.mcq-toolbar {
  padding: 10px 22px;
  background: var(--bg-card);
  border-bottom: 1px solid var(--ui-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.mcq-toolbar-left, .mcq-toolbar-right {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.mcq-counter {
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--text-main);
}

.mcq-score-badge {
  font-size: 0.82rem;
  padding: 3px 10px;
  border-radius: 6px;
  background: rgba(5, 150, 105, 0.12);
  color: #059669;
  font-weight: 700;
  border: 1px solid rgba(5, 150, 105, 0.3);
}

.mcq-mode-toggle {
  display: flex;
  background: var(--bg-app);
  border: 1px solid var(--ui-border);
  border-radius: 6px;
  overflow: hidden;
}

.btn-mode {
  padding: 5px 12px;
  font-size: 0.74rem;
  font-weight: 700;
  border: none;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn-mode.active {
  background: var(--accent);
  color: #ffffff;
}

/* Font Size Controls in MCQ */
.mcq-font-controls {
  display: flex;
  align-items: center;
  gap: 3px;
  background: var(--bg-app);
  border: 1px solid var(--ui-border);
  border-radius: 6px;
  padding: 2px 4px;
}

.mcq-font-controls .btn-font {
  padding: 3px 8px;
  font-size: 0.75rem;
  font-weight: 700;
  border: none;
  background: transparent;
  cursor: pointer;
  color: var(--text-main);
  border-radius: 4px;
}

.mcq-font-controls .btn-font:hover {
  background: rgba(0, 0, 0, 0.08);
}

.mcq-font-size-label {
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--text-muted);
  padding: 0 4px;
  min-width: 38px;
  text-align: center;
}

.mcq-jump-box {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 0.76rem;
  font-weight: 600;
  color: var(--text-muted);
}

.mcq-jump-box select {
  padding: 5px 10px;
  font-size: 0.78rem;
  border: 1.5px solid var(--ui-border);
  border-radius: 6px;
  background: var(--bg-card);
  color: var(--text-main);
  cursor: pointer;
  max-width: 170px;
}

.mcq-search-box input {
  padding: 5px 10px;
  font-size: 0.78rem;
  border: 1.5px solid var(--ui-border);
  border-radius: 6px;
  background: var(--bg-app);
  color: var(--text-main);
  width: 140px;
  transition: width 0.2s;
}

.mcq-search-box input:focus {
  width: 180px;
  outline: none;
  border-color: var(--accent);
}

/* Progress Bar */
.mcq-progress-bar {
  height: 5px;
  background: var(--ui-border);
  width: 100%;
}

.mcq-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #059669, #10b981);
  transition: width 0.25s ease;
}

/* Question Body - Readability Scaling */
:root {
  --mcq-scale: 1;
}

.mcq-body {
  padding: 24px 28px;
  overflow-y: auto;
  flex: 1;
  background: var(--bg-app);
}

.mcq-card {
  display: flex;
  flex-direction: column;
  gap: 18px;
  max-width: 860px;
  margin: 0 auto;
}

/* Enhanced Question Box */
.mcq-q-box {
  background: var(--bg-card);
  border: 1.5px solid var(--ui-border);
  border-radius: 12px;
  padding: 20px 24px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.04);
}

.mcq-q-meta {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
}

.q-number-pill {
  padding: 4px 11px;
  border-radius: 6px;
  font-weight: 800;
  font-size: 0.78rem;
  letter-spacing: 0.04em;
  background: var(--accent);
  color: #ffffff;
  flex-shrink: 0;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
}

.mcq-book-pill {
  font-size: 0.74rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.q-text {
  font-size: calc(1.18rem * var(--mcq-scale));
  font-weight: 650;
  line-height: 1.65;
  color: var(--text-main);
  letter-spacing: -0.01em;
}

/* Options Section Heading */
.mcq-options-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 4px;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-muted);
}

.mcq-key-hint {
  font-size: 0.74rem;
  color: var(--text-muted);
  background: var(--bg-card);
  border: 1px solid var(--ui-border);
  padding: 2px 8px;
  border-radius: 4px;
}

/* 4 Option Buttons */
.mcq-options {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.mcq-option-btn {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 15px 20px;
  border: 2px solid var(--ui-border);
  border-radius: 12px;
  background: var(--bg-card);
  color: var(--text-main);
  font-size: calc(1.02rem * var(--mcq-scale));
  line-height: 1.55;
  cursor: pointer;
  text-align: left;
  transition: all 0.18s cubic-bezier(0.16, 1, 0.3, 1);
  width: 100%;
  position: relative;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.03);
}

.mcq-option-btn:hover:not(.disabled) {
  border-color: var(--accent);
  background: rgba(140, 45, 25, 0.04);
  transform: translateX(4px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

.option-badge {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 2px solid var(--ui-border);
  background: var(--bg-app);
  font-weight: 800;
  font-size: calc(0.85rem * var(--mcq-scale));
  color: var(--text-muted);
  flex-shrink: 0;
  transition: all 0.18s ease;
}

.option-text {
  flex: 1;
}

.mcq-option-btn:hover .option-badge {
  border-color: var(--accent);
  color: var(--accent);
  background: #ffffff;
}

/* Option Selected State */
.mcq-option-btn.selected {
  border-color: var(--accent) !important;
  background: rgba(140, 45, 25, 0.08) !important;
}

/* Option Correct State */
.mcq-option-btn.correct {
  border-color: #059669 !important;
  background: rgba(5, 150, 105, 0.12) !important;
  color: #064e3b !important;
  font-weight: 650;
  box-shadow: 0 4px 14px rgba(5, 150, 105, 0.18);
}

.mcq-option-btn.correct .option-badge {
  background: #059669 !important;
  border-color: #059669 !important;
  color: #ffffff !important;
}

/* Option Wrong State */
.mcq-option-btn.wrong {
  border-color: #dc2626 !important;
  background: rgba(220, 38, 38, 0.1) !important;
  color: #7f1d1d !important;
}

.mcq-option-btn.wrong .option-badge {
  background: #dc2626 !important;
  border-color: #dc2626 !important;
  color: #ffffff !important;
}

.mcq-option-btn.disabled {
  cursor: default;
}

/* Detailed Explanation Card */
.mcq-explanation {
  background: var(--bg-card);
  border: 2px solid #059669;
  border-radius: 12px;
  padding: 20px 24px;
  margin-top: 6px;
  box-shadow: 0 6px 20px rgba(5, 150, 105, 0.12);
  animation: slideDown 0.22s cubic-bezier(0.16, 1, 0.3, 1);
}

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

.mcq-explanation.is-wrong {
  border-color: #dc2626;
  box-shadow: 0 6px 20px rgba(220, 38, 38, 0.12);
}

.explanation-title {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 10px;
}

.verdict-pill {
  font-size: 0.76rem;
  font-weight: 800;
  text-transform: uppercase;
  padding: 4px 10px;
  border-radius: 6px;
  background: #059669;
  color: #ffffff;
  letter-spacing: 0.04em;
}

.mcq-explanation.is-wrong .verdict-pill {
  background: #dc2626;
}

.explanation-heading {
  font-size: calc(0.92rem * var(--mcq-scale));
  font-weight: 700;
  color: var(--text-main);
}

.explanation-text {
  font-size: calc(1.02rem * var(--mcq-scale));
  line-height: 1.7;
  color: var(--text-main);
  font-weight: 450;
  letter-spacing: 0.01em;
}

/* Footer Navigation */
.mcq-footer {
  padding: 14px 24px;
  background: var(--ui-header-bg);
  border-top: 1px solid var(--ui-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
}

.mcq-footer-left {
  display: flex;
  align-items: center;
  gap: 10px;
}

.mcq-shortcut-hint {
  font-size: 0.76rem;
  color: var(--text-muted);
}

/* Dark Theme Overrides for Maximum Readability */
body.theme-dark .mcq-body {
  background: #0b1120;
}

body.theme-dark .mcq-q-box {
  background: #1e293b;
  border-color: #334155;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
}

body.theme-dark .q-text {
  color: #f8fafc;
}

body.theme-dark .mcq-option-btn {
  background: #1e293b;
  border-color: #334155;
  color: #f1f5f9;
}

body.theme-dark .mcq-option-btn:hover:not(.disabled) {
  background: #273549;
  border-color: #60a5fa;
}

body.theme-dark .option-badge {
  background: #0f172a;
  border-color: #475569;
  color: #cbd5e1;
}

body.theme-dark .mcq-option-btn.correct {
  color: #ecfdf5 !important;
  background: rgba(5, 150, 105, 0.28) !important;
  border-color: #10b981 !important;
}

body.theme-dark .mcq-option-btn.wrong {
  color: #fef2f2 !important;
  background: rgba(220, 38, 38, 0.25) !important;
  border-color: #ef4444 !important;
}

body.theme-dark .mcq-explanation {
  background: #1e293b;
  border-color: #10b981;
}

body.theme-dark .mcq-explanation.is-wrong {
  border-color: #ef4444;
}

body.theme-dark .explanation-text {
  color: #f8fafc;
}

/* Paper / Sepia Theme Overrides */
body.theme-paper .mcq-body {
  background: #fbf7ee;
}

body.theme-paper .mcq-q-box {
  background: #fffef8;
  border-color: #e6dac6;
}

body.theme-paper .q-text {
  color: #2c1a0e;
}

body.theme-paper .mcq-option-btn {
  background: #fffef8;
  border-color: #e6dac6;
  color: #2c1a0e;
}

body.theme-paper .explanation-text {
  color: #2c1a0e;
}

/* Responsive adjustments */
@media (max-width: 768px) {
  .mcq-container {
    max-height: 96vh;
    border-radius: 8px;
  }
  .mcq-toolbar {
    padding: 8px 12px;
  }
  .mcq-body {
    padding: 16px 14px;
  }
  .mcq-q-box {
    padding: 16px;
  }
  .mcq-shortcut-hint {
    display: none;
  }
  .q-text {
    font-size: calc(1.05rem * var(--mcq-scale));
  }
  .mcq-option-btn {
    padding: 12px 14px;
    font-size: calc(0.92rem * var(--mcq-scale));
  }
  .tab-name {
    display: none;
  }
}




/* ==========================================================================
   Two-Way Interactive Study & MCQ Practice System
   ========================================================================== */

/* Header 'Test This Spread' Button */
.btn-test-spread {
  background: linear-gradient(135deg, #0284c7, #0369a1) !important;
  color: #ffffff !important;
  border: 1px solid #0284c7 !important;
  font-weight: 700 !important;
  box-shadow: 0 2px 6px rgba(2, 132, 199, 0.25);
  transition: all 0.2s ease;
  height: 32px !important;
  padding: 0 10px !important;
  white-space: nowrap !important;
  flex-shrink: 0 !important;
  display: inline-flex !important;
  align-items: center !important;
  line-height: 1 !important;
  font-size: 0.78rem !important;
}

.btn-test-spread:hover {
  background: linear-gradient(135deg, #38bdf8, #0ea5e9) !important;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(14, 165, 233, 0.38);
}

/* Spread CTA Banner on Right Pages */
.spread-quiz-cta-banner {
  margin-top: 24px;
  margin-bottom: 8px;
  padding: 12px 16px;
  background: linear-gradient(135deg, rgba(14, 165, 233, 0.08), rgba(5, 150, 105, 0.08));
  border: 1px solid rgba(14, 165, 233, 0.25);
  border-left: 4px solid #0ea5e9;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}

.spread-quiz-cta-info {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 1;
  min-width: 240px;
}

.spread-quiz-icon {
  font-size: 1.4rem;
  line-height: 1;
}

.spread-quiz-title {
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--text-heading);
  letter-spacing: -0.01em;
}

.spread-quiz-subtitle {
  font-size: 0.78rem;
  color: var(--text-muted);
  line-height: 1.4;
  margin-top: 2px;
}

.spread-quiz-cta-banner button,
.btn-spread-cta-action {
  padding: 8px 16px;
  border-radius: 6px;
  background: linear-gradient(135deg, #059669, #047857) !important;
  color: #ffffff !important;
  border: none !important;
  font-size: 0.82rem;
  font-weight: 700;
  cursor: pointer !important;
  pointer-events: auto !important;
  position: relative;
  z-index: 10;
  box-shadow: 0 2px 6px rgba(5, 150, 105, 0.25);
  transition: all 0.2s ease;
  white-space: nowrap;
}

.spread-quiz-cta-banner button:hover,
.btn-spread-cta-action:hover {
  background: linear-gradient(135deg, #10b981, #059669) !important;
  transform: translateY(-1px);
  box-shadow: 0 4px 10px rgba(5, 150, 105, 0.35);
}

/* MCQ Question Card: Source Spread & View Notes Button */
.mcq-spread-source-badge {
  font-size: 0.74rem;
  font-weight: 700;
  color: #0284c7;
  background: rgba(14, 165, 233, 0.12);
  border: 1px solid rgba(14, 165, 233, 0.28);
  padding: 3px 8px;
  border-radius: 4px;
  letter-spacing: 0.02em;
  display: inline-flex;
  align-items: center;
}

.btn-notes-jump {
  margin-left: auto;
  padding: 4px 10px;
  border-radius: 6px;
  background: rgba(99, 102, 241, 0.1);
  color: #6366f1;
  border: 1px solid rgba(99, 102, 241, 0.25);
  font-size: 0.74rem;
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  transition: all 0.2s ease;
}

.btn-notes-jump:hover {
  background: #6366f1;
  color: #ffffff;
  border-color: #6366f1;
  transform: translateY(-1px);
  box-shadow: 0 2px 6px rgba(99, 102, 241, 0.3);
}

/* MCQ Explanation Link to Notes */
.mcq-notes-link-box {
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px dashed rgba(255, 255, 255, 0.15);
}

.mcq-notes-link-btn {
  background: rgba(14, 165, 233, 0.15);
  border: 1px solid rgba(14, 165, 233, 0.3);
  color: #38bdf8;
  padding: 8px 14px;
  border-radius: 6px;
  font-size: 0.82rem;
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: all 0.2s ease;
}

.mcq-notes-link-btn:hover {
  background: #0284c7;
  color: #ffffff;
  border-color: #0284c7;
  transform: translateY(-1px);
  box-shadow: 0 3px 8px rgba(14, 165, 233, 0.35);
}

/* MCQ Topic / Spread Filter Select in Toolbar */
.mcq-spread-filter-box {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.8rem;
  color: #94a3b8;
  font-weight: 600;
}

.mcq-spread-select {
  padding: 6px 10px;
  border-radius: 6px;
  background: #1e293b;
  color: #f1f5f9;
  border: 1px solid #334155;
  font-size: 0.8rem;
  outline: none;
  max-width: 210px;
  cursor: pointer;
  text-overflow: ellipsis;
}

.mcq-spread-select:focus {
  border-color: #38bdf8;
  box-shadow: 0 0 0 2px rgba(56, 189, 248, 0.2);
}

/* Responsive Navbar Rules */
@media (max-width: 1450px) {
  .header-right .btn-library span,
  .header-right .btn-audio span,
  .header-right #viewModeToggleBtn,
  .header-right #themeToggleBtn {
    font-size: 0.78rem;
    padding: 5px 8px;
  }
}

@media (max-width: 1300px) {
  .header-right .btn-library span,
  .header-right .btn-audio span {
    display: none;
  }
  .header-right .btn-deepdive span.deepdive-label-long {
    display: none;
  }
  .header-right .btn-deepdive span.deepdive-label-short {
    display: inline !important;
  }
  .book-tab-btn {
    padding: 4px 7px;
    font-size: 0.75rem;
  }
  .search-box {
    flex: 0 1 150px;
    min-width: 110px;
  }
}

@media (max-width: 1100px) {
  .book-tab-label {
    display: none;
  }
  .book-tab-btn {
    padding: 4px 8px;
    font-size: 0.9rem;
  }
  .header-right .btn-tool {
    padding: 5px 8px;
    font-size: 0.78rem;
  }
  .search-box {
    flex: 0 1 120px;
    min-width: 90px;
  }
}

@media (max-width: 850px) {
  .header-right .font-controls,
  .header-right .theme-controls {
    display: none;
  }
}

/* ============================================================
   OFFICIAL SYLLABUS HEADING HIERARCHY (MAIN HEADING & SUBTOPIC)
   ============================================================ */
.syllabus-header-card {
  margin-bottom: 12px;
  padding-bottom: 8px;
  border-bottom: 2px solid rgba(217, 119, 6, 0.35);
}

.syllabus-pill {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  background: rgba(217, 119, 6, 0.12);
  color: #d97706;
  border: 1px solid rgba(217, 119, 6, 0.35);
  margin-bottom: 4px;
}

.syllabus-main-title {
  font-family: var(--font-title);
  font-size: 1.16rem !important;
  font-weight: 800 !important;
  color: var(--text-heading);
  line-height: 1.25 !important;
  margin: 3px 0 4px 0 !important;
  display: block;
}

.syllabus-subtopic-title {
  font-family: var(--font-body);
  font-size: 0.88rem !important;
  font-weight: 600 !important;
  color: var(--accent-color);
  margin: 0 0 6px 0 !important;
  display: flex;
  align-items: center;
  gap: 5px;
}

.syllabus-subtopic-title::before {
  content: "↳";
  font-weight: 700;
  color: var(--accent-color);
}



/* =========================================================================
   SARKARI HITH MULTI-VACANCY STUDY HUB ADDITIONS
   ========================================================================= */
.btn-portal-back {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 6px 10px;
  border-radius: 7px;
  background: rgba(185, 28, 28, 0.1);
  color: #b91c1c;
  font-weight: 700;
  font-size: 0.78rem;
  text-decoration: none;
  border: 1px solid rgba(185, 28, 28, 0.25);
  transition: all 0.2s ease;
  white-space: nowrap;
}
.btn-portal-back:hover {
  background: #b91c1c;
  color: #fff;
}

.btn-vacancy-hub {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 11px;
  border-radius: 7px;
  background: linear-gradient(135deg, #0f172a, #1e293b);
  color: #f8fafc;
  font-weight: 600;
  font-size: 0.78rem;
  border: 1px solid rgba(255, 255, 255, 0.16);
  cursor: pointer;
  white-space: nowrap;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.btn-vacancy-hub:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(15, 23, 42, 0.25);
}

.study-loading-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.72);
  backdrop-filter: blur(4px);
  z-index: 9999;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: #fff;
  gap: 12px;
}
.study-loading-overlay.hidden {
  display: none;
}
.study-spinner {
  width: 38px;
  height: 38px;
  border: 3px solid rgba(255, 255, 255, 0.25);
  border-top-color: #38bdf8;
  border-radius: 50%;
  animation: studySpin 0.8s linear infinite;
}
@keyframes studySpin {
  to { transform: rotate(360deg); }
}

.vacancy-hub-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(290px, 1fr));
  gap: 14px;
  margin-top: 14px;
  max-height: 55vh;
  overflow-y: auto;
  padding-right: 4px;
}
.vacancy-pack-card {
  background: var(--bg-surface, #fff);
  border: 1px solid var(--border-color, #e2e8f0);
  border-radius: 12px;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  cursor: pointer;
  transition: all 0.2s ease;
  text-align: left;
}
.vacancy-pack-card:hover {
  border-color: #b91c1c;
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.08);
}
.vacancy-pack-card.is-active {
  border-color: #b91c1c;
  box-shadow: 0 0 0 2px rgba(185, 28, 28, 0.2);
}
.vacancy-pack-badge {
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 999px;
  background: rgba(185, 28, 28, 0.1);
  color: #b91c1c;
  width: fit-content;
}
.vacancy-pack-title {
  font-family: var(--font-title);
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-heading, #0f172a);
  margin: 0;
}
.vacancy-pack-sub {
  font-size: 0.8rem;
  color: var(--text-muted, #64748b);
  line-height: 1.4;
  margin: 0;
}
.vacancy-pack-meta {
  font-size: 0.75rem;
  font-weight: 600;
  color: #0284c7;
  margin-top: auto;
  padding-top: 6px;
  border-top: 1px dashed rgba(148, 163, 184, 0.3);
}
.vacancy-hub-search {
  width: 100%;
  padding: 9px 12px;
  border-radius: 8px;
  border: 1px solid var(--border-color, #cbd5e1);
  font-size: 0.88rem;
  margin-top: 8px;
  background: var(--bg-surface, #fff);
  color: var(--text-heading, #0f172a);
}
