/* ==========================================================================
   TOÁN THẦY AN — BÀI BÁO TƯƠNG TÁC CHUẨN SEO & EDTECH CAO CẤP (v2.5)
   File: frontend/css/article.css
   Mục tiêu: Đọc êm mắt (Soft Glassmorphism), Karaoke từng chữ mượt mà,
             4 Trạm tương tác Mục 4, Menu sổ máy tính & Dụng cụ học tập,
             Mục lục di động góc trái trên cùng
   ========================================================================== */

/* 1. KHUNG CHỨA BÀI VIẾT (READING CONTAINER) */
.article-wrapper {
  background: var(--bg-page);
  min-height: 100vh;
  padding-bottom: 120px;
  position: relative;
}

.article-container {
  max-width: 860px;
  margin: 0 auto;
  padding: 32px 24px 80px;
  background: var(--bg-surface);
  border-radius: var(--radius-lg, 12px);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.04);
  border: 1px solid var(--border-color);
  margin-top: 24px;
}

/* 2. HEADER BÀI GIẢNG CHUẨN SEO */
.article-header {
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 24px;
  margin-bottom: 32px;
}

.article-breadcrumb {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.88rem;
  color: var(--text-muted);
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.article-breadcrumb a {
  color: var(--primary);
  text-decoration: none;
  font-weight: 600;
  transition: color 0.15s ease;
}

.article-breadcrumb a:hover {
  text-decoration: underline;
}

.article-title-h1 {
  font-size: 2.05rem;
  font-weight: 800;
  color: var(--text-main);
  line-height: 1.35;
  margin: 0 0 16px 0;
  letter-spacing: -0.02em;
}

.article-meta-bar {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
  font-size: 0.86rem;
  color: var(--text-muted);
}

.meta-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.meta-tag-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  border-radius: 9999px;
  font-size: 0.78rem;
  font-weight: 700;
  background: var(--primary-light);
  color: var(--primary);
}

.meta-tag-pill.green {
  background: #ecfdf5;
  color: #059669;
}

.meta-tag-pill.amber {
  background: #fffbeb;
  color: #d97706;
}

/* 3. ĐỊNH DẠNG NỘI DUNG VĂN BẢN (TYPOGRAPHY) */
.article-body {
  font-size: 1.06rem;
  line-height: 1.85;
  color: var(--text-secondary);
  word-break: break-word;
}

.article-body p {
  margin-bottom: 1.4em;
}

.article-body h2 {
  font-size: 1.48rem;
  font-weight: 800;
  color: var(--text-main);
  margin: 2.4em 0 0.8em;
  padding-bottom: 8px;
  border-bottom: 2px solid var(--border-color);
  display: flex;
  align-items: center;
  gap: 10px;
  scroll-margin-top: 80px;
}

.article-body h3 {
  font-size: 1.22rem;
  font-weight: 700;
  color: var(--text-main);
  margin: 1.8em 0 0.6em;
  scroll-margin-top: 80px;
}

.article-body h4 {
  font-size: 1.08rem;
  font-weight: 700;
  color: var(--text-main);
  margin: 1.4em 0 0.5em;
}

/* 4. HỘP ĐẶC TRƯNG — BẢNG MÀU KÍNH MỜ PASTEL DỊU MẮT (SOFT GLASSMORPHISM) */
.article-callout {
  padding: 18px 22px;
  border-radius: 12px;
  margin: 24px 0;
  border-left: 4px solid;
  border-top: 1px solid rgba(0, 0, 0, 0.05);
  border-right: 1px solid rgba(0, 0, 0, 0.05);
  border-bottom: 1px solid rgba(0, 0, 0, 0.05);
  position: relative;
  transition: all 0.2s ease;
}

.callout-header {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 800;
  font-size: 0.92rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  margin-bottom: 10px;
}

/* Định nghĩa SGK: Xanh dương phấn dịu êm */
.callout-sgk {
  border-left-color: #0056d2;
  background: #f0f7ff;
  border-color: #dbeafe;
}
.callout-sgk .callout-header {
  color: #0056d2;
}

/* Mẹo Thầy An: Xanh lục bảo ngọc */
.callout-tip {
  border-left-color: #10b981;
  background: #f0fdf4;
  border-color: #dcfce7;
}
.callout-tip .callout-header {
  color: #059669;
}

/* Cảnh báo bẫy thi: Đỏ san hô nhạt, chữ êm dịu, KHÔNG CHÓI LÒE LOẸT */
.callout-warning {
  border-left-color: #f87171;
  background: #fff5f5;
  border-color: #fee2e2;
}
.callout-warning .callout-header {
  color: #dc2626;
}

/* Vận dụng thực tế: Tím phấn nhẹ nhàng */
.callout-realworld {
  border-left-color: #8b5cf6;
  background: #f5f3ff;
  border-color: #ede9fe;
}
.callout-realworld .callout-header {
  color: #7c3aed;
}

/* 5. CÔNG THỨC TOÁN KATEX KHỐI (MATH BLOCK) */
.math-card {
  background: var(--bg-surface-soft);
  border: 1px solid var(--border-color);
  border-radius: 10px;
  padding: 16px 20px;
  margin: 18px 0;
  text-align: center;
  overflow-x: auto;
}

.math-card .katex-display {
  margin: 0.5em 0;
}

/* 6. HIỆU ỨNG KARAOKE TỪNG CHỮ MƯỢT MÀ (WORD-BY-WORD SMOOTH KARAOKE) */
span[data-sentence-id] {
  border-radius: 4px;
  padding: 1px 2px;
  background: transparent;
}

span[data-sentence-id]:hover {
  background: rgba(0, 86, 210, 0.05);
  cursor: pointer;
}

/* Khi cả câu đang được nói: BỎ HOÀN TOÀN NỀN MỜ DƯỚI CÂU THEO GÓP Ý CỦA LOUIS */
span[data-sentence-id].narrating-active {
  background: transparent !important;
  box-shadow: none !important;
}

/* Từng chữ chạy mượt mà: Ánh sáng vàng hổ phách ấm, chuyển động êm dịu không giật lag */
.karaoke-word {
  display: inline;
  border-radius: 4px;
  padding: 1px 3px;
  margin: 0 -1px;
  transition: color 0.2s cubic-bezier(0.4, 0, 0.2, 1), 
              background 0.2s cubic-bezier(0.4, 0, 0.2, 1), 
              text-shadow 0.2s cubic-bezier(0.4, 0, 0.2, 1),
              box-shadow 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.karaoke-word.active-word {
  color: #b45309;
  font-weight: 800;
  background: rgba(245, 158, 11, 0.25);
  text-shadow: 0 0 12px rgba(245, 158, 11, 0.45);
  box-shadow: 0 0 0 2px rgba(245, 158, 11, 0.2);
}

/* 7. MÔ HÌNH HÌNH HỌC / CANVAS TRỰC QUAN TƯƠNG TÁC (INTERACTIVE 3D/2D) */
.interactive-visual-card {
  border: 1px solid var(--border-color);
  border-radius: 12px;
  overflow: hidden;
  background: var(--bg-surface);
  margin: 28px 0;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.03);
}

.visual-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 18px;
  background: var(--bg-surface-soft);
  border-bottom: 1px solid var(--border-color);
}

.visual-title {
  font-weight: 700;
  font-size: 0.94rem;
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text-main);
}

.visual-controls {
  display: flex;
  align-items: center;
  gap: 8px;
}

.visual-btn {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  padding: 6px 12px;
  border-radius: 6px;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  transition: all 0.15s ease;
}

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

.visual-canvas-stage {
  position: relative;
  width: 100%;
  height: 380px;
  background: #0f172a;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}

.visual-canvas-stage canvas {
  width: 100%;
  height: 100%;
  display: block;
}

.visual-hint-overlay {
  position: absolute;
  bottom: 10px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(15, 23, 42, 0.8);
  color: #e2e8f0;
  padding: 4px 14px;
  border-radius: 9999px;
  font-size: 0.76rem;
  pointer-events: none;
  backdrop-filter: blur(4px);
  border: 1px solid rgba(255, 255, 255, 0.1);
}

/* 8. BỐN TRẠM LUYỆN TẬP TOÁN TƯƠNG TÁC Ở MỤC 4 (INTERACTIVE BLOOM MINI-LABS) */
.bloom-lab-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 22px;
  margin-bottom: 24px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.02);
  transition: border-color 0.2s ease;
}

.bloom-lab-card:hover {
  border-color: #cbd5e1;
}

.bloom-lab-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 14px;
  flex-wrap: wrap;
  gap: 8px;
}

.bloom-lab-badge {
  font-size: 0.78rem;
  font-weight: 800;
  padding: 3px 10px;
  border-radius: 9999px;
  letter-spacing: 0.5px;
}

.bloom-lab-badge.b1 { background: #e0f2fe; color: #0284c7; }
.bloom-lab-badge.b2 { background: #dcfce7; color: #16a34a; }
.bloom-lab-badge.b3 { background: #fef3c7; color: #d97706; }
.bloom-lab-badge.b4 { background: #f3e8ff; color: #9333ea; }

.bloom-interactive-stage {
  background: var(--bg-surface-soft);
  border: 1px dashed var(--border-color);
  border-radius: 10px;
  padding: 16px 18px;
  margin: 14px 0;
}

/* Dạng 1: Các nút chọn ký hiệu ∈ / ∉ */
.symbol-selector-row {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
  margin-top: 10px;
}

.sym-item-box {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--bg-surface);
  padding: 6px 12px;
  border-radius: 8px;
  border: 1px solid var(--border-color);
  font-weight: 700;
}

.sym-toggle-btn,
.lab-sym-btn {
  background: var(--bg-surface-soft);
  border: 1px solid var(--border-color);
  padding: 3px 10px;
  border-radius: 6px;
  font-size: 0.95rem;
  font-weight: 800;
  cursor: pointer;
  min-width: 40px;
  transition: all 0.15s ease;
}

.sym-toggle-btn:hover,
.lab-sym-btn:hover {
  border-color: var(--primary);
  background: var(--primary-light);
}

.sym-toggle-btn.selected,
.lab-sym-btn.selected {
  background: var(--primary);
  color: white;
  border-color: var(--primary);
}

/* Dạng 3: Bảng 12 tháng tương tác */
.month-grid-interactive {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  margin-top: 10px;
}

@media (max-width: 640px) {
  .month-grid-interactive {
    grid-template-columns: repeat(3, 1fr);
  }
}

.month-pill-btn {
  padding: 8px 10px;
  border-radius: 8px;
  border: 1.5px solid var(--border-color);
  background: var(--bg-surface);
  font-size: 0.86rem;
  font-weight: 700;
  color: var(--text-secondary);
  cursor: pointer;
  text-align: center;
  transition: all 0.15s ease;
}

.month-pill-btn:hover {
  border-color: var(--primary);
}

.month-pill-btn.active {
  background: #ecfdf5;
  border-color: #10b981;
  color: #047857;
  box-shadow: 0 2px 6px rgba(16, 185, 129, 0.2);
}

/* Nút kiểm tra bài thực hành */
.btn-lab-check {
  background: var(--primary);
  color: white;
  border: none;
  padding: 8px 18px;
  border-radius: 8px;
  font-size: 0.88rem;
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: all 0.15s ease;
}

.btn-lab-check:hover {
  background: var(--primary-hover);
}

.lab-feedback-box {
  margin-top: 14px;
  padding: 14px 18px;
  border-radius: 8px;
  background: #f8fafc;
  border-left: 4px solid var(--primary);
  font-size: 0.92rem;
  line-height: 1.6;
  display: none;
}

.lab-feedback-box.show {
  display: block;
  animation: fadeIn 0.25s ease-out;
}

.lab-feedback-box.correct {
  border-left-color: #10b981;
  background: #f0fdf4;
}

.lab-feedback-box.wrong {
  border-left-color: #ef4444;
  background: #fef2f2;
}

/* 9. BẢN CHẨN ĐOÁN LỖ HỔNG & LỜI ĐỘNG VIÊN CỦA THẦY AN */
.diagnostic-report-card {
  margin-top: 24px;
  border-radius: 12px;
  background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
  border: 1px solid var(--border-color);
  padding: 24px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.04);
}

.diagnostic-coach-header {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 16px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--border-color);
}

.coach-avatar {
  font-size: 2.2rem;
  background: white;
  width: 52px;
  height: 52px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.coach-quote {
  font-style: italic;
  color: var(--text-secondary);
  line-height: 1.6;
  font-size: 0.96rem;
}

.diagnostic-weakness-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin: 16px 0;
}

.diagnostic-weakness-item {
  background: white;
  border-radius: 8px;
  padding: 12px 16px;
  border-left: 4px solid #ef4444;
  border: 1px solid #fee2e2;
  border-left-width: 4px;
}

.btn-jump-review {
  background: var(--primary-light);
  color: var(--primary);
  border: 1px solid rgba(0, 86, 210, 0.2);
  padding: 6px 14px;
  border-radius: 6px;
  font-size: 0.82rem;
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-top: 8px;
  transition: all 0.15s ease;
}

.btn-jump-review:hover {
  background: var(--primary);
  color: white;
}

/* 10. MỤC LỤC THU GỌN GÓC TRÁI TRÊN CÙNG (HIỂN THỊ CỐ ĐỊNH TRÊN 100% THIẾT BỊ) */
#mobileTocBtn {
  position: fixed;
  top: 16px;
  left: 16px;
  z-index: 1001;
  display: flex !important;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.94);
  backdrop-filter: blur(12px);
  border: 1px solid var(--border-color);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
  font-size: 0.88rem;
  font-weight: 700;
  cursor: pointer;
  color: var(--text-main);
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  user-select: none;
}

#mobileTocBtn .toc-btn-icon {
  font-size: 1.1rem;
  line-height: 1;
}

#mobileTocBtn .toc-btn-text {
  font-size: 0.88rem;
  font-weight: 700;
  letter-spacing: 0.2px;
}

#mobileTocBtn:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 22px rgba(0, 86, 210, 0.2);
  border-color: var(--primary);
  background: #ffffff;
  color: var(--primary);
}

/* Menu trượt Offcanvas Drawer trên Mobile */
.mobile-toc-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(15, 23, 42, 0.5);
  backdrop-filter: blur(4px);
  z-index: 1100;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
}

.mobile-toc-overlay.show {
  opacity: 1;
  pointer-events: auto;
}

.mobile-toc-drawer {
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  width: 300px;
  max-width: 85vw;
  background: var(--bg-surface);
  z-index: 1200;
  box-shadow: 4px 0 25px rgba(0, 0, 0, 0.2);
  transform: translateX(-100%);
  transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  display: flex;
  flex-direction: column;
}

.mobile-toc-overlay.show .mobile-toc-drawer {
  transform: translateX(0);
}

.toc-drawer-header {
  padding: 18px 20px;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.toc-drawer-title {
  font-weight: 800;
  font-size: 1.05rem;
  color: var(--text-main);
  margin: 0;
}

.toc-drawer-close {
  background: transparent;
  border: none;
  font-size: 1.4rem;
  cursor: pointer;
  color: var(--text-muted);
}

.toc-drawer-body {
  padding: 14px 16px;
  overflow-y: auto;
  flex: 1;
}

.toc-nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border-radius: 8px;
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 0.92rem;
  font-weight: 600;
  margin-bottom: 4px;
  transition: all 0.15s ease;
}

.toc-nav-item:hover,
.toc-nav-item.active {
  background: var(--primary-light);
  color: var(--primary);
  font-weight: 700;
}

.toc-num-circle {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--bg-surface-soft);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.78rem;
  font-weight: 800;
  flex-shrink: 0;
}

/* 11. MENU SỔ MÁY TÍNH & HỆ SINH THÁI DỤNG CỤ HỌC TẬP (CALCULATOR & STUDY TOOLS) */
.calc-ecosystem-box {
  background: var(--bg-surface-soft);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 24px;
  margin: 28px 0;
}

.calc-selector-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 18px;
  flex-wrap: wrap;
}

.calc-select-dropdown {
  padding: 9px 14px;
  border: 1.5px solid var(--border-color);
  border-radius: 8px;
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text-main);
  background: var(--bg-surface);
  cursor: pointer;
  outline: none;
  transition: border-color 0.15s ease;
}

.calc-select-dropdown:focus {
  border-color: var(--primary);
}

.keystroke-sequence {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin: 14px 0;
}

.keystroke-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 7px 14px;
  border-radius: 8px;
  background: #f1f5f9;
  border: 1px solid #cbd5e1;
  border-bottom: 3px solid #94a3b8;
  font-family: 'JetBrains Mono', monospace;
  font-weight: 800;
  font-size: 0.88rem;
  color: #0f172a !important; /* Rõ nét 100% trên nền sáng, triệt tiêu chữ trắng chìm */
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.08);
  transition: all 0.15s ease;
  user-select: none;
}

.keystroke-pill:hover {
  transform: translateY(1px);
  border-bottom-width: 2px;
  background: #e2e8f0;
}

.keystroke-arrow {
  color: var(--text-muted);
  font-size: 0.8rem;
}

/* Lưới dụng cụ học tập liên quan */
.tools-ecosystem-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 14px;
  margin-top: 18px;
}

@media (max-width: 640px) {
  .tools-ecosystem-grid {
    grid-template-columns: 1fr;
  }
}

.tool-item-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: 10px;
  padding: 16px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 12px;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.tool-item-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.05);
}

.tool-item-header {
  display: flex;
  align-items: center;
  gap: 10px;
}

.tool-item-icon {
  font-size: 1.8rem;
}

.tool-item-name {
  font-weight: 700;
  font-size: 0.94rem;
  color: var(--text-main);
  margin: 0 0 4px 0;
}

.tool-item-desc {
  font-size: 0.8rem;
  color: var(--text-muted);
  line-height: 1.4;
}

.btn-tool-shopee {
  background: #ea580c;
  color: white;
  text-decoration: none;
  padding: 7px 12px;
  border-radius: 6px;
  font-size: 0.8rem;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  transition: background 0.15s ease;
}

.btn-tool-shopee:hover {
  background: #c2410c;
}

/* 12. SMART AUDIO NARRATOR BAR (THANH ĐỌC THÔNG MINH) */
.smart-audio-bar {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  width: calc(100% - 32px);
  max-width: 780px;
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(16px);
  border: 1px solid rgba(0, 86, 210, 0.2);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.12), 0 0 0 1px rgba(0, 86, 210, 0.1);
  border-radius: 9999px;
  padding: 10px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  z-index: 9999;
  transition: all 0.3s ease;
}

.audio-bar-left {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
  flex: 1;
}

.audio-play-btn {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: var(--primary);
  color: white;
  border: none;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  flex-shrink: 0;
  box-shadow: 0 4px 12px rgba(0, 86, 210, 0.3);
  transition: transform 0.15s ease, background 0.15s ease;
}

.audio-play-btn:hover {
  background: var(--primary-hover);
  transform: scale(1.05);
}

.audio-info-col {
  min-width: 0;
}

.audio-title-status {
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--text-main);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  display: flex;
  align-items: center;
  gap: 6px;
}

.audio-sub-hint {
  font-size: 0.74rem;
  color: var(--text-muted);
}

.audio-bar-right {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.speed-badge-btn {
  background: var(--bg-surface-soft);
  border: 1px solid var(--border-color);
  padding: 4px 8px;
  border-radius: 6px;
  font-size: 0.76rem;
  font-weight: 700;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.15s ease;
}

.speed-badge-btn:hover,
.speed-badge-btn.active {
  background: var(--primary);
  color: white;
  border-color: var(--primary);
}

.autoscroll-toggle-label {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-secondary);
  cursor: pointer;
  user-select: none;
}

/* 13. QUIZ ENGINE 2025 STYLING */
.quiz-section {
  margin-top: 48px;
  padding-top: 32px;
  border-top: 2px dashed var(--border-color);
}

.quiz-header-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 24px;
}

.quiz-mode-pills {
  display: inline-flex;
  background: var(--bg-surface-soft);
  padding: 4px;
  border-radius: 8px;
  border: 1px solid var(--border-color);
}

.quiz-mode-pill {
  padding: 6px 14px;
  font-size: 0.84rem;
  font-weight: 700;
  border-radius: 6px;
  border: none;
  cursor: pointer;
  background: transparent;
  color: var(--text-muted);
  transition: all 0.15s ease;
}

.quiz-mode-pill.active {
  background: var(--bg-surface);
  color: var(--primary);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.06);
}

.quiz-part-block {
  margin-bottom: 36px;
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 24px;
}

.quiz-part-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 12px;
  margin-bottom: 20px;
}

.quiz-part-title {
  font-size: 1.15rem;
  font-weight: 800;
  color: var(--text-main);
  margin: 0;
}

.quiz-part-badge {
  font-size: 0.8rem;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: 9999px;
  background: #ecfdf5;
  color: #059669;
}

.quiz-q-item {
  margin-bottom: 28px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--border-subtle);
}

.quiz-q-prompt {
  font-weight: 700;
  color: var(--text-main);
  margin-bottom: 14px;
  font-size: 1.02rem;
}

.quiz-options-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
}

@media (min-width: 640px) {
  .quiz-options-grid.two-cols {
    grid-template-columns: 1fr 1fr;
  }
}

.quiz-opt-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  border: 1.5px solid var(--border-color);
  border-radius: 8px;
  background: var(--bg-surface);
  cursor: pointer;
  text-align: left;
  font-size: 0.95rem;
  color: var(--text-secondary);
  transition: all 0.15s ease;
}

.quiz-opt-btn:hover {
  border-color: var(--primary);
  background: var(--primary-light);
}

.quiz-opt-btn.selected {
  border-color: var(--primary);
  background: #eff6ff;
  color: var(--primary);
  font-weight: 600;
}

.quiz-opt-btn.correct {
  border-color: #10b981 !important;
  background: #ecfdf5 !important;
  color: #047857 !important;
}

.quiz-opt-btn.wrong {
  border-color: #ef4444 !important;
  background: #fef2f2 !important;
  color: #b91c1c !important;
}

.opt-letter {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--bg-surface-soft);
  font-weight: 700;
  font-size: 0.82rem;
  flex-shrink: 0;
}

.quiz-tf-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 14px;
}

.quiz-tf-table th,
.quiz-tf-table td {
  padding: 12px 14px;
  border: 1px solid var(--border-color);
  text-align: left;
  font-size: 0.94rem;
}

.quiz-tf-table th {
  background: var(--bg-surface-soft);
  font-weight: 700;
  color: var(--text-main);
}

.quiz-tf-table td.col-choice {
  text-align: center;
  width: 75px;
}

.tf-radio-label {
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 6px;
  font-weight: 700;
  font-size: 0.85rem;
  border: 1px solid var(--border-color);
  transition: all 0.15s ease;
}

.tf-radio-label:hover {
  background: var(--bg-surface-soft);
}

.tf-radio-label.selected-true {
  background: #10b981;
  color: white;
  border-color: #10b981;
}

.tf-radio-label.selected-false {
  background: #ef4444;
  color: white;
  border-color: #ef4444;
}

.quiz-short-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 12px;
  flex-wrap: wrap;
}

.quiz-short-input {
  padding: 10px 14px;
  border: 2px solid var(--border-color);
  border-radius: 8px;
  font-size: 1.05rem;
  font-weight: 700;
  width: 160px;
  text-align: center;
  color: var(--text-main);
  background: var(--bg-surface);
  transition: border-color 0.15s ease;
}

.quiz-short-input:focus {
  outline: none;
  border-color: var(--primary);
}

.quiz-short-input.correct {
  border-color: #10b981;
  background: #ecfdf5;
  color: #047857;
}

.quiz-short-input.wrong {
  border-color: #ef4444;
  background: #fef2f2;
  color: #b91c1c;
}

.quiz-explanation-box {
  margin-top: 14px;
  padding: 16px 20px;
  border-radius: 8px;
  background: #f8fafc;
  border-left: 4px solid var(--primary);
  font-size: 0.94rem;
  line-height: 1.6;
  display: none;
}

.quiz-explanation-box.show {
  display: block;
  animation: fadeIn 0.25s ease-out;
}

.quiz-explanation-box.correct {
  border-left-color: #10b981;
  background: #f0fdf4;
}

.quiz-explanation-box.wrong {
  border-left-color: #ef4444;
  background: #fef2f2;
}

.explanation-title {
  font-weight: 700;
  color: var(--primary);
  margin-bottom: 6px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.explanation-title.title-correct {
  color: #059669;
}

.explanation-title.title-wrong {
  color: #dc2626;
}

.quiz-action-bar {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  margin-top: 24px;
}

.btn-check-answer {
  background: var(--primary);
  color: white;
  border: none;
  padding: 12px 24px;
  border-radius: 8px;
  font-weight: 700;
  font-size: 0.95rem;
  cursor: pointer;
  transition: all 0.15s ease;
  box-shadow: 0 4px 12px rgba(0, 86, 210, 0.25);
}

.btn-check-answer:hover {
  background: var(--primary-hover);
  transform: translateY(-1px);
}

/* 14. DARK THEME TƯƠNG THÍCH (DARK MODE) */
[data-theme="dark"] .article-container {
  background: #1e293b;
  border-color: #334155;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.25);
}

[data-theme="dark"] .article-title-h1,
[data-theme="dark"] .article-body h2,
[data-theme="dark"] .article-body h3,
[data-theme="dark"] .article-body h4,
[data-theme="dark"] .quiz-part-title,
[data-theme="dark"] .quiz-q-prompt,
[data-theme="dark"] .tool-item-name,
[data-theme="dark"] .toc-drawer-title {
  color: #f8fafc;
}

[data-theme="dark"] .article-body {
  color: #cbd5e1;
}

/* Callouts trong Dark mode: Kính mờ dịu mắt, KHÔNG CHÓI */
[data-theme="dark"] .callout-sgk {
  background: rgba(15, 23, 42, 0.7);
  border-left-color: #38bdf8;
  border-color: #1e293b;
}

[data-theme="dark"] .callout-sgk .callout-header {
  color: #38bdf8;
}

[data-theme="dark"] .callout-tip {
  background: rgba(6, 78, 59, 0.3);
  border-left-color: #34d399;
  border-color: #064e3b;
}

[data-theme="dark"] .callout-tip .callout-header {
  color: #34d399;
}

[data-theme="dark"] .callout-warning {
  background: rgba(69, 10, 10, 0.35);
  border-left-color: #f87171;
  border-color: #7f1d1d;
}

[data-theme="dark"] .callout-warning .callout-header {
  color: #f87171;
}

/* Karaoke từng chữ trong Dark mode: Bỏ hoàn toàn nền mờ dưới câu */
[data-theme="dark"] span[data-sentence-id].narrating-active {
  background: transparent !important;
  box-shadow: none !important;
}

[data-theme="dark"] .karaoke-word.active-word {
  color: #fbbf24;
  background: rgba(251, 191, 36, 0.25);
  text-shadow: 0 0 12px rgba(251, 191, 36, 0.6);
}

[data-theme="dark"] .smart-audio-bar {
  background: rgba(30, 41, 59, 0.95);
  border-color: rgba(56, 189, 248, 0.25);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4);
}

[data-theme="dark"] .audio-title-status {
  color: #f8fafc;
}

[data-theme="dark"] .quiz-part-block,
[data-theme="dark"] .quiz-opt-btn,
[data-theme="dark"] .bloom-lab-card,
[data-theme="dark"] .tool-item-card,
[data-theme="dark"] .calc-ecosystem-box,
[data-theme="dark"] .mobile-toc-drawer {
  background: #0f172a;
  border-color: #334155;
}

[data-theme="dark"] #mobileTocBtn {
  background: rgba(30, 41, 59, 0.92);
  border-color: #334155;
  color: #f8fafc;
}

[data-theme="dark"] .quiz-tf-table th {
  background: #1e293b;
  color: #f8fafc;
}

[data-theme="dark"] .quiz-tf-table th,
[data-theme="dark"] .quiz-tf-table td {
  border-color: #334155;
}

[data-theme="dark"] .quiz-short-input,
[data-theme="dark"] .calc-select-dropdown {
  background: #1e293b;
  border-color: #334155;
  color: #f8fafc;
}

/* Phím bấm máy tính Casio trong Dark Mode: Xanh neon cực nét, hết chìm trắng */
[data-theme="dark"] .keystroke-pill {
  background: #1e293b;
  border: 1px solid #475569;
  border-bottom: 3px solid #0f172a;
  color: #38bdf8 !important;
  text-shadow: 0 0 8px rgba(56, 189, 248, 0.45);
  box-shadow: 0 3px 8px rgba(0, 0, 0, 0.4);
}

[data-theme="dark"] .keystroke-pill:hover {
  background: #334155;
  border-color: #38bdf8;
}

[data-theme="dark"] .diagnostic-report-card {
  background: #0f172a;
  border-color: #334155;
}

[data-theme="dark"] .coach-avatar {
  background: #1e293b;
}

[data-theme="dark"] .diagnostic-weakness-item {
  background: #1e293b;
  border-color: #450a0a;
  border-left-color: #ef4444;
}

[data-theme="dark"] .lab-feedback-box,
[data-theme="dark"] .quiz-explanation-box {
  background: #1e293b;
  color: #f1f5f9;
  border-left-color: #38bdf8;
}

[data-theme="dark"] .lab-feedback-box.correct,
[data-theme="dark"] .quiz-explanation-box.correct {
  background: rgba(16, 185, 129, 0.12);
  border-left-color: #10b981;
}

[data-theme="dark"] .lab-feedback-box.wrong,
[data-theme="dark"] .quiz-explanation-box.wrong {
  background: rgba(239, 68, 68, 0.12);
  border-left-color: #ef4444;
}

[data-theme="dark"] .explanation-title.title-correct {
  color: #34d399;
}

[data-theme="dark"] .explanation-title.title-wrong {
  color: #f87171;
}

/* ANIMATIONS */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ==========================================================================
   [UPG-01] SECURITY — Chặn bôi đen, copy, user-select
   ========================================================================== */
.article-body,
.bloom-lab-card,
.bloom-interactive-stage,
.quiz-part-block,
.interactive-visual-card,
.calc-ecosystem-box,
.tools-ecosystem-grid {
  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
  user-select: none;
}

/* Cho phép copy trong ô nhập liệu của học sinh */
input, textarea, .quiz-short-input {
  -webkit-user-select: text !important;
  user-select: text !important;
}

/* ==========================================================================
   [UPG-01] WATERMARK — Chống quay màn hình
   ========================================================================== */
.toan-thay-an-watermark {
  position: fixed;
  pointer-events: none;
  z-index: 9998;
  font-size: 1rem;
  font-weight: 800;
  color: rgba(0, 86, 210, 0.07);
  white-space: nowrap;
  transform: rotate(-30deg);
  letter-spacing: 2px;
  font-family: 'Plus Jakarta Sans', sans-serif;
  transition: top 1s ease, left 1s ease;
  user-select: none;
}

[data-theme="dark"] .toan-thay-an-watermark {
  color: rgba(59, 130, 246, 0.09);
}

/* ==========================================================================
   [UPG-04] ANIMATION — Nút "Thi Thử Bấm Giờ" nhấp nháy thu hút
   ========================================================================== */
@keyframes examBtnPulse {
  0%   { box-shadow: 0 0 0 0 rgba(220, 38, 38, 0.35); }
  60%  { box-shadow: 0 0 0 7px rgba(220, 38, 38, 0); }
  100% { box-shadow: 0 0 0 0 rgba(220, 38, 38, 0); }
}

.quiz-mode-pill[data-mode="exam"].pulse-attention {
  animation: examBtnPulse 1.6s ease-in-out 4;
  border: 1.5px solid #dc2626;
  color: #dc2626;
  position: relative;
}

.quiz-mode-pill[data-mode="exam"].pulse-attention::after {
  content: "MỚI";
  position: absolute;
  top: -8px;
  right: -6px;
  background: #dc2626;
  color: white;
  font-size: 0.58rem;
  font-weight: 900;
  padding: 1px 5px;
  border-radius: 9999px;
  letter-spacing: 0.5px;
}

/* Đồng hồ đỏ khi ≤ 3 phút */
#quizTimerBox.timer-warning {
  animation: timerBlink 0.9s ease-in-out infinite;
  background: #fecaca !important;
}

#quizTimerBox.timer-urgent {
  animation: timerBlink 0.4s ease-in-out infinite;
  background: #fee2e2 !important;
  border: 2px solid #dc2626;
}

@keyframes timerBlink {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0.65; }
}

/* ==========================================================================
   [UPG-05] HERO BANNER — Phần đầu bài học hấp dẫn
   ========================================================================== */
.article-hero-banner {
  background: linear-gradient(135deg, #e6f0ff 0%, #f0f7ff 60%, #ecfdf5 100%);
  border: 1px solid #dbeafe;
  border-radius: 14px;
  padding: 24px 28px 20px;
  margin-bottom: 28px;
  position: relative;
  overflow: hidden;
}

[data-theme="dark"] .article-hero-banner {
  background: linear-gradient(135deg, rgba(59,130,246,0.12) 0%, rgba(16,185,129,0.08) 100%);
  border-color: rgba(59,130,246,0.2);
}

.article-hero-banner::before {
  content: '∈';
  position: absolute;
  right: 24px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 6rem;
  font-weight: 900;
  color: rgba(0, 86, 210, 0.06);
  font-family: 'JetBrains Mono', monospace;
  line-height: 1;
  pointer-events: none;
  user-select: none;
}

.hero-label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--primary);
  color: white;
  font-size: 0.72rem;
  font-weight: 800;
  padding: 3px 10px;
  border-radius: 9999px;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  margin-bottom: 10px;
}

.hero-title {
  font-size: 1.9rem;
  font-weight: 800;
  color: var(--text-main);
  line-height: 1.3;
  margin: 0 0 14px 0;
  letter-spacing: -0.02em;
}

.hero-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 16px;
}

.hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: rgba(255,255,255,0.75);
  border: 1px solid rgba(0,86,210,0.15);
  color: var(--text-secondary);
  font-size: 0.8rem;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 8px;
  backdrop-filter: blur(4px);
}

[data-theme="dark"] .hero-badge {
  background: rgba(255,255,255,0.06);
  border-color: rgba(255,255,255,0.12);
}

/* Thanh scroll-progress mỏng dưới hero */
.hero-scroll-progress {
  height: 4px;
  background: rgba(0,86,210,0.12);
  border-radius: 9999px;
  overflow: hidden;
  margin-top: 4px;
}

.hero-scroll-bar {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--primary), #10b981);
  border-radius: 9999px;
  transition: width 0.2s ease;
}

/* ==========================================================================
   [UPG-06] TRAP COMPARE TABLE — Bảng Đúng/Sai 2 cột cho bẫy thi
   ========================================================================== */
.trap-compare-wrapper {
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid #fee2e2;
  margin: 24px 0;
}

.trap-compare-header {
  background: #fef2f2;
  padding: 10px 18px;
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 800;
  font-size: 0.88rem;
  color: #dc2626;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  border-bottom: 1px solid #fee2e2;
}

[data-theme="dark"] .trap-compare-header {
  background: rgba(239,68,68,0.12);
  border-color: rgba(239,68,68,0.2);
  color: #f87171;
}

.trap-compare-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
}

.trap-col {
  padding: 16px 18px;
}

.trap-col-correct {
  background: #f0fdf4;
  border-right: 1px solid #bbf7d0;
}

.trap-col-wrong {
  background: #fff5f5;
}

[data-theme="dark"] .trap-col-correct {
  background: rgba(16,185,129,0.08);
  border-right-color: rgba(16,185,129,0.2);
}
[data-theme="dark"] .trap-col-wrong {
  background: rgba(239,68,68,0.08);
}

.trap-col-title {
  font-size: 0.8rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.trap-col-correct .trap-col-title { color: #059669; }
.trap-col-wrong  .trap-col-title { color: #dc2626; }

.trap-item {
  font-size: 0.9rem;
  line-height: 1.6;
  margin-bottom: 10px;
  padding: 8px 10px;
  border-radius: 8px;
  border-left: 3px solid transparent;
}

.trap-col-correct .trap-item {
  background: rgba(16,185,129,0.08);
  border-left-color: #10b981;
  color: var(--text-secondary);
}

.trap-col-wrong .trap-item {
  background: rgba(239,68,68,0.07);
  border-left-color: #ef4444;
  color: var(--text-secondary);
  text-decoration-line: line-through;
  text-decoration-color: rgba(239,68,68,0.5);
}

.trap-item-note {
  font-size: 0.78rem;
  font-style: italic;
  color: var(--text-muted);
  display: block;
  margin-top: 3px;
  text-decoration: none;
}

@media (max-width: 480px) {
  .trap-compare-grid {
    grid-template-columns: 1fr;
  }
  .trap-col-correct {
    border-right: none;
    border-bottom: 1px solid #bbf7d0;
  }
}

/* ==========================================================================
   [UPG-07] SECTION STEP DIVIDER — Phân cách mục học trực quan
   ========================================================================== */
.section-step-divider {
  display: flex;
  align-items: center;
  gap: 14px;
  margin: 36px 0 4px;
  user-select: none;
}

.section-step-divider::before,
.section-step-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--border-color), transparent);
}

.step-num-badge {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--primary);
  color: white;
  font-size: 0.95rem;
  font-weight: 900;
  flex-shrink: 0;
  box-shadow: 0 0 0 4px rgba(0,86,210,0.12);
}

.step-divider-label {
  font-size: 0.72rem;
  font-weight: 800;
  color: var(--text-muted);
  letter-spacing: 1px;
  text-transform: uppercase;
  white-space: nowrap;
}

/* ==========================================================================
   [UPG-08] AUDIO ONBOARDING — Tooltip chào đón học sinh mới
   ========================================================================== */
.narrator-onboard-tooltip {
  position: absolute;
  bottom: calc(100% + 10px);
  left: 50%;
  transform: translateX(-50%);
  background: var(--primary);
  color: white;
  font-size: 0.82rem;
  font-weight: 700;
  padding: 8px 14px;
  border-radius: 10px;
  white-space: nowrap;
  pointer-events: none;
  z-index: 10010;
  animation: tooltipFadeIn 0.35s ease-out forwards;
  box-shadow: 0 4px 14px rgba(0,86,210,0.35);
}

.narrator-onboard-tooltip::after {
  content: '';
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%);
  border: 6px solid transparent;
  border-top-color: var(--primary);
}

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

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

@keyframes playBtnPulse {
  0%   { box-shadow: 0 0 0 0 rgba(0,86,210,0.4); }
  70%  { box-shadow: 0 0 0 8px rgba(0,86,210,0); }
  100% { box-shadow: 0 0 0 0 rgba(0,86,210,0); }
}

.audio-play-btn.onboard-pulse {
  animation: playBtnPulse 1.4s ease-in-out 3;
}

/* ==========================================================================
   [UPG-09] NARRATOR PREV/NEXT + PROGRESS BAR
   ========================================================================== */
.narrator-nav-btn {
  background: transparent;
  border: 1.5px solid var(--border-color);
  color: var(--text-muted);
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.85rem;
  cursor: pointer;
  transition: all 0.15s ease;
  flex-shrink: 0;
}

.narrator-nav-btn:hover {
  border-color: var(--primary);
  color: var(--primary);
  background: var(--primary-light);
}

.narrator-nav-btn:disabled {
  opacity: 0.35;
  cursor: default;
  pointer-events: none;
}

.narrator-progress-wrap {
  height: 3px;
  background: var(--border-color);
  border-radius: 9999px;
  overflow: hidden;
  margin-top: 2px;
}

.narrator-progress-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--primary), #10b981);
  border-radius: 9999px;
  transition: width 0.4s ease;
}

/* ============================================ */
/* v3.5 UPGRADE: SHARE, WARMUP, HOOK, HINT,     */
/* MINDMAP, CHALLENGE, FAQ, PROGRESS, SORT      */
/* ============================================ */

/* SHARE BUTTONS BAR */
.share-buttons-bar {
  display: flex; gap: 10px; justify-content: center;
  margin: 0 auto 20px; max-width: 800px; padding: 0 20px;
}
.share-btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 16px; border-radius: 8px; font-size: 0.85rem;
  font-weight: 700; text-decoration: none; transition: all 0.2s;
}
.share-zalo { background: #0068ff; color: #fff; }
.share-zalo:hover { background: #0050cc; }
.share-fb { background: #1877f2; color: #fff; }
.share-fb:hover { background: #1466cc; }

/* WARMUP BOX */
.warmup-box {
  max-width: 800px; margin: 0 auto 24px; padding: 20px 24px;
  background: var(--bg-surface-soft, #f0f9ff);
  border: 2px dashed var(--primary, #3b82f6);
  border-radius: 16px; text-align: center;
}
.warmup-header {
  font-size: 1.1rem; font-weight: 800; color: var(--primary);
  margin-bottom: 10px;
}
.warmup-question { font-size: 1rem; font-weight: 600; margin-bottom: 14px; }
.warmup-options {
  display: flex; flex-wrap: wrap; gap: 10px; justify-content: center;
}
.warmup-opt {
  padding: 12px 20px; border-radius: 12px; font-size: 1rem;
  font-weight: 700; cursor: pointer; border: 2px solid var(--border-color);
  background: var(--bg-surface); color: var(--text-main);
  min-height: 48px; transition: all 0.2s;
}
.warmup-opt:hover { border-color: var(--primary); transform: scale(1.05); }
.warmup-opt.correct { background: #10b981; color: #fff; border-color: #10b981; }
.warmup-opt.wrong { background: #ef4444; color: #fff; border-color: #ef4444; opacity: 0.6; }
.warmup-feedback {
  margin-top: 14px; padding: 12px 16px; border-radius: 10px;
  font-weight: 700; font-size: 0.95rem; display: none;
}

/* HOOK CALLOUT */
.callout-hook { border-left: 4px solid #f59e0b; background: rgba(245,158,11,0.06); }
[data-theme='dark'] .callout-hook { background: rgba(245,158,11,0.08); }

/* SORTING WIDGET */
.sorting-widget {
  margin: 20px 0; padding: 20px; border-radius: 16px;
  background: var(--bg-surface-soft); border: 1px solid var(--border-color);
}
.sorting-title {
  font-size: 1.05rem; font-weight: 800; color: var(--primary);
  margin-bottom: 14px; text-align: center;
}
.sorting-items {
  display: flex; flex-wrap: wrap; gap: 10px; justify-content: center;
  margin-bottom: 16px;
}
.sort-item {
  padding: 10px 18px; border-radius: 10px; font-size: 1rem;
  font-weight: 700; cursor: pointer; border: 2px solid var(--border-color);
  background: var(--bg-surface); color: var(--text-main);
  min-height: 48px; transition: all 0.25s;
}
.sort-item:hover { transform: scale(1.08); border-color: var(--primary); }
.sort-item.sorted { opacity: 0.4; pointer-events: none; transform: scale(0.9); }
.sorting-bins {
  display: grid; grid-template-columns: 1fr 1fr; gap: 14px;
}
.sort-bin {
  padding: 14px; border-radius: 12px; min-height: 80px;
  border: 2px dashed var(--border-color); background: var(--bg-surface);
}
.bin-label {
  font-weight: 800; font-size: 0.95rem; margin-bottom: 8px;
  text-align: center; color: var(--text-secondary);
}
.bin-items { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; }
.bin-item-chip {
  padding: 4px 10px; border-radius: 6px; font-size: 0.85rem;
  font-weight: 700; background: var(--primary); color: #fff;
  animation: popIn 0.3s ease;
}
@keyframes popIn { from { transform: scale(0); } to { transform: scale(1); } }
.sorting-feedback {
  margin-top: 12px; padding: 10px; border-radius: 8px;
  text-align: center; font-weight: 700; display: none;
}

/* HINT TOGGLE */
.hint-toggle-bar { margin-bottom: 14px; }
.hint-btn {
  padding: 10px 18px; border-radius: 10px; font-size: 0.9rem;
  font-weight: 700; cursor: pointer; border: 2px solid #f59e0b;
  background: rgba(245,158,11,0.08); color: var(--text-main);
  min-height: 48px; transition: all 0.2s;
}
.hint-btn:hover { background: rgba(245,158,11,0.15); }
.hint-content {
  margin-top: 10px; padding: 14px 16px; border-radius: 10px;
  background: rgba(245,158,11,0.06); border-left: 3px solid #f59e0b;
  font-size: 0.95rem; color: var(--text-main); line-height: 1.6;
}

/* MINDMAP CARD */
.mindmap-card {
  position: relative; padding: 28px 20px; border-radius: 20px;
  background: linear-gradient(135deg, rgba(59,130,246,0.06), rgba(139,92,246,0.06));
  border: 2px solid var(--border-color); overflow: hidden;
}
.mindmap-watermark {
  position: absolute; top: 50%; left: 50%; transform: translate(-50%,-50%) rotate(-15deg);
  font-size: 1.1rem; font-weight: 800; color: rgba(59,130,246,0.08);
  white-space: nowrap; pointer-events: none; z-index: 0;
}
[data-theme='dark'] .mindmap-watermark { color: rgba(96,165,250,0.1); }
.mindmap-center {
  text-align: center; font-size: 1.3rem; font-weight: 900;
  color: var(--primary); padding: 16px; margin: 0 auto 20px;
  background: var(--bg-surface); border-radius: 16px;
  border: 3px solid var(--primary); display: inline-block;
  position: relative; z-index: 1;
  width: 100%; max-width: 260px;
}
.mindmap-branches {
  display: grid; grid-template-columns: 1fr 1fr; gap: 14px;
  position: relative; z-index: 1;
}
.mindmap-branch {
  padding: 14px; border-radius: 12px; background: var(--bg-surface);
  border: 2px solid var(--border-color);
}
.branch-title {
  font-weight: 800; font-size: 0.95rem; margin-bottom: 6px;
  color: var(--text-main);
}
.branch-content {
  font-size: 0.85rem; line-height: 1.5; color: var(--text-secondary);
}
.branch-1 { border-color: #3b82f6; }
.branch-2 { border-color: #10b981; }
.branch-3 { border-color: #f59e0b; }
.branch-4 { border-color: #ef4444; }
.mindmap-footer {
  display: flex; flex-wrap: wrap; gap: 8px; justify-content: center;
  margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--border-color);
  font-size: 0.78rem; font-weight: 700; color: var(--text-muted);
  position: relative; z-index: 1;
}
.btn-download-mindmap {
  display: block; margin: 16px auto 0; padding: 12px 24px;
  border-radius: 12px; font-size: 0.95rem; font-weight: 700 !important;
  font-family: 'Be Vietnam Pro', 'Plus Jakarta Sans', 'Segoe UI', Roboto, system-ui, -apple-system, sans-serif !important;
  cursor: pointer; border: 2px solid var(--primary);
  background: var(--primary); color: #fff; min-height: 48px;
  transition: all 0.2s; position: relative; z-index: 1;
  letter-spacing: normal;
}
.btn-download-mindmap:hover { opacity: 0.9; transform: scale(1.03); }

/* CHALLENGE BOX */
.challenge-box {
  text-align: center; padding: 28px 24px; border-radius: 20px;
  background: linear-gradient(135deg, rgba(245,158,11,0.06), rgba(239,68,68,0.04));
  border: 2px solid var(--border-color);
}
.challenge-icon { font-size: 3rem; margin-bottom: 10px; }
.challenge-question { font-size: 1.1rem; font-weight: 700; margin-bottom: 8px; }
.challenge-hint {
  font-size: 0.9rem; color: var(--text-muted); font-style: italic;
  margin-bottom: 12px;
}
.challenge-cta {
  font-weight: 800; color: var(--primary); font-size: 1rem;
}

/* FAQ SECTION */
.faq-section { margin-top: 24px; }
.faq-item {
  margin-bottom: 10px; border-radius: 12px;
  border: 1px solid var(--border-color); overflow: hidden;
}
.faq-item summary {
  padding: 14px 18px; font-weight: 700; font-size: 1rem;
  cursor: pointer; background: var(--bg-surface-soft);
  list-style: none; display: flex; align-items: center; gap: 8px;
  min-height: 48px;
}
.faq-item summary::before { content: '❓'; }
.faq-item[open] summary { border-bottom: 1px solid var(--border-color); }
.faq-item p {
  padding: 14px 18px; margin: 0; font-size: 0.95rem;
  line-height: 1.6; color: var(--text-secondary);
}

/* SECTION PROGRESS BAR (ghim cố định) */
.section-progress-bar {
  position: fixed; top: 60px; left: 0; right: 0; z-index: 99;
  display: flex; justify-content: center; gap: 4px;
  padding: 6px 12px; background: var(--bg-surface);
  border-bottom: 1px solid var(--border-color);
  backdrop-filter: blur(8px);
}
.progress-dot {
  width: 10px; height: 10px; border-radius: 50%;
  background: var(--border-color); transition: all 0.3s;
  cursor: pointer;
}
.progress-dot.active { background: var(--primary); transform: scale(1.3); }
.progress-dot.done { background: #10b981; }
@media (max-width: 480px) {
  .sorting-bins { grid-template-columns: 1fr; }
  .mindmap-branches { grid-template-columns: 1fr; }
  .share-buttons-bar { flex-direction: column; align-items: center; }
}

/* RESUME DIALOG */
.resume-dialog {
  position: fixed; bottom: 20px; right: 20px; z-index: 9999;
  background: var(--bg-surface); border: 2px solid var(--primary);
  border-radius: 16px; padding: 18px 22px; box-shadow: 0 8px 32px rgba(0,0,0,0.15);
  max-width: 320px; animation: slideUp 0.4s ease;
}
@keyframes slideUp { from { transform: translateY(100px); opacity:0; } to { transform: translateY(0); opacity:1; } }
.resume-dialog-title { font-weight: 800; font-size: 1rem; margin-bottom: 8px; }
.resume-dialog-text { font-size: 0.88rem; color: var(--text-muted); margin-bottom: 12px; }
.resume-dialog-btns { display: flex; gap: 8px; }
.resume-dialog-btns button {
  flex: 1; padding: 10px; border-radius: 10px; font-weight: 700;
  font-size: 0.88rem; cursor: pointer; border: none; min-height: 44px;
}
.resume-btn-continue { background: var(--primary); color: #fff; }
.resume-btn-restart { background: var(--bg-surface-soft); color: var(--text-main); border: 1px solid var(--border-color) !important; }

/* ==========================================================================
   VIETNAMESE TYPOGRAPHY ENGINE FIX
   Đảm bảo 100% phần tử hiển thị font chữ mượt mà, không vỡ dấu (ả, ơ, đồ, tư...)
   ========================================================================== */
body, button, input, select, textarea, 
.btn, .share-btn, .warmup-opt, .sort-item, .hint-btn, 
.mindmap-card, .challenge-box, .btn-download-mindmap {
  font-family: 'Be Vietnam Pro', 'Plus Jakarta Sans', 'Segoe UI', Roboto, system-ui, -apple-system, sans-serif !important;
}

/* ==========================================================================
   IN-PLACE LIVE LINK EDITOR (CỬA THẦN KỲ) STYLES
   ========================================================================== */

/* Thanh trạng thái Admin Bar ghim đỉnh */
.thayan-admin-bar {
  display: none;
  position: sticky;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100000;
  background: linear-gradient(135deg, #1e1b4b 0%, #312e81 100%);
  color: #fff;
  border-bottom: 2px solid #818cf8;
  padding: 10px 20px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.25);
  font-family: 'Be Vietnam Pro', sans-serif;
  animation: slideDown 0.3s ease;
}

body.thayan-admin-active header {
  top: 48px !important;
}

.admin-bar-inner {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 15px;
  flex-wrap: wrap;
}

.admin-bar-left {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.95rem;
}

.admin-crown {
  font-size: 1.3rem;
  animation: pulse 1.5s infinite;
}

.admin-hint {
  font-size: 0.8rem;
  color: #c7d2fe;
  background: rgba(255, 255, 255, 0.12);
  padding: 3px 10px;
  border-radius: 9999px;
}

.btn-exit-admin {
  background: #ef4444;
  color: #fff;
  border: none;
  padding: 6px 14px;
  border-radius: 8px;
  font-weight: 700;
  font-size: 0.85rem;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-exit-admin:hover {
  background: #dc2626;
  transform: translateY(-1px);
}

/* Huy hiệu bút chì vàng trên các nút có thể sửa link */
.thayan-admin-active [data-editable-link] {
  position: relative !important;
  outline: 2px dashed #f59e0b !important;
  outline-offset: 4px;
  cursor: pointer !important;
  transition: all 0.2s ease;
}

.thayan-admin-active [data-editable-link]:hover {
  outline-color: #d97706 !important;
  transform: scale(1.02);
}

.thayan-edit-badge {
  display: none;
}

.thayan-admin-active .thayan-edit-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  position: absolute;
  top: -12px;
  right: -8px;
  background: #f59e0b;
  color: #1e1b4b;
  font-size: 0.75rem;
  font-weight: 800;
  padding: 3px 8px;
  border-radius: 9999px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25);
  z-index: 10;
  pointer-events: none;
  animation: pulse 2s infinite;
}

/* Modal Kính mờ */
.thayan-modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.8);
  backdrop-filter: blur(8px);
  z-index: 100001;
  align-items: center;
  justify-content: center;
  padding: 20px;
  animation: fadeIn 0.25s ease;
}

.thayan-modal-card {
  background: var(--bg-surface, #ffffff);
  color: var(--text-main, #0f172a);
  border: 1px solid var(--border-color, #e2e8f0);
  border-radius: 16px;
  padding: 28px 24px;
  max-width: 440px;
  width: 100%;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
  font-family: 'Be Vietnam Pro', sans-serif;
  animation: scaleUp 0.3s ease;
}

@keyframes scaleUp {
  from { transform: scale(0.92); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.thayan-modal-header {
  text-align: center;
  margin-bottom: 20px;
}

.thayan-modal-icon {
  font-size: 2.4rem;
  display: inline-block;
  margin-bottom: 8px;
}

.thayan-modal-header h3 {
  font-size: 1.25rem;
  font-weight: 800;
  margin: 0 0 6px 0;
  color: var(--primary, #0056d2);
}

.thayan-modal-header p {
  font-size: 0.88rem;
  color: var(--text-muted, #64748b);
  margin: 0;
  line-height: 1.5;
}

.thayan-modal-body input {
  width: 100%;
  padding: 12px 16px;
  font-size: 1rem;
  border: 2px solid var(--border-color, #cbd5e1);
  background: var(--bg-surface-soft, #f8fafc);
  color: var(--text-main, #0f172a);
  border-radius: 10px;
  font-weight: 600;
  outline: none;
  transition: all 0.2s ease;
}

.thayan-modal-body input:focus {
  border-color: var(--primary, #0056d2);
  background: #fff;
  box-shadow: 0 0 0 3px rgba(0, 86, 210, 0.15);
}

.thayan-error-msg {
  color: #dc2626;
  font-size: 0.85rem;
  font-weight: 600;
  margin-top: 8px;
  text-align: center;
}

.thayan-modal-actions {
  display: flex;
  gap: 12px;
  margin-top: 20px;
}

.thayan-modal-actions button {
  flex: 1;
  padding: 12px;
  border-radius: 10px;
  font-weight: 700;
  font-size: 0.95rem;
  cursor: pointer;
  border: none;
  min-height: 46px;
  transition: all 0.2s ease;
}

.btn-cancel {
  background: var(--bg-surface-soft, #f1f5f9);
  color: var(--text-muted, #475569);
  border: 1px solid var(--border-color, #cbd5e1) !important;
}

.btn-cancel:hover {
  background: #e2e8f0;
}

.btn-submit {
  background: var(--primary, #0056d2);
  color: #fff;
}

.btn-submit:hover {
  background: #0044a8;
  transform: translateY(-1px);
}

/* Toast Thông Báo */
.thayan-toast {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 100002;
  background: #0f172a;
  color: #fff;
  padding: 12px 20px;
  border-radius: 12px;
  font-size: 0.9rem;
  font-weight: 700;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.25);
  opacity: 0;
  transform: translateY(-20px);
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  pointer-events: none;
  font-family: 'Be Vietnam Pro', sans-serif;
}

.thayan-toast.show {
  opacity: 1;
  transform: translateY(0);
}

.thayan-toast.success {
  background: #065f46;
  border: 1px solid #34d399;
}


@media (max-width: 480px) { .smart-audio-bar { left:8px; right:8px; bottom:max(8px,env(safe-area-inset-bottom,0px)); width:auto; max-width:none; transform:none; display:grid; grid-template-columns:minmax(0,1fr) auto; gap:8px 10px; padding:10px 12px; border-radius:18px; } .smart-audio-bar .audio-bar-left { grid-column:1/-1; width:100%; gap:10px; } .smart-audio-bar .audio-play-btn,.smart-audio-bar .narrator-nav-btn { width:48px; height:48px; flex:0 0 48px; } .smart-audio-bar .audio-bar-right { grid-column:1/-1; width:100%; justify-content:space-between; gap:8px; } .smart-audio-bar .speed-badge-btn { min-height:48px; min-width:54px; } body { padding-bottom:calc(132px + env(safe-area-inset-bottom,0px)); } }

@media (max-width: 480px) {
  #securityWatermark,
  .toan-thay-an-watermark {
    display: none !important;
  }
}
