/* Digital Khatt Indo-Pak, primary Mushaf font (bundled locally for offline use) */
@font-face {
    font-family: 'digitalkhatt-indopak';
    src: url('./assets/fonts/DigitalKhattIndoPak.otf') format('opentype'),
         url('https://static-cdn.tarteel.ai/qul/fonts/dk/DigitalKhattIndoPak.otf') format('opentype');
    font-display: swap;
    unicode-range: U+0600-06FF, U+0750-077F, U+08A0-08FF, U+FB50-FDFF, U+FE70-FEFF;
}

/* Utility class, apply Indo-Pak Mushaf font to any Arabic snippet. */
.font-quran, [lang="ar"], [dir="rtl"] {
    font-family: var(--font-quran);
}

:root {
    --bg: #f7f5f0;
    --surface: #ffffff;
    --surface-alt: #faf8f3;
    --border: #e6e1d6;
    --text: #1c1c1c;
    --text-muted: #6b6b6b;
    --accent: #1f6f5c;
    --accent-dark: #18584a;
    --accent-soft: #e6f1ed;
    --danger: #a23b3b;
    --success: #2f7d4f;
    --warn: #b07b00;
    --shadow: 0 1px 2px rgba(0,0,0,0.04), 0 4px 16px rgba(0,0,0,0.04);
    --radius: 12px;
    --radius-sm: 8px;
    --safe-bottom: env(safe-area-inset-bottom, 0px);
    --safe-top: env(safe-area-inset-top, 0px);
    /* Indo-Pak Mushaf script, used everywhere Arabic appears.
       Scheherazade New (SIL) is the open-source web font designed for
       South Asian / Indo-Pak Quranic typesetting. Noto Naskh Arabic and
       Amiri Quran are graceful fallbacks. */
    --font-quran: 'digitalkhatt-indopak', 'Scheherazade New', 'Noto Naskh Arabic', 'Amiri Quran', 'Traditional Arabic', serif;
}

[data-theme="dark"] {
    --bg: #0f1715;
    --surface: #161e1c;
    --surface-alt: #1c2624;
    --border: #2a3431;
    --text: #e8e6e1;
    --text-muted: #9aa39f;
    --accent: #4fb89d;
    --accent-dark: #6dcab2;
    --accent-soft: #1c2e29;
    --danger: #d97676;
    --success: #6dcab2;
    --warn: #e0b85c;
    --shadow: 0 1px 2px rgba(0,0,0,0.3), 0 4px 16px rgba(0,0,0,0.25);
}

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

html, body {
    margin: 0;
    padding: 0;
    background: var(--bg);
    color: var(--text);
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    font-size: 15px;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
    overscroll-behavior-y: none;
    /* iOS: kill the long-press "magnifier" + selection tooltips that
       feel un-native when wrapping a webview. */
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    user-select: none;
}
/* Allow selection/copy in passages where it actually matters. */
input, textarea, [contenteditable], .ayah-arabic, .dua-arabic, .drive-arabic,
.dua-trans, .dua-en, .ayah-translation, .selectable {
    -webkit-user-select: text;
    user-select: text;
    -webkit-touch-callout: default;
}
/* Remove the 300 ms double-tap-zoom delay on iOS for every interactive
   element, plus turn off iOS's auto text-size adjustment which can
   cause sudden reflows when the view first appears. */
button, a, [role="button"], .nav-btn, .bnav-btn, .hv3-pill, .hv3-chip,
.dua-pills li, .qibla-readout .hv3-pill, .ramadan-ring-btn {
    touch-action: manipulation;
}
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }

body {
    /* The header has its own safe-area inset; don't pad the body too
       or we get a doubled gap when running inside Capacitor. The bottom
       inset is drawn behind the bottom-nav (see .bottom-nav rules). */
    padding-top: 0;
    /* Smooth momentum scroll on iOS WKWebView. */
    -webkit-overflow-scrolling: touch;
}

/* When running inside Capacitor we draw a colored slab behind the
   home-indicator + status-bar so the system chrome blends with the
   app, instead of flashing white. */
body::before, body::after {
    content: ""; position: fixed; left: 0; right: 0; z-index: 1; pointer-events: none;
    background: var(--bg);
}
body::before { top: 0;    height: env(safe-area-inset-top, 0px); }
body::after  { bottom: 0; height: env(safe-area-inset-bottom, 0px); }

.container {
    max-width: 1240px;
    margin: 0 auto;
    padding: 0 24px;
}

/* Header */
.app-header {
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 10;
    padding-top: var(--safe-top);
}
.header-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-top: 14px;
    padding-bottom: 14px;
    gap: 16px;
    flex-wrap: wrap;
}
.brand-title {
    margin: 0;
    font-size: 20px;
    font-weight: 600;
    letter-spacing: -0.01em;
}
.brand-subtitle {
    margin: 2px 0 0;
    font-size: 13px;
    color: var(--text-muted);
}
.top-nav { display: flex; gap: 4px; flex-wrap: wrap; }
.nav-btn {
    background: transparent;
    border: 1px solid transparent;
    color: var(--text-muted);
    padding: 8px 14px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    font-family: inherit;
    transition: all 0.15s ease;
}
.nav-btn:hover { color: var(--text); background: var(--surface-alt); }
.nav-btn.active {
    color: var(--accent);
    background: var(--accent-soft);
}
.theme-toggle {
    background: var(--surface-alt);
    border: 1px solid var(--border);
    width: 36px;
    height: 36px;
    border-radius: 50%;
    cursor: pointer;
    color: var(--text);
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: inherit;
}
.theme-toggle:hover { background: var(--accent-soft); border-color: var(--accent); }
.theme-icon::before { content: '\263C'; font-size: 16px; }
[data-theme="dark"] .theme-icon::before { content: '\263D'; }

/* Layout */
.main-content { padding: 24px 24px 80px; }
.view { display: none; }
.view.active { display: block; }
.hidden { display: none !important; }

.layout {
    display: grid;
    grid-template-columns: 280px 1fr;
    gap: 24px;
    align-items: start;
}

/* Sidebar */
.sidebar {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    max-height: calc(100vh - 140px);
    display: flex;
    flex-direction: column;
    position: sticky;
    top: 88px;
}
.sidebar-header {
    padding: 14px;
    border-bottom: 1px solid var(--border);
}
.sidebar-header h2 {
    margin: 0 0 10px;
    font-size: 13px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-muted);
}
#surah-search {
    width: 100%;
    padding: 9px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-family: inherit;
    background: var(--surface-alt);
    color: var(--text);
}
#surah-search:focus { outline: none; border-color: var(--accent); background: var(--surface); }
.surah-list {
    list-style: none;
    margin: 0;
    padding: 6px;
    overflow-y: auto;
    flex: 1;
    -webkit-overflow-scrolling: touch;
}
.surah-list li {
    padding: 10px 12px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    gap: 10px;
    font-size: 14px;
    transition: background 0.12s ease;
    align-items: center;
}
.surah-list li:hover { background: var(--surface-alt); }
.surah-list li.active {
    background: var(--accent-soft);
    color: var(--accent-dark);
    font-weight: 500;
}
.surah-list li.loading { cursor: default; color: var(--text-muted); }
.surah-list .surah-num {
    color: var(--text-muted);
    font-variant-numeric: tabular-nums;
    font-size: 13px;
    min-width: 28px;
}
.surah-list .surah-en { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.surah-list .surah-ar {
    font-family: var(--font-quran);
    color: var(--text-muted);
    font-size: 18px;
    line-height: 1;
}
.surah-list li.active .surah-num,
.surah-list li.active .surah-ar { color: var(--accent-dark); }
.surah-list li.completed::after { content: '\2713'; color: var(--success); font-weight: 700; }
.surah-list li.partial::after {
    content: '';
    width: 6px; height: 6px; border-radius: 50%;
    background: var(--warn);
    display: inline-block;
}

.workspace { min-width: 0; }

/* Empty state */
.empty-state {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 40px 24px;
    text-align: center;
}
.empty-state h2 { margin: 0 0 8px; font-size: 22px; font-weight: 600; }
.empty-state p { color: var(--text-muted); max-width: 480px; margin: 0 auto 24px; }
.empty-quick { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; margin-bottom: 24px; }

.daily-card {
    margin-top: 12px;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    max-width: 460px;
    margin-left: auto;
    margin-right: auto;
}
.daily-card > div {
    background: var(--surface-alt);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px;
    text-align: left;
}
.daily-label {
    margin: 0 0 4px;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-muted);
    font-weight: 500;
}
.daily-value {
    margin: 0;
    font-size: 20px;
    font-weight: 600;
    color: var(--text);
    font-variant-numeric: tabular-nums;
}

/* Surah header */
.surah-header {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 18px 22px;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 24px;
    flex-wrap: wrap;
    margin-bottom: 18px;
}
.surah-header h2 { margin: 0; font-size: 22px; font-weight: 600; }
.surah-meta { margin: 4px 0 0; color: var(--text-muted); font-size: 13px; }
.surah-progress { min-width: 180px; }
.progress-bar {
    margin-top: 8px;
    width: 100%;
    height: 6px;
    background: var(--border);
    border-radius: 999px;
    overflow: hidden;
}
.progress-fill {
    height: 100%;
    background: var(--accent);
    width: 0;
    transition: width 0.3s ease;
}

/* Ayah card */
.ayah-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 22px;
    margin-bottom: 18px;
    box-shadow: var(--shadow);
}
.ayah-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
    padding-bottom: 14px;
    border-bottom: 1px solid var(--border);
    gap: 12px;
}
.position-block { display: flex; flex-direction: column; align-items: center; gap: 2px; }
.ayah-position { font-size: 14px; font-weight: 500; color: var(--text-muted); }
.range-indicator { font-size: 12px; color: var(--accent); font-weight: 500; }
.icon-btn {
    background: var(--surface-alt);
    border: 1px solid var(--border);
    width: 40px;
    height: 40px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 22px;
    line-height: 1;
    color: var(--text);
    transition: all 0.15s ease;
}
.icon-btn:hover { background: var(--accent-soft); border-color: var(--accent); color: var(--accent-dark); }
.icon-btn:disabled { opacity: 0.35; cursor: not-allowed; }

.bismillah {
    font-family: var(--font-quran);
    font-size: 30px;
    text-align: center;
    direction: rtl;
    color: var(--text);
    padding: 12px 0;
    margin-bottom: 8px;
    border-bottom: 1px dashed var(--border);
    font-weight: 500;
}

.ayah-body { padding: 16px 0; }
.ayah-arabic {
    font-family: var(--font-quran);
    font-size: 36px;
    font-weight: 500;
    line-height: 2;
    text-align: center;
    direction: rtl;
    margin: 0 0 24px;
    color: var(--text);
    word-spacing: 4px;
}
.ayah-words {
    text-align: center;
    direction: rtl;
    font-family: var(--font-quran);
    margin: 0 0 18px;
}
.ayah-words .word {
    display: inline-block;
    margin: 4px 8px;
    padding: 4px 10px;
    border-radius: var(--radius-sm);
    background: var(--surface-alt);
    border: 1px solid var(--border);
    font-size: 28px;
    cursor: pointer;
    transition: all 0.15s ease;
}
.ayah-words .word.hidden-word { color: transparent; background: var(--border); user-select: none; }
.ayah-words .word.hidden-word:hover { color: var(--accent); }

.ayah-translation { font-size: 16px; line-height: 1.7; color: var(--text); margin: 0; text-align: center; }
.ayah-translation.transliteration { color: var(--text-muted); font-style: italic; margin-top: 12px; font-size: 15px; }

.audio-controls {
    display: flex;
    align-items: center;
    gap: 14px;
    flex-wrap: wrap;
    padding: 14px 0;
    border-top: 1px solid var(--border);
    border-bottom: 1px solid var(--border);
    margin: 14px 0;
}
.repeat-control {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    color: var(--text-muted);
}
.repeat-control.toggle-inline { gap: 6px; }
.repeat-control select {
    padding: 7px 10px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--surface);
    color: var(--text);
    font-family: inherit;
    font-size: 14px;
    cursor: pointer;
}
.repeat-control input[type="checkbox"] { width: 18px; height: 18px; accent-color: var(--accent); }

.primary-btn, .ghost-btn, .success-btn, .danger-btn {
    padding: 10px 18px;
    border-radius: var(--radius-sm);
    font-family: inherit;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    border: 1px solid transparent;
    transition: all 0.15s ease;
    min-height: 40px;
}
.primary-btn { background: var(--accent); color: white; }
.primary-btn:hover { background: var(--accent-dark); }
.primary-btn.playing { background: var(--accent-dark); }

.ghost-btn { background: var(--surface); color: var(--text); border-color: var(--border); }
.ghost-btn:hover { background: var(--surface-alt); }

.success-btn { background: var(--success); color: white; }
.success-btn:hover { filter: brightness(0.92); }
.success-btn.done { background: var(--surface-alt); color: var(--success); border-color: var(--success); }

.danger-btn { background: var(--surface); color: var(--danger); border-color: var(--danger); }
.danger-btn:hover { background: var(--danger); color: white; }

.action-row { display: flex; gap: 8px; flex-wrap: wrap; padding-top: 8px; }

.strength-row {
    display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
    padding-top: 14px; margin-top: 14px;
    border-top: 1px solid var(--border);
}
.strength-label { font-size: 13px; color: var(--text-muted); font-weight: 500; }
.strength-buttons { display: flex; gap: 6px; flex-wrap: wrap; }
.strength-btn {
    padding: 7px 14px;
    background: var(--surface-alt);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-family: inherit;
    font-size: 13px;
    color: var(--text);
    transition: all 0.15s ease;
}
.strength-btn:hover { border-color: var(--accent); color: var(--accent); }
.strength-btn.selected { background: var(--accent); color: white; border-color: var(--accent); }

/* Range tools */
.range-tools {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 18px 22px;
    margin-bottom: 18px;
}
.range-tools h3 { margin: 0 0 4px; font-size: 14px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-muted); }
.range-inputs { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; margin-top: 12px; }
.range-inputs label { display: flex; align-items: center; gap: 8px; font-size: 14px; color: var(--text-muted); }
.range-inputs input[type="number"] {
    width: 80px;
    padding: 8px 10px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-family: inherit;
    font-size: 14px;
    background: var(--surface);
    color: var(--text);
}

/* Mini list */
.ayah-list-wrap {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 18px 22px;
}
.ayah-list-wrap h3 {
    margin: 0 0 12px;
    font-size: 14px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-muted);
}
.ayah-mini-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(48px, 1fr));
    gap: 8px;
}
.ayah-mini-list li {
    text-align: center;
    padding: 10px 6px;
    background: var(--surface-alt);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 13px;
    font-variant-numeric: tabular-nums;
    transition: all 0.15s ease;
}
.ayah-mini-list li:hover { border-color: var(--accent); color: var(--accent); }
.ayah-mini-list li.current { background: var(--accent-soft); border-color: var(--accent); color: var(--accent-dark); font-weight: 600; }
.ayah-mini-list li.memorised { background: var(--accent); color: white; border-color: var(--accent); }
.ayah-mini-list li.bookmarked { box-shadow: inset 0 -3px 0 var(--warn); }

/* Stats grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 14px;
    margin: 20px 0 28px;
}
.stat-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 18px;
}
.stat-label {
    margin: 0 0 6px;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-muted);
    font-weight: 500;
}
.stat-value { margin: 0; font-size: 28px; font-weight: 600; font-variant-numeric: tabular-nums; }

.review-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 14px; margin: 16px 0 24px; }

/* Bookmarks */
.bookmarks-list {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 8px;
    margin-bottom: 24px;
}
.bookmark-row {
    display: flex; justify-content: space-between; align-items: center;
    gap: 12px; padding: 12px 16px; border-radius: var(--radius-sm);
    cursor: pointer;
}
.bookmark-row:hover { background: var(--surface-alt); }
.bookmark-row .bm-info { font-weight: 500; }
.bookmark-row .bm-arabic { font-family: var(--font-quran); font-size: 18px; color: var(--text-muted); direction: rtl; }
.bookmark-row .bm-remove {
    background: none; border: none; color: var(--text-muted); cursor: pointer; font-size: 16px;
    padding: 4px 8px;
}
.bookmark-row .bm-remove:hover { color: var(--danger); }

/* Progress list */
.progress-list {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 8px;
}
.progress-row {
    display: grid;
    grid-template-columns: 40px 1fr 100px 160px;
    align-items: center;
    gap: 16px;
    padding: 14px 16px;
    border-radius: var(--radius-sm);
}
.progress-row:hover { background: var(--surface-alt); cursor: pointer; }
.progress-row .num { color: var(--text-muted); font-variant-numeric: tabular-nums; }
.progress-row .name { font-weight: 500; }
.progress-row .count { color: var(--text-muted); font-size: 13px; font-variant-numeric: tabular-nums; }
.progress-row .bar { width: 100%; height: 6px; background: var(--border); border-radius: 999px; overflow: hidden; }
.progress-row .bar > div { height: 100%; background: var(--accent); }

/* Settings */
.settings-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 8px 24px;
    max-width: 640px;
    margin: 20px 0;
}
.settings-row {
    display: flex; justify-content: space-between; align-items: center;
    padding: 16px 0; border-bottom: 1px solid var(--border); gap: 16px;
}
.settings-row:last-of-type { border-bottom: none; }
.settings-row span { font-weight: 500; }
.settings-row input[type="number"], .settings-row select {
    padding: 8px 10px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-family: inherit;
    font-size: 14px;
    background: var(--surface);
    color: var(--text);
    min-width: 220px;
}
.settings-row input[type="checkbox"] { width: 20px; height: 20px; cursor: pointer; accent-color: var(--accent); }
.settings-row input[type="text"], .settings-row input[type="time"] {
    padding: 8px 10px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-family: inherit;
    font-size: 14px;
    background: var(--surface);
    color: var(--text);
    min-width: 220px;
}
.settings-row span small {
    display: block;
    font-weight: 400;
    font-size: 12px;
    margin-top: 2px;
}
.settings-row.settings-row-stack { align-items: flex-start; }
.settings-account-row {
    display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
    justify-content: flex-end;
}
.settings-h {
    margin: 0 -24px 4px;
    padding: 14px 24px 10px;
    font-size: 13px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-muted);
    border-bottom: 1px solid var(--border);
}
.settings-note { margin: 12px 0 4px; }
.settings-actions { padding: 16px 0; border-top: 1px solid var(--border); display: flex; gap: 10px; flex-wrap: wrap; }

/* Translation font-size hook (set as inline custom property in JS) */
.ayah-translation { font-size: var(--translation-font-size, 16px); }

/* Reduced motion: kill animations and transitions globally */
html.reduced-motion *,
html.reduced-motion *::before,
html.reduced-motion *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
}

.muted { color: var(--text-muted); }
.small { font-size: 13px; }

/* Bottom nav (mobile) */
.bottom-nav {
    display: none;
    position: fixed;
    bottom: 0; left: 0; right: 0;
    background: var(--surface);
    border-top: 1px solid var(--border);
    padding: 8px 4px calc(8px + var(--safe-bottom));
    z-index: 50;
    justify-content: space-around;
}
.bnav-btn {
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-family: inherit;
    font-size: 11px;
    padding: 6px 10px;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    flex: 1;
    border-radius: var(--radius-sm);
}
.bnav-btn.active { color: var(--accent); }
.bnav-ic {
    width: 28px; height: 28px;
    display: flex; align-items: center; justify-content: center;
    background: var(--surface-alt);
    border-radius: 8px;
    font-size: 12px;
    font-weight: 600;
}
.bnav-btn.active .bnav-ic { background: var(--accent-soft); color: var(--accent); }

/* Toast */
.toast {
    position: fixed;
    bottom: calc(80px + var(--safe-bottom));
    left: 50%;
    transform: translateX(-50%) translateY(20px);
    background: var(--text);
    color: var(--bg);
    padding: 10px 18px;
    border-radius: 999px;
    font-size: 14px;
    opacity: 0;
    pointer-events: none;
    transition: all 0.3s ease;
    z-index: 100;
    max-width: 90vw;
    text-align: center;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* Side panels (notes, tafsir) */
.side-panel {
    margin-top: 14px;
    padding: 14px;
    background: var(--surface-alt);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
}
.side-panel textarea {
    width: 100%;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--surface);
    color: var(--text);
    font-family: inherit;
    font-size: 14px;
    padding: 10px;
    resize: vertical;
    min-height: 80px;
}
.side-panel-actions { display: flex; gap: 8px; margin-top: 10px; flex-wrap: wrap; }
.tafsir-head {
    display: flex; align-items: center; gap: 10px; margin-bottom: 10px; flex-wrap: wrap;
}
.tafsir-head select {
    padding: 6px 10px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--surface);
    color: var(--text);
    font-family: inherit;
    font-size: 13px;
}
.small-btn { padding: 6px 12px !important; font-size: 13px !important; min-height: 32px !important; }
.tafsir-text {
    font-size: 14px;
    line-height: 1.7;
    color: var(--text);
    max-height: 320px;
    overflow-y: auto;
    padding-right: 6px;
}
.tafsir-text.arabic { font-family: var(--font-quran); font-size: 22px; line-height: 2; direction: rtl; text-align: right; }

/* Sidebar filters */
.sidebar-filters { display: flex; gap: 8px; margin-top: 8px; }
.sidebar-filters select {
    flex: 1;
    padding: 7px 10px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--surface-alt);
    color: var(--text);
    font-family: inherit;
    font-size: 13px;
}

/* Activity heatmap */
.heatmap {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px;
    overflow-x: auto;
    margin-bottom: 24px;
    display: flex;
    gap: 4px;
}
.heatmap-week { display: flex; flex-direction: column; gap: 4px; }
.heatmap-cell {
    width: 14px; height: 14px;
    border-radius: 3px;
    background: var(--border);
}
.heatmap-cell.l1 { background: color-mix(in srgb, var(--accent) 25%, var(--border)); }
.heatmap-cell.l2 { background: color-mix(in srgb, var(--accent) 50%, var(--border)); }
.heatmap-cell.l3 { background: color-mix(in srgb, var(--accent) 75%, var(--border)); }
.heatmap-cell.l4 { background: var(--accent); }
.heatmap-cell:hover { outline: 2px solid var(--accent); outline-offset: 1px; }

/* Notes list (reuse bookmarks styling but allow text wrap) */
.note-text {
    color: var(--text-muted);
    font-size: 13px;
    margin-top: 4px;
    white-space: pre-wrap;
    max-height: 80px;
    overflow: hidden;
}

/* Chain Builder */
.chain-tools { border-color: color-mix(in srgb, var(--accent) 35%, var(--border)); }
.badge {
    display: inline-block;
    background: var(--accent-soft);
    color: var(--accent-dark);
    padding: 2px 8px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    border-radius: 999px;
    margin-left: 8px;
    vertical-align: middle;
}
.chain-status {
    margin-top: 14px;
    padding: 12px 14px;
    background: var(--accent-soft);
    border-radius: var(--radius-sm);
}
.chain-stage-line {
    display: flex; justify-content: space-between; align-items: center;
    font-size: 13px; font-weight: 500; color: var(--accent-dark); margin-bottom: 8px;
}
.chain-stage-bar {
    width: 100%; height: 6px; background: var(--border);
    border-radius: 999px; overflow: hidden;
}
.chain-stage-bar > div {
    height: 100%; background: var(--accent); width: 0; transition: width 0.3s ease;
}
.chain-pitch { margin: 4px 0 10px; color: var(--text); font-size: 14px; line-height: 1.55; }
.chain-howto { margin: 0 0 12px; padding: 10px 14px; background: var(--surface-alt); border-radius: var(--radius-sm); font-size: 13.5px; }
.chain-howto summary { cursor: pointer; font-weight: 600; color: var(--accent-dark); }
.chain-howto ol { margin: 10px 0 4px; padding-left: 20px; line-height: 1.6; }
.chain-howto li { margin-bottom: 4px; }
.chain-stage-dots {
    display: flex; gap: 8px; justify-content: space-between; margin-bottom: 10px;
}
.chain-stage-dots .dot {
    flex: 1; display: flex; flex-direction: column; align-items: center;
    padding: 8px 4px; background: var(--surface); border: 1px solid var(--border);
    border-radius: var(--radius-sm); transition: all 0.25s ease; opacity: 0.55;
}
.chain-stage-dots .dot .n { font-weight: 700; font-size: 16px; color: var(--text-muted); }
.chain-stage-dots .dot .t { font-size: 11px; text-transform: uppercase; letter-spacing: 0.05em; color: var(--text-muted); margin-top: 2px; }
.chain-stage-dots .dot.active { opacity: 1; background: var(--accent); border-color: var(--accent); transform: translateY(-2px); }
.chain-stage-dots .dot.active .n, .chain-stage-dots .dot.active .t { color: white; }
.chain-stage-dots .dot.done { opacity: 1; background: var(--accent-soft); border-color: var(--accent); }
.chain-instruction {
    margin: 6px 0 10px; padding: 10px 12px; background: var(--surface);
    border-left: 3px solid var(--accent); border-radius: 4px;
    font-size: 14px; line-height: 1.5; color: var(--text); font-weight: 500;
}

/* Listen-first overlay */
.ayah-arabic.listen-first-hidden,
.first-letter-cue.listen-first-hidden { filter: blur(14px); user-select: none; cursor: pointer; }
.listen-first-reveal-btn {
    display: inline-block; margin: 8px auto; padding: 6px 14px;
    background: var(--accent); color: white; border: none; border-radius: var(--radius-sm);
    font-size: 13px; cursor: pointer;
}

/* Recitation comparison report */
.rec-report { margin-top: 14px; padding: 14px; background: var(--surface-alt); border-radius: var(--radius-sm); }
.rec-score-row { display: flex; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }
.rec-score {
    flex: 1; min-width: 90px; padding: 10px; background: var(--surface);
    border: 1px solid var(--border); border-radius: var(--radius-sm); text-align: center;
}
.rec-score-num { display: block; font-size: 24px; font-weight: 700; color: var(--accent-dark); }
.rec-score-lbl { display: block; font-size: 11px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-muted); margin-top: 2px; }
.rec-canvas { width: 100%; height: auto; max-width: 100%; background: var(--surface); border-radius: var(--radius-sm); border: 1px solid var(--border); }
.rec-feedback { margin-top: 10px; line-height: 1.55; }
.stat-value.small-value { font-size: 20px; }

/* Fade ladder */
.ayah-arabic.fade-1 { opacity: 0.7; }
.ayah-arabic.fade-2 { opacity: 0.45; }
.ayah-arabic.fade-3 { opacity: 0.22; }
.ayah-arabic.fade-4 { opacity: 0.05; }
.ayah-arabic { transition: opacity 0.5s ease; }

/* First-letter cue */
.first-letter-cue {
    font-family: var(--font-quran);
    font-size: 38px;
    line-height: 2;
    text-align: center;
    direction: rtl;
    color: var(--text);
    letter-spacing: 18px;
    word-spacing: 12px;
    padding: 24px 8px;
    background: var(--surface-alt);
    border-radius: var(--radius-sm);
    margin: 0 0 20px;
}
.first-letter-cue .cue {
    display: inline-block;
    padding: 0 4px;
    border-bottom: 2px solid var(--border);
    margin: 0 4px;
}

/* Mushaf page */
.mushaf-wrap {
    margin-top: 14px;
    padding: 12px;
    background: var(--surface-alt);
    border-radius: var(--radius-sm);
    text-align: center;
}
.mushaf-wrap img {
    max-width: 100%;
    height: auto;
    border-radius: var(--radius-sm);
    background: white;
    padding: 8px;
}
.mushaf-page {
    background: #fbf8ee;
    color: #1a1a1a;
    padding: 28px 22px;
    border-radius: var(--radius-sm);
    font-family: var(--font-quran);
    font-size: 28px;
    line-height: 2.2;
    text-align: justify;
    direction: rtl;
    max-height: 70vh;
    overflow-y: auto;
    border: 1px solid #d4caa7;
    box-shadow: inset 0 0 30px rgba(120, 90, 30, 0.08);
}
[data-theme="dark"] .mushaf-page {
    background: #2a261d;
    color: #f1ead7;
    border-color: #4a4231;
    box-shadow: inset 0 0 30px rgba(0, 0, 0, 0.3);
}
.mushaf-surah-header {
    display: block;
    text-align: center;
    font-size: 20px;
    font-weight: 700;
    color: var(--accent-dark);
    padding: 14px 8px 6px;
    margin: 14px 0 10px;
    border-top: 2px solid var(--accent);
    border-bottom: 2px solid var(--accent);
    background: color-mix(in srgb, var(--accent) 8%, transparent);
}
.mushaf-bismillah {
    display: block;
    text-align: center;
    font-size: 26px;
    margin: 6px 0 14px;
    color: var(--accent-dark);
}
.mushaf-ayah {
    cursor: pointer;
    transition: background 0.15s ease;
    border-radius: 4px;
    padding: 0 2px;
}
.mushaf-ayah:hover {
    background: color-mix(in srgb, var(--accent) 14%, transparent);
}
.mushaf-ayah.current {
    background: color-mix(in srgb, var(--accent) 28%, transparent);
    box-shadow: 0 0 0 2px var(--accent);
}
.mushaf-ayah-end {
    font-size: 0.7em;
    color: var(--accent-dark);
    margin: 0 4px;
}

/* Recorder */
.rec-active { background: var(--danger) !important; color: white !important; }

/* Weakness heatmap on mini list */
.ayah-mini-list li.s-1 { box-shadow: inset 0 0 0 2px #c44; }
.ayah-mini-list li.s-2 { box-shadow: inset 0 0 0 2px #d68b2c; }
.ayah-mini-list li.s-3 { box-shadow: inset 0 0 0 2px #6da64a; }
.ayah-mini-list li.s-4 { box-shadow: inset 0 0 0 2px var(--accent); }

/* Streak freeze pill */
.freeze-pill {
    display: inline-block;
    padding: 3px 10px;
    background: color-mix(in srgb, #2196d8 18%, var(--surface-alt));
    color: #2078b3;
    border: 1px solid color-mix(in srgb, #2196d8 35%, var(--border));
    border-radius: 999px;
    font-size: 12px;
    margin-left: 8px;
    font-weight: 500;
}
[data-theme="dark"] .freeze-pill { color: #6cc0f0; }

/* Scrollbar */
.surah-list::-webkit-scrollbar { width: 8px; }
.surah-list::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }
.surah-list::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

/* ------- Responsive ------- */
@media (max-width: 860px) {
    .container { padding: 0 16px; }
    .main-content { padding: 16px 16px 100px; }
    .top-nav { display: none; }
    .brand-subtitle { display: none; }
    .brand-title { font-size: 18px; }
    .layout { grid-template-columns: 1fr; }
    .sidebar {
        position: static;
        max-height: 60vh;
    }
    .bottom-nav { display: flex; }
    .ayah-card { padding: 16px; }
    .ayah-arabic { font-size: 30px; line-height: 1.9; }
    .bismillah { font-size: 24px; }
    .surah-header { padding: 14px 16px; }
    .surah-header h2 { font-size: 18px; }
    .surah-progress { min-width: 100%; }
    .audio-controls { gap: 10px; }
    .repeat-control { font-size: 13px; }
    .progress-row { grid-template-columns: 32px 1fr; gap: 8px; }
    .progress-row .count, .progress-row .bar { grid-column: 2; }
    .settings-row { flex-direction: column; align-items: flex-start; }
    .settings-row input[type="number"], .settings-row select { width: 100%; min-width: 0; }
    .stats-grid { grid-template-columns: repeat(2, 1fr); }
    .review-stats { grid-template-columns: repeat(3, 1fr); }
    .stat-value { font-size: 22px; }
    .empty-state { padding: 28px 16px; }
}

@media (max-width: 480px) {
    .header-inner { padding-top: 10px; padding-bottom: 10px; }
    .ayah-arabic { font-size: 26px; }
    .ayah-mini-list { grid-template-columns: repeat(auto-fill, minmax(42px, 1fr)); }
}

@media (display-mode: standalone) {
    .app-header { padding-top: max(var(--safe-top), 12px); }
}

/* ============ Consolidated UI: primary bar, mode chips, panels ============ */
.primary-bar {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    padding: 14px 0;
    border-top: 1px solid var(--border);
    border-bottom: 1px solid var(--border);
    margin: 14px 0;
}
.primary-bar .primary-btn,
.primary-bar .success-btn { padding: 10px 18px; font-size: 15px; }
.compact-select {
    padding: 9px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--surface);
    color: var(--text);
    font-family: inherit;
    font-size: 14px;
    cursor: pointer;
}
.actions-wrap { position: relative; margin-left: auto; }
.icon-round {
    width: 40px; height: 40px; padding: 0; border-radius: 50%;
    font-size: 22px; line-height: 1; display: inline-flex;
    align-items: center; justify-content: center;
    background: var(--surface-alt); border: 1px solid var(--border);
    cursor: pointer; color: var(--text);
}
.icon-round:hover { background: var(--accent-soft); }
.actions-menu {
    position: absolute;
    top: calc(100% + 8px); right: 0;
    min-width: 180px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    box-shadow: 0 8px 24px rgba(0,0,0,0.15);
    padding: 6px; z-index: 50;
    display: flex; flex-direction: column;
}
.actions-menu button {
    text-align: left; padding: 10px 14px; background: transparent;
    border: none; color: var(--text); font-size: 14px;
    border-radius: 6px; cursor: pointer; font-family: inherit;
}
.actions-menu button:hover { background: var(--accent-soft); }

/* Mode chips */
.mode-chips {
    display: flex; gap: 8px; flex-wrap: wrap;
    padding: 14px 0 12px;
    border-bottom: 1px solid var(--border);
    margin-bottom: 14px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}
.mode-chips .chip {
    padding: 8px 16px;
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--text-muted);
    border-radius: 999px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.15s ease;
    font-family: inherit;
}
.mode-chips .chip:hover { color: var(--text); border-color: var(--accent); }
.mode-chips .chip.active {
    background: var(--accent); color: white; border-color: var(--accent);
}
.mode-panel { padding: 4px 0 18px; }
.mode-panel.hidden { display: none; }
.mode-help { margin: 0 0 12px; }

/* Drill grid */
.drill-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 10px;
    margin: 6px 0 12px;
}
.toggle-card {
    display: flex; flex-direction: column; gap: 2px;
    padding: 12px 14px;
    background: var(--surface-alt);
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all 0.15s ease;
    position: relative;
    padding-left: 44px;
}
.toggle-card input[type="checkbox"] {
    position: absolute; left: 14px; top: 14px;
    width: 18px; height: 18px; cursor: pointer;
}
.toggle-card .t-title { font-size: 14px; font-weight: 600; color: var(--text); }
.toggle-card .t-sub { font-size: 12px; color: var(--text-muted); }
.toggle-card:has(input:checked) {
    border-color: var(--accent);
    background: var(--accent-soft);
}

@media (max-width: 480px) {
    .primary-bar { gap: 8px; }
    .primary-bar .primary-btn,
    .primary-bar .success-btn { padding: 9px 14px; font-size: 14px; }
    .compact-select { padding: 8px 10px; font-size: 13px; }
    .actions-wrap { margin-left: auto; }
    .drill-grid { grid-template-columns: 1fr 1fr; }
}

/* ================= Home dashboard ================= */
.home-dashboard { text-align: left; padding: 22px; }
.home-greeting { text-align: center; margin-bottom: 18px; }
.greeting-arabic { font-family: var(--font-quran); font-size: 28px; margin: 0 0 4px; color: var(--text); }
#greeting-line { margin: 0 0 4px; font-size: 22px; font-weight: 600; }
.greeting-meta { margin: 0; color: var(--text-muted); font-size: 13px; }
.dot-sep { margin: 0 6px; opacity: 0.6; }

.home-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 18px; }
.stat-tile {
    display: flex; align-items: center; gap: 12px;
    background: var(--surface-alt); border: 1px solid var(--border);
    border-radius: var(--radius); padding: 14px; cursor: pointer;
    text-align: left; transition: transform .12s ease, border-color .12s ease;
}
.stat-tile:hover { transform: translateY(-1px); border-color: var(--accent); }
.stat-tile-text { display: flex; flex-direction: column; }
.stat-tile-num { margin: 0; font-size: 22px; font-weight: 700; color: var(--text); line-height: 1.1; }
.stat-divider { color: var(--text-muted); margin: 0 2px; font-weight: 500; }
.stat-tile-suffix { font-size: 14px; color: var(--text-muted); margin-left: 2px; font-weight: 500; }
.stat-tile-lbl { margin: 2px 0 0; font-size: 12px; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.05em; }
.stat-tile-icon { font-size: 22px; color: var(--accent); width: 36px; text-align: center; }
.stat-ring { width: 44px; height: 44px; transform: rotate(-90deg); }
.ring-bg { fill: none; stroke: var(--border); stroke-width: 6; }
.ring-fg { fill: none; stroke: var(--accent); stroke-width: 6; stroke-linecap: round;
    stroke-dasharray: 163.36; stroke-dashoffset: 163.36; transition: stroke-dashoffset .5s ease; }

.home-card {
    background: var(--surface-alt); border: 1px solid var(--border);
    border-radius: var(--radius); padding: 16px; margin-top: 14px;
}
.card-eyebrow { margin: 0 0 6px; font-size: 11px; text-transform: uppercase;
    letter-spacing: 0.08em; color: var(--text-muted); font-weight: 600; }
.card-actions { display: flex; gap: 8px; margin-top: 10px; }

.resume-card { display: flex; gap: 14px; align-items: center; justify-content: space-between; }
.resume-info { flex: 1; min-width: 0; }
.resume-info h3 { margin: 0 0 4px; font-size: 17px; }
.resume-arabic { font-family: var(--font-quran); font-size: 22px; line-height: 1.7;
    margin: 6px 0; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.home-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-top: 14px; }
.home-grid .home-card { margin-top: 0; }
.vod-arabic { font-family: var(--font-quran); font-size: 26px; line-height: 1.9;
    margin: 8px 0; color: var(--text); }
.vod-translation { color: var(--text-muted); font-size: 14px; line-height: 1.55; margin: 6px 0 0; }
.suggest-card h3 { margin: 0 0 4px; font-size: 16px; }
.suggest-arabic { font-family: var(--font-quran); font-size: 22px; line-height: 1.7;
    margin: 8px 0 0; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.continue-list, .bookmarks-list { list-style: none; margin: 0; padding: 0; }
.continue-list li, .bookmarks-list li {
    display: flex; align-items: center; gap: 12px; padding: 10px 0;
    border-bottom: 1px solid var(--border); cursor: pointer;
}
.continue-list li:last-child, .bookmarks-list li:last-child { border-bottom: none; }
.continue-list li:hover, .bookmarks-list li:hover { background: var(--surface); }
.continue-num { width: 28px; height: 28px; border-radius: 50%; background: var(--accent);
    color: #fff; display: grid; place-items: center; font-size: 12px; font-weight: 600; flex-shrink: 0; }
.continue-meta { flex: 1; min-width: 0; }
.continue-meta strong { display: block; font-size: 14px; }
.continue-bar { height: 4px; background: var(--border); border-radius: 2px; margin-top: 6px; overflow: hidden; }
.continue-bar > div { height: 100%; background: var(--accent); transition: width .3s; }
.continue-pct { font-size: 12px; color: var(--text-muted); width: 42px; text-align: right; flex-shrink: 0; }
.bm-arabic { font-family: var(--font-quran); font-size: 18px; flex: 1; min-width: 0;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis; direction: rtl; text-align: right; }
.bm-loc { font-size: 12px; color: var(--text-muted); flex-shrink: 0; }

.spark-card { padding: 14px 16px; }
.spark-head { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 6px; }
.spark-svg { width: 100%; height: 60px; display: block; }
.spark-bar { fill: var(--accent); opacity: 0.85; }
.spark-bar.dim { opacity: 0.25; }
.spark-label { font-size: 9px; fill: var(--text-muted); }

.home-quick { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 14px; justify-content: center; }

@media (max-width: 720px) {
    .home-stats { grid-template-columns: 1fr 1fr; }
    .home-grid { grid-template-columns: 1fr; }
    .resume-card { flex-direction: column; align-items: stretch; }
    .resume-card .primary-btn { width: 100%; }
}
@media (max-width: 480px) {
    .home-dashboard { padding: 14px; }
    .greeting-arabic { font-size: 24px; }
    #greeting-line { font-size: 18px; }
    .stat-tile { padding: 10px; gap: 8px; }
    .stat-tile-num { font-size: 18px; }
    .vod-arabic { font-size: 22px; }
}

/* ================= Splash screen ================= */
.splash {
    position: fixed; inset: 0; z-index: 9999;
    background: radial-gradient(ellipse at top, #1f6f5c 0%, #0e3d34 70%, #0a2a24 100%);
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    gap: 16px; color: #fffaf1;
    animation: splashFadeOut 360ms ease 1.4s forwards;
}
.splash.is-hidden { display: none; }
.splash-logo { position: relative; width: 120px; height: 120px;
    animation: splashLogoIn 520ms cubic-bezier(.2,.8,.2,1.05) both;
    filter: drop-shadow(0 12px 32px rgba(0,0,0,0.4));
}
.splash-logo svg { position: relative; z-index: 2; }
.splash-pulse {
    position: absolute; inset: -10px; border-radius: 28px;
    border: 2px solid rgba(255,250,241,0.45);
    animation: splashPulse 1.6s ease-out infinite;
}
.splash-title { margin: 8px 0 0; font-size: 22px; font-weight: 600; letter-spacing: 0.02em;
    animation: splashFadeIn 600ms ease 200ms both; }
.splash-tagline { margin: 0; font-family: var(--font-quran); font-size: 32px;
    color: #e9dcb6; opacity: 0.95;
    animation: splashFadeIn 700ms ease 350ms both; }
.splash-bar { width: 140px; height: 3px; border-radius: 2px;
    background: rgba(255,250,241,0.18); overflow: hidden; margin-top: 10px;
    animation: splashFadeIn 600ms ease 500ms both; }
.splash-bar-fill { width: 30%; height: 100%; background: #f0e7d3;
    animation: splashSlide 1.1s linear infinite; border-radius: 2px; }

@keyframes splashLogoIn {
    0%   { transform: scale(0.5) rotate(-8deg); opacity: 0; }
    60%  { transform: scale(1.08) rotate(2deg); opacity: 1; }
    100% { transform: scale(1) rotate(0); opacity: 1; }
}
@keyframes splashFadeIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
@keyframes splashPulse {
    0%   { transform: scale(0.9); opacity: 0.7; }
    100% { transform: scale(1.5); opacity: 0; }
}
@keyframes splashSlide {
    0%   { transform: translateX(-100%); }
    100% { transform: translateX(366%); }
}
@keyframes splashFadeOut { to { opacity: 0; visibility: hidden; pointer-events: none; } }
@media (prefers-reduced-motion: reduce) {
    .splash, .splash-logo, .splash-pulse, .splash-bar-fill { animation: none !important; }
    .splash { animation: splashFadeOut 200ms ease 600ms forwards !important; }
}

/* ================= Drive Mode ================= */
.drive-view { padding: 0 !important; }
.drive-shell {
    min-height: calc(100vh - 140px);
    background: linear-gradient(180deg, #0e1e1a 0%, #0a1614 100%);
    color: #f3ece0; border-radius: 14px; padding: 18px;
    display: flex; flex-direction: column; gap: 16px;
}
.drive-topbar { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 8px; }
.drive-mini-btn {
    background: rgba(255,255,255,0.08); color: #f3ece0; border: 1px solid rgba(255,255,255,0.12);
    padding: 8px 14px; border-radius: 999px; cursor: pointer; font-size: 14px;
}
.drive-mini-btn:hover { background: rgba(255,255,255,0.14); }
.drive-status { display: flex; gap: 8px; flex-wrap: wrap; font-size: 14px; opacity: 0.85; align-items: center; }
.drive-dot { opacity: 0.4; }
.drive-flags { display: flex; gap: 6px; }
.drive-flag {
    font-size: 11px; text-transform: uppercase; letter-spacing: 0.06em;
    padding: 4px 10px; border-radius: 999px; background: rgba(60,180,140,0.18);
    color: #7fdcc1; border: 1px solid rgba(127,220,193,0.25);
}
.drive-flag.off { background: rgba(255,255,255,0.05); color: #aaa; border-color: rgba(255,255,255,0.1); }

.drive-arabic-wrap {
    flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center;
    text-align: center; padding: 22px 12px; min-height: 240px;
    background: rgba(255,255,255,0.03); border-radius: 14px; border: 1px solid rgba(255,255,255,0.06);
}
.drive-arabic {
    font-family: var(--font-quran);
    font-size: clamp(34px, 6vw, 64px); line-height: 1.9; margin: 0; color: #fffaf1;
    text-shadow: 0 1px 0 rgba(0,0,0,0.3); max-width: 1100px;
}
.drive-translation { margin: 14px 0 0; font-size: clamp(15px, 1.5vw, 18px);
    color: #c9d6cf; max-width: 800px; line-height: 1.55; }

.drive-controls { display: flex; align-items: center; justify-content: center; gap: 22px; }
.drive-side-btn {
    width: 76px; height: 76px; border-radius: 50%;
    background: rgba(255,255,255,0.08); color: #fffaf1; font-size: 38px; line-height: 1;
    border: 1px solid rgba(255,255,255,0.12); cursor: pointer;
    transition: transform .12s ease, background .12s ease;
}
.drive-side-btn:hover { background: rgba(255,255,255,0.16); transform: scale(1.04); }
.drive-side-btn:active { transform: scale(0.96); }
.drive-play-btn {
    width: 120px; height: 120px; border-radius: 50%;
    background: linear-gradient(180deg, #2da387 0%, #1f6f5c 100%); color: #fffaf1;
    font-size: 46px; line-height: 1; border: none; cursor: pointer;
    box-shadow: 0 12px 40px rgba(31,111,92,0.45), inset 0 1px 0 rgba(255,255,255,0.25);
    transition: transform .12s ease;
}
.drive-play-btn:hover { transform: scale(1.04); }
.drive-play-btn:active { transform: scale(0.97); }
.drive-play-btn.is-playing { background: linear-gradient(180deg, #d4a83c 0%, #a07b14 100%);
    box-shadow: 0 12px 40px rgba(212,168,60,0.45), inset 0 1px 0 rgba(255,255,255,0.25); }

.drive-options { display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; }
.drive-chip {
    background: rgba(255,255,255,0.07); color: #f3ece0; border: 1px solid rgba(255,255,255,0.12);
    padding: 12px 18px; border-radius: 999px; cursor: pointer; font-size: 14px;
    transition: background .12s ease;
}
.drive-chip:hover { background: rgba(255,255,255,0.14); }
.drive-chip strong { color: #ffd479; margin-left: 4px; }
.drive-chip.is-on strong { color: #7fdcc1; }
.drive-hint { text-align: center; color: #97a39b; font-size: 13px; line-height: 1.55;
    padding: 6px 12px; max-width: 720px; margin: 0 auto; }
.drive-hint em { color: #ffd479; font-style: normal; padding: 1px 5px;
    background: rgba(255,212,121,0.08); border-radius: 4px; }

@media (max-width: 600px) {
    .drive-side-btn { width: 64px; height: 64px; font-size: 32px; }
    .drive-play-btn { width: 100px; height: 100px; font-size: 40px; }
    .drive-controls { gap: 14px; }
    .drive-chip { padding: 10px 14px; font-size: 13px; }
    .drive-status { font-size: 12px; }
}

/* ============================================================
   Drive Mode v2, clean, mobile, handsfree
   ============================================================ */
.drive-view { padding: 0; }
.drive-view .drive-shell {
    background: linear-gradient(180deg, #0c1f1a 0%, #061410 100%);
    color: #f1f6f4;
    min-height: calc(100vh - 56px);
    display: flex;
    flex-direction: column;
    padding: 14px 18px 28px;
    box-sizing: border-box;
    border-radius: 0;
    box-shadow: none;
    gap: 16px;
}
.drive-head {
    display: flex; align-items: center; gap: 10px;
    padding: 6px 0 4px;
}
.drive-head-mid { flex: 1; text-align: center; min-width: 0; }
.drive-head-title {
    font-weight: 600; font-size: 15px; letter-spacing: .2px;
    color: #f1f6f4;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.drive-head-sub {
    font-size: 12px; color: #88a59d; margin-top: 2px;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.drive-icon-btn {
    background: rgba(255,255,255,.06);
    border: 0; color: #d8e6e1;
    width: 40px; height: 40px;
    border-radius: 50%;
    display: inline-flex; align-items: center; justify-content: center;
    cursor: pointer; transition: background .15s;
    flex-shrink: 0;
}
.drive-icon-btn:hover, .drive-icon-btn:active {
    background: rgba(255,255,255,.12);
}

.drive-stage {
    flex: 1;
    display: flex; flex-direction: column;
    align-items: center; justify-content: center;
    text-align: center;
    padding: 18px 6px;
    min-height: 220px;
}
.drive-arabic {
    font-family: var(--font-quran);
    font-size: clamp(34px, 7vw, 56px);
    line-height: 1.85;
    color: #fff;
    margin: 0 0 14px;
    word-wrap: break-word;
    max-width: 760px;
    text-shadow: 0 2px 10px rgba(0,0,0,.25);
}
.drive-translation {
    font-size: clamp(15px, 2.2vw, 18px);
    color: #b8cdc6;
    line-height: 1.5;
    margin: 0;
    max-width: 600px;
    font-style: italic;
}

.drive-progress {
    display: flex; align-items: center; gap: 10px;
    padding: 0 4px;
    font-variant-numeric: tabular-nums;
}
.drive-loop, .drive-time {
    font-size: 11px; color: #7e9a92; min-width: 48px;
    letter-spacing: .4px;
}
.drive-time { text-align: right; }
.drive-bar {
    flex: 1; height: 4px;
    background: rgba(255,255,255,.08);
    border-radius: 4px; overflow: hidden;
}
.drive-bar-fill {
    height: 100%; width: 0;
    background: linear-gradient(90deg, #2bb98a, #d4af6a);
    transition: width .2s linear;
}

.drive-controls {
    display: flex; align-items: center; justify-content: center;
    gap: 28px; padding: 4px 0 6px;
}
.drive-side-btn {
    background: rgba(255,255,255,.06); border: 0;
    width: 64px; height: 64px; border-radius: 50%;
    color: #e6f0ec; cursor: pointer;
    display: inline-flex; align-items: center; justify-content: center;
    transition: background .15s, transform .1s;
}
.drive-side-btn:hover { background: rgba(255,255,255,.12); }
.drive-side-btn:active { transform: scale(.94); }
.drive-play-btn {
    background: #fff; color: #0c1f1a;
    border: 0; width: 88px; height: 88px; border-radius: 50%;
    cursor: pointer;
    display: inline-flex; align-items: center; justify-content: center;
    box-shadow: 0 8px 24px rgba(0,0,0,.35), 0 0 0 0 rgba(43,185,138,.0);
    transition: transform .15s, box-shadow .25s;
}
.drive-play-btn:active { transform: scale(.96); }
.drive-play-btn.is-playing {
    background: #d4af6a;
    box-shadow: 0 8px 24px rgba(0,0,0,.35), 0 0 0 8px rgba(212,175,106,.15);
}

.drive-quick {
    display: flex; gap: 8px; justify-content: center; flex-wrap: wrap;
    padding-top: 4px;
}
.drive-chip {
    background: rgba(255,255,255,.06);
    color: #d8e6e1;
    border: 1px solid rgba(255,255,255,.08);
    border-radius: 999px;
    padding: 8px 14px;
    font-size: 13px;
    cursor: pointer;
    transition: background .15s, border-color .15s;
    display: inline-flex; align-items: center; gap: 5px;
}
.drive-chip strong { color: #fff; font-weight: 600; }
.drive-chip:hover { background: rgba(255,255,255,.1); border-color: rgba(255,255,255,.15); }
.drive-chip.is-on { background: rgba(43,185,138,.18); border-color: rgba(43,185,138,.4); color: #aef0d0; }
.drive-chip.is-on strong { color: #d4ffe9; }

.drive-sheet {
    background: rgba(255,255,255,.04);
    border: 1px solid rgba(255,255,255,.06);
    border-radius: 14px;
    padding: 14px 16px;
    display: flex; flex-direction: column; gap: 12px;
    margin-top: 4px;
}
.drive-sheet[hidden] { display: none; }
.drive-sheet-row {
    display: flex; align-items: center; justify-content: space-between;
    gap: 10px;
}
.drive-sheet-row label { font-size: 13px; color: #b8cdc6; }
.drive-pill {
    background: rgba(255,255,255,.08); border: 0; color: #f1f6f4;
    border-radius: 999px; padding: 6px 12px; font-size: 13px;
    cursor: pointer;
}
.drive-pill:hover { background: rgba(255,255,255,.14); }
.drive-pill strong { color: #fff; font-weight: 600; }
.drive-hint {
    margin: 4px 0 0; padding: 0;
    font-size: 12px; color: #7e9a92; line-height: 1.55;
}
.drive-hint em { color: #b8cdc6; font-style: normal; font-weight: 600; }

@media (min-width: 720px) {
    .drive-view .drive-shell {
        max-width: 720px;
        margin: 24px auto;
        min-height: 0;
        border-radius: 22px;
        box-shadow: 0 18px 60px rgba(0,0,0,.25);
        padding: 24px 32px 32px;
    }
}

/* ============================================================
   Hafiz Teacher report card
   ============================================================ */
.hafiz-report {
    margin-top: 18px;
    padding: 16px 18px;
    border-radius: 14px;
    background: linear-gradient(180deg, #ffffff 0%, #fbfaf6 100%);
    border: 1px solid #e7ddc9;
    box-shadow: 0 2px 8px rgba(31,111,92,.06);
}
.hafiz-report.hidden { display: none; }
.hafiz-head {
    display: flex; gap: 16px; align-items: flex-start;
    padding-bottom: 12px; border-bottom: 1px dashed #e7ddc9;
    margin-bottom: 12px;
}
.hafiz-grade-wrap {
    display: flex; flex-direction: column; align-items: center;
    flex-shrink: 0; min-width: 72px;
}
.hafiz-grade {
    font-size: 44px; font-weight: 700; line-height: 1;
    color: var(--accent, #1f6f5c);
    font-family: Georgia, 'Amiri', serif;
}
.hafiz-grade.is-A { color: #1f8a5c; }
.hafiz-grade.is-B { color: #4a8a1f; }
.hafiz-grade.is-C { color: #b58508; }
.hafiz-grade.is-D { color: #b75c1c; }
.hafiz-grade.is-F { color: #a83232; }
.hafiz-grade-lbl { font-size: 11px; color: #888; margin-top: 2px; letter-spacing: .5px; text-transform: uppercase; }
.hafiz-summary { flex: 1; }
.hafiz-verdict { margin: 0 0 4px; font-size: 14px; line-height: 1.5; color: #333; font-weight: 500; }
.hafiz-tally { margin: 0; }

.hafiz-words {
    display: flex; flex-wrap: wrap; gap: 6px;
    padding: 6px 0 10px;
    direction: rtl;
}
.hafiz-word {
    padding: 4px 9px; border-radius: 6px;
    font-family: var(--font-quran);
    font-size: 22px; line-height: 1.4;
    background: #f0f7f4; color: #1a3d34;
    cursor: help;
    border-bottom: 3px solid #cfe5dc;
    transition: transform .12s;
}
.hafiz-word:hover { transform: translateY(-1px); }
.hafiz-word.ok { background: #e7f5ee; border-bottom-color: #2bb98a; }
.hafiz-word.warn { background: #fff5d8; border-bottom-color: #d4af6a; color: #6d4f08; }
.hafiz-word.bad { background: #fde6e6; border-bottom-color: #c44; color: #7d1d1d; }
.hafiz-word.miss { background: #f3f3f3; border-bottom-color: #999; color: #777; text-decoration: line-through; }

.hafiz-section { margin-top: 10px; }
.hafiz-section h4 {
    margin: 8px 0 4px; font-size: 13px;
    color: #1f6f5c; text-transform: uppercase; letter-spacing: .5px;
}
.hafiz-section ul, .hafiz-section ol { margin: 0; padding-left: 20px; line-height: 1.55; font-size: 13.5px; color: #333; }
.hafiz-section li { margin-bottom: 4px; }
.hafiz-section li strong { color: #1a3d34; }
.hafiz-section li em { color: #888; font-style: normal; font-size: 12px; margin-left: 4px; }

/* ============================================================
   Home v2, clean, simple, professional
   ============================================================ */
.home-v2 {
    max-width: 760px;
    margin: 0 auto;
    padding: 28px 20px 56px;
    display: flex; flex-direction: column;
    gap: 28px;
}

/* Greeting */
.home-hero-head { text-align: center; padding: 8px 0 4px; }
.home-bismillah {
    font-family: var(--font-quran);
    font-size: clamp(20px, 3vw, 26px);
    color: #1f6f5c;
    margin: 0 0 14px;
    line-height: 1.7;
    font-weight: 500;
    opacity: .92;
}
.home-greet {
    font-size: clamp(24px, 3.2vw, 30px);
    margin: 0 0 6px;
    font-weight: 600;
    letter-spacing: -.4px;
    color: #102a23;
}
.home-dates {
    margin: 0; font-size: 13px; color: #8a9a93;
    display: flex; justify-content: center; gap: 8px;
    font-variant-numeric: tabular-nums;
}
.home-dot { color: #c9d4cf; }

.home-eyebrow {
    font-size: 10.5px; letter-spacing: 1.2px; text-transform: uppercase;
    color: #7a9990; margin: 0 0 8px; font-weight: 600;
}

/* Hero card, Continue / Start */
.home-hero {
    position: relative;
    border-radius: 20px;
    overflow: hidden;
    background: linear-gradient(135deg, #1f6f5c 0%, #0e453b 100%);
    color: #fff;
    box-shadow: 0 14px 38px -12px rgba(15, 79, 67, .35);
}
.home-hero-bg {
    position: absolute; inset: 0;
    background-image:
        radial-gradient(circle at 92% 8%, rgba(212,175,106,.20) 0%, transparent 42%),
        radial-gradient(circle at 8% 96%, rgba(255,255,255,.06) 0%, transparent 45%);
    pointer-events: none;
}
.home-hero-body {
    position: relative; z-index: 1;
    padding: 26px 28px 26px;
}
.home-hero .home-eyebrow { color: rgba(255,255,255,.6); margin-bottom: 10px; }
.home-hero-title {
    margin: 0 0 10px; font-size: clamp(20px, 2.8vw, 26px);
    font-weight: 600; letter-spacing: -.3px; line-height: 1.25;
}
.home-hero-arabic {
    margin: 0 0 14px;
    font-family: var(--font-quran);
    font-size: clamp(24px, 3.6vw, 32px);
    line-height: 1.95;
    color: #fff; opacity: 1;
    font-weight: 500;
    text-shadow: 0 1px 2px rgba(0,0,0,.18);
}
.home-hero-meta {
    margin: 0 0 18px;
    font-size: 14px;
    color: rgba(255,255,255,.78); line-height: 1.55;
    max-width: 480px;
}
.home-hero-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.home-hero-actions .primary-btn {
    background: #fff; color: #0e453b;
    border: 0; padding: 10px 22px; border-radius: 999px;
    font-weight: 600; font-size: 14px; cursor: pointer;
    transition: transform .12s ease, box-shadow .15s ease;
}
.home-hero-actions .primary-btn:hover { transform: translateY(-1px); box-shadow: 0 8px 18px rgba(0,0,0,.22); }
.home-hero-actions .ghost-btn {
    background: rgba(255,255,255,.10);
    color: #fff;
    border: 1px solid rgba(255,255,255,.22);
    padding: 10px 20px; border-radius: 999px;
    font-weight: 500; font-size: 14px; cursor: pointer;
    transition: background .15s ease;
}
.home-hero-actions .ghost-btn:hover { background: rgba(255,255,255,.18); }

/* Stats strip */
.home-stats-row {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 0;
    background: #fff;
    border: 1px solid #e6ebe8;
    border-radius: 14px;
    overflow: hidden;
}
.home-stat {
    background: transparent;
    border: 0;
    border-right: 1px solid #eef1ef;
    padding: 18px 12px;
    cursor: pointer;
    text-align: center;
    transition: background .15s ease;
    display: flex; flex-direction: column; align-items: center; gap: 8px;
    position: relative;
}
.home-stat:last-child { border-right: 0; }
.home-stat:hover { background: #f7faf8; }
.home-stat-text { display: flex; flex-direction: column; align-items: center; gap: 4px; }
.home-stat-num {
    font-size: 24px; font-weight: 700; color: #102a23;
    line-height: 1; font-variant-numeric: tabular-nums;
    letter-spacing: -.5px;
    display: inline-flex; align-items: baseline; gap: 1px;
}
.home-stat-divider {
    color: #c5d2cc; font-weight: 500; font-size: 20px;
    margin: 0 2px; line-height: 1;
}
.home-stat-suffix {
    color: #8a9a93; font-weight: 600; font-size: 14px;
    margin-left: 1px;
}
.home-stat-sub {
    font-size: 10px; color: #a3b3ad;
    letter-spacing: .4px; text-transform: uppercase;
    font-weight: 500; margin-top: 2px;
}
.home-stat-lbl {
    font-size: 10.5px; color: #7a9990;
    letter-spacing: .8px; text-transform: uppercase;
    font-weight: 600;
}
.home-ring { width: 30px; height: 30px; transform: rotate(-90deg); }
.home-ring-bg { fill: none; stroke: #e8ede9; stroke-width: 3; }
.home-ring-fg {
    fill: none; stroke: #1f6f5c; stroke-width: 3;
    stroke-linecap: round;
    stroke-dasharray: 94.25;
    stroke-dashoffset: 94.25;
    transition: stroke-dashoffset .6s ease;
}

/* Verse of the day */
.home-vod {
    background: #fff;
    border: 1px solid #e6ebe8;
    border-radius: 16px;
    padding: 26px 28px;
    text-align: center;
}
.home-vod .home-eyebrow { color: #b58508; }
.home-vod-arabic {
    font-family: var(--font-quran);
    font-size: clamp(22px, 3.4vw, 30px);
    line-height: 2.1;
    margin: 8px 0 14px;
    color: #102a23;
    word-wrap: break-word;
}
.home-vod-trans {
    font-size: 14px; line-height: 1.65;
    color: #5e6c66; margin: 0 0 18px;
    max-width: 540px; margin-left: auto; margin-right: auto;
}
.home-vod-actions {
    display: flex; gap: 8px; justify-content: center;
}
.home-vod-actions .small-btn {
    padding: 8px 18px; border-radius: 999px;
    font-size: 13px; font-weight: 500;
}

/* 7-day sparkline */
.home-spark {
    background: #fff;
    border: 1px solid #e6ebe8;
    border-radius: 14px;
    padding: 16px 20px;
}
.home-spark-head {
    display: flex; justify-content: space-between; align-items: baseline;
    margin-bottom: 8px;
}
.home-spark-total {
    font-size: 14px; color: #102a23; font-weight: 600;
    font-variant-numeric: tabular-nums;
}
.home-spark .spark-svg { width: 100%; height: 56px; }

/* Quick actions */
.home-actions-row {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
}
.home-action {
    background: #fff;
    border: 1px solid #e6ebe8;
    border-radius: 12px;
    padding: 14px 16px;
    font-size: 14px;
    font-weight: 500;
    color: #102a23;
    text-align: center;
    cursor: pointer;
    transition: border-color .15s ease, transform .12s ease, background .15s ease;
}
.home-action:hover {
    border-color: #1f6f5c;
    transform: translateY(-1px);
    background: #f7faf8;
}

@media (min-width: 600px) {
    .home-actions-row { grid-template-columns: repeat(4, 1fr); }
}
@media (max-width: 480px) {
    .home-stats-row { grid-template-columns: 1fr 1fr; }
    .home-stat { border-right: 1px solid #eef1ef; }
    .home-stat:nth-child(2) { border-right: 0; }
    .home-stat:nth-child(1), .home-stat:nth-child(2) { border-bottom: 1px solid #eef1ef; }
    .home-hero-body { padding: 22px 20px; }
    .home-vod { padding: 22px 18px; }
    .home-v2 { padding: 20px 14px 40px; gap: 22px; }
}

/* Dark mode */
[data-theme="dark"] .home-greet,
[data-theme="dark"] .home-stat-num,
[data-theme="dark"] .home-spark-total,
[data-theme="dark"] .home-vod-arabic,
[data-theme="dark"] .home-action { color: #e6f0ec; }
[data-theme="dark"] .home-bismillah { color: #6fc2ad; }
[data-theme="dark"] .home-stats-row,
[data-theme="dark"] .home-spark,
[data-theme="dark"] .home-vod,
[data-theme="dark"] .home-action { background: #15211d; border-color: #25342f; }
[data-theme="dark"] .home-stat { border-right-color: #25342f; }
[data-theme="dark"] .home-stat:hover,
[data-theme="dark"] .home-action:hover { background: #1a2a25; }
[data-theme="dark"] .home-vod-trans { color: #a3b3ad; }
[data-theme="dark"] .home-dot { color: #3a4742; }
[data-theme="dark"] .home-dates { color: #7a8a85; }

/* ===== Grammar panel ===== */
.grammar-tabs {
    display: flex; gap: 6px; flex-wrap: wrap;
    border-bottom: 1px solid #e6ebe8;
    margin-bottom: 14px; padding-bottom: 8px;
}
.grammar-tab {
    background: transparent; border: 0;
    padding: 6px 12px; border-radius: 999px;
    font-size: 13px; font-weight: 500;
    color: #5e6c66; cursor: pointer;
    transition: background .15s, color .15s;
}
.grammar-tab:hover { background: #f0f5f2; color: #102a23; }
.grammar-tab.active {
    background: #1f6f5c; color: #fff;
}
.grammar-pane.hidden { display: none; }

.grammar-verse {
    display: flex; flex-wrap: wrap; gap: 10px;
    direction: rtl;
    padding: 8px 0 4px;
}
.gw-card {
    background: #fff;
    border: 1px solid #e6ebe8;
    border-radius: 12px;
    padding: 12px 14px 10px;
    min-width: 130px;
    text-align: center;
    transition: border-color .15s, transform .12s;
}
.gw-card.known { border-color: #1f6f5c; }
.gw-card.unknown { background: #fafaf7; border-style: dashed; }
.gw-card:hover { transform: translateY(-1px); border-color: #1f6f5c; }
.gw-word {
    font-family: var(--font-quran);
    font-size: 24px;
    line-height: 1.5;
    color: #102a23;
    margin: 0 0 6px;
}
.gw-translit {
    font-size: 11px; color: #7a9990; font-style: italic;
    direction: ltr; margin: 0 0 3px; letter-spacing: .2px;
}
.gw-gloss {
    font-size: 13px; color: #1f6f5c; font-weight: 600;
    direction: ltr; margin: 0 0 4px;
}
.gw-meta {
    font-size: 11px; color: #7a9990;
    letter-spacing: .3px;
    direction: ltr; margin: 0;
    display: flex; justify-content: center; gap: 6px;
}
.gw-meta .gw-pos {
    background: #eef5f1; color: #1f6f5c;
    padding: 2px 7px; border-radius: 999px;
    font-weight: 600; text-transform: uppercase; font-size: 10px;
    letter-spacing: .6px;
}
.gw-meta .gw-root {
    font-family: var(--font-quran); font-size: 14px; color: #b58508;
    direction: rtl; line-height: 1;
}
.grammar-coverage { margin-top: 10px; text-align: center; }

/* === Curriculum (Lessons tab) === */
.grammar-lessons { display: flex; flex-direction: column; gap: 12px; padding: 0; margin: 0; }
.gl-progress {
    background: #fff; border: 1px solid #e6ebe8; border-radius: 12px;
    padding: 12px 14px;
}
.gl-progress-text { font-size: 13px; color: #4a5852; margin-bottom: 8px; }
.gl-progress-bar { height: 8px; background: #eef5f1; border-radius: 999px; overflow: hidden; }
.gl-progress-fill { height: 100%; background: linear-gradient(90deg, #1f6f5c, #2da383); border-radius: 999px; transition: width .4s ease; }

.gl-chapter {
    background: #fff; border: 1px solid #e6ebe8; border-radius: 12px;
    padding: 0; overflow: hidden;
}
.gl-chapter > summary {
    list-style: none; cursor: pointer;
    padding: 14px 16px;
    display: flex; align-items: center; justify-content: space-between;
    font-weight: 600; color: #102a23;
}
.gl-chapter > summary::-webkit-details-marker { display: none; }
.gl-chapter > summary::after {
    content: '▾'; color: #7a9990; transition: transform .2s; margin-left: 8px;
}
.gl-chapter[open] > summary::after { transform: rotate(180deg); }
.gl-ch-title { font-size: 14.5px; }
.gl-ch-count {
    font-size: 11px; color: #1f6f5c; background: #eef5f1;
    padding: 3px 9px; border-radius: 999px; font-weight: 700; letter-spacing: .3px;
}
.gl-ch-intro { padding: 0 16px 6px; }
.gl-list { padding: 4px 16px 16px; display: flex; flex-direction: column; gap: 10px; }
.gl-lesson {
    background: #f7faf8; border: 1px solid #e6ebe8; border-radius: 10px;
    padding: 12px 14px;
    transition: border-color .2s, background .2s;
}
.gl-lesson.done { border-color: #1f6f5c; background: #effaf5; }
.gl-lesson h4 { margin: 0 0 6px; font-size: 14px; color: #102a23; font-weight: 600; }
.gl-lesson p { margin: 0 0 8px; font-size: 13.5px; color: #4a5852; line-height: 1.6; }
.gl-lesson .gl-example {
    background: #fff; border-left: 3px solid #1f6f5c;
    padding: 8px 12px; border-radius: 0 8px 8px 0;
    display: flex; flex-direction: column; gap: 3px;
    font-size: 13px; margin-bottom: 10px;
}
.gl-lesson .gl-ar { font-family: var(--font-quran); font-size: 18px; color: #102a23; direction: rtl; }
.gl-lesson .gl-tr { color: #5e6c66; font-style: italic; }
.gl-mark {
    background: transparent; color: #1f6f5c; border: 1px solid #1f6f5c;
    border-radius: 999px; padding: 5px 14px; font-size: 12px; font-weight: 600;
    cursor: pointer; transition: all .15s;
}
.gl-mark:hover { background: #1f6f5c; color: #fff; }
.gl-lesson.done .gl-mark { background: #1f6f5c; color: #fff; }

/* === Patterns tab === */
.gl-section-title { margin: 18px 0 10px; font-size: 14px; color: #1f6f5c; font-weight: 700; letter-spacing: .3px; text-transform: uppercase; }
.gp-table {
    width: 100%; border-collapse: collapse;
    background: #fff; border: 1px solid #e6ebe8; border-radius: 10px; overflow: hidden;
    font-size: 13px;
}
.gp-table th, .gp-table td { padding: 9px 10px; border-bottom: 1px solid #eef2f0; text-align: left; vertical-align: middle; }
.gp-table th { background: #f7faf8; color: #1f6f5c; font-weight: 700; font-size: 11px; text-transform: uppercase; letter-spacing: .4px; }
.gp-table tr:last-child td { border-bottom: 0; }
.gp-form { font-weight: 700; color: #b58508; width: 50px; }
.gp-pat, .gp-ex { font-family: var(--font-quran); font-size: 17px; color: #102a23; }

.gp-noun-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 10px; }
.gp-noun { background: #fff; border: 1px solid #e6ebe8; border-radius: 10px; padding: 12px; text-align: center; }
.gp-noun-pat { font-family: var(--font-quran); font-size: 22px; color: #b58508; margin: 0 0 4px; }
.gp-noun-en { font-size: 12px; color: #1f6f5c; font-weight: 600; margin: 0 0 4px; text-transform: uppercase; letter-spacing: .3px; }
.gp-noun-ex { font-size: 13px; color: #4a5852; margin: 0; }

/* === Expandable word card detail === */
.gw-card { cursor: pointer; transition: box-shadow .15s, border-color .15s; }
.gw-card:hover { border-color: #1f6f5c; box-shadow: 0 2px 8px rgba(31,111,92,.08); }
.gw-detail {
    display: none; margin-top: 10px; padding-top: 10px;
    border-top: 1px dashed #d3ddd8;
    text-align: left; direction: ltr;
}
.gw-card.expanded .gw-detail { display: block; }
.gw-detail-row {
    display: flex; align-items: baseline; gap: 8px;
    padding: 3px 0; font-size: 12.5px;
}
.gw-detail-k {
    flex: 0 0 78px; color: #7a9990; font-size: 10.5px;
    text-transform: uppercase; letter-spacing: .5px; font-weight: 700;
}
.gw-detail-v { flex: 1; color: #102a23; line-height: 1.5; }
.gw-detail-v[dir="rtl"] { font-family: var(--font-quran); font-size: 17px; }

.grammar-roots {
    display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
    gap: 10px;
}
.gr-card {
    background: #fff;
    border: 1px solid #e6ebe8;
    border-radius: 10px;
    padding: 12px;
    text-align: center;
}
.gr-root {
    font-family: var(--font-quran);
    font-size: 22px; color: #b58508;
    margin: 0 0 4px; direction: rtl;
}
.gr-meaning { font-size: 13px; color: #102a23; font-weight: 600; margin: 0 0 4px; }
.gr-count { font-size: 11px; color: #7a9990; letter-spacing: .4px; text-transform: uppercase; font-weight: 600; }

[data-theme="dark"] .grammar-tabs { border-bottom-color: #25342f; }
[data-theme="dark"] .grammar-tab { color: #a3b3ad; }
[data-theme="dark"] .grammar-tab:hover { background: #1a2a25; color: #e6f0ec; }
[data-theme="dark"] .gw-card,
[data-theme="dark"] .gr-card,
[data-theme="dark"] .gl-progress,
[data-theme="dark"] .gl-chapter,
[data-theme="dark"] .gp-table,
[data-theme="dark"] .gp-noun { background: #15211d; border-color: #25342f; }
[data-theme="dark"] .gl-lesson { background: #1a2a25; border-color: #25342f; }
[data-theme="dark"] .gl-lesson.done { background: #1d3a30; border-color: #2da383; }
[data-theme="dark"] .gw-card.unknown { background: #131c19; }
[data-theme="dark"] .gw-word,
[data-theme="dark"] .gl-lesson h4,
[data-theme="dark"] .gl-ch-title,
[data-theme="dark"] .gp-pat,
[data-theme="dark"] .gw-detail-v,
[data-theme="dark"] .gr-meaning { color: #e6f0ec; }
[data-theme="dark"] .gw-meta .gw-pos,
[data-theme="dark"] .gl-ch-count { background: #1f2e29; color: #6fc2ad; }
[data-theme="dark"] .gl-lesson .gl-example { background: #131c19; }
[data-theme="dark"] .gp-table th { background: #1a2a25; color: #6fc2ad; }
[data-theme="dark"] .gp-table th, [data-theme="dark"] .gp-table td { border-bottom-color: #25342f; }
[data-theme="dark"] .gw-detail { border-top-color: #25342f; }
[data-theme="dark"] .grammar-lessons .gl-ar { color: #e6f0ec; }

/* ===== Hafiz Live (speech-to-text recitation analyser) ===== */
.mode-help { margin: 0 0 12px; }
.hafiz-live-card {
    background: linear-gradient(180deg, #f6fbf8 0%, #eef6f1 100%);
    border: 1px solid #d6e8de;
    border-radius: 14px;
    padding: 16px;
    margin-bottom: 14px;
}
.hafiz-live-head h3 { margin: 0 0 4px; font-size: 16px; display: flex; align-items: center; gap: 8px; }
.hafiz-beta {
    font-size: 10px; letter-spacing: .8px; text-transform: uppercase;
    background: #2bb98a; color: #fff; padding: 2px 6px; border-radius: 999px;
}
.hafiz-live-head p { margin: 0 0 12px; }
.hafiz-live-target {
    font-family: var(--font-quran);
    font-size: clamp(20px, 4vw, 28px);
    line-height: 2;
    text-align: center;
    background: #fff;
    border: 1px solid #e1ebe5;
    border-radius: 10px;
    padding: 14px 12px;
    margin-bottom: 10px;
    color: #1f3b32;
}
.hafiz-live-controls {
    display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
    margin-bottom: 8px;
}
.hafiz-live-interim {
    min-height: 22px;
    font-family: var(--font-quran);
    font-size: 18px;
    color: #5a6f66;
    text-align: right;
    padding: 4px 8px;
}
.hafiz-live-report {
    margin-top: 14px;
    background: #fff;
    border: 1px solid #e1ebe5;
    border-radius: 12px;
    padding: 14px;
}
.hafiz-live-grade {
    display: flex; align-items: center; gap: 14px;
    border-bottom: 1px dashed #e1ebe5;
    padding-bottom: 10px;
    margin-bottom: 12px;
}
.hafiz-live-grade .hafiz-grade {
    font-size: 42px; font-weight: 800; line-height: 1;
    min-width: 56px; text-align: center;
    padding: 8px 12px; border-radius: 12px;
    background: #f0f7f3;
}
.hafiz-live-grade .hafiz-grade[data-tone="great"] { color: #1f8a5c; background: #e7f7ee; }
.hafiz-live-grade .hafiz-grade[data-tone="good"]  { color: #4a8a1f; background: #eff7e3; }
.hafiz-live-grade .hafiz-grade[data-tone="mid"]   { color: #b58508; background: #fdf3d8; }
.hafiz-live-grade .hafiz-grade[data-tone="weak"]  { color: #a83232; background: #fbe3e3; }
.hafiz-live-acc { font-size: 18px; font-weight: 700; color: #1f3b32; }
.hafiz-live-aligned {
    font-family: var(--font-quran);
    font-size: clamp(22px, 4.2vw, 30px);
    line-height: 2.2;
    text-align: center;
    padding: 8px;
    margin-bottom: 12px;
}
.hl-word {
    display: inline-block;
    padding: 2px 8px;
    margin: 2px 3px;
    border-radius: 8px;
    border-bottom: 3px solid transparent;
    cursor: help;
    transition: transform .15s;
}
.hl-word:hover { transform: translateY(-1px); }
.hl-ok   { background: #e7f7ee; border-bottom-color: #2bb98a; color: #14523b; }
.hl-warn { background: #fdf3d8; border-bottom-color: #d4af6a; color: #6d4f08; }
.hl-bad  { background: #fbe3e3; border-bottom-color: #c44;    color: #7d1d1d; }
.hl-miss { background: #f0f0f0; border-bottom-color: #999;    color: #777; text-decoration: line-through; }
.hafiz-live-transcript {
    background: #f6fbf8;
    border: 1px dashed #cfe0d6;
    border-radius: 8px;
    padding: 8px 12px;
    margin-bottom: 12px;
    font-size: 15px;
    line-height: 1.7;
}
.hafiz-live-transcript span[dir="rtl"] {
    font-family: var(--font-quran);
    font-size: 18px;
    margin-right: 6px;
    color: #2a3f37;
}
.hafiz-live-fixes h4 { margin: 8px 0 6px; font-size: 14px; color: #1f3b32; }
.hafiz-live-fixes ol { margin: 0; padding-left: 20px; }
.hafiz-live-fixes li { margin-bottom: 6px; line-height: 1.5; }
.hafiz-live-fixes strong[dir="rtl"], .hafiz-live-fixes em[dir="rtl"] {
    font-family: var(--font-quran); font-size: 18px;
}
.hafiz-audio-details {
    background: #fafafa;
    border: 1px solid #ececec;
    border-radius: 10px;
    padding: 10px 14px;
    margin-top: 8px;
}
.hafiz-audio-details > summary {
    cursor: pointer; font-weight: 600; color: #555;
    list-style: none; padding: 4px 0;
}
.hafiz-audio-details > summary::before { content: '▸ '; transition: transform .2s; display: inline-block; }
.hafiz-audio-details[open] > summary::before { transform: rotate(90deg); }

/* Dark theme */
[data-theme="dark"] .hafiz-live-card { background: linear-gradient(180deg, #142420 0%, #0f1d19 100%); border-color: #25342f; }
[data-theme="dark"] .hafiz-live-target,
[data-theme="dark"] .hafiz-live-report { background: #15211d; border-color: #25342f; color: #e6f0ec; }
[data-theme="dark"] .hafiz-live-grade .hafiz-grade { background: #1f2e29; }
[data-theme="dark"] .hafiz-live-acc { color: #e6f0ec; }
[data-theme="dark"] .hafiz-live-transcript { background: #182522; border-color: #2a3a35; color: #d8e2dd; }
[data-theme="dark"] .hafiz-live-transcript span[dir="rtl"] { color: #e6f0ec; }
[data-theme="dark"] .hl-ok   { background: #1d3a2c; color: #a9e2c1; }
[data-theme="dark"] .hl-warn { background: #3a2f12; color: #f0d489; }
[data-theme="dark"] .hl-bad  { background: #3a1c1c; color: #f0a9a9; }
[data-theme="dark"] .hl-miss { background: #2a2a2a; color: #aaa; }
[data-theme="dark"] .hafiz-audio-details { background: #15211d; border-color: #25342f; }
[data-theme="dark"] .hafiz-audio-details > summary { color: #b8c4be; }

/* Hafiz AI mode toggle + download progress */
.hafiz-ai-toggle {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 6px 10px; border-radius: 999px;
    background: #eef6f1; border: 1px solid #cfe0d6;
    font-size: 12px; font-weight: 600; color: #1f6f5c;
    cursor: pointer; user-select: none;
}
.hafiz-ai-toggle input { margin: 0; accent-color: #1f6f5c; }
.hafiz-ai-toggle:has(input:checked) { background: #1f6f5c; color: #fff; border-color: #1f6f5c; }
.hafiz-ai-progress {
    display: flex; flex-direction: column; gap: 4px;
    margin-top: 8px;
}
.hafiz-ai-bar {
    height: 6px; border-radius: 3px; overflow: hidden;
    background: #e6e1d6;
}
.hafiz-ai-bar > div {
    height: 100%; width: 0%; background: linear-gradient(90deg, #1f6f5c, #4fb89d);
    transition: width .3s ease;
}
[data-theme="dark"] .hafiz-ai-toggle { background: #1c2624; border-color: #2a3431; color: #6dcab2; }
[data-theme="dark"] .hafiz-ai-toggle:has(input:checked) { background: #4fb89d; color: #0f1715; border-color: #4fb89d; }
[data-theme="dark"] .hafiz-ai-bar { background: #2a3431; }

/* ============================================================
   LEARNING HUB, clean, editorial layout
   ============================================================ */
.learn-view { padding: 24px clamp(16px, 4vw, 40px) 100px; max-width: 1240px; margin: 0 auto; }

.learn-header { display: flex; justify-content: space-between; align-items: flex-end; gap: 24px; margin-bottom: 32px; padding-bottom: 24px; border-bottom: 1px solid var(--border, #e5dfd2); flex-wrap: wrap; }
.learn-header h2 { margin: 0 0 6px; font-size: 1.75rem; font-weight: 600; letter-spacing: -0.01em; }
.learn-header > div > p { margin: 0; max-width: 540px; opacity: 0.7; line-height: 1.55; }
.learn-progress-pill { display: inline-flex; align-items: baseline; gap: 6px; padding: 0; background: transparent; border: none; }
.learn-progress-num { font-weight: 600; font-size: 1.4rem; color: var(--accent, #1f6f5c); font-variant-numeric: tabular-nums; }
.learn-progress-label { font-size: 0.78rem; opacity: 0.55; text-transform: lowercase; letter-spacing: 0.02em; }

.learn-shell { display: grid; grid-template-columns: 260px 1fr; gap: 48px; align-items: start; }
@media (max-width: 900px) { .learn-shell { grid-template-columns: 1fr; gap: 28px; } }

/* ---- Sidebar (flat, editorial, no boxes) ---- */
.learn-sidebar { position: sticky; top: 16px; max-height: calc(100vh - 40px); overflow-y: auto; padding-right: 6px; font-size: 0.9rem; }
@media (max-width: 900px) { .learn-sidebar { position: static; max-height: none; } }
.learn-sidebar::-webkit-scrollbar { width: 6px; }
.learn-sidebar::-webkit-scrollbar-thumb { background: var(--border, #d8d0bd); border-radius: 3px; }
.ls-nav { display: flex; flex-direction: column; gap: 28px; }
.ls-part-head { margin-bottom: 8px; }
.ls-part-meta { display: flex; align-items: center; gap: 8px; margin-bottom: 4px; }
.ls-part-tag { font-size: 0.66rem; text-transform: uppercase; letter-spacing: 0.1em; color: var(--accent, #1f6f5c); font-weight: 600; }
.ls-part-count { font-size: 0.68rem; opacity: 0.5; font-variant-numeric: tabular-nums; margin-left: auto; }
.ls-part-title { margin: 0; font-size: 0.92rem; font-weight: 600; line-height: 1.3; opacity: 0.85; }
.ls-lessons { list-style: none; margin: 8px 0 0; padding: 0; border-left: 1px solid var(--border, #e5dfd2); }
.ls-lesson { width: 100%; text-align: left; display: flex; align-items: center; gap: 10px; padding: 7px 12px; border: none; background: transparent; cursor: pointer; font-size: 0.85rem; color: inherit; line-height: 1.4; transition: color 0.12s; position: relative; margin-left: -1px; border-left: 1px solid transparent; }
.ls-lesson:hover { color: var(--accent, #1f6f5c); }
.ls-lesson.active { color: var(--accent, #1f6f5c); font-weight: 600; border-left-color: var(--accent, #1f6f5c); }
.ls-dot { width: 6px; height: 6px; border-radius: 50%; background: transparent; border: 1px solid var(--border, #c8bfa8); flex-shrink: 0; transition: all 0.12s; }
.ls-lesson.done .ls-dot { background: var(--accent, #1f6f5c); border-color: var(--accent, #1f6f5c); }
.ls-lesson.active .ls-dot { background: var(--accent, #1f6f5c); border-color: var(--accent, #1f6f5c); }
.ls-title { flex: 1; }
.ls-min { font-size: 0.7rem; opacity: 0.4; font-variant-numeric: tabular-nums; }

/* ---- Reader (editorial, generous typography) ---- */
.learn-reader { max-width: 720px; margin: 0; padding: 0; background: transparent; border: none; }
.lr-header { margin-bottom: 36px; }
.lr-meta { display: flex; gap: 0; margin-bottom: 14px; font-size: 0.74rem; text-transform: uppercase; letter-spacing: 0.08em; opacity: 0.55; flex-wrap: wrap; align-items: center; }
.lr-meta-item { display: inline-flex; align-items: center; }
.lr-meta-item:not(:last-child)::after { content: '·'; margin: 0 10px; opacity: 0.55; }
.lr-title { margin: 0 0 14px; font-size: 1.95rem; line-height: 1.2; font-weight: 600; letter-spacing: -0.015em; }
.lr-summary { margin: 0; font-size: 1.08rem; line-height: 1.6; opacity: 0.78; font-style: italic; }

.lr-section { margin: 32px 0; }
.lr-section h3 { margin: 0 0 10px; font-size: 1.0rem; font-weight: 600; letter-spacing: -0.005em; }
.lr-section p { margin: 0; line-height: 1.72; font-size: 1.0rem; opacity: 0.88; }

.lr-block { margin: 44px 0; padding: 0; background: transparent; border-radius: 0; border-left: none; }
.lr-block-title { margin: 0 0 18px; font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.14em; color: var(--accent, #1f6f5c); font-weight: 700; padding-bottom: 8px; border-bottom: 1px solid var(--border, #e5dfd2); }

/* Verses, editorial, no boxes */
.lr-verse { margin-bottom: 28px; }
.lr-verse:last-child { margin-bottom: 0; }
.lr-verse-ref { font-size: 0.78rem; font-weight: 600; opacity: 0.55; margin-bottom: 10px; letter-spacing: 0.02em; }
.lr-verse-ar { font-size: 2.6rem; line-height: 2.2; margin: 10px 0 16px; text-align: right; font-weight: 400; }
.lr-verse-tr { margin: 6px 0; opacity: 0.6; font-size: 0.92rem; font-style: italic; line-height: 1.55; }
.lr-verse-en { margin: 8px 0; line-height: 1.6; font-size: 1.0rem; }
.lr-verse-note { margin: 12px 0 0; font-size: 0.92rem; line-height: 1.65; padding-left: 14px; border-left: 2px solid var(--accent, #1f6f5c); opacity: 0.78; }

/* Reflect */
.lr-reflect ul { margin: 0; padding-left: 0; list-style: none; }
.lr-reflect li { margin: 12px 0; line-height: 1.6; font-size: 0.97rem; padding-left: 18px; position: relative; opacity: 0.85; }
.lr-reflect li::before { content: ''; position: absolute; left: 4px; top: 0.7em; width: 5px; height: 5px; border-radius: 50%; background: var(--accent, #1f6f5c); opacity: 0.5; }

/* Quiz */
.lr-q { margin-bottom: 28px; }
.lr-q:last-child { margin-bottom: 0; }
.lr-q-text { margin: 0 0 12px; font-size: 0.97rem; line-height: 1.5; }
.lr-q-num { display: inline-block; min-width: 22px; font-variant-numeric: tabular-nums; opacity: 0.4; font-weight: 600; }
.lr-q-opts { display: flex; flex-direction: column; gap: 6px; }
.lr-q-opt { text-align: left; padding: 10px 14px; border: 1px solid var(--border, #e5dfd2); background: transparent; border-radius: 6px; cursor: pointer; font-size: 0.92rem; transition: all 0.12s; color: inherit; line-height: 1.4; }
.lr-q-opt:hover:not(:disabled) { border-color: var(--accent, #1f6f5c); }
.lr-q-opt.correct { background: rgba(31,111,92,0.08); border-color: var(--accent, #1f6f5c); color: var(--accent, #1f6f5c); font-weight: 500; }
.lr-q-opt.wrong { background: rgba(180,70,70,0.06); border-color: #b34646; color: #b34646; }
.lr-q-opt:disabled { cursor: default; }
.lr-q-fb { margin: 12px 0 0; font-size: 0.85rem; opacity: 0.7; }
.lr-q-fb.ok { color: var(--accent, #1f6f5c); }
.lr-q-fb.no { color: #b34646; }

/* Footer */
.lr-foot { margin-top: 56px; padding-top: 24px; border-top: 1px solid var(--border, #e5dfd2); display: flex; justify-content: space-between; align-items: center; gap: 14px; flex-wrap: wrap; }
.lr-mark { padding: 9px 18px; border: 1px solid var(--accent, #1f6f5c); background: transparent; color: var(--accent, #1f6f5c); border-radius: 6px; cursor: pointer; font-weight: 500; font-size: 0.88rem; transition: all 0.12s; }
.lr-mark:hover { background: var(--accent, #1f6f5c); color: #fff; }
.lr-mark.done { background: var(--accent, #1f6f5c); color: #fff; }
.lr-nav { display: flex; gap: 8px; }
.lr-nav-btn { padding: 9px 14px; border: 1px solid var(--border, #d8d0bd); background: transparent; border-radius: 6px; cursor: pointer; font-size: 0.85rem; color: inherit; font-weight: 500; transition: all 0.12s; }
.lr-nav-btn:hover:not(:disabled) { border-color: var(--accent, #1f6f5c); color: var(--accent, #1f6f5c); }
.lr-nav-btn:disabled { opacity: 0.35; cursor: not-allowed; }
.lr-nav-btn.primary { background: var(--accent, #1f6f5c); color: #fff; border-color: var(--accent, #1f6f5c); }
.lr-nav-btn.primary:hover:not(:disabled) { opacity: 0.9; color: #fff; }

.grammar-tab-cta { background: var(--accent, #1f6f5c) !important; color: #fff !important; border-color: var(--accent, #1f6f5c) !important; margin-left: auto; }

/* Dark theme */
[data-theme="dark"] .learn-header { border-bottom-color: #2a3431; }
[data-theme="dark"] .ls-lessons { border-left-color: #2a3431; }
[data-theme="dark"] .ls-dot { border-color: #3d4845; }
[data-theme="dark"] .lr-block-title { border-bottom-color: #2a3431; }
[data-theme="dark"] .lr-meta-item { border-right-color: #2a3431; }
[data-theme="dark"] .lr-q-opt { border-color: #2a3431; }
[data-theme="dark"] .lr-q-opt.correct { background: rgba(109,202,178,0.1); border-color: #6dcab2; color: #6dcab2; }
[data-theme="dark"] .lr-q-opt.wrong { background: rgba(220,120,120,0.1); border-color: #dc7878; color: #dc7878; }
[data-theme="dark"] .lr-foot { border-top-color: #2a3431; }
[data-theme="dark"] .lr-nav-btn { border-color: #2a3431; }
[data-theme="dark"] .learn-sidebar::-webkit-scrollbar-thumb { background: #2a3431; }

/* ========== LEARNING HUB - Mobile chrome (drawer + sticky bottom nav) ========== */
.learn-mobile-bar { display: none; }
.learn-mobile-nav { display: none; }
.learn-backdrop { display: none; }

@media (max-width: 900px) {
  .learn-mobile-bar {
    display: block;
    position: sticky;
    top: 0;
    z-index: 30;
    background: var(--bg, #f7f3e9);
    padding: 10px 0 12px;
    margin: -8px 0 16px;
  }
  .lmb-toggle {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    background: var(--card, #fff);
    border: 1px solid var(--border, #e6dfcc);
    border-radius: 12px;
    font: inherit;
    color: inherit;
    cursor: pointer;
    text-align: left;
    box-shadow: 0 1px 2px rgba(0,0,0,0.04);
  }
  .lmb-toggle:active { transform: scale(0.99); }
  .lmb-label {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    opacity: 0.55;
    flex-shrink: 0;
  }
  .lmb-current {
    flex: 1;
    font-weight: 600;
    font-size: 0.95rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  .lmb-caret { opacity: 0.5; flex-shrink: 0; }

  .learn-sidebar { display: none; }
  .learn-sidebar.drawer-open {
    display: block;
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    width: min(86vw, 360px);
    max-height: 100vh;
    background: var(--bg, #f7f3e9);
    z-index: 60;
    padding: 24px 20px 80px;
    overflow-y: auto;
    box-shadow: -8px 0 32px rgba(0,0,0,0.15);
    animation: drawerIn 0.22s ease-out;
  }
  @keyframes drawerIn {
    from { transform: translateX(100%); }
    to   { transform: translateX(0); }
  }
  .learn-backdrop.show {
    display: block;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.4);
    z-index: 55;
    animation: fadeIn 0.2s ease-out;
  }
  @keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

  .learn-mobile-nav {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr 1fr;
    gap: 4px;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 40;
    padding: 6px 6px calc(6px + env(safe-area-inset-bottom));
    background: var(--bg, #f7f3e9);
    border-top: 1px solid var(--border, #e6dfcc);
    box-shadow: 0 -2px 12px rgba(0,0,0,0.05);
  }
  .lmn-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    padding: 8px 4px;
    min-height: 52px;
    background: transparent;
    border: none;
    border-radius: 10px;
    font: inherit;
    color: inherit;
    cursor: pointer;
    font-size: 0.72rem;
    line-height: 1.1;
    opacity: 0.85;
  }
  .lmn-btn:active { background: var(--border, #e6dfcc); }
  .lmn-btn:disabled { opacity: 0.3; cursor: not-allowed; }
  .lmn-ico { font-size: 1.15rem; line-height: 1; }
  .lmn-btn.lmn-mark.done { color: var(--accent, #1f6f5c); opacity: 1; }

  .learn-view { padding-bottom: 76px; }
  .lr-foot { display: none; }
}

[data-theme="dark"] .learn-mobile-bar { background: var(--bg); }
[data-theme="dark"] .lmb-toggle { background: #1a201f; border-color: #2a3431; }
[data-theme="dark"] .learn-sidebar.drawer-open { background: var(--bg); }
[data-theme="dark"] .learn-mobile-nav { background: var(--bg); border-top-color: #2a3431; }
[data-theme="dark"] .lmn-btn:active { background: #2a3431; }

/* ============================================================================
 * IQRA - Branding (header + splash)
 * ============================================================================ */
.brand { display: flex; align-items: center; gap: 12px; text-decoration: none; color: inherit; }
.brand-mark { width: 36px; height: 36px; border-radius: 9px; box-shadow: 0 2px 8px rgba(0,0,0,0.12); flex-shrink: 0; }
.brand-text { display: flex; flex-direction: column; line-height: 1.1; }
.brand-title { margin: 0; font-size: 1.35rem; font-weight: 700; letter-spacing: -0.01em; }
.brand-subtitle { margin: 2px 0 0; font-size: 0.74rem; opacity: 0.6; letter-spacing: 0.04em; }
@media (max-width: 640px) { .brand-subtitle { display: none; } .brand-title { font-size: 1.1rem; } }

.splash-icon { width: 128px; height: 128px; border-radius: 28px; box-shadow: 0 12px 40px rgba(0,0,0,0.25); }
.splash-bismillah { margin: 12px 0 0; font-family: 'Amiri Quran', serif; font-size: 1.4rem; opacity: 0.75; }

/* Account chip */
.account-chip {
    display: inline-flex; align-items: center; gap: 8px;
    padding: 6px 12px 6px 6px;
    background: var(--card, #fff);
    border: 1px solid var(--border, #e6dfcc);
    border-radius: 999px;
    font: inherit; color: inherit; cursor: pointer;
    margin-left: 8px;
    transition: background 0.15s ease, border-color 0.15s ease;
}
.account-chip:hover { background: var(--bg-elev, #faf6ec); border-color: var(--accent, #1f6f5c); }
.account-avatar {
    width: 28px; height: 28px; border-radius: 50%;
    display: inline-flex; align-items: center; justify-content: center;
    background: var(--accent, #1f6f5c); color: #fff;
    overflow: hidden; flex-shrink: 0;
    font-size: 0.85rem; font-weight: 600;
}
.account-avatar img { width: 100%; height: 100%; object-fit: cover; }
.account-label { font-size: 0.85rem; font-weight: 500; }
@media (max-width: 640px) { .account-label { display: none; } .account-chip { padding: 4px; } }
[data-theme="dark"] .account-chip { background: #1a201f; border-color: #2a3431; }
[data-theme="dark"] .account-chip:hover { background: #1f2624; border-color: var(--accent, #6dcab2); }

/* Account menu */
.account-menu {
    position: fixed; z-index: 200;
    background: var(--card, #fff);
    border: 1px solid var(--border, #e6dfcc);
    border-radius: 14px;
    padding: 14px;
    min-width: 260px;
    box-shadow: 0 16px 48px rgba(0,0,0,0.18);
}
.acc-head { display: flex; gap: 12px; align-items: center; padding-bottom: 12px; border-bottom: 1px solid var(--border, #e6dfcc); margin-bottom: 10px; }
.acc-avatar-lg {
    width: 48px; height: 48px; border-radius: 50%;
    background: var(--accent, #1f6f5c); color: #fff;
    display: inline-flex; align-items: center; justify-content: center;
    font-weight: 700; font-size: 1.2rem; overflow: hidden; flex-shrink: 0;
}
.acc-avatar-lg img { width: 100%; height: 100%; object-fit: cover; }
.acc-meta { min-width: 0; flex: 1; }
.acc-name { margin: 0; font-weight: 600; font-size: 0.95rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.acc-email { margin: 2px 0 0; font-size: 0.78rem; opacity: 0.6; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.acc-sync { font-size: 0.74rem; opacity: 0.6; padding: 0 4px 8px; }
.acc-item {
    display: block; width: 100%; padding: 10px 12px;
    background: transparent; border: none;
    text-align: left; font: inherit; color: inherit;
    border-radius: 8px; cursor: pointer; font-size: 0.9rem;
}
.acc-item:hover { background: var(--bg-elev, #faf6ec); }
.acc-danger { color: #c0392b; }
[data-theme="dark"] .account-menu { background: #1a201f; border-color: #2a3431; }
[data-theme="dark"] .acc-head { border-bottom-color: #2a3431; }
[data-theme="dark"] .acc-item:hover { background: #232a28; }
[data-theme="dark"] .acc-danger { color: #ef8a7a; }

/* ============================================================================
 * IQRA - Auth modal
 * ============================================================================ */
.auth-modal {
    position: fixed; inset: 0; z-index: 300;
    display: none;
    align-items: center; justify-content: center;
    padding: 16px;
}
.auth-modal.open { display: flex; }
.auth-backdrop {
    position: absolute; inset: 0;
    background: rgba(8,18,16,0.55);
    backdrop-filter: blur(6px);
    animation: fadeIn 0.2s ease-out;
}
.auth-card {
    position: relative;
    width: 100%; max-width: 420px;
    background: var(--surface, #fff);
    color: var(--text, #1c1c1c);
    border: 1px solid var(--border, #e6dfcc);
    border-radius: 18px;
    padding: 28px 24px 22px;
    box-shadow: 0 24px 64px rgba(0,0,0,0.45);
    max-height: 92vh; overflow-y: auto;
    animation: authIn 0.25s ease-out;
}
@keyframes authIn {
    from { opacity: 0; transform: translateY(12px) scale(0.98); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
}
.auth-close {
    position: absolute; top: 10px; right: 10px;
    width: 36px; height: 36px;
    background: transparent; border: none;
    font-size: 1.5rem; line-height: 1; cursor: pointer;
    color: inherit; opacity: 0.5; border-radius: 50%;
}
.auth-close:hover { opacity: 1; background: var(--surface-alt, #faf6ec); }
.auth-brand { text-align: center; margin-bottom: 18px; }
.auth-brand img { border-radius: 14px; margin-bottom: 12px; box-shadow: 0 4px 12px rgba(0,0,0,0.1); }
.auth-brand h2 { margin: 0 0 4px; font-size: 1.4rem; font-weight: 700; }
.auth-sub { margin: 0; opacity: 0.7; font-size: 0.9rem; line-height: 1.5; }

.auth-providers { display: flex; flex-direction: column; gap: 8px; margin-bottom: 16px; }
.auth-prov {
    display: inline-flex; align-items: center; justify-content: center; gap: 10px;
    padding: 11px 16px;
    background: var(--surface, #fff);
    color: var(--text, #1c1c1c);
    border: 1px solid var(--border, #d8d0bd);
    border-radius: 10px;
    font: inherit; font-weight: 500; font-size: 0.92rem;
    cursor: pointer;
    transition: background 0.15s ease, transform 0.05s ease, border-color 0.15s ease;
}
.auth-prov:hover { background: var(--surface-alt, #faf6ec); border-color: var(--accent, #1f6f5c); }
.auth-prov:active { transform: scale(0.99); }
.auth-apple { background: #000; color: #fff; border-color: #000; }
.auth-apple:hover { background: #1a1a1a; }
[data-theme="dark"] .auth-prov { background: #1c2624; border-color: #2f3a37; color: #e8e6e1; }
[data-theme="dark"] .auth-prov:hover { background: #232e2b; border-color: var(--accent, #4fb89d); }

.auth-divider {
    display: flex; align-items: center; gap: 12px;
    margin: 14px 0; opacity: 0.5;
    font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.1em;
}
.auth-divider::before, .auth-divider::after {
    content: ''; flex: 1; height: 1px; background: var(--border, #d8d0bd);
}

.auth-form { display: flex; flex-direction: column; gap: 12px; }
.auth-field { display: flex; flex-direction: column; gap: 4px; }
.auth-field span { font-size: 0.8rem; font-weight: 500; opacity: 0.75; }
.auth-field input {
    padding: 11px 14px;
    background: var(--surface-alt, #faf6ec);
    border: 1px solid var(--border, #d8d0bd);
    border-radius: 10px;
    font: inherit; color: var(--text, #1c1c1c);
    transition: border-color 0.15s ease, background 0.15s ease;
}
.auth-field input::placeholder { color: var(--text-muted, #6b6b6b); opacity: 0.7; }
.auth-field input:focus { outline: none; border-color: var(--accent, #1f6f5c); }
[data-theme="dark"] .auth-field input { background: #111816; border-color: #2f3a37; color: #e8e6e1; }
[data-theme="dark"] .auth-field input::placeholder { color: #7a857f; }

.auth-error {
    margin: 0; padding: 10px 12px;
    background: rgba(220,80,60,0.08);
    border: 1px solid rgba(220,80,60,0.25);
    color: #b3392c;
    border-radius: 8px; font-size: 0.85rem;
}
[data-theme="dark"] .auth-error { color: #ef8a7a; background: rgba(239,138,122,0.06); border-color: rgba(239,138,122,0.2); }

.auth-actions { display: flex; gap: 8px; margin-top: 4px; }
.auth-submit { flex: 1; padding: 12px 16px; font-size: 0.95rem; }
.auth-switch { margin: 0; font-size: 0.85rem; opacity: 0.75; text-align: center; }
.auth-link { background: none; border: none; color: var(--accent, #1f6f5c); font: inherit; cursor: pointer; padding: 0 4px; text-decoration: underline; }
.auth-fineprint { margin: 14px 0 0; font-size: 0.74rem; opacity: 0.75; text-align: center; line-height: 1.55; color: var(--text-muted, #6b6b6b); }
.auth-fineprint a { color: var(--accent, #1f6f5c); text-decoration: underline; text-underline-offset: 2px; }
.auth-fineprint a:hover { color: var(--accent-dark, #18584a); }
[data-theme="dark"] .auth-fineprint { color: #b6bfba; opacity: 0.9; }
[data-theme="dark"] .auth-fineprint a { color: #6dcab2; }
[data-theme="dark"] .auth-sub { color: #b6bfba; opacity: 0.95; }
[data-theme="dark"] .auth-switch { color: #b6bfba; opacity: 0.95; }
[data-theme="dark"] .auth-link { color: #6dcab2; }
[data-theme="dark"] .auth-divider { color: #9aa39f; opacity: 0.7; }
[data-theme="dark"] .auth-divider::before, [data-theme="dark"] .auth-divider::after { background: #2f3a37; }

/* ============================================================================
 * LEARN - Pedagogy blocks (objectives, takeaway, vocab, practice, quiz)
 * ============================================================================ */
.lr-section h3 { display: flex; align-items: baseline; gap: 12px; }
.lr-sec-num {
    font-variant-numeric: tabular-nums;
    font-size: 0.72rem; font-weight: 600;
    color: var(--accent, #1f6f5c);
    letter-spacing: 0.06em;
    opacity: 0.7;
    flex-shrink: 0;
}

.lr-objectives {
    background: linear-gradient(135deg, rgba(31,111,92,0.04), rgba(31,111,92,0.01));
    border: 1px solid rgba(31,111,92,0.15);
    border-radius: 12px;
    padding: 18px 20px;
}
.lr-obj-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 10px; }
.lr-obj-list li { display: flex; align-items: flex-start; gap: 10px; font-size: 0.95rem; line-height: 1.5; }
.lr-obj-tick {
    flex-shrink: 0;
    width: 22px; height: 22px;
    background: var(--accent, #1f6f5c); color: #fff;
    border-radius: 50%;
    display: inline-flex; align-items: center; justify-content: center;
    font-size: 0.8rem; font-weight: 700;
    margin-top: 1px;
}
[data-theme="dark"] .lr-objectives { background: linear-gradient(135deg, rgba(109,202,178,0.06), rgba(109,202,178,0.02)); border-color: rgba(109,202,178,0.18); }

.lr-ladder {
    margin: 30px 0 34px;
    padding: 22px 24px;
    border: 1px solid rgba(31,111,92,0.16);
    border-radius: 18px;
    background:
        radial-gradient(circle at top left, rgba(31,111,92,0.10), transparent 38%),
        linear-gradient(135deg, rgba(31,111,92,0.055), rgba(31,111,92,0.018));
}
.lr-ladder-head { margin-bottom: 18px; }
.lr-ladder-eyebrow {
    display: inline-flex;
    margin-bottom: 8px;
    font-size: 0.68rem;
    font-weight: 800;
    letter-spacing: 0.13em;
    text-transform: uppercase;
    color: var(--accent, #1f6f5c);
}
.lr-ladder h3 { margin: 0; font-size: 1.15rem; line-height: 1.35; letter-spacing: -0.01em; }
.lr-ladder-steps { list-style: none; margin: 0; padding: 0; display: grid; gap: 14px; }
.lr-ladder-steps li { display: grid; grid-template-columns: 30px 1fr; gap: 12px; align-items: start; }
.lr-ladder-num {
    width: 30px; height: 30px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--accent, #1f6f5c);
    color: #fff;
    font-size: 0.82rem;
    font-weight: 800;
    box-shadow: 0 8px 18px rgba(31,111,92,0.18);
}
.lr-ladder-steps strong { display: block; font-size: 0.92rem; margin: 1px 0 4px; }
.lr-ladder-steps p { margin: 0; line-height: 1.62; font-size: 0.94rem; opacity: 0.84; }
[data-theme="dark"] .lr-ladder {
    background: linear-gradient(135deg, rgba(109,202,178,0.08), rgba(109,202,178,0.025));
    border-color: rgba(109,202,178,0.16);
}

.lr-skill {
    margin: 0 0 38px;
    padding: 24px;
    border-radius: 20px;
    background: var(--bg-elev, #fbf7ef);
    border: 1px solid var(--border, #e3dccb);
    box-shadow: 0 16px 36px rgba(43,36,23,0.06);
}
.lr-skill-main { margin-bottom: 18px; }
.lr-skill-eyebrow {
    display: inline-flex;
    margin-bottom: 8px;
    font-size: 0.68rem;
    font-weight: 800;
    letter-spacing: 0.13em;
    text-transform: uppercase;
    color: var(--accent, #1f6f5c);
}
.lr-skill h3 { margin: 0 0 8px; font-size: 1.2rem; line-height: 1.32; }
.lr-skill-main p { margin: 0; line-height: 1.65; opacity: 0.86; }
.lr-skill-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.lr-skill-card {
    padding: 16px;
    border-radius: 14px;
    background: rgba(255,255,255,0.62);
    border: 1px solid rgba(31,111,92,0.10);
}
.lr-skill-card h4 { margin: 0 0 8px; font-size: 0.78rem; letter-spacing: 0.08em; text-transform: uppercase; color: var(--accent, #1f6f5c); }
.lr-skill-card p { margin: 0; line-height: 1.58; font-size: 0.92rem; opacity: 0.84; }
.lr-skill-card ol { margin: 0; padding-left: 18px; display: grid; gap: 6px; }
.lr-skill-card li { line-height: 1.45; font-size: 0.9rem; opacity: 0.86; }
.lr-skill-tools { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.lr-skill-tools span {
    display: inline-flex;
    align-items: center;
    padding: 6px 10px;
    border-radius: 999px;
    background: rgba(31,111,92,0.08);
    color: var(--text);
    font-size: 1.2rem;
    line-height: 1.4;
}
.lr-skill-anchor strong { display: block; margin-bottom: 4px; color: var(--accent, #1f6f5c); }
.lr-skill-anchor span { display: block; }
.lr-skill-card.mastery { background: rgba(31,111,92,0.075); }
.lr-skill-rule { margin-top: 10px !important; font-weight: 600; opacity: 0.92 !important; }
[data-theme="dark"] .lr-skill { background: #161c1b; border-color: #283330; box-shadow: none; }
[data-theme="dark"] .lr-skill-card { background: rgba(255,255,255,0.035); border-color: rgba(109,202,178,0.12); }
[data-theme="dark"] .lr-skill-tools span { background: rgba(109,202,178,0.10); }

.lr-lab {
    margin: 0 0 38px;
    padding: 22px;
    border-radius: 18px;
    background: linear-gradient(135deg, rgba(179,126,43,0.09), rgba(31,111,92,0.035));
    border: 1px solid rgba(179,126,43,0.20);
}
.lr-lab-head { margin-bottom: 16px; }
.lr-lab-eyebrow {
    display: inline-flex;
    margin-bottom: 8px;
    font-size: 0.68rem;
    font-weight: 800;
    letter-spacing: 0.13em;
    text-transform: uppercase;
    color: #9a681d;
}
.lr-lab h3 { margin: 0 0 8px; font-size: 1.16rem; }
.lr-lab-head p { margin: 0; line-height: 1.6; opacity: 0.84; }
.lr-lab-reps { display: grid; gap: 12px; }
.lr-rep {
    display: grid;
    grid-template-columns: 34px 1fr;
    gap: 12px;
    align-items: start;
    padding: 14px;
    border-radius: 14px;
    background: rgba(255,255,255,0.58);
    border: 1px solid rgba(179,126,43,0.14);
}
.lr-rep.done { border-color: rgba(31,111,92,0.32); background: rgba(31,111,92,0.06); }
.lr-rep-step {
    width: 34px; height: 34px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: #b37e2b;
    color: #fff;
    font-weight: 800;
}
.lr-rep.done .lr-rep-step { background: var(--accent, #1f6f5c); }
.lr-rep h4 { margin: 0 0 6px; font-size: 0.95rem; }
.lr-rep p { margin: 0 0 10px; line-height: 1.55; opacity: 0.84; }
.lr-rep p.font-quran { font-size: 1.75rem; line-height: 1.9; text-align: right; opacity: 1; }
.lr-rep-btn {
    border: 1px solid rgba(31,111,92,0.35);
    background: var(--bg, #fffaf1);
    color: var(--accent, #1f6f5c);
    border-radius: 999px;
    padding: 8px 13px;
    font-weight: 800;
    cursor: pointer;
}
.lr-rep-btn:disabled { opacity: 0.75; cursor: default; background: rgba(31,111,92,0.10); }
[data-theme="dark"] .lr-lab { background: linear-gradient(135deg, rgba(179,126,43,0.12), rgba(109,202,178,0.035)); border-color: rgba(179,126,43,0.20); }
[data-theme="dark"] .lr-rep { background: rgba(255,255,255,0.035); border-color: rgba(179,126,43,0.16); }
[data-theme="dark"] .lr-rep.done { background: rgba(109,202,178,0.07); border-color: rgba(109,202,178,0.22); }
[data-theme="dark"] .lr-rep-btn { background: #111716; }

.lr-mastery {
    padding: 20px 22px;
    border-radius: 16px;
    border: 1px solid rgba(31,111,92,0.18);
    background: linear-gradient(135deg, rgba(31,111,92,0.07), rgba(31,111,92,0.025));
}
.lr-mastery-sub { margin: -6px 0 16px; line-height: 1.6; opacity: 0.82; }
.lr-mastery-grid { display: grid; gap: 12px; }
.lr-master-check {
    display: flex;
    gap: 10px;
    align-items: flex-start;
    line-height: 1.5;
    font-size: 0.94rem;
}
.lr-master-check input { margin-top: 4px; accent-color: var(--accent, #1f6f5c); }
.lr-master-explain { display: grid; gap: 8px; font-size: 0.84rem; font-weight: 700; color: var(--accent, #1f6f5c); }
.lr-master-explain textarea {
    width: 100%;
    resize: vertical;
    min-height: 86px;
    border: 1px solid var(--border, #ddd3bf);
    border-radius: 12px;
    padding: 12px 14px;
    background: var(--bg, #fffaf1);
    color: var(--text, #2b2417);
    font: inherit;
    line-height: 1.5;
}
.lr-mastery-status { list-style: none; margin: 16px 0 0; padding: 0; display: grid; gap: 8px; }
.lr-mastery-status li {
    position: relative;
    padding-left: 24px;
    line-height: 1.45;
    font-size: 0.9rem;
    opacity: 0.78;
}
.lr-mastery-status li::before {
    content: '○';
    position: absolute;
    left: 0;
    color: var(--accent, #1f6f5c);
    font-weight: 800;
}
.lr-mastery-status li.done { opacity: 1; font-weight: 600; }
.lr-mastery-status li.done::before { content: '✓'; }
.lr-mastery-result {
    margin: 16px 0 0;
    padding: 10px 12px;
    border-radius: 10px;
    background: rgba(0,0,0,0.04);
    font-weight: 700;
    font-size: 0.92rem;
}
.lr-mastery-result.done { background: rgba(31,111,92,0.12); color: var(--accent, #1f6f5c); }
.lr-mark:disabled,
.lr-nav-btn:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}
[data-theme="dark"] .lr-mastery { background: linear-gradient(135deg, rgba(109,202,178,0.08), rgba(109,202,178,0.025)); border-color: rgba(109,202,178,0.16); }
[data-theme="dark"] .lr-master-explain textarea { background: #111716; border-color: #2a3431; color: var(--text); }
[data-theme="dark"] .lr-mastery-result { background: rgba(255,255,255,0.05); }

.lr-vocab-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 12px; }
.lr-vocab-card {
    background: var(--bg-elev, #faf6ec);
    border: 1px solid var(--border, #e6dfcc);
    border-radius: 10px;
    padding: 14px;
    text-align: center;
}
.lr-vocab-ar { font-size: 1.6rem; margin: 0 0 6px; line-height: 1.4; color: var(--text); }
.lr-vocab-tr { margin: 0 0 4px; font-size: 0.78rem; font-style: italic; opacity: 0.65; letter-spacing: 0.02em; }
.lr-vocab-en { margin: 0; font-weight: 500; font-size: 0.92rem; }
.lr-vocab-note { margin: 6px 0 0; font-size: 0.78rem; opacity: 0.65; line-height: 1.4; }
[data-theme="dark"] .lr-vocab-card { background: #1a201f; border-color: #2a3431; }

.lr-takeaway {
    background: var(--accent, #1f6f5c); color: #fff;
    border-radius: 14px;
    padding: 20px 22px;
    margin: 8px 0;
}
.lr-takeaway-eyebrow {
    margin: 0 0 8px;
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    opacity: 0.8;
    font-weight: 600;
}
.lr-takeaway-text { margin: 0; font-size: 1.05rem; line-height: 1.6; font-weight: 500; }

.lr-practice {
    border-left: 3px solid var(--accent, #1f6f5c);
    padding: 4px 0 4px 16px;
    background: transparent;
}
.lr-practice .lr-block-title { margin-top: 0; }
.lr-practice-text { margin: 0; font-size: 0.96rem; line-height: 1.65; opacity: 0.88; }

.lr-quiz-sub { margin: -6px 0 14px; font-size: 0.85rem; opacity: 0.65; }
.lr-q-why { margin: 8px 0 0; padding: 10px 12px; background: rgba(31,111,92,0.06); border-radius: 8px; font-size: 0.86rem; line-height: 1.5; }
.lr-q-why span { font-weight: 600; color: var(--accent, #1f6f5c); }
[data-theme="dark"] .lr-q-why { background: rgba(109,202,178,0.06); }

.lr-quiz-score {
    margin-top: 16px;
    padding: 12px 14px;
    background: var(--bg-elev, #faf6ec);
    border-radius: 8px;
    font-size: 0.92rem;
    text-align: center;
}
[data-theme="dark"] .lr-quiz-score { background: #1a201f; }


/* ---------- Live-practice drills ---------- */
.lr-drills { background: linear-gradient(180deg, rgba(31,111,92,0.04), transparent); border: 1px solid rgba(31,111,92,0.12); border-radius: 14px; padding: 18px 18px 14px; }
[data-theme="dark"] .lr-drills { background: linear-gradient(180deg, rgba(109,202,178,0.06), transparent); border-color: rgba(109,202,178,0.18); }
.lr-drills-sub { margin: -6px 0 16px; font-size: 0.88rem; opacity: 0.75; line-height: 1.5; }
.lr-drill { background: var(--surface, #fff); border: 1px solid var(--border, rgba(0,0,0,0.08)); border-radius: 12px; padding: 14px 16px; margin-bottom: 12px; }
[data-theme="dark"] .lr-drill { background: var(--surface-alt, #1a201f); border-color: rgba(255,255,255,0.08); }
.lr-drill:last-child { margin-bottom: 0; }
.lr-drill-head { margin-bottom: 12px; }
.lr-drill-tag { display: inline-block; font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.06em; font-weight: 700; color: var(--accent, #1f6f5c); background: rgba(31,111,92,0.1); padding: 3px 8px; border-radius: 999px; margin-bottom: 6px; }
[data-theme="dark"] .lr-drill-tag { color: #6dcab2; background: rgba(109,202,178,0.12); }
.lr-drill-prompt { margin: 4px 0 0; font-size: 0.96rem; line-height: 1.5; font-weight: 500; }
.lr-drill-ref { margin: 0 0 8px; font-size: 0.78rem; opacity: 0.6; font-style: italic; }
.lr-drill-verse, .lr-drill-tagverse { font-size: 2.2rem; line-height: 2.4; margin: 8px 0 12px; padding: 14px 16px; background: rgba(31,111,92,0.04); border-radius: 8px; }
[data-theme="dark"] .lr-drill-verse, [data-theme="dark"] .lr-drill-tagverse { background: rgba(109,202,178,0.05); }
.lr-drill-tr, .lr-drill-en { margin: 0 0 10px; font-size: 0.88rem; opacity: 0.78; line-height: 1.55; }

.lr-tok { display: inline-block; margin: 3px 2px; padding: 4px 9px; font: inherit; background: transparent; border: 2px dashed transparent; border-radius: 6px; cursor: pointer; transition: all 0.15s; color: inherit; }
.lr-tok:hover { border-color: rgba(31,111,92,0.3); }
.lr-tok.selected { border-color: var(--accent, #1f6f5c); background: rgba(31,111,92,0.08); }
.lr-tok.correct { background: rgba(34,153,84,0.18); border-color: #229954; }
.lr-tok.wrong { background: rgba(192,57,43,0.15); border-color: #c0392b; }
[data-theme="dark"] .lr-tok:hover { border-color: rgba(109,202,178,0.4); }
[data-theme="dark"] .lr-tok.selected { border-color: #6dcab2; background: rgba(109,202,178,0.1); }

.lr-drill-foot { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
.lr-drill-btn { padding: 7px 14px; font-size: 0.82rem; font-weight: 600; border: 1px solid var(--accent, #1f6f5c); background: var(--accent, #1f6f5c); color: #fff; border-radius: 7px; cursor: pointer; transition: all 0.15s; }
.lr-drill-btn:hover { filter: brightness(1.08); }
.lr-drill-btn.ghost { background: transparent; color: var(--accent, #1f6f5c); }
[data-theme="dark"] .lr-drill-btn { background: #2a8a72; border-color: #2a8a72; }
[data-theme="dark"] .lr-drill-btn.ghost { background: transparent; color: #6dcab2; border-color: rgba(109,202,178,0.4); }

.lr-drill-fb { margin: 10px 0 0; padding: 8px 12px; border-radius: 7px; font-size: 0.86rem; font-weight: 500; }
.lr-drill-fb.ok { background: rgba(34,153,84,0.12); color: #1e7e3e; }
.lr-drill-fb.no { background: rgba(192,57,43,0.1); color: #c0392b; }
[data-theme="dark"] .lr-drill-fb.ok { color: #6dcab2; background: rgba(109,202,178,0.1); }
[data-theme="dark"] .lr-drill-fb.no { color: #ff8a7a; background: rgba(192,57,43,0.15); }
.lr-drill-explain { margin: 10px 0 0; padding: 10px 12px; background: rgba(31,111,92,0.06); border-radius: 7px; font-size: 0.84rem; line-height: 1.55; }
.lr-drill-explain span { font-weight: 700; color: var(--accent, #1f6f5c); margin-right: 4px; }
[data-theme="dark"] .lr-drill-explain { background: rgba(109,202,178,0.06); }
[data-theme="dark"] .lr-drill-explain span { color: #6dcab2; }

.lr-drill-opts { display: flex; flex-direction: column; gap: 8px; margin-top: 8px; }
.lr-drill-opt { padding: 10px 14px; background: var(--surface-alt, #faf6ec); border: 1.5px solid var(--border, rgba(0,0,0,0.1)); border-radius: 8px; cursor: pointer; font: inherit; color: inherit; text-align: left; transition: all 0.15s; }
.lr-drill-opt:hover:not(:disabled) { border-color: var(--accent, #1f6f5c); }
.lr-drill-opt.correct { background: rgba(34,153,84,0.15); border-color: #229954; }
.lr-drill-opt.wrong { background: rgba(192,57,43,0.12); border-color: #c0392b; }
.lr-drill-opt:disabled { cursor: default; opacity: 0.85; }
[data-theme="dark"] .lr-drill-opt { background: #232a29; border-color: rgba(255,255,255,0.1); }

.lr-fill-blank { display: inline-block; min-width: 90px; border-bottom: 2.5px dashed var(--accent, #1f6f5c); padding: 0 8px; opacity: 0.55; }

.lr-match { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 4px; }
.lr-match-col { display: flex; flex-direction: column; gap: 6px; }
.lr-match-cell { padding: 10px 12px; background: var(--surface-alt, #faf6ec); border: 1.5px solid var(--border, rgba(0,0,0,0.1)); border-radius: 8px; cursor: pointer; font: inherit; color: inherit; text-align: left; transition: all 0.15s; display: flex; flex-direction: column; gap: 2px; }
.lr-match-cell[data-side="ar"] { text-align: right; }
.lr-match-cell .font-quran { font-size: 1.7rem; line-height: 1.7; }
.lr-match-tr { font-size: 0.72rem; opacity: 0.55; font-style: italic; }
.lr-match-cell:hover:not(:disabled) { border-color: var(--accent, #1f6f5c); }
.lr-match-cell.picked { border-color: var(--accent, #1f6f5c); background: rgba(31,111,92,0.08); }
.lr-match-cell.matched { background: rgba(34,153,84,0.12); border-color: #229954; opacity: 0.7; cursor: default; }
.lr-match-cell.wrong { background: rgba(192,57,43,0.12); border-color: #c0392b; }
[data-theme="dark"] .lr-match-cell { background: #232a29; border-color: rgba(255,255,255,0.1); }
[data-theme="dark"] .lr-match-cell.picked { border-color: #6dcab2; background: rgba(109,202,178,0.1); }


/* ---------- App footer ---------- */
.app-footer {
    margin: 48px auto 24px;
    padding: 16px 20px;
    max-width: 880px;
    text-align: center;
    font-size: 0.78rem;
    color: var(--muted, rgba(245, 240, 224, 0.55));
}
.app-footer-line { margin: 0; line-height: 1.8; }
.app-footer-brand { opacity: 0.7; margin-right: 4px; }
.app-footer-sep { opacity: 0.4; margin: 0 6px; }
.app-footer a {
    color: inherit;
    text-decoration: none;
    border-bottom: 1px dotted rgba(212, 178, 110, 0.5);
    padding-bottom: 1px;
    transition: color 0.15s, border-color 0.15s;
}
.app-footer a:hover { color: #d4b26e; border-bottom-color: #d4b26e; }

/* ---------- Legal pages (terms / privacy) ---------- */
body.legal-page {
    background:
        radial-gradient(1100px 600px at 15% -10%, rgba(31, 111, 92, 0.28), transparent 60%),
        radial-gradient(900px 500px at 110% 10%, rgba(212, 178, 110, 0.12), transparent 60%),
        linear-gradient(180deg, #0b1815 0%, #0a1411 100%);
    color: #e8e2d0;
    font-family: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
    line-height: 1.65;
    margin: 0;
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
}
.legal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
    max-width: 880px;
    margin: 0 auto;
    padding: 28px 24px 12px;
}
.legal-header .brand {
    display: flex;
    align-items: center;
    gap: 12px;
    text-decoration: none;
    color: inherit;
}
.legal-header .brand-mark {
    border-radius: 10px;
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.45);
    display: block;
}
.legal-header .brand-title {
    margin: 0;
    font-size: 1.25rem;
    font-weight: 700;
    letter-spacing: 0.02em;
    color: #f5efd9;
}
.legal-header .brand-subtitle {
    margin: 2px 0 0;
    font-size: 0.74rem;
    opacity: 0.6;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}
.legal-nav {
    display: flex;
    gap: 18px;
    font-size: 0.88rem;
}
.legal-nav a {
    color: #d8d2c0;
    text-decoration: none;
    padding: 6px 10px;
    border-radius: 8px;
    transition: background 0.15s, color 0.15s;
}
.legal-nav a:hover { background: rgba(255, 247, 224, 0.06); color: #f5efd9; }
.legal-nav a[aria-current="page"] {
    background: rgba(31, 111, 92, 0.35);
    color: #fff7e0;
}
.legal-main {
    max-width: 760px;
    margin: 0 auto;
    padding: 24px 24px 60px;
}
.legal-article {
    background: rgba(20, 32, 28, 0.55);
    border: 1px solid rgba(255, 247, 224, 0.08);
    border-radius: 18px;
    padding: 36px clamp(20px, 4vw, 44px);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.35);
}
.legal-article .legal-eyebrow {
    margin: 0 0 8px;
    font-size: 0.72rem;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: #d4b26e;
    font-weight: 600;
}
.legal-article h1 {
    margin: 0 0 6px;
    font-size: clamp(1.7rem, 4vw, 2.3rem);
    color: #f5efd9;
    letter-spacing: -0.01em;
    font-weight: 700;
}
.legal-article .legal-updated {
    margin: 0 0 28px;
    font-size: 0.82rem;
    opacity: 0.55;
}
.legal-article section { margin: 26px 0; }
.legal-article h2 {
    margin: 32px 0 10px;
    font-size: 1.1rem;
    color: #fff7e0;
    font-weight: 600;
    letter-spacing: 0.005em;
}
.legal-article h3 {
    margin: 20px 0 6px;
    font-size: 0.98rem;
    color: #ead9a8;
    font-weight: 600;
}
.legal-article p { margin: 10px 0; color: #e3dcc8; }
.legal-article ul { margin: 8px 0 14px; padding-left: 22px; }
.legal-article li { margin: 6px 0; color: #d8d1bb; }
.legal-article a {
    color: #e9c986;
    text-decoration: none;
    border-bottom: 1px dotted rgba(233, 201, 134, 0.5);
    transition: color 0.15s, border-color 0.15s;
}
.legal-article a:hover { color: #fff7e0; border-bottom-color: #fff7e0; }
.legal-article code {
    background: rgba(255, 247, 224, 0.08);
    padding: 1px 6px;
    border-radius: 5px;
    font-size: 0.85em;
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
}
.legal-article strong { color: #fff7e0; font-weight: 600; }
.legal-article .legal-foot-note {
    margin: 36px 0 0;
    text-align: center;
    font-size: 1.4rem;
    color: #d4b26e;
    direction: rtl;
    font-family: 'IqraIndoPak', 'Amiri', 'Scheherazade New', serif;
    line-height: 1.8;
    opacity: 0.75;
}
.legal-footer {
    max-width: 880px;
    margin: 0 auto;
    padding: 0 24px 32px;
    text-align: center;
    font-size: 0.78rem;
    opacity: 0.55;
}
.legal-footer a { color: inherit; text-decoration: underline; text-decoration-color: rgba(212, 178, 110, 0.5); }
.legal-footer a:hover { color: #d4b26e; }
@font-face {
    font-family: 'IqraIndoPak';
    src: url('./assets/fonts/DigitalKhattIndoPak.otf') format('opentype');
    font-display: swap;
}

/* ---------- Drive mode intro / empty-state ---------- */
.drive-intro {
    margin: 14px 16px 0;
    padding: 22px 22px 18px;
    background: linear-gradient(140deg, rgba(31, 111, 92, 0.18), rgba(15, 79, 67, 0.08));
    border: 1px solid rgba(212, 178, 110, 0.28);
    border-radius: 18px;
    color: #e8e2d0;
    position: relative;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    animation: fadeIn 0.25s ease-out;
}
.drive-intro-icon {
    width: 44px; height: 44px;
    border-radius: 12px;
    display: inline-flex; align-items: center; justify-content: center;
    background: rgba(212, 178, 110, 0.18);
    color: #f0d9a3;
    margin-bottom: 10px;
}
.drive-intro-title {
    margin: 0 0 6px;
    font-size: 1.05rem;
    font-weight: 700;
    letter-spacing: 0.005em;
    color: #fff7e0;
}
.drive-intro-lede {
    margin: 0 0 12px;
    font-size: 0.92rem;
    line-height: 1.55;
    color: #d8d2c0;
    opacity: 0.95;
}
.drive-intro-list {
    margin: 0 0 12px;
    padding: 0 0 0 18px;
    font-size: 0.88rem;
    line-height: 1.55;
    color: #cfc8b4;
}
.drive-intro-list li { margin: 6px 0; }
.drive-intro-list strong { color: #fff7e0; font-weight: 600; }
.drive-intro-list em {
    background: rgba(212, 178, 110, 0.18);
    color: #ffd479;
    padding: 1px 6px; border-radius: 5px;
    font-style: normal; font-size: 0.86em; font-weight: 500;
    margin: 0 1px;
}
.drive-intro-cta {
    margin: 0 0 12px;
    font-size: 0.88rem;
    color: #d8d2c0;
}
.drive-intro-link {
    color: #ffd479;
    text-decoration: none;
    border-bottom: 1px dotted rgba(255, 212, 121, 0.5);
    font-weight: 600;
}
.drive-intro-link:hover { color: #fff7e0; border-bottom-color: #fff7e0; }
.drive-intro-close {
    appearance: none;
    background: rgba(255, 247, 224, 0.08);
    border: 1px solid rgba(255, 247, 224, 0.18);
    color: #f5efd9;
    padding: 8px 14px;
    border-radius: 999px;
    font: inherit; font-size: 0.84rem; font-weight: 500;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s;
}
.drive-intro-close:hover { background: rgba(255, 247, 224, 0.14); border-color: rgba(255, 247, 224, 0.3); }

#drive-help.is-on { color: #ffd479; }
@media (max-width: 600px) {
    .drive-intro { margin: 10px 10px 0; padding: 18px 16px 14px; border-radius: 14px; }
    .drive-intro-title { font-size: 1rem; }
    .drive-intro-lede, .drive-intro-list, .drive-intro-cta { font-size: 0.86rem; }
}

/* ---------- Lesson reader: Arabic readability boosts ---------- */
/* Inline Arabic inside lesson section paragraphs, takeaway, reflect, practice etc.
   Any <em>...</em>, <span dir="rtl">, [lang="ar"], or .font-quran inside lesson body
   should render markedly larger than English body text so beginners can actually see
   the diacritics. */
.lr-section p [lang="ar"],
.lr-section p [dir="rtl"],
.lr-section p .font-quran,
.lr-takeaway-text [lang="ar"],
.lr-takeaway-text [dir="rtl"],
.lr-takeaway-text .font-quran,
.lr-reflect li [lang="ar"],
.lr-reflect li [dir="rtl"],
.lr-reflect li .font-quran,
.lr-practice li [lang="ar"],
.lr-practice li [dir="rtl"],
.lr-practice li .font-quran,
.lr-objectives li [lang="ar"],
.lr-objectives li [dir="rtl"],
.lr-objectives li .font-quran,
.lr-q-text [lang="ar"],
.lr-q-text [dir="rtl"],
.lr-q-text .font-quran,
.lr-q-opt [lang="ar"],
.lr-q-opt [dir="rtl"],
.lr-q-opt .font-quran,
.lr-drill-prompt [lang="ar"],
.lr-drill-prompt [dir="rtl"],
.lr-drill-prompt .font-quran,
.lr-drill-explain [lang="ar"],
.lr-drill-explain [dir="rtl"],
.lr-drill-explain .font-quran,
.lr-drill-opt [lang="ar"],
.lr-drill-opt [dir="rtl"],
.lr-drill-opt .font-quran {
    font-size: 1.45em;
    line-height: 1.9;
    vertical-align: -0.08em;
}

/* Vocabulary cards: bigger headline Arabic */
.lr-vocab-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 12px;
}
.lr-vocab-card {
    padding: 14px 16px;
    background: var(--surface-alt, #faf6ec);
    border: 1px solid var(--border, rgba(0,0,0,0.08));
    border-radius: 10px;
}
[data-theme="dark"] .lr-vocab-card { background: #232a29; border-color: rgba(255,255,255,0.08); }
.lr-vocab-ar {
    margin: 0 0 6px;
    font-size: 2rem;
    line-height: 1.7;
    text-align: right;
    direction: rtl;
    font-weight: 400;
}
.lr-vocab-tr { margin: 0 0 4px; font-size: 0.82rem; opacity: 0.62; font-style: italic; }
.lr-vocab-en { margin: 0; font-size: 0.95rem; line-height: 1.45; }
.lr-vocab-note { margin: 6px 0 0; font-size: 0.82rem; opacity: 0.7; line-height: 1.45; }

/* "From last lesson" prereq hook, links progress between lessons */
.lr-prereq {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    margin: 18px 0 4px;
    padding: 12px 16px;
    background: rgba(31,111,92,0.06);
    border-left: 3px solid var(--accent, #1f6f5c);
    border-radius: 0 8px 8px 0;
    font-size: 0.95rem;
    line-height: 1.6;
}
.lr-prereq-tag {
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.07em;
    font-size: 0.68rem;
    color: var(--accent, #1f6f5c);
    white-space: nowrap;
    padding-top: 3px;
    flex-shrink: 0;
}
.lr-prereq-text { margin: 0; opacity: 0.9; }
[data-theme="dark"] .lr-prereq { background: rgba(109,202,178,0.07); }
[data-theme="dark"] .lr-prereq-tag { color: #6dcab2; }

/* Match cell, bigger English label too */
.lr-match-cell { padding: 12px 14px; }
.lr-match-tr { font-size: 0.78rem; }

/* Slightly bigger fill-blank slot to fit larger Arabic */
.lr-fill-blank { min-width: 110px; padding: 0 10px; font-size: 1em; }

@media (max-width: 600px) {
    .lr-verse-ar { font-size: 2.1rem; line-height: 2.0; }
    .lr-drill-verse, .lr-drill-tagverse { font-size: 1.85rem; line-height: 2.1; padding: 12px 12px; }
    .lr-vocab-ar { font-size: 1.7rem; }
    .lr-match-cell .font-quran { font-size: 1.45rem; }
    .lr-skill { padding: 18px; }
    .lr-skill-grid { grid-template-columns: 1fr; }
    .lr-skill-tools span { font-size: 1.08rem; }
    .lr-lab { padding: 18px; }
    .lr-rep { grid-template-columns: 30px 1fr; padding: 12px; }
    .lr-rep-step { width: 30px; height: 30px; }
    .lr-rep p.font-quran { font-size: 1.45rem; }
}

/* Auto-generated grammar lesson pattern tables */
.lesson-pattern {
    width: 100%;
    border-collapse: collapse;
    margin: 12px 0 6px;
    font-size: 0.95rem;
}
.lesson-pattern th, .lesson-pattern td {
    padding: 8px 12px;
    border-bottom: 1px solid var(--border, #e3e0d6);
    text-align: left;
    vertical-align: middle;
}
.lesson-pattern th {
    font-weight: 600;
    color: var(--muted, #7a766c);
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}
.lesson-pattern td:nth-child(2) {
    text-align: center;
    font-size: 1.4rem;
    line-height: 1.4;
    direction: rtl;
    min-width: 110px;
}
.lesson-pattern td:nth-child(3) em {
    color: var(--muted, #7a766c);
    font-style: normal;
}

/* ============================================================
   Home v3 — quiet, magazine-style spiritual dashboard
   ============================================================ */
.home-v3 {
    --hv3-ink:    var(--text);
    --hv3-mute:   #7a8a83;
    --hv3-line:   rgba(31, 111, 92, 0.12);
    --hv3-soft:   rgba(31, 111, 92, 0.05);
    --hv3-emerald:#1f6f5c;
    --hv3-emerald-deep:#0e453b;
    --hv3-gold:   #b6892b;
    --hv3-gold-soft:#f1e6c7;

    max-width: 720px;
    margin: 0 auto;
    padding: 36px 22px 64px;
    display: flex; flex-direction: column;
    gap: 36px;
    text-align: left;
}
@media (prefers-color-scheme: dark) {
    .home-v3 {
        --hv3-mute:   #98a8a2;
        --hv3-line:   rgba(255,255,255,0.10);
        --hv3-soft:   rgba(79,184,157,0.07);
        --hv3-emerald:#4fb89d;
        --hv3-emerald-deep:#7fdcc1;
        --hv3-gold:   #e2c480;
        --hv3-gold-soft:rgba(226,196,128,0.12);
    }
}

/* --- Top: date pill + greeting --- */
.hv3-top { display: flex; flex-direction: column; align-items: flex-start; gap: 10px; }
.hv3-datepill {
    display: inline-flex; align-items: center; gap: 8px;
    padding: 6px 12px; border-radius: 999px;
    background: var(--hv3-soft);
    color: var(--hv3-mute);
    font-size: 12px; letter-spacing: 0.02em;
    font-variant-numeric: tabular-nums;
    border: 1px solid var(--hv3-line);
}
.hv3-datepill .hv3-dot {
    width: 6px; height: 6px; border-radius: 50%;
    background: var(--hv3-emerald);
    box-shadow: 0 0 0 4px rgba(31,111,92,0.10);
    animation: hv3pulse 2.4s ease-in-out infinite;
}
.hv3-datepill .hv3-sep { opacity: 0.45; }
@keyframes hv3pulse {
    0%,100% { box-shadow: 0 0 0 4px rgba(31,111,92,0.10); }
    50%     { box-shadow: 0 0 0 7px rgba(31,111,92,0.04); }
}

.hv3-greet {
    margin: 0;
    font-size: clamp(28px, 4.4vw, 38px);
    font-weight: 600;
    letter-spacing: -0.02em;
    line-height: 1.15;
    color: var(--hv3-ink);
}

/* --- Bismillah --- */
.hv3-bismillah {
    text-align: center;
    margin: 6px 0 0;
    font-family: var(--font-quran);
    font-size: clamp(28px, 5vw, 40px);
    line-height: 1.9;
    color: var(--hv3-emerald-deep);
    font-weight: 500;
    letter-spacing: 0.01em;
}
@media (prefers-color-scheme: dark) {
    .hv3-bismillah { color: var(--hv3-emerald); }
}
.hv3-rule {
    display: block; width: 64px; height: 1px;
    margin: 4px auto 0;
    background: linear-gradient(90deg, transparent, var(--hv3-gold), transparent);
    opacity: 0.7;
}

/* --- Eyebrow label (shared) --- */
.hv3-eyebrow {
    display: inline-block;
    font-size: 10.5px; letter-spacing: 0.18em;
    text-transform: uppercase; font-weight: 700;
    color: var(--hv3-mute);
}
.hv3-eyebrow.gold { color: var(--hv3-gold); }

/* --- Focus block: ring + metrics --- */
.hv3-focus {
    display: grid;
    grid-template-columns: minmax(160px, 200px) 1fr;
    gap: 28px;
    align-items: center;
    padding: 22px 24px;
    background: var(--surface, #fff);
    border: 1px solid var(--hv3-line);
    border-radius: 22px;
    box-shadow: 0 1px 0 rgba(0,0,0,0.02), 0 18px 40px -28px rgba(15,79,67,0.18);
}
.hv3-ringbtn {
    position: relative;
    background: none; border: 0; cursor: pointer;
    width: 100%; aspect-ratio: 1;
    padding: 0; display: grid; place-items: center;
}
.hv3-ring {
    width: 100%; height: 100%;
    transform: rotate(-90deg);
    overflow: visible;
}
.hv3-ring-bg {
    fill: none; stroke: var(--hv3-line);
    stroke-width: 8;
}
.hv3-ring-fg {
    fill: none;
    stroke: url(#hv3RingGrad);
    /* fallback if gradient ref ignored */
    stroke: var(--hv3-emerald);
    stroke-width: 9;
    stroke-linecap: round;
    stroke-dasharray: 326.7;
    stroke-dashoffset: 326.7;
    transition: stroke-dashoffset 0.7s cubic-bezier(.2,.8,.2,1);
    filter: drop-shadow(0 4px 10px rgba(31,111,92,0.18));
}
.hv3-ring-center {
    position: absolute; inset: 0;
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    pointer-events: none;
}
.hv3-ring-num {
    font-size: clamp(34px, 5vw, 46px);
    font-weight: 700; color: var(--hv3-ink);
    letter-spacing: -0.04em; line-height: 1;
    font-variant-numeric: tabular-nums;
}
.hv3-ring-sub {
    margin-top: 6px;
    font-size: 12px; color: var(--hv3-mute);
    letter-spacing: 0.04em;
}

.hv3-metrics {
    list-style: none; margin: 0; padding: 0;
    display: flex; flex-direction: column;
}
.hv3-metrics li + li { border-top: 1px solid var(--hv3-line); }
.hv3-metric {
    width: 100%;
    display: flex; align-items: center; gap: 14px;
    padding: 12px 4px; background: none; border: 0;
    cursor: pointer; text-align: left;
    color: inherit;
    transition: padding-left 0.15s ease, color 0.15s ease;
}
.hv3-metric:hover { padding-left: 8px; color: var(--hv3-emerald); }
.hv3-metric-icon {
    width: 32px; height: 32px;
    display: grid; place-items: center;
    border-radius: 10px;
    background: var(--hv3-soft);
    color: var(--hv3-emerald);
    font-size: 16px; line-height: 1;
}
.hv3-metric-text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.hv3-metric-num {
    font-size: 20px; font-weight: 700; color: var(--hv3-ink);
    letter-spacing: -0.02em; line-height: 1.1;
    font-variant-numeric: tabular-nums;
    display: inline-flex; align-items: baseline; gap: 1px;
}
.hv3-metric-unit { font-size: 12px; font-weight: 600; color: var(--hv3-mute); margin-left: 2px; }
.hv3-metric-lbl {
    font-size: 12.5px; color: var(--hv3-mute);
    letter-spacing: 0.02em;
}
.hv3-metric-aside { font-size: 11px; opacity: 0.75; margin-left: 4px; }
.hv3-chev {
    color: var(--hv3-mute); font-size: 22px; line-height: 1;
    opacity: 0.5; transition: transform 0.15s ease, opacity 0.15s ease;
}
.hv3-metric:hover .hv3-chev { transform: translateX(3px); opacity: 1; color: var(--hv3-emerald); }

/* --- Continue / Begin row (no big hero) --- */
.hv3-continue {
    position: relative;
    padding: 22px 24px 22px 30px;
    background: var(--surface, #fff);
    border: 1px solid var(--hv3-line);
    border-radius: 18px;
    overflow: hidden;
}
.hv3-continue::before {
    content: ''; position: absolute; left: 0; top: 16px; bottom: 16px;
    width: 3px; border-radius: 2px;
    background: linear-gradient(180deg, var(--hv3-emerald), var(--hv3-gold));
}
.hv3-cont-row {
    display: flex; align-items: center; gap: 18px;
    margin-top: 10px; flex-wrap: wrap;
}
.hv3-cont-text { flex: 1; min-width: 220px; }
.hv3-cont-title {
    margin: 0 0 4px;
    font-size: clamp(18px, 2.4vw, 22px);
    font-weight: 600;
    letter-spacing: -0.01em;
    color: var(--hv3-ink);
}
.hv3-cont-arabic {
    margin: 4px 0;
    font-family: var(--font-quran);
    font-size: clamp(22px, 3vw, 28px);
    line-height: 1.7;
    color: var(--hv3-emerald-deep);
    font-weight: 500;
}
@media (prefers-color-scheme: dark) {
    .hv3-cont-arabic { color: var(--hv3-emerald); }
}
.hv3-cont-meta {
    margin: 4px 0 0;
    font-size: 13px; color: var(--hv3-mute); line-height: 1.5;
}
.hv3-cont-actions {
    display: flex; gap: 8px; flex-wrap: wrap;
}

/* --- Pill buttons --- */
.hv3-pill {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 10px 18px; border-radius: 999px;
    font-size: 13.5px; font-weight: 600;
    cursor: pointer;
    border: 1px solid transparent;
    transition: transform 0.12s ease, background 0.15s ease, box-shadow 0.15s ease, color 0.15s ease;
    letter-spacing: 0.005em;
    white-space: nowrap;
}
.hv3-pill.solid {
    background: var(--hv3-emerald-deep);
    color: #fff7e0;
    box-shadow: 0 6px 18px -6px rgba(15,79,67,0.45);
}
.hv3-pill.solid:hover {
    background: var(--hv3-emerald);
    transform: translateY(-1px);
    box-shadow: 0 10px 22px -8px rgba(31,111,92,0.5);
}
.hv3-pill.ghost {
    background: transparent;
    color: var(--hv3-ink);
    border-color: var(--hv3-line);
}
.hv3-pill.ghost:hover {
    background: var(--hv3-soft);
    color: var(--hv3-emerald);
    border-color: var(--hv3-emerald);
}
@media (prefers-color-scheme: dark) {
    .hv3-pill.solid {
        background: var(--hv3-emerald);
        color: #0a1614;
        box-shadow: 0 6px 18px -6px rgba(0,0,0,0.5);
    }
    .hv3-pill.solid:hover { background: var(--hv3-emerald-deep); color: #0a1614; }
}

/* --- Verse of the day (quote style) --- */
.hv3-vod {
    position: relative;
    padding: 28px 24px 24px;
    text-align: center;
    background:
        radial-gradient(ellipse at top, var(--hv3-gold-soft), transparent 70%),
        var(--surface, #fff);
    border: 1px solid var(--hv3-line);
    border-radius: 22px;
    overflow: hidden;
}
.hv3-quote {
    position: absolute; top: -8px; left: 18px;
    font-family: 'Georgia', serif;
    font-size: 110px; line-height: 1;
    color: var(--hv3-gold);
    opacity: 0.35;
    pointer-events: none;
    user-select: none;
}
.hv3-vod-arabic {
    font-family: var(--font-quran);
    font-size: clamp(24px, 3.6vw, 32px);
    line-height: 2.1;
    margin: 14px 0 16px;
    color: var(--hv3-ink);
    word-wrap: break-word;
    font-weight: 500;
}
.hv3-vod-trans {
    font-size: 14px; line-height: 1.65;
    color: var(--hv3-mute);
    margin: 0 auto 18px;
    max-width: 520px;
    font-style: italic;
}
.hv3-vod-actions { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; }

/* --- 7-day bars --- */
.hv3-week {
    padding: 18px 22px 14px;
    background: var(--surface, #fff);
    border: 1px solid var(--hv3-line);
    border-radius: 18px;
}
.hv3-week-head {
    display: flex; justify-content: space-between; align-items: baseline;
    margin-bottom: 12px;
}
.hv3-week-total {
    font-size: 14px; color: var(--hv3-ink); font-weight: 500;
    font-variant-numeric: tabular-nums;
    display: inline-flex; align-items: baseline; gap: 4px;
}
.hv3-week-total b { font-size: 18px; font-weight: 700; letter-spacing: -0.01em; }
.hv3-week-unit { font-size: 11.5px; color: var(--hv3-mute); letter-spacing: 0.03em; }
.hv3-bars {
    width: 100%; height: 64px; display: block;
    overflow: visible;
}
.hv3-bars .spark-bar {
    fill: var(--hv3-emerald);
    opacity: 0.92;
    rx: 2;
}
.hv3-bars .spark-bar.dim { opacity: 0.22; }
.hv3-bars .spark-label { font-size: 9px; fill: var(--hv3-mute); letter-spacing: 0.04em; }

/* --- Quick action chips --- */
.hv3-chips {
    display: flex; flex-wrap: wrap; gap: 8px;
    justify-content: flex-start;
}
.hv3-chip {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 9px 14px; border-radius: 999px;
    font-size: 13px; font-weight: 500;
    background: var(--surface, #fff);
    color: var(--hv3-ink);
    border: 1px solid var(--hv3-line);
    cursor: pointer;
    transition: background 0.15s ease, border-color 0.15s ease, transform 0.12s ease, color 0.15s ease;
}
.hv3-chip span { color: var(--hv3-emerald); font-size: 14px; line-height: 1; }
.hv3-chip:hover {
    background: var(--hv3-soft);
    border-color: var(--hv3-emerald);
    color: var(--hv3-emerald);
    transform: translateY(-1px);
}

/* --- Responsive --- */
@media (max-width: 560px) {
    .home-v3 { padding: 22px 16px 56px; gap: 28px; }
    .hv3-focus {
        grid-template-columns: 1fr;
        padding: 22px 18px;
        gap: 18px;
        text-align: center;
    }
    .hv3-ringbtn { max-width: 180px; margin: 0 auto; }
    .hv3-metric { padding: 12px 6px; }
    .hv3-continue { padding: 20px 18px 20px 24px; }
    .hv3-cont-actions { width: 100%; }
    .hv3-cont-actions .hv3-pill { flex: 1; justify-content: center; }
    .hv3-vod { padding: 24px 18px 20px; }
    .hv3-quote { font-size: 80px; left: 10px; }
}
@media (prefers-reduced-motion: reduce) {
    .hv3-datepill .hv3-dot { animation: none; }
    .hv3-ring-fg, .hv3-pill, .hv3-chip, .hv3-metric, .hv3-chev { transition: none; }
}

/* ============================================================
   Salāh / Qibla / Du'ās · Khatm planner · Ramaḍān mode  (v3.43)
   Uses the app's [data-theme="dark"] variables so cards always
   match the active theme.
   ============================================================ */

/* ---- Salāh view ---- */
.salah-view { max-width: 720px; margin: 0 auto; padding: 18px 16px 96px; color: var(--text); }
.salah-head { display: flex; flex-direction: column; gap: 4px; margin: 4px 0 16px; }
.salah-title { margin: 0; font-size: 26px; letter-spacing: -.01em; color: var(--text); }
.salah-sub   { margin: 0; color: var(--text-muted); font-size: 14px; }

.salah-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 18px;
    padding: 18px 20px;
    margin-bottom: 14px;
    box-shadow: var(--shadow);
    color: var(--text);
}
.salah-card .salah-h {
    margin: 0 0 8px; font-size: 12px; letter-spacing: .14em;
    text-transform: uppercase; color: var(--text-muted); font-weight: 600;
}
.salah-card .muted { color: var(--text-muted); }

.salah-loc-card .salah-loc-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 14px; }
.salah-loc-card .hv3-pill { flex: 1 1 auto; min-width: 140px; justify-content: center; }

/* Now block + prayer rows */
.salah-now {
    display: grid; grid-template-columns: auto 1fr auto; align-items: baseline;
    column-gap: 12px; padding: 4px 2px 14px; margin-bottom: 12px;
    border-bottom: 1px dashed var(--border);
}
.salah-now .hv3-eyebrow { font-size: 11px; letter-spacing: .14em; text-transform: uppercase; color: var(--text-muted); }
.salah-now-name { margin: 0; font-size: 22px; font-weight: 700; letter-spacing: -.01em; color: var(--text); }
.salah-now-cd   { margin: 0; color: var(--text-muted); font-variant-numeric: tabular-nums; }
.salah-times    { display: grid; grid-template-columns: 1fr; gap: 0; }
.salah-row {
    display: flex; align-items: baseline; justify-content: space-between;
    padding: 12px 6px; border-top: 1px solid var(--border);
}
.salah-row:first-child { border-top: 0; }
.salah-row-name { color: var(--text); font-weight: 500; }
.salah-row-time { color: var(--text-muted); font-variant-numeric: tabular-nums; }
.salah-row.is-current .salah-row-name::before { content: "•  "; color: var(--accent); }
.salah-row.is-next {
    background: var(--accent-soft);
    border-radius: 12px; padding-left: 12px; padding-right: 12px;
    margin: 2px 0;
}
.salah-row.is-next + .salah-row { border-top-color: transparent; }
.salah-row.is-next .salah-row-name { color: var(--accent); font-weight: 700; }
.salah-row.is-next .salah-row-time { color: var(--accent); font-weight: 600; }

/* ---- Qibla compass: SVG dial + bezel + alignment glow ---- */
.qibla-wrap {
    display: flex; gap: 22px; align-items: center; flex-wrap: wrap;
    justify-content: center;
}
.qibla-compass {
    --qf-bezel-1: #e6e1d6;
    --qf-bezel-2: #c9c3b6;
    --qf-bezel-edge: rgba(0,0,0,.16);
    --qf-face-top: #fbfaf6;
    --qf-face-bot: #ece6d6;
    --qf-rim: rgba(0,0,0,.08);
    --qf-tick: #6b6b6b;
    --qf-letter: #2a2a2a;
    --qf-deg: #888;
    --qf-south: #888;
    --qf-hub: #2a2a2a;
    --qf-hub-ring: #f5f1e7;
    --qf-front: var(--accent);
    position: relative; flex: 0 0 240px;
    width: 240px; height: 240px;
    border-radius: 50%;
    background: linear-gradient(145deg, var(--qf-bezel-1), var(--qf-bezel-2));
    box-shadow:
        0 1px 0 rgba(255,255,255,.7) inset,
        0 -1px 0 var(--qf-bezel-edge) inset,
        0 12px 28px rgba(0,0,0,.18),
        0 2px 6px rgba(0,0,0,.08);
    padding: 14px;
}
[data-theme="dark"] .qibla-compass {
    --qf-bezel-1: #2a3431;
    --qf-bezel-2: #1c2624;
    --qf-bezel-edge: rgba(0,0,0,.5);
    --qf-face-top: #1c2624;
    --qf-face-bot: #11181a;
    --qf-rim: rgba(255,255,255,.08);
    --qf-tick: #c9d3cf;
    --qf-letter: #e8e6e1;
    --qf-deg: #8a958f;
    --qf-south: #555c5a;
    --qf-hub: #e8e6e1;
    --qf-hub-ring: #11181a;
    box-shadow:
        0 1px 0 rgba(255,255,255,.05) inset,
        0 -1px 0 rgba(0,0,0,.6) inset,
        0 12px 32px rgba(0,0,0,.55),
        0 2px 6px rgba(0,0,0,.3);
}
.qibla-bezel {
    position: absolute; inset: 0; border-radius: 50%; pointer-events: none;
    display: flex; align-items: flex-start; justify-content: center;
    z-index: 3;
}
.qibla-front-pointer {
    margin-top: -2px;
    color: var(--qf-front);
    font-size: 22px; line-height: 1;
    text-shadow: 0 1px 2px rgba(0,0,0,.25);
    filter: drop-shadow(0 0 2px rgba(31,111,92,.45));
}
.qibla-dial-svg {
    position: relative; width: 100%; height: 100%; display: block;
    transition: transform .35s cubic-bezier(.22,.61,.36,1);
    will-change: transform;
}
.qibla-dial-svg .qf-letter { font-size: 14px; letter-spacing: .04em; }
.qibla-dial-svg .qf-letter.qf-n { font-size: 16px; }
.qibla-dial-svg .qf-needle, .qibla-dial-svg .qf-kaaba {
    transform-origin: 0 0;
    transition: transform .35s cubic-bezier(.22,.61,.36,1);
}
.qibla-dial-svg .qf-kaaba {
    filter: drop-shadow(0 1px 2px rgba(31,111,92,.35));
}
.qibla-aligned-ring {
    position: absolute; inset: 6px; border-radius: 50%; pointer-events: none;
    box-shadow: 0 0 0 0 rgba(52, 192, 138, 0); transition: box-shadow .35s ease;
    z-index: 2;
}
.qibla-compass.is-aligned .qibla-aligned-ring {
    box-shadow:
        0 0 0 2px rgba(52, 192, 138, .65),
        0 0 28px 4px rgba(52, 192, 138, .45) inset;
    animation: qfAlignedPulse 1.6s ease-in-out infinite;
}
@keyframes qfAlignedPulse {
    0%, 100% { box-shadow: 0 0 0 2px rgba(52,192,138,.55), 0 0 18px 2px rgba(52,192,138,.35) inset; }
    50%      { box-shadow: 0 0 0 3px rgba(52,192,138,.85), 0 0 32px 6px rgba(52,192,138,.55) inset; }
}
.qibla-deg {
    position: absolute; left: 50%; bottom: 26px; transform: translateX(-50%);
    font: 600 12px/1 ui-monospace, SFMono-Regular, Menlo, monospace;
    letter-spacing: .08em; color: var(--text-muted);
    background: var(--surface); padding: 3px 8px; border-radius: 999px;
    border: 1px solid var(--border); z-index: 4;
}

.qibla-readout { flex: 1 1 220px; display: flex; flex-direction: column; gap: 4px; }
.qibla-readout-eyebrow { font-size: 11px; letter-spacing: .14em; text-transform: uppercase; color: var(--text-muted); }
.qibla-readout .big {
    font-size: 38px; font-weight: 700; letter-spacing: -.02em; color: var(--text);
    font-variant-numeric: tabular-nums;
}
.qibla-readout .muted { margin: 4px 0 8px; color: var(--text-muted); }
.qibla-aligned-msg {
    margin: 4px 0 6px; padding: 6px 10px; display: inline-block;
    background: var(--accent-soft); color: var(--accent);
    font-weight: 600; border-radius: 999px; font-size: 13px;
    align-self: flex-start;
    animation: qfAlignedFade .25s ease-out;
}
@keyframes qfAlignedFade { from { opacity: 0; transform: translateY(-2px); } to { opacity: 1; transform: none; } }
.qibla-readout .hv3-pill { margin-top: 4px; align-self: flex-start; }

/* ---- Du'ās (bigger, more legible) ---- */
.salah-duas-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.dua-card { padding: 6px 2px 4px; }
.dua-arabic {
    direction: rtl; text-align: right;
    font-size: 32px; line-height: 2.05;
    font-family: var(--font-quran);
    color: var(--text);
    margin: 14px 0 18px;
}
.dua-trans {
    font-size: 16px; line-height: 1.65; font-style: italic;
    color: var(--text); opacity: .9;
    margin: 0 0 12px;
}
.dua-en {
    font-size: 16px; line-height: 1.6;
    color: var(--text); margin: 0 0 12px;
}
.dua-src   { font-size: 12px; color: var(--text-muted); letter-spacing: .02em; }
.dua-pills { list-style: none; padding: 0; margin: 14px 0 4px; display: flex; flex-wrap: wrap; gap: 6px; }
.dua-pills li {
    cursor: pointer; padding: 6px 12px; border-radius: 999px;
    border: 1px solid var(--border); font-size: 13px; color: var(--text-muted);
    user-select: none; background: var(--surface-alt);
    transition: background .15s ease, color .15s ease, border-color .15s ease;
}
.dua-pills li:hover { color: var(--text); border-color: var(--accent); }
.dua-pills li.is-on { background: var(--accent); color: #fff; border-color: var(--accent); }

/* ---- Khatm card on home + standalone setup btn ---- */
.khatm-card {
    grid-column: 1 / -1;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 18px;
    padding: 16px 18px;
    box-shadow: var(--shadow);
    color: var(--text);
}
.khatm-head { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; margin-bottom: 6px; }
.khatm-eyebrow { font-size: 11px; letter-spacing: .14em; text-transform: uppercase; color: var(--text-muted); }
.khatm-label { font-weight: 600; color: var(--text); }
.khatm-meta { display: flex; flex-wrap: wrap; gap: 14px; font-size: 13px; color: var(--text); margin: 6px 0 10px; }
.khatm-meta .muted { color: var(--text-muted); }
.khatm-meta .khatm-dot { color: var(--border); padding: 0 2px; }
.khatm-bar { height: 8px; background: var(--surface-alt); border: 1px solid var(--border); border-radius: 999px; overflow: hidden; }
.khatm-bar-fill { height: 100%; width: 0%; background: linear-gradient(90deg, var(--accent), var(--warn)); transition: width .35s ease; }
.khatm-actions { display: flex; gap: 8px; margin-top: 12px; flex-wrap: wrap; }
.khatm-actions .hv3-pill { flex: 1 1 auto; justify-content: center; min-width: 90px; }
.khatm-note { margin: 10px 0 0; font-size: 13px; color: var(--text-muted); }
.khatm-setup-btn { grid-column: 1 / -1; margin-top: 4px; }

/* ---- Ramaḍān banner + skin ---- */
.ramadan-banner {
    grid-column: 1 / -1; position: relative; overflow: hidden;
    background: linear-gradient(135deg, #1d3b2a 0%, #2a553a 50%, #5b4a1f 100%);
    color: #fdfaf0; border-radius: 20px; padding: 18px 20px; margin-bottom: 12px;
    box-shadow: var(--shadow);
}
.ramadan-stars {
    position: absolute; inset: 0; pointer-events: none; opacity: .45;
    background-image:
        radial-gradient(1px 1px at 20% 30%, #fff, transparent 60%),
        radial-gradient(1px 1px at 70% 60%, #fff, transparent 60%),
        radial-gradient(1.5px 1.5px at 45% 80%, #fff, transparent 60%),
        radial-gradient(1px 1px at 85% 20%, #fff, transparent 60%),
        radial-gradient(1.2px 1.2px at 10% 70%, #fff, transparent 60%);
}
.ramadan-body { position: relative; z-index: 1; }
.ramadan-eyebrow { font-size: 11px; letter-spacing: .18em; text-transform: uppercase; color: #ffd98a; }
.ramadan-title { margin: 4px 0 12px; font-size: 22px; font-weight: 700; letter-spacing: -.01em; }
.ramadan-rings { display: flex; gap: 10px; flex-wrap: wrap; }
.ramadan-ring-btn {
    flex: 1 1 100px; min-width: 96px;
    background: rgba(255,255,255,.08); border: 1px solid rgba(255,255,255,.18);
    color: inherit; border-radius: 14px; padding: 10px 8px; cursor: pointer;
    display: flex; flex-direction: column; align-items: center; gap: 4px;
    transition: background .15s ease, transform .15s ease;
}
.ramadan-ring-btn:hover { background: rgba(255,255,255,.14); }
.ramadan-ring-btn:active { transform: scale(.97); }
.ramadan-ring-num { font-size: 20px; font-weight: 700; letter-spacing: -.01em; }
.ramadan-ring-lbl { font-size: 11px; letter-spacing: .12em; text-transform: uppercase; opacity: .85; }

body.ramadan-mode .hv3-ring-fg { stroke: var(--accent); }
body.ramadan-mode .hv3-greeting-name,
body.ramadan-mode .hv3-bismillah { color: var(--accent); }
body.ramadan-mode .hv3-vod { border-color: rgba(31,111,92,.3); }

/* ---- Modals (loc + khatm) ---- */
.iqra-modal { position: fixed; inset: 0; z-index: 80; display: none; align-items: flex-end; justify-content: center; }
.iqra-modal.is-open { display: flex; }
.iqra-modal-backdrop { position: absolute; inset: 0; background: rgba(0,0,0,.5); }
.iqra-modal-card {
    position: relative; width: min(480px, 100%); max-height: 86vh; overflow: auto;
    background: var(--surface); color: var(--text);
    border: 1px solid var(--border); border-bottom: 0;
    border-top-left-radius: 20px; border-top-right-radius: 20px;
    padding: 20px 20px 28px;
    box-shadow: 0 -10px 40px rgba(0,0,0,.25);
    animation: iqraSheetIn .22s ease-out;
}
@keyframes iqraSheetIn { from { transform: translateY(20px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }
.iqra-modal-card h3 { margin: 0 0 6px; font-size: 18px; color: var(--text); }
.iqra-modal-card .muted { font-size: 13px; color: var(--text-muted); }
.iqra-modal-close {
    position: absolute; top: 10px; right: 10px; width: 36px; height: 36px;
    border: 0; background: transparent; font-size: 22px; line-height: 1; cursor: pointer;
    color: var(--text-muted); border-radius: 50%;
}
.iqra-modal-close:hover { background: var(--surface-alt); color: var(--text); }
.iqra-form-row { display: flex; flex-direction: column; gap: 4px; margin: 14px 0; }
.iqra-form-row label { font-size: 12px; letter-spacing: .04em; color: var(--text-muted); text-transform: uppercase; }
.iqra-form-row input, .iqra-form-row select {
    padding: 10px 12px; font: inherit; color: var(--text);
    border: 1px solid var(--border); border-radius: 10px;
    background: var(--surface-alt);
}
.iqra-form-row input:focus, .iqra-form-row select:focus {
    outline: none; border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-soft);
}
.loc-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.iqra-modal-actions { display: flex; gap: 8px; margin-top: 8px; }
.iqra-modal-actions .hv3-pill { flex: 1; justify-content: center; }

@media (max-width: 520px) {
    .qibla-compass { width: 220px; height: 220px; flex-basis: 220px; }
    .ramadan-title { font-size: 19px; }
    .dua-arabic { font-size: 28px; line-height: 1.95; }
    .qibla-readout .big { font-size: 32px; }
}

/* ============================================================
   iOS / Capacitor performance + native feel  (v3.44)
   ============================================================ */

/* Promote interactive / animated layers to the GPU so iOS can compose
   them without re-rasterising on every scroll tick. */
.bottom-nav, .app-header, .qibla-dial-svg, .qibla-compass,
.hv3-ring-fg, .hv3-pill, .ramadan-banner, .iqra-modal-card {
    transform: translateZ(0);
    -webkit-backface-visibility: hidden;
    backface-visibility: hidden;
}

/* Faster, lighter shadows on small screens — heavy box-shadows tank
   scroll performance on iPhones. */
@media (max-width: 720px) {
    .salah-card, .khatm-card, .iqra-modal-card {
        box-shadow: 0 1px 2px rgba(0,0,0,.06);
    }
    [data-theme="dark"] .salah-card,
    [data-theme="dark"] .khatm-card,
    [data-theme="dark"] .iqra-modal-card {
        box-shadow: 0 1px 2px rgba(0,0,0,.4);
    }
}

/* Prevent the body from rubber-band scrolling past content; the nested
   .view scrollers stay smooth. */
@supports (-webkit-touch-callout: none) {
    body { overscroll-behavior: none; }
    .view { -webkit-overflow-scrolling: touch; }
}

/* Status bar overlay: the Capacitor StatusBar plugin (overlaysWebView=true)
   hands us the inset; we already paint it via body::before. Make the
   sticky header sit flush below it without a second gap. */
.app-header { padding-top: env(safe-area-inset-top, 0px); }

/* The Capacitor "platform-ios" body class is set by JS at boot. Use it
   to nudge platform-specific touch targets up to Apple's 44 pt minimum. */
body.platform-ios .nav-btn,
body.platform-ios .bnav-btn { min-height: 44px; }
body.platform-ios .hv3-pill { min-height: 40px; }

/* Animations get cut down on Reduce Motion (accessibility). */
@media (prefers-reduced-motion: reduce) {
    .qibla-dial-svg, .qibla-dial-svg .qf-needle, .qibla-dial-svg .qf-kaaba {
        transition: none !important;
    }
    .qibla-compass.is-aligned .qibla-aligned-ring { animation: none !important; }
}
