/* ════════════════════════════════════════════════════════════════════
   Surah Al-Fajr (89) — Master Linguistic Intelligence Web App
   Theme: The Cosmic Dawn & Sublime Serenity
   Version: v1.1.13 (updated 2026-10-13 16:20)
   ════════════════════════════════════════════════════════════════════ */

:root {
  --bg-primary: #f8fafc;
  --bg-card: #ffffff;
  --bg-hero: linear-gradient(135deg, #090d16 0%, #111827 45%, #1e1b4b 80%, #2e1065 100%);
  --dawn-amber: #f59e0b;
  --dawn-gold: #fbbf24;
  --dawn-orange: #ea580c;
  --dawn-sky: #38bdf8;
  --text-main: #0f172a;
  --text-muted: #64748b;
  --border-light: #e2e8f0;
  
  /* Grammar Color Dimensions */
  --color-raf: #2563eb;
  --bg-raf: #eff6ff;
  --border-raf: #3b82f6;
  
  --color-nasb: #059669;
  --bg-nasb: #ecfdf5;
  --border-nasb: #10b981;
  
  --color-jarr: #7c3aed;
  --bg-jarr: #f5f3ff;
  --border-jarr: #8b5cf6;
  
  --color-jazm: #d97706;
  --bg-jazm: #fffbeb;
  --border-jazm: #f59e0b;
  
  --color-mabni: #475569;
  --bg-mabni: #f8fafc;
  --border-mabni: #94a3b8;
  
  /* POS Colors: Nouns Blue, Verbs Red family, Harf Green */
  --pos-ism: #1d4ed8;
  --pos-ism-bg: #dbeafe;
  --pos-fil: #dc2626;
  --pos-fil-bg: #fee2e2;
  --pos-harf: #059669;
  --pos-harf-bg: #dcfce7;
  
  /* Font Families */
  --font-arabic: 'Amiri Quran', 'Amiri', 'Traditional Arabic', serif;
  --font-sans: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-mono: 'JetBrains Mono', monospace;
  
  /* Dynamic font scale */
  --arabic-scale: 1.0;
  --english-scale: 1.0;
}

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

body {
  font-family: var(--font-sans);
  background-color: var(--bg-primary);
  color: var(--text-main);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ── Top Bar & Links ── */
.top-nav {
  background: rgba(15, 23, 42, 0.95);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  padding: 0.75rem 1.5rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1rem;
  position: sticky;
  top: 0;
  z-index: 50;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
}

.nav-link {
  color: #94a3b8;
  text-decoration: none;
  font-size: 0.82rem;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  transition: all 0.2s ease;
  padding: 0.3rem 0.65rem;
  border-radius: 6px;
}

.nav-link:hover {
  color: #ffffff;
  background: rgba(255, 255, 255, 0.06);
}

.nav-link.active {
  color: var(--dawn-gold);
  background: rgba(245, 158, 11, 0.12);
  border: 1px solid rgba(245, 158, 11, 0.3);
}

.nav-right-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.btn-pill {
  padding: 0.4rem 0.85rem;
  font-size: 0.78rem;
  font-weight: 700;
  border-radius: 9999px;
  border: 1px solid transparent;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  transition: all 0.2s ease;
  text-decoration: none;
}

.btn-pill-dawn {
  background: linear-gradient(135deg, var(--dawn-amber), var(--dawn-orange));
  color: #ffffff;
  box-shadow: 0 2px 10px rgba(234, 88, 12, 0.3);
}

.btn-pill-dawn:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 14px rgba(234, 88, 12, 0.4);
}

.btn-pill-glass {
  background: rgba(255, 255, 255, 0.08);
  color: #e2e8f0;
  border-color: rgba(255, 255, 255, 0.15);
}

.btn-pill-glass:hover {
  background: rgba(255, 255, 255, 0.15);
  color: #ffffff;
}

/* ── Hero Header ── */
.fajr-hero {
  background: var(--bg-hero);
  color: #ffffff;
  padding: 3.5rem 1.5rem 3rem;
  text-align: center;
  position: relative;
  overflow: hidden;
}

.fajr-hero::before {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse at 50% 120%, rgba(245, 158, 11, 0.2) 0%, rgba(234, 88, 12, 0.1) 40%, transparent 70%);
  pointer-events: none;
}

.fajr-hero::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 5px;
  background: linear-gradient(90deg, #f59e0b, #ea580c, #ec4899, #8b5cf6, #38bdf8, #f59e0b);
  background-size: 300% 100%;
  animation: dawnHorizon 6s ease infinite;
}

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

.surah-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  background: rgba(245, 158, 11, 0.18);
  color: #fde68a;
  border: 1px solid rgba(245, 158, 11, 0.35);
  padding: 0.4rem 1.1rem;
  border-radius: 9999px;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  margin-bottom: 1.25rem;
  backdrop-filter: blur(4px);
}

.hero-titles {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1.5rem;
  flex-wrap: wrap;
  margin-bottom: 0.75rem;
}

h1.hero-en {
  font-size: 2.8rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  color: #ffffff;
}

.hero-ar {
  font-family: var(--font-arabic);
  font-size: 3.4rem;
  color: var(--dawn-gold);
  direction: rtl;
  text-shadow: 0 0 35px rgba(251, 191, 36, 0.4);
}

p.hero-subtitle {
  color: #94a3b8;
  font-size: 1.05rem;
  max-width: 720px;
  margin: 0 auto 2rem;
  line-height: 1.6;
}

/* ── Live Stats Bar ── */
.hero-stats {
  display: flex;
  justify-content: center;
  gap: 1.25rem;
  flex-wrap: wrap;
  margin-top: 1.5rem;
}

.stat-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.12);
  padding: 0.45rem 1rem;
  border-radius: 10px;
  backdrop-filter: blur(4px);
}

.stat-chip-num {
  font-family: var(--font-mono);
  font-weight: 700;
  color: var(--dawn-gold);
  font-size: 1rem;
}

.stat-chip-label {
  font-size: 0.8rem;
  color: #cbd5e1;
  font-weight: 500;
}

/* ── Controls Section ── */
.controls-bar {
  background: #ffffff;
  border-bottom: 1px solid var(--border-light);
  padding: 1.25rem 1.5rem;
  box-shadow: 0 2px 8px rgba(0,0,0,0.02);
}

.controls-container {
  max-width: 1280px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.controls-row-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1rem;
}

.segmented-control {
  display: inline-flex;
  background: #f1f5f9;
  padding: 0.25rem;
  border-radius: 12px;
  border: 1px solid #e2e8f0;
  gap: 0.2rem;
}

.seg-btn {
  padding: 0.45rem 0.9rem;
  font-size: 0.82rem;
  font-weight: 600;
  border: none;
  background: transparent;
  color: #475569;
  border-radius: 9px;
  cursor: pointer;
  transition: all 0.2s ease;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}

.seg-btn:hover {
  color: #0f172a;
}

.seg-btn.active {
  background: #ffffff;
  color: var(--dawn-orange);
  box-shadow: 0 2px 6px rgba(0,0,0,0.08);
  font-weight: 700;
}

.action-toggles {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.toggle-pill {
  padding: 0.45rem 0.9rem;
  font-size: 0.8rem;
  font-weight: 600;
  border-radius: 10px;
  border: 1px solid #e2e8f0;
  background: #f8fafc;
  color: #334155;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  transition: all 0.2s ease;
}

.toggle-pill:hover {
  background: #f1f5f9;
  border-color: #cbd5e1;
}

.toggle-pill.is-active {
  background: #eff6ff;
  color: #1d4ed8;
  border-color: #93c5fd;
  font-weight: 700;
}

/* Audio button highlight */
.audio-main-btn {
  background: linear-gradient(135deg, #1e293b, #0f172a);
  color: #ffffff;
  border-color: #334155;
}

.audio-main-btn:hover {
  background: #0f172a;
}

.audio-main-btn.is-playing {
  background: linear-gradient(135deg, #ea580c, #f59e0b);
  border-color: #f59e0b;
  color: #ffffff;
  box-shadow: 0 0 15px rgba(245, 158, 11, 0.4);
}

/* Equalizer waves */
.eq-bars {
  display: inline-flex;
  align-items: flex-end;
  gap: 2px;
  height: 14px;
}

.eq-bar {
  width: 3px;
  background: #ffffff;
  border-radius: 2px;
  animation: eqJump 0.8s ease infinite alternate;
}

.eq-bar:nth-child(1) { height: 6px; animation-delay: 0.1s; }
.eq-bar:nth-child(2) { height: 14px; animation-delay: 0.3s; }
.eq-bar:nth-child(3) { height: 9px; animation-delay: 0.2s; }
.eq-bar:nth-child(4) { height: 12px; animation-delay: 0.4s; }

@keyframes eqJump {
  0% { height: 4px; }
  100% { height: 14px; }
}

/* ── Thematic Sections Pill Tabs ── */
.thematic-nav {
  display: flex;
  gap: 0.5rem;
  overflow-x: auto;
  padding-bottom: 0.25rem;
  scrollbar-width: thin;
}

.theme-tab {
  white-space: nowrap;
  padding: 0.4rem 0.85rem;
  border-radius: 8px;
  font-size: 0.78rem;
  font-weight: 600;
  border: 1px solid #e2e8f0;
  background: #ffffff;
  color: #475569;
  cursor: pointer;
  transition: all 0.2s ease;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}

.theme-tab:hover {
  background: #f8fafc;
  color: #0f172a;
}

.theme-tab.active {
  background: #0f172a;
  color: #ffffff;
  border-color: #0f172a;
}

/* ── Search & Filter Row ── */
.filter-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.search-box {
  flex: 1;
  min-width: 260px;
  position: relative;
}

.search-box input {
  width: 100%;
  padding: 0.5rem 1rem 0.5rem 2.25rem;
  border-radius: 10px;
  border: 1px solid #cbd5e1;
  font-size: 0.85rem;
  font-family: inherit;
  transition: all 0.2s ease;
  background: #ffffff;
}

.search-box input:focus {
  outline: none;
  border-color: var(--dawn-amber);
  box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.15);
}

.search-icon {
  position: absolute;
  left: 0.75rem;
  top: 50%;
  transform: translateY(-50%);
  color: #94a3b8;
  font-size: 0.9rem;
}

.clear-search {
  position: absolute;
  right: 0.65rem;
  top: 50%;
  transform: translateY(-50%);
  background: transparent;
  border: none;
  color: #94a3b8;
  cursor: pointer;
  font-size: 0.9rem;
}

.filter-select {
  padding: 0.5rem 0.85rem;
  border-radius: 10px;
  border: 1px solid #cbd5e1;
  background: #ffffff;
  font-size: 0.82rem;
  font-family: inherit;
  color: #334155;
  cursor: pointer;
}

/* Font Steppers */
.font-controls {
  display: inline-flex;
  align-items: center;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 9px;
  padding: 0.15rem 0.4rem;
  gap: 0.25rem;
}

.font-btn {
  background: transparent;
  border: none;
  font-size: 0.75rem;
  font-weight: 700;
  padding: 0.25rem 0.45rem;
  border-radius: 5px;
  cursor: pointer;
  color: #475569;
}

.font-btn:hover {
  background: #e2e8f0;
  color: #0f172a;
}

.font-display {
  font-size: 0.75rem;
  font-weight: 700;
  font-family: var(--font-mono);
  color: #0f172a;
  min-width: 40px;
  text-align: center;
}

/* ── Educational Legend Card ── */
.legend-wrapper {
  max-width: 1280px;
  margin: 1.5rem auto 0;
  padding: 0 1.5rem;
  width: 100%;
}

.legend-card {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 16px;
  padding: 1.25rem 1.5rem;
  box-shadow: 0 2px 10px rgba(0,0,0,0.02);
}

.legend-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
}

.legend-title {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.92rem;
  color: #0f172a;
}

.legend-tag {
  background: #eff6ff;
  color: #1d4ed8;
  font-size: 0.72rem;
  font-weight: 700;
  padding: 0.2rem 0.6rem;
  border-radius: 6px;
}

.legend-benefit {
  font-size: 0.85rem;
  color: #64748b;
  margin-bottom: 1rem;
}

.legend-chips-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
}

.legend-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  padding: 0.35rem 0.75rem;
  border-radius: 8px;
  font-size: 0.78rem;
}

.legend-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}

.legend-chip-label {
  font-weight: 700;
  color: #1e293b;
}

.legend-chip-desc {
  color: #64748b;
}

/* ── Main Canvas ── */
.main-canvas {
  max-width: 1280px;
  margin: 1.5rem auto 4rem;
  padding: 0 1.5rem;
  width: 100%;
  flex: 1;
}

/* ── Sacred Bismillah Banner ── */
.bismillah-card {
  text-align: center;
  padding: 1.75rem 1.5rem 1.5rem;
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 20px;
  margin-bottom: 1.75rem;
  box-shadow: 0 4px 15px -2px rgba(0,0,0,0.03);
}

.bismillah-ar {
  font-family: var(--font-arabic);
  font-size: calc(2.4rem * var(--arabic-scale));
  color: #0f172a;
  direction: rtl;
  margin-bottom: 0.4rem;
}

.bismillah-en {
  font-size: 0.85rem;
  color: #64748b;
  font-style: italic;
}

/* ── Inline Grammar Reveal Card ── */
.inline-reveal-card {
  background: linear-gradient(135deg, #f8fafc 0%, #ffffff 100%);
  border: 2px solid var(--dawn-amber);
  border-radius: 20px;
  padding: 1.5rem 1.75rem;
  margin-bottom: 2rem;
  box-shadow: 0 8px 25px -4px rgba(245, 158, 11, 0.15);
  animation: slideReveal 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

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

.reveal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid #f1f5f9;
  margin-bottom: 1rem;
}

.reveal-word-box {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.reveal-ar {
  font-family: var(--font-arabic);
  font-size: 2.4rem;
  color: #0f172a;
  direction: rtl;
}

.reveal-meta {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.reveal-lemma {
  font-size: 0.95rem;
  font-weight: 700;
  color: #1e293b;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.reveal-tag {
  background: #f1f5f9;
  color: #475569;
  padding: 0.15rem 0.5rem;
  border-radius: 6px;
  font-size: 0.72rem;
  font-weight: 600;
}

.reveal-loc {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: #94a3b8;
}

.reveal-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.btn-deep-tutor {
  background: linear-gradient(135deg, #2563eb, #1d4ed8);
  color: #ffffff;
  border: none;
  padding: 0.5rem 1.1rem;
  border-radius: 10px;
  font-size: 0.82rem;
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  transition: all 0.2s ease;
  box-shadow: 0 2px 8px rgba(37, 99, 235, 0.25);
}

.btn-deep-tutor:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.35);
}

.btn-close-reveal {
  background: #f1f5f9;
  border: none;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  color: #64748b;
  cursor: pointer;
  font-size: 1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
}

.btn-close-reveal:hover {
  background: #e2e8f0;
  color: #0f172a;
}

/* Meaning card in reveal */
.reveal-meaning-box {
  background: #fffbeb;
  border: 1px solid #fef3c7;
  border-left: 4px solid var(--dawn-amber);
  border-radius: 12px;
  padding: 1rem 1.25rem;
  margin-bottom: 1.25rem;
}

.meaning-title {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.82rem;
  font-weight: 700;
  color: #92400e;
  margin-bottom: 0.3rem;
}

.meaning-body {
  font-size: 0.95rem;
  color: #78350f;
  line-height: 1.5;
}

.reveal-chips-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
}

.reveal-chip {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  padding: 0.4rem 0.85rem;
  border-radius: 10px;
  font-size: 0.8rem;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.reveal-chip-k {
  color: #64748b;
  font-weight: 500;
}

.reveal-chip-v {
  font-weight: 700;
  color: #0f172a;
}

.reveal-chip-v.ar-font {
  font-family: var(--font-arabic);
  font-size: 1.1rem;
  color: #1d4ed8;
}

/* ── VIEW MODE 1: Mushaf Continuous Flow ── */
.mushaf-card {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 24px;
  padding: 2.5rem 3rem;
  box-shadow: 0 4px 20px -4px rgba(0,0,0,0.04);
}

.mushaf-paragraph {
  direction: rtl;
  text-align: justify;
  line-height: calc(3.4 * var(--arabic-scale));
  font-family: var(--font-arabic);
  font-size: calc(2.2rem * var(--arabic-scale));
  word-spacing: 0.15em;
}

/* Word Token in Mushaf & Cards — Clean Calligraphy, NO Highlighted Boxes */
.q-token {
  display: inline;
  padding: 0 0.12em;
  margin: 0;
  background: transparent !important;
  border: none !important;
  box-shadow: none !important;
  outline: none !important;
  cursor: pointer;
  transition: opacity 0.15s ease, text-decoration 0.15s ease;
  position: relative;
  user-select: none;
  font-family: inherit;
}

.q-token:hover {
  opacity: 0.78;
}

.q-token.is-selected {
  text-decoration: underline !important;
  text-decoration-thickness: 3px !important;
  text-underline-offset: 8px !important;
  text-decoration-color: currentColor !important;
  font-weight: 700;
}

/* ── STRICT WORD CLASS FAMILY COLORS (NO BACKGROUND BOXES) ── */
/* 1. Nouns = Blue Color */
.pos-ism, [class*="pos-ism"] {
  color: #1d4ed8 !important;
}

/* 2. Verbs = Red Family Color */
.pos-fil, [class*="pos-fil"], [class*="pos-fi'l"] {
  color: #dc2626 !important;
}

/* 3. Harf = Green Family Color */
.pos-harf, [class*="pos-harf"] {
  color: #059669 !important;
}

/* Alternate Grammar Dimensions (Text Ink Only, NEVER Background Boxes) */
.case-mode .case-raf { color: #2563eb !important; }
.case-mode .case-nasb { color: #059669 !important; }
.case-mode .case-jarr { color: #7c3aed !important; }
.case-mode .case-jazm { color: #d97706 !important; }
.case-mode .case-mabni { color: #475569 !important; }

/* Ayah end marker symbol */
.ayah-end-ornament {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--dawn-amber);
  font-family: var(--font-arabic);
  font-size: 0.85em;
  margin: 0 0.45rem;
  cursor: pointer;
  transition: all 0.2s ease;
  user-select: none;
}

.ayah-end-ornament:hover {
  transform: scale(1.15);
  color: var(--dawn-orange);
}

.ayah-end-ornament.is-playing {
  color: var(--dawn-orange);
  animation: pulseAyah 1.2s infinite;
}

@keyframes pulseAyah {
  0%, 100% { transform: scale(1); filter: drop-shadow(0 0 2px var(--dawn-amber)); }
  50% { transform: scale(1.2); filter: drop-shadow(0 0 8px var(--dawn-orange)); }
}

/* ── Inline Word Explanation Drawer (Pushes Following Lines Down) ── */
.mushaf-flow-container {
  direction: rtl;
  text-align: justify;
  line-height: calc(3.4 * var(--arabic-scale));
  font-family: var(--font-arabic);
  font-size: calc(2.2rem * var(--arabic-scale));
  word-spacing: 0.15em;
}

.mushaf-ayah-row,
.mushaf-ayah-span {
  display: inline;
}

.inline-word-drawer {
  display: block;
  width: 100%;
  box-sizing: border-box;
  direction: ltr !important;
  text-align: left !important;
  font-family: var(--font-sans) !important;
  font-size: 0.95rem !important;
  line-height: 1.5 !important;
  letter-spacing: normal !important;
  word-spacing: normal !important;
  margin: 1.5rem 0;
  padding: 1.5rem 1.75rem;
  background: #ffffff;
  border-radius: 18px;
  box-shadow: 0 10px 30px -5px rgba(0,0,0,0.08), 0 0 0 1px #e2e8f0;
  animation: drawerSlideDown 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  clear: both;
}

.drawer-close-btn {
  background: #f1f5f9;
  border: none;
  color: #64748b;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 1rem;
  font-weight: 700;
  transition: all 0.2s ease;
  line-height: 1;
  user-select: none;
}

.drawer-close-btn:hover {
  background: #e2e8f0;
  color: #0f172a;
  transform: scale(1.06);
}

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

.inline-word-drawer.type-fil {
  border-left: 5px solid #dc2626;
  background: linear-gradient(135deg, #fff5f5 0%, #ffffff 40%);
}

.inline-word-drawer.type-ism {
  border-left: 5px solid #1d4ed8;
  background: linear-gradient(135deg, #f0f7ff 0%, #ffffff 40%);
}

.inline-word-drawer.type-harf {
  border-left: 5px solid #059669;
  background: linear-gradient(135deg, #f0fdf4 0%, #ffffff 40%);
}

.drawer-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1rem;
  padding-bottom: 0.9rem;
  border-bottom: 1px solid #f1f5f9;
  margin-bottom: 1rem;
}

.drawer-word-box {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.drawer-ar-text {
  font-family: var(--font-arabic);
  font-size: 2.4rem;
  direction: rtl;
  line-height: 1.2;
}

.drawer-meta {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.drawer-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.75rem;
  font-weight: 700;
  padding: 0.2rem 0.6rem;
  border-radius: 6px;
  width: fit-content;
}

.badge-fil {
  background: #fee2e2;
  color: #b91c1c;
}

.badge-ism {
  background: #dbeafe;
  color: #1e40af;
}

.badge-harf {
  background: #dcfce7;
  color: #15803d;
}

.drawer-meaning-box {
  background: rgba(255, 255, 255, 0.9);
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 1rem 1.25rem;
  margin-bottom: 1rem;
}

.drawer-chips-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.drawer-chip {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  padding: 0.35rem 0.75rem;
  border-radius: 8px;
  font-size: 0.8rem;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

.drawer-chip-k {
  color: #64748b;
  font-weight: 500;
}

.drawer-chip-v {
  font-weight: 700;
  color: #0f172a;
}

.drawer-chip-v.ar-font {
  font-family: var(--font-arabic);
  font-size: 1.15rem;
}

/* Gem highlight inside drawer */
.drawer-gem-box {
  background: #fffbeb;
  border: 1px solid #fef3c7;
  border-radius: 10px;
  padding: 0.85rem 1.1rem;
  margin-bottom: 1rem;
  font-size: 0.88rem;
}

.drawer-actions-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.5rem;
  padding-top: 0.75rem;
  border-top: 1px solid #f1f5f9;
}

.drawer-hint {
  font-size: 0.78rem;
  color: #94a3b8;
  font-style: italic;
}

/* ── VIEW MODE 2: Ayah-by-Ayah Study Cards ── */
.ayah-cards-list {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.ayah-study-card {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 20px;
  padding: 1.75rem 2rem;
  box-shadow: 0 2px 10px rgba(0,0,0,0.02);
  transition: all 0.3s ease;
  position: relative;
}

.ayah-study-card.is-active-ayah {
  border-color: var(--dawn-amber);
  box-shadow: 0 0 0 2px rgba(245, 158, 11, 0.25), 0 8px 24px -4px rgba(245, 158, 11, 0.15);
}

.ayah-card-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.75rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid #f1f5f9;
  margin-bottom: 1.25rem;
}

.ayah-num-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  background: #f1f5f9;
  color: #1e293b;
  font-family: var(--font-mono);
  font-size: 0.8rem;
  font-weight: 700;
  padding: 0.3rem 0.75rem;
  border-radius: 8px;
}

.ayah-theme-chip {
  font-size: 0.75rem;
  font-weight: 700;
  padding: 0.25rem 0.65rem;
  border-radius: 6px;
  background: #f8fafc;
  color: #475569;
  border: 1px solid #e2e8f0;
}

.ayah-card-actions {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.ayah-action-btn {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  color: #475569;
  border-radius: 8px;
  padding: 0.35rem 0.75rem;
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  transition: all 0.2s ease;
}

.ayah-action-btn:hover {
  background: #f1f5f9;
  color: #0f172a;
}

.ayah-action-btn.is-playing {
  background: var(--dawn-amber);
  color: #ffffff;
  border-color: var(--dawn-orange);
}

.ayah-arabic-flow {
  direction: rtl;
  font-family: var(--font-arabic);
  font-size: calc(2.2rem * var(--arabic-scale));
  line-height: calc(3.2 * var(--arabic-scale));
  margin-bottom: 1.25rem;
}

.ayah-translation-block {
  padding-top: 1rem;
  border-top: 1px solid #f8fafc;
}

.ayah-tlit {
  font-size: calc(0.92rem * var(--english-scale));
  color: #64748b;
  font-style: italic;
  margin-bottom: 0.4rem;
}

.ayah-trans {
  font-size: calc(1.05rem * var(--english-scale));
  color: #1e293b;
  font-weight: 500;
  line-height: 1.6;
}

/* Tooltips */
.show-tooltips .q-token[data-tooltip]:hover::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: 100%;
  left: 50%;
  transform: translateX(-50%);
  background: #0f172a;
  color: #ffffff;
  padding: 0.35rem 0.75rem;
  border-radius: 6px;
  font-size: 0.72rem;
  font-family: var(--font-sans);
  white-space: nowrap;
  pointer-events: none;
  z-index: 100;
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
  margin-bottom: 6px;
}

/* ── Deep Linguistic Tutor Drawer / Modal ── */
.deep-modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.75);
  backdrop-filter: blur(6px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  animation: fadeIn 0.2s ease;
}

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

.deep-modal-card {
  background: #ffffff;
  width: 100%;
  max-width: 960px;
  max-height: 90vh;
  border-radius: 24px;
  box-shadow: 0 25px 50px -12px rgba(0,0,0,0.25);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: scaleUp 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

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

.deep-modal-header {
  padding: 1.5rem 2rem;
  background: linear-gradient(135deg, #090d16 0%, #1e1b4b 100%);
  color: #ffffff;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1rem;
}

.modal-header-word {
  display: flex;
  align-items: center;
  gap: 1.25rem;
}

.modal-ar-text {
  font-family: var(--font-arabic);
  font-size: 3rem;
  color: var(--dawn-gold);
  direction: rtl;
}

.modal-meta-box {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.modal-meta-title {
  font-size: 1.1rem;
  font-weight: 700;
  color: #ffffff;
}

.modal-meta-sub {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: #94a3b8;
}

.modal-close-btn {
  background: rgba(255, 255, 255, 0.1);
  border: none;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  color: #cbd5e1;
  font-size: 1.2rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
}

.modal-close-btn:hover {
  background: rgba(255, 255, 255, 0.2);
  color: #ffffff;
}

.deep-modal-body {
  padding: 2rem;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 1.75rem;
}

/* 3-Tier AI Explanation Tabs in Modal */
.ai-tabs-header {
  display: flex;
  gap: 0.5rem;
  border-bottom: 2px solid #f1f5f9;
  padding-bottom: 0.75rem;
}

.ai-tab-btn {
  background: transparent;
  border: none;
  font-size: 0.85rem;
  font-weight: 600;
  color: #64748b;
  padding: 0.4rem 0.85rem;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s ease;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}

.ai-tab-btn:hover {
  color: #0f172a;
  background: #f8fafc;
}

.ai-tab-btn.active {
  color: var(--dawn-orange);
  background: #fff7ed;
  font-weight: 700;
}

.ai-tab-content-box {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 14px;
  padding: 1.25rem 1.5rem;
  font-size: 0.95rem;
  color: #334155;
  line-height: 1.6;
}

/* Nouman Ali Khan Gem Card */
.gem-card {
  background: linear-gradient(135deg, #fdf8f6 0%, #fffbf5 100%);
  border: 1px solid #fed7aa;
  border-radius: 16px;
  padding: 1.5rem 1.75rem;
  position: relative;
  overflow: hidden;
}

.gem-card::before {
  content: '💎';
  position: absolute;
  top: 1rem;
  right: 1.25rem;
  font-size: 2rem;
  opacity: 0.25;
}

.gem-header-badge {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  color: #ea580c;
  letter-spacing: 0.06em;
  margin-bottom: 0.4rem;
}

.gem-title {
  font-size: 1.15rem;
  font-weight: 800;
  color: #9a3412;
  margin-bottom: 0.75rem;
  line-height: 1.4;
}

.gem-deep-dive {
  font-size: 0.92rem;
  color: #431407;
  line-height: 1.65;
  margin-bottom: 1.25rem;
}

/* Sub-morphemes table */
.sub-morphemes-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
  margin-bottom: 1rem;
}

.sub-morphemes-table th, .sub-morphemes-table td {
  padding: 0.6rem 0.85rem;
  text-align: left;
  border-bottom: 1px solid #fed7aa;
}

.sub-morphemes-table th {
  background: rgba(254, 215, 170, 0.4);
  color: #9a3412;
  font-weight: 700;
}

.sub-morphemes-table td.ar-cell {
  font-family: var(--font-arabic);
  font-size: 1.2rem;
  direction: rtl;
  color: #9a3412;
}

.balaghah-secret-pill {
  background: #ffedd5;
  border-left: 4px solid #ea580c;
  padding: 0.75rem 1rem;
  border-radius: 8px;
  font-size: 0.85rem;
  color: #7c2d12;
  font-weight: 600;
}

/* Traditional Irab Box */
.irab-box {
  background: #f8fafc;
  border: 1px solid #cbd5e1;
  border-radius: 14px;
  padding: 1.25rem 1.5rem;
}

.irab-box-title {
  font-size: 0.85rem;
  font-weight: 700;
  color: #475569;
  margin-bottom: 0.5rem;
}

.irab-ar-text {
  font-family: var(--font-arabic);
  font-size: 1.25rem;
  color: #1e293b;
  direction: rtl;
  line-height: 1.8;
}

/* ── Interactive Quiz Modal / Drawer ── */
.quiz-card-full {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 18px;
  padding: 1.5rem;
  box-shadow: 0 4px 15px rgba(0,0,0,0.03);
}

.quiz-question-text {
  font-size: 1.05rem;
  font-weight: 700;
  color: #0f172a;
  margin-bottom: 1.25rem;
  line-height: 1.5;
}

.quiz-options-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin-bottom: 1.25rem;
}

.quiz-opt-btn {
  background: #f8fafc;
  border: 1.5px solid #e2e8f0;
  border-radius: 12px;
  padding: 0.85rem 1.1rem;
  font-size: 0.9rem;
  color: #1e293b;
  cursor: pointer;
  text-align: left;
  transition: all 0.2s ease;
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
}

.quiz-opt-btn:hover {
  background: #f1f5f9;
  border-color: #cbd5e1;
}

.quiz-opt-btn.correct {
  background: #ecfdf5;
  border-color: #10b981;
  color: #065f46;
  font-weight: 600;
}

.quiz-opt-btn.incorrect {
  background: #fff1f2;
  border-color: #f43f5e;
  color: #9f1239;
}

.quiz-explanation-box {
  background: #f0fdf4;
  border: 1px solid #bbf7d0;
  border-radius: 10px;
  padding: 1rem;
  font-size: 0.88rem;
  color: #166534;
  line-height: 1.5;
}

/* ── Toast Notification ── */
.toast-msg {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  background: #0f172a;
  color: #ffffff;
  padding: 0.75rem 1.25rem;
  border-radius: 12px;
  font-size: 0.85rem;
  font-weight: 600;
  box-shadow: 0 10px 25px rgba(0,0,0,0.2);
  z-index: 2000;
  animation: slideUp 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

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

/* ── Footer ── */
.app-footer {
  background: #ffffff;
  border-top: 1px solid var(--border-light);
  padding: 2.5rem 1.5rem;
  text-align: center;
  font-size: 0.82rem;
  color: #64748b;
  margin-top: auto;
}

.footer-container {
  max-width: 1280px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  align-items: center;
}

.footer-version {
  font-family: var(--font-mono);
  font-weight: 700;
  color: var(--dawn-orange);
  background: #fff7ed;
  border: 1px solid #ffedd5;
  padding: 0.25rem 0.75rem;
  border-radius: 6px;
  display: inline-block;
}

/* ── Responsive Media Queries ── */
@media (max-width: 768px) {
  h1.hero-en { font-size: 2rem; }
  .hero-ar { font-size: 2.5rem; }
  .mushaf-card { padding: 1.5rem 1.25rem; }
  .mushaf-paragraph { font-size: calc(1.7rem * var(--arabic-scale)); line-height: calc(2.7 * var(--arabic-scale)); }
  .ayah-arabic-flow { font-size: calc(1.7rem * var(--arabic-scale)); line-height: calc(2.7 * var(--arabic-scale)); }
  .deep-modal-card { max-height: 95vh; border-radius: 16px; }
  .deep-modal-header { padding: 1rem 1.25rem; }
  .deep-modal-body { padding: 1.25rem; }
}
