:root {
  /* Warm Parchment Light Theme (Matched to Book Palette) */
  --bg: #f8f6f0;
  --surface: #ffffff;
  --surface-alt: #f4f1e8;
  --surface-tint: #edf4f0;
  --arabic-bg: #fbf9f3;
  --border: #e3ded0;
  --border-strong: #cfc7b4;
  --primary: #0b4638;
  --primary-hover: #0f5c4a;
  --primary-soft: rgba(11, 70, 56, 0.09);
  --gold: #8c5d14;
  --gold-soft: #f7eedb;
  --gold-border: #d4b06a;
  --text: #141f1b;
  --text-secondary: #2e3f38;
  --text-muted: #5b6d65;
  --shadow-sm: 0 1px 3px rgba(11, 70, 56, 0.06);
  --shadow-md: 0 6px 20px rgba(11, 70, 56, 0.09);
  --shadow-lg: 0 16px 40px rgba(10, 25, 20, 0.18);

  /* Exact 7-Color Tajweed Palette from PDF Page 5 */
  --tj-idgham: #15803d;
  --tj-qalqalah: #c61a1a;
  --tj-qalb: #6b21a8;
  --tj-ghunnah: #e65100;
  --tj-ikhfa: #0277bd;
  --tj-ikhfa-meem: #c2185b;
  --tj-idgham-meem: #689f38;

  /* Dynamic Typography Controls */
  --ar-size: 28px;
  --bn-size: 16px;

  /* Layout */
  --sidebar-w: 280px;
  --header-h: 58px;
  --bottom-nav-h: 64px;
  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 20px;
}

[data-theme="dark"] {
  --bg: #0b1210;
  --surface: #121d19;
  --surface-alt: #182722;
  --surface-tint: #152b23;
  --arabic-bg: #0f1916;
  --border: #22352e;
  --border-strong: #2e483e;
  --primary: #34b88d;
  --primary-hover: #4fd1a5;
  --primary-soft: rgba(52, 184, 141, 0.14);
  --gold: #e6c27a;
  --gold-soft: rgba(230, 194, 122, 0.13);
  --gold-border: #8a6c34;
  --text: #ecf3ef;
  --text-secondary: #c5d6ce;
  --text-muted: #8aa397;
  --shadow-sm: 0 1px 4px rgba(0, 0, 0, 0.35);
  --shadow-md: 0 6px 24px rgba(0, 0, 0, 0.45);
  --shadow-lg: 0 18px 48px rgba(0, 0, 0, 0.65);

  /* High-Contrast WCAG Dark Mode Tajweed Palette */
  --tj-idgham: #4ade80;
  --tj-qalqalah: #f87171;
  --tj-qalb: #c084fc;
  --tj-ghunnah: #fb923c;
  --tj-ikhfa: #38bdf8;
  --tj-ikhfa-meem: #f472b6;
  --tj-idgham-meem: #a3e635;
}

[data-theme="sepia"] {
  --bg: #f3ead8;
  --surface: #fbf6ea;
  --surface-alt: #efe4cc;
  --surface-tint: #e8ebd9;
  --arabic-bg: #f6eedc;
  --border: #ddd0b3;
  --border-strong: #c5b38c;
  --primary: #0f4c3a;
  --primary-hover: #14634c;
  --primary-soft: rgba(15, 76, 58, 0.09);
  --gold: #7d5210;
  --gold-soft: #eee1c2;
  --gold-border: #c29c52;
  --text: #2a2117;
  --text-secondary: #433728;
  --text-muted: #6c5d49;

  /* Calibrated Sepia Tajweed Palette */
  --tj-idgham: #166534;
  --tj-qalqalah: #b91c1c;
  --tj-qalb: #6b21a8;
  --tj-ghunnah: #c2410c;
  --tj-ikhfa: #0369a1;
  --tj-ikhfa-meem: #be185d;
  --tj-idgham-meem: #4d7c0f;
}

*, *::before, *::after {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: 'Hind Siliguri', 'Noto Sans Bengali', 'Noto Serif Bengali', system-ui, -apple-system, sans-serif;
  font-size: var(--bn-size);
  line-height: 1.65;
  min-height: 100%;
  overflow-x: hidden;
  transition: background-color 0.2s ease, color 0.2s ease;
}

.serif-bn {
  font-family: 'Noto Serif Bengali', 'Hind Siliguri', serif;
}

/* Tajweed Color Classes — pure inline color to preserve Arabic cursive ligatures */
.tj-idgham { color: var(--tj-idgham); }
.tj-qalqalah { color: var(--tj-qalqalah); }
.tj-qalb { color: var(--tj-qalb); }
.tj-ghunnah { color: var(--tj-ghunnah); }
.tj-ikhfa { color: var(--tj-ikhfa); }
.tj-ikhfa-meem { color: var(--tj-ikhfa-meem); }
.tj-idgham-meem { color: var(--tj-idgham-meem); }

body.tajweed-off .tj-idgham,
body.tajweed-off .tj-qalqalah,
body.tajweed-off .tj-qalb,
body.tajweed-off .tj-ghunnah,
body.tajweed-off .tj-ikhfa,
body.tajweed-off .tj-ikhfa-meem,
body.tajweed-off .tj-idgham-meem {
  color: inherit !important;
}

body.hide-pronunciation .dua-pronunciation { display: none !important; }
body.hide-meaning .dua-meaning { display: none !important; }

/* App Shell */
.app-shell {
  display: flex;
  min-height: 100vh;
}

/* Desktop Sidebar */
.sidebar {
  display: none;
  width: var(--sidebar-w);
  background: var(--surface);
  border-right: 1px solid var(--border);
  position: fixed;
  top: 0;
  bottom: 0;
  left: 0;
  z-index: 40;
  flex-direction: column;
  overflow: hidden;
}

.sidebar-brand {
  padding: 18px 18px 14px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--primary);
  color: #ffffff;
}

.sidebar-brand-icon {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  flex-shrink: 0;
  overflow: hidden;
  border: 1px solid rgba(232, 198, 122, 0.55);
}

.sidebar-brand h1 {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: 0.01em;
  line-height: 1.2;
}

.sidebar-brand p {
  margin: 2px 0 0;
  font-size: 0.72rem;
  opacity: 0.85;
}

.sidebar-nav {
  flex: 1;
  overflow-y: auto;
  padding: 10px 10px 24px;
}

.sidebar-group-label {
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 12px 10px 6px;
}

.sidebar-link {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  border: none;
  background: transparent;
  color: var(--text-secondary);
  font-family: inherit;
  font-size: 0.88rem;
  text-align: left;
  padding: 9px 11px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}

.sidebar-link:hover {
  background: var(--surface-alt);
  color: var(--text);
}

.sidebar-link.active {
  background: var(--primary-soft);
  color: var(--primary);
  font-weight: 600;
}

.sidebar-num {
  width: 24px;
  height: 24px;
  border-radius: 6px;
  background: var(--surface-alt);
  color: var(--primary);
  font-size: 0.75rem;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.sidebar-link.active .sidebar-num {
  background: var(--primary);
  color: #fff;
}

/* Main Area */
.main-wrap {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  padding-bottom: calc(var(--bottom-nav-h) + 18px);
}

/* Top Header */
.top-header {
  position: sticky;
  top: 0;
  z-index: 30;
  height: var(--header-h);
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 14px;
  gap: 8px;
  box-shadow: var(--shadow-sm);
}

.header-left {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.header-logo-mini {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  flex-shrink: 0;
}

.header-title {
  margin: 0;
  font-size: 1.02rem;
  font-weight: 700;
  color: var(--primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

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

.icon-btn {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--surface-alt);
  color: var(--text);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, transform 0.1s;
  position: relative;
}

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

.icon-btn:active {
  transform: scale(0.95);
}

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

/* Install Banner */
.install-banner {
  background: linear-gradient(135deg, #0b4638 0%, #12614e 100%);
  color: #fff;
  padding: 12px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border-bottom: 2px solid var(--gold-border);
}

.install-banner.hidden { display: none; }

.install-banner-text {
  font-size: 0.88rem;
  line-height: 1.35;
}

.install-banner-text strong {
  display: block;
  font-size: 0.94rem;
  color: #f6e0a6;
}

.install-banner-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.btn-install {
  background: #f6e0a6;
  color: #0b3b2f;
  border: none;
  border-radius: 8px;
  padding: 7px 14px;
  font-family: inherit;
  font-weight: 700;
  font-size: 0.84rem;
  cursor: pointer;
}

.btn-dismiss {
  background: rgba(255, 255, 255, 0.16);
  color: #fff;
  border: none;
  border-radius: 8px;
  width: 30px;
  height: 30px;
  cursor: pointer;
  font-size: 1rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

/* Content Container */
.content-container {
  width: 100%;
  max-width: 760px;
  margin: 0 auto;
  padding: 16px 14px 32px;
}

/* Hero / Time-of-Day Card */
.hero-card {
  background: linear-gradient(145deg, #0b4638 0%, #105a48 65%, #0a3c30 100%);
  color: #ffffff;
  border-radius: var(--radius-lg);
  padding: 20px 18px;
  margin-bottom: 18px;
  position: relative;
  overflow: hidden;
  border: 1px solid rgba(212, 175, 102, 0.45);
  box-shadow: var(--shadow-md);
}

.hero-card::after {
  content: "";
  position: absolute;
  right: -30px;
  top: -30px;
  width: 150px;
  height: 150px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(246, 224, 166, 0.16) 0%, transparent 70%);
  pointer-events: none;
}

.hero-bismillah {
  font-family: 'Noto Naskh Arabic', 'Scheherazade New', serif;
  font-size: 1.35rem;
  color: #f6e0a6;
  text-align: center;
  margin-bottom: 6px;
  line-height: 1.9;
}

.hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(246, 224, 166, 0.18);
  color: #f6e0a6;
  border: 1px solid rgba(246, 224, 166, 0.35);
  border-radius: 999px;
  padding: 4px 12px;
  font-size: 0.78rem;
  font-weight: 600;
  margin-bottom: 8px;
}

.hero-title {
  margin: 0 0 6px;
  font-size: 1.35rem;
  line-height: 1.3;
  color: #ffffff;
}

.hero-sub {
  margin: 0 0 14px;
  font-size: 0.88rem;
  color: rgba(255, 255, 255, 0.86);
}

.hero-cta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.hero-pill-btn {
  background: rgba(255, 255, 255, 0.14);
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.25);
  border-radius: 10px;
  padding: 8px 13px;
  font-family: inherit;
  font-size: 0.84rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s;
}

.hero-pill-btn.primary {
  background: #f6e0a6;
  color: #0b3b2f;
  border-color: #f6e0a6;
}

.hero-pill-btn:hover {
  background: rgba(255, 255, 255, 0.24);
}
.hero-pill-btn.primary:hover {
  background: #fae8b8;
}

/* Section Titles */
.section-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 22px 0 10px;
}

.section-heading h2 {
  margin: 0;
  font-size: 1.04rem;
  color: var(--primary);
  font-weight: 700;
}

/* Quick Launch Grid */
.quick-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  margin-bottom: 18px;
}

.quick-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 13px 13px;
  text-align: left;
  cursor: pointer;
  font-family: inherit;
  color: var(--text);
  display: flex;
  flex-direction: column;
  gap: 4px;
  box-shadow: var(--shadow-sm);
  transition: transform 0.14s, border-color 0.15s, box-shadow 0.15s;
}

.quick-card:hover {
  border-color: var(--primary);
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
}

.quick-card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.quick-card-icon {
  width: 32px;
  height: 32px;
  border-radius: 9px;
  background: var(--primary-soft);
  color: var(--primary);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  font-weight: 700;
}

.quick-card-tag {
  font-size: 0.7rem;
  color: var(--gold);
  background: var(--gold-soft);
  padding: 2px 7px;
  border-radius: 99px;
  font-weight: 600;
}

.quick-card-title {
  font-weight: 700;
  font-size: 0.92rem;
  color: var(--text);
  margin-top: 4px;
}

.quick-card-desc {
  font-size: 0.77rem;
  color: var(--text-muted);
  line-height: 1.35;
}

/* Chapter Index List */
.chapter-list {
  display: flex;
  flex-direction: column;
  gap: 9px;
}

.chapter-row {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 13px 14px;
  display: flex;
  align-items: center;
  gap: 13px;
  cursor: pointer;
  text-align: left;
  width: 100%;
  font-family: inherit;
  color: var(--text);
  box-shadow: var(--shadow-sm);
  transition: border-color 0.15s, background 0.15s;
}

.chapter-row:hover {
  border-color: var(--primary);
  background: var(--surface-tint);
}

.chapter-badge-num {
  width: 40px;
  height: 40px;
  border-radius: 11px;
  background: var(--primary);
  color: #f6e0a6;
  font-weight: 700;
  font-size: 0.98rem;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.chapter-row-body {
  flex: 1;
  min-width: 0;
}

.chapter-row-title {
  font-weight: 700;
  font-size: 0.96rem;
  color: var(--text);
  line-height: 1.35;
}

.chapter-row-sub {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: 2px;
  line-height: 1.35;
}

.chapter-row-page {
  font-size: 0.74rem;
  color: var(--gold);
  background: var(--gold-soft);
  padding: 3px 8px;
  border-radius: 6px;
  font-weight: 600;
  flex-shrink: 0;
}

/* Chapter Header Banner */
.chapter-banner {
  background: var(--primary);
  color: #ffffff;
  border-radius: var(--radius-md);
  padding: 16px 18px;
  margin-bottom: 14px;
  border-bottom: 3px solid var(--gold-border);
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.chapter-banner h2 {
  margin: 0;
  font-size: 1.18rem;
  line-height: 1.35;
  color: #ffffff;
}

.chapter-banner-meta {
  font-size: 0.8rem;
  color: #f6e0a6;
  margin-top: 4px;
}

.btn-tajweed-mini {
  background: rgba(255, 255, 255, 0.14);
  color: #f6e0a6;
  border: 1px solid rgba(246, 224, 166, 0.4);
  border-radius: 9px;
  padding: 6px 10px;
  font-family: inherit;
  font-size: 0.76rem;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  flex-shrink: 0;
}

.btn-tajweed-mini:hover {
  background: rgba(255, 255, 255, 0.24);
}

/* Sub-heading banner inside chapters */
.sub-heading-bar {
  background: var(--surface-tint);
  border: 1px solid var(--border);
  border-top: 2px solid var(--gold-border);
  border-bottom: 2px solid var(--gold-border);
  color: var(--primary);
  font-weight: 700;
  text-align: center;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  margin: 18px 0 12px;
  font-size: 0.94rem;
}

/* Callout Box */
.callout-box {
  background: var(--gold-soft);
  border: 1px solid var(--gold-border);
  border-left: 4px solid var(--gold);
  border-radius: var(--radius-sm);
  padding: 13px 15px;
  margin-bottom: 12px;
  font-size: 0.92rem;
  color: var(--text);
}

.callout-box strong {
  color: var(--primary);
}

/* Dua Card */
.dua-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 15px 16px;
  margin-bottom: 13px;
  box-shadow: var(--shadow-sm);
  transition: box-shadow 0.2s, border-color 0.2s;
}

.dua-card.highlight-flash {
  border-color: var(--gold);
  box-shadow: 0 0 0 3px var(--gold-soft), var(--shadow-md);
}

.dua-card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
}

.dua-card-title {
  margin: 0;
  font-size: 0.98rem;
  font-weight: 700;
  color: var(--primary);
  line-height: 1.4;
}

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

.count-badge {
  background: var(--gold-soft);
  color: var(--gold);
  border: 1px solid var(--gold-border);
  border-radius: 8px;
  padding: 3px 9px;
  font-size: 0.78rem;
  font-weight: 700;
  white-space: nowrap;
}

.bookmark-btn {
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 8px;
  width: 32px;
  height: 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.15s;
}

.bookmark-btn.saved {
  background: var(--gold-soft);
  border-color: var(--gold-border);
  color: var(--gold);
}

.bismillah-bar {
  background: var(--arabic-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 9px 12px;
  text-align: center;
  font-family: 'Noto Naskh Arabic', 'Scheherazade New', serif;
  font-size: calc(var(--ar-size) * 0.82);
  color: var(--primary);
  margin-bottom: 10px;
  line-height: 1.9;
}

.block-label-pill {
  display: inline-block;
  background: var(--gold-soft);
  color: var(--gold);
  border: 1px solid var(--gold-border);
  border-radius: 6px;
  padding: 2px 10px;
  font-size: 0.78rem;
  font-weight: 700;
  margin: 8px 0 8px;
}

/* CRITICAL ARABIC TYPOGRAPHY — Unbroken Cursive Joining Across Colored Spans */
.arabic-box {
  background: var(--arabic-bg);
  border: 1px solid var(--border);
  border-right: 4px solid var(--gold-border);
  border-radius: var(--radius-sm);
  padding: 14px 16px;
  margin-bottom: 12px;
}

.arabic-text {
  font-family: 'Noto Naskh Arabic', 'Scheherazade New', 'Amiri Quran', 'Traditional Arabic', serif;
  font-size: var(--ar-size);
  line-height: 2.38;
  word-spacing: 0.14em;
  direction: rtl;
  text-align: right;
  color: var(--text);
  margin: 0;
  font-feature-settings: "kern" 1, "liga" 1, "calt" 1, "ccmp" 1, "mark" 1, "mkmk" 1;
  text-rendering: optimizeLegibility;
}

/* Strictly inline — zero box/layout breaks inside Arabic shaping runs */
.arabic-text span[class^="tj-"] {
  display: inline;
  padding: 0;
  margin: 0;
  border: none;
  font-weight: inherit;
}

.ar-inline {
  font-family: 'Noto Naskh Arabic', 'Scheherazade New', serif;
  font-size: 1.25em;
  line-height: 1.9;
  direction: rtl;
  unicode-bidi: isolate;
}

.ayah-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 28px;
  height: 28px;
  padding: 0 5px;
  margin: 0 4px;
  border-radius: 999px;
  border: 1.5px solid var(--gold-border);
  background: var(--gold-soft);
  color: var(--primary);
  font-family: 'Hind Siliguri', 'Noto Sans Bengali', sans-serif;
  font-size: 0.5em;
  font-weight: 700;
  vertical-align: middle;
  line-height: 1;
}

/* Bengali Pronunciation & Meaning */
.dua-pronunciation {
  font-size: var(--bn-size);
  color: var(--text);
  margin: 0 0 8px;
  line-height: 1.72;
}

.dua-pronunciation .label,
.dua-meaning .label {
  font-weight: 700;
  color: var(--primary);
}

.dua-meaning {
  font-size: calc(var(--bn-size) * 0.96);
  color: var(--text-secondary);
  margin: 0 0 6px;
  line-height: 1.72;
}

.dua-ref {
  font-style: italic;
  color: var(--gold);
  font-size: 0.88em;
}

.dua-note {
  background: var(--surface-alt);
  border-left: 3px solid var(--gold-border);
  border-radius: 6px;
  padding: 9px 12px;
  margin-top: 10px;
  font-size: 0.88em;
  color: var(--text-secondary);
}

.dua-virtue {
  background: var(--surface-tint);
  border-left: 4px solid var(--primary);
  border-radius: 6px;
  padding: 10px 13px;
  margin-top: 10px;
  font-size: 0.9em;
  color: var(--text);
}

/* Morning/Evening & Pronoun Variant Switcher */
.variant-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  margin-bottom: 10px;
}

.variant-pill {
  border: 1px solid var(--border-strong);
  background: var(--surface-alt);
  color: var(--text-secondary);
  border-radius: 999px;
  padding: 4px 11px;
  font-family: inherit;
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
}

.variant-pill.active {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}

/* Embedded Tap-to-Count Tasbih Bar (Mobile-First, Strictly Single-Line) */
.tasbih-inline {
  margin-top: 12px;
  padding-top: 11px;
  border-top: 1px dashed var(--border);
  display: flex;
  align-items: stretch;
  gap: 8px;
  flex-wrap: nowrap;
}

.tasbih-tap-btn {
  flex: 1 1 auto;
  min-width: 0;
  min-height: 44px;
  background: var(--primary-soft);
  border: 1.5px solid var(--primary);
  color: var(--primary);
  border-radius: 12px;
  padding: 8px 12px;
  font-family: inherit;
  font-weight: 700;
  font-size: 0.88rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  position: relative;
  overflow: hidden;
  transition: transform 0.08s, background-color 0.2s, color 0.2s;
  user-select: none;
  -webkit-user-select: none;
  touch-action: manipulation;
}

.tasbih-tap-btn:active {
  transform: scale(0.98);
}

.tasbih-tap-btn.completed {
  background: var(--primary);
  color: #ffffff;
}

.tasbih-progress-fill {
  position: absolute !important;
  left: 0;
  top: 0;
  bottom: 0;
  height: 100%;
  background: rgba(11, 70, 56, 0.16);
  pointer-events: none;
  z-index: 0 !important;
  transition: width 0.2s ease;
}

[data-theme="dark"] .tasbih-progress-fill {
  background: rgba(52, 184, 141, 0.22);
}

.tasbih-tap-btn.completed .tasbih-progress-fill {
  background: rgba(255, 255, 255, 0.14);
}

.tasbih-tap-btn > .tasbih-label {
  position: relative;
  z-index: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
  text-align: left;
}

.tasbih-tap-btn > .tasbih-count {
  position: relative;
  z-index: 1;
  white-space: nowrap;
  flex-shrink: 0;
  font-variant-numeric: tabular-nums;
  background: rgba(255, 255, 255, 0.55);
  color: var(--primary);
  padding: 2px 9px;
  border-radius: 999px;
  font-size: 0.84rem;
}

[data-theme="dark"] .tasbih-tap-btn > .tasbih-count {
  background: rgba(0, 0, 0, 0.28);
  color: var(--primary);
}

.tasbih-tap-btn.completed > .tasbih-count {
  background: rgba(255, 255, 255, 0.2);
  color: #ffffff;
}

.tasbih-reset-btn {
  flex-shrink: 0;
  white-space: nowrap;
  min-height: 44px;
  background: var(--surface-alt);
  border: 1px solid var(--border);
  color: var(--text-muted);
  border-radius: 12px;
  padding: 8px 13px;
  font-family: inherit;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  touch-action: manipulation;
}

.tasbih-reset-btn:hover {
  color: var(--text);
  border-color: var(--border-strong);
}

/* Cross-Reference Row Card */
.ref-row-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 4px solid var(--primary);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  margin-bottom: 11px;
  box-shadow: var(--shadow-sm);
}

.ref-row-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.ref-row-text {
  font-size: 0.94rem;
  color: var(--text);
  line-height: 1.6;
}

.ref-pills-wrap {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin-top: 9px;
}

.xref-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: var(--gold-soft);
  color: var(--gold);
  border: 1px solid var(--gold-border);
  border-radius: 999px;
  padding: 5px 12px;
  font-family: inherit;
  font-size: 0.82rem;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.15s, transform 0.1s;
}

.xref-pill:hover {
  background: var(--primary);
  color: #f6e0a6;
  border-color: var(--primary);
}

/* Chapter 13 Sections & Munajat */
.reflection-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 16px 18px;
  margin-bottom: 13px;
}

.reflection-card h3 {
  margin: 0 0 10px;
  color: var(--primary);
  font-size: 1.05rem;
  border-bottom: 1px solid var(--border);
  padding-bottom: 8px;
}

.hadith-box {
  background: var(--gold-soft);
  border: 1px solid var(--gold-border);
  border-left: 4px solid var(--primary);
  border-radius: var(--radius-sm);
  padding: 14px 16px;
  margin-bottom: 13px;
  font-size: 0.94rem;
}

.munajat-box {
  background: var(--surface-tint);
  border: 2px solid var(--primary);
  border-radius: var(--radius-md);
  padding: 20px 18px;
  margin: 18px 0;
  text-align: center;
}

.munajat-box h3 {
  margin: 0 0 12px;
  color: var(--primary);
  font-size: 1.12rem;
}

/* Chapter 14 Interactive Daily Checklist */
.checklist-summary {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 16px;
  margin-bottom: 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
}

.checklist-ring-wrap {
  display: flex;
  align-items: center;
  gap: 14px;
}

.streak-chip {
  background: var(--gold-soft);
  color: var(--gold);
  border: 1px solid var(--gold-border);
  border-radius: 999px;
  padding: 5px 12px;
  font-size: 0.82rem;
  font-weight: 700;
}

.checklist-item {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 14px;
  margin-bottom: 10px;
  display: flex;
  align-items: flex-start;
  gap: 12px;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}

.checklist-item.done {
  background: var(--surface-tint);
  border-color: var(--primary);
}

.chk-box {
  width: 24px;
  height: 24px;
  border-radius: 7px;
  border: 2px solid var(--border-strong);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  margin-top: 2px;
  background: var(--surface);
  color: #fff;
  font-weight: 700;
}

.checklist-item.done .chk-box {
  background: var(--primary);
  border-color: var(--primary);
}

.checklist-item-body {
  flex: 1;
}

.checklist-time {
  font-weight: 700;
  color: var(--primary);
  font-size: 0.94rem;
  margin-bottom: 3px;
}

.checklist-task {
  font-size: 0.88rem;
  color: var(--text-secondary);
  line-height: 1.55;
}

.checklist-item.done .checklist-task {
  text-decoration: line-through;
  opacity: 0.72;
}

/* Prev / Next Chapter Nav */
.chapter-pager {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  margin-top: 22px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}

.pager-btn {
  flex: 1;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 11px 13px;
  font-family: inherit;
  color: var(--text);
  cursor: pointer;
  text-align: left;
  transition: border-color 0.15s;
}

.pager-btn.next { text-align: right; }
.pager-btn:hover { border-color: var(--primary); }
.pager-btn small { display: block; font-size: 0.72rem; color: var(--text-muted); }
.pager-btn strong { font-size: 0.88rem; color: var(--primary); }

/* Tajweed Legend Table / Cards */
.tajweed-rule-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 13px 14px;
  margin-bottom: 10px;
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
}

.tajweed-rule-head {
  display: flex;
  align-items: center;
  gap: 9px;
  font-weight: 700;
  font-size: 0.98rem;
}

.tj-swatch {
  width: 16px;
  height: 16px;
  border-radius: 4px;
  flex-shrink: 0;
}

.tajweed-example-box {
  background: var(--arabic-bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

/* Search Bar & Results */
.search-input-wrap {
  position: relative;
  margin-bottom: 14px;
}

.search-input {
  width: 100%;
  padding: 12px 16px;
  border-radius: var(--radius-md);
  border: 1.5px solid var(--border-strong);
  background: var(--surface);
  color: var(--text);
  font-family: inherit;
  font-size: 0.96rem;
  outline: none;
}

.search-input:focus {
  border-color: var(--primary);
}

/* Settings Panel */
.settings-group {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 16px;
  margin-bottom: 14px;
}

.settings-group h3 {
  margin: 0 0 12px;
  font-size: 0.98rem;
  color: var(--primary);
}

.theme-pills {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.theme-pill {
  border: 1.5px solid var(--border);
  background: var(--surface-alt);
  color: var(--text);
  border-radius: 10px;
  padding: 10px 8px;
  font-family: inherit;
  font-weight: 600;
  font-size: 0.86rem;
  cursor: pointer;
}

.theme-pill.active {
  border-color: var(--primary);
  background: var(--primary-soft);
  color: var(--primary);
}

.setting-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
  gap: 12px;
}

.setting-row:last-child { border-bottom: none; }

.range-slider {
  width: 140px;
  accent-color: var(--primary);
}

.toggle-switch {
  width: 46px;
  height: 26px;
  border-radius: 99px;
  background: var(--border-strong);
  border: none;
  position: relative;
  cursor: pointer;
  transition: background 0.2s;
  flex-shrink: 0;
}

.toggle-switch::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #fff;
  transition: transform 0.2s;
}

.toggle-switch.on {
  background: var(--primary);
}

.toggle-switch.on::after {
  transform: translateX(20px);
}

/* Bottom Navigation Bar (Mobile) */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: var(--bottom-nav-h);
  background: var(--surface);
  border-top: 1px solid var(--border);
  display: flex;
  align-items: stretch;
  justify-content: space-around;
  z-index: 35;
  padding-bottom: env(safe-area-inset-bottom, 0px);
  box-shadow: 0 -2px 12px rgba(0, 0, 0, 0.06);
}

.bnav-item {
  flex: 1;
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-family: inherit;
  font-size: 0.72rem;
  font-weight: 600;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  cursor: pointer;
  padding: 6px 2px;
}

.bnav-item.active {
  color: var(--primary);
}

.bnav-item svg {
  width: 21px;
  height: 21px;
}

/* Slide-up Modal Sheet (Cross-Refs, Tajweed Guide, Free Tasbih, Search) */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(8, 18, 15, 0.58);
  z-index: 60;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}

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

.modal-sheet {
  width: 100%;
  max-width: 720px;
  max-height: 88vh;
  background: var(--bg);
  border-radius: 20px 20px 0 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: var(--shadow-lg);
  transform: translateY(24px);
  transition: transform 0.22s ease;
}

.modal-backdrop.open .modal-sheet {
  transform: translateY(0);
}

.modal-header {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 14px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.modal-header h3 {
  margin: 0;
  font-size: 1rem;
  color: var(--primary);
}

.modal-body {
  padding: 16px;
  overflow-y: auto;
  flex: 1;
}

/* Free Tasbih Drawer UI */
.free-tasbih-circle {
  width: 196px;
  height: 196px;
  border-radius: 50%;
  margin: 14px auto;
  background: linear-gradient(145deg, #0b4638, #12614e);
  color: #f6e0a6;
  border: 5px solid var(--gold-border);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  user-select: none;
  box-shadow: var(--shadow-md);
  transition: transform 0.08s;
}

.free-tasbih-circle:active {
  transform: scale(0.95);
}

.free-tasbih-num {
  font-size: 3rem;
  font-weight: 700;
  line-height: 1;
}

.free-tasbih-target {
  font-size: 0.85rem;
  opacity: 0.85;
  margin-top: 6px;
}

.preset-row {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 7px;
  margin: 12px 0;
}

/* Toast Notification */
.toast {
  position: fixed;
  bottom: calc(var(--bottom-nav-h) + 14px);
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: #0b4638;
  color: #f6e0a6;
  padding: 9px 18px;
  border-radius: 999px;
  font-size: 0.84rem;
  font-weight: 600;
  z-index: 80;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s, transform 0.2s;
  box-shadow: var(--shadow-md);
}

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

/* Front Matter / About Table */
.meta-table {
  width: 100%;
  border-collapse: collapse;
  background: var(--surface);
  border-radius: var(--radius-sm);
  overflow: hidden;
  border: 1px solid var(--border);
  margin: 12px 0;
}

.meta-table td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  font-size: 0.9rem;
  vertical-align: top;
}

.meta-table td:first-child {
  font-weight: 700;
  color: var(--primary);
  width: 36%;
  background: var(--surface-tint);
}

/* Desktop Breakpoint */
@media (min-width: 960px) {
  .sidebar { display: flex; }
  .main-wrap {
    margin-left: var(--sidebar-w);
    padding-bottom: 32px;
  }
  .bottom-nav { display: none; }
  .header-logo-mini { display: none; }
  .quick-grid { grid-template-columns: repeat(3, 1fr); }
  .modal-backdrop { align-items: center; padding: 24px; }
  .modal-sheet { border-radius: 20px; max-height: 82vh; }
  .toast { bottom: 24px; }
}


/* ---------- Mobile-First Global Button & Touch Polish ---------- */
button {
  touch-action: manipulation;
}

.hero-pill-btn,
.xref-pill,
.variant-pill,
.btn-install,
.btn-tajweed-mini,
.count-badge,
.streak-chip,
.chapter-row-page {
  white-space: nowrap;
}

.xref-pill {
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
}

.pager-btn {
  min-width: 0;
}

.pager-btn strong {
  display: block;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.theme-pill {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  padding: 10px 6px;
}

@media (max-width: 480px) {
  .content-container {
    padding: 12px 11px 28px;
  }
  .dua-card {
    padding: 13px 13px;
  }
  .arabic-box {
    padding: 12px 13px;
  }
  .chapter-banner {
    padding: 14px 14px;
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
  }
  .btn-tajweed-mini {
    align-self: flex-start;
  }
  .section-heading {
    gap: 8px;
    flex-wrap: wrap;
  }
  .hero-card {
    padding: 16px 14px;
  }
  .hero-pill-btn {
    padding: 8px 11px;
    font-size: 0.8rem;
  }
  .theme-pill {
    font-size: 0.78rem;
  }
  .tasbih-tap-btn {
    padding: 8px 10px;
    font-size: 0.84rem;
  }
  .tasbih-reset-btn {
    padding: 8px 11px;
    font-size: 0.78rem;
  }
  .checklist-summary {
    padding: 13px;
  }
  .setting-row {
    gap: 10px;
  }
  .range-slider {
    width: 120px;
  }
}


/* ---------- Sign In / Account Profile & 7-Day Stats UI ---------- */
.account-avatar-btn {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  border: 1.5px solid var(--border);
  background: var(--surface-alt);
  color: var(--primary);
  font-family: inherit;
  font-weight: 700;
  font-size: 0.84rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  transition: border-color 0.15s, background 0.15s;
}

.account-avatar-btn.signed-in {
  background: var(--primary);
  border-color: var(--gold-border);
  color: #f6e0a6;
}

.auth-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  background: var(--surface-alt);
  padding: 5px;
  border-radius: 12px;
  border: 1px solid var(--border);
  margin-bottom: 16px;
}

.auth-tab {
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-family: inherit;
  font-weight: 700;
  font-size: 0.9rem;
  padding: 9px 10px;
  border-radius: 9px;
  cursor: pointer;
  white-space: nowrap;
}

.auth-tab.active {
  background: var(--primary);
  color: #ffffff;
}

.auth-field {
  margin-bottom: 12px;
}

.auth-field label {
  display: block;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 5px;
}

.auth-input-wrap {
  position: relative;
  display: flex;
  align-items: center;
}

.auth-input {
  width: 100%;
  padding: 11px 13px;
  border-radius: 10px;
  border: 1.5px solid var(--border-strong);
  background: var(--surface);
  color: var(--text);
  font-family: inherit;
  font-size: 0.94rem;
  outline: none;
}

.auth-input:focus {
  border-color: var(--primary);
}

.auth-eye-btn {
  position: absolute;
  right: 8px;
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 6px;
  font-size: 0.85rem;
}

.auth-error {
  background: rgba(198, 26, 26, 0.1);
  border: 1px solid rgba(198, 26, 26, 0.35);
  color: var(--tj-qalqalah);
  border-radius: 9px;
  padding: 9px 12px;
  font-size: 0.84rem;
  margin-bottom: 12px;
  display: none;
}

.auth-error.show { display: block; }

.auth-submit-btn {
  width: 100%;
  min-height: 46px;
  background: var(--primary);
  color: #ffffff;
  border: none;
  border-radius: 12px;
  font-family: inherit;
  font-size: 0.95rem;
  font-weight: 700;
  cursor: pointer;
  margin-top: 4px;
}

.auth-submit-btn:hover {
  background: var(--primary-hover);
}

.auth-divider {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 14px 0;
  color: var(--text-muted);
  font-size: 0.8rem;
}

.auth-divider::before,
.auth-divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--border);
}

.auth-google-btn {
  width: 100%;
  min-height: 44px;
  background: var(--surface);
  color: var(--text);
  border: 1.5px solid var(--border-strong);
  border-radius: 12px;
  font-family: inherit;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
}

.auth-guest-btn {
  width: 100%;
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-family: inherit;
  font-size: 0.84rem;
  font-weight: 600;
  padding: 10px;
  margin-top: 6px;
  cursor: pointer;
  text-decoration: underline;
}

.profile-header-card {
  background: linear-gradient(145deg, #0b4638, #12614e);
  color: #ffffff;
  border-radius: 14px;
  padding: 16px;
  display: flex;
  align-items: center;
  gap: 13px;
  margin-bottom: 14px;
  border: 1px solid rgba(232, 198, 122, 0.4);
}

.profile-avatar-lg {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: #f6e0a6;
  color: #0b3b2f;
  font-size: 1.25rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.sync-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: rgba(246, 224, 166, 0.18);
  color: #f6e0a6;
  border: 1px solid rgba(246, 224, 166, 0.4);
  border-radius: 999px;
  padding: 2px 9px;
  font-size: 0.72rem;
  font-weight: 600;
  margin-top: 4px;
}

.stats-grid-4 {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 9px;
  margin-bottom: 14px;
}

.stat-mini-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 11px 12px;
  text-align: center;
}

.stat-mini-val {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--primary);
  line-height: 1.2;
}

.stat-mini-lbl {
  font-size: 0.76rem;
  color: var(--text-muted);
  margin-top: 3px;
}

.week-chart-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 13px 14px;
  margin-bottom: 14px;
}

.week-bars {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 6px;
  align-items: end;
  height: 86px;
  margin-top: 10px;
}

.week-bar-col {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  height: 100%;
  justify-content: flex-end;
}

.week-bar-track {
  width: 100%;
  max-width: 24px;
  height: 56px;
  background: var(--surface-alt);
  border-radius: 6px;
  overflow: hidden;
  display: flex;
  align-items: flex-end;
}

.week-bar-fill {
  width: 100%;
  background: var(--primary);
  border-radius: 6px 6px 0 0;
  transition: height 0.25s ease;
}

.week-bar-day {
  font-size: 0.68rem;
  color: var(--text-muted);
  white-space: nowrap;
}

.profile-actions-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 10px;
}

.btn-outline-action {
  min-height: 42px;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  color: var(--text);
  border-radius: 10px;
  padding: 8px 10px;
  font-family: inherit;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
}

.btn-danger-outline {
  width: 100%;
  min-height: 42px;
  background: rgba(198, 26, 26, 0.08);
  border: 1px solid rgba(198, 26, 26, 0.35);
  color: var(--tj-qalqalah);
  border-radius: 10px;
  padding: 8px 12px;
  font-family: inherit;
  font-size: 0.86rem;
  font-weight: 700;
  cursor: pointer;
}
