/* ==========================================================================
   TALEEM-UL-ISLAM (تعلیم الاسلام) — NEXT-GEN FLAGSHIP DESIGN SYSTEM v1.0.0
   Layered Atmospheric Sanctuary • 6 Heritage Themes • Strict Script Segregation
   AlQuran Neo v5x1 (Hanafi Madd U+06E4) + Noto Nastaliq / Jameel Noori Urdu
   ========================================================================== */

@font-face {
  font-family: 'AlQuran Neo v5x1';
  src: url('fonts/AlQuranNeo5x3.woff2') format('woff2'),
       url('fonts/AlQuranNeov5x1.woff2') format('woff2');
  font-weight: normal;
  font-style: normal;
  font-display: swap;
  ascent-override: 132%;
  descent-override: 56%;
  line-gap-override: 0%;
}

@font-face {
  font-family: 'Noto Nastaliq Urdu';
  src: url('fonts/NotoNastaliqUrdu-Regular.woff2') format('woff2');
  font-weight: normal;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'Jameel Noori Nastaleeq';
  src: url('fonts/JameelNooriNastaleeq.woff2') format('woff2');
  font-weight: normal;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'Material Symbols Rounded';
  src: url('fonts/MaterialSymbolsRounded.woff2') format('woff2');
  font-weight: normal;
  font-style: normal;
  font-display: swap;
}

.msr {
  font-family: 'Material Symbols Rounded', sans-serif;
  font-weight: normal;
  font-style: normal;
  font-size: 22px;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  white-space: nowrap;
  direction: ltr;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  user-select: none;
  flex-shrink: 0;
}
.msr-sm { font-size: 18px; }
.msr-xs { font-size: 15px; }
.msr-lg { font-size: 28px; }

/* ==========================================================================
   DESIGN TOKENS & 6 SIGNATURE HERITAGE THEMES
   ========================================================================== */
:root {
  --ar-fs: 27px;
  --ur-fs: 16.5px;
  --ur-lh: 2.32;
  --en-fs: 14px;
  --ur-font: 'Noto Nastaliq Urdu', serif;

  --radius-xl: 22px;
  --radius-lg: 18px;
  --radius-md: 14px;
  --radius-sm: 10px;
  --header-h: 62px;
  --nav-h: 64px;

  --ease: cubic-bezier(0.22, 1, 0.36, 1);

  --ok: #22c55e;
  --ok-bg: rgba(34, 197, 94, 0.13);
  --ok-border: rgba(34, 197, 94, 0.36);
  --err: #f43f5e;
  --err-bg: rgba(244, 63, 94, 0.13);
  --err-border: rgba(244, 63, 94, 0.38);
  --warn: #f59e0b;
  --warn-bg: rgba(245, 158, 11, 0.13);
  --q-accent: #fb7185;
  --q-bg: rgba(251, 113, 133, 0.13);
  --q-border: rgba(251, 113, 133, 0.35);
  --a-accent: #34d399;
  --a-bg: rgba(52, 211, 153, 0.12);
  --a-border: rgba(52, 211, 153, 0.34);

  /* Part Heritage Accent Colors */
  --p1: #10b981; --p1-rgb: 16, 185, 129;
  --p2: #38bdf8; --p2-rgb: 56, 189, 248;
  --p3: #f59e0b; --p3-rgb: 245, 158, 11;
  --p4: #c084fc; --p4-rgb: 192, 132, 252;
}

html[data-ur-font="jameel"] {
  --ur-font: 'Jameel Noori Nastaleeq', 'Noto Nastaliq Urdu', serif;
  --ur-lh: 2.02;
}

html { color-scheme: dark; }

/* 1. Emerald Sanctuary (Default Flagship Theme) */
html.theme-emerald-sanctuary {
  --bg: #061413;
  --bg-glow: radial-gradient(ellipse 80% 42% at 50% 0%, rgba(228, 184, 91, 0.11), rgba(20, 120, 102, 0.08) 55%, transparent 100%);
  --surface: rgba(10, 29, 27, 0.88);
  --surface-solid: #0b201e;
  --surface-2: #122d2a;
  --card: #0e2422;
  --card-elev: linear-gradient(165deg, #13312e 0%, #0b1f1d 100%);
  --stage: #081a18;
  --border: rgba(228, 184, 91, 0.17);
  --border-subtle: rgba(255, 255, 255, 0.075);
  --specular: inset 0 1px 0 rgba(255, 255, 255, 0.065);
  --shadow: 0 8px 24px rgba(0, 0, 0, 0.32);
  --accent: #e4b85b;
  --accent-2: #2dd4bf;
  --accent-hover: #f0ca78;
  --accent-rgb: 228, 184, 91;
  --accent-text: #061413;
  --text: #f3f7f5;
  --muted: #93b3ac;
  --arabic: #fffcf0;
  --urdu: #f0ebe0;
  --english: #cbdcd7;
}

/* 2. Madinah Parchment (Warm Archival Scholar Mode — Light) */
html.theme-madinah-parchment {
  color-scheme: light;
  --bg: #f8f2e4;
  --bg-glow: radial-gradient(ellipse 85% 40% at 50% 0%, rgba(16, 102, 74, 0.08), rgba(180, 134, 42, 0.06) 55%, transparent 100%);
  --surface: rgba(255, 252, 245, 0.90);
  --surface-solid: #fffcf5;
  --surface-2: #f1e8d6;
  --card: #fffdf8;
  --card-elev: linear-gradient(165deg, #ffffff 0%, #fbf5e8 100%);
  --stage: #f6eedc;
  --border: rgba(133, 98, 28, 0.20);
  --border-subtle: rgba(44, 34, 26, 0.09);
  --specular: inset 0 1px 0 rgba(255, 255, 255, 0.9);
  --shadow: 0 6px 20px rgba(74, 52, 16, 0.07);
  --accent: #0f5c47;
  --accent-2: #9b6d16;
  --accent-hover: #0a4938;
  --accent-rgb: 15, 92, 71;
  --accent-text: #ffffff;
  --text: #1f1916;
  --muted: #65594c;
  --arabic: #14110f;
  --urdu: #221c18;
  --english: #3e362f;
  --q-accent: #9f1239;
  --q-bg: rgba(159, 18, 57, 0.08);
  --q-border: rgba(159, 18, 57, 0.24);
  --a-accent: #0f5c47;
  --a-bg: rgba(15, 92, 71, 0.08);
  --a-border: rgba(15, 92, 71, 0.24);
  --ok: #15803d;
  --err: #be123c;
  --p1: #0d7a56; --p2: #0369a1; --p3: #b45309; --p4: #7e22ce;
}

/* 3. Dark Luxury (DEEN Obsidian & Gold) */
html.theme-dark-luxury {
  --bg: #09090c;
  --bg-glow: radial-gradient(ellipse 80% 42% at 50% 0%, rgba(220, 165, 76, 0.11), transparent 100%);
  --surface: rgba(20, 20, 24, 0.88);
  --surface-solid: #141418;
  --surface-2: #1d1d23;
  --card: #16161b;
  --card-elev: linear-gradient(165deg, #1d1d24 0%, #131318 100%);
  --stage: #101014;
  --border: rgba(220, 165, 76, 0.18);
  --border-subtle: rgba(255, 255, 255, 0.075);
  --specular: inset 0 1px 0 rgba(255, 255, 255, 0.06);
  --shadow: 0 8px 24px rgba(0, 0, 0, 0.36);
  --accent: #dca54c;
  --accent-2: #34d399;
  --accent-hover: #ebb966;
  --accent-rgb: 220, 165, 76;
  --accent-text: #09090c;
  --text: #f4f4f6;
  --muted: #a1a1aa;
  --arabic: #fffdf5;
  --urdu: #f1ebd8;
  --english: #d4d4d8;
}

/* 4. Royal Indigo Night (Andalusian Dusk) */
html.theme-royal-night {
  --bg: #080d1a;
  --bg-glow: radial-gradient(ellipse 80% 45% at 50% 0%, rgba(99, 134, 245, 0.14), rgba(230, 192, 104, 0.07) 55%, transparent 100%);
  --surface: rgba(15, 23, 42, 0.88);
  --surface-solid: #0f172a;
  --surface-2: #182542;
  --card: #111c34;
  --card-elev: linear-gradient(165deg, #172546 0%, #0f182e 100%);
  --stage: #0c1428;
  --border: rgba(230, 192, 104, 0.18);
  --border-subtle: rgba(148, 163, 184, 0.12);
  --specular: inset 0 1px 0 rgba(255, 255, 255, 0.07);
  --shadow: 0 8px 24px rgba(2, 6, 23, 0.42);
  --accent: #e6c068;
  --accent-2: #60a5fa;
  --accent-hover: #f3d284;
  --accent-rgb: 230, 192, 104;
  --accent-text: #080d1a;
  --text: #f1f5f9;
  --muted: #94a3b8;
  --arabic: #fffdf5;
  --urdu: #e8edf5;
  --english: #cbd5e1;
}

/* 5. Classic Light (Crisp Alabaster & Deep Teal) */
html.theme-classic-light {
  color-scheme: light;
  --bg: #f3f6f9;
  --bg-glow: radial-gradient(ellipse 80% 38% at 50% 0%, rgba(15, 118, 110, 0.08), transparent 100%);
  --surface: rgba(255, 255, 255, 0.90);
  --surface-solid: #ffffff;
  --surface-2: #edf2f6;
  --card: #ffffff;
  --card-elev: linear-gradient(165deg, #ffffff 0%, #f8fafc 100%);
  --stage: #f1f5f9;
  --border: rgba(15, 118, 110, 0.18);
  --border-subtle: rgba(15, 23, 42, 0.08);
  --specular: inset 0 1px 0 rgba(255, 255, 255, 0.95);
  --shadow: 0 6px 18px rgba(15, 23, 42, 0.06);
  --accent: #0f766e;
  --accent-2: #b45309;
  --accent-hover: #0d5f59;
  --accent-rgb: 15, 118, 110;
  --accent-text: #ffffff;
  --text: #0f172a;
  --muted: #475569;
  --arabic: #0f172a;
  --urdu: #1e293b;
  --english: #334155;
  --q-accent: #be123c;
  --q-bg: rgba(190, 18, 60, 0.075);
  --q-border: rgba(190, 18, 60, 0.24);
  --a-accent: #0f766e;
  --a-bg: rgba(15, 118, 110, 0.075);
  --a-border: rgba(15, 118, 110, 0.24);
  --ok: #15803d;
  --err: #be123c;
  --p1: #0f766e; --p2: #0284c7; --p3: #d97706; --p4: #7c3aed;
}

/* 6. OLED Midnight (Pure True Black) */
html.theme-oled-black {
  --bg: #000000;
  --bg-glow: radial-gradient(ellipse 70% 34% at 50% 0%, rgba(228, 184, 91, 0.09), transparent 100%);
  --surface: rgba(8, 8, 10, 0.92);
  --surface-solid: #0a0a0c;
  --surface-2: #141418;
  --card: #0c0c0f;
  --card-elev: linear-gradient(165deg, #131317 0%, #08080a 100%);
  --stage: #060608;
  --border: rgba(228, 184, 91, 0.20);
  --border-subtle: rgba(255, 255, 255, 0.09);
  --specular: inset 0 1px 0 rgba(255, 255, 255, 0.055);
  --shadow: 0 8px 24px rgba(0, 0, 0, 0.65);
  --accent: #e4b85b;
  --accent-2: #2dd4bf;
  --accent-hover: #f2cb79;
  --accent-rgb: 228, 184, 91;
  --accent-text: #000000;
  --text: #fafafa;
  --muted: #a1a1aa;
  --arabic: #ffffff;
  --urdu: #f4f4f5;
  --english: #d4d4d8;
}

/* ==========================================================================
   BASE RESET & STRICT SCRIPT SEGREGATION
   ========================================================================== */
*, *::before, *::after { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
  margin: 0;
  padding: 0;
  width: 100%;
  max-width: 100%;
  overflow-x: clip;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

button, input, select { font-family: inherit; }

/* STRICT ARABIC EXCLUSIVITY — AlQuran Neo v5x1 ONLY */
.ar {
  font-family: 'AlQuran Neo v5x1', serif !important;
  direction: rtl;
  unicode-bidi: isolate;
  color: var(--arabic);
  font-size: var(--ar-fs);
  line-height: 2.24;
  letter-spacing: 0 !important;
  word-spacing: 3.5px;
  font-feature-settings: "liga" 1, "mark" 1, "mkmk" 1;
  font-weight: normal !important;
}
.ar-sm { font-size: calc(var(--ar-fs) * 0.80); line-height: 2.02; }
.ar-lg { font-size: calc(var(--ar-fs) * 1.18); line-height: 2.28; }
.ar-inline {
  font-family: 'AlQuran Neo v5x1', serif !important;
  direction: rtl;
  unicode-bidi: isolate;
  color: var(--arabic);
  font-size: 1.24em;
  line-height: 1.9;
  padding: 0 3px;
  font-weight: normal !important;
  display: inline;
}

/* STRICT URDU EXCLUSIVITY — Selectable Noto Nastaliq / Jameel Noori */
.ur {
  font-family: var(--ur-font) !important;
  direction: rtl;
  unicode-bidi: isolate;
  color: var(--urdu);
  font-size: var(--ur-fs);
  line-height: var(--ur-lh);
  font-weight: normal !important;
}
.ur-sm { font-size: calc(var(--ur-fs) * 0.86); line-height: calc(var(--ur-lh) - 0.12); }
.ur-lg { font-size: calc(var(--ur-fs) * 1.16); line-height: var(--ur-lh); }

.en {
  color: var(--english);
  font-size: var(--en-fs);
  line-height: 1.58;
  direction: ltr;
  unicode-bidi: isolate;
}
.muted { color: var(--muted); }
.muted-sm { color: var(--muted); font-size: 12.5px; }

/* Language display mode toggles */
html[data-lang-mode="ur"] .en-block { display: none !important; }
html[data-lang-mode="en"] .ur-block { display: none !important; }

/* ==========================================================================
   APP SHELL, AMBIENT GLOW, GLASS HEADER & SCULPTED BOTTOM NAV
   ========================================================================== */
.ti-shell {
  position: relative;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  width: 100%;
  max-width: 100%;
  overflow-x: clip;
}

.ti-ambient-glow {
  position: fixed;
  inset: 0 0 auto 0;
  height: 360px;
  background: var(--bg-glow);
  pointer-events: none;
  z-index: 0;
}

.ti-header {
  position: sticky;
  top: 0;
  z-index: 50;
  height: calc(var(--header-h) + env(safe-area-inset-top, 0px));
  padding: env(safe-area-inset-top, 0px) 14px 0;
  background: var(--surface);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

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

.ti-brand {
  appearance: none;
  border: none;
  background: transparent;
  padding: 0;
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  cursor: pointer;
  text-align: left;
  color: var(--text);
}

.ti-logo-img {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  border: 1px solid var(--border);
  flex-shrink: 0;
  object-fit: cover;
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.25);
}

.ti-brand-copy {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.ti-brand-title {
  font-size: 14.5px;
  font-weight: 800;
  letter-spacing: -0.2px;
  line-height: 1.2;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.ur-inline {
  font-family: var(--ur-font) !important;
  direction: rtl;
  unicode-bidi: isolate;
  font-weight: normal !important;
  line-height: 1.75;
}
.ti-brand-sub {
  font-size: 11px !important;
  line-height: 2.05 !important;
  color: var(--accent) !important;
  white-space: nowrap;
  margin-top: -1px;
}
input[type="search"]::-webkit-search-cancel-button {
  -webkit-appearance: none;
  appearance: none;
}

.ti-header-ctx {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  flex: 1;
}
.ti-header-ctx-copy {
  display: flex;
  flex-direction: column;
  min-width: 0;
}
.ti-header-ctx-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.25;
}
.ti-header-ctx-sub {
  font-size: 11px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

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

.ti-icon-btn {
  width: 38px;
  height: 38px;
  border-radius: 11px;
  border: 1px solid var(--border-subtle);
  background: var(--surface-2);
  color: var(--text);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  transition: transform 0.14s var(--ease), border-color 0.16s, color 0.16s, background 0.16s;
}
.ti-icon-btn:active { transform: scale(0.94); }
.ti-icon-btn:hover { border-color: var(--accent); color: var(--accent); }
.ti-icon-btn.active {
  background: rgba(var(--accent-rgb), 0.16);
  border-color: var(--accent);
  color: var(--accent);
}

.ti-scroll-progress {
  position: absolute;
  left: 0;
  bottom: 0;
  height: 2.5px;
  width: 0%;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  transition: width 0.08s linear;
  pointer-events: none;
}

/* Main Viewport */
.ti-main {
  position: relative;
  z-index: 1;
  flex: 1;
  width: 100%;
  max-width: 820px;
  margin: 0 auto;
  padding: 14px 14px calc(var(--nav-h) + env(safe-area-inset-bottom, 0px) + 26px);
}

.ti-boot-loader {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 84px 16px;
  gap: 12px;
  text-align: center;
}
.ti-boot-ar { color: var(--accent); font-size: 26px; }
.ti-spinner {
  width: 34px;
  height: 34px;
  border: 3px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: tiSpin 0.8s linear infinite;
}
@keyframes tiSpin { to { transform: rotate(360deg); } }

/* Sculpted Material-3 Glass Bottom Navigation (Zero Nastaliq Cramping!) */
.ti-bottom-nav {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 60;
  height: calc(var(--nav-h) + env(safe-area-inset-bottom, 0px));
  padding: 6px 8px calc(env(safe-area-inset-bottom, 0px) + 6px);
  background: var(--surface);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  border-top: 1px solid var(--border-subtle);
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  align-items: center;
  gap: 2px;
}

.ti-nav-tab {
  appearance: none;
  border: none;
  background: transparent;
  color: var(--muted);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  padding: 2px;
  cursor: pointer;
  min-width: 0;
  transition: color 0.16s var(--ease);
}

.ti-nav-pill {
  width: 48px;
  height: 30px;
  border-radius: 99px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s var(--ease), transform 0.18s var(--ease), color 0.16s;
}
.ti-nav-pill .msr { font-size: 22px; }

.ti-nav-lbl {
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.15px;
  line-height: 1.1;
}

.ti-nav-tab.active {
  color: var(--accent);
}
.ti-nav-tab.active .ti-nav-pill {
  background: rgba(var(--accent-rgb), 0.18);
  color: var(--accent);
  box-shadow: inset 0 0 0 1px rgba(var(--accent-rgb), 0.28);
}
.ti-nav-tab:active .ti-nav-pill { transform: scale(0.92); }

/* ==========================================================================
   COMMON ELEVATED CARDS, PILLS, BUTTONS & PROGRESS
   ========================================================================== */
.ti-card {
  background: var(--card-elev);
  border: 1px solid var(--border-subtle);
  box-shadow: var(--shadow), var(--specular);
  border-radius: var(--radius-lg);
  padding: 16px;
  margin-bottom: 12px;
}
.ti-card-accent {
  border-color: var(--border);
}

.ti-btn {
  appearance: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border-radius: 11px;
  border: 1px solid var(--border-subtle);
  background: var(--surface-2);
  color: var(--text);
  padding: 9px 14px;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  min-height: 40px;
  transition: transform 0.12s var(--ease), border-color 0.16s, background 0.16s, color 0.16s;
}
.ti-btn:active { transform: scale(0.97); }
.ti-btn:hover { border-color: var(--accent); }
.ti-btn-primary {
  background: var(--accent);
  color: var(--accent-text);
  border-color: var(--accent);
  box-shadow: 0 4px 14px rgba(var(--accent-rgb), 0.28);
}
.ti-btn-primary:hover { background: var(--accent-hover); }
.ti-btn-ghost {
  background: transparent;
  border-color: var(--border-subtle);
  color: var(--muted);
}
.ti-btn-ghost:hover { color: var(--text); border-color: var(--border); }
.ti-btn-ok { background: var(--ok-bg); color: var(--ok); border-color: var(--ok-border); }
.ti-btn-err { background: var(--err-bg); color: var(--err); border-color: var(--err-border); }
.ti-btn-warn { background: var(--warn-bg); color: var(--warn); border-color: rgba(245, 158, 11, 0.36); }
.ti-btn-sm { padding: 6px 11px; font-size: 12px; min-height: 33px; border-radius: 9px; }
.ti-btn-xs { padding: 4px 9px; font-size: 11.5px; min-height: 28px; border-radius: 8px; }
.ti-btn-block { width: 100%; }

.ti-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 9px;
  border-radius: 99px;
  font-size: 11px;
  font-weight: 700;
  background: rgba(var(--accent-rgb), 0.14);
  color: var(--accent);
  border: 1px solid rgba(var(--accent-rgb), 0.24);
  white-space: nowrap;
}
.ti-pill-muted {
  background: var(--surface-2);
  color: var(--muted);
  border-color: var(--border-subtle);
}
.ti-pill-ok { background: var(--ok-bg); color: var(--ok); border-color: var(--ok-border); }
.ti-pill-q { background: var(--q-bg); color: var(--q-accent); border-color: var(--q-border); }
.ti-pill-a { background: var(--a-bg); color: var(--a-accent); border-color: var(--a-border); }

.ti-section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  margin: 18px 2px 10px;
}
.ti-section-head h3 {
  margin: 0;
  font-size: 13.5px;
  font-weight: 800;
  letter-spacing: 0.3px;
  text-transform: uppercase;
  color: var(--accent);
  display: flex;
  align-items: center;
  gap: 6px;
}
.ti-section-sub {
  font-size: 11.5px;
  color: var(--muted);
}

.ti-progress-bar {
  width: 100%;
  height: 6px;
  border-radius: 99px;
  background: var(--surface-2);
  overflow: hidden;
}
.ti-progress-fill {
  height: 100%;
  border-radius: 99px;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  transition: width 0.35s var(--ease);
}

/* Scrollable Filter Rail with Right Fade Mask */
.ti-chip-rail {
  display: flex;
  gap: 7px;
  overflow-x: auto;
  padding: 2px 2px 6px;
  margin-bottom: 10px;
  scrollbar-width: none;
  -webkit-mask-image: linear-gradient(to right, #000 90%, transparent 100%);
  mask-image: linear-gradient(to right, #000 90%, transparent 100%);
}
.ti-chip-rail::-webkit-scrollbar { display: none; }

.ti-chip {
  flex-shrink: 0;
  border: 1px solid var(--border-subtle);
  background: var(--card);
  color: var(--muted);
  border-radius: 99px;
  padding: 6px 13px;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  white-space: nowrap;
  transition: all 0.16s var(--ease);
}
.ti-chip:hover { border-color: var(--accent); color: var(--text); }
.ti-chip.active {
  background: var(--accent);
  color: var(--accent-text);
  border-color: var(--accent);
  box-shadow: 0 3px 10px rgba(var(--accent-rgb), 0.25);
}

/* ==========================================================================
   HOME DASHBOARD: COMPACT RESUME HERO + 4-PART HERITAGE SHOWCASE
   ========================================================================== */
.ti-resume-hero {
  position: relative;
  overflow: hidden;
  border-radius: var(--radius-xl);
  padding: 16px;
  margin-bottom: 14px;
  background: linear-gradient(145deg, rgba(var(--accent-rgb), 0.16) 0%, var(--card) 56%, var(--surface-solid) 100%);
  border: 1px solid var(--border);
  box-shadow: var(--shadow), var(--specular);
}
.ti-resume-hero::after {
  content: '';
  position: absolute;
  top: -36px;
  right: -36px;
  width: 150px;
  height: 150px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(var(--accent-rgb), 0.18), transparent 70%);
  pointer-events: none;
}

.ti-resume-top {
  display: flex;
  align-items: center;
  gap: 14px;
  position: relative;
  z-index: 1;
}

.ti-ring-wrap {
  position: relative;
  width: 58px;
  height: 58px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}
.ti-ring-svg { width: 58px; height: 58px; transform: rotate(-90deg); }
.ti-ring-bg { fill: none; stroke: var(--surface-2); stroke-width: 5; }
.ti-ring-fg { fill: none; stroke: var(--accent); stroke-width: 5; stroke-linecap: round; transition: stroke-dashoffset 0.5s var(--ease); }
.ti-ring-pct {
  position: absolute;
  font-size: 12.5px;
  font-weight: 800;
  color: var(--text);
}

.ti-resume-meta {
  flex: 1;
  min-width: 0;
}
.ti-resume-eyebrow {
  font-size: 10.5px;
  font-weight: 800;
  letter-spacing: 0.7px;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 2px;
}
.ti-resume-title {
  font-size: 15.5px;
  font-weight: 800;
  color: var(--text);
  line-height: 1.25;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.ti-resume-sub {
  font-size: 12px;
  color: var(--muted);
  margin-top: 2px;
}

.ti-resume-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: 13px;
  padding-top: 11px;
  border-top: 1px solid var(--border-subtle);
  position: relative;
  z-index: 1;
}

.ti-mini-metrics {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 12px;
  font-weight: 700;
  color: var(--muted);
}
.ti-mini-metric {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.ti-mini-metric strong { color: var(--text); }
.ti-mini-metric .msr { font-size: 16px; color: var(--accent); }

/* 4-Part Heritage Curriculum Grid (Immediately Visible Above The Fold!) */
.ti-parts-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 14px;
}

.ti-part-card {
  position: relative;
  overflow: hidden;
  border-radius: var(--radius-lg);
  padding: 14px 13px 13px;
  background: var(--card-elev);
  border: 1px solid var(--border-subtle);
  box-shadow: var(--shadow), var(--specular);
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 6px;
  text-align: left;
  color: var(--text);
  transition: transform 0.16s var(--ease), border-color 0.2s;
}
.ti-part-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: var(--part-color, var(--accent));
}
.ti-part-card:active { transform: scale(0.975); }
.ti-part-card:hover { border-color: var(--part-color, var(--accent)); }

.ti-part-card[data-part="1"] { --part-color: var(--p1); }
.ti-part-card[data-part="2"] { --part-color: var(--p2); }
.ti-part-card[data-part="3"] { --part-color: var(--p3); }
.ti-part-card[data-part="4"] { --part-color: var(--p4); }

.ti-part-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
}
.ti-part-badge {
  font-size: 10.5px;
  font-weight: 800;
  letter-spacing: 0.4px;
  text-transform: uppercase;
  color: var(--part-color);
  background: color-mix(in srgb, var(--part-color) 14%, transparent);
  border: 1px solid color-mix(in srgb, var(--part-color) 32%, transparent);
  padding: 2px 8px;
  border-radius: 99px;
}
.ti-part-pct {
  font-size: 11px;
  font-weight: 800;
  color: var(--muted);
}

.ti-part-ur {
  text-align: right;
  font-size: 18px !important;
  line-height: 1.95 !important;
  color: var(--text) !important;
  margin-top: 2px;
}
.ti-part-en {
  font-size: 12px;
  font-weight: 700;
  color: var(--muted);
  line-height: 1.3;
  min-height: 31px;
}
.ti-part-stats {
  font-size: 11px;
  color: var(--muted);
  display: flex;
  justify-content: space-between;
  margin-top: auto;
}
.ti-part-card .ti-progress-fill {
  background: var(--part-color);
}

/* Quick Access Pillars Strip (2x2 Balanced Grid — Zero Orphan Holes) */
.ti-quick-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 9px;
  margin-bottom: 14px;
}
.ti-quick-tile {
  background: var(--card);
  border: 1px solid var(--border-subtle);
  box-shadow: var(--specular);
  border-radius: var(--radius-md);
  padding: 11px 12px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 10px;
  text-align: left;
  color: var(--text);
  transition: transform 0.14s var(--ease), border-color 0.16s;
}
.ti-quick-tile:active { transform: scale(0.975); }
.ti-quick-tile:hover { border-color: var(--accent); }
.ti-quick-ico {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: rgba(var(--accent-rgb), 0.14);
  color: var(--accent);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.ti-quick-copy { min-width: 0; }
.ti-quick-title { font-size: 12.5px; font-weight: 800; color: var(--text); line-height: 1.25; }
.ti-quick-sub { font-size: 11px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* Daily Pearl Card */
.ti-pearl-card {
  position: relative;
  border-radius: var(--radius-lg);
  padding: 15px;
  margin-bottom: 14px;
  background: linear-gradient(155deg, var(--card) 0%, var(--stage) 100%);
  border: 1px solid var(--border);
  box-shadow: var(--shadow), var(--specular);
}
.ti-pearl-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 8px;
}
.ti-pearl-tag {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.45px;
  text-transform: uppercase;
  color: var(--accent);
}
.ti-pearl-q {
  text-align: right;
  color: var(--q-accent) !important;
  margin-bottom: 6px;
}
.ti-pearl-a {
  text-align: right;
  margin-bottom: 8px;
}
.ti-pearl-en {
  font-size: 12.5px;
  color: var(--muted);
  border-top: 1px dashed var(--border-subtle);
  padding-top: 8px;
  margin-bottom: 10px;
}

/* ==========================================================================
   PART VIEW: BRANCH TABS & CHAPTER LIST
   ========================================================================== */
.ti-part-banner {
  border-radius: var(--radius-xl);
  padding: 16px;
  margin-bottom: 12px;
  background: linear-gradient(145deg, color-mix(in srgb, var(--part-color, var(--accent)) 18%, var(--card)), var(--card));
  border: 1px solid color-mix(in srgb, var(--part-color, var(--accent)) 35%, transparent);
  box-shadow: var(--shadow), var(--specular);
}
.ti-part-banner-ur { text-align: right; font-size: 22px !important; line-height: 1.9 !important; color: var(--text) !important; }
.ti-part-banner-en { font-size: 14px; font-weight: 800; color: var(--part-color, var(--accent)); margin-top: 2px; }
.ti-part-banner-desc { font-size: 12.5px; color: var(--muted); margin-top: 4px; }

.ti-chapter-list {
  display: flex;
  flex-direction: column;
  gap: 9px;
}
.ti-chapter-card {
  background: var(--card-elev);
  border: 1px solid var(--border-subtle);
  box-shadow: var(--specular);
  border-radius: var(--radius-md);
  padding: 13px 14px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 12px;
  text-align: left;
  color: var(--text);
  transition: transform 0.14s var(--ease), border-color 0.16s;
}
.ti-chapter-card:active { transform: scale(0.985); }
.ti-chapter-card:hover { border-color: var(--accent); }
.ti-chapter-card.done { border-color: var(--ok-border); }

.ti-ch-num {
  width: 38px;
  height: 38px;
  border-radius: 12px;
  background: rgba(var(--accent-rgb), 0.13);
  border: 1px solid rgba(var(--accent-rgb), 0.25);
  color: var(--accent);
  font-size: 13.5px;
  font-weight: 800;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.ti-chapter-card.done .ti-ch-num {
  background: var(--ok-bg);
  border-color: var(--ok-border);
  color: var(--ok);
}

.ti-ch-body { flex: 1; min-width: 0; }
.ti-ch-ur {
  text-align: right;
  font-size: 16.5px !important;
  line-height: 2.0 !important;
  color: var(--text) !important;
}
.ti-ch-en {
  font-size: 12.5px;
  font-weight: 700;
  color: var(--muted);
  margin-top: 1px;
}
.ti-ch-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 5px;
  font-size: 11px;
  color: var(--muted);
}

/* ==========================================================================
   CHAPTER READER STUDIO (MANUSCRIPT HERITAGE + ACTIVE RECALL)
   ========================================================================== */
.ti-segmented {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 4px;
  background: var(--surface-solid);
  border: 1px solid var(--border-subtle);
  border-radius: 13px;
  padding: 4px;
  margin-bottom: 11px;
}
.ti-seg-btn {
  appearance: none;
  border: none;
  background: transparent;
  color: var(--muted);
  border-radius: 9px;
  padding: 8px 6px;
  font-size: 12.5px;
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  transition: all 0.16s var(--ease);
}
.ti-seg-btn.active {
  background: var(--accent);
  color: var(--accent-text);
  box-shadow: 0 2px 8px rgba(var(--accent-rgb), 0.25);
}

.ti-reader-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  flex-wrap: wrap;
  margin-bottom: 12px;
  padding: 8px 10px;
  border-radius: var(--radius-md);
  background: var(--surface-solid);
  border: 1px solid var(--border-subtle);
}
.ti-lang-pills {
  display: inline-flex;
  background: var(--surface-2);
  border-radius: 9px;
  padding: 2px;
  gap: 2px;
}
.ti-lang-pill {
  border: none;
  background: transparent;
  color: var(--muted);
  font-size: 11.5px;
  font-weight: 700;
  padding: 5px 9px;
  border-radius: 7px;
  cursor: pointer;
}
.ti-lang-pill.active {
  background: var(--accent);
  color: var(--accent-text);
}

/* Authentic Q&A Manuscript Card */
.ti-qa-card {
  background: var(--card-elev);
  border: 1px solid var(--border-subtle);
  box-shadow: var(--shadow), var(--specular);
  border-radius: var(--radius-lg);
  padding: 15px;
  margin-bottom: 12px;
  transition: border-color 0.2s;
}
.ti-qa-card.mastered {
  border-color: var(--ok-border);
}
.ti-qa-card.highlight-jump {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(var(--accent-rgb), 0.32), var(--shadow);
}

.ti-qa-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 10px;
}
.ti-qa-badges {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}
.ti-qa-tools {
  display: flex;
  align-items: center;
  gap: 4px;
}
.ti-mini-ico-btn {
  width: 31px;
  height: 31px;
  border-radius: 8px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--muted);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.14s, color 0.14s, border-color 0.14s;
}
.ti-mini-ico-btn:hover { background: var(--surface-2); color: var(--text); }
.ti-mini-ico-btn.saved { color: var(--accent); background: rgba(var(--accent-rgb), 0.14); border-color: rgba(var(--accent-rgb), 0.25); }
.ti-mini-ico-btn.done { color: var(--ok); background: var(--ok-bg); border-color: var(--ok-border); }

/* Question Block (Crimson Medallion Heritage) */
.ti-q-zone {
  padding-bottom: 11px;
  margin-bottom: 11px;
  border-bottom: 1px dashed var(--border-subtle);
}
.ti-q-ur {
  text-align: right;
  color: var(--q-accent) !important;
  font-size: calc(var(--ur-fs) * 1.04) !important;
}
.ti-q-en {
  margin-top: 4px;
  font-size: calc(var(--en-fs) + 0.5px);
  font-weight: 700;
  color: var(--text);
  line-height: 1.48;
}

/* Answer Block (Emerald Sanctuary Bar) */
.ti-a-zone {
  position: relative;
}
.ti-a-ur {
  text-align: right;
  padding-right: 12px;
  border-right: 3px solid var(--a-accent);
}
.ti-a-en {
  margin-top: 9px;
  padding: 9px 11px;
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  color: var(--english);
  font-size: var(--en-fs);
  line-height: 1.62;
}

/* Self-Test Hidden Answer Veil */
.ti-reveal-veil {
  width: 100%;
  border: 1.5px dashed var(--accent);
  background: rgba(var(--accent-rgb), 0.08);
  color: var(--accent);
  border-radius: var(--radius-md);
  padding: 15px 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 800;
  cursor: pointer;
  transition: background 0.15s;
}
.ti-reveal-veil:hover { background: rgba(var(--accent-rgb), 0.14); }

/* Scannable Numbered Points List (① ② ③) */
.ti-points-list {
  margin-top: 10px;
  display: flex;
  flex-direction: column;
  gap: 7px;
}
.ti-point-row {
  display: flex;
  flex-direction: row-reverse;
  align-items: flex-start;
  gap: 10px;
  padding: 9px 11px;
  border-radius: var(--radius-sm);
  background: var(--stage);
  border: 1px solid var(--border-subtle);
}
.ti-point-num {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: rgba(var(--accent-rgb), 0.16);
  color: var(--accent);
  border: 1px solid rgba(var(--accent-rgb), 0.30);
  font-size: 11.5px;
  font-weight: 800;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  margin-top: 4px;
}
.ti-point-text { flex: 1; min-width: 0; }
.ti-point-ur { text-align: right; }
.ti-point-en { font-size: 12.5px; color: var(--muted); margin-top: 3px; text-align: left; }

/* Illuminated Sacred Arabic Reading & Audio Stage */
.ti-ar-stage {
  margin-top: 11px;
  border-radius: var(--radius-md);
  padding: 13px 14px;
  background: var(--stage);
  border: 1px solid var(--border);
  border-right: 4px solid var(--accent);
}
.ti-ar-stage-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 8px;
}
.ti-ar-stage-lbl {
  font-size: 11.5px;
  font-weight: 800;
  color: var(--accent);
  letter-spacing: 0.2px;
}
.ti-ar-stage-text {
  text-align: right;
  cursor: pointer;
  padding: 4px 2px;
  border-radius: 8px;
  transition: background 0.16s;
}
.ti-ar-stage-text:hover { background: rgba(var(--accent-rgb), 0.08); }
.ti-ar-stage.playing {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(var(--accent-rgb), 0.24);
}
.ti-ar-stage-tr-ur {
  text-align: right;
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px dashed var(--border-subtle);
  color: var(--urdu) !important;
}
.ti-ar-stage-tr-en {
  margin-top: 5px;
  font-size: 12.5px;
  color: var(--muted);
  font-style: italic;
}

/* Interlinear Phrase-by-Phrase Breakdown (Duas & Prayers) */
.ti-interlinear-grid {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 10px;
}
.ti-inter-seg {
  background: var(--card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  cursor: pointer;
  transition: border-color 0.15s;
}
.ti-inter-seg:hover, .ti-inter-seg.playing { border-color: var(--accent); }
.ti-inter-ar { text-align: right; font-size: calc(var(--ar-fs) * 0.92) !important; }
.ti-inter-ur { text-align: right; color: var(--muted) !important; font-size: calc(var(--ur-fs) * 0.88) !important; }
.ti-inter-en { font-size: 12px; color: var(--muted); margin-top: 2px; }

/* Scholarly Footnote Callout (حاشیہ) */
.ti-footnote-box {
  margin-top: 11px;
  border-radius: var(--radius-md);
  background: rgba(var(--accent-rgb), 0.07);
  border: 1px solid rgba(var(--accent-rgb), 0.24);
  overflow: hidden;
}
.ti-footnote-box summary {
  list-style: none;
  padding: 9px 12px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 12px;
  font-weight: 800;
  color: var(--accent);
}
.ti-footnote-box summary::-webkit-details-marker { display: none; }
.ti-footnote-body {
  padding: 0 12px 11px;
  border-top: 1px dashed rgba(var(--accent-rgb), 0.20);
}
.ti-footnote-ur { text-align: right; margin-top: 6px; font-size: calc(var(--ur-fs) * 0.86) !important; }
.ti-footnote-en { font-size: 12px; color: var(--muted); margin-top: 5px; }

/* Chapter Footer Nav */
.ti-chapter-nav-footer {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 16px;
}

/* ==========================================================================
   PRACTICE ARENA (BALANCED 2x2 MODE GRID + SRS FLASHCARDS + RULING DRILL)
   ========================================================================== */
.ti-mode-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 9px;
  margin-bottom: 12px;
}
.ti-mode-card {
  background: var(--card-elev);
  border: 1px solid var(--border-subtle);
  box-shadow: var(--specular);
  border-radius: var(--radius-md);
  padding: 12px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 10px;
  text-align: left;
  color: var(--text);
  transition: all 0.16s var(--ease);
}
.ti-mode-card.active {
  background: rgba(var(--accent-rgb), 0.15);
  border-color: var(--accent);
  box-shadow: 0 0 0 1px rgba(var(--accent-rgb), 0.25);
}
.ti-mode-card .msr {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: var(--surface-2);
  color: var(--accent);
}
.ti-mode-card.active .msr {
  background: var(--accent);
  color: var(--accent-text);
}
.ti-mode-title { font-size: 13px; font-weight: 800; line-height: 1.2; }
.ti-mode-sub { font-size: 11px; color: var(--muted); margin-top: 2px; }

/* SRS Flashcard */
.ti-srs-card {
  background: linear-gradient(155deg, var(--card) 0%, var(--stage) 100%);
  border: 1.5px solid var(--border);
  box-shadow: var(--shadow), var(--specular);
  border-radius: var(--radius-xl);
  padding: 20px 16px;
  min-height: 260px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 14px;
  cursor: pointer;
  margin-bottom: 12px;
}
.ti-srs-card.flipped { border-color: var(--accent); }
.ti-srs-eval-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

/* Ruling Classifier / Quiz Options */
.ti-quiz-opt {
  width: 100%;
  background: var(--card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 12px 13px;
  margin-bottom: 8px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  color: var(--text);
  text-align: left;
  transition: all 0.15s var(--ease);
}
.ti-quiz-opt:hover:not(:disabled) { border-color: var(--accent); background: var(--surface-2); }
.ti-quiz-opt.correct { border-color: var(--ok); background: var(--ok-bg); }
.ti-quiz-opt.wrong { border-color: var(--err); background: var(--err-bg); }
.ti-opt-key {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  background: var(--surface-2);
  color: var(--accent);
  font-size: 12px;
  font-weight: 800;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

/* ==========================================================================
   VISUAL INTERACTIVE GUIDES (WUDU, SALAH MATRIX, GLOSSARY, FOOTNOTES)
   ========================================================================== */
.ti-step-card {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  background: var(--card-elev);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 13px;
  margin-bottom: 9px;
}
.ti-step-card.checked { border-color: var(--ok-border); background: linear-gradient(155deg, var(--ok-bg), var(--card)); }
.ti-step-badge {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  background: rgba(var(--accent-rgb), 0.14);
  color: var(--accent);
  font-weight: 800;
  font-size: 13px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.ti-ruling-tag {
  display: inline-block;
  padding: 2px 7px;
  border-radius: 6px;
  font-size: 10.5px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}
.ruling-fard { background: rgba(244, 63, 94, 0.16); color: #fb7185; }
.ruling-wajib { background: rgba(245, 158, 11, 0.16); color: #fbbf24; }
.ruling-sunnah { background: rgba(16, 185, 129, 0.16); color: #34d399; }
.ruling-mustahab { background: rgba(56, 189, 248, 0.16); color: #38bdf8; }
html.theme-madinah-parchment .ruling-fard, html.theme-classic-light .ruling-fard { color: #be123c; }
html.theme-madinah-parchment .ruling-wajib, html.theme-classic-light .ruling-wajib { color: #b45309; }
html.theme-madinah-parchment .ruling-sunnah, html.theme-classic-light .ruling-sunnah { color: #047857; }
html.theme-madinah-parchment .ruling-mustahab, html.theme-classic-light .ruling-mustahab { color: #0369a1; }

.ti-rakaat-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
  overflow: hidden;
  border-radius: 12px;
}
.ti-rakaat-table th, .ti-rakaat-table td {
  padding: 9px 6px;
  text-align: center;
  border-bottom: 1px solid var(--border-subtle);
}
.ti-rakaat-table th {
  background: var(--surface-2);
  color: var(--accent);
  font-weight: 800;
  font-size: 11px;
}
.ti-rakaat-table td:first-child { text-align: left; font-weight: 800; padding-left: 10px; }
.ti-rakaat-total { font-weight: 800; color: var(--accent); }

/* ==========================================================================
   MODALS, SEARCH SHEET, FLOATING BARS & TOAST
   ========================================================================== */
.ti-modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: rgba(0, 0, 0, 0.68);
  backdrop-filter: blur(5px);
  display: flex;
  align-items: flex-end;
  justify-content: center;
}
.ti-modal-backdrop[hidden] { display: none !important; }
@media (min-width: 600px) {
  .ti-modal-backdrop { align-items: center; padding: 20px; }
}
.ti-modal {
  width: 100%;
  max-width: 540px;
  max-height: 88vh;
  background: var(--surface-solid);
  border: 1px solid var(--border);
  border-radius: 22px 22px 0 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: 0 -10px 40px rgba(0, 0, 0, 0.45);
}
.ti-modal-tall { height: 86vh; }
@media (min-width: 600px) { .ti-modal { border-radius: 22px; } }

.ti-modal-head {
  padding: 13px 15px;
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.ti-modal-head h2 { margin: 0; font-size: 16px; font-weight: 800; color: var(--accent); }
.ti-modal-body {
  padding: 14px 15px 26px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.ti-search-input-wrap {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 0 10px;
}
.ti-search-input-wrap input {
  flex: 1;
  min-width: 0;
  border: none;
  background: transparent;
  color: var(--text);
  padding: 9px 0;
  font-size: 13.5px;
  outline: none;
}
.ti-clear-btn {
  border: none;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  padding: 2px;
  display: inline-flex;
}

.ti-theme-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}
.ti-theme-swatch {
  border: 1.5px solid var(--border-subtle);
  border-radius: 12px;
  padding: 9px 6px;
  background: var(--card);
  color: var(--text);
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  font-weight: 700;
}
.ti-theme-swatch.active {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(var(--accent-rgb), 0.25);
}
.ti-swatch-orb {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.25);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.28);
}

.ti-setting-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 9px 0;
  border-bottom: 1px solid var(--border-subtle);
}
.ti-slider { width: 100%; accent-color: var(--accent); }

.ti-audio-bar {
  position: fixed;
  left: 12px;
  right: 12px;
  bottom: calc(var(--nav-h) + env(safe-area-inset-bottom, 0px) + 10px);
  z-index: 58;
  max-width: 780px;
  margin: 0 auto;
  background: var(--surface-solid);
  border: 1px solid var(--accent);
  border-radius: 15px;
  padding: 9px 12px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.42);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.ti-audio-bar[hidden] { display: none !important; }

.ti-autoscroll-pill {
  position: fixed;
  left: 50%;
  transform: translateX(-50%);
  bottom: calc(var(--nav-h) + env(safe-area-inset-bottom, 0px) + 12px);
  z-index: 59;
  background: var(--surface-solid);
  border: 1px solid var(--accent);
  border-radius: 99px;
  padding: 5px 7px;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.4);
}
.ti-autoscroll-pill[hidden] { display: none !important; }
.as-btn {
  border: none;
  background: var(--surface-2);
  color: var(--text);
  border-radius: 99px;
  padding: 6px 11px;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.as-btn-main { background: var(--accent); color: var(--accent-text); }

.ti-scroll-top {
  position: fixed;
  right: 14px;
  bottom: calc(var(--nav-h) + env(safe-area-inset-bottom, 0px) + 14px);
  z-index: 55;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--surface-solid);
  color: var(--accent);
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.35);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}
.ti-scroll-top[hidden] { display: none !important; }

.ti-toast {
  position: fixed;
  left: 50%;
  bottom: calc(var(--nav-h) + env(safe-area-inset-bottom, 0px) + 16px);
  transform: translateX(-50%) translateY(16px);
  z-index: 200;
  background: var(--accent);
  color: var(--accent-text);
  padding: 9px 18px;
  border-radius: 99px;
  font-size: 12.5px;
  font-weight: 800;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s, transform 0.2s var(--ease);
  max-width: 92vw;
  text-align: center;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.38);
}
.ti-toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* Narrow screen safety (320px-360px) */
@media (max-width: 360px) {
  .ti-main { padding: 10px 10px calc(var(--nav-h) + env(safe-area-inset-bottom, 0px) + 22px); }
  .ti-part-ur { font-size: 16px !important; }
  .ti-brand-title { font-size: 13.5px; }
}


/* ==========================================================================
   TALEEM-UL-ISLAM v2.0.0 — HUGE GRAPHICS, EASY NAVIGATION & WCAG 2.2 LAYER
   ========================================================================== */
[hidden] { display: none !important; }

.ti-skip-link {
  position: fixed;
  top: -64px;
  left: 12px;
  z-index: 9999;
  background: var(--accent);
  color: var(--accent-text);
  padding: 10px 16px;
  border-radius: 10px;
  font-weight: 800;
  font-size: 13px;
  text-decoration: none;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.4);
  transition: top 0.16s ease;
}
.ti-skip-link:focus { top: 10px; outline: 3px solid var(--text); outline-offset: 2px; }

:focus-visible {
  outline: 2.5px solid var(--accent) !important;
  outline-offset: 2px !important;
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

/* Compact Header Fit for 4 Action Buttons without Title Clipping */
.ti-header { padding: env(safe-area-inset-top, 0px) 10px 0; gap: 6px; }
.ti-header-actions { gap: 5px; }
.ti-icon-btn { width: 36px; height: 36px; border-radius: 10px; }
.ti-icon-btn .msr { font-size: 20px; }
.ti-nav-trigger {
  border-color: var(--border);
  background: rgba(var(--accent-rgb), 0.14);
  color: var(--accent);
}
@media (max-width: 350px) {
  .ti-brand-title { font-size: 13px; }
  .ti-icon-btn { width: 32px; height: 32px; }
}

/* Huge Custom Vector Hero Artwork */
.ti-hero-svg {
  display: block;
  flex-shrink: 0;
  filter: drop-shadow(0 8px 18px rgba(0, 0, 0, 0.28));
}

/* Home Hero v2 with Huge Mosque-Mushaf Graphic + Clickable 4-Metric Shortcuts */
.ti-hero-v2-row {
  display: flex;
  align-items: center;
  gap: 13px;
}
.ti-hero-v2-art {
  position: relative;
  flex-shrink: 0;
}
.ti-hero-ring-badge {
  position: absolute;
  bottom: -4px;
  right: -4px;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--surface-solid, var(--surface));
  border: 2px solid var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 900;
  color: var(--accent);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.35);
}
.ti-hero-v2-copy { flex: 1; min-width: 0; }
.ti-hero-cta-row {
  display: flex;
  align-items: center;
  gap: 7px;
  margin-top: 9px;
  flex-wrap: wrap;
}
.ti-hero-metrics-4 {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 6px;
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px solid var(--border-subtle);
}
.ti-metric-shortcut {
  appearance: none;
  border: 1px solid var(--border-subtle);
  background: rgba(var(--accent-rgb), 0.06);
  border-radius: 11px;
  padding: 7px 4px;
  text-align: center;
  cursor: pointer;
  color: var(--text);
  min-height: 48px;
  transition: border-color 0.15s, background 0.15s, transform 0.12s;
}
.ti-metric-shortcut:hover { border-color: var(--accent); background: rgba(var(--accent-rgb), 0.13); }
.ti-metric-shortcut:active { transform: scale(0.96); }
.ti-metric-shortcut strong { display: block; font-size: 14px; font-weight: 900; color: var(--accent); line-height: 1.15; }
.ti-metric-shortcut span { font-size: 10.5px; font-weight: 700; color: var(--muted); }

/* Illustrated 4-Part Curriculum Cards */
.ti-part-crest-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin: 4px 0 4px;
}
.ti-part-svg { border-radius: 16px; }

/* Page Visual Hero Banners (Duas, Practice, Exams, Guides) */
.ti-page-hero {
  display: flex;
  align-items: center;
  gap: 13px;
  padding: 14px 15px;
  border-radius: var(--radius-xl, 20px);
  margin-bottom: 12px;
  background: linear-gradient(145deg, rgba(var(--accent-rgb), 0.16) 0%, var(--card) 62%);
  border: 1px solid var(--border);
  box-shadow: var(--shadow, none);
}
.ti-page-hero-copy { flex: 1; min-width: 0; }

/* Sticky Part Quick-Switcher & In-Chapter Controls */
.ti-part-switcher {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 6px;
  margin-bottom: 11px;
}
.ti-part-sw-btn {
  appearance: none;
  border: 1px solid var(--border-subtle);
  background: var(--card);
  color: var(--muted);
  border-radius: 11px;
  padding: 8px 4px;
  font-size: 12px;
  font-weight: 800;
  cursor: pointer;
  min-height: 38px;
  transition: border-color 0.15s, background 0.15s, color 0.15s;
}
.ti-part-sw-btn.active {
  background: rgba(var(--accent-rgb), 0.18);
  border-color: var(--accent);
  color: var(--accent);
}

/* Chapter Reader Top Navigation Cluster + Sticky Q&A Jump Bar */
.ti-ch-switcher-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  margin-bottom: 10px;
}
.ti-ch-picker-pill {
  appearance: none;
  border: 1px solid var(--border);
  background: rgba(var(--accent-rgb), 0.12);
  color: var(--text);
  border-radius: 11px;
  padding: 6px 12px;
  min-height: 38px;
  flex: 1;
  min-width: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  font-size: 12.5px;
  font-weight: 800;
  cursor: pointer;
}
.ti-ch-picker-pill:hover { border-color: var(--accent); }

.ti-qa-jump-bar {
  position: sticky;
  top: calc(var(--header-h, 58px) + env(safe-area-inset-top, 0px));
  z-index: 34;
  display: flex;
  gap: 6px;
  overflow-x: auto;
  scrollbar-width: none;
  margin: 0 -14px 12px;
  padding: 7px 14px;
  background: var(--surface);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border-subtle);
}
.ti-qa-jump-bar::-webkit-scrollbar { display: none; }
.ti-qa-jump-pill {
  appearance: none;
  border: 1px solid var(--border-subtle);
  background: var(--card);
  color: var(--text);
  border-radius: 99px;
  padding: 5px 11px;
  min-height: 34px;
  font-size: 11.5px;
  font-weight: 800;
  white-space: nowrap;
  flex-shrink: 0;
  cursor: pointer;
}
.ti-qa-jump-pill:hover, .ti-qa-jump-pill.active {
  border-color: var(--accent);
  background: rgba(var(--accent-rgb), 0.16);
  color: var(--accent);
}
.ti-qa-jump-pill.done {
  border-color: var(--ok-border);
  color: var(--ok);
}
.ti-qa-card { scroll-margin-top: 126px; }

/* 4-Way Chapter Studio Switcher */
.ti-seg-4 {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 4px;
}
.ti-seg-4 .ti-seg-btn {
  flex-direction: column;
  padding: 8px 4px;
  font-size: 11px;
  gap: 2px;
}

/* Interactive 5-Prayer Sun-Arc Timeline (Visual Salah Guide) */
.ti-sun-arc-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 6px;
  margin-bottom: 12px;
}
.ti-sun-orb-card {
  background: var(--card);
  border: 1px solid var(--border-subtle);
  border-radius: 14px;
  padding: 9px 4px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
}
.ti-sun-dot {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  color: #061413;
  font-weight: 900;
}
.ti-sun-name { font-size: 11px; font-weight: 800; color: var(--text); }
.ti-sun-rak { font-size: 10.5px; font-weight: 800; color: var(--accent); }

/* Bilingual Ruling Drill Grid */
.ti-ruling-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}
.ti-ruling-btn {
  min-height: 50px;
  justify-content: space-between;
  padding: 8px 12px;
}

/* Global Book Navigator Drawer */
.ti-nav-tabs {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 5px;
  margin-bottom: 12px;
}
.ti-nav-dtab {
  appearance: none;
  border: 1px solid var(--border-subtle);
  background: var(--surface-2);
  color: var(--muted);
  border-radius: 11px;
  padding: 8px 4px;
  font-size: 11px;
  font-weight: 800;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  cursor: pointer;
  min-height: 52px;
}
.ti-nav-dtab.active {
  background: rgba(var(--accent-rgb), 0.18);
  border-color: var(--accent);
  color: var(--accent);
}
.ti-page-jump-form {
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
}
.ti-page-jump-input {
  flex: 1;
  min-width: 0;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 11px;
  color: var(--text);
  padding: 10px 12px;
  font-size: 14px;
  font-weight: 700;
}
.ti-page-range-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 12px;
}
.ti-page-num-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 6px;
}
.ti-page-pill {
  appearance: none;
  border: 1px solid var(--border-subtle);
  background: var(--card);
  color: var(--text);
  border-radius: 10px;
  min-height: 40px;
  font-size: 12.5px;
  font-weight: 800;
  cursor: pointer;
}
.ti-page-pill:hover { border-color: var(--accent); color: var(--accent); }
.ti-shortcut-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}
.ti-pill { white-space: nowrap; flex-shrink: 0; }


/* ==========================================================================
   TALEEM-UL-ISLAM v2.1.0 — INSTRUCTIONAL ANIMATIONS & INTERACTIVE WORSHIP LAB
   Learner-Paced • Tap-Controlled • Strict prefers-reduced-motion Compliance
   ========================================================================== */
.ti-posture-stage {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 14px;
  margin-bottom: 14px;
  box-shadow: var(--shadow, none);
}
.ti-posture-pills {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  scrollbar-width: none;
  padding-bottom: 8px;
  margin-bottom: 8px;
}
.ti-posture-pills::-webkit-scrollbar { display: none; }
.ti-posture-pill {
  appearance: none;
  border: 1px solid var(--border-subtle);
  background: var(--surface-2);
  color: var(--muted);
  border-radius: 99px;
  padding: 6px 11px;
  min-height: 36px;
  font-size: 11.5px;
  font-weight: 800;
  white-space: nowrap;
  flex-shrink: 0;
  cursor: pointer;
  transition: border-color 0.16s, background 0.16s, color 0.16s;
}
.ti-posture-pill.active {
  background: rgba(var(--accent-rgb), 0.18);
  border-color: var(--accent);
  color: var(--accent);
}
.ti-posture-canvas {
  display: flex;
  justify-content: center;
  align-items: center;
  background: linear-gradient(180deg, rgba(var(--accent-rgb), 0.08) 0%, var(--surface-2) 100%);
  border: 1px solid var(--border-subtle);
  border-radius: 14px;
  padding: 6px;
  margin-bottom: 10px;
}
.ti-posture-svg { width: 100%; max-width: 280px; height: auto; display: block; }

/* Hanafi Legal Rulings Visual Impact Meter */
.ti-impact-meter {
  margin: 10px 0 10px;
  padding: 10px 12px;
  border-radius: 12px;
  background: var(--surface-2);
  border: 1px solid var(--border-subtle);
}
.ti-impact-track {
  height: 9px;
  border-radius: 99px;
  background: rgba(255, 255, 255, 0.08);
  overflow: hidden;
  margin-top: 6px;
}
.ti-impact-fill {
  height: 100%;
  border-radius: 99px;
  transition: width 0.42s cubic-bezier(0.22, 1, 0.36, 1);
}

/* Live Audio Equalizer Waveform Bars */
.ti-eq-bars {
  display: inline-flex;
  align-items: flex-end;
  gap: 2.5px;
  height: 13px;
  margin-right: 5px;
  vertical-align: middle;
}
.ti-eq-bars i {
  display: block;
  width: 3px;
  height: 5px;
  border-radius: 2px;
  background: var(--accent);
  font-style: normal;
}

@media (prefers-reduced-motion: no-preference) {
  @keyframes tiPosturePop {
    0% { opacity: 0.25; transform: scale(0.94) translateY(5px); }
    100% { opacity: 1; transform: scale(1) translateY(0); }
  }
  @keyframes tiCheckPop {
    0% { transform: scale(0.84); }
    60% { transform: scale(1.12); }
    100% { transform: scale(1); }
  }
  @keyframes tiShake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-6px); }
    50% { transform: translateX(6px); }
    75% { transform: translateX(-4px); }
  }
  @keyframes tiEqBounce {
    0%, 100% { height: 4px; }
    50% { height: 13px; }
  }
  @keyframes tiFillGrow {
    0% { transform: scaleX(0); transform-origin: left; }
    100% { transform: scaleX(1); transform-origin: left; }
  }

  .ti-anim-posture { animation: tiPosturePop 0.34s cubic-bezier(0.22, 1, 0.36, 1) both; }
  .ti-impact-fill { animation: tiFillGrow 0.44s cubic-bezier(0.22, 1, 0.36, 1) both; }
  .ti-step-card.checked .ti-step-badge { animation: tiCheckPop 0.28s ease-out both; }
  .ti-srs-card.flipped { animation: tiPosturePop 0.28s ease-out both; }
  .ti-quiz-opt.wrong, .ti-ruling-btn.ti-btn-err { animation: tiShake 0.30s ease-in-out both; }
  .ti-quiz-opt.correct, .ti-ruling-btn.ti-btn-ok { animation: tiCheckPop 0.26s ease-out both; }
  .ti-eq-bars i:nth-child(1) { animation: tiEqBounce 0.55s ease-in-out infinite; }
  .ti-eq-bars i:nth-child(2) { animation: tiEqBounce 0.55s 0.16s ease-in-out infinite; }
  .ti-eq-bars i:nth-child(3) { animation: tiEqBounce 0.55s 0.32s ease-in-out infinite; }
}


/* ==========================================================================
   TALEEM-UL-ISLAM v3.0.0 — 100/100 HUGE INTERACTIVE ANIMATED LESSON PLAYER
   14 Custom Thematic Animated SVG Worlds (All 122 Chapters) • All-Ages Comfort
   WCAG 2.2 AA/AAA Contrast (All 6 Themes) • prefers-reduced-motion Compliant
   ========================================================================== */

.ti-anim-open { overflow: hidden !important; }

/* Luminous Animated Launchers (Home Hero, Featured Rail, Chapter Studio) */
.tia-glow-cta {
  background: linear-gradient(135deg, var(--accent) 0%, #f59e0b 100%) !important;
  color: #061413 !important;
  font-weight: 800 !important;
  box-shadow: 0 4px 16px rgba(234, 179, 8, 0.34);
}
.tia-featured-rail {
  display: flex;
  gap: 9px;
  overflow-x: auto;
  padding: 2px 2px 8px;
  margin-bottom: 10px;
  scrollbar-width: none;
}
.tia-featured-rail::-webkit-scrollbar { display: none; }
.tia-feat-chip {
  appearance: none;
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  gap: 9px;
  padding: 10px 12px;
  min-width: 196px;
  border-radius: 16px;
  border: 1.5px solid color-mix(in srgb, var(--fc, var(--accent)) 40%, var(--border-subtle));
  background: var(--card-elev, var(--card));
  color: var(--text);
  cursor: pointer;
  transition: transform 0.14s var(--ease), border-color 0.16s;
}
.tia-feat-chip:active { transform: scale(0.96); }
.tia-feat-ico {
  width: 38px;
  height: 38px;
  border-radius: 11px;
  background: color-mix(in srgb, var(--fc, var(--accent)) 18%, transparent);
  color: var(--fc, var(--accent));
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.tia-feat-en { font-size: 13px; font-weight: 800; color: var(--text); white-space: nowrap; }
.tia-feat-ur { font-size: 12.5px !important; line-height: 1.75 !important; color: var(--muted) !important; text-align: right; }

.tia-studio-banner {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 13px 14px;
  margin: 10px 0 12px;
  border-radius: 18px;
  background: linear-gradient(135deg, rgba(16, 185, 129, 0.22) 0%, rgba(234, 179, 8, 0.18) 100%);
  border: 1.5px solid var(--accent);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.22);
  cursor: pointer;
}
.tia-studio-banner:active { transform: scale(0.985); }
.tia-studio-ico {
  width: 48px;
  height: 48px;
  border-radius: 14px;
  background: linear-gradient(135deg, #eab308, #10b981);
  color: #061413;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.tia-studio-ico .msr { font-size: 28px; }
.tia-studio-kicker { font-size: 10px; font-weight: 800; letter-spacing: 0.7px; color: var(--accent); text-transform: uppercase; }
.tia-studio-title { font-size: 15.5px; font-weight: 800; color: var(--text); line-height: 1.25; }
.tia-studio-go {
  width: 38px;
  height: 38px;
  border-radius: 99px;
  background: var(--accent);
  color: var(--accent-text);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

/* Confetti Overlay */
.ti-fx-canvas {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  pointer-events: none;
  z-index: 12050;
}

/* Full-Screen Animated Lesson Player Shell */
.tia-overlay {
  position: fixed;
  inset: 0;
  z-index: 11000;
  background: var(--bg);
  color: var(--text);
  display: flex;
  justify-content: center;
  overflow: hidden;
}
.tia-shell {
  width: 100%;
  max-width: 560px;
  height: 100%;
  display: flex;
  flex-direction: column;
  padding: env(safe-area-inset-top, 0px) 0 env(safe-area-inset-bottom, 0px);
}
.tia-top-bar {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 10px 12px 6px;
  flex-shrink: 0;
}
.tia-ico-btn {
  appearance: none;
  width: 38px;
  height: 38px;
  border-radius: 12px;
  border: 1px solid var(--border-subtle);
  background: var(--surface-2);
  color: var(--text);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  font-weight: 800;
  font-size: 12px;
}
.tia-pill-mini { width: auto; padding: 0 9px; }
.tia-prog-segs {
  flex: 1;
  display: flex;
  gap: 4px;
  align-items: center;
  min-width: 0;
}
.tia-seg {
  flex: 1;
  height: 7px;
  border-radius: 99px;
  background: var(--surface-2);
  transition: background 0.28s, transform 0.25s;
}
.tia-seg.done { background: #10b981; }
.tia-seg.cur { background: linear-gradient(90deg, #eab308, #34d399); transform: scaleY(1.25); }

.tia-kicker-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 2px 14px 8px;
  gap: 8px;
  flex-shrink: 0;
}
.tia-kicker {
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.6px;
  color: var(--accent);
  text-transform: uppercase;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.tia-step-num { font-size: 11.5px; font-weight: 800; color: var(--muted); white-space: nowrap; }

.tia-viewport {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 4px 12px 18px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.tia-card {
  background: var(--card-elev, var(--card));
  border: 1px solid var(--border);
  border-radius: 22px;
  padding: 14px;
  box-shadow: var(--shadow, none);
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.tia-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; flex-wrap: wrap; }
.tia-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 10.5px;
  font-weight: 800;
  letter-spacing: 0.55px;
  color: var(--accent);
  background: rgba(var(--accent-rgb), 0.14);
  padding: 4px 10px;
  border-radius: 99px;
}
.tia-tag {
  font-size: 11px;
  font-weight: 800;
  padding: 3px 9px;
  border-radius: 99px;
  background: var(--surface-2);
  color: var(--muted);
}
.tia-title { margin: 0; font-size: 16px; font-weight: 800; color: var(--text); line-height: 1.35; }
.tia-ur-title { font-size: 17px !important; line-height: 2 !important; color: var(--accent) !important; text-align: right; }

/* Deep Theater Canvas for 14 Animated Thematic Worlds */
.tia-svg-frame {
  border-radius: 18px;
  background: linear-gradient(155deg, #06211c 0%, #0b332b 100%);
  border: 1.5px solid rgba(234, 179, 8, 0.42);
  padding: 6px;
  cursor: pointer;
  overflow: hidden;
  box-shadow: inset 0 0 28px rgba(0, 0, 0, 0.34), 0 8px 22px rgba(0, 0, 0, 0.22);
}
.ti-world-svg { display: block; width: 100%; height: auto; min-height: 188px; max-height: 248px; }
@media (max-height: 760px) {
  .ti-world-svg { min-height: 158px; max-height: 204px; }
}
.ti-salah-embed { display: flex; justify-content: center; padding: 12px 0; }
.ti-salah-embed svg { width: 100%; max-width: 340px; height: auto; }
.ti-svg-ar {
  font-family: 'AlQuran Neo v5x1', 'AlQuran Neo', serif;
  font-weight: 400;
  direction: rtl;
  unicode-bidi: plaintext;
}

.tia-pills { display: flex; flex-wrap: wrap; gap: 7px; justify-content: center; }
.tia-pill {
  appearance: none;
  padding: 8px 12px;
  min-height: 38px;
  border-radius: 13px;
  border: 1.5px solid var(--border-subtle);
  background: var(--surface-2);
  color: var(--text);
  font-size: 12.5px;
  font-weight: 800;
  cursor: pointer;
}
.tia-pill.active {
  background: rgba(var(--accent-rgb), 0.22);
  border-color: var(--accent);
  color: var(--accent);
}

.tia-caption-box {
  border-radius: 16px;
  background: var(--stage, var(--surface-2));
  border: 1px solid var(--border);
  padding: 12px;
}
.tia-spk-fab {
  appearance: none;
  width: 44px;
  height: 44px;
  border-radius: 14px;
  border: none;
  background: linear-gradient(135deg, var(--accent), #10b981);
  color: #061413;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  cursor: pointer;
}
.tia-cap-ur { font-size: 15px !important; line-height: 2.05 !important; color: var(--urdu); text-align: right; }
.tia-cap-en { font-size: 13.5px; line-height: 1.5; color: var(--english, var(--text)); margin-top: 4px; font-weight: 600; }

/* Act 2: Interactive Q&A Discovery */
.tia-q-box {
  padding: 13px;
  border-radius: 16px;
  background: rgba(var(--accent-rgb), 0.08);
  border: 1px solid var(--border);
}
.tia-q-ur { font-size: 17px !important; line-height: 2.05 !important; color: var(--accent) !important; text-align: right; }
.tia-q-en { font-size: 15px; font-weight: 800; color: var(--text); line-height: 1.4; margin-top: 4px; }

.tia-reveal-btn {
  appearance: none;
  width: 100%;
  min-height: 84px;
  padding: 16px;
  border-radius: 18px;
  border: 2px dashed var(--accent);
  background: linear-gradient(135deg, rgba(var(--accent-rgb), 0.16), rgba(16, 185, 129, 0.16));
  color: var(--text);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  cursor: pointer;
}
.tia-reveal-btn .msr { font-size: 32px; color: var(--accent); }
.tia-ans-box {
  padding: 13px;
  border-radius: 16px;
  background: var(--stage, var(--surface-2));
  border: 1.5px solid #10b981;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.tia-ans-badge {
  display: inline-flex;
  align-self: flex-start;
  padding: 3px 10px;
  border-radius: 99px;
  background: rgba(16, 185, 129, 0.2);
  color: #10b981;
  font-size: 11px;
  font-weight: 800;
}
.tia-a-ur { font-size: 16px !important; line-height: 2.1 !important; color: var(--urdu); text-align: right; }
.tia-a-en { font-size: 14px; line-height: 1.55; color: var(--english, var(--text)); font-weight: 600; }

.tia-ar-box {
  margin-top: 4px;
  padding: 12px;
  border-radius: 15px;
  background: rgba(var(--accent-rgb), 0.09);
  border: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.tia-ar-top { display: flex; justify-content: space-between; align-items: center; gap: 6px; flex-wrap: wrap; }
.tia-ar-lbl { font-size: 11px; font-weight: 800; color: var(--accent); }
.tia-mini-spk {
  appearance: none;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 5px 10px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text);
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
}
.tia-ar-text {
  font-size: 27px !important;
  line-height: 1.8 !important;
  color: var(--arabic);
  text-align: center;
  cursor: pointer;
}

/* Act 3: Mastery Check Quiz */
.tia-quiz-list { display: flex; flex-direction: column; gap: 9px; }
.tia-quiz-opt {
  appearance: none;
  width: 100%;
  min-height: 54px;
  padding: 11px 12px;
  border-radius: 15px;
  border: 1.5px solid var(--border-subtle);
  background: var(--surface-2);
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 10px;
  text-align: left;
  cursor: pointer;
}
.tia-quiz-opt.is-ok { border-color: #10b981; background: rgba(16, 185, 129, 0.2); box-shadow: 0 0 0 2px rgba(16, 185, 129, 0.28); }
.tia-quiz-opt.is-try { border-color: #f59e0b; background: rgba(245, 158, 11, 0.16); }
.tia-opt-letter {
  width: 28px;
  height: 28px;
  border-radius: 9px;
  background: var(--card);
  border: 1px solid var(--border);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 800;
  color: var(--accent);
  flex-shrink: 0;
}
.tia-opt-ur { font-size: 14.5px !important; line-height: 1.9 !important; color: var(--urdu); text-align: right; }
.tia-opt-en { font-size: 13.5px; font-weight: 700; color: var(--text); }

/* Encouraging Praise Banner */
.tia-praise {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 12px 14px;
  border-radius: 16px;
  border: 1.5px solid #10b981;
  background: rgba(16, 185, 129, 0.16);
}
.tia-praise.is-retry { border-color: #f59e0b; background: rgba(245, 158, 11, 0.15); }
.tia-praise-ar { font-size: 20px !important; color: var(--accent); text-align: right; line-height: 1.5 !important; }
.tia-praise-en { font-size: 13.5px; font-weight: 800; color: var(--text); }
.tia-praise-ur { font-size: 13.5px !important; line-height: 1.85 !important; color: var(--urdu); text-align: right; }

/* Act 4: Grand Celebration */
.tia-celebrate {
  background: var(--card-elev, var(--card));
  border: 1.5px solid var(--accent);
  border-radius: 24px;
  padding: 18px 16px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}
.tia-trophy-svg { width: 168px; height: 136px; }
.tia-cel-ar { font-size: 25px !important; color: var(--accent); line-height: 1.6 !important; }
.tia-cel-title { margin: 0; font-size: 21px; font-weight: 900; color: var(--text); }
.tia-cel-ur { font-size: 15px !important; line-height: 1.95 !important; color: var(--urdu); }
.tia-cel-stars { font-size: 30px; letter-spacing: 8px; color: #eab308; }
.tia-cel-stats { width: 100%; display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 6px 0; }
.tia-cel-stat { padding: 10px 6px; border-radius: 14px; background: var(--stage, var(--surface-2)); border: 1px solid var(--border-subtle); }
.tia-cel-stat strong { display: block; font-size: 16px; font-weight: 900; color: var(--accent); }
.tia-cel-stat span { font-size: 11px; color: var(--muted); font-weight: 700; }
.tia-cel-actions { width: 100%; display: flex; flex-direction: column; gap: 8px; margin-top: 6px; }

/* Sticky Footer Controls */
.tia-foot-bar {
  display: flex;
  gap: 9px;
  padding: 10px 12px 12px;
  border-top: 1px solid var(--border-subtle);
  background: var(--surface);
  flex-shrink: 0;
}
.tia-btn-back {
  appearance: none;
  width: 48px;
  height: 48px;
  border-radius: 15px;
  border: 1.5px solid var(--border-subtle);
  background: var(--surface-2);
  color: var(--text);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
}
.tia-btn-next {
  appearance: none;
  flex: 1;
  min-height: 48px;
  padding: 12px 18px;
  border-radius: 15px;
  border: none;
  background: linear-gradient(135deg, var(--accent), #f59e0b);
  color: #061413;
  font-size: 15px;
  font-weight: 900;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  cursor: pointer;
}
.tia-btn-next.locked { opacity: 0.42; cursor: not-allowed; }
.tia-btn-ghost {
  appearance: none;
  min-height: 44px;
  padding: 10px 14px;
  border-radius: 14px;
  border: 1.5px solid var(--border-subtle);
  background: var(--surface-2);
  color: var(--text);
  font-weight: 700;
  font-size: 13.5px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  cursor: pointer;
}

/* All-Ages Universal Comfort Text Scaling (A+ and A++ for Kids & Elders!) */
.tia-overlay[data-comfort="1"] .tia-cap-en,
.tia-overlay[data-comfort="1"] .tia-a-en { font-size: 16px; }
.tia-overlay[data-comfort="1"] .tia-cap-ur,
.tia-overlay[data-comfort="1"] .tia-a-ur { font-size: 18px !important; }
.tia-overlay[data-comfort="1"] .tia-ar-text { font-size: 32px !important; }

.tia-overlay[data-comfort="2"] .tia-cap-en,
.tia-overlay[data-comfort="2"] .tia-a-en,
.tia-overlay[data-comfort="2"] .tia-q-en { font-size: 18px; }
.tia-overlay[data-comfort="2"] .tia-cap-ur,
.tia-overlay[data-comfort="2"] .tia-a-ur,
.tia-overlay[data-comfort="2"] .tia-q-ur { font-size: 20px !important; }
.tia-overlay[data-comfort="2"] .tia-ar-text { font-size: 36px !important; }

/* Light-Theme Crystal-Clear High-Contrast Primary Controls */
html.theme-madinah-parchment .tia-btn-next,
html.theme-classic-light .tia-btn-next,
html.theme-madinah-parchment .tia-glow-cta,
html.theme-classic-light .tia-glow-cta {
  background: linear-gradient(135deg, #0f766e 0%, #065f46 100%) !important;
  color: #ffffff !important;
  box-shadow: 0 5px 16px rgba(15, 118, 110, 0.28);
}
html.theme-madinah-parchment .tia-spk-fab,
html.theme-classic-light .tia-spk-fab {
  background: linear-gradient(135deg, #0f766e 0%, #059669 100%) !important;
  color: #ffffff !important;
}

/* Purposeful Motion (Respects prefers-reduced-motion!) */
@media (prefers-reduced-motion: no-preference) {
  .ti-dash-flow { animation: tiDashFlow 1.8s linear infinite; }
  .ti-pulse-halo { animation: tiPulseHalo 2.6s ease-in-out infinite; transform-box: fill-box; transform-origin: center; }
  .ti-pop-in { animation: tiPopIn 0.34s cubic-bezier(0.22, 1, 0.36, 1) both; transform-box: fill-box; transform-origin: center; }
  .ti-twinkle { animation: tiTwinkle 2.2s ease-in-out infinite; }
  .ti-drop-fall { animation: tiDropFall 1.8s ease-in-out infinite; }
}
@keyframes tiDashFlow { from { stroke-dashoffset: 30; } to { stroke-dashoffset: 0; } }
@keyframes tiPulseHalo { 0%, 100% { opacity: 0.72; transform: scale(0.96); } 50% { opacity: 1; transform: scale(1.05); } }
@keyframes tiPopIn { from { opacity: 0; transform: scale(0.88); } to { opacity: 1; transform: scale(1); } }
@keyframes tiTwinkle { 0%, 100% { opacity: 0.35; } 50% { opacity: 1; } }
@keyframes tiDropFall { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(8px); } }


/* ==========================================================================
   TALEEM-UL-ISLAM v4.0.0 — AUTHENTIC QARI BADGES & STUDIO HIFZ AUDIO BAR
   ========================================================================== */
.ti-qari-badge {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  font-size: 10.5px;
  font-weight: 800;
  padding: 2px 7px;
  border-radius: 999px;
  letter-spacing: 0.02em;
  white-space: nowrap;
}
.ti-qari-alafasy {
  background: rgba(var(--accent-rgb, 228, 184, 91), 0.18);
  border: 1px solid rgba(var(--accent-rgb, 228, 184, 91), 0.48);
  color: var(--accent);
}
.ti-qari-human {
  background: rgba(16, 185, 129, 0.14);
  border: 1px solid rgba(16, 185, 129, 0.40);
  color: #34d399;
}
.ti-qari-saudi {
  background: var(--surface-2);
  border: 1px solid var(--border-subtle);
  color: var(--muted);
}
html.theme-madinah-parchment .ti-qari-human,
html.theme-classic-light .ti-qari-human {
  color: #065f46;
  background: rgba(5, 150, 105, 0.11);
  border-color: rgba(5, 150, 105, 0.35);
}
html.theme-madinah-parchment .ti-qari-alafasy,
html.theme-classic-light .ti-qari-alafasy {
  color: #92400e;
  background: rgba(217, 119, 6, 0.11);
  border-color: rgba(217, 119, 6, 0.35);
}

/* Upgraded Live Floating Hifz Studio Audio Bar */
#ti-audio-bar {
  flex-direction: column !important;
  align-items: stretch !important;
  gap: 6px !important;
  padding: 0 12px 9px !important;
  overflow: hidden;
}
.ti-ab-prog {
  height: 3px;
  margin: 0 -12px;
  background: rgba(255, 255, 255, 0.12);
}
.ti-ab-prog-fill {
  height: 100%;
  background: var(--accent);
  transition: width 0.15s linear;
}
.ti-ab-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.ti-ab-kicker {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 10.5px;
  font-weight: 800;
  color: var(--accent);
  letter-spacing: 0.03em;
}
.ti-ab-time {
  margin-left: auto;
  font-variant-numeric: tabular-nums;
  color: var(--muted);
  font-weight: 700;
}
.ti-ab-title {
  font-size: 12.5px;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.ti-ab-ctrls {
  display: flex;
  align-items: center;
  gap: 5px;
  flex-shrink: 0;
}
