/* ==========================================================================
   Interactive Book System — Catalog (/book) & Manning liveBook Reader Styles
   ========================================================================== */

/* --- Language Switcher Pills (Shared between Catalog & Reader) --- */
.book-lang-switcher {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: rgba(20, 20, 20, 0.05);
  padding: 3px;
  border-radius: 9999px;
  border: 1px solid rgba(20, 20, 20, 0.1);
}

.book-lang-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 4px 11px;
  border-radius: 9999px;
  font-family: var(--font-body);
  font-size: 0.76rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  color: #52525b;
  text-decoration: none;
  transition: all 0.16s ease;
}

.book-lang-pill:hover {
  color: #111827;
}

.book-lang-pill.active {
  background: #141414;
  color: #ffffff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.14);
}

/* --- /book Catalog Page Additions (Matching index.html warm aesthetic) --- */
.book-catalog-top-controls {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 18px;
}

.book-catalog-chapters-list {
  list-style: none;
  margin: 14px 0 18px;
  padding: 12px 14px;
  background: var(--bg-card-subtle, #faf6f0);
  border: 1px solid var(--border-light, rgba(20, 20, 20, 0.09));
  border-radius: 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.book-catalog-chapter-item {
  border-bottom: 1px dashed rgba(20, 20, 20, 0.08);
  padding-bottom: 6px;
}

.book-catalog-chapter-item:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

.book-catalog-chapter-link {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-main, #141414);
  transition: color 0.15s ease;
}

.book-catalog-chapter-link:hover {
  color: var(--accent-warm, #d96b43);
}

.book-catalog-chapter-num {
  font-weight: 700;
  color: var(--accent-warm, #d96b43);
  min-width: 20px;
}

.book-catalog-chapter-title {
  flex: 1;
}

.book-catalog-chapter-arrow {
  color: var(--text-light, #948b81);
  font-size: 0.85rem;
}

.book-open-btn {
  padding: 9px 18px;
  font-size: 0.86rem;
}

/* ==========================================================================
   Manning liveBook Reader Layout (/book/:level & /book/:level/:page_slug)
   ========================================================================== */

body.livebook-body {
  background: #ffffff;
  color: #1f2937;
  font-family: var(--font-body, 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, sans-serif);
  min-height: 100vh;
  padding-bottom: 58px;
}

/* --- Top Header Bar --- */
.livebook-topbar {
  position: sticky;
  top: 0;
  z-index: 1100;
  height: 52px;
  background: #ffffff;
  border-bottom: 1px solid #e5e7eb;
  padding: 0 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.livebook-topbar-left {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.livebook-brand-logo {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-display, 'Fredoka', sans-serif);
  font-weight: 700;
  font-size: 1rem;
  color: #111827;
  white-space: nowrap;
}

.livebook-brand-img {
  width: 24px;
  height: 24px;
  object-fit: contain;
}

.livebook-topbar-divider {
  width: 1px;
  height: 20px;
  background: #e5e7eb;
}

.livebook-catalog-back-link {
  font-size: 0.82rem;
  font-weight: 600;
  color: #4b5563;
  padding: 4px 8px;
  border-radius: 6px;
  white-space: nowrap;
  transition: background 0.15s ease, color 0.15s ease;
}

.livebook-catalog-back-link:hover {
  background: #f3f4f6;
  color: #111827;
}

.livebook-levels-nav {
  display: flex;
  align-items: center;
  gap: 4px;
}

.livebook-level-pill {
  font-size: 0.75rem;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 5px;
  color: #4b5563;
  border: 1px solid #e5e7eb;
  background: #f9fafb;
  transition: all 0.15s ease;
}

.livebook-level-pill:hover {
  border-color: #9ca3af;
  color: #111827;
}

.livebook-level-pill.active {
  background: #eff6ff;
  border-color: #2563eb;
  color: #1d4ed8;
}

.livebook-topbar-search {
  flex: 1;
  max-width: 440px;
  position: relative;
  display: flex;
  align-items: center;
}

.livebook-search-icon {
  position: absolute;
  left: 11px;
  color: #6b7280;
  pointer-events: none;
}

.livebook-search-input {
  width: 100%;
  padding: 7px 12px 7px 34px;
  font-family: inherit;
  font-size: 0.85rem;
  color: #111827;
  background: #f9fafb;
  border: 1px solid transparent;
  border-radius: 6px;
  outline: none;
  transition: all 0.15s ease;
}

.livebook-search-input:focus {
  background: #ffffff;
  border-color: #cbd5e1;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.livebook-topbar-right {
  display: flex;
  align-items: center;
  gap: 10px;
}

/* --- Workspace Split Layout (Sidebar + Main Area) --- */
.livebook-workspace {
  display: flex;
  align-items: stretch;
  min-height: calc(100vh - 108px);
  position: relative;
}

.livebook-sidebar-backdrop {
  display: none;
}

/* --- Left Navigation Sidebar (Manning liveBook TOC) --- */
.livebook-sidebar {
  width: 315px;
  flex-shrink: 0;
  background: #ffffff;
  border-right: 1px solid #e5e7eb;
  display: flex;
  flex-direction: column;
  height: calc(100vh - 108px);
  position: sticky;
  top: 52px;
  overflow: hidden;
  transition: margin-left 0.24s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.2s ease;
}

.livebook-workspace:not(.is-sidebar-open) .livebook-sidebar {
  margin-left: -315px;
  opacity: 0;
  pointer-events: none;
}

.livebook-sidebar-meta {
  padding: 18px 18px 14px;
}

.livebook-sidebar-meta-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.livebook-book-title {
  font-family: Georgia, 'Times New Roman', serif;
  font-size: 0.96rem;
  font-weight: 700;
  color: #111827;
  line-height: 1.35;
}

.livebook-book-subtitle {
  font-family: Georgia, 'Times New Roman', serif;
  font-size: 0.78rem;
  font-weight: 600;
  color: #374151;
  margin-top: 4px;
  line-height: 1.35;
}

.livebook-book-author {
  font-size: 0.76rem;
  color: #6b7280;
  margin-top: 6px;
}

/* Sidebar Tabs (table of contents | notebook) */
.livebook-sidebar-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  border-bottom: 1px solid #e5e7eb;
}

.livebook-tab-btn {
  padding: 10px 8px;
  font-size: 0.82rem;
  font-weight: 700;
  color: #4b5563;
  text-align: center;
  border-bottom: 2px solid transparent;
  transition: color 0.15s ease, border-color 0.15s ease;
}

.livebook-tab-btn:hover {
  color: #111827;
}

.livebook-tab-btn.is-active {
  color: #111827;
  border-bottom-color: #1d4ed8;
}

.livebook-sidebar-panel {
  flex: 1;
  overflow-y: auto;
  padding: 12px 10px 28px;
}

/* TOC Hierarchy */
.livebook-toc-section {
  margin-bottom: 14px;
}

.livebook-toc-section-header {
  font-size: 0.76rem;
  font-weight: 600;
  color: #6b7280;
  padding: 6px 8px;
}

.livebook-toc-chapter-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.livebook-toc-chapter {
  border-radius: 4px;
  padding: 4px 6px;
  transition: background 0.15s ease;
}

.livebook-toc-chapter.is-active {
  background: #f0f4f9;
  border: 1px solid #dce6f4;
  padding: 8px 6px 10px;
}

.livebook-toc-chapter-row {
  display: flex;
  align-items: flex-start;
  gap: 4px;
}

.livebook-toc-chevron {
  width: 20px;
  height: 20px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #6b7280;
  flex-shrink: 0;
  margin-top: 1px;
  transition: transform 0.16s ease;
}

.livebook-toc-chapter.is-expanded .livebook-toc-chevron {
  transform: rotate(90deg);
  color: #1d4ed8;
}

.livebook-toc-chapter-link {
  font-size: 0.82rem;
  line-height: 1.4;
  color: #374151;
  font-weight: 500;
  flex: 1;
  padding: 1px 4px;
}

.livebook-toc-chapter-link:hover {
  color: #1d4ed8;
}

.livebook-toc-chapter.is-active .livebook-toc-chapter-link {
  color: #1d4ed8;
  font-weight: 700;
}

.livebook-toc-sublist {
  list-style: none;
  margin-top: 6px;
  padding-left: 20px;
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.livebook-toc-sublink {
  display: flex;
  align-items: baseline;
  gap: 6px;
  font-size: 0.79rem;
  line-height: 1.38;
  color: #374151;
  padding: 2px 4px;
  border-radius: 3px;
}

.livebook-toc-sublink:hover,
.livebook-toc-sublink.is-in-view {
  color: #1d4ed8;
  background: rgba(29, 78, 216, 0.06);
}

.livebook-toc-num {
  color: #4b5563;
  font-size: 0.76rem;
  min-width: 22px;
}

.livebook-toc-leaf-list {
  list-style: none;
  padding-left: 26px;
  margin-top: 3px;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.livebook-toc-leaf-link {
  display: block;
  font-size: 0.76rem;
  color: #4b5563;
  padding: 2px 4px;
  line-height: 1.35;
}

.livebook-toc-leaf-link:hover {
  color: #1d4ed8;
}

/* Notebook Tab */
.livebook-notebook-wrap {
  padding: 6px 8px;
}

.livebook-notebook-title {
  font-size: 0.82rem;
  font-weight: 700;
  color: #374151;
  margin-bottom: 10px;
}

.livebook-notebook-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.livebook-notebook-play {
  width: 100%;
  justify-content: space-between;
}

.livebook-notebook-empty {
  font-size: 0.82rem;
  color: #6b7280;
  line-height: 1.5;
}

/* --- Main Reader Content Column --- */
.livebook-main-area {
  flex: 1;
  min-width: 0;
  position: relative;
  background: #ffffff;
}

.livebook-subbar {
  position: sticky;
  top: 52px;
  z-index: 950;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 20px 0;
  pointer-events: none;
}

.livebook-sidebar-toggle {
  width: 34px;
  height: 34px;
  border-radius: 6px;
  color: #4b5563;
  background: rgba(255, 255, 255, 0.9);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  pointer-events: auto;
  transition: background 0.15s ease, color 0.15s ease;
}

.livebook-sidebar-toggle:hover {
  background: #f3f4f6;
  color: #111827;
}

.livebook-subbar-right {
  display: flex;
  align-items: center;
  gap: 8px;
  pointer-events: auto;
}

.livebook-badge-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 26px;
  padding: 0 8px;
  font-size: 0.74rem;
  font-weight: 700;
  border-radius: 4px;
  border: 1.5px solid #cbd5e1;
  color: #475569;
  background: #ffffff;
}

.livebook-badge-btn:hover {
  border-color: #2563eb;
  color: #1d4ed8;
}


.livebook-reader-container {
  max-width: 680px;
  margin: 0 auto;
  padding: 8px 28px 96px;
}

.livebook-reader-container.is-large-font .livebook-prose {
  font-size: 1.26rem;
}

/* Chapter Header (Matching Manning liveBook) */
.livebook-chapter-eyebrow {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.82rem;
  color: #6b7280;
  margin-bottom: 14px;
}

.livebook-chapter-title {
  font-family: var(--font-body, 'Plus Jakarta Sans', sans-serif);
  font-size: clamp(2rem, 4vw, 2.75rem);
  font-weight: 800;
  color: #111827;
  line-height: 1.15;
  letter-spacing: -0.025em;
  margin-bottom: 22px;
  text-wrap: balance;
}

.livebook-play-circle {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.livebook-play-yellow {
  background: #f5c518;
  color: #ffffff;
}

.livebook-play-circle.is-playing,
.livebook-bottom-play.is-playing {
  background: #dc2626;
  animation: livebook-pulse 1.5s infinite;
}

@keyframes livebook-pulse {
  0% { box-shadow: 0 0 0 0 rgba(245, 197, 24, 0.55); }
  70% { box-shadow: 0 0 0 8px rgba(245, 197, 24, 0); }
  100% { box-shadow: 0 0 0 0 rgba(245, 197, 24, 0); }
}

/* "This chapter covers" Summary Box */
.livebook-covers-box {
  padding: 16px 14px 20px;
  border-bottom: 1px solid #e5e7eb;
  margin-bottom: 28px;
}

.livebook-covers-title {
  font-family: var(--font-body, 'Plus Jakarta Sans', sans-serif);
  font-size: 0.94rem;
  font-weight: 700;
  color: #111827;
  margin-bottom: 10px;
}

.livebook-covers-list {
  padding-left: 22px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.livebook-covers-list li {
  font-size: 0.9rem;
  color: #374151;
  line-height: 1.5;
}

/* --- Book Editorial Typography (.livebook-prose) --- */
.livebook-prose {
  font-family: Georgia, Cambria, 'Times New Roman', Times, serif;
  font-size: 1.1rem;
  line-height: 1.8;
  color: #1f2937;
}

.livebook-prose p {
  margin-bottom: 1.35rem;
  text-wrap: pretty;
}

.livebook-prose .book-heading {
  font-family: var(--font-body, 'Plus Jakarta Sans', sans-serif);
  color: #111827;
  font-weight: 800;
  line-height: 1.28;
  margin-top: 2.3rem;
  margin-bottom: 0.95rem;
  scroll-margin-top: 72px;
  text-wrap: balance;
}

.livebook-prose .book-h2 {
  font-size: 1.5rem;
  padding-bottom: 6px;
  border-bottom: 1px solid #f3f4f6;
}

.livebook-prose .book-h3 {
  font-size: 1.2rem;
  margin-top: 1.7rem;
}

.livebook-prose .book-heading-num {
  color: #1d4ed8;
  margin-right: 4px;
}

.livebook-prose .book-list {
  margin: 0 0 1.4rem 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}

.livebook-prose .book-list li {
  text-wrap: pretty;
}

.livebook-prose .book-sublist {
  margin: 0.45rem 0 0.6rem 1.4rem;
  gap: 0.35rem;
}

.livebook-prose .book-divider {
  border: none;
  border-top: 1px solid #e5e7eb;
  margin: 2rem 0;
}

/* --- Inline Audio Word/Phrase Pronunciation Button --- */
.book-audio-inline {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 2px 10px 2px 10px;
  margin: 0 2px;
  border-radius: 9999px;
  background: #fefce8;
  border: 1px solid #fde047;
  font-family: var(--font-body, 'Plus Jakarta Sans', sans-serif);
  font-size: 0.92em;
  font-weight: 700;
  color: #854d0e;
  line-height: 1.45;
  vertical-align: baseline;
  cursor: pointer;
  transition: all 0.16s ease;
}

.book-audio-inline:hover {
  background: #fef08a;
  border-color: #eab308;
  transform: translateY(-1px);
  box-shadow: 0 2px 6px rgba(234, 179, 8, 0.2);
}

.book-audio-inline.is-playing {
  background: #f5c518;
  border-color: #ca8a04;
  color: #111827;
  box-shadow: 0 0 0 4px rgba(245, 197, 24, 0.3);
}

.book-audio-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #ca8a04;
}

.book-audio-inline.is-playing .book-audio-icon {
  color: #111827;
}

.book-audio-icon-btn,
.book-audio-inline.book-audio-icon-only {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  margin: 0 2px;
  border: none;
  border-radius: 0;
  background: none;
  box-shadow: none;
  color: inherit;
  vertical-align: middle;
  cursor: pointer;
}

.book-audio-icon-btn:hover,
.book-audio-icon-btn.is-playing,
.book-audio-inline.book-audio-icon-only:hover,
.book-audio-inline.book-audio-icon-only.is-playing {
  background: none;
  border: none;
  box-shadow: none;
  transform: none;
  color: #ca8a04;
}

/* --- Manning-Style Highlight Passage with Left Yellow Border & Margin Play Button --- */
.book-highlight-passage {
  position: relative;
  margin: 1.6rem 0;
}

.book-margin-play-btn {
  position: absolute;
  left: -42px;
  top: 6px;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: #f5c518;
  color: #ffffff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 6px rgba(245, 197, 24, 0.35);
  transition: transform 0.15s ease, background 0.15s ease;
}

.book-margin-play-btn:hover {
  transform: scale(1.08);
  background: #eab308;
}

.book-margin-play-btn.is-playing {
  background: #dc2626;
}

.book-callout {
  border-left: 3.5px solid #f5c518;
  padding: 6px 0 6px 18px;
  background: linear-gradient(90deg, rgba(254, 252, 232, 0.65) 0%, rgba(255, 255, 255, 0) 100%);
}

.book-callout p:last-child {
  margin-bottom: 0;
}

/* --- Tables in Book Chapters --- */
.book-table-wrap {
  overflow-x: auto;
  margin: 1.5rem 0;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
}

.book-table {
  width: 100%;
  border-collapse: collapse;
  font-family: var(--font-body, sans-serif);
  font-size: 0.92rem;
}

.book-table th,
.book-table td {
  padding: 11px 14px;
  text-align: left;
  border-bottom: 1px solid #e5e7eb;
}

.book-table th {
  background: #f8fafc;
  font-weight: 700;
  color: #111827;
}

.book-table tr:last-child td {
  border-bottom: none;
}

/* --- Interactive Knowledge Check / liveTest Quiz Cards --- */
.book-quiz-card {
  margin: 2.4rem 0;
  padding: 24px;
  background: #f8fafc;
  border: 1.5px solid #dbeafe;
  border-radius: 14px;
  font-family: var(--font-body, 'Plus Jakarta Sans', sans-serif);
  box-shadow: 0 6px 20px rgba(37, 99, 235, 0.05);
  scroll-margin-top: 72px;
}

.book-quiz-header {
  margin-bottom: 18px;
}

.book-quiz-badge-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 6px;
}

.book-quiz-badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: 9999px;
  background: #dbeafe;
  color: #1d4ed8;
  font-size: 0.75rem;
  font-weight: 800;
  letter-spacing: 0.03em;
}

.book-quiz-score {
  font-size: 0.8rem;
  font-weight: 700;
  color: #475569;
}

.book-quiz-title {
  font-size: 1.2rem;
  font-weight: 800;
  color: #111827;
}

.book-quiz-question {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  padding: 16px;
  margin-bottom: 14px;
}

.book-quiz-question-header {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 12px;
}

.book-quiz-q-num {
  font-size: 0.74rem;
  font-weight: 800;
  color: #2563eb;
  background: #eff6ff;
  padding: 2px 8px;
  border-radius: 9999px;
}

.book-quiz-prompt {
  font-size: 0.96rem;
  font-weight: 700;
  color: #111827;
  margin: 0 !important;
  flex: 1;
}

.book-quiz-options {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.book-quiz-option {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  cursor: pointer;
  font-size: 0.9rem;
  color: #334155;
  transition: all 0.14s ease;
}

.book-quiz-option:hover {
  border-color: #93c5fd;
  background: #f8fafc;
}

.book-quiz-option.is-correct {
  border-color: #16a34a;
  background: #f0fdf4;
  color: #14532d;
  font-weight: 600;
}

.book-quiz-option.is-wrong {
  border-color: #dc2626;
  background: #fef2f2;
  color: #7f1d1d;
}

.book-quiz-feedback {
  margin-top: 10px;
  padding: 9px 12px;
  border-radius: 7px;
  font-size: 0.84rem;
  line-height: 1.45;
}

.book-quiz-feedback.is-success {
  background: #dcfce7;
  color: #166534;
}

.book-quiz-feedback.is-error {
  background: #fee2e2;
  color: #991b1b;
}

.book-quiz-footer {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 14px;
}

.book-quiz-btn {
  padding: 9px 18px;
  border-radius: 8px;
  font-size: 0.86rem;
  font-weight: 700;
  transition: all 0.15s ease;
}

.book-quiz-check-btn {
  background: #1d4ed8;
  color: #ffffff;
}

.book-quiz-check-btn:hover {
  background: #1e40af;
}

.book-quiz-reset-btn {
  background: #ffffff;
  border: 1px solid #cbd5e1;
  color: #475569;
}

.book-quiz-reset-btn:hover {
  background: #f1f5f9;
  color: #0f172a;
}

/* Custom HTML Interactive Exercise Blocks inside Markdown */
.book-html-test {
  margin: 2rem 0;
  padding: 22px;
  background: #fffbeb;
  border: 1.5px solid #fde68a;
  border-radius: 14px;
  font-family: var(--font-body, 'Plus Jakarta Sans', sans-serif);
}

/* ==========================================================================
   Interactive Prepositions of Place Game (.book-prep-game)
   ========================================================================== */
.book-prep-game {
  margin: 2.5rem 0;
  padding: 26px 24px;
  background: #fdfefe;
  border: 1.5px solid #e2e8f0;
  border-radius: 18px;
  box-shadow: 0 4px 16px rgba(15, 23, 42, 0.04);
  font-family: var(--font-body, 'Plus Jakarta Sans', sans-serif);
}

.book-prep-header {
  margin-bottom: 20px;
}

.book-prep-badge-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}

.book-prep-badge {
  display: inline-flex;
  align-items: center;
  padding: 4px 12px;
  border-radius: 9999px;
  background: #f1f5f9;
  color: #334155;
  font-size: 0.76rem;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.book-prep-score {
  font-size: 0.82rem;
  font-weight: 700;
  color: #475569;
}

.book-prep-title {
  font-size: 1.25rem;
  font-weight: 800;
  color: #0f172a;
  margin: 0 0 6px 0;
}

.book-prep-hint {
  font-size: 0.88rem;
  color: #64748b;
  margin: 0 !important;
}

.book-prep-stage-container {
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 24px 16px;
  margin: 18px 0;
  background: #f8fafc;
  border: 1px dashed #cbd5e1;
  border-radius: 14px;
}

.book-prep-stage {
  display: flex;
  justify-content: center;
  align-items: center;
  width: 100%;
  max-width: 320px;
  height: 200px;
}

.book-prep-svg {
  width: 100%;
  height: 100%;
  max-height: 200px;
  display: block;
}

.book-prep-interactive-row {
  margin: 20px 0 16px;
  display: flex;
  justify-content: center;
}

.book-prep-sentence {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 8px;
  font-size: 1.05rem;
  color: #1e293b;
  font-weight: 600;
  text-align: center;
}

.book-prep-color-chip {
  padding: 2px 8px;
  border-radius: 6px;
  font-weight: 800;
  border: 1px solid rgba(0, 0, 0, 0.12);
  display: inline-block;
  line-height: 1.3;
}

.book-prep-select {
  appearance: auto;
  font-family: inherit;
  font-size: 1rem;
  font-weight: 700;
  color: #0f172a;
  background-color: #ffffff;
  padding: 8px 12px;
  border: 1.5px solid #94a3b8;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.15s ease;
  outline: none;
}

.book-prep-select:focus {
  border-color: #3b82f6;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}

.book-prep-target-noun {
  font-weight: 700;
}

.book-prep-feedback {
  margin: 14px 0;
  padding: 10px 14px;
  border-radius: 8px;
  font-size: 0.9rem;
  font-weight: 600;
  text-align: center;
}

.book-prep-feedback.is-correct {
  background: #dcfce7;
  color: #15803d;
  border: 1px solid #bbf7d0;
}

.book-prep-feedback.is-wrong {
  background: #fee2e2;
  color: #b91c1c;
  border: 1px solid #fecaca;
}

.book-prep-controls {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin-top: 18px;
}

.book-prep-btn {
  font-family: inherit;
  font-size: 0.92rem;
  font-weight: 700;
  padding: 10px 22px;
  border-radius: 8px;
  border: 1px solid transparent;
  cursor: pointer;
  transition: all 0.15s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.book-prep-btn-primary {
  background: #0f172a;
  color: #ffffff;
}

.book-prep-btn-primary:hover {
  background: #334155;
  transform: translateY(-1px);
}

.book-prep-btn-secondary {
  background: #ffffff;
  color: #334155;
  border-color: #cbd5e1;
}

.book-prep-btn-secondary:hover {
  background: #f8fafc;
  border-color: #94a3b8;
}

/* ==========================================================================
   Silent Letters & Textbook Conjugation Tables (.book-silent, .book-conj-*)
   ========================================================================== */
.book-silent {
  color: #9ca3af !important;
  font-weight: 400;
}

.book-audio-inline .book-silent {
  color: #a1a1aa !important;
  font-weight: 500;
}

.book-conj-card {
  margin: 1.75rem 0 2rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  font-family: var(--font-body, 'Plus Jakarta Sans', sans-serif);
}

.book-conj-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 6px 28px;
  border-radius: 9999px;
  border: 2px solid #d97706;
  background: #fffbeb;
  color: #0369a1;
  font-size: 1.25rem;
  font-weight: 800;
  letter-spacing: 0.01em;
  margin-bottom: 12px;
  box-shadow: 0 2px 6px rgba(217, 119, 6, 0.1);
}

.book-conj-box {
  width: 100%;
  background: #f8fafc;
  border: 1.5px solid #e2e8f0;
  border-radius: 18px;
  padding: 16px 20px;
  box-shadow: 0 4px 14px rgba(15, 23, 42, 0.03);
  overflow-x: auto;
}

.book-conj-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 1rem;
}

.book-conj-table th {
  text-align: left;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #64748b;
  padding: 8px 12px;
  border-bottom: 1.5px solid #e2e8f0;
}

.book-conj-table td {
  padding: 10px 12px;
  border-bottom: 1px dashed #e2e8f0;
  vertical-align: middle;
}

.book-conj-table tr:last-child td {
  border-bottom: none;
}

.book-conj-form-cell {
  font-size: 1.12rem;
  font-weight: 700;
  white-space: nowrap;
}

.book-conj-pronoun {
  color: #15803d;
  font-weight: 600;
}

.book-conj-stem {
  color: #0369a1;
  font-weight: 700;
}

.book-conj-ending {
  color: #dc2626;
  font-weight: 700;
}

.book-er-showcase {
  margin: 1.75rem 0 2rem;
  padding: 20px;
  background: #f8fafc;
  border: 1.5px solid #e2e8f0;
  border-radius: 18px;
  font-family: var(--font-body, 'Plus Jakarta Sans', sans-serif);
}

.book-er-formula {
  text-align: center;
  font-size: 1.05rem;
  font-weight: 800;
  margin-bottom: 16px !important;
  color: #1e293b;
}

.book-er-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
  inline-size: 100%;
}

.book-er-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  background: #ffffff;
  border: 1.5px solid #e2e8f0;
  border-radius: 14px;
  padding: 16px 20px;
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.03);
}

.book-er-list {
  list-style: none;
  margin: 0 !important;
  padding: 0 !important;
  width: 100%;
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 1.08rem;
}

.book-er-rule-banner {
  margin-top: 16px;
  padding: 12px 16px;
  background: #fef9c3;
  border: 1.5px solid #fde047;
  border-radius: 12px;
  text-align: center;
  font-size: 0.96rem;
  color: #1e293b;
}

.book-conj-ipa {
  font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, sans-serif;
  font-size: 0.9rem;
  color: #475569;
  white-space: nowrap;
}

.book-conj-meaning {
  font-size: 0.92rem;
  color: #334155;
}

/* Interactive Conjugation Game Stage Extensions (reusing .book-prep-game) */
.book-conj-mode-bar {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 14px;
}

.book-conj-mode-btn {
  font-family: inherit;
  font-size: 0.8rem;
  font-weight: 700;
  padding: 6px 14px;
  border-radius: 9999px;
  border: 1px solid #cbd5e1;
  background: #ffffff;
  color: #475569;
  cursor: pointer;
  transition: all 0.15s ease;
}

.book-conj-mode-btn:hover {
  border-color: #94a3b8;
  color: #0f172a;
}

.book-conj-mode-btn.is-active {
  background: #0f172a;
  border-color: #0f172a;
  color: #ffffff;
}

.book-conj-stage {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  text-align: center;
  width: 100%;
}

.book-conj-stage-badges {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 8px;
}

.book-conj-verb-pill {
  display: inline-flex;
  align-items: center;
  padding: 4px 16px;
  border-radius: 9999px;
  border: 2px solid #d97706;
  background: #fffbeb;
  color: #0369a1;
  font-size: 0.95rem;
  font-weight: 800;
}

.book-conj-task-pill {
  display: inline-flex;
  align-items: center;
  padding: 4px 12px;
  border-radius: 9999px;
  background: #e0f2fe;
  color: #0369a1;
  font-size: 0.78rem;
  font-weight: 700;
}

.book-conj-translation {
  font-size: 0.95rem;
  color: #475569;
  font-style: italic;
  margin: 0 !important;
}

.book-html-test-desc {
  font-size: 0.92rem;
  color: #4b5563;
  margin: 6px 0 12px !important;
}

.book-html-test-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  font-size: 0.96rem;
  font-weight: 600;
}

.book-html-test-input {
  padding: 8px 12px;
  border: 1.5px solid #cbd5e1;
  border-radius: 8px;
  font-family: inherit;
  font-size: 0.92rem;
  background: #ffffff;
  color: #111827;
  min-width: 180px;
}

.book-html-test-input:focus {
  outline: none;
  border-color: #2563eb;
}

/* --- Sticky Bottom Bar (Prev | Chapter + Book Title | Next Chapter) --- */
.livebook-bottom-bar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 1050;
  height: 56px;
  background: #ffffff;
  border-top: 1px solid #e5e7eb;
  padding: 0 22px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.livebook-nav-step {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.82rem;
  font-weight: 700;
  color: #374151;
  padding: 6px 10px;
  border-radius: 6px;
  white-space: nowrap;
  transition: background 0.15s ease, color 0.15s ease;
}

.livebook-nav-step:hover {
  background: #f3f4f6;
  color: #1d4ed8;
}

.livebook-bottom-center {
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 0;
  text-align: center;
}

.livebook-bottom-chapter-row {
  display: flex;
  align-items: center;
  gap: 7px;
  max-width: 100%;
}

.livebook-bottom-play {
  width: 20px;
  height: 20px;
}

.livebook-bottom-chapter-title {
  font-size: 0.82rem;
  font-weight: 800;
  color: #111827;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 420px;
}

.livebook-bottom-book-subtitle {
  font-size: 0.72rem;
  color: #6b7280;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 420px;
}

/* ==========================================================================
   Mobile & Tablet Responsive Styles
   ========================================================================== */
@media (max-width: 900px) {
  .livebook-topbar-search {
    max-width: 200px;
  }

  .livebook-brand-name,
  .livebook-catalog-back-link {
    display: none;
  }

  .livebook-sidebar {
    position: fixed;
    top: 52px;
    left: 0;
    bottom: 56px;
    height: auto;
    z-index: 1200;
    margin-left: 0 !important;
    transform: translateX(0);
    opacity: 1 !important;
    pointer-events: auto !important;
    box-shadow: 12px 0 32px rgba(0, 0, 0, 0.14);
    transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  }

  .livebook-workspace:not(.is-sidebar-open) .livebook-sidebar {
    transform: translateX(-104%);
  }

  .livebook-workspace.is-sidebar-open .livebook-sidebar-backdrop {
    display: block;
    position: fixed;
    top: 52px;
    left: 0;
    right: 0;
    bottom: 56px;
    background: rgba(15, 23, 42, 0.35);
    z-index: 1150;
  }

  .book-margin-play-btn {
    position: static;
    margin-bottom: 8px;
  }

  .livebook-reader-container {
    padding: 8px 18px 80px;
  }

  .livebook-bottom-chapter-title,
  .livebook-bottom-book-subtitle {
    max-width: 190px;
  }
}
